1 | <?php |
||
10 | class LanguageResolver |
||
11 | { |
||
12 | private $configLanguages; |
||
13 | private $useAlwaysAvailable; |
||
14 | private $contextLanguage; |
||
15 | |||
16 | public function __construct(array $configLanguages, $useAlwaysAvailable = null) |
||
21 | |||
22 | /** |
||
23 | * For use by event listening to config resolver scope changes (or other event changing configured languages) |
||
24 | * |
||
25 | * @param array $configLanguages |
||
26 | */ |
||
27 | public function setConfigLanguages(array $configLanguages) |
||
31 | |||
32 | /** |
||
33 | * For use by custom events / logic setting language for all retrieved objects from repository. |
||
34 | * |
||
35 | * User language will, if set, will have prepended before configured languages. But in cases PHP API consumer |
||
36 | * specifies languages to retrieve repository objects in it will instead be appended as a fallback. |
||
37 | * |
||
38 | * @param string|null $contextLanguage |
||
39 | */ |
||
40 | public function setContextLanguage($contextLanguage) |
||
44 | |||
45 | /** |
||
46 | * Get prioritized languages taking into account argument, config and context languages. |
||
47 | * |
||
48 | * |
||
49 | * @param array|null $forcedLanguages Optional, if not empty will be used instead of configured languages, typically |
||
50 | * arguments provided to API. |
||
51 | * |
||
52 | * @return array |
||
53 | */ |
||
54 | public function getPrioritizedLanguages(array $forcedLanguages = null) |
||
74 | |||
75 | /** |
||
76 | * For use by event listening to config resolver scope changes (or other event changing configured languages). |
||
77 | * |
||
78 | * By default this is not set and hence default in API will be used instead. |
||
79 | * |
||
80 | * @param bool $useAlwaysAvailable |
||
81 | */ |
||
82 | public function setUseAlwaysAvailable($useAlwaysAvailable) |
||
86 | |||
87 | /** |
||
88 | * Get currently set UseAlwaysAvailable. |
||
89 | * |
||
90 | * @param bool|null $forcedUseAlwaysAvailable Optional, if set will be used instead of configured balue, |
||
91 | * typically arguments provided to API. |
||
92 | * @param bool $defaultUseAlwaysAvailable |
||
93 | * |
||
94 | * @return bool |
||
95 | */ |
||
96 | public function getUseAlwaysAvailable($forcedUseAlwaysAvailable = null, $defaultUseAlwaysAvailable = true) |
||
108 | } |
||
109 |
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.
The variable may have been renamed without also renaming all references.