45        if (!is_callable(
$error)) {
 
   60    final public function check($value)
 
   74        return call_user_func($this->is_ok, $value);
 
   99        if ($problem !== 
null) {
 
  100            $error = $this->data_factory->error($problem);
 
  112        $clone = clone $this;
 
  125        return call_user_func($this->
error, $lng_closure, $value);
 
  137            $args = func_get_args();
 
  138            if (count($args) < 1) {
 
  139                throw new \InvalidArgumentException(
 
  140                    "Expected an id of a lang var as first parameter" 
  143            $error = $this->lng->txt($args[0]);
 
  144            if (count($args) > 1) {
 
  146                for (
$i = 0; 
$i < count($args); 
$i++) {
 
  148                    if ((is_array($v) || is_object($v) || is_null($v))
 
  149                    && !method_exists($v, 
"__toString")) {
 
  152                        } elseif (is_null($v)) {
 
  155                            $args[
$i] = get_class($v);
 
  159                $error = call_user_func_array(
"sprintf", $args);
 
An exception for terminatinating execution or to throw for unit testing.
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...
__construct(callable $is_ok, $error, Data\Factory $data_factory, \ilLanguage $lng)
If $error is a callable it needs to take two parameters:
getLngClosure()
Get the closure to be passed to the error-function that does i18n and sprintf.
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.