| 1 | <?php |
||
| 18 | class IsFloat extends Rule |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * A constant that will be used when the value does not represent a float. |
||
| 22 | */ |
||
| 23 | const NOT_A_FLOAT = 'IsFloat::NOT_A_FLOAT'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * The message templates which can be returned by this validator. |
||
| 27 | * |
||
| 28 | * @var array |
||
| 29 | */ |
||
| 30 | protected $messageTemplates = [ |
||
| 31 | self::NOT_A_FLOAT => '{{ name }} must be a float', |
||
| 32 | ]; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Validates if $value represents a float. |
||
| 36 | * |
||
| 37 | * @param mixed $value |
||
| 38 | * @return bool |
||
| 39 | */ |
||
| 40 | 9 | public function validate($value) |
|
| 48 | |||
| 49 | /** |
||
| 50 | * {@inheritdoc} |
||
| 51 | */ |
||
| 52 | 7 | public function shouldBreakChainOnError() |
|
| 56 | } |
||
| 57 |