1 | <?php |
||
7 | class Ballot |
||
8 | { |
||
9 | /** |
||
10 | * Ranking of candidates ids |
||
11 | * |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $ranking; |
||
15 | |||
16 | /** |
||
17 | * The current weighting or value of this person's vote |
||
18 | * |
||
19 | * @var float |
||
20 | */ |
||
21 | protected $weight; |
||
22 | |||
23 | /** |
||
24 | * The current preference in use from this ballot |
||
25 | * |
||
26 | * @var integer |
||
27 | */ |
||
28 | protected $levelUsed; |
||
29 | |||
30 | /** |
||
31 | * Constructor |
||
32 | * |
||
33 | * @param array $ranking The ranking of candidates Key being ranking, |
||
34 | * value being a candidate id |
||
35 | */ |
||
36 | 3 | public function __construct(array $ranking) |
|
42 | |||
43 | /** |
||
44 | * Gets the Ranking of candidates ids. |
||
45 | * |
||
46 | * @return array |
||
47 | */ |
||
48 | 1 | public function getRanking(): array |
|
52 | |||
53 | /** |
||
54 | * Sets the Ranking of candidates ids. |
||
55 | * |
||
56 | * @param array $ranking the ranking |
||
57 | * |
||
58 | * @return self |
||
59 | */ |
||
60 | public function setRanking(array $ranking) |
||
66 | |||
67 | /** |
||
68 | * Gets the The current weighting or value of this person's vote. |
||
69 | * |
||
70 | * @return float |
||
71 | */ |
||
72 | 1 | public function getWeight(): float |
|
76 | |||
77 | /** |
||
78 | * Sets the The current weighting or value of this person's vote. |
||
79 | * |
||
80 | * @param float $weight the weight |
||
81 | * |
||
82 | * @return self |
||
83 | */ |
||
84 | public function setWeight(float $weight) |
||
90 | |||
91 | /** |
||
92 | * Gets the the current preference in use from this ballot. |
||
93 | * |
||
94 | * @return integer |
||
95 | */ |
||
96 | 1 | public function getLevelUsed(): int |
|
100 | |||
101 | /** |
||
102 | * Sets the the current preference in use from this ballot. |
||
103 | * |
||
104 | * @param integer $levelUsed |
||
105 | * |
||
106 | * @return self |
||
107 | */ |
||
108 | public function setLevelUsed(int $levelUsed) |
||
114 | |||
115 | public function getLastChoice() |
||
126 | |||
127 | public function getNextChoice() |
||
138 | |||
139 | public function getNextChoiceWorth(): float |
||
143 | } |
||
144 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.