1 | <?php |
||
12 | abstract class AbstractProvider extends BaseProvider implements ProviderInterface |
||
13 | { |
||
14 | use ConfigTrait; |
||
15 | |||
16 | /** |
||
17 | * @var array |
||
18 | 1 | */ |
|
19 | protected $credentialsResponseBody; |
||
20 | 1 | ||
21 | public static function serviceContainerKey($providerName) |
||
25 | 7 | ||
26 | /** |
||
27 | * @return \SocialiteProviders\Manager\OAuth2\User |
||
28 | */ |
||
29 | public function user() |
||
30 | { |
||
31 | if ($this->hasInvalidState()) { |
||
32 | throw new InvalidStateException(); |
||
33 | 1 | } |
|
34 | |||
35 | 1 | $response = $this->getAccessTokenResponse($this->getCode()); |
|
|
|||
36 | 1 | ||
37 | 1 | $user = $this->mapUserToObject($this->getUserByToken( |
|
38 | 1 | $token = $this->parseAccessToken($response) |
|
39 | )); |
||
40 | 1 | ||
41 | $this->credentialsResponseBody = $response; |
||
42 | |||
43 | if ($user instanceof User) { |
||
44 | return $user->setAccessTokenResponseBody($this->credentialsResponseBody); |
||
45 | } |
||
46 | 5 | ||
47 | return $user->setToken($token) |
||
48 | 5 | ->setRefreshToken($this->parseRefreshToken($response)) |
|
49 | 2 | ->setExpiresIn($this->parseExpiresIn($response)); |
|
50 | } |
||
51 | |||
52 | 3 | /** |
|
53 | 3 | * Get the access token from the token response body. |
|
54 | 3 | * |
|
55 | * @param string $body |
||
56 | 3 | * |
|
57 | * @return string |
||
58 | 3 | */ |
|
59 | 3 | protected function parseAccessToken($body) |
|
63 | |||
64 | /** |
||
65 | * Get the refresh token from the token response body. |
||
66 | * |
||
67 | * @param string $body |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | protected function parseRefreshToken($body) |
||
75 | |||
76 | 3 | /** |
|
77 | 3 | * Get the expires in from the token response body. |
|
78 | 3 | * |
|
79 | 3 | * @param string $body |
|
80 | * |
||
81 | 3 | * @return string |
|
82 | */ |
||
83 | 3 | protected function parseExpiresIn($body) |
|
87 | } |
||
88 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.