| 1 | <?php |
||
| 18 | class Boolean extends Rule |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * A constant that will be used when the value is not in the array without strict checking. |
||
| 22 | */ |
||
| 23 | const NOT_BOOL = 'BOOL::NOT_BOOL'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * The message templates which can be returned by this validator. |
||
| 27 | * |
||
| 28 | * @var array |
||
| 29 | */ |
||
| 30 | protected $messageTemplates = [ |
||
| 31 | self::NOT_BOOL => '{{ name }} must be either true or false', |
||
| 32 | ]; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Validates if $value is either true or false. |
||
| 36 | * |
||
| 37 | * @param mixed $value |
||
| 38 | * @return bool |
||
| 39 | */ |
||
| 40 | 11 | public function validate($value) |
|
| 44 | |||
| 45 | /** |
||
| 46 | * {@inheritdoc} |
||
| 47 | */ |
||
| 48 | 6 | public function shouldBreakChainOnError() |
|
| 52 | } |
||
| 53 |