Habari\SocketRequestProcessor::gzdecode PHP Метод

gzdecode() приватный Метод

private gzdecode ( $body )
    private function gzdecode($body)
    {
        // create the temp file to write to
        $tmp = tempnam(FILE_CACHE_LOCATION, 'RRS');
        if (!$tmp) {
            throw new \Exception(_t('Socket Error. Unable to create temporary file name.'));
        }
        $result = file_put_contents($tmp, $body);
        if ($result === false) {
            throw new \Exception(_t('Socket Error. Unable to write to temporary file.'));
        }
        // before we read it back in, try to free up as much memory as possible
        unset($body);
        $zp = gzopen($tmp, 'rb');
        $body = '';
        while (!gzeof($zp)) {
            $body .= gzread($zp, 1024);
        }
        gzclose($zp);
        // clean up the temp file
        if (file_exists($tmp)) {
            unlink($tmp);
        }
        return $body;
    }