ILIAS  release_8 Revision v8.23
IsNumeric.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 namespace ILIAS\Refinery\Numeric;
22 
24 use ILIAS\Data;
25 use ilLanguage;
26 
27 class IsNumeric extends Constraint
28 {
29  public function __construct(Data\Factory $data_factory, ilLanguage $lng)
30  {
32  static function ($value): bool {
33  return is_numeric($value);
34  },
35  static function ($txt, $value): string {
36  if ('' === $value) {
37  return (string) $txt("not_numeric_empty_string");
38  }
39 
40  return (string) $txt("not_numeric", $value);
41  },
42  $data_factory,
43  $lng
44  );
45  }
46 }
__construct(Data\Factory $data_factory, ilLanguage $lng)
Definition: IsNumeric.php:29
$lng
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Group.php:21
$txt
Definition: error.php:13
__construct(Container $dic, ilPlugin $plugin)