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

Commit 141eb23

Browse files
committed
🚿
1 parent b91f2bd commit 141eb23

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"ext-json":"*",
3030
"ext-simplexml":"*",
3131
"ext-zlib": "*",
32-
"chillerlan/php-http-message-utils": "^1.0",
32+
"chillerlan/php-httpinterface": "dev-main#e1a872e63fc8ee066163f8259a19defff2eb0683",
3333
"chillerlan/php-settings-container": "^2.1",
3434
"psr/http-client":"^1.0",
3535
"psr/http-message": "^1.0",
@@ -38,7 +38,6 @@
3838
"require-dev": {
3939
"chillerlan/php-dotenv": "^2.1",
4040
"guzzlehttp/guzzle": "^7.3",
41-
"guzzlehttp/psr7": "^2.0.0-beta1",
4241
"phan/phan": "^4.0",
4342
"phpunit/phpunit": "^9.5"
4443
},

phpunit.xml.dist

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
</logging>
2626
<php>
2727
<const name="TEST_IS_CI" value="true"/>
28-
<const name="TEST_CLIENT_FACTORY" value="chillerlan\OAuthTest\GuzzleClientFactory"/>
29-
<const name="REQUEST_FACTORY" value="GuzzleHttp\Psr7\HttpFactory"/>
30-
<const name="RESPONSE_FACTORY" value="GuzzleHttp\Psr7\HttpFactory"/>
31-
<const name="STREAM_FACTORY" value="GuzzleHttp\Psr7\HttpFactory"/>
32-
<const name="URI_FACTORY" value="GuzzleHttp\Psr7\HttpFactory"/>
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"/>
3333
</php>
3434
</phpunit>

src/Core/OAuthProvider.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace chillerlan\OAuth\Core;
1414

15-
use GuzzleHttp\Psr7\HttpFactory;
15+
use chillerlan\HTTP\Psr17\{RequestFactory, StreamFactory, UriFactory};
1616
use chillerlan\HTTP\Utils\Query;
1717
use chillerlan\OAuth\MagicAPI\{ApiClientException, EndpointMap, EndpointMapInterface};
1818
use chillerlan\OAuth\Storage\OAuthStorageInterface;
@@ -164,10 +164,9 @@ public function __construct(
164164

165165
// i hate this, but i also hate adding 3 more params to the constructor
166166
// no i won't use a DI container for this. don't @ me
167-
$factory = new HttpFactory;
168-
$this->requestFactory = $factory;
169-
$this->streamFactory = $factory;
170-
$this->uriFactory = $factory;
167+
$this->requestFactory = new RequestFactory;
168+
$this->streamFactory = new StreamFactory;
169+
$this->uriFactory = new UriFactory;
171170

172171
$this->serviceName = (new ReflectionClass($this))->getShortName();
173172

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Class ChillerlanHttpClientFactory
4+
*
5+
* @created 01.04.2021
6+
* @author smiley <smiley@chillerlan.net>
7+
* @copyright 2021 smiley
8+
* @license MIT
9+
*/
10+
11+
namespace chillerlan\OAuthTest;
12+
13+
use chillerlan\HTTP\HTTPOptions;
14+
use chillerlan\HTTP\Psr18\CurlClient;
15+
use Psr\Http\Client\ClientInterface;
16+
17+
class ChillerlanHttpClientFactory implements OAuthTestHttpClientFactoryInterface{
18+
19+
/**
20+
* @inheritDoc
21+
*/
22+
public static function getClient(string $cfgdir):ClientInterface{
23+
$options = new HTTPOptions;
24+
$options->ca_info = $cfgdir.'/cacert.pem';
25+
$options->user_agent = 'chillerlanPhpOAuth/4.0.0 +https://github.com/chillerlan/php-oauth-core';
26+
27+
return new CurlClient($options);
28+
}
29+
30+
}

0 commit comments

Comments
 (0)