QueryPath\DOMQuery::setMatches PHP Метод

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

A utility function for setting the current set of matches. It makes sure the last matches buffer is set (for end() and andSelf()).
С версии: 2.0
public setMatches ( $matches, $unique = true )
    public function setMatches($matches, $unique = true)
    {
        // This causes a lot of overhead....
        //if ($unique) $matches = self::unique($matches);
        $this->last = $this->matches;
        // Just set current matches.
        if ($matches instanceof \SplObjectStorage) {
            $this->matches = $matches;
        } elseif (is_array($matches)) {
            trigger_error('Legacy array detected.');
            $tmp = new \SplObjectStorage();
            foreach ($matches as $m) {
                $tmp->attach($m);
            }
            $this->matches = $tmp;
        } else {
            $found = new \SplObjectStorage();
            if (isset($matches)) {
                $found->attach($matches);
            }
            $this->matches = $found;
        }
        // EXPERIMENTAL: Support for qp()->length.
        $this->length = $this->matches->count();
    }