@@ -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 | } |
@@ -32,19 +32,19 @@ |
||
| 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 | if ($line) { |
| 38 | 38 | $terms = call_user_func_array( |
| 39 | 39 | 'array_merge', |
| 40 | 40 | array_map( |
| 41 | - function ($u) { |
|
| 42 | - return ["localize('{$u->term}')", 'localize("'.$u->term.'")']; |
|
| 41 | + function($u) { |
|
| 42 | + return ["localize('{$u->term}')", 'localize("' . $u->term . '")']; |
|
| 43 | 43 | }, |
| 44 | 44 | $this->terms()->get()->all() |
| 45 | 45 | ) |
| 46 | 46 | ); |
| 47 | - $matched = array_filter(array_map(function ($u) use ($line) { |
|
| 47 | + $matched = array_filter(array_map(function($u) use ($line) { |
|
| 48 | 48 | return strpos($line, $u); |
| 49 | 49 | }, $terms), 'strlen'); |
| 50 | 50 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | function localize($languages, string $failback = '') |
| 19 | 19 | { |
| 20 | 20 | if (is_array($languages) || is_json($languages)) { |
| 21 | - $languages = (!is_array($languages)) ? (array) json_decode($languages) : $languages; |
|
| 21 | + $languages = (!is_array($languages)) ? (array)json_decode($languages) : $languages; |
|
| 22 | 22 | $locales = array_keys($languages); |
| 23 | 23 | $system = \App::getLocale(); |
| 24 | 24 | $default = config('app.locale'); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $cite['class'] = $tracer[0]['class'] ?? ''; |
| 38 | 38 | $vocab = []; |
| 39 | 39 | $vocab['namespace'] = preg_replace( |
| 40 | - '/(^'.addcslashes(base_path(), '\/').')|(\.php$)/', |
|
| 40 | + '/(^' . addcslashes(base_path(), '\/') . ')|(\.php$)/', |
|
| 41 | 41 | '', |
| 42 | 42 | $cite['file'] |
| 43 | 43 | ); |
@@ -55,14 +55,14 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | $cite['file'] = preg_replace( |
| 58 | - '/^'.addcslashes(base_path(), '\/').'/', |
|
| 58 | + '/^' . addcslashes(base_path(), '\/') . '/', |
|
| 59 | 59 | '', |
| 60 | 60 | $cite['file'] |
| 61 | 61 | ); |
| 62 | 62 | $cite = config('trans-helper.model.cite')::firstOrCreate($cite); |
| 63 | 63 | $vocab->cites()->sync([$cite->id], false); |
| 64 | 64 | if (!$cite->code) { |
| 65 | - $lines = explode("\n", file_get_contents(base_path().$cite->file)); |
|
| 65 | + $lines = explode("\n", file_get_contents(base_path() . $cite->file)); |
|
| 66 | 66 | $cite->code = $lines[$cite->line - 1]; |
| 67 | 67 | if (substr($cite->file, -10) != '.blade.php') { |
| 68 | 68 | for ($start = $cite->line - 2; $start > -1; $start--) { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | $code = array_filter(array_slice($lines, $start, $end - $start + 1, true), 'trim'); |
| 83 | 83 | $max = strlen($end); |
| 84 | - $cite->code = implode("\n", array_map(function ($u, $v) use ($max) { |
|
| 84 | + $cite->code = implode("\n", array_map(function($u, $v) use ($max) { |
|
| 85 | 85 | return sprintf("%{$max}d %s", $u + 1, rtrim($v)); |
| 86 | 86 | }, array_keys($code), $code)); |
| 87 | 87 | $cite->save(); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | function sweep() |
| 100 | 100 | { |
| 101 | 101 | array_map( |
| 102 | - function ($u) { |
|
| 102 | + function($u) { |
|
| 103 | 103 | $u->sweep(); |
| 104 | 104 | }, |
| 105 | 105 | array_merge( |