1 | <?php |
||
10 | class Qq extends AbstractProvider |
||
11 | { |
||
12 | use BearerAuthorizationTrait; |
||
13 | |||
14 | /** |
||
15 | * Domain |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | public $domain = 'https://graph.qq.com'; |
||
20 | |||
21 | /** |
||
22 | * OpenId |
||
23 | * |
||
24 | * @see http://wiki.open.qq.com/wiki/website/%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7OpenID_OAuth2.0 |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $openId; |
||
28 | |||
29 | /** |
||
30 | * Get authorization url to begin OAuth flow |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | public function getBaseAuthorizationUrl() |
||
38 | |||
39 | /** |
||
40 | * Get access token url to retrieve token |
||
41 | * |
||
42 | * @param array $params |
||
43 | * |
||
44 | * @return string |
||
45 | */ |
||
46 | public function getBaseAccessTokenUrl(array $params) |
||
50 | |||
51 | /** |
||
52 | * Get open id from access token |
||
53 | * |
||
54 | * @param array $params |
||
|
|||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getOpenId(AccessToken $token) |
||
59 | { |
||
60 | $request = $this->getAuthenticatedRequest(self::METHOD_GET, $this->domain.'/oauth2.0/me?access_token='.(string)$token); |
||
61 | |||
62 | $response = $this->getResponse($request); |
||
63 | |||
64 | return isset($response['openid']) ? $response['openid'] : null; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Requests and returns the resource owner of given access token. |
||
69 | * |
||
70 | * @param AccessToken $token |
||
71 | * @return ResourceOwnerInterface |
||
72 | */ |
||
73 | public function getResourceOwner(AccessToken $token) |
||
79 | |||
80 | /** |
||
81 | * Get provider url to fetch user details |
||
82 | * |
||
83 | * @param AccessToken $token |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
||
91 | |||
92 | /** |
||
93 | * Get the default scopes used by this provider. |
||
94 | * |
||
95 | * This should not be a complete list of all scopes, but the minimum |
||
96 | * required for the provider user interface! |
||
97 | * |
||
98 | * @return array |
||
99 | */ |
||
100 | protected function getDefaultScopes() |
||
104 | |||
105 | /** |
||
106 | * Returns an authenticated PSR-7 request instance. |
||
107 | * |
||
108 | * @param string $method |
||
109 | * @param string $url |
||
110 | * @param null |
||
111 | * @param null |
||
112 | * @return RequestInterface |
||
113 | */ |
||
114 | public function getAuthenticatedRequest($method, $url, $token = null, array $options = null) |
||
118 | |||
119 | /** |
||
120 | * Parses the response according to its content-type header. |
||
121 | * |
||
122 | * @throws UnexpectedValueException |
||
123 | * @param ResponseInterface $response |
||
124 | * @return array |
||
125 | */ |
||
126 | protected function parseResponse(ResponseInterface $response) |
||
144 | |||
145 | /** |
||
146 | * Check a provider response for errors. |
||
147 | * |
||
148 | * @link http://wiki.open.qq.com/wiki/website/%E5%85%AC%E5%85%B1%E8%BF%94%E5%9B%9E%E7%A0%81%E8%AF%B4%E6%98%8E#100000-100031.EF.BC.9APC.E7.BD.91.E7.AB.99.E6.8E.A5.E5.85.A5.E6.97.B6.E7.9A.84.E5.85.AC.E5.85.B1.E8.BF.94.E5.9B.9E.E7.A0.81 |
||
149 | * @throws IdentityProviderException |
||
150 | * @param ResponseInterface $response |
||
151 | * @param string $data Parsed response data |
||
152 | * @return void |
||
153 | */ |
||
154 | protected function checkResponse(ResponseInterface $response, $data) |
||
178 | |||
179 | /** |
||
180 | * Generate a user object from a successful user details request. |
||
181 | * |
||
182 | * @param array $response |
||
183 | * @param AccessToken $token |
||
184 | * @return League\OAuth2\Client\Provider\ResourceOwnerInterface |
||
185 | */ |
||
186 | protected function createResourceOwner(array $response, AccessToken $token) |
||
194 | } |
||
195 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.