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 |
|
113 | 3 | ||
114 | /** |
||
115 | 3 | * @param PlayerContract $player |
|
116 | 3 | */ |
|
117 | 3 | public function sitPlayerOut(PlayerContract $player) |
|
121 | 3 | ||
122 | 1 | /** |
|
123 | * @return PlayerCollection |
||
124 | */ |
||
125 | 2 | public function playersSatDown(): PlayerCollection |
|
129 | |||
130 | /** |
||
131 | 15 | * @param PlayerContract $player |
|
132 | * |
||
133 | 15 | * @throws TableException |
|
134 | */ |
||
135 | 15 | public function giveButtonToPlayer(PlayerContract $player) |
|
149 | 22 | ||
150 | /** |
||
151 | 22 | * Moves the button along the table seats. |
|
152 | 22 | */ |
|
153 | public function moveButton() |
||
161 | 22 | ||
162 | 22 | /** |
|
163 | 22 | * @param PlayerContract $findPlayer |
|
164 | * |
||
165 | 22 | * @return int |
|
166 | */ |
||
167 | public function findSeat(PlayerContract $findPlayer): int |
||
176 | |||
177 | 16 | /** |
|
178 | 16 | * @param string $playerName |
|
179 | 16 | * |
|
180 | 16 | * @return Player |
|
181 | */ |
||
182 | public function findPlayerByName($playerName): PlayerContract |
||
190 | 1 | ||
191 | 1 | public function removePlayer(Client $client) |
|
210 | } |
||
211 |
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: