Code Duplication    Length = 14-15 lines in 2 locations

application/tests/_ci_phpunit_test/replacing/libraries/Upload.php 2 locations

@@ 1223-1237 (lines=15) @@
1220
1221
		// Fileinfo extension - most reliable method
1222
		$finfo = @finfo_open(FILEINFO_MIME);
1223
		if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
1224
		{
1225
			$mime = @finfo_file($finfo, $file['tmp_name']);
1226
			finfo_close($finfo);
1227
1228
			/* According to the comments section of the PHP manual page,
1229
			 * it is possible that this function returns an empty string
1230
			 * for some files (e.g. if they don't exist in the magic MIME database)
1231
			 */
1232
			if (is_string($mime) && preg_match($regexp, $mime, $matches))
1233
			{
1234
				$this->file_type = $matches[1];
1235
				return;
1236
			}
1237
		}
1238
1239
		/* This is an ugly hack, but UNIX-type systems provide a "native" way to detect the file type,
1240
		 * which is still more secure than depending on the value of $_FILES[$field]['type'], and as it
@@ 1256-1269 (lines=14) @@
1253
				? 'file --brief --mime '.escapeshellarg($file['tmp_name']).' 2>&1'
1254
				: 'file --brief --mime '.$file['tmp_name'].' 2>&1';
1255
1256
			if (function_usable('exec'))
1257
			{
1258
				/* This might look confusing, as $mime is being populated with all of the output when set in the second parameter.
1259
				 * However, we only need the last line, which is the actual return value of exec(), and as such - it overwrites
1260
				 * anything that could already be set for $mime previously. This effectively makes the second parameter a dummy
1261
				 * value, which is only put to allow us to get the return status code.
1262
				 */
1263
				$mime = @exec($cmd, $mime, $return_status);
1264
				if ($return_status === 0 && is_string($mime) && preg_match($regexp, $mime, $matches))
1265
				{
1266
					$this->file_type = $matches[1];
1267
					return;
1268
				}
1269
			}
1270
1271
			if ( ! ini_get('safe_mode') && function_usable('shell_exec'))
1272
			{