| Total Complexity | 5 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 9 | class CardsInHand |
||
| 10 | { |
||
| 11 | /** @var Card[][][] */ |
||
| 12 | private $cards = []; |
||
| 13 | |||
| 14 | public function draw(MatchId $match, int $player, Card ...$cards): void |
||
| 19 | ); |
||
| 20 | } |
||
| 21 | |||
| 22 | public function played(int $offset, MatchId $match, int $player): void |
||
| 23 | { |
||
| 24 | foreach ($this->cards[$match->id()][$player] as $cardNumber => $cardInHand) { |
||
| 25 | if ($cardInHand->offset() === $offset) { |
||
| 26 | unset($this->cards[$match->id()][$player][$cardNumber]); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | $this->cards[$match->id()][$player] = array_values( |
||
| 30 | $this->cards[$match->id()][$player] |
||
| 31 | ); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** @return Card[] */ |
||
| 35 | public function ofPlayer(int $player, MatchId $match): array |
||
| 38 | } |
||
| 39 | } |
||
| 40 |