|
@@ 91-103 (lines=13) @@
|
| 88 |
|
* @param \SpareParts\Overseer\Context\IVotingContext $votingContext |
| 89 |
|
* @return \SpareParts\Overseer\IVotingResult |
| 90 |
|
*/ |
| 91 |
|
private function strategyAllowUnlessDenied($votingSubject, IVotingContext $votingContext) |
| 92 |
|
{ |
| 93 |
|
$results = []; |
| 94 |
|
foreach ($this->voters as $name => $voter) { |
| 95 |
|
if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { |
| 96 |
|
$results[] = $lastResult; |
| 97 |
|
if ($lastResult->getDecision() === VotingDecisionEnum::DENIED()) { |
| 98 |
|
return new VotingResult(VotingDecisionEnum::DENIED(), $results); |
| 99 |
|
} |
| 100 |
|
} |
| 101 |
|
} |
| 102 |
|
return new VotingResult(VotingDecisionEnum::ALLOWED(), $results); |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
|
| 106 |
|
/** |
|
@@ 111-123 (lines=13) @@
|
| 108 |
|
* @param \SpareParts\Overseer\Context\IVotingContext $votingContext |
| 109 |
|
* @return \SpareParts\Overseer\IVotingResult |
| 110 |
|
*/ |
| 111 |
|
private function strategyDenyUnlessAllowed($votingSubject, IVotingContext $votingContext) |
| 112 |
|
{ |
| 113 |
|
$results = []; |
| 114 |
|
foreach ($this->voters as $name => $voter) { |
| 115 |
|
if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { |
| 116 |
|
$results[] = $lastResult; |
| 117 |
|
if ($lastResult->getDecision() === VotingDecisionEnum::ALLOWED()) { |
| 118 |
|
return new VotingResult(VotingDecisionEnum::ALLOWED(), $results); |
| 119 |
|
} |
| 120 |
|
} |
| 121 |
|
} |
| 122 |
|
return new VotingResult(VotingDecisionEnum::DENIED(), $results); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
|
| 126 |
|
/** |