|
ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
A constraint encodes some resrtictions on values. More...
Inheritance diagram for ILIAS\Validation\Constraint:
Collaboration diagram for ILIAS\Validation\Constraint:Public Member Functions | |
| check ($value) | |
| Checks the provided value. More... | |
| accepts ($value) | |
| Tells if the provided value complies. More... | |
| problemWith ($value) | |
| Tells what the problem with the provided value is. More... | |
| restrict (Result $result) | |
| Restricts a Result. More... | |
| withProblemBuilder (callable $builder) | |
| Get a constraint like this one with a builder for a custom error message. More... | |
A constraint encodes some resrtictions on values.
Constraints MUST NOT modify the supplied value.
Definition at line 14 of file Constraint.php.
| ILIAS\Validation\Constraint::accepts | ( | $value | ) |
Tells if the provided value complies.
| mixed | $value |
Implemented in ILIAS\Validation\Constraints\Custom.
Referenced by ILIAS\Validation\Constraints\IsArrayOf\__construct().
Here is the caller graph for this function:| ILIAS\Validation\Constraint::check | ( | $value | ) |
Checks the provided value.
Should not throw if accepts($value).
UnexpectedValueException if value does not comply with encoded constraint.
| mixed | $value |
Implemented in ILIAS\Validation\Constraints\Custom.
| ILIAS\Validation\Constraint::problemWith | ( | $value | ) |
Tells what the problem with the provided value is.
Should return null if accepts($value).
| mixed | $value |
Implemented in ILIAS\Validation\Constraints\Custom.
Referenced by ILIAS\Validation\Constraints\IsArrayOf\__construct().
Here is the caller graph for this function:| ILIAS\Validation\Constraint::restrict | ( | Result | $result | ) |
Restricts a Result.
Must do nothing with the result if $result->isError(). Must replace the result with an error according to problemWith() if !accepts($result->value()).
| Result | $result |
Implemented in ILIAS\Validation\Constraints\Custom.
Referenced by ILIAS\UI\Implementation\Component\Input\Field\Input\setAdditionalConstraint().
Here is the caller graph for this function:| ILIAS\Validation\Constraint::withProblemBuilder | ( | callable | $builder | ) |
Get a constraint like this one with a builder for a custom error message.
problemWith() must return an error message according to the new builder for the new constraint.
The builder needs to be callable that takes two parameters:
| callable | $builder |
Implemented in ILIAS\Validation\Constraints\Custom.