1 | <?php |
||
15 | class EmailVerificationBroker implements EmailVerificationBrokerContract |
||
16 | { |
||
17 | /** |
||
18 | * The application key. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $key; |
||
23 | |||
24 | /** |
||
25 | * The user provider implementation. |
||
26 | * |
||
27 | * @var \Illuminate\Contracts\Auth\UserProvider |
||
28 | */ |
||
29 | protected $users; |
||
30 | |||
31 | /** |
||
32 | * The number of minutes that the reset token should be considered valid. |
||
33 | * |
||
34 | * @var int |
||
35 | */ |
||
36 | protected $expiration; |
||
37 | |||
38 | /** |
||
39 | * Create a new verification broker instance. |
||
40 | * |
||
41 | * @param \Illuminate\Contracts\Auth\UserProvider $users |
||
42 | * @param string $key |
||
43 | * @param int $expiration |
||
44 | */ |
||
45 | public function __construct(UserProvider $users, $key, $expiration) |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function sendVerificationLink(array $credentials): string |
||
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | public function verify(array $credentials, Closure $callback) |
||
98 | |||
99 | /** |
||
100 | * Get the user for the given credentials. |
||
101 | * |
||
102 | * @param array $credentials |
||
103 | * |
||
104 | * @throws \UnexpectedValueException |
||
105 | * |
||
106 | * @return \Rinvex\Fort\Contracts\CanVerifyEmailContract |
||
107 | */ |
||
108 | public function getUser(array $credentials): CanVerifyEmailContract |
||
118 | |||
119 | /** |
||
120 | * Create a new email verification token for the given user. |
||
121 | * |
||
122 | * @param \Rinvex\Fort\Contracts\CanVerifyEmailContract $user |
||
123 | * @param int $expiration |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function createToken(CanVerifyEmailContract $user, $expiration): string |
||
133 | |||
134 | /** |
||
135 | * Validate the given email verification token. |
||
136 | * |
||
137 | * @param \Rinvex\Fort\Contracts\CanVerifyEmailContract $user |
||
138 | * @param array $credentials |
||
139 | * |
||
140 | * @return bool |
||
141 | */ |
||
142 | public function validateToken(CanVerifyEmailContract $user, array $credentials): bool |
||
148 | |||
149 | /** |
||
150 | * Validate the given expiration timestamp. |
||
151 | * |
||
152 | * @param int $expiration |
||
153 | * |
||
154 | * @return bool |
||
155 | */ |
||
156 | public function validateTimestamp($expiration): bool |
||
160 | |||
161 | /** |
||
162 | * Return the application key. |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | public function getKey(): string |
||
174 | |||
175 | /** |
||
176 | * Returns the payload string containing. |
||
177 | * |
||
178 | * @param \Rinvex\Fort\Contracts\CanVerifyEmailContract $user |
||
179 | * @param string $email |
||
180 | * @param int $expiration |
||
181 | * |
||
182 | * @return string |
||
183 | */ |
||
184 | protected function buildPayload(CanVerifyEmailContract $user, $email, $expiration): string |
||
193 | |||
194 | /** |
||
195 | * Validate an email verification for the given credentials. |
||
196 | * |
||
197 | * @param array $credentials |
||
198 | * |
||
199 | * @return \Rinvex\Fort\Contracts\CanVerifyEmailContract|string |
||
200 | */ |
||
201 | protected function validateVerification(array $credentials) |
||
217 | } |
||
218 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: