Completed
Push — master ( 83c2ec...cbd12d )
by smiley
02:03
created
src/OAuthOptionsTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\OAuth;
14 14
 
15
-trait OAuthOptionsTrait{
15
+trait OAuthOptionsTrait {
16 16
 
17 17
 	/**
18 18
 	 * @var string
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	/**
77 77
 	 * @var string
78 78
 	 */
79
-	protected $dbLabelFormat   = '%1$s@%2$s'; // user@service
79
+	protected $dbLabelFormat = '%1$s@%2$s'; // user@service
80 80
 
81 81
 	/**
82 82
 	 * @var int|string
Please login to merge, or discard this patch.
src/OAuthException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,4 +12,4 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\OAuth;
14 14
 
15
-class OAuthException extends \Exception{}
15
+class OAuthException extends \Exception {}
Please login to merge, or discard this patch.
src/OAuthOptions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  * @property string     $ca_info
56 56
  * @property int        $max_redirects
57 57
  */
58
-class OAuthOptions implements ContainerInterface{
58
+class OAuthOptions implements ContainerInterface {
59 59
 	use OAuthOptionsTrait, HTTPOptionsTrait, MemzeroDestructorTrait, Container{
60 60
 		__construct as protected containerConstruct;
61 61
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param array|null $properties
67 67
 	 */
68
-	public function __construct(array $properties = null){
68
+	public function __construct(array $properties = null) {
69 69
 		// enable encryption by default if possible...
70 70
 		$this->useEncryption = extension_loaded('sodium');
71 71
 
Please login to merge, or discard this patch.
examples/OAuth1Testprovider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 /**
18 18
  *
19 19
  */
20
-class OAuth1Testprovider extends OAuth1Provider{
20
+class OAuth1Testprovider extends OAuth1Provider {
21 21
 
22 22
 	protected $apiURL          = 'https://api.example.com';
23 23
 	protected $requestTokenURL = 'https://example.com/oauth/request_token';
Please login to merge, or discard this patch.
src/Core/OAuthInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
  * @property string $serviceName
20 20
  * @property string $userRevokeURL
21 21
  */
22
-interface OAuthInterface{
22
+interface OAuthInterface {
23 23
 
24 24
 	/**
25 25
 	 * @param array $params
Please login to merge, or discard this patch.
src/Core/TokenExpires.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\OAuth\Core;
14 14
 
15
-interface TokenExpires{
15
+interface TokenExpires {
16 16
 
17 17
 }
Please login to merge, or discard this patch.
src/Core/ProviderException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,4 +14,4 @@
 block discarded – undo
14 14
 
15 15
 use chillerlan\OAuth\OAuthException;
16 16
 
17
-class ProviderException extends OAuthException{}
17
+class ProviderException extends OAuthException {}
Please login to merge, or discard this patch.
src/Core/CSRFToken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\OAuth\Core;
14 14
 
15
-interface CSRFToken{
15
+interface CSRFToken {
16 16
 
17 17
 }
Please login to merge, or discard this patch.
src/Core/OAuth1Provider.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use chillerlan\HTTP\HTTPResponseInterface;
16 16
 use DateTime;
17 17
 
18
-abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface{
18
+abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface {
19 19
 
20 20
 	/**
21 21
 	 * @var string
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @return \chillerlan\OAuth\Core\AccessToken
47 47
 	 */
48 48
 	public function getRequestToken():AccessToken {
49
-		$params   = $this->getRequestTokenHeaderParams();
49
+		$params = $this->getRequestTokenHeaderParams();
50 50
 
51 51
 		return $this->parseTokenResponse(
52 52
 			$this->httpPOST(
@@ -71,19 +71,19 @@  discard block
 block discarded – undo
71 71
 	protected function parseTokenResponse(HTTPResponseInterface $response, bool $checkCallbackConfirmed = null):AccessToken {
72 72
 		parse_str($response->body, $data);
73 73
 
74
-		if(!$data || !is_array($data)){
74
+		if (!$data || !is_array($data)) {
75 75
 			throw new ProviderException('unable to parse token response');
76 76
 		}
77
-		elseif(isset($data['error'])){
77
+		elseif (isset($data['error'])) {
78 78
 			throw new ProviderException('error retrieving access token: '.$data['error']);
79 79
 		}
80
-		elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){
80
+		elseif (!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])) {
81 81
 			throw new ProviderException('token missing');
82 82
 		}
83 83
 
84
-		if(($checkCallbackConfirmed ?? false)
84
+		if (($checkCallbackConfirmed ?? false)
85 85
 		   && (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true')
86
-		){
86
+		) {
87 87
 			throw new ProviderException('oauth callback unconfirmed');
88 88
 		}
89 89
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	public function getSignature(string $url, array $params, string $method = null):string {
147 147
 		$parseURL = parse_url($url);
148 148
 
149
-		if(!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)){
149
+		if (!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)) {
150 150
 			throw new ProviderException('getSignature: invalid url');
151 151
 		}
152 152
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return string
172 172
 	 */
173
-	protected function getSignatureData(string $signatureURL, array $signatureParams, string $method){
173
+	protected function getSignatureData(string $signatureURL, array $signatureParams, string $method) {
174 174
 
175
-		if(isset($signatureParams['oauth_signature'])){
175
+		if (isset($signatureParams['oauth_signature'])) {
176 176
 			unset($signatureParams['oauth_signature']);
177 177
 		}
178 178
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	public function getAccessToken(string $token, string $verifier, string $tokenSecret = null):AccessToken {
196 196
 		$this->tokenSecret = $tokenSecret;
197 197
 
198
-		if(empty($this->tokenSecret)){
198
+		if (empty($this->tokenSecret)) {
199 199
 			$this->tokenSecret = $this->storage->getAccessToken($this->serviceName)->requestTokenSecret;
200 200
 		}
201 201
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 		$parameters['oauth_signature'] = $this->getSignature($url, array_merge($params ?? [], $parameters), $method);
233 233
 
234
-		if(isset($params['oauth_session_handle'])){
234
+		if (isset($params['oauth_session_handle'])) {
235 235
 			$parameters['oauth_session_handle'] = $params['oauth_session_handle'];
236 236
 			unset($params['oauth_session_handle']);
237 237
 		}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,11 +74,9 @@
 block discarded – undo
74 74
 
75 75
 		if(!$data || !is_array($data)){
76 76
 			throw new ProviderException('unable to parse token response');
77
-		}
78
-		elseif(isset($data['error'])){
77
+		} elseif(isset($data['error'])){
79 78
 			throw new ProviderException('error retrieving access token: '.$data['error']);
80
-		}
81
-		elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){
79
+		} elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){
82 80
 			throw new ProviderException('token missing');
83 81
 		}
84 82
 
Please login to merge, or discard this patch.