@@ 79-81 (lines=3) @@ | ||
76 | * @return string |
|
77 | */ |
|
78 | public function formatDuration( $seconds, array $chosenIntervals = [] ) { |
|
79 | if ( empty( $chosenIntervals ) ) { |
|
80 | $chosenIntervals = [ 'centuries', 'years', 'days', 'hours', 'minutes', 'seconds' ]; |
|
81 | } |
|
82 | ||
83 | $intervals = $this->getDurationIntervals( $seconds, $chosenIntervals ); |
|
84 |
@@ 2322-2333 (lines=12) @@ | ||
2319 | * @return array |
|
2320 | */ |
|
2321 | public function getDurationIntervals( $seconds, array $chosenIntervals = [] ) { |
|
2322 | if ( empty( $chosenIntervals ) ) { |
|
2323 | $chosenIntervals = [ |
|
2324 | 'millennia', |
|
2325 | 'centuries', |
|
2326 | 'decades', |
|
2327 | 'years', |
|
2328 | 'days', |
|
2329 | 'hours', |
|
2330 | 'minutes', |
|
2331 | 'seconds' |
|
2332 | ]; |
|
2333 | } |
|
2334 | ||
2335 | $intervals = array_intersect_key( self::$durationIntervals, array_flip( $chosenIntervals ) ); |
|
2336 | $sortedNames = array_keys( $intervals ); |