@@ -24,10 +24,10 @@ |
||
| 24 | 24 | $options['scope'] = $request->scope; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - $texts = Text::where(function ($q) use ($options) { |
|
| 27 | + $texts = Text::where(function($q) use ($options) { |
|
| 28 | 28 | foreach ($options as $k => $v) { |
| 29 | 29 | if ($k == 'keyword') { |
| 30 | - $q->where(function ($query) use ($v) { |
|
| 30 | + $q->where(function($query) use ($v) { |
|
| 31 | 31 | $query->where('key', 'LIKE', '%' . $v . '%')->orWhere('value', 'LIKE', '%' . $v . '%'); |
| 32 | 32 | }); |
| 33 | 33 | } else { |
@@ -263,7 +263,7 @@ |
||
| 263 | 263 | */ |
| 264 | 264 | protected function sortReplacements(array $replace) |
| 265 | 265 | { |
| 266 | - return (new Collection($replace))->sortBy(function ($value, $key) { |
|
| 266 | + return (new Collection($replace))->sortBy(function($value, $key) { |
|
| 267 | 267 | return mb_strlen($key) * -1; |
| 268 | 268 | }); |
| 269 | 269 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | ->where('lang', $lang); |
| 81 | 81 | |
| 82 | 82 | if (!is_null($scope)) { |
| 83 | - $query = $query->whereNested(function ($query) use ($scope) { |
|
| 83 | + $query = $query->whereNested(function($query) use ($scope) { |
|
| 84 | 84 | $query->where('scope', 'global'); |
| 85 | 85 | $query->orWhere('scope', $scope); |
| 86 | 86 | }); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | if (!is_null($scope)) { |
| 116 | - $query = $query->whereNested(function ($query) use ($scope) { |
|
| 116 | + $query = $query->whereNested(function($query) use ($scope) { |
|
| 117 | 117 | $query->where('scope', 'global'); |
| 118 | 118 | $query->orWhere('scope', $scope); |
| 119 | 119 | }); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $table = Config::get('multilang.db.texts_table'); |
| 40 | 40 | |
| 41 | 41 | if ('' == $table) { |
| 42 | - $this->error('Couldn\'t create migration.'.PHP_EOL.'Table name can\'t be empty. Check your configuration.'); |
|
| 42 | + $this->error('Couldn\'t create migration.' . PHP_EOL . 'Table name can\'t be empty. Check your configuration.'); |
|
| 43 | 43 | |
| 44 | 44 | return; |
| 45 | 45 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $this->info('Migration successfully created!'); |
| 61 | 61 | } else { |
| 62 | 62 | $this->error( |
| 63 | - 'Couldn\'t create migration.'.PHP_EOL.' Check the write permissions |
|
| 63 | + 'Couldn\'t create migration.' . PHP_EOL . ' Check the write permissions |
|
| 64 | 64 | within the database/migrations directory.' |
| 65 | 65 | ); |
| 66 | 66 | } |
@@ -83,16 +83,16 @@ discard block |
||
| 83 | 83 | $this->db = $this->getDatabase(); |
| 84 | 84 | |
| 85 | 85 | $lang = $this->option('lang'); |
| 86 | - if (! empty($lang)) { |
|
| 86 | + if (!empty($lang)) { |
|
| 87 | 87 | $this->langs = explode(',', $lang); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $scopes = $this->scopes; |
| 91 | 91 | $scope = $this->option('scope'); |
| 92 | - if (! empty($scope)) { |
|
| 92 | + if (!empty($scope)) { |
|
| 93 | 93 | $scopes = explode(',', $scope); |
| 94 | 94 | foreach ($scopes as $scope) { |
| 95 | - if (! in_array($scope, $this->scopes)) { |
|
| 95 | + if (!in_array($scope, $this->scopes)) { |
|
| 96 | 96 | throw new InvalidArgumentException('Scope "' . $scope . '" is not found! Available scopes is ' . implode(', ', $this->scopes)); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $path = $this->option('path', 'storage/multilang'); |
| 102 | 102 | $this->path = base_path($path); |
| 103 | - if (! is_dir($this->path)) { |
|
| 103 | + if (!is_dir($this->path)) { |
|
| 104 | 104 | throw new InvalidArgumentException('Folder "' . $this->path . '" is not accessible!'); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | protected function import($scope = 'global', $force = false) |
| 114 | 114 | { |
| 115 | 115 | $path = $this->path . '/' . $scope . '.yml'; |
| 116 | - if (! is_readable($path)) { |
|
| 116 | + if (!is_readable($path)) { |
|
| 117 | 117 | $this->warn('File "' . $path . '" is not readable!'); |
| 118 | 118 | return false; |
| 119 | 119 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $key = $text['key']; |
| 132 | 132 | |
| 133 | 133 | foreach ($text['texts'] as $lang => $value) { |
| 134 | - if (! empty($this->langs) && ! in_array($lang, $this->langs)) { |
|
| 134 | + if (!empty($this->langs) && !in_array($lang, $this->langs)) { |
|
| 135 | 135 | continue; |
| 136 | 136 | } |
| 137 | 137 | |
@@ -84,16 +84,16 @@ discard block |
||
| 84 | 84 | $this->db = $this->getDatabase(); |
| 85 | 85 | |
| 86 | 86 | $lang = $this->option('lang'); |
| 87 | - if (! empty($lang)) { |
|
| 87 | + if (!empty($lang)) { |
|
| 88 | 88 | $this->langs = explode(',', $lang); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $scopes = $this->scopes; |
| 92 | 92 | $scope = $this->option('scope'); |
| 93 | - if (! empty($scope)) { |
|
| 93 | + if (!empty($scope)) { |
|
| 94 | 94 | $scopes = explode(',', $scope); |
| 95 | 95 | foreach ($scopes as $scope) { |
| 96 | - if (! in_array($scope, $this->scopes)) { |
|
| 96 | + if (!in_array($scope, $this->scopes)) { |
|
| 97 | 97 | throw new InvalidArgumentException('Scope "' . $scope . '" is not found! Available scopes is ' . implode(', ', $this->scopes)); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $path = $this->option('path', 'storage/multilang'); |
| 103 | 103 | $this->path = base_path($path); |
| 104 | - if (! is_dir($this->path)) { |
|
| 104 | + if (!is_dir($this->path)) { |
|
| 105 | 105 | throw new InvalidArgumentException('Folder "' . $this->path . '" is not accessible!'); |
| 106 | 106 | } |
| 107 | - if (! is_writable($this->path)) { |
|
| 107 | + if (!is_writable($this->path)) { |
|
| 108 | 108 | throw new InvalidArgumentException('Folder "' . $this->path . '" is not writable!'); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | $dbTexts = $this->getTextsFromDb($scope); |
| 149 | 149 | |
| 150 | - $fileTexts = ! $clear ? $this->getTextsFromFile($scope) : []; |
|
| 150 | + $fileTexts = !$clear ? $this->getTextsFromFile($scope) : []; |
|
| 151 | 151 | |
| 152 | 152 | $textsToWrite = $force ? array_replace_recursive($fileTexts, $dbTexts) : array_replace_recursive($dbTexts, $fileTexts); |
| 153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | $path = $this->path . '/' . $scope . '.yml'; |
| 160 | 160 | $written = file_put_contents($path, $yaml); |
| 161 | - if (! $written) { |
|
| 161 | + if (!$written) { |
|
| 162 | 162 | $this->error('Export texts of "' . $scope . '" is failed!'); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | foreach ($dbTexts as $text) { |
| 203 | 203 | $key = $text->key; |
| 204 | 204 | $lang = $text->lang; |
| 205 | - if (! isset($formattedDbTexts[$key])) { |
|
| 205 | + if (!isset($formattedDbTexts[$key])) { |
|
| 206 | 206 | $formattedDbTexts[$key] = ['key' => $key]; |
| 207 | 207 | } |
| 208 | 208 | $formattedDbTexts[$key]['texts'][$lang] = $text->value; |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | 51 | // Register blade directives |
| 52 | - Blade::directive('t', function ($expression) { |
|
| 52 | + Blade::directive('t', function($expression) { |
|
| 53 | 53 | return "<?php echo e(t({$expression})); ?>"; |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | - $this->app['events']->listen(RouteMatched::class, function () { |
|
| 56 | + $this->app['events']->listen(RouteMatched::class, function() { |
|
| 57 | 57 | $scope = $this->app['config']->get('app.scope'); |
| 58 | 58 | if ($scope && $scope != 'global') { |
| 59 | 59 | $this->app['multilang']->setScope($scope); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $configPath = __DIR__ . '/../config/config.php'; |
| 75 | 75 | $this->mergeConfigFrom($configPath, 'debugbar'); |
| 76 | 76 | |
| 77 | - $this->app->singleton('multilang', function ($app) { |
|
| 77 | + $this->app->singleton('multilang', function($app) { |
|
| 78 | 78 | $environment = $app->environment(); |
| 79 | 79 | $config = $app['config']->get('multilang'); |
| 80 | 80 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | 88 | if ($multilang->autoSaveIsAllowed()) { |
| 89 | - $app->terminating(function () use ($multilang) { |
|
| 89 | + $app->terminating(function() use ($multilang) { |
|
| 90 | 90 | $scope = $this->app['config']->get('app.scope'); |
| 91 | 91 | if ($scope && $scope != 'global') { |
| 92 | 92 | $multilang->setScope($scope); |
@@ -102,28 +102,28 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $this->app->singleton( |
| 104 | 104 | 'command.multilang.migration', |
| 105 | - function () { |
|
| 105 | + function() { |
|
| 106 | 106 | return new MigrationCommand(); |
| 107 | 107 | } |
| 108 | 108 | ); |
| 109 | 109 | |
| 110 | 110 | $this->app->singleton( |
| 111 | 111 | 'command.multilang.texts', |
| 112 | - function () { |
|
| 112 | + function() { |
|
| 113 | 113 | return new TextsCommand(); |
| 114 | 114 | } |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | 117 | $this->app->singleton( |
| 118 | 118 | 'command.multilang.import', |
| 119 | - function () { |
|
| 119 | + function() { |
|
| 120 | 120 | return new ImportCommand(); |
| 121 | 121 | } |
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | 124 | $this->app->singleton( |
| 125 | 125 | 'command.multilang.export', |
| 126 | - function () { |
|
| 126 | + function() { |
|
| 127 | 127 | return new ExportCommand(); |
| 128 | 128 | } |
| 129 | 129 | ); |