Code Duplication    Length = 25-25 lines in 3 locations

src/Handlers/OkFileHandler.php 1 location

@@ 250-274 (lines=25) @@
247
     * @todo Refactorig required, because of duplicate method
248
     * @see \TechDivision\Import\Loaders\Filters\OkFileFilter::getOkFilenames()
249
     */
250
    protected function getOkFilenames() : array
251
    {
252
253
        // initialize the array for the available okFilenames
254
        $okFilenames = array();
255
256
        // prepare the OK filenames based on the found CSV file information
257
        for ($i = 1; $i <= sizeof($patternKeys = $this->getPatternKeys()); $i++) {
258
            // intialize the array for the parts of the names (prefix, filename + counter)
259
            $parts = array();
260
            // load the parts from the matches
261
            for ($z = 0; $z < $i; $z++) {
262
                // append the part
263
                $parts[] = $this->getLoader()->getMatch($patternKeys[$z]);
264
            }
265
266
            // query whether or not, the OK file exists, if yes append it
267
            if (file_exists($okFilename = $this->prepareOkFilename($parts))) {
268
                $okFilenames[] = $okFilename;
269
            }
270
        }
271
272
        // prepare and return the pattern for the OK file
273
        return $okFilenames;
274
    }
275
276
    /**
277
     * Set's the loader instance used to load the proposed .OK filenames and it's content.

src/Loaders/Filters/OkFileFilter.php 1 location

@@ 298-322 (lines=25) @@
295
     * @todo Refactorig required, because of duplicate method
296
     * @see \TechDivision\Import\Subjects\FileResolver\OkFileAwareFileResolver::getOkFilenames()
297
     */
298
    protected function getOkFilenames() : array
299
    {
300
301
        // initialize the array for the available okFilenames
302
        $okFilenames = array();
303
304
        // prepare the OK filenames based on the found CSV file information
305
        for ($i = 1; $i <= sizeof($patternKeys = $this->getPatternKeys()); $i++) {
306
            // intialize the array for the parts of the names (prefix, filename + counter)
307
            $parts = array();
308
            // load the parts from the matches
309
            for ($z = 0; $z < $i; $z++) {
310
                // append the part
311
                $parts[] = $this->getMatch($patternKeys[$z]);
312
            }
313
314
            // query whether or not, the OK file exists, if yes append it
315
            if (file_exists($okFilename = $this->prepareOkFilename($parts))) {
316
                $okFilenames[] = $okFilename;
317
            }
318
        }
319
320
        // prepare and return the pattern for the OK file
321
        return $okFilenames;
322
    }
323
324
    /**
325
     * Compare's that passed strings binary safe and return's an integer, depending on the comparison result.

src/Subjects/FileResolver/OkFileAwareFileResolver.php 1 location

@@ 177-201 (lines=25) @@
174
     * @todo Refactorig required, because of duplicate method
175
     * @see \TechDivision\Import\Loaders\Filters\OkFileFilter::getOkFilenames()
176
     */
177
    protected function getOkFilenames() : array
178
    {
179
180
        // initialize the array for the available okFilenames
181
        $okFilenames = array();
182
183
        // prepare the OK filenames based on the found CSV file information
184
        for ($i = 1; $i <= sizeof($patternKeys = $this->getPatternKeys()); $i++) {
185
            // intialize the array for the parts of the names (prefix, filename + counter)
186
            $parts = array();
187
            // load the parts from the matches
188
            for ($z = 0; $z < $i; $z++) {
189
                // append the part
190
                $parts[] = $this->getMatch($patternKeys[$z]);
191
            }
192
193
            // query whether or not, the OK file exists, if yes append it
194
            if (file_exists($okFilename = $this->prepareOkFilename($parts))) {
195
                $okFilenames[] = $okFilename;
196
            }
197
        }
198
199
        // prepare and return the pattern for the OK file
200
        return $okFilenames;
201
    }
202
203
    /**
204
     * Query whether or not, the passed CSV filename is in the OK file. If the filename was found,