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