1 | <?php |
||
15 | final class CredentialResponseItem |
||
16 | { |
||
17 | /** |
||
18 | * @var int|null |
||
19 | */ |
||
20 | private $sizeBytes; |
||
21 | |||
22 | /** |
||
23 | * @var \DateTime |
||
24 | */ |
||
25 | private $createdAt; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $mailbox; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $login; |
||
36 | |||
37 | /** |
||
38 | * @param array $data |
||
39 | * |
||
40 | * @return self |
||
41 | */ |
||
42 | public static function create(array $data) |
||
51 | |||
52 | /** |
||
53 | * @param int $sizeBytes |
||
54 | * @param \DateTime $createdAt |
||
55 | * @param string $mailbox |
||
56 | * @param string $login |
||
57 | */ |
||
58 | private function __construct($sizeBytes, \DateTime $createdAt, $mailbox, $login) |
||
65 | |||
66 | /** |
||
67 | * @return int|null |
||
68 | */ |
||
69 | public function getSizeBytes() |
||
73 | |||
74 | /** |
||
75 | * @return \DateTime |
||
76 | */ |
||
77 | public function getCreatedAt() |
||
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getMailbox() |
||
89 | |||
90 | /** |
||
91 | * @return string |
||
92 | */ |
||
93 | public function getLogin() |
||
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: