Change private method to protected

This commit is contained in:
bancer 2019-01-31 09:49:41 +01:00
parent e94183c6d8
commit bb20b4f419

View file

@ -369,7 +369,7 @@ class CakeTime {
$format = static::$niceFormat; $format = static::$niceFormat;
} }
$convertedFormat = static::convertSpecifiers($format, $timestamp); $convertedFormat = static::convertSpecifiers($format, $timestamp);
return static::__strftimeWithTimezone($convertedFormat, $timestamp, $date, $timezone); return static::_strftimeWithTimezone($convertedFormat, $timestamp, $date, $timezone);
} }
/** /**
@ -394,19 +394,19 @@ class CakeTime {
$timestamp = static::fromString($date, $timezone); $timestamp = static::fromString($date, $timezone);
if (static::isToday($date, $timezone)) { if (static::isToday($date, $timezone)) {
$formattedDate = static::__strftimeWithTimezone("%H:%M", $timestamp, $date, $timezone); $formattedDate = static::_strftimeWithTimezone("%H:%M", $timestamp, $date, $timezone);
return __d('cake', 'Today, %s', $formattedDate); return __d('cake', 'Today, %s', $formattedDate);
} }
if (static::wasYesterday($date, $timezone)) { if (static::wasYesterday($date, $timezone)) {
$formattedDate = static::__strftimeWithTimezone("%H:%M", $timestamp, $date, $timezone); $formattedDate = static::_strftimeWithTimezone("%H:%M", $timestamp, $date, $timezone);
return __d('cake', 'Yesterday, %s', $formattedDate); return __d('cake', 'Yesterday, %s', $formattedDate);
} }
if (static::isTomorrow($date, $timezone)) { if (static::isTomorrow($date, $timezone)) {
$formattedDate = static::__strftimeWithTimezone("%H:%M", $timestamp, $date, $timezone); $formattedDate = static::_strftimeWithTimezone("%H:%M", $timestamp, $date, $timezone);
return __d('cake', 'Tomorrow, %s', $formattedDate); return __d('cake', 'Tomorrow, %s', $formattedDate);
} }
$d = static::__strftimeWithTimezone("%w", $timestamp, $date, $timezone); $d = static::_strftimeWithTimezone("%w", $timestamp, $date, $timezone);
$day = array( $day = array(
__d('cake', 'Sunday'), __d('cake', 'Sunday'),
__d('cake', 'Monday'), __d('cake', 'Monday'),
@ -417,11 +417,11 @@ class CakeTime {
__d('cake', 'Saturday') __d('cake', 'Saturday')
); );
if (static::wasWithinLast('7 days', $date, $timezone)) { if (static::wasWithinLast('7 days', $date, $timezone)) {
$formattedDate = static::__strftimeWithTimezone(static::$niceShortFormat, $timestamp, $date, $timezone); $formattedDate = static::_strftimeWithTimezone(static::$niceShortFormat, $timestamp, $date, $timezone);
return sprintf('%s %s', $day[$d], $formattedDate); return sprintf('%s %s', $day[$d], $formattedDate);
} }
if (static::isWithinNext('7 days', $date, $timezone)) { if (static::isWithinNext('7 days', $date, $timezone)) {
$formattedDate = static::__strftimeWithTimezone(static::$niceShortFormat, $timestamp, $date, $timezone); $formattedDate = static::_strftimeWithTimezone(static::$niceShortFormat, $timestamp, $date, $timezone);
return __d('cake', 'On %s %s', $day[$d], $formattedDate); return __d('cake', 'On %s %s', $day[$d], $formattedDate);
} }
@ -430,7 +430,7 @@ class CakeTime {
$y = ' %Y'; $y = ' %Y';
} }
$format = static::convertSpecifiers("%b %eS{$y}, %H:%M", $timestamp); $format = static::convertSpecifiers("%b %eS{$y}, %H:%M", $timestamp);
return static::__strftimeWithTimezone($format, $timestamp, $date, $timezone); return static::_strftimeWithTimezone($format, $timestamp, $date, $timezone);
} }
/** /**
@ -1072,7 +1072,7 @@ class CakeTime {
$format = '%x'; $format = '%x';
} }
$convertedFormat = static::convertSpecifiers($format, $timestamp); $convertedFormat = static::convertSpecifiers($format, $timestamp);
return static::__strftimeWithTimezone($convertedFormat, $timestamp, $date, $timezone); return static::_strftimeWithTimezone($convertedFormat, $timestamp, $date, $timezone);
} }
/** /**
@ -1193,7 +1193,7 @@ class CakeTime {
* @param string|DateTimeZone $timezone Timezone string or DateTimeZone object. * @param string|DateTimeZone $timezone Timezone string or DateTimeZone object.
* @return string Formatted date string with correct encoding. * @return string Formatted date string with correct encoding.
*/ */
private static function __strftimeWithTimezone($format, $timestamp, $date, $timezone) { protected static function _strftimeWithTimezone($format, $timestamp, $date, $timezone) {
$serverTimeZone = date_default_timezone_get(); $serverTimeZone = date_default_timezone_get();
if ( if (
!empty($timezone) && !empty($timezone) &&