Skip to content

Commit c5dae14

Browse files
committed
Whitespace consistency.
Oops.
1 parent 2a89266 commit c5dae14

1 file changed

Lines changed: 92 additions & 92 deletions

File tree

src/OAuth/OAuth2/Service/BattleNet.php

Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -13,104 +13,104 @@
1313

1414
//-----------------------------------------------------------------------------
1515
class BattleNet extends AbstractService {
16-
17-
/** -----------------------------------------------------------------------
16+
17+
/** -----------------------------------------------------------------------
1818
* Defined scopes.
1919
*
2020
* @link https://dev.battle.net/docs
2121
*/
22-
const SCOPE_WOW_PROFILE = "wow.profile";
23-
const SCOPE_SC2_PROFILE = "sc2.profile";
24-
25-
/** -----------------------------------------------------------------------
22+
const SCOPE_WOW_PROFILE = "wow.profile";
23+
const SCOPE_SC2_PROFILE = "sc2.profile";
24+
25+
/** -----------------------------------------------------------------------
2626
* Defined API URIs.
2727
*
2828
* @link https://dev.battle.net/docs
2929
*/
30-
const API_URI_US = 'https://us.api.battle.net/';
31-
const API_URI_EU = 'https://eu.api.battle.net/';
32-
const API_URI_KR = 'https://kr.api.battle.net/';
33-
const API_URI_TW = 'https://tw.api.battle.net/';
34-
const API_URI_CN = 'https://api.battlenet.com.cn/';
35-
const API_URI_SEA = 'https://sea.api.battle.net/';
36-
37-
public function __construct( CredentialsInterface $credentials,
38-
ClientInterface $httpClient,
39-
TokenStorageInterface $storage,
40-
$scopes = array(),
41-
UriInterface $baseApiUri = null ) {
42-
43-
parent::__construct( $credentials, $httpClient, $storage,
44-
$scopes, $baseApiUri );
45-
46-
if( $baseApiUri === null ) {
47-
$this->baseApiUri = new Uri( self::API_URI_US );
48-
}
49-
}
50-
51-
/** -----------------------------------------------------------------------
52-
* Translates the current base API URI into an OAuth base URI.
53-
*
54-
* @returns string Base URI of oauth services.
55-
*/
56-
private function GetOAuthBaseUri() {
57-
58-
// i love china
59-
switch( $this->baseApiUri ) {
60-
case self::API_URI_US: return 'https://us.battle.net/oauth/';
61-
case self::API_URI_EU: return 'https://eu.battle.net/oauth/';
62-
case self::API_URI_KR: return 'https://kr.battle.net/oauth/';
63-
case self::API_URI_TW: return 'https://tw.battle.net/oauth/';
64-
case self::API_URI_CN: return 'https://www.battlenet.com.cn/oauth/';
65-
case self::API_URI_SEA: return 'https://sea.battle.net/oauth/';
66-
}
67-
68-
}
69-
70-
/** -----------------------------------------------------------------------
71-
* {@inheritdoc}
72-
*/
73-
public function getAuthorizationEndpoint() {
74-
return new Uri( $this->GetOAuthBaseUri() . 'authorize' );
75-
}
76-
77-
/** -----------------------------------------------------------------------
78-
* {@inheritdoc}
79-
*/
80-
public function getAccessTokenEndpoint() {
81-
return new Uri( $this->GetOAuthBaseUri() . 'token' );
82-
}
83-
84-
/** -----------------------------------------------------------------------
85-
* {@inheritdoc}
86-
*/
87-
protected function getAuthorizationMethod()
88-
{
89-
return static::AUTHORIZATION_METHOD_QUERY_STRING;
90-
}
91-
92-
/** -----------------------------------------------------------------------
93-
* {@inheritdoc}
94-
*/
95-
protected function parseAccessTokenResponse( $responseBody )
96-
{
97-
$data = json_decode($responseBody, true);
98-
if( $data === null || !is_array($data) ) {
99-
throw new TokenResponseException( 'Unable to parse response.' );
100-
} elseif( isset($data['error']) ) {
101-
$err = $data['error'];
102-
throw new TokenResponseException(
103-
"Error in retrieving token: \"$err\"" );
104-
}
105-
106-
$token = new StdOAuth2Token( $data['access_token'], null,
107-
$data['expires_in'] );
108-
109-
unset( $data['access_token'] );
110-
unset( $data['expires_in'] );
111-
112-
$token->setExtraParams( $data );
113-
114-
return $token;
115-
}
30+
const API_URI_US = 'https://us.api.battle.net/';
31+
const API_URI_EU = 'https://eu.api.battle.net/';
32+
const API_URI_KR = 'https://kr.api.battle.net/';
33+
const API_URI_TW = 'https://tw.api.battle.net/';
34+
const API_URI_CN = 'https://api.battlenet.com.cn/';
35+
const API_URI_SEA = 'https://sea.api.battle.net/';
36+
37+
public function __construct( CredentialsInterface $credentials,
38+
ClientInterface $httpClient,
39+
TokenStorageInterface $storage,
40+
$scopes = array(),
41+
UriInterface $baseApiUri = null ) {
42+
43+
parent::__construct( $credentials, $httpClient, $storage,
44+
$scopes, $baseApiUri );
45+
46+
if( $baseApiUri === null ) {
47+
$this->baseApiUri = new Uri( self::API_URI_US );
48+
}
49+
}
50+
51+
/** -----------------------------------------------------------------------
52+
* Translates the current base API URI into an OAuth base URI.
53+
*
54+
* @returns string Base URI of oauth services.
55+
*/
56+
private function GetOAuthBaseUri() {
57+
58+
// i love china
59+
switch( $this->baseApiUri ) {
60+
case self::API_URI_US: return 'https://us.battle.net/oauth/';
61+
case self::API_URI_EU: return 'https://eu.battle.net/oauth/';
62+
case self::API_URI_KR: return 'https://kr.battle.net/oauth/';
63+
case self::API_URI_TW: return 'https://tw.battle.net/oauth/';
64+
case self::API_URI_CN: return 'https://www.battlenet.com.cn/oauth/';
65+
case self::API_URI_SEA: return 'https://sea.battle.net/oauth/';
66+
}
67+
68+
}
69+
70+
/** -----------------------------------------------------------------------
71+
* {@inheritdoc}
72+
*/
73+
public function getAuthorizationEndpoint() {
74+
return new Uri( $this->GetOAuthBaseUri() . 'authorize' );
75+
}
76+
77+
/** -----------------------------------------------------------------------
78+
* {@inheritdoc}
79+
*/
80+
public function getAccessTokenEndpoint() {
81+
return new Uri( $this->GetOAuthBaseUri() . 'token' );
82+
}
83+
84+
/** -----------------------------------------------------------------------
85+
* {@inheritdoc}
86+
*/
87+
protected function getAuthorizationMethod()
88+
{
89+
return static::AUTHORIZATION_METHOD_QUERY_STRING;
90+
}
91+
92+
/** -----------------------------------------------------------------------
93+
* {@inheritdoc}
94+
*/
95+
protected function parseAccessTokenResponse( $responseBody )
96+
{
97+
$data = json_decode($responseBody, true);
98+
if( $data === null || !is_array($data) ) {
99+
throw new TokenResponseException( 'Unable to parse response.' );
100+
} elseif( isset($data['error']) ) {
101+
$err = $data['error'];
102+
throw new TokenResponseException(
103+
"Error in retrieving token: \"$err\"" );
104+
}
105+
106+
$token = new StdOAuth2Token( $data['access_token'], null,
107+
$data['expires_in'] );
108+
109+
unset( $data['access_token'] );
110+
unset( $data['expires_in'] );
111+
112+
$token->setExtraParams( $data );
113+
114+
return $token;
115+
}
116116
}

0 commit comments

Comments
 (0)