Completed
Push — chore/php-8-migration ( 0b97e4...588942 )
by Vladimir
09:24
created
src/Filesystem/FilesystemPath.php 1 patch
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,7 +39,8 @@  discard block
 block discarded – undo
39 39
         $this->isWindows = $dirSep === '\\';
40 40
         $this->isVFS = fs::isVFS($filePath);
41 41
 
42
-        if ($this->isWindows) {
42
+        if ($this->isWindows)
43
+        {
43 44
             $filePath = $this->unixifyPath($filePath);
44 45
         }
45 46
 
@@ -58,7 +59,8 @@  discard block
 block discarded – undo
58 59
      */
59 60
     public function appendToPath($append): self
60 61
     {
61
-        if ($this->isFile(false)) {
62
+        if ($this->isFile(false))
63
+        {
62 64
             throw new InvalidArgumentException("Appending to a file's path is not possible");
63 65
         }
64 66
 
@@ -86,7 +88,8 @@  discard block
 block discarded – undo
86 88
      */
87 89
     public function getAbsolutePath(): string
88 90
     {
89
-        if (!$this->isVFS && $this->isWindows) {
91
+        if (!$this->isVFS && $this->isWindows)
92
+        {
90 93
             return str_replace('/', '\\', $this->absolutePath);
91 94
         }
92 95
 
@@ -112,7 +115,8 @@  discard block
 block discarded – undo
112 115
     {
113 116
         $absPath = $this->absolutePath;
114 117
 
115
-        if ($checkExistence) {
118
+        if ($checkExistence)
119
+        {
116 120
             return file_exists($absPath) && is_dir($absPath);
117 121
         }
118 122
 
@@ -130,7 +134,8 @@  discard block
 block discarded – undo
130 134
     {
131 135
         $absPath = $this->absolutePath;
132 136
 
133
-        if ($checkExistence) {
137
+        if ($checkExistence)
138
+        {
134 139
             return file_exists($absPath) && is_file($absPath);
135 140
         }
136 141
 
@@ -147,8 +152,10 @@  discard block
 block discarded – undo
147 152
     {
148 153
         $paths = [];
149 154
 
150
-        foreach (func_get_args() as $arg) {
151
-            if ($arg !== '') {
155
+        foreach (func_get_args() as $arg)
156
+        {
157
+            if ($arg !== '')
158
+            {
152 159
                 $paths[] = $arg;
153 160
             }
154 161
         }
Please login to merge, or discard this patch.
src/Filesystem/FilesystemLoader.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@
 block discarded – undo
25 25
 
26 26
     public static function __callStatic($name, $arguments)
27 27
     {
28
-        if (self::$fs === null) {
28
+        if (self::$fs === null)
29
+        {
29 30
             self::$fs = new Filesystem();
30 31
         }
31 32
 
Please login to merge, or discard this patch.
src/Filesystem/FileExplorerMatcher.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,11 @@
 block discarded – undo
20 20
      */
21 21
     public static function modifiedAfter(DateTime $time): Closure
22 22
     {
23
-        return function ($file) use ($time) {
23
+        return function ($file) use ($time)
24
+        {
24 25
             /** @var File|Folder $file */
25
-            if ($file instanceof Folder) {
26
+            if ($file instanceof Folder)
27
+            {
26 28
                 return true;
27 29
             }
28 30
 
Please login to merge, or discard this patch.
src/Filesystem/BaseFilesystemItem.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      *
25 25
      * @throws FileNotFoundException
26 26
      */
27
-    public function __construct(protected string|FilesystemPath $rawPath)
27
+    public function __construct(protected string | FilesystemPath $rawPath)
28 28
     {
29 29
         $realPath = fs::realpath($rawPath);
30 30
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@  discard block
 block discarded – undo
28 28
     {
29 29
         $realPath = fs::realpath($rawPath);
30 30
 
31
-        if ($realPath === false) {
31
+        if ($realPath === false)
32
+        {
32 33
             throw $this->buildNotFoundException();
33 34
         }
34 35
 
@@ -112,11 +113,13 @@  discard block
 block discarded – undo
112 113
      */
113 114
     protected function isSafeToRead(): void
114 115
     {
115
-        if (fs::isVFS($this->getAbsolutePath())) {
116
+        if (fs::isVFS($this->getAbsolutePath()))
117
+        {
116 118
             return;
117 119
         }
118 120
 
119
-        if (!str_starts_with($this->getAbsolutePath(), (string)Service::getWorkingDirectory())) {
121
+        if (!str_starts_with($this->getAbsolutePath(), (string)Service::getWorkingDirectory()))
122
+        {
120 123
             throw $this->buildNotFoundException();
121 124
         }
122 125
     }
Please login to merge, or discard this patch.
src/Filesystem/Filesystem.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      *
224 224
      * @return false|T
225 225
      */
226
-    public function realpath(string|BaseFilesystemItem $path): false|string|BaseFilesystemItem
226
+    public function realpath(string | BaseFilesystemItem $path): false | string | BaseFilesystemItem
227 227
     {
228 228
         return $this->isVFS($path) ? $path : realpath((string)$path);
229 229
     }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     /**
232 232
      * Check whether a given path is on the virtual filesystem.
233 233
      */
234
-    public function isVFS(string|BaseFilesystemItem $path): bool
234
+    public function isVFS(string | BaseFilesystemItem $path): bool
235 235
     {
236 236
         return str_starts_with((string)$path, 'vfs://');
237 237
     }
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,11 +25,13 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function absolutePath($pathFragments): string
27 27
     {
28
-        if ($pathFragments instanceof FilesystemPath) {
28
+        if ($pathFragments instanceof FilesystemPath)
29
+        {
29 30
             $pathFragments = (string)$pathFragments;
30 31
         }
31 32
 
32
-        if ($this->isAbsolutePath($pathFragments)) {
33
+        if ($this->isAbsolutePath($pathFragments))
34
+        {
33 35
             return $pathFragments;
34 36
         }
35 37
 
@@ -61,16 +63,20 @@  discard block
 block discarded – undo
61 63
      */
62 64
     public function copy($originFile, $targetFile, $overwriteNewerFiles = false): void
63 65
     {
64
-        if ($this->isDir($originFile)) {
65
-            if (!$this->isDir($targetFile)) {
66
+        if ($this->isDir($originFile))
67
+        {
68
+            if (!$this->isDir($targetFile))
69
+            {
66 70
                 mkdir($targetFile, 0755, true);
67 71
             }
68 72
 
69 73
             $dir = dir($originFile);
70 74
 
71
-            while (false !== $entry = $dir->read()) {
75
+            while (false !== $entry = $dir->read())
76
+            {
72 77
                 // Skip pointers
73
-                if ($entry == '.' || $entry == '..') {
78
+                if ($entry == '.' || $entry == '..')
79
+                {
74 80
                     continue;
75 81
                 }
76 82
 
@@ -78,7 +84,9 @@  discard block
 block discarded – undo
78 84
             }
79 85
 
80 86
             $dir->close();
81
-        } else {
87
+        }
88
+        else
89
+        {
82 90
             parent::copy($originFile, $targetFile, $overwriteNewerFiles);
83 91
         }
84 92
     }
Please login to merge, or discard this patch.
src/Manager/TrackingManager.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
         }
163 163
     }
164 164
 
165
-    protected function addFileToTracker(File &$file): void
165
+    protected function addFileToTracker(File & $file): void
166 166
     {
167 167
         $this->trackedItemsFlattened[$file->getRelativeFilePath()] = &$file;
168 168
     }
169 169
 
170
-    protected function delFileFromTracker(File &$file): void
170
+    protected function delFileFromTracker(File & $file): void
171 171
     {
172 172
         unset($this->trackedItemsFlattened[$file->getRelativeFilePath()]);
173 173
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      *
178 178
      * @param null|string $namespace
179 179
      */
180
-    protected function addObjectToTracker(ReadableDocument &$trackedItem, $namespace = null): void
180
+    protected function addObjectToTracker(ReadableDocument & $trackedItem, $namespace = null): void
181 181
     {
182 182
         if ($namespace == null) {
183 183
             $this->trackedItems[$trackedItem->getIndexName()] = &$trackedItem;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      *
194 194
      * @param null|string $namespace
195 195
      */
196
-    protected function delObjectFromTracker(ReadableDocument &$trackedItem, $namespace = null): void
196
+    protected function delObjectFromTracker(ReadableDocument & $trackedItem, $namespace = null): void
197 197
     {
198 198
         if ($namespace == null) {
199 199
             unset($this->trackedItems[$trackedItem->getIndexName()]);
Please login to merge, or discard this patch.
Braces   +33 added lines, -15 removed lines patch added patch discarded remove patch
@@ -96,7 +96,8 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function getTracked($filePath): mixed
98 98
     {
99
-        if ($this->isTracked($filePath)) {
99
+        if ($this->isTracked($filePath))
100
+        {
100 101
             return $this->trackedItemsFlattened[(string)$filePath];
101 102
         }
102 103
 
@@ -125,8 +126,10 @@  discard block
 block discarded – undo
125 126
      */
126 127
     public function shouldBeTracked($filePath): bool
127 128
     {
128
-        foreach ($this->folderDefinitions as $folder) {
129
-            if (str_starts_with($filePath, $folder)) {
129
+        foreach ($this->folderDefinitions as $folder)
130
+        {
131
+            if (str_starts_with($filePath, $folder))
132
+            {
130 133
                 return true;
131 134
             }
132 135
         }
@@ -157,7 +160,8 @@  discard block
 block discarded – undo
157 160
      */
158 161
     protected function declareTrackingNamespace($namespace): void
159 162
     {
160
-        if (!isset($this->trackedItems[$namespace])) {
163
+        if (!isset($this->trackedItems[$namespace]))
164
+        {
161 165
             $this->trackedItems[$namespace] = [];
162 166
         }
163 167
     }
@@ -179,9 +183,12 @@  discard block
 block discarded – undo
179 183
      */
180 184
     protected function addObjectToTracker(ReadableDocument &$trackedItem, $namespace = null): void
181 185
     {
182
-        if ($namespace == null) {
186
+        if ($namespace == null)
187
+        {
183 188
             $this->trackedItems[$trackedItem->getIndexName()] = &$trackedItem;
184
-        } else {
189
+        }
190
+        else
191
+        {
185 192
             $this->trackedItems[$namespace][$trackedItem->getIndexName()] = &$trackedItem;
186 193
         }
187 194
 
@@ -195,9 +202,12 @@  discard block
 block discarded – undo
195 202
      */
196 203
     protected function delObjectFromTracker(ReadableDocument &$trackedItem, $namespace = null): void
197 204
     {
198
-        if ($namespace == null) {
205
+        if ($namespace == null)
206
+        {
199 207
             unset($this->trackedItems[$trackedItem->getIndexName()]);
200
-        } else {
208
+        }
209
+        else
210
+        {
201 211
             unset($this->trackedItems[$namespace][$trackedItem->getIndexName()]);
202 212
         }
203 213
 
@@ -255,14 +265,16 @@  discard block
 block discarded – undo
255 265
     {
256 266
         $this->watchedFolders[$def->folder->getAbsolutePath()] = $def;
257 267
 
258
-        if (empty($def->excludes)) {
268
+        if (empty($def->excludes))
269
+        {
259 270
             $def->excludes = self::$documentIgnoreList;
260 271
         }
261 272
 
262 273
         $fileExplorer = FileExplorer::createFromDefinition($def);
263 274
         $fileIterator = $fileExplorer->getFileIterator();
264 275
 
265
-        foreach ($fileIterator as $file) {
276
+        foreach ($fileIterator as $file)
277
+        {
266 278
             $this->handleTrackableItem($file, $options);
267 279
         }
268 280
     }
@@ -298,18 +310,24 @@  discard block
 block discarded – undo
298 310
         $jailItems = [];
299 311
 
300 312
         /** @var CollectableItem|ReadableDocument $item */
301
-        foreach ($elements as &$item) {
302
-            if ($item instanceof TemplateReadyDocument) {
303
-                if (!Service::hasRunTimeFlag(RuntimeStatus::USING_DRAFTS) && $item->isDraft()) {
313
+        foreach ($elements as &$item)
314
+        {
315
+            if ($item instanceof TemplateReadyDocument)
316
+            {
317
+                if (!Service::hasRunTimeFlag(RuntimeStatus::USING_DRAFTS) && $item->isDraft())
318
+                {
304 319
                     continue;
305 320
                 }
306 321
             }
307 322
 
308 323
             $keyName = ($name === null) ? $item->getRelativeFilePath() : $name($item);
309 324
 
310
-            if (empty($item->getNamespace())) {
325
+            if (empty($item->getNamespace()))
326
+            {
311 327
                 $jailItems[$keyName] = $item->createJail();
312
-            } else {
328
+            }
329
+            else
330
+            {
313 331
                 $jailItems[$item->getNamespace()][$keyName] = $item->createJail();
314 332
             }
315 333
         }
Please login to merge, or discard this patch.
src/Manager/DataManager.php 1 patch
Braces   +20 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function compileManager(): void
40 40
     {
41
-        if (!$this->configuration->hasDataItems()) {
41
+        if (!$this->configuration->hasDataItems())
42
+        {
42 43
             $this->logger->notice('No DataItems or Datasets detected... Ignoring.');
43 44
 
44 45
             return;
@@ -73,11 +74,13 @@  discard block
 block discarded – undo
73 74
      */
74 75
     public function parseDataItems($folders): void
75 76
     {
76
-        if ($folders === null) {
77
+        if ($folders === null)
78
+        {
77 79
             return;
78 80
         }
79 81
 
80
-        foreach ($folders as $folder) {
82
+        foreach ($folders as $folder)
83
+        {
81 84
             $cls = new Folder($folder);
82 85
 
83 86
             $this->logger->debug('Scanning "{folder}" for data items...', [
@@ -101,7 +104,8 @@  discard block
 block discarded – undo
101 104
      */
102 105
     public function parseDataSets($dataSets): void
103 106
     {
104
-        if ($dataSets === null) {
107
+        if ($dataSets === null)
108
+        {
105 109
             return;
106 110
         }
107 111
 
@@ -113,7 +117,8 @@  discard block
 block discarded – undo
113 117
          *            'folder' => '(string) The folder where this collection has its ContentItems'
114 118
          *            ]
115 119
          */
116
-        foreach ($dataSets as $dataSet) {
120
+        foreach ($dataSets as $dataSet)
121
+        {
117 122
             $folder = new Folder($dataSet['folder']);
118 123
 
119 124
             $this->logger->debug('Scanning "{folder}" for the "{name}" dataset...', [
@@ -137,7 +142,8 @@  discard block
 block discarded – undo
137 142
      */
138 143
     protected function handleTrackableItem(File $filePath, array $options = []): mixed
139 144
     {
140
-        try {
145
+        try
146
+        {
141 147
             $namespace = $options['namespace'] ?? null;
142 148
 
143 149
             $dataItem = new DataItem($filePath);
@@ -151,12 +157,17 @@  discard block
 block discarded – undo
151 157
             $this->saveTrackerOptions($dataItem->getRelativeFilePath(), $options);
152 158
 
153 159
             return $dataItem->getRelativeFilePath();
154
-        } catch (DependencyMissingException $e) {
155
-            if ($e->getDependency() === 'XML') {
160
+        }
161
+        catch (DependencyMissingException $e)
162
+        {
163
+            if ($e->getDependency() === 'XML')
164
+            {
156 165
                 $this->logger->critical('XML support is not available in your PHP installation. For XML support, please install the appropriate package for your system:');
157 166
                 $this->logger->critical('  e.g. php7.0-xml');
158 167
             }
159
-        } catch (UnsupportedDataTypeException $e) {
168
+        }
169
+        catch (UnsupportedDataTypeException $e)
170
+        {
160 171
             $this->logger->warning('There is no function to handle {ext} file format.', [
161 172
                 'ext' => $e->getDataType(),
162 173
             ]);
Please login to merge, or discard this patch.
src/Manager/PageManager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@
 block discarded – undo
179 179
      *
180 180
      * @since 0.2.0
181 181
      */
182
-    public function trackNewPageView(BasePageView|DynamicPageView|RepeaterPageView|StaticPageView $pageView): void
182
+    public function trackNewPageView(BasePageView | DynamicPageView | RepeaterPageView | StaticPageView $pageView): void
183 183
     {
184 184
         $namespace = $pageView->getType();
185 185
 
Please login to merge, or discard this patch.
Braces   +33 added lines, -16 removed lines patch added patch discarded remove patch
@@ -85,7 +85,8 @@  discard block
 block discarded – undo
85 85
         $preEvent = new PageManagerPreProcess($this);
86 86
         $this->eventDispatcher->dispatch($preEvent, PageManagerPreProcess::NAME);
87 87
 
88
-        foreach ($pageViewFolders as $pageViewFolderName) {
88
+        foreach ($pageViewFolders as $pageViewFolderName)
89
+        {
89 90
             $folder = new Folder($pageViewFolderName);
90 91
 
91 92
             $event = new PageViewDefinitionAdded($folder);
@@ -149,7 +150,8 @@  discard block
 block discarded – undo
149 150
     {
150 151
         $jailedObjects = [];
151 152
 
152
-        foreach ($this->staticPages as $key => $value) {
153
+        foreach ($this->staticPages as $key => $value)
154
+        {
153 155
             $jailedObjects[$key] = $value->createJail();
154 156
         }
155 157
 
@@ -163,7 +165,8 @@  discard block
 block discarded – undo
163 165
     {
164 166
         $jailedObjects = [];
165 167
 
166
-        foreach ($this->repeaterPages as $key => $value) {
168
+        foreach ($this->repeaterPages as $key => $value)
169
+        {
167 170
             $jailedObjects[$key] = $value->createJail();
168 171
         }
169 172
 
@@ -183,7 +186,8 @@  discard block
 block discarded – undo
183 186
     {
184 187
         $namespace = $pageView->getType();
185 188
 
186
-        switch ($namespace) {
189
+        switch ($namespace)
190
+        {
187 191
             case BasePageView::STATIC_TYPE:
188 192
                 $this->handleTrackableStaticPageView($pageView);
189 193
 
@@ -250,7 +254,8 @@  discard block
 block discarded – undo
250 254
             'site' => $this->configuration->getConfiguration(),
251 255
         ]);
252 256
 
253
-        if (empty($pageView['title'])) {
257
+        if (empty($pageView['title']))
258
+        {
254 259
             return;
255 260
         }
256 261
 
@@ -274,33 +279,40 @@  discard block
 block discarded – undo
274 279
         $dataSource = null;
275 280
         $namespace = null;
276 281
 
277
-        if (isset($frontMatter['collection'])) {
282
+        if (isset($frontMatter['collection']))
283
+        {
278 284
             $dataSource = &$this->collectionManager->getCollections();
279 285
             $namespace = 'collection';
280
-        } elseif (isset($frontMatter['dataset'])) {
286
+        }
287
+        elseif (isset($frontMatter['dataset']))
288
+        {
281 289
             $dataSource = &$this->dataManager->getDataItems();
282 290
             $namespace = 'dataset';
283 291
         }
284 292
 
285
-        if ($dataSource === null) {
293
+        if ($dataSource === null)
294
+        {
286 295
             throw new LogicException('Invalid Dynamic PageView defined');
287 296
         }
288 297
 
289 298
         $collection = $frontMatter[$namespace];
290 299
 
291
-        if (!isset($dataSource[$collection])) {
300
+        if (!isset($dataSource[$collection]))
301
+        {
292 302
             throw new CollectionNotFoundException("The '{$collection}' {$namespace} is not defined");
293 303
         }
294 304
 
295 305
         /** @var ContentItem|DataItem $item */
296
-        foreach ($dataSource[$collection] as &$item) {
306
+        foreach ($dataSource[$collection] as &$item)
307
+        {
297 308
             $item->evaluateFrontMatter($frontMatter, [
298 309
                 'site' => $this->configuration->getConfiguration(),
299 310
             ]);
300 311
             $item->saveParentPageView($pageView);
301 312
             $item->buildPermalink(true);
302 313
 
303
-            if ($item instanceof ContentItem) {
314
+            if ($item instanceof ContentItem)
315
+            {
304 316
                 $this->registerExplicitAssets($item);
305 317
             }
306 318
 
@@ -325,7 +337,8 @@  discard block
 block discarded – undo
325 337
         ]);
326 338
         $pageView->configurePermalinks();
327 339
 
328
-        if (empty($pageView['title'])) {
340
+        if (empty($pageView['title']))
341
+        {
329 342
             return;
330 343
         }
331 344
 
@@ -336,21 +349,25 @@  discard block
 block discarded – undo
336 349
     {
337 350
         $assets = $contentItem['assets'];
338 351
 
339
-        if (!is_array($assets) && $assets !== null) {
352
+        if (!is_array($assets) && $assets !== null)
353
+        {
340 354
             $this->logger->warning('The "assets" directive in FrontMatter must be null or an array of strings.');
341 355
 
342 356
             return;
343 357
         }
344 358
 
345
-        if ($assets === null || count($assets) === 0) {
359
+        if ($assets === null || count($assets) === 0)
360
+        {
346 361
             return;
347 362
         }
348 363
 
349 364
         $sourceFolder = fs::path($contentItem->getAbsoluteFilePath())->getParentDirectory();
350 365
         $permalinkFolder = fs::path($contentItem->getTargetFile())->getParentDirectory();
351 366
 
352
-        foreach ($assets as $i => $asset) {
353
-            if (!is_string($asset)) {
367
+        foreach ($assets as $i => $asset)
368
+        {
369
+            if (!is_string($asset))
370
+            {
354 371
                 $this->logger->warning('{path}: Item #{index} of the "assets" array is not a string', [
355 372
                     'path' => $contentItem->getRelativeFilePath(),
356 373
                     'index' => $i,
Please login to merge, or discard this patch.
src/Manager/MenuManager.php 1 patch
Braces   +29 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function compileManager(): void
27 27
     {
28
-        if ($this->pageManager === null) {
28
+        if ($this->pageManager === null)
29
+        {
29 30
             return;
30 31
         }
31 32
 
@@ -41,9 +42,11 @@  discard block
 block discarded – undo
41 42
     {
42 43
         $jailedMenu = [];
43 44
 
44
-        foreach ($this->siteMenu as $key => $value) {
45
+        foreach ($this->siteMenu as $key => $value)
46
+        {
45 47
             // If it's an array, it means the parent is hidden from the site menu therefore its children should be too
46
-            if (is_array($this->siteMenu[$key])) {
48
+            if (is_array($this->siteMenu[$key]))
49
+            {
47 50
                 continue;
48 51
             }
49 52
 
@@ -58,7 +61,8 @@  discard block
 block discarded – undo
58 61
      */
59 62
     public function buildFromPageViews($pageViews): void
60 63
     {
61
-        foreach ($pageViews as $pageView) {
64
+        foreach ($pageViews as $pageView)
65
+        {
62 66
             $this->addToSiteMenu($pageView);
63 67
         }
64 68
     }
@@ -70,38 +74,50 @@  discard block
 block discarded – undo
70 74
     {
71 75
         $frontMatter = $pageView->getFrontMatter();
72 76
 
73
-        if (isset($frontMatter['menu']) && !$frontMatter['menu']) {
77
+        if (isset($frontMatter['menu']) && !$frontMatter['menu'])
78
+        {
74 79
             return;
75 80
         }
76 81
 
77 82
         $url = trim((string)$pageView->getPermalink(), '/');
78 83
 
79 84
         // @TODO in the next breaking release, remove this check and allow the homepage to be indexed as '.'
80
-        if (empty($url)) {
85
+        if (empty($url))
86
+        {
81 87
             return;
82 88
         }
83 89
 
84 90
         $root = &$this->siteMenu;
85 91
         $dirs = explode('/', $url);
86 92
 
87
-        while (count($dirs) > 0) {
93
+        while (count($dirs) > 0)
94
+        {
88 95
             $name = array_shift($dirs);
89 96
             $name = (!empty($name)) ? $name : '.';
90 97
 
91
-            if (!is_null($name) && count($dirs) == 0) {
92
-                if (isset($root[$name]) && is_array($root[$name])) {
98
+            if (!is_null($name) && count($dirs) == 0)
99
+            {
100
+                if (isset($root[$name]) && is_array($root[$name]))
101
+                {
93 102
                     $children = &$pageView->getChildren();
94 103
                     $children = $root[$name]['children'];
95 104
                 }
96 105
 
97 106
                 $root[$name] = &$pageView;
98
-            } else {
99
-                if (!isset($root[$name])) {
107
+            }
108
+            else
109
+            {
110
+                if (!isset($root[$name]))
111
+                {
100 112
                     $root[$name]['children'] = [];
101 113
                     $root = &$root[$name]['children'];
102
-                } elseif (isset($root[$name]) && is_array($root[$name])) {
114
+                }
115
+                elseif (isset($root[$name]) && is_array($root[$name]))
116
+                {
103 117
                     $root = &$root[$name]['children'];
104
-                } else {
118
+                }
119
+                else
120
+                {
105 121
                     $root = &$root[$name]->getChildren();
106 122
                 }
107 123
             }
Please login to merge, or discard this patch.