public static function throwIfError(ResponseInterface $response, $expected)
    {
        $expectedStatusCodes = is_array($expected) ? $expected : array($expected);

        if (!in_array($response->getStatusCode(), $expectedStatusCodes)) {
            throw new ServiceException($response);
        }
    }
public static function throwIfError(ResponseInterface $response, $expected)
    {
        $expectedStatusCodes = is_array($expected) ? $expected : array($expected);

        if (!in_array($response->getStatusCode(), $expectedStatusCodes)) {
            throw new ServiceException($response);
        }
    }
public static function throwIfError ( ResponseInterface $ response , $ expected ) { $ expectedStatusCodes = is_array ( $ expected ) ? $ expected : array ( $ expected ) ; if ( ! in_array ( $ response -> getStatusCode ( ) , $ expectedStatusCodes ) ) { throw new ServiceException ( $ response ) ; } }
Throws ServiceException if the received status code is not expected.

@param ResponseInterface $response The response received
@param array|int         $expected The expected status codes.

@return void

@throws ServiceException
Throws ServiceException if the received status code is not expected .