Total Complexity | 12 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class Settings extends Collection |
||
9 | { |
||
10 | public static function configValues(): array |
||
13 | } |
||
14 | |||
15 | public function get($key, $locale = null, $default = null) |
||
16 | { |
||
17 | $this->fetch(); |
||
18 | |||
19 | if (!isset($this->items[$key])) { |
||
20 | return $default; |
||
21 | } |
||
22 | |||
23 | if (is_array($this->items[$key])) { |
||
24 | if (!$locale) { |
||
25 | $locale = app()->getLocale(); |
||
|
|||
26 | } |
||
27 | |||
28 | if ($this->items[$key] == null || !isset($this->items[$key][$locale])) { |
||
29 | return $default; |
||
30 | } |
||
31 | |||
32 | return $this->items[$key][$locale] ?? $default; |
||
33 | } |
||
34 | |||
35 | return $this->items[$key]; |
||
36 | } |
||
37 | |||
38 | public function set($key, $value) |
||
41 | } |
||
42 | |||
43 | private function fetch() |
||
56 | } |
||
57 | |||
58 | public function fresh() |
||
65 |