Skip to content

Commit

Permalink
TravisCI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AJH16 committed Apr 28, 2015
1 parent d8a4952 commit e9c38ef
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 79 deletions.
112 changes: 56 additions & 56 deletions src/OAuth/OAuth2/Service/BattleNetBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,71 +11,71 @@

class BattleNetBase extends AbstractService
{
const SCOPE_WOW_PROFILE = 'wow.profile';
const SCOPE_SC2_PROFILE = 'sc2.profile';
const SCOPE_WOW_PROFILE = 'wow.profile';
const SCOPE_SC2_PROFILE = 'sc2.profile';

/**
* BattleNet Region
*
* @var \region
*/
protected $region;
/**
* BattleNet Region
*
* @var \region
*/
protected $region;

public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if( null === $baseApiUri ) {
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if ( null === $baseApiUri ) {
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
}

/**
* @return \OAuth\Common\Http\Uri\UriInterface
*/
public function getAuthorizationEndpoint()
{
return new Uri('https://' . $this->region . '.battle.net/oauth/authorize');
}
/**
* @return \OAuth\Common\Http\Uri\UriInterface
*/
public function getAuthorizationEndpoint()
{
return new Uri('https://' . $this->region . '.battle.net/oauth/authorize');
}

/**
* @return \OAuth\Common\Http\Uri\UriInterface
*/
public function getAccessTokenEndpoint()
{
return new Uri('https://' . $this->region . '.battle.net/oauth/token');
}
/**
* @return \OAuth\Common\Http\Uri\UriInterface
*/
public function getAccessTokenEndpoint()
{
return new Uri('https://' . $this->region . '.battle.net/oauth/token');
}

/**
* @param string $responseBody
* @return \OAuth\Common\Token\TokenInterface|\OAuth\OAuth2\Token\StdOAuth2Token
* @throws \OAuth\Common\Http\Exception\TokenResponseException
*/
protected function parseAccessTokenResponse($responseBody)
{
$data = json_decode( $responseBody, true );
/**
* @param string $responseBody
* @return \OAuth\Common\Token\TokenInterface|\OAuth\OAuth2\Token\StdOAuth2Token
* @throws \OAuth\Common\Http\Exception\TokenResponseException
*/
protected function parseAccessTokenResponse($responseBody)
{
$data = json_decode( $responseBody, true );

if( null === $data || !is_array($data) ) {
throw new TokenResponseException('Unable to parse response.');
} elseif( isset($data['error'] ) ) {
throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
}
if( null === $data || !is_array($data) ) {
throw new TokenResponseException('Unable to parse response.');
} elseif( isset($data['error'] ) ) {
throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
}

$token = new StdOAuth2Token();
$token = new StdOAuth2Token();

$token->setAccessToken( $data['access_token'] );
// I'm invincible!!!
$token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES);
unset( $data['access_token'] );
$token->setExtraParams( $data );
$token->setAccessToken( $data['access_token'] );
// I'm invincible!!!
$token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES);
unset( $data['access_token'] );
$token->setExtraParams( $data );

return $token;
}
return $token;
}

/**
* @return int
*/
protected function getAuthorizationMethod()
{
return static::AUTHORIZATION_METHOD_QUERY_STRING;
}
/**
* @return int
*/
protected function getAuthorizationMethod()
{
return static::AUTHORIZATION_METHOD_QUERY_STRING;
}
}
10 changes: 5 additions & 5 deletions src/OAuth/OAuth2/Service/BattleNetCN.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

class BattleNetCN extends BattleNetBase
{
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'cn';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'cn';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
}
10 changes: 5 additions & 5 deletions src/OAuth/OAuth2/Service/BattleNetEU.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

class BattleNetEU extends BattleNetBase
{
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'eu';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'eu';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
}
10 changes: 5 additions & 5 deletions src/OAuth/OAuth2/Service/BattleNetKR.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

class BattleNetKR extends BattleNetBase
{
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'kr';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'kr';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
}
8 changes: 4 additions & 4 deletions src/OAuth/OAuth2/Service/BattleNetTW.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

class BattleNetTW extends BattleNetBase
{
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'tw';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'tw';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
}
8 changes: 4 additions & 4 deletions src/OAuth/OAuth2/Service/BattleNetUS.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class BattleNetUS extends BattleNetBase
{
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'us';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$this->region = 'us';
$this->baseApiUri = new Uri('https://' . $this->region . '.api.battle.net/');
}
}

0 comments on commit e9c38ef

Please sign in to comment.