@@ -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,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)) { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | $key = slugify($this->translation['en']); |
| 39 | 39 | $key = strlen($key) > 20 ? substr($key, 0, 20) : $key; |
| 40 | - $key .= '_'.substr(uniqid(), -5); |
|
| 40 | + $key .= '_' . substr(uniqid(), -5); |
|
| 41 | 41 | |
| 42 | 42 | return $key; |
| 43 | 43 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 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() |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | function localize($languages, string $failback = '') |
| 26 | 26 | { |
| 27 | 27 | if (is_array($languages) || is_json($languages)) { |
| 28 | - $languages = (!is_array($languages)) ? (array) json_decode($languages) : $languages; |
|
| 28 | + $languages = (!is_array($languages)) ? (array)json_decode($languages) : $languages; |
|
| 29 | 29 | $locales = array_keys($languages); |
| 30 | 30 | $system = \App::getLocale(); |
| 31 | 31 | $default = config('app.locale'); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $cite['class'] = $tracer[0]['class'] ?? ''; |
| 45 | 45 | $vocab = []; |
| 46 | 46 | $vocab['namespace'] = preg_replace( |
| 47 | - '/(^'.addcslashes(base_path(), '\/').')|(\.php$)/', |
|
| 47 | + '/(^' . addcslashes(base_path(), '\/') . ')|(\.php$)/', |
|
| 48 | 48 | '', |
| 49 | 49 | $cite['file'] |
| 50 | 50 | ); |
@@ -61,14 +61,14 @@ discard block |
||
| 61 | 61 | dispatch(new Translation($vocab, [app()->getLocale()])); |
| 62 | 62 | } |
| 63 | 63 | $cite['file'] = preg_replace( |
| 64 | - '/^'.addcslashes(base_path(), '\/').'/', |
|
| 64 | + '/^' . addcslashes(base_path(), '\/') . '/', |
|
| 65 | 65 | '', |
| 66 | 66 | $cite['file'] |
| 67 | 67 | ); |
| 68 | 68 | $cite = VocabCite::firstOrCreate($cite); |
| 69 | 69 | $vocab->cites()->sync([$cite->id], false); |
| 70 | 70 | if (!$cite->code) { |
| 71 | - $lines = explode("\n", file_get_contents(base_path().$cite->file)); |
|
| 71 | + $lines = explode("\n", file_get_contents(base_path() . $cite->file)); |
|
| 72 | 72 | $cite->code = $lines[$cite->line - 1]; |
| 73 | 73 | if (substr($cite->file, -10) != '.blade.php') { |
| 74 | 74 | for ($start = $cite->line - 2; $start > -1; $start--) { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | $code = array_filter(array_slice($lines, $start, $end - $start + 1, true), 'trim'); |
| 89 | 89 | $max = strlen($end); |
| 90 | - $cite->code = implode("\n", array_map(function ($u, $v) use ($max) { |
|
| 90 | + $cite->code = implode("\n", array_map(function($u, $v) use ($max) { |
|
| 91 | 91 | return sprintf("%{$max}d %s", $u + 1, rtrim($v)); |
| 92 | 92 | }, array_keys($code), $code)); |
| 93 | 93 | $cite->save(); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | function sweep() |
| 106 | 106 | { |
| 107 | 107 | array_map( |
| 108 | - function ($u) { |
|
| 108 | + function($u) { |
|
| 109 | 109 | $u->sweep(); |
| 110 | 110 | }, |
| 111 | 111 | array_merge( |