/** * 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; }
public function handleMethodNotAllowed() { $exception = new MethodNotAllowedException(); if ($this->getStrategy() instanceof RestfulStrategy) { return $exception->getJsonResponse(); } throw $exception; }
/** * 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; }