ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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
3 docs/LICENSE */
4 
5 namespace ILIAS\Refinery\Numeric;
6 
9 use ILIAS\Data;
10 
11 class 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 }
A constraint encodes some resrtictions on values.
Definition: Constraint.php:14
Builds data types.
Definition: Factory.php:19
$txt
Definition: error.php:13
__construct(Container $dic, ilPlugin $plugin)
__construct(Data\Factory $data_factory, \ilLanguage $lng)
Definition: IsNumeric.php:13