public function getHeight()
    {
        if ($this->isLeaf()) {
            return 0;
        }

        $heights = [];

        foreach ($this->getChildren() as $child) {
            $heights[] = $child->getHeight();
        }

        return max($heights) + 1;
    }
public function getHeight()
    {
        if ($this->isLeaf()) {
            return 0;
        }

        $heights = [];

        foreach ($this->getChildren() as $child) {
            $heights[] = $child->getHeight();
        }

        return max($heights) + 1;
    }
public function getHeight ( ) { if ( $ this -> isLeaf ( ) ) { return 0 ; } $ heights = [ ] ; foreach ( $ this -> getChildren ( ) as $ child ) { $ heights [ ] = $ child -> getHeight ( ) ; } return max ( $ heights ) + 1 ; }
Return the height of the tree whose root is this node

@return int
Return the height of the tree whose root is this node