ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
IsInt.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 IsInt extends Custom implements Constraint
11 {
12  public function __construct(Data\Factory $data_factory)
13  {
14  parent::__construct(
15  function ($value) {
16  return is_int($value);
17  },
18  function ($value) {
19  return "'" . gettype($value) . "' is not an integer.";
20  },
22  );
23  }
24 }
A constraint encodes some resrtictions on values.
Definition: Constraint.php:14
__construct(Data\Factory $data_factory)
Definition: IsInt.php:12
Builds data types.
Definition: Factory.php:14