1 | <?php |
||
15 | class TotalResponseItem |
||
16 | { |
||
17 | /** |
||
18 | * @var \DateTime |
||
19 | */ |
||
20 | private $time; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | private $accepted; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | private $delivered; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | private $failed; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private $complained; |
||
41 | |||
42 | /** |
||
43 | * @param array $data |
||
44 | * |
||
45 | * @return self |
||
46 | */ |
||
47 | 4 | public static function create(array $data) |
|
57 | |||
58 | /** |
||
59 | * @param \DateTime $time |
||
60 | * @param array $accepted |
||
61 | * @param array $delivered |
||
62 | * @param array $failed |
||
63 | * @param array $complained |
||
64 | */ |
||
65 | 4 | private function __construct(\DateTime $time, array $accepted, array $delivered, array $failed, array $complained) |
|
73 | |||
74 | /** |
||
75 | * @return \DateTime |
||
76 | */ |
||
77 | 1 | public function getTime() |
|
81 | |||
82 | /** |
||
83 | * @return array |
||
84 | */ |
||
85 | public function getAccepted() |
||
89 | |||
90 | /** |
||
91 | * @return array |
||
92 | */ |
||
93 | public function getDelivered() |
||
97 | |||
98 | /** |
||
99 | * @return array |
||
100 | */ |
||
101 | public function getFailed() |
||
105 | |||
106 | /** |
||
107 | * @return array |
||
108 | */ |
||
109 | 1 | public function getComplained() |
|
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: