Completed
Pull Request — master (#403)
by
unknown
01:47
created
src/Hal/Metric/Package/PackageDependencies.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 {
13 13
     public function calculate(Metrics $metrics)
14 14
     {
15
-        $classes = array_filter($metrics->all(), function (Metric $metric) {
15
+        $classes = array_filter($metrics->all(), function(Metric $metric) {
16 16
             return $metric instanceof ClassMetric || $metric instanceof InterfaceMetric;
17 17
         });
18 18
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     private function increaseDependencies(Metric $class, Metrics $metrics)
29 29
     {
30
-        if (! $class->has('package') || ! $class->has('externals')) {
30
+        if (!$class->has('package') || !$class->has('externals')) {
31 31
             return;
32 32
         }
33 33
         $incomingPackage = $metrics->get($class->get('package')); /* @var $incomingPackage PackageMetric */
@@ -56,6 +56,6 @@  discard block
 block discarded – undo
56 56
         }
57 57
         $parts = explode('\\', $className);
58 58
         array_pop($parts);
59
-        return implode('\\', $parts) . '\\';
59
+        return implode('\\', $parts).'\\';
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
src/Hal/Metric/Package/PackageInstability.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     public function calculate(Metrics $metrics)
11 11
     {
12 12
         /* @var $packages PackageMetric[] */
13
-        $packages = array_filter($metrics->all(), function ($metric) {
13
+        $packages = array_filter($metrics->all(), function($metric) {
14 14
             return $metric instanceof PackageMetric;
15 15
         });
16 16
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         }
29 29
         // Set depending instabilities
30 30
         foreach ($packages as $eachPackage) {
31
-            $dependentInstabilities = array_map(function ($packageName) use ($instabilitiesByPackage) {
31
+            $dependentInstabilities = array_map(function($packageName) use ($instabilitiesByPackage) {
32 32
                 return isset($instabilitiesByPackage[$packageName]) ? $instabilitiesByPackage[$packageName] : null;
33 33
             }, $eachPackage->getOutgoingPackageDependencies());
34 34
             $dependentInstabilities = array_combine(
Please login to merge, or discard this patch.
src/Hal/Metric/Helper/MetricClassNameGenerator.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,6 @@
 block discarded – undo
17 17
     public static function getName(Node $node)
18 18
     {
19 19
         return ($node instanceof Node\Stmt\Class_ && $node->isAnonymous()) ?
20
-            'anonymous@' . spl_object_hash($node) :
21
-            $node->namespacedName->toString();
20
+            'anonymous@'.spl_object_hash($node) : $node->namespacedName->toString();
22 21
     }
23 22
 }
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Component/MaintainabilityIndexVisitor.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Hal\Metric\Class_\Component;
3 3
 
4
-use Hal\Metric\FunctionMetric;
5 4
 use Hal\Metric\Metrics;
6
-use Hoa\Ruler\Model\Bag\Scalar;
7 5
 use PhpParser\Node;
8 6
 use PhpParser\Node\Stmt;
9 7
 use PhpParser\NodeVisitorAbstract;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     public function leaveNode(Node $node)
48 48
     {
49 49
         if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
50
-            $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@' . spl_object_hash($node));
50
+            $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node));
51 51
             $classOrFunction = $this->metrics->get($name);
52 52
 
53 53
             if (null === $lloc = $classOrFunction->get('lloc')) {
Please login to merge, or discard this patch.
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
@@ -40,46 +40,46 @@  discard block
 block discarded – undo
40 40
 
41 41
         $consolidated = new Consolidated($metrics);
42 42
 
43
-        $files = glob($logDir . '/js/history-*.json');
43
+        $files = glob($logDir.'/js/history-*.json');
44 44
         natsort($files);
45
-        $history = array_map(static function ($filename) {
45
+        $history = array_map(static function($filename) {
46 46
             return json_decode(file_get_contents($filename));
47 47
         }, $files);
48 48
 
49 49
         foreach (['js', 'css', 'images', 'fonts'] as $subFolder) {
50
-            $folder = $logDir . '/' . $subFolder;
50
+            $folder = $logDir.'/'.$subFolder;
51 51
             if (!file_exists($folder)) {
52 52
                 mkdir($folder, 0755, true);
53 53
             }
54
-            recurse_copy(__DIR__ . '/template/' . $subFolder, $folder);
54
+            recurse_copy(__DIR__.'/template/'.$subFolder, $folder);
55 55
         }
56 56
 
57 57
         // render dynamic pages
58
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/index.php', $logDir . '/index.html', $consolidated, $history);
59
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history);
60
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history);
61
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history);
62
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/all.php', $logDir . '/all.html', $consolidated, $history);
63
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history);
64
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history);
65
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history);
66
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history);
67
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history);
68
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history);
58
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/index.php', $logDir.'/index.html', $consolidated, $history);
59
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/loc.php', $logDir.'/loc.html', $consolidated, $history);
60
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/relations.php', $logDir.'/relations.html', $consolidated, $history);
61
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/coupling.php', $logDir.'/coupling.html', $consolidated, $history);
62
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/all.php', $logDir.'/all.html', $consolidated, $history);
63
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/oop.php', $logDir.'/oop.html', $consolidated, $history);
64
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/complexity.php', $logDir.'/complexity.html', $consolidated, $history);
65
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/panel.php', $logDir.'/panel.html', $consolidated, $history);
66
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/violations.php', $logDir.'/violations.html', $consolidated, $history);
67
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/packages.php', $logDir.'/packages.html', $consolidated, $history);
68
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/package_relations.php', $logDir.'/package_relations.html', $consolidated, $history);
69 69
         if ($this->config->has('git')) {
70
-            $this->renderPage(PROJECT_DIR . '/templates/html_report/git.php', $logDir . '/git.html', $consolidated, $history);
70
+            $this->renderPage(PROJECT_DIR.'/templates/html_report/git.php', $logDir.'/git.html', $consolidated, $history);
71 71
         }
72
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/junit.php', $logDir . '/junit.html', $consolidated, $history);
72
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/junit.php', $logDir.'/junit.html', $consolidated, $history);
73 73
 
74
-        $today = (object)['avg' => $consolidated->getAvg(), 'sum' => $consolidated->getSum()];
74
+        $today = (object) ['avg' => $consolidated->getAvg(), 'sum' => $consolidated->getSum()];
75 75
         $encodedToday = json_encode($today, JSON_PRETTY_PRINT);
76 76
         $next = count($history) + 1;
77 77
         file_put_contents(sprintf('%s/js/history-%d.json', $logDir, $next), $encodedToday);
78 78
         file_put_contents(sprintf('%s/js/latest.json', $logDir), $encodedToday);
79 79
 
80 80
         file_put_contents(
81
-            $logDir . '/js/classes.js',
82
-            'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
81
+            $logDir.'/js/classes.js',
82
+            'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT)
83 83
         );
84 84
 
85 85
         $this->output->writeln(sprintf('HTML report generated in "%s" directory', $logDir));
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         $goodOrBad = 'neutral';
146 146
         if ($newValue > $oldValue) {
147 147
             $r = 'gt';
148
-            $diff = '+' . $diff;
148
+            $diff = '+'.$diff;
149 149
             $goodOrBad = $lowIsBetter ? 'bad' : $goodOrBad;
150 150
             $goodOrBad = $highIsBetter ? 'good' : $goodOrBad;
151 151
         } elseif ($newValue < $oldValue) {
Please login to merge, or discard this patch.
src/Hal/Application/Analyze.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
         $metrics = new Metrics();
79 79
 
80 80
         // traverse all
81
-        $whenToStop = function () {
81
+        $whenToStop = function() {
82 82
             return true;
83 83
         };
84 84
 
Please login to merge, or discard this patch.
src/Hal/Component/Tree/GraphDeduplicated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
      */
28 28
     public function addEdge(Node $from, Node $to)
29 29
     {
30
-        $key = $from->getUniqueId() . '->' . $to->getUniqueId();
30
+        $key = $from->getUniqueId().'->'.$to->getUniqueId();
31 31
 
32 32
         if (isset($this->edgesMap[$key])) {
33 33
             return $this;
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/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.