1 | <?php |
||
9 | class LeftToAct extends Collection |
||
10 | { |
||
11 | const BIG_BLIND = 6; |
||
12 | const SMALL_BLIND = 5; |
||
13 | const ALLIN = 3; |
||
14 | const AGGRESSIVELY_ACTIONED = 2; |
||
15 | const STILL_TO_ACT = 1; |
||
16 | const ACTIONED = 0; |
||
17 | |||
18 | /** |
||
19 | * Sets all players actions to STILL_TO_ACT. |
||
20 | * |
||
21 | * @param PlayerCollection $players |
||
22 | * |
||
23 | * @return LeftToAct |
||
24 | */ |
||
25 | 58 | public function setup(PlayerCollection $players): self |
|
38 | |||
39 | /** |
||
40 | * Resets all players, and move dealer to the bottom of queue. |
||
41 | * |
||
42 | * @param PlayerCollection $players |
||
43 | * |
||
44 | * @return LeftToAct |
||
45 | */ |
||
46 | 1 | public function setupWithoutDealer(PlayerCollection $players): self |
|
55 | |||
56 | /** |
||
57 | * @return LeftToAct |
||
58 | */ |
||
59 | 27 | public function resetActions(): self |
|
73 | |||
74 | /** |
||
75 | * @return LeftToAct |
||
76 | */ |
||
77 | 16 | public function sortBySeats(): self |
|
87 | |||
88 | /** |
||
89 | * @return LeftToAct |
||
90 | */ |
||
91 | 39 | public function playerHasActioned(Player $player, int $value = 0): self |
|
102 | |||
103 | /** |
||
104 | * @param Player $player |
||
105 | * @param int $activity |
||
106 | * |
||
107 | * @return LeftToAct |
||
108 | */ |
||
109 | 40 | public function setActivity($player, int $activity): self |
|
124 | |||
125 | /** |
||
126 | * @return LeftToAct |
||
127 | */ |
||
128 | 41 | public function movePlayerToLastInQueue(): self |
|
134 | |||
135 | /** |
||
136 | * @return LeftToAct |
||
137 | */ |
||
138 | 50 | public function resetPlayerListFromSeat(int $seatNumber): self |
|
155 | |||
156 | /** |
||
157 | * @return LeftToAct |
||
158 | */ |
||
159 | 14 | public function removePlayer(Player $player): self |
|
168 | |||
169 | /** |
||
170 | * @return self |
||
171 | */ |
||
172 | public function findByAction(int $action) |
||
178 | 36 | ||
179 | /** |
||
180 | * @return array |
||
181 | */ |
||
182 | public function getRemainingPlayers() |
||
189 | |||
190 | /** |
||
191 | * @return array |
||
192 | */ |
||
193 | public function getNextPlayer() |
||
197 | } |
||
198 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: