1 | <?php |
||
20 | class ZoneInfo extends DateTimeZone |
||
21 | { |
||
22 | /** |
||
23 | * @var DateTimeImmutable |
||
24 | */ |
||
25 | private $dateTime; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | private $timestamp; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $country; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private $info; |
||
41 | |||
42 | /** |
||
43 | * ZoneInfo constructor. |
||
44 | * |
||
45 | * @param string $id IANA Timezone identifier. |
||
46 | * @param int $timestamp Seconds since January 1, 1970 UTC. |
||
47 | */ |
||
48 | public function __construct($id, $timestamp) |
||
56 | |||
57 | /** |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getAbbreviation() |
||
64 | |||
65 | /** |
||
66 | * @return string |
||
67 | */ |
||
68 | public function getCountry() |
||
72 | |||
73 | /** |
||
74 | * @return DateTimeImmutable |
||
75 | */ |
||
76 | public function getDateTime() |
||
80 | |||
81 | /** |
||
82 | * @return int |
||
83 | */ |
||
84 | public function getTimestamp() |
||
88 | |||
89 | /** |
||
90 | * @return int |
||
91 | */ |
||
92 | public function getUtcOffset() |
||
96 | |||
97 | /** |
||
98 | * @return boolean |
||
99 | */ |
||
100 | public function isDst() |
||
104 | |||
105 | /** |
||
106 | * Lazily loads the transition info. |
||
107 | * |
||
108 | * @return array |
||
109 | */ |
||
110 | private function loadInfo() |
||
118 | |||
119 | /** |
||
120 | * @param int $timestamp |
||
121 | * |
||
122 | * @return array |
||
123 | */ |
||
124 | private function getCurrentTransition($timestamp) |
||
133 | } |
||
134 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.