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 | * @return string |
||
60 | */ |
||
61 | public function loadCurrentLocale(): string |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | * @codeCoverageIgnore |
||
84 | */ |
||
85 | public function setLocale($locale = 'en'): void |
||
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | * @codeCoverageIgnore |
||
93 | */ |
||
94 | public function getLocale(): string |
||
98 | } |
||
99 |
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: