Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace HSkrasek\OpenAPI\Command\Stages; |
||
21 | public function __invoke($payload) |
||
22 | { |
||
23 | foreach ($payload[0] as $filename => $jsonSchema) { |
||
24 | $schemaPath = $payload[1] . DIRECTORY_SEPARATOR . pathinfo($filename, PATHINFO_FILENAME) . '.json'; |
||
25 | |||
26 | if ($this->filesystem->has($schemaPath)) { |
||
27 | $this->filesystem->delete($schemaPath); |
||
28 | } |
||
29 | |||
30 | $this->filesystem->put( |
||
31 | $schemaPath, |
||
32 | json_encode($jsonSchema, JSON_PRETTY_PRINT) |
||
33 | ); |
||
34 | } |
||
35 | |||
36 | return \count($payload[0]); |
||
37 | } |
||
38 | } |
||
39 |