src/Node/Node.php
public function getParent(string $id = null)
    {
        if (!$this->_parents || ($id !== null && !isset($this->_parents[$id]))) {
            return null;
        }

        return $id !== null ?
            $this->_parents[$id] :
            $this->_parents[array_rand($this->_parents)];
    }
public function getParent(string $id = null)
    {
        if (!$this->_parents || ($id !== null && !isset($this->_parents[$id]))) {
            return null;
        }

        return $id !== null ?
            $this->_parents[$id] :
            $this->_parents[array_rand($this->_parents)];
    }
public function getParent ( string $ id = null ) { if ( ! $ this -> _parents || ( $ id !== null && ! isset ( $ this -> _parents [ $ id ] ) ) ) { return null ; } return $ id !== null ? $ this -> _parents [ $ id ] : $ this -> _parents [ array_rand ( $ this -> _parents ) ] ; }
Returns the value of field _parent.

@param string|null $id - Parent ID.

@return NodeInterface|null
Returns the value of field _parent .