Code Duplication    Length = 10-12 lines in 3 locations

Classes/Tool/DuplicateFilesFinderTool.php 1 location

@@ 67-76 (lines=10) @@
64
        $duplicateFilesReports = [];
65
66
        if ($this->getBackendUser()->isAdmin()) {
67
            foreach ($this->getStorageRepository()->findAll() as $storage) {
68
                if ($storage->isOnline()) {
69
                    $duplicateFiles = $this->getIndexAnalyser()->searchForDuplicateSha1($storage);
70
                    $duplicateFilesReports[] = array(
71
                        'storage' => $storage,
72
                        'duplicateFiles' => $duplicateFiles,
73
                        'numberOfDuplicateFiles' => count($duplicateFiles),
74
                    );
75
                }
76
            }
77
        } else {
78
79
            $fileMounts = $this->getBackendUser()->getFileMountRecords();

Classes/Tool/DuplicateRecordsFinderTool.php 1 location

@@ 58-68 (lines=11) @@
55
        $view = $this->initializeStandaloneView($templateNameAndPath);
56
57
        $duplicateRecordsReports = [];
58
        foreach ($this->getStorageRepository()->findAll() as $storage) {
59
60
            if ($storage->isOnline()) {
61
                $duplicateFiles = $this->getIndexAnalyser()->searchForDuplicateIdentifiers($storage);
62
                $duplicateRecordsReports[] = array(
63
                    'storage' => $storage,
64
                    'duplicateFiles' => $duplicateFiles,
65
                    'numberOfDuplicateFiles' => count($duplicateFiles),
66
                );
67
            }
68
        }
69
70
        $view->assign('duplicateRecordsReports', $duplicateRecordsReports);
71

Classes/Tool/MissingFilesFinderTool.php 1 location

@@ 65-76 (lines=12) @@
62
        $view = $this->initializeStandaloneView($templateNameAndPath);
63
64
        $missingReports = [];
65
        foreach ($this->getStorageRepository()->findAll() as $storage) {
66
67
            if ($storage->isOnline()) {
68
                $missingFiles = $this->getIndexAnalyser()->searchForMissingFiles($storage);
69
70
                $missingReports[] = array(
71
                    'storage' => $storage,
72
                    'missingFiles' => $missingFiles,
73
                    'numberOfMissingFiles' => count($missingFiles),
74
                );
75
            }
76
        }
77
78
        $view->assign('missingReports', $missingReports);
79