Shikiryu_Backup/app/code/backup/Files.php
2015-07-10 23:13:46 +02:00

42 lines
1.0 KiB
PHP

<?php
namespace Shikiryu\Backup\Backup;
class Files extends BackupAbstract
{
/**
* @param array $config
* @throws \Exception
*/
function __construct($config = array())
{
parent::__construct();
if (!isset($config['files'])) {
throw new \Exception('Files needs a "files" configuration.');
}
$filesToBackup = $config['files'];
if(!empty($filesToBackup) && is_array($filesToBackup)){
$names = array_map("basename",$filesToBackup);
$this->_filesToBackup = array_combine($filesToBackup,$names);
}
}
/**
*
*
* @param string[] $filestobackup a list of file path
*
* @return $this
*/
function setFilePath($filesToBackup = array())
{
if(!empty($filesToBackup) && is_array($filesToBackup))
{
$names = array_map("basename",$filesToBackup);
$this->_filesToBackup = array_combine($filesToBackup,$names);
}
return $this;
}
}
?>