@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | public function import(UploadedFile $file) |
20 | 20 | { |
21 | 21 | $csv = Reader::createFromPath($file->getRealPath()); |
22 | - $csv->detectDelimiterList(5, [',', ';']); |
|
22 | + $csv->detectDelimiterList(5, [ ',', ';' ]); |
|
23 | 23 | $headers = $csv->fetchOne(); |
24 | 24 | $csv->setOffset(1); |
25 | 25 | |
26 | - $csv->each(function ($row) use ($headers) { |
|
26 | + $csv->each(function($row) use ($headers) { |
|
27 | 27 | try { |
28 | 28 | $row = array_combine($headers, $row); |
29 | 29 | } catch (\Exception $e) { |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | $key = array_get($row, 'key'); |
34 | 34 | array_shift($row); |
35 | - $data = []; |
|
35 | + $data = [ ]; |
|
36 | 36 | foreach ($row as $locale => $value) { |
37 | - $data[$locale] = ['value' => $value]; |
|
37 | + $data[ $locale ] = [ 'value' => $value ]; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $this->translation->updateFromImport($key, $data); |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | |
55 | 55 | private function registerBindings() |
56 | 56 | { |
57 | - $this->app->bind(TranslationRepository::class, function () { |
|
57 | + $this->app->bind(TranslationRepository::class, function() { |
|
58 | 58 | $repository = new EloquentTranslationRepository(new Translation()); |
59 | 59 | |
60 | 60 | return new CacheTranslationDecorator($repository); |
61 | 61 | }); |
62 | 62 | |
63 | - $this->app->bind(FileTranslationRepository::class, function ($app) { |
|
64 | - return new FileDiskTranslationRepository($app['files']); |
|
63 | + $this->app->bind(FileTranslationRepository::class, function($app) { |
|
64 | + return new FileDiskTranslationRepository($app[ 'files' ]); |
|
65 | 65 | }); |
66 | 66 | } |
67 | 67 | |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | { |
77 | 77 | $this->app->offsetUnset('translator'); |
78 | 78 | |
79 | - $this->app->singleton('translator', function ($app) { |
|
80 | - $loader = $app['translation.loader']; |
|
79 | + $this->app->singleton('translator', function($app) { |
|
80 | + $loader = $app[ 'translation.loader' ]; |
|
81 | 81 | |
82 | - $locale = $app['config']['app.locale']; |
|
82 | + $locale = $app[ 'config' ][ 'app.locale' ]; |
|
83 | 83 | |
84 | 84 | $trans = new Translator($loader, $locale); |
85 | 85 | |
86 | - $trans->setFallback($app['config']['app.fallback_locale']); |
|
86 | + $trans->setFallback($app[ 'config' ][ 'app.fallback_locale' ]); |
|
87 | 87 | |
88 | 88 | return $trans; |
89 | 89 | }); |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | |
92 | 92 | private function registerValidators() |
93 | 93 | { |
94 | - Validator::extend('extensions', function ($attribute, $value, $parameters) { |
|
94 | + Validator::extend('extensions', function($attribute, $value, $parameters) { |
|
95 | 95 | return in_array($value->getClientOriginalExtension(), $parameters); |
96 | 96 | }); |
97 | 97 | |
98 | - Validator::replacer('extensions', function ($message, $attribute, $rule, $parameters) { |
|
99 | - return str_replace([':attribute', ':values'], [$attribute, implode(',', $parameters)], $message); |
|
98 | + Validator::replacer('extensions', function($message, $attribute, $rule, $parameters) { |
|
99 | + return str_replace([ ':attribute', ':values' ], [ $attribute, implode(',', $parameters) ], $message); |
|
100 | 100 | }); |
101 | 101 | } |
102 | 102 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | return $this->cache |
23 | 23 | ->tags($this->entityName, 'global') |
24 | 24 | ->rememberForever("{$this->locale}.{$this->entityName}.findByKeyAndLocale.{$key}.{$locale}", |
25 | - function () use ($key, $locale) { |
|
25 | + function() use ($key, $locale) { |
|
26 | 26 | return $this->repository->findByKeyAndLocale($key, $locale); |
27 | 27 | } |
28 | 28 | ); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | return $this->cache |
34 | 34 | ->tags($this->entityName, 'global') |
35 | 35 | ->rememberForever("{$this->locale}.{$this->entityName}.allFormatted", |
36 | - function () { |
|
36 | + function() { |
|
37 | 37 | return $this->repository->allFormatted(); |
38 | 38 | } |
39 | 39 | ); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return $this->cache |
52 | 52 | ->tags($this->entityName, 'global') |
53 | 53 | ->rememberForever("{$this->locale}.{$this->entityName}.findTranslationByKey.{$key}", |
54 | - function () use ($key) { |
|
54 | + function() use ($key) { |
|
55 | 55 | return $this->repository->findTranslationByKey($key); |
56 | 56 | } |
57 | 57 | ); |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | public function allFormatted() |
26 | 26 | { |
27 | 27 | $allRows = $this->all(); |
28 | - $allDatabaseTranslations = []; |
|
28 | + $allDatabaseTranslations = [ ]; |
|
29 | 29 | foreach ($allRows as $translation) { |
30 | 30 | foreach (config('laravellocalization.supportedLocales') as $locale => $language) { |
31 | 31 | if ($translation->hasTranslation($locale)) { |
32 | - $allDatabaseTranslations[$locale][$translation->key] = $translation->translate($locale)->value; |
|
32 | + $allDatabaseTranslations[ $locale ][ $translation->key ] = $translation->translate($locale)->value; |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | public function findTranslationByKey($key) |
48 | 48 | { |
49 | - return $this->model->firstOrCreate(['key' => $key]); |
|
49 | + return $this->model->firstOrCreate([ 'key' => $key ]); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function all() |
23 | 23 | { |
24 | - $allFileTranslations = []; |
|
24 | + $allFileTranslations = [ ]; |
|
25 | 25 | $files = $this->finder->allFiles($this->getTranslationsDirectory()); |
26 | 26 | foreach ($files as $file) { |
27 | 27 | $lang = $this->getLanguageFrom($file->getRelativePath()); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $contents = $this->finder->getRequire($this->getTranslationsDirectory() . '/' . $path); |
30 | 30 | $trans = array_dot($contents, $this->getModuleFrom($file->getRelativePath()) . '::' . $this->getFileNameFrom($path) . '.'); |
31 | 31 | foreach ($trans as $key => $value) { |
32 | - $allFileTranslations[$lang][$key] = $value; |
|
32 | + $allFileTranslations[ $lang ][ $key ] = $value; |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | private function getModuleFrom($relativePath) |
61 | 61 | { |
62 | - return explode(DIRECTORY_SEPARATOR, $relativePath)[0]; |
|
62 | + return explode(DIRECTORY_SEPARATOR, $relativePath)[ 0 ]; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | private function getFileNameFrom($path) |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | foreach ($allFileTranslations as $locale => $fileTranslation) { |
34 | 34 | foreach ($fileTranslation as $key => $translation) { |
35 | - if (isset($allDatabaseTranslations[$locale][$key])) { |
|
36 | - $allFileTranslations[$locale][$key] = $allDatabaseTranslations[$locale][$key]; |
|
37 | - unset($allDatabaseTranslations[$locale][$key]); |
|
35 | + if (isset($allDatabaseTranslations[ $locale ][ $key ])) { |
|
36 | + $allFileTranslations[ $locale ][ $key ] = $allDatabaseTranslations[ $locale ][ $key ]; |
|
37 | + unset($allDatabaseTranslations[ $locale ][ $key ]); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | $activeLocales = $this->getActiveLocales(); |
55 | 55 | |
56 | 56 | foreach ($allFileTranslations as $locale => $value) { |
57 | - if (! in_array($locale, $activeLocales)) { |
|
58 | - unset($allFileTranslations[$locale]); |
|
57 | + if (!in_array($locale, $activeLocales)) { |
|
58 | + unset($allFileTranslations[ $locale ]); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | */ |
67 | 67 | private function getActiveLocales() |
68 | 68 | { |
69 | - $locales = []; |
|
69 | + $locales = [ ]; |
|
70 | 70 | |
71 | 71 | foreach (config('laravellocalization.supportedLocales') as $locale => $translation) { |
72 | - $locales[] = $locale; |
|
72 | + $locales[ ] = $locale; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $locales; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | foreach ($allDatabaseTranslations as $locale => $group) { |
85 | 85 | foreach ($group as $key => $value) { |
86 | - $allFileTranslations[$locale][$key] = $value; |
|
86 | + $allFileTranslations[ $locale ][ $key ] = $value; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | private function makeTree(TranslationGroup $translations) |
79 | 79 | { |
80 | - $tree = []; |
|
80 | + $tree = [ ]; |
|
81 | 81 | |
82 | 82 | foreach ($translations->allRaw() as $locale => $translation) { |
83 | 83 | foreach ($translation as $key => $trans) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $fileName = $this->getFileNameFrom($key); |
86 | 86 | $key = str_replace($moduleName . '::' . $fileName . '.', '', $key); |
87 | 87 | |
88 | - array_set($tree[$locale][$moduleName][$fileName], $key, $trans); |
|
88 | + array_set($tree[ $locale ][ $moduleName ][ $fileName ], $key, $trans); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 |
@@ -32,8 +32,8 @@ |
||
32 | 32 | if (false === config('asgard.translation.config.translations-gui')) { |
33 | 33 | return $menu; |
34 | 34 | } |
35 | - $menu->group(trans('core::sidebar.content'), function (Group $group) { |
|
36 | - $group->item(trans('translation::translations.title.translations'), function (Item $item) { |
|
35 | + $menu->group(trans('core::sidebar.content'), function(Group $group) { |
|
36 | + $group->item(trans('translation::translations.title.translations'), function(Item $item) { |
|
37 | 37 | $item->icon('fa fa-globe'); |
38 | 38 | $item->weight(10); |
39 | 39 | $item->route('admin.translation.translation.index'); |
@@ -20,11 +20,11 @@ |
||
20 | 20 | */ |
21 | 21 | private function reArrangeTranslations(array $translationsRaw) |
22 | 22 | { |
23 | - $translations = []; |
|
23 | + $translations = [ ]; |
|
24 | 24 | |
25 | 25 | foreach ($translationsRaw as $locale => $translationGroup) { |
26 | 26 | foreach ($translationGroup as $key => $translation) { |
27 | - $translations[$key][$locale] = $translation; |
|
27 | + $translations[ $key ][ $locale ] = $translation; |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 |