Conditions | 8 |
Paths | 7 |
Total Lines | 27 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function get($key, $locale = null, $default = null) |
||
18 | { |
||
19 | $this->fetch(); |
||
20 | |||
21 | if (!isset($this->items[$key])) { |
||
22 | return $default; |
||
23 | } |
||
24 | |||
25 | // non-assoc array of items |
||
26 | if(is_array($this->items[$key]) && key($this->items[$key]) === 0) { |
||
27 | return $this->items[$key]; |
||
28 | } |
||
29 | |||
30 | // Array of localized items |
||
31 | if (is_array($this->items[$key])) { |
||
32 | if (!$locale) { |
||
33 | $locale = app()->getLocale(); |
||
|
|||
34 | } |
||
35 | |||
36 | if ($this->items[$key] == null || !isset($this->items[$key][$locale])) { |
||
37 | return $default; |
||
38 | } |
||
39 | |||
40 | return $this->items[$key][$locale] ?? $default; |
||
41 | } |
||
42 | |||
43 | return $this->items[$key]; |
||
44 | } |
||
73 |