public function _getController()
 {
     $this->request = new Request();
     $this->response = new Response();
     $this->eventManager = new EventManager();
     Router::parser($this->request->url, $this->request);
 }
Example #2
0
 public function __construct(Request $request, Response $response, EventManager $eventManager)
 {
     $this->request = $request;
     $this->response = $response;
     $this->eventManager = $eventManager;
     Router::request($this->request);
     Router::parser($this->request->url, $this->request);
     $ctrl = $this->loadController($this->request->plugin);
     $action = $this->request->action;
     if ($this->request->prefix) {
         $action = $this->request->prefix . '_' . $action;
     }
     if (!in_array($action, array_diff(get_class_methods($ctrl), get_class_methods('Core\\Controller\\Controller')))) {
         throw new MissingActionException(['plugin' => $this->request->plugin, 'controller' => ucfirst($this->request->controller) . 'Controller', 'action' => $action]);
     }
     call_user_func_array([$ctrl, $action], $this->request->params);
     $this->response->body($ctrl->render($action));
     $this->response->send();
 }