1 | <?php namespace Limoncello\l10n\Messages; |
||
26 | class BundleEncoder implements BundleEncoderInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private $bundles = []; |
||
32 | |||
33 | /** |
||
34 | * @inheritdoc |
||
35 | */ |
||
36 | 5 | public function addBundle(ResourceBundleInterface $bundle): BundleEncoderInterface |
|
44 | |||
45 | /** |
||
46 | * @inheritdoc |
||
47 | */ |
||
48 | 5 | public function getStorageData(string $defaultLocale): array |
|
69 | |||
70 | /** |
||
71 | * @return array |
||
72 | */ |
||
73 | 5 | protected function getBundles(): array |
|
77 | |||
78 | /** |
||
79 | * @param ResourceBundleInterface $bundle |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | 5 | private function encodeBundle(ResourceBundleInterface $bundle): array |
|
92 | |||
93 | /** |
||
94 | * @param string $locale |
||
95 | * @param string $namespace |
||
96 | * |
||
97 | * @return null|ResourceBundleInterface |
||
98 | */ |
||
99 | 5 | private function getBundle(string $locale, string $namespace) |
|
110 | |||
111 | /** |
||
112 | * @param ResourceBundleInterface $localizedBundle |
||
113 | * @param ResourceBundleInterface|null $defaultBundle |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | 5 | private function encodeMergedBundles( |
|
147 | |||
148 | /** |
||
149 | * @return array |
||
150 | */ |
||
151 | 5 | private function getLocales(): array |
|
155 | |||
156 | /** |
||
157 | * @param string $locale |
||
158 | * |
||
159 | * @return bool |
||
160 | */ |
||
161 | 5 | private function hasLocale(string $locale): bool |
|
168 | |||
169 | /** |
||
170 | * @param string $locale |
||
171 | * |
||
172 | * @return string[] |
||
173 | */ |
||
174 | 5 | private function getNamespaces(string $locale): array |
|
180 | |||
181 | /** |
||
182 | * @param string $locale |
||
183 | * @param string $namespace |
||
184 | * |
||
185 | * @return bool |
||
186 | */ |
||
187 | 5 | private function hasLocalizedNamespace(string $locale, string $namespace): bool |
|
195 | |||
196 | /** |
||
197 | * @param string $locale |
||
198 | * |
||
199 | * @return void |
||
200 | */ |
||
201 | 5 | private function assertLocale(string $locale) |
|
205 | |||
206 | /** |
||
207 | * @param string $namespace |
||
208 | * |
||
209 | * @return void |
||
210 | */ |
||
211 | 5 | private function assertNamespace(string $namespace) |
|
215 | |||
216 | /** |
||
217 | * @param ResourceBundleInterface $bundle |
||
218 | * @param string $key |
||
219 | * |
||
220 | * @return string[] |
||
221 | */ |
||
222 | 5 | private function getBundleValue(ResourceBundleInterface $bundle, $key): array |
|
229 | } |
||
230 |