Completed
Pull Request — master (#408)
by
unknown
01:37
created
src/Hal/Metric/Class_/Text/HalsteadVisitor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
     {
45 45
         if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) {
46 46
             if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
47
-                $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@' . spl_object_hash($node));
47
+                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node));
48 48
                 $classOrFunction = $this->metrics->get($name);
49 49
             } else {
50
-                $classOrFunction = new FunctionMetric((string)$node->name);
50
+                $classOrFunction = new FunctionMetric((string) $node->name);
51 51
                 $this->metrics->attach($classOrFunction);
52 52
             }
53 53
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             $operands = [];
56 56
             $operators = [];
57 57
 
58
-            iterate_over_node($node, function ($node) use (&$operators, &$operands) {
58
+            iterate_over_node($node, function($node) use (&$operators, &$operands) {
59 59
                 if ($node instanceof Node\Expr\BinaryOp
60 60
                     || $node instanceof Node\Expr\AssignOp
61 61
                     || $node instanceof Stmt\If_
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Text/LengthVisitor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
     {
35 35
         if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) {
36 36
             if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
37
-                $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@' . spl_object_hash($node));
37
+                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node));
38 38
                 $classOrFunction = $this->metrics->get($name);
39 39
             } else {
40
-                $classOrFunction = new FunctionMetric((string)$node->name);
40
+                $classOrFunction = new FunctionMetric((string) $node->name);
41 41
                 $this->metrics->attach($classOrFunction);
42 42
             }
43 43
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             $code = preg_replace('!/\*.*?\*/!s', '', $code);
58 58
 
59 59
             // count and remove single line comments
60
-            $code = preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function (array $matches) use (&$cloc) {
60
+            $code = preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function(array $matches) use (&$cloc) {
61 61
                 if (isset($matches[2])) {
62 62
                     $cloc += 1;
63 63
                 }
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Structural/LcomVisitor.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
             foreach ($node->stmts as $stmt) {
44 44
                 if ($stmt instanceof Stmt\ClassMethod) {
45
-                    if (!$graph->has($stmt->name . '()')) {
46
-                        $graph->insert(new TreeNode($stmt->name . '()'));
45
+                    if (!$graph->has($stmt->name.'()')) {
46
+                        $graph->insert(new TreeNode($stmt->name.'()'));
47 47
                     }
48
-                    $from = $graph->get($stmt->name . '()');
48
+                    $from = $graph->get($stmt->name.'()');
49 49
 
50
-                    \iterate_over_node($stmt, function ($node) use ($from, &$graph) {
50
+                    \iterate_over_node($stmt, function($node) use ($from, &$graph) {
51 51
                         if ($node instanceof Node\Expr\PropertyFetch && isset($node->var->name) && $node->var->name == 'this') {
52 52
                             $name = getNameOfNode($node);
53 53
                             // use of attribute $this->xxx;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                             if (!$node->var instanceof Node\Expr\New_ && isset($node->var->name) && getNameOfNode($node->var) === 'this') {
64 64
                                 // use of method call $this->xxx();
65 65
                                 // use of attribute $this->xxx;
66
-                                $name = getNameOfNode($node->name) . '()';
66
+                                $name = getNameOfNode($node->name).'()';
67 67
                                 if (!$graph->has($name)) {
68 68
                                     $graph->insert(new TreeNode($name));
69 69
                                 }
Please login to merge, or discard this patch.
src/Hal/Metric/Package/PackageCollectingVisitor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     public function enterNode(Node $node)
28 28
     {
29 29
         if ($node instanceof Namespace_) {
30
-            $this->namespace = (string)$node->name;
30
+            $this->namespace = (string) $node->name;
31 31
         }
32 32
     }
33 33
 
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
                 $package = $matches[1];
43 43
             }
44 44
             if (preg_match('/^\s*\* @subpackage (.*)/m', $docBlockText, $matches)) {
45
-                $package = $package . '\\' . $matches[1];
45
+                $package = $package.'\\'.$matches[1];
46 46
             }
47 47
 
48
-            $packageName = $package . '\\';
49
-            if (! $packageMetric = $this->metrics->get($packageName)) {
48
+            $packageName = $package.'\\';
49
+            if (!$packageMetric = $this->metrics->get($packageName)) {
50 50
                 $packageMetric = new PackageMetric($packageName);
51 51
                 $this->metrics->attach($packageMetric);
52 52
             }
53 53
             /* @var PackageMetric $packageMetric */
54
-            $elementName = isset($node->namespacedName) ? $node->namespacedName : 'anonymous@' . spl_object_hash($node);
55
-            $elementName = (string)$elementName;
54
+            $elementName = isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node);
55
+            $elementName = (string) $elementName;
56 56
             $packageMetric->addClass($elementName);
57 57
 
58 58
             $this->metrics->get($elementName)->set('package', $packageName);
Please login to merge, or discard this patch.
src/Hal/Metric/PackageMetric.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     public function addClass($name)
19 19
     {
20 20
         $elements = $this->get('classes');
21
-        $elements[] = (string)$name;
21
+        $elements[] = (string) $name;
22 22
         $this->set('classes', $elements);
23 23
     }
24 24
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     public function setAbstraction($abstraction)
27 27
     {
28 28
         if ($abstraction !== null) {
29
-            $abstraction = (float)$abstraction;
29
+            $abstraction = (float) $abstraction;
30 30
         }
31 31
         $this->set('abstraction', $abstraction);
32 32
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function setInstability($instability)
42 42
     {
43 43
         if ($instability !== null) {
44
-            $instability = (float)$instability;
44
+            $instability = (float) $instability;
45 45
         }
46 46
         $this->set('instability', $instability);
47 47
     }
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
         }
64 64
         $classDependencies = $this->getOutgoingClassDependencies();
65 65
         $packageDependencies = $this->getOutgoingPackageDependencies();
66
-        if (! in_array($className, $classDependencies)) {
66
+        if (!in_array($className, $classDependencies)) {
67 67
             $classDependencies[] = $className;
68 68
             $this->set('outgoing_class_dependencies', $classDependencies);
69 69
         }
70
-        if (! in_array($packageName, $packageDependencies)) {
70
+        if (!in_array($packageName, $packageDependencies)) {
71 71
             $packageDependencies[] = $packageName;
72 72
             $this->set('outgoing_package_dependencies', $packageDependencies);
73 73
         }
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
         }
97 97
         $classDependencies = $this->getIncomingClassDependencies();
98 98
         $packageDependencies = $this->getIncomingPackageDependencies();
99
-        if (! in_array($className, $classDependencies)) {
99
+        if (!in_array($className, $classDependencies)) {
100 100
             $classDependencies[] = $className;
101 101
             $this->set('incoming_class_dependencies', $classDependencies);
102 102
         }
103
-        if (! in_array($packageName, $packageDependencies)) {
103
+        if (!in_array($packageName, $packageDependencies)) {
104 104
             $packageDependencies[] = $packageName;
105 105
             $this->set('incoming_package_dependencies', $packageDependencies);
106 106
         }
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,9 +9,9 @@
 block discarded – undo
9 9
 namespace Hal\Component\Ast;
10 10
 
11 11
 if (PHP_VERSION_ID >= 70000) {
12
-    class_alias(Php7NodeTraverser::class, __NAMESPACE__ . '\\ActualNodeTraverser');
12
+    class_alias(Php7NodeTraverser::class, __NAMESPACE__.'\\ActualNodeTraverser');
13 13
 } else {
14
-    class_alias(Php5NodeTraverser::class, __NAMESPACE__ . '\\ActualNodeTraverser');
14
+    class_alias(Php5NodeTraverser::class, __NAMESPACE__.'\\ActualNodeTraverser');
15 15
 }
16 16
 
17 17
 /**
Please login to merge, or discard this patch.
src/Hal/Metric/Helper/RoleOfMethodDetector.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                 'PhpParser\\Node\\Param',
79 79
                 'PhpParser\\Node\\Expr\\Variable',
80 80
                 'PhpParser\\Node\\Name',
81
-            ],[
81
+            ], [
82 82
                 // function setOk(?bool $ok): self { $this->isOk = $ok; return $this; }
83 83
                 'PhpParser\\Node\\Stmt\\ClassMethod',
84 84
                 'PhpParser\\Node\\Stmt\\Expression',
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function detects($node)
100 100
     {
101
-        if (! $node instanceof ClassMethod) {
101
+        if (!$node instanceof ClassMethod) {
102 102
             return null;
103 103
         }
104 104
 
105 105
         // build a fingerprint of the given method
106 106
         $fingerprintOfMethod = [];
107
-        iterate_over_node($node, function ($node) use (&$fingerprintOfMethod) {
107
+        iterate_over_node($node, function($node) use (&$fingerprintOfMethod) {
108 108
             // avoid identifier (php-parser:^4)
109 109
             if ($node instanceof Identifier) {
110 110
                 return;
Please login to merge, or discard this patch.
src/Hal/Metric/System/Packages/Composer/Packagist.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
         // get latest version
36 36
         $latest = '0.0.0';
37
-        foreach ((array)$json->package->versions as $version => $datas) {
37
+        foreach ((array) $json->package->versions as $version => $datas) {
38 38
             if ($version[0] === 'v') {
39 39
                 $version = substr($version, 1);
40 40
             }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                 $latest = $version;
46 46
                 $response->name = $package;
47 47
                 $response->latest = $version;
48
-                $response->license = (array)$datas->license;
48
+                $response->license = (array) $datas->license;
49 49
                 $response->homepage = $datas->homepage;
50 50
                 $response->time = $datas->time;
51 51
                 $response->zip = $datas->dist->url;
Please login to merge, or discard this patch.
src/Hal/Report/Html/Reporter.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
         $consolidated = new Consolidated($metrics);
41 41
 
42 42
         // history of builds
43
-        $today = (object)[
43
+        $today = (object) [
44 44
             'avg' => $consolidated->getAvg(),
45 45
             'sum' => $consolidated->getSum()
46 46
         ];
47
-        $files = glob($logDir . '/js/history-*.json');
47
+        $files = glob($logDir.'/js/history-*.json');
48 48
         $next = count($files) + 1;
49 49
         $history = [];
50 50
         natsort($files);
@@ -53,39 +53,39 @@  discard block
 block discarded – undo
53 53
         }
54 54
 
55 55
         // copy sources
56
-        if (!file_exists($logDir . '/js')) {
57
-            mkdir($logDir . '/js', 0755, true);
56
+        if (!file_exists($logDir.'/js')) {
57
+            mkdir($logDir.'/js', 0755, true);
58 58
         }
59
-        if (!file_exists($logDir . '/css')) {
60
-            mkdir($logDir . '/css', 0755, true);
59
+        if (!file_exists($logDir.'/css')) {
60
+            mkdir($logDir.'/css', 0755, true);
61 61
         }
62
-        if (!file_exists($logDir . '/images')) {
63
-            mkdir($logDir . '/images', 0755, true);
62
+        if (!file_exists($logDir.'/images')) {
63
+            mkdir($logDir.'/images', 0755, true);
64 64
         }
65
-        if (!file_exists($logDir . '/fonts')) {
66
-            mkdir($logDir . '/fonts', 0755, true);
65
+        if (!file_exists($logDir.'/fonts')) {
66
+            mkdir($logDir.'/fonts', 0755, true);
67 67
         }
68
-        recurse_copy(PROJECT_DIR . '/templates/html_report/js', $logDir . '/js');
69
-        recurse_copy(PROJECT_DIR . '/templates/html_report/css', $logDir . '/css');
70
-        recurse_copy(PROJECT_DIR . '/templates/html_report/images', $logDir . '/images');
71
-        recurse_copy(PROJECT_DIR . '/templates/html_report/fonts', $logDir . '/fonts');
68
+        recurse_copy(PROJECT_DIR.'/templates/html_report/js', $logDir.'/js');
69
+        recurse_copy(PROJECT_DIR.'/templates/html_report/css', $logDir.'/css');
70
+        recurse_copy(PROJECT_DIR.'/templates/html_report/images', $logDir.'/images');
71
+        recurse_copy(PROJECT_DIR.'/templates/html_report/fonts', $logDir.'/fonts');
72 72
 
73 73
         // render dynamic pages
74
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/index.php', $logDir . '/index.html', $consolidated, $history);
75
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history);
76
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history);
77
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history);
78
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/all.php', $logDir . '/all.html', $consolidated, $history);
79
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history);
80
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history);
81
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history);
82
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history);
83
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history);
84
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history);
74
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/index.php', $logDir.'/index.html', $consolidated, $history);
75
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/loc.php', $logDir.'/loc.html', $consolidated, $history);
76
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/relations.php', $logDir.'/relations.html', $consolidated, $history);
77
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/coupling.php', $logDir.'/coupling.html', $consolidated, $history);
78
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/all.php', $logDir.'/all.html', $consolidated, $history);
79
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/oop.php', $logDir.'/oop.html', $consolidated, $history);
80
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/complexity.php', $logDir.'/complexity.html', $consolidated, $history);
81
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/panel.php', $logDir.'/panel.html', $consolidated, $history);
82
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/violations.php', $logDir.'/violations.html', $consolidated, $history);
83
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/packages.php', $logDir.'/packages.html', $consolidated, $history);
84
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/package_relations.php', $logDir.'/package_relations.html', $consolidated, $history);
85 85
         if ($this->config->has('git')) {
86
-            $this->renderPage(PROJECT_DIR . '/templates/html_report/git.php', $logDir . '/git.html', $consolidated, $history);
86
+            $this->renderPage(PROJECT_DIR.'/templates/html_report/git.php', $logDir.'/git.html', $consolidated, $history);
87 87
         }
88
-        $this->renderPage(PROJECT_DIR . '/templates/html_report/junit.php', $logDir . '/junit.html', $consolidated, $history);
88
+        $this->renderPage(PROJECT_DIR.'/templates/html_report/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));
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
         $diff = $newValue - $oldValue;
169 169
         if ($diff > 0) {
170
-            $diff = '+' . $diff;
170
+            $diff = '+'.$diff;
171 171
         }
172 172
 
173 173
         $goodOrBad = 'neutral';
Please login to merge, or discard this patch.