Amire80 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/194071
Change subject: Shrten long lines in Language to make phpcs pass
......................................................................
Shrten long lines in Language to make phpcs pass
Change-Id: Ied04ebc64cd5a6e54bd0c3de5845342ec89d4d1c
---
M languages/Language.php
1 file changed, 47 insertions(+), 15 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/71/194071/1
diff --git a/languages/Language.php b/languages/Language.php
index d203c0f..ac5420c 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -1254,7 +1254,9 @@
break;
case 'D':
$usedDay = true;
- $s .= $this->getWeekdayAbbreviation(
Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'w' ) + 1 );
+ $s .= $this->getWeekdayAbbreviation(
+ Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 'w' ) + 1
+ );
break;
case 'j':
$usedDay = true;
@@ -1283,7 +1285,9 @@
break;
case 'l':
$usedDay = true;
- $s .= $this->getWeekdayName(
Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'w' ) + 1 );
+ $s .= $this->getWeekdayName(
+ Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 'w' ) + 1
+ );
break;
case 'F':
$usedMonth = true;
@@ -1531,42 +1535,70 @@
$ttl = 3600 - substr( $ts, 10, 2 ) * 60 - substr( $ts,
12, 2 );
} elseif ( $usedAMPM ) {
$ttl = 43200 - ( substr( $ts, 8, 2 ) % 12 ) * 3600 -
substr( $ts, 10, 2 ) * 60 - substr( $ts, 12, 2 );
- } elseif ( $usedDay || $usedHebrewMonth || $usedIranianMonth ||
$usedHijriMonth || $usedHebrewYear || $usedIranianYear || $usedHijriYear ||
$usedTennoYear ) {
- // @todo Someone who understands the non-Gregorian
calendars should write proper logic for them
- // so that they don't need purged every day.
- $ttl = 86400 - substr( $ts, 8, 2 ) * 3600 - substr(
$ts, 10, 2 ) * 60 - substr( $ts, 12, 2 );
+ } elseif (
+ $usedDay ||
+ $usedHebrewMonth ||
+ $usedIranianMonth ||
+ $usedHijriMonth ||
+ $usedHebrewYear ||
+ $usedIranianYear ||
+ $usedHijriYear ||
+ $usedTennoYear
+ ) {
+ // @todo Someone who understands the non-Gregorian
calendars
+ // should write proper logic for them so that they
don't need purged every day.
+ $ttl = 86400 - substr( $ts, 8, 2 ) * 3600 -
+ substr( $ts, 10, 2 ) * 60 - substr( $ts, 12, 2
);
} else {
$possibleTtls = array();
- $timeRemainingInDay = 86400 - substr( $ts, 8, 2 ) *
3600 - substr( $ts, 10, 2 ) * 60 - substr( $ts, 12, 2 );
+ $timeRemainingInDay = 86400 - substr( $ts, 8, 2 ) *
3600 -
+ substr( $ts, 10, 2 ) * 60 - substr( $ts, 12, 2
);
if ( $usedWeek ) {
- $possibleTtls[] = ( 7 -
Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'N' ) ) * 86400 +
$timeRemainingInDay;
+ $possibleTtls[] =
+ ( 7 - Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 'N' ) ) * 86400 +
+ $timeRemainingInDay;
} elseif ( $usedISOYear ) {
// December 28th falls on the last ISO week of
the year, every year.
// The last ISO week of a year can be 52 or 53.
- $lastWeekOfISOYear =
DateTime::createFromFormat( 'Ymd', substr( $ts, 0, 4 ) . '1228', $zone ?: new
DateTimeZone( 'UTC' ) )->format( 'W' );
+ $lastWeekOfISOYear = DateTime::createFromFormat(
+ 'Ymd',
+ substr( $ts, 0, 4 ) . '1228',
+ $zone ?: new DateTimeZone( 'UTC' )
+ )->format( 'W' );
$currentISOWeek = Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 'W' );
$weeksRemaining = $lastWeekOfISOYear -
$currentISOWeek;
- $timeRemainingInWeek = ( 7 -
Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'N' ) ) * 86400 +
$timeRemainingInDay;
+ $timeRemainingInWeek =
+ ( 7 - Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 'N' ) ) * 86400
+ + $timeRemainingInDay;
$possibleTtls[] = $weeksRemaining * 604800 +
$timeRemainingInWeek;
}
if ( $usedMonth ) {
- $possibleTtls[] = (
Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 't' ) - substr( $ts, 6,
2 ) ) * 86400 + $timeRemainingInDay;
+ $possibleTtls[] =
+ ( Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 't' ) -
+ substr( $ts, 6, 2 ) ) * 86400
+ + $timeRemainingInDay;
} elseif ( $usedYear ) {
- $possibleTtls[] = (
Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'L' ) + 364 -
Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'z' ) ) * 86400
+ $possibleTtls[] =
+ ( Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 'L' ) + 364 -
+ Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 'z' ) ) * 86400
+ $timeRemainingInDay;
} elseif ( $usedIsLeapYear ) {
$year = substr( $ts, 0, 4 );
- $timeRemainingInYear = (
Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'L' ) + 364 -
Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'z' ) ) * 86400
+ $timeRemainingInYear =
+ ( Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 'L' ) + 364 -
+ Language::dateTimeObjFormat(
$dateTimeObj, $ts, $zone, 'z' ) ) * 86400
+ $timeRemainingInDay;
$mod = $year % 4;
if ( $mod || ( !( $year % 100 ) && $year % 400
) ) {
// this isn't a leap year. see when the
next one starts
$nextCandidate = $year - $mod + 4;
if ( $nextCandidate % 100 || !(
$nextCandidate % 400 ) ) {
- $possibleTtls[] = (
$nextCandidate - $year - 1 ) * 365 * 86400 + $timeRemainingInYear;
+ $possibleTtls[] = (
$nextCandidate - $year - 1 ) * 365 * 86400 +
+ $timeRemainingInYear;
} else {
- $possibleTtls[] = (
$nextCandidate - $year + 3 ) * 365 * 86400 + $timeRemainingInYear;
+ $possibleTtls[] = (
$nextCandidate - $year + 3 ) * 365 * 86400 +
+ $timeRemainingInYear;
}
} else {
// this is a leap year, so the next
year isn't
--
To view, visit https://gerrit.wikimedia.org/r/194071
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied04ebc64cd5a6e54bd0c3de5845342ec89d4d1c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits