Added default null parameter value to RouterController and RouterResource

This commit is contained in:
Simon Sessingø
2016-11-17 15:03:18 +01:00
parent 2db0601e20
commit eb160ff7bb
3 changed files with 3 additions and 5 deletions
+1 -3
View File
@@ -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;
+1 -1
View File
@@ -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;
} }
+1 -1
View File
@@ -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;
} }