1 | <?php |
||
21 | class Sftp extends Remote implements Collector |
||
22 | { |
||
23 | /** |
||
24 | * @var \phpseclib\Net\SFTP |
||
25 | */ |
||
26 | protected $sftp; |
||
27 | |||
28 | /** |
||
29 | * OpenStack constructor. |
||
30 | * |
||
31 | * @param \phpbu\App\Backup\Target $target |
||
32 | * @param \phpbu\App\Backup\Path $path |
||
33 | * @param \phpseclib\Net\SFTP $sftp |
||
34 | */ |
||
35 | 3 | public function __construct(Target $target, Path $path, \phpseclib\Net\SFTP $sftp) |
|
40 | |||
41 | /** |
||
42 | * Get all created backups. |
||
43 | * |
||
44 | * @return \phpbu\App\Backup\File[] |
||
45 | */ |
||
46 | 3 | protected function collectBackups(): array |
|
51 | |||
52 | /** |
||
53 | * Collect all remote files in all matching directories. |
||
54 | * |
||
55 | * @param string $path |
||
56 | */ |
||
57 | 3 | private function collect(string $path) |
|
78 | |||
79 | /** |
||
80 | * Collect matching files in a directory. |
||
81 | * |
||
82 | * @param array $fileList |
||
83 | * @param string $path |
||
84 | */ |
||
85 | 2 | 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 | 1 | 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 | 1 | protected function isMatchingDirectory(string $dir, int $depth) |
|
124 | } |
||
125 |