From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- .../Guzzle/Http/Exception/BadResponseException.php | 69 ++++++++++ .../Exception/ClientErrorResponseException.php | 8 ++ .../Exception/CouldNotRewindStreamException.php | 7 + .../src/Guzzle/Http/Exception/CurlException.php | 101 ++++++++++++++ .../src/Guzzle/Http/Exception/HttpException.php | 10 ++ .../Http/Exception/MultiTransferException.php | 145 +++++++++++++++++++++ .../src/Guzzle/Http/Exception/RequestException.php | 39 ++++++ .../Exception/ServerErrorResponseException.php | 8 ++ .../Http/Exception/TooManyRedirectsException.php | 5 + 9 files changed, 392 insertions(+) create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ClientErrorResponseException.php create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/CouldNotRewindStreamException.php create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/CurlException.php create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/HttpException.php create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/MultiTransferException.php create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/RequestException.php create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ServerErrorResponseException.php create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/TooManyRedirectsException.php (limited to 'vendor/guzzle/guzzle/src/Guzzle/Http/Exception') diff --git a/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php new file mode 100644 index 0000000..0ed0b47 --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php @@ -0,0 +1,69 @@ +isClientError()) { + $label = 'Client error response'; + $class = __NAMESPACE__ . '\\ClientErrorResponseException'; + } elseif ($response->isServerError()) { + $label = 'Server error response'; + $class = __NAMESPACE__ . '\\ServerErrorResponseException'; + } else { + $label = 'Unsuccessful response'; + $class = __CLASS__; + } + + $message = $label . PHP_EOL . implode(PHP_EOL, array( + '[status code] ' . $response->getStatusCode(), + '[reason phrase] ' . $response->getReasonPhrase(), + '[url] ' . $request->getUrl(), + )); + + $e = new $class($message); + $e->setResponse($response); + $e->setRequest($request); + + return $e; + } + + /** + * Set the response that caused the exception + * + * @param Response $response Response to set + */ + public function setResponse(Response $response) + { + $this->response = $response; + } + + /** + * Get the response that caused the exception + * + * @return Response + */ + public function getResponse() + { + return $this->response; + } +} diff --git a/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ClientErrorResponseException.php b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ClientErrorResponseException.php new file mode 100644 index 0000000..04d7ddc --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ClientErrorResponseException.php @@ -0,0 +1,8 @@ +curlError = $error; + $this->curlErrorNo = $number; + + return $this; + } + + /** + * Set the associated curl handle + * + * @param CurlHandle $handle Curl handle + * + * @return self + */ + public function setCurlHandle(CurlHandle $handle) + { + $this->handle = $handle; + + return $this; + } + + /** + * Get the associated cURL handle + * + * @return CurlHandle|null + */ + public function getCurlHandle() + { + return $this->handle; + } + + /** + * Get the associated cURL error message + * + * @return string|null + */ + public function getError() + { + return $this->curlError; + } + + /** + * Get the associated cURL error number + * + * @return int|null + */ + public function getErrorNo() + { + return $this->curlErrorNo; + } + + /** + * Returns curl information about the transfer + * + * @return array + */ + public function getCurlInfo() + { + return $this->curlInfo; + } + + /** + * Set curl transfer information + * + * @param array $info Array of curl transfer information + * + * @return self + * @link http://php.net/manual/en/function.curl-getinfo.php + */ + public function setCurlInfo(array $info) + { + $this->curlInfo = $info; + + return $this; + } +} diff --git a/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/HttpException.php b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/HttpException.php new file mode 100644 index 0000000..ee87295 --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/HttpException.php @@ -0,0 +1,10 @@ +successfulRequests, $this->failedRequests); + } + + /** + * Add to the array of successful requests + * + * @param RequestInterface $request Successful request + * + * @return self + */ + public function addSuccessfulRequest(RequestInterface $request) + { + $this->successfulRequests[] = $request; + + return $this; + } + + /** + * Add to the array of failed requests + * + * @param RequestInterface $request Failed request + * + * @return self + */ + public function addFailedRequest(RequestInterface $request) + { + $this->failedRequests[] = $request; + + return $this; + } + + /** + * Add to the array of failed requests and associate with exceptions + * + * @param RequestInterface $request Failed request + * @param \Exception $exception Exception to add and associate with + * + * @return self + */ + public function addFailedRequestWithException(RequestInterface $request, \Exception $exception) + { + $this->add($exception) + ->addFailedRequest($request) + ->exceptionForRequest[spl_object_hash($request)] = $exception; + + return $this; + } + + /** + * Get the Exception that caused the given $request to fail + * + * @param RequestInterface $request Failed command + * + * @return \Exception|null + */ + public function getExceptionForFailedRequest(RequestInterface $request) + { + $oid = spl_object_hash($request); + + return isset($this->exceptionForRequest[$oid]) ? $this->exceptionForRequest[$oid] : null; + } + + /** + * Set all of the successful requests + * + * @param array Array of requests + * + * @return self + */ + public function setSuccessfulRequests(array $requests) + { + $this->successfulRequests = $requests; + + return $this; + } + + /** + * Set all of the failed requests + * + * @param array Array of requests + * + * @return self + */ + public function setFailedRequests(array $requests) + { + $this->failedRequests = $requests; + + return $this; + } + + /** + * Get an array of successful requests sent in the multi transfer + * + * @return array + */ + public function getSuccessfulRequests() + { + return $this->successfulRequests; + } + + /** + * Get an array of failed requests sent in the multi transfer + * + * @return array + */ + public function getFailedRequests() + { + return $this->failedRequests; + } + + /** + * Check if the exception object contains a request + * + * @param RequestInterface $request Request to check + * + * @return bool + */ + public function containsRequest(RequestInterface $request) + { + return in_array($request, $this->failedRequests, true) || in_array($request, $this->successfulRequests, true); + } +} diff --git a/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/RequestException.php b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/RequestException.php new file mode 100644 index 0000000..274df2c --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/RequestException.php @@ -0,0 +1,39 @@ +request = $request; + + return $this; + } + + /** + * Get the request that caused the exception + * + * @return RequestInterface + */ + public function getRequest() + { + return $this->request; + } +} diff --git a/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ServerErrorResponseException.php b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ServerErrorResponseException.php new file mode 100644 index 0000000..f0f7cfe --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ServerErrorResponseException.php @@ -0,0 +1,8 @@ +