Passed
Push — master ( db837a...eb1c7a )
by smiley
01:31
created
src/Core/OAuth1Provider.php 2 patches
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.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,11 +81,9 @@
 block discarded – undo
81 81
 
82 82
 		if(!$data || !\is_array($data)){
83 83
 			throw new ProviderException('unable to parse token response');
84
-		}
85
-		elseif(isset($data['error'])){
84
+		} elseif(isset($data['error'])){
86 85
 			throw new ProviderException('error retrieving access token: '.$data['error']);
87
-		}
88
-		elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){
86
+		} elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){
89 87
 			throw new ProviderException('invalid token');
90 88
 		}
91 89
 
Please login to merge, or discard this patch.
src/Storage/SessionStorage.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use chillerlan\OAuth\Core\AccessToken;
16 16
 use chillerlan\Settings\SettingsContainerInterface;
17 17
 
18
-class SessionStorage extends OAuthStorageAbstract{
18
+class SessionStorage extends OAuthStorageAbstract {
19 19
 
20 20
 	/**
21 21
 	 * @var string
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param \chillerlan\Settings\SettingsContainerInterface|null $options
34 34
 	 */
35
-	public function __construct(SettingsContainerInterface $options = null){
35
+	public function __construct(SettingsContainerInterface $options = null) {
36 36
 		parent::__construct($options);
37 37
 
38 38
 		$this->sessionVar = $this->options->sessionTokenVar;
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 
41 41
 		// Determine if the session has started.
42 42
 		// @link http://stackoverflow.com/a/18542272/1470961
43
-		if($this->options->sessionStart && !(\session_status() !== \PHP_SESSION_NONE)){
43
+		if ($this->options->sessionStart && !(\session_status() !== \PHP_SESSION_NONE)) {
44 44
 			\session_start();
45 45
 		}
46 46
 
47
-		if(!isset($_SESSION[$this->sessionVar])){
47
+		if (!isset($_SESSION[$this->sessionVar])) {
48 48
 			$_SESSION[$this->sessionVar] = [];
49 49
 		}
50 50
 
51
-		if(!isset($_SESSION[$this->stateVar])){
51
+		if (!isset($_SESSION[$this->stateVar])) {
52 52
 			$_SESSION[$this->stateVar] = [];
53 53
 		}
54 54
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @codeCoverageIgnore
61 61
 	 */
62
-	public function __destruct(){
63
-		if($this->options->sessionStart){
62
+	public function __destruct() {
63
+		if ($this->options->sessionStart) {
64 64
 			\session_write_close();
65 65
 		}
66 66
 	}
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	public function storeAccessToken(string $service, AccessToken $token):OAuthStorageInterface{
75 75
 		$data = $this->toStorage($token);
76 76
 
77
-		if(isset($_SESSION[$this->sessionVar]) && \is_array($_SESSION[$this->sessionVar])){
77
+		if (isset($_SESSION[$this->sessionVar]) && \is_array($_SESSION[$this->sessionVar])) {
78 78
 			$_SESSION[$this->sessionVar][$service] = $data;
79 79
 		}
80
-		else{
80
+		else {
81 81
 			$_SESSION[$this->sessionVar] = [$service => $data];
82 82
 		}
83 83
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function getAccessToken(string $service):AccessToken{
94 94
 
95
-		if($this->hasAccessToken($service)){
95
+		if ($this->hasAccessToken($service)) {
96 96
 			return $this->fromStorage($_SESSION[$this->sessionVar][$service]);
97 97
 		}
98 98
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function clearAccessToken(string $service):OAuthStorageInterface{
117 117
 
118
-		if(\array_key_exists($service, $_SESSION[$this->sessionVar])){
118
+		if (\array_key_exists($service, $_SESSION[$this->sessionVar])) {
119 119
 			unset($_SESSION[$this->sessionVar][$service]);
120 120
 		}
121 121
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function clearAllAccessTokens():OAuthStorageInterface{
129 129
 
130
-		foreach(\array_keys($_SESSION[$this->sessionVar]) as $service){
130
+		foreach (\array_keys($_SESSION[$this->sessionVar]) as $service) {
131 131
 			unset($_SESSION[$this->sessionVar][$service]);
132 132
 		}
133 133
 
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function storeCSRFState(string $service, string $state):OAuthStorageInterface{
146 146
 
147
-		if(isset($_SESSION[$this->stateVar]) && \is_array($_SESSION[$this->stateVar])){
147
+		if (isset($_SESSION[$this->stateVar]) && \is_array($_SESSION[$this->stateVar])) {
148 148
 			$_SESSION[$this->stateVar][$service] = $state;
149 149
 		}
150
-		else{
150
+		else {
151 151
 			$_SESSION[$this->stateVar] = [$service => $state];
152 152
 		}
153 153
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function getCSRFState(string $service):string{
164 164
 
165
-		if($this->hasCSRFState($service)){
165
+		if ($this->hasCSRFState($service)) {
166 166
 			return $_SESSION[$this->stateVar][$service];
167 167
 		}
168 168
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function clearCSRFState(string $service):OAuthStorageInterface{
187 187
 
188
-		if(\array_key_exists($service, $_SESSION[$this->stateVar])){
188
+		if (\array_key_exists($service, $_SESSION[$this->stateVar])) {
189 189
 			unset($_SESSION[$this->stateVar][$service]);
190 190
 		}
191 191
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 		if(isset($_SESSION[$this->sessionVar]) && \is_array($_SESSION[$this->sessionVar])){
78 78
 			$_SESSION[$this->sessionVar][$service] = $data;
79
-		}
80
-		else{
79
+		} else{
81 80
 			$_SESSION[$this->sessionVar] = [$service => $data];
82 81
 		}
83 82
 
@@ -146,8 +145,7 @@  discard block
 block discarded – undo
146 145
 
147 146
 		if(isset($_SESSION[$this->stateVar]) && \is_array($_SESSION[$this->stateVar])){
148 147
 			$_SESSION[$this->stateVar][$service] = $state;
149
-		}
150
-		else{
148
+		} else{
151 149
 			$_SESSION[$this->stateVar] = [$service => $state];
152 150
 		}
153 151
 
Please login to merge, or discard this patch.
src/Storage/MemoryStorage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 use chillerlan\OAuth\Core\AccessToken;
16 16
 
17
-class MemoryStorage extends OAuthStorageAbstract{
17
+class MemoryStorage extends OAuthStorageAbstract {
18 18
 
19 19
 	/**
20 20
 	 * @var array
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function getAccessToken(string $service):AccessToken{
48 48
 
49
-		if($this->hasAccessToken($service)){
49
+		if ($this->hasAccessToken($service)) {
50 50
 			return $this->tokens[$service];
51 51
 		}
52 52
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function clearAccessToken(string $service):OAuthStorageInterface{
71 71
 
72
-		if(\array_key_exists($service, $this->tokens)){
72
+		if (\array_key_exists($service, $this->tokens)) {
73 73
 			unset($this->tokens[$service]);
74 74
 		}
75 75
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function clearAllAccessTokens():OAuthStorageInterface{
83 83
 
84
-		foreach(\array_keys($this->tokens) as $service){
84
+		foreach (\array_keys($this->tokens) as $service) {
85 85
 			unset($this->tokens[$service]);
86 86
 		}
87 87
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function getCSRFState(string $service):string{
112 112
 
113
-		if($this->hasCSRFState($service)){
113
+		if ($this->hasCSRFState($service)) {
114 114
 			return $this->states[$service];
115 115
 		}
116 116
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function clearCSRFState(string $service):OAuthStorageInterface{
135 135
 
136
-		if(\array_key_exists($service, $this->states)){
136
+		if (\array_key_exists($service, $this->states)) {
137 137
 			unset($this->states[$service]);
138 138
 		}
139 139
 
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
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
  * @property string                                         $serviceName
27 27
  * @property string                                         $userRevokeURL
28 28
  */
29
-interface OAuthInterface{
29
+interface OAuthInterface {
30 30
 
31 31
 	/**
32 32
 	 * @param array $params
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
@@ -18,6 +18,6 @@
 block discarded – undo
18 18
  * checkState(string $state = null):void
19 19
  * setState(array $params):array
20 20
  */
21
-interface CSRFToken{
21
+interface CSRFToken {
22 22
 
23 23
 }
Please login to merge, or discard this patch.