fixed router typos

This commit is contained in:
Nick Yeoman 2024-09-16 06:54:02 -07:00
parent b858af3b55
commit 77b60d34f6

View File

@ -7,12 +7,13 @@ class Router {
public $controller; public $controller;
public $controllerPath; public $controllerPath;
public $parameters = []; public $parameters = [];
public $requestType = 'get';
public function __construct() { public function __construct() {
$this->routes = $this->loadRoutes(); $this->routes = $this->loadRoutes();
$this->path = $this->preparePath(); $this->path = $this->preparePath();
$this->query = $this->prepareQuery(); $this->query = $this->prepareQuery();
$this->request = $this->getRequestType(); $this->requestType = $this->getRequestType();
$this->controller = $this->findController(); $this->controller = $this->findController();
$this->controllerPath = $this->setRouteFile(); $this->controllerPath = $this->setRouteFile();
} }
@ -61,7 +62,7 @@ class Router {
// one to one match // one to one match
if (array_key_exists($this->path, $this->routes)) { if (array_key_exists($this->path, $this->routes)) {
return $this->routes[$this->path][$this->request]; return $this->routes[$this->path][$this->requestType];
} }
foreach ($this->routes as $key => $value) { foreach ($this->routes as $key => $value) {