@@ -215,10 +215,8 @@ public function __construct($template, DatabaseInterface $dbi)
215215 */
216216 private function getNavigationDbPos (): int
217217 {
218- $ retval = 0 ;
219-
220218 if (strlen ($ GLOBALS ['db ' ] ?? '' ) === 0 ) {
221- return $ retval ;
219+ return 0 ;
222220 }
223221
224222 /**
@@ -379,14 +377,12 @@ private function buildPathPart(array $path, string $type2, int $pos2, string $ty
379377 return false ;
380378 }
381379
382- $ retval = $ db ;
383-
384380 $ containers = $ this ->addDbContainers ($ db , $ type2 , $ pos2 );
385381
386382 array_shift ($ path ); // remove db
387383
388- if ((count ( $ path) <= 0 || ! array_key_exists ($ path [0 ], $ containers )) && count ($ containers ) != 1 ) {
389- return $ retval ;
384+ if (($ path === [] || ! array_key_exists ($ path [0 ], $ containers )) && count ($ containers ) != 1 ) {
385+ return $ db ;
390386 }
391387
392388 if (count ($ containers ) === 1 ) {
@@ -398,8 +394,6 @@ private function buildPathPart(array $path, string $type2, int $pos2, string $ty
398394 }
399395 }
400396
401- $ retval = $ container ;
402-
403397 if (count ($ container ->children ) <= 1 ) {
404398 $ dbData = $ db ->getData ($ container ->realName , $ pos2 , $ this ->searchClause2 );
405399 foreach ($ dbData as $ item ) {
@@ -441,7 +435,7 @@ private function buildPathPart(array $path, string $type2, int $pos2, string $ty
441435
442436 array_shift ($ path ); // remove container
443437 if (count ($ path ) <= 0 ) {
444- return $ retval ;
438+ return $ container ;
445439 }
446440
447441 /** @var NodeTable|null $table */
@@ -458,17 +452,22 @@ private function buildPathPart(array $path, string $type2, int $pos2, string $ty
458452
459453 $ container ->addChild ($ node );
460454 $ table = $ container ->getChild ($ path [0 ], true );
455+ if ($ table === null ) {
456+ return false ;
457+ }
461458 }
462459
463- $ retval = $ table ?? false ;
464460 $ containers = $ this ->addTableContainers ($ table , $ pos2 , $ type3 , $ pos3 );
465461 array_shift ($ path ); // remove table
466- if (count ( $ path) <= 0 || ! array_key_exists ($ path [0 ], $ containers )) {
467- return $ retval ;
462+ if ($ path === [] || ! array_key_exists ($ path [0 ], $ containers )) {
463+ return $ table ;
468464 }
469465
470466 $ container = $ table ->getChild ($ path [0 ], true );
471- $ retval = $ container ?? false ;
467+ if ($ container === null ) {
468+ return false ;
469+ }
470+
472471 $ tableData = $ table ->getData ($ container ->realName , $ pos3 );
473472 foreach ($ tableData as $ item ) {
474473 switch ($ container ->realName ) {
@@ -497,7 +496,7 @@ private function buildPathPart(array $path, string $type2, int $pos2, string $ty
497496 $ container ->addChild ($ node );
498497 }
499498
500- return $ retval ;
499+ return $ container ;
501500 }
502501
503502 /**
@@ -515,7 +514,7 @@ private function buildPathPart(array $path, string $type2, int $pos2, string $ty
515514 * @param int $pos3 The position for the pagination of
516515 * the branch at the third level of the tree
517516 *
518- * @return array An array of new nodes
517+ * @return Node[] An array of new nodes
519518 */
520519 private function addTableContainers (NodeTable $ table , int $ pos2 , string $ type3 , int $ pos3 ): array
521520 {
@@ -568,7 +567,7 @@ private function addTableContainers(NodeTable $table, int $pos2, string $type3,
568567 * @param int $pos2 The position for the pagination of
569568 * the branch at the second level of the tree
570569 *
571- * @return array An array of new nodes
570+ * @return Node[] An array of new nodes
572571 */
573572 private function addDbContainers (NodeDatabase $ db , string $ type , int $ pos2 ): array
574573 {
0 commit comments