Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit f2c95e6

Browse files
committed
:octocat: dependency update
1 parent df9841b commit f2c95e6

File tree

18 files changed

+77
-68
lines changed

18 files changed

+77
-68
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chillerlan/php-oauth-providers",
3-
"description": "OAuth 1/2 Provider implementations for chillerlan/php-oauth-core. PHP 7.2+",
3+
"description": "OAuth 1/2 Provider implementations for chillerlan/php-oauth-core. PHP 7.4+",
44
"homepage": "https://github.com/chillerlan/php-oauth-providers",
55
"license": "MIT",
66
"type": "library",
@@ -9,7 +9,7 @@
99
"amazon", "bigcartel", "deezer", "deviantart", "discogs", "discord", "flickr", "foursquare",
1010
"github", "gitter", "google", "guildwars2", "instagram", "lastfm", "mailchimp", "mastodon",
1111
"mixcloud", "musicbrainz", "opencaching", "openstreetmap", "patreon", "slack", "soundcloud",
12-
"spotify", "stripe", "tumblr", "twitch", "twitter", "vimeo", "wordpress",
12+
"spotify", "steam", "stripe", "tumblr", "twitch", "twitter", "vimeo", "wordpress",
1313
"npr", "imgur", "gitlab", "bitbucket", "paypal", "microsoft", "battlenet"
1414
],
1515
"authors": [
@@ -30,7 +30,7 @@
3030
"ext-curl": "*",
3131
"ext-json":"*",
3232
"ext-simplexml":"*",
33-
"chillerlan/php-oauth-core": "dev-main#59f122e88c19e44c9d1d31599e73f06d3ef67c90",
33+
"chillerlan/php-oauth-core": "dev-main#1522c62b715fe1300d3774c00be155565d83ace8",
3434
"psr/http-client":"^1.0",
3535
"psr/http-message": "^1.0"
3636
},

phpunit.xml.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,10 @@
2525
</logging>
2626
<php>
2727
<const name="TEST_IS_CI" value="true"/>
28+
<const name="TEST_CLIENT_FACTORY" value="chillerlan\OAuthTest\ChillerlanHttpClientFactory"/>
29+
<const name="REQUEST_FACTORY" value="chillerlan\HTTP\Psr17\RequestFactory"/>
30+
<const name="RESPONSE_FACTORY" value="chillerlan\HTTP\Psr17\ResponseFactory"/>
31+
<const name="STREAM_FACTORY" value="chillerlan\HTTP\Psr17\StreamFactory"/>
32+
<const name="URI_FACTORY" value="chillerlan\HTTP\Psr17\UriFactory"/>
2833
</php>
2934
</phpunit>

src/Deezer/Deezer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
use chillerlan\OAuth\Core\{AccessToken, CSRFToken, OAuth2Provider, ProviderException};
1919
use Psr\Http\Message\{ResponseInterface, UriInterface};
2020

21-
use function array_merge, http_build_query, implode, parse_str;
22-
use function chillerlan\HTTP\Psr7\{decompress_content, merge_query};
21+
use function array_merge, implode;
22+
use function chillerlan\HTTP\Utils\decompress_content;
2323

2424
use const PHP_QUERY_RFC1738;
2525

@@ -72,7 +72,7 @@ public function getAuthURL(array $params = null, array $scopes = null):UriInterf
7272

7373
$params = $this->setState($params);
7474

75-
return $this->uriFactory->createUri(merge_query($this->authURL, $params));
75+
return $this->uriFactory->createUri($this->mergeQuery($this->authURL, $params));
7676
}
7777

7878
/**
@@ -92,7 +92,7 @@ public function getAccessToken(string $code, string $state = null):AccessToken{
9292
->createRequest('POST', $this->accessTokenURL)
9393
->withHeader('Content-Type', 'application/x-www-form-urlencoded')
9494
->withHeader('Accept-Encoding', 'identity')
95-
->withBody($this->streamFactory->createStream(http_build_query($body, '', '&', PHP_QUERY_RFC1738)));
95+
->withBody($this->streamFactory->createStream($this->buildQuery($body, PHP_QUERY_RFC1738)));
9696

9797
$token = $this->parseTokenResponse($this->http->sendRequest($request));
9898

@@ -105,7 +105,7 @@ public function getAccessToken(string $code, string $state = null):AccessToken{
105105
* @inheritDoc
106106
*/
107107
protected function parseTokenResponse(ResponseInterface $response):AccessToken{
108-
parse_str(decompress_content($response), $data);
108+
$data = $this->parseQuery(decompress_content($response));
109109

110110
if(isset($data['error_reason'])){
111111
throw new ProviderException('error retrieving access token: "'.$data['error_reason'].'"');

src/Flickr/Flickr.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Psr\Http\Message\ResponseInterface;
1818

1919
use function array_merge;
20-
use function chillerlan\HTTP\Psr7\merge_query;
2120

2221
/**
2322
* @method \Psr\Http\Message\ResponseInterface activityUserComments(array $params = ['per_page', 'page'])
@@ -277,7 +276,7 @@ public function request(
277276

278277
$request = $this->getRequestAuthorization(
279278
/** @phan-suppress-next-line PhanTypeMismatchArgumentNullable */
280-
$this->requestFactory->createRequest($method ?? 'POST', merge_query($this->apiURL, $params)),
279+
$this->requestFactory->createRequest($method ?? 'POST', $this->mergeQuery($this->apiURL, $params)),
281280
$this->storage->getAccessToken($this->serviceName)
282281
);
283282

src/Foursquare/Foursquare.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
use chillerlan\OAuth\Core\OAuth2Provider;
1717
use Psr\Http\Message\ResponseInterface;
1818

19-
use function array_merge, explode, parse_str, parse_url;
20-
21-
use const PHP_URL_QUERY;
19+
use function array_merge, explode;
20+
use function chillerlan\HTTP\Utils\parseUrl;
2221

2322
/**
2423
* @method \Psr\Http\Message\ResponseInterface me()
@@ -48,12 +47,17 @@ public function request(
4847
array $headers = null
4948
):ResponseInterface{
5049

51-
parse_str(parse_url($this->apiURL.$path, PHP_URL_QUERY), $query);
50+
$queryparams = [];
51+
$querystring = parseUrl($this->apiURL.$path)['query'] ?? '';
52+
53+
if(!empty($querystring)){
54+
$queryparams = $this->parseQuery($querystring);
55+
}
5256

53-
$query['v'] = $this::API_VERSIONDATE;
54-
$query['m'] = 'foursquare';
57+
$queryparams['v'] = $this::API_VERSIONDATE;
58+
$queryparams['m'] = 'foursquare';
5559

56-
return parent::request(explode('?', $path)[0], array_merge($params ?? [], $query), $method, $body, $headers);
60+
return parent::request(explode('?', $path)[0], array_merge($params ?? [], $queryparams), $method, $body, $headers);
5761
}
5862

5963
}

src/GuildWars2/GuildWars2.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
use chillerlan\OAuth\Core\{AccessToken, OAuth2Provider, ProviderException};
1919
use Psr\Http\Message\UriInterface;
2020

21-
use function implode, preg_match, substr;
22-
use function chillerlan\HTTP\Psr7\{get_json, merge_query};
21+
use function implode, preg_match, substr, strpos;
22+
use function chillerlan\HTTP\Utils\get_json;
2323

2424
/**
2525
* @method \Psr\Http\Message\ResponseInterface account(array $params = ['access_token'])
@@ -272,12 +272,12 @@ public function storeGW2Token(string $access_token):AccessToken{
272272
}
273273

274274
$request = $this->requestFactory
275-
->createRequest('GET', merge_query($this->apiURL.'/tokeninfo', ['access_token' => $access_token]))
275+
->createRequest('GET', $this->mergeQuery($this->apiURL.'/tokeninfo', ['access_token' => $access_token]))
276276
;
277277

278278
$tokeninfo = get_json($this->http->sendRequest($request));
279279

280-
if(isset($tokeninfo->id) && \strpos($access_token, $tokeninfo->id) === 0){
280+
if(isset($tokeninfo->id) && strpos($access_token, $tokeninfo->id) === 0){
281281

282282
$token = new AccessToken([
283283
'provider' => $this->serviceName,

src/LastFM/LastFM.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
use chillerlan\OAuth\Core\{AccessToken, OAuthProvider, ProviderException};
1616
use Psr\Http\Message\{RequestInterface, ResponseInterface, UriInterface};
1717

18-
use function array_merge, http_build_query, in_array, is_array,ksort, md5;
19-
use function chillerlan\HTTP\Psr7\{get_json, merge_query};
18+
use function array_merge, in_array, is_array, ksort, md5;
19+
use function chillerlan\HTTP\Utils\get_json;
2020

2121
use const PHP_QUERY_RFC1738;
2222

@@ -109,7 +109,7 @@ public function getAuthURL(array $params = null):UriInterface{
109109
'api_key' => $this->options->key,
110110
]);
111111

112-
return $this->uriFactory->createUri(merge_query($this->authURL, $params));
112+
return $this->uriFactory->createUri($this->mergeQuery($this->authURL, $params));
113113
}
114114

115115
/**
@@ -148,7 +148,7 @@ public function getAccessToken(string $session_token):AccessToken{
148148
$params['api_sig'] = $this->getSignature($params);
149149

150150
/** @phan-suppress-next-line PhanTypeMismatchArgumentNullable */
151-
$request = $this->requestFactory->createRequest('GET', merge_query($this->apiURL, $params));
151+
$request = $this->requestFactory->createRequest('GET', $this->mergeQuery($this->apiURL, $params));
152152

153153
return $this->parseTokenResponse($this->http->sendRequest($request));
154154
}
@@ -214,15 +214,15 @@ public function request(
214214
}
215215

216216
/** @phan-suppress-next-line PhanTypeMismatchArgumentNullable */
217-
$request = $this->requestFactory->createRequest($method, merge_query($this->apiURL, $params));
217+
$request = $this->requestFactory->createRequest($method, $this->mergeQuery($this->apiURL, $params));
218218

219219
foreach(array_merge($this->apiHeaders, $headers ?? []) as $header => $value){
220220
$request = $request->withAddedHeader($header, $value);
221221
}
222222

223223
if($method === 'POST'){
224224
$request = $request->withHeader('Content-Type', 'application/x-www-form-urlencoded');
225-
$body = $this->streamFactory->createStream(http_build_query($body, '', '&', PHP_QUERY_RFC1738));
225+
$body = $this->streamFactory->createStream($this->buildQuery($body, PHP_QUERY_RFC1738));
226226
$request = $request->withBody($body);
227227
}
228228

src/MailChimp/MailChimp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Psr\Http\Message\ResponseInterface;
1919

2020
use function array_merge, sprintf;
21-
use function chillerlan\HTTP\Psr7\get_json;
21+
use function chillerlan\HTTP\Utils\get_json;
2222

2323
/**
2424
* @method \Psr\Http\Message\ResponseInterface createAuthorizedApp(array $body = ['client_id', 'client_secret'])

src/Mastodon/Mastodon.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
use chillerlan\OAuth\Core\{AccessToken, CSRFToken, OAuth2Provider, TokenRefresh};
1717
use chillerlan\OAuth\OAuthException;
1818

19-
use function array_merge, http_build_query, parse_url;
19+
use function array_merge;
20+
use function chillerlan\HTTP\Utils\parseUrl;
2021
use const PHP_QUERY_RFC1738;
2122

2223
/**
@@ -117,7 +118,7 @@ class Mastodon extends OAuth2Provider implements CSRFToken, TokenRefresh{
117118
* set the internal URLs for the given Mastodon instance
118119
*/
119120
public function setInstance(string $instance):Mastodon{
120-
$instance = parse_url($instance);
121+
$instance = parseUrl($instance);
121122

122123
if(!isset($instance['scheme']) || !isset($instance['host'])){
123124
throw new OAuthException('invalid instance URL');
@@ -153,7 +154,7 @@ public function getAccessToken(string $code, string $state = null):AccessToken{
153154
->createRequest('POST', $this->accessTokenURL)
154155
->withHeader('Content-Type', 'application/x-www-form-urlencoded')
155156
->withHeader('Accept-Encoding', 'identity')
156-
->withBody($this->streamFactory->createStream(http_build_query($body, '', '&', PHP_QUERY_RFC1738)));
157+
->withBody($this->streamFactory->createStream($this->buildQuery($body, PHP_QUERY_RFC1738)));
157158

158159
$token = $this->parseTokenResponse($this->http->sendRequest($request));
159160
// store the instance the token belongs to

src/MusicBrainz/MusicBrainz.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use chillerlan\OAuth\Core\{AccessToken, CSRFToken, OAuth2Provider, ProviderException, TokenRefresh};
1717
use Psr\Http\Message\ResponseInterface;
1818

19-
use function date, explode, http_build_query, in_array, sprintf, strtoupper;
19+
use function date, explode, in_array, sprintf, strtoupper;
2020

2121
use const PHP_QUERY_RFC1738;
2222

@@ -115,7 +115,7 @@ public function refreshAccessToken(AccessToken $token = null):AccessToken{
115115
->createRequest('POST', $this->refreshTokenURL ?? $this->accessTokenURL) // refreshTokenURL is used in tests
116116
->withHeader('Content-Type', 'application/x-www-form-urlencoded')
117117
->withHeader('Accept-Encoding', 'identity')
118-
->withBody($this->streamFactory->createStream(http_build_query($body, '', '&', PHP_QUERY_RFC1738)))
118+
->withBody($this->streamFactory->createStream($this->buildQuery($body, PHP_QUERY_RFC1738)))
119119
;
120120

121121
$newToken = $this->parseTokenResponse($this->http->sendRequest($request));
@@ -144,7 +144,7 @@ public function request(
144144
$token = $this->storage->getAccessToken($this->serviceName);
145145

146146
if($token->isExpired()){
147-
$token = $this->refreshAccessToken($token);
147+
$this->refreshAccessToken($token);
148148
}
149149

150150
if(!isset($params['fmt'])){

0 commit comments

Comments
 (0)