| Total Complexity | 4 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 10 | class FolderBackupRestorer |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $backupFilePath; |
||
| 16 | /** |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | protected $targetFolder; |
||
| 20 | /** |
||
| 21 | * @var Module |
||
| 22 | */ |
||
| 23 | protected $module; |
||
| 24 | /** |
||
| 25 | * DatabaseBackupMaker constructor. |
||
| 26 | * @param string $backupFilePath |
||
| 27 | * @param string $targetFolder |
||
| 28 | * @throws Exception |
||
| 29 | */ |
||
| 30 | public function __construct(string $backupFilePath, string $targetFolder, $io = IOPriority::IDLE) |
||
| 31 | { |
||
| 32 | if (!file_exists($backupFilePath)) |
||
| 33 | throw new Exception("Backup file don`t exist.."); |
||
| 34 | |||
| 35 | if (!file_exists($targetFolder)) |
||
| 36 | throw new Exception("Target folder don`t exist."); |
||
| 37 | |||
| 38 | $this->backupFilePath = $backupFilePath; |
||
| 39 | $this->targetFolder = $targetFolder; |
||
| 40 | |||
| 41 | $this->module = Yii::$app->getModule('backup'); |
||
| 42 | $this->io = $io; |
||
|
|
|||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return bool |
||
| 47 | * @throws \Exception |
||
| 48 | */ |
||
| 49 | public function execute() |
||
| 56 | } |
||
| 57 | } |
||
| 58 |