@@ 12-27 (lines=16) @@ | ||
9 | /** |
|
10 | * All contained expressions must evaluate to true |
|
11 | */ |
|
12 | class All extends Counter |
|
13 | { |
|
14 | /** |
|
15 | * Evaluate that contained expressions returns true |
|
16 | */ |
|
17 | public function evaluate($operand): bool |
|
18 | { |
|
19 | foreach ($this->exprs as $expr) { |
|
20 | if (!$expr->evaluate($operand)) { |
|
21 | return false; |
|
22 | } |
|
23 | } |
|
24 | ||
25 | return true; |
|
26 | } |
|
27 | } |
|
28 |
@@ 12-27 (lines=16) @@ | ||
9 | /** |
|
10 | * At least one contained expressions must evaluate to true |
|
11 | */ |
|
12 | class AtLeastOne extends Counter |
|
13 | { |
|
14 | /** |
|
15 | * Evaluate that at least one contained expressions returns true |
|
16 | */ |
|
17 | public function evaluate($operand): bool |
|
18 | { |
|
19 | foreach ($this->exprs as $expr) { |
|
20 | if ($expr->evaluate($operand)) { |
|
21 | return true; |
|
22 | } |
|
23 | } |
|
24 | ||
25 | return false; |
|
26 | } |
|
27 | } |
|
28 |