ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
IsNumeric.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2017 Timon Amstutz <timon.amstutz@ilub.unibe.ch> Extended GPL, see
3docs/LICENSE */
4
6
8use ILIAS\Refinery\Custom\Constraint as CustomConstraint;
9use ILIAS\Data;
10
11class IsNumeric extends CustomConstraint implements Constraint
12{
14 {
16 function ($value) {
17 return is_numeric($value);
18 },
19 function ($txt, $value) {
20 if ('' === $value) {
21 return $txt("not_numeric_empty_string");
22 }
23
24 return $txt("not_numeric", $value);
25 },
27 $lng
28 );
29 }
30}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
__construct(Data\Factory $data_factory, \ilLanguage $lng)
Definition: IsNumeric.php:13
language handling
$txt
Definition: error.php:13
A constraint encodes some resrtictions on values.
Definition: Constraint.php:15
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc