/** * BaseController constructor. * @param Application $application */ public function __construct(Application $application) { $this->application = $application; $this->setPathBound($application->basePath()); $this->router = $application->getRouter(); $this->request = $application->getRequest(); $this->POST = $this->request->POST(); $this->GET = $this->request->GET(); $this->method = $this->request->getHttpMethod(); $this->baseInit(); }
/** * Parse Request to get Matching Route * * @param RequestInterface $request * @return mixed|null * @throws PageNotFoundException */ public function parse(RequestInterface $request) { //$this->request = $request; $method = $request->getHttpMethod(); $routes = $this->getRoutes($method); $route = $this->findRoute($routes, $request); $this->setCurrentRoute($route); return $route; }