Code Duplication    Length = 3-12 lines in 2 locations

languages/classes/LanguageZh_hans.php 1 location

@@ 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

languages/Language.php 1 location

@@ 2302-2313 (lines=12) @@
2299
	 * @return array
2300
	 */
2301
	public function getDurationIntervals( $seconds, array $chosenIntervals = [] ) {
2302
		if ( empty( $chosenIntervals ) ) {
2303
			$chosenIntervals = [
2304
				'millennia',
2305
				'centuries',
2306
				'decades',
2307
				'years',
2308
				'days',
2309
				'hours',
2310
				'minutes',
2311
				'seconds'
2312
			];
2313
		}
2314
2315
		$intervals = array_intersect_key( self::$durationIntervals, array_flip( $chosenIntervals ) );
2316
		$sortedNames = array_keys( $intervals );