Passed
Pull Request — master (#572)
by Alexander
02:59 queued 01:28
created

Action   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Infrastructure\IO\Http\Home\GetIndex;
6
7
use App\Infrastructure\VersionProvider;
8
use OpenApi\Annotations as OA;
0 ignored issues
show
Bug introduced by
The type OpenApi\Annotations 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 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...
10
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...
11
12
/**
13
 * @OA\Info(title="Yii API application", version="1.0")
14
 *
15
 * @OA\Get(
16
 *     path="/{locale}/",
17
 *     summary="Returns info about the API",
18
 *     description="",
19
 *     @OA\Parameter(
20
 *          @OA\Schema(type="string", example="en"),
21
 *          in="path",
22
 *          name="locale",
23
 *          parameter="locale"
24
 *     ),
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
 *          )
49
 *    ),
50
 * )
51
 */
52
final class Action
53
{
54
    public function __construct(
55
        private readonly VersionProvider $versionProvider,
56
    ) {
57
    }
58
59
    public function __invoke(DataResponseFactoryInterface $responseFactory): ResponseInterface
60
    {
61
        return $responseFactory->createResponse(['version' => $this->versionProvider->version, 'author' => 'yiisoft']);
62
    }
63
}
64