ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Not.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 Not extends Custom implements Constraint
11{
12 const ERROR_MESSAGE_PREFIX = "It is not the case that:";
13
17 protected $constraint;
18
20 {
21 $this->constraint = $constraint;
22 parent::__construct(
23 function ($value) {
24 return !$this->constraint->accepts($value);
25 },
26 function ($value) {
27 return self::ERROR_MESSAGE_PREFIX . ": " . $this->constraint->getErrorMessage($value);
28 },
30 );
31 }
32}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:15
__construct(Constraint $constraint, Data\Factory $data_factory)
Definition: Not.php:19
A constraint encodes some resrtictions on values.
Definition: Constraint.php:15