1 | <?php |
||
2 | |||
3 | use Kahlan\Filter\Filters; |
||
4 | use Kahlan\Reporter\Coverage; |
||
5 | use Kahlan\Reporter\Coverage\Driver\Phpdbg; |
||
6 | use Kahlan\Reporter\Coverage\Driver\Xdebug; |
||
7 | use Kahlan\Reporter\Coverage\Exporter\Clover; |
||
8 | |||
9 | $commandLine = $this->commandLine(); |
||
10 | $commandLine->option('ff', 'default', 1); |
||
11 | $commandLine->option('coverage-scrutinizer', 'default', 'scrutinizer.xml'); |
||
12 | |||
13 | Filters::apply($this, 'reporting', function ($next) { |
||
14 | |||
15 | // Get the reporter called `'coverage'` from the list of reporters |
||
16 | $reporter = $this->reporters()->get('coverage'); |
||
17 | |||
18 | // Abort if no coverage is available. |
||
19 | if (! $reporter || ! $this->commandLine()->exists('coverage-scrutinizer')) { |
||
20 | return $next(); |
||
21 | } |
||
22 | |||
23 | // Use the `Coveralls` class to write the JSON coverage into a file |
||
24 | Clover::write([ |
||
25 | 'collector' => $reporter, |
||
26 | 'file' => $this->commandLine()->get('coverage-scrutinizer'), |
||
27 | ]); |
||
28 | |||
29 | return $next(); |
||
30 | }); |
||
31 | |||
32 | Filters::apply($this, 'coverage', function ($next) { |
||
0 ignored issues
–
show
|
|||
33 | if (! extension_loaded('xdebug') && PHP_SAPI !== 'phpdbg') { |
||
34 | return; |
||
35 | } |
||
36 | $reporters = $this->reporters(); |
||
37 | $coverage = new Coverage([ |
||
38 | 'verbosity' => $this->commandLine()->get('coverage'), |
||
39 | 'driver' => PHP_SAPI !== 'phpdbg' ? new Xdebug() : new Phpdbg(), |
||
40 | 'path' => $this->commandLine()->get('src'), |
||
41 | 'colors' => ! $this->commandLine()->get('no-colors'), |
||
42 | ]); |
||
43 | $reporters->add('coverage', $coverage); |
||
44 | }); |
||
45 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.