@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function saveTranslations(Translations $translations) |
| 38 | 38 | { |
| 39 | 39 | $locale = $translations->getLanguage(); |
| 40 | - $domain = (string)$translations->getDomain(); |
|
| 40 | + $domain = (string) $translations->getDomain(); |
|
| 41 | 41 | |
| 42 | 42 | if (!$locale) { |
| 43 | 43 | throw new InvalidTranslationException('Locale is missing'); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $item->key = $this->getKey($locale, $domain, $translation); |
| 182 | 182 | $item->domain = $domain; |
| 183 | 183 | $item->locale = $locale; |
| 184 | - $item->context = (string)$translation->getContext(); |
|
| 184 | + $item->context = (string) $translation->getContext(); |
|
| 185 | 185 | $item->original = $translation->getOriginal(); |
| 186 | 186 | $item->translation = $translation->getTranslation(); |
| 187 | 187 | $item->originalPlural = $translation->getPlural(); |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | { |
| 206 | 206 | return $this->convertItems( |
| 207 | 207 | $locale, |
| 208 | - (string)$domain, |
|
| 209 | - $this->repository->getAll($locale, (string)$domain) |
|
| 208 | + (string) $domain, |
|
| 209 | + $this->repository->getAll($locale, (string) $domain) |
|
| 210 | 210 | ); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | { |
| 222 | 222 | return $this->convertItems( |
| 223 | 223 | $locale, |
| 224 | - (string)$domain, |
|
| 225 | - $this->repository->getEnabled($locale, (string)$domain) |
|
| 224 | + (string) $domain, |
|
| 225 | + $this->repository->getEnabled($locale, (string) $domain) |
|
| 226 | 226 | ); |
| 227 | 227 | } |
| 228 | 228 | |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function getEnabledTranslated(string $locale, $domain): Translations |
| 237 | 237 | { |
| 238 | - $items = $this->repository->getEnabledTranslated($locale, (string)$domain); |
|
| 238 | + $items = $this->repository->getEnabledTranslated($locale, (string) $domain); |
|
| 239 | 239 | |
| 240 | - return $this->convertItems($locale, (string)$domain, $items); |
|
| 240 | + return $this->convertItems($locale, (string) $domain, $items); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -251,8 +251,8 @@ discard block |
||
| 251 | 251 | { |
| 252 | 252 | return $this->convertItems( |
| 253 | 253 | $locale, |
| 254 | - (string)$domain, |
|
| 255 | - $this->repository->getRequiresTranslating($locale, (string)$domain) |
|
| 254 | + (string) $domain, |
|
| 255 | + $this->repository->getRequiresTranslating($locale, (string) $domain) |
|
| 256 | 256 | ); |
| 257 | 257 | } |
| 258 | 258 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | private function convertItems(string $locale, $domain, array $items): Translations |
| 268 | 268 | { |
| 269 | - $domain = (string)$domain; |
|
| 269 | + $domain = (string) $domain; |
|
| 270 | 270 | |
| 271 | 271 | $translations = new Translations; |
| 272 | 272 | $translations->setDomain($domain); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | private function generateHash(Translations $translations): string |
| 58 | 58 | { |
| 59 | - $array = array_map(function (Translation $t) { |
|
| 59 | + $array = array_map(function(Translation $t) { |
|
| 60 | 60 | return [ |
| 61 | 61 | $t->getOriginal(), |
| 62 | 62 | $t->getPlural(), |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $t->getPluralTranslations(), |
| 65 | 65 | $t->getContext(), |
| 66 | 66 | ]; |
| 67 | - }, (array)$translations); |
|
| 67 | + }, (array) $translations); |
|
| 68 | 68 | |
| 69 | 69 | return substr(md5(serialize($array)), 0, 6); // Take only 6, and pray for no collisions |
| 70 | 70 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | throw new InvalidPathException('Directory does not exist (' . $this->config->getMoDirectory() . ')'); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - return (bool)file_put_contents($pathname, json_encode($revisions->toArray(), JSON_PRETTY_PRINT)); |
|
| 131 | + return (bool) file_put_contents($pathname, json_encode($revisions->toArray(), JSON_PRETTY_PRINT)); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -155,12 +155,12 @@ |
||
| 155 | 155 | |
| 156 | 156 | // If extensions are set, filter other files out |
| 157 | 157 | if (!empty($item->extensions)) { |
| 158 | - $files = array_filter($files, function ($file) use ($item) { |
|
| 158 | + $files = array_filter($files, function($file) use ($item) { |
|
| 159 | 159 | return in_array($file['extension'], $item->extensions); |
| 160 | 160 | }); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - return array_map(function ($file) use ($dir) { |
|
| 163 | + return array_map(function($file) use ($dir) { |
|
| 164 | 164 | return $dir . DIRECTORY_SEPARATOR . $file['path']; |
| 165 | 165 | }, $files); |
| 166 | 166 | } |