From a3566c4cbb214b4f0b302b7fcac61a98ff4b44e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1gi-Kaz=C3=A1r=20M=C3=A1rk?= Date: Sat, 30 May 2015 21:32:51 +0200 Subject: [PATCH 1/2] Adds configurable HTTP adapter interface --- src/ConfigurableHttpAdapter.php | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/ConfigurableHttpAdapter.php diff --git a/src/ConfigurableHttpAdapter.php b/src/ConfigurableHttpAdapter.php new file mode 100644 index 0000000..df547ab --- /dev/null +++ b/src/ConfigurableHttpAdapter.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please read the LICENSE + * file that was distributed with this source code. + */ + +namespace Http\Adapter; + +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; + +/** + * @author GeLo + */ +interface ConfigurableHttpAdapter extends HttpAdapter +{ + /** + * Sends a PSR request + * + * @param RequestInterface $request + * @param array $options + * + * @return ResponseInterface + * + * @throws \InvalidArgumentException + * @throws Exception\HttpAdapterException + */ + public function sendRequest(RequestInterface $request, array $options = []); + + /** + * Sends PSR requests + * + * @param RequestInterface[] $requests + * @param array $options + * + * @return ResponseInterface[] + * + * @throws \InvalidArgumentException + * @throws Exception\MultiHttpAdapterException + */ + public function sendRequests(array $requests, array $options = []); +} From 342010438c4b148e98f6f18795055754ca47656e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1gi-Kaz=C3=A1r=20M=C3=A1rk?= Date: Sun, 31 May 2015 16:25:05 +0200 Subject: [PATCH 2/2] Merges configurable and non-configurable adapters --- src/ConfigurableHttpAdapter.php | 47 --------------------------------- src/HttpAdapter.php | 6 +++-- 2 files changed, 4 insertions(+), 49 deletions(-) delete mode 100644 src/ConfigurableHttpAdapter.php diff --git a/src/ConfigurableHttpAdapter.php b/src/ConfigurableHttpAdapter.php deleted file mode 100644 index df547ab..0000000 --- a/src/ConfigurableHttpAdapter.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please read the LICENSE - * file that was distributed with this source code. - */ - -namespace Http\Adapter; - -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; - -/** - * @author GeLo - */ -interface ConfigurableHttpAdapter extends HttpAdapter -{ - /** - * Sends a PSR request - * - * @param RequestInterface $request - * @param array $options - * - * @return ResponseInterface - * - * @throws \InvalidArgumentException - * @throws Exception\HttpAdapterException - */ - public function sendRequest(RequestInterface $request, array $options = []); - - /** - * Sends PSR requests - * - * @param RequestInterface[] $requests - * @param array $options - * - * @return ResponseInterface[] - * - * @throws \InvalidArgumentException - * @throws Exception\MultiHttpAdapterException - */ - public function sendRequests(array $requests, array $options = []); -} diff --git a/src/HttpAdapter.php b/src/HttpAdapter.php index c54da24..0447f9a 100644 --- a/src/HttpAdapter.php +++ b/src/HttpAdapter.php @@ -23,25 +23,27 @@ interface HttpAdapter * Sends a PSR request * * @param RequestInterface $request + * @param array $options * * @return ResponseInterface * * @throws \InvalidArgumentException * @throws Exception\HttpAdapterException */ - public function sendRequest(RequestInterface $request); + public function sendRequest(RequestInterface $request, array $options = []); /** * Sends PSR requests * * @param RequestInterface[] $requests + * @param array $options * * @return ResponseInterface[] * * @throws \InvalidArgumentException * @throws Exception\MultiHttpAdapterException */ - public function sendRequests(array $requests); + public function sendRequests(array $requests, array $options = []); /** * Returns the name