public function nodeCount(): int
    {
        $c = 1;
        foreach ($this->_children as $child) {
            $c += $child->nodeCount();
        }
        return $c;
    }
public function nodeCount(): int
    {
        $c = 1;
        foreach ($this->_children as $child) {
            $c += $child->nodeCount();
        }
        return $c;
    }
public function nodeCount ( ) : int { $ c = 1 ; foreach ( $ this -> _children as $ child ) { $ c += $ child -> nodeCount ( ) ; } return $ c ; }
Get the total number of nodes in a tree.

@return int
Get the total number of nodes in a tree .