1 | <?php |
||
6 | class MovieDTO |
||
7 | { |
||
8 | private $originalTitle, $originalPosterUrl, $imdbId, $budget, $runtime, $releaseDate; |
||
|
|||
9 | |||
10 | /** |
||
11 | * MovieDTO constructor. |
||
12 | * @param null|string $originalTitle |
||
13 | * @param null|string $originalPosterUrl |
||
14 | * @param null|string $imdbId |
||
15 | * @param int|null $budget |
||
16 | * @param int|null $runtime |
||
17 | * @param null|string $releaseDate |
||
18 | * @throws \Exception |
||
19 | */ |
||
20 | 2 | public function __construct(?string $originalTitle, ?string $originalPosterUrl, ?string $imdbId, ?int $budget, ?int $runtime, ?string $releaseDate) |
|
29 | |||
30 | /** |
||
31 | * @return null|string |
||
32 | */ |
||
33 | 2 | public function getOriginalTitle(): ?string |
|
37 | |||
38 | /** |
||
39 | * @return null|string |
||
40 | */ |
||
41 | 2 | public function getOriginalPosterUrl(): ?string |
|
45 | |||
46 | /** |
||
47 | * @return null|string |
||
48 | */ |
||
49 | public function getImdbId(): ?string |
||
53 | |||
54 | /** |
||
55 | * @return int |
||
56 | */ |
||
57 | public function getBudget(): int |
||
61 | |||
62 | /** |
||
63 | * @return int |
||
64 | */ |
||
65 | public function getRuntime(): int |
||
69 | |||
70 | /** |
||
71 | * @return \DateTimeImmutable |
||
72 | */ |
||
73 | public function getReleaseDate(): \DateTimeImmutable |
||
77 | } |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.