QueryPath\CSS\QueryPathEventHandler::sibling PHP Method

sibling() public method

If two passed in items are siblings of each other, neither will be included in the list of siblings. Their status as being candidates excludes them from being considered siblings.
public sibling ( )
    public function sibling()
    {
        $this->findAnyElement = false;
        // Get the nodes at the same level.
        if ($this->matches->count() > 0) {
            $sibs = new \SplObjectStorage();
            foreach ($this->matches as $item) {
                /*$candidates = $item->parentNode->childNodes;
                  foreach ($candidates as $candidate) {
                    if ($candidate->nodeType === XML_ELEMENT_NODE && $candidate !== $item) {
                      $sibs->attach($candidate);
                    }
                  }
                  */
                while ($item->nextSibling != null) {
                    $item = $item->nextSibling;
                    if ($item->nodeType === XML_ELEMENT_NODE) {
                        $sibs->attach($item);
                    }
                }
            }
            $this->matches = $sibs;
        }
    }