Code Duplication    Length = 5-5 lines in 3 locations

includes/libs/filebackend/MemoryFileBackend.php 1 location

@@ 77-81 (lines=5) @@
74
		MediaWiki\suppressWarnings();
75
		$data = file_get_contents( $params['src'] );
76
		MediaWiki\restoreWarnings();
77
		if ( $data === false ) { // source doesn't exist?
78
			$status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
79
80
			return $status;
81
		}
82
83
		$this->files[$dst] = [
84
			'data' => $data,

includes/libs/filebackend/SwiftFileBackend.php 2 locations

@@ 309-313 (lines=5) @@
306
		MediaWiki\suppressWarnings();
307
		$sha1Hash = sha1_file( $params['src'] );
308
		MediaWiki\restoreWarnings();
309
		if ( $sha1Hash === false ) { // source doesn't exist?
310
			$status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
311
312
			return $status;
313
		}
314
		$sha1Hash = Wikimedia\base_convert( $sha1Hash, 16, 36, 31 );
315
		$contentType = isset( $params['headers']['content-type'] )
316
			? $params['headers']['content-type']
@@ 320-324 (lines=5) @@
317
			: $this->getContentType( $params['dst'], null, $params['src'] );
318
319
		$handle = fopen( $params['src'], 'rb' );
320
		if ( $handle === false ) { // source doesn't exist?
321
			$status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
322
323
			return $status;
324
		}
325
326
		$reqs = [ [
327
			'method' => 'PUT',