Passed
Pull Request — master (#87)
by Dmitriy
03:13
created

Action   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 1
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;
10
use Psr\Http\Message\ResponseInterface;
11
12
/**
13
 * @OA\Tag(
14
 *     name="user",
15
 *     description="Users"
16
 * )
17
 *
18
 * @OA\Get(
19
 *     tags={"user"},
20
 *     path="/users/",
21
 *     summary="Returns paginated users",
22
 *     description="",
23
 *     security={{"ApiKey": {}}},
24
 *     @OA\Response(
25
 *          response="200",
26
 *          description="Success",
27
 *          @OA\JsonContent(
28
 *              allOf={
29
 *                  @OA\Schema(ref="#/components/schemas/Response"),
30
 *                  @OA\Schema(
31
 *                      @OA\Property(
32
 *                          property="data",
33
 *                          type="object",
34
 *                          @OA\Property(
35
 *                              property="users",
36
 *                              type="array",
37
 *                              @OA\Items(ref="#/components/schemas/UserIndexResponse")
38
 *                          ),
39
 *                      ),
40
 *                  ),
41
 *              },
42
 *          )
43
 *    ),
44
 * )
45
 */
46
final class Action
47
{
48 1
    public function __invoke(
49
        ResponseFactory $responseFactory,
50
        UserRepository $userRepository,
51
    ): ResponseInterface {
52 1
        $dataReader = $userRepository->findAllOrderByLogin();
53
54 1
        return $responseFactory->create($dataReader);
55
    }
56
}
57