1 | <?php |
||
18 | abstract class Collector |
||
19 | { |
||
20 | use Path; |
||
21 | |||
22 | /** |
||
23 | * Backup target |
||
24 | * |
||
25 | * @var \phpbu\App\Backup\Target |
||
26 | */ |
||
27 | protected $target; |
||
28 | |||
29 | /** |
||
30 | * Target filename regex |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $fileRegex; |
||
35 | |||
36 | /** |
||
37 | * Collection cache |
||
38 | * |
||
39 | * @var \phpbu\App\Backup\File[] |
||
40 | */ |
||
41 | protected $files; |
||
42 | |||
43 | /** |
||
44 | * Setting up |
||
45 | * |
||
46 | * @param \phpbu\App\Backup\Target $target |
||
47 | */ |
||
48 | 4 | public function setUp(Target $target) |
|
54 | |||
55 | /** |
||
56 | * Return true if target full path matches file and path regex. |
||
57 | * |
||
58 | * @param string $targetPath Full path to the remote file to check |
||
59 | * @return bool |
||
60 | */ |
||
61 | 1 | protected function isFileMatch(string $targetPath): bool |
|
69 | |||
70 | /** |
||
71 | * Returns true if filename matches the target regex |
||
72 | * |
||
73 | * @param string $filename |
||
74 | * @return bool |
||
75 | */ |
||
76 | 13 | protected function isFilenameMatch(string $filename): bool |
|
80 | |||
81 | /** |
||
82 | * Get all created backups. |
||
83 | * |
||
84 | * @return \phpbu\App\Backup\File[] |
||
85 | */ |
||
86 | abstract public function getBackupFiles() : array; |
||
87 | } |
||
88 |