| Conditions | 3 |
| Paths | 5 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function execute() : BackupFile |
||
| 32 | { |
||
| 33 | $filepath = $this->getFilePath(); |
||
| 34 | $process = new Process("mysqldump --login-path=local {$this->db_name} --single-transaction > {$filepath}"); |
||
| 35 | try { |
||
| 36 | $process->mustRun(); |
||
| 37 | return new DBBackupFile($filepath); |
||
| 38 | } catch (ProcessFailedException $exception) { |
||
| 39 | if (file_exists($filepath)) { |
||
| 40 | unlink($filepath); |
||
| 41 | } |
||
| 42 | throw new Exception($process->getErrorOutput()); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 50 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.