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 | * @param array $data |
||
39 | * |
||
40 | * @return self |
||
41 | */ |
||
42 | public static function create(array $data) |
||
51 | |||
52 | /** |
||
53 | * @param \DateTime $time |
||
54 | * @param array $accepted |
||
55 | * @param array $delivered |
||
56 | * @param array $failed |
||
57 | */ |
||
58 | private function __construct(\DateTime $time, array $accepted, array $delivered, array $failed) |
||
65 | |||
66 | /** |
||
67 | * @return \DateTime |
||
68 | */ |
||
69 | public function getTime() |
||
73 | |||
74 | /** |
||
75 | * @return array |
||
76 | */ |
||
77 | public function getAccepted() |
||
81 | |||
82 | /** |
||
83 | * @return array |
||
84 | */ |
||
85 | public function getDelivered() |
||
89 | |||
90 | /** |
||
91 | * @return array |
||
92 | */ |
||
93 | public function getFailed() |
||
97 | } |
||
98 |
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: