ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
6
8
14interface 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
70 public function withProblemBuilder(callable $builder);
71}
$result
An exception for terminatinating execution or to throw for unit testing.
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:12
A constraint encodes some resrtictions on values.
Definition: Constraint.php:15
accepts($value)
Tells if the provided value complies.
problemWith($value)
Tells what the problem with the provided value is.
restrict(Result $result)
Restricts a Result.
check($value)
Checks the provided value.
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.
$builder
Definition: parser.php:5