@@ -28,16 +28,15 @@ |
||
28 | 28 | /** |
29 | 29 | * Create a new MultiLang instance. |
30 | 30 | * |
31 | - * @param string $environment |
|
32 | - * @param array $config |
|
33 | - * @param \Illuminate\Cache\CacheManager $cache |
|
34 | - * @param \Illuminate\Database\DatabaseManager $db |
|
35 | 31 | */ |
36 | 32 | public function __construct(array $data) |
37 | 33 | { |
38 | 34 | $this->data = $data; |
39 | 35 | } |
40 | 36 | |
37 | + /** |
|
38 | + * @param string $key |
|
39 | + */ |
|
41 | 40 | public function get($key = null, $default = null) |
42 | 41 | { |
43 | 42 | $array = $this->data; |
@@ -12,9 +12,6 @@ |
||
12 | 12 | |
13 | 13 | use Illuminate\Cache\CacheManager as Cache; |
14 | 14 | use Illuminate\Database\DatabaseManager as Database; |
15 | -use Illuminate\Http\Request; |
|
16 | -use Illuminate\Support\Collection; |
|
17 | -use InvalidArgumentException; |
|
18 | 15 | |
19 | 16 | class Config |
20 | 17 | { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | /** |
215 | 215 | * Get texts |
216 | 216 | * |
217 | - * @return array |
|
217 | + * @return string|null |
|
218 | 218 | */ |
219 | 219 | public function getRedirectUrl(Request $request) |
220 | 220 | { |
@@ -246,6 +246,9 @@ discard block |
||
246 | 246 | return null; |
247 | 247 | } |
248 | 248 | |
249 | + /** |
|
250 | + * @return string |
|
251 | + */ |
|
249 | 252 | public function detectLocale(Request $request) |
250 | 253 | { |
251 | 254 | $locale = $request->segment(1); |
@@ -314,6 +317,9 @@ discard block |
||
314 | 317 | return $this; |
315 | 318 | } |
316 | 319 | |
320 | + /** |
|
321 | + * @param string|null $lang |
|
322 | + */ |
|
317 | 323 | public function loadTextsFromDatabase($lang) |
318 | 324 | { |
319 | 325 | $texts = $lang ? $this->getDb()->table($this->getTableName()) |
@@ -334,6 +340,9 @@ discard block |
||
334 | 340 | return $texts; |
335 | 341 | } |
336 | 342 | |
343 | + /** |
|
344 | + * @param string $lang |
|
345 | + */ |
|
337 | 346 | public function setCacheName($lang) |
338 | 347 | { |
339 | 348 | $this->cache_name = $this->config->get('db.texts_table') . '_' . $lang; |
@@ -401,6 +410,9 @@ discard block |
||
401 | 410 | return true; |
402 | 411 | } |
403 | 412 | |
413 | + /** |
|
414 | + * @return string |
|
415 | + */ |
|
404 | 416 | protected function getTableName() |
405 | 417 | { |
406 | 418 | $table = $this->config->get('db.texts_table', 'texts'); |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * Create a new MultiLang instance. |
61 | 61 | * |
62 | - * @param string $environment |
|
63 | - * @param array $config |
|
62 | + * @param Config $config |
|
64 | 63 | * @param \Illuminate\Cache\CacheManager $cache |
65 | 64 | * @param \Illuminate\Database\DatabaseManager $db |
66 | 65 | */ |
@@ -149,6 +148,9 @@ discard block |
||
149 | 148 | } |
150 | 149 | |
151 | 150 | |
151 | + /** |
|
152 | + * @return string |
|
153 | + */ |
|
152 | 154 | protected function getTableName() |
153 | 155 | { |
154 | 156 | $table = $this->config->get('db.texts_table', 'texts'); |
@@ -12,9 +12,6 @@ |
||
12 | 12 | |
13 | 13 | use Illuminate\Cache\CacheManager as Cache; |
14 | 14 | use Illuminate\Database\DatabaseManager as Database; |
15 | -use Illuminate\Http\Request; |
|
16 | -use Illuminate\Support\Collection; |
|
17 | -use InvalidArgumentException; |
|
18 | 15 | use Longman\LaravelMultiLang\Config; |
19 | 16 | |
20 | 17 | class Repository |
@@ -66,7 +66,7 @@ |
||
66 | 66 | */ |
67 | 67 | public function __construct(Config $config, Cache $cache, Database $db) |
68 | 68 | { |
69 | - $this->config = $config; |
|
69 | + $this->config = $config; |
|
70 | 70 | $this->cache = $cache; |
71 | 71 | $this->db = $db; |
72 | 72 |