PicoFeed\Client\Stream::decodeChunked PHP Метод

decodeChunked() публичный Метод

Decode a chunked body.
public decodeChunked ( string $str ) : string
$str string Raw body
Результат string Decoded body
    public function decodeChunked($str)
    {
        for ($result = ''; !empty($str); $str = trim($str)) {
            // Get the chunk length
            $pos = strpos($str, "\r\n");
            $len = hexdec(substr($str, 0, $pos));
            // Append the chunk to the result
            $result .= substr($str, $pos + 2, $len);
            $str = substr($str, $pos + 2 + $len);
        }
        return $result;
    }