@@ 25-40 (lines=16) @@ | ||
22 | * |
|
23 | * @package Netzmacht\Workflow\Flow\Workflow |
|
24 | */ |
|
25 | class AndCondition extends ConditionCollection |
|
26 | { |
|
27 | /** |
|
28 | * {@inheritdoc} |
|
29 | */ |
|
30 | public function match(Workflow $workflow, EntityId $entityId, $entity): bool |
|
31 | { |
|
32 | foreach ($this->conditions as $condition) { |
|
33 | if (!$condition->match($workflow, $entityId, $entity)) { |
|
34 | return false; |
|
35 | } |
|
36 | } |
|
37 | ||
38 | return true; |
|
39 | } |
|
40 | } |
|
41 |
@@ 25-44 (lines=20) @@ | ||
22 | * |
|
23 | * @package Netzmacht\Workflow\Flow\Workflow |
|
24 | */ |
|
25 | class OrCondition extends ConditionCollection |
|
26 | { |
|
27 | /** |
|
28 | * {@inheritdoc} |
|
29 | */ |
|
30 | public function match(Workflow $workflow, EntityId $entityId, $entity): bool |
|
31 | { |
|
32 | foreach ($this->conditions as $condition) { |
|
33 | if ($condition->match($workflow, $entityId, $entity)) { |
|
34 | return true; |
|
35 | } |
|
36 | } |
|
37 | ||
38 | if (!$this->conditions) { |
|
39 | return true; |
|
40 | } |
|
41 | ||
42 | return false; |
|
43 | } |
|
44 | } |
|
45 |