IndexController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 19
c 0
b 0
f 0
dl 0
loc 28
rs 10

1 Method

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