Expanded class hierarchy of StaticMethodLoader
class StaticMethodLoader implements LoaderInterface {
protected $methodName;
public function __construct($methodName = 'loadValidatorMetadata') {
$this->methodName = $methodName;
}
/**
* {@inheritDoc}
*/
public function loadClassMetadata(ClassMetadata $metadata) {
/** @var \ReflectionClass $reflClass */
$reflClass = $metadata
->getReflectionClass();
if (!$reflClass
->isInterface() && $reflClass
->hasMethod($this->methodName)) {
$reflMethod = $reflClass
->getMethod($this->methodName);
if (!$reflMethod
->isStatic()) {
throw new MappingException(sprintf('The method %s::%s should be static', $reflClass->name, $this->methodName));
}
if ($reflMethod
->getDeclaringClass()->name != $reflClass->name) {
return false;
}
$reflMethod
->invoke(null, $metadata);
return true;
}
return false;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StaticMethodLoader:: |
protected | property | ||
StaticMethodLoader:: |
public | function |
Load a Class Metadata. Overrides LoaderInterface:: |
|
StaticMethodLoader:: |
public | function |