Code Duplication    Length = 9-12 lines in 2 locations

src/Backup/Collector/Sftp.php 1 location

@@ 55-66 (lines=12) @@
52
    public function getBackupFiles(): array
53
    {
54
        $list = $this->sftp->_list($this->path);
55
        foreach ($list as $fileInfo) {
56
            if ($fileInfo['type'] === 2) {
57
                continue;
58
            }
59
            // skip currently created backup
60
            if ($fileInfo['filename'] == $this->target->getFilename()) {
61
                continue;
62
            }
63
            if ($this->isFilenameMatch($fileInfo['filename'])) {
64
                $this->files[] = new \phpbu\App\Backup\File\Sftp($this->sftp, $fileInfo, $this->path);
65
            }
66
        }
67
68
        return $this->files;
69
    }

src/Backup/Collector/AmazonS3v3.php 1 location

@@ 70-78 (lines=9) @@
67
            return [];
68
        }
69
70
        foreach ($result['Contents'] as $object) {
71
            // skip currently created backup
72
            if ($object['Key'] == $this->getPrefix() . $this->target->getFilename()) {
73
                continue;
74
            }
75
            if ($this->isFileMatch($object['Key'])) {
76
                $this->files[] = new AwsFile($this->client, $this->bucket, $object);
77
            }
78
        }
79
80
        return $this->files;
81
    }