src/Recursivity/Tree/Node.php
private function getSibling($offset)
    {
        $siblingsAndSelf = $this->parent->getChildren();
        $pos             = array_search($this, $siblingsAndSelf);
        if (isset($siblingsAndSelf[$pos + $offset])) {
            return $siblingsAndSelf[$pos + $offset]; // Next / prev. node
        }
        return null;
    }
private function getSibling($offset)
    {
        $siblingsAndSelf = $this->parent->getChildren();
        $pos             = array_search($this, $siblingsAndSelf);
        if (isset($siblingsAndSelf[$pos + $offset])) {
            return $siblingsAndSelf[$pos + $offset]; // Next / prev. node
        }
        return null;
    }
private function getSibling ( $ offset ) { $ siblingsAndSelf = $ this -> parent -> getChildren ( ) ; $ pos = array_search ( $ this , $ siblingsAndSelf ) ; if ( isset ( $ siblingsAndSelf [ $ pos + $ offset ] ) ) { return $ siblingsAndSelf [ $ pos + $ offset ] ; // Next / prev. node } return null ; }
Returns the sibling with the given offset from this node,
or NULL if there is no such sibling

@param int $offset If 1, the next node is returned, if -1, then
the previous one. Can be called with arbitrary
values, too, if desired.

@return Node|null
Returns the sibling with the given offset from this node or NULL if there is no such sibling