ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Parallel.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 2017 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3 
5 
7 use ILIAS\Data;
9 
10 class Parallel extends Custom implements Constraint
11 {
15  protected $constraints;
16 
24 
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 ($txt, $value) {
42  $messages = [];
43  foreach ($this->failed_constraints as $key => $constraint) {
44  $messages[] = $constraint->getErrorMessage($value);
45  }
46 
47  return implode(" ", $messages);
48  },
50  $lng
51  );
52  }
53 }
A constraint encodes some resrtictions on values.
Definition: Constraint.php:14
$messages
Definition: en.php:5
__construct(array $constraints, Data\Factory $data_factory, \ilLanguage $lng)
Definition: Parallel.php:25
Builds data types.
Definition: Factory.php:14
$txt
Definition: error.php:11
$ret
Definition: parser.php:6
language handling
$key
Definition: croninfo.php:18