protected function hasChildren(&$nodes) { $hasChildren = false; foreach ($nodes as $node) { if (count($node) != 0) { return true; } } return $hasChildren; }