ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LogicalOr.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\Data;
25
26class 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}
Builds data types.
Definition: Factory.php:36
__construct(array $other, Data\Factory $data_factory, \ILIAS\Language\Language $lng)
LogicalOr constructor.
Definition: LogicalOr.php:34
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31