Skip to content

Commit

Permalink
Codestyle fixes. Adding missed phpDoc. className -> static in methods…
Browse files Browse the repository at this point in the history
… which returns $this
  • Loading branch information
Валерий Маслеников committed Sep 22, 2017
1 parent 544ac1b commit f166dee
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 58 deletions.
3 changes: 2 additions & 1 deletion src/Auth/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/
abstract class Authentication
{
/**
/**
* @var string
* The Authentication type for example PasswordAuthentication or OAuthDesktopMobileImplicitGrant.
*/
public $Type;
Expand Down
20 changes: 12 additions & 8 deletions src/Auth/AuthorizationData.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@
*/
class AuthorizationData
{
/**
/**
* @var OAuthAuthorization
* An object representing the authentication headers that should be used in calls to the Bing Ads web services.
*/
public $Authentication;

/**
/**
* @var string
* The identifier of the account that owns the entities in the request. Used as the CustomerAccountId header element in calls to the Bing Ads web services.
*/
public $AccountId;

/**
/**
* @var string
* The identifier of the customer that owns the account. Used as the CustomerId header element in calls to the Bing Ads web services.
*/
public $CustomerId;

/**
/**
* @var string
* The Bing Ads developer access token. Used as the DeveloperToken header element in calls to the Bing Ads web services.
*/
public $DeveloperToken;
Expand All @@ -34,7 +38,7 @@ public function __construct() {}
* Includes the authentication.
*
* @param Authentication $authentication
* @return AuthorizationData this builder
* @return static this builder
*/
public function withAuthentication($authentication) {
$this->Authentication = $authentication;
Expand All @@ -45,7 +49,7 @@ public function withAuthentication($authentication) {
* Includes the account ID.
*
* @param string $accountId
* @return AuthorizationData this builder
* @return static this builder
*/
public function withAccountId($accountId) {
$this->AccountId = $accountId;
Expand All @@ -56,7 +60,7 @@ public function withAccountId($accountId) {
* Includes the customer ID.
*
* @param string $customerId
* @return AuthorizationData this builder
* @return static this builder
*/
public function withCustomerId($customerId) {
$this->CustomerId = $customerId;
Expand All @@ -67,7 +71,7 @@ public function withCustomerId($customerId) {
* Includes the developer token.
*
* @param string $developerToken
* @return AuthorizationData this builder
* @return static this builder
*/
public function withDeveloperToken($developerToken) {
$this->DeveloperToken = $developerToken;
Expand Down
8 changes: 5 additions & 3 deletions src/Auth/IOAuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
*/
abstract class IOAuthService
{
/**
* Implementations of this abstract method must call the authorization server with the oauthRequestParameters passed in,
/**
* Implementations of this abstract method must call the authorization server with the oauthRequestParameters passed in,
* deserialize the response, and return back OAuth tokens.
* @param OAuthRequestParameters $oauthParameters
* @return OAuthTokens
*/
abstract function GetAccessTokens(OAuthRequestParameters $oauthParameters);
abstract public function GetAccessTokens(OAuthRequestParameters $oauthParameters);
}

?>
23 changes: 13 additions & 10 deletions src/Auth/OAuthAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,31 @@
*/
abstract class OAuthAuthorization extends Authentication
{
/**
/**
* @var string
* The client identifier corresponding to your registered application.
*/
public $ClientId;

/**
/**
* @var OAuthTokens
* Contains information about OAuth access tokens received from the Microsoft Account authorization service.
*/
public $OAuthTokens;

/**
/**
* @var string
* The URI to which the user of the app will be redirected after receiving user consent.
*/
public $RedirectUri;

public function __construct() {}

/**
/**
* Includes the client ID.
*
* @param string $clientId
* @return OAuthAuthorization this builder
* @return static this builder
*/
public function withClientId($clientId) {
$this->ClientId = $clientId;
Expand All @@ -39,18 +42,18 @@ public function withClientId($clientId) {
* Includes the redirect URI.
*
* @param string $redirectUri
* @return OAuthAuthorization this builder
* @return static this builder
*/
public function withRedirectUri($redirectUri) {
$this->RedirectUri = $redirectUri;
return $this;
}

/**
/**
* Includes the refresh token.
*
* @param string $refreshToken
* @return OAuthAuthorization this builder
* @return static this builder
*/
public function withRefreshToken($refreshToken) {
$this->OAuthTokens = (new OAuthTokens())->withRefreshToken($refreshToken);
Expand All @@ -61,14 +64,14 @@ public function withRefreshToken($refreshToken) {
* Includes the OAuth tokens.
*
* @param string $oauthTokens
* @return OAuthAuthorization this builder
* @return static this builder
*/
public function withOAuthTokens($oauthTokens) {
$this->OAuthTokens = $oauthTokens;
return $this;
}

/**
/**
* Implementations of this abstract method will get the Microsoft Account authorization endpoint
* where the user should be navigated to give their consent.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/OAuthDesktopMobileImplicitGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct() {
* Includes the state.
*
* @param string $state
* @return OAuthDesktopMobileImplicitGrant this builder
* @return static this builder
*/
public function withState($state) {
$this->State = $state;
Expand Down
24 changes: 15 additions & 9 deletions src/Auth/OAuthRequestParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,41 @@
*/
class OAuthRequestParameters
{
/**
/**
* @var string
* Your application's registered client identifier.
*/
public $ClientId;

/**
/**
* @var string
* Your application's registered client secret.
* This parameter is required with OAuthWebAuthCodeGrant requests.
*/
public $ClientSecret;

/**
/**
* @var string
* The URI where you want the authorization response to be redirected.
*/
public $RedirectUri;

/**
* @var string
* The authorization grant param name.
* For example the grant param name could be 'refresh_token' or 'authorization_code'.
*/
public $GrantType;

/**
* @var string
* The authorization grant param name.
* For example the grant param name could be 'refresh_token' or 'code'.
*/
public $GrantParamName;

/**
* @var string
* The value depends on the $GrantType and $GrantParamName.
* For example if $GrantType and $GrantParamName are both set to 'refresh_token',
* the value is equal to the last known and valid refresh token.
Expand All @@ -48,7 +54,7 @@ public function __construct() {}
* Includes the client ID.
*
* @param string $clientId
* @return OAuthRequestParameters this builder
* @return static this builder
*/
public function withClientId($clientId) {
$this->ClientId = $clientId;
Expand All @@ -59,7 +65,7 @@ public function withClientId($clientId) {
* Includes the client secret.
*
* @param string $clientSecret
* @return OAuthRequestParameters this builder
* @return static this builder
*/
public function withClientSecret($clientSecret) {
$this->ClientSecret = $clientSecret;
Expand All @@ -70,7 +76,7 @@ public function withClientSecret($clientSecret) {
* Includes the redirect URI.
*
* @param string $redirectUri
* @return OAuthRequestParameters this builder
* @return static this builder
*/
public function withRedirectUri($redirectUri) {
$this->RedirectUri = $redirectUri;
Expand All @@ -81,7 +87,7 @@ public function withRedirectUri($redirectUri) {
* Includes the grant type.
*
* @param string $grantType
* @return OAuthRequestParameters this builder
* @return static this builder
*/
public function withGrantType($grantType) {
$this->GrantType = $grantType;
Expand All @@ -92,7 +98,7 @@ public function withGrantType($grantType) {
* Includes the grant param name.
*
* @param string $grantParamName
* @return OAuthRequestParameters this builder
* @return static this builder
*/
public function withGrantParamName($grantParamName) {
$this->GrantParamName = $grantParamName;
Expand All @@ -103,7 +109,7 @@ public function withGrantParamName($grantParamName) {
* Includes the grant value.
*
* @param string $grantValue
* @return OAuthRequestParameters this builder
* @return static this builder
*/
public function withGrantValue($grantValue) {
$this->GrantValue = $grantValue;
Expand Down
15 changes: 11 additions & 4 deletions src/Auth/OAuthTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
*/
class OAuthTokens
{
/**
/**
* @var string
* Represents the access_token value returned by the authorization service.
*/
public $AccessToken;

/**
/**
* @var int
* Represents the expires_in value returned by the authorization service.
*/
public $AccessTokenExpiresInSeconds;

/**
/**
* @var string
* Represents the refresh_token value returned or sent via the authorization service.
*/
public $RefreshToken;
Expand All @@ -35,6 +38,7 @@ public function __construct() {}

/**
* Includes the access token.
* @return static
*/
public function withAccessToken($accessToken) {
$this->AccessToken = $accessToken;
Expand All @@ -43,14 +47,17 @@ public function withAccessToken($accessToken) {

/**
* Includes the access token expiration time in seconds.
* @return static
*/
public function withAccessTokenExpiresInSeconds($accessTokenExpiresInSeconds) {
$this->AccessTokenExpiresInSeconds = $accessTokenExpiresInSeconds;
return $this;
}

/**
/**
* Includes the refresh token.
* @param $refreshToken
* @return static
*/
public function withRefreshToken($refreshToken) {
$this->RefreshToken = $refreshToken;
Expand Down
20 changes: 12 additions & 8 deletions src/Auth/OAuthUrlParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@
*/
class OAuthUrlParameters
{
/**
/**
* @var string
* Your application's registered client identifier.
*/
public $ClientId;

/**
/**
* @var string
* The authorization response type.
* For implicit grant flow, the response type is 'token'.
* For authorization code grant flow, the response type is 'code'.
*/
public $ResponseType;

/**
/**
* @var string
* The URI where you want the authorization response to be redirected.
*/
public $RedirectUri;

/**
/**
* @var string
* An opaque value used by the client to maintain state between the request and callback.
*/
public $State;
Expand All @@ -35,7 +39,7 @@ public function __construct() {}
* Includes the client ID.
*
* @param string $clientId
* @return OAuthUrlParameters this builder
* @return static this builder
*/
public function withClientId($clientId) {
$this->ClientId = $clientId;
Expand All @@ -46,7 +50,7 @@ public function withClientId($clientId) {
* Includes the response type.
*
* @param string $responseType
* @return OAuthUrlParameters this builder
* @return static this builder
*/
public function withResponseType($responseType) {
$this->ResponseType = $responseType;
Expand All @@ -57,7 +61,7 @@ public function withResponseType($responseType) {
* Includes the redirect URI.
*
* @param string $redirectUri
* @return OAuthUrlParameters this builder
* @return static this builder
*/
public function withRedirectUri($redirectUri) {
$this->RedirectUri = $redirectUri;
Expand All @@ -68,7 +72,7 @@ public function withRedirectUri($redirectUri) {
* Includes the state.
*
* @param string $state
* @return OAuthUrlParameters this builder
* @return static this builder
*/
public function withState($state) {
$this->State = $state;
Expand Down
Loading

0 comments on commit f166dee

Please sign in to comment.