| 1 | <?php |
||
| 38 | trait Validator |
||
| 39 | { |
||
| 40 | /** |
||
| 41 | * @var ValidatorBuilder instance of ValidatorBuilder |
||
| 42 | */ |
||
| 43 | protected $validatorBuilder; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Get ValidatorBuilder |
||
| 47 | * |
||
| 48 | * @return ValidatorBuilder |
||
| 49 | */ |
||
| 50 | 2 | protected function getValidatorBuilder() |
|
| 57 | |||
| 58 | /** |
||
| 59 | * Add Validator for field |
||
| 60 | * |
||
| 61 | * @param string $name |
||
| 62 | * @param \Bluz\Validator\Validator[] $validators |
||
| 63 | * @return Validator |
||
| 64 | */ |
||
| 65 | 2 | protected function addValidator($name, ...$validators) |
|
| 70 | |||
| 71 | /** |
||
| 72 | * Validate input data |
||
| 73 | * |
||
| 74 | * @param array $input |
||
| 75 | * @return bool |
||
| 76 | */ |
||
| 77 | public function validate($input) : bool |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Assert input data |
||
| 84 | * |
||
| 85 | * @param array $input |
||
| 86 | * @return bool |
||
| 87 | */ |
||
| 88 | 2 | public function assert($input) |
|
| 92 | } |
||
| 93 |