@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $logDir = dirname($logFile); |
50 | 50 | if (!file_exists($logDir) || !is_writable($logDir)) { |
51 | - throw new RuntimeException('You do not have permissions to write CSV report in ' . $logFile); |
|
51 | + throw new RuntimeException('You do not have permissions to write CSV report in '.$logFile); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $availableMetrics = (new Registry())->allForStructures(); |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | if (!$metric instanceof ClassMetric) { |
60 | 60 | continue; |
61 | 61 | } |
62 | - $row = array_map(static function ($key) use ($metric) { |
|
62 | + $row = array_map(static function($key) use ($metric) { |
|
63 | 63 | $data = $metric->get($key); |
64 | - return (!is_scalar($data)) ? 'N/A': $data; |
|
64 | + return (!is_scalar($data)) ? 'N/A' : $data; |
|
65 | 65 | }, $availableMetrics); |
66 | 66 | |
67 | 67 | fputcsv($logPointer, $row); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | $logDir = dirname($logFile); |
46 | 46 | if (!file_exists($logDir) || !is_writable($logDir)) { |
47 | - throw new RuntimeException('You do not have permissions to write JSON report in ' . $logFile); |
|
47 | + throw new RuntimeException('You do not have permissions to write JSON report in '.$logFile); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | file_put_contents($logFile, json_encode($metrics, JSON_PRETTY_PRINT)); |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $out .= $this->reportUnitTesting($metrics->get('unitTesting')); |
54 | 54 | } |
55 | 55 | |
56 | - $this->output->write($out . "\n"); |
|
56 | + $this->output->write($out."\n"); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $this->config = $config; |
59 | 59 | $this->output = $output; |
60 | - $this->templateDir = __DIR__ . '/../../../../templates'; |
|
60 | + $this->templateDir = __DIR__.'/../../../../templates'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -82,52 +82,52 @@ discard block |
||
82 | 82 | } |
83 | 83 | $consolidated = new Consolidated($metrics); |
84 | 84 | |
85 | - $files = glob($logDir . '/js/history-*.json'); |
|
85 | + $files = glob($logDir.'/js/history-*.json'); |
|
86 | 86 | natsort($files); |
87 | - $history = array_map(static function ($filename) { |
|
87 | + $history = array_map(static function($filename) { |
|
88 | 88 | return json_decode(file_get_contents($filename)); |
89 | 89 | }, $files); |
90 | 90 | |
91 | 91 | foreach (['js', 'css', 'images', 'fonts'] as $subFolder) { |
92 | - $folder = $logDir . '/' . $subFolder; |
|
92 | + $folder = $logDir.'/'.$subFolder; |
|
93 | 93 | if (!file_exists($folder)) { |
94 | 94 | mkdir($folder, 0755, true); |
95 | 95 | } |
96 | - recurse_copy(__DIR__ . '/template/' . $subFolder, $folder); |
|
96 | + recurse_copy(__DIR__.'/template/'.$subFolder, $folder); |
|
97 | 97 | } |
98 | 98 | |
99 | - recurse_copy($this->templateDir . '/html_report/js', $logDir . '/js'); |
|
100 | - recurse_copy($this->templateDir . '/html_report/css', $logDir . '/css'); |
|
101 | - recurse_copy($this->templateDir . '/html_report/images', $logDir . '/images'); |
|
102 | - recurse_copy($this->templateDir . '/html_report/fonts', $logDir . '/fonts'); |
|
99 | + recurse_copy($this->templateDir.'/html_report/js', $logDir.'/js'); |
|
100 | + recurse_copy($this->templateDir.'/html_report/css', $logDir.'/css'); |
|
101 | + recurse_copy($this->templateDir.'/html_report/images', $logDir.'/images'); |
|
102 | + recurse_copy($this->templateDir.'/html_report/fonts', $logDir.'/fonts'); |
|
103 | 103 | |
104 | 104 | // render dynamic pages |
105 | - $this->renderPage($this->templateDir . '/html_report/index.php', $logDir . '/index.html', $consolidated, $history); |
|
106 | - $this->renderPage($this->templateDir . '/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history); |
|
107 | - $this->renderPage($this->templateDir . '/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history); |
|
108 | - $this->renderPage($this->templateDir . '/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history); |
|
109 | - $this->renderPage($this->templateDir . '/html_report/all.php', $logDir . '/all.html', $consolidated, $history); |
|
110 | - $this->renderPage($this->templateDir . '/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history); |
|
111 | - $this->renderPage($this->templateDir . '/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history); |
|
112 | - $this->renderPage($this->templateDir . '/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history); |
|
113 | - $this->renderPage($this->templateDir . '/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history); |
|
114 | - $this->renderPage($this->templateDir . '/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history); |
|
115 | - $this->renderPage($this->templateDir . '/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history); |
|
116 | - $this->renderPage($this->templateDir . '/html_report/composer.php', $logDir . '/composer.html', $consolidated, $history); |
|
105 | + $this->renderPage($this->templateDir.'/html_report/index.php', $logDir.'/index.html', $consolidated, $history); |
|
106 | + $this->renderPage($this->templateDir.'/html_report/loc.php', $logDir.'/loc.html', $consolidated, $history); |
|
107 | + $this->renderPage($this->templateDir.'/html_report/relations.php', $logDir.'/relations.html', $consolidated, $history); |
|
108 | + $this->renderPage($this->templateDir.'/html_report/coupling.php', $logDir.'/coupling.html', $consolidated, $history); |
|
109 | + $this->renderPage($this->templateDir.'/html_report/all.php', $logDir.'/all.html', $consolidated, $history); |
|
110 | + $this->renderPage($this->templateDir.'/html_report/oop.php', $logDir.'/oop.html', $consolidated, $history); |
|
111 | + $this->renderPage($this->templateDir.'/html_report/complexity.php', $logDir.'/complexity.html', $consolidated, $history); |
|
112 | + $this->renderPage($this->templateDir.'/html_report/panel.php', $logDir.'/panel.html', $consolidated, $history); |
|
113 | + $this->renderPage($this->templateDir.'/html_report/violations.php', $logDir.'/violations.html', $consolidated, $history); |
|
114 | + $this->renderPage($this->templateDir.'/html_report/packages.php', $logDir.'/packages.html', $consolidated, $history); |
|
115 | + $this->renderPage($this->templateDir.'/html_report/package_relations.php', $logDir.'/package_relations.html', $consolidated, $history); |
|
116 | + $this->renderPage($this->templateDir.'/html_report/composer.php', $logDir.'/composer.html', $consolidated, $history); |
|
117 | 117 | if ($this->config->has('git')) { |
118 | - $this->renderPage($this->templateDir . '/html_report/git.php', $logDir . '/git.html', $consolidated, $consolidatedGroups, $history); |
|
118 | + $this->renderPage($this->templateDir.'/html_report/git.php', $logDir.'/git.html', $consolidated, $consolidatedGroups, $history); |
|
119 | 119 | } |
120 | - $this->renderPage($this->templateDir . '/html_report/junit.php', $logDir . '/junit.html', $consolidated, $consolidatedGroups, $history); |
|
120 | + $this->renderPage($this->templateDir.'/html_report/junit.php', $logDir.'/junit.html', $consolidated, $consolidatedGroups, $history); |
|
121 | 121 | |
122 | - $today = (object)['avg' => $consolidated->getAvg(), 'sum' => $consolidated->getSum()]; |
|
122 | + $today = (object) ['avg' => $consolidated->getAvg(), 'sum' => $consolidated->getSum()]; |
|
123 | 123 | $encodedToday = json_encode($today, JSON_PRETTY_PRINT); |
124 | 124 | $next = count($history) + 1; |
125 | 125 | file_put_contents(sprintf('%s/js/history-%d.json', $logDir, $next), $encodedToday); |
126 | 126 | file_put_contents(sprintf('%s/js/latest.json', $logDir), $encodedToday); |
127 | 127 | |
128 | 128 | file_put_contents( |
129 | - $logDir . '/classes.js', |
|
130 | - 'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
129 | + $logDir.'/classes.js', |
|
130 | + 'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
131 | 131 | ); |
132 | 132 | |
133 | 133 | // HTML files to generate |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | // consolidated by groups |
150 | 150 | foreach ($consolidatedGroups as $name => $consolidated) { |
151 | - $outDir = $logDir . DIRECTORY_SEPARATOR . $name; |
|
151 | + $outDir = $logDir.DIRECTORY_SEPARATOR.$name; |
|
152 | 152 | $this->currentGroup = $name; |
153 | 153 | $this->assetPath = '../'; |
154 | 154 | |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | ); |
166 | 166 | |
167 | 167 | file_put_contents( |
168 | - $outDir . '/classes.js', |
|
169 | - 'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
168 | + $outDir.'/classes.js', |
|
169 | + 'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
170 | 170 | ); |
171 | 171 | } |
172 | 172 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $goodOrBad = 'neutral'; |
239 | 239 | if ($newValue > $oldValue) { |
240 | 240 | $r = 'gt'; |
241 | - $diff = '+' . $diff; |
|
241 | + $diff = '+'.$diff; |
|
242 | 242 | $goodOrBad = $lowIsBetter ? 'bad' : $goodOrBad; |
243 | 243 | $goodOrBad = $highIsBetter ? 'good' : $goodOrBad; |
244 | 244 | } elseif ($newValue < $oldValue) { |