@@ -15,7 +15,7 @@ |
||
15 | 15 | * @param bool $fallback |
16 | 16 | * @return string |
17 | 17 | */ |
18 | - public function get($key, array $replace = [], $locale = null, $fallback = true) |
|
18 | + public function get($key, array $replace = [ ], $locale = null, $fallback = true) |
|
19 | 19 | { |
20 | 20 | $translationRepository = app(TranslationRepository::class); |
21 | 21 | if ($translation = $translationRepository->findByKeyAndLocale($key, $locale)) { |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('revisions', function (Blueprint $table) { |
|
15 | + Schema::create('revisions', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('revisionable_type'); |
18 | 18 | $table->integer('revisionable_id'); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | public function paths() |
10 | 10 | { |
11 | 11 | return array_merge( |
12 | - [$this->path], |
|
12 | + [ $this->path ], |
|
13 | 13 | $this->hints |
14 | 14 | ); |
15 | 15 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function up() |
13 | 13 | { |
14 | - Schema::table('translation__translations', function (Blueprint $table) { |
|
14 | + Schema::table('translation__translations', function(Blueprint $table) { |
|
15 | 15 | $table->index('key'); |
16 | 16 | }); |
17 | 17 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function down() |
24 | 24 | { |
25 | - Schema::table('translation__translations', function (Blueprint $table) { |
|
25 | + Schema::table('translation__translations', function(Blueprint $table) { |
|
26 | 26 | $table->dropIndex('key'); |
27 | 27 | }); |
28 | 28 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | { |
11 | 11 | use RevisionableTrait; |
12 | 12 | public $timestamps = false; |
13 | - protected $fillable = ['value']; |
|
13 | + protected $fillable = [ 'value' ]; |
|
14 | 14 | protected $table = 'translation__translation_translations'; |
15 | 15 | |
16 | 16 | protected $revisionEnabled = true; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | protected $historyLimit = 100; |
19 | 19 | protected $revisionCreationsEnabled = true; |
20 | 20 | |
21 | - public function __construct(array $attributes = []) |
|
21 | + public function __construct(array $attributes = [ ]) |
|
22 | 22 | { |
23 | 23 | parent::__construct($attributes); |
24 | 24 | $this->historyLimit = config('asgard.translation.config.revision-history-limit', 100); |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | |
79 | 79 | private function registerBindings() |
80 | 80 | { |
81 | - $this->app->bind(TranslationRepository::class, function () { |
|
81 | + $this->app->bind(TranslationRepository::class, function() { |
|
82 | 82 | $repository = new EloquentTranslationRepository(new Translation()); |
83 | 83 | |
84 | - if (! config('app.cache')) { |
|
84 | + if (!config('app.cache')) { |
|
85 | 85 | return $repository; |
86 | 86 | } |
87 | 87 | |
88 | 88 | return new CacheTranslationDecorator($repository); |
89 | 89 | }); |
90 | 90 | |
91 | - $this->app->bind(FileTranslationRepository::class, function ($app) { |
|
92 | - return new FileDiskTranslationRepository($app['files'], $app['translation.loader']); |
|
91 | + $this->app->bind(FileTranslationRepository::class, function($app) { |
|
92 | + return new FileDiskTranslationRepository($app[ 'files' ], $app[ 'translation.loader' ]); |
|
93 | 93 | }); |
94 | 94 | } |
95 | 95 | |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | $this->app->offsetUnset('translation.loader'); |
106 | 106 | $this->app->offsetUnset('translator'); |
107 | 107 | |
108 | - $this->app->singleton('translation.loader', function ($app) { |
|
109 | - return new TranslationLoader($app['files'], $app['path.lang']); |
|
108 | + $this->app->singleton('translation.loader', function($app) { |
|
109 | + return new TranslationLoader($app[ 'files' ], $app[ 'path.lang' ]); |
|
110 | 110 | }); |
111 | - $this->app->singleton('translator', function ($app) { |
|
112 | - $loader = $app['translation.loader']; |
|
111 | + $this->app->singleton('translator', function($app) { |
|
112 | + $loader = $app[ 'translation.loader' ]; |
|
113 | 113 | |
114 | - $locale = $app['config']['app.locale']; |
|
114 | + $locale = $app[ 'config' ][ 'app.locale' ]; |
|
115 | 115 | |
116 | 116 | $trans = new Translator($loader, $locale); |
117 | 117 | |
118 | - $trans->setFallback($app['config']['app.fallback_locale']); |
|
118 | + $trans->setFallback($app[ 'config' ][ 'app.fallback_locale' ]); |
|
119 | 119 | |
120 | 120 | return $trans; |
121 | 121 | }); |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | |
124 | 124 | private function registerValidators() |
125 | 125 | { |
126 | - Validator::extend('extensions', function ($attribute, $value, $parameters) { |
|
126 | + Validator::extend('extensions', function($attribute, $value, $parameters) { |
|
127 | 127 | return in_array($value->getClientOriginalExtension(), $parameters); |
128 | 128 | }); |
129 | 129 | |
130 | - Validator::replacer('extensions', function ($message, $attribute, $rule, $parameters) { |
|
131 | - return str_replace([':attribute', ':values'], [$attribute, implode(',', $parameters)], $message); |
|
130 | + Validator::replacer('extensions', function($message, $attribute, $rule, $parameters) { |
|
131 | + return str_replace([ ':attribute', ':values' ], [ $attribute, implode(',', $parameters) ], $message); |
|
132 | 132 | }); |
133 | 133 | } |
134 | 134 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $files = $this->getTranslationFilenamesFromPaths($this->loader->paths()); |
31 | 31 | |
32 | - $translations = []; |
|
32 | + $translations = [ ]; |
|
33 | 33 | |
34 | 34 | foreach ($files as $locale => $files) { |
35 | 35 | foreach ($files as $namespace => $file) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $trans = array_dot($trans); |
38 | 38 | |
39 | 39 | foreach ($trans as $key => $value) { |
40 | - $translations[$locale]["{$namespace}.{$key}"] = $value; |
|
40 | + $translations[ $locale ][ "{$namespace}.{$key}" ] = $value; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | protected function getTranslationFilenamesFromPaths(array $paths) |
55 | 55 | { |
56 | - $files = []; |
|
56 | + $files = [ ]; |
|
57 | 57 | $locales = config('laravellocalization.supportedLocales'); |
58 | 58 | |
59 | 59 | foreach ($paths as $hint => $path) { |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | |
63 | 63 | if ($glob) { |
64 | 64 | foreach ($glob as $file) { |
65 | - $category = str_replace(["$path/", ".php", "{$locale}/"], "", $file); |
|
65 | + $category = str_replace([ "$path/", ".php", "{$locale}/" ], "", $file); |
|
66 | 66 | $category = str_replace("/", ".", $category); |
67 | 67 | $category = !is_int($hint) ? "{$hint}::{$category}" : $category; |
68 | 68 | |
69 | - $files[$locale][$category] = $file; |
|
69 | + $files[ $locale ][ $category ] = $file; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | foreach ($tree as $locale => $groups) { |
33 | 33 | foreach ($groups as $moduleName => $fileGroup) { |
34 | 34 | foreach ($fileGroup as $file => $data) { |
35 | - $path = $this->getTranslationsDirectory() . $moduleName . '/' . $locale . '/' . $file . '.php'; |
|
36 | - $output = "<?php\n\nreturn " . var_export($data, true) . ";\n"; |
|
35 | + $path = $this->getTranslationsDirectory().$moduleName.'/'.$locale.'/'.$file.'.php'; |
|
36 | + $output = "<?php\n\nreturn ".var_export($data, true).";\n"; |
|
37 | 37 | $this->finder->put($path, $output); |
38 | 38 | } |
39 | 39 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | private function getTranslationsDirectory() |
57 | 57 | { |
58 | - return __DIR__ . '/../Resources/lang/'; |
|
58 | + return __DIR__.'/../Resources/lang/'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | private function getFileNameFrom($key) |
67 | 67 | { |
68 | - $key = str_replace($this->getModuleNameFrom($key) . '::', '', $key); |
|
68 | + $key = str_replace($this->getModuleNameFrom($key).'::', '', $key); |
|
69 | 69 | |
70 | 70 | return substr($key, 0, strpos($key, '.')); |
71 | 71 | } |
@@ -77,15 +77,15 @@ 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) { |
84 | 84 | $moduleName = $this->getModuleNameFrom($key); |
85 | 85 | $fileName = $this->getFileNameFrom($key); |
86 | - $key = str_replace($moduleName . '::' . $fileName . '.', '', $key); |
|
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 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public function export() |
21 | 21 | { |
22 | 22 | $data = $this->formatData(); |
23 | - $keys = array_keys($data[0]); |
|
23 | + $keys = array_keys($data[ 0 ]); |
|
24 | 24 | |
25 | 25 | $csv = Writer::createFromFileObject(new SplTempFileObject()); |
26 | 26 | $csv->insertOne($keys); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | private function getFileName() |
35 | 35 | { |
36 | - return $this->filename . time() . '.csv'; |
|
36 | + return $this->filename.time().'.csv'; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | $translations = $this->translations->getFileAndDatabaseMergedTranslations(); |
45 | 45 | $translations = $translations->all(); |
46 | 46 | |
47 | - $data = []; |
|
47 | + $data = [ ]; |
|
48 | 48 | foreach ($translations as $key => $translation) { |
49 | - $data[] = array_merge(['key' => $key], $translation); |
|
49 | + $data[ ] = array_merge([ 'key' => $key ], $translation); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return $data; |