Code Duplication    Length = 11-17 lines in 2 locations

includes/installer/LocalSettingsGenerator.php 1 location

@@ 114-130 (lines=17) @@
111
	 *
112
	 * @return string
113
	 */
114
	public static function escapePhpString( $string ) {
115
		if ( is_array( $string ) || is_object( $string ) ) {
116
			return false;
117
		}
118
119
		return strtr(
120
			$string,
121
			[
122
				"\n" => "\\n",
123
				"\r" => "\\r",
124
				"\t" => "\\t",
125
				"\\" => "\\\\",
126
				"\$" => "\\\$",
127
				"\"" => "\\\""
128
			]
129
		);
130
	}
131
132
	/**
133
	 * Return the full text of the generated LocalSettings.php file,

includes/api/ApiBase.php 1 location

@@ 1487-1497 (lines=11) @@
1484
	 * @param string|array $v
1485
	 * @return string|array
1486
	 */
1487
	private static function escapeWikiText( $v ) {
1488
		if ( is_array( $v ) ) {
1489
			return array_map( 'self::escapeWikiText', $v );
1490
		} else {
1491
			return strtr( $v, [
1492
				'__' => '__', '{' => '{', '}' => '}',
1493
				'[[Category:' => '[[:Category:',
1494
				'[[File:' => '[[:File:', '[[Image:' => '[[:Image:',
1495
			] );
1496
		}
1497
	}
1498
1499
	/**
1500
	 * Create a Message from a string or array