/** * Create a new `Menu` instance. * * @param string $name * @param array $items * @param array $config * @param UrlGenerator $generator * @param Factory $viewFactory */ public function __construct($name, array $items, array $config, UrlGenerator $generator, Factory $viewFactory) { $this->name = $name; $this->config = $config; $this->request = $generator->getRequest(); $this->generator = $generator; $this->viewFactory = $viewFactory; // Has to be done after other dependencies are set $this->items = new Collection($this->createItems($items)); }