ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
LogicalOr.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 namespace ILIAS\Refinery\Logical;
22 
24 use ILIAS\Data;
25 use ilLanguage;
26 
27 class LogicalOr extends Constraint
28 {
35  public function __construct(array $other, Data\Factory $data_factory, ilLanguage $lng)
36  {
38  static function ($value) use ($other): bool {
39  foreach ($other as $constraint) {
40  if ($constraint->accepts($value)) {
41  return true;
42  }
43  }
44 
45  return false;
46  },
47  static function ($value) use ($other): string {
48  $problems = [];
49 
50  foreach ($other as $constraint) {
51  $problems[] = $constraint->getErrorMessage($value);
52  }
53 
54  return 'Please fix one of these: ' . implode(', ', array_filter($problems));
55  },
56  $data_factory,
57  $lng
58  );
59  }
60 }
__construct(array $other, Data\Factory $data_factory, ilLanguage $lng)
LogicalOr constructor.
Definition: LogicalOr.php:35
$lng
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Group.php:21