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
28
$this->request = $request;
20
28
}
21
22
28
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
28
if ($this->segment($scope)) return null;
26
27
// At this point if no locale segment is given and if in config the hidden_locale is set,
28
// we assume the locale is hidden.
29
// TODO account for domain specific hidden (default) locales