Conditions | 6 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
52 | 21 | public function getLocalizedName($name, array $parameters = []) |
|
53 | { |
||
54 | 21 | $defaultLocale = null; |
|
55 | 21 | $contextLocale = $this->context->getParameter('_locale'); |
|
56 | |||
57 | 21 | $locale = isset($parameters['_locale']) ? $parameters['_locale'] : $contextLocale ?: $defaultLocale; |
|
58 | |||
59 | 21 | if (null !== $locale) { |
|
60 | 21 | $localizedName = $name.'.'.$locale; |
|
61 | 21 | if (null !== ($route = $this->routeCollection->get($localizedName)) && $route->getDefault('_canonical_route') === $name) { |
|
62 | 2 | return $localizedName; |
|
63 | } |
||
64 | } |
||
65 | |||
66 | 19 | return null; |
|
67 | } |
||
69 |