dgd-backupper-php/app/Utils/BackupManager.php

48 lines
869 B
PHP

<?php
namespace App\Utils;
use AdamBrett\ShellWrapper\Runners\Exec;
use App\Exceptions\BackupFolderNotFoundException;
use App\Exceptions\ExportFolderNotFoundException;
use Throwable;
class BackupManager
{
private $shell;
private $builder;
public function __construct()
{
$this->shell = new Exec();
}
/**
* @return Exec
*/
public function getShell(): Exec
{
return $this->shell;
}
public function setBuilder(Builder $builder): BackupManager
{
$this->builder = $builder;
return $this;
}
public function getBuilder(): Builder
{
return $this->builder;
}
/**
* @return string
* @throws Throwable
*/
public function execute()
{
$builder = $this->getBuilder()->builder();
return $this->shell->run($builder);
}
}