ILIAS  release_8 Revision v8.24
Parallel.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
24use ILIAS\Data;
25use ilLanguage;
26
27class Parallel extends Constraint
28{
35 protected array $failed_constraints;
36
42 public function __construct(array $constraints, Data\Factory $data_factory, ilLanguage $lng)
43 {
45 function ($value) use ($constraints): bool {
46 $ret = true;
47 $this->failed_constraints = [];
48 foreach ($constraints as $constraint) {
49 if (!$constraint->accepts($value)) {
50 $this->failed_constraints[] = $constraint;
51 $ret = false;
52 }
53 }
54
55 return $ret;
56 },
57 function ($txt, $value): string {
58 $messages = [];
59 foreach ($this->failed_constraints as $constraint) {
60 $messages[] = $constraint->getErrorMessage($value);
61 }
62
63 return implode(" ", $messages);
64 },
65 $data_factory,
66 $lng
67 );
68 }
69}
Builds data types.
Definition: Factory.php:21
__construct(array $constraints, Data\Factory $data_factory, ilLanguage $lng)
Definition: Parallel.php:42
language handling
$txt
Definition: error.php:13
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Group.php:21
$lng
$messages
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: xapiexit.php:22