/** * @param $name * @param Level|null $level * @return Level */ public function addLevel($name, Level $level = null) { if ($level == null) { $level = new Level(); } $this->levels[$name] = $level; $level->setParent($this); return $level; }
/** * @param Level $level * @return string */ public function generateLevelName(Level $level) { return $this->parent->generateLevelName($this) . "[" . array_search($level, $this->levels, TRUE) . "]"; }