/** * MenuItem constructor. */ public function __construct($id) { $this->id = $id; if (is_null(static::$current)) { static::$current = $this; $this->level(0); } else { static::$current->addItem($this); $this->level(static::$current->level() + 1); } }
public function addItem(MenuItem $item) { parent::addItem($item); $this->more_url[] = $item->url; }