ILIAS  release_7 Revision v7.30-3-g800a261c036
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
5namespace ILIAS\Refinery;
6
8
14interface 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
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.
applyTo(Result $result)
Restricts a Result.
check($value)
Checks the provided value.
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 transformation is a function from one datatype to another.
$builder
Definition: parser.php:5