ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
4 namespace ILIAS\Refinery\Logical;
5 
7 use ILIAS\Data;
8 
9 class Parallel extends Constraint
10 {
14  protected $constraints;
15 
23 
24  public function __construct(array $constraints, Data\Factory $data_factory, \ilLanguage $lng)
25  {
26  $this->constraints = $constraints;
28  function ($value) {
29  $ret = true;
30  $this->failed_constraints = array();
31  foreach ($this->constraints as $constraint) {
32  if (!$constraint->accepts($value)) {
33  $this->failed_constraints[] = $constraint;
34  $ret = false;
35  }
36  }
37 
38  return $ret;
39  },
40  function ($txt, $value) {
41  $messages = [];
42  foreach ($this->failed_constraints as $key => $constraint) {
43  $messages[] = $constraint->getErrorMessage($value);
44  }
45 
46  return implode(" ", $messages);
47  },
48  $data_factory,
49  $lng
50  );
51  }
52 }
__construct(array $constraints, Data\Factory $data_factory, \ilLanguage $lng)
Definition: Parallel.php:24
A constraint encodes some resrtictions on values.
Definition: Constraint.php:14
$messages
Definition: xapiexit.php:5
$lng
Builds data types.
Definition: Factory.php:19
$txt
Definition: error.php:13
__construct(Container $dic, ilPlugin $plugin)
$ret
Definition: parser.php:6
language handling