phpQueryObject::getElementSiblings PHP Méthode

getElementSiblings() protected méthode

protected getElementSiblings ( $direction, $selector = null, $limitToOne = false )
    protected function getElementSiblings($direction, $selector = null, $limitToOne = false)
    {
        $stack = array();
        $count = 0;
        foreach ($this->stack() as $node) {
            $test = $node;
            while (isset($test->{$direction}) && $test->{$direction}) {
                $test = $test->{$direction};
                if (!$test instanceof DOMELEMENT) {
                    continue;
                }
                $stack[] = $test;
                if ($limitToOne) {
                    break;
                }
            }
        }
        if ($selector) {
            $stackOld = $this->elements;
            $this->elements = $stack;
            $stack = $this->filter($selector, true)->stack();
            $this->elements = $stackOld;
        }
        return $stack;
    }