|
@@ 104-116 (lines=13) @@
|
| 101 |
|
* @param \SpareParts\Overseer\Context\IVotingContext $votingContext |
| 102 |
|
* @return \SpareParts\Overseer\IVotingResult |
| 103 |
|
*/ |
| 104 |
|
private function strategyAllowUnlessDenied($votingSubject, $votingContext) |
| 105 |
|
{ |
| 106 |
|
$results = []; |
| 107 |
|
foreach ($this->voters as $name => $voter) { |
| 108 |
|
if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { |
| 109 |
|
$results[] = $lastResult; |
| 110 |
|
if ($lastResult->getDecision() == VotingDecisionEnum::DENIED()) { |
| 111 |
|
return new VotingResult(VotingDecisionEnum::DENIED(), $results); |
| 112 |
|
} |
| 113 |
|
} |
| 114 |
|
} |
| 115 |
|
return new VotingResult(VotingDecisionEnum::ALLOWED(), $results); |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
|
| 119 |
|
/** |
|
@@ 124-136 (lines=13) @@
|
| 121 |
|
* @param \SpareParts\Overseer\Context\IVotingContext $votingContext |
| 122 |
|
* @return \SpareParts\Overseer\IVotingResult |
| 123 |
|
*/ |
| 124 |
|
private function strategyDenyUnlessAllowed($votingSubject, $votingContext) |
| 125 |
|
{ |
| 126 |
|
$results = []; |
| 127 |
|
foreach ($this->voters as $name => $voter) { |
| 128 |
|
if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { |
| 129 |
|
$results[] = $lastResult; |
| 130 |
|
if ($lastResult->getDecision() == VotingDecisionEnum::DENIED()) { |
| 131 |
|
return new VotingResult(VotingDecisionEnum::ALLOWED(), $results); |
| 132 |
|
} |
| 133 |
|
} |
| 134 |
|
} |
| 135 |
|
return new VotingResult(VotingDecisionEnum::DENIED(), $results); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
|
| 139 |
|
/** |