| Conditions | 5 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 48 | protected function processFile(LocalFile $file, LocalFile $output, $cmd, $deleteOld = true) |
|
| 23 | { |
||
| 24 | 48 | $process = $this->getProcess($cmd); |
|
| 25 | 48 | $process->run(); |
|
| 26 | |||
| 27 | 48 | if (!$process->isSuccessful() || !$output->exists()) { |
|
| 28 | 8 | throw new ProcessFailedException($process); |
|
| 29 | } |
||
| 30 | |||
| 31 | 40 | if ($file->exists() && !$deleteOld) { |
|
| 32 | 9 | $this->log(LogLevel::DEBUG, "Deleting old file: '{file}'", ['file' => $file]); |
|
| 33 | 9 | $file->delete(); |
|
| 34 | } |
||
| 35 | |||
| 36 | 40 | return $output; |
|
| 37 | } |
||
| 38 | } |
||
| 39 |