@@ -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; |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | // extends |
63 | 63 | if (isset($node->extends)) { |
64 | 64 | if (is_array($node->extends)) { |
65 | - foreach ((array)$node->extends as $interface) { |
|
66 | - $this->pushToDependencies($dependencies, (string)$interface); |
|
67 | - array_push($parents, (string)$interface); |
|
65 | + foreach ((array) $node->extends as $interface) { |
|
66 | + $this->pushToDependencies($dependencies, (string) $interface); |
|
67 | + array_push($parents, (string) $interface); |
|
68 | 68 | } |
69 | 69 | } else { |
70 | - $this->pushToDependencies($dependencies, (string)$node->extends); |
|
71 | - array_push($parents, (string)$node->extends); |
|
70 | + $this->pushToDependencies($dependencies, (string) $node->extends); |
|
71 | + array_push($parents, (string) $node->extends); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | // implements |
76 | 76 | if (isset($node->implements)) { |
77 | 77 | foreach ($node->implements as $interface) { |
78 | - $this->pushToDependencies($dependencies, (string)$interface); |
|
78 | + $this->pushToDependencies($dependencies, (string) $interface); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | // return |
85 | 85 | if (isset($stmt->returnType)) { |
86 | 86 | if ($stmt->returnType instanceof Node\Name\FullyQualified) { |
87 | - $this->pushToDependencies($dependencies, (string)$stmt->returnType); |
|
87 | + $this->pushToDependencies($dependencies, (string) $stmt->returnType); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | foreach ($stmt->params as $param) { |
93 | 93 | if ($param->type) { |
94 | 94 | if ($param->type instanceof Node\Name\FullyQualified) { |
95 | - $this->pushToDependencies($dependencies, (string)$param->type); |
|
95 | + $this->pushToDependencies($dependencies, (string) $param->type); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | 100 | // instantiations, static calls |
101 | - \iterate_over_node($stmt, function ($node) use (&$dependencies) { |
|
101 | + \iterate_over_node($stmt, function($node) use (&$dependencies) { |
|
102 | 102 | switch (true) { |
103 | 103 | case $node instanceof Node\Expr\New_: |
104 | 104 | // new MyClass |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | foreach ($this->uses as $use) { |
119 | 119 | if (method_exists($use, 'getAlias')) { |
120 | 120 | if (((string) $use->getAlias()) === $check) { |
121 | - $this->pushToDependencies($dependencies, (string)($use->name)); |
|
121 | + $this->pushToDependencies($dependencies, (string) ($use->name)); |
|
122 | 122 | } |
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | if ($use->alias === $check) { |
126 | - $this->pushToDependencies($dependencies, (string)($use->name)); |
|
126 | + $this->pushToDependencies($dependencies, (string) ($use->name)); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | namespace Hal\Component\Ast; |
10 | 10 | |
11 | 11 | if (PHP_VERSION_ID >= 70000) { |
12 | - class_alias(Php7NodeTraverser::class, __NAMESPACE__ . '\\NodeTraverser'); |
|
12 | + class_alias(Php7NodeTraverser::class, __NAMESPACE__.'\\NodeTraverser'); |
|
13 | 13 | } else { |
14 | - class_alias(Php5NodeTraverser::class, __NAMESPACE__ . '\\NodeTraverser'); |
|
14 | + class_alias(Php5NodeTraverser::class, __NAMESPACE__.'\\NodeTraverser'); |
|
15 | 15 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php require __DIR__ . '/_header.php'; ?> |
|
1 | +<?php require __DIR__.'/_header.php'; ?> |
|
2 | 2 | |
3 | 3 | |
4 | 4 | <?php |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | |
20 | 20 | // 2. percentile map |
21 | 21 | $json = []; |
22 | -if(count($array) > 1) { |
|
22 | +if (count($array) > 1) { |
|
23 | 23 | $range = range(0.5, 1, .05); |
24 | 24 | foreach ($range as $percentile) { |
25 | - $json[] = (object)[ |
|
25 | + $json[] = (object) [ |
|
26 | 26 | 'lloc' => percentile($array, $percentile), |
27 | 27 | 'percentile' => round($percentile * 100), |
28 | 28 | ]; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | </div> |
75 | 75 | |
76 | 76 | |
77 | -<?php require __DIR__ . '/_footer.php'; ?> |
|
77 | +<?php require __DIR__.'/_footer.php'; ?> |
|
78 | 78 | |
79 | 79 | |
80 | 80 | <script> |