@@ -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 |
@@ -223,8 +223,7 @@ discard block |
||
223 | 223 | $minimum = $candidate->getVotes(); |
224 | 224 | unset($minimumCandidates); |
225 | 225 | $minimumCandidates[] = $candidate; |
226 | - } |
|
227 | - elseif ($candidate->getVotes() == $minimum) |
|
226 | + } elseif ($candidate->getVotes() == $minimum) |
|
228 | 227 | { |
229 | 228 | $minimumCandidates[] = $candidate; |
230 | 229 | } |
@@ -253,8 +252,7 @@ discard block |
||
253 | 252 | if (count($ballot->getRanking()) > $this->election->getCandidateCount()) |
254 | 253 | { |
255 | 254 | $rejected = true; |
256 | - } |
|
257 | - else |
|
255 | + } else |
|
258 | 256 | { |
259 | 257 | $candidateIds = $this->election->getCandidateIds(); |
260 | 258 |
@@ -120,7 +120,7 @@ |
||
120 | 120 | * candidate votes) |
121 | 121 | * @return Ballot The same ballot passed in modified |
122 | 122 | */ |
123 | - protected function allocateVotes(Ballot &$ballot, float $multiplier = 1.0, float $divisor = 1.0): Ballot |
|
123 | + protected function allocateVotes(Ballot & $ballot, float $multiplier = 1.0, float $divisor = 1.0): Ballot |
|
124 | 124 | { |
125 | 125 | $weight = $ballot->setWeight(($ballot->getWeight() * $multiplier) / $divisor); |
126 | 126 | $candidate = $ballot->getNextChoice(); |
@@ -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; |