@@ -60,7 +60,7 @@ |
||
60 | 60 | if ($data === null || !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 StdOAuth1Token(); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | const ENDPOINT_AUTHENTICATE = "https://api.twitter.com/oauth/authenticate"; |
18 | 18 | const ENDPOINT_AUTHORIZE = "https://api.twitter.com/oauth/authorize"; |
19 | 19 | |
20 | - protected $authorizationEndpoint = self::ENDPOINT_AUTHENTICATE; |
|
20 | + protected $authorizationEndpoint = self::ENDPOINT_AUTHENTICATE; |
|
21 | 21 | |
22 | 22 | public function __construct( |
23 | 23 | CredentialsInterface $credentials, |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | parse_str($responseBody, $data); |
101 | 101 | |
102 | 102 | if (null === $data || !is_array($data)) { |
103 | - throw new TokenResponseException('Unable to parse response: ' . $responseBody); |
|
103 | + throw new TokenResponseException('Unable to parse response: '.$responseBody); |
|
104 | 104 | } elseif (isset($data['error'])) { |
105 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
105 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
106 | 106 | } elseif (!isset($data["oauth_token"]) || !isset($data["oauth_token_secret"])) { |
107 | - throw new TokenResponseException('Invalid response. OAuth Token data not set: ' . $responseBody); |
|
107 | + throw new TokenResponseException('Invalid response. OAuth Token data not set: '.$responseBody); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $token = new StdOAuth1Token(); |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function getRequestTokenEndpoint() |
37 | 37 | { |
38 | - $uri = new Uri($this->baseApiUri . 'oauth/request_token'); |
|
38 | + $uri = new Uri($this->baseApiUri.'oauth/request_token'); |
|
39 | 39 | $scopes = $this->getScopes(); |
40 | 40 | |
41 | 41 | if (count($scopes)) { |
42 | - $uri->setQuery('scope=' . implode('%20', $scopes)); |
|
42 | + $uri->setQuery('scope='.implode('%20', $scopes)); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | return $uri; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function getAccessTokenEndpoint() |
60 | 60 | { |
61 | - return new Uri($this->baseApiUri . 'oauth/access_token'); |
|
61 | + return new Uri($this->baseApiUri.'oauth/access_token'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if (null === $data || !is_array($data)) { |
88 | 88 | throw new TokenResponseException('Unable to parse response.'); |
89 | 89 | } elseif (isset($data['error'])) { |
90 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
90 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | $token = new StdOAuth1Token(); |
@@ -78,7 +78,7 @@ |
||
78 | 78 | if (null === $data || !is_array($data)) { |
79 | 79 | throw new TokenResponseException('Unable to parse response.'); |
80 | 80 | } elseif ($errors) { |
81 | - throw new TokenResponseException('Error in retrieving token: "' . $errors->error_name . '"'); |
|
81 | + throw new TokenResponseException('Error in retrieving token: "'.$errors->error_name.'"'); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | $token = new StdOAuth1Token(); |
@@ -111,11 +111,11 @@ |
||
111 | 111 | throw new TokenResponseException('Unable to parse response.'); |
112 | 112 | } elseif (isset($data['error_description'])) { |
113 | 113 | throw new TokenResponseException( |
114 | - 'Error in retrieving token: "' . $data['error_description'] . '"' |
|
114 | + 'Error in retrieving token: "'.$data['error_description'].'"' |
|
115 | 115 | ); |
116 | 116 | } elseif (isset($data['error'])) { |
117 | 117 | throw new TokenResponseException( |
118 | - 'Error in retrieving token: "' . $data['error'] . '"' |
|
118 | + 'Error in retrieving token: "'.$data['error'].'"' |
|
119 | 119 | ); |
120 | 120 | } |
121 | 121 |
@@ -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 | /** |