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; |
||
15 | |||
16 | 1 | public function __construct(ClientAppParser $clientAppParser/*, AccessTokenParser $accessTokenParser*/) |
|
17 | { |
||
18 | 1 | $this->clientAppParser = $clientAppParser; |
|
19 | // $this->accessTokenParser = $accessTokenParser; |
||
20 | 1 | } |
|
21 | |||
22 | 1 | public function retrieveByCredentials(array $credentials) |
|
23 | { |
||
24 | 1 | $token = $credentials['cognito_token']; |
|
25 | |||
26 | try { |
||
27 | 1 | return $this->clientAppParser->parse($token); |
|
28 | } catch (Exception $e) { |
||
29 | var_dump($e->getMessage()); |
||
0 ignored issues
–
show
Security
Debugging Code
introduced
by
Loading history...
|
|||
30 | exit; |
||
0 ignored issues
–
show
|
|||
31 | } |
||
32 | /* |
||
33 | try { |
||
34 | return $this->accessTokenParser->parse($token); |
||
35 | } catch (Exception $e) { |
||
36 | |||
37 | } |
||
38 | */ |
||
39 | return null; |
||
0 ignored issues
–
show
return null is not reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last
Loading history...
|
|||
40 | } |
||
41 | |||
42 | /** @phpstan ignore */ |
||
43 | public function validateCredentials(Authenticatable $user, array $credentials) |
||
44 | { |
||
45 | } |
||
46 | |||
47 | /** @phpstan ignore */ |
||
48 | public function retrieveById($identifier) |
||
49 | { |
||
50 | } |
||
51 | |||
52 | /** @phpstan ignore */ |
||
53 | public function retrieveByToken($identifier, $token) |
||
54 | { |
||
55 | } |
||
56 | |||
57 | /** @phpstan ignore */ |
||
58 | public function updateRememberToken(Authenticatable $user, $token) |
||
59 | { |
||
60 | } |
||
61 | } |
||
62 |