Conditions | 7 |
Paths | 10 |
Total Lines | 32 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public function handle() |
||
36 | { |
||
37 | $setting = $this->argument('setting'); |
||
38 | |||
39 | // load os definition if requested, and remove special definition_loaded key |
||
40 | if (preg_match('/^os\.(?<os>[^.]+)/', $setting, $matches)) { |
||
|
|||
41 | OS::loadDefinition($matches['os']); |
||
42 | Config::forget("os.{$matches['os']}.definition_loaded"); |
||
43 | } |
||
44 | |||
45 | if ($this->option('dump')) { |
||
46 | $this->line($setting ? json_encode(Config::get($setting)) : Config::toJson()); |
||
47 | |||
48 | return 0; |
||
49 | } |
||
50 | |||
51 | if (! $setting) { |
||
52 | throw new \RuntimeException('Not enough arguments (missing: "setting").'); |
||
53 | } |
||
54 | |||
55 | if (Config::has($setting)) { |
||
56 | $output = Config::get($setting); |
||
57 | if (! is_string($output)) { |
||
58 | $output = json_encode($output, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); |
||
59 | } |
||
60 | |||
61 | $this->line($output); |
||
62 | |||
63 | return 0; |
||
64 | } |
||
65 | |||
66 | return 1; |
||
67 | } |
||
69 |