Conditions | 6 |
Paths | 9 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
42 | 1 | public function validate($value): bool |
|
43 | { |
||
44 | 1 | $trueCount = 0; |
|
45 | |||
46 | 1 | foreach ($this->rules as $rule) { |
|
47 | 1 | if ($rule->validate($value)) { |
|
48 | 1 | $trueCount++; |
|
49 | } |
||
50 | } |
||
51 | |||
52 | 1 | if ((false === $this->all) && (0 < $trueCount)) { |
|
53 | 1 | return true; |
|
54 | } |
||
55 | |||
56 | 1 | if ($trueCount == count($this->rules)) { |
|
57 | 1 | return true; |
|
58 | } |
||
59 | |||
60 | 1 | return false; |
|
61 | } |
||
63 |