Code Duplication    Length = 16-17 lines in 2 locations

src/Installers/Plugin.php 2 locations

@@ 327-343 (lines=17) @@
324
            $current = PATH_ROOT . DS . $directory . DS . $iterator->getSubPathName();
325
326
            // remove empty directories
327
            if (is_dir($current)) {
328
                if (count(scandir($current, SCANDIR_SORT_ASCENDING )) === 2) {
329
                    rmdir($current);
330
                    $this->installer->getIo()->write(
331
                        "  - Removed directory `{$iterator->getSubPathName()}`",
332
                        true,
333
                        IOInterface::VERBOSE
334
                    );
335
                } else {
336
                    $this->installer->getIo()->write(
337
                        "  - <comment>Skip directory `{$iterator->getSubPathName()}`</comment>",
338
                        true,
339
                        IOInterface::VERBOSE
340
                    );
341
                }
342
                continue;
343
            }
344
345
            // skip already removed files
346
            if (!is_file($current)) {
@@ 350-365 (lines=16) @@
347
                continue;
348
            }
349
350
            if (md5_file($item) === md5_file($current)) {
351
                // remove file
352
                unlink($current);
353
                $this->installer->getIo()->write(
354
                    "  - Removed file `{$iterator->getSubPathName()}`",
355
                    true,
356
                    IOInterface::VERBOSE
357
                );
358
            } else {
359
                // or skip changed files
360
                $this->installer->getIo()->write(
361
                    "  - <comment>File `{$iterator->getSubPathName()}` has changed</comment>",
362
                    true,
363
                    IOInterface::VERBOSE
364
                );
365
            }
366
        }
367
    }
368
}