@@ -42,7 +42,7 @@ |
||
42 | 42 | return; |
43 | 43 | } |
44 | 44 | if (!file_exists(dirname($logFile)) || !is_writable(dirname($logFile))) { |
45 | - throw new \RuntimeException('You don\'t have permissions to write JSON report in ' . $logFile); |
|
45 | + throw new \RuntimeException('You don\'t have permissions to write JSON report in '.$logFile); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | file_put_contents($logFile, json_encode($metrics, JSON_PRETTY_PRINT)); |
@@ -1,9 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Hal\Metric\Class_\Component; |
3 | 3 | |
4 | -use Hal\Metric\FunctionMetric; |
|
5 | 4 | use Hal\Metric\Metrics; |
6 | -use Hoa\Ruler\Model\Bag\Scalar; |
|
7 | 5 | use PhpParser\Node; |
8 | 6 | use PhpParser\Node\Stmt; |
9 | 7 | use PhpParser\NodeVisitorAbstract; |
@@ -78,7 +78,7 @@ |
||
78 | 78 | $metrics = new Metrics(); |
79 | 79 | |
80 | 80 | // traverse all |
81 | - $whenToStop = function () { |
|
81 | + $whenToStop = function() { |
|
82 | 82 | return true; |
83 | 83 | }; |
84 | 84 |
@@ -18,10 +18,10 @@ |
||
18 | 18 | |
19 | 19 | public function apply(Metric $metric) |
20 | 20 | { |
21 | - if (! $metric instanceof PackageMetric) { |
|
21 | + if (!$metric instanceof PackageMetric) { |
|
22 | 22 | return; |
23 | 23 | } |
24 | - if (abs($metric->getDistance()) > sqrt(2)/4) { |
|
24 | + if (abs($metric->getDistance()) > sqrt(2) / 4) { |
|
25 | 25 | $this->metric = $metric; |
26 | 26 | $metric->get('violations')->add($this); |
27 | 27 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | // get latest version |
38 | 38 | $latest = '0.0.0'; |
39 | - foreach ((array)$json->package->versions as $version => $datas) { |
|
39 | + foreach ((array) $json->package->versions as $version => $datas) { |
|
40 | 40 | if ($version[0] === 'v') { |
41 | 41 | $version = substr($version, 1); |
42 | 42 | } |
@@ -81,13 +81,13 @@ |
||
81 | 81 | */ |
82 | 82 | public function detects($node) |
83 | 83 | { |
84 | - if (! $node instanceof ClassMethod) { |
|
84 | + if (!$node instanceof ClassMethod) { |
|
85 | 85 | return null; |
86 | 86 | } |
87 | 87 | |
88 | 88 | // build a fingerprint of the given method |
89 | 89 | $fingerprintOfMethod = []; |
90 | - iterate_over_node($node, function ($node) use (&$fingerprintOfMethod) { |
|
90 | + iterate_over_node($node, function($node) use (&$fingerprintOfMethod) { |
|
91 | 91 | |
92 | 92 | // avoid identifier (php-parser:^4) |
93 | 93 | if ($node instanceof Identifier) { |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | public function apply(Metric $metric) |
27 | 27 | { |
28 | - if (! $metric instanceof ClassMetric) { |
|
28 | + if (!$metric instanceof ClassMetric) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | public function apply(Metric $metric) |
27 | 27 | { |
28 | - if (! $metric instanceof ClassMetric) { |
|
28 | + if (!$metric instanceof ClassMetric) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | // sums |
70 | - $sum = (object)[ |
|
70 | + $sum = (object) [ |
|
71 | 71 | 'loc' => 0, |
72 | 72 | 'cloc' => 0, |
73 | 73 | 'lloc' => 0, |
74 | 74 | 'nbMethods' => 0, |
75 | 75 | ]; |
76 | - $avg = (object)[ |
|
76 | + $avg = (object) [ |
|
77 | 77 | 'wmc' => [], |
78 | 78 | 'ccn' => [], |
79 | 79 | 'bugs' => [], |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $violations[$name]++; |
166 | 166 | } |
167 | 167 | } |
168 | - $sum->violations = (object)$violations; |
|
168 | + $sum->violations = (object) $violations; |
|
169 | 169 | |
170 | 170 | |
171 | 171 | $this->avg = $avg; |