1 | <?php |
||
18 | class Dealer extends BaseDealer implements DealerContract |
||
19 | { |
||
20 | /** |
||
21 | * @var Deck |
||
22 | */ |
||
23 | private $deck; |
||
|
|||
24 | |||
25 | /** |
||
26 | * @var CardEvaluator |
||
27 | */ |
||
28 | private $cardEvaluationRules; |
||
29 | |||
30 | /** |
||
31 | 78 | * @var CardCollection |
|
32 | */ |
||
33 | 78 | private $communityCards; |
|
34 | 78 | ||
35 | 78 | /** |
|
36 | * @var CardCollection |
||
37 | */ |
||
38 | private $burnCards; |
||
39 | |||
40 | /** |
||
41 | * @var HandCollection |
||
42 | */ |
||
43 | 78 | private $hands; |
|
44 | |||
45 | 78 | /** |
|
46 | * Dealer constructor. |
||
47 | * |
||
48 | * @param Deck $deck |
||
49 | * @param CardEvaluator $cardEvaluationRules |
||
50 | */ |
||
51 | 50 | private function __construct(Deck $deck, CardEvaluator $cardEvaluationRules) |
|
60 | |||
61 | 23 | /** |
|
62 | * @param Deck $deck |
||
63 | * @param CardEvaluator $cardEvaluationRules |
||
64 | * |
||
65 | * @return Dealer |
||
66 | */ |
||
67 | 50 | public static function startWork(Deck $deck, CardEvaluator $cardEvaluationRules) |
|
71 | |||
72 | /** |
||
73 | * @return Deck |
||
74 | */ |
||
75 | public function deck(): Deck |
||
79 | |||
80 | 22 | /** |
|
81 | * @return CardCollection |
||
82 | */ |
||
83 | public function communityCards(): CardCollection |
||
87 | |||
88 | /** |
||
89 | * @return CardCollection |
||
90 | */ |
||
91 | public function burnCards(): CardCollection |
||
95 | |||
96 | /** |
||
97 | * @return Card |
||
98 | */ |
||
99 | public function dealCard(): Card |
||
103 | |||
104 | /** |
||
105 | * @return HandCollection |
||
106 | */ |
||
107 | public function hands(): HandCollection |
||
111 | |||
112 | /** |
||
113 | * Shuffles the deck. |
||
114 | */ |
||
115 | public function shuffleDeck() |
||
119 | |||
120 | /** |
||
121 | * Adds a card to the BurnCards(), also Adds a card to the CommunityCards(). |
||
122 | * |
||
123 | * @param int $cards |
||
124 | */ |
||
125 | public function dealCommunityCards(int $cards = 1) |
||
135 | |||
136 | /** |
||
137 | * Deals the remainder of the community cards, whilst taking burn cards into account. |
||
138 | */ |
||
139 | public function checkCommunityCards() |
||
157 | |||
158 | /** |
||
159 | * Deal the hands to the players. |
||
160 | */ |
||
161 | public function dealHands(PlayerCollection $players) |
||
165 | |||
166 | /** |
||
167 | * @param PlayerContract $player |
||
168 | * |
||
169 | * @return Hand |
||
170 | */ |
||
171 | public function playerHand(PlayerContract $player): Hand |
||
181 | |||
182 | /** |
||
183 | * @return HandCollection |
||
184 | */ |
||
185 | public function dealCardsToPlayers(PlayerCollection $players): HandCollection |
||
208 | |||
209 | /** |
||
210 | * @param CardCollection $board |
||
211 | * @param HandCollection $playerHands |
||
212 | * |
||
213 | * @return ResultCollection |
||
214 | */ |
||
215 | public function evaluateHands(CardCollection $board, HandCollection $playerHands): ResultCollection |
||
219 | } |
||
220 |