1111use PhpMyAdmin \DatabaseInterface ;
1212use PhpMyAdmin \Html \Generator ;
1313use PhpMyAdmin \Navigation \Nodes \Node ;
14+ use PhpMyAdmin \Navigation \Nodes \NodeColumn ;
15+ use PhpMyAdmin \Navigation \Nodes \NodeColumnContainer ;
1416use PhpMyAdmin \Navigation \Nodes \NodeDatabase ;
17+ use PhpMyAdmin \Navigation \Nodes \NodeDatabaseContainer ;
18+ use PhpMyAdmin \Navigation \Nodes \NodeEvent ;
19+ use PhpMyAdmin \Navigation \Nodes \NodeEventContainer ;
20+ use PhpMyAdmin \Navigation \Nodes \NodeFunction ;
21+ use PhpMyAdmin \Navigation \Nodes \NodeFunctionContainer ;
22+ use PhpMyAdmin \Navigation \Nodes \NodeIndex ;
23+ use PhpMyAdmin \Navigation \Nodes \NodeIndexContainer ;
24+ use PhpMyAdmin \Navigation \Nodes \NodeProcedure ;
25+ use PhpMyAdmin \Navigation \Nodes \NodeProcedureContainer ;
1526use PhpMyAdmin \Navigation \Nodes \NodeTable ;
1627use PhpMyAdmin \Navigation \Nodes \NodeTableContainer ;
28+ use PhpMyAdmin \Navigation \Nodes \NodeTrigger ;
29+ use PhpMyAdmin \Navigation \Nodes \NodeTriggerContainer ;
30+ use PhpMyAdmin \Navigation \Nodes \NodeView ;
1731use PhpMyAdmin \Navigation \Nodes \NodeViewContainer ;
1832use PhpMyAdmin \RecentFavoriteTable ;
1933use PhpMyAdmin \ResponseRenderer ;
@@ -198,7 +212,7 @@ public function __construct($template, DatabaseInterface $dbi)
198212 }
199213
200214 // Initialize the tree by creating a root node
201- $ this ->tree = NodeFactory::getInstance (' NodeDatabaseContainer ' , 'root ' );
215+ $ this ->tree = NodeFactory::getInstance (NodeDatabaseContainer::class , 'root ' );
202216 if (! $ GLOBALS ['cfg ' ]['NavigationTreeEnableGrouping ' ] || ! $ GLOBALS ['cfg ' ]['ShowDatabasesNavigationAsTree ' ]) {
203217 return ;
204218 }
@@ -319,8 +333,7 @@ private function buildPath()
319333 $ data = $ this ->tree ->getData ('databases ' , $ this ->pos , $ this ->searchClause );
320334 $ hiddenCounts = $ this ->tree ->getNavigationHidingData ();
321335 foreach ($ data as $ db ) {
322- /** @var NodeDatabase $node */
323- $ node = NodeFactory::getInstance ('NodeDatabase ' , $ db );
336+ $ node = NodeFactory::getInstance (NodeDatabase::class, $ db );
324337 if (isset ($ hiddenCounts [$ db ])) {
325338 $ node ->setHiddenCount ($ hiddenCounts [$ db ]);
326339 }
@@ -395,19 +408,19 @@ private function buildPathPart(array $path, string $type2, int $pos2, string $ty
395408 foreach ($ dbData as $ item ) {
396409 switch ($ container ->realName ) {
397410 case 'events ' :
398- $ node = NodeFactory::getInstance (' NodeEvent ' , $ item );
411+ $ node = NodeFactory::getInstance (NodeEvent::class , $ item );
399412 break ;
400413 case 'functions ' :
401- $ node = NodeFactory::getInstance (' NodeFunction ' , $ item );
414+ $ node = NodeFactory::getInstance (NodeFunction::class , $ item );
402415 break ;
403416 case 'procedures ' :
404- $ node = NodeFactory::getInstance (' NodeProcedure ' , $ item );
417+ $ node = NodeFactory::getInstance (NodeProcedure::class , $ item );
405418 break ;
406419 case 'tables ' :
407- $ node = NodeFactory::getInstance (' NodeTable ' , $ item );
420+ $ node = NodeFactory::getInstance (NodeTable::class , $ item );
408421 break ;
409422 case 'views ' :
410- $ node = NodeFactory::getInstance (' NodeView ' , $ item );
423+ $ node = NodeFactory::getInstance (NodeView::class , $ item );
411424 break ;
412425 default :
413426 break ;
@@ -441,7 +454,7 @@ private function buildPathPart(array $path, string $type2, int $pos2, string $ty
441454 return false ;
442455 }
443456
444- $ node = NodeFactory::getInstance (' NodeTable ' , $ path [0 ]);
457+ $ node = NodeFactory::getInstance (NodeTable::class , $ path [0 ]);
445458 if ($ type2 == $ container ->realName ) {
446459 $ node ->pos2 = $ pos2 ;
447460 }
@@ -468,13 +481,13 @@ private function buildPathPart(array $path, string $type2, int $pos2, string $ty
468481 foreach ($ tableData as $ item ) {
469482 switch ($ container ->realName ) {
470483 case 'indexes ' :
471- $ node = NodeFactory::getInstance (' NodeIndex ' , $ item );
484+ $ node = NodeFactory::getInstance (NodeIndex::class , $ item );
472485 break ;
473486 case 'columns ' :
474- $ node = NodeFactory::getInstance (' NodeColumn ' , $ item );
487+ $ node = NodeFactory::getInstance (NodeColumn::class , $ item );
475488 break ;
476489 case 'triggers ' :
477- $ node = NodeFactory::getInstance (' NodeTrigger ' , $ item );
490+ $ node = NodeFactory::getInstance (NodeTrigger::class , $ item );
478491 break ;
479492 default :
480493 break ;
@@ -517,15 +530,15 @@ private function addTableContainers(NodeTable $table, int $pos2, string $type3,
517530 $ retval = [];
518531 if (! $ table ->hasChildren ()) {
519532 if ($ table ->getPresence ('columns ' )) {
520- $ retval ['columns ' ] = NodeFactory::getInstance (' NodeColumnContainer ' );
533+ $ retval ['columns ' ] = NodeFactory::getInstance (NodeColumnContainer::class );
521534 }
522535
523536 if ($ table ->getPresence ('indexes ' )) {
524- $ retval ['indexes ' ] = NodeFactory::getInstance (' NodeIndexContainer ' );
537+ $ retval ['indexes ' ] = NodeFactory::getInstance (NodeIndexContainer::class );
525538 }
526539
527540 if ($ table ->getPresence ('triggers ' )) {
528- $ retval ['triggers ' ] = NodeFactory::getInstance (' NodeTriggerContainer ' );
541+ $ retval ['triggers ' ] = NodeFactory::getInstance (NodeTriggerContainer::class );
529542 }
530543
531544 // Add all new Nodes to the tree
@@ -592,23 +605,23 @@ private function addDbContainers(NodeDatabase $db, string $type, int $pos2): arr
592605 $ retval = [];
593606 if (! $ db ->hasChildren ()) {
594607 if (! in_array ('tables ' , $ hidden ) && $ db ->getPresence ('tables ' )) {
595- $ retval ['tables ' ] = NodeFactory::getInstance (' NodeTableContainer ' );
608+ $ retval ['tables ' ] = NodeFactory::getInstance (NodeTableContainer::class );
596609 }
597610
598611 if (! in_array ('views ' , $ hidden ) && $ db ->getPresence ('views ' )) {
599- $ retval ['views ' ] = NodeFactory::getInstance (' NodeViewContainer ' );
612+ $ retval ['views ' ] = NodeFactory::getInstance (NodeViewContainer::class );
600613 }
601614
602615 if (! in_array ('functions ' , $ hidden ) && $ db ->getPresence ('functions ' )) {
603- $ retval ['functions ' ] = NodeFactory::getInstance (' NodeFunctionContainer ' );
616+ $ retval ['functions ' ] = NodeFactory::getInstance (NodeFunctionContainer::class );
604617 }
605618
606619 if (! in_array ('procedures ' , $ hidden ) && $ db ->getPresence ('procedures ' )) {
607- $ retval ['procedures ' ] = NodeFactory::getInstance (' NodeProcedureContainer ' );
620+ $ retval ['procedures ' ] = NodeFactory::getInstance (NodeProcedureContainer::class );
608621 }
609622
610623 if (! in_array ('events ' , $ hidden ) && $ db ->getPresence ('events ' )) {
611- $ retval ['events ' ] = NodeFactory::getInstance (' NodeEventContainer ' );
624+ $ retval ['events ' ] = NodeFactory::getInstance (NodeEventContainer::class );
612625 }
613626
614627 // Add all new Nodes to the tree
@@ -768,12 +781,8 @@ public function groupNode($node): void
768781 continue ;
769782 }
770783
771- $ class = get_class ($ child );
772- $ className = substr ($ class , strrpos ($ class , '\\' ) + 1 );
773- unset($ class );
774- /** @var NodeDatabase $newChild */
775784 $ newChild = NodeFactory::getInstance (
776- $ className ,
785+ get_class ( $ child ) ,
777786 mb_substr (
778787 $ child ->name ,
779788 $ keySeparatorLength
0 commit comments