@@ -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 | /** |
@@ -40,46 +40,46 @@ discard block |
||
40 | 40 | |
41 | 41 | $consolidated = new Consolidated($metrics); |
42 | 42 | |
43 | - $files = glob($logDir . '/js/history-*.json'); |
|
43 | + $files = glob($logDir.'/js/history-*.json'); |
|
44 | 44 | natsort($files); |
45 | - $history = array_map(static function ($filename) { |
|
45 | + $history = array_map(static function($filename) { |
|
46 | 46 | return json_decode(file_get_contents($filename)); |
47 | 47 | }, $files); |
48 | 48 | |
49 | 49 | foreach (['js', 'css', 'images', 'fonts'] as $subFolder) { |
50 | - $folder = $logDir . '/' . $subFolder; |
|
50 | + $folder = $logDir.'/'.$subFolder; |
|
51 | 51 | if (!file_exists($folder)) { |
52 | 52 | mkdir($folder, 0755, true); |
53 | 53 | } |
54 | - recurse_copy(__DIR__ . '/template/' . $subFolder, $folder); |
|
54 | + recurse_copy(__DIR__.'/template/'.$subFolder, $folder); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // render dynamic pages |
58 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/index.php', $logDir . '/index.html', $consolidated, $history); |
|
59 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history); |
|
60 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history); |
|
61 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history); |
|
62 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/all.php', $logDir . '/all.html', $consolidated, $history); |
|
63 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history); |
|
64 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history); |
|
65 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history); |
|
66 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history); |
|
67 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history); |
|
68 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history); |
|
58 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/index.php', $logDir.'/index.html', $consolidated, $history); |
|
59 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/loc.php', $logDir.'/loc.html', $consolidated, $history); |
|
60 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/relations.php', $logDir.'/relations.html', $consolidated, $history); |
|
61 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/coupling.php', $logDir.'/coupling.html', $consolidated, $history); |
|
62 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/all.php', $logDir.'/all.html', $consolidated, $history); |
|
63 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/oop.php', $logDir.'/oop.html', $consolidated, $history); |
|
64 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/complexity.php', $logDir.'/complexity.html', $consolidated, $history); |
|
65 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/panel.php', $logDir.'/panel.html', $consolidated, $history); |
|
66 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/violations.php', $logDir.'/violations.html', $consolidated, $history); |
|
67 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/packages.php', $logDir.'/packages.html', $consolidated, $history); |
|
68 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/package_relations.php', $logDir.'/package_relations.html', $consolidated, $history); |
|
69 | 69 | if ($this->config->has('git')) { |
70 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/git.php', $logDir . '/git.html', $consolidated, $history); |
|
70 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/git.php', $logDir.'/git.html', $consolidated, $history); |
|
71 | 71 | } |
72 | - $this->renderPage(PROJECT_DIR . '/templates/html_report/junit.php', $logDir . '/junit.html', $consolidated, $history); |
|
72 | + $this->renderPage(PROJECT_DIR.'/templates/html_report/junit.php', $logDir.'/junit.html', $consolidated, $history); |
|
73 | 73 | |
74 | - $today = (object)['avg' => $consolidated->getAvg(), 'sum' => $consolidated->getSum()]; |
|
74 | + $today = (object) ['avg' => $consolidated->getAvg(), 'sum' => $consolidated->getSum()]; |
|
75 | 75 | $encodedToday = json_encode($today, JSON_PRETTY_PRINT); |
76 | 76 | $next = count($history) + 1; |
77 | 77 | file_put_contents(sprintf('%s/js/history-%d.json', $logDir, $next), $encodedToday); |
78 | 78 | file_put_contents(sprintf('%s/js/latest.json', $logDir), $encodedToday); |
79 | 79 | |
80 | 80 | file_put_contents( |
81 | - $logDir . '/js/classes.js', |
|
82 | - 'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
81 | + $logDir.'/js/classes.js', |
|
82 | + 'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | $this->output->writeln(sprintf('HTML report generated in "%s" directory', $logDir)); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $goodOrBad = 'neutral'; |
146 | 146 | if ($newValue > $oldValue) { |
147 | 147 | $r = 'gt'; |
148 | - $diff = '+' . $diff; |
|
148 | + $diff = '+'.$diff; |
|
149 | 149 | $goodOrBad = $lowIsBetter ? 'bad' : $goodOrBad; |
150 | 150 | $goodOrBad = $highIsBetter ? 'good' : $goodOrBad; |
151 | 151 | } elseif ($newValue < $oldValue) { |