public function hasChildren($count_empty_containers = true) { $retval = false; if ($count_empty_containers) { if (count($this->children)) { $retval = true; } } else { foreach ($this->children as $child) { if ($child->type == Node::OBJECT || $child->hasChildren(false)) { $retval = true; break; } } } return $retval; }