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