Total Complexity | 7 |
Total Lines | 76 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class Domino |
||
12 | { |
||
13 | /** |
||
14 | * @var int |
||
15 | */ |
||
16 | private int $topTile; |
||
17 | |||
18 | /** |
||
19 | * @var int |
||
20 | */ |
||
21 | private int $bottomTile; |
||
22 | |||
23 | /** |
||
24 | * @param int $topTile |
||
25 | * @param int $bottomTile |
||
26 | */ |
||
27 | public function __construct(int $topTile, int $bottomTile) |
||
28 | { |
||
29 | $this->topTile = $topTile; |
||
30 | $this->bottomTile = $bottomTile; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return string |
||
35 | */ |
||
36 | public function getName(): string |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Check if the top and bottom dots are equal, a double. |
||
43 | * |
||
44 | * @return bool |
||
45 | */ |
||
46 | public function isDouble(): bool |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Return the number of dots in the 'top' square. |
||
53 | * |
||
54 | * @return int |
||
55 | */ |
||
56 | public function getTopTile(): int |
||
57 | { |
||
58 | return $this->topTile; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Return the number of dots in the 'bottom' square. |
||
63 | * |
||
64 | * @return int |
||
65 | */ |
||
66 | public function getBottomTile(): int |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * Return the sum of the domino's dots. |
||
73 | * |
||
74 | * @return int |
||
75 | */ |
||
76 | public function getValue(): int |
||
77 | { |
||
78 | return ($this->topTile + $this->bottomTile); |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * @return string |
||
83 | */ |
||
84 | public function __toString() |
||
87 | } |
||
88 | } |
||
89 |