Conditions | 7 |
Paths | 4 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
20 | public function validate($value, array $context = []): bool |
||
21 | { |
||
22 | if ($this->skipOnEmpty and ($value === [] or $value === null)) { |
||
23 | return true; |
||
24 | } |
||
25 | if (!\is_array($value)) { |
||
26 | return false; |
||
27 | } |
||
28 | if ($this->size !== null and $this->size !== \sizeof($value)) { |
||
29 | $this->message = 'Expected array size: ' . $this->size . '. Actual: ' . \sizeof($value); |
||
30 | } |
||
31 | return true; |
||
32 | } |
||
33 | } |
||
34 |