diff --git a/CHANGELOG.md b/CHANGELOG.md index 233e4d0..94674b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log + +## Unreleased + +### Deprecated + +- Core plugins and plugin client, moved to [client-common](https://github.com/php-http/client-common) +- Logger plugin, moved to [logger-plugin](https://github.com/php-http/logger-plugin) +- Cache plugin, moved to [cache-plugin](https://github.com/php-http/cache-plugin) +- Stopwatch plugin, moved to [stopwatch-plugin](https://github.com/php-http/stopwatch-plugin) + + ## 1.0.1 - 2016-01-29 ### Changed diff --git a/composer.json b/composer.json index bdfbafb..2d9b1f1 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "php": ">=5.4", "php-http/httplug": "^1.0", "php-http/message-factory": "^1.0.2", - "php-http/client-common": "^1.0", + "php-http/client-common": "^1.1", "php-http/message": "^1.0", "symfony/options-resolver": "^2.6|^3.0" }, diff --git a/src/AddHostPlugin.php b/src/AddHostPlugin.php index 025ef80..a71d064 100644 --- a/src/AddHostPlugin.php +++ b/src/AddHostPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\AddHostPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\AddHostPlugin instead.', E_USER_DEPRECATED); + use Psr\Http\Message\RequestInterface; use Psr\Http\Message\UriInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -10,6 +12,8 @@ * Add schema and host to a request. Can be set to overwrite the schema and host if desired. * * @author Tobias Nyholm + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\AddHostPlugin} instead. */ class AddHostPlugin implements Plugin { diff --git a/src/AuthenticationPlugin.php b/src/AuthenticationPlugin.php index 29e368b..c47a42d 100644 --- a/src/AuthenticationPlugin.php +++ b/src/AuthenticationPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\AuthenticationPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\AuthenticationPlugin instead.', E_USER_DEPRECATED); + use Http\Message\Authentication; use Psr\Http\Message\RequestInterface; @@ -9,6 +11,8 @@ * Send an authenticated request. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\AuthenticationPlugin} instead. */ class AuthenticationPlugin implements Plugin { diff --git a/src/CachePlugin.php b/src/CachePlugin.php index 62c9715..7583940 100644 --- a/src/CachePlugin.php +++ b/src/CachePlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\CachePlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\CachePlugin instead.', E_USER_DEPRECATED); + use Http\Message\StreamFactory; use Http\Promise\FulfilledPromise; use Psr\Cache\CacheItemPoolInterface; @@ -13,6 +15,8 @@ * Allow for caching a response. * * @author Tobias Nyholm + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\CachePlugin} instead. */ class CachePlugin implements Plugin { diff --git a/src/ContentLengthPlugin.php b/src/ContentLengthPlugin.php index 068d65e..b8b9c7a 100644 --- a/src/ContentLengthPlugin.php +++ b/src/ContentLengthPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\ContentLengthPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\ContentLengthPlugin instead.', E_USER_DEPRECATED); + use Http\Message\Encoding\ChunkStream; use Psr\Http\Message\RequestInterface; @@ -9,6 +11,8 @@ * Allow to set the correct content length header on the request or to transfer it as a chunk if not possible. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\ContentLengthPlugin} instead. */ class ContentLengthPlugin implements Plugin { diff --git a/src/CookiePlugin.php b/src/CookiePlugin.php index 6e222ab..0a52c13 100644 --- a/src/CookiePlugin.php +++ b/src/CookiePlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\CookiePlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\CookiePlugin instead.', E_USER_DEPRECATED); + use Http\Client\Exception\TransferException; use Http\Message\Cookie; use Http\Message\CookieJar; @@ -12,6 +14,8 @@ * Handle request cookies. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\CookiePlugin} instead. */ class CookiePlugin implements Plugin { diff --git a/src/DecoderPlugin.php b/src/DecoderPlugin.php index 4b49bfb..8eff824 100644 --- a/src/DecoderPlugin.php +++ b/src/DecoderPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\DecoderPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\DecoderPlugin instead.', E_USER_DEPRECATED); + use Http\Message\Encoding\DechunkStream; use Http\Message\Encoding\DecompressStream; use Http\Message\Encoding\GzipDecodeStream; @@ -19,6 +21,8 @@ * If Content-Encoding is not disabled, the plugin will add an Accept-Encoding header for the encoding methods it supports. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\DecoderPlugin} instead. */ class DecoderPlugin implements Plugin { diff --git a/src/ErrorPlugin.php b/src/ErrorPlugin.php index 36ca121..02b4d19 100644 --- a/src/ErrorPlugin.php +++ b/src/ErrorPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\ErrorPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\ErrorPlugin instead.', E_USER_DEPRECATED); + use Http\Client\Plugin\Exception\ClientErrorException; use Http\Client\Plugin\Exception\ServerErrorException; use Psr\Http\Message\RequestInterface; @@ -13,6 +15,8 @@ * By default an exception will be thrown for all status codes from 400 to 599. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\ErrorPlugin} instead. */ class ErrorPlugin implements Plugin { diff --git a/src/Exception/CircularRedirectionException.php b/src/Exception/CircularRedirectionException.php index bf71b1a..bc4df78 100644 --- a/src/Exception/CircularRedirectionException.php +++ b/src/Exception/CircularRedirectionException.php @@ -2,12 +2,16 @@ namespace Http\Client\Plugin\Exception; +@trigger_error('The '.__NAMESPACE__.'\CircularRedirectionException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\CircularRedirectionException instead.', E_USER_DEPRECATED); + use Http\Client\Exception\HttpException; /** * Thrown when circular redirection is detected. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\CircularRedirectionException} instead. */ class CircularRedirectionException extends HttpException { diff --git a/src/Exception/ClientErrorException.php b/src/Exception/ClientErrorException.php index 8624660..28e0b85 100644 --- a/src/Exception/ClientErrorException.php +++ b/src/Exception/ClientErrorException.php @@ -2,12 +2,16 @@ namespace Http\Client\Plugin\Exception; +@trigger_error('The '.__NAMESPACE__.'\ClientErrorException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\ClientErrorException instead.', E_USER_DEPRECATED); + use Http\Client\Exception\HttpException; /** * Thrown when there is a client error (4xx). * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\ClientErrorException} instead. */ class ClientErrorException extends HttpException { diff --git a/src/Exception/LoopException.php b/src/Exception/LoopException.php index 5194ed7..cb291da 100644 --- a/src/Exception/LoopException.php +++ b/src/Exception/LoopException.php @@ -2,10 +2,14 @@ namespace Http\Client\Plugin\Exception; +@trigger_error('The '.__NAMESPACE__.'\LoopException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\LoopException instead.', E_USER_DEPRECATED); + use Http\Client\Exception\RequestException; /** * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\LoopException} instead. */ class LoopException extends RequestException { diff --git a/src/Exception/MultipleRedirectionException.php b/src/Exception/MultipleRedirectionException.php index b16c026..0ded5da 100644 --- a/src/Exception/MultipleRedirectionException.php +++ b/src/Exception/MultipleRedirectionException.php @@ -2,12 +2,16 @@ namespace Http\Client\Plugin\Exception; +@trigger_error('The '.__NAMESPACE__.'\MultipleRedirectionException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\MultipleRedirectionException instead.', E_USER_DEPRECATED); + use Http\Client\Exception\HttpException; /** * Redirect location cannot be chosen. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\MultipleRedirectionException} instead. */ class MultipleRedirectionException extends HttpException { diff --git a/src/Exception/ServerErrorException.php b/src/Exception/ServerErrorException.php index 65117f1..8702d27 100644 --- a/src/Exception/ServerErrorException.php +++ b/src/Exception/ServerErrorException.php @@ -2,12 +2,16 @@ namespace Http\Client\Plugin\Exception; +@trigger_error('The '.__NAMESPACE__.'\ServerErrorException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\ServerErrorException instead.', E_USER_DEPRECATED); + use Http\Client\Exception\HttpException; /** * Thrown when there is a server error (5xx). * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\ServerErrorException} instead. */ class ServerErrorException extends HttpException { diff --git a/src/HeaderAppendPlugin.php b/src/HeaderAppendPlugin.php index b3fcac2..29eea10 100644 --- a/src/HeaderAppendPlugin.php +++ b/src/HeaderAppendPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\HeaderAppendPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HeaderAppendPlugin instead.', E_USER_DEPRECATED); + use Psr\Http\Message\RequestInterface; /** @@ -13,6 +15,8 @@ * @link https://en.wikipedia.org/wiki/List_of_HTTP_header_fields * * @author Soufiane Ghzal + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HeaderAppendPlugin} instead. */ class HeaderAppendPlugin implements Plugin { diff --git a/src/HeaderDefaultsPlugin.php b/src/HeaderDefaultsPlugin.php index fbee194..c2415e9 100644 --- a/src/HeaderDefaultsPlugin.php +++ b/src/HeaderDefaultsPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\HeaderDefaultsPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HeaderDefaultsPlugin instead.', E_USER_DEPRECATED); + use Psr\Http\Message\RequestInterface; /** @@ -9,6 +11,8 @@ * If a given header already exists the value wont be replaced and the request wont be changed. * * @author Soufiane Ghzal + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HeaderDefaultsPlugin} instead. */ class HeaderDefaultsPlugin implements Plugin { diff --git a/src/HeaderRemovePlugin.php b/src/HeaderRemovePlugin.php index b49ac26..800e8e6 100644 --- a/src/HeaderRemovePlugin.php +++ b/src/HeaderRemovePlugin.php @@ -2,12 +2,16 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\HeaderRemovePlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HeaderRemovePlugin instead.', E_USER_DEPRECATED); + use Psr\Http\Message\RequestInterface; /** * Removes headers from the request. * * @author Soufiane Ghzal + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HeaderRemovePlugin} instead. */ class HeaderRemovePlugin implements Plugin { diff --git a/src/HeaderSetPlugin.php b/src/HeaderSetPlugin.php index 0e855f9..fe06c08 100644 --- a/src/HeaderSetPlugin.php +++ b/src/HeaderSetPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\HeaderSetPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HeaderSetPlugin instead.', E_USER_DEPRECATED); + use Psr\Http\Message\RequestInterface; /** @@ -9,6 +11,8 @@ * If the header does not exist it wil be set, if the header already exists it will be replaced. * * @author Soufiane Ghzal + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HeaderSetPlugin} instead. */ class HeaderSetPlugin implements Plugin { diff --git a/src/HistoryPlugin.php b/src/HistoryPlugin.php index 798b32e..0c02679 100644 --- a/src/HistoryPlugin.php +++ b/src/HistoryPlugin.php @@ -2,12 +2,16 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\HistoryPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HistoryPlugin instead.', E_USER_DEPRECATED); + use Http\Client\Exception; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; /** * Record http call. + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HistoryPlugin} instead. */ class HistoryPlugin implements Plugin { diff --git a/src/Journal.php b/src/Journal.php index 711ed43..a35504c 100644 --- a/src/Journal.php +++ b/src/Journal.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\Journal class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\Journal instead.', E_USER_DEPRECATED); + use Http\Client\Exception; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -10,6 +12,8 @@ * Records history of http calls. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\Journal} instead. */ interface Journal { diff --git a/src/LoggerPlugin.php b/src/LoggerPlugin.php index 5feec57..0fe9cbe 100644 --- a/src/LoggerPlugin.php +++ b/src/LoggerPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\LoggerPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\LoggerPlugin instead.', E_USER_DEPRECATED); + use Http\Client\Exception; use Http\Message\Formatter; use Http\Message\Formatter\SimpleFormatter; @@ -13,6 +15,8 @@ * Log request, response and exception for a HTTP Client. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\LoggerPlugin} instead. */ class LoggerPlugin implements Plugin { diff --git a/src/Plugin.php b/src/Plugin.php index 2f09ff1..66c7f3f 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -2,8 +2,7 @@ namespace Http\Client\Plugin; -use Http\Promise\Promise; -use Psr\Http\Message\RequestInterface; +@trigger_error('The '.__NAMESPACE__.'\Plugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin instead.', E_USER_DEPRECATED); /** * A plugin is a middleware to transform the request and/or the response. @@ -14,17 +13,9 @@ * - restart the request * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin} instead. */ -interface Plugin +interface Plugin extends \Http\Client\Common\Plugin { - /** - * Handle the request and return the response coming from the next callable. - * - * @param RequestInterface $request - * @param callable $next Next middleware in the chain, the request is passed as the first argument - * @param callable $first First middleware in the chain, used to to restart a request - * - * @return Promise - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first); } diff --git a/src/PluginClient.php b/src/PluginClient.php index 2d276ed..02cf22b 100644 --- a/src/PluginClient.php +++ b/src/PluginClient.php @@ -2,43 +2,26 @@ namespace Http\Client\Plugin; -use Http\Client\Common\EmulatedHttpAsyncClient; -use Http\Client\Exception; +@trigger_error('The '.__NAMESPACE__.'\PluginClient class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\PluginClient instead.', E_USER_DEPRECATED); + use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; use Http\Client\Plugin\Exception\LoopException; -use Http\Promise\FulfilledPromise; -use Http\Promise\RejectedPromise; use Psr\Http\Message\RequestInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; /** * The client managing plugins and providing a decorator around HTTP Clients. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\PluginClient} instead. */ final class PluginClient implements HttpClient, HttpAsyncClient { /** - * An HTTP async client. - * - * @var HttpAsyncClient - */ - private $client; - - /** - * The plugin chain. - * - * @var Plugin[] + * @var \Http\Client\Common\PluginClient */ - private $plugins; - - /** - * A list of options. - * - * @var array - */ - private $options; + private $pluginClient; /** * @param HttpClient|HttpAsyncClient $client @@ -52,16 +35,7 @@ final class PluginClient implements HttpClient, HttpAsyncClient */ public function __construct($client, array $plugins = [], array $options = []) { - if ($client instanceof HttpAsyncClient) { - $this->client = $client; - } elseif ($client instanceof HttpClient) { - $this->client = new EmulatedHttpAsyncClient($client); - } else { - throw new \RuntimeException('Client must be an instance of Http\\Client\\HttpClient or Http\\Client\\HttpAsyncClient'); - } - - $this->plugins = $plugins; - $this->options = $this->configure($options); + $this->pluginClient = new \Http\Client\Common\PluginClient($client, $plugins, $options); } /** @@ -69,22 +43,11 @@ public function __construct($client, array $plugins = [], array $options = []) */ public function sendRequest(RequestInterface $request) { - // If we don't have an http client, use the async call - if (!($this->client instanceof HttpClient)) { - return $this->sendAsyncRequest($request)->wait(); + try { + return $this->pluginClient->sendRequest($request); + } catch (\Http\Client\Common\Exception\LoopException $e) { + throw new LoopException($e->getMessage(), $e->getRequest(), $e); } - - // Else we want to use the synchronous call of the underlying client, and not the async one in the case - // we have both an async and sync call - $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) { - try { - return new FulfilledPromise($this->client->sendRequest($request)); - } catch (Exception $exception) { - return new RejectedPromise($exception); - } - }); - - return $pluginChain($request)->wait(); } /** @@ -92,61 +55,10 @@ public function sendRequest(RequestInterface $request) */ public function sendAsyncRequest(RequestInterface $request) { - $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) { - return $this->client->sendAsyncRequest($request); - }); - - return $pluginChain($request); - } - - /** - * Configure the plugin client. - * - * @param array $options - * - * @return array - */ - private function configure(array $options = []) - { - $resolver = new OptionsResolver(); - $resolver->setDefaults([ - 'max_restarts' => 10, - ]); - - return $resolver->resolve($options); - } - - /** - * Create the plugin chain. - * - * @param Plugin[] $pluginList A list of plugins - * @param callable $clientCallable Callable making the HTTP call - * - * @return callable - */ - private function createPluginChain($pluginList, callable $clientCallable) - { - $firstCallable = $lastCallable = $clientCallable; - - while ($plugin = array_pop($pluginList)) { - $lastCallable = function (RequestInterface $request) use ($plugin, $lastCallable, &$firstCallable) { - return $plugin->handleRequest($request, $lastCallable, $firstCallable); - }; - - $firstCallable = $lastCallable; + try { + return $this->pluginClient->sendAsyncRequest($request); + } catch (\Http\Client\Common\Exception\LoopException $e) { + throw new LoopException($e->getMessage(), $e->getRequest(), $e); } - - $firstCalls = 0; - $firstCallable = function (RequestInterface $request) use ($lastCallable, &$firstCalls) { - if ($firstCalls > $this->options['max_restarts']) { - throw new LoopException('Too many restarts in plugin client', $request); - } - - ++$firstCalls; - - return $lastCallable($request); - }; - - return $firstCallable; } } diff --git a/src/RedirectPlugin.php b/src/RedirectPlugin.php index 7a3f775..e6a8d6c 100644 --- a/src/RedirectPlugin.php +++ b/src/RedirectPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\RedirectPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\RedirectPlugin instead.', E_USER_DEPRECATED); + use Http\Client\Exception\HttpException; use Http\Client\Plugin\Exception\CircularRedirectionException; use Http\Client\Plugin\Exception\MultipleRedirectionException; @@ -15,6 +17,8 @@ * Follow redirections. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\RedirectPlugin} instead. */ class RedirectPlugin implements Plugin { diff --git a/src/RetryPlugin.php b/src/RetryPlugin.php index 80097da..4d81970 100644 --- a/src/RetryPlugin.php +++ b/src/RetryPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\RetryPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\RetryPlugin instead.', E_USER_DEPRECATED); + use Http\Client\Exception; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -13,6 +15,8 @@ * By default will retry only one time. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\RetryPlugin} instead. */ class RetryPlugin implements Plugin { diff --git a/src/StopwatchPlugin.php b/src/StopwatchPlugin.php index 48ce9ce..0a9c542 100644 --- a/src/StopwatchPlugin.php +++ b/src/StopwatchPlugin.php @@ -2,6 +2,8 @@ namespace Http\Client\Plugin; +@trigger_error('The '.__NAMESPACE__.'\StopwatchPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\StopwatchPlugin instead.', E_USER_DEPRECATED); + use Http\Client\Exception; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -11,6 +13,8 @@ * Measure the duration of a request call with the stopwatch component. * * @author Joel Wurtz + * + * @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\StopwatchPlugin} instead. */ class StopwatchPlugin implements Plugin {