public static function create(CloseIoResponse $response): self
    {
        switch ($response->getHttpStatusCode()) {
            case StatusCodeInterface::STATUS_UNAUTHORIZED:
                return new CloseIoAuthenticationException($response);
            case StatusCodeInterface::STATUS_TOO_MANY_REQUESTS:
                return new CloseIoThrottleException($response);
            case StatusCodeInterface::STATUS_NOT_FOUND:
                return new CloseIoResourceNotFoundException($response);
            case StatusCodeInterface::STATUS_BAD_REQUEST:
                return new CloseIoBadRequestException($response);
            default:
                return new static($response);
        }
    }
public static function create(CloseIoResponse $response): self
    {
        switch ($response->getHttpStatusCode()) {
            case StatusCodeInterface::STATUS_UNAUTHORIZED:
                return new CloseIoAuthenticationException($response);
            case StatusCodeInterface::STATUS_TOO_MANY_REQUESTS:
                return new CloseIoThrottleException($response);
            case StatusCodeInterface::STATUS_NOT_FOUND:
                return new CloseIoResourceNotFoundException($response);
            case StatusCodeInterface::STATUS_BAD_REQUEST:
                return new CloseIoBadRequestException($response);
            default:
                return new static($response);
        }
    }
public static function create ( CloseIoResponse $ response ) : self { switch ( $ response -> getHttpStatusCode ( ) ) { case StatusCodeInterface :: STATUS_UNAUTHORIZED : return new CloseIoAuthenticationException ( $ response ) ; case StatusCodeInterface :: STATUS_TOO_MANY_REQUESTS : return new CloseIoThrottleException ( $ response ) ; case StatusCodeInterface :: STATUS_NOT_FOUND : return new CloseIoResourceNotFoundException ( $ response ) ; case StatusCodeInterface :: STATUS_BAD_REQUEST : return new CloseIoBadRequestException ( $ response ) ; default : return new static ( $ response ) ; } }
A factory method for creating the appropriate exception based on the
response from Close.io.

@param CloseIoResponse $response The response that threw the exception

@return self
A factory method for creating the appropriate exception based on the response from Close . io .