Passed
Push — master ( 84533f...cb764e )
by Marco Aurélio
02:53
created

CognitoUserProvider   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Test Coverage

Coverage 53.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 49
ccs 8
cts 15
cp 0.5333
rs 10
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A validateCredentials() 0 2 1
A retrieveByCredentials() 0 17 2
A retrieveByToken() 0 2 1
A retrieveById() 0 2 1
A updateRememberToken() 0 2 1
1
<?php declare(strict_types=1);
2
3
namespace CustomerGauge\Cognito;
4
5
use CustomerGauge\Cognito\Parsers\ClientAppParser;
6
use Exception;
7
use Illuminate\Contracts\Auth\Authenticatable;
8
use Illuminate\Contracts\Auth\UserProvider;
9
10
final class CognitoUserProvider implements UserProvider
11
{
12
    private $clientAppParser;
13
14
    private $accessTokenParser;
0 ignored issues
show
introduced by
The private property $accessTokenParser is not used, and could be removed.
Loading history...
15
16 2
    public function __construct(ClientAppParser $clientAppParser/*, AccessTokenParser $accessTokenParser*/)
17
    {
18 2
        $this->clientAppParser = $clientAppParser;
19
//        $this->accessTokenParser = $accessTokenParser;
20 2
    }
21
22 2
    public function retrieveByCredentials(array $credentials)
23
    {
24 2
        $token = $credentials['cognito_token'];
25
26
        try {
27 2
            return $this->clientAppParser->parse($token);
28 1
        } catch (Exception $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
29
30
        }
31
/*
32
        try {
33
            return $this->accessTokenParser->parse($token);
34
        } catch (Exception $e) {
35
36
        }
37
*/
38 1
        return null;
39
    }
40
41
    /** @phpstan ignore */
42
    public function validateCredentials(Authenticatable $user, array $credentials)
43
    {
44
    }
45
46
    /** @phpstan ignore */
47
    public function retrieveById($identifier)
48
    {
49
    }
50
51
    /** @phpstan ignore */
52
    public function retrieveByToken($identifier, $token)
53
    {
54
    }
55
56
    /** @phpstan ignore */
57
    public function updateRememberToken(Authenticatable $user, $token)
58
    {
59
    }
60
}
61