Conditions | 5 |
Paths | 5 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function validate(): void |
||
15 | { |
||
16 | if (empty($this->data)) { |
||
17 | throw new InvalidArgumentException('The data provided is empty.'); |
||
18 | } |
||
19 | |||
20 | if (!is_array($this->data)) { |
||
21 | throw new InvalidArgumentException('The data provided is not an array.'); |
||
22 | } |
||
23 | |||
24 | foreach (array_values($this->data) as $i => $rule) { |
||
25 | if (!$rule instanceof RuleInterface) { |
||
26 | throw new InvalidArgumentException('Rule ' . ++$i . ' is not a valid rule class'); |
||
27 | } |
||
31 |