| 1 | <?php |
||
| 9 | abstract class BaseValidator implements ValidatorInterface { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | protected $errors = []; |
||
| 15 | |||
| 16 | |||
| 17 | /** |
||
| 18 | * @param string $value |
||
| 19 | * @return bool |
||
| 20 | */ |
||
| 21 | public abstract function isValid($value); |
||
| 22 | |||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $message |
||
| 26 | * @return $this |
||
| 27 | */ |
||
| 28 | 6 | public function addError($message) { |
|
| 32 | |||
| 33 | |||
| 34 | /** |
||
| 35 | * @return bool |
||
| 36 | */ |
||
| 37 | 1 | public function hasErrors() { |
|
| 40 | |||
| 41 | |||
| 42 | /** |
||
| 43 | * @return array |
||
| 44 | */ |
||
| 45 | 6 | public function getErrors() { |
|
| 48 | |||
| 49 | |||
| 50 | /** |
||
| 51 | * @return null|string |
||
| 52 | */ |
||
| 53 | 2 | public function getFirstError() { |
|
| 56 | } |