File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -121,15 +121,13 @@ public static function getInstance($client, $options = [])
121121 // Create a Router object
122122 $ classname = 'JRouter ' . ucfirst ($ client );
123123
124- if (!class_exists ($ classname )) {
125- throw new \RuntimeException (Text::sprintf ('JLIB_APPLICATION_ERROR_ROUTER_LOAD ' , $ client ), 500 );
126- }
127-
128- // Check for a possible service from the container otherwise manually instantiate the class
124+ // Check for a possible service from the container, otherwise manually instantiate the class if it exists
129125 if (Factory::getContainer ()->has ($ classname )) {
130126 self ::$ instances [$ client ] = Factory::getContainer ()->get ($ classname );
131- } else {
127+ } elseif ( class_exists ( $ classname )) {
132128 self ::$ instances [$ client ] = new $ classname ();
129+ } else {
130+ throw new \RuntimeException (Text::sprintf ('JLIB_APPLICATION_ERROR_ROUTER_LOAD ' , $ client ), 500 );
133131 }
134132 }
135133
You can’t perform that action at this time.
0 commit comments