getResponseBodySummary() публичный статический Метод

Will return null if the response is not printable.
public static getResponseBodySummary ( Psr\Http\Message\ResponseInterface $response ) : string | null
$response Psr\Http\Message\ResponseInterface
Результат string | null
Пример #1
1
 /**
  * Get a response summary (useful for exceptions).
  * Use Guzzle method if available (Guzzle 6.1.1+).
  *
  * @param ResponseInterface $response
  *
  * @return string
  */
 public static function getResponseBodySummary(ResponseInterface $response)
 {
     if (method_exists(RequestException::class, 'getResponseBodySummary')) {
         return RequestException::getResponseBodySummary($response);
     }
     $body = \GuzzleHttp\Psr7\copy_to_string($response->getBody());
     if (strlen($body) > 120) {
         return substr($body, 0, 120) . ' (truncated...)';
     }
     return $body;
 }