@@ -48,7 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | return $this->render( |
| 50 | 50 | 'user/index.html.twig', |
| 51 | - ['votes' => $votes, 'user' => $user,] |
|
| 51 | + ['votes' => $votes, 'user' => $user, ] |
|
| 52 | 52 | ); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -144,16 +144,16 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | protected function transferSurplusVotes(float $surplus, Candidate $candidate) |
| 146 | 146 | { |
| 147 | - $totalVotes = $candidate->getVotes(); |
|
| 148 | - $candidateId = $candidate->getId(); |
|
| 147 | + $totalVotes = $candidate->getVotes(); |
|
| 148 | + $candidateId = $candidate->getId(); |
|
| 149 | 149 | |
| 150 | - foreach ($this->ballots as $i => $ballot) |
|
| 151 | - { |
|
| 152 | - if ($ballot->getLastChoice() == $candidateId) |
|
| 153 | - { |
|
| 154 | - $this->allocateVotes($ballot, $surplus, $totalVotes); |
|
| 155 | - } |
|
| 156 | - } |
|
| 150 | + foreach ($this->ballots as $i => $ballot) |
|
| 151 | + { |
|
| 152 | + if ($ballot->getLastChoice() == $candidateId) |
|
| 153 | + { |
|
| 154 | + $this->allocateVotes($ballot, $surplus, $totalVotes); |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | 158 | return; |
| 159 | 159 | } |
@@ -167,14 +167,14 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | protected function transferEliminatedVotes(Candidate $candidate) |
| 169 | 169 | { |
| 170 | - $candidateId = $candidate->getId(); |
|
| 170 | + $candidateId = $candidate->getId(); |
|
| 171 | 171 | |
| 172 | - foreach ($this->ballots as $i => $ballot) |
|
| 172 | + foreach ($this->ballots as $i => $ballot) |
|
| 173 | 173 | { |
| 174 | - if ($ballot->getLastChoice() == $candidateId) |
|
| 175 | - { |
|
| 176 | - $this->allocateVotes($ballot); |
|
| 177 | - } |
|
| 174 | + if ($ballot->getLastChoice() == $candidateId) |
|
| 175 | + { |
|
| 176 | + $this->allocateVotes($ballot); |
|
| 177 | + } |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | return; |
@@ -224,8 +224,7 @@ discard block |
||
| 224 | 224 | $minimum = $candidate->getVotes(); |
| 225 | 225 | unset($minimumCandidates); |
| 226 | 226 | $minimumCandidates[] = $candidate; |
| 227 | - } |
|
| 228 | - elseif ($candidate->getVotes() == $minimum) |
|
| 227 | + } elseif ($candidate->getVotes() == $minimum) |
|
| 229 | 228 | { |
| 230 | 229 | $minimumCandidates[] = $candidate; |
| 231 | 230 | } |
@@ -270,8 +269,7 @@ discard block |
||
| 270 | 269 | if (count($ballot->getRanking()) > $this->election->getCandidateCount()) |
| 271 | 270 | { |
| 272 | 271 | return false; |
| 273 | - } |
|
| 274 | - else |
|
| 272 | + } else |
|
| 275 | 273 | { |
| 276 | 274 | $candidateIds = $this->election->getCandidateIds(); |
| 277 | 275 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | /** |
| 119 | 119 | * Check if any candidates have reached the quota and can be elected |
| 120 | 120 | * |
| 121 | - * @param array $candidates Array of active candidates to check |
|
| 121 | + * @param Candidate[] $candidates Array of active candidates to check |
|
| 122 | 122 | * @return bool Whether any candidates were changed to elected |
| 123 | 123 | */ |
| 124 | 124 | protected function checkCandidates(array $candidates): bool |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | /** |
| 348 | 348 | * Check if ballot is valid |
| 349 | 349 | * |
| 350 | - * @param Ballot $Ballot Ballot to test |
|
| 350 | + * @param Ballot $ballot Ballot to test |
|
| 351 | 351 | * @return bool True if valid, false if invalid |
| 352 | 352 | */ |
| 353 | 353 | public function checkBallotValidity(Ballot $ballot): bool |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | foreach ($this->ballots as $i => $ballot) |
| 103 | 103 | { |
| 104 | 104 | $this->logger->debug("Processing ballot $i in stage 1", |
| 105 | - ['ballot' => $ballot,] |
|
| 105 | + ['ballot' => $ballot, ] |
|
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | 108 | $this->allocateVotes($ballot); |