ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Constraint.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 2017 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3 /* Copyright (c) 2017 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 namespace ILIAS\Validation;
6 
8 
14 interface Constraint
15 {
25  public function check($value);
26 
33  public function accepts($value);
34 
43  public function problemWith($value);
44 
55  public function restrict(Result $result);
56 
67  public function withProblemBuilder(callable $builder);
68 }
restrict(Result $result)
Restricts a Result.
$result
A constraint encodes some resrtictions on values.
Definition: Constraint.php:14
problemWith($value)
Tells what the problem with the provided value is.
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:11
check($value)
Checks the provided value.
accepts($value)
Tells if the provided value complies.
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.