ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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\Refinery;
6 
8 
14 interface Constraint extends Transformation
15 {
25  public function check($value);
26 
33  public function accepts($value);
34 
43  public function problemWith($value);
44 
55  public function applyTo(Result $result) : Result;
56 
70  public function withProblemBuilder(callable $builder);
71 }
$result
problemWith($value)
Tells what the problem with the provided value is.
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:11
A constraint encodes some resrtictions on values.
Definition: Constraint.php:14
applyTo(Result $result)
Restricts a Result.
accepts($value)
Tells if the provided value complies.
check($value)
Checks the provided value.
A transformation is a function from one datatype to another.
$builder
Definition: parser.php:5