Passed
Pull Request — master (#572)
by Dmitriy
01:31
created

Action   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Infrastructure\IO\Http\Auth\PostLogout;
6
7
use App\Application\User\Service\UserService;
8
use App\Infrastructure\IO\Http\Auth\PostLogout\Request\Request;
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 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...
12
13
/**
14
 * @OA\Tag(
15
 *     name="auth",
16
 *     description="Authentication"
17
 * )
18
 *
19
 * @OA\Post(
20
 *     tags={"auth"},
21
 *     path="/{locale}/auth/logout",
22
 *     summary="Logout",
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(ref="#/components/schemas/Response")
35
 *    ),
36
 *    @OA\Response(
37
 *          response="400",
38
 *          description="Bad request",
39
 *          @OA\JsonContent(ref="#/components/schemas/BadResponse")
40
 *     ),
41
 * )
42
 */
43
final class Action
44
{
45
    public function __construct(
46
        private DataResponseFactoryInterface $responseFactory,
47
        private UserService $userService,
48
    ) {
49
    }
50
51
    public function __invoke(Request $request): ResponseInterface
52
    {
53
        $this->userService->logout($request->getUser());
54
        return $this->responseFactory->createResponse();
55
    }
56
}
57