ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
LogicalOr.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 
26 class LogicalOr extends Constraint
27 {
34  public function __construct(array $other, Data\Factory $data_factory, \ILIAS\Language\Language $lng)
35  {
37  static function ($value) use ($other): bool {
38  foreach ($other as $constraint) {
39  if ($constraint->accepts($value)) {
40  return true;
41  }
42  }
43 
44  return false;
45  },
46  static function ($value) use ($other): string {
47  $problems = [];
48 
49  foreach ($other as $constraint) {
50  $problems[] = $constraint->getErrorMessage($value);
51  }
52 
53  return 'Please fix one of these: ' . implode(', ', array_filter($problems));
54  },
55  $data_factory,
56  $lng
57  );
58  }
59 }
Interface Observer Contains several chained tasks and infos about them.
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
__construct(array $other, Data\Factory $data_factory, \ILIAS\Language\Language $lng)
LogicalOr constructor.
Definition: LogicalOr.php:34
Builds data types.
Definition: Factory.php:35
__construct(Container $dic, ilPlugin $plugin)
global $lng
Definition: privfeed.php:31