Completed
Pull Request — master (#347)
by Oskar
04:52
created
src/Hal/Report/Html/Reporter.php 1 patch
Spacing   +26 added lines, -26 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,39 +57,39 @@  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
-        if(!file_exists($logDir . '/fonts')) {
69
+        if (!file_exists($logDir.'/fonts')) {
70 70
             mkdir($logDir.'/fonts', 0755, true);
71 71
         }
72
-        recurse_copy(__DIR__ . '/template/js', $logDir . '/js');
73
-        recurse_copy(__DIR__ . '/template/css', $logDir . '/css');
74
-        recurse_copy(__DIR__ . '/template/images', $logDir . '/images');
75
-        recurse_copy(__DIR__ . '/template/fonts', $logDir . '/fonts');
72
+        recurse_copy(__DIR__.'/template/js', $logDir.'/js');
73
+        recurse_copy(__DIR__.'/template/css', $logDir.'/css');
74
+        recurse_copy(__DIR__.'/template/images', $logDir.'/images');
75
+        recurse_copy(__DIR__.'/template/fonts', $logDir.'/fonts');
76 76
 
77 77
         // render dynamic pages
78
-        $this->renderPage(__DIR__ . '/template/index.php', $logDir . '/index.html', $consolidated, $history);
79
-        $this->renderPage(__DIR__ . '/template/loc.php', $logDir . '/loc.html', $consolidated, $history);
80
-        $this->renderPage(__DIR__ . '/template/relations.php', $logDir . '/relations.html', $consolidated, $history);
81
-        $this->renderPage(__DIR__ . '/template/coupling.php', $logDir . '/coupling.html', $consolidated, $history);
82
-        $this->renderPage(__DIR__ . '/template/all.php', $logDir . '/all.html', $consolidated, $history);
83
-        $this->renderPage(__DIR__ . '/template/oop.php', $logDir . '/oop.html', $consolidated, $history);
84
-        $this->renderPage(__DIR__ . '/template/complexity.php', $logDir . '/complexity.html', $consolidated, $history);
85
-        $this->renderPage(__DIR__ . '/template/panel.php', $logDir . '/panel.html', $consolidated, $history);
86
-        $this->renderPage(__DIR__ . '/template/violations.php', $logDir . '/violations.html', $consolidated, $history);
87
-        $this->renderPage(__DIR__ . '/template/packages.php', $logDir . '/packages.html', $consolidated, $history);
88
-        $this->renderPage(__DIR__ . '/template/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history);
78
+        $this->renderPage(__DIR__.'/template/index.php', $logDir.'/index.html', $consolidated, $history);
79
+        $this->renderPage(__DIR__.'/template/loc.php', $logDir.'/loc.html', $consolidated, $history);
80
+        $this->renderPage(__DIR__.'/template/relations.php', $logDir.'/relations.html', $consolidated, $history);
81
+        $this->renderPage(__DIR__.'/template/coupling.php', $logDir.'/coupling.html', $consolidated, $history);
82
+        $this->renderPage(__DIR__.'/template/all.php', $logDir.'/all.html', $consolidated, $history);
83
+        $this->renderPage(__DIR__.'/template/oop.php', $logDir.'/oop.html', $consolidated, $history);
84
+        $this->renderPage(__DIR__.'/template/complexity.php', $logDir.'/complexity.html', $consolidated, $history);
85
+        $this->renderPage(__DIR__.'/template/panel.php', $logDir.'/panel.html', $consolidated, $history);
86
+        $this->renderPage(__DIR__.'/template/violations.php', $logDir.'/violations.html', $consolidated, $history);
87
+        $this->renderPage(__DIR__.'/template/packages.php', $logDir.'/packages.html', $consolidated, $history);
88
+        $this->renderPage(__DIR__.'/template/package_relations.php', $logDir.'/package_relations.html', $consolidated, $history);
89 89
         if ($this->config->has('git')) {
90
-            $this->renderPage(__DIR__ . '/template/git.php', $logDir . '/git.html', $consolidated, $history);
90
+            $this->renderPage(__DIR__.'/template/git.php', $logDir.'/git.html', $consolidated, $history);
91 91
         }
92
-        $this->renderPage(__DIR__ . '/template/junit.php', $logDir . '/junit.html', $consolidated, $history);
92
+        $this->renderPage(__DIR__.'/template/junit.php', $logDir.'/junit.html', $consolidated, $history);
93 93
 
94 94
         // js data
95 95
         file_put_contents(
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 
104 104
         // json data
105 105
         file_put_contents(
106
-            $logDir . '/js/classes.js',
107
-            'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
106
+            $logDir.'/js/classes.js',
107
+            'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
108 108
         );
109 109
 
110 110
         $this->output->writeln(sprintf('HTML report generated in "%s" directory', $logDir));
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
         $diff = $newValue - $oldValue;
175 175
         if ($diff > 0) {
176
-            $diff = '+' . $diff;
176
+            $diff = '+'.$diff;
177 177
         }
178 178
 
179 179
         $goodOrBad = 'neutral';
Please login to merge, or discard this patch.
src/Hal/Violation/Package/StableAbstractionsPrinciple.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
 
19 19
     public function apply(Metric $metric)
20 20
     {
21
-        if (! $metric instanceof PackageMetric) {
21
+        if (!$metric instanceof PackageMetric) {
22 22
             return;
23 23
         }
24
-        if (abs($metric->getDistance()) > sqrt(2)/4) {
24
+        if (abs($metric->getDistance()) > sqrt(2) / 4) {
25 25
             $this->metric = $metric;
26 26
             $metric->get('violations')->add($this);
27 27
         }
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
             if ($version[0] === 'v') {
41 41
                 $version = substr($version, 1);
42 42
             }
Please login to merge, or discard this patch.
src/Hal/Report/Html/template/loc.php 1 patch
Spacing   +4 added lines, -4 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
 
3 3
 
4 4
 <?php
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 
20 20
 // 2. percentile map
21 21
 $json = [];
22
-if(sizeof($array) > 1) {
22
+if (sizeof($array) > 1) {
23 23
     $range = range(0.5, 1, .05);
24 24
     foreach ($range as $percentile) {
25
-        $json[] = (object)[
25
+        $json[] = (object) [
26 26
             'lloc' => percentile($array, $percentile),
27 27
             'percentile' => round($percentile * 100),
28 28
         ];
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 </div>
75 75
 
76 76
 
77
-<?php require __DIR__ . '/_footer.php'; ?>
77
+<?php require __DIR__.'/_footer.php'; ?>
78 78
 
79 79
 
80 80
 <script>
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Complexity/CyclomaticComplexityVisitor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
                 if ($stmt instanceof Stmt\ClassMethod) {
59 59
 
60 60
                     // iterate over children, recursively
61
-                    $cb = function ($node) use (&$cb) {
61
+                    $cb = function($node) use (&$cb) {
62 62
                         $ccn = 0;
63 63
 
64 64
                         foreach (get_object_vars($node) as $name => $member) {
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Coupling/ExternalsVisitor.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
             // extends
64 64
             if (isset($node->extends)) {
65 65
                 if (is_array($node->extends)) {
66
-                    foreach ((array)$node->extends as $interface) {
67
-                        array_push($dependencies, (string)$interface);
68
-                        array_push($parents, (string)$interface);
66
+                    foreach ((array) $node->extends as $interface) {
67
+                        array_push($dependencies, (string) $interface);
68
+                        array_push($parents, (string) $interface);
69 69
                     }
70 70
                 } else {
71
-                    array_push($dependencies, (string)$node->extends);
72
-                    array_push($parents, (string)$node->extends);
71
+                    array_push($dependencies, (string) $node->extends);
72
+                    array_push($parents, (string) $node->extends);
73 73
                 }
74 74
             }
75 75
 
76 76
             // implements
77 77
             if (isset($node->implements)) {
78 78
                 foreach ($node->implements as $interface) {
79
-                    array_push($dependencies, (string)$interface);
79
+                    array_push($dependencies, (string) $interface);
80 80
                 }
81 81
             }
82 82
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                     // return
86 86
                     if (isset($stmt->returnType)) {
87 87
                         if ($stmt->returnType instanceof Node\Name\FullyQualified) {
88
-                            array_push($dependencies, (string)$stmt->returnType);
88
+                            array_push($dependencies, (string) $stmt->returnType);
89 89
                         }
90 90
                     }
91 91
 
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
                     foreach ($stmt->params as $param) {
94 94
                         if ($param->type) {
95 95
                             if ($param->type instanceof Node\Name\FullyQualified) {
96
-                                array_push($dependencies, (string)$param->type);
96
+                                array_push($dependencies, (string) $param->type);
97 97
                             }
98 98
                         }
99 99
                     }
100 100
 
101 101
                     // instantiations, static calls
102
-                    \iterate_over_node($stmt, function ($node) use (&$dependencies) {
102
+                    \iterate_over_node($stmt, function($node) use (&$dependencies) {
103 103
                         switch (true) {
104 104
                             case $node instanceof Node\Expr\New_:
105 105
                                 // new MyClass
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
                             foreach ($this->uses as $use) {
120 120
                                 if (method_exists($use, 'getAlias')) {
121 121
                                     if (((string) $use->getAlias()) === $check) {
122
-                                        array_push($dependencies, (string)($use->name));
122
+                                        array_push($dependencies, (string) ($use->name));
123 123
                                     }
124 124
                                     continue;
125 125
                                 }
126 126
                                 if ($use->alias === $check) {
127
-                                    array_push($dependencies, (string)($use->name));
127
+                                    array_push($dependencies, (string) ($use->name));
128 128
                                 }
129 129
                             }
130 130
                         }
Please login to merge, or discard this patch.
src/Hal/Component/Ast/NodeTraverser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@
 block discarded – undo
28 28
 
29 29
     public function __construct(Mother $traverser, $stopCondition = null)
30 30
     {
31
-        if(null === $stopCondition) {
31
+        if (null === $stopCondition) {
32 32
             $stopCondition = function($node) {
33
-                if($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Interface_) {
33
+                if ($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Interface_) {
34 34
                     return false;
35 35
                 }
36 36
 
Please login to merge, or discard this patch.
src/Hal/Metric/Helper/RoleOfMethodDetector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,13 +81,13 @@
 block discarded – undo
81 81
      */
82 82
     public function detects($node)
83 83
     {
84
-        if (! $node instanceof ClassMethod) {
84
+        if (!$node instanceof ClassMethod) {
85 85
             return null;
86 86
         }
87 87
 
88 88
         // build a fingerprint of the given method
89 89
         $fingerprintOfMethod = [];
90
-        iterate_over_node($node, function ($node) use (&$fingerprintOfMethod) {
90
+        iterate_over_node($node, function($node) use (&$fingerprintOfMethod) {
91 91
 
92 92
             // avoid identifier (php-parser:^4)
93 93
             if ($node instanceof Identifier) {
Please login to merge, or discard this patch.