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