/**
 * Returns the number of items.
 *
 * @param   boolean  $recursive  If false number of children, if true number of descendants
 *
 * @return  integer  Number of children or descendants
 *
 * @since   1.6
 */
public function getNumItems($recursive = false)
{
    if ($recursive) {
        $count = $this->numitems;
        foreach ($this->getChildren() as $child) {
            $count = $count + $child->getNumItems(true);
        }
        return $count;
    }
    return $this->numitems;
}