ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ILIAS\Validation\Constraints\Parallel Class Reference
+ Inheritance diagram for ILIAS\Validation\Constraints\Parallel:
+ Collaboration diagram for ILIAS\Validation\Constraints\Parallel:

Public Member Functions

 __construct (array $constraints, Data\Factory $data_factory)
 
- Public Member Functions inherited from ILIAS\Validation\Constraints\Custom
 __construct (callable $is_ok, $error, Data\Factory $data_factory)
 
 check ($value)
 Checks the provided value.Should not throw if accepts($value).
Exceptions
More...
 
 accepts ($value)
 Tells if the provided value complies.
Parameters
mixed$value
Returns
bool
More...
 
 problemWith ($value)
 Tells what the problem with the provided value is.Should return null if accepts($value).
Parameters
mixed$value
Returns
string|null
More...
 
 restrict (Result $result)
 Restricts a Result.Must do nothing with the result if $result->isError(). Must replace the result with an error according to problemWith() if !accepts($result->value()).
Parameters
Result$value
Returns
Result
More...
 
 withProblemBuilder (callable $builder)
 Get a constraint like this one with a builder for a custom error message.problemWith() must return an error message according to the new builder for the new constraint.
Parameters
callable$buildermixed -> string
Returns
Constraint
More...
 
 getErrorMessage ($value)
 Get the problem message. More...
 

Protected Attributes

 $constraints
 
 $failed_constraints
 
- Protected Attributes inherited from ILIAS\Validation\Constraints\Custom
 $data_factory
 
 $is_ok
 
 $error
 

Detailed Description

Definition at line 10 of file Parallel.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Validation\Constraints\Parallel::__construct ( array  $constraints,
Data\Factory  $data_factory 
)

Definition at line 25 of file Parallel.php.

References ILIAS\Validation\Constraints\Parallel\$constraints, ILIAS\Validation\Constraints\Custom\$data_factory, $key, $message, $ret, and array.

26  {
27  $this->constraints = $constraints;
28  parent::__construct(
29  function ($value) {
30  $ret = true;
31  $this->failed_constraints = array();
32  foreach ($this->constraints as $constraint) {
33  if (!$constraint->accepts($value)) {
34  $this->failed_constraints[] = $constraint;
35  $ret = false;
36  }
37  }
38 
39  return $ret;
40  },
41  function ($value) {
42  $message = "";
43  foreach ($this->failed_constraints as $key => $constraint) {
44  $message .= $constraint->getErrorMessage($value);
45  }
46 
47  return $message;
48  },
50  );
51  }
catch(Exception $e) $message
Create styles array
The data for the language used.
$ret
Definition: parser.php:6
$key
Definition: croninfo.php:18

Field Documentation

◆ $constraints

ILIAS\Validation\Constraints\Parallel::$constraints
protected

Definition at line 15 of file Parallel.php.

Referenced by ILIAS\Validation\Constraints\Parallel\__construct().

◆ $failed_constraints

ILIAS\Validation\Constraints\Parallel::$failed_constraints
protected

Definition at line 23 of file Parallel.php.


The documentation for this class was generated from the following file: