Cookie
2 years ago
Exception
2 years ago
Handler
2 years ago
BodySummarizer.php
2 years ago
BodySummarizerInterface.php
2 years ago
Client.php
2 years ago
ClientInterface.php
2 years ago
ClientTrait.php
2 years ago
HandlerStack.php
2 years ago
MessageFormatter.php
2 years ago
MessageFormatterInterface.php
2 years ago
Middleware.php
2 years ago
Pool.php
2 years ago
PrepareBodyMiddleware.php
2 years ago
RedirectMiddleware.php
2 years ago
RequestOptions.php
2 years ago
RetryMiddleware.php
2 years ago
TransferStats.php
2 years ago
Utils.php
2 years ago
functions.php
2 years ago
functions_include.php
2 years ago
ClientTrait.php
228 lines
| 1 | <?php |
| 2 | |
| 3 | namespace YoastSEO_Vendor\GuzzleHttp; |
| 4 | |
| 5 | use YoastSEO_Vendor\GuzzleHttp\Exception\GuzzleException; |
| 6 | use YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface; |
| 7 | use YoastSEO_Vendor\Psr\Http\Message\ResponseInterface; |
| 8 | use YoastSEO_Vendor\Psr\Http\Message\UriInterface; |
| 9 | /** |
| 10 | * Client interface for sending HTTP requests. |
| 11 | */ |
| 12 | trait ClientTrait |
| 13 | { |
| 14 | /** |
| 15 | * Create and send an HTTP request. |
| 16 | * |
| 17 | * Use an absolute path to override the base path of the client, or a |
| 18 | * relative path to append to the base path of the client. The URL can |
| 19 | * contain the query string as well. |
| 20 | * |
| 21 | * @param string $method HTTP method. |
| 22 | * @param string|UriInterface $uri URI object or string. |
| 23 | * @param array $options Request options to apply. |
| 24 | * |
| 25 | * @throws GuzzleException |
| 26 | */ |
| 27 | public abstract function request(string $method, $uri, array $options = []) : \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface; |
| 28 | /** |
| 29 | * Create and send an HTTP GET request. |
| 30 | * |
| 31 | * Use an absolute path to override the base path of the client, or a |
| 32 | * relative path to append to the base path of the client. The URL can |
| 33 | * contain the query string as well. |
| 34 | * |
| 35 | * @param string|UriInterface $uri URI object or string. |
| 36 | * @param array $options Request options to apply. |
| 37 | * |
| 38 | * @throws GuzzleException |
| 39 | */ |
| 40 | public function get($uri, array $options = []) : \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface |
| 41 | { |
| 42 | return $this->request('GET', $uri, $options); |
| 43 | } |
| 44 | /** |
| 45 | * Create and send an HTTP HEAD request. |
| 46 | * |
| 47 | * Use an absolute path to override the base path of the client, or a |
| 48 | * relative path to append to the base path of the client. The URL can |
| 49 | * contain the query string as well. |
| 50 | * |
| 51 | * @param string|UriInterface $uri URI object or string. |
| 52 | * @param array $options Request options to apply. |
| 53 | * |
| 54 | * @throws GuzzleException |
| 55 | */ |
| 56 | public function head($uri, array $options = []) : \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface |
| 57 | { |
| 58 | return $this->request('HEAD', $uri, $options); |
| 59 | } |
| 60 | /** |
| 61 | * Create and send an HTTP PUT request. |
| 62 | * |
| 63 | * Use an absolute path to override the base path of the client, or a |
| 64 | * relative path to append to the base path of the client. The URL can |
| 65 | * contain the query string as well. |
| 66 | * |
| 67 | * @param string|UriInterface $uri URI object or string. |
| 68 | * @param array $options Request options to apply. |
| 69 | * |
| 70 | * @throws GuzzleException |
| 71 | */ |
| 72 | public function put($uri, array $options = []) : \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface |
| 73 | { |
| 74 | return $this->request('PUT', $uri, $options); |
| 75 | } |
| 76 | /** |
| 77 | * Create and send an HTTP POST request. |
| 78 | * |
| 79 | * Use an absolute path to override the base path of the client, or a |
| 80 | * relative path to append to the base path of the client. The URL can |
| 81 | * contain the query string as well. |
| 82 | * |
| 83 | * @param string|UriInterface $uri URI object or string. |
| 84 | * @param array $options Request options to apply. |
| 85 | * |
| 86 | * @throws GuzzleException |
| 87 | */ |
| 88 | public function post($uri, array $options = []) : \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface |
| 89 | { |
| 90 | return $this->request('POST', $uri, $options); |
| 91 | } |
| 92 | /** |
| 93 | * Create and send an HTTP PATCH request. |
| 94 | * |
| 95 | * Use an absolute path to override the base path of the client, or a |
| 96 | * relative path to append to the base path of the client. The URL can |
| 97 | * contain the query string as well. |
| 98 | * |
| 99 | * @param string|UriInterface $uri URI object or string. |
| 100 | * @param array $options Request options to apply. |
| 101 | * |
| 102 | * @throws GuzzleException |
| 103 | */ |
| 104 | public function patch($uri, array $options = []) : \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface |
| 105 | { |
| 106 | return $this->request('PATCH', $uri, $options); |
| 107 | } |
| 108 | /** |
| 109 | * Create and send an HTTP DELETE request. |
| 110 | * |
| 111 | * Use an absolute path to override the base path of the client, or a |
| 112 | * relative path to append to the base path of the client. The URL can |
| 113 | * contain the query string as well. |
| 114 | * |
| 115 | * @param string|UriInterface $uri URI object or string. |
| 116 | * @param array $options Request options to apply. |
| 117 | * |
| 118 | * @throws GuzzleException |
| 119 | */ |
| 120 | public function delete($uri, array $options = []) : \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface |
| 121 | { |
| 122 | return $this->request('DELETE', $uri, $options); |
| 123 | } |
| 124 | /** |
| 125 | * Create and send an asynchronous HTTP request. |
| 126 | * |
| 127 | * Use an absolute path to override the base path of the client, or a |
| 128 | * relative path to append to the base path of the client. The URL can |
| 129 | * contain the query string as well. Use an array to provide a URL |
| 130 | * template and additional variables to use in the URL template expansion. |
| 131 | * |
| 132 | * @param string $method HTTP method |
| 133 | * @param string|UriInterface $uri URI object or string. |
| 134 | * @param array $options Request options to apply. |
| 135 | */ |
| 136 | public abstract function requestAsync(string $method, $uri, array $options = []) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface; |
| 137 | /** |
| 138 | * Create and send an asynchronous HTTP GET request. |
| 139 | * |
| 140 | * Use an absolute path to override the base path of the client, or a |
| 141 | * relative path to append to the base path of the client. The URL can |
| 142 | * contain the query string as well. Use an array to provide a URL |
| 143 | * template and additional variables to use in the URL template expansion. |
| 144 | * |
| 145 | * @param string|UriInterface $uri URI object or string. |
| 146 | * @param array $options Request options to apply. |
| 147 | */ |
| 148 | public function getAsync($uri, array $options = []) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface |
| 149 | { |
| 150 | return $this->requestAsync('GET', $uri, $options); |
| 151 | } |
| 152 | /** |
| 153 | * Create and send an asynchronous HTTP HEAD request. |
| 154 | * |
| 155 | * Use an absolute path to override the base path of the client, or a |
| 156 | * relative path to append to the base path of the client. The URL can |
| 157 | * contain the query string as well. Use an array to provide a URL |
| 158 | * template and additional variables to use in the URL template expansion. |
| 159 | * |
| 160 | * @param string|UriInterface $uri URI object or string. |
| 161 | * @param array $options Request options to apply. |
| 162 | */ |
| 163 | public function headAsync($uri, array $options = []) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface |
| 164 | { |
| 165 | return $this->requestAsync('HEAD', $uri, $options); |
| 166 | } |
| 167 | /** |
| 168 | * Create and send an asynchronous HTTP PUT request. |
| 169 | * |
| 170 | * Use an absolute path to override the base path of the client, or a |
| 171 | * relative path to append to the base path of the client. The URL can |
| 172 | * contain the query string as well. Use an array to provide a URL |
| 173 | * template and additional variables to use in the URL template expansion. |
| 174 | * |
| 175 | * @param string|UriInterface $uri URI object or string. |
| 176 | * @param array $options Request options to apply. |
| 177 | */ |
| 178 | public function putAsync($uri, array $options = []) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface |
| 179 | { |
| 180 | return $this->requestAsync('PUT', $uri, $options); |
| 181 | } |
| 182 | /** |
| 183 | * Create and send an asynchronous HTTP POST request. |
| 184 | * |
| 185 | * Use an absolute path to override the base path of the client, or a |
| 186 | * relative path to append to the base path of the client. The URL can |
| 187 | * contain the query string as well. Use an array to provide a URL |
| 188 | * template and additional variables to use in the URL template expansion. |
| 189 | * |
| 190 | * @param string|UriInterface $uri URI object or string. |
| 191 | * @param array $options Request options to apply. |
| 192 | */ |
| 193 | public function postAsync($uri, array $options = []) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface |
| 194 | { |
| 195 | return $this->requestAsync('POST', $uri, $options); |
| 196 | } |
| 197 | /** |
| 198 | * Create and send an asynchronous HTTP PATCH request. |
| 199 | * |
| 200 | * Use an absolute path to override the base path of the client, or a |
| 201 | * relative path to append to the base path of the client. The URL can |
| 202 | * contain the query string as well. Use an array to provide a URL |
| 203 | * template and additional variables to use in the URL template expansion. |
| 204 | * |
| 205 | * @param string|UriInterface $uri URI object or string. |
| 206 | * @param array $options Request options to apply. |
| 207 | */ |
| 208 | public function patchAsync($uri, array $options = []) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface |
| 209 | { |
| 210 | return $this->requestAsync('PATCH', $uri, $options); |
| 211 | } |
| 212 | /** |
| 213 | * Create and send an asynchronous HTTP DELETE request. |
| 214 | * |
| 215 | * Use an absolute path to override the base path of the client, or a |
| 216 | * relative path to append to the base path of the client. The URL can |
| 217 | * contain the query string as well. Use an array to provide a URL |
| 218 | * template and additional variables to use in the URL template expansion. |
| 219 | * |
| 220 | * @param string|UriInterface $uri URI object or string. |
| 221 | * @param array $options Request options to apply. |
| 222 | */ |
| 223 | public function deleteAsync($uri, array $options = []) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface |
| 224 | { |
| 225 | return $this->requestAsync('DELETE', $uri, $options); |
| 226 | } |
| 227 | } |
| 228 |