Issues (25)

src/Controllers/DocsYamlController.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace W2w\Lib\Apie\Controllers;
4
5
use W2w\Lib\Apie\OpenApiSchema\OpenApiSpecGenerator;
6
use Zend\Diactoros\Response\TextResponse;
0 ignored issues
show
The type Zend\Diactoros\Response\TextResponse was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
/**
9
 * Returns the OpenAPI specs as YAML.
10
 */
11
class DocsYamlController
12
{
13
    /**
14
     * @var OpenApiSpecGenerator
15
     */
16
    private $openApiSpecGenerator;
17
18
    /**
19
     * @param OpenApiSpecGenerator $openApiSpecGenerator
20
     */
21
    public function __construct(OpenApiSpecGenerator $openApiSpecGenerator)
22
    {
23
        $this->openApiSpecGenerator = $openApiSpecGenerator;
24
    }
25
26
    public function __invoke()
27
    {
28
        return new TextResponse(
29
            $this->openApiSpecGenerator->getOpenApiSpec()->toYaml(),
30
            200,
31
            [
32
                'Content-Type' => 'application/vnd.oai.openapi+yaml',
33
            ]
34
        );
35
    }
36
}
37