diff options
Diffstat (limited to 'vendor/php-http/httplug/src')
10 files changed, 0 insertions, 330 deletions
diff --git a/vendor/php-http/httplug/src/Exception.php b/vendor/php-http/httplug/src/Exception.php deleted file mode 100644 index 4df164c9a..000000000 --- a/vendor/php-http/httplug/src/Exception.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Http\Client; - -use Psr\Http\Client\ClientExceptionInterface as PsrClientException; - -/** - * Every HTTP Client related Exception must implement this interface. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -interface Exception extends PsrClientException -{ -} diff --git a/vendor/php-http/httplug/src/Exception/HttpException.php b/vendor/php-http/httplug/src/Exception/HttpException.php deleted file mode 100644 index 6c2a007a0..000000000 --- a/vendor/php-http/httplug/src/Exception/HttpException.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -namespace Http\Client\Exception; - -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; - -/** - * Thrown when a response was received but the request itself failed. - * - * In addition to the request, this exception always provides access to the response object. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -class HttpException extends RequestException -{ - /** - * @var ResponseInterface - */ - protected $response; - - /** - * @param string $message - */ - public function __construct( - $message, - RequestInterface $request, - ResponseInterface $response, - \Exception $previous = null - ) { - parent::__construct($message, $request, $previous); - - $this->response = $response; - $this->code = $response->getStatusCode(); - } - - /** - * Returns the response. - * - * @return ResponseInterface - */ - public function getResponse() - { - return $this->response; - } - - /** - * Factory method to create a new exception with a normalized error message. - */ - public static function create( - RequestInterface $request, - ResponseInterface $response, - \Exception $previous = null - ) { - $message = sprintf( - '[url] %s [http method] %s [status code] %s [reason phrase] %s', - $request->getRequestTarget(), - $request->getMethod(), - $response->getStatusCode(), - $response->getReasonPhrase() - ); - - return new static($message, $request, $response, $previous); - } -} diff --git a/vendor/php-http/httplug/src/Exception/NetworkException.php b/vendor/php-http/httplug/src/Exception/NetworkException.php deleted file mode 100644 index 9b4f1e8fd..000000000 --- a/vendor/php-http/httplug/src/Exception/NetworkException.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -namespace Http\Client\Exception; - -use Psr\Http\Client\NetworkExceptionInterface as PsrNetworkException; -use Psr\Http\Message\RequestInterface; - -/** - * Thrown when the request cannot be completed because of network issues. - * - * There is no response object as this exception is thrown when no response has been received. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -class NetworkException extends TransferException implements PsrNetworkException -{ - use RequestAwareTrait; - - /** - * @param string $message - */ - public function __construct($message, RequestInterface $request, \Exception $previous = null) - { - $this->setRequest($request); - - parent::__construct($message, 0, $previous); - } -} diff --git a/vendor/php-http/httplug/src/Exception/RequestAwareTrait.php b/vendor/php-http/httplug/src/Exception/RequestAwareTrait.php deleted file mode 100644 index 71b4bb8c9..000000000 --- a/vendor/php-http/httplug/src/Exception/RequestAwareTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Http\Client\Exception; - -use Psr\Http\Message\RequestInterface; - -trait RequestAwareTrait -{ - /** - * @var RequestInterface - */ - private $request; - - private function setRequest(RequestInterface $request) - { - $this->request = $request; - } - - /** - * {@inheritdoc} - */ - public function getRequest(): RequestInterface - { - return $this->request; - } -} diff --git a/vendor/php-http/httplug/src/Exception/RequestException.php b/vendor/php-http/httplug/src/Exception/RequestException.php deleted file mode 100644 index f6c60ce56..000000000 --- a/vendor/php-http/httplug/src/Exception/RequestException.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -namespace Http\Client\Exception; - -use Psr\Http\Client\RequestExceptionInterface as PsrRequestException; -use Psr\Http\Message\RequestInterface; - -/** - * Exception for when a request failed, providing access to the failed request. - * - * This could be due to an invalid request, or one of the extending exceptions - * for network errors or HTTP error responses. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -class RequestException extends TransferException implements PsrRequestException -{ - use RequestAwareTrait; - - /** - * @param string $message - */ - public function __construct($message, RequestInterface $request, \Exception $previous = null) - { - $this->setRequest($request); - - parent::__construct($message, 0, $previous); - } -} diff --git a/vendor/php-http/httplug/src/Exception/TransferException.php b/vendor/php-http/httplug/src/Exception/TransferException.php deleted file mode 100644 index a858cf5ec..000000000 --- a/vendor/php-http/httplug/src/Exception/TransferException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Http\Client\Exception; - -use Http\Client\Exception; - -/** - * Base exception for transfer related exceptions. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -class TransferException extends \RuntimeException implements Exception -{ -} diff --git a/vendor/php-http/httplug/src/HttpAsyncClient.php b/vendor/php-http/httplug/src/HttpAsyncClient.php deleted file mode 100644 index c3b9d61aa..000000000 --- a/vendor/php-http/httplug/src/HttpAsyncClient.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Http\Client; - -use Http\Promise\Promise; -use Psr\Http\Message\RequestInterface; - -/** - * Sends a PSR-7 Request in an asynchronous way by returning a Promise. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -interface HttpAsyncClient -{ - /** - * Sends a PSR-7 request in an asynchronous way. - * - * Exceptions related to processing the request are available from the returned Promise. - * - * @return Promise resolves a PSR-7 Response or fails with an Http\Client\Exception - * - * @throws \Exception If processing the request is impossible (eg. bad configuration). - */ - public function sendAsyncRequest(RequestInterface $request); -} diff --git a/vendor/php-http/httplug/src/HttpClient.php b/vendor/php-http/httplug/src/HttpClient.php deleted file mode 100644 index 22b94aaf7..000000000 --- a/vendor/php-http/httplug/src/HttpClient.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -namespace Http\Client; - -use Psr\Http\Client\ClientInterface; - -/** - * {@inheritdoc} - * - * Provide the Httplug HttpClient interface for BC. - * You should typehint Psr\Http\Client\ClientInterface in new code - * - * @deprecated since version 2.4, use Psr\Http\Client\ClientInterface instead; see https://www.php-fig.org/psr/psr-18/ - */ -interface HttpClient extends ClientInterface -{ -} diff --git a/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php b/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php deleted file mode 100644 index 1ad32cd53..000000000 --- a/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -namespace Http\Client\Promise; - -use Http\Client\Exception; -use Http\Promise\Promise; -use Psr\Http\Message\ResponseInterface; - -final class HttpFulfilledPromise implements Promise -{ - /** - * @var ResponseInterface - */ - private $response; - - public function __construct(ResponseInterface $response) - { - $this->response = $response; - } - - /** - * {@inheritdoc} - */ - public function then(callable $onFulfilled = null, callable $onRejected = null) - { - if (null === $onFulfilled) { - return $this; - } - - try { - return new self($onFulfilled($this->response)); - } catch (Exception $e) { - return new HttpRejectedPromise($e); - } - } - - /** - * {@inheritdoc} - */ - public function getState() - { - return Promise::FULFILLED; - } - - /** - * {@inheritdoc} - */ - public function wait($unwrap = true) - { - if ($unwrap) { - return $this->response; - } - } -} diff --git a/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php b/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php deleted file mode 100644 index 624cc8a94..000000000 --- a/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -namespace Http\Client\Promise; - -use Http\Client\Exception; -use Http\Promise\Promise; - -final class HttpRejectedPromise implements Promise -{ - /** - * @var Exception - */ - private $exception; - - public function __construct(Exception $exception) - { - $this->exception = $exception; - } - - /** - * {@inheritdoc} - */ - public function then(callable $onFulfilled = null, callable $onRejected = null) - { - if (null === $onRejected) { - return $this; - } - - try { - $result = $onRejected($this->exception); - if ($result instanceof Promise) { - return $result; - } - - return new HttpFulfilledPromise($result); - } catch (Exception $e) { - return new self($e); - } - } - - /** - * {@inheritdoc} - */ - public function getState() - { - return Promise::REJECTED; - } - - /** - * {@inheritdoc} - */ - public function wait($unwrap = true) - { - if ($unwrap) { - throw $this->exception; - } - } -} |