Passed
Push — master ( 724f51...d895e0 )
by Alexander
02:14
created

IndexController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Controller;
6
7
use OpenApi\Annotations as OA;
8
use Psr\Http\Message\ResponseInterface;
9
use Yiisoft\DataResponse\DataResponseFactoryInterface;
10
11
/**
12
 * @OA\Info(title="Yii API application", version="1.0")
13
 */
14
class IndexController
15
{
16
    /**
17
     * @OA\Get(
18
     *     path="/",
19
     *     summary="Returns info about the API",
20
     *     description="",
21
     *
22
     *     @OA\Response(
23
     *          response="200",
24
     *          description="Success",
25
     *
26
     *          @OA\JsonContent(
27
     *              allOf={
28
     *
29
     *                  @OA\Schema(ref="#/components/schemas/Response"),
30
     *                  @OA\Schema(
31
     *
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
     *          )
49
     *    ),
50
     * )
51
     */
52
    public function index(DataResponseFactoryInterface $responseFactory): ResponseInterface
53
    {
54
        return $responseFactory->createResponse(['version' => '3.0', 'author' => 'yiisoft']);
55
    }
56
}
57