Passed
Push — master ( 640c38...669df3 )
by Christian
04:59
created
src/Report/HtmlReportGenerator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $this->reportDir = $reportDir;
31 31
         $this->sourceDir = $sourceDir;
32
-        $this->templateDir = __DIR__.'/Html/Template';
32
+        $this->templateDir = __DIR__ . '/Html/Template';
33 33
     }
34 34
 
35 35
     public function generate(AnalyzerResult $result): void
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
     private function copySkeleton(): void
50 50
     {
51 51
         $this->createDirectory($this->reportDir);
52
-        $this->copyDirectoryFiles($this->templateDir.DIRECTORY_SEPARATOR.'css', $this->reportDir.DIRECTORY_SEPARATOR.'css');
53
-        $this->copyDirectoryFiles($this->templateDir.DIRECTORY_SEPARATOR.'icons', $this->reportDir.DIRECTORY_SEPARATOR.'icons');
54
-        $this->copyDirectoryFiles($this->templateDir.DIRECTORY_SEPARATOR.'img', $this->reportDir.DIRECTORY_SEPARATOR.'img');
52
+        $this->copyDirectoryFiles($this->templateDir . DIRECTORY_SEPARATOR . 'css', $this->reportDir . DIRECTORY_SEPARATOR . 'css');
53
+        $this->copyDirectoryFiles($this->templateDir . DIRECTORY_SEPARATOR . 'icons', $this->reportDir . DIRECTORY_SEPARATOR . 'icons');
54
+        $this->copyDirectoryFiles($this->templateDir . DIRECTORY_SEPARATOR . 'img', $this->reportDir . DIRECTORY_SEPARATOR . 'img');
55 55
     }
56 56
 
57 57
     private function copyDirectoryFiles(string $templateDir, string $reportDir): void
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $this->createDirectory($reportDir);
60 60
         $handle = opendir($templateDir);
61 61
         if (!$handle) {
62
-            throw new HtmlReportException('Could not read template files from '.$templateDir);
62
+            throw new HtmlReportException('Could not read template files from ' . $templateDir);
63 63
         }
64 64
 
65 65
         while ($file = readdir($handle)) {
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
                 continue;
68 68
             }
69 69
 
70
-            $templateFile = $templateDir.DIRECTORY_SEPARATOR.$file;
71
-            $reportFile = $reportDir.DIRECTORY_SEPARATOR.$file;
70
+            $templateFile = $templateDir . DIRECTORY_SEPARATOR . $file;
71
+            $reportFile = $reportDir . DIRECTORY_SEPARATOR . $file;
72 72
 
73 73
             if (is_dir($templateFile)) {
74 74
                 $this->copyDirectoryFiles($templateFile, $reportFile);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             }
77 77
 
78 78
             if ([email protected]($templateFile, $reportFile)) {
79
-                throw new HtmlReportException('Could not copy '.$templateFile.' to '.$reportFile);
79
+                throw new HtmlReportException('Could not copy ' . $templateFile . ' to ' . $reportFile);
80 80
             }
81 81
         }
82 82
         closedir($handle);
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
     {
87 87
         if (!is_dir($dir)) {
88 88
             if ([email protected]($dir, 0777, true)) {
89
-                throw new HtmlReportException('Could not create directory '.$dir);
89
+                throw new HtmlReportException('Could not create directory ' . $dir);
90 90
             }
91 91
         } elseif (!is_writable($dir)) {
92
-            throw new HtmlReportException('Directory '.$dir.' has to be writable');
92
+            throw new HtmlReportException('Directory ' . $dir . ' has to be writable');
93 93
         }
94 94
     }
95 95
 }
Please login to merge, or discard this patch.
src/Report/Html/Renderer/FileRenderer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $sourceCode = $this->formatSourceCode($fileResult);
56 56
         $relativeFilePath = PathNormalizer::makeRelativeTo($fileResult->getFile(), $this->sourceDir);
57 57
         $this->fileTemplate->setVar([
58
-            'path_to_root' => './'.str_repeat('../', substr_count($relativeFilePath, '/')),
58
+            'path_to_root' => './' . str_repeat('../', substr_count($relativeFilePath, '/')),
59 59
             'full_path' => $fileResult->getFile(),
60 60
             'breadcrumb' => $this->renderBreadcrumb($relativeFilePath),
61 61
             'tombstones_list' => $tombstonesList,
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             'version' => Application::VERSION,
65 65
         ]);
66 66
 
67
-        $reportFile = $this->reportDir.DIRECTORY_SEPARATOR.$relativeFilePath.'.html';
67
+        $reportFile = $this->reportDir . DIRECTORY_SEPARATOR . $relativeFilePath . '.html';
68 68
         $reportDir = dirname($reportFile);
69 69
         if (!is_dir($reportDir)) {
70 70
             mkdir($reportDir, 0777, true);
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
     {
140 140
         $parts = explode('/', $relativeFilePath);
141 141
         $numParts = count($parts);
142
-        $breadcrumbString = '<li class="breadcrumb-item"><a href="./'.str_repeat('../', $numParts - 1).'index.html">'.$this->sourceDir.'</a></li> ';
142
+        $breadcrumbString = '<li class="breadcrumb-item"><a href="./' . str_repeat('../', $numParts - 1) . 'index.html">' . $this->sourceDir . '</a></li> ';
143 143
 
144 144
         $folderUp = $numParts - 2;
145 145
         while ($label = array_shift($parts)) {
146 146
             if (!$parts) {
147
-                $breadcrumbString .= '<li class="breadcrumb-item active">'.$label.'</li> ';
147
+                $breadcrumbString .= '<li class="breadcrumb-item active">' . $label . '</li> ';
148 148
             } else {
149
-                $link = './'.str_repeat('../', $folderUp).'index.html';
149
+                $link = './' . str_repeat('../', $folderUp) . 'index.html';
150 150
                 $breadcrumbString .= sprintf('<li class="breadcrumb-item"><a href="%s">%s</a></li> ', $link, $label);
151 151
             }
152 152
             --$folderUp;
Please login to merge, or discard this patch.
src/Report/Html/Renderer/DirectoryRenderer.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
     private function renderDirectory(ResultDirectory $directory): void
70 70
     {
71 71
         $directoryPath = $directory->getPath();
72
-        $pathToRoot = './'.str_repeat('../', substr_count($directoryPath, '/') + ($directoryPath ? 1 : 0));
72
+        $pathToRoot = './' . str_repeat('../', substr_count($directoryPath, '/') + ($directoryPath ? 1 : 0));
73 73
         $filesList = '';
74 74
         foreach ($directory->getDirectories() as $subDir) {
75 75
             $name = $subDir->getName();
76
-            $link = './'.$subDir->getName().'/index.html';
76
+            $link = './' . $subDir->getName() . '/index.html';
77 77
             $filesList .= $this->renderDirectoryItem($name, $link, $subDir, $pathToRoot);
78 78
         }
79 79
         foreach ($directory->getFiles() as $fileResult) {
80 80
             $name = basename($fileResult->getFile());
81
-            $link = './'.$name.'.html';
81
+            $link = './' . $name . '.html';
82 82
             $filesList .= $this->renderDirectoryItem($name, $link, $fileResult, $pathToRoot);
83 83
         }
84 84
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             'version' => Application::VERSION,
92 92
         ]);
93 93
 
94
-        $reportFile = $this->reportDir.DIRECTORY_SEPARATOR.$directoryPath.'/index.html';
94
+        $reportFile = $this->reportDir . DIRECTORY_SEPARATOR . $directoryPath . '/index.html';
95 95
         $reportDir = dirname($reportFile);
96 96
         if (!is_dir($reportDir)) {
97 97
             mkdir($reportDir, 0777, true);
@@ -152,19 +152,19 @@  discard block
 block discarded – undo
152 152
     private function renderBreadcrumb(string $directoryPath): string
153 153
     {
154 154
         if (!$directoryPath) {
155
-            return '<li class="breadcrumb-item">'.$this->sourceDir.'</li> ';
155
+            return '<li class="breadcrumb-item">' . $this->sourceDir . '</li> ';
156 156
         }
157 157
 
158 158
         $parts = explode('/', $directoryPath);
159 159
         $numParts = count($parts);
160
-        $breadcrumbString = '<li class="breadcrumb-item"><a href="./'.str_repeat('../', $numParts).'index.html">'.$this->sourceDir.'</a></li> ';
160
+        $breadcrumbString = '<li class="breadcrumb-item"><a href="./' . str_repeat('../', $numParts) . 'index.html">' . $this->sourceDir . '</a></li> ';
161 161
 
162 162
         $folderUp = $numParts - 1;
163 163
         while ($label = array_shift($parts)) {
164 164
             if (!$parts) {
165
-                $breadcrumbString .= '<li class="breadcrumb-item active">'.$label.'</li> ';
165
+                $breadcrumbString .= '<li class="breadcrumb-item active">' . $label . '</li> ';
166 166
             } else {
167
-                $link = './'.str_repeat('../', $folderUp).'index.html';
167
+                $link = './' . str_repeat('../', $folderUp) . 'index.html';
168 168
                 $breadcrumbString .= sprintf('<li class="breadcrumb-item"><a href="%s">%s</a></li> ', $link, $label);
169 169
             }
170 170
             --$folderUp;
Please login to merge, or discard this patch.