@@ 12-31 (lines=20) @@ | ||
9 | /** |
|
10 | * Expression must evaluate to true for each list item |
|
11 | */ |
|
12 | class ListAll extends Set |
|
13 | { |
|
14 | /** |
|
15 | * Expression must evaluate to true for each list item |
|
16 | */ |
|
17 | public function evaluate($list): bool |
|
18 | { |
|
19 | if (!is_array($list)) { |
|
20 | return false; |
|
21 | } |
|
22 | ||
23 | foreach ($list as $item) { |
|
24 | if (!$this->expr->evaluate($item)) { |
|
25 | return false; |
|
26 | } |
|
27 | } |
|
28 | ||
29 | return true; |
|
30 | } |
|
31 | } |
|
32 |
@@ 12-31 (lines=20) @@ | ||
9 | /** |
|
10 | * Expression must evaluate to true for at least one list item |
|
11 | */ |
|
12 | class ListAtLeastOne extends Set |
|
13 | { |
|
14 | /** |
|
15 | * Expression must evaluate to true for at least one list item |
|
16 | */ |
|
17 | public function evaluate($list): bool |
|
18 | { |
|
19 | if (!is_array($list)) { |
|
20 | return false; |
|
21 | } |
|
22 | ||
23 | foreach ($list as $item) { |
|
24 | if ($this->expr->evaluate($item)) { |
|
25 | return true; |
|
26 | } |
|
27 | } |
|
28 | ||
29 | return false; |
|
30 | } |
|
31 | } |
|
32 |