Completed
Push — master ( 83fca8...0d9c6e )
by Andrii
10:43
created

Service/OpenApi/Endpoint/OpenAPISchemaAction.php (1 issue)

Upgrade to new PHP Analysis Engine

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
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
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