Test Failed
Push — master ( 76df14...d7ef17 )
by
unknown
13:45
created

InfoController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 2
c 2
b 0
f 0
dl 0
loc 41
rs 10
ccs 2
cts 2
cp 1
wmc 2

2 Methods

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