1 | <?php |
||
22 | final class Game |
||
23 | { |
||
24 | /** |
||
25 | * @var Collection |
||
26 | */ |
||
27 | private $achievements; |
||
28 | |||
29 | /** |
||
30 | * @var int |
||
31 | */ |
||
32 | private $appId; |
||
33 | |||
34 | /** |
||
35 | * @var string|null |
||
36 | */ |
||
37 | private $developer; |
||
38 | |||
39 | /** |
||
40 | * @var UuidInterface |
||
41 | */ |
||
42 | private $id; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | private $name; |
||
48 | |||
49 | /** |
||
50 | * @var int |
||
51 | */ |
||
52 | private $players; |
||
53 | |||
54 | /** |
||
55 | * @var string|null |
||
56 | */ |
||
57 | private $publisher; |
||
58 | |||
59 | /** |
||
60 | * @var int|null |
||
61 | */ |
||
62 | private $scoreRank; |
||
63 | |||
64 | /** |
||
65 | * Constructor. |
||
66 | * |
||
67 | * @param int $appId |
||
68 | * @param string $name |
||
69 | * @param string|null $developer |
||
70 | * @param string|null $publisher |
||
71 | * @param int|null $scoreRank |
||
72 | * @param int $players |
||
73 | */ |
||
74 | public function __construct( |
||
91 | |||
92 | /** |
||
93 | * Gets all achievements that belongs to the game. |
||
94 | * |
||
95 | * @return Collection |
||
96 | */ |
||
97 | 1 | public function getAchievements(): Collection |
|
101 | |||
102 | /** |
||
103 | * Gets the unique Steam identifier. |
||
104 | * |
||
105 | * @return int |
||
106 | */ |
||
107 | public function getAppId(): int |
||
111 | |||
112 | /** |
||
113 | * Gets the developer of the game. |
||
114 | * |
||
115 | * @return string |
||
116 | */ |
||
117 | public function getDeveloper(): string |
||
121 | |||
122 | /** |
||
123 | * Gets the unique identifier. |
||
124 | * |
||
125 | * @return UuidInterface |
||
126 | */ |
||
127 | 1 | public function getId(): UuidInterface |
|
131 | |||
132 | /** |
||
133 | * Gets the name of the game. |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | public function getName(): string |
||
141 | |||
142 | /** |
||
143 | * Gets the number of people that owns the game. |
||
144 | * |
||
145 | * @return int |
||
146 | */ |
||
147 | public function getPlayers(): int |
||
151 | |||
152 | /** |
||
153 | * Gets the publisher of the game. |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | public function getPublisher(): string |
||
161 | |||
162 | /** |
||
163 | * Gets the score rank of the game. |
||
164 | * |
||
165 | * @return int |
||
166 | */ |
||
167 | public function getScoreRank(): int |
||
171 | } |
||
172 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: