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

Commit 7fa7654

Browse files
committed
Move adapter into subnamespace
1 parent 50831e5 commit 7fa7654

13 files changed

+41
-41
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
},
3131
"autoload": {
3232
"psr-4": {
33-
"Http\\Adapter\\": "src/"
33+
"Http\\Adapter\\Guzzle6\\": "src/"
3434
}
3535
},
3636
"autoload-dev": {
3737
"psr-4": {
38-
"Http\\Adapter\\Tests\\": "tests/"
38+
"Http\\Adapter\\Guzzle6\\Tests\\": "tests/"
3939
}
4040
},
4141
"scripts": {

src/Guzzle6HttpAdapter.php renamed to src/Client.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace Http\Adapter;
3+
namespace Http\Adapter\Guzzle6;
44

5-
use GuzzleHttp\Client;
5+
use GuzzleHttp\Client as GuzzleClient;
66
use GuzzleHttp\ClientInterface;
77
use GuzzleHttp\HandlerStack;
88
use GuzzleHttp\Middleware;
@@ -16,7 +16,7 @@
1616
*
1717
* @author David de Boer <[email protected]>
1818
*/
19-
class Guzzle6HttpAdapter implements HttpClient, HttpAsyncClient
19+
class Client implements HttpClient, HttpAsyncClient
2020
{
2121
use HttpClientEmulator;
2222

@@ -33,7 +33,7 @@ public function __construct(ClientInterface $client = null)
3333
if (!$client) {
3434
$handlerStack = new HandlerStack(\GuzzleHttp\choose_handler());
3535
$handlerStack->push(Middleware::prepareBody(), 'prepare_body');
36-
$client = new Client(['handler' => $handlerStack]);
36+
$client = new GuzzleClient(['handler' => $handlerStack]);
3737
}
3838
$this->client = $client;
3939
}
@@ -45,6 +45,6 @@ public function sendAsyncRequest(RequestInterface $request)
4545
{
4646
$promise = $this->client->sendAsync($request);
4747

48-
return new Guzzle6Promise($promise, $request);
48+
return new Promise($promise, $request);
4949
}
5050
}

src/Guzzle6Promise.php renamed to src/Promise.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace Http\Adapter;
3+
namespace Http\Adapter\Guzzle6;
44

55
use GuzzleHttp\Exception as GuzzleExceptions;
66
use GuzzleHttp\Promise\PromiseInterface;
77
use Http\Client\Exception as HttplugException;
8-
use Http\Promise\Promise;
8+
use Http\Promise\Promise as HttpPromise;
99
use Psr\Http\Message\RequestInterface;
1010
use Psr\Http\Message\ResponseInterface;
1111

@@ -14,7 +14,7 @@
1414
*
1515
* @author Joel Wurtz <[email protected]>
1616
*/
17-
class Guzzle6Promise implements Promise
17+
class Promise implements HttpPromise
1818
{
1919
/**
2020
* @var PromiseInterface

tests/Guzzle6CurlHttpAdapterTest.php renamed to tests/CurlHttpAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Http\Adapter\Tests;
3+
namespace Http\Adapter\Guzzle6\Tests;
44

55
use GuzzleHttp\Handler\CurlHandler;
66

@@ -9,7 +9,7 @@
99
*
1010
* @author GeLo <[email protected]>
1111
*/
12-
class Guzzle6CurlHttpAdapterTest extends Guzzle6HttpAdapterTest
12+
class CurlHttpAdapterTest extends HttpAdapterTest
1313
{
1414
/**
1515
* {@inheritdoc}

tests/Guzzle6CurlHttpAsyncAdapterTest.php renamed to tests/CurlHttpAsyncAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Http\Adapter\Tests;
3+
namespace Http\Adapter\Guzzle6\Tests;
44

55
use GuzzleHttp\Handler\CurlHandler;
66

@@ -9,7 +9,7 @@
99
*
1010
* @author Joel Wurtz <[email protected]>
1111
*/
12-
class Guzzle6CurlHttpAsyncAdapterTest extends Guzzle6HttpAsyncAdapterTest
12+
class CurlHttpAsyncAdapterTest extends HttpAsyncAdapterTest
1313
{
1414
/**
1515
* {@inheritdoc}

tests/Guzzle6HttpAdapterTest.php renamed to tests/HttpAdapterTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<?php
22

3-
namespace Http\Adapter\Tests;
3+
namespace Http\Adapter\Guzzle6\Tests;
44

5-
use GuzzleHttp\Client;
6-
use Http\Adapter\Guzzle6HttpAdapter;
5+
use GuzzleHttp\Client as GuzzleClient;
6+
use Http\Adapter\Guzzle6\Client;
77
use Http\Client\Tests\HttpClientTest;
88

99
/**
1010
* @author GeLo <[email protected]>
1111
*/
12-
abstract class Guzzle6HttpAdapterTest extends HttpClientTest
12+
abstract class HttpAdapterTest extends HttpClientTest
1313
{
1414
/**
1515
* {@inheritdoc}
1616
*/
1717
protected function createHttpAdapter()
1818
{
19-
return new Guzzle6HttpAdapter(new Client(['handler' => $this->createHandler()]));
19+
return new Client(new GuzzleClient(['handler' => $this->createHandler()]));
2020
}
2121

2222
/**

tests/Guzzle6HttpAsyncAdapterTest.php renamed to tests/HttpAsyncAdapterTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<?php
22

3-
namespace Http\Adapter\Tests;
3+
namespace Http\Adapter\Guzzle6\Tests;
44

5-
use GuzzleHttp\Client;
6-
use Http\Adapter\Guzzle6HttpAdapter;
5+
use GuzzleHttp\Client as GuzzleClient;
6+
use Http\Adapter\Guzzle6\Client;
77
use Http\Client\Tests\HttpAsyncClientTest;
88

99
/**
1010
* @author Joel Wurtz <[email protected]>
1111
*/
12-
abstract class Guzzle6HttpAsyncAdapterTest extends HttpAsyncClientTest
12+
abstract class HttpAsyncAdapterTest extends HttpAsyncClientTest
1313
{
1414
/**
1515
* {@inheritdoc}
1616
*/
1717
protected function createHttpAsyncClient()
1818
{
19-
return new Guzzle6HttpAdapter(new Client(['handler' => $this->createHandler()]));
19+
return new Client(new GuzzleClient(['handler' => $this->createHandler()]));
2020
}
2121

2222
/**

tests/Guzzle6MultiCurlHttpAdapterTest.php renamed to tests/MultiCurlHttpAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace Http\Adapter\Tests;
3+
namespace Http\Adapter\Guzzle6\Tests;
44

55
use GuzzleHttp\Handler\CurlMultiHandler;
66

77
/**
88
* @author GeLo <[email protected]>
99
*/
10-
class Guzzle6MultiCurlHttpAdapterTest extends Guzzle6HttpAdapterTest
10+
class MultiCurlHttpAdapterTest extends HttpAdapterTest
1111
{
1212
/**
1313
* {@inheritdoc}

tests/Guzzle6MultiCurlHttpAsyncAdapterTest.php renamed to tests/MultiCurlHttpAsyncAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace Http\Adapter\Tests;
3+
namespace Http\Adapter\Guzzle6\Tests;
44

55
use GuzzleHttp\Handler\CurlMultiHandler;
66

77
/**
88
* @author Joel Wurtz <[email protected]>
99
*/
10-
class Guzzle6MultiCurlHttpAsyncAdapterTest extends Guzzle6HttpAsyncAdapterTest
10+
class MultiCurlHttpAsyncAdapterTest extends HttpAsyncAdapterTest
1111
{
1212
/**
1313
* {@inheritdoc}

tests/Guzzle6PromiseExceptionTest.php renamed to tests/PromiseExceptionTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
<?php
22

3-
namespace Http\Adapter\Tests;
3+
namespace Http\Adapter\Guzzle6\Tests;
44

55
use GuzzleHttp\Exception as GuzzleExceptions;
6-
use Http\Adapter\Guzzle6Promise;
6+
use Http\Adapter\Guzzle6\Promise;
77

88
/**
99
* @author Tobias Nyholm <[email protected]>
1010
*/
11-
class Guzzle6PromiseExceptionTest extends \PHPUnit_Framework_TestCase
11+
class PromiseExceptionTest extends \PHPUnit_Framework_TestCase
1212
{
1313
public function testGetException()
1414
{
1515
$request = $this->getMock('Psr\Http\Message\RequestInterface');
1616
$response = $this->getMock('Psr\Http\Message\ResponseInterface');
1717
$promise = $this->getMock('GuzzleHttp\Promise\PromiseInterface');
1818

19-
$adapter = new Guzzle6Promise($promise, $request);
20-
$method = new \ReflectionMethod('Http\Adapter\Guzzle6Promise', 'handleException');
19+
$adapter = new Promise($promise, $request);
20+
$method = new \ReflectionMethod('Http\Adapter\Guzzle6\Promise', 'handleException');
2121
$method->setAccessible(true);
2222

2323
$outputException = $method->invoke($adapter, new GuzzleExceptions\ConnectException('foo', $request), $request);

0 commit comments

Comments
 (0)