1 | <?php |
||
23 | class Import |
||
24 | { |
||
25 | /** |
||
26 | * @var FileImport |
||
27 | */ |
||
28 | private $fileImport; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private $locales; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | private $domains; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | private $kernelDir; |
||
44 | |||
45 | /** |
||
46 | * @var array |
||
47 | */ |
||
48 | private $bundles; |
||
49 | |||
50 | /** |
||
51 | * @var array |
||
52 | */ |
||
53 | private $formats; |
||
54 | |||
55 | /** |
||
56 | * @var array |
||
57 | */ |
||
58 | private $translations = []; |
||
59 | |||
60 | /** |
||
61 | * @var Manager |
||
62 | */ |
||
63 | private $esManager; |
||
64 | |||
65 | /** |
||
66 | * @var array |
||
67 | */ |
||
68 | private $configBundles; |
||
69 | |||
70 | /** |
||
71 | * @param FileImport $fileImport |
||
72 | * @param Manager $esManager |
||
73 | * @param string $kernelDir |
||
74 | * @param array $kernelBundles |
||
75 | * @param array $configBundles |
||
76 | */ |
||
77 | public function __construct( |
||
90 | |||
91 | /** |
||
92 | * Collects translations. |
||
93 | */ |
||
94 | public function import() |
||
102 | |||
103 | /** |
||
104 | * Returns all translations as array. |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | public function getTranslations() |
||
116 | |||
117 | /** |
||
118 | * Write translations to storage. |
||
119 | */ |
||
120 | public function writeToStorage() |
||
143 | |||
144 | /** |
||
145 | * Imports application translation files. |
||
146 | */ |
||
147 | public function importAppTranslationFiles() |
||
152 | |||
153 | /** |
||
154 | * Imports translation files form all bundles. |
||
155 | * |
||
156 | * @param array $bundles |
||
157 | * @param bool $isBundle |
||
158 | */ |
||
159 | public function importBundlesTranslationFiles($bundles, $isBundle = false) |
||
169 | |||
170 | /** |
||
171 | * Imports translation files form the specific bundles. |
||
172 | * |
||
173 | * @param string $bundle |
||
174 | */ |
||
175 | public function importBundleTranslationFiles($bundle) |
||
180 | |||
181 | /** |
||
182 | * Imports Symfony's components translation files. |
||
183 | */ |
||
184 | public function importComponentTranslationFiles() |
||
205 | |||
206 | /** |
||
207 | * Return a Finder object if $path has a Resources/translations folder. |
||
208 | * |
||
209 | * @param string $path |
||
210 | * |
||
211 | * @return Finder |
||
212 | */ |
||
213 | protected function findTranslationsFiles($path) |
||
234 | |||
235 | /** |
||
236 | * @return string |
||
237 | */ |
||
238 | protected function getFileNamePattern() |
||
257 | |||
258 | /** |
||
259 | * Imports some translations files. |
||
260 | * |
||
261 | * @param Finder $finder |
||
262 | */ |
||
263 | protected function importTranslationFiles($finder) |
||
271 | |||
272 | /** |
||
273 | * @return mixed |
||
274 | */ |
||
275 | public function getDomains() |
||
279 | |||
280 | /** |
||
281 | * @param mixed $domains |
||
282 | */ |
||
283 | public function setDomains($domains) |
||
287 | |||
288 | /** |
||
289 | * @return mixed |
||
290 | */ |
||
291 | public function getLocales() |
||
295 | |||
296 | /** |
||
297 | * @param mixed $locales |
||
298 | */ |
||
299 | public function setLocales($locales) |
||
303 | |||
304 | /** |
||
305 | * @return mixed |
||
306 | */ |
||
307 | public function getFormats() |
||
311 | |||
312 | /** |
||
313 | * @param mixed $formats |
||
314 | */ |
||
315 | public function setFormats($formats) |
||
319 | |||
320 | /** |
||
321 | * Returns Finder object. |
||
322 | * |
||
323 | * @return Finder |
||
324 | */ |
||
325 | protected function getFinder() |
||
329 | |||
330 | /** |
||
331 | * @return array |
||
332 | */ |
||
333 | public function getConfigBundles() |
||
337 | |||
338 | /** |
||
339 | * @return array |
||
340 | */ |
||
341 | public function getBundles() |
||
345 | } |
||
346 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: