Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | public function handle(OpenApiSpecGenerator $generator) |
||
15 | { |
||
16 | $filename = $this->argument('filename'); |
||
17 | if (preg_match('/\.y[a]{0,1}ml$/i', $filename)) { |
||
|
|||
18 | $content = $this->createYamlContent($generator); |
||
19 | } else { |
||
20 | $content = $this->createJsonContent($generator); |
||
21 | } |
||
22 | if (@file_put_contents($this->argument('filename'), $content)) { |
||
23 | $this->output->writeln('Created file "' . $this->argument('filename') . '" successfully!'); |
||
24 | } else { |
||
25 | $this->output->error('Could not write file "' . $this->argument('filename') . '"!'); |
||
26 | return false; |
||
27 | } |
||
28 | return true; |
||
29 | } |
||
41 |