Code Duplication    Length = 5-5 lines in 3 locations

includes/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/filebackend/SwiftFileBackend.php 2 locations

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