@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | // sums |
62 | - $sum = (object)[ |
|
62 | + $sum = (object) [ |
|
63 | 63 | 'loc' => 0, |
64 | 64 | 'cloc' => 0, |
65 | 65 | 'lloc' => 0, |
66 | 66 | 'nbMethods' => 0, |
67 | 67 | ]; |
68 | - $avg = (object)[ |
|
68 | + $avg = (object) [ |
|
69 | 69 | 'wmc' => [], |
70 | 70 | 'ccn' => [], |
71 | 71 | 'bugs' => [], |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | 'error' => 0, |
137 | 137 | 'critical' => 0, |
138 | 138 | ]; |
139 | - $violationCounter = static function (array $elementViolations) use (&$violations): void { |
|
140 | - array_map(static function (Violation $violation) use (&$violations): void { |
|
139 | + $violationCounter = static function(array $elementViolations) use (&$violations): void { |
|
140 | + array_map(static function(Violation $violation) use (&$violations): void { |
|
141 | 141 | $violations['total']++; |
142 | 142 | $name = [ |
143 | 143 | Violation::INFO => 'information', |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $violationHandler = $element['violations']; |
155 | 155 | $violationCounter($violationHandler->getAll()); |
156 | 156 | } |
157 | - $sum->violations = (object)$violations; |
|
157 | + $sum->violations = (object) $violations; |
|
158 | 158 | |
159 | 159 | $this->avg = $avg; |
160 | 160 | $this->sum = $sum; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** @var string $name */ |
65 | 65 | $name = $metric->get('name'); |
66 | 66 | $node->setAttribute('name', $name); |
67 | - array_map(function (Violation $violation) use ($node): void { |
|
67 | + array_map(function(Violation $violation) use ($node): void { |
|
68 | 68 | $node->appendChild($this->createXmlViolationItem($violation)); |
69 | 69 | }, $violations); |
70 | 70 | $root->appendChild($node); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $item->setAttribute('rule', $violationName); |
97 | 97 | $item->setAttribute('ruleset', $violationName); |
98 | 98 | $item->setAttribute('externalInfoUrl', 'https://www.phpmetrics.org'); |
99 | - $item->setAttribute('priority', (string)(4 - $violation->getLevel())); // Priority = reversed level. |
|
99 | + $item->setAttribute('priority', (string) (4 - $violation->getLevel())); // Priority = reversed level. |
|
100 | 100 | $item->nodeValue = $violation->getDescription(); |
101 | 101 | |
102 | 102 | return $item; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | private readonly ReaderInterface $fileReader, |
59 | 59 | private readonly ViewHelper $viewHelper |
60 | 60 | ) { |
61 | - $this->templateDir = dirname(__DIR__, 4) . '/templates/html_report/'; |
|
61 | + $this->templateDir = dirname(__DIR__, 4).'/templates/html_report/'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if (null === $logDir) { |
74 | 74 | return; |
75 | 75 | } |
76 | - $logDir = rtrim($logDir, '/') . '/'; |
|
76 | + $logDir = rtrim($logDir, '/').'/'; |
|
77 | 77 | $this->fileWriter->ensureDirectoryExists($logDir); |
78 | 78 | if (!$this->fileWriter->isWritable($logDir)) { |
79 | 79 | throw new RuntimeException(sprintf('Unable to write in the directory "%s"', $logDir)); |
@@ -91,35 +91,35 @@ discard block |
||
91 | 91 | $consolidated = new Consolidated($metrics); |
92 | 92 | |
93 | 93 | // history of builds |
94 | - $today = (object)[ |
|
94 | + $today = (object) [ |
|
95 | 95 | 'avg' => $consolidated->getAvg(), |
96 | 96 | 'sum' => $consolidated->getSum() |
97 | 97 | ]; |
98 | 98 | /** @var array<string> $files */ |
99 | - $files = $this->fileReader->glob($logDir . 'js/history-*.json'); |
|
99 | + $files = $this->fileReader->glob($logDir.'js/history-*.json'); |
|
100 | 100 | natsort($files); |
101 | 101 | /** @var array<stdClass> $history */ |
102 | 102 | $history = array_map($this->fileReader->readJson(...), array_values($files)); |
103 | 103 | |
104 | 104 | // copy sources |
105 | - $this->fileWriter->copy($this->templateDir . 'favicon.ico', $logDir . 'favicon.ico'); |
|
106 | - $this->fileWriter->recursiveCopy($this->templateDir . 'js', $logDir . 'js'); |
|
107 | - $this->fileWriter->recursiveCopy($this->templateDir . 'css', $logDir . 'css'); |
|
108 | - $this->fileWriter->recursiveCopy($this->templateDir . 'images', $logDir . 'images'); |
|
109 | - $this->fileWriter->recursiveCopy($this->templateDir . 'fonts', $logDir . 'fonts'); |
|
105 | + $this->fileWriter->copy($this->templateDir.'favicon.ico', $logDir.'favicon.ico'); |
|
106 | + $this->fileWriter->recursiveCopy($this->templateDir.'js', $logDir.'js'); |
|
107 | + $this->fileWriter->recursiveCopy($this->templateDir.'css', $logDir.'css'); |
|
108 | + $this->fileWriter->recursiveCopy($this->templateDir.'images', $logDir.'images'); |
|
109 | + $this->fileWriter->recursiveCopy($this->templateDir.'fonts', $logDir.'fonts'); |
|
110 | 110 | // render dynamic pages |
111 | 111 | $this->renderHtmlPages($logDir, $consolidated, $history); |
112 | 112 | |
113 | 113 | // js data |
114 | - $this->fileWriter->writePrettyJson($logDir . sprintf('js/history-%d.json', count($files) + 1), $today); |
|
115 | - $this->fileWriter->writePrettyJson($logDir . 'js/latest.json', $today); |
|
114 | + $this->fileWriter->writePrettyJson($logDir.sprintf('js/history-%d.json', count($files) + 1), $today); |
|
115 | + $this->fileWriter->writePrettyJson($logDir.'js/latest.json', $today); |
|
116 | 116 | |
117 | 117 | // consolidated by groups |
118 | 118 | foreach ($consolidatedGroups as $name => $consolidatedGroup) { |
119 | 119 | $this->currentGroup = $name; |
120 | 120 | $this->assetPath = '../'; |
121 | 121 | |
122 | - $this->renderHtmlPages($logDir . $name . '/', $consolidatedGroup, $history); |
|
122 | + $this->renderHtmlPages($logDir.$name.'/', $consolidatedGroup, $history); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | $this->output->writeln(sprintf('HTML report generated in "%s" directory', $logDir)); |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | ); |
162 | 162 | |
163 | 163 | $this->fileWriter->write( |
164 | - $destination . 'classes.js', |
|
165 | - 'var classes = ' . json_encode($consolidated->getClasses(), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT) |
|
164 | + $destination.'classes.js', |
|
165 | + 'var classes = '.json_encode($consolidated->getClasses(), JSON_THROW_ON_ERROR|JSON_PRETTY_PRINT) |
|
166 | 166 | ); |
167 | 167 | } |
168 | 168 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | throw new RuntimeException(sprintf('Unable to write in the directory "%s"', dirname($destination))); |
180 | 180 | } |
181 | 181 | |
182 | - $this->sharedMetrics = (object)[ |
|
182 | + $this->sharedMetrics = (object) [ |
|
183 | 183 | 'sum' => $consolidated->getSum(), |
184 | 184 | 'avg' => $consolidated->getAvg(), |
185 | 185 | 'classes' => $consolidated->getClasses(), |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $oldValue, |
243 | 243 | $trendNames[$trendIndex], |
244 | 244 | $trendCodes[$trendIndex], |
245 | - ($diff > 0) ? '+' . round($diff, 3) : round($diff, 3), |
|
245 | + ($diff > 0) ? '+'.round($diff, 3) : round($diff, 3), |
|
246 | 246 | $svg[$trendCodes[$trendIndex]] |
247 | 247 | ); |
248 | 248 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | */ |
61 | 61 | private function generateRowData(ClassMetric $metric): array |
62 | 62 | { |
63 | - return array_map(static function (string $key) use ($metric): string|int|bool|float { |
|
63 | + return array_map(static function(string $key) use ($metric): string|int|bool|float { |
|
64 | 64 | $value = $metric->get($key); |
65 | 65 | return is_scalar($value) ? $value : 'N/A'; |
66 | 66 | }, Registry::allForStructures()); |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $title = sprintf('<%s>Found %d occurrences for search "%s"</%s>', $tag, $nbFound, $searchName, $tag); |
63 | 63 | $this->output->writeln($title); |
64 | 64 | |
65 | - array_map(function (Metric $metric): void { |
|
65 | + array_map(function(Metric $metric): void { |
|
66 | 66 | $this->output->writeln(sprintf('- %s', $metric->getName())); |
67 | 67 | }, array_splice($metricsListInViolation, 0, 5)); |
68 | 68 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | public function writeln(string $message): void |
18 | 18 | { |
19 | - $this->write(PHP_EOL . $message); |
|
19 | + $this->write(PHP_EOL.$message); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | public function addEdge(Node $from, Node $to): void |
16 | 16 | { |
17 | - $key = $from->getUniqueId() . '➔' . $to->getUniqueId(); |
|
17 | + $key = $from->getUniqueId().'➔'.$to->getUniqueId(); |
|
18 | 18 | |
19 | 19 | if (isset($this->edgesMap[$key])) { |
20 | 20 | return; |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | { |
32 | 32 | $pregExcludedDirs = '.+'; |
33 | 33 | if ([] !== $excludedDirs) { |
34 | - $pregExcludedDirs = '((?!' . implode('|', array_map(preg_quote(...), $excludedDirs)) . ').)+'; |
|
34 | + $pregExcludedDirs = '((?!'.implode('|', array_map(preg_quote(...), $excludedDirs)).').)+'; |
|
35 | 35 | } |
36 | - $pregExtensions = '\.(' . implode('|', $extensions) . ')'; |
|
36 | + $pregExtensions = '\.('.implode('|', $extensions).')'; |
|
37 | 37 | |
38 | 38 | // Regular expression that needs to be filled with a path to filter all files. |
39 | - $this->pathFilterRegex = '`^%s' . $pregExcludedDirs . $pregExtensions . '$`'; |
|
39 | + $this->pathFilterRegex = '`^%s'.$pregExcludedDirs.$pregExtensions.'$`'; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if (is_file($path)) { |
50 | 50 | $files[] = $path; |
51 | 51 | } elseif (is_dir($path)) { |
52 | - $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
52 | + $path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
53 | 53 | |
54 | 54 | // Each iteration produces an array of a single file matching the regular expression set in constructor. |
55 | 55 | /** @var RegexIterator<array{string}> $filteredIterator */ |
@@ -70,7 +70,7 @@ |
||
70 | 70 | } |
71 | 71 | $content = file_get_contents($uri, context: stream_context_create(['http' => $httpOptions])); |
72 | 72 | if (false === $content) { |
73 | - return (object)[]; |
|
73 | + return (object) []; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /* @TODO: Remove @noinspection once https://github.com/kalessil/phpinspectionsea/issues/1725 fixed. */ |