mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-16 02:30:09 +03:00
[TASK] Updates
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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'], '/');
|
||||
|
||||
Reference in New Issue
Block a user