1 | <?php |
||
21 | trait File |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * \addtogroup Localization Localization |
||
26 | * \brief Methods to create a localized bot. |
||
27 | * \details Localization files must have this syntax: |
||
28 | * file <code>./localization/en.json</code>: |
||
29 | * |
||
30 | * {"Hello_Msg": "Hello"} |
||
31 | * |
||
32 | * File <code>./localization/it.json</code>: |
||
33 | * |
||
34 | * {"Hello_Msg": "Ciao"} |
||
35 | * |
||
36 | * Usage in <code>processMessage()</code>: |
||
37 | * |
||
38 | * $sendMessage($this->local[$this->language]["Hello_Msg"]); |
||
39 | * |
||
40 | * @{ |
||
41 | */ |
||
42 | |||
43 | /** \brief (<i>Internal</i>)Store the localizated strings. */ |
||
44 | protected $local; |
||
45 | |||
46 | /** \brief Directory where there are the localization files. */ |
||
47 | protected $localization_dir = './localization'; |
||
48 | |||
49 | /** |
||
50 | * \brief (<i>Internal</i>)Load a localization file into the localized strings array. |
||
51 | * @param string $lang Language to load. |
||
52 | * @param string $dir Directory in which there are the JSON files. |
||
53 | * @return bool True if loaded. |
||
54 | */ |
||
55 | protected function loadSingleLanguage(string $lang = 'en', string $dir = './localization') : bool |
||
77 | |||
78 | /** |
||
79 | * \brief Load all localization files (JSON-serialized) from a folder and set them in $local variable. |
||
80 | * \details Save all localization files, saved as json format, from a directory and put the contents in $local variable. |
||
81 | * Each file will be saved into $local with the first two letters of the filename as the index. |
||
82 | * @param string $dir Directory where the localization files are saved. |
||
83 | * @return bool True if the directory could be opened without errors. |
||
84 | */ |
||
85 | public function loadAllLocalizations(string $dir = './localization') : bool |
||
106 | |||
107 | /** |
||
108 | * \brief Load localization for current language and mode. |
||
109 | * \details This method will load only the current user/group localization file if the bot is using webhook, all files otherwise. |
||
110 | * @param string $dir Directory where the localization file is stored. If no directory is given (by default) it will load it from $localization_dir (which is ./localization if it is not set). |
||
111 | * @return bool True if the localization has been loaded or it is already loaded. |
||
112 | */ |
||
113 | public function loadCurrentLocalization(string $dir = '') : bool |
||
133 | |||
134 | /** |
||
135 | * \brief Set location of localization files. |
||
136 | * @param string $dir Directory where the files are stored. |
||
137 | */ |
||
138 | public function setLocalizationDir(string $dir) |
||
142 | |||
143 | /** @} */ |
||
144 | } |
||
145 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.