Code Duplication    Length = 13-18 lines in 5 locations

languages/classes/LanguageBg.php 1 location

@@ 29-45 (lines=17) @@
26
 *
27
 * @ingroup Language
28
 */
29
class LanguageBg extends Language {
30
	/**
31
	 * ISO number formatting: 123 456 789,99.
32
	 * Avoid tripple grouping by numbers with whole part up to 4 digits.
33
	 *
34
	 * @param string $_
35
	 *
36
	 * @return string
37
	 */
38
	function commafy( $_ ) {
39
		if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
40
			return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
41
		} else {
42
			return $_;
43
		}
44
	}
45
}
46

languages/classes/LanguageEs.php 1 location

@@ 29-42 (lines=14) @@
26
 *
27
 * @ingroup Language
28
 */
29
class LanguageEs extends Language {
30
31
	/**
32
	 * @param string $_
33
	 * @return string
34
	 */
35
	function commafy( $_ ) {
36
		if ( !preg_match( '/^-?\d{1,4}(\.\d+)?$/', $_ ) ) {
37
			return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
38
		} else {
39
			return $_;
40
		}
41
	}
42
}
43

languages/classes/LanguageEt.php 1 location

@@ 29-42 (lines=14) @@
26
 *
27
 * @ingroup Language
28
 */
29
class LanguageEt extends Language {
30
	/**
31
	 * Avoid grouping whole numbers between -9999 to 9999
32
	 * @param string $_
33
	 * @return string
34
	 */
35
	function commafy( $_ ) {
36
		if ( !preg_match( '/^\-?\d{1,4}(\.\d+)?$/', $_ ) ) {
37
			return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
38
		} else {
39
			return $_;
40
		}
41
	}
42
}
43

languages/classes/LanguageKu_ku.php 1 location

@@ 30-47 (lines=18) @@
27
 * @ingroup Language
28
 */
29
// @codingStandardsIgnoreStart Ignore class name is not in camel caps format error
30
class LanguageKu_ku extends Language {
31
	// @codingStandardsIgnoreEnd
32
	/**
33
	 * Avoid grouping whole numbers between 0 to 9999
34
	 *
35
	 * @param string $_
36
	 *
37
	 * @return string
38
	 */
39
	function commafy( $_ ) {
40
41
		if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
42
			return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
43
		} else {
44
			return $_;
45
		}
46
	}
47
}
48

languages/classes/LanguagePl.php 1 location

@@ 29-41 (lines=13) @@
26
 *
27
 * @ingroup Language
28
 */
29
class LanguagePl extends Language {
30
	/**
31
	 * @param string $_
32
	 * @return string
33
	 */
34
	function commafy( $_ ) {
35
		if ( !preg_match( '/^\-?\d{1,4}(\.\d+)?$/', $_ ) ) {
36
			return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
37
		} else {
38
			return $_;
39
		}
40
	}
41
}
42