1 | <?php |
||
14 | class WebProvider extends AbstractProvider |
||
15 | { |
||
16 | use ArrayAccessorTrait; |
||
17 | |||
18 | protected $appid; |
||
19 | protected $secret; |
||
20 | protected $redirect_uri; |
||
21 | |||
22 | /** |
||
23 | * Returns the base URL for authorizing a client. |
||
24 | * |
||
25 | * @return string |
||
26 | */ |
||
27 | 9 | public function getBaseAuthorizationUrl() |
|
31 | |||
32 | /** |
||
33 | * Returns authorization parameters based on provided options. |
||
34 | * |
||
35 | * @param array $options |
||
36 | * @return array Authorization parameters |
||
37 | */ |
||
38 | 9 | protected function getAuthorizationParameters(array $options) |
|
70 | |||
71 | /** |
||
72 | * Returns the base URL for requesting an access token. |
||
73 | * |
||
74 | * @param array $params |
||
75 | * @return string |
||
76 | */ |
||
77 | 12 | public function getBaseAccessTokenUrl(array $params) |
|
81 | |||
82 | /** |
||
83 | * Requests an access token using a specified grant and option set. |
||
84 | * |
||
85 | * @param mixed $grant |
||
86 | * @param array $options |
||
87 | * @return AccessToken |
||
88 | */ |
||
89 | 9 | public function getAccessToken($grant, array $options = []) |
|
105 | |||
106 | /** |
||
107 | * Creates an access token from a response. |
||
108 | * |
||
109 | * The grant that was used to fetch the response can be used to provide |
||
110 | * additional context. |
||
111 | * |
||
112 | * @param array $response |
||
113 | * @param AbstractGrant $grant |
||
114 | * @return AccessToken |
||
115 | */ |
||
116 | 9 | protected function createAccessToken(array $response, AbstractGrant $grant) |
|
120 | |||
121 | /** |
||
122 | * Returns the URL for requesting the resource owner's details. |
||
123 | * |
||
124 | * @param AccessToken $token |
||
125 | * @return string |
||
126 | */ |
||
127 | 6 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
|
132 | |||
133 | /** |
||
134 | * Returns the default scopes used by this provider. |
||
135 | * |
||
136 | * This should only be the scopes that are required to request the details |
||
137 | * of the resource owner, rather than all the available scopes. |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | protected function getDefaultScopes() |
||
145 | |||
146 | /** |
||
147 | * Checks a provider response for errors. |
||
148 | * |
||
149 | * @throws IdentityProviderException |
||
150 | * @param ResponseInterface $response |
||
151 | * @param array|string|\Psr\Http\Message\ResponseInterface $data Parsed response data |
||
152 | * @return void |
||
153 | */ |
||
154 | 9 | protected function checkResponse(ResponseInterface $response, $data) |
|
163 | |||
164 | /** |
||
165 | * Generates a resource owner object from a successful resource owner |
||
166 | * details request. |
||
167 | * |
||
168 | * @param array $response |
||
169 | * @param AccessToken $token |
||
170 | * @return ResourceOwnerInterface |
||
171 | */ |
||
172 | 6 | protected function createResourceOwner(array $response, AccessToken $token) |
|
176 | } |
||
177 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.