Completed
Pull Request — master (#401)
by
unknown
01:34
created
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/Violation/Class_/TooComplexMethodCode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     public function apply(Metric $metric)
27 27
     {
28
-        if (! $metric instanceof ClassMetric) {
28
+        if (!$metric instanceof ClassMetric) {
29 29
             return;
30 30
         }
31 31
 
Please login to merge, or discard this patch.
src/Hal/Violation/Class_/TooComplexClassCode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     public function apply(Metric $metric)
27 27
     {
28
-        if (! $metric instanceof ClassMetric) {
28
+        if (!$metric instanceof ClassMetric) {
29 29
             return;
30 30
         }
31 31
 
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Coupling/ExternalsVisitor.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -136,6 +136,9 @@
 block discarded – undo
136 136
         }
137 137
     }
138 138
 
139
+    /**
140
+     * @param string|null $dependency
141
+     */
139 142
     private function pushToDependencies(array &$dependencies, $dependency)
140 143
     {
141 144
         $lowercase = strtolower($dependency);
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -58,20 +58,20 @@  discard block
 block discarded – undo
58 58
             // extends
59 59
             if (isset($node->extends)) {
60 60
                 if (is_array($node->extends)) {
61
-                    foreach ((array)$node->extends as $interface) {
62
-                        $this->pushToDependencies($dependencies, (string)$interface);
63
-                        array_push($parents, (string)$interface);
61
+                    foreach ((array) $node->extends as $interface) {
62
+                        $this->pushToDependencies($dependencies, (string) $interface);
63
+                        array_push($parents, (string) $interface);
64 64
                     }
65 65
                 } else {
66
-                    $this->pushToDependencies($dependencies, (string)$node->extends);
67
-                    array_push($parents, (string)$node->extends);
66
+                    $this->pushToDependencies($dependencies, (string) $node->extends);
67
+                    array_push($parents, (string) $node->extends);
68 68
                 }
69 69
             }
70 70
 
71 71
             // implements
72 72
             if (isset($node->implements)) {
73 73
                 foreach ($node->implements as $interface) {
74
-                    $this->pushToDependencies($dependencies, (string)$interface);
74
+                    $this->pushToDependencies($dependencies, (string) $interface);
75 75
                 }
76 76
             }
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                     // return
81 81
                     if (isset($stmt->returnType)) {
82 82
                         if ($stmt->returnType instanceof Node\Name\FullyQualified) {
83
-                            $this->pushToDependencies($dependencies, (string)$stmt->returnType);
83
+                            $this->pushToDependencies($dependencies, (string) $stmt->returnType);
84 84
                         }
85 85
                     }
86 86
 
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
                     foreach ($stmt->params as $param) {
89 89
                         if ($param->type) {
90 90
                             if ($param->type instanceof Node\Name\FullyQualified) {
91
-                                $this->pushToDependencies($dependencies, (string)$param->type);
91
+                                $this->pushToDependencies($dependencies, (string) $param->type);
92 92
                             }
93 93
                         }
94 94
                     }
95 95
 
96 96
                     // instantiations, static calls
97
-                    \iterate_over_node($stmt, function ($node) use (&$dependencies) {
97
+                    \iterate_over_node($stmt, function($node) use (&$dependencies) {
98 98
                         switch (true) {
99 99
                             case $node instanceof Node\Expr\New_:
100 100
                                 // new MyClass
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
                         foreach ($matches[1] as $check) {
114 114
                             foreach ($this->uses as $use) {
115 115
                                 if (method_exists($use, 'getAlias')) {
116
-                                    if (((string)$use->getAlias()) === $check) {
117
-                                        $this->pushToDependencies($dependencies, (string)($use->name));
116
+                                    if (((string) $use->getAlias()) === $check) {
117
+                                        $this->pushToDependencies($dependencies, (string) ($use->name));
118 118
                                     }
119 119
                                     continue;
120 120
                                 }
121 121
                                 if ($use->alias === $check) {
122
-                                    $this->pushToDependencies($dependencies, (string)($use->name));
122
+                                    $this->pushToDependencies($dependencies, (string) ($use->name));
123 123
                                 }
124 124
                             }
125 125
                         }
@@ -138,6 +138,6 @@  discard block
 block discarded – undo
138 138
         if ('self' === $lowercase || 'parent' === $lowercase) {
139 139
             return;
140 140
         }
141
-        array_push($dependencies, (string)$dependency);
141
+        array_push($dependencies, (string) $dependency);
142 142
     }
143 143
 }
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
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 namespace Hal\Component\Ast;
10 10
 
11 11
 if (PHP_VERSION_ID >= 70000) {
12
-    class_alias(Php7NodeTraverser::class, __NAMESPACE__ . '\\NodeTraverser');
12
+    class_alias(Php7NodeTraverser::class, __NAMESPACE__.'\\NodeTraverser');
13 13
 } else {
14
-    class_alias(Php5NodeTraverser::class, __NAMESPACE__ . '\\NodeTraverser');
14
+    class_alias(Php5NodeTraverser::class, __NAMESPACE__.'\\NodeTraverser');
15 15
 }
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(count($array) > 1) {
22
+if (count($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/Report/Html/template/violations.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
 <?php
4 4
 $map = [
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                     <tbody>
58 58
                     <?php foreach ($classes as $class) {
59 59
                         if (count($class['violations']) > 0) {
60
-                            $currentId = 'bloc-' . uniqid('', true);
60
+                            $currentId = 'bloc-'.uniqid('', true);
61 61
                             ?>
62 62
 
63 63
                             <tr>
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                     <tbody>
109 109
                     <?php foreach ($packages as $package) {
110 110
                         if (count($package['violations']) > 0) {
111
-                            $currentId = 'bloc-' . uniqid();
111
+                            $currentId = 'bloc-'.uniqid();
112 112
                             ?>
113 113
 
114 114
                             <tr>
@@ -158,4 +158,4 @@  discard block
 block discarded – undo
158 158
             }
159 159
         }
160 160
     </script>
161
-<?php require __DIR__ . '/_footer.php'; ?>
161
+<?php require __DIR__.'/_footer.php'; ?>
Please login to merge, or discard this patch.
src/Hal/Report/Html/template/index.php 1 patch
Spacing   +10 added lines, -10 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);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                             <tbody id="contentPackages" class="clusterize-content">
138 138
                             <?php
139 139
                             $packages = isset($project['composer'], $project['composer']['packages']) ? $project['composer']['packages'] : [];
140
-                            usort($packages, function ($a, $b) {
140
+                            usort($packages, function($a, $b) {
141 141
                                 return strcmp($a->name, $b->name);
142 142
                             });
143 143
                             foreach ($packages as $package) { ?>
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
                                     <td><?php echo $package->required; ?></td>
147 147
                                     <?php if (0 !== count($packagesInstalled)) {?><td><?php echo $package->installed; ?></td><?php } ?>
148 148
                                     <td><?php echo $package->latest; ?></td>
149
-                                    <td><?php foreach($package->license as $license) { ?>
150
-                                            <a target="_blank" href="https://spdx.org/licenses/<?php echo $license;?>.html"><?php echo $license;?></a>
149
+                                    <td><?php foreach ($package->license as $license) { ?>
150
+                                            <a target="_blank" href="https://spdx.org/licenses/<?php echo $license; ?>.html"><?php echo $license; ?></a>
151 151
                                         <?php } ?>
152 152
                                     </td>
153 153
                                 </tr>
154 154
                             <?php } ?>
155 155
                             </tbody>
156 156
                         </table>
157
-                        <?php if(0 === count($packages)) { ?>
157
+                        <?php if (0 === count($packages)) { ?>
158 158
                             <div>No composer.json file found</div>
159 159
                         <?php } ?>
160
-                        <?php if(0 === count($packagesInstalled)) { ?>
160
+                        <?php if (0 === count($packagesInstalled)) { ?>
161 161
                             <div>No composer.lock file found</div>
162 162
                         <?php } ?>
163 163
                     </div>
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         <div class="column">
169 169
             <div class="bloc bloc-number">
170 170
                 <div class="label">Licences of Composer dependencies</div>
171
-                <?php if(0 === count($packages)) { ?>
171
+                <?php if (0 === count($packages)) { ?>
172 172
                     <div>No composer.json file found</div>
173 173
                 <?php } ?>
174 174
                 <div id="svg-licenses"></div>
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
                     }
208 208
                 }
209 209
                 ?>
210
-                chartLicenses(<?php echo json_encode(array_values($json));?>);
210
+                chartLicenses(<?php echo json_encode(array_values($json)); ?>);
211 211
             }
212 212
         };
213 213
     </script>
214 214
 
215
-<?php require __DIR__ . '/_footer.php'; ?>
215
+<?php require __DIR__.'/_footer.php'; ?>
Please login to merge, or discard this patch.