[TASK] Updates

This commit is contained in:
Simon Sessingø
2015-09-18 19:55:17 +02:00
parent d4f0046283
commit 05a89c368d
3 changed files with 6 additions and 12 deletions

View File

@@ -9,10 +9,16 @@
namespace Pecee;
use Pecee\Router\RouterGroup;
use Pecee\Router\RouterRoute;
use Pecee\Router\SimpleRouter;
class Router {
public static function init() {
SimpleRouter::GetInstance()->routeRequest();
}
public static function get($url, $callback) {
$route = new RouterRoute($url, $callback);
$route->addRequestType(RouterRoute::REQUEST_TYPE_GET);

View File

@@ -15,9 +15,6 @@ class RouterRoute extends RouterEntry {
$this->callback = $callback;
$this->settings['aliases'] = array();
// Set default namespace
$this->namespace = Registry::GetInstance()->get(SimpleRouter::SETTINGS_APPNAME, false) . '\\' . 'Controller';
}
public function getRoute($requestMethod, &$url) {

View File

@@ -3,8 +3,6 @@ namespace Pecee\Router;
class SimpleRouter {
const SETTINGS_APPNAME = 'AppName';
protected static $instance;
protected $currentRoute;
@@ -13,15 +11,8 @@ class SimpleRouter {
protected $requestUri;
protected $requestMethod;
protected $loadedClass;
protected $appName;
public function __construct() {
$this->appName = Registry::GetInstance()->get(self::SETTINGS_APPNAME, false);
if (!$this->appName) {
throw new RouterException('"AppName" registry key not defined!', 2);
}
$this->routes = array();
$this->backstack = array();
$this->requestUri = rtrim($_SERVER['REQUEST_URI'], '/');