1 | <?php |
||
15 | class Translator implements TranslatorInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var TranslatorInterface |
||
19 | */ |
||
20 | private $translator; |
||
21 | |||
22 | /** |
||
23 | * @var RequestStack |
||
24 | */ |
||
25 | private $requestStack; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $defaultLocale; |
||
31 | |||
32 | /** |
||
33 | * Translator constructor. |
||
34 | * |
||
35 | * @param TranslatorInterface $translator |
||
36 | * @param RequestStack $requestStack |
||
37 | * @param string $defaultLocale |
||
38 | */ |
||
39 | public function __construct(TranslatorInterface $translator, RequestStack $requestStack, string $defaultLocale) |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public function trans($id, array $parameters = array(), $domain = null, $locale = null): string |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null): string |
||
69 | |||
70 | /** |
||
71 | * @return mixed|string |
||
72 | */ |
||
73 | public function loadCurrentLocale(): string |
||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | * @codeCoverageIgnore |
||
96 | */ |
||
97 | public function setLocale($locale = 'en'): void |
||
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | * @codeCoverageIgnore |
||
105 | */ |
||
106 | public function getLocale(): string |
||
110 | } |
||
111 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: