1 | <?php |
||
15 | final class AllResponseItem |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $id; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $event; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $totalCount; |
||
31 | |||
32 | /** |
||
33 | * @var string[] |
||
34 | */ |
||
35 | private $tags; |
||
36 | |||
37 | /** |
||
38 | * @var \DateTime |
||
39 | */ |
||
40 | private $createdAt; |
||
41 | |||
42 | /** |
||
43 | * @param array $data |
||
44 | * |
||
45 | * @return self |
||
46 | */ |
||
47 | public static function create(array $data) |
||
57 | |||
58 | /** |
||
59 | * @param string $id |
||
60 | * @param string $event |
||
61 | * @param string $totalCount |
||
62 | * @param \string[] $tags |
||
63 | * @param \DateTime $createdAt |
||
64 | */ |
||
65 | private function __construct($id, $event, $totalCount, array $tags, \DateTime $createdAt) |
||
73 | |||
74 | /** |
||
75 | * @return string |
||
76 | */ |
||
77 | public function getId() |
||
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getEvent() |
||
89 | |||
90 | /** |
||
91 | * @return string |
||
92 | */ |
||
93 | public function getTotalCount() |
||
97 | |||
98 | /** |
||
99 | * @return string[] |
||
100 | */ |
||
101 | public function getTags() |
||
105 | |||
106 | /** |
||
107 | * @return \DateTime |
||
108 | */ |
||
109 | public function getCreatedAt() |
||
113 | } |
||
114 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: