@@ -60,7 +60,7 @@ |
||
| 60 | 60 | if (null === $data || !is_array($data)) { |
| 61 | 61 | throw new TokenResponseException('Unable to parse response.'); |
| 62 | 62 | } elseif (isset($data['error'])) { |
| 63 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 63 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $token = new StdOAuth2Token(); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | foreach ($scopes as $scope) { |
| 59 | 59 | if (!$this->isValidScope($scope)) { |
| 60 | - throw new InvalidScopeException('Scope ' . $scope . ' is not valid for service ' . get_class($this)); |
|
| 60 | + throw new InvalidScopeException('Scope '.$scope.' is not valid for service '.get_class($this)); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | // add the token where it may be needed |
| 167 | 167 | if (static::AUTHORIZATION_METHOD_HEADER_OAUTH === $this->getAuthorizationMethod()) { |
| 168 | - $extraHeaders = array_merge(array('Authorization' => 'OAuth ' . $token->getAccessToken()), $extraHeaders); |
|
| 168 | + $extraHeaders = array_merge(array('Authorization' => 'OAuth '.$token->getAccessToken()), $extraHeaders); |
|
| 169 | 169 | } elseif (static::AUTHORIZATION_METHOD_QUERY_STRING === $this->getAuthorizationMethod()) { |
| 170 | 170 | $uri->addToQuery('access_token', $token->getAccessToken()); |
| 171 | 171 | } elseif (static::AUTHORIZATION_METHOD_QUERY_STRING_V2 === $this->getAuthorizationMethod()) { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } elseif (static::AUTHORIZATION_METHOD_QUERY_STRING_V4 === $this->getAuthorizationMethod()) { |
| 176 | 176 | $uri->addToQuery('auth', $token->getAccessToken()); |
| 177 | 177 | } elseif (static::AUTHORIZATION_METHOD_HEADER_BEARER === $this->getAuthorizationMethod()) { |
| 178 | - $extraHeaders = array_merge(array('Authorization' => 'Bearer ' . $token->getAccessToken()), $extraHeaders); |
|
| 178 | + $extraHeaders = array_merge(array('Authorization' => 'Bearer '.$token->getAccessToken()), $extraHeaders); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $extraHeaders = array_merge($this->getExtraApiHeaders(), $extraHeaders); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | protected function getApiVersionString() |
| 351 | 351 | { |
| 352 | - return !(empty($this->apiVersion)) ? "/".$this->apiVersion : "" ; |
|
| 352 | + return !(empty($this->apiVersion)) ? "/".$this->apiVersion : ""; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @var string |
| 20 | 20 | */ |
| 21 | - const SCOPE_API = 'api', |
|
| 22 | - SCOPE_REFRESH_TOKEN = 'refresh_token'; |
|
| 21 | + const SCOPE_API = 'api', |
|
| 22 | + SCOPE_REFRESH_TOKEN = 'refresh_token'; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * {@inheritdoc} |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | if (null === $data || !is_array($data)) { |
| 64 | 64 | throw new TokenResponseException('Unable to parse response.'); |
| 65 | 65 | } elseif (isset($data['error'])) { |
| 66 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 66 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $token = new StdOAuth2Token(); |
@@ -83,10 +83,10 @@ |
||
| 83 | 83 | { |
| 84 | 84 | $data = json_decode($responseBody, true); |
| 85 | 85 | |
| 86 | - if (null === $data || ! is_array($data)) { |
|
| 86 | + if (null === $data || !is_array($data)) { |
|
| 87 | 87 | throw new TokenResponseException('Unable to parse response.'); |
| 88 | 88 | } elseif (isset($data['error'])) { |
| 89 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 89 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $token = new StdOAuth2Token(); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | if (null === $data || !is_array($data)) { |
| 165 | 165 | throw new TokenResponseException('Unable to parse response.'); |
| 166 | 166 | } elseif (isset($data['error'])) { |
| 167 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 167 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $token = new StdOAuth2Token(); |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | throw new Exception("Redirect uri is mandatory for this request"); |
| 194 | 194 | } |
| 195 | 195 | $parameters['app_id'] = $this->credentials->getConsumerId(); |
| 196 | - $baseUrl = self::WWW_URL .$this->getApiVersionString(). '/dialog/' . $dialogPath; |
|
| 196 | + $baseUrl = self::WWW_URL.$this->getApiVersionString().'/dialog/'.$dialogPath; |
|
| 197 | 197 | $query = http_build_query($parameters); |
| 198 | - return new Uri($baseUrl . '?' . $query); |
|
| 198 | + return new Uri($baseUrl.'?'.$query); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | if (null === $data || !is_array($data)) { |
| 120 | 120 | throw new TokenResponseException('Unable to parse response.'); |
| 121 | 121 | } elseif (isset($data['error'])) { |
| 122 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 122 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 123 | 123 | } |
| 124 | 124 | //print $data['access_token'];exit; |
| 125 | 125 | |
@@ -79,9 +79,9 @@ |
||
| 79 | 79 | if (null === $data || !is_array($data)) { |
| 80 | 80 | throw new TokenResponseException('Unable to parse response.'); |
| 81 | 81 | } elseif (isset($data['message'])) { |
| 82 | - throw new TokenResponseException('Error in retrieving token: "' . $data['message'] . '"'); |
|
| 82 | + throw new TokenResponseException('Error in retrieving token: "'.$data['message'].'"'); |
|
| 83 | 83 | } elseif (isset($data['name'])) { |
| 84 | - throw new TokenResponseException('Error in retrieving token: "' . $data['name'] . '"'); |
|
| 84 | + throw new TokenResponseException('Error in retrieving token: "'.$data['name'].'"'); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $token = new StdOAuth2Token(); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | throw new TokenResponseException('Unable to parse response.'); |
| 46 | 46 | } elseif (isset($data['error'])) |
| 47 | 47 | { |
| 48 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 48 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $token = new StdOAuth2Token(); |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected function getExtraOAuthHeaders() |
| 73 | 73 | { |
| 74 | - $encodedCredentials = base64_encode($this->credentials->getConsumerId() . ':' . $this->credentials->getConsumerSecret()); |
|
| 75 | - return array('Authorization' => 'Basic ' . $encodedCredentials); |
|
| 74 | + $encodedCredentials = base64_encode($this->credentials->getConsumerId().':'.$this->credentials->getConsumerSecret()); |
|
| 75 | + return array('Authorization' => 'Basic '.$encodedCredentials); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | if (null === $data || !is_array($data)) { |
| 63 | 63 | throw new TokenResponseException('Unable to parse response.'); |
| 64 | 64 | } elseif (isset($data['error'])) { |
| 65 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 65 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Create token object. |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | protected function setBaseApiUri(StdOAuth2Token $token) |
| 98 | 98 | { |
| 99 | 99 | // Make request uri. |
| 100 | - $endpoint = 'https://login.mailchimp.com/oauth2/metadata?oauth_token='. $token->getAccessToken(); |
|
| 100 | + $endpoint = 'https://login.mailchimp.com/oauth2/metadata?oauth_token='.$token->getAccessToken(); |
|
| 101 | 101 | |
| 102 | 102 | // Grab meta data about the token. |
| 103 | 103 | $response = $this->httpClient->retrieveResponse(new Uri($endpoint), array(), array(), 'GET'); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $meta = json_decode($response, true); |
| 107 | 107 | |
| 108 | 108 | // Set base api uri. |
| 109 | - $this->baseApiUri = new Uri('https://'. $meta['dc'] .'.api.mailchimp.com/2.0/'); |
|
| 109 | + $this->baseApiUri = new Uri('https://'.$meta['dc'].'.api.mailchimp.com/2.0/'); |
|
| 110 | 110 | |
| 111 | 111 | // Allow chaining. |
| 112 | 112 | return $this; |