private function responseResolver(Response $response, $ch) { if ($response->isOK()) { return $response; } if ($response->isBadRequest()) { throw new ValidationException(HttpHelper::fromJson($response->getContent())); } throw new ConnectionException(HttpHelper::fromJson($response->getContent()), curl_error($ch)); }