ILIAS  release_8 Revision v8.24
Constraint.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21namespace ILIAS\Refinery;
22
24use UnexpectedValueException;
25
31interface Constraint extends Transformation
32{
42 public function check($value);
43
50 public function accepts($value): bool;
51
60 public function problemWith($value): ?string;
61
72 public function applyTo(Result $result): Result;
73
87 public function withProblemBuilder(callable $builder): self;
88}
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:15
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: ByTrying.php:21