@@ -145,7 +145,7 @@ |
||
145 | 145 | /** |
146 | 146 | * Get the services provided by the provider. |
147 | 147 | * |
148 | - * @return array |
|
148 | + * @return string[] |
|
149 | 149 | */ |
150 | 150 | public function provides() |
151 | 151 | { |
@@ -14,7 +14,6 @@ |
||
14 | 14 | use Illuminate\Support\ServiceProvider; |
15 | 15 | use Longman\LaravelMultiLang\Console\MigrationCommand; |
16 | 16 | use Longman\LaravelMultiLang\Console\TextsCommand; |
17 | -use Route; |
|
18 | 17 | use Illuminate\Routing\Events\RouteMatched; |
19 | 18 | |
20 | 19 | class MultiLangServiceProvider extends ServiceProvider |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | ); |
49 | 49 | |
50 | 50 | // Register blade directives |
51 | - Blade::directive('t', function ($expression) { |
|
51 | + Blade::directive('t', function($expression) { |
|
52 | 52 | return "<?php echo e(t({$expression})); ?>"; |
53 | 53 | }); |
54 | 54 | |
55 | - $this->app['events']->listen(RouteMatched::class, function ($match) { |
|
55 | + $this->app['events']->listen(RouteMatched::class, function($match) { |
|
56 | 56 | $scope = $this->app['config']->get('app.scope'); |
57 | 57 | if ($scope && $scope != 'global') { |
58 | 58 | $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,13 +102,13 @@ discard block |
||
102 | 102 | $this->app->alias('multilang', 'Longman\LaravelMultiLang\MultiLang'); |
103 | 103 | |
104 | 104 | $this->app['command.multilang.migration'] = $this->app->share( |
105 | - function () { |
|
105 | + function() { |
|
106 | 106 | return new MigrationCommand(); |
107 | 107 | } |
108 | 108 | ); |
109 | 109 | |
110 | 110 | $this->app['command.multilang.texts'] = $this->app->share( |
111 | - function () { |
|
111 | + function() { |
|
112 | 112 | return new TextsCommand(); |
113 | 113 | } |
114 | 114 | ); |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * Create a new MultiLang instance. |
43 | 43 | * |
44 | - * @param string $environment |
|
45 | - * @param array $config |
|
44 | + * @param Config $config |
|
46 | 45 | * @param \Illuminate\Cache\CacheManager $cache |
47 | 46 | * @param \Illuminate\Database\DatabaseManager $db |
48 | 47 | */ |
@@ -72,8 +71,8 @@ discard block |
||
72 | 71 | /** |
73 | 72 | * Load texts from database storage |
74 | 73 | * |
75 | - * @param $lang |
|
76 | - * @param null $scope |
|
74 | + * @param string $lang |
|
75 | + * @param string|null $scope |
|
77 | 76 | * @return array |
78 | 77 | */ |
79 | 78 | public function loadFromDatabase($lang, $scope = null) |
@@ -102,8 +101,8 @@ discard block |
||
102 | 101 | /** |
103 | 102 | * Load texts from cache storage |
104 | 103 | * |
105 | - * @param $lang |
|
106 | - * @param null $scope |
|
104 | + * @param string $lang |
|
105 | + * @param string|null $scope |
|
107 | 106 | * @return mixed |
108 | 107 | */ |
109 | 108 | public function loadFromCache($lang, $scope = null) |
@@ -116,9 +115,9 @@ discard block |
||
116 | 115 | /** |
117 | 116 | * Store texts in cache |
118 | 117 | * |
119 | - * @param $lang |
|
118 | + * @param string $lang |
|
120 | 119 | * @param array $texts |
121 | - * @param null $scope |
|
120 | + * @param string|null $scope |
|
122 | 121 | * @return $this |
123 | 122 | */ |
124 | 123 | public function storeInCache($lang, array $texts, $scope = null) |
@@ -130,7 +129,7 @@ discard block |
||
130 | 129 | /** |
131 | 130 | * Check if we must load texts from cache |
132 | 131 | * |
133 | - * @param $lang |
|
132 | + * @param string $lang |
|
134 | 133 | * @param null $scope |
135 | 134 | * @return bool |
136 | 135 | */ |
@@ -171,7 +170,7 @@ discard block |
||
171 | 170 | * Save missing texts in database |
172 | 171 | * |
173 | 172 | * @param $texts |
174 | - * @param null $scope |
|
173 | + * @param string $scope |
|
175 | 174 | * @return bool |
176 | 175 | */ |
177 | 176 | public function save($texts, $scope = null) |
@@ -216,7 +215,7 @@ discard block |
||
216 | 215 | /** |
217 | 216 | * Get texts table name |
218 | 217 | * |
219 | - * @return array|mixed|null |
|
218 | + * @return string |
|
220 | 219 | */ |
221 | 220 | public function getTableName() |
222 | 221 | { |
@@ -203,11 +203,11 @@ |
||
203 | 203 | $this->getDb() |
204 | 204 | ->table($table) |
205 | 205 | ->insert([ |
206 | - 'key' => $k, |
|
207 | - 'lang' => $lang, |
|
208 | - 'scope' => $scope, |
|
209 | - 'value' => $v, |
|
210 | - ]); |
|
206 | + 'key' => $k, |
|
207 | + 'lang' => $lang, |
|
208 | + 'scope' => $scope, |
|
209 | + 'value' => $v, |
|
210 | + ]); |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | return true; |
@@ -82,7 +82,7 @@ |
||
82 | 82 | ->where('lang', $lang); |
83 | 83 | |
84 | 84 | if (!is_null($scope)) { |
85 | - $query = $query->whereNested(function ($query) use ($scope) { |
|
85 | + $query = $query->whereNested(function($query) use ($scope) { |
|
86 | 86 | $query->where('scope', 'global'); |
87 | 87 | $query->orWhere('scope', $scope); |
88 | 88 | }); |
@@ -288,9 +288,9 @@ |
||
288 | 288 | |
289 | 289 | foreach ($locales as $locale => $val) { |
290 | 290 | $router->group([ |
291 | - 'prefix' => $locale, |
|
292 | - 'as' => $locale . '.', |
|
293 | - ], $callback); |
|
291 | + 'prefix' => $locale, |
|
292 | + 'as' => $locale . '.', |
|
293 | + ], $callback); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | } |