ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
LessThan.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 
7 use ILIAS\Data;
9 
10 class LessThan extends Custom implements Constraint
11 {
15  protected $max;
16 
17  public function __construct($max, Data\Factory $data_factory)
18  {
19  assert('is_int($max)');
20  $this->max = $max;
21  parent::__construct(
22  function ($value) {
23  return $value < $this->max;
24  },
25  function ($value) {
26  return "'$value' is greater than '{$this->max}'.";
27  },
29  );
30  }
31 }
A constraint encodes some resrtictions on values.
Definition: Constraint.php:14
__construct($max, Data\Factory $data_factory)
Definition: LessThan.php:17
Builds data types.
Definition: Factory.php:14