PlayerAuthAction::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 8
ccs 0
cts 5
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Game\Features\Authorization;
6
7
use App\Game\Features\Authorization\Request\LoginRequest;
8
9
final class PlayerAuthAction
10
{
11
    public function __invoke(LoginRequest $request, PlayerLogin $playerLogin): string
12
    {
13
        try {
14
            $playerLogin($request->nickname(), $request->password());
15
16
            return 'Player successfully logged!';
17
        } catch (PlayerLoginException) {
18
            return 'Failed!';
19
        }
20
    }
21
}
22