Issues (25)

src/Controllers/DocsController.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\JsonResponse;
0 ignored issues
show
The type Zend\Diactoros\Response\JsonResponse 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 JSON.
10
 */
11
class DocsController
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 JsonResponse(
29
            $this->openApiSpecGenerator->getOpenApiSpec()->toArray(),
30
            200,
31
            [],
32
            JSON_UNESCAPED_SLASHES
33
        );
34
    }
35
}
36