Validator
class Validator (View source)
Validatable object constraints validator.
Constants
private CLASS_ATTRIBUTE |
|
private CONSTANT_ATTRIBUTE |
|
private METHOD_ATTRIBUTE |
|
private PROPERTY_ATTRIBUTE |
|
Properties
protected Constraint> | $constraints | Validatable object constraints. |
|
protected Result> | $errors | Validatable object validation errors. |
|
static protected Reflector|Reflector[]> | $reflections | Validatable objects reflections cache. |
|
protected Result> | $results | Validatable object validation results. |
Methods
Checks object constraints and throws an exception if validation failed.
Checks attributes of the passed validatable object reflection.
Checks constraints of the passed validatable object reflection.
Returns object constraints validation errors.
Returns a unique identifier for the specifed reflection class name.
Returns object constraints validation results.
Validates object constraints and returns validation results.
Validates class attributes of the passed validatable object reflection.
Validates constants attributes of the passed validatable object reflection.
Validates methods attributes of the passed validatable object reflection.
Validates properties attributes of the passed validatable object reflection.
Details
__construct(ValidatableObjectInterface $object)
Validator constructor.
void
check()
Checks object constraints and throws an exception if validation failed.
protected void
checkAttributes(array $attributes, string $type, string $name, mixed $value, string|null $cacheKey = null)
Checks attributes of the passed validatable object reflection.
protected void
checkConstraint(Constraint $constraint, string $type, string $name, mixed $value)
Checks constraints of the passed validatable object reflection.
private never
fail(Result ...$violation)
No description
array
getErrors()
Returns object constraints validation errors.
private string
getMemoizationKey(string $reflection, string $target = 'class', string $prefix = '::', string $suffix = '')
Returns a unique identifier for the specifed reflection class name.
array
getResults()
Returns object constraints validation results.
array
validate()
Validates object constraints and returns validation results.
protected void
validateClass(ReflectionClass $reflection)
Validates class attributes of the passed validatable object reflection.
protected void
validateConstants(ReflectionClass $reflection)
Validates constants attributes of the passed validatable object reflection.
protected void
validateMethods(ReflectionClass $reflection)
Validates methods attributes of the passed validatable object reflection.
protected void
validateProperties(ReflectionClass $reflection)
Validates properties attributes of the passed validatable object reflection.