Input   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
A getCurrentUser() 0 6 1
1
<?php
2
3
namespace Scheduler\Web\Radar\Input;
4
5
use Psr\Http\Message\ServerRequestInterface as Request;
6
use Scheduler\Domain\Model\User\Authenticator;
7
8
class Input
9
{
10
    private $authenticator;
11
12
    public function __construct(Authenticator $authenticator)
13
    {
14
        $this->authenticator = $authenticator;
15
    }
16
17
    public function __invoke(Request $request)
18
    {
19
        return [$this->getCurrentUser($request)];
20
    }
21
22
    protected function getCurrentUser(Request $request)
23
    {
24
        $token = $request->getHeaderLine("x-access-token");
25
26
        return $this->authenticator->authenticate($token);
27
    }
28
}
29