| Conditions | 6 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | public function getBackupFiles(): array |
||
| 41 | { |
||
| 42 | $list = $this->sftp->_list($this->path); |
||
| 43 | foreach ($list as $filename => $fileInfo) { |
||
| 44 | if (in_array($filename, ['.', '..'])) { |
||
| 45 | continue; |
||
| 46 | } |
||
| 47 | if ($fileInfo['type'] === 2) { |
||
| 48 | continue; |
||
| 49 | } |
||
| 50 | // skip currently created backup |
||
| 51 | if ($fileInfo['filename'] == $this->target->getFilename()) { |
||
| 52 | continue; |
||
| 53 | } |
||
| 54 | if (preg_match('#' . $this->fileRegex . '#i', $fileInfo['filename'])) { |
||
| 55 | $this->files[] = new \phpbu\App\Backup\File\Sftp($this->sftp, $fileInfo, $this->path); |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | return $this->files; |
||
| 60 | } |
||
| 61 | } |