MIME::bufMatchlet PHP Méthode

bufMatchlet() protected méthode

protected bufMatchlet ( &$buf, $pos )
    protected function bufMatchlet(&$buf, $pos)
    {
        list($off, $range, $word_size, $len, $value_off, $mask_off, $n_child, $child_off) = $this->nuint32_at($pos, 8);
        $range = min($range, strlen($buf) - $len - $off + 1);
        if ($range <= 0) {
            return FALSE;
        }
        $value = array_map('ord', str_split($this->substr($value_off, $len)));
        if ($mask_off) {
            $mask = array_map('ord', str_split($this->substr($mask_off, $len)));
        } else {
            $mask = NULL;
        }
        assert($len % $word_size == 0);
        if ($word_size > 1) {
            self::byteswap($value, $word_size);
            if ($mask) {
                self::byteswap($mask, $word_size);
            }
        }
        for ($start = $off; $start < $off + $range; $start++) {
            for ($i = 0; $i < $len; $i++) {
                $c = ord($buf[$start + $i]);
                if ($mask) {
                    $c &= $mask[$i];
                }
                if ($c != $value[$i]) {
                    continue 2;
                }
            }
            return $this->bufMatchlets($buf, $child_off, $n_child);
        }
        return FALSE;
    }