mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
Added default null parameter value to RouterController and RouterResource
This commit is contained in:
@@ -22,13 +22,11 @@ abstract class LoadableRoute extends RouterEntry implements ILoadableRoute {
|
|||||||
$this->url = '/' . trim($url, '/') . '/';
|
$this->url = '/' . trim($url, '/') . '/';
|
||||||
|
|
||||||
if(preg_match_all('/' . static::PARAMETERS_REGEX_MATCH . '/is', $this->url, $matches)) {
|
if(preg_match_all('/' . static::PARAMETERS_REGEX_MATCH . '/is', $this->url, $matches)) {
|
||||||
|
|
||||||
if (count($matches[1])) {
|
if (count($matches[1])) {
|
||||||
foreach (array_keys($matches[1]) as $key) {
|
foreach ($matches[1] as $key) {
|
||||||
$this->parameters[$key] = null;
|
$this->parameters[$key] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class RouterController extends LoadableRoute implements IControllerRoute {
|
|||||||
protected $method;
|
protected $method;
|
||||||
|
|
||||||
public function __construct($url, $controller) {
|
public function __construct($url, $controller) {
|
||||||
$this->url = $url;
|
$this->setUrl($url);
|
||||||
$this->controller = $controller;
|
$this->controller = $controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class RouterResource extends LoadableRoute implements IControllerRoute {
|
|||||||
protected $controller;
|
protected $controller;
|
||||||
|
|
||||||
public function __construct($url, $controller) {
|
public function __construct($url, $controller) {
|
||||||
$this->url = $url;
|
$this->setUrl($url);
|
||||||
$this->controller = $controller;
|
$this->controller = $controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user