Completed
Push — 2.0-dev ( b0a4a0...b1403e )
by Michael
01:16
created
src/Client.php 3 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -209,12 +209,12 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	private function authorise()
211 211
 	{
212
-		$url = $this->getOption('authoriseURL') . '?oauth_token=' . $this->token['key'];
212
+		$url = $this->getOption('authoriseURL').'?oauth_token='.$this->token['key'];
213 213
 
214 214
 		if ($this->getOption('scope'))
215 215
 		{
216 216
 			$scope = \is_array($this->getOption('scope')) ? implode(' ', $this->getOption('scope')) : $this->getOption('scope');
217
-			$url .= '&scope=' . urlencode($scope);
217
+			$url .= '&scope='.urlencode($scope);
218 218
 		}
219 219
 
220 220
 		if ($this->getOption('sendheaders'))
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
 		{
359 359
 			if (!strcmp($header, 'OAuth '))
360 360
 			{
361
-				$header .= $key . '="' . $this->safeEncode($value) . '"';
361
+				$header .= $key.'="'.$this->safeEncode($value).'"';
362 362
 			}
363 363
 			else
364 364
 			{
365
-				$header .= ', ' . $key . '="' . $value . '"';
365
+				$header .= ', '.$key.'="'.$value.'"';
366 366
 			}
367 367
 		}
368 368
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 						$url .= '&';
397 397
 					}
398 398
 
399
-					$url .= $key . '=' . $v;
399
+					$url .= $key.'='.$v;
400 400
 				}
401 401
 			}
402 402
 			else
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 					$url .= '&';
416 416
 				}
417 417
 
418
-				$url .= $key . '=' . $value;
418
+				$url .= $key.'='.$value;
419 419
 			}
420 420
 		}
421 421
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	public static function generateNonce()
537 537
 	{
538 538
 		// The md5s look nicer than numbers.
539
-		return md5(microtime() . random_bytes(16));
539
+		return md5(microtime().random_bytes(16));
540 540
 	}
541 541
 
542 542
 	/**
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	 */
549 549
 	private function prepareSigningKey(): string
550 550
 	{
551
-		return $this->safeEncode($this->getOption('consumer_secret')) . '&' . $this->safeEncode(($this->token) ? $this->token['secret'] : '');
551
+		return $this->safeEncode($this->getOption('consumer_secret')).'&'.$this->safeEncode(($this->token) ? $this->token['secret'] : '');
552 552
 	}
553 553
 
554 554
 	/**
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
 		if (strcmp($this->version, '1.0a') === 0)
122 122
 		{
123 123
 			$verifier = $this->input->get('oauth_verifier');
124
-		}
125
-		else
124
+		} else
126 125
 		{
127 126
 			$verifier = $this->input->get('oauth_token');
128 127
 		}
@@ -282,8 +281,7 @@  discard block
 block discarded – undo
282 281
 		if (isset($headers['Content-Type']) && strpos($headers['Content-Type'], 'multipart/form-data') !== false || !\is_array($data))
283 282
 		{
284 283
 			$oauthHeaders = $parameters;
285
-		}
286
-		else
284
+		} else
287 285
 		{
288 286
 			// Use all parameters for the signature.
289 287
 			$oauthHeaders = array_merge($parameters, $data);
@@ -359,8 +357,7 @@  discard block
 block discarded – undo
359 357
 			if (!strcmp($header, 'OAuth '))
360 358
 			{
361 359
 				$header .= $key . '="' . $this->safeEncode($value) . '"';
362
-			}
363
-			else
360
+			} else
364 361
 			{
365 362
 				$header .= ', ' . $key . '="' . $value . '"';
366 363
 			}
@@ -390,16 +387,14 @@  discard block
 block discarded – undo
390 387
 					if (strpos($url, '?') === false)
391 388
 					{
392 389
 						$url .= '?';
393
-					}
394
-					else
390
+					} else
395 391
 					{
396 392
 						$url .= '&';
397 393
 					}
398 394
 
399 395
 					$url .= $key . '=' . $v;
400 396
 				}
401
-			}
402
-			else
397
+			} else
403 398
 			{
404 399
 				if (strpos($value, ' ') !== false)
405 400
 				{
@@ -409,8 +404,7 @@  discard block
 block discarded – undo
409 404
 				if (strpos($url, '?') === false)
410 405
 				{
411 406
 					$url .= '?';
412
-				}
413
-				else
407
+				} else
414 408
 				{
415 409
 					$url .= '&';
416 410
 				}
@@ -475,8 +469,7 @@  discard block
 block discarded – undo
475 469
 					$v    = $this->safeEncode($v);
476 470
 					$kv[] = "{$key}={$v}";
477 471
 				}
478
-			}
479
-			else
472
+			} else
480 473
 			{
481 474
 				$value = $this->safeEncode($value);
482 475
 				$kv[]  = "{$key}={$value}";
Please login to merge, or discard this patch.
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.
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.