This commit is contained in:
Simon Sessingø
2016-11-17 03:17:11 +01:00
parent 75566dc2ba
commit b5f8d9410f
7 changed files with 201 additions and 225 deletions
+2 -20
View File
@@ -4,11 +4,10 @@ namespace Pecee\SimpleRouter;
use Pecee\Exception\RouterException;
use Pecee\Http\Request;
class RouterController extends RouterEntry implements ILoadableRoute, IControllerRoute {
class RouterController extends LoadableRoute implements IControllerRoute {
const DEFAULT_METHOD = 'index';
protected $url;
protected $controller;
protected $method;
@@ -18,7 +17,7 @@ class RouterController extends RouterEntry implements ILoadableRoute, IControlle
}
public function renderRoute(Request $request) {
if(is_object($this->getCallback()) && is_callable($this->getCallback())) {
if($this->getCallback() !== null && is_callable($this->getCallback())) {
// When the callback is a function
call_user_func_array($this->getCallback(), $this->getParameters());
@@ -69,23 +68,6 @@ class RouterController extends RouterEntry implements ILoadableRoute, IControlle
return null;
}
/**
* @return string
*/
public function getUrl() {
return $this->url;
}
/**
* @param string $url
* @return static
*/
public function setUrl($url) {
$url = rtrim($url, '/') . '/';
$this->url = $url;
return $this;
}
/**
* @return string
*/