ILIAS  release_7 Revision v7.30-3-g800a261c036
Parallel.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2017 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
5
7use ILIAS\Data;
8
9class Parallel extends Constraint
10{
14 protected $constraints;
15
23
24 public function __construct(array $constraints, Data\Factory $data_factory, \ilLanguage $lng)
25 {
26 $this->constraints = $constraints;
28 function ($value) {
29 $ret = true;
30 $this->failed_constraints = array();
31 foreach ($this->constraints as $constraint) {
32 if (!$constraint->accepts($value)) {
33 $this->failed_constraints[] = $constraint;
34 $ret = false;
35 }
36 }
37
38 return $ret;
39 },
40 function ($txt, $value) {
41 $messages = [];
42 foreach ($this->failed_constraints as $key => $constraint) {
43 $messages[] = $constraint->getErrorMessage($value);
44 }
45
46 return implode(" ", $messages);
47 },
48 $data_factory,
49 $lng
50 );
51 }
52}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
__construct(array $constraints, Data\Factory $data_factory, \ilLanguage $lng)
Definition: Parallel.php:24
language handling
$txt
Definition: error.php:13
A constraint encodes some resrtictions on values.
Definition: Constraint.php:15
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
$lng
$messages
Definition: xapiexit.php:5