Ejemplo n.º 1
0
 private function compare($uri)
 {
     $this->uri = $uri;
     $this->uri = trim($this->uri, "/");
     $this->params = explode(",", $this->uri);
     $this->params = array_shift($this->params);
     if (array_key_exists($this->uri, Config::get("valid_requests"))) {
         if (array_key_exists('middleware', Config::get("valid_requests")[$this->uri])) {
             foreach (Config::get("valid_requests")[$this->uri]['middleware'] as $middleware) {
                 Middleware::run($middleware);
             }
         }
         $this->controller = $this->declareController(Config::get("valid_requests")[$this->uri]['controller']);
         $this->method = Config::get("valid_requests")[$this->uri]['method'];
     } else {
         #print_r(Config::get("default_request")["not_found"]);
         $this->controller = $this->declareController(Config::get("default_request")["not_found"]['controller']);
         $this->method = Config::get("default_request")["not_found"]['method'];
     }
 }