| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Anomaly\SettingsModule\Setting\Command; |
||
| 41 | public function handle(Repository $config, Container $container) |
||
| 42 | { |
||
| 43 | $parts = explode('::', $this->settingKey); |
||
| 44 | $namespace = $parts[0]; |
||
| 45 | $key = $parts[1]; |
||
| 46 | |||
| 47 | if (!$fields = $config->get($namespace . '::settings/settings')) { |
||
| 48 | $fields = $config->get($namespace . '::settings'); |
||
| 49 | } |
||
| 50 | |||
| 51 | $defaultValue = array_get($fields, $key . '.config.default_value', null); |
||
| 52 | |||
| 53 | /** |
||
| 54 | * If it is a closure, run it through the IoC container |
||
| 55 | */ |
||
| 56 | if ($fields && ($defaultValue instanceof \Closure)) { |
||
| 57 | |||
| 58 | return $container->call($defaultValue); |
||
| 59 | } |
||
| 60 | |||
| 61 | return $defaultValue; |
||
| 62 | } |
||
| 63 | } |