ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sequential.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;
9
10class Sequential extends Custom implements Constraint
11{
15 protected $constraints;
16
24
26 {
27 $this->constraints = $constraints;
28 parent::__construct(
29 function ($value) {
30 foreach ($this->constraints as $key => $constraint) {
31 if (!$constraint->accepts($value)) {
32 $this->failed_constraint = $constraint;
33 return false;
34 }
35 }
36
37 return true;
38 },
39 function ($txt, $value) {
40 return $this->failed_constraint->getErrorMessage($value);
41 },
43 $lng
44 );
45 }
46}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:15
__construct(array $constraints, Data\Factory $data_factory, \ilLanguage $lng)
Definition: Sequential.php:25
language handling
$key
Definition: croninfo.php:18
$txt
Definition: error.php:11
A constraint encodes some resrtictions on values.
Definition: Constraint.php:15