Completed
Push — master ( 44e9c6...5609e7 )
by Michael
06:24
created
src/Client.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	/**
59 59
 	 * Constructor.
60 60
 	 *
61
-	 * @param   array                   $options      OAuth1 Client options array.
61
+	 * @param   \Joomla\Registry\Registry                   $options      OAuth1 Client options array.
62 62
 	 * @param   Http                    $client       The HTTP client object.
63 63
 	 * @param   Input                   $input        The input object
64 64
 	 * @param   AbstractWebApplication  $application  The application object
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 * @param   mixed   $data        The POST request data.
250 250
 	 * @param   array   $headers     An array of name-value pairs to include in the header of the request
251 251
 	 *
252
-	 * @return  object  The Response object.
252
+	 * @return  \Joomla\Http\Response  The Response object.
253 253
 	 *
254 254
 	 * @since   1.0
255 255
 	 * @throws  \DomainException
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * Method to validate a response.
319 319
 	 *
320 320
 	 * @param   string    $url       The request URL.
321
-	 * @param   Response  $response  The response to validate.
321
+	 * @param   \Joomla\Http\Response  $response  The response to validate.
322 322
 	 *
323 323
 	 * @return  void
324 324
 	 *
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	 * Set an option for the OAuth1 Client instance.
566 566
 	 *
567 567
 	 * @param   string  $key    The name of the option to set
568
-	 * @param   mixed   $value  The option value to set
568
+	 * @param   string   $value  The option value to set
569 569
 	 *
570 570
 	 * @return  Client  This object for method chaining
571 571
 	 *
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	private function authorise()
199 199
 	{
200
-		$url = $this->getOption('authoriseURL') . '?oauth_token=' . $this->token['key'];
200
+		$url = $this->getOption('authoriseURL').'?oauth_token='.$this->token['key'];
201 201
 
202 202
 		if ($this->getOption('scope'))
203 203
 		{
204 204
 			$scope = is_array($this->getOption('scope')) ? implode(' ', $this->getOption('scope')) : $this->getOption('scope');
205
-			$url .= '&scope=' . urlencode($scope);
205
+			$url .= '&scope='.urlencode($scope);
206 206
 		}
207 207
 
208 208
 		if ($this->getOption('sendheaders'))
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
 		{
344 344
 			if (!strcmp($header, 'OAuth '))
345 345
 			{
346
-				$header .= $key . '="' . $this->safeEncode($value) . '"';
346
+				$header .= $key.'="'.$this->safeEncode($value).'"';
347 347
 			}
348 348
 			else
349 349
 			{
350
-				$header .= ', ' . $key . '="' . $value . '"';
350
+				$header .= ', '.$key.'="'.$value.'"';
351 351
 			}
352 352
 		}
353 353
 
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
 				{
375 375
 					if (strpos($url, '?') === false)
376 376
 					{
377
-						$url .= '?' . $key . '=' . $v;
377
+						$url .= '?'.$key.'='.$v;
378 378
 					}
379 379
 					else
380 380
 					{
381
-						$url .= '&' . $key . '=' . $v;
381
+						$url .= '&'.$key.'='.$v;
382 382
 					}
383 383
 				}
384 384
 			}
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 
392 392
 				if (strpos($url, '?') === false)
393 393
 				{
394
-					$url .= '?' . $key . '=' . $value;
394
+					$url .= '?'.$key.'='.$value;
395 395
 				}
396 396
 				else
397 397
 				{
398
-					$url .= '&' . $key . '=' . $value;
398
+					$url .= '&'.$key.'='.$value;
399 399
 				}
400 400
 			}
401 401
 		}
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		$rand = random_bytes(16);
521 521
 
522 522
 		// The md5s look nicer than numbers.
523
-		return md5($mt . $rand);
523
+		return md5($mt.$rand);
524 524
 	}
525 525
 
526 526
 	/**
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	 */
533 533
 	private function prepareSigningKey()
534 534
 	{
535
-		return $this->safeEncode($this->getOption('consumer_secret')) . '&' . $this->safeEncode(($this->token) ? $this->token['secret'] : '');
535
+		return $this->safeEncode($this->getOption('consumer_secret')).'&'.$this->safeEncode(($this->token) ? $this->token['secret'] : '');
536 536
 	}
537 537
 
538 538
 	/**
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -93,8 +93,7 @@  discard block
 block discarded – undo
93 93
 			if ($response)
94 94
 			{
95 95
 				return $this->token;
96
-			}
97
-			else
96
+			} else
98 97
 			{
99 98
 				$this->token = null;
100 99
 			}
@@ -104,8 +103,7 @@  discard block
 block discarded – undo
104 103
 		if (strcmp($this->version, '1.0a') === 0)
105 104
 		{
106 105
 			$verifier = $this->input->get('oauth_verifier');
107
-		}
108
-		else
106
+		} else
109 107
 		{
110 108
 			$verifier = $this->input->get('oauth_token');
111 109
 		}
@@ -163,8 +161,7 @@  discard block
 block discarded – undo
163 161
 			$parameters = array(
164 162
 				'oauth_callback' => $this->getOption('callback')
165 163
 			);
166
-		}
167
-		else
164
+		} else
168 165
 		{
169 166
 			$parameters = array();
170 167
 		}
@@ -270,8 +267,7 @@  discard block
 block discarded – undo
270 267
 		if (isset($headers['Content-Type']) && strpos($headers['Content-Type'], 'multipart/form-data') !== false || !is_array($data))
271 268
 		{
272 269
 			$oauthHeaders = $parameters;
273
-		}
274
-		else
270
+		} else
275 271
 		{
276 272
 			// Use all parameters for the signature.
277 273
 			$oauthHeaders = array_merge($parameters, $data);
@@ -344,8 +340,7 @@  discard block
 block discarded – undo
344 340
 			if (!strcmp($header, 'OAuth '))
345 341
 			{
346 342
 				$header .= $key . '="' . $this->safeEncode($value) . '"';
347
-			}
348
-			else
343
+			} else
349 344
 			{
350 345
 				$header .= ', ' . $key . '="' . $value . '"';
351 346
 			}
@@ -375,14 +370,12 @@  discard block
 block discarded – undo
375 370
 					if (strpos($url, '?') === false)
376 371
 					{
377 372
 						$url .= '?' . $key . '=' . $v;
378
-					}
379
-					else
373
+					} else
380 374
 					{
381 375
 						$url .= '&' . $key . '=' . $v;
382 376
 					}
383 377
 				}
384
-			}
385
-			else
378
+			} else
386 379
 			{
387 380
 				if (strpos($value, ' ') !== false)
388 381
 				{
@@ -392,8 +385,7 @@  discard block
 block discarded – undo
392 385
 				if (strpos($url, '?') === false)
393 386
 				{
394 387
 					$url .= '?' . $key . '=' . $value;
395
-				}
396
-				else
388
+				} else
397 389
 				{
398 390
 					$url .= '&' . $key . '=' . $value;
399 391
 				}
@@ -456,8 +448,7 @@  discard block
 block discarded – undo
456 448
 					$v = $this->safeEncode($v);
457 449
 					$kv[] = "{$key}={$v}";
458 450
 				}
459
-			}
460
-			else
451
+			} else
461 452
 			{
462 453
 				$value = $this->safeEncode($value);
463 454
 				$kv[] = "{$key}={$value}";
Please login to merge, or discard this patch.
Tests/stubs/ClientInspector.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	/**
19 19
 	 * Mimic verifing credentials.
20 20
 	 *
21
-	 * @return void
21
+	 * @return boolean
22 22
 	 *
23 23
 	 * @since 1.0
24 24
 	 */
Please login to merge, or discard this patch.
Tests/ClientTest.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 	}
100 100
 
101 101
 	/**
102
-	* Provides test data.
103
-	*
104
-	* @return array
105
-	*
106
-	* @since 1.0
107
-	*/
102
+	 * Provides test data.
103
+	 *
104
+	 * @return array
105
+	 *
106
+	 * @since 1.0
107
+	 */
108 108
 	public function seedAuthenticate()
109 109
 	{
110 110
 		// Token, fail and oauth version.
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 	}
259 259
 
260 260
 	/**
261
-	* Provides test data.
262
-	*
263
-	* @return array
264
-	*
265
-	* @since  1.0
266
-	*/
261
+	 * Provides test data.
262
+	 *
263
+	 * @return array
264
+	 *
265
+	 * @since  1.0
266
+	 */
267 267
 	public function seedOauthRequest()
268 268
 	{
269 269
 		// Method
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 use Joomla\Test\TestHelper;
14 14
 use PHPUnit\Framework\TestCase;
15 15
 
16
-require_once __DIR__ . '/stubs/ClientInspector.php';
16
+require_once __DIR__.'/stubs/ClientInspector.php';
17 17
 
18 18
 /**
19 19
  * Test class for OAuth1 Client.
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -134,8 +134,7 @@  discard block
 block discarded – undo
134 134
 			$this->object->setToken($token);
135 135
 			$result = $this->object->authenticate();
136 136
 			$this->assertEquals($result, $token);
137
-		}
138
-		else
137
+		} else
139 138
 		{
140 139
 			$this->object->setOption('requestTokenURL', 'https://example.com/request_token');
141 140
 			$this->object->setOption('authoriseURL', 'https://example.com/authorize');
@@ -173,8 +172,7 @@  discard block
 block discarded – undo
173 172
 			{
174 173
 				TestHelper::setValue($this->object, 'version', $version);
175 174
 				$data = array('oauth_verifier' => 'verifier', 'oauth_token' => 'token');
176
-			}
177
-			else
175
+			} else
178 176
 			{
179 177
 				TestHelper::setValue($this->object, 'version', $version);
180 178
 				$data = array('oauth_token' => 'token');
@@ -203,8 +201,7 @@  discard block
 block discarded – undo
203 201
 				if (method_exists($this, 'expectException'))
204 202
 				{
205 203
 					$this->expectException('DomainException');
206
-				}
207
-				else
204
+				} else
208 205
 				{
209 206
 					$this->setExpectedException('DomainException');
210 207
 				}
@@ -309,8 +306,7 @@  discard block
 block discarded – undo
309 306
 				$this->object->oauthRequest('www.example.com', $method, array('oauth_token' => '1235'), $data, array('Content-Type' => 'multipart/form-data')),
310 307
 				$this->equalTo($returnData)
311 308
 				);
312
-		}
313
-		else
309
+		} else
314 310
 		{
315 311
 			$this->client->expects($this->at(0))
316 312
 				->method($method)
Please login to merge, or discard this patch.