Conditions | 6 |
Paths | 5 |
Total Lines | 24 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
50 | public function getBackupFiles(): array |
||
51 | { |
||
52 | $result = $this->client->listObjects([ |
||
53 | 'Bucket' => $this->bucket, |
||
54 | 'Prefix' => $this->path, |
||
55 | 'Delimiter' => '/', |
||
56 | ]); |
||
57 | |||
58 | if (!$result['Contents'] || !is_array($result['Contents'])) { |
||
59 | return []; |
||
60 | } |
||
61 | |||
62 | foreach ($result['Contents'] as $object) { |
||
63 | // skip currently created backup |
||
64 | if ($object['Key'] == $this->path . $this->target->getFilename()) { |
||
65 | continue; |
||
66 | } |
||
67 | if ($this->isFilenameMatch(basename($object['Key']))) { |
||
68 | $this->files[] = new \phpbu\App\Backup\File\AmazonS3v3($this->client, $this->bucket, $object); |
||
69 | } |
||
70 | } |
||
71 | |||
72 | return $this->files; |
||
73 | } |
||
74 | } |