| Total Complexity | 3 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class ItemExtension extends \Twig_Extension |
||
| 16 | { |
||
| 17 | /** @var NavigationHelper */ |
||
| 18 | private $helper; |
||
| 19 | /** @var ItemContainerInterface */ |
||
| 20 | private $container; |
||
| 21 | /** @var MatcherInterface */ |
||
| 22 | private $matcher; |
||
| 23 | |||
| 24 | public function __construct( |
||
| 32 | } |
||
| 33 | |||
| 34 | public function renderItem( |
||
| 35 | Environment $environment, |
||
| 36 | string $name, |
||
| 37 | string $template = '@EverlutionNavigation/bootstrap_navigation_item.html.twig' |
||
| 38 | ): string { |
||
| 39 | $item = $this->container->get($name); |
||
| 40 | |||
| 41 | return $environment->render( |
||
| 42 | $template, |
||
| 43 | [ |
||
| 44 | 'item' => $item, |
||
| 45 | 'helper' => $this->helper, |
||
| 46 | 'is_active' => $this->matcher->isCurrent($item), |
||
| 47 | ] |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function getFunctions() |
||
| 58 | ), |
||
| 59 | ]; |
||
| 62 |