Completed
Pull Request — master (#314)
by
unknown
01:54
created
src/functions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     }
90 90
 
91 91
     if ($node instanceof \PhpParser\Node\Name\FullyQualified) {
92
-        return (string)$node;
92
+        return (string) $node;
93 93
     }
94 94
     if ($node instanceof \PhpParser\Node\Expr\New_) {
95 95
         return getNameOfNode($node->class);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     }
101 101
 
102 102
     if ($node instanceof \PhpParser\Node\Name) {
103
-        return (string)implode($node->parts);
103
+        return (string) implode($node->parts);
104 104
     }
105 105
 
106 106
     if (isset($node->name) && $node->name instanceof \PhpParser\Node\Expr\Variable) {
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
     }
129 129
 
130 130
     if (isset($node->name) && null === $node->name) {
131
-        return 'anonymous@' . spl_object_hash($node);
131
+        return 'anonymous@'.spl_object_hash($node);
132 132
     }
133 133
 
134 134
     if (isset($node->name)) {
135
-        return (string)$node->name;
135
+        return (string) $node->name;
136 136
     }
137 137
 
138 138
     return null;
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
     }
151 151
     while (false !== ($file = readdir($dir))) {
152 152
         if (('.' != $file) && ('..' != $file)) {
153
-            if (is_dir($src . '/' . $file)) {
154
-                recurse_copy($src . '/' . $file, $dst . '/' . $file);
153
+            if (is_dir($src.'/'.$file)) {
154
+                recurse_copy($src.'/'.$file, $dst.'/'.$file);
155 155
             } else {
156
-                copy($src . '/' . $file, $dst . '/' . $file);
156
+                copy($src.'/'.$file, $dst.'/'.$file);
157 157
             }
158 158
         }
159 159
     }
Please login to merge, or discard this patch.
src/Hal/Metric/Consolidated.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
         }
67 67
 
68 68
         // sums
69
-        $sum = (object)[
69
+        $sum = (object) [
70 70
             'loc' => 0,
71 71
             'cloc' => 0,
72 72
             'lloc' => 0,
73 73
             'nbMethods' => 0,
74 74
         ];
75
-        $avg = (object)[
75
+        $avg = (object) [
76 76
             'ccn' => [],
77 77
             'bugs' => [],
78 78
             'kanDefect' => [],
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                 $violations[$name]++;
133 133
             }
134 134
         }
135
-        $sum->violations = (object)$violations;
135
+        $sum->violations = (object) $violations;
136 136
 
137 137
         $this->avg = $avg;
138 138
         $this->sum = $sum;
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Structural/SystemComplexityVisitor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
                     $output = 0;
51 51
                     $fanout = [];
52 52
 
53
-                    \iterate_over_node($node, function ($node) use (&$output, &$fanout) {
53
+                    \iterate_over_node($node, function($node) use (&$output, &$fanout) {
54 54
                         switch (true) {
55 55
                             case $node instanceof Stmt\Return_:
56 56
                                 $output++;
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
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 
45 45
             foreach ($node->stmts as $stmt) {
46 46
                 if ($stmt instanceof Stmt\ClassMethod) {
47
-                    if (!$graph->has($stmt->name . '()')) {
48
-                        $graph->insert(new TreeNode($stmt->name . '()'));
47
+                    if (!$graph->has($stmt->name.'()')) {
48
+                        $graph->insert(new TreeNode($stmt->name.'()'));
49 49
                     }
50
-                    $from = $graph->get($stmt->name . '()');
50
+                    $from = $graph->get($stmt->name.'()');
51 51
 
52
-                    \iterate_over_node($stmt, function ($node) use ($from, &$graph) {
52
+                    \iterate_over_node($stmt, function($node) use ($from, &$graph) {
53 53
 
54 54
                         if ($node instanceof Node\Expr\PropertyFetch && isset($node->var->name) && 'this' == $node->var->name) {
55 55
                             $name = \getNameOfNode($node);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                             if (!$node->var instanceof Node\Expr\New_ && isset($node->var->name) && 'this' === \getNameOfNode($node->var)) {
68 68
                                 // use of method call $this->xxx();
69 69
                                 // use of attribute $this->xxx;
70
-                                $name = \getNameOfNode($node->name) . '()';
70
+                                $name = \getNameOfNode($node->name).'()';
71 71
                                 if (!$graph->has($name)) {
72 72
                                     $graph->insert(new TreeNode($name));
73 73
                                 }
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Text/HalsteadVisitor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) {
47 47
             if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
48
-                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'. \spl_object_hash($node));
48
+                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.\spl_object_hash($node));
49 49
                 $classOrFunction = $this->metrics->get($name);
50 50
             } else {
51 51
                 $classOrFunction = new FunctionMetric($node->name);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $operands = [];
57 57
             $operators = [];
58 58
 
59
-            \iterate_over_node($node, function ($node) use (&$operators, &$operands) {
59
+            \iterate_over_node($node, function($node) use (&$operators, &$operands) {
60 60
 
61 61
                 if ($node instanceof Node\Expr\BinaryOp
62 62
                     || $node instanceof Node\Expr\AssignOp
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Text/LengthVisitor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) {
38 38
             if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
39
-                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'. \spl_object_hash($node));
39
+                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.\spl_object_hash($node));
40 40
                 $classOrFunction = $this->metrics->get($name);
41 41
             } else {
42 42
                 $classOrFunction = new FunctionMetric($node->name);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             $code = \preg_replace('!/\*.*?\*/!s', '', $code);
61 61
 
62 62
             // count and remove single line comments
63
-            $code = \preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function (array $matches) use (&$cloc) {
63
+            $code = \preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function(array $matches) use (&$cloc) {
64 64
                 if (isset($matches[2])) {
65 65
                     ++$cloc;
66 66
                 }
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Complexity/KanDefectVisitor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
             $select = $while = $if = 0;
45 45
 
46
-            \iterate_over_node($node, function ($node) use (&$while, &$select, &$if) {
46
+            \iterate_over_node($node, function($node) use (&$while, &$select, &$if) {
47 47
                 switch (true) {
48 48
                     case $node instanceof Stmt\Do_:
49 49
                     case $node instanceof Stmt\Foreach_:
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 }
60 60
             });
61 61
 
62
-            $defect = 0.15 + 0.23 *  $while + 0.22 *  $select + 0.07 * $if;
62
+            $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if;
63 63
             $class->set('kanDefect', \round($defect, 2));
64 64
         }
65 65
     }
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Component/MaintainabilityIndexVisitor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     public function leaveNode(Node $node)
49 49
     {
50 50
         if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
51
-            $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'. \spl_object_hash($node));
51
+            $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.\spl_object_hash($node));
52 52
             $classOrFunction = $this->metrics->get($name);
53 53
 
54 54
             if (null === $lloc = $classOrFunction->get('lloc')) {
Please login to merge, or discard this patch.
src/Hal/Metric/System/UnitTesting/UnitTesting.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         // JUNIT format
82 82
         foreach ($xpath->query('//testsuite[@file]') as $suite) {
83
-            $testsuites[] = (object)[
83
+            $testsuites[] = (object) [
84 84
                 'file' => $suite->getAttribute('file'),
85 85
                 'name' => $suite->getAttribute('name'),
86 86
                 'assertions' => $suite->getAttribute('assertions'),
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             }
111 111
 
112 112
             $attributeClass = $case->getAttribute('class');
113
-            $testsuites[$attributeClass] = (object)[
113
+            $testsuites[$attributeClass] = (object) [
114 114
                 'file' => $case->getAttribute('file'),
115 115
                 'name' => $attributeClass,
116 116
                 'assertions' => $assertions,
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             $traverser->addVisitor(new ExternalsVisitor($metricsOfUnitTest));
130 130
 
131 131
             if (!\file_exists($suite->file) || !\is_readable($suite->file)) {
132
-                throw new \LogicException('Cannot find source file referenced in testsuite: ' . $suite->file);
132
+                throw new \LogicException('Cannot find source file referenced in testsuite: '.$suite->file);
133 133
             }
134 134
 
135 135
             $code = \file_get_contents($suite->file);
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 
143 143
             // list of externals sources of unit test
144 144
             $metric = $metricsOfUnitTest->get($suite->name);
145
-            $externals = (array)$metric->get('externals');
145
+            $externals = (array) $metric->get('externals');
146 146
 
147 147
             // global stats for each test
148
-            $infoAboutTests[$suite->name] = (object)[
148
+            $infoAboutTests[$suite->name] = (object) [
149 149
                 'nbExternals' => \count(\array_unique($externals)),
150 150
                 'externals' => \array_unique($externals),
151 151
                 'filename' => $suite->file,
Please login to merge, or discard this patch.