ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Parallel.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\Data;
25
26class Parallel extends Constraint
27{
34 protected array $failed_constraints;
35
41 public function __construct(array $constraints, Data\Factory $data_factory, \ILIAS\Language\Language $lng)
42 {
44 function ($value) use ($constraints): bool {
45 $ret = true;
46 $this->failed_constraints = [];
47 foreach ($constraints as $constraint) {
48 if (!$constraint->accepts($value)) {
49 $this->failed_constraints[] = $constraint;
50 $ret = false;
51 }
52 }
53
54 return $ret;
55 },
56 function ($txt, $value): string {
57 $messages = [];
58 foreach ($this->failed_constraints as $constraint) {
59 $messages[] = $constraint->getErrorMessage($value);
60 }
61
62 return implode(" ", $messages);
63 },
64 $data_factory,
65 $lng
66 );
67 }
68}
Builds data types.
Definition: Factory.php:36
__construct(array $constraints, Data\Factory $data_factory, \ILIAS\Language\Language $lng)
Definition: Parallel.php:41
$txt
Definition: error.php:31
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
$messages
Definition: xapiexit.php:21