| Conditions | 4 |
| Paths | 12 |
| Total Lines | 29 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 2 | public function process(CoverageEvent $event) |
|
| 37 | { |
||
| 38 | 2 | $codeCoverage = $event->getProcessor()->getCodeCoverage(); |
|
| 39 | 2 | $processor = $this->processor; |
|
| 40 | 2 | $options = $this->options; |
|
| 41 | 2 | $target = $options['target']; |
|
| 42 | 2 | $io = $event->getConsoleIO(); |
|
| 43 | |||
| 44 | 2 | $dir = $target; |
|
| 45 | |||
| 46 | 2 | if($options['type'] === 'file'){ |
|
| 47 | 2 | $dir = dirname($target); |
|
| 48 | } |
||
| 49 | |||
| 50 | 2 | if(!is_dir($dir)){ |
|
| 51 | 1 | mkdir($dir, 0775, true); |
|
| 52 | } |
||
| 53 | |||
| 54 | try{ |
||
| 55 | 2 | $processor->process($codeCoverage, $target); |
|
| 56 | 1 | $io->writeln(sprintf( |
|
| 57 | 1 | '<info>Generated code coverage to: <comment>%s</comment></info>', |
|
| 58 | $target |
||
| 59 | )); |
||
| 60 | 1 | }catch (\Exception $exception){ |
|
| 61 | 1 | $io->writeln(sprintf( |
|
| 62 | 1 | "<info>Failed generate code coverage to <comment>%s</comment>.\n%s</info>", |
|
| 63 | $target, |
||
| 64 | 1 | $exception->getMessage() |
|
| 65 | )); |
||
| 69 | } |