| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 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 | } |
||
| 39 |