Completed
Pull Request — master (#403)
by
unknown
03:04
created
src/Hal/Report/Html/Reporter.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -116,8 +116,8 @@
 block discarded – undo
116 116
     }
117 117
 
118 118
     /**
119
-     * @param $source
120
-     * @param $destination
119
+     * @param string $source
120
+     * @param string $destination
121 121
      * @param Consolidated $consolidated
122 122
      * @param $history
123 123
      * @return $this
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -51,46 +51,46 @@  discard block
 block discarded – undo
51 51
 
52 52
         $consolidated = new Consolidated($metrics);
53 53
 
54
-        $files = glob($logDir . '/js/history-*.json');
54
+        $files = glob($logDir.'/js/history-*.json');
55 55
         natsort($files);
56
-        $history = array_map(static function ($filename) {
56
+        $history = array_map(static function($filename) {
57 57
             return json_decode(file_get_contents($filename));
58 58
         }, $files);
59 59
 
60 60
         foreach (['js', 'css', 'images', 'fonts'] as $subFolder) {
61
-            $folder = $logDir . '/' . $subFolder;
61
+            $folder = $logDir.'/'.$subFolder;
62 62
             if (!file_exists($folder)) {
63 63
                 mkdir($folder, 0755, true);
64 64
             }
65
-            recurse_copy(__DIR__ . '/template/' . $subFolder, $folder);
65
+            recurse_copy(__DIR__.'/template/'.$subFolder, $folder);
66 66
         }
67 67
 
68 68
         // render dynamic pages
69
-        $this->renderPage(__DIR__ . '/template/index.php', $logDir . '/index.html', $consolidated, $history);
70
-        $this->renderPage(__DIR__ . '/template/loc.php', $logDir . '/loc.html', $consolidated, $history);
71
-        $this->renderPage(__DIR__ . '/template/relations.php', $logDir . '/relations.html', $consolidated, $history);
72
-        $this->renderPage(__DIR__ . '/template/coupling.php', $logDir . '/coupling.html', $consolidated, $history);
73
-        $this->renderPage(__DIR__ . '/template/all.php', $logDir . '/all.html', $consolidated, $history);
74
-        $this->renderPage(__DIR__ . '/template/oop.php', $logDir . '/oop.html', $consolidated, $history);
75
-        $this->renderPage(__DIR__ . '/template/complexity.php', $logDir . '/complexity.html', $consolidated, $history);
76
-        $this->renderPage(__DIR__ . '/template/panel.php', $logDir . '/panel.html', $consolidated, $history);
77
-        $this->renderPage(__DIR__ . '/template/violations.php', $logDir . '/violations.html', $consolidated, $history);
78
-        $this->renderPage(__DIR__ . '/template/packages.php', $logDir . '/packages.html', $consolidated, $history);
79
-        $this->renderPage(__DIR__ . '/template/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history);
69
+        $this->renderPage(__DIR__.'/template/index.php', $logDir.'/index.html', $consolidated, $history);
70
+        $this->renderPage(__DIR__.'/template/loc.php', $logDir.'/loc.html', $consolidated, $history);
71
+        $this->renderPage(__DIR__.'/template/relations.php', $logDir.'/relations.html', $consolidated, $history);
72
+        $this->renderPage(__DIR__.'/template/coupling.php', $logDir.'/coupling.html', $consolidated, $history);
73
+        $this->renderPage(__DIR__.'/template/all.php', $logDir.'/all.html', $consolidated, $history);
74
+        $this->renderPage(__DIR__.'/template/oop.php', $logDir.'/oop.html', $consolidated, $history);
75
+        $this->renderPage(__DIR__.'/template/complexity.php', $logDir.'/complexity.html', $consolidated, $history);
76
+        $this->renderPage(__DIR__.'/template/panel.php', $logDir.'/panel.html', $consolidated, $history);
77
+        $this->renderPage(__DIR__.'/template/violations.php', $logDir.'/violations.html', $consolidated, $history);
78
+        $this->renderPage(__DIR__.'/template/packages.php', $logDir.'/packages.html', $consolidated, $history);
79
+        $this->renderPage(__DIR__.'/template/package_relations.php', $logDir.'/package_relations.html', $consolidated, $history);
80 80
         if ($this->config->has('git')) {
81
-            $this->renderPage(__DIR__ . '/template/git.php', $logDir . '/git.html', $consolidated, $history);
81
+            $this->renderPage(__DIR__.'/template/git.php', $logDir.'/git.html', $consolidated, $history);
82 82
         }
83
-        $this->renderPage(__DIR__ . '/template/junit.php', $logDir . '/junit.html', $consolidated, $history);
83
+        $this->renderPage(__DIR__.'/template/junit.php', $logDir.'/junit.html', $consolidated, $history);
84 84
 
85
-        $today = (object)['avg' => $consolidated->getAvg(), 'sum' => $consolidated->getSum()];
85
+        $today = (object) ['avg' => $consolidated->getAvg(), 'sum' => $consolidated->getSum()];
86 86
         $encodedToday = json_encode($today, JSON_PRETTY_PRINT);
87 87
         $next = count($history) + 1;
88 88
         file_put_contents(sprintf('%s/js/history-%d.json', $logDir, $next), $encodedToday);
89 89
         file_put_contents(sprintf('%s/js/latest.json', $logDir), $encodedToday);
90 90
 
91 91
         file_put_contents(
92
-            $logDir . '/js/classes.js',
93
-            'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
92
+            $logDir.'/js/classes.js',
93
+            'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
94 94
         );
95 95
 
96 96
         $this->output->writeln(sprintf('HTML report generated in "%s" directory', $logDir));
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $goodOrBad = 'neutral';
157 157
         if ($newValue > $oldValue) {
158 158
             $r = 'gt';
159
-            $diff = '+' . $diff;
159
+            $diff = '+'.$diff;
160 160
             $goodOrBad = $lowIsBetter ? 'bad' : $goodOrBad;
161 161
             $goodOrBad = $highIsBetter ? 'good' : $goodOrBad;
162 162
         } elseif ($newValue < $oldValue) {
Please login to merge, or discard this patch.
src/Hal/Report/Csv/Reporter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Hal/Report/Json/Reporter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
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));
Please login to merge, or discard this patch.
src/Hal/Report/Cli/Reporter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.