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 | 141 | public function __construct(array $elements = array()) |
|
35 | |||
36 | /** |
||
37 | * @param mixed $key |
||
38 | * @param HangmanPlayer $value |
||
39 | */ |
||
40 | 90 | public function set($key, $value) |
|
55 | |||
56 | /** |
||
57 | * @param HangmanPlayer $value |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | 90 | public function add($value) |
|
69 | |||
70 | /** |
||
71 | * @return bool |
||
72 | */ |
||
73 | 60 | public function hasPlayers() |
|
77 | |||
78 | /** |
||
79 | * @return bool |
||
80 | */ |
||
81 | 24 | public function hasAtLeastOneActivePlayer() |
|
94 | |||
95 | /** |
||
96 | * Returns the next player in line |
||
97 | * |
||
98 | * @return PlayerId |
||
99 | */ |
||
100 | 27 | public function getNextPlayerId() |
|
119 | |||
120 | /** |
||
121 | * @param PlayerId $playerId |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | 39 | public function canPlay(PlayerId $playerId) |
|
129 | |||
130 | /** |
||
131 | * @param PlayerId $playerId |
||
132 | * |
||
133 | * @return bool |
||
134 | */ |
||
135 | 51 | public function isCurrentPlayer(PlayerId $playerId = null) |
|
139 | |||
140 | /** |
||
141 | * @return HangmanPlayer |
||
142 | */ |
||
143 | 30 | public function getCurrentPlayer() |
|
147 | |||
148 | /** |
||
149 | * @param PlayerId $playerId |
||
150 | */ |
||
151 | 33 | public function setCurrentPlayer(PlayerId $playerId = null) |
|
155 | } |
||
156 |