1 | <?php |
||
13 | class AuthProviderHandler |
||
14 | { |
||
15 | /** |
||
16 | * @var int |
||
17 | */ |
||
18 | private $type; |
||
19 | /** |
||
20 | * @var User |
||
21 | */ |
||
22 | private $user; |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $email; |
||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $verified = false; |
||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | private $exist = false; |
||
35 | /** |
||
36 | * @var ClientInterface |
||
37 | */ |
||
38 | private $client; |
||
39 | |||
40 | public function __construct(ClientInterface $client) |
||
45 | |||
46 | /** |
||
47 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
48 | */ |
||
49 | public function handle() |
||
74 | |||
75 | public function getUser() |
||
79 | |||
80 | public function getEmail() |
||
84 | |||
85 | public function isExist() |
||
89 | |||
90 | public function isVerified() |
||
94 | |||
95 | /** |
||
96 | * Find user by provider |
||
97 | * |
||
98 | * @return app\models\User|null |
||
99 | */ |
||
100 | private function findUserByProvider() |
||
113 | |||
114 | /** |
||
115 | * Parse provider |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | private function parseProvider() |
||
141 | |||
142 | /** |
||
143 | * Parse profile |
||
144 | * |
||
145 | * @return array |
||
146 | */ |
||
147 | private function parseProfile() |
||
167 | |||
168 | /** |
||
169 | * Prepare provider attributes for facebook |
||
170 | * |
||
171 | * @param array $profile |
||
172 | * @param array $token |
||
173 | * @return array |
||
174 | */ |
||
175 | private function parseProviderFacebook($profile, $token) |
||
184 | |||
185 | /** |
||
186 | * Prepare provider attributes for vkontakte |
||
187 | * |
||
188 | * @param array $profile |
||
189 | * @param array $token |
||
190 | * @return array |
||
191 | */ |
||
192 | private function parseProviderVkontakte($profile, $token) |
||
201 | |||
202 | /** |
||
203 | * Prepare provider attributes for twitter |
||
204 | * |
||
205 | * @param array $profile |
||
206 | * @param array $token |
||
207 | * @return array |
||
208 | */ |
||
209 | private function parseProviderTwitter($profile, $token) |
||
218 | |||
219 | /** |
||
220 | * Prepare profile attributes for facebook |
||
221 | * |
||
222 | * @param array $profile |
||
223 | * @return array |
||
224 | */ |
||
225 | private function parseProfileFacebook($profile) |
||
233 | |||
234 | /** |
||
235 | * Prepare profile attributes for vkontakte |
||
236 | * |
||
237 | * @param array $profile |
||
238 | * @return array |
||
239 | */ |
||
240 | private function parseProfileVkontakte($profile) |
||
251 | |||
252 | /** |
||
253 | * Prepare profile attributes for twitter |
||
254 | * |
||
255 | * @param array $profile |
||
256 | * @return array |
||
257 | */ |
||
258 | private function parseProfileTwitter($profile) |
||
266 | } |
||
267 |
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: