1 | <?php |
||
20 | class Collector |
||
21 | { |
||
22 | /** |
||
23 | * Backup target |
||
24 | * |
||
25 | * @var \phpbu\App\Backup\Target |
||
26 | */ |
||
27 | protected $target; |
||
28 | /** |
||
29 | * Collection cache |
||
30 | * |
||
31 | * @var array<\phpbu\App\Backup\File> |
||
32 | */ |
||
33 | protected $files; |
||
34 | |||
35 | /** |
||
36 | * Constructor |
||
37 | * |
||
38 | 7 | * @param Target $target |
|
39 | */ |
||
40 | 7 | public function __construct(Target $target) |
|
44 | |||
45 | /** |
||
46 | * Get all created backups. |
||
47 | * |
||
48 | 7 | * @return \phpbu\App\Backup\File[] |
|
49 | */ |
||
50 | 7 | public function getBackupFiles() |
|
59 | |||
60 | /** |
||
61 | * Recursive backup collecting. |
||
62 | * |
||
63 | * @param string $path |
||
64 | 7 | * @param integer $depth |
|
65 | */ |
||
66 | 7 | protected function collect($path, $depth) |
|
99 | 7 | ||
100 | /** |
||
101 | * Check if the iterated file is part of a valid target path. |
||
102 | * |
||
103 | * @param \SplFileInfo $file |
||
104 | * @param int $depth |
||
105 | * @return bool |
||
106 | */ |
||
107 | protected function isValidDirectory(SplFileInfo $file, $depth) |
||
111 | |||
112 | /** |
||
113 | * Does a directory match the respective target path. |
||
114 | * |
||
115 | * @param string $dir |
||
116 | * @param int $depth |
||
117 | * @return bool |
||
118 | */ |
||
119 | protected function isMatchingDirectory($dir, $depth) |
||
125 | } |
||
126 |