Completed
Pull Request — 2.0-dev (#7)
by
unknown
10:58
created
src/Client.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	 * Method to validate a response.
337 337
 	 *
338 338
 	 * @param   string    $url       The request URL.
339
-	 * @param   Response  $response  The response to validate.
339
+	 * @param   \Joomla\Http\Response  $response  The response to validate.
340 340
 	 *
341 341
 	 * @return  void
342 342
 	 *
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	 * Set an option for the OAuth1 Client instance.
585 585
 	 *
586 586
 	 * @param   string  $key    The name of the option to set
587
-	 * @param   mixed   $value  The option value to set
587
+	 * @param   string   $value  The option value to set
588 588
 	 *
589 589
 	 * @return  $this
590 590
 	 *
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	private function authorise()
219 219
 	{
220
-		$url = $this->getOption('authoriseURL') . '?oauth_token=' . $this->token['key'];
220
+		$url = $this->getOption('authoriseURL').'?oauth_token='.$this->token['key'];
221 221
 
222 222
 		if ($this->getOption('scope'))
223 223
 		{
224 224
 			$scope = \is_array($this->getOption('scope')) ? implode(' ', $this->getOption('scope')) : $this->getOption('scope');
225
-			$url .= '&scope=' . urlencode($scope);
225
+			$url .= '&scope='.urlencode($scope);
226 226
 		}
227 227
 
228 228
 		if ($this->getOption('sendheaders'))
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
 		{
371 371
 			if (!strcmp($header, 'OAuth '))
372 372
 			{
373
-				$header .= $key . '="' . $this->safeEncode($value) . '"';
373
+				$header .= $key.'="'.$this->safeEncode($value).'"';
374 374
 			}
375 375
 			else
376 376
 			{
377
-				$header .= ', ' . $key . '="' . $value . '"';
377
+				$header .= ', '.$key.'="'.$value.'"';
378 378
 			}
379 379
 		}
380 380
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	public static function generateNonce()
514 514
 	{
515 515
 		// The md5s look nicer than numbers.
516
-		return md5(microtime() . random_bytes(16));
516
+		return md5(microtime().random_bytes(16));
517 517
 	}
518 518
 
519 519
 	/**
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 	 */
526 526
 	private function prepareSigningKey(): string
527 527
 	{
528
-		return $this->safeEncode($this->getOption('consumer_secret')) . '&' . $this->safeEncode(($this->token) ? $this->token['secret'] : '');
528
+		return $this->safeEncode($this->getOption('consumer_secret')).'&'.$this->safeEncode(($this->token) ? $this->token['secret'] : '');
529 529
 	}
530 530
 
531 531
 	/**
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -129,8 +129,7 @@  discard block
 block discarded – undo
129 129
 		if (strcmp($this->version, '1.0a') === 0)
130 130
 		{
131 131
 			$verifier = $this->input->get('oauth_verifier');
132
-		}
133
-		else
132
+		} else
134 133
 		{
135 134
 			$verifier = $this->input->get('oauth_token');
136 135
 		}
@@ -290,8 +289,7 @@  discard block
 block discarded – undo
290 289
 		if (isset($headers['Content-Type']) && strpos($headers['Content-Type'], 'multipart/form-data') !== false || !\is_array($data))
291 290
 		{
292 291
 			$oauthHeaders = $parameters;
293
-		}
294
-		else
292
+		} else
295 293
 		{
296 294
 			// Use all parameters for the signature.
297 295
 			$oauthHeaders = array_merge($parameters, $data);
@@ -371,8 +369,7 @@  discard block
 block discarded – undo
371 369
 			if (!strcmp($header, 'OAuth '))
372 370
 			{
373 371
 				$header .= $key . '="' . $this->safeEncode($value) . '"';
374
-			}
375
-			else
372
+			} else
376 373
 			{
377 374
 				$header .= ', ' . $key . '="' . $value . '"';
378 375
 			}
@@ -452,8 +449,7 @@  discard block
 block discarded – undo
452 449
 					$v    = $this->safeEncode($v);
453 450
 					$kv[] = "{$key}={$v}";
454 451
 				}
455
-			}
456
-			else
452
+			} else
457 453
 			{
458 454
 				$value = $this->safeEncode($value);
459 455
 				$kv[]  = "{$key}={$value}";
Please login to merge, or discard this patch.
Tests/ClientTest.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -144,8 +144,7 @@  discard block
 block discarded – undo
144 144
 			$this->object->setToken($token);
145 145
 			$result = $this->object->authenticate();
146 146
 			$this->assertEquals($result, $token);
147
-		}
148
-		else
147
+		} else
149 148
 		{
150 149
 			$this->object->setOption('requestTokenURL', 'https://example.com/request_token');
151 150
 			$this->object->setOption('authoriseURL', 'https://example.com/authorize');
@@ -183,8 +182,7 @@  discard block
 block discarded – undo
183 182
 			if ($version === '1.0a')
184 183
 			{
185 184
 				$data = ['oauth_verifier' => 'verifier', 'oauth_token' => 'token'];
186
-			}
187
-			else
185
+			} else
188 186
 			{
189 187
 				$data = ['oauth_token' => 'token'];
190 188
 			}
@@ -306,8 +304,7 @@  discard block
 block discarded – undo
306 304
 					['Content-Type' => 'multipart/form-data']
307 305
 				)
308 306
 			);
309
-		}
310
-		else
307
+		} else
311 308
 		{
312 309
 			$this->client->expects($this->at(0))
313 310
 				->method($method)
Please login to merge, or discard this patch.