Completed
Pull Request — master (#281)
by Oskar
02:32
created
src/Hal/Report/Html/Reporter.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
         $consolidated = new Consolidated($metrics);
45 45
 
46 46
         // history of builds
47
-        $today = (object)[
47
+        $today = (object) [
48 48
             'avg' => $consolidated->getAvg(),
49 49
             'sum' => $consolidated->getSum()
50 50
         ];
51
-        $files = glob($logDir . '/js/history-*.json');
51
+        $files = glob($logDir.'/js/history-*.json');
52 52
         $next = sizeof($files) + 1;
53 53
         $history = [];
54 54
         natsort($files);
@@ -57,33 +57,33 @@  discard block
 block discarded – undo
57 57
         }
58 58
 
59 59
         // copy sources
60
-        if(!file_exists($logDir . '/js')) {
60
+        if (!file_exists($logDir.'/js')) {
61 61
             mkdir($logDir.'/js', 0755, true);
62 62
         }
63
-        if(!file_exists($logDir . '/css')) {
63
+        if (!file_exists($logDir.'/css')) {
64 64
             mkdir($logDir.'/css', 0755, true);
65 65
         }
66
-        if(!file_exists($logDir . '/images')) {
66
+        if (!file_exists($logDir.'/images')) {
67 67
             mkdir($logDir.'/images', 0755, true);
68 68
         }
69
-        recurse_copy(__DIR__ . '/template/js', $logDir . '/js');
70
-        recurse_copy(__DIR__ . '/template/css', $logDir . '/css');
71
-        recurse_copy(__DIR__ . '/template/images', $logDir . '/images');
69
+        recurse_copy(__DIR__.'/template/js', $logDir.'/js');
70
+        recurse_copy(__DIR__.'/template/css', $logDir.'/css');
71
+        recurse_copy(__DIR__.'/template/images', $logDir.'/images');
72 72
 
73 73
         // render dynamic pages
74
-        $this->renderPage(__DIR__ . '/template/index.php', $logDir . '/index.html', $consolidated, $history);
75
-        $this->renderPage(__DIR__ . '/template/loc.php', $logDir . '/loc.html', $consolidated, $history);
76
-        $this->renderPage(__DIR__ . '/template/relations.php', $logDir . '/relations.html', $consolidated, $history);
77
-        $this->renderPage(__DIR__ . '/template/coupling.php', $logDir . '/coupling.html', $consolidated, $history);
78
-        $this->renderPage(__DIR__ . '/template/all.php', $logDir . '/all.html', $consolidated, $history);
79
-        $this->renderPage(__DIR__ . '/template/oop.php', $logDir . '/oop.html', $consolidated, $history);
80
-        $this->renderPage(__DIR__ . '/template/complexity.php', $logDir . '/complexity.html', $consolidated, $history);
81
-        $this->renderPage(__DIR__ . '/template/panel.php', $logDir . '/panel.html', $consolidated, $history);
82
-        $this->renderPage(__DIR__ . '/template/violations.php', $logDir . '/violations.html', $consolidated, $history);
74
+        $this->renderPage(__DIR__.'/template/index.php', $logDir.'/index.html', $consolidated, $history);
75
+        $this->renderPage(__DIR__.'/template/loc.php', $logDir.'/loc.html', $consolidated, $history);
76
+        $this->renderPage(__DIR__.'/template/relations.php', $logDir.'/relations.html', $consolidated, $history);
77
+        $this->renderPage(__DIR__.'/template/coupling.php', $logDir.'/coupling.html', $consolidated, $history);
78
+        $this->renderPage(__DIR__.'/template/all.php', $logDir.'/all.html', $consolidated, $history);
79
+        $this->renderPage(__DIR__.'/template/oop.php', $logDir.'/oop.html', $consolidated, $history);
80
+        $this->renderPage(__DIR__.'/template/complexity.php', $logDir.'/complexity.html', $consolidated, $history);
81
+        $this->renderPage(__DIR__.'/template/panel.php', $logDir.'/panel.html', $consolidated, $history);
82
+        $this->renderPage(__DIR__.'/template/violations.php', $logDir.'/violations.html', $consolidated, $history);
83 83
         if ($this->config->has('git')) {
84
-            $this->renderPage(__DIR__ . '/template/git.php', $logDir . '/git.html', $consolidated, $history);
84
+            $this->renderPage(__DIR__.'/template/git.php', $logDir.'/git.html', $consolidated, $history);
85 85
         }
86
-        $this->renderPage(__DIR__ . '/template/junit.php', $logDir . '/junit.html', $consolidated, $history);
86
+        $this->renderPage(__DIR__.'/template/junit.php', $logDir.'/junit.html', $consolidated, $history);
87 87
 
88 88
         // js data
89 89
         file_put_contents(
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 
98 98
         // json data
99 99
         file_put_contents(
100
-            $logDir . '/js/classes.js',
101
-            'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
100
+            $logDir.'/js/classes.js',
101
+            'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
102 102
         );
103 103
 
104 104
         $this->output->writeln(sprintf('HTML report generated in "%s" directory', $logDir));
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         $diff = $newValue - $oldValue;
168 168
         if ($diff > 0) {
169
-            $diff = '+' . $diff;
169
+            $diff = '+'.$diff;
170 170
         }
171 171
 
172 172
         $goodOrBad = 'neutral';
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     }
91 91
 
92 92
     if ($node instanceof \PhpParser\Node\Name\FullyQualified) {
93
-        return (string)$node;
93
+        return (string) $node;
94 94
     }
95 95
     if ($node instanceof \PhpParser\Node\Expr\New_) {
96 96
         return getNameOfNode($node->class);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     }
102 102
 
103 103
     if ($node instanceof \PhpParser\Node\Name) {
104
-        return (string)implode($node->parts);
104
+        return (string) implode($node->parts);
105 105
     }
106 106
 
107 107
     if (isset($node->name) && $node->name instanceof \PhpParser\Node\Expr\Variable) {
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
     }
130 130
 
131 131
     if (isset($node->name) && null === $node->name) {
132
-        return 'anonymous@' . spl_object_hash($node);
132
+        return 'anonymous@'.spl_object_hash($node);
133 133
     }
134 134
 
135 135
     if (isset($node->name)) {
136
-        return (string)$node->name;
136
+        return (string) $node->name;
137 137
     }
138 138
 
139 139
     return null;
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
     }
152 152
     while (false !== ($file = readdir($dir))) {
153 153
         if (($file != '.') && ($file != '..')) {
154
-            if (is_dir($src . '/' . $file)) {
155
-                recurse_copy($src . '/' . $file, $dst . '/' . $file);
154
+            if (is_dir($src.'/'.$file)) {
155
+                recurse_copy($src.'/'.$file, $dst.'/'.$file);
156 156
             } else {
157
-                copy($src . '/' . $file, $dst . '/' . $file);
157
+                copy($src.'/'.$file, $dst.'/'.$file);
158 158
             }
159 159
         }
160 160
     }
Please login to merge, or discard this patch.
src/Hal/Metric/System/Packages/Composer/Packagist.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 
37 37
         // get latest version
38 38
         $latest = '0.0.0';
39
-        foreach ((array)$json->package->versions as $version => $datas) {
39
+        foreach ((array) $json->package->versions as $version => $datas) {
40 40
             $version = preg_replace('([^\.\d])', '', $version);
41 41
             if (!preg_match('!\d+\.\d+\.\d+!', $version)) {
42 42
                 continue;
Please login to merge, or discard this patch.
src/Hal/Metric/System/Packages/Composer/Composer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
             if (!preg_match('/composer\.json|composer-dist\.json/', $filename)) {
50 50
                 continue;
51 51
             }
52
-            $datas = (object)json_decode(file_get_contents($filename));
52
+            $datas = (object) json_decode(file_get_contents($filename));
53 53
 
54 54
             if (!isset($datas->require)) {
55 55
                 continue;
56 56
             }
57 57
 
58
-            $rawRequirements = array_merge($rawRequirements, (array)$datas->require);
58
+            $rawRequirements = array_merge($rawRequirements, (array) $datas->require);
59 59
         }
60 60
 
61 61
         $packagist = new Packagist();
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
             $package = $packagist->get($requirement);
65 65
 
66
-            $packages[$requirement] = (object)array(
66
+            $packages[$requirement] = (object) array(
67 67
                 'name' => $requirement,
68 68
                 'required' => $version,
69 69
                 'latest' => $package->latest,
Please login to merge, or discard this patch.
src/Hal/Report/Html/template/index.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php require __DIR__ . '/_header.php'; ?>
1
+<?php require __DIR__.'/_header.php'; ?>
2 2
     <div class="row">
3 3
         <div class="column">
4 4
             <div class="bloc bloc-number">
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                             <tbody id="contentClassRank" class="clusterize-content">
96 96
                             <?php
97 97
                             $classesS = $classes;
98
-                            usort($classesS, function ($a, $b) {
98
+                            usort($classesS, function($a, $b) {
99 99
                                 return strcmp($b['pageRank'], $a['pageRank']);
100 100
                             });
101 101
                             //$classesS = array_slice($classesS, 0, 10);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                             <tbody id="contentPackages" class="clusterize-content">
134 134
                             <?php
135 135
                             $packages = isset($project['composer'], $project['composer']['packages']) ? $project['composer']['packages'] : [];
136
-                            usort($packages, function ($a, $b) {
136
+                            usort($packages, function($a, $b) {
137 137
                                 return strcmp($a->name, $b->name);
138 138
                             });
139 139
                             foreach ($packages as $package) { ?>
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
                                     <td><?php echo $package->name; ?></td>
142 142
                                     <td><?php echo $package->required; ?></td>
143 143
                                     <td><?php echo $package->latest; ?></td>
144
-                                    <td><?php foreach($package->license as $license) { ?>
145
-                                            <a target="_blank" href="https://spdx.org/licenses/<?php echo $license;?>.html"><?php echo $license;?></a>
144
+                                    <td><?php foreach ($package->license as $license) { ?>
145
+                                            <a target="_blank" href="https://spdx.org/licenses/<?php echo $license; ?>.html"><?php echo $license; ?></a>
146 146
                                         <?php }; ?>
147 147
                                     </td>
148 148
                                 </tr>
149 149
                             <?php } ?>
150 150
                             </tbody>
151 151
                         </table>
152
-                        <?php if(0 === sizeof($packages)) { ?>
152
+                        <?php if (0 === sizeof($packages)) { ?>
153 153
                             <div>No composer.json file found</div>
154 154
                         <?php } ?>
155 155
                     </div>
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         <div class="column">
161 161
             <div class="bloc bloc-number">
162 162
                 <div class="label">Licences of Composer dependencies</div>
163
-                <?php if(0 === sizeof($packages)) { ?>
163
+                <?php if (0 === sizeof($packages)) { ?>
164 164
                     <div>No composer.json file found</div>
165 165
                 <?php } ?>
166 166
                 <div id="svg-licenses"></div>
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
                     }
200 200
                 }
201 201
                 ?>
202
-                chartLicenses(<?php echo json_encode(array_values($json));?>);
202
+                chartLicenses(<?php echo json_encode(array_values($json)); ?>);
203 203
             }
204 204
         };
205 205
     </script>
206 206
 
207
-<?php require __DIR__ . '/_footer.php'; ?>
208 207
\ No newline at end of file
208
+<?php require __DIR__.'/_footer.php'; ?>
209 209
\ No newline at end of file
Please login to merge, or discard this patch.