Code Duplication    Length = 11-17 lines in 2 locations

includes/installer/LocalSettingsGenerator.php 1 location

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

includes/api/ApiBase.php 1 location

@@ 1388-1398 (lines=11) @@
1385
	 * @param string|array $v
1386
	 * @return string|array
1387
	 */
1388
	private static function escapeWikiText( $v ) {
1389
		if ( is_array( $v ) ) {
1390
			return array_map( 'self::escapeWikiText', $v );
1391
		} else {
1392
			return strtr( $v, [
1393
				'__' => '__', '{' => '{', '}' => '}',
1394
				'[[Category:' => '[[:Category:',
1395
				'[[File:' => '[[:File:', '[[Image:' => '[[:Image:',
1396
			] );
1397
		}
1398
	}
1399
1400
	/**
1401
	 * Create a Message from a string or array