ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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;
8
9class Sequential 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 foreach ($this->constraints as $key => $constraint) {
30 if (!$constraint->accepts($value)) {
31 $this->failed_constraint = $constraint;
32 return false;
33 }
34 }
35
36 return true;
37 },
38 function ($txt, $value) {
39 return $this->failed_constraint->getErrorMessage($value);
40 },
41 $data_factory,
42 $lng
43 );
44 }
45}
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: Sequential.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
$lng