Skip to content

Commit

Permalink
code standardization, space fixes and class functions+vars to public …
Browse files Browse the repository at this point in the history
…where undefined
  • Loading branch information
liedekef committed Dec 30, 2022
1 parent 217e50e commit ad7001a
Show file tree
Hide file tree
Showing 33 changed files with 2,715 additions and 2,711 deletions.
12 changes: 6 additions & 6 deletions class-expressivedate.php
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ public function setTimestampFromString( $string ): ExpressiveDate {
public function isWeekday(): bool {
$day = $this->getDayOfWeek();

return ! in_array( $day, array( 'Saturday', 'Sunday' ) );
return ! in_array( $day, [ 'Saturday', 'Sunday' ] );
}

/**
Expand Down Expand Up @@ -837,7 +837,7 @@ public function getDifferenceInMonths( $compare = null ): string {

$difference = $this->diff( $compare );

list($years, $months) = explode( ':', $difference->format( '%y:%m' ) );
[$years, $months] = explode( ':', $difference->format( '%y:%m' ) );

return ( ( $years * 12 ) + $months ) * $difference->format( '%r1' );
}
Expand Down Expand Up @@ -895,7 +895,7 @@ public function getDifferenceInSeconds( $compare = null ) {

$difference = $this->diff( $compare );

list($days, $hours, $minutes, $seconds) = explode( ':', $difference->format( '%a:%h:%i:%s' ) );
[$days, $hours, $minutes, $seconds] = explode( ':', $difference->format( '%a:%h:%i:%s' ) );

// Add the total amount of seconds in all the days.
$seconds += ( $days * 24 * 60 * 60 );
Expand All @@ -920,8 +920,8 @@ public function getRelativeDate( $compare = null ) {
$compare = new ExpressiveDate( 'now', $this->getTimezone() );
}

$units = array( 'second', 'minute', 'hour', 'day', 'week', 'month', 'year' );
$values = array( 60, 60, 24, 7, 4.35, 12 );
$units = [ 'second', 'minute', 'hour', 'day', 'week', 'month', 'year' ];
$values = [ 60, 60, 24, 7, 4.35, 12 ];

// Get the difference between the two timestamps. We'll use this to cacluate the
// actual time remaining.
Expand Down Expand Up @@ -1027,7 +1027,7 @@ public function setWeekStartDay( $weekStartDay ) {
if ( is_numeric( $weekStartDay ) ) {
$this->weekStartDay = $weekStartDay;
} else {
$this->weekStartDay = array_search( strtolower( $weekStartDay ), array( 'sunday', 'monday' ) );
$this->weekStartDay = array_search( strtolower( $weekStartDay ), [ 'sunday', 'monday' ] );
}

return $this;
Expand Down
Loading

0 comments on commit ad7001a

Please sign in to comment.