Exemple #1
0
 /**
  * Handle a not found route.
  *
  * @param \Psr\Http\Message\ResponseInterface $response
  *
  * @throws \League\Route\Http\Exception\NotFoundException if a response cannot be built
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 protected function handleNotFound(ResponseInterface $response)
 {
     $exception = new NotFoundException();
     if ($this->getStrategy() instanceof JsonStrategy) {
         return $exception->buildJsonResponse($response);
     }
     throw $exception;
 }
Exemple #2
0
 public function handleRouteNotFound()
 {
     // @todo add route not found view
     $exception = new NotFoundException();
     if ($this->getStrategy() instanceof RestfulStrategy) {
         return $exception->getJsonResponse();
     }
     throw $exception;
 }
Exemple #3
0
 /**
  * Handle a not found route
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function handleNotFound()
 {
     $exception = new NotFoundException();
     if ($this->getStrategy() instanceof RestfulStrategy) {
         return $exception->getJsonResponse();
     }
     throw $exception;
 }