Code Duplication    Length = 14-14 lines in 2 locations

Classes/Index/IndexAnalyser.php 2 locations

@@ 88-101 (lines=14) @@
85
     * @param \TYPO3\CMS\Core\Resource\ResourceStorage $storage
86
     * @return array
87
     */
88
    public function searchForDuplicateIdentifiers(ResourceStorage $storage)
89
    {
90
91
        // Detect duplicate records.
92
        $query = "SELECT identifier FROM sys_file WHERE storage = {$storage->getUid()} GROUP BY identifier, storage Having COUNT(*) > 1";
93
        $resource = $this->getDatabaseConnection()->sql_query($query);
94
        $duplicates = [];
95
        while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($resource)) {
96
            $clause = sprintf('identifier = "%s" AND storage = %s', $row['identifier'], $storage->getUid());
97
            $records = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_file', $clause);
98
            $duplicates[$row['identifier']] = $records;
99
        }
100
        return $duplicates;
101
    }
102
103
    /**
104
     * Return duplicates file records
@@ 109-122 (lines=14) @@
106
     * @param \TYPO3\CMS\Core\Resource\ResourceStorage $storage
107
     * @return array
108
     */
109
    public function searchForDuplicateSha1(ResourceStorage $storage)
110
    {
111
112
        // Detect duplicate records.
113
        $query = "SELECT sha1 FROM sys_file WHERE storage = {$storage->getUid()} GROUP BY sha1, storage Having COUNT(*) > 1";
114
        $resource = $this->getDatabaseConnection()->sql_query($query);
115
        $duplicates = [];
116
        while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($resource)) {
117
            $clause = sprintf('sha1 = "%s" AND storage = %s', $row['sha1'], $storage->getUid());
118
            $records = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_file', $clause);
119
            $duplicates[$row['sha1']] = $records;
120
        }
121
        return $duplicates;
122
    }
123
124
    /**
125
     * @param string $tableName