Conditions | 6 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
15 | 13 | public function get($key, $locale = null, $default = null) |
|
16 | { |
||
17 | 13 | $this->fetch(); |
|
18 | |||
19 | 13 | if (!isset($this->items[$key])) { |
|
20 | 4 | return $default; |
|
21 | } |
||
22 | |||
23 | 9 | if (is_array($this->items[$key])) { |
|
24 | 5 | if (!$locale) { |
|
25 | 4 | $locale = app()->getLocale(); |
|
|
|||
26 | } |
||
27 | |||
28 | 5 | if ($this->items[$key] == null || !isset($this->items[$key][$locale])) { |
|
29 | 1 | return $default; |
|
30 | } |
||
31 | |||
32 | 5 | return $this->items[$key][$locale] ?? $default; |
|
33 | } |
||
34 | |||
35 | 4 | return $this->items[$key]; |
|
36 | } |
||
65 |