Completed
Push — master ( bf1af1...6436fd )
by Michael
04:16
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.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -94,8 +94,7 @@  discard block
 block discarded – undo
94 94
 			if ($response)
95 95
 			{
96 96
 				return $this->token;
97
-			}
98
-			else
97
+			} else
99 98
 			{
100 99
 				$this->token = null;
101 100
 			}
@@ -105,8 +104,7 @@  discard block
 block discarded – undo
105 104
 		if (strcmp($this->version, '1.0a') === 0)
106 105
 		{
107 106
 			$verifier = $this->input->get('oauth_verifier');
108
-		}
109
-		else
107
+		} else
110 108
 		{
111 109
 			$verifier = $this->input->get('oauth_token');
112 110
 		}
@@ -164,8 +162,7 @@  discard block
 block discarded – undo
164 162
 			$parameters = array(
165 163
 				'oauth_callback' => $this->getOption('callback')
166 164
 			);
167
-		}
168
-		else
165
+		} else
169 166
 		{
170 167
 			$parameters = array();
171 168
 		}
@@ -271,8 +268,7 @@  discard block
 block discarded – undo
271 268
 		if (isset($headers['Content-Type']) && strpos($headers['Content-Type'], 'multipart/form-data') !== false || !is_array($data))
272 269
 		{
273 270
 			$oauth_headers = $parameters;
274
-		}
275
-		else
271
+		} else
276 272
 		{
277 273
 			// Use all parameters for the signature.
278 274
 			$oauth_headers = array_merge($parameters, $data);
@@ -345,8 +341,7 @@  discard block
 block discarded – undo
345 341
 			if (!strcmp($header, 'OAuth '))
346 342
 			{
347 343
 				$header .= $key . '="' . $this->safeEncode($value) . '"';
348
-			}
349
-			else
344
+			} else
350 345
 			{
351 346
 				$header .= ', ' . $key . '="' . $value . '"';
352 347
 			}
@@ -376,14 +371,12 @@  discard block
 block discarded – undo
376 371
 					if (strpos($url, '?') === false)
377 372
 					{
378 373
 						$url .= '?' . $key . '=' . $v;
379
-					}
380
-					else
374
+					} else
381 375
 					{
382 376
 						$url .= '&' . $key . '=' . $v;
383 377
 					}
384 378
 				}
385
-			}
386
-			else
379
+			} else
387 380
 			{
388 381
 				if (strpos($value, ' ') !== false)
389 382
 				{
@@ -393,8 +386,7 @@  discard block
 block discarded – undo
393 386
 				if (strpos($url, '?') === false)
394 387
 				{
395 388
 					$url .= '?' . $key . '=' . $value;
396
-				}
397
-				else
389
+				} else
398 390
 				{
399 391
 					$url .= '&' . $key . '=' . $value;
400 392
 				}
@@ -457,8 +449,7 @@  discard block
 block discarded – undo
457 449
 					$v = $this->safeEncode($v);
458 450
 					$kv[] = "{$key}={$v}";
459 451
 				}
460
-			}
461
-			else
452
+			} else
462 453
 			{
463 454
 				$value = $this->safeEncode($value);
464 455
 				$kv[] = "{$key}={$value}";
@@ -494,16 +485,14 @@  discard block
 block discarded – undo
494 485
 		if (is_array($data))
495 486
 		{
496 487
 			return array_map(array($this, 'safeEncode'), $data);
497
-		}
498
-		elseif (is_scalar($data))
488
+		} elseif (is_scalar($data))
499 489
 		{
500 490
 			return str_ireplace(
501 491
 				array('+', '%7E'),
502 492
 				array(' ', '~'),
503 493
 				rawurlencode($data)
504 494
 				);
505
-		}
506
-		else
495
+		} else
507 496
 		{
508 497
 			return '';
509 498
 		}
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	private function _authorise()
200 200
 	{
201
-		$url = $this->getOption('authoriseURL') . '?oauth_token=' . $this->token['key'];
201
+		$url = $this->getOption('authoriseURL').'?oauth_token='.$this->token['key'];
202 202
 
203 203
 		if ($this->getOption('scope'))
204 204
 		{
205 205
 			$scope = is_array($this->getOption('scope')) ? implode(' ', $this->getOption('scope')) : $this->getOption('scope');
206
-			$url .= '&scope=' . urlencode($scope);
206
+			$url .= '&scope='.urlencode($scope);
207 207
 		}
208 208
 
209 209
 		if ($this->getOption('sendheaders'))
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 		{
345 345
 			if (!strcmp($header, 'OAuth '))
346 346
 			{
347
-				$header .= $key . '="' . $this->safeEncode($value) . '"';
347
+				$header .= $key.'="'.$this->safeEncode($value).'"';
348 348
 			}
349 349
 			else
350 350
 			{
351
-				$header .= ', ' . $key . '="' . $value . '"';
351
+				$header .= ', '.$key.'="'.$value.'"';
352 352
 			}
353 353
 		}
354 354
 
@@ -375,11 +375,11 @@  discard block
 block discarded – undo
375 375
 				{
376 376
 					if (strpos($url, '?') === false)
377 377
 					{
378
-						$url .= '?' . $key . '=' . $v;
378
+						$url .= '?'.$key.'='.$v;
379 379
 					}
380 380
 					else
381 381
 					{
382
-						$url .= '&' . $key . '=' . $v;
382
+						$url .= '&'.$key.'='.$v;
383 383
 					}
384 384
 				}
385 385
 			}
@@ -392,11 +392,11 @@  discard block
 block discarded – undo
392 392
 
393 393
 				if (strpos($url, '?') === false)
394 394
 				{
395
-					$url .= '?' . $key . '=' . $value;
395
+					$url .= '?'.$key.'='.$value;
396 396
 				}
397 397
 				else
398 398
 				{
399
-					$url .= '&' . $key . '=' . $value;
399
+					$url .= '&'.$key.'='.$value;
400 400
 				}
401 401
 			}
402 402
 		}
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 		$rand = mt_rand();
523 523
 
524 524
 		// The md5s look nicer than numbers.
525
-		return md5($mt . $rand);
525
+		return md5($mt.$rand);
526 526
 	}
527 527
 
528 528
 	/**
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 */
535 535
 	private function _prepareSigningKey()
536 536
 	{
537
-		return $this->safeEncode($this->getOption('consumer_secret')) . '&' . $this->safeEncode(($this->token) ? $this->token['secret'] : '');
537
+		return $this->safeEncode($this->getOption('consumer_secret')).'&'.$this->safeEncode(($this->token) ? $this->token['secret'] : '');
538 538
 	}
539 539
 
540 540
 	/**
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.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@  discard block
 block discarded – undo
136 136
 			$this->object->setToken($token);
137 137
 			$result = $this->object->authenticate();
138 138
 			$this->assertEquals($result, $token);
139
-		}
140
-		else
139
+		} else
141 140
 		{
142 141
 			$this->object->setOption('requestTokenURL', 'https://example.com/request_token');
143 142
 			$this->object->setOption('authoriseURL', 'https://example.com/authorize');
@@ -175,8 +174,7 @@  discard block
 block discarded – undo
175 174
 			{
176 175
 				TestHelper::setValue($this->object, 'version', $version);
177 176
 				$data = array('oauth_verifier' => 'verifier', 'oauth_token' => 'token');
178
-			}
179
-			else
177
+			} else
180 178
 			{
181 179
 				TestHelper::setValue($this->object, 'version', $version);
182 180
 				$data = array('oauth_token' => 'token');
@@ -302,8 +300,7 @@  discard block
 block discarded – undo
302 300
 				$this->object->oauthRequest('www.example.com', $method, array('oauth_token' => '1235'), $data, array('Content-Type' => 'multipart/form-data')),
303 301
 				$this->equalTo($returnData)
304 302
 				);
305
-		}
306
-		else
303
+		} else
307 304
 		{
308 305
 			$this->client->expects($this->at(0))
309 306
 				->method($method)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 use Joomla\Test\WebInspector;
13 13
 use Joomla\Test\TestHelper;
14 14
 
15
-require_once __DIR__ . '/stubs/ClientInspector.php';
15
+require_once __DIR__.'/stubs/ClientInspector.php';
16 16
 
17 17
 
18 18
 /**
Please login to merge, or discard this patch.