@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | namespace OAuth; |
8 | 8 | |
9 | -require_once __DIR__ . '/Common/AutoLoader.php'; |
|
9 | +require_once __DIR__.'/Common/AutoLoader.php'; |
|
10 | 10 | |
11 | 11 | $autoloader = new Common\AutoLoader(__NAMESPACE__, dirname(__DIR__)); |
12 | 12 |
@@ -71,7 +71,7 @@ |
||
71 | 71 | $path = substr($path, 1); |
72 | 72 | } |
73 | 73 | |
74 | - $uri->setPath($uri->getPath() . $path); |
|
74 | + $uri->setPath($uri->getPath().$path); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | return $uri; |
@@ -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; |
@@ -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 | } |
@@ -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 |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $authorizationHeader = 'OAuth '; |
182 | 182 | $delimiter = ''; |
183 | 183 | foreach ($parameters as $key => $value) { |
184 | - $authorizationHeader .= $delimiter . rawurlencode($key) . '="' . rawurlencode($value) . '"'; |
|
184 | + $authorizationHeader .= $delimiter.rawurlencode($key).'="'.rawurlencode($value).'"'; |
|
185 | 185 | |
186 | 186 | $delimiter = ', '; |
187 | 187 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $delimiter = ''; |
226 | 226 | |
227 | 227 | foreach ($authParameters as $key => $value) { |
228 | - $authorizationHeader .= $delimiter . rawurlencode($key) . '="' . rawurlencode($value) . '"'; |
|
228 | + $authorizationHeader .= $delimiter.rawurlencode($key).'="'.rawurlencode($value).'"'; |
|
229 | 229 | $delimiter = ', '; |
230 | 230 | } |
231 | 231 | |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; |
265 | 265 | |
266 | 266 | $nonce = ''; |
267 | - $maxRand = strlen($characters)-1; |
|
267 | + $maxRand = strlen($characters) - 1; |
|
268 | 268 | for ($i = 0; $i < $length; $i++) { |
269 | - $nonce.= $characters[rand(0, $maxRand)]; |
|
269 | + $nonce .= $characters[rand(0, $maxRand)]; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | return $nonce; |