Passed
Push — main ( d473b6...58e8ad )
by smiley
11:00
created
src/MusicBrainz/MusicBrainz.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function refreshAccessToken(AccessToken $token = null):AccessToken{
94 94
 
95
-		if($token === null){
95
+		if ($token === null) {
96 96
 			$token = $this->storage->getAccessToken($this->serviceName);
97 97
 		}
98 98
 
99 99
 		$refreshToken = $token->refreshToken;
100 100
 
101
-		if(empty($refreshToken)){
101
+		if (empty($refreshToken)) {
102 102
 			throw new ProviderException(
103 103
 				sprintf('no refresh token available, token expired [%s]', date('Y-m-d h:i:s A', $token->expires))
104 104
 			);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 		$newToken = $this->parseTokenResponse($this->http->sendRequest($request));
122 122
 
123
-		if(empty($newToken->refreshToken)){
123
+		if (empty($newToken->refreshToken)) {
124 124
 			$newToken->refreshToken = $refreshToken;
125 125
 		}
126 126
 
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
 		$method = strtoupper($method ?? '');
144 144
 		$token  = $this->storage->getAccessToken($this->serviceName);
145 145
 
146
-		if($token->isExpired()){
146
+		if ($token->isExpired()) {
147 147
 			$this->refreshAccessToken($token);
148 148
 		}
149 149
 
150
-		if(!isset($params['fmt'])){
150
+		if (!isset($params['fmt'])) {
151 151
 			$params['fmt'] = 'json';
152 152
 		}
153 153
 
154
-		if(in_array($method, ['POST', 'PUT', 'DELETE']) && !isset($params['client'])){
154
+		if (in_array($method, ['POST', 'PUT', 'DELETE']) && !isset($params['client'])) {
155 155
 			$params['client'] = $this->options->user_agent; // @codeCoverageIgnore
156 156
 		}
157 157
 
Please login to merge, or discard this patch.
src/Deezer/Deezer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 /**
27 27
  * @method \Psr\Http\Message\ResponseInterface me()
28 28
  */
29
-class Deezer extends OAuth2Provider implements CSRFToken{
29
+class Deezer extends OAuth2Provider implements CSRFToken {
30 30
 
31 31
 	public const SCOPE_BASIC             = 'basic_access';
32 32
 	public const SCOPE_EMAIL             = 'email';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	public function getAuthURL(array $params = null, array $scopes = null):UriInterface{
60 60
 		$params = $params ?? [];
61 61
 
62
-		if(isset($params['client_secret'])){
62
+		if (isset($params['client_secret'])) {
63 63
 			unset($params['client_secret']);
64 64
 		}
65 65
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	protected function parseTokenResponse(ResponseInterface $response):AccessToken{
108 108
 		$data = $this->parseQuery(decompress_content($response));
109 109
 
110
-		if(isset($data['error_reason'])){
110
+		if (isset($data['error_reason'])) {
111 111
 			throw new ProviderException('error retrieving access token: "'.$data['error_reason'].'"');
112 112
 		}
113 113
 
114
-		if(!isset($data['access_token'])){
114
+		if (!isset($data['access_token'])) {
115 115
 			throw new ProviderException('token missing');
116 116
 		}
117 117
 
Please login to merge, or discard this patch.
src/Steam/SteamOpenID.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * @method \Psr\Http\Message\ResponseInterface steamWebAPIUtilGetSupportedAPIList()
49 49
  * @method \Psr\Http\Message\ResponseInterface storeServiceGetAppList(array $params = ['if_modified_since', 'have_description_language', 'include_games', 'include_dlc', 'include_software', 'include_videos', 'include_hardware', 'last_appid', 'max_results'])
50 50
  */
51
-class SteamOpenID extends OAuthProvider{
51
+class SteamOpenID extends OAuthProvider {
52 52
 
53 53
 	protected string $authURL         = 'https://steamcommunity.com/openid/login';
54 54
 	protected string $accessTokenURL  = 'https://steamcommunity.com/openid/login';
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			'openid.sig'  => $received['openid_sig'],
91 91
 		];
92 92
 
93
-		foreach(explode(',', $received['openid_signed']) as $item){
93
+		foreach (explode(',', $received['openid_signed']) as $item) {
94 94
 			$body['openid.'.$item] = $received['openid_'.$item];
95 95
 		}
96 96
 
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
 	protected function parseTokenResponse(ResponseInterface $response):AccessToken{
126 126
 		$data = explode("\x0a", (string)$response->getBody());
127 127
 
128
-		if(!isset($data[1]) || strpos($data[1], 'is_valid') !== 0){
128
+		if (!isset($data[1]) || strpos($data[1], 'is_valid') !== 0) {
129 129
 			throw new ProviderException('unable to parse token response');
130 130
 		}
131 131
 
132
-		if($data[1] !== 'is_valid:true'){
132
+		if ($data[1] !== 'is_valid:true') {
133 133
 			throw new ProviderException('invalid id');
134 134
 		}
135 135
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 		$params = ['key' => $this->options->secret];
152 152
 
153 153
 		// the steamid parameter does not necessarily specify the current user, so add it only when it's not already set
154
-		if(strpos(parse_url($uri, PHP_URL_QUERY), 'steamid=') === false){ // php8: str_contains
155
-			$params['steamid']= $token->accessToken;
154
+		if (strpos(parse_url($uri, PHP_URL_QUERY), 'steamid=') === false) { // php8: str_contains
155
+			$params['steamid'] = $token->accessToken;
156 156
 		}
157 157
 
158 158
 		return $request->withUri($this->uriFactory->createUri($this->mergeQuery($uri, $params)));
Please login to merge, or discard this patch.
src/GuildWars2/GuildWars2.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
  * @method \Psr\Http\Message\ResponseInterface wvwUpgrades(array $params = ['lang'])
238 238
  * @method \Psr\Http\Message\ResponseInterface wvwUpgradesId(string $id, array $params = ['lang'])
239 239
  */
240
-class GuildWars2 extends OAuth2Provider{
240
+class GuildWars2 extends OAuth2Provider {
241 241
 
242 242
 	public const SCOPE_ACCOUNT     = 'account';
243 243
 	public const SCOPE_INVENTORIES = 'inventories';
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	public function storeGW2Token(string $access_token):AccessToken{
269 269
 
270
-		if(!preg_match('/^[a-f\d\-]{72}$/i', $access_token)){
270
+		if (!preg_match('/^[a-f\d\-]{72}$/i', $access_token)) {
271 271
 			throw new ProviderException('invalid token');
272 272
 		}
273 273
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 		$tokeninfo = get_json($this->http->sendRequest($request));
279 279
 
280
-		if(isset($tokeninfo->id) && strpos($access_token, $tokeninfo->id) === 0){
280
+		if (isset($tokeninfo->id) && strpos($access_token, $tokeninfo->id) === 0) {
281 281
 
282 282
 			$token = new AccessToken([
283 283
 				'provider'     => $this->serviceName,
Please login to merge, or discard this patch.
src/NPR/NPROne.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	protected function getRequestTarget(string $uri):string{
63 63
 		$parsedURL = parseUrl($uri);
64 64
 
65
-		if(!isset($parsedURL['path'])){
65
+		if (!isset($parsedURL['path'])) {
66 66
 			throw new ProviderException('invalid path'); // @codeCoverageIgnore
67 67
 		}
68 68
 
69 69
 		// for some reason we were given a host name
70
-		if(isset($parsedURL['host'])){
70
+		if (isset($parsedURL['host'])) {
71 71
 
72 72
 			// back out if it doesn't match
73
-			if(strpos($parsedURL['host'], '.api.npr.org') === false){
73
+			if (strpos($parsedURL['host'], '.api.npr.org') === false) {
74 74
 				throw new ProviderException('given host does not match provider host'); // @codeCoverageIgnore
75 75
 			}
76 76
 
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	public function sendRequest(RequestInterface $request):ResponseInterface{
89 89
 
90 90
 		// get authorization only if we request the provider API
91
-		if(strpos((string)$request->getUri(), '.api.npr.org') !== false){
91
+		if (strpos((string)$request->getUri(), '.api.npr.org') !== false) {
92 92
 			$token = $this->storage->getAccessToken($this->serviceName);
93 93
 
94 94
 			// attempt to refresh an expired token
95
-			if(
95
+			if (
96 96
 				$this->options->tokenAutoRefresh
97 97
 				&& ($token->isExpired() || $token->expires === $token::EOL_UNKNOWN)
98
-			){
98
+			) {
99 99
 				$token = $this->refreshAccessToken($token); // @codeCoverageIgnore
100 100
 			}
101 101
 
Please login to merge, or discard this patch.
src/Mastodon/Mastodon.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
 	public function setInstance(string $instance):Mastodon{
121 121
 		$instance = parseUrl($instance);
122 122
 
123
-		if(!isset($instance['scheme']) || !isset($instance['host'])){
123
+		if (!isset($instance['scheme']) || !isset($instance['host'])) {
124 124
 			throw new OAuthException('invalid instance URL');
125 125
 		}
126 126
 
Please login to merge, or discard this patch.
src/LastFM/LastFM.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
  * @method \Psr\Http\Message\ResponseInterface userGetWeeklyChartList(array $params = ['user'])
76 76
  * @method \Psr\Http\Message\ResponseInterface userGetWeeklyTrackChart(array $params = ['from', 'to', 'user'])
77 77
  */
78
-class LastFM extends OAuthProvider{
78
+class LastFM extends OAuthProvider {
79 79
 
80 80
 	public const PERIOD_OVERALL = 'overall';
81 81
 	public const PERIOD_7DAY    = '7day';
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		self::PERIOD_12MONTH,
94 94
 	];
95 95
 
96
-	protected string $authURL        = 'https://www.last.fm/api/auth';
96
+	protected string $authURL = 'https://www.last.fm/api/auth';
97 97
 	protected ?string $apiURL         = 'https://ws.audioscrobbler.com/2.0';
98 98
 	protected ?string $userRevokeURL  = 'https://www.last.fm/settings/applications';
99 99
 	protected ?string $endpointMap    = LastFMEndpoints::class;
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 
123 123
 		$signature = '';
124 124
 
125
-		foreach($params as $k => $v){
126
-			if(!in_array($k, ['format', 'callback'])){
125
+		foreach ($params as $k => $v) {
126
+			if (!in_array($k, ['format', 'callback'])) {
127 127
 				$signature .= $k.$v;
128 128
 			}
129 129
 		}
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
 	protected function parseTokenResponse(ResponseInterface $response):AccessToken{
163 163
 		$data = get_json($response, true);
164 164
 
165
-		if(!$data || !is_array($data)){
165
+		if (!$data || !is_array($data)) {
166 166
 			throw new ProviderException('unable to parse token response');
167 167
 		}
168
-		elseif(isset($data['error'])){
168
+		elseif (isset($data['error'])) {
169 169
 			throw new ProviderException('error retrieving access token: '.$data['message']);
170 170
 		}
171
-		elseif(!isset($data['session']['key'])){
171
+		elseif (!isset($data['session']['key'])) {
172 172
 			throw new ProviderException('token missing');
173 173
 		}
174 174
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
 		$params['api_sig'] = $this->getSignature($params);
210 210
 
211
-		if($method === 'POST'){
211
+		if ($method === 'POST') {
212 212
 			$body   = $params;
213 213
 			$params = [];
214 214
 		}
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 		/** @phan-suppress-next-line PhanTypeMismatchArgumentNullable */
217 217
 		$request = $this->requestFactory->createRequest($method, $this->mergeQuery($this->apiURL, $params));
218 218
 
219
-		foreach(array_merge($this->apiHeaders, $headers ?? []) as $header => $value){
219
+		foreach (array_merge($this->apiHeaders, $headers ?? []) as $header => $value) {
220 220
 			$request = $request->withAddedHeader($header, $value);
221 221
 		}
222 222
 
223
-		if($method === 'POST'){
223
+		if ($method === 'POST') {
224 224
 			$request = $request->withHeader('Content-Type', 'application/x-www-form-urlencoded');
225 225
 			$body    = $this->streamFactory->createStream($this->buildQuery($body, PHP_QUERY_RFC1738));
226 226
 			$request = $request->withBody($body);
Please login to merge, or discard this patch.
src/Twitch/Twitch.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	protected array $authHeaders       = ['Accept' => 'application/vnd.twitchtv.v5+json'];
116 116
 	protected array $apiHeaders        = ['Accept' => 'application/vnd.twitchtv.v5+json'];
117 117
 
118
-	protected array $defaultScopes     =  [
118
+	protected array $defaultScopes     = [
119 119
 		self::SCOPE_USER_READ_EMAIL,
120 120
 	];
121 121
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			'grant_type'    => 'client_credentials',
134 134
 		];
135 135
 
136
-		if($scopes !== null){
136
+		if ($scopes !== null) {
137 137
 			$params['scope'] = implode($this->scopesDelimiter, $scopes);
138 138
 		}
139 139
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			->withBody($this->streamFactory->createStream($this->buildQuery($params, PHP_QUERY_RFC1738)))
144 144
 		;
145 145
 
146
-		foreach($this->authHeaders as $header => $value){
146
+		foreach ($this->authHeaders as $header => $value) {
147 147
 			$request = $request->withAddedHeader($header, $value);
148 148
 		}
149 149
 
Please login to merge, or discard this patch.
src/Foursquare/Foursquare.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * @method \Psr\Http\Message\ResponseInterface me()
24 24
  */
25
-class Foursquare extends OAuth2Provider{
25
+class Foursquare extends OAuth2Provider {
26 26
 
27 27
 	protected const API_VERSIONDATE = '20190225';
28 28
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		$queryparams = [];
51 51
 		$querystring = parseUrl($this->apiURL.$path)['query'] ?? '';
52 52
 
53
-		if(!empty($querystring)){
53
+		if (!empty($querystring)) {
54 54
 			$queryparams = $this->parseQuery($querystring);
55 55
 		}
56 56
 
Please login to merge, or discard this patch.