| 1 | <?php |
||
| 7 | abstract class Collector |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Backup target |
||
| 11 | * |
||
| 12 | * @var \phpbu\App\Backup\Target |
||
| 13 | */ |
||
| 14 | protected $target; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Target filename regex |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $fileRegex; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Collection cache |
||
| 25 | * |
||
| 26 | * @var \phpbu\App\Backup\File[] |
||
| 27 | */ |
||
| 28 | protected $files; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Setting up |
||
| 32 | * |
||
| 33 | * @param \phpbu\App\Backup\Target $target |
||
| 34 | */ |
||
| 35 | public function setUp(Target $target) |
||
| 36 | { |
||
| 37 | $this->target = $target; |
||
| 38 | $this->fileRegex = Str::datePlaceholdersToRegex($target->getFilenameRaw()); |
||
| 39 | $this->files = []; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get all created backups. |
||
| 44 | * |
||
| 45 | * @return \phpbu\App\Backup\File[] |
||
| 46 | */ |
||
| 47 | abstract public function getBackupFiles() : array; |
||
| 48 | } |