Пример #1
0
 /**
  * Retorna o objeto Request 
  * @return Request
  */
 public function getRequest()
 {
     if (is_null($this->request)) {
         $this->request = Request::createFromGlobals();
     }
     return $this->request;
 }
Пример #2
0
 private function __construct($routes)
 {
     $this->routeCollection = $routes;
     $this->request = Request::createFromGlobals();
     $this->requestContext = new RequestContext();
     $this->matcher = new UrlMatcher($routes, $this->requestContext->fromRequest($this->getRequest()));
     $this->dispatcher = new Dispatcher();
     $this->dispatcher->addSubscriber(new RouterListener($this->matcher, new RequestStack()));
     $this->dispatcher->addSubscriber(new KernelExceptionListener());
     $this->dispatcher->addSubscriber(new ResponseListener('UTF-8'));
 }