| @@ 94-108 (lines=15) @@ | ||
| 91 | $gmt_offset = (int)$gmt_offset; |
|
| 92 | /** @var array[] $abbreviations */ |
|
| 93 | $abbreviations = DateTimeZone::listAbbreviations(); |
|
| 94 | foreach ($abbreviations as $abbreviation) { |
|
| 95 | foreach ($abbreviation as $timezone) { |
|
| 96 | if ((int)$timezone['offset'] === $gmt_offset && (bool)$timezone['dst'] === false) { |
|
| 97 | try { |
|
| 98 | $offset = $this->getTimezoneOffset(new DateTimeZone($timezone['timezone_id'])); |
|
| 99 | if ($offset !== $gmt_offset) { |
|
| 100 | continue; |
|
| 101 | } |
|
| 102 | return $timezone['timezone_id']; |
|
| 103 | } catch (Exception $e) { |
|
| 104 | continue; |
|
| 105 | } |
|
| 106 | } |
|
| 107 | } |
|
| 108 | } |
|
| 109 | //if $coerce is true, let's see if we can get a timezone string after the offset is adjusted |
|
| 110 | if ($coerce === true) { |
|
| 111 | $timezone_string = $this->getTimezoneStringFromAbbreviationsList( |
|
| @@ 141-155 (lines=15) @@ | ||
| 138 | $gmt_offset = (int) $gmt_offset; |
|
| 139 | /** @var array[] $abbreviations */ |
|
| 140 | $abbreviations = DateTimeZone::listAbbreviations(); |
|
| 141 | foreach ($abbreviations as $abbreviation) { |
|
| 142 | foreach ($abbreviation as $timezone) { |
|
| 143 | if ((int) $timezone['offset'] === $gmt_offset && (bool) $timezone['dst'] === false) { |
|
| 144 | try { |
|
| 145 | $offset = self::get_timezone_offset(new DateTimeZone($timezone['timezone_id'])); |
|
| 146 | if ($offset !== $gmt_offset) { |
|
| 147 | continue; |
|
| 148 | } |
|
| 149 | return $timezone['timezone_id']; |
|
| 150 | } catch (Exception $e) { |
|
| 151 | continue; |
|
| 152 | } |
|
| 153 | } |
|
| 154 | } |
|
| 155 | } |
|
| 156 | //if $coerce is true, let's see if we can get a timezone string after the offset is adjusted |
|
| 157 | if ($coerce === true) { |
|
| 158 | $timezone_string = self::get_timezone_string_from_abbreviations_list( |
|