Code Duplication    Length = 17-17 lines in 2 locations

includes/libs/filebackend/FSFileBackend.php 2 locations

@@ 597-613 (lines=17) @@
594
	 * @param array $params
595
	 * @return array|FSFileBackendDirList|null
596
	 */
597
	public function getDirectoryListInternal( $fullCont, $dirRel, array $params ) {
598
		list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] );
599
		$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
600
		$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
601
		$exists = is_dir( $dir );
602
		if ( !$exists ) {
603
			$this->logger->warning( __METHOD__ . "() given directory does not exist: '$dir'\n" );
604
605
			return []; // nothing under this dir
606
		} elseif ( !is_readable( $dir ) ) {
607
			$this->logger->warning( __METHOD__ . "() given directory is unreadable: '$dir'\n" );
608
609
			return null; // bad permissions?
610
		}
611
612
		return new FSFileBackendDirList( $dir, $params );
613
	}
614
615
	/**
616
	 * @see FileBackendStore::getFileListInternal()
@@ 622-638 (lines=17) @@
619
	 * @param array $params
620
	 * @return array|FSFileBackendFileList|null
621
	 */
622
	public function getFileListInternal( $fullCont, $dirRel, array $params ) {
623
		list( , $shortCont, ) = FileBackend::splitStoragePath( $params['dir'] );
624
		$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
625
		$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
626
		$exists = is_dir( $dir );
627
		if ( !$exists ) {
628
			$this->logger->warning( __METHOD__ . "() given directory does not exist: '$dir'\n" );
629
630
			return []; // nothing under this dir
631
		} elseif ( !is_readable( $dir ) ) {
632
			$this->logger->warning( __METHOD__ . "() given directory is unreadable: '$dir'\n" );
633
634
			return null; // bad permissions?
635
		}
636
637
		return new FSFileBackendFileList( $dir, $params );
638
	}
639
640
	protected function doGetLocalReferenceMulti( array $params ) {
641
		$fsFiles = []; // (path => FSFile)