public function dispatch()
 {
     if ($this->router == null) {
         throw new \Exception('No valid router found.', 500);
     }
     $uri = $this->router->getURI();
     $input = InputData::getInstance();
     if ($this->parseCustomRoute($input, $uri)) {
         return;
     }
     $params = explode('/', $uri);
     $this->controller = array_shift($params);
     if (!$this->controller) {
         $this->controller = $this->getDefaultController();
         $this->method = $this->getDefaultMethod();
     } else {
         $this->method = array_shift($params);
         if (!$this->method) {
             $this->method = $this->getDefaultMethod();
         }
         $input->setGet($params);
     }
     $this->namespace = $this->config->app['defaultControllerNamespace'];
     $input->setPost($this->router->getPost());
     $this->loadControllerAction();
 }
 public function __construct()
 {
     $this->app = \PFCS\FMK\App::getInstance();
     $this->view = \PFCS\FMK\View::getInstance();
     $this->config = \PFCS\FMK\Config::getInstance();
     $this->input = \PFCS\FMK\InputData::getInstance();
     //        $this->session = $this->app->getSession(); we need Http Context maybe :P
     //        View::logged((bool)$this->session->userId);
     //        View::role($this->session->user['role']);
 }