Expanded class hierarchy of GetterMetadata
class GetterMetadata extends MemberMetadata {
/**
* Constructor.
*
* @param string $class The class the getter is defined on
* @param string $property The property which the getter returns
*
* @throws ValidatorException
*/
public function __construct($class, $property) {
$getMethod = 'get' . ucfirst($property);
$isMethod = 'is' . ucfirst($property);
if (method_exists($class, $getMethod)) {
$method = $getMethod;
}
elseif (method_exists($class, $isMethod)) {
$method = $isMethod;
}
else {
throw new ValidatorException(sprintf('Neither method %s nor %s exists in class %s', $getMethod, $isMethod, $class));
}
parent::__construct($class, $method, $property);
}
/**
* {@inheritDoc}
*/
public function getPropertyValue($object) {
return $this
->newReflectionMember($object)
->invoke($object);
}
/**
* {@inheritDoc}
*/
protected function newReflectionMember($objectOrClassName) {
return new \ReflectionMethod($objectOrClassName, $this
->getName());
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ElementMetadata:: |
public | property | ||
ElementMetadata:: |
public | property | ||
ElementMetadata:: |
public | function | Returns the constraints of the given group and global ones (* group). | |
ElementMetadata:: |
public | function | Returns all constraints of this element. | |
ElementMetadata:: |
public | function | Returns whether this element has any constraints. | |
ElementMetadata:: |
public | function | Clones this object. | |
GetterMetadata:: |
public | function |
Extracts the value of the property from the given container. Overrides PropertyMetadataInterface:: |
|
GetterMetadata:: |
protected | function |
Creates a new Reflection instance for the member Overrides MemberMetadata:: |
|
GetterMetadata:: |
public | function |
Constructor. Overrides MemberMetadata:: |
|
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
private | property | ||
MemberMetadata:: |
public | function |
Implementation of the Visitor design pattern. Overrides MetadataInterface:: |
|
MemberMetadata:: |
public | function |
Adds a constraint to this element. Overrides ElementMetadata:: |
|
MemberMetadata:: |
public | function |
Returns the class this member is defined on Overrides ClassBasedInterface:: |
|
MemberMetadata:: |
public | function | Returns the name of the member | |
MemberMetadata:: |
public | function |
Returns the name of the property this member belongs to Overrides PropertyMetadataInterface:: |
|
MemberMetadata:: |
public | function | Returns the Reflection instance of the member | |
MemberMetadata:: |
public | function | Returns whether objects stored in this member should be validated | |
MemberMetadata:: |
public | function | Returns whether arrays or traversable objects stored in this member should be traversed and validated in each entry | |
MemberMetadata:: |
public | function | Returns whether arrays or traversable objects stored in this member should be traversed recursively for inner arrays/traversable objects | |
MemberMetadata:: |
public | function | Returns whether this member is private | |
MemberMetadata:: |
public | function | Returns whether this member is protected | |
MemberMetadata:: |
public | function | Returns whether this member is public | |
MemberMetadata:: |
public | function |
Returns the names of the properties that should be serialized Overrides ElementMetadata:: |