1 | <?php |
||
29 | class TokenAuth |
||
30 | { |
||
31 | /** |
||
32 | * @var JWTInterface |
||
33 | */ |
||
34 | private $jwt; |
||
35 | |||
36 | /** |
||
37 | * @var Guard |
||
38 | */ |
||
39 | private $guard; |
||
40 | |||
41 | /** |
||
42 | * TokenAuth constructor. |
||
43 | * @param JWTInterface $jwt |
||
44 | * @param Guard $guard |
||
45 | */ |
||
46 | public function __construct(JWTInterface $jwt, Guard $guard) |
||
51 | |||
52 | /** |
||
53 | * @param string $email |
||
54 | * @param string $password |
||
55 | * @return Authenticatable |
||
56 | */ |
||
57 | public function attemptFromEmailAndPassword(string $email, string $password): ?Authenticatable |
||
65 | |||
66 | /** |
||
67 | * @param int $id |
||
68 | * @param string $password |
||
69 | * @return Authenticatable |
||
70 | */ |
||
71 | public function resolveFromIdAndPassword(int $id, string $password): ?Authenticatable |
||
79 | |||
80 | /** |
||
81 | * @param Guard $guard |
||
82 | * @return string |
||
83 | */ |
||
84 | public function fromGuard(Guard $guard): string |
||
88 | |||
89 | /** |
||
90 | * @param Authenticatable $user |
||
91 | * @return string |
||
92 | */ |
||
93 | public function fromUser(Authenticatable $user): string |
||
104 | |||
105 | /** |
||
106 | * @param array $payload |
||
107 | * @return string |
||
108 | */ |
||
109 | public function encode(array $payload): string |
||
113 | |||
114 | /** |
||
115 | * @return Authenticatable |
||
116 | */ |
||
117 | public function guest(): Authenticatable |
||
121 | |||
122 | /** |
||
123 | * @param string $token |
||
124 | * @return Authenticatable |
||
125 | * @throws BadRequestHttpException |
||
126 | * @throws UnprocessableEntityHttpException |
||
127 | */ |
||
128 | public function fromToken(string $token): Authenticatable |
||
144 | |||
145 | /** |
||
146 | * @param string $token |
||
147 | * @return array |
||
148 | */ |
||
149 | public function decode(string $token): array |
||
153 | |||
154 | /** |
||
155 | * @param array $userInfo |
||
156 | * @return mixed |
||
157 | * @throws UnprocessableEntityHttpException |
||
158 | */ |
||
159 | private function resolveExistingUser(array $userInfo) |
||
179 | } |
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.