1 | <?php |
||
13 | class SocialAuth |
||
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 $isVerified = false; |
||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | private $isExist = false; |
||
35 | /** |
||
36 | * @var ClientInterface |
||
37 | */ |
||
38 | private $client; |
||
39 | |||
40 | public function execute(ClientInterface $client): SocialAuth |
||
72 | |||
73 | public function user(): ?User |
||
77 | |||
78 | public function email(): ?string |
||
82 | |||
83 | public function isExist(): bool |
||
87 | |||
88 | public function isVerified(): bool |
||
92 | |||
93 | /** |
||
94 | * Find user by provider |
||
95 | * |
||
96 | * @return app\models\User|null |
||
97 | */ |
||
98 | private function findUserByProvider(): ?User |
||
111 | |||
112 | /** |
||
113 | * Parse provider |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | private function parseProvider(): array |
||
139 | |||
140 | /** |
||
141 | * Parse profile |
||
142 | * |
||
143 | * @return array |
||
144 | */ |
||
145 | private function parseProfile(): array |
||
165 | |||
166 | /** |
||
167 | * Prepare provider attributes for facebook |
||
168 | * |
||
169 | * @param array $profile |
||
170 | * @param array $token |
||
171 | * @return array |
||
172 | */ |
||
173 | private function parseProviderFacebook(array $profile, array $token): array |
||
182 | |||
183 | /** |
||
184 | * Prepare provider attributes for vkontakte |
||
185 | * |
||
186 | * @param array $profile |
||
187 | * @param array $token |
||
188 | * @return array |
||
189 | */ |
||
190 | private function parseProviderVkontakte(array $profile, array $token): array |
||
199 | |||
200 | /** |
||
201 | * Prepare provider attributes for twitter |
||
202 | * |
||
203 | * @param array $profile |
||
204 | * @param array $token |
||
205 | * @return array |
||
206 | */ |
||
207 | private function parseProviderTwitter(array $profile, array $token): array |
||
216 | |||
217 | /** |
||
218 | * Prepare profile attributes for facebook |
||
219 | * |
||
220 | * @param array $profile |
||
221 | * @return array |
||
222 | */ |
||
223 | private function parseProfileFacebook(array $profile): array |
||
231 | |||
232 | /** |
||
233 | * Prepare profile attributes for vkontakte |
||
234 | * |
||
235 | * @param array $profile |
||
236 | * @return array |
||
237 | */ |
||
238 | private function parseProfileVkontakte(array $profile): array |
||
249 | |||
250 | /** |
||
251 | * Prepare profile attributes for twitter |
||
252 | * |
||
253 | * @param array $profile |
||
254 | * @return array |
||
255 | */ |
||
256 | private function parseProfileTwitter(array $profile): array |
||
264 | } |
||
265 |
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: