Ejemplo n.º 1
0
 /**
  * Handles a not allowed route.
  *
  * @param \Psr\Http\Message\ResponseInterface $response
  * @param array                               $allowed
  *
  * @throws \League\Route\Http\Exception\MethodNotAllowedException if a response cannot be built
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 protected function handleNotAllowed(ResponseInterface $response, array $allowed)
 {
     $exception = new MethodNotAllowedException($allowed);
     if ($this->getStrategy() instanceof JsonStrategy) {
         return $exception->buildJsonResponse($response);
     }
     throw $exception;
 }
Ejemplo n.º 2
0
 public function handleMethodNotAllowed()
 {
     $exception = new MethodNotAllowedException();
     if ($this->getStrategy() instanceof RestfulStrategy) {
         return $exception->getJsonResponse();
     }
     throw $exception;
 }
Ejemplo n.º 3
0
 /**
  * Handles a not allowed route
  *
  * @param  array $allowed
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function handleNotAllowed(array $allowed)
 {
     $exception = new MethodNotAllowedException($allowed);
     if ($this->getStrategy() instanceof RestfulStrategy) {
         return $exception->getJsonResponse();
     }
     throw $exception;
 }