@@ -11,7 +11,7 @@ |
||
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; |
@@ -42,11 +42,11 @@ |
||
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 | } |
@@ -12,7 +12,7 @@ discard block |
||
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 |
||
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 |
||
56 | 56 | } |
57 | 57 | $parts = explode('\\', $className); |
58 | 58 | array_pop($parts); |
59 | - return implode('\\', $parts) . '\\'; |
|
59 | + return implode('\\', $parts).'\\'; |
|
60 | 60 | } |
61 | 61 | } |
@@ -10,7 +10,7 @@ discard block |
||
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 |
||
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( |
@@ -17,7 +17,6 @@ |
||
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 | } |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | // extends |
63 | 63 | if (isset($node->extends)) { |
64 | 64 | if (is_array($node->extends)) { |
65 | - foreach ((array)$node->extends as $interface) { |
|
66 | - array_push($dependencies, (string)$interface); |
|
67 | - array_push($parents, (string)$interface); |
|
65 | + foreach ((array) $node->extends as $interface) { |
|
66 | + array_push($dependencies, (string) $interface); |
|
67 | + array_push($parents, (string) $interface); |
|
68 | 68 | } |
69 | 69 | } else { |
70 | - array_push($dependencies, (string)$node->extends); |
|
71 | - array_push($parents, (string)$node->extends); |
|
70 | + array_push($dependencies, (string) $node->extends); |
|
71 | + array_push($parents, (string) $node->extends); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | // implements |
76 | 76 | if (isset($node->implements)) { |
77 | 77 | foreach ($node->implements as $interface) { |
78 | - array_push($dependencies, (string)$interface); |
|
78 | + array_push($dependencies, (string) $interface); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | // return |
85 | 85 | if (isset($stmt->returnType)) { |
86 | 86 | if ($stmt->returnType instanceof Node\Name\FullyQualified) { |
87 | - array_push($dependencies, (string)$stmt->returnType); |
|
87 | + array_push($dependencies, (string) $stmt->returnType); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | foreach ($stmt->params as $param) { |
93 | 93 | if ($param->type) { |
94 | 94 | if ($param->type instanceof Node\Name\FullyQualified) { |
95 | - array_push($dependencies, (string)$param->type); |
|
95 | + array_push($dependencies, (string) $param->type); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | 100 | // instantiations, static calls |
101 | - \iterate_over_node($stmt, function ($node) use (&$dependencies) { |
|
101 | + \iterate_over_node($stmt, function($node) use (&$dependencies) { |
|
102 | 102 | switch (true) { |
103 | 103 | case $node instanceof Node\Expr\New_: |
104 | 104 | // new MyClass |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | foreach ($matches[1] as $check) { |
118 | 118 | foreach ($this->uses as $use) { |
119 | 119 | if ($use->alias === $check) { |
120 | - array_push($dependencies, (string)($use->name)); |
|
120 | + array_push($dependencies, (string) ($use->name)); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | return; |
45 | 45 | } |
46 | 46 | if (!file_exists(dirname($logFile)) || !is_writable(dirname($logFile))) { |
47 | - throw new \RuntimeException('You don\'t have permissions to write CSV report in ' . $logFile); |
|
47 | + throw new \RuntimeException('You don\'t have permissions to write CSV report in '.$logFile); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $availables = (new Registry())->allForStructures(); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | return; |
43 | 43 | } |
44 | 44 | if (!file_exists(dirname($logFile)) || !is_writable(dirname($logFile))) { |
45 | - throw new \RuntimeException('You don\'t have permissions to write JSON report in ' . $logFile); |
|
45 | + throw new \RuntimeException('You don\'t have permissions to write JSON report in '.$logFile); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | file_put_contents($logFile, json_encode($metrics, JSON_PRETTY_PRINT)); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $package = $packagist->get($requirement); |
47 | 47 | |
48 | - $packages[$requirement] = (object)array( |
|
48 | + $packages[$requirement] = (object) array( |
|
49 | 49 | 'name' => $requirement, |
50 | 50 | 'required' => $version, |
51 | 51 | 'installed' => isset($rawInstalled[$requirement]) ? $rawInstalled[$requirement] : null, |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | if (!\preg_match('/composer(-dist)?\.json/', $filename)) { |
77 | 77 | continue; |
78 | 78 | } |
79 | - $composerJson = (object)\json_decode(\file_get_contents($filename)); |
|
79 | + $composerJson = (object) \json_decode(\file_get_contents($filename)); |
|
80 | 80 | |
81 | 81 | if (!isset($composerJson->require)) { |
82 | 82 | continue; |
83 | 83 | } |
84 | 84 | |
85 | - $rawRequirements[] = (array)$composerJson->require; |
|
85 | + $rawRequirements[] = (array) $composerJson->require; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | return \call_user_func_array('array_merge', $rawRequirements); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | if (false === \strpos($filename, 'composer.lock')) { |
107 | 107 | continue; |
108 | 108 | } |
109 | - $composerLockJson = (object)\json_decode(\file_get_contents($filename)); |
|
109 | + $composerLockJson = (object) \json_decode(\file_get_contents($filename)); |
|
110 | 110 | |
111 | 111 | if (!isset($composerLockJson->packages)) { |
112 | 112 | continue; |