Completed
Pull Request — master (#448)
by
unknown
08:31
created
phpmetrics/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.
phpmetrics/src/Hal/Metric/System/Changes/GitChanges.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         $file = current($this->files);
67 67
         $realpath = realpath(dirname($file));
68 68
         if ($realpath === false) {
69
-            throw new ShouldNotHappenException('Cannot get realpath of ' . dirname($file));
69
+            throw new ShouldNotHappenException('Cannot get realpath of '.dirname($file));
70 70
         }
71 71
         $command = sprintf(
72 72
             "cd %s && %s log --format='* %%at\t%%cn' --numstat -n 500",
Please login to merge, or discard this patch.
phpmetrics/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.
phpmetrics/src/Hal/Metric/System/UnitTesting/UnitTesting.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $domList = $xpath->query('//testsuite[@file]');
77 77
         if ($domList !== false) {
78 78
             foreach ($domList as $suite) {
79
-                array_push($testsuites, (object)[
79
+                array_push($testsuites, (object) [
80 80
                     'file' => $suite->getAttribute('file'),
81 81
                     'name' => $suite->getAttribute('name'),
82 82
                     'assertions' => $suite->getAttribute('assertions'),
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                     $assertions = $case === $suite->firstChild->nextSibling ? $suite->getAttribute('assertions') : 0;
109 109
                 }
110 110
 
111
-                $testsuites[$case->getAttribute('class')] = (object)[
111
+                $testsuites[$case->getAttribute('class')] = (object) [
112 112
                     'file' => $case->getAttribute('file'),
113 113
                     'name' => $case->getAttribute('class'),
114 114
                     'assertions' => $assertions,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             $traverser->addVisitor(new ExternalsVisitor($metricsOfUnitTest));
129 129
 
130 130
             if (!file_exists($suite->file) || !is_readable($suite->file)) {
131
-                throw new \LogicException('Cannot find source file referenced in testsuite: ' . $suite->file);
131
+                throw new \LogicException('Cannot find source file referenced in testsuite: '.$suite->file);
132 132
             }
133 133
 
134 134
             $code = file_get_contents($suite->file);
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
             if ($metric === null) {
151 151
                 throw new MetricNullException($suite->name, self::class);
152 152
             }
153
-            $externals = (array)$metric->get('externals');
153
+            $externals = (array) $metric->get('externals');
154 154
 
155 155
             // global stats for each test
156
-            $infoAboutTests[$suite->name] = (object)[
156
+            $infoAboutTests[$suite->name] = (object) [
157 157
                 'nbExternals' => count(array_unique($externals)),
158 158
                 'externals' => array_unique($externals),
159 159
                 'filename' => $suite->file,
Please login to merge, or discard this patch.
phpmetrics/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
             if ($classOrFunction === null) {
54 54
                 throw new MetricNullException($name, self::class);
Please login to merge, or discard this patch.
phpmetrics/src/Hal/Metric/Class_/Text/LengthVisitor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  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
-                $name = (string)$node->name;
42
+                $name = (string) $node->name;
43 43
                 $classOrFunction = new FunctionMetric($name);
44 44
                 $this->metrics->attach($classOrFunction);
45 45
             }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             }
76 76
 
77 77
             // count and remove single line comments
78
-            $code = preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function (array $matches) use (&$cloc) {
78
+            $code = preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function(array $matches) use (&$cloc) {
79 79
                 if (isset($matches[2])) {
80 80
                     $cloc += 1;
81 81
                 }
Please login to merge, or discard this patch.
phpmetrics/src/Hal/Metric/Class_/Text/HalsteadVisitor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@  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
-                $name = (string)$node->name;
51
+                $name = (string) $node->name;
52 52
                 $classOrFunction = new FunctionMetric($name);
53 53
                 $this->metrics->attach($classOrFunction);
54 54
             }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             $operands = [];
62 62
             $operators = [];
63 63
 
64
-            iterate_over_node($node, function ($node) use (&$operators, &$operands) {
64
+            iterate_over_node($node, function($node) use (&$operators, &$operands) {
65 65
                 if ($node instanceof Node\Expr\BinaryOp
66 66
                     || $node instanceof Node\Expr\AssignOp
67 67
                     || $node instanceof Stmt\If_
Please login to merge, or discard this patch.
phpmetrics/src/Hal/Metric/Class_/Structural/SystemComplexityVisitor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
                     $output = 0;
53 53
                     $fanout = [];
54 54
 
55
-                    iterate_over_node($node, function ($node) use (&$output, &$fanout) {
55
+                    iterate_over_node($node, function($node) use (&$output, &$fanout) {
56 56
                         switch (true) {
57 57
                             case $node instanceof Stmt\Return_:
58 58
                                 $output++;
Please login to merge, or discard this patch.
phpmetrics/src/Hal/Metric/Class_/Structural/LcomVisitor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
 
50 50
             foreach ($node->stmts as $stmt) {
51 51
                 if ($stmt instanceof Stmt\ClassMethod) {
52
-                    if (!$graph->has($stmt->name . '()')) {
53
-                        $graph->insert(new TreeNode($stmt->name . '()'));
52
+                    if (!$graph->has($stmt->name.'()')) {
53
+                        $graph->insert(new TreeNode($stmt->name.'()'));
54 54
                     }
55
-                    $from = $graph->get($stmt->name . '()');
55
+                    $from = $graph->get($stmt->name.'()');
56 56
                     if ($from === null) {
57 57
                         throw new ShouldNotHappenException('Graph $from is null');
58 58
                     }
59 59
 
60
-                    \iterate_over_node($stmt, function ($node) use ($from, &$graph) {
60
+                    \iterate_over_node($stmt, function($node) use ($from, &$graph) {
61 61
                         if ($node instanceof Node\Expr\PropertyFetch && isset($node->var->name) && $node->var->name == 'this') {
62
-                            $name = (string)getNameOfNode($node);
62
+                            $name = (string) getNameOfNode($node);
63 63
                             // use of attribute $this->xxx;
64 64
                             if (!$graph->has($name)) {
65 65
                                 $graph->insert(new TreeNode($name));
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                             if (!$node->var instanceof Node\Expr\New_ && isset($node->var->name) && getNameOfNode($node->var) === 'this') {
77 77
                                 // use of method call $this->xxx();
78 78
                                 // use of attribute $this->xxx;
79
-                                $name = getNameOfNode($node->name) . '()';
79
+                                $name = getNameOfNode($node->name).'()';
80 80
                                 if (!$graph->has($name)) {
81 81
                                     $graph->insert(new TreeNode($name));
82 82
                                 }
Please login to merge, or discard this patch.