@@ -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) |
@@ -109,8 +109,8 @@ |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
112 | - * @param $source |
|
113 | - * @param $destination |
|
112 | + * @param string $source |
|
113 | + * @param string $destination |
|
114 | 114 | * @return $this |
115 | 115 | */ |
116 | 116 | public function renderPage($source, $destination, Consolidated $consolidated, $history) |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $this->config = $config; |
55 | 55 | $this->output = $output; |
56 | - $this->templateDir = __DIR__ . '/../../../../templates'; |
|
56 | + $this->templateDir = __DIR__.'/../../../../templates'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | $consolidated = new Consolidated($metrics); |
79 | 79 | |
80 | 80 | // history of builds |
81 | - $today = (object)[ |
|
81 | + $today = (object) [ |
|
82 | 82 | 'avg' => $consolidated->getAvg(), |
83 | 83 | 'sum' => $consolidated->getSum() |
84 | 84 | ]; |
85 | - $files = glob($logDir . '/js/history-*.json'); |
|
85 | + $files = glob($logDir.'/js/history-*.json'); |
|
86 | 86 | $next = count($files) + 1; |
87 | 87 | $history = []; |
88 | 88 | natsort($files); |
@@ -91,40 +91,40 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | // copy sources |
94 | - if (!file_exists($logDir . '/js')) { |
|
95 | - mkdir($logDir . '/js', 0755, true); |
|
94 | + if (!file_exists($logDir.'/js')) { |
|
95 | + mkdir($logDir.'/js', 0755, true); |
|
96 | 96 | } |
97 | - if (!file_exists($logDir . '/css')) { |
|
98 | - mkdir($logDir . '/css', 0755, true); |
|
97 | + if (!file_exists($logDir.'/css')) { |
|
98 | + mkdir($logDir.'/css', 0755, true); |
|
99 | 99 | } |
100 | - if (!file_exists($logDir . '/images')) { |
|
101 | - mkdir($logDir . '/images', 0755, true); |
|
100 | + if (!file_exists($logDir.'/images')) { |
|
101 | + mkdir($logDir.'/images', 0755, true); |
|
102 | 102 | } |
103 | - if (!file_exists($logDir . '/fonts')) { |
|
104 | - mkdir($logDir . '/fonts', 0755, true); |
|
103 | + if (!file_exists($logDir.'/fonts')) { |
|
104 | + mkdir($logDir.'/fonts', 0755, true); |
|
105 | 105 | } |
106 | - recurse_copy($this->templateDir . '/html_report/js', $logDir . '/js'); |
|
107 | - recurse_copy($this->templateDir . '/html_report/css', $logDir . '/css'); |
|
108 | - recurse_copy($this->templateDir . '/html_report/images', $logDir . '/images'); |
|
109 | - recurse_copy($this->templateDir . '/html_report/fonts', $logDir . '/fonts'); |
|
106 | + recurse_copy($this->templateDir.'/html_report/js', $logDir.'/js'); |
|
107 | + recurse_copy($this->templateDir.'/html_report/css', $logDir.'/css'); |
|
108 | + recurse_copy($this->templateDir.'/html_report/images', $logDir.'/images'); |
|
109 | + recurse_copy($this->templateDir.'/html_report/fonts', $logDir.'/fonts'); |
|
110 | 110 | |
111 | 111 | // render dynamic pages |
112 | - $this->renderPage($this->templateDir . '/html_report/index.php', $logDir . '/index.html', $consolidated, $history); |
|
113 | - $this->renderPage($this->templateDir . '/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history); |
|
114 | - $this->renderPage($this->templateDir . '/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history); |
|
115 | - $this->renderPage($this->templateDir . '/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history); |
|
116 | - $this->renderPage($this->templateDir . '/html_report/all.php', $logDir . '/all.html', $consolidated, $history); |
|
117 | - $this->renderPage($this->templateDir . '/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history); |
|
118 | - $this->renderPage($this->templateDir . '/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history); |
|
119 | - $this->renderPage($this->templateDir . '/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history); |
|
120 | - $this->renderPage($this->templateDir . '/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history); |
|
121 | - $this->renderPage($this->templateDir . '/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history); |
|
122 | - $this->renderPage($this->templateDir . '/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history); |
|
123 | - $this->renderPage($this->templateDir . '/html_report/composer.php', $logDir . '/composer.html', $consolidated, $history); |
|
112 | + $this->renderPage($this->templateDir.'/html_report/index.php', $logDir.'/index.html', $consolidated, $history); |
|
113 | + $this->renderPage($this->templateDir.'/html_report/loc.php', $logDir.'/loc.html', $consolidated, $history); |
|
114 | + $this->renderPage($this->templateDir.'/html_report/relations.php', $logDir.'/relations.html', $consolidated, $history); |
|
115 | + $this->renderPage($this->templateDir.'/html_report/coupling.php', $logDir.'/coupling.html', $consolidated, $history); |
|
116 | + $this->renderPage($this->templateDir.'/html_report/all.php', $logDir.'/all.html', $consolidated, $history); |
|
117 | + $this->renderPage($this->templateDir.'/html_report/oop.php', $logDir.'/oop.html', $consolidated, $history); |
|
118 | + $this->renderPage($this->templateDir.'/html_report/complexity.php', $logDir.'/complexity.html', $consolidated, $history); |
|
119 | + $this->renderPage($this->templateDir.'/html_report/panel.php', $logDir.'/panel.html', $consolidated, $history); |
|
120 | + $this->renderPage($this->templateDir.'/html_report/violations.php', $logDir.'/violations.html', $consolidated, $history); |
|
121 | + $this->renderPage($this->templateDir.'/html_report/packages.php', $logDir.'/packages.html', $consolidated, $history); |
|
122 | + $this->renderPage($this->templateDir.'/html_report/package_relations.php', $logDir.'/package_relations.html', $consolidated, $history); |
|
123 | + $this->renderPage($this->templateDir.'/html_report/composer.php', $logDir.'/composer.html', $consolidated, $history); |
|
124 | 124 | if ($this->config->has('git')) { |
125 | - $this->renderPage($this->templateDir . '/html_report/git.php', $logDir . '/git.html', $consolidated, $consolidatedGroups, $history); |
|
125 | + $this->renderPage($this->templateDir.'/html_report/git.php', $logDir.'/git.html', $consolidated, $consolidatedGroups, $history); |
|
126 | 126 | } |
127 | - $this->renderPage($this->templateDir . '/html_report/junit.php', $logDir . '/junit.html', $consolidated, $consolidatedGroups, $history); |
|
127 | + $this->renderPage($this->templateDir.'/html_report/junit.php', $logDir.'/junit.html', $consolidated, $consolidatedGroups, $history); |
|
128 | 128 | |
129 | 129 | // js data |
130 | 130 | file_put_contents( |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | |
139 | 139 | // json data |
140 | 140 | file_put_contents( |
141 | - $logDir . '/classes.js', |
|
142 | - 'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
141 | + $logDir.'/classes.js', |
|
142 | + 'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
143 | 143 | ); |
144 | 144 | |
145 | 145 | // HTML files to generate |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | // consolidated by groups |
162 | 162 | foreach ($consolidatedGroups as $name => $consolidated) { |
163 | - $outDir = $logDir . DIRECTORY_SEPARATOR . $name; |
|
163 | + $outDir = $logDir.DIRECTORY_SEPARATOR.$name; |
|
164 | 164 | $this->currentGroup = $name; |
165 | 165 | $this->assetPath = '../'; |
166 | 166 | |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | ); |
178 | 178 | |
179 | 179 | file_put_contents( |
180 | - $outDir . '/classes.js', |
|
181 | - 'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
180 | + $outDir.'/classes.js', |
|
181 | + 'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
182 | 182 | ); |
183 | 183 | } |
184 | 184 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | $diff = $newValue - $oldValue; |
253 | 253 | if ($diff > 0) { |
254 | - $diff = '+' . $diff; |
|
254 | + $diff = '+'.$diff; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | $goodOrBad = 'neutral'; |
@@ -44,7 +44,7 @@ |
||
44 | 44 | { |
45 | 45 | $string = ''; |
46 | 46 | foreach ($this->data as $violation) { |
47 | - $string .= $violation->getName() . ','; |
|
47 | + $string .= $violation->getName().','; |
|
48 | 48 | } |
49 | 49 | return $string; |
50 | 50 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | $output = 0; |
53 | 53 | $fanout = []; |
54 | 54 | |
55 | - iterate_over_node($node, function ($node) use (&$output, &$fanout) { |
|
55 | + iterate_over_node($node, function($node) use (&$output, &$fanout) { |
|
56 | 56 | switch (true) { |
57 | 57 | case $node instanceof Stmt\Return_: |
58 | 58 | $output++; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $select = $while = $if = 0; |
44 | 44 | |
45 | - iterate_over_node($node, function ($node) use (&$while, &$select, &$if) { |
|
45 | + iterate_over_node($node, function($node) use (&$while, &$select, &$if) { |
|
46 | 46 | switch (true) { |
47 | 47 | case $node instanceof Stmt\Do_: |
48 | 48 | case $node instanceof Stmt\Foreach_: |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | }); |
60 | 60 | |
61 | - $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if; |
|
61 | + $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if; |
|
62 | 62 | $class->set('kanDefect', round($defect, 2)); |
63 | 63 | } |
64 | 64 | } |
@@ -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 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function writeln($message) |
25 | 25 | { |
26 | - $this->write(PHP_EOL . $message); |
|
26 | + $this->write(PHP_EOL.$message); |
|
27 | 27 | return $this; |
28 | 28 | } |
29 | 29 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function writeln($message) |
27 | 27 | { |
28 | - $this->write(PHP_EOL . $message); |
|
28 | + $this->write(PHP_EOL.$message); |
|
29 | 29 | return $this; |
30 | 30 | } |
31 | 31 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function write($message) |
36 | 36 | { |
37 | - $this->quietMode||file_put_contents('php://stdout', $message); |
|
37 | + $this->quietMode || file_put_contents('php://stdout', $message); |
|
38 | 38 | return $this; |
39 | 39 | } |
40 | 40 |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | |
22 | 22 | public function apply(Metric $metric) |
23 | 23 | { |
24 | - if (! $metric instanceof PackageMetric) { |
|
24 | + if (!$metric instanceof PackageMetric) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | $instability = $metric->getInstability(); |
28 | 28 | $violatingInstabilities = array_filter( |
29 | 29 | $metric->getDependentInstabilities(), |
30 | - function ($otherInstability) use ($instability) { |
|
30 | + function($otherInstability) use ($instability) { |
|
31 | 31 | return $otherInstability >= $instability; |
32 | 32 | } |
33 | 33 | ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $count = count($this->violatingInstabilities); |
49 | 49 | $thisInstability = round($this->metric->getInstability(), 3); |
50 | - $packages = implode("\n* ", array_map(function ($name, $instability) { |
|
50 | + $packages = implode("\n* ", array_map(function($name, $instability) { |
|
51 | 51 | $name = $name === '\\' ? 'global' : substr($name, 0, -1); |
52 | 52 | $instability = round($instability, 3); |
53 | 53 | return "$name ($instability)"; |