Example #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;
 }