Server IP : 66.29.132.124 / Your IP : 3.138.113.44 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/vendor/omnipay__/common/src/Common/Http/ |
Upload File : |
<?php namespace Omnipay\Common\Http; use function GuzzleHttp\Psr7\str; use Http\Client\HttpClient; use Http\Discovery\HttpClientDiscovery; use Http\Discovery\MessageFactoryDiscovery; use Http\Message\RequestFactory; use Omnipay\Common\Http\Exception\NetworkException; use Omnipay\Common\Http\Exception\RequestException; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; class Client implements ClientInterface { /** * The Http Client which implements `public function sendRequest(RequestInterface $request)` * Note: Will be changed to PSR-18 when released * * @var HttpClient */ private $httpClient; /** * @var RequestFactory */ private $requestFactory; public function __construct($httpClient = null, RequestFactory $requestFactory = null) { $this->httpClient = $httpClient ?: HttpClientDiscovery::find(); $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find(); } /** * @param $method * @param $uri * @param array $headers * @param string|array|resource|StreamInterface|null $body * @param string $protocolVersion * @return ResponseInterface * @throws \Http\Client\Exception */ public function request( $method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1' ) { $request = $this->requestFactory->createRequest($method, $uri, $headers, $body, $protocolVersion); return $this->sendRequest($request); } /** * @param RequestInterface $request * @return ResponseInterface * @throws \Http\Client\Exception */ private function sendRequest(RequestInterface $request) { try { return $this->httpClient->sendRequest($request); } catch (\Http\Client\Exception\NetworkException $networkException) { throw new NetworkException($networkException->getMessage(), $request, $networkException); } catch (\Exception $exception) { throw new RequestException($exception->getMessage(), $request, $exception); } } }