@@ -27,7 +27,7 @@ public function __construct() {
27
27
$ this ->routes = array ();
28
28
$ this ->backstack = array ();
29
29
$ this ->controllerUrlMap = array ();
30
- $ this ->request = new Request ();
30
+ $ this ->request = Request:: getInstance ();
31
31
$ this ->baseCsrfVerifier = new BaseCsrfVerifier ();
32
32
}
33
33
@@ -253,7 +253,7 @@ public function getRoute($controller = null, $parameters = null, $getParams = nu
253
253
throw new \InvalidArgumentException ('Invalid type for getParams. Must be array or null ' );
254
254
}
255
255
256
- if ($ controller === null && $ parameters === null && $ this -> loadedRoute !== null ) {
256
+ if ($ controller === null && $ parameters === null ) {
257
257
return $ this ->processUrl ($ this ->loadedRoute , null , $ getParams );
258
258
}
259
259
@@ -295,7 +295,7 @@ public function getRoute($controller = null, $parameters = null, $getParams = nu
295
295
$ method = $ tmp [1 ];
296
296
}
297
297
298
- if ($ controller === $ c && $ route !== null ) {
298
+ if ($ controller === $ c ) {
299
299
return $ this ->processUrl ($ route , $ method , $ parameters , $ getParams );
300
300
}
301
301
}
@@ -307,7 +307,13 @@ public function getRoute($controller = null, $parameters = null, $getParams = nu
307
307
ArrayUtil::append ($ url , $ parameters );
308
308
}
309
309
310
- return '/ ' . join ('/ ' , $ url );
310
+ $ url = '/ ' . trim (join ('/ ' , $ url ), '/ ' ) . '/ ' ;
311
+
312
+ if (is_array ($ getParams )) {
313
+ $ url .= '? ' . Url::arrayToParams ($ getParams );
314
+ }
315
+
316
+ return $ url ;
311
317
}
312
318
313
319
public static function getInstance () {
0 commit comments