Passed
Push — master ( 9ceb2f...b72385 )
by smiley
01:36
created
src/Storage/OAuthStorageInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 use chillerlan\OAuth\Core\AccessToken;
16 16
 
17
-interface OAuthStorageInterface{
17
+interface OAuthStorageInterface {
18 18
 
19 19
 	/**
20 20
 	 * @param string                             $service
Please login to merge, or discard this patch.
src/Core/OAuth2TokenRefreshTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  * @property \Psr\Http\Message\RequestFactoryInterface       $requestFactory
25 25
  * @property \Psr\Http\Message\StreamFactoryInterface        $streamFactory
26 26
  */
27
-trait OAuth2TokenRefreshTrait{
27
+trait OAuth2TokenRefreshTrait {
28 28
 
29 29
 	/**
30 30
 	 * @param \chillerlan\OAuth\Core\AccessToken $token
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function refreshAccessToken(AccessToken $token = null):AccessToken{
36 36
 
37
-		if($token === null){
37
+		if ($token === null) {
38 38
 			$token = $this->storage->getAccessToken($this->serviceName);
39 39
 		}
40 40
 
41 41
 		$refreshToken = $token->refreshToken;
42 42
 
43
-		if(empty($refreshToken)){
43
+		if (empty($refreshToken)) {
44 44
 
45
-			if(!$this instanceof AccessTokenForRefresh){
45
+			if (!$this instanceof AccessTokenForRefresh) {
46 46
 				throw new ProviderException(sprintf('no refresh token available, token expired [%s]', date('Y-m-d h:i:s A', $token->expires)));
47 47
 			}
48 48
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 			->withBody($this->streamFactory->createStream(http_build_query($body, '', '&', PHP_QUERY_RFC1738)))
64 64
 		;
65 65
 
66
-		foreach($this->authHeaders as $header => $value){
66
+		foreach ($this->authHeaders as $header => $value) {
67 67
 			$request = $request->withAddedHeader($header, $value);
68 68
 		}
69 69
 
70 70
 		$newToken = $this->parseTokenResponse($this->http->sendRequest($request));
71 71
 
72
-		if(empty($newToken->refreshToken)){
72
+		if (empty($newToken->refreshToken)) {
73 73
 			$newToken->refreshToken = $refreshToken;
74 74
 		}
75 75
 
Please login to merge, or discard this patch.
src/Core/OAuth2ClientCredentialsTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  * @property \Psr\Http\Message\RequestFactoryInterface       $requestFactory
25 25
  * @property \Psr\Http\Message\StreamFactoryInterface        $streamFactory
26 26
  */
27
-trait OAuth2ClientCredentialsTrait{
27
+trait OAuth2ClientCredentialsTrait {
28 28
 
29 29
 	/**
30 30
 	 * @param array $scopes
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	public function getClientCredentialsToken(array $scopes = null):AccessToken{
35 35
 		$params = ['grant_type' => 'client_credentials'];
36 36
 
37
-		if($scopes !== null){
37
+		if ($scopes !== null) {
38 38
 			$params['scope'] = implode($this->scopesDelimiter, $scopes);
39 39
 		}
40 40
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 			->withBody($this->streamFactory->createStream(http_build_query($params, '', '&', PHP_QUERY_RFC1738)))
46 46
 		;
47 47
 
48
-		foreach($this->authHeaders as $header => $value){
48
+		foreach ($this->authHeaders as $header => $value) {
49 49
 			$request = $request->withAddedHeader($header, $value);
50 50
 		}
51 51
 
Please login to merge, or discard this patch.
src/OAuthOptionsTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 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
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
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 use chillerlan\OAuth\Core\OAuth1Provider;
16 16
 
17
-class OAuth1Testprovider extends OAuth1Provider{
17
+class OAuth1Testprovider extends OAuth1Provider {
18 18
 
19 19
 	protected $apiURL          = 'https://api.example.com';
20 20
 	protected $requestTokenURL = 'https://example.com/oauth/request_token';
Please login to merge, or discard this patch.
examples/TestEndpoints.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 use chillerlan\HTTP\MagicAPI\EndpointMap;
16 16
 
17
-class TestEndpoints extends EndpointMap{
17
+class TestEndpoints extends EndpointMap {
18 18
 
19 19
 	protected $test = [
20 20
 		'path'          => '/test/%1$s',
Please login to merge, or discard this patch.
examples/OAuth2Testprovider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	protected $authURL        = 'https://example.com/oauth2/authorize';
25 25
 	protected $accessTokenURL = 'https://example.com/oauth2/token';
26 26
 	protected $userRevokeURL  = 'https://account.example.com/apps/';
27
-	protected $endpointMap     = TestEndpoints::class;
27
+	protected $endpointMap = TestEndpoints::class;
28 28
 	protected $authHeaders    = ['foo' => 'bar'];
29 29
 	protected $apiHeaders     = ['foo' => 'bar'];
30 30
 
Please login to merge, or discard this patch.
src/Core/OAuth1Provider.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,11 +78,9 @@
 block discarded – undo
78 78
 
79 79
 		if(!$data || !is_array($data)){
80 80
 			throw new ProviderException('unable to parse token response');
81
-		}
82
-		elseif(isset($data['error'])){
81
+		} elseif(isset($data['error'])){
83 82
 			throw new ProviderException('error retrieving access token: '.$data['error']);
84
-		}
85
-		elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){
83
+		} elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){
86 84
 			throw new ProviderException('invalid token');
87 85
 		}
88 86
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use DateTime;
19 19
 use Psr\Http\Message\{RequestInterface, ResponseInterface, UriInterface};
20 20
 
21
-abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface{
21
+abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface {
22 22
 
23 23
 	/**
24 24
 	 * @var string
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			->withHeader('Accept-Encoding', 'identity')
63 63
 		;
64 64
 
65
-		foreach($this->authHeaders as $header => $value){
65
+		foreach ($this->authHeaders as $header => $value) {
66 66
 			$request = $request->withAddedHeader($header, $value);
67 67
 		}
68 68
 
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 	protected function parseTokenResponse(ResponseInterface $response, bool $checkCallbackConfirmed = null):AccessToken{
80 80
 		parse_str(Psr7\decompress_content($response), $data);
81 81
 
82
-		if(!$data || !is_array($data)){
82
+		if (!$data || !is_array($data)) {
83 83
 			throw new ProviderException('unable to parse token response');
84 84
 		}
85
-		elseif(isset($data['error'])){
85
+		elseif (isset($data['error'])) {
86 86
 			throw new ProviderException('error retrieving access token: '.$data['error']);
87 87
 		}
88
-		elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){
88
+		elseif (!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])) {
89 89
 			throw new ProviderException('invalid token');
90 90
 		}
91 91
 
92
-		if($checkCallbackConfirmed && (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true')){
92
+		if ($checkCallbackConfirmed && (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true')) {
93 93
 			throw new ProviderException('oauth callback unconfirmed');
94 94
 		}
95 95
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	protected function getSignature(string $url, array $params, string $method, string $accessTokenSecret = null):string{
136 136
 		$parseURL = parse_url($url);
137 137
 
138
-		if(!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)){
138
+		if (!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)) {
139 139
 			throw new ProviderException('getSignature: invalid url');
140 140
 		}
141 141
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 		$signatureParams = array_merge($query, $params);
145 145
 
146
-		if(isset($signatureParams['oauth_signature'])){
146
+		if (isset($signatureParams['oauth_signature'])) {
147 147
 			unset($signatureParams['oauth_signature']);
148 148
 		}
149 149
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			$token->accessTokenSecret
202 202
 		);
203 203
 
204
-		if(isset($query['oauth_session_handle'])){
204
+		if (isset($query['oauth_session_handle'])) {
205 205
 			$parameters['oauth_session_handle'] = $query['oauth_session_handle']; // @codeCoverageIgnore
206 206
 		}
207 207
 
Please login to merge, or discard this patch.
src/Core/OAuth2Interface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 use Psr\Http\Message\UriInterface;
16 16
 
17
-interface OAuth2Interface extends OAuthInterface{
17
+interface OAuth2Interface extends OAuthInterface {
18 18
 
19 19
 	const HEADER_OAUTH              = 0;
20 20
 	const HEADER_BEARER             = 1;
Please login to merge, or discard this patch.