| Conditions | 1 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | public function requestAccessToken($code = '', $state = '') |
||
| 8 | { |
||
| 9 | |||
| 10 | $body = array( |
||
| 11 | 'client_id' => $this->getClient()->getClientId(), |
||
| 12 | 'client_secret' => $this->getClient()->getClientSecret(), |
||
| 13 | 'grant_type' => 'authorization_code', |
||
| 14 | 'redirect_uri' => $this->getClient()->getRedirectUri(), |
||
| 15 | 'code' => $code, |
||
| 16 | 'state' => $state, |
||
| 17 | ); |
||
| 18 | |||
| 19 | $response = $this->call('requestAccessToken', array(), $body); |
||
| 20 | |||
| 21 | $accesstoken = new Twitch\AccessToken; |
||
| 22 | $accesstoken->setAccessToken($response->access_token); |
||
| 23 | $accesstoken->setRefreshToken($response->refresh_token); |
||
| 24 | $accesstoken->setScope($response->scope); |
||
| 25 | return $accesstoken; |
||
| 26 | } |
||
| 27 | } |