[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:
Simon Sessingø
2015-10-18 23:18:58 +02:00
parent b3b362a9e6
commit c1a6c63dc7
3 changed files with 64 additions and 36 deletions
+7 -8
View File
@@ -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() {