code: protected function handleResponseContent(ResponseInterface $response, $contentType = null)
      {
          $contents = $response->getBody()->getContents();
  
          if (!$contentType) {
              $contentTypeHeaderLine = $response->getHeaderLine('Content-Type');
  
              if (stripos($contentTypeHeaderLine, 'application/json') !== false) {
                  $contentType = 'json';
              } elseif (stripos($contentTypeHeaderLine, 'application/xml') !== false) {
                  $contentType = 'xml';
              }
          }
  
          if ($contentType) {
              return Parser::data($contents)->from($contentType)->toArray();
          }
  
          return $contents;
      }
docs: Handles the body content of a response
  
  @param ResponseInterface $response    Response instance
  @param string|null       $contentType Content Type
  
  @return array|string