Completed
Pull Request — master (#504)
by
unknown
30s
created
src/Hal/Metric/Package/PackageAbstraction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function calculate(): void
25 25
     {
26
-        array_map(function (PackageMetric $package): void {
26
+        array_map(function(PackageMetric $package): void {
27 27
             $classesInPackage = $package->getClasses();
28 28
             if ([] === $classesInPackage) {
29 29
                 return;
@@ -41,6 +41,6 @@  discard block
 block discarded – undo
41 41
      */
42 42
     private function isAbstract(string $classname): bool
43 43
     {
44
-        return (bool)$this->metrics->get($classname)?->get('abstract');
44
+        return (bool) $this->metrics->get($classname)?->get('abstract');
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
src/Hal/Metric/Consolidated.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Hal/Report/Violations/Xml/Reporter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Hal/Report/Html/Reporter.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Hal/Report/Csv/Reporter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
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());
Please login to merge, or discard this patch.
src/Hal/Report/Cli/SearchReporter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Hal/Component/Output/CliOutput.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Hal/Component/Tree/GraphDeduplicated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Hal/Component/File/Finder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 */
Please login to merge, or discard this patch.