InfoController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 25 1
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App;
6
7
use OpenApi\Attributes as OA;
0 ignored issues
show
Bug introduced by
The type OpenApi\Attributes 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...
8
use Psr\Http\Message\ResponseInterface;
0 ignored issues
show
Bug introduced by
The type Psr\Http\Message\ResponseInterface 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...
9
use Yiisoft\DataResponse\DataResponseFactoryInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\DataResponse\DataResponseFactoryInterface 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...
10
11
#[OA\Info(version: '1.0', title: 'Yii API application')]
12
class InfoController
13
{
14
    public function __construct(private VersionProvider $versionProvider)
15
    {
16
    }
17
18
    #[OA\Get(
19
        path: '/',
20
        description: '',
21
        summary: 'Returns info about the API',
22
        responses: [
23
            new OA\Response(
24
                response:'200',
25
                description:'Success',
26
                content: new OA\JsonContent(
27
                    allOf: [
28
                        new OA\Schema(ref: '#/components/schemas/Response'),
29
                        new OA\Schema(properties: [
30
                            new OA\Property(property: 'data', properties: [
31
                                new OA\Property(property: 'version', type: 'string', example: '3.0'),
32
                                new OA\Property(property: 'author', type: 'string', example: 'yiisoft'),
33
                            ], type: 'object'),
34
                        ]),
35
                    ]
36
                ),
37
            ),
38
        ]
39
    )]
40
    public function index(DataResponseFactoryInterface $responseFactory): ResponseInterface
41
    {
42
        return $responseFactory->createResponse(['version' => $this->versionProvider->version, 'author' => 'yiisoft']);
43
    }
44
}
45