@@ -44,7 +44,7 @@ |
||
44 | 44 | { |
45 | 45 | $string = ''; |
46 | 46 | foreach ($this->data as $violation) { |
47 | - $string .= $violation->getName() . ','; |
|
47 | + $string .= $violation->getName().','; |
|
48 | 48 | } |
49 | 49 | return $string; |
50 | 50 | } |
@@ -52,7 +52,7 @@ |
||
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++; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $select = $while = $if = 0; |
44 | 44 | |
45 | - iterate_over_node($node, function ($node) use (&$while, &$select, &$if) { |
|
45 | + iterate_over_node($node, function($node) use (&$while, &$select, &$if) { |
|
46 | 46 | switch (true) { |
47 | 47 | case $node instanceof Stmt\Do_: |
48 | 48 | case $node instanceof Stmt\Foreach_: |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | }); |
60 | 60 | |
61 | - $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if; |
|
61 | + $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if; |
|
62 | 62 | $class->set('kanDefect', round($defect, 2)); |
63 | 63 | } |
64 | 64 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -chdir(__DIR__ . '/../../'); |
|
2 | +chdir(__DIR__.'/../../'); |
|
3 | 3 | |
4 | 4 | if (!file_exists('vendor/autoload.php')) { |
5 | - echo '[ERROR] It\'s required to run "composer install" before building PhpMetrics!' . PHP_EOL; |
|
5 | + echo '[ERROR] It\'s required to run "composer install" before building PhpMetrics!'.PHP_EOL; |
|
6 | 6 | exit(1); |
7 | 7 | } |
8 | 8 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | if (preg_match($exclude, $file)) { |
22 | 22 | continue; |
23 | 23 | } |
24 | - $path = str_replace(__DIR__ . '/', '', $file); |
|
24 | + $path = str_replace(__DIR__.'/', '', $file); |
|
25 | 25 | $phar->addFromString($path, file_get_contents($file)); |
26 | 26 | } |
27 | 27 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | |
53 | 53 | function rglob($pattern = '*', $flags = 0, $path = '') |
54 | 54 | { |
55 | - $paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT); |
|
56 | - $files = glob($path . $pattern, $flags); |
|
55 | + $paths = glob($path.'*', GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT); |
|
56 | + $files = glob($path.$pattern, $flags); |
|
57 | 57 | foreach ($paths as $path) { |
58 | 58 | $files = array_merge($files, rglob($pattern, $flags, $path)); |
59 | 59 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function writeln($message) |
25 | 25 | { |
26 | - $this->write(PHP_EOL . $message); |
|
26 | + $this->write(PHP_EOL.$message); |
|
27 | 27 | return $this; |
28 | 28 | } |
29 | 29 |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | |
22 | 22 | public function apply(Metric $metric) |
23 | 23 | { |
24 | - if (! $metric instanceof PackageMetric) { |
|
24 | + if (!$metric instanceof PackageMetric) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | $instability = $metric->getInstability(); |
28 | 28 | $violatingInstabilities = array_filter( |
29 | 29 | $metric->getDependentInstabilities(), |
30 | - function ($otherInstability) use ($instability) { |
|
30 | + function($otherInstability) use ($instability) { |
|
31 | 31 | return $otherInstability >= $instability; |
32 | 32 | } |
33 | 33 | ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $count = count($this->violatingInstabilities); |
49 | 49 | $thisInstability = round($this->metric->getInstability(), 3); |
50 | - $packages = implode("\n* ", array_map(function ($name, $instability) { |
|
50 | + $packages = implode("\n* ", array_map(function($name, $instability) { |
|
51 | 51 | $name = $name === '\\' ? 'global' : substr($name, 0, -1); |
52 | 52 | $instability = round($instability, 3); |
53 | 53 | return "$name ($instability)"; |
@@ -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; |
@@ -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( |