Aerys\HPack::huffman_decode PHP Method

huffman_decode() public static method

public static huffman_decode ( $input )
    public static function huffman_decode($input)
    {
        $lookup = self::$huffman_lookup;
        $len = \strlen($input);
        $out = str_repeat("", $len / 5 * 8 + 1);
        // max length
        for ($off = $i = 0; $i < $len; $i++) {
            list($lookup, $chr) = $lookup[$input[$i]];
            if ($chr != null) {
                $out[$off++] = $chr;
                if (isset($chr[1])) {
                    $out[$off++] = $chr[1];
                    continue;
                }
                continue;
            }
            if ($chr === "") {
                return null;
            }
        }
        return substr($out, 0, $off);
    }