Completed
Pull Request — master (#283)
by Oskar
02:45
created
src/Hal/Violation/Package/StableDependenciesPrinciple.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function apply(Metric $metric)
23 23
     {
24
-        if (! $metric instanceof PackageMetric) {
24
+        if (!$metric instanceof PackageMetric) {
25 25
             return;
26 26
         }
27 27
         $instability = $metric->getInstability();
28 28
         $violatingInstabilities = array_filter(
29 29
             $metric->getDependentInstabilities(),
30
-            function ($otherInstability) use ($instability) {
30
+            function($otherInstability) use ($instability) {
31 31
                 return $otherInstability >= $instability;
32 32
             }
33 33
         );
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     {
48 48
         $count = count($this->violatingInstabilities);
49 49
         $thisInstability = round($this->metric->getInstability(), 3);
50
-        $packages = implode("\n* ", array_map(function ($name, $instability) {
50
+        $packages = implode("\n* ", array_map(function($name, $instability) {
51 51
             $name = $name === '\\' ? 'global' : substr($name, 0, -1);
52 52
             $instability = round($instability, 3);
53 53
             return "$name ($instability)";
Please login to merge, or discard this patch.
src/Hal/Report/Html/template/_footer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 </div>
2 2
 
3 3
 <!-- Sidebar -->
4
-<?php if(!isset($fullwidth) || $fullwidth === false) {?>
4
+<?php if (!isset($fullwidth) || $fullwidth === false) {?>
5 5
 <div id="sidebar">
6 6
     <div class="content">
7 7
         <div class="logo">
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
                             <path d="M0 0h24v24H0z" fill="none"/>
29 29
                             <path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"/>
30 30
                         </svg>
31
-                        Violations (<?php echo $sum->violations->total;?>)
31
+                        Violations (<?php echo $sum->violations->total; ?>)
32 32
                     </a>
33 33
                 </li>
34
-                <?php if($config->has('junit')) { ?>
34
+                <?php if ($config->has('junit')) { ?>
35 35
                     <li>
36 36
                         <a href="junit.html">
37 37
                             <svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                         Package relations
126 126
                     </a>
127 127
                 </li>
128
-                <?php if($config->has('git')) { ?>
128
+                <?php if ($config->has('git')) { ?>
129 129
                 <li>
130 130
                     <a href="git.html">
131 131
                         <img src="images/logo-git.png" alt="">
Please login to merge, or discard this patch.
src/Hal/Report/Html/template/packages.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require __DIR__ . '/_header.php'; ?>
2
+require __DIR__.'/_header.php'; ?>
3 3
 
4 4
     <div class="row">
5 5
         <div class="column">
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             </div>
41 41
         </div>
42 42
     </div>
43
-<?php require __DIR__ . '/_footer.php'; ?>
43
+<?php require __DIR__.'/_footer.php'; ?>
44 44
 <?php
45 45
 $spots = [];
46 46
 foreach ($packages as $each) {
Please login to merge, or discard this patch.
src/Hal/Report/Html/template/package_relations.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1
-<?php require __DIR__ . '/_header.php'; ?>
1
+<?php require __DIR__.'/_header.php'; ?>
2 2
 
3 3
 <?php
4 4
 $relations = [];
5
-$getPackageName = function ($name) {
5
+$getPackageName = function($name) {
6 6
     return $name === '\\' ? 'global' : substr($name, 0, -1);
7 7
 };
8 8
 foreach ($packages as $package) {
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     </div>
42 42
 </div>
43 43
 
44
-<?php require __DIR__ . '/_footer.php'; ?>
44
+<?php require __DIR__.'/_footer.php'; ?>
45 45
 
46 46
 
47 47
 <script type="text/javascript">
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 (sizeof($class['violations']) > 0) {
60
-                            $currentId = 'bloc-' . uniqid();
60
+                            $currentId = 'bloc-'.uniqid();
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 (sizeof($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'; ?>
162 161
\ No newline at end of file
162
+<?php require __DIR__.'/_footer.php'; ?>
163 163
\ No newline at end of file
Please login to merge, or discard this patch.
src/Hal/Report/Html/Reporter.php 1 patch
Spacing   +24 added lines, -24 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,35 +57,35 @@  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);
83
-        $this->renderPage(__DIR__ . '/template/packages.php', $logDir . '/packages.html', $consolidated, $history);
84
-        $this->renderPage(__DIR__ . '/template/package_relations.php', $logDir . '/package_relations.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
+        $this->renderPage(__DIR__.'/template/packages.php', $logDir.'/packages.html', $consolidated, $history);
84
+        $this->renderPage(__DIR__.'/template/package_relations.php', $logDir.'/package_relations.html', $consolidated, $history);
85 85
         if ($this->config->has('git')) {
86
-            $this->renderPage(__DIR__ . '/template/git.php', $logDir . '/git.html', $consolidated, $history);
86
+            $this->renderPage(__DIR__.'/template/git.php', $logDir.'/git.html', $consolidated, $history);
87 87
         }
88
-        $this->renderPage(__DIR__ . '/template/junit.php', $logDir . '/junit.html', $consolidated, $history);
88
+        $this->renderPage(__DIR__.'/template/junit.php', $logDir.'/junit.html', $consolidated, $history);
89 89
 
90 90
         // js data
91 91
         file_put_contents(
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 
100 100
         // json data
101 101
         file_put_contents(
102
-            $logDir . '/js/classes.js',
103
-            'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
102
+            $logDir.'/js/classes.js',
103
+            'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
104 104
         );
105 105
 
106 106
         $this->output->writeln(sprintf('HTML report generated in "%s" directory', $logDir));
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
         $diff = $newValue - $oldValue;
171 171
         if ($diff > 0) {
172
-            $diff = '+' . $diff;
172
+            $diff = '+'.$diff;
173 173
         }
174 174
 
175 175
         $goodOrBad = 'neutral';
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/ClassEnumVisitor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
                 $class->set('abstract', true);
40 40
             } else {
41 41
 
42
-                if(null === $node->name) {
42
+                if (null === $node->name) {
43 43
                     // anonymous class
44
-                    $name = 'anonymous@' . spl_object_hash($node);
44
+                    $name = 'anonymous@'.spl_object_hash($node);
45 45
                 } else {
46 46
                     $name = $node->namespacedName->toString();
47 47
                 }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             }
91 91
 
92 92
             $class->set('methods', $methods);
93
-            $class->set('nbMethodsIncludingGettersSetters', sizeof($methods) );
93
+            $class->set('nbMethodsIncludingGettersSetters', sizeof($methods));
94 94
             $class->set('nbMethods', sizeof($methods) - ($nbGetters + $nbSetters));
95 95
             $class->set('nbMethodsPrivate', $methodsPrivate);
96 96
             $class->set('nbMethodsPublic', $methodsPublic);
Please login to merge, or discard this patch.
src/Hal/Metric/PackageMetric.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
         }
48 48
         $classDependencies = $this->getOutgoingClassDependencies();
49 49
         $packageDependencies = $this->getOutgoingPackageDependencies();
50
-        if (! in_array($className, $classDependencies)) {
50
+        if (!in_array($className, $classDependencies)) {
51 51
             $classDependencies[] = $className;
52 52
             $this->set('outgoing_class_dependencies', $classDependencies);
53 53
         }
54
-        if (! in_array($packageName, $packageDependencies)) {
54
+        if (!in_array($packageName, $packageDependencies)) {
55 55
             $packageDependencies[] = $packageName;
56 56
             $this->set('outgoing_package_dependencies', $packageDependencies);
57 57
         }
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
         }
76 76
         $classDependencies = $this->getIncomingClassDependencies();
77 77
         $packageDependencies = $this->getIncomingPackageDependencies();
78
-        if (! in_array($className, $classDependencies)) {
78
+        if (!in_array($className, $classDependencies)) {
79 79
             $classDependencies[] = $className;
80 80
             $this->set('incoming_class_dependencies', $classDependencies);
81 81
         }
82
-        if (! in_array($packageName, $packageDependencies)) {
82
+        if (!in_array($packageName, $packageDependencies)) {
83 83
             $packageDependencies[] = $packageName;
84 84
             $this->set('incoming_package_dependencies', $packageDependencies);
85 85
         }
Please login to merge, or discard this patch.
src/Hal/Metric/Package/PackageAbstraction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
     {
12 12
         /* @var $packages PackageMetric[] */
13 13
         foreach ($metrics->all() as $eachPackage) {
14
-            if (! $eachPackage instanceof PackageMetric) {
14
+            if (!$eachPackage instanceof PackageMetric) {
15 15
                 continue;
16 16
             }
17 17
             $abstractClassCount = 0;
Please login to merge, or discard this patch.