34        if (!is_callable(
$error)) {
 
   48    final public function check($value)
 
   62        return call_user_func($this->is_ok, $value);
 
   87        if ($problem !== 
null) {
 
   88            $error = $this->data_factory->error($problem);
 
  100        $clone = clone $this;
 
  112        return call_user_func($this->
error, $value);
 
An exception for terminatinating execution or to throw for unit testing.
__construct(callable $is_ok, $error, Data\Factory $data_factory)
accepts($value)
Tells if the provided value complies.bool
problemWith($value)
Tells what the problem with the provided value is.Should return null if accepts($value)....
check($value)
Checks the provided value.Should not throw if accepts($value).UnexpectedValueException if value does ...
restrict(Result $result)
Restricts a Result.Must do nothing with the result if $result->isError(). Must replace the result wit...
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.problemWith() must return an...
getErrorMessage($value)
Get the problem message.
error($a_errmsg)
set error message @access public
A result encapsulates a value or an error and simplifies the handling of those.
value()
Get the encapsulated value.
A constraint encodes some resrtictions on values.