These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | |||
4 | namespace hiapi\Service\OpenApi\Endpoint; |
||
5 | |||
6 | use cebe\openapi\Writer; |
||
7 | use hiapi\Service\OpenApi\OpenAPIGenerator; |
||
8 | use Laminas\Diactoros\Response; |
||
9 | |||
10 | final class OpenAPISchemaAction |
||
11 | { |
||
12 | private OpenAPIGenerator $openApiGenerator; |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
13 | |||
14 | public function __construct(OpenAPIGenerator $openApiGenerator) |
||
15 | { |
||
16 | $this->openApiGenerator = $openApiGenerator; |
||
17 | } |
||
18 | |||
19 | public function __invoke(OpenAPISchemaCommand $command) |
||
20 | { |
||
21 | $openApi = $this->openApiGenerator->__invoke(); |
||
22 | $json = Writer::writeToJson($openApi); |
||
23 | return new Response\TextResponse($json, 200, [ |
||
24 | 'Content-Type' => ['application/json'], |
||
25 | ]); |
||
26 | } |
||
27 | } |
||
28 |