public static function encodeBody($body, $encode = 'gzip')
    {
        switch ($encode) {
            // GZIP compression
            case 'gzip':
                if (!function_exists('gzencode')) {
                    throw new \Exception('Gzip compression is not available.');
                }
                $encodedBody = gzencode($body);
                break;

            // Deflate compression
            case 'deflate':
                if (!function_exists('gzdeflate')) {
                    throw new \Exception('Deflate compression is not available.');
                }
                $encodedBody = gzdeflate($body);
                break;

            // Unknown compression
            default:
                $encodedBody = $body;

        }

        return $encodedBody;
    }
public static function encodeBody($body, $encode = 'gzip')
    {
        switch ($encode) {
            // GZIP compression
            case 'gzip':
                if (!function_exists('gzencode')) {
                    throw new \Exception('Gzip compression is not available.');
                }
                $encodedBody = gzencode($body);
                break;

            // Deflate compression
            case 'deflate':
                if (!function_exists('gzdeflate')) {
                    throw new \Exception('Deflate compression is not available.');
                }
                $encodedBody = gzdeflate($body);
                break;

            // Unknown compression
            default:
                $encodedBody = $body;

        }

        return $encodedBody;
    }
public static function encodeBody ( $ body , $ encode = 'gzip' ) { switch ( $ encode ) { // GZIP compression case 'gzip' : if ( ! function_exists ( 'gzencode' ) ) { throw new \ Exception ( 'Gzip compression is not available.' ) ; } $ encodedBody = gzencode ( $ body ) ; break ; // Deflate compression case 'deflate' : if ( ! function_exists ( 'gzdeflate' ) ) { throw new \ Exception ( 'Deflate compression is not available.' ) ; } $ encodedBody = gzdeflate ( $ body ) ; break ; // Unknown compression default : $ encodedBody = $ body ; } return $ encodedBody ; }
Encode the body data.

@param (mixed)  $body
@param (string) $encode

@since 3.0.0

@return string
Encode the body data .