| Total Complexity | 6 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class PageSettingsCollection extends Collection |
||
| 14 | { |
||
| 15 | 2 | public function getSettingValue(string $key, string $type = 'string', $default = null, ...$parameters) |
|
| 16 | { |
||
| 17 | /** @var PageSetting $setting */ |
||
| 18 | 2 | if ($setting = $this->firstWhere('key', $key)) { |
|
| 19 | 2 | if (is_object($setting) && method_exists($setting, ($method = 'value'.Str::ucfirst($type)))) { |
|
| 20 | 1 | return $setting->$method(...$parameters); |
|
| 21 | } |
||
| 22 | |||
| 23 | 1 | return Arr::get($setting, 'value'); |
|
| 24 | } |
||
| 25 | |||
| 26 | 1 | return $default; |
|
| 27 | } |
||
| 28 | |||
| 29 | 2 | public function __call($method, $parameters) |
|
| 37 | } |
||
| 38 | } |
||
| 39 |