1 | <?php |
||
10 | class PlayersCollection extends ArrayCollection |
||
11 | { |
||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | private $gameOrder; |
||
16 | |||
17 | /** |
||
18 | * @var HangmanPlayer |
||
19 | */ |
||
20 | private $currentPlayer; |
||
21 | |||
22 | /** |
||
23 | * @inheritDoc |
||
24 | */ |
||
25 | 111 | public function __construct(array $elements = array()) |
|
31 | |||
32 | /** |
||
33 | * @param mixed $key |
||
34 | * @param HangmanPlayer $value |
||
35 | */ |
||
36 | 63 | public function set($key, $value) |
|
45 | |||
46 | /** |
||
47 | * @param HangmanPlayer $value |
||
48 | * |
||
49 | * @return bool |
||
50 | */ |
||
51 | 63 | public function add($value) |
|
59 | |||
60 | /** |
||
61 | * @return bool |
||
62 | */ |
||
63 | 15 | public function thereIsAtLeastOneActivePlayer() |
|
76 | |||
77 | /** |
||
78 | * Returns the next player in line |
||
79 | * |
||
80 | * @return PlayerId |
||
81 | */ |
||
82 | 18 | public function getNextPlayerId() |
|
101 | |||
102 | /** |
||
103 | * @return HangmanPlayer |
||
104 | */ |
||
105 | 27 | public function getCurrentPlayer() |
|
109 | |||
110 | /** |
||
111 | * @param PlayerId $playerId |
||
112 | */ |
||
113 | 48 | public function setCurrentPlayer(PlayerId $playerId = null) |
|
117 | |||
118 | /** |
||
119 | * @param PlayerId $playerId |
||
120 | * |
||
121 | * @return bool |
||
122 | */ |
||
123 | 48 | public function isCurrentPlayer(PlayerId $playerId = null) |
|
127 | |||
128 | /** |
||
129 | * @param PlayerId $playerId |
||
130 | * |
||
131 | * @return bool |
||
132 | */ |
||
133 | 36 | public function canPlayerPlay(PlayerId $playerId) |
|
137 | |||
138 | 51 | public function hasPlayers() |
|
142 | } |
||
143 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):