@@ -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'; |
@@ -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(); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | if ($node instanceof \PhpParser\Node\Name\FullyQualified) { |
89 | - return (string)$node; |
|
89 | + return (string) $node; |
|
90 | 90 | } |
91 | 91 | if ($node instanceof \PhpParser\Node\Expr\New_) { |
92 | 92 | return getNameOfNode($node->class); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | if ($node instanceof \PhpParser\Node\Name) { |
100 | - return (string)implode($node->parts); |
|
100 | + return (string) implode($node->parts); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | if (isset($node->name) && $node->name instanceof \PhpParser\Node\Expr\Variable) { |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | if (isset($node->name) && null === $node->name) { |
128 | - return 'anonymous@' . spl_object_hash($node); |
|
128 | + return 'anonymous@'.spl_object_hash($node); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | if (isset($node->name)) { |
132 | - return (string)$node->name; |
|
132 | + return (string) $node->name; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return null; |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | } |
148 | 148 | while (false !== ($file = readdir($dir))) { |
149 | 149 | if (($file != '.') && ($file != '..')) { |
150 | - if (is_dir($src . '/' . $file)) { |
|
151 | - recurse_copy($src . '/' . $file, $dst . '/' . $file); |
|
150 | + if (is_dir($src.'/'.$file)) { |
|
151 | + recurse_copy($src.'/'.$file, $dst.'/'.$file); |
|
152 | 152 | } else { |
153 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
153 | + copy($src.'/'.$file, $dst.'/'.$file); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | { |
176 | 176 | // memory cache |
177 | 177 | static $caches; |
178 | - if(null === $caches) { |
|
178 | + if (null === $caches) { |
|
179 | 179 | $caches = []; |
180 | 180 | } |
181 | 181 | |
182 | - if(!isset($caches[$attribute])) { |
|
182 | + if (!isset($caches[$attribute])) { |
|
183 | 183 | // avoid to iterate over array too many times |
184 | 184 | $max = 0; |
185 | 185 | $min = 1; |
186 | - foreach($array as $item) { |
|
187 | - if(!isset($item[$attribute])) { |
|
186 | + foreach ($array as $item) { |
|
187 | + if (!isset($item[$attribute])) { |
|
188 | 188 | continue; |
189 | 189 | } |
190 | 190 |
@@ -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 |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | $prophet->get('volume')->willReturn($volume); |
36 | 36 | |
37 | 37 | // spy |
38 | - $prophet->set('mIwoC', $mIwoC)->will(function () use ($prophet) { |
|
38 | + $prophet->set('mIwoC', $mIwoC)->will(function() use ($prophet) { |
|
39 | 39 | return $prophet->reveal(); |
40 | 40 | })->shouldBeCalled(); |
41 | - $prophet->set('mi', $mi)->will(function () use ($prophet) { |
|
41 | + $prophet->set('mi', $mi)->will(function() use ($prophet) { |
|
42 | 42 | return $prophet->reveal(); |
43 | 43 | })->shouldBeCalled(); |
44 | - $prophet->set('commentWeight', $weight)->will(function () use ($prophet) { |
|
44 | + $prophet->set('commentWeight', $weight)->will(function() use ($prophet) { |
|
45 | 45 | return $prophet->reveal(); |
46 | 46 | })->shouldBeCalled(); |
47 | 47 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | { |
72 | 72 | return [ |
73 | 73 | // CC LLOC CLOC Volume MIwoC mi commentWeight |
74 | - [5 , 50 , 20 , 10 , 55.26, 92.1, 36.83 ], |
|
75 | - [11 , 45 , 26 , 1777.49 , 39.7, 80.01, 40.3 ] |
|
74 | + [5, 50, 20, 10, 55.26, 92.1, 36.83], |
|
75 | + [11, 45, 26, 1777.49, 39.7, 80.01, 40.3] |
|
76 | 76 | ]; |
77 | 77 | } |
78 | 78 | } |
@@ -63,10 +63,10 @@ |
||
63 | 63 | public function provideExamples() |
64 | 64 | { |
65 | 65 | return [ |
66 | - [ __DIR__ . '/../../examples/halstead1.php', 'twice', 2, 3, 1.5], |
|
67 | - [ __DIR__ . '/../../examples/halstead2.php', 'maxi', 4, 6, 4.5], |
|
68 | - [ __DIR__ . '/../../examples/halstead3.php', 'f_switch', 3, 9, 1.29], |
|
69 | - [ __DIR__ . '/../../examples/halstead4.php', 'f_while', 9, 13, 10.4], |
|
66 | + [__DIR__.'/../../examples/halstead1.php', 'twice', 2, 3, 1.5], |
|
67 | + [__DIR__.'/../../examples/halstead2.php', 'maxi', 4, 6, 4.5], |
|
68 | + [__DIR__.'/../../examples/halstead3.php', 'f_switch', 3, 9, 1.29], |
|
69 | + [__DIR__.'/../../examples/halstead4.php', 'f_while', 9, 13, 10.4], |
|
70 | 70 | ]; |
71 | 71 | } |
72 | 72 | } |