public function getTotalSize()
    {
        if (!isset($this->_size)) {
            $size = $this->getSize();
            if (!$this->isLeaf()) {
                foreach ($this->getChildren() as $child) {
                    $size += $child->getTotalSize();
                }
            }
            $this->_size = $size;
        }

        return $this->_size;
    }
public function getTotalSize()
    {
        if (!isset($this->_size)) {
            $size = $this->getSize();
            if (!$this->isLeaf()) {
                foreach ($this->getChildren() as $child) {
                    $size += $child->getTotalSize();
                }
            }
            $this->_size = $size;
        }

        return $this->_size;
    }
public function getTotalSize ( ) { if ( ! isset ( $ this -> _size ) ) { $ size = $ this -> getSize ( ) ; if ( ! $ this -> isLeaf ( ) ) { foreach ( $ this -> getChildren ( ) as $ child ) { $ size += $ child -> getTotalSize ( ) ; } } $ this -> _size = $ size ; } return $ this -> _size ; }
depth first search to get the total number of nodes
that are descendants of this node.
depth first search to get the total number of nodes that are descendants of this node .