ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
LogicalOr.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\Refinery\Custom\Constraint as CustomConstraint;
25use ILIAS\Data;
26
27class LogicalOr extends CustomConstraint
28{
32 public function __construct(array $other, Data\Factory $data_factory, \ILIAS\Language\Language $lng)
33 {
35 static function ($value) use ($other): bool {
36 foreach ($other as $constraint) {
37 if ($constraint->accepts($value)) {
38 return true;
39 }
40 }
41
42 return false;
43 },
44 static function ($value) use ($other): string {
45 $problems = [];
46
47 foreach ($other as $constraint) {
48 $problems[] = $constraint->getErrorMessage($value);
49 }
50
51 return 'Please fix one of these: ' . implode(', ', array_filter($problems));
52 },
53 $data_factory,
54 $lng
55 );
56 }
57}
Builds data types.
Definition: Factory.php:36
__construct(array $other, Data\Factory $data_factory, \ILIAS\Language\Language $lng)
Definition: LogicalOr.php:32
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