You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
18
{
19
72
$this->request = $request;
20
72
}
21
22
72
public function get(Scope $scope, Config $config): ?Locale
23
{
24
// If a locale segment is found, it means locale is not hidden so we won't bother going further.
25
72
if ($this->segment($scope)) {
26
13
return null;
27
}
28
29
// At this point if no locale segment is given and if in config the hidden_locale is set,
30
// we assume the locale is hidden.
31
// TODO account for domain specific hidden (default) locales