Ejemplo n.º 1
0
 public function _getController()
 {
     $this->request = new Request();
     $this->response = new Response();
     $this->eventManager = new EventManager();
     Router::parser($this->request->url, $this->request);
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
0
 /**
  * Crée une url
  **/
 public function url($route, $args = [])
 {
     return Router::url($route, $args);
 }
Ejemplo n.º 4
0
 public function redirect($url, $args, $code = null)
 {
     if ($code) {
         $this->errorCode($code);
     }
     header('Location: ' . Router::url($url, $args));
     die;
 }