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
7use ILIAS\Data;
9
10class 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}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:15
__construct(Data\Factory $data_factory)
Definition: IsInt.php:12
A constraint encodes some resrtictions on values.
Definition: Constraint.php:15