Passed
Pull Request — master (#572)
by Dmitriy
02:20 queued 52s
created

Action::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 10
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Infrastructure\IO\Http\User\GetIndex;
6
7
use App\Application\User\Entity\UserRepository;
8
use App\Infrastructure\IO\Http\User\GetIndex\Response\ResponseFactory;
9
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...
10
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...
11
use Psr\Log\LoggerInterface;
0 ignored issues
show
Bug introduced by
The type Psr\Log\LoggerInterface 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...
12
13
/**
14
 * @OA\Tag(
15
 *     name="user",
16
 *     description="Users"
17
 * )
18
 *
19
 * @OA\Get(
20
 *     tags={"user"},
21
 *     path="/{locale}/users/",
22
 *     summary="Returns paginated users",
23
 *     description="",
24
 *     security={{"ApiKey": {}}},
25
 *     @OA\Parameter(
26
 *          @OA\Schema(type="string", example="en"),
27
 *          in="path",
28
 *          name="locale",
29
 *          parameter="locale"
30
 *     ),
31
 *     @OA\Response(
32
 *          response="200",
33
 *          description="Success",
34
 *          @OA\JsonContent(
35
 *              allOf={
36
 *                  @OA\Schema(ref="#/components/schemas/Response"),
37
 *                  @OA\Schema(
38
 *                      @OA\Property(
39
 *                          property="data",
40
 *                          type="object",
41
 *                          @OA\Property(
42
 *                              property="users",
43
 *                              type="array",
44
 *                              @OA\Items(ref="#/components/schemas/UserIndexResponse")
45
 *                          ),
46
 *                      ),
47
 *                  ),
48
 *              },
49
 *          )
50
 *    ),
51
 * )
52
 */
53
final class Action
54
{
55
    public function __invoke(
56
        ResponseFactory $responseFactory,
57
        UserRepository $userRepository,
58
        LoggerInterface $logger
59
    ): ResponseInterface {
60
        $dataReader = $userRepository->findAllOrderByLogin();
61
62
        $logger->debug('Collected {count} users', ['count' => $dataReader->count()]);
63
64
        return $responseFactory->create($dataReader);
65
    }
66
}
67