| 1 | <?php |
||
| 9 | abstract class AbstractValidator implements ValidatorInterface |
||
| 10 | { |
||
| 11 | |||
| 12 | /** @var Translate */ |
||
| 13 | private $langs; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var string[]|array |
||
| 17 | */ |
||
| 18 | protected $errors; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var string[]|array |
||
| 22 | */ |
||
| 23 | private $warningMessages; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var boolean |
||
| 27 | */ |
||
| 28 | protected $valid; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var DoliDB |
||
| 32 | */ |
||
| 33 | protected $db; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * AbstractValidator constructor. |
||
| 37 | * |
||
| 38 | * @param Translate $langs |
||
| 39 | * @param DoliDB $db |
||
| 40 | */ |
||
| 41 | public function __construct(Translate $langs, DoliDB $db) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param string $field |
||
| 51 | * @param string $message |
||
| 52 | */ |
||
| 53 | protected function addError($field, $message) |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param string $message |
||
| 65 | * |
||
| 66 | * @return AbstractValidator |
||
| 67 | */ |
||
| 68 | protected function addWarning($message) |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @return array|string[] |
||
| 76 | */ |
||
| 77 | public function getWarningMessages() |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @return array|string[] |
||
| 84 | */ |
||
| 85 | public function getErrors() |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @param string $field |
||
| 99 | * |
||
| 100 | * @return bool |
||
| 101 | */ |
||
| 102 | public function hasError($field) |
||
| 106 | |||
| 107 | } |