| Total Complexity | 10 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class Settings extends Collection |
||
| 9 | { |
||
| 10 | public static function configValues(): array |
||
| 11 | { |
||
| 12 | return config('thinktomorrow.chief-settings'); |
||
| 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 ($this->items[$key]['value'] == null) { |
||
| 25 | return $default; |
||
| 26 | } |
||
| 27 | |||
| 28 | return $this->items[$key]['value']; |
||
| 29 | } |
||
| 30 | |||
| 31 | return $this->items[$key]; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function set($key, $value) |
||
| 37 | } |
||
| 38 | |||
| 39 | private function fetch() |
||
| 52 | } |
||
| 53 | |||
| 54 | public function fresh() |
||
| 61 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.