| Conditions | 6 | 
| Paths | 5 | 
| Total Lines | 53 | 
| Code Lines | 34 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php | ||
| 43 | public function handle() | ||
| 44 |     { | ||
| 45 | $path = __DIR__ . "/../../tests/coverage.xml"; | ||
| 46 | 	    if (!file_exists($path)) { | ||
| 47 | 		    $this->error("Coverage file does not exist."); | ||
| 48 | 	    } else { | ||
| 49 | |||
| 50 | $xml = Parser::xml(file_get_contents($path)); | ||
| 51 | |||
| 52 | |||
| 53 | $elements = [ | ||
| 54 | 'covered' => $xml['project']['metrics']['@coveredelements'], | ||
| 55 | 'total' => $xml['project']['metrics']['@elements'] | ||
| 56 | ]; | ||
| 57 | |||
| 58 | $statements = [ | ||
| 59 | 'covered' => $xml['project']['metrics']['@coveredstatements'], | ||
| 60 | 'total' => $xml['project']['metrics']['@statements'] | ||
| 61 | ]; | ||
| 62 | |||
| 63 | $methods = [ | ||
| 64 | 'covered' => $xml['project']['metrics']['@coveredmethods'], | ||
| 65 | 'total' => $xml['project']['metrics']['@methods'] | ||
| 66 | ]; | ||
| 67 | |||
| 68 | $percentages = [ | ||
| 69 | 'elements' => round(($elements['covered'] / $elements['total']) * 100), | ||
| 70 | 'statements' => round(($statements['covered'] / $statements['total']) * 100), | ||
| 71 | 'methods' => round(($methods['covered'] / $methods['total']) * 100), | ||
| 72 | ]; | ||
| 73 | |||
| 74 | $average = round(($percentages['elements'] + $percentages['statements'] + $percentages['methods']) / 3); | ||
| 75 | $percentages['average'] = $average; | ||
| 76 | |||
| 77 | 		    $percentages = array_map(function($item) { | ||
| 78 | return number_format($item) . '%'; | ||
| 79 | }, $percentages); | ||
| 80 | |||
| 81 | $headers = ['Elements', 'Statements', 'Methods', 'Average']; | ||
| 82 | $this->table($headers, [$percentages]); | ||
| 83 | |||
| 84 | 		    if ($this->option('lines')) { | ||
| 85 | |||
| 86 | $packages = $xml['project']['package']; | ||
| 87 | |||
| 88 | 			    foreach ($packages as $namespace) { | ||
| 89 | $name = $namespace['@name']; | ||
| 90 | 				    if (!$this->isAssoc($namespace['file'])) { | ||
| 91 | 					    foreach ($namespace['file'] as $file) { | ||
| 92 | $this->processFile($file, $name); | ||
| 93 | } | ||
| 94 | 					} else { | ||
| 95 | $this->processFile($namespace['file'], $name); | ||
| 96 | } | ||
| 135 | 
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths