Exemplo n.º 1
0
 public function build(Request $request)
 {
     foreach ($this->paths as $pattern => $path) {
         $matcher = new PathMatcher($pattern);
         if ($matcher->match($request->path())) {
             $this->path = $path;
             $this->parameters = $matcher->getParameters();
             if (property_exists($path, 'action')) {
                 $this->setAction($this->classname($path->action));
             }
             if (property_exists($path, 'view')) {
                 $this->setView($this->classname($path->view));
             }
             return $this;
         }
     }
     throw new ResourceNotFoundException();
 }
Exemplo n.º 2
0
 private function handleException(Exception $e, Request $request)
 {
     $context = new Context($request->server());
     $context->set('uri', $request->path()->value())->set('message', $e->getMessage())->set('code', HttpError::code($e));
     $this->dispatch(new HttpErrorViewAction(), $context);
 }