Total Complexity | 4 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | class DatabaseBackuper |
||
14 | { |
||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $dbProcessors = [ |
||
19 | 'mysql' => MysqlProcessor::class, |
||
20 | 'pgsql' => PostgresProcessor::class, |
||
21 | ]; |
||
22 | /** |
||
23 | * @var DbProcessor |
||
24 | */ |
||
25 | protected $dbProcessor; |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $backupFilePath; |
||
30 | |||
31 | /** |
||
32 | * DatabaseBackupMaker constructor. |
||
33 | * @param string $backupFilePath |
||
34 | * @param Connection $connection |
||
35 | * @throws Exception |
||
36 | */ |
||
37 | public function __construct(string $backupFilePath, Connection $connection) |
||
38 | { |
||
39 | $this->backupFilePath = $backupFilePath; |
||
40 | $currentProcessorClassname = $this->dbProcessors[$connection->driverName]; |
||
41 | $this->dbProcessor = new $currentProcessorClassname($backupFilePath, $connection); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return bool |
||
46 | * @throws \Exception |
||
47 | */ |
||
48 | public function backup() |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return bool |
||
57 | * @throws \Exception |
||
58 | */ |
||
59 | public function restore() |
||
62 | } |
||
63 | } |
||
64 |