1 | <?php |
||
14 | class Table extends BaseTable |
||
15 | { |
||
16 | /** |
||
17 | * @var Uuid |
||
18 | */ |
||
19 | private $id; |
||
20 | |||
21 | /** |
||
22 | * @var Dealer |
||
23 | */ |
||
24 | private $dealer; |
||
25 | |||
26 | /** |
||
27 | * @var PlayerCollection |
||
28 | */ |
||
29 | private $players; |
||
30 | |||
31 | /** |
||
32 | * @var PlayerCollection |
||
33 | */ |
||
34 | private $playersSatOut; |
||
35 | |||
36 | /** |
||
37 | * @var int |
||
38 | */ |
||
39 | private $button = 0; |
||
40 | |||
41 | /** |
||
42 | 66 | * Table constructor. |
|
43 | * |
||
44 | 66 | * @param Uuid $id |
|
45 | 66 | * @param DealerContract $dealer |
|
46 | 66 | * @param PlayerCollection $players |
|
47 | 66 | */ |
|
48 | private function __construct(Uuid $id, DealerContract $dealer, PlayerCollection $players) |
||
55 | 66 | ||
56 | /** |
||
57 | 66 | * @param Uuid $id |
|
58 | * @param DealerContract $dealer |
||
59 | * @param PlayerCollection $players |
||
60 | * |
||
61 | * @return Table |
||
62 | */ |
||
63 | 64 | public static function setUp(Uuid $id, DealerContract $dealer, PlayerCollection $players) |
|
67 | |||
68 | /** |
||
69 | * @return Uuid |
||
70 | */ |
||
71 | 52 | public function id(): Uuid |
|
75 | |||
76 | /** |
||
77 | * @return PlayerCollection |
||
78 | */ |
||
79 | 46 | public function players(): PlayerCollection |
|
83 | |||
84 | /** |
||
85 | * @return DealerContract |
||
86 | */ |
||
87 | 12 | public function dealer(): DealerContract |
|
91 | |||
92 | /** |
||
93 | * @return int |
||
94 | */ |
||
95 | 9 | public function button(): int |
|
99 | |||
100 | /** |
||
101 | * @return PlayerContract |
||
102 | */ |
||
103 | 61 | public function locatePlayerWithButton(): PlayerContract |
|
107 | |||
108 | /** |
||
109 | * @param PlayerContract $player |
||
110 | */ |
||
111 | public function sitPlayerOut(PlayerContract $player) |
||
115 | 3 | ||
116 | 3 | /** |
|
117 | 3 | * @return PlayerCollection |
|
118 | 3 | */ |
|
119 | 3 | public function playersSatDown(): PlayerCollection |
|
123 | |||
124 | /** |
||
125 | 2 | * @param PlayerContract $player |
|
126 | 2 | * |
|
127 | * @throws TableException |
||
128 | */ |
||
129 | public function giveButtonToPlayer(PlayerContract $player) |
||
143 | 22 | ||
144 | /** |
||
145 | 22 | * Moves the button along the table seats. |
|
146 | */ |
||
147 | public function moveButton() |
||
155 | |||
156 | /** |
||
157 | 22 | * @param PlayerContract $findPlayer |
|
158 | 22 | * |
|
159 | * @return int |
||
160 | */ |
||
161 | 22 | public function findSeat(PlayerContract $findPlayer): int |
|
170 | |||
171 | /** |
||
172 | * @param string $playerName |
||
173 | 16 | * |
|
174 | * @return Player |
||
175 | 16 | */ |
|
176 | public function findPlayerByName($playerName): PlayerContract |
||
184 | |||
185 | public function removePlayer(Client $client) |
||
204 | } |
||
205 |
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: