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

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