| 1 | <?php |
||
| 18 | class Integer extends Rule |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * A constant that will be used when the value does not represent an integer value. |
||
| 22 | */ |
||
| 23 | const NOT_AN_INTEGER = 'Integer::NOT_AN_INTEGER'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * The message templates which can be returned by this validator. |
||
| 27 | * |
||
| 28 | * @var array |
||
| 29 | */ |
||
| 30 | protected $messageTemplates = [ |
||
| 31 | self::NOT_AN_INTEGER => '{{ name }} must be an integer', |
||
| 32 | ]; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * A bool denoting whether or not strict checking should be done. |
||
| 36 | * |
||
| 37 | * @var bool |
||
| 38 | */ |
||
| 39 | private $strict; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param bool $strict |
||
| 43 | */ |
||
| 44 | 18 | public function __construct($strict = false) |
|
| 48 | |||
| 49 | /** |
||
| 50 | * Validates if $value represents an integer. |
||
| 51 | * |
||
| 52 | * @param mixed $value |
||
| 53 | * @return bool |
||
| 54 | */ |
||
| 55 | 18 | public function validate($value) |
|
| 67 | } |
||
| 68 |