src/SapiServer.php
protected function serveBody(ResponseInterface $response, $compression = null)
    {
        $body = $response->getBody();
        $body->rewind();
        $out = fopen('php://output', 'wb');
        if ($compression == 'bzip2') {
            fwrite($out, bzcompress($body->getContents()));
        } elseif ($compression == 'gzip') {
            fwrite($out, gzencode($body->getContents()));
        } else {
            while (! $body->eof()) {
                fwrite($out, $body->read(8192));
            }
        }
        fclose($out);
        $body->close();
    }
protected function serveBody(ResponseInterface $response, $compression = null)
    {
        $body = $response->getBody();
        $body->rewind();
        $out = fopen('php://output', 'wb');
        if ($compression == 'bzip2') {
            fwrite($out, bzcompress($body->getContents()));
        } elseif ($compression == 'gzip') {
            fwrite($out, gzencode($body->getContents()));
        } else {
            while (! $body->eof()) {
                fwrite($out, $body->read(8192));
            }
        }
        fclose($out);
        $body->close();
    }
protected function serveBody ( ResponseInterface $ response , $ compression = null ) { $ body = $ response -> getBody ( ) ; $ body -> rewind ( ) ; $ out = fopen ( 'php://output' , 'wb' ) ; if ( $ compression == 'bzip2' ) { fwrite ( $ out , bzcompress ( $ body -> getContents ( ) ) ) ; } elseif ( $ compression == 'gzip' ) { fwrite ( $ out , gzencode ( $ body -> getContents ( ) ) ) ; } else { while ( ! $ body -> eof ( ) ) { fwrite ( $ out , $ body -> read ( 8192 ) ) ; } } fclose ( $ out ) ; $ body -> close ( ) ; }
Output the response body.

@param ResponseInterface $response The response.
@param string $compression Compression to use: 'bzip2' or 'gzip'.
Output the response body .