Completed
Push — chore/php-8-migration ( 09d054...95d009 )
by Vladimir
05:18
created
tests/StakxTestCase.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     // Mock Objects
226 226
     //
227 227
 
228
-    protected function getMockAssetEngineManager(): MockBuilder|AssetEngineManager
228
+    protected function getMockAssetEngineManager(): MockBuilder | AssetEngineManager
229 229
     {
230 230
         return new AssetEngineManager();
231 231
     }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         return new AssetManager($this->getMockEventDispatcher(), $this->getMockLogger());
236 236
     }
237 237
 
238
-    protected function getMockConfiguration(): MockObject|Configuration
238
+    protected function getMockConfiguration(): MockObject | Configuration
239 239
     {
240 240
         $stub = $this->getMockBuilder(Configuration::class)
241 241
             ->disableOriginalConstructor()
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         return $stub;
249 249
     }
250 250
 
251
-    protected function getMockPageManager(): PageManager|MockObject
251
+    protected function getMockPageManager(): PageManager | MockObject
252 252
     {
253 253
         $stub = $this->getMockBuilder(PageManager::class)
254 254
             ->disableOriginalConstructor()
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         return $stub;
261 261
     }
262 262
 
263
-    protected function getMockMenuManager(): MockObject|MenuManager
263
+    protected function getMockMenuManager(): MockObject | MenuManager
264 264
     {
265 265
         $stub = $this->getMockBuilder(MenuManager::class)
266 266
             ->disableOriginalConstructor()
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         return $stub;
273 273
     }
274 274
 
275
-    protected function getMockCollectionManager(): MockObject|CollectionManager
275
+    protected function getMockCollectionManager(): MockObject | CollectionManager
276 276
     {
277 277
         $stub = $this->getMockBuilder(CollectionManager::class)
278 278
             ->disableOriginalConstructor()
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         return $stub;
285 285
     }
286 286
 
287
-    protected function getMockDataManager(): MockObject|DataManager
287
+    protected function getMockDataManager(): MockObject | DataManager
288 288
     {
289 289
         $stub = $this->getMockBuilder(DataManager::class)
290 290
             ->disableOriginalConstructor()
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         return $markupEngine;
328 328
     }
329 329
 
330
-    protected function getMockRedirectMapper(): RedirectMapper|MockObject
330
+    protected function getMockRedirectMapper(): RedirectMapper | MockObject
331 331
     {
332 332
         $stub = $this->getMockBuilder(RedirectMapper::class)
333 333
             ->getMock()
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     /**
342 342
      * Get a mock EventDispatcher.
343 343
      */
344
-    protected function getMockEventDispatcher(): MockObject|EventDispatcherInterface
344
+    protected function getMockEventDispatcher(): MockObject | EventDispatcherInterface
345 345
     {
346 346
         return $this->getMockBuilder(EventDispatcherInterface::class)->getMock();
347 347
     }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     /**
350 350
      * Get a mock logger.
351 351
      */
352
-    protected function getMockLogger(): MockObject|LoggerInterface
352
+    protected function getMockLogger(): MockObject | LoggerInterface
353 353
     {
354 354
         return $this->getMockBuilder(LoggerInterface::class)->getMock();
355 355
     }
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -72,7 +72,8 @@  discard block
 block discarded – undo
72 72
 
73 73
     public function tearDown(): void
74 74
     {
75
-        if ($this->assetFolder !== null) {
75
+        if ($this->assetFolder !== null)
76
+        {
76 77
             fs::remove($this->assetFolder);
77 78
         }
78 79
     }
@@ -167,7 +168,8 @@  discard block
 block discarded – undo
167 168
     {
168 169
         $body = $this->buildFrontMatterTemplate($frontMatter, $content);
169 170
 
170
-        if (!$filename) {
171
+        if (!$filename)
172
+        {
171 173
             $filename = hash('sha256', (string)random_int(0, mt_getrandmax()));
172 174
         }
173 175
 
@@ -194,7 +196,8 @@  discard block
 block discarded – undo
194 196
     {
195 197
         $results = [];
196 198
 
197
-        foreach ($elements as $element) {
199
+        foreach ($elements as $element)
200
+        {
198 201
             $filename = $element['filename'] ?? null;
199 202
             $frontMatter = (!isset($element['frontmatter']) || empty($element['frontmatter'])) ? [] : $element['frontmatter'];
200 203
             $body = $element['body'] ?? 'Body Text';
@@ -405,7 +408,8 @@  discard block
 block discarded – undo
405 408
             ->value()
406 409
         ;
407 410
 
408
-        if ($fxnToCall === null) {
411
+        if ($fxnToCall === null)
412
+        {
409 413
             throw new BadFunctionCallException(sprintf('No function by the name of "%s" in this class', $method));
410 414
         }
411 415
 
@@ -413,10 +417,14 @@  discard block
 block discarded – undo
413 417
         $callUserFuncArray = [];
414 418
 
415 419
         /** @var ReflectionParameter $argument */
416
-        foreach ($arguments as $argument) {
417
-            if (isset($namedParams[$argument->getName()])) {
420
+        foreach ($arguments as $argument)
421
+        {
422
+            if (isset($namedParams[$argument->getName()]))
423
+            {
418 424
                 $callUserFuncArray[] = $namedParams[$argument->getName()];
419
-            } else {
425
+            }
426
+            else
427
+            {
420 428
                 $callUserFuncArray[] = $argument->getDefaultValue();
421 429
             }
422 430
         }
Please login to merge, or discard this patch.
src/AssetEngine/Sass/SassEngine.php 1 patch
Braces   +22 added lines, -10 removed lines patch added patch discarded remove patch
@@ -84,7 +84,8 @@  discard block
 block discarded – undo
84 84
         $this->handleThemeImports($content);
85 85
 
86 86
         // We don't need to write the source map to a file
87
-        if (!$this->fileSourceMap) {
87
+        if (!$this->fileSourceMap)
88
+        {
88 89
             $this->compiler->setSourceMapOptions($sourceMapOptions);
89 90
 
90 91
             return $this->compiler->compile($content);
@@ -138,13 +139,16 @@  discard block
 block discarded – undo
138 139
 
139 140
     public static function stringToFormatter($format)
140 141
     {
141
-        if ($format === 'nested') {
142
+        if ($format === 'nested')
143
+        {
142 144
             return Nested::class;
143 145
         }
144
-        if ($format === 'expanded') {
146
+        if ($format === 'expanded')
147
+        {
145 148
             return Expanded::class;
146 149
         }
147
-        if ($format === 'compact') {
150
+        if ($format === 'compact')
151
+        {
148 152
             return Compact::class;
149 153
         }
150 154
 
@@ -167,12 +171,17 @@  discard block
 block discarded – undo
167 171
     {
168 172
         $sourceMap = __::get($this->options, 'sourcemap');
169 173
 
170
-        if ($sourceMap === 'inline') {
174
+        if ($sourceMap === 'inline')
175
+        {
171 176
             $this->compiler->setSourceMap(Compiler::SOURCE_MAP_INLINE);
172
-        } elseif ($sourceMap === true) {
177
+        }
178
+        elseif ($sourceMap === true)
179
+        {
173 180
             $this->compiler->setSourceMap(Compiler::SOURCE_MAP_FILE);
174 181
             $this->fileSourceMap = true;
175
-        } else {
182
+        }
183
+        else
184
+        {
176 185
             $this->compiler->setSourceMap(Compiler::SOURCE_MAP_NONE);
177 186
         }
178 187
     }
@@ -187,14 +196,16 @@  discard block
 block discarded – undo
187 196
 
188 197
     private function initializeCompiler(): void
189 198
     {
190
-        if ($this->compiler) {
199
+        if ($this->compiler)
200
+        {
191 201
             return;
192 202
         }
193 203
 
194 204
         $cacheOptions = [];
195 205
 
196 206
         // If we have a cache directory set, use it.
197
-        if ($this->cacheDirectory) {
207
+        if ($this->cacheDirectory)
208
+        {
198 209
             $cacheOptions = [
199 210
                 'cacheDir' => (string)$this->cacheDirectory->getFilesystemPath(),
200 211
                 'forceRefresh' => false,
@@ -210,7 +221,8 @@  discard block
 block discarded – undo
210 221
 
211 222
     private function handleThemeImports(&$content): void
212 223
     {
213
-        if ($themeName = $this->configuration->getTheme()) {
224
+        if ($themeName = $this->configuration->getTheme())
225
+        {
214 226
             $themePath = "../_themes/{$themeName}/_sass";
215 227
             $content = preg_replace("/(@import ['\"])(@theme)(.+)/", "$1{$themePath}$3", $content);
216 228
         }
Please login to merge, or discard this patch.
src/Server/RouteMapper.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,11 +46,13 @@
 block discarded – undo
46 46
      */
47 47
     public function registerPageView(BasePageView $pageView): void
48 48
     {
49
-        switch ($pageView->getType()) {
49
+        switch ($pageView->getType())
50
+        {
50 51
             case BasePageView::STATIC_TYPE:
51 52
                 $this->mapping[$pageView->getPermalink()] = $pageView;
52 53
 
53
-                foreach ($pageView->getRedirects() as $redirect) {
54
+                foreach ($pageView->getRedirects() as $redirect)
55
+                {
54 56
                     $this->redirects[$redirect] = $pageView->getPermalink();
55 57
                 }
56 58
 
Please login to merge, or discard this patch.
src/Server/ExceptionRenderer.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@
 block discarded – undo
20 20
         $source = fs::getInternalResource('error.html.twig');
21 21
         $template = $compiler->getTemplateBridge()->createTemplate($source);
22 22
 
23
-        if ($exception instanceof TemplateErrorInterface) {
23
+        if ($exception instanceof TemplateErrorInterface)
24
+        {
24 25
             $message = [
25 26
                 sprintf('File: %s:%d', $exception->getRelativeFilePath(), $exception->getTemplateLine()),
26 27
             ];
Please login to merge, or discard this patch.
src/Server/WebServer.php 1 patch
Braces   +25 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,29 +51,36 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $routes = Controller::create($routeMapper, $compiler);
53 53
 
54
-        return new Server(function (ServerRequestInterface $request) use ($routes, $compiler, $assetManager) {
54
+        return new Server(function (ServerRequestInterface $request) use ($routes, $compiler, $assetManager)
55
+        {
55 56
             $httpMethod = $request->getMethod();
56 57
             $urlPath = Controller::normalizeUrl($request->getUri()->getPath());
57 58
 
58 59
             // We're a static website, we should never support anything other than GET requests
59
-            if ($httpMethod !== 'GET') {
60
+            if ($httpMethod !== 'GET')
61
+            {
60 62
                 return new Response(406, ['Content-Type' => 'text/plain'], 'Method not allowed');
61 63
             }
62 64
 
63 65
             $context = new RequestContext($urlPath);
64 66
             $matcher = new UrlMatcher($routes, $context);
65 67
 
66
-            try {
68
+            try
69
+            {
67 70
                 $parameters = $matcher->match($urlPath);
68 71
 
69
-                if (isset($parameters['_controller'])) {
72
+                if (isset($parameters['_controller']))
73
+                {
70 74
                     $controller = $parameters['_controller'];
71 75
 
72 76
                     return $controller($request, ...array_values($parameters));
73 77
                 }
74
-            } catch (ResourceNotFoundException $e) {
78
+            }
79
+            catch (ResourceNotFoundException $e)
80
+            {
75 81
                 // If we have a "manual" asset, let's serve from it
76
-                if (($file = $assetManager->getExplicitAsset(self::normalizePath($urlPath))) !== null) {
82
+                if (($file = $assetManager->getExplicitAsset(self::normalizePath($urlPath))) !== null)
83
+                {
77 84
                     return self::makeResponse($file);
78 85
                 }
79 86
 
@@ -82,10 +89,13 @@  discard block
 block discarded – undo
82 89
                 // reason, we manually look through the filesystem and load from there.
83 90
                 //
84 91
                 // @TODO this should be fixed to make the AssetManager the authority on assets.
85
-                if (($asset = self::searchAsset($urlPath)) !== null) {
92
+                if (($asset = self::searchAsset($urlPath)) !== null)
93
+                {
86 94
                     return $asset;
87 95
                 }
88
-            } catch (Exception $e) {
96
+            }
97
+            catch (Exception $e)
98
+            {
89 99
                 $response = ExceptionRenderer::render($e, $compiler);
90 100
 
91 101
                 return new Response(500, ['Content-Type' => 'text/html'], $response);
@@ -103,12 +113,16 @@  discard block
 block discarded – undo
103 113
      */
104 114
     private static function searchAsset($url, $continueNesting = true): ?Response
105 115
     {
106
-        try {
116
+        try
117
+        {
107 118
             $file = new File(self::normalizePath($url));
108 119
 
109 120
             return self::makeResponse($file);
110
-        } catch (FileNotFoundException) {
111
-            if (!$continueNesting) {
121
+        }
122
+        catch (FileNotFoundException)
123
+        {
124
+            if (!$continueNesting)
125
+            {
112 126
                 // This will evaluate to true if we've searched inside the themes folder and it still doesn't exist
113 127
                 return null;
114 128
             }
Please login to merge, or discard this patch.
src/Server/Controller.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@
 block discarded – undo
183 183
     /**
184 184
      * Return the appropriate action based on a PageView's type.
185 185
      */
186
-    private function createAction(BasePageView|DynamicPageView|RepeaterPageView|StaticPageView $pageView, Compiler $compiler): Closure
186
+    private function createAction(BasePageView | DynamicPageView | RepeaterPageView | StaticPageView $pageView, Compiler $compiler): Closure
187 187
     {
188 188
         return match ($pageView->getType()) {
189 189
             BasePageView::STATIC_TYPE => $this->staticPageViewAction($pageView, $compiler),
Please login to merge, or discard this patch.
Braces   +36 added lines, -18 removed lines patch added patch discarded remove patch
@@ -51,7 +51,8 @@  discard block
 block discarded – undo
51 51
          * @var string $from
52 52
          * @var string $to
53 53
          */
54
-        foreach ($routeMapper->getRedirectMapping() as $from => $to) {
54
+        foreach ($routeMapper->getRedirectMapping() as $from => $to)
55
+        {
55 56
             $routeName = preg_replace('/[\/\.]/', '_', $from);
56 57
             $routeName = 'redirect_' . $routeName;
57 58
 
@@ -64,7 +65,8 @@  discard block
 block discarded – undo
64 65
          * @var string       $routeUrl
65 66
          * @var BasePageView $pageView
66 67
          */
67
-        foreach ($routeMapper->getRouteMapping() as $routeUrl => $pageView) {
68
+        foreach ($routeMapper->getRouteMapping() as $routeUrl => $pageView)
69
+        {
68 70
             $routeName = $pageView->getRelativeFilePath();
69 71
             $routeName = preg_replace('/[\/\.]/', '_', $routeName);
70 72
 
@@ -75,7 +77,8 @@  discard block
 block discarded – undo
75 77
             // Allow the last route parameter to have `/` in the permalink that's not part of the route itself
76 78
             //   see https://github.com/stakx-io/stakx/issues/98
77 79
             $requirements = [];
78
-            if (count($results) >= 2) {
80
+            if (count($results) >= 2)
81
+            {
79 82
                 $requirements[$results[1]] = '.*';
80 83
             }
81 84
 
@@ -109,12 +112,14 @@  discard block
 block discarded – undo
109 112
      */
110 113
     private function staticPageViewAction(StaticPageView $pageView, Compiler $compiler): Closure
111 114
     {
112
-        return function () use ($pageView, $compiler) {
115
+        return function () use ($pageView, $compiler)
116
+        {
113 117
             Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath());
114 118
 
115 119
             $compiler->getTemplateBridge()->clearTemplateCache();
116 120
 
117
-            if ($this->hasBeenTouched($pageView)) {
121
+            if ($this->hasBeenTouched($pageView))
122
+            {
118 123
                 $pageView->readContent();
119 124
             }
120 125
 
@@ -133,22 +138,26 @@  discard block
 block discarded – undo
133 138
      */
134 139
     private function dynamicPageViewAction(DynamicPageView $pageView, Compiler $compiler): Closure
135 140
     {
136
-        return function (ServerRequestInterface $request) use ($pageView, $compiler) {
141
+        return function (ServerRequestInterface $request) use ($pageView, $compiler)
142
+        {
137 143
             Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath());
138 144
 
139 145
             $compiler->getTemplateBridge()->clearTemplateCache();
140 146
 
141 147
             $contentItem = self::getContentItem($pageView, $request->getUri()->getPath());
142 148
 
143
-            if ($contentItem === null) {
149
+            if ($contentItem === null)
150
+            {
144 151
                 return WebServer::return404();
145 152
             }
146 153
 
147
-            if ($this->hasBeenTouched($pageView)) {
154
+            if ($this->hasBeenTouched($pageView))
155
+            {
148 156
                 $pageView->readContent();
149 157
             }
150 158
 
151
-            if ($this->hasBeenTouched($contentItem)) {
159
+            if ($this->hasBeenTouched($contentItem))
160
+            {
152 161
                 $contentItem->readContent();
153 162
             }
154 163
 
@@ -161,18 +170,21 @@  discard block
 block discarded – undo
161 170
      */
162 171
     private function repeaterPageViewAction(RepeaterPageView $pageView, Compiler $compiler): Closure
163 172
     {
164
-        return function (ServerRequestInterface $request) use ($pageView, $compiler) {
173
+        return function (ServerRequestInterface $request) use ($pageView, $compiler)
174
+        {
165 175
             Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath());
166 176
 
167 177
             $compiler->getTemplateBridge()->clearTemplateCache();
168 178
 
169 179
             $expandedValue = self::getExpandedValue($pageView, $request->getUri()->getPath());
170 180
 
171
-            if ($expandedValue === null) {
181
+            if ($expandedValue === null)
182
+            {
172 183
                 return WebServer::return404();
173 184
             }
174 185
 
175
-            if ($this->hasBeenTouched($pageView)) {
186
+            if ($this->hasBeenTouched($pageView))
187
+            {
176 188
                 $pageView->readContent();
177 189
             }
178 190
 
@@ -189,7 +201,8 @@  discard block
 block discarded – undo
189 201
             BasePageView::STATIC_TYPE => $this->staticPageViewAction($pageView, $compiler),
190 202
             BasePageView::DYNAMIC_TYPE => $this->dynamicPageViewAction($pageView, $compiler),
191 203
             BasePageView::REPEATER_TYPE => $this->repeaterPageViewAction($pageView, $compiler),
192
-            default => function () {
204
+            default => function ()
205
+            {
193 206
                 $errMsg = 'This URL type has not yet been implemented.';
194 207
 
195 208
                 return new Response(501, ['Content-Type' => 'text/plain'], $errMsg);
@@ -218,7 +231,8 @@  discard block
 block discarded – undo
218 231
     {
219 232
         $rPath = $document->getRelativeFilePath();
220 233
 
221
-        if (!isset($this->lastModified[$rPath])) {
234
+        if (!isset($this->lastModified[$rPath]))
235
+        {
222 236
             $this->lastModified[$rPath] = $document->getLastModified();
223 237
 
224 238
             return true;
@@ -236,8 +250,10 @@  discard block
 block discarded – undo
236 250
     {
237 251
         $permalink = self::normalizeUrl($permalink);
238 252
 
239
-        foreach ($pageView->getCollectableItems() as $collectableItem) {
240
-            if ($collectableItem['permalink'] === $permalink) {
253
+        foreach ($pageView->getCollectableItems() as $collectableItem)
254
+        {
255
+            if ($collectableItem['permalink'] === $permalink)
256
+            {
241 257
                 return $collectableItem;
242 258
             }
243 259
         }
@@ -253,8 +269,10 @@  discard block
 block discarded – undo
253 269
         $url = self::normalizeUrl($permalink);
254 270
         $repeaterPermalinks = $pageView->getRepeaterPermalinks();
255 271
 
256
-        foreach ($repeaterPermalinks as $expandedValue) {
257
-            if ($expandedValue->getEvaluated() === $url) {
272
+        foreach ($repeaterPermalinks as $expandedValue)
273
+        {
274
+            if ($expandedValue->getEvaluated() === $url)
275
+            {
258 276
                 return $expandedValue;
259 277
             }
260 278
         }
Please login to merge, or discard this patch.
src/Website.php 1 patch
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function build(): bool
45 45
     {
46
-        if (empty($this->getConfiguration()->getPageViewFolders())) {
46
+        if (empty($this->getConfiguration()->getPageViewFolders()))
47
+        {
47 48
             $this->logger->error('No PageViews were configured for this site. Check the `pageviews` key in your _config.yml.');
48 49
 
49 50
             return false;
@@ -63,10 +64,14 @@  discard block
 block discarded – undo
63 64
         $this->compiler->setThemeName($theme);
64 65
         $this->compiler->compileAll();
65 66
 
66
-        if (Service::hasRunTimeFlag(RuntimeStatus::IN_PROFILE_MODE)) {
67
-            if (!$this->templateBridge->hasProfiler()) {
67
+        if (Service::hasRunTimeFlag(RuntimeStatus::IN_PROFILE_MODE))
68
+        {
69
+            if (!$this->templateBridge->hasProfiler())
70
+            {
68 71
                 $this->logger->writeln('This template engine currently does not support a profiler.');
69
-            } else {
72
+            }
73
+            else
74
+            {
70 75
                 $profilerText = $this->templateBridge->getProfilerOutput($this->compiler);
71 76
                 $this->logger->writeln($profilerText);
72 77
             }
@@ -82,7 +87,8 @@  discard block
 block discarded – undo
82 87
         //
83 88
         // Theme Management
84 89
         //
85
-        if ($theme !== null) {
90
+        if ($theme !== null)
91
+        {
86 92
             $this->logger->notice("Looking for '{$theme}' theme...");
87 93
 
88 94
             $tm = new ThemeManager($theme, $this->eventDispatcher, $this->logger);
@@ -113,11 +119,13 @@  discard block
 block discarded – undo
113 119
     {
114 120
         $targetDir = fs::absolutePath($this->getConfiguration()->getTargetFolder());
115 121
 
116
-        if (!Service::hasRunTimeFlag(RuntimeStatus::BOOT_WITHOUT_CLEAN)) {
122
+        if (!Service::hasRunTimeFlag(RuntimeStatus::BOOT_WITHOUT_CLEAN))
123
+        {
117 124
             fs::remove($targetDir);
118 125
         }
119 126
 
120
-        if (!Service::hasRunTimeFlag(RuntimeStatus::USING_CACHE)) {
127
+        if (!Service::hasRunTimeFlag(RuntimeStatus::USING_CACHE))
128
+        {
121 129
             fs::remove(fs::absolutePath(Configuration::CACHE_FOLDER, 'twig'));
122 130
             fs::mkdir(fs::absolutePath(fs::appendPath(Configuration::CACHE_FOLDER, 'twig')));
123 131
         }
@@ -132,20 +140,24 @@  discard block
 block discarded – undo
132 140
     {
133 141
         $enabled = $this->getConfiguration()->isHighlighterEnabled();
134 142
 
135
-        if (!$enabled) {
143
+        if (!$enabled)
144
+        {
136 145
             return;
137 146
         }
138 147
 
139 148
         Service::setRuntimeFlag(RuntimeStatus::USING_HIGHLIGHTER);
140 149
 
141
-        if ($this->getConfiguration()->isHighlighterUsingLineNumbers()) {
150
+        if ($this->getConfiguration()->isHighlighterUsingLineNumbers())
151
+        {
142 152
             Service::setRuntimeFlag(RuntimeStatus::USING_LINE_NUMBERS);
143 153
         }
144 154
 
145
-        foreach ($this->getConfiguration()->getHighlighterCustomLanguages() as $lang => $path) {
155
+        foreach ($this->getConfiguration()->getHighlighterCustomLanguages() as $lang => $path)
156
+        {
146 157
             $fullPath = fs::absolutePath($path);
147 158
 
148
-            if (!fs::exists($fullPath)) {
159
+            if (!fs::exists($fullPath))
160
+            {
149 161
                 $this->logger->warning('The following language definition could not be found: {lang}', [
150 162
                     'lang' => $path,
151 163
                 ]);
Please login to merge, or discard this patch.
src/Configuration.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@
 block discarded – undo
171 171
         return __::get($this->configuration, 'twig.autoescape');
172 172
     }
173 173
 
174
-    public function getRedirectTemplate(): false|string
174
+    public function getRedirectTemplate(): false | string
175 175
     {
176 176
         return __::get($this->configuration, 'templates.redirect');
177 177
     }
Please login to merge, or discard this patch.
Braces   +46 added lines, -20 removed lines patch added patch discarded remove patch
@@ -210,18 +210,21 @@  discard block
 block discarded – undo
210 210
      */
211 211
     private function parseConfig(File $configFile = null): array
212 212
     {
213
-        if ($configFile === null) {
213
+        if ($configFile === null)
214
+        {
214 215
             return [];
215 216
         }
216 217
 
217 218
         $this->currentFile = $configFile;
218 219
 
219
-        try {
220
+        try
221
+        {
220 222
             $this->isRecursiveImport($configFile);
221 223
 
222 224
             $parsedConfig = Yaml::parse($configFile->getContents());
223 225
 
224
-            if ($parsedConfig === null) {
226
+            if ($parsedConfig === null)
227
+            {
225 228
                 $parsedConfig = [];
226 229
             }
227 230
 
@@ -230,13 +233,17 @@  discard block
 block discarded – undo
230 233
             unset($parsedConfig[self::IMPORT_KEYWORD]);
231 234
 
232 235
             return $parsedConfig;
233
-        } catch (ParseException $e) {
236
+        }
237
+        catch (ParseException $e)
238
+        {
234 239
             $this->logger->error('{file}: parsing failed... {message}', [
235 240
                 'message' => $e->getMessage(),
236 241
                 'file' => $configFile,
237 242
             ]);
238 243
             $this->logger->error('Using default configuration...');
239
-        } catch (RecursiveConfigurationException $e) {
244
+        }
245
+        catch (RecursiveConfigurationException $e)
246
+        {
240 247
             $this->logger->error("{file}: you can't recursively import a file that's already been imported: {import}", [
241 248
                 'file' => $configFile,
242 249
                 'import' => $e->getRecursiveImport(),
@@ -297,7 +304,8 @@  discard block
 block discarded – undo
297 304
      */
298 305
     private function handleImports(array &$configuration): void
299 306
     {
300
-        if (!isset($configuration[self::IMPORT_KEYWORD])) {
307
+        if (!isset($configuration[self::IMPORT_KEYWORD]))
308
+        {
301 309
             $this->logger->debug('{file}: does not import any other files', [
302 310
                 'file' => $this->currentFile->getRelativeFilePath(),
303 311
             ]);
@@ -305,13 +313,15 @@  discard block
 block discarded – undo
305 313
             return;
306 314
         }
307 315
 
308
-        if (!is_array($imports = $configuration[self::IMPORT_KEYWORD])) {
316
+        if (!is_array($imports = $configuration[self::IMPORT_KEYWORD]))
317
+        {
309 318
             $this->logger->error('{file}: the reserved "import" keyword can only be an array');
310 319
 
311 320
             return;
312 321
         }
313 322
 
314
-        foreach ($imports as $import) {
323
+        foreach ($imports as $import)
324
+        {
315 325
             $this->handleImport($import, $configuration);
316 326
         }
317 327
     }
@@ -325,7 +335,8 @@  discard block
 block discarded – undo
325 335
      */
326 336
     private function handleImport($importDef, array &$configuration): void
327 337
     {
328
-        if (!is_string($importDef)) {
338
+        if (!is_string($importDef))
339
+        {
329 340
             $this->logger->error('{file}: invalid import: {message}', [
330 341
                 'file' => $this->configFile->getRelativeFilePath(),
331 342
                 'message' => $importDef,
@@ -336,7 +347,8 @@  discard block
 block discarded – undo
336 347
 
337 348
         $import = $this->configFile->createFileForRelativePath($importDef);
338 349
 
339
-        if (!$this->isValidImport($import)) {
350
+        if (!$this->isValidImport($import))
351
+        {
340 352
             return;
341 353
         }
342 354
 
@@ -345,10 +357,13 @@  discard block
 block discarded – undo
345 357
             'import' => $import->getRelativeFilePath(),
346 358
         ]);
347 359
 
348
-        try {
360
+        try
361
+        {
349 362
             $importedConfig = $this->parseConfig($import);
350 363
             $configuration = $this->mergeImports($importedConfig, $configuration);
351
-        } catch (FileNotFoundException) {
364
+        }
365
+        catch (FileNotFoundException)
366
+        {
352 367
             $this->logger->warning('{file}: could not find file to import: {import}', [
353 368
                 'file' => $this->configFile->getRelativeFilePath(),
354 369
                 'import' => $import,
@@ -363,17 +378,25 @@  discard block
 block discarded – undo
363 378
     {
364 379
         $errorMsg = '';
365 380
 
366
-        if ($filePath->isDir()) {
381
+        if ($filePath->isDir())
382
+        {
367 383
             $errorMsg = 'a directory';
368
-        } elseif ($filePath->isLink()) {
384
+        }
385
+        elseif ($filePath->isLink())
386
+        {
369 387
             $errorMsg = 'a symbolically linked file';
370
-        } elseif ($this->currentFile->getAbsolutePath() == $filePath->getAbsolutePath()) {
388
+        }
389
+        elseif ($this->currentFile->getAbsolutePath() == $filePath->getAbsolutePath())
390
+        {
371 391
             $errorMsg = 'yourself';
372
-        } elseif (($ext = $filePath->getExtension()) != 'yml' && $ext != 'yaml') {
392
+        }
393
+        elseif (($ext = $filePath->getExtension()) != 'yml' && $ext != 'yaml')
394
+        {
373 395
             $errorMsg = 'a non-YAML configuration';
374 396
         }
375 397
 
376
-        if (!($noErrors = empty($errorMsg))) {
398
+        if (!($noErrors = empty($errorMsg)))
399
+        {
377 400
             $this->logger->error("{file}: you can't import {message}: {import}", [
378 401
                 'file' => $this->configFile->getRelativeFilePath(),
379 402
                 'message' => $errorMsg,
@@ -389,7 +412,8 @@  discard block
 block discarded – undo
389 412
      */
390 413
     private function isRecursiveImport(File $filePath): void
391 414
     {
392
-        if (in_array($filePath->getRelativeFilePath(), self::$configImports)) {
415
+        if (in_array($filePath->getRelativeFilePath(), self::$configImports))
416
+        {
393 417
             throw new RecursiveConfigurationException($filePath, sprintf(
394 418
                 'The %s file has already been imported',
395 419
                 $filePath->getRelativeFilePath()
@@ -412,11 +436,13 @@  discard block
 block discarded – undo
412 436
 
413 437
     private function handleDefaultOperations(): void
414 438
     {
415
-        if (substr($this->getTargetFolder(), 0, 1) != '_') {
439
+        if (substr($this->getTargetFolder(), 0, 1) != '_')
440
+        {
416 441
             $this->configuration['exclude'][] = $this->getTargetFolder();
417 442
         }
418 443
 
419
-        if ($this->configuration['build']['preserveCase']) {
444
+        if ($this->configuration['build']['preserveCase'])
445
+        {
420 446
             Service::setRuntimeFlag(RuntimeStatus::COMPILER_PRESERVE_CASE);
421 447
         }
422 448
     }
Please login to merge, or discard this patch.
src/DataTransformer/CsvTransformer.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@
 block discarded – undo
18 18
         $columns = array_shift($rows);
19 19
         $csv = [];
20 20
 
21
-        foreach ($rows as $row) {
21
+        foreach ($rows as $row)
22
+        {
22 23
             $csv[] = array_combine($columns, $row);
23 24
         }
24 25
 
Please login to merge, or discard this patch.