@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct($namespace, $path) |
29 | 29 | { |
30 | 30 | $this->namespace = ltrim($namespace, '\\'); |
31 | - $this->path = rtrim($path, '/\\') . DIRECTORY_SEPARATOR; |
|
31 | + $this->path = rtrim($path, '/\\').DIRECTORY_SEPARATOR; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $nsparts = explode('\\', $class); |
47 | 47 | $class = array_pop($nsparts); |
48 | 48 | $nsparts[] = ''; |
49 | - $path = $this->path . implode(DIRECTORY_SEPARATOR, $nsparts); |
|
50 | - $path .= str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; |
|
49 | + $path = $this->path.implode(DIRECTORY_SEPARATOR, $nsparts); |
|
50 | + $path .= str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; |
|
51 | 51 | |
52 | 52 | if (file_exists($path)) { |
53 | 53 | require $path; |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'"; |
131 | 131 | $sql .= " AND entity IN (".getEntity('oauth_token').")"; |
132 | 132 | $resql = $this->db->query($sql); |
133 | - if (! $resql) { |
|
133 | + if (!$resql) { |
|
134 | 134 | dol_print_error($this->db); |
135 | 135 | } |
136 | 136 | $obj = $this->db->fetch_array($resql); |
137 | 137 | if ($obj) { |
138 | 138 | // update |
139 | 139 | $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token"; |
140 | - $sql.= " SET token = '".$this->db->escape(dolEncrypt($serializedToken))."'"; |
|
141 | - $sql.= " WHERE rowid = ".((int) $obj['rowid']); |
|
140 | + $sql .= " SET token = '".$this->db->escape(dolEncrypt($serializedToken))."'"; |
|
141 | + $sql .= " WHERE rowid = ".((int) $obj['rowid']); |
|
142 | 142 | $resql = $this->db->query($sql); |
143 | 143 | if (!$resql) { |
144 | 144 | dol_print_error($this->db); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'"; |
184 | 184 | $sql .= " AND entity IN (".getEntity('oauth_token').")"; |
185 | 185 | $resql = $this->db->query($sql); |
186 | - if (! $resql) { |
|
186 | + if (!$resql) { |
|
187 | 187 | dol_print_error($this->db); |
188 | 188 | } |
189 | 189 | $result = $this->db->fetch_array($resql); |
@@ -292,20 +292,20 @@ discard block |
||
292 | 292 | $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'"; |
293 | 293 | $sql .= " AND entity IN (".getEntity('oauth_token').")"; |
294 | 294 | $resql = $this->db->query($sql); |
295 | - if (! $resql) { |
|
295 | + if (!$resql) { |
|
296 | 296 | dol_print_error($this->db); |
297 | 297 | } |
298 | 298 | $obj = $this->db->fetch_array($resql); |
299 | 299 | if ($obj) { |
300 | 300 | // update |
301 | 301 | $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token"; |
302 | - $sql.= " SET state = '".$this->db->escape($newstate)."'"; |
|
303 | - $sql.= " WHERE rowid = ".((int) $obj['rowid']); |
|
302 | + $sql .= " SET state = '".$this->db->escape($newstate)."'"; |
|
303 | + $sql .= " WHERE rowid = ".((int) $obj['rowid']); |
|
304 | 304 | $resql = $this->db->query($sql); |
305 | 305 | } else { |
306 | 306 | // insert (should not happen) |
307 | 307 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, state, entity)"; |
308 | - $sql.= " VALUES ('".$this->db->escape($servicepluskeyforprovider)."', '".$this->db->escape($newstate)."', ".((int) $conf->entity).")"; |
|
308 | + $sql .= " VALUES ('".$this->db->escape($servicepluskeyforprovider)."', '".$this->db->escape($newstate)."', ".((int) $conf->entity).")"; |
|
309 | 309 | $resql = $this->db->query($sql); |
310 | 310 | } |
311 | 311 |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | // pipeline for performance |
121 | 121 | $this->redis->pipeline( |
122 | - function ($pipe) use ($keys, $me) { |
|
122 | + function($pipe) use ($keys, $me) { |
|
123 | 123 | foreach ($keys as $k) { |
124 | 124 | $pipe->hdel($me->getKey(), $k); |
125 | 125 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | // pipeline for performance |
203 | 203 | $this->redis->pipeline( |
204 | - function ($pipe) use ($keys, $me) { |
|
204 | + function($pipe) use ($keys, $me) { |
|
205 | 205 | foreach ($keys as $k) { |
206 | 206 | $pipe->hdel($me->getKey(), $k); |
207 | 207 | } |
@@ -67,8 +67,8 @@ |
||
67 | 67 | $lastError = error_get_last(); |
68 | 68 | if (is_null($lastError)) { |
69 | 69 | throw new TokenResponseException( |
70 | - 'Failed to request resource. HTTP Code: ' . |
|
71 | - ((isset($http_response_header[0]))?$http_response_header[0]:'No response') |
|
70 | + 'Failed to request resource. HTTP Code: '. |
|
71 | + ((isset($http_response_header[0])) ? $http_response_header[0] : 'No response') |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | throw new TokenResponseException($lastError['message']); |
@@ -64,9 +64,9 @@ |
||
64 | 64 | // Normalize headers |
65 | 65 | array_walk( |
66 | 66 | $headers, |
67 | - function (&$val, &$key) { |
|
67 | + function(&$val, &$key) { |
|
68 | 68 | $key = ucfirst(strtolower($key)); |
69 | - $val = ucfirst(strtolower($key)) . ': ' . $val; |
|
69 | + $val = ucfirst(strtolower($key)).': '.$val; |
|
70 | 70 | } |
71 | 71 | ); |
72 | 72 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $userInfo .= $uriParts['user']; |
115 | 115 | } |
116 | 116 | if ($userInfo && !empty($uriParts['pass'])) { |
117 | - $userInfo .= ':' . $uriParts['pass']; |
|
117 | + $userInfo .= ':'.$uriParts['pass']; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->setUserInfo($userInfo); |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | // after the first colon (":") character found within a userinfo |
135 | 135 | // subcomponent unless the data after the colon is the empty string |
136 | 136 | // (indicating no password)" |
137 | - if ($colonPos !== false && strlen($rawUserInfo)-1 > $colonPos) { |
|
138 | - return substr($rawUserInfo, 0, $colonPos) . ':********'; |
|
137 | + if ($colonPos !== false && strlen($rawUserInfo) - 1 > $colonPos) { |
|
138 | + return substr($rawUserInfo, 0, $colonPos).':********'; |
|
139 | 139 | } else { |
140 | 140 | return $rawUserInfo; |
141 | 141 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function getAbsoluteUri() |
245 | 245 | { |
246 | - $uri = $this->scheme . '://' . $this->getRawAuthority(); |
|
246 | + $uri = $this->scheme.'://'.$this->getRawAuthority(); |
|
247 | 247 | |
248 | 248 | if ('/' === $this->path) { |
249 | 249 | $uri .= $this->explicitTrailingHostSlash ? '/' : ''; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function __toString() |
288 | 288 | { |
289 | - $uri = $this->scheme . '://' . $this->getAuthority(); |
|
289 | + $uri = $this->scheme.'://'.$this->getAuthority(); |
|
290 | 290 | |
291 | 291 | if ('/' === $this->path) { |
292 | 292 | $uri .= $this->explicitTrailingHostSlash ? '/' : ''; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ksort($signatureData); |
66 | 66 | |
67 | 67 | // determine base uri |
68 | - $baseUri = $uri->getScheme() . '://' . $uri->getRawAuthority(); |
|
68 | + $baseUri = $uri->getScheme().'://'.$uri->getRawAuthority(); |
|
69 | 69 | |
70 | 70 | if ('/' === $uri->getPath()) { |
71 | 71 | $baseUri .= $uri->hasExplicitTrailingHostSlash() ? '/' : ''; |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | $baseUri .= $uri->getPath(); |
74 | 74 | } |
75 | 75 | |
76 | - $baseString = strtoupper($method) . '&'; |
|
77 | - $baseString .= rawurlencode($baseUri) . '&'; |
|
76 | + $baseString = strtoupper($method).'&'; |
|
77 | + $baseString .= rawurlencode($baseUri).'&'; |
|
78 | 78 | $baseString .= rawurlencode($this->buildSignatureDataString($signatureData)); |
79 | 79 | |
80 | 80 | return base64_encode($this->hash($baseString)); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $signatureString = ''; |
91 | 91 | $delimiter = ''; |
92 | 92 | foreach ($signatureData as $key => $value) { |
93 | - $signatureString .= $delimiter . $key . '=' . $value; |
|
93 | + $signatureString .= $delimiter.$key.'='.$value; |
|
94 | 94 | |
95 | 95 | $delimiter = '&'; |
96 | 96 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function getSigningKey() |
105 | 105 | { |
106 | - $signingKey = rawurlencode($this->credentials->getConsumerSecret()) . '&'; |
|
106 | + $signingKey = rawurlencode($this->credentials->getConsumerSecret()).'&'; |
|
107 | 107 | if ($this->tokenSecret !== null) { |
108 | 108 | $signingKey .= rawurlencode($this->tokenSecret); |
109 | 109 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | return hash_hmac('sha1', $data, $this->getSigningKey(), true); |
126 | 126 | default: |
127 | 127 | throw new UnsupportedHashAlgorithmException( |
128 | - 'Unsupported hashing algorithm (' . $this->algorithm . ') used.' |
|
128 | + 'Unsupported hashing algorithm ('.$this->algorithm.') used.' |
|
129 | 129 | ); |
130 | 130 | } |
131 | 131 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function getRequestTokenEndpoint() |
34 | 34 | { |
35 | - return new Uri($this->baseApiUri->getAbsoluteUri() . '/request_token'); |
|
35 | + return new Uri($this->baseApiUri->getAbsoluteUri().'/request_token'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getAuthorizationEndpoint() |
42 | 42 | { |
43 | - return new Uri($this->baseApiUri->getAbsoluteUri() . '/authorize'); |
|
43 | + return new Uri($this->baseApiUri->getAbsoluteUri().'/authorize'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getAccessTokenEndpoint() |
50 | 50 | { |
51 | - return new Uri($this->baseApiUri->getAbsoluteUri() . '/access_token'); |
|
51 | + return new Uri($this->baseApiUri->getAbsoluteUri().'/access_token'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if (null === $data || !is_array($data)) { |
78 | 78 | throw new TokenResponseException('Unable to parse response.'); |
79 | 79 | } elseif (isset($data['error'])) { |
80 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
80 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $token = new StdOAuth1Token(); |
@@ -87,7 +87,7 @@ |
||
87 | 87 | if (null === $data || !is_array($data)) { |
88 | 88 | throw new TokenResponseException('Unable to parse response.'); |
89 | 89 | } elseif (isset($data['error'])) { |
90 | - $message = 'Error in retrieving token: "' . $data['error'] . '"'; |
|
90 | + $message = 'Error in retrieving token: "'.$data['error'].'"'; |
|
91 | 91 | throw new TokenResponseException($message); |
92 | 92 | } |
93 | 93 |