Conditions | 5 |
Paths | 16 |
Total Lines | 50 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function benchSimpleManyVotes () : void |
||
21 | { |
||
22 | $election = new Election; |
||
23 | $election->allowVoteWeight(true); |
||
24 | |||
25 | $election->parseCandidates('A;B;C;D;E;F'); |
||
26 | |||
27 | $election->parseVotes(' |
||
28 | Ultimate Question of Life || A>B>C ^42 * 42 |
||
29 | C=A>B ^2 * 200 |
||
30 | B>C |
||
31 | E > B > C > A ^80 *50 |
||
32 | F > B > G > H > A* 250 |
||
33 | D = B = E > F ^6 * 48 |
||
34 | '); |
||
35 | |||
36 | $election->getWinner(); |
||
37 | $election->getLoser(); |
||
38 | |||
39 | foreach (Condorcet::getAuthMethods() as $method) : |
||
40 | $election->getResult($method); |
||
41 | endforeach; |
||
42 | |||
43 | $election->setImplicitRanking(false); |
||
44 | |||
45 | foreach (Condorcet::getAuthMethods() as $method) : |
||
46 | $election->getResult($method); |
||
47 | endforeach; |
||
48 | |||
49 | $election->allowVoteWeight(false); |
||
50 | |||
51 | foreach (Condorcet::getAuthMethods() as $method) : |
||
52 | $election->getResult($method); |
||
53 | endforeach; |
||
54 | |||
55 | $election->parseVotes(' |
||
56 | Ultimate Question of Life || C>B>A ^42 * 42 |
||
57 | C=A=B ^2 * 200 |
||
58 | B>C |
||
59 | A > C >E ^80 *50 |
||
60 | G > B > G > H > F* 250 |
||
61 | C = B = E > A ^6 * 48 |
||
62 | '); |
||
63 | |||
64 | foreach (Condorcet::getAuthMethods() as $method) : |
||
65 | $election->getResult($method); |
||
66 | endforeach; |
||
67 | |||
68 | $votes = $election->getVotesListAsString(); |
||
|
|||
69 | } |
||
70 | |||
71 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.