Drop PHP version checked according to our new requirement of PHP 5.5

This commit is contained in:
Adrien Crivelli 2016-12-03 11:35:04 +09:00
parent 5b7d6cc524
commit 22b9a3f66f
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
1 changed files with 1 additions and 29 deletions

View File

@ -75,30 +75,6 @@ class TimeZone
return self::$timezone; return self::$timezone;
} }
/**
* Return the Timezone transition for the specified timezone and timestamp
*
* @param DateTimeZone $objTimezone The timezone for finding the transitions
* @param int $timestamp PHP date/time value for finding the current transition
* @return array The current transition details
*/
private static function getTimezoneTransitions($objTimezone, $timestamp)
{
$allTransitions = $objTimezone->getTransitions();
$transitions = [];
foreach ($allTransitions as $key => $transition) {
if ($transition['ts'] > $timestamp) {
$transitions[] = ($key > 0) ? $allTransitions[$key - 1] : $transition;
break;
}
if (empty($transitions)) {
$transitions[] = end($allTransitions);
}
}
return $transitions;
}
/** /**
* Return the Timezone offset used for date/time conversions to/from UST * Return the Timezone offset used for date/time conversions to/from UST
* This requires both the timezone and the calculated date/time to allow for local DST * This requires both the timezone and the calculated date/time to allow for local DST
@ -123,11 +99,7 @@ class TimeZone
} }
$objTimezone = new \DateTimeZone($timezone); $objTimezone = new \DateTimeZone($timezone);
if (version_compare(PHP_VERSION, '5.3.0') >= 0) { $transitions = $objTimezone->getTransitions($timestamp, $timestamp);
$transitions = $objTimezone->getTransitions($timestamp, $timestamp);
} else {
$transitions = self::getTimezoneTransitions($objTimezone, $timestamp);
}
return (count($transitions) > 0) ? $transitions[0]['offset'] : 0; return (count($transitions) > 0) ? $transitions[0]['offset'] : 0;
} }