@@ -65,7 +65,6 @@ |
||
65 | 65 | /** |
66 | 66 | * Create the migration. |
67 | 67 | * |
68 | - * @param string $name |
|
69 | 68 | * @return bool |
70 | 69 | */ |
71 | 70 | protected function createMigration($table) |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $this->info('Migration successfully created!'); |
54 | 54 | } else { |
55 | 55 | $this->error( |
56 | - 'Couldn\'t create migration.'.PHP_EOL.' Check the write permissions |
|
56 | + 'Couldn\'t create migration.' . PHP_EOL . ' Check the write permissions |
|
57 | 57 | within the database/migrations directory.' |
58 | 58 | ); |
59 | 59 | } |
@@ -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 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ); |
44 | 44 | |
45 | 45 | // Register blade directives |
46 | - Blade::directive('t', function ($expression) { |
|
46 | + Blade::directive('t', function($expression) { |
|
47 | 47 | return "<?php echo e(t({$expression})); ?>"; |
48 | 48 | }); |
49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $configPath = __DIR__ . '/../config/config.php'; |
60 | 60 | $this->mergeConfigFrom($configPath, 'debugbar'); |
61 | 61 | |
62 | - $this->app->singleton('multilang', function ($app) { |
|
62 | + $this->app->singleton('multilang', function($app) { |
|
63 | 63 | $locale = $app->getLocale(); |
64 | 64 | $environment = $app->environment(); |
65 | 65 | $config = $app['config']->get('multilang'); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $multilang->setLocale($locale); |
75 | 75 | |
76 | 76 | if ($multilang->autoSaveIsAllowed()) { |
77 | - $this->app->terminating(function () use ($multilang) { |
|
77 | + $this->app->terminating(function() use ($multilang) { |
|
78 | 78 | return $multilang->saveTexts(); |
79 | 79 | }); |
80 | 80 | } |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | $this->app->alias('multilang', 'Longman\LaravelMultiLang\MultiLang'); |
86 | 86 | |
87 | 87 | $this->app['command.multilang.migration'] = $this->app->share( |
88 | - function ($app) { |
|
88 | + function($app) { |
|
89 | 89 | return new MigrationCommand(); |
90 | 90 | } |
91 | 91 | ); |
92 | 92 | |
93 | 93 | $this->app['command.multilang.texts'] = $this->app->share( |
94 | - function ($app) { |
|
94 | + function($app) { |
|
95 | 95 | return new TextsCommand(); |
96 | 96 | } |
97 | 97 | ); |
@@ -35,7 +35,6 @@ |
||
35 | 35 | /** |
36 | 36 | * Get translated text |
37 | 37 | * |
38 | - * @param mixed $key |
|
39 | 38 | * @return mixed |
40 | 39 | */ |
41 | 40 | function t($text) |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param array $config |
89 | 89 | * @param \Illuminate\Cache\CacheManager $cache |
90 | 90 | * @param \Illuminate\Database\DatabaseManager $db |
91 | - * @return void |
|
91 | + * @return string |
|
92 | 92 | */ |
93 | 93 | public function __construct($environment, array $config, CacheContract $cache, DatabaseContract $db) |
94 | 94 | { |
@@ -127,6 +127,9 @@ discard block |
||
127 | 127 | return $config; |
128 | 128 | } |
129 | 129 | |
130 | + /** |
|
131 | + * @param string $key |
|
132 | + */ |
|
130 | 133 | public function getConfig($key = null) |
131 | 134 | { |
132 | 135 | if ($key === null) { |
@@ -141,7 +144,7 @@ discard block |
||
141 | 144 | * |
142 | 145 | * @param string $lang |
143 | 146 | * @param string $default_lang |
144 | - * @param array $text |
|
147 | + * @param array $texts |
|
145 | 148 | * @return void |
146 | 149 | */ |
147 | 150 | public function setLocale($lang, $default_lang = null, $texts = null) |
@@ -199,7 +202,6 @@ discard block |
||
199 | 202 | * Get translated text |
200 | 203 | * |
201 | 204 | * @param string $key |
202 | - * @param string $default |
|
203 | 205 | * @return string |
204 | 206 | */ |
205 | 207 | public function get($key) |
@@ -226,7 +228,7 @@ discard block |
||
226 | 228 | /** |
227 | 229 | * Get texts |
228 | 230 | * |
229 | - * @return array |
|
231 | + * @return string|null |
|
230 | 232 | */ |
231 | 233 | public function getRedirectUrl(Request $request) |
232 | 234 | { |
@@ -317,6 +319,9 @@ discard block |
||
317 | 319 | return $status; |
318 | 320 | } |
319 | 321 | |
322 | + /** |
|
323 | + * @param string|null $lang |
|
324 | + */ |
|
320 | 325 | public function loadTextsFromDatabase($lang) |
321 | 326 | { |
322 | 327 | $texts = $lang ? $this->db->table($this->getTableName()) |
@@ -337,6 +342,9 @@ discard block |
||
337 | 342 | return $texts; |
338 | 343 | } |
339 | 344 | |
345 | + /** |
|
346 | + * @param string $lang |
|
347 | + */ |
|
340 | 348 | public function setCacheName($lang) |
341 | 349 | { |
342 | 350 | $this->cache_name = $this->getConfig('texts_table') . '_' . $lang; |
@@ -378,7 +378,7 @@ |
||
378 | 378 | $table = $this->getTableName(); |
379 | 379 | $locales = $this->getConfig('locales'); |
380 | 380 | foreach ($this->new_texts as $k => $v) { |
381 | - foreach($locales as $lang => $locale_data) { |
|
381 | + foreach ($locales as $lang => $locale_data) { |
|
382 | 382 | $exists = $this->db->table($table)->where([ |
383 | 383 | 'key' => $k, |
384 | 384 | 'lang' => $lang, |