for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace phpbu\App\Backup;
use phpbu\App\Util\Str;
abstract class Collector
{
/**
* Backup target
*
* @var \phpbu\App\Backup\Target
*/
protected $target;
* Target filename regex
* @var string
protected $fileRegex;
* Collection cache
* @var \phpbu\App\Backup\File[]
protected $files;
* Setting up
* @param \phpbu\App\Backup\Target $target
public function setUp(Target $target)
$this->target = $target;
$this->fileRegex = Str::datePlaceholdersToRegex($target->getFilenameRaw());
$this->files = [];
}
* Returns true if filename matches the target regex
* @param string $filename
* @return bool
protected function isFilenameMatch(string $filename): bool
return preg_match('#'.$this->fileRegex . '#i', $filename);
* Get all created backups.
* @return \phpbu\App\Backup\File[]
abstract public function getBackupFiles() : array;