ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
Parallel.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Refinery\Logical;
22 
24 use ILIAS\Data;
25 use ilLanguage;
26 
27 class Parallel extends Constraint
28 {
35  protected array $failed_constraints;
36 
42  public function __construct(array $constraints, Data\Factory $data_factory, ilLanguage $lng)
43  {
45  function ($value) use ($constraints): bool {
46  $ret = true;
47  $this->failed_constraints = [];
48  foreach ($constraints as $constraint) {
49  if (!$constraint->accepts($value)) {
50  $this->failed_constraints[] = $constraint;
51  $ret = false;
52  }
53  }
54 
55  return $ret;
56  },
57  function ($txt, $value): string {
58  $messages = [];
59  foreach ($this->failed_constraints as $constraint) {
60  $messages[] = $constraint->getErrorMessage($value);
61  }
62 
63  return implode(" ", $messages);
64  },
65  $data_factory,
66  $lng
67  );
68  }
69 }
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
$messages
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: xapiexit.php:22
__construct(array $constraints, Data\Factory $data_factory, ilLanguage $lng)
Definition: Parallel.php:42
__construct(VocabulariesInterface $vocabularies)
$lng
$txt
Definition: error.php:14
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...