/** * Get a proper message from the response, or status code. * * @param Response $response * @return string */ protected function getMessage(Response $response) { $message = null; if ($response->hasException()) { $message = $response->getException()->getMessage(); } if (is_string($response->getOriginalContent())) { $message = $response->getOriginalContent(); } if (empty($message)) { $message = strtolower($response->getStatusText()); } return $message; }