@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | public function calculate(Metrics $metrics) |
13 | 13 | { |
14 | 14 | /* @var $packages PackageMetric[] */ |
15 | - $packages = array_filter($metrics->all(), function ($metric) { |
|
15 | + $packages = array_filter($metrics->all(), function($metric) { |
|
16 | 16 | return $metric instanceof PackageMetric; |
17 | 17 | }); |
18 | 18 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | // Set depending instabilities |
32 | 32 | foreach ($packages as $eachPackage) { |
33 | - $dependentInstabilities = array_map(function ($packageName) use ($instabilitiesByPackage) { |
|
33 | + $dependentInstabilities = array_map(function($packageName) use ($instabilitiesByPackage) { |
|
34 | 34 | return isset($instabilitiesByPackage[$packageName]) ? $instabilitiesByPackage[$packageName] : null; |
35 | 35 | }, $eachPackage->getOutgoingPackageDependencies()); |
36 | 36 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->excludedDirs = $excludedDirs; |
58 | 58 | $this->flags = $flags; |
59 | 59 | if ($flags === -1) { |
60 | - $this->flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO; |
|
60 | + $this->flags = FilesystemIterator::KEY_AS_PATHNAME|FilesystemIterator::CURRENT_AS_FILEINFO; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | $files = []; |
73 | 73 | foreach ($paths as $path) { |
74 | 74 | if (is_dir($path)) { |
75 | - $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
75 | + $path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
76 | 76 | $directory = new RecursiveDirectoryIterator($path, $this->flags); |
77 | 77 | $iterator = new RecursiveIteratorIterator($directory); |
78 | 78 | |
79 | 79 | $filterRegex = sprintf( |
80 | 80 | '`^%s%s%s$`', |
81 | 81 | preg_quote($path, '`'), |
82 | - !empty($this->excludedDirs) ? '((?!' . implode('|', array_map('preg_quote', $this->excludedDirs)) . ').)+' : '.+', |
|
83 | - '\.(' . implode('|', $this->extensions) . ')' |
|
82 | + !empty($this->excludedDirs) ? '((?!'.implode('|', array_map('preg_quote', $this->excludedDirs)).').)+' : '.+', |
|
83 | + '\.('.implode('|', $this->extensions).')' |
|
84 | 84 | ); |
85 | 85 | |
86 | 86 | $filteredIterator = new RegexIterator( |
@@ -31,7 +31,7 @@ |
||
31 | 31 | public function __construct(CustomNodeTraverser $traverser, $stopCondition = null) |
32 | 32 | { |
33 | 33 | if (null === $stopCondition) { |
34 | - $stopCondition = function ($node) { |
|
34 | + $stopCondition = function($node) { |
|
35 | 35 | if ($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Interface_) { |
36 | 36 | return false; |
37 | 37 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | $item->setAttribute('rule', $violation->getName()); |
68 | 68 | $item->setAttribute('ruleset', $violation->getName()); |
69 | 69 | $item->setAttribute('externalInfoUrl', 'http://www.phpmetrics.org/documentation/index.html'); |
70 | - $item->setAttribute('priority', (string)$map[$violation->getLevel()]); |
|
70 | + $item->setAttribute('priority', (string) $map[$violation->getLevel()]); |
|
71 | 71 | $item->nodeValue = $violation->getDescription(); |
72 | 72 | $node->appendChild($item); |
73 | 73 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $this->config = $config; |
59 | 59 | $this->output = $output; |
60 | - $this->templateDir = __DIR__ . '/../../../../templates'; |
|
60 | + $this->templateDir = __DIR__.'/../../../../templates'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** @return void */ |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | $consolidated = new Consolidated($metrics); |
83 | 83 | |
84 | 84 | // history of builds |
85 | - $today = (object)[ |
|
85 | + $today = (object) [ |
|
86 | 86 | 'avg' => $consolidated->getAvg(), |
87 | 87 | 'sum' => $consolidated->getSum() |
88 | 88 | ]; |
89 | - $files = glob($logDir . '/js/history-*.json'); |
|
89 | + $files = glob($logDir.'/js/history-*.json'); |
|
90 | 90 | if ($files === false) { |
91 | 91 | throw new ShouldNotHappenException('Glob logdir operation return false'); |
92 | 92 | } |
@@ -102,40 +102,40 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | // copy sources |
105 | - if (!file_exists($logDir . '/js')) { |
|
106 | - mkdir($logDir . '/js', 0755, true); |
|
105 | + if (!file_exists($logDir.'/js')) { |
|
106 | + mkdir($logDir.'/js', 0755, true); |
|
107 | 107 | } |
108 | - if (!file_exists($logDir . '/css')) { |
|
109 | - mkdir($logDir . '/css', 0755, true); |
|
108 | + if (!file_exists($logDir.'/css')) { |
|
109 | + mkdir($logDir.'/css', 0755, true); |
|
110 | 110 | } |
111 | - if (!file_exists($logDir . '/images')) { |
|
112 | - mkdir($logDir . '/images', 0755, true); |
|
111 | + if (!file_exists($logDir.'/images')) { |
|
112 | + mkdir($logDir.'/images', 0755, true); |
|
113 | 113 | } |
114 | - if (!file_exists($logDir . '/fonts')) { |
|
115 | - mkdir($logDir . '/fonts', 0755, true); |
|
114 | + if (!file_exists($logDir.'/fonts')) { |
|
115 | + mkdir($logDir.'/fonts', 0755, true); |
|
116 | 116 | } |
117 | - recurse_copy($this->templateDir . '/html_report/js', $logDir . '/js'); |
|
118 | - recurse_copy($this->templateDir . '/html_report/css', $logDir . '/css'); |
|
119 | - recurse_copy($this->templateDir . '/html_report/images', $logDir . '/images'); |
|
120 | - recurse_copy($this->templateDir . '/html_report/fonts', $logDir . '/fonts'); |
|
117 | + recurse_copy($this->templateDir.'/html_report/js', $logDir.'/js'); |
|
118 | + recurse_copy($this->templateDir.'/html_report/css', $logDir.'/css'); |
|
119 | + recurse_copy($this->templateDir.'/html_report/images', $logDir.'/images'); |
|
120 | + recurse_copy($this->templateDir.'/html_report/fonts', $logDir.'/fonts'); |
|
121 | 121 | |
122 | 122 | // render dynamic pages |
123 | - $this->renderPage($this->templateDir . '/html_report/index.php', $logDir . '/index.html', $consolidated, $history); |
|
124 | - $this->renderPage($this->templateDir . '/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history); |
|
125 | - $this->renderPage($this->templateDir . '/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history); |
|
126 | - $this->renderPage($this->templateDir . '/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history); |
|
127 | - $this->renderPage($this->templateDir . '/html_report/all.php', $logDir . '/all.html', $consolidated, $history); |
|
128 | - $this->renderPage($this->templateDir . '/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history); |
|
129 | - $this->renderPage($this->templateDir . '/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history); |
|
130 | - $this->renderPage($this->templateDir . '/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history); |
|
131 | - $this->renderPage($this->templateDir . '/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history); |
|
132 | - $this->renderPage($this->templateDir . '/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history); |
|
133 | - $this->renderPage($this->templateDir . '/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history); |
|
134 | - $this->renderPage($this->templateDir . '/html_report/composer.php', $logDir . '/composer.html', $consolidated, $history); |
|
123 | + $this->renderPage($this->templateDir.'/html_report/index.php', $logDir.'/index.html', $consolidated, $history); |
|
124 | + $this->renderPage($this->templateDir.'/html_report/loc.php', $logDir.'/loc.html', $consolidated, $history); |
|
125 | + $this->renderPage($this->templateDir.'/html_report/relations.php', $logDir.'/relations.html', $consolidated, $history); |
|
126 | + $this->renderPage($this->templateDir.'/html_report/coupling.php', $logDir.'/coupling.html', $consolidated, $history); |
|
127 | + $this->renderPage($this->templateDir.'/html_report/all.php', $logDir.'/all.html', $consolidated, $history); |
|
128 | + $this->renderPage($this->templateDir.'/html_report/oop.php', $logDir.'/oop.html', $consolidated, $history); |
|
129 | + $this->renderPage($this->templateDir.'/html_report/complexity.php', $logDir.'/complexity.html', $consolidated, $history); |
|
130 | + $this->renderPage($this->templateDir.'/html_report/panel.php', $logDir.'/panel.html', $consolidated, $history); |
|
131 | + $this->renderPage($this->templateDir.'/html_report/violations.php', $logDir.'/violations.html', $consolidated, $history); |
|
132 | + $this->renderPage($this->templateDir.'/html_report/packages.php', $logDir.'/packages.html', $consolidated, $history); |
|
133 | + $this->renderPage($this->templateDir.'/html_report/package_relations.php', $logDir.'/package_relations.html', $consolidated, $history); |
|
134 | + $this->renderPage($this->templateDir.'/html_report/composer.php', $logDir.'/composer.html', $consolidated, $history); |
|
135 | 135 | if ($this->config->has('git')) { |
136 | - $this->renderPage($this->templateDir . '/html_report/git.php', $logDir . '/git.html', $consolidated, $consolidatedGroups, $history); |
|
136 | + $this->renderPage($this->templateDir.'/html_report/git.php', $logDir.'/git.html', $consolidated, $consolidatedGroups, $history); |
|
137 | 137 | } |
138 | - $this->renderPage($this->templateDir . '/html_report/junit.php', $logDir . '/junit.html', $consolidated, $consolidatedGroups, $history); |
|
138 | + $this->renderPage($this->templateDir.'/html_report/junit.php', $logDir.'/junit.html', $consolidated, $consolidatedGroups, $history); |
|
139 | 139 | |
140 | 140 | // js data |
141 | 141 | file_put_contents( |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | |
150 | 150 | // json data |
151 | 151 | file_put_contents( |
152 | - $logDir . '/classes.js', |
|
153 | - 'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
152 | + $logDir.'/classes.js', |
|
153 | + 'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
154 | 154 | ); |
155 | 155 | |
156 | 156 | // HTML files to generate |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | // consolidated by groups |
173 | 173 | foreach ($consolidatedGroups as $name => $consolidated) { |
174 | - $outDir = $logDir . DIRECTORY_SEPARATOR . $name; |
|
174 | + $outDir = $logDir.DIRECTORY_SEPARATOR.$name; |
|
175 | 175 | $this->currentGroup = $name; |
176 | 176 | $this->assetPath = '../'; |
177 | 177 | |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | ); |
189 | 189 | |
190 | 190 | file_put_contents( |
191 | - $outDir . '/classes.js', |
|
192 | - 'var classes = ' . json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
191 | + $outDir.'/classes.js', |
|
192 | + 'var classes = '.json_encode($consolidated->getClasses(), JSON_PRETTY_PRINT) |
|
193 | 193 | ); |
194 | 194 | } |
195 | 195 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | $diff = $newValue - $oldValue; |
269 | 269 | if ($diff > 0) { |
270 | - $diff = '+' . $diff; |
|
270 | + $diff = '+'.$diff; |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | $goodOrBad = 'neutral'; |
@@ -36,24 +36,24 @@ |
||
36 | 36 | |
37 | 37 | public function flow3_B() |
38 | 38 | { |
39 | - return $this->d * 3; |
|
39 | + return $this->d * 3; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function flow3_C() |
43 | 43 | { |
44 | - return $this->d * 4; |
|
44 | + return $this->d * 4; |
|
45 | 45 | $a = new E; |
46 | 46 | $b = new F; |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function flow3_D() |
50 | 50 | { |
51 | - return $this->d * 5; |
|
51 | + return $this->d * 5; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function flow3_E() |
55 | 55 | { |
56 | - return $this->d * 6; |
|
56 | + return $this->d * 6; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function testICanParseJunitXmlFile() |
15 | 15 | { |
16 | 16 | $config = new Config(); |
17 | - $config->set('junit', __DIR__ . '/xml/junit1.xml'); |
|
17 | + $config->set('junit', __DIR__.'/xml/junit1.xml'); |
|
18 | 18 | $unit = new UnitTesting($config, []); |
19 | 19 | $metrics = new Metrics(); |
20 | 20 | $unit->calculate($metrics); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function testExceptionIsThrownIfJunitFileDoesNotExist() |
41 | 41 | { |
42 | 42 | $config = new Config(); |
43 | - $config->set('junit', __DIR__ . '/xml/junit-not-found.xml'); |
|
43 | + $config->set('junit', __DIR__.'/xml/junit-not-found.xml'); |
|
44 | 44 | $unit = new UnitTesting($config, []); |
45 | 45 | $metrics = new Metrics(); |
46 | 46 | $unit->calculate($metrics); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function testICanParseCodeceptionFile() |
50 | 50 | { |
51 | 51 | $config = new Config(); |
52 | - $config->set('junit', __DIR__ . '/xml/codeception1.xml'); |
|
52 | + $config->set('junit', __DIR__.'/xml/codeception1.xml'); |
|
53 | 53 | $unit = new UnitTesting($config, []); |
54 | 54 | $metrics = new Metrics(); |
55 | 55 | $unit->calculate($metrics); |
@@ -124,7 +124,7 @@ |
||
124 | 124 | |
125 | 125 | $metric->setNormalizedDistance(1); |
126 | 126 | $this->assertSame(1, $metric->getNormalizedDistance()); |
127 | - $this->assertEquals(1/sqrt(2), $metric->getDistance()); |
|
127 | + $this->assertEquals(1 / sqrt(2), $metric->getDistance()); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | public function testItMyaHasDependentInstabilities() |
@@ -66,7 +66,7 @@ |
||
66 | 66 | public static function provideExamples() |
67 | 67 | { |
68 | 68 | return [ |
69 | - [__DIR__ . '/../examples/nbmethods1.php', 'A', 3, 1, 2, 7], |
|
69 | + [__DIR__.'/../examples/nbmethods1.php', 'A', 3, 1, 2, 7], |
|
70 | 70 | ]; |
71 | 71 | } |
72 | 72 |