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 hasPlayers() |
|
67 | 15 | ||
68 | /** |
||
69 | 15 | * @return bool |
|
70 | 13 | */ |
|
71 | public function hasAtLeastOneActivePlayer() |
||
84 | 18 | ||
85 | 18 | /** |
|
86 | 18 | * Returns the next player in line |
|
87 | * |
||
88 | 18 | * @return PlayerId |
|
89 | */ |
||
90 | 18 | public function getNextPlayerId() |
|
109 | |||
110 | /** |
||
111 | * @param PlayerId $playerId |
||
112 | * |
||
113 | 48 | * @return bool |
|
114 | */ |
||
115 | 48 | public function canPlay(PlayerId $playerId) |
|
119 | |||
120 | /** |
||
121 | * @param PlayerId $playerId |
||
122 | * |
||
123 | 48 | * @return bool |
|
124 | */ |
||
125 | 48 | public function isCurrentPlayer(PlayerId $playerId = null) |
|
129 | |||
130 | /** |
||
131 | * @return HangmanPlayer |
||
132 | */ |
||
133 | 36 | public function getCurrentPlayer() |
|
137 | |||
138 | 51 | /** |
|
139 | * @param PlayerId $playerId |
||
140 | 51 | */ |
|
141 | public function setCurrentPlayer(PlayerId $playerId = null) |
||
145 | } |
||
146 |