1 | <?php |
||
26 | class TokenAuth |
||
27 | { |
||
28 | /** |
||
29 | * @var JWTInterface |
||
30 | */ |
||
31 | private $jwt; |
||
32 | |||
33 | /** |
||
34 | * @var Guard |
||
35 | */ |
||
36 | private $guard; |
||
37 | |||
38 | /** |
||
39 | * TokenAuth constructor. |
||
40 | * @param JWTInterface $jwt |
||
41 | * @param Guard $guard |
||
42 | */ |
||
43 | public function __construct(JWTInterface $jwt, Guard $guard) |
||
48 | |||
49 | /** |
||
50 | * @param string $email |
||
51 | * @param string $password |
||
52 | * @return Authenticatable |
||
53 | */ |
||
54 | public function attemptFromEmailAndPassword(string $email, string $password): ?Authenticatable |
||
62 | |||
63 | /** |
||
64 | * @param int $id |
||
65 | * @param string $password |
||
66 | * @return Authenticatable |
||
67 | */ |
||
68 | public function resolveFromIdAndPassword(int $id, string $password): ?Authenticatable |
||
76 | |||
77 | /** |
||
78 | * @param Guard $guard |
||
79 | * @return string |
||
80 | */ |
||
81 | public function fromGuard(Guard $guard): string |
||
85 | |||
86 | /** |
||
87 | * @param Authenticatable $user |
||
88 | * @return string |
||
89 | */ |
||
90 | public function fromUser(Authenticatable $user): string |
||
102 | |||
103 | /** |
||
104 | * @param array $payload |
||
105 | * @return string |
||
106 | */ |
||
107 | public function encode(array $payload): string |
||
111 | |||
112 | /** |
||
113 | * @return Authenticatable |
||
114 | */ |
||
115 | public function guest(): Authenticatable |
||
119 | |||
120 | /** |
||
121 | * @param string $token |
||
122 | * @return Authenticatable |
||
123 | * @throws BadRequestHttpException |
||
124 | * @throws UnprocessableEntityHttpException |
||
125 | */ |
||
126 | public function fromToken(string $token): Authenticatable |
||
145 | |||
146 | /** |
||
147 | * @param array $userInfo |
||
148 | * @throws TokenExpiredException |
||
149 | */ |
||
150 | private function verifyTokenCreated(array $userInfo): void |
||
158 | |||
159 | /** |
||
160 | * @param string $token |
||
161 | * @return array |
||
162 | */ |
||
163 | public function decode(string $token): array |
||
167 | |||
168 | /** |
||
169 | * @param array $userInfo |
||
170 | * @return mixed |
||
171 | * @throws UnprocessableEntityHttpException |
||
172 | */ |
||
173 | private function resolveExistingUser(array $userInfo) |
||
193 | } |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.