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