@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | if (null === $data || !is_array($data)) { |
| 69 | 69 | throw new TokenResponseException('Unable to parse response.'); |
| 70 | 70 | } elseif (isset($data['error'])) { |
| 71 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 71 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $token = new StdOAuth2Token(); |
@@ -93,6 +93,6 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | protected function getExtraOAuthHeaders() |
| 95 | 95 | { |
| 96 | - return array('Authorization' => 'Basic ' . $this->credentials->getConsumerSecret()); |
|
| 96 | + return array('Authorization' => 'Basic '.$this->credentials->getConsumerSecret()); |
|
| 97 | 97 | } |
| 98 | 98 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | const SCOPE_CALENDAR = 'https://www.googleapis.com/auth/calendar'; |
| 77 | 77 | const SCOPE_CALENDAR_READ_ONLY = 'https://www.googleapis.com/auth/calendar.readonly'; |
| 78 | 78 | const SCOPE_CONTACT = 'https://www.google.com/m8/feeds/'; |
| 79 | - const SOCPE_CONTACTS = 'https://www.googleapis.com/auth/contacts'; |
|
| 79 | + const SOCPE_CONTACTS = 'https://www.googleapis.com/auth/contacts'; |
|
| 80 | 80 | const SCOPE_CONTACTS_RO = 'https://www.googleapis.com/auth/contacts.readonly'; |
| 81 | 81 | const SCOPE_CHROMEWEBSTORE = 'https://www.googleapis.com/auth/chromewebstore.readonly'; |
| 82 | 82 | const SCOPE_GMAIL = 'https://mail.google.com/mail/feed/atom'; |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | // Google Gsuite |
| 122 | - const SCOPE_ADMIN_DIRECTORY_USER = "https://www.googleapis.com/auth/admin.directory.user"; |
|
| 123 | - const SCOPE_ADMIN_DIRECTORY_CUSTOMER = "https://www.googleapis.com/auth/admin.directory.customer"; |
|
| 122 | + const SCOPE_ADMIN_DIRECTORY_USER = "https://www.googleapis.com/auth/admin.directory.user"; |
|
| 123 | + const SCOPE_ADMIN_DIRECTORY_CUSTOMER = "https://www.googleapis.com/auth/admin.directory.customer"; |
|
| 124 | 124 | |
| 125 | 125 | protected $accessType = 'online'; |
| 126 | 126 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // LDR CHANGE Add approval_prompt to force the prompt if value is set to 'force' so it force return of a "refresh token" in addition to "standard token" |
| 150 | - public $approvalPrompt='auto'; |
|
| 150 | + public $approvalPrompt = 'auto'; |
|
| 151 | 151 | public function setApprouvalPrompt($prompt) |
| 152 | 152 | { |
| 153 | 153 | if (!in_array($prompt, array('auto', 'force'), true)) { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | { |
| 165 | 165 | // LDR CHANGE Add approval_prompt to force the prompt if value is set to 'force' so it force return of a "refresh token" in addition to "standard token" |
| 166 | 166 | //return new Uri('https://accounts.google.com/o/oauth2/auth?access_type='.$this->accessType); |
| 167 | - $url = 'https://accounts.google.com/o/oauth2/auth?'.($this->approvalPrompt?'approval_prompt='.$this->approvalPrompt.'&':'').'access_type='.$this->accessType; |
|
| 167 | + $url = 'https://accounts.google.com/o/oauth2/auth?'.($this->approvalPrompt ? 'approval_prompt='.$this->approvalPrompt.'&' : '').'access_type='.$this->accessType; |
|
| 168 | 168 | |
| 169 | 169 | return new Uri($url); |
| 170 | 170 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | if (null === $data || !is_array($data)) { |
| 188 | 188 | throw new TokenResponseException('Unable to parse response.'); |
| 189 | 189 | } elseif (isset($data['error'])) { |
| 190 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 190 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | $token = new StdOAuth2Token(); |
@@ -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(); |