67 final public function check($value)
81 return call_user_func($this->is_ok, $value);
106 if ($problem !== null) {
107 $error = $this->data_factory->error($problem);
applyTo(Result $result)
Restricts a Result.Must do nothing with the result if $result->isError(). Must replace the result wit...
accepts($value)
Tells if the provided value complies.bool
value()
Get the encapsulated value.
isError()
Get to know if the result is an error.
check($value)
Checks the provided value.Should not throw if accepts($value).
A result encapsulates a value or an error and simplifies the handling of those.
trait DeriveTransformFromApplyTo
trait DeriveInvokeFromTransform
__construct(callable $is_ok, $error, Data\Factory $data_factory, \ilLanguage $lng)
If $error is a callable it needs to take two parameters:
getErrorMessage($value)
Get the problem message.
problemWith($value)
Tells what the problem with the provided value is.Should return null if accepts($value).string|null