1 | <?php |
||
14 | class StackExchange extends AbstractProvider |
||
15 | { |
||
16 | use BearerAuthorizationTrait; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $urlApi = 'https://api.stackexchange.com/2.2/'; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $urlAuthorize = 'https://stackexchange.com/oauth'; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $urlAccessToken = 'https://stackexchange.com/oauth/access_token'; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $scope; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $key; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $site = 'stackoverflow'; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $state; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $redirectUri; |
||
57 | |||
58 | /** |
||
59 | * @inheritDoc |
||
60 | */ |
||
61 | 1 | public function getBaseAuthorizationUrl() |
|
65 | |||
66 | /** |
||
67 | * @inheritDoc |
||
68 | */ |
||
69 | 3 | public function getBaseAccessTokenUrl(array $params) |
|
78 | |||
79 | /** |
||
80 | * @inheritDoc |
||
81 | */ |
||
82 | 1 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
|
91 | |||
92 | /** |
||
93 | * @inheritDoc |
||
94 | */ |
||
95 | 1 | protected function getDefaultScopes() |
|
99 | |||
100 | /** |
||
101 | * @inheritDoc |
||
102 | */ |
||
103 | 1 | protected function getAuthorizationParameters(array $options) |
|
122 | |||
123 | /** |
||
124 | * @inheritDoc |
||
125 | */ |
||
126 | 4 | protected function parseResponse(ResponseInterface $response) |
|
139 | |||
140 | /** |
||
141 | * @inheritDoc |
||
142 | */ |
||
143 | 3 | protected function checkResponse(ResponseInterface $response, $data) |
|
144 | { |
||
145 | 3 | if (isset($data['error'])) { |
|
146 | 1 | throw StackExchangeException::errorResponse($response, $data); |
|
147 | } |
||
148 | 2 | } |
|
149 | |||
150 | /** |
||
151 | * @inheritDoc |
||
152 | */ |
||
153 | 1 | protected function createResourceOwner(array $response, AccessToken $token) |
|
157 | } |
||
158 |