mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
[BUGFIX] Optimised getRoute for custom urls.
This commit is contained in:
@@ -253,7 +253,7 @@ class RouterBase {
|
|||||||
throw new \InvalidArgumentException('Invalid type for getParams. Must be array or null');
|
throw new \InvalidArgumentException('Invalid type for getParams. Must be array or null');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($controller === null && $parameters === null && $this->loadedRoute !== null) {
|
if($controller === null && $parameters === null) {
|
||||||
return $this->processUrl($this->loadedRoute, null, $getParams);
|
return $this->processUrl($this->loadedRoute, null, $getParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ class RouterBase {
|
|||||||
$method = $tmp[1];
|
$method = $tmp[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($controller === $c && $route !== null) {
|
if($controller === $c) {
|
||||||
return $this->processUrl($route, $method, $parameters, $getParams);
|
return $this->processUrl($route, $method, $parameters, $getParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -307,7 +307,13 @@ class RouterBase {
|
|||||||
ArrayUtil::append($url, $parameters);
|
ArrayUtil::append($url, $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '/' . join('/', $url);
|
$url = '/' . trim(join('/', $url), '/') . '/';
|
||||||
|
|
||||||
|
if(is_array($getParams)) {
|
||||||
|
$url .= '?' . Url::arrayToParams($getParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getInstance() {
|
public static function getInstance() {
|
||||||
|
|||||||
Reference in New Issue
Block a user