GetterMetadata
extends MemberMetadata
in package
Stores all metadata needed for validating a class property via its getter method.
A property getter is any method that is equal to the property's name, prefixed with "get", "is" or "has". That method will be used to access the property's value.
The getter will be invoked by reflection, so the access of private and protected getters is supported.
This class supports serialization and cloning.
Tags
Table of Contents
- $reflMember : array<string|int, ReflectionMethod>|array<string|int, ReflectionProperty>
- __clone() : mixed
- Clones this object.
- __construct() : mixed
- __sleep() : array<string|int, string>
- Returns the names of the properties that should be serialized.
- addConstraint() : $this
- Adds a constraint.
- addConstraints() : $this
- Adds an list of constraints.
- findConstraints() : array<string|int, Constraint>
- Returns all constraints for a given validation group.
- getAutoMappingStrategy() : int
- getCascadingStrategy() : int
- Returns the strategy for cascading objects.
- getClassName() : mixed
- {@inheritdoc}
- getConstraints() : array<string|int, Constraint>
- Returns all constraints of this element.
- getName() : string
- Returns the name of the member.
- getPropertyName() : string
- Returns the name of the property.
- getPropertyValue() : mixed
- {@inheritdoc}
- getReflectionMember() : ReflectionMethod|ReflectionProperty
- Returns the reflection instance for accessing the member's value.
- getTraversalStrategy() : int
- Returns the strategy for traversing traversable objects.
- hasConstraints() : bool
- Returns whether this element has any constraints.
- isPrivate() : bool
- Returns whether this member is private.
- isProtected() : bool
- Returns whether this member is protected.
- isPublic() : bool
- Returns whether this member is public.
- newReflectionMember() : ReflectionMethod|ReflectionProperty
- Creates a new reflection instance for accessing the member's value.
- checkConstraint() : mixed
- configureLengthConstraints() : void
Properties
$reflMember
private
array<string|int, ReflectionMethod>|array<string|int, ReflectionProperty>
$reflMember
= []
Methods
__clone()
Clones this object.
public
__clone() : mixed
Return values
mixed —__construct()
public
__construct(string $class, string $property[, string|null $method = null ]) : mixed
Parameters
- $class : string
-
The class the getter is defined on
- $property : string
-
The property which the getter returns
- $method : string|null = null
-
The method that is called to retrieve the value being validated (null for auto-detection)
Tags
Return values
mixed —__sleep()
Returns the names of the properties that should be serialized.
public
__sleep() : array<string|int, string>
Return values
array<string|int, string> —addConstraint()
Adds a constraint.
public
addConstraint(Constraint $constraint) : $this
If the constraint is added, the cascading strategy will be changed to . Depending on the $traverse property of that constraint, the traversal strategy will be set to one of the following:
Parameters
- $constraint : Constraint
Tags
Return values
$this —addConstraints()
Adds an list of constraints.
public
addConstraints(array<string|int, Constraint> $constraints) : $this
Parameters
- $constraints : array<string|int, Constraint>
-
The constraints to add
Return values
$this —findConstraints()
Returns all constraints for a given validation group.
public
findConstraints(mixed $group) : array<string|int, Constraint>
Aware of the global group (* group).
Parameters
- $group : mixed
-
The validation group
Return values
array<string|int, Constraint> —A list of constraint instances
getAutoMappingStrategy()
public
getAutoMappingStrategy() : int
Tags
Return values
int —getCascadingStrategy()
Returns the strategy for cascading objects.
public
getCascadingStrategy() : int
Return values
int —The cascading strategy
getClassName()
{@inheritdoc}
public
getClassName() : mixed
Return values
mixed —getConstraints()
Returns all constraints of this element.
public
getConstraints() : array<string|int, Constraint>
Return values
array<string|int, Constraint> —A list of Constraint instances
getName()
Returns the name of the member.
public
getName() : string
Return values
string —getPropertyName()
Returns the name of the property.
public
getPropertyName() : string
Return values
string —The property name
getPropertyValue()
{@inheritdoc}
public
getPropertyValue(mixed $object) : mixed
Parameters
- $object : mixed
Return values
mixed —getReflectionMember()
Returns the reflection instance for accessing the member's value.
public
getReflectionMember(object|string $objectOrClassName) : ReflectionMethod|ReflectionProperty
Parameters
- $objectOrClassName : object|string
-
The object or the class name
Return values
ReflectionMethod|ReflectionProperty —The reflection instance
getTraversalStrategy()
Returns the strategy for traversing traversable objects.
public
getTraversalStrategy() : int
Return values
int —The traversal strategy
hasConstraints()
Returns whether this element has any constraints.
public
hasConstraints() : bool
Return values
bool —isPrivate()
Returns whether this member is private.
public
isPrivate(object|string $objectOrClassName) : bool
Parameters
- $objectOrClassName : object|string
-
The object or the class name
Return values
bool —isProtected()
Returns whether this member is protected.
public
isProtected(object|string $objectOrClassName) : bool
Parameters
- $objectOrClassName : object|string
-
The object or the class name
Return values
bool —isPublic()
Returns whether this member is public.
public
isPublic(object|string $objectOrClassName) : bool
Parameters
- $objectOrClassName : object|string
-
The object or the class name
Return values
bool —newReflectionMember()
Creates a new reflection instance for accessing the member's value.
protected
newReflectionMember(mixed $objectOrClassName) : ReflectionMethod|ReflectionProperty
Parameters
- $objectOrClassName : mixed
-
The object or the class name
Return values
ReflectionMethod|ReflectionProperty —The reflection instance
checkConstraint()
private
checkConstraint(Constraint $constraint) : mixed
Parameters
- $constraint : Constraint
Return values
mixed —configureLengthConstraints()
private
configureLengthConstraints(array<string|int, mixed> $constraints) : void
Parameters
- $constraints : array<string|int, mixed>