Symfony\Component\Debug\Exception\FlattenException::setStatusCode PHP Метод

setStatusCode() публичный Метод

public setStatusCode ( $code )
    public function setStatusCode($code)
    {
        $this->statusCode = $code;
    }

Usage Example

Пример #1
0
 /**
  * Converts a {@see \Symfony\Component\Debug\Exception\FlattenException}
  * to a {@see \Dunglas\ApiBundle\JsonLd\Response}.
  *
  * @param FlattenException $exception
  *
  * @return Response
  */
 public function __invoke(FlattenException $exception)
 {
     $exceptionClass = $exception->getClass();
     if (is_a($exceptionClass, ExceptionInterface::class, true) || is_a($exceptionClass, InvalidArgumentException::class, true)) {
         $exception->setStatusCode(Response::HTTP_BAD_REQUEST);
     }
     return new Response($this->normalizer->normalize($exception, 'hydra-error'), $exception->getStatusCode(), $exception->getHeaders());
 }
All Usage Examples Of Symfony\Component\Debug\Exception\FlattenException::setStatusCode