@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $this->publishes( |
31 | 31 | [ |
32 | - __DIR__.'/config/trans-helper.php' => config_path('trans-helper.php'), |
|
32 | + __DIR__ . '/config/trans-helper.php' => config_path('trans-helper.php'), |
|
33 | 33 | ] |
34 | 34 | ); |
35 | 35 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function boot() |
41 | 41 | { |
42 | - $this->loadMigrationsFrom(__DIR__.'/migration'); |
|
42 | + $this->loadMigrationsFrom(__DIR__ . '/migration'); |
|
43 | 43 | if ($this->app->runningInConsole()) { |
44 | 44 | $this->publishAssets(); |
45 | 45 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | if (!Schema::connection($connection)->hasTable('_trans_helper_cites')) { |
23 | 23 | Schema::connection($connection)->create( |
24 | 24 | '_trans_helper_cites', |
25 | - function (Blueprint $table) { |
|
25 | + function(Blueprint $table) { |
|
26 | 26 | $table->bigIncrements('id'); |
27 | 27 | $table->string('file', 256)->default(''); |
28 | 28 | $table->unsignedBigInteger('line'); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | if (!Schema::connection($connection)->hasTable('_trans_helper_terms')) { |
45 | 45 | Schema::connection($connection)->create( |
46 | 46 | '_trans_helper_terms', |
47 | - function (Blueprint $table) { |
|
47 | + function(Blueprint $table) { |
|
48 | 48 | $table->bigIncrements('id'); |
49 | 49 | $table->string('namespace', 256)->default(''); |
50 | 50 | $table->string('term', 256)->default(''); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if (!Schema::connection($connection)->hasTable('_trans_helper_links')) { |
64 | 64 | Schema::connection($connection)->create( |
65 | 65 | '_trans_helper_links', |
66 | - function (Blueprint $table) { |
|
66 | + function(Blueprint $table) { |
|
67 | 67 | $table->unsignedBigInteger('cited'); |
68 | 68 | $table->unsignedBigInteger('vocab'); |
69 | 69 |
@@ -32,13 +32,13 @@ |
||
32 | 32 | |
33 | 33 | public function sweep() |
34 | 34 | { |
35 | - $line = explode("\n", file_get_contents(base_path().$this->file)); |
|
35 | + $line = explode("\n", file_get_contents(base_path() . $this->file)); |
|
36 | 36 | $line = $line[$this->line - 1] ?? ''; |
37 | 37 | $count = 0; |
38 | 38 | if ($line) { |
39 | 39 | foreach ($this->terms()->get() as $term) { |
40 | - $keywords = ["localize('{$term->term}')", 'localize("'.$term->term.'")']; |
|
41 | - $matched = array_filter(array_map(function ($u) use ($line) { |
|
40 | + $keywords = ["localize('{$term->term}')", 'localize("' . $term->term . '")']; |
|
41 | + $matched = array_filter(array_map(function($u) use ($line) { |
|
42 | 42 | return strpos($line, $u); |
43 | 43 | }, $keywords), 'strlen'); |
44 | 44 | if (empty($matched)) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | if (!Schema::connection($connection)->hasTable(config('queue.failed.table'))) { |
19 | 19 | Schema::connection($connection)->create( |
20 | 20 | config('queue.failed.table'), |
21 | - function (Blueprint $table) { |
|
21 | + function(Blueprint $table) { |
|
22 | 22 | $table->bigIncrements('id'); |
23 | 23 | $table->text('connection'); |
24 | 24 | $table->text('queue'); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | if (!Schema::connection($connection)->hasTable(config('queue.connections.database.table'))) { |
33 | 33 | Schema::connection($connection)->create( |
34 | 34 | config('queue.connections.database.table'), |
35 | - function (Blueprint $table) { |
|
35 | + function(Blueprint $table) { |
|
36 | 36 | $table->bigIncrements('id'); |
37 | 37 | $table->string('queue')->index(); |
38 | 38 | $table->longText('payload'); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | call_user_func_array( |
61 | 61 | 'array_merge', |
62 | 62 | array_map( |
63 | - function ($u) { |
|
63 | + function($u) { |
|
64 | 64 | return array_keys($u->translation); |
65 | 65 | }, |
66 | 66 | self::get()->all() |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | private function initVocabCite(VocabCite $cite) |
34 | 34 | { |
35 | 35 | if (empty($cite->code)) { |
36 | - $lines = explode("\n", file_get_contents(base_path().$cite->file)); |
|
36 | + $lines = explode("\n", file_get_contents(base_path() . $cite->file)); |
|
37 | 37 | $cite->code = $lines[$cite->line - 1]; |
38 | 38 | if (substr($cite->file, -10) != '.blade.php') { |
39 | 39 | for ($start = $cite->line - 2; $start > -1; $start--) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | $code = array_filter(array_slice($lines, $start, $end - $start + 1, true), 'trim'); |
54 | 54 | $max = strlen($end); |
55 | - $cite->code = implode("\n", array_map(function ($u, $v) use ($max) { |
|
55 | + $cite->code = implode("\n", array_map(function($u, $v) use ($max) { |
|
56 | 56 | return sprintf("%{$max}d %s ", $u + 1, rtrim($v)); |
57 | 57 | }, array_keys($code), $code)); |
58 | 58 | $cite->save(); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | // SORT_FLAG_CASE |
18 | 18 | |
19 | 19 | if (!is_array($array)) { |
20 | - $array = method_exists($array, 'toArray') ? $array->toArray() : (array) $array; |
|
20 | + $array = method_exists($array, 'toArray') ? $array->toArray() : (array)$array; |
|
21 | 21 | } |
22 | 22 | // \Locale::setDefault(str_replace('-', '_', \App::getLocale())); |
23 | 23 | $keys = array_keys($array); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | function localize($languages, string $failback = '') |
52 | 52 | { |
53 | 53 | if (is_array($languages) || is_json($languages)) { |
54 | - $languages = (!is_array($languages)) ? (array) json_decode($languages) : $languages; |
|
54 | + $languages = (!is_array($languages)) ? (array)json_decode($languages) : $languages; |
|
55 | 55 | $locales = array_keys($languages); |
56 | 56 | $system = app()->getLocale(); |
57 | 57 | $default = config('app.locale'); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $cite['class'] = $tracer[0]['class'] ?? ''; |
71 | 71 | $vocab = []; |
72 | 72 | $vocab['namespace'] = preg_replace( |
73 | - '/(^'.addcslashes(base_path(), '\/').')|(\.php$)/', |
|
73 | + '/(^' . addcslashes(base_path(), '\/') . ')|(\.php$)/', |
|
74 | 74 | '', |
75 | 75 | $cite['file'] |
76 | 76 | ); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | dispatch(new Translation($vocab, [app()->getLocale()])); |
84 | 84 | } |
85 | 85 | $cite['file'] = preg_replace( |
86 | - '/^'.addcslashes(base_path(), '\/').'/', |
|
86 | + '/^' . addcslashes(base_path(), '\/') . '/', |
|
87 | 87 | '', |
88 | 88 | $cite['file'] |
89 | 89 | ); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $cite->refresh(); |
92 | 92 | $vocab->cites()->sync([$cite->id], false); |
93 | 93 | if (!$cite->code) { |
94 | - $lines = explode("\n", file_get_contents(base_path().$cite->file)); |
|
94 | + $lines = explode("\n", file_get_contents(base_path() . $cite->file)); |
|
95 | 95 | $cite->code = $lines[$cite->line - 1]; |
96 | 96 | if (substr($cite->file, -10) != '.blade.php') { |
97 | 97 | for ( |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | $code = array_filter(array_slice($lines, $start, $end - $start + 1, true), 'trim'); |
120 | 120 | $max = strlen($end); |
121 | - $cite->code = implode("\n", array_map(function ($u, $v) use ($max) { |
|
121 | + $cite->code = implode("\n", array_map(function($u, $v) use ($max) { |
|
122 | 122 | return sprintf("%{$max}d %s ", $u + 1, rtrim($v)); |
123 | 123 | }, array_keys($code), $code)); |
124 | 124 | $cite->save(); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | function sweep() |
137 | 137 | { |
138 | 138 | array_map( |
139 | - function ($u) { |
|
139 | + function($u) { |
|
140 | 140 | $u->sweep(); |
141 | 141 | }, |
142 | 142 | array_merge( |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | { |
188 | 188 | $keys = array_keys($slugs); |
189 | 189 | $slugs = array_values($slugs); |
190 | - $slugs = array_map(function ($k, $v) use ($slugs) { |
|
190 | + $slugs = array_map(function($k, $v) use ($slugs) { |
|
191 | 191 | if ($k > 0 && in_array($v, array_slice($slugs, 0, $k - 1))) { |
192 | - $v .= '-'.uniqid(); |
|
192 | + $v .= '-' . uniqid(); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | return $v; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | { |
205 | 205 | $lang_file = str_replace('/', '.', strtolower(ltrim(Str::snake($namespace), '/'))); |
206 | 206 | $lang_file = str_replace('//', '/', implode('/', [$path, $locale, $lang_file])); |
207 | - $lang_file = str_replace('._', '.', $lang_file).'.php'; |
|
207 | + $lang_file = str_replace('._', '.', $lang_file) . '.php'; |
|
208 | 208 | |
209 | 209 | return $lang_file; |
210 | 210 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | } |
236 | 236 | $slugs = unique_slugs($slugs); |
237 | 237 | $max = intdiv(max(array_map('strlen', $slugs)) + 3, 4) * 4; |
238 | - $lines = array_map(function ($u, $v) use ($max) { |
|
238 | + $lines = array_map(function($u, $v) use ($max) { |
|
239 | 239 | $u = "'{$u}'"; |
240 | 240 | |
241 | 241 | return sprintf(" %-{$max}s => '%s',", $u, $v); |