Total Complexity | 5 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
18 | class ItemHelper |
||
19 | { |
||
20 | /** @var TranslatorInterface */ |
||
21 | private $translator; |
||
22 | /** @var UrlProviderContainer */ |
||
23 | private $urlProvider; |
||
24 | |||
25 | public function __construct(TranslatorInterface $translator, UrlProviderContainer $urlProvider) |
||
29 | } |
||
30 | |||
31 | public function getLabel(ItemInterface $item, string $domain = null, string $locale = null): string |
||
32 | { |
||
33 | $label = $item->getLabel(); |
||
34 | $parameters = $label instanceof TranslatableItemLabelInterface ? $label->getParameters() : []; |
||
35 | |||
36 | return $this->translator->trans($label->getValue(), $parameters, $domain, $locale); |
||
37 | } |
||
38 | |||
39 | public function getUrl(ItemInterface $item): string |
||
45 | } |
||
46 | } |
||
48 |