Test Failed
Pull Request — master (#87)
by Dmitriy
02:46
created

Action::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 2
dl 0
loc 4
rs 10
c 1
b 0
f 0
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;
0 ignored issues
show
Bug introduced by
The type App\Application\User\Service\UserService 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...
8
use App\Infrastructure\IO\Http\Auth\PostLogout\Request\Request;
9
use OpenApi\Annotations as OA;
10
use Psr\Http\Message\ResponseInterface;
11
use Yiisoft\DataResponse\DataResponseFactoryInterface;
12
13
/**
14
 * @OA\Tag(
15
 *     name="auth",
16
 *     description="Authentication"
17
 * )
18
 *
19
 * @OA\Post(
20
 *     tags={"auth"},
21
 *     path="/auth/logout",
22
 *     summary="Logout",
23
 *     description="",
24
 *     security={{"ApiKey": {}}},
25
 *     @OA\Response(
26
 *          response="200",
27
 *          description="Success",
28
 *          @OA\JsonContent(ref="#/components/schemas/Response")
29
 *    ),
30
 *    @OA\Response(
31
 *          response="400",
32
 *          description="Bad request",
33
 *          @OA\JsonContent(ref="#/components/schemas/BadResponse")
34
 *     ),
35
 * )
36
 */
37
final class Action
38
{
39
    public function __construct(
40
        private DataResponseFactoryInterface $responseFactory,
41
        private UserService $userService,
42
    ) {
43
    }
44
45
    public function __invoke(Request $request): ResponseInterface
46
    {
47
        $this->userService->logout($request->getUser());
48
        return $this->responseFactory->createResponse();
49
    }
50
}
51