mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
[FEATURE/BUGFIX] Improvements
- Added match method to match specific regular expression. - GetRoute now returns provided controller and method if no match is found. - Bugfixes and other minor improvements.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Pecee\SimpleRouter;
|
||||
|
||||
use Pecee\ArrayUtil;
|
||||
use Pecee\Http\Request;
|
||||
use Pecee\Url;
|
||||
|
||||
@@ -245,15 +246,13 @@ class RouterBase {
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing found - return current route
|
||||
if($this->loadedRoute) {
|
||||
$getParams = ($getParams === null) ? array() : $getParams;
|
||||
$params = ($this->loadedRoute->getParameters() == null) ? array() : $this->loadedRoute->getParameters();
|
||||
$parameters = ($parameters === null) ? array() : $parameters;
|
||||
return $this->processUrl($this->loadedRoute, null, array_merge($params, $parameters), array_merge($_GET, $getParams));
|
||||
}
|
||||
$controller = ($controller === null) ? '/' : $controller;
|
||||
$url = array($controller);
|
||||
|
||||
return '/';
|
||||
if(is_array($parameters)) {
|
||||
ArrayUtil::append($url, $parameters);
|
||||
}
|
||||
return join('/', $url);
|
||||
}
|
||||
|
||||
public static function getInstance() {
|
||||
|
||||
Reference in New Issue
Block a user