1 | <?php |
||
21 | class Sftp extends Collector |
||
22 | { |
||
23 | /** |
||
24 | * @var \phpseclib\Net\SFTP |
||
25 | */ |
||
26 | protected $sftp; |
||
27 | |||
28 | /** |
||
29 | * SFTP remote path |
||
30 | * |
||
31 | * @var Path |
||
32 | */ |
||
33 | protected $path; |
||
34 | |||
35 | /** |
||
36 | * OpenStack constructor. |
||
37 | * |
||
38 | * @param \phpbu\App\Backup\Target $target |
||
39 | * @param \phpseclib\Net\SFTP $sftp |
||
40 | * @param Path $path |
||
41 | */ |
||
42 | 1 | public function __construct(Target $target, \phpseclib\Net\SFTP $sftp, Path $path) |
|
48 | |||
49 | /** |
||
50 | * Get all created backups. |
||
51 | * |
||
52 | * @return \phpbu\App\Backup\File[] |
||
53 | */ |
||
54 | 1 | public function getBackupFiles(): array |
|
59 | |||
60 | 1 | private function collect(string $path) |
|
81 | |||
82 | 1 | private function collectFiles(array $fileList, string $path) |
|
98 | |||
99 | /** |
||
100 | * Check if the iterated file is part of a valid target path. |
||
101 | * |
||
102 | * @param array $file |
||
103 | * @param int $depth |
||
104 | * @return bool |
||
105 | */ |
||
106 | protected function isValidDirectory(array $file, int $depth) |
||
110 | |||
111 | /** |
||
112 | * Does a directory match the respective target path. |
||
113 | * |
||
114 | * @param string $dir |
||
115 | * @param int $depth |
||
116 | * @return bool |
||
117 | */ |
||
118 | protected function isMatchingDirectory(string $dir, int $depth) |
||
124 | } |
||
125 |