From 8cb8f1792d2021ac06d6c110f831dbfed13f2285 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Thu, 13 Dec 2018 15:36:09 +0100 Subject: [PATCH] adjust to final clients --- components/client-common.rst | 14 +++++++++++++- integrations/symfony-bundle.rst | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/components/client-common.rst b/components/client-common.rst index b75fea8..38c17a9 100644 --- a/components/client-common.rst +++ b/components/client-common.rst @@ -26,6 +26,10 @@ To be able to do that, it also wraps a message factory:: $bar = $client->get('http://example.com/bar', ['accept-encoding' => 'application/json']); $post = $client->post('http://example.com/update', [], 'My post body'); +..versionadded:: 2.0 + ``HttpMethodsClient`` is final since version 2.0. You can typehint the + ``HttpMethodsClientInterface`` to allow mocking the client in unit tests. + BatchClient ----------- @@ -48,6 +52,10 @@ their responses as a ``BatchResult``:: $batchResult = $client->sendRequests($requests); +..versionadded:: 2.0 + ``BatchClient`` is final since version 2.0. You can typehint the + ``BatchClientInterface`` to allow mocking the client in unit tests. + The ``BatchResult`` itself is an object that contains responses for all requests sent. It provides methods that give appropriate information based on a given request:: @@ -123,7 +131,7 @@ To enable the behavior, wrap the clients with the ``HttpClientPoolItem`` class y // Never reactivate the client (default) $httpClientPool->addHttpClient(new HttpClientPoolItem($httpClient, null)); -``HttpClientPool`` is abstract. There are three concrete implementations with specific strategies on how to choose clients: +``HttpClientPool`` is an interface. There are three concrete implementations with specific strategies on how to choose clients: LeastUsedClientPool ******************* @@ -228,3 +236,7 @@ and also to download an image from a static host:: it's easier to use the ``RequestConditionalPlugin`` and the ``PluginClient``, but in that case the routing logic is integrated into the linear request flow which might make debugging harder. + +..versionadded:: 2.0 + ``HttpClientRouter`` is final since version 2.0. You can typehint the + ``HttpClientRouterInterface`` to allow mocking the client in unit tests. diff --git a/integrations/symfony-bundle.rst b/integrations/symfony-bundle.rst index e34cccf..16365fc 100644 --- a/integrations/symfony-bundle.rst +++ b/integrations/symfony-bundle.rst @@ -225,7 +225,7 @@ Plugins ``````` Clients can have plugins that act on the request before it is sent out and/or -on the response before it is returned to the caller. Generic plugins from +on the response before it is returned to the caller. Generic plugins from ``php-http/client-common`` (e.g. retry or redirect) can be configured globally. You can tell the client which of those plugins to use, as well as specify the service names of custom plugins that you want to use. @@ -322,7 +322,7 @@ Special HTTP Clients ```````````````````` If you want to use the ``FlexibleHttpClient`` or ``HttpMethodsClient`` from the -``php-http/message`` package you may specify that on the client configuration. +``php-http/client-common`` package, you may specify that on the client configuration. .. code-block:: yaml