@@ -51,7 +51,7 @@ |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | $r = shell_exec(sprintf('%s --version', $bin)); |
54 | - if(!preg_match('!git version!', $r)) { |
|
54 | + if (!preg_match('!git version!', $r)) { |
|
55 | 55 | throw new ConfigException(sprintf('Git binary (%s) incorrect', $bin)); |
56 | 56 | } |
57 | 57 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | // build a fingerprint of the given method |
49 | 49 | $fingerprintOfMethod = []; |
50 | - iterate_over_node($node, function ($node) use (&$fingerprintOfMethod) { |
|
50 | + iterate_over_node($node, function($node) use (&$fingerprintOfMethod) { |
|
51 | 51 | |
52 | 52 | // avoid cast |
53 | 53 | if ($node instanceof Cast) { |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -chdir(__DIR__ . '/../../'); |
|
2 | +chdir(__DIR__.'/../../'); |
|
3 | 3 | |
4 | 4 | if (!file_exists('vendor/autoload.php')) { |
5 | - echo '[ERROR] It\'s required to run "composer install" before building PhpMetrics!' . PHP_EOL; |
|
5 | + echo '[ERROR] It\'s required to run "composer install" before building PhpMetrics!'.PHP_EOL; |
|
6 | 6 | exit(1); |
7 | 7 | } |
8 | 8 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | if (preg_match($exclude, $file)) { |
22 | 22 | continue; |
23 | 23 | } |
24 | - $path = str_replace(__DIR__ . '/', '', $file); |
|
24 | + $path = str_replace(__DIR__.'/', '', $file); |
|
25 | 25 | $phar->addFromString($path, file_get_contents($file)); |
26 | 26 | } |
27 | 27 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | |
53 | 53 | function rglob($pattern = '*', $flags = 0, $path = '') |
54 | 54 | { |
55 | - $paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT); |
|
56 | - $files = glob($path . $pattern, $flags); |
|
55 | + $paths = glob($path.'*', GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT); |
|
56 | + $files = glob($path.$pattern, $flags); |
|
57 | 57 | foreach ($paths as $path) { |
58 | 58 | $files = array_merge($files, rglob($pattern, $flags, $path)); |
59 | 59 | } |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | // sums |
61 | - $sum = (object)[ |
|
61 | + $sum = (object) [ |
|
62 | 62 | 'loc' => 0, |
63 | 63 | 'cloc' => 0, |
64 | 64 | 'lloc' => 0, |
65 | 65 | 'nbMethods' => 0, |
66 | 66 | ]; |
67 | - $avg = (object)[ |
|
67 | + $avg = (object) [ |
|
68 | 68 | 'ccn' => [], |
69 | 69 | 'bugs' => [], |
70 | 70 | 'kanDefect' => [], |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $violations[$name]++; |
125 | 125 | } |
126 | 126 | } |
127 | - $sum->violations = (object)$violations; |
|
127 | + $sum->violations = (object) $violations; |
|
128 | 128 | |
129 | 129 | |
130 | 130 | $this->avg = $avg; |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | // extends |
61 | 61 | if (isset($node->extends)) { |
62 | 62 | if (is_array($node->extends)) { |
63 | - foreach ((array)$node->extends as $interface) { |
|
64 | - array_push($dependencies, (string)$interface); |
|
63 | + foreach ((array) $node->extends as $interface) { |
|
64 | + array_push($dependencies, (string) $interface); |
|
65 | 65 | } |
66 | 66 | } else { |
67 | - array_push($dependencies, (string)$node->extends); |
|
67 | + array_push($dependencies, (string) $node->extends); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | // implements |
72 | 72 | if (isset($node->implements)) { |
73 | 73 | foreach ($node->implements as $interface) { |
74 | - array_push($dependencies, (string)$interface); |
|
74 | + array_push($dependencies, (string) $interface); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // return |
81 | 81 | if (isset($stmt->returnType)) { |
82 | 82 | if ($stmt->returnType instanceof Node\Name\FullyQualified) { |
83 | - array_push($dependencies, (string)$stmt->returnType); |
|
83 | + array_push($dependencies, (string) $stmt->returnType); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | foreach ($stmt->params as $param) { |
89 | 89 | if ($param->type) { |
90 | 90 | if ($param->type instanceof Node\Name\FullyQualified) { |
91 | - array_push($dependencies, (string)$param->type); |
|
91 | + array_push($dependencies, (string) $param->type); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | 96 | // instantiations, static calls |
97 | - \iterate_over_node($stmt, function ($node) use (&$dependencies) { |
|
97 | + \iterate_over_node($stmt, function($node) use (&$dependencies) { |
|
98 | 98 | switch (true) { |
99 | 99 | case $node instanceof Node\Expr\New_: |
100 | 100 | // new MyClass |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | foreach ($matches[1] as $check) { |
114 | 114 | foreach ($this->uses as $use) { |
115 | 115 | if ($use->alias === $check) { |
116 | - array_push($dependencies, (string)($use->name)); |
|
116 | + array_push($dependencies, (string) ($use->name)); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | if ($stmt instanceof Stmt\ClassMethod) { |
56 | 56 | |
57 | 57 | // iterate over children, recursively |
58 | - $cb = function ($node) use (&$cb) { |
|
58 | + $cb = function($node) use (&$cb) { |
|
59 | 59 | $ccn = 0; |
60 | 60 | if (isset($node->stmts) && $node->stmts) { |
61 | 61 | foreach ($node->stmts as $child) { |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Hal\Metric\Class_\Complexity; |
3 | 3 | |
4 | -use Hal\Component\Reflected\Method; |
|
5 | 4 | use Hal\Metric\Helper\MetricClassNameGenerator; |
6 | 5 | use Hal\Metric\Metrics; |
7 | 6 | use PhpParser\Node; |
@@ -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(sizeof($array) > 1) { |
|
22 | +if (sizeof($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' => procentile($array, $percentile), |
27 | 27 | 'percentile' => $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> |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Analyze constructor. |
51 | - * @param OutputInterface $output |
|
51 | + * @param Output $output |
|
52 | 52 | */ |
53 | 53 | public function __construct(Config $config, Output $output, Issuer $issuer) |
54 | 54 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Issuer constructor. |
35 | - * @param OutputInterface $output |
|
35 | + * @param Output $output |
|
36 | 36 | */ |
37 | 37 | public function __construct(Output $output) |
38 | 38 | { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
133 | - * @param $status |
|
133 | + * @param integer $status |
|
134 | 134 | */ |
135 | 135 | protected function terminate($status) |
136 | 136 | { |
@@ -139,6 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | /** |
141 | 141 | * @param $log |
142 | + * @param string $logfile |
|
142 | 143 | * @return $this |
143 | 144 | */ |
144 | 145 | protected function log($logfile, $log) |
@@ -152,7 +153,7 @@ discard block |
||
152 | 153 | } |
153 | 154 | |
154 | 155 | /** |
155 | - * @param $debugKey |
|
156 | + * @param string $debugKey |
|
156 | 157 | * @param $value |
157 | 158 | * @return $this |
158 | 159 | */ |
@@ -163,7 +164,7 @@ discard block |
||
163 | 164 | } |
164 | 165 | |
165 | 166 | /** |
166 | - * @param $debugKey |
|
167 | + * @param string $debugKey |
|
167 | 168 | * @return $this |
168 | 169 | */ |
169 | 170 | public function clear($debugKey) |