| Total Complexity | 10 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class DiceHand |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var Dice[] |
||
| 11 | */ |
||
| 12 | private array $hand = []; |
||
| 13 | |||
| 14 | 6 | public function add(Dice $die): void |
|
| 15 | { |
||
| 16 | 6 | $this->hand[] = $die; |
|
| 17 | } |
||
| 18 | |||
| 19 | 5 | public function roll(): void |
|
| 20 | { |
||
| 21 | 5 | foreach ($this->hand as $die) { |
|
| 22 | 5 | $die->roll(); |
|
| 23 | } |
||
| 24 | } |
||
| 25 | |||
| 26 | 2 | public function getNumberDices(): int |
|
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return array<int|null> |
||
| 33 | */ |
||
| 34 | 1 | public function getValues(): array |
|
| 35 | { |
||
| 36 | 1 | $values = []; |
|
| 37 | 1 | foreach ($this->hand as $die) { |
|
| 38 | 1 | $values[] = $die->getValue(); |
|
| 39 | } |
||
| 40 | 1 | return $values; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return int |
||
| 45 | */ |
||
| 46 | 1 | public function sum(): int |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return string[] |
||
| 57 | */ |
||
| 58 | 2 | public function getString(): array |
|
| 65 | } |
||
| 66 | |||
| 67 | } |
||
| 68 |