| Total Complexity | 12 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class Settings extends Collection |
||
| 9 | { |
||
| 10 | 13 | public static function configValues(): array |
|
| 13 | } |
||
| 14 | |||
| 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 | } |
||
| 37 | |||
| 38 | 1 | public function set($key, $value) |
|
| 41 | 1 | } |
|
| 42 | |||
| 43 | 13 | private function fetch() |
|
| 56 | 13 | } |
|
| 57 | |||
| 58 | 2 | public function fresh() |
|
| 65 |