/** * Render a list item * * @param Item $item * * @return string */ protected function renderItem(Item $item) { $template = '<li class="%s"><a href="%s">%s</a></li>'; $value = null === $this->getTranslator() ? $item->value() : $this->getTranslator()->translate($item->value()); if (in_array(WithIcon::class, class_uses($item))) { /** @var WithIcon $item */ $value = sprintf('<i class="%s"></i> <span>%s</span>', $item->icon(), $value); } return vsprintf($template, [$this->getResolver()->match($item) ? 'active' : '', $item instanceof Link ? $this->getResolver()->getUrl($item->destination(), $item->params()) : '#', $value]); }