public function getBodyAsString(): string
    {
        $body = $this->getBody();
        if (is_string($body)) {
            return $body;
        }
        if (null === $body) {
            return '';
        }
        if (is_callable($body)) {
            ob_start();
            $body();

            return ob_get_clean();
        }
        /**
         * @var string|int|null
         */
        $contentLength = $this->getHeader('Content-Length');
        if (is_int($contentLength) || ctype_digit($contentLength)) {
            return stream_get_contents($body, (int) $contentLength);
        }

        return stream_get_contents($body);
    }
public function getBodyAsString(): string
    {
        $body = $this->getBody();
        if (is_string($body)) {
            return $body;
        }
        if (null === $body) {
            return '';
        }
        if (is_callable($body)) {
            ob_start();
            $body();

            return ob_get_clean();
        }
        /**
         * @var string|int|null
         */
        $contentLength = $this->getHeader('Content-Length');
        if (is_int($contentLength) || ctype_digit($contentLength)) {
            return stream_get_contents($body, (int) $contentLength);
        }

        return stream_get_contents($body);
    }
public function getBodyAsString ( ) : string { $ body = $ this -> getBody ( ) ; if ( is_string ( $ body ) ) { return $ body ; } if ( null === $ body ) { return '' ; } if ( is_callable ( $ body ) ) { ob_start ( ) ; $ body ( ) ; return ob_get_clean ( ) ; } /**
         * @var string|int|null
         */ $ contentLength = $ this -> getHeader ( 'Content-Length' ) ; if ( is_int ( $ contentLength ) || ctype_digit ( $ contentLength ) ) { return stream_get_contents ( $ body , ( int ) $ contentLength ) ; } return stream_get_contents ( $ body ) ; }
Returns the body as a string.

Note that because the underlying data may be based on a stream, this
method could only work correctly the first time.
Returns the body as a string .