| 1 | <?php |
||
| 19 | class Validator |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var OptionsResolver |
||
| 23 | */ |
||
| 24 | protected $optionResolver; |
||
| 25 | |||
| 26 | 180 | public function __construct(array $required) |
|
| 27 | { |
||
| 28 | 180 | $this->optionResolver = new OptionsResolver(); |
|
| 29 | 180 | $this->optionResolver->setDefaults(array_fill_keys($required, null)); |
|
| 30 | 180 | $this->optionResolver->setRequired($required); |
|
| 31 | 180 | } |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @param array $data |
||
| 35 | * @throws UndefinedOptionsException If an option name is undefined |
||
| 36 | * @throws InvalidOptionsException If an option doesn't fulfill the |
||
| 37 | * specified validation rules |
||
| 38 | * @throws MissingOptionsException If a required option is missing |
||
| 39 | * @throws OptionDefinitionException If there is a cyclic dependency between |
||
| 40 | * lazy options and/or normalizers |
||
| 41 | * @throws NoSuchOptionException If a lazy option reads an unavailable option |
||
| 42 | * @throws AccessException If called from a lazy option or normalizer |
||
| 43 | * @return bool |
||
| 44 | */ |
||
| 45 | 16 | public function validate(array $data) |
|
| 52 | } |
||
| 53 |