-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #442 from glaubinix/client-interface
Use ClientInterface instead of HttpClient
- Loading branch information
Showing
23 changed files
with
72 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,27 +8,26 @@ | |
use Http\Client\Common\VersionBridgeClient; | ||
use Http\Client\Exception\HttpException; | ||
use Http\Client\HttpAsyncClient; | ||
use Http\Client\HttpClient; | ||
use Psr\Http\Client\ClientInterface; | ||
use Psr\Http\Message\RequestInterface; | ||
use Psr\Http\Message\ResponseInterface; | ||
use Symfony\Component\Stopwatch\Stopwatch; | ||
use Symfony\Component\Stopwatch\StopwatchEvent; | ||
|
||
/** | ||
* The ProfileClient decorates any client that implement both HttpClient and HttpAsyncClient interfaces to gather target | ||
* The ProfileClient decorates any client that implement both ClientInterface and HttpAsyncClient interfaces to gather target | ||
* url and response status code. | ||
* | ||
* @author Fabien Bourigault <[email protected]> | ||
* | ||
* @internal | ||
*/ | ||
class ProfileClient implements HttpClient, HttpAsyncClient | ||
class ProfileClient implements ClientInterface, HttpAsyncClient | ||
{ | ||
use VersionBridgeClient; | ||
|
||
/** | ||
* @var HttpClient|HttpAsyncClient | ||
* @var ClientInterface|HttpAsyncClient | ||
*/ | ||
private $client; | ||
|
||
|
@@ -55,12 +54,12 @@ class ProfileClient implements HttpClient, HttpAsyncClient | |
private const STOPWATCH_CATEGORY = 'httplug'; | ||
|
||
/** | ||
* @param HttpClient|HttpAsyncClient $client The client to profile. Client must implement HttpClient or | ||
* HttpAsyncClient interface. | ||
* @param ClientInterface|HttpAsyncClient $client The client to profile. Client must implement HttpClient or | ||
* HttpAsyncClient interface. | ||
*/ | ||
public function __construct($client, Collector $collector, Formatter $formatter, Stopwatch $stopwatch) | ||
{ | ||
if (!(($client instanceof ClientInterface || $client instanceof HttpClient) && $client instanceof HttpAsyncClient)) { | ||
if (!($client instanceof ClientInterface && $client instanceof HttpAsyncClient)) { | ||
$client = new FlexibleHttpClient($client); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.