Version Description
Download this release
Release Info
Developer | |
Plugin | Official Facebook Pixel |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- changelog.txt +3 -0
- composer.json +3 -0
- composer.lock +1 -360
- core/FacebookPluginConfig.php +1 -1
- facebook-for-wordpress.php +1 -1
- languages/official-facebook-pixel-ar_AR.po +1 -1
- languages/official-facebook-pixel-cs_CZ.po +1 -1
- languages/official-facebook-pixel-da_DK.po +1 -1
- languages/official-facebook-pixel-de_DE.po +1 -1
- languages/official-facebook-pixel-en_GB.po +1 -1
- languages/official-facebook-pixel-es_ES.po +1 -1
- languages/official-facebook-pixel-es_LA.po +1 -1
- languages/official-facebook-pixel-fi_FI.po +1 -1
- languages/official-facebook-pixel-fr_CA.po +1 -1
- languages/official-facebook-pixel-fr_FR.po +1 -1
- languages/official-facebook-pixel-he_IL.po +1 -1
- languages/official-facebook-pixel-it_IT.po +1 -1
- languages/official-facebook-pixel-ja_JP.po +1 -1
- languages/official-facebook-pixel-ko_KR.po +1 -1
- languages/official-facebook-pixel-nb_NO.po +1 -1
- languages/official-facebook-pixel-nl_NL.po +1 -1
- languages/official-facebook-pixel-pl_PL.po +1 -1
- languages/official-facebook-pixel-pt_BR.po +1 -1
- languages/official-facebook-pixel-pt_PT.po +1 -1
- languages/official-facebook-pixel-ru_RU.po +1 -1
- languages/official-facebook-pixel-sv_SE.po +1 -1
- languages/official-facebook-pixel-th_TH.po +1 -1
- languages/official-facebook-pixel-tr_TR.po +1 -1
- languages/official-facebook-pixel-vi_VN.po +1 -1
- languages/official-facebook-pixel-zh_CN.po +1 -1
- languages/official-facebook-pixel-zh_TW.po +1 -1
- readme.txt +4 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_files.php +0 -13
- vendor/composer/autoload_psr4.php +0 -5
- vendor/composer/autoload_real.php +4 -22
- vendor/composer/autoload_static.php +4 -42
- vendor/composer/installed.json +0 -371
- vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/AsyncClient.php +0 -53
- vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/BatchProcessor.php +0 -121
- vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/EventRequestAsync.php +0 -89
- vendor/facebook/php-business-sdk/test/FacebookAdsTest/Object/ServerSide/AsyncClientTest.php +0 -58
- vendor/facebook/php-business-sdk/test/FacebookAdsTest/Object/ServerSide/BatchProcessorTest.php +0 -166
- vendor/facebook/php-business-sdk/test/FacebookAdsTest/Object/ServerSide/EventRequestAsyncTest.php +0 -97
- vendor/guzzlehttp/guzzle/CHANGELOG.md +0 -1450
- vendor/guzzlehttp/guzzle/LICENSE +0 -19
- vendor/guzzlehttp/guzzle/README.md +0 -79
- vendor/guzzlehttp/guzzle/UPGRADING.md +0 -1253
- vendor/guzzlehttp/guzzle/composer.json +0 -72
- vendor/guzzlehttp/guzzle/src/BodySummarizer.php +0 -28
- vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php +0 -13
- vendor/guzzlehttp/guzzle/src/Client.php +0 -474
- vendor/guzzlehttp/guzzle/src/ClientInterface.php +0 -84
- vendor/guzzlehttp/guzzle/src/ClientTrait.php +0 -241
- vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php +0 -313
- vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +0 -79
- vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php +0 -101
- vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +0 -77
- vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +0 -410
- vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php +0 -39
- vendor/guzzlehttp/guzzle/src/Exception/ClientException.php +0 -10
- vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php +0 -56
- vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php +0 -9
- vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php +0 -7
- vendor/guzzlehttp/guzzle/src/Exception/RequestException.php +0 -166
- vendor/guzzlehttp/guzzle/src/Exception/ServerException.php +0 -10
- vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php +0 -7
- vendor/guzzlehttp/guzzle/src/Exception/TransferException.php +0 -7
- vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +0 -586
- vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php +0 -25
- vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php +0 -49
- vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +0 -253
- vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php +0 -118
- vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php +0 -211
- vendor/guzzlehttp/guzzle/src/Handler/Proxy.php +0 -51
- vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +0 -527
- vendor/guzzlehttp/guzzle/src/HandlerStack.php +0 -271
- vendor/guzzlehttp/guzzle/src/MessageFormatter.php +0 -198
- vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php +0 -18
- vendor/guzzlehttp/guzzle/src/Middleware.php +0 -260
- vendor/guzzlehttp/guzzle/src/Pool.php +0 -125
- vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php +0 -104
- vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php +0 -216
- vendor/guzzlehttp/guzzle/src/RequestOptions.php +0 -264
- vendor/guzzlehttp/guzzle/src/RetryMiddleware.php +0 -116
- vendor/guzzlehttp/guzzle/src/TransferStats.php +0 -133
- vendor/guzzlehttp/guzzle/src/Utils.php +0 -387
- vendor/guzzlehttp/guzzle/src/functions.php +0 -167
- vendor/guzzlehttp/guzzle/src/functions_include.php +0 -6
- vendor/guzzlehttp/promises/.php_cs.dist +0 -88
- vendor/guzzlehttp/promises/CHANGELOG.md +0 -81
- vendor/guzzlehttp/promises/LICENSE +0 -19
- vendor/guzzlehttp/promises/Makefile +0 -13
- vendor/guzzlehttp/promises/README.md +0 -532
- vendor/guzzlehttp/promises/composer.json +0 -39
- vendor/guzzlehttp/promises/phpstan-baseline.neon +0 -7
- vendor/guzzlehttp/promises/phpstan.neon.dist +0 -10
- vendor/guzzlehttp/promises/psalm.xml +0 -15
- vendor/guzzlehttp/promises/src/AggregateException.php +0 -17
- vendor/guzzlehttp/promises/src/CancellationException.php +0 -10
- vendor/guzzlehttp/promises/src/Coroutine.php +0 -169
- vendor/guzzlehttp/promises/src/Create.php +0 -84
- vendor/guzzlehttp/promises/src/Each.php +0 -90
- vendor/guzzlehttp/promises/src/EachPromise.php +0 -253
- vendor/guzzlehttp/promises/src/FulfilledPromise.php +0 -84
- vendor/guzzlehttp/promises/src/Is.php +0 -46
- vendor/guzzlehttp/promises/src/Promise.php +0 -278
- vendor/guzzlehttp/promises/src/PromiseInterface.php +0 -97
- vendor/guzzlehttp/promises/src/PromisorInterface.php +0 -16
- vendor/guzzlehttp/promises/src/RejectedPromise.php +0 -91
- vendor/guzzlehttp/promises/src/RejectionException.php +0 -48
- vendor/guzzlehttp/promises/src/TaskQueue.php +0 -67
- vendor/guzzlehttp/promises/src/TaskQueueInterface.php +0 -24
- vendor/guzzlehttp/promises/src/Utils.php +0 -274
- vendor/guzzlehttp/promises/src/functions.php +0 -363
- vendor/guzzlehttp/promises/src/functions_include.php +0 -6
- vendor/guzzlehttp/psr7/CHANGELOG.md +0 -270
- vendor/guzzlehttp/psr7/LICENSE +0 -19
- vendor/guzzlehttp/psr7/README.md +0 -809
- vendor/guzzlehttp/psr7/composer.json +0 -49
- vendor/guzzlehttp/psr7/src/AppendStream.php +0 -244
- vendor/guzzlehttp/psr7/src/BufferStream.php +0 -140
- vendor/guzzlehttp/psr7/src/CachingStream.php +0 -139
- vendor/guzzlehttp/psr7/src/DroppingStream.php +0 -43
- vendor/guzzlehttp/psr7/src/FnStream.php +0 -160
- vendor/guzzlehttp/psr7/src/Header.php +0 -71
- vendor/guzzlehttp/psr7/src/InflateStream.php +0 -53
- vendor/guzzlehttp/psr7/src/LazyOpenStream.php +0 -40
- vendor/guzzlehttp/psr7/src/LimitStream.php +0 -156
- vendor/guzzlehttp/psr7/src/Message.php +0 -252
- vendor/guzzlehttp/psr7/src/MessageTrait.php +0 -214
- vendor/guzzlehttp/psr7/src/MimeType.php +0 -140
- vendor/guzzlehttp/psr7/src/MultipartStream.php +0 -154
- vendor/guzzlehttp/psr7/src/NoSeekStream.php +0 -23
- vendor/guzzlehttp/psr7/src/PumpStream.php +0 -168
- vendor/guzzlehttp/psr7/src/Query.php +0 -108
- vendor/guzzlehttp/psr7/src/Request.php +0 -152
- vendor/guzzlehttp/psr7/src/Response.php +0 -155
- vendor/guzzlehttp/psr7/src/Rfc7230.php +0 -18
- vendor/guzzlehttp/psr7/src/ServerRequest.php +0 -378
- vendor/guzzlehttp/psr7/src/Stream.php +0 -270
- vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php +0 -151
- vendor/guzzlehttp/psr7/src/StreamWrapper.php +0 -163
- vendor/guzzlehttp/psr7/src/UploadedFile.php +0 -325
- vendor/guzzlehttp/psr7/src/Uri.php +0 -761
- vendor/guzzlehttp/psr7/src/UriNormalizer.php +0 -217
- vendor/guzzlehttp/psr7/src/UriResolver.php +0 -220
- vendor/guzzlehttp/psr7/src/Utils.php +0 -398
- vendor/guzzlehttp/psr7/src/functions.php +0 -417
- vendor/guzzlehttp/psr7/src/functions_include.php +0 -6
- vendor/psr/http-client/CHANGELOG.md +0 -23
- vendor/psr/http-client/LICENSE +0 -19
- vendor/psr/http-client/README.md +0 -12
- vendor/psr/http-client/composer.json +0 -27
- vendor/psr/http-client/src/ClientExceptionInterface.php +0 -10
- vendor/psr/http-client/src/ClientInterface.php +0 -20
- vendor/psr/http-client/src/NetworkExceptionInterface.php +0 -24
- vendor/psr/http-client/src/RequestExceptionInterface.php +0 -24
- vendor/psr/http-message/CHANGELOG.md +0 -36
- vendor/psr/http-message/LICENSE +0 -19
- vendor/psr/http-message/README.md +0 -13
- vendor/psr/http-message/composer.json +0 -26
- vendor/psr/http-message/src/MessageInterface.php +0 -187
- vendor/psr/http-message/src/RequestInterface.php +0 -129
- vendor/psr/http-message/src/ResponseInterface.php +0 -68
- vendor/psr/http-message/src/ServerRequestInterface.php +0 -261
- vendor/psr/http-message/src/StreamInterface.php +0 -158
- vendor/psr/http-message/src/UploadedFileInterface.php +0 -123
- vendor/psr/http-message/src/UriInterface.php +0 -323
- vendor/ralouphie/getallheaders/LICENSE +0 -21
- vendor/ralouphie/getallheaders/README.md +0 -27
- vendor/ralouphie/getallheaders/composer.json +0 -26
- vendor/ralouphie/getallheaders/src/getallheaders.php +0 -46
changelog.txt
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
*** Facebook for WordPress Changelog ***
|
|
|
|
|
|
|
2 |
2021-01-28 version 3.0.1
|
3 |
* Support for WordPress 5.6
|
4 |
* Adding banner for plugin review
|
1 |
*** Facebook for WordPress Changelog ***
|
2 |
+
2021-02-09 version 3.0.2
|
3 |
+
* Removing Guzzle dependency
|
4 |
+
|
5 |
2021-01-28 version 3.0.1
|
6 |
* Support for WordPress 5.6
|
7 |
* Adding banner for plugin review
|
composer.json
CHANGED
@@ -24,5 +24,8 @@
|
|
24 |
"__tests__/",
|
25 |
"./"
|
26 |
]
|
|
|
|
|
|
|
27 |
}
|
28 |
}
|
24 |
"__tests__/",
|
25 |
"./"
|
26 |
]
|
27 |
+
},
|
28 |
+
"replace": {
|
29 |
+
"guzzlehttp/guzzle": "*"
|
30 |
}
|
31 |
}
|
composer.lock
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
-
"content-hash": "
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "facebook/php-business-sdk",
|
@@ -47,365 +47,6 @@
|
|
47 |
],
|
48 |
"time": "2021-01-14T00:20:35+00:00"
|
49 |
},
|
50 |
-
{
|
51 |
-
"name": "guzzlehttp/guzzle",
|
52 |
-
"version": "7.2.0",
|
53 |
-
"source": {
|
54 |
-
"type": "git",
|
55 |
-
"url": "https://github.com/guzzle/guzzle.git",
|
56 |
-
"reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79"
|
57 |
-
},
|
58 |
-
"dist": {
|
59 |
-
"type": "zip",
|
60 |
-
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79",
|
61 |
-
"reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79",
|
62 |
-
"shasum": ""
|
63 |
-
},
|
64 |
-
"require": {
|
65 |
-
"ext-json": "*",
|
66 |
-
"guzzlehttp/promises": "^1.4",
|
67 |
-
"guzzlehttp/psr7": "^1.7",
|
68 |
-
"php": "^7.2.5 || ^8.0",
|
69 |
-
"psr/http-client": "^1.0"
|
70 |
-
},
|
71 |
-
"provide": {
|
72 |
-
"psr/http-client-implementation": "1.0"
|
73 |
-
},
|
74 |
-
"require-dev": {
|
75 |
-
"ext-curl": "*",
|
76 |
-
"php-http/client-integration-tests": "^3.0",
|
77 |
-
"phpunit/phpunit": "^8.5.5 || ^9.3.5",
|
78 |
-
"psr/log": "^1.1"
|
79 |
-
},
|
80 |
-
"suggest": {
|
81 |
-
"ext-curl": "Required for CURL handler support",
|
82 |
-
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
|
83 |
-
"psr/log": "Required for using the Log middleware"
|
84 |
-
},
|
85 |
-
"type": "library",
|
86 |
-
"extra": {
|
87 |
-
"branch-alias": {
|
88 |
-
"dev-master": "7.1-dev"
|
89 |
-
}
|
90 |
-
},
|
91 |
-
"autoload": {
|
92 |
-
"psr-4": {
|
93 |
-
"GuzzleHttp\\": "src/"
|
94 |
-
},
|
95 |
-
"files": [
|
96 |
-
"src/functions_include.php"
|
97 |
-
]
|
98 |
-
},
|
99 |
-
"notification-url": "https://packagist.org/downloads/",
|
100 |
-
"license": [
|
101 |
-
"MIT"
|
102 |
-
],
|
103 |
-
"authors": [
|
104 |
-
{
|
105 |
-
"name": "Michael Dowling",
|
106 |
-
"email": "mtdowling@gmail.com",
|
107 |
-
"homepage": "https://github.com/mtdowling"
|
108 |
-
},
|
109 |
-
{
|
110 |
-
"name": "Márk Sági-Kazár",
|
111 |
-
"email": "mark.sagikazar@gmail.com",
|
112 |
-
"homepage": "https://sagikazarmark.hu"
|
113 |
-
}
|
114 |
-
],
|
115 |
-
"description": "Guzzle is a PHP HTTP client library",
|
116 |
-
"homepage": "http://guzzlephp.org/",
|
117 |
-
"keywords": [
|
118 |
-
"client",
|
119 |
-
"curl",
|
120 |
-
"framework",
|
121 |
-
"http",
|
122 |
-
"http client",
|
123 |
-
"psr-18",
|
124 |
-
"psr-7",
|
125 |
-
"rest",
|
126 |
-
"web service"
|
127 |
-
],
|
128 |
-
"funding": [
|
129 |
-
{
|
130 |
-
"url": "https://github.com/GrahamCampbell",
|
131 |
-
"type": "github"
|
132 |
-
},
|
133 |
-
{
|
134 |
-
"url": "https://github.com/Nyholm",
|
135 |
-
"type": "github"
|
136 |
-
},
|
137 |
-
{
|
138 |
-
"url": "https://github.com/alexeyshockov",
|
139 |
-
"type": "github"
|
140 |
-
},
|
141 |
-
{
|
142 |
-
"url": "https://github.com/gmponos",
|
143 |
-
"type": "github"
|
144 |
-
}
|
145 |
-
],
|
146 |
-
"time": "2020-10-10T11:47:56+00:00"
|
147 |
-
},
|
148 |
-
{
|
149 |
-
"name": "guzzlehttp/promises",
|
150 |
-
"version": "1.4.0",
|
151 |
-
"source": {
|
152 |
-
"type": "git",
|
153 |
-
"url": "https://github.com/guzzle/promises.git",
|
154 |
-
"reference": "60d379c243457e073cff02bc323a2a86cb355631"
|
155 |
-
},
|
156 |
-
"dist": {
|
157 |
-
"type": "zip",
|
158 |
-
"url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631",
|
159 |
-
"reference": "60d379c243457e073cff02bc323a2a86cb355631",
|
160 |
-
"shasum": ""
|
161 |
-
},
|
162 |
-
"require": {
|
163 |
-
"php": ">=5.5"
|
164 |
-
},
|
165 |
-
"require-dev": {
|
166 |
-
"symfony/phpunit-bridge": "^4.4 || ^5.1"
|
167 |
-
},
|
168 |
-
"type": "library",
|
169 |
-
"extra": {
|
170 |
-
"branch-alias": {
|
171 |
-
"dev-master": "1.4-dev"
|
172 |
-
}
|
173 |
-
},
|
174 |
-
"autoload": {
|
175 |
-
"psr-4": {
|
176 |
-
"GuzzleHttp\\Promise\\": "src/"
|
177 |
-
},
|
178 |
-
"files": [
|
179 |
-
"src/functions_include.php"
|
180 |
-
]
|
181 |
-
},
|
182 |
-
"notification-url": "https://packagist.org/downloads/",
|
183 |
-
"license": [
|
184 |
-
"MIT"
|
185 |
-
],
|
186 |
-
"authors": [
|
187 |
-
{
|
188 |
-
"name": "Michael Dowling",
|
189 |
-
"email": "mtdowling@gmail.com",
|
190 |
-
"homepage": "https://github.com/mtdowling"
|
191 |
-
}
|
192 |
-
],
|
193 |
-
"description": "Guzzle promises library",
|
194 |
-
"keywords": [
|
195 |
-
"promise"
|
196 |
-
],
|
197 |
-
"time": "2020-09-30T07:37:28+00:00"
|
198 |
-
},
|
199 |
-
{
|
200 |
-
"name": "guzzlehttp/psr7",
|
201 |
-
"version": "1.7.0",
|
202 |
-
"source": {
|
203 |
-
"type": "git",
|
204 |
-
"url": "https://github.com/guzzle/psr7.git",
|
205 |
-
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3"
|
206 |
-
},
|
207 |
-
"dist": {
|
208 |
-
"type": "zip",
|
209 |
-
"url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3",
|
210 |
-
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3",
|
211 |
-
"shasum": ""
|
212 |
-
},
|
213 |
-
"require": {
|
214 |
-
"php": ">=5.4.0",
|
215 |
-
"psr/http-message": "~1.0",
|
216 |
-
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
|
217 |
-
},
|
218 |
-
"provide": {
|
219 |
-
"psr/http-message-implementation": "1.0"
|
220 |
-
},
|
221 |
-
"require-dev": {
|
222 |
-
"ext-zlib": "*",
|
223 |
-
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
|
224 |
-
},
|
225 |
-
"suggest": {
|
226 |
-
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
|
227 |
-
},
|
228 |
-
"type": "library",
|
229 |
-
"extra": {
|
230 |
-
"branch-alias": {
|
231 |
-
"dev-master": "1.7-dev"
|
232 |
-
}
|
233 |
-
},
|
234 |
-
"autoload": {
|
235 |
-
"psr-4": {
|
236 |
-
"GuzzleHttp\\Psr7\\": "src/"
|
237 |
-
},
|
238 |
-
"files": [
|
239 |
-
"src/functions_include.php"
|
240 |
-
]
|
241 |
-
},
|
242 |
-
"notification-url": "https://packagist.org/downloads/",
|
243 |
-
"license": [
|
244 |
-
"MIT"
|
245 |
-
],
|
246 |
-
"authors": [
|
247 |
-
{
|
248 |
-
"name": "Michael Dowling",
|
249 |
-
"email": "mtdowling@gmail.com",
|
250 |
-
"homepage": "https://github.com/mtdowling"
|
251 |
-
},
|
252 |
-
{
|
253 |
-
"name": "Tobias Schultze",
|
254 |
-
"homepage": "https://github.com/Tobion"
|
255 |
-
}
|
256 |
-
],
|
257 |
-
"description": "PSR-7 message implementation that also provides common utility methods",
|
258 |
-
"keywords": [
|
259 |
-
"http",
|
260 |
-
"message",
|
261 |
-
"psr-7",
|
262 |
-
"request",
|
263 |
-
"response",
|
264 |
-
"stream",
|
265 |
-
"uri",
|
266 |
-
"url"
|
267 |
-
],
|
268 |
-
"time": "2020-09-30T07:37:11+00:00"
|
269 |
-
},
|
270 |
-
{
|
271 |
-
"name": "psr/http-client",
|
272 |
-
"version": "1.0.1",
|
273 |
-
"source": {
|
274 |
-
"type": "git",
|
275 |
-
"url": "https://github.com/php-fig/http-client.git",
|
276 |
-
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
|
277 |
-
},
|
278 |
-
"dist": {
|
279 |
-
"type": "zip",
|
280 |
-
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
|
281 |
-
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
|
282 |
-
"shasum": ""
|
283 |
-
},
|
284 |
-
"require": {
|
285 |
-
"php": "^7.0 || ^8.0",
|
286 |
-
"psr/http-message": "^1.0"
|
287 |
-
},
|
288 |
-
"type": "library",
|
289 |
-
"extra": {
|
290 |
-
"branch-alias": {
|
291 |
-
"dev-master": "1.0.x-dev"
|
292 |
-
}
|
293 |
-
},
|
294 |
-
"autoload": {
|
295 |
-
"psr-4": {
|
296 |
-
"Psr\\Http\\Client\\": "src/"
|
297 |
-
}
|
298 |
-
},
|
299 |
-
"notification-url": "https://packagist.org/downloads/",
|
300 |
-
"license": [
|
301 |
-
"MIT"
|
302 |
-
],
|
303 |
-
"authors": [
|
304 |
-
{
|
305 |
-
"name": "PHP-FIG",
|
306 |
-
"homepage": "http://www.php-fig.org/"
|
307 |
-
}
|
308 |
-
],
|
309 |
-
"description": "Common interface for HTTP clients",
|
310 |
-
"homepage": "https://github.com/php-fig/http-client",
|
311 |
-
"keywords": [
|
312 |
-
"http",
|
313 |
-
"http-client",
|
314 |
-
"psr",
|
315 |
-
"psr-18"
|
316 |
-
],
|
317 |
-
"time": "2020-06-29T06:28:15+00:00"
|
318 |
-
},
|
319 |
-
{
|
320 |
-
"name": "psr/http-message",
|
321 |
-
"version": "1.0.1",
|
322 |
-
"source": {
|
323 |
-
"type": "git",
|
324 |
-
"url": "https://github.com/php-fig/http-message.git",
|
325 |
-
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
326 |
-
},
|
327 |
-
"dist": {
|
328 |
-
"type": "zip",
|
329 |
-
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
330 |
-
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
331 |
-
"shasum": ""
|
332 |
-
},
|
333 |
-
"require": {
|
334 |
-
"php": ">=5.3.0"
|
335 |
-
},
|
336 |
-
"type": "library",
|
337 |
-
"extra": {
|
338 |
-
"branch-alias": {
|
339 |
-
"dev-master": "1.0.x-dev"
|
340 |
-
}
|
341 |
-
},
|
342 |
-
"autoload": {
|
343 |
-
"psr-4": {
|
344 |
-
"Psr\\Http\\Message\\": "src/"
|
345 |
-
}
|
346 |
-
},
|
347 |
-
"notification-url": "https://packagist.org/downloads/",
|
348 |
-
"license": [
|
349 |
-
"MIT"
|
350 |
-
],
|
351 |
-
"authors": [
|
352 |
-
{
|
353 |
-
"name": "PHP-FIG",
|
354 |
-
"homepage": "http://www.php-fig.org/"
|
355 |
-
}
|
356 |
-
],
|
357 |
-
"description": "Common interface for HTTP messages",
|
358 |
-
"homepage": "https://github.com/php-fig/http-message",
|
359 |
-
"keywords": [
|
360 |
-
"http",
|
361 |
-
"http-message",
|
362 |
-
"psr",
|
363 |
-
"psr-7",
|
364 |
-
"request",
|
365 |
-
"response"
|
366 |
-
],
|
367 |
-
"time": "2016-08-06T14:39:51+00:00"
|
368 |
-
},
|
369 |
-
{
|
370 |
-
"name": "ralouphie/getallheaders",
|
371 |
-
"version": "3.0.3",
|
372 |
-
"source": {
|
373 |
-
"type": "git",
|
374 |
-
"url": "https://github.com/ralouphie/getallheaders.git",
|
375 |
-
"reference": "120b605dfeb996808c31b6477290a714d356e822"
|
376 |
-
},
|
377 |
-
"dist": {
|
378 |
-
"type": "zip",
|
379 |
-
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
|
380 |
-
"reference": "120b605dfeb996808c31b6477290a714d356e822",
|
381 |
-
"shasum": ""
|
382 |
-
},
|
383 |
-
"require": {
|
384 |
-
"php": ">=5.6"
|
385 |
-
},
|
386 |
-
"require-dev": {
|
387 |
-
"php-coveralls/php-coveralls": "^2.1",
|
388 |
-
"phpunit/phpunit": "^5 || ^6.5"
|
389 |
-
},
|
390 |
-
"type": "library",
|
391 |
-
"autoload": {
|
392 |
-
"files": [
|
393 |
-
"src/getallheaders.php"
|
394 |
-
]
|
395 |
-
},
|
396 |
-
"notification-url": "https://packagist.org/downloads/",
|
397 |
-
"license": [
|
398 |
-
"MIT"
|
399 |
-
],
|
400 |
-
"authors": [
|
401 |
-
{
|
402 |
-
"name": "Ralph Khattar",
|
403 |
-
"email": "ralph.khattar@gmail.com"
|
404 |
-
}
|
405 |
-
],
|
406 |
-
"description": "A polyfill for getallheaders.",
|
407 |
-
"time": "2019-03-08T08:55:37+00:00"
|
408 |
-
},
|
409 |
{
|
410 |
"name": "techcrunch/wp-async-task",
|
411 |
"version": "dev-master",
|
4 |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
+
"content-hash": "8f4e59db4fb83d9835136e3e476bfcb3",
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "facebook/php-business-sdk",
|
47 |
],
|
48 |
"time": "2021-01-14T00:20:35+00:00"
|
49 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
{
|
51 |
"name": "techcrunch/wp-async-task",
|
52 |
"version": "dev-master",
|
core/FacebookPluginConfig.php
CHANGED
@@ -20,7 +20,7 @@ namespace FacebookPixelPlugin\Core;
|
|
20 |
defined('ABSPATH') or die('Direct access not allowed');
|
21 |
|
22 |
class FacebookPluginConfig {
|
23 |
-
const PLUGIN_VERSION = '3.0.
|
24 |
const SOURCE = 'wordpress';
|
25 |
const TEXT_DOMAIN = 'official-facebook-pixel';
|
26 |
const PLUGIN_NAME = 'Facebook for WordPress';
|
20 |
defined('ABSPATH') or die('Direct access not allowed');
|
21 |
|
22 |
class FacebookPluginConfig {
|
23 |
+
const PLUGIN_VERSION = '3.0.2';
|
24 |
const SOURCE = 'wordpress';
|
25 |
const TEXT_DOMAIN = 'official-facebook-pixel';
|
26 |
const PLUGIN_NAME = 'Facebook for WordPress';
|
facebook-for-wordpress.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: <strong><em>***ATTENTION: After upgrade the plugin may be deactivated due to a known issue, to workaround please refresh this page and activate plugin.***</em></strong> The Facebook pixel is an analytics tool that helps you measure the effectiveness of your advertising. You can use the Facebook pixel to understand the actions people are taking on your website and reach audiences you care about.
|
6 |
* Author: Facebook
|
7 |
* Author URI: https://www.facebook.com/
|
8 |
-
* Version: 3.0.
|
9 |
* Text Domain: official-facebook-pixel
|
10 |
*/
|
11 |
|
5 |
* Description: <strong><em>***ATTENTION: After upgrade the plugin may be deactivated due to a known issue, to workaround please refresh this page and activate plugin.***</em></strong> The Facebook pixel is an analytics tool that helps you measure the effectiveness of your advertising. You can use the Facebook pixel to understand the actions people are taking on your website and reach audiences you care about.
|
6 |
* Author: Facebook
|
7 |
* Author URI: https://www.facebook.com/
|
8 |
+
* Version: 3.0.2
|
9 |
* Text Domain: official-facebook-pixel
|
10 |
*/
|
11 |
|
languages/official-facebook-pixel-ar_AR.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-cs_CZ.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-da_DK.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-de_DE.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-en_GB.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-es_ES.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-es_LA.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-fi_FI.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-fr_CA.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-fr_FR.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-he_IL.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-it_IT.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-ja_JP.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-ko_KR.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-nb_NO.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-nl_NL.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-pl_PL.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-pt_BR.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-pt_PT.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-ru_RU.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-sv_SE.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-th_TH.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-pixel\n"
|
7 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
8 |
"PO-Revision-Date: 2018-11-28 17:37-0800\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-pixel\n"
|
7 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
8 |
"PO-Revision-Date: 2018-11-28 17:37-0800\n"
|
languages/official-facebook-pixel-tr_TR.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-vi_VN.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-zh_CN.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
languages/official-facebook-pixel-zh_TW.po
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Facebook for WordPress 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
2 |
# This file is distributed under the same license as the Facebook Pixel package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Facebook for WordPress 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/official-facebook-"
|
7 |
"pixel\n"
|
8 |
"POT-Creation-Date: 2018-11-29 01:26:28+00:00\n"
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: Facebook, Facebook Conversion Pixel, Facebook Pixel, Facebook Pixel Events
|
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 5.6
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -57,6 +57,9 @@ If you get stuck, or have any questions, you can ask for help in the [Facebook f
|
|
57 |
Of course! This plugin is open sourced on the Facebook Incubator GitHub. You can find the code and contribution instructions in the [plugin repository](https://github.com/facebookincubator/Facebook-Pixel-for-WordPress).
|
58 |
|
59 |
== Changelog ==
|
|
|
|
|
|
|
60 |
= 2021-01-28 version 3.0.1 =
|
61 |
* Support for WordPress 5.6
|
62 |
* Adding banner for plugin review
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 5.6
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 3.0.1
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
57 |
Of course! This plugin is open sourced on the Facebook Incubator GitHub. You can find the code and contribution instructions in the [plugin repository](https://github.com/facebookincubator/Facebook-Pixel-for-WordPress).
|
58 |
|
59 |
== Changelog ==
|
60 |
+
= 2021-02-09 version 3.0.2 =
|
61 |
+
* Removing Guzzle dependency
|
62 |
+
|
63 |
= 2021-01-28 version 3.0.1 =
|
64 |
* Support for WordPress 5.6
|
65 |
* Adding banner for plugin review
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit1a1a8abeac5549101724112e56b57281::getLoader();
|
vendor/composer/autoload_files.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_files.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
|
10 |
-
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
|
11 |
-
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
|
12 |
-
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
|
13 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -6,11 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
-
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
|
10 |
-
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
|
11 |
-
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
|
12 |
-
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
|
13 |
-
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
14 |
'FacebookPixelPlugin\\Integration\\' => array($baseDir . '/integration'),
|
15 |
'FacebookPixelPlugin\\Core\\' => array($baseDir . '/core'),
|
16 |
'FacebookPixelPlugin\\' => array($baseDir . '/'),
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
|
|
|
|
|
|
|
|
9 |
'FacebookPixelPlugin\\Integration\\' => array($baseDir . '/integration'),
|
10 |
'FacebookPixelPlugin\\Core\\' => array($baseDir . '/core'),
|
11 |
'FacebookPixelPlugin\\' => array($baseDir . '/'),
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit251289fac33e7f76f7bddc11271dd50f
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
spl_autoload_register(array('
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
-
spl_autoload_unregister(array('
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
-
call_user_func(\Composer\Autoload\
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
@@ -50,24 +50,6 @@ class ComposerAutoloaderInit251289fac33e7f76f7bddc11271dd50f
|
|
50 |
|
51 |
$loader->register(true);
|
52 |
|
53 |
-
if ($useStaticLoader) {
|
54 |
-
$includeFiles = Composer\Autoload\ComposerStaticInit251289fac33e7f76f7bddc11271dd50f::$files;
|
55 |
-
} else {
|
56 |
-
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
-
}
|
58 |
-
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
-
composerRequire251289fac33e7f76f7bddc11271dd50f($fileIdentifier, $file);
|
60 |
-
}
|
61 |
-
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
-
|
66 |
-
function composerRequire251289fac33e7f76f7bddc11271dd50f($fileIdentifier, $file)
|
67 |
-
{
|
68 |
-
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
69 |
-
require $file;
|
70 |
-
|
71 |
-
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
72 |
-
}
|
73 |
-
}
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit1a1a8abeac5549101724112e56b57281
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInit1a1a8abeac5549101724112e56b57281', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit1a1a8abeac5549101724112e56b57281', 'loadClassLoader'));
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit1a1a8abeac5549101724112e56b57281::getInitializer($loader));
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
50 |
|
51 |
$loader->register(true);
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
return $loader;
|
54 |
}
|
55 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,27 +4,9 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
-
public static $files = array (
|
10 |
-
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
11 |
-
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
|
12 |
-
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
|
13 |
-
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
|
14 |
-
);
|
15 |
-
|
16 |
public static $prefixLengthsPsr4 = array (
|
17 |
-
'P' =>
|
18 |
-
array (
|
19 |
-
'Psr\\Http\\Message\\' => 17,
|
20 |
-
'Psr\\Http\\Client\\' => 16,
|
21 |
-
),
|
22 |
-
'G' =>
|
23 |
-
array (
|
24 |
-
'GuzzleHttp\\Psr7\\' => 16,
|
25 |
-
'GuzzleHttp\\Promise\\' => 19,
|
26 |
-
'GuzzleHttp\\' => 11,
|
27 |
-
),
|
28 |
'F' =>
|
29 |
array (
|
30 |
'FacebookPixelPlugin\\Integration\\' => 32,
|
@@ -35,26 +17,6 @@ class ComposerStaticInit251289fac33e7f76f7bddc11271dd50f
|
|
35 |
);
|
36 |
|
37 |
public static $prefixDirsPsr4 = array (
|
38 |
-
'Psr\\Http\\Message\\' =>
|
39 |
-
array (
|
40 |
-
0 => __DIR__ . '/..' . '/psr/http-message/src',
|
41 |
-
),
|
42 |
-
'Psr\\Http\\Client\\' =>
|
43 |
-
array (
|
44 |
-
0 => __DIR__ . '/..' . '/psr/http-client/src',
|
45 |
-
),
|
46 |
-
'GuzzleHttp\\Psr7\\' =>
|
47 |
-
array (
|
48 |
-
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
|
49 |
-
),
|
50 |
-
'GuzzleHttp\\Promise\\' =>
|
51 |
-
array (
|
52 |
-
0 => __DIR__ . '/..' . '/guzzlehttp/promises/src',
|
53 |
-
),
|
54 |
-
'GuzzleHttp\\' =>
|
55 |
-
array (
|
56 |
-
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
|
57 |
-
),
|
58 |
'FacebookPixelPlugin\\Integration\\' =>
|
59 |
array (
|
60 |
0 => __DIR__ . '/../..' . '/integration',
|
@@ -80,9 +42,9 @@ class ComposerStaticInit251289fac33e7f76f7bddc11271dd50f
|
|
80 |
public static function getInitializer(ClassLoader $loader)
|
81 |
{
|
82 |
return \Closure::bind(function () use ($loader) {
|
83 |
-
$loader->prefixLengthsPsr4 =
|
84 |
-
$loader->prefixDirsPsr4 =
|
85 |
-
$loader->classMap =
|
86 |
|
87 |
}, null, ClassLoader::class);
|
88 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit1a1a8abeac5549101724112e56b57281
|
8 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
public static $prefixLengthsPsr4 = array (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
'F' =>
|
11 |
array (
|
12 |
'FacebookPixelPlugin\\Integration\\' => 32,
|
17 |
);
|
18 |
|
19 |
public static $prefixDirsPsr4 = array (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
'FacebookPixelPlugin\\Integration\\' =>
|
21 |
array (
|
22 |
0 => __DIR__ . '/../..' . '/integration',
|
42 |
public static function getInitializer(ClassLoader $loader)
|
43 |
{
|
44 |
return \Closure::bind(function () use ($loader) {
|
45 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit1a1a8abeac5549101724112e56b57281::$prefixLengthsPsr4;
|
46 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit1a1a8abeac5549101724112e56b57281::$prefixDirsPsr4;
|
47 |
+
$loader->classMap = ComposerStaticInit1a1a8abeac5549101724112e56b57281::$classMap;
|
48 |
|
49 |
}, null, ClassLoader::class);
|
50 |
}
|
vendor/composer/installed.json
CHANGED
@@ -42,377 +42,6 @@
|
|
42 |
"sdk"
|
43 |
]
|
44 |
},
|
45 |
-
{
|
46 |
-
"name": "guzzlehttp/guzzle",
|
47 |
-
"version": "7.2.0",
|
48 |
-
"version_normalized": "7.2.0.0",
|
49 |
-
"source": {
|
50 |
-
"type": "git",
|
51 |
-
"url": "https://github.com/guzzle/guzzle.git",
|
52 |
-
"reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79"
|
53 |
-
},
|
54 |
-
"dist": {
|
55 |
-
"type": "zip",
|
56 |
-
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79",
|
57 |
-
"reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79",
|
58 |
-
"shasum": ""
|
59 |
-
},
|
60 |
-
"require": {
|
61 |
-
"ext-json": "*",
|
62 |
-
"guzzlehttp/promises": "^1.4",
|
63 |
-
"guzzlehttp/psr7": "^1.7",
|
64 |
-
"php": "^7.2.5 || ^8.0",
|
65 |
-
"psr/http-client": "^1.0"
|
66 |
-
},
|
67 |
-
"provide": {
|
68 |
-
"psr/http-client-implementation": "1.0"
|
69 |
-
},
|
70 |
-
"require-dev": {
|
71 |
-
"ext-curl": "*",
|
72 |
-
"php-http/client-integration-tests": "^3.0",
|
73 |
-
"phpunit/phpunit": "^8.5.5 || ^9.3.5",
|
74 |
-
"psr/log": "^1.1"
|
75 |
-
},
|
76 |
-
"suggest": {
|
77 |
-
"ext-curl": "Required for CURL handler support",
|
78 |
-
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
|
79 |
-
"psr/log": "Required for using the Log middleware"
|
80 |
-
},
|
81 |
-
"time": "2020-10-10T11:47:56+00:00",
|
82 |
-
"type": "library",
|
83 |
-
"extra": {
|
84 |
-
"branch-alias": {
|
85 |
-
"dev-master": "7.1-dev"
|
86 |
-
}
|
87 |
-
},
|
88 |
-
"installation-source": "dist",
|
89 |
-
"autoload": {
|
90 |
-
"psr-4": {
|
91 |
-
"GuzzleHttp\\": "src/"
|
92 |
-
},
|
93 |
-
"files": [
|
94 |
-
"src/functions_include.php"
|
95 |
-
]
|
96 |
-
},
|
97 |
-
"notification-url": "https://packagist.org/downloads/",
|
98 |
-
"license": [
|
99 |
-
"MIT"
|
100 |
-
],
|
101 |
-
"authors": [
|
102 |
-
{
|
103 |
-
"name": "Michael Dowling",
|
104 |
-
"email": "mtdowling@gmail.com",
|
105 |
-
"homepage": "https://github.com/mtdowling"
|
106 |
-
},
|
107 |
-
{
|
108 |
-
"name": "Márk Sági-Kazár",
|
109 |
-
"email": "mark.sagikazar@gmail.com",
|
110 |
-
"homepage": "https://sagikazarmark.hu"
|
111 |
-
}
|
112 |
-
],
|
113 |
-
"description": "Guzzle is a PHP HTTP client library",
|
114 |
-
"homepage": "http://guzzlephp.org/",
|
115 |
-
"keywords": [
|
116 |
-
"client",
|
117 |
-
"curl",
|
118 |
-
"framework",
|
119 |
-
"http",
|
120 |
-
"http client",
|
121 |
-
"psr-18",
|
122 |
-
"psr-7",
|
123 |
-
"rest",
|
124 |
-
"web service"
|
125 |
-
],
|
126 |
-
"funding": [
|
127 |
-
{
|
128 |
-
"url": "https://github.com/GrahamCampbell",
|
129 |
-
"type": "github"
|
130 |
-
},
|
131 |
-
{
|
132 |
-
"url": "https://github.com/Nyholm",
|
133 |
-
"type": "github"
|
134 |
-
},
|
135 |
-
{
|
136 |
-
"url": "https://github.com/alexeyshockov",
|
137 |
-
"type": "github"
|
138 |
-
},
|
139 |
-
{
|
140 |
-
"url": "https://github.com/gmponos",
|
141 |
-
"type": "github"
|
142 |
-
}
|
143 |
-
]
|
144 |
-
},
|
145 |
-
{
|
146 |
-
"name": "guzzlehttp/promises",
|
147 |
-
"version": "1.4.0",
|
148 |
-
"version_normalized": "1.4.0.0",
|
149 |
-
"source": {
|
150 |
-
"type": "git",
|
151 |
-
"url": "https://github.com/guzzle/promises.git",
|
152 |
-
"reference": "60d379c243457e073cff02bc323a2a86cb355631"
|
153 |
-
},
|
154 |
-
"dist": {
|
155 |
-
"type": "zip",
|
156 |
-
"url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631",
|
157 |
-
"reference": "60d379c243457e073cff02bc323a2a86cb355631",
|
158 |
-
"shasum": ""
|
159 |
-
},
|
160 |
-
"require": {
|
161 |
-
"php": ">=5.5"
|
162 |
-
},
|
163 |
-
"require-dev": {
|
164 |
-
"symfony/phpunit-bridge": "^4.4 || ^5.1"
|
165 |
-
},
|
166 |
-
"time": "2020-09-30T07:37:28+00:00",
|
167 |
-
"type": "library",
|
168 |
-
"extra": {
|
169 |
-
"branch-alias": {
|
170 |
-
"dev-master": "1.4-dev"
|
171 |
-
}
|
172 |
-
},
|
173 |
-
"installation-source": "dist",
|
174 |
-
"autoload": {
|
175 |
-
"psr-4": {
|
176 |
-
"GuzzleHttp\\Promise\\": "src/"
|
177 |
-
},
|
178 |
-
"files": [
|
179 |
-
"src/functions_include.php"
|
180 |
-
]
|
181 |
-
},
|
182 |
-
"notification-url": "https://packagist.org/downloads/",
|
183 |
-
"license": [
|
184 |
-
"MIT"
|
185 |
-
],
|
186 |
-
"authors": [
|
187 |
-
{
|
188 |
-
"name": "Michael Dowling",
|
189 |
-
"email": "mtdowling@gmail.com",
|
190 |
-
"homepage": "https://github.com/mtdowling"
|
191 |
-
}
|
192 |
-
],
|
193 |
-
"description": "Guzzle promises library",
|
194 |
-
"keywords": [
|
195 |
-
"promise"
|
196 |
-
]
|
197 |
-
},
|
198 |
-
{
|
199 |
-
"name": "guzzlehttp/psr7",
|
200 |
-
"version": "1.7.0",
|
201 |
-
"version_normalized": "1.7.0.0",
|
202 |
-
"source": {
|
203 |
-
"type": "git",
|
204 |
-
"url": "https://github.com/guzzle/psr7.git",
|
205 |
-
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3"
|
206 |
-
},
|
207 |
-
"dist": {
|
208 |
-
"type": "zip",
|
209 |
-
"url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3",
|
210 |
-
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3",
|
211 |
-
"shasum": ""
|
212 |
-
},
|
213 |
-
"require": {
|
214 |
-
"php": ">=5.4.0",
|
215 |
-
"psr/http-message": "~1.0",
|
216 |
-
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
|
217 |
-
},
|
218 |
-
"provide": {
|
219 |
-
"psr/http-message-implementation": "1.0"
|
220 |
-
},
|
221 |
-
"require-dev": {
|
222 |
-
"ext-zlib": "*",
|
223 |
-
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
|
224 |
-
},
|
225 |
-
"suggest": {
|
226 |
-
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
|
227 |
-
},
|
228 |
-
"time": "2020-09-30T07:37:11+00:00",
|
229 |
-
"type": "library",
|
230 |
-
"extra": {
|
231 |
-
"branch-alias": {
|
232 |
-
"dev-master": "1.7-dev"
|
233 |
-
}
|
234 |
-
},
|
235 |
-
"installation-source": "dist",
|
236 |
-
"autoload": {
|
237 |
-
"psr-4": {
|
238 |
-
"GuzzleHttp\\Psr7\\": "src/"
|
239 |
-
},
|
240 |
-
"files": [
|
241 |
-
"src/functions_include.php"
|
242 |
-
]
|
243 |
-
},
|
244 |
-
"notification-url": "https://packagist.org/downloads/",
|
245 |
-
"license": [
|
246 |
-
"MIT"
|
247 |
-
],
|
248 |
-
"authors": [
|
249 |
-
{
|
250 |
-
"name": "Michael Dowling",
|
251 |
-
"email": "mtdowling@gmail.com",
|
252 |
-
"homepage": "https://github.com/mtdowling"
|
253 |
-
},
|
254 |
-
{
|
255 |
-
"name": "Tobias Schultze",
|
256 |
-
"homepage": "https://github.com/Tobion"
|
257 |
-
}
|
258 |
-
],
|
259 |
-
"description": "PSR-7 message implementation that also provides common utility methods",
|
260 |
-
"keywords": [
|
261 |
-
"http",
|
262 |
-
"message",
|
263 |
-
"psr-7",
|
264 |
-
"request",
|
265 |
-
"response",
|
266 |
-
"stream",
|
267 |
-
"uri",
|
268 |
-
"url"
|
269 |
-
]
|
270 |
-
},
|
271 |
-
{
|
272 |
-
"name": "psr/http-client",
|
273 |
-
"version": "1.0.1",
|
274 |
-
"version_normalized": "1.0.1.0",
|
275 |
-
"source": {
|
276 |
-
"type": "git",
|
277 |
-
"url": "https://github.com/php-fig/http-client.git",
|
278 |
-
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
|
279 |
-
},
|
280 |
-
"dist": {
|
281 |
-
"type": "zip",
|
282 |
-
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
|
283 |
-
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
|
284 |
-
"shasum": ""
|
285 |
-
},
|
286 |
-
"require": {
|
287 |
-
"php": "^7.0 || ^8.0",
|
288 |
-
"psr/http-message": "^1.0"
|
289 |
-
},
|
290 |
-
"time": "2020-06-29T06:28:15+00:00",
|
291 |
-
"type": "library",
|
292 |
-
"extra": {
|
293 |
-
"branch-alias": {
|
294 |
-
"dev-master": "1.0.x-dev"
|
295 |
-
}
|
296 |
-
},
|
297 |
-
"installation-source": "dist",
|
298 |
-
"autoload": {
|
299 |
-
"psr-4": {
|
300 |
-
"Psr\\Http\\Client\\": "src/"
|
301 |
-
}
|
302 |
-
},
|
303 |
-
"notification-url": "https://packagist.org/downloads/",
|
304 |
-
"license": [
|
305 |
-
"MIT"
|
306 |
-
],
|
307 |
-
"authors": [
|
308 |
-
{
|
309 |
-
"name": "PHP-FIG",
|
310 |
-
"homepage": "http://www.php-fig.org/"
|
311 |
-
}
|
312 |
-
],
|
313 |
-
"description": "Common interface for HTTP clients",
|
314 |
-
"homepage": "https://github.com/php-fig/http-client",
|
315 |
-
"keywords": [
|
316 |
-
"http",
|
317 |
-
"http-client",
|
318 |
-
"psr",
|
319 |
-
"psr-18"
|
320 |
-
]
|
321 |
-
},
|
322 |
-
{
|
323 |
-
"name": "psr/http-message",
|
324 |
-
"version": "1.0.1",
|
325 |
-
"version_normalized": "1.0.1.0",
|
326 |
-
"source": {
|
327 |
-
"type": "git",
|
328 |
-
"url": "https://github.com/php-fig/http-message.git",
|
329 |
-
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
330 |
-
},
|
331 |
-
"dist": {
|
332 |
-
"type": "zip",
|
333 |
-
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
334 |
-
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
335 |
-
"shasum": ""
|
336 |
-
},
|
337 |
-
"require": {
|
338 |
-
"php": ">=5.3.0"
|
339 |
-
},
|
340 |
-
"time": "2016-08-06T14:39:51+00:00",
|
341 |
-
"type": "library",
|
342 |
-
"extra": {
|
343 |
-
"branch-alias": {
|
344 |
-
"dev-master": "1.0.x-dev"
|
345 |
-
}
|
346 |
-
},
|
347 |
-
"installation-source": "dist",
|
348 |
-
"autoload": {
|
349 |
-
"psr-4": {
|
350 |
-
"Psr\\Http\\Message\\": "src/"
|
351 |
-
}
|
352 |
-
},
|
353 |
-
"notification-url": "https://packagist.org/downloads/",
|
354 |
-
"license": [
|
355 |
-
"MIT"
|
356 |
-
],
|
357 |
-
"authors": [
|
358 |
-
{
|
359 |
-
"name": "PHP-FIG",
|
360 |
-
"homepage": "http://www.php-fig.org/"
|
361 |
-
}
|
362 |
-
],
|
363 |
-
"description": "Common interface for HTTP messages",
|
364 |
-
"homepage": "https://github.com/php-fig/http-message",
|
365 |
-
"keywords": [
|
366 |
-
"http",
|
367 |
-
"http-message",
|
368 |
-
"psr",
|
369 |
-
"psr-7",
|
370 |
-
"request",
|
371 |
-
"response"
|
372 |
-
]
|
373 |
-
},
|
374 |
-
{
|
375 |
-
"name": "ralouphie/getallheaders",
|
376 |
-
"version": "3.0.3",
|
377 |
-
"version_normalized": "3.0.3.0",
|
378 |
-
"source": {
|
379 |
-
"type": "git",
|
380 |
-
"url": "https://github.com/ralouphie/getallheaders.git",
|
381 |
-
"reference": "120b605dfeb996808c31b6477290a714d356e822"
|
382 |
-
},
|
383 |
-
"dist": {
|
384 |
-
"type": "zip",
|
385 |
-
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
|
386 |
-
"reference": "120b605dfeb996808c31b6477290a714d356e822",
|
387 |
-
"shasum": ""
|
388 |
-
},
|
389 |
-
"require": {
|
390 |
-
"php": ">=5.6"
|
391 |
-
},
|
392 |
-
"require-dev": {
|
393 |
-
"php-coveralls/php-coveralls": "^2.1",
|
394 |
-
"phpunit/phpunit": "^5 || ^6.5"
|
395 |
-
},
|
396 |
-
"time": "2019-03-08T08:55:37+00:00",
|
397 |
-
"type": "library",
|
398 |
-
"installation-source": "dist",
|
399 |
-
"autoload": {
|
400 |
-
"files": [
|
401 |
-
"src/getallheaders.php"
|
402 |
-
]
|
403 |
-
},
|
404 |
-
"notification-url": "https://packagist.org/downloads/",
|
405 |
-
"license": [
|
406 |
-
"MIT"
|
407 |
-
],
|
408 |
-
"authors": [
|
409 |
-
{
|
410 |
-
"name": "Ralph Khattar",
|
411 |
-
"email": "ralph.khattar@gmail.com"
|
412 |
-
}
|
413 |
-
],
|
414 |
-
"description": "A polyfill for getallheaders."
|
415 |
-
},
|
416 |
{
|
417 |
"name": "techcrunch/wp-async-task",
|
418 |
"version": "dev-master",
|
42 |
"sdk"
|
43 |
]
|
44 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
{
|
46 |
"name": "techcrunch/wp-async-task",
|
47 |
"version": "dev-master",
|
vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/AsyncClient.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
|
25 |
-
namespace FacebookAds\Object\ServerSide;
|
26 |
-
|
27 |
-
use FacebookAds\Api;
|
28 |
-
|
29 |
-
use GuzzleHttp\Client;
|
30 |
-
use GuzzleHttp\HandlerStack;
|
31 |
-
use GuzzleHttp\Handler\CurlHandler;
|
32 |
-
|
33 |
-
class AsyncClient extends Singleton {
|
34 |
-
protected $client = null;
|
35 |
-
|
36 |
-
public function __construct() {
|
37 |
-
$handler_stack = HandlerStack::create(new CurlHandler([
|
38 |
-
'options' => [
|
39 |
-
CURLOPT_CONNECTTIMEOUT => 10,
|
40 |
-
CURLOPT_TIMEOUT => 60,
|
41 |
-
CURLOPT_RETURNTRANSFER => true,
|
42 |
-
CURLOPT_HEADER => true,
|
43 |
-
CURLOPT_CAINFO => Api::instance()->getHttpClient()->getCaBundlePath(),
|
44 |
-
]
|
45 |
-
]));
|
46 |
-
|
47 |
-
$this->client = new Client(['handler' => $handler_stack]);
|
48 |
-
}
|
49 |
-
|
50 |
-
public function getClient() {
|
51 |
-
return $this->client;
|
52 |
-
}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/BatchProcessor.php
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
|
25 |
-
namespace FacebookAds\Object\ServerSide;
|
26 |
-
|
27 |
-
use GuzzleHttp\Promise;
|
28 |
-
|
29 |
-
class BatchProcessor {
|
30 |
-
protected $batch_size;
|
31 |
-
protected $concurrent_requests;
|
32 |
-
protected $pixel_id;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Constructor
|
36 |
-
* @param int $pixel_id
|
37 |
-
* @param int $batch_size
|
38 |
-
* @param int $concurrent_requests
|
39 |
-
*/
|
40 |
-
public function __construct($pixel_id, $batch_size = 50, $concurrent_requests = 4) {
|
41 |
-
$this->pixel_id = $pixel_id;
|
42 |
-
// Note: batch_size is only used in processEvents and processEventsGenerator
|
43 |
-
$this->batch_size = $batch_size;
|
44 |
-
$this->concurrent_requests = $concurrent_requests;
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Processes events that have identical event_request params
|
49 |
-
* @param array $event_request_params
|
50 |
-
* @param array|\FacebookAds\Object\ServerSide\Event $events
|
51 |
-
* @return void
|
52 |
-
*/
|
53 |
-
public function processEvents($event_request_params, $events) {
|
54 |
-
$generator = $this->processEventsGenerator($event_request_params, $events);
|
55 |
-
foreach ($generator as $promises) {
|
56 |
-
Promise\unwrap($promises);
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* This generator returns event_requests promises for events that have identical event_request params
|
62 |
-
* @param array $event_request_params
|
63 |
-
* @param array|\FacebookAds\Object\ServerSide\Event $events
|
64 |
-
* @return Generator|array|\GuzzleHttp\Promise\PromiseInterface $promises
|
65 |
-
*/
|
66 |
-
public function processEventsGenerator($event_request_params, $events) {
|
67 |
-
$index = 0;
|
68 |
-
while ($index < count($events)) {
|
69 |
-
$promises = [];
|
70 |
-
|
71 |
-
while ($index < count($events) && count($promises) < $this->concurrent_requests) {
|
72 |
-
$params = array_merge(
|
73 |
-
array('events' => array_slice($events, $index, $this->batch_size)),
|
74 |
-
$event_request_params
|
75 |
-
);
|
76 |
-
$event_request = new EventRequestAsync(
|
77 |
-
$this->pixel_id,
|
78 |
-
$params
|
79 |
-
);
|
80 |
-
|
81 |
-
$promises[] = $event_request->execute();
|
82 |
-
$index += $this->batch_size;
|
83 |
-
}
|
84 |
-
|
85 |
-
yield $promises;
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Processes async event_requests
|
91 |
-
* @param array|\FacebookAds\Object\ServerSide\EventRequestAsync $event_requests_async
|
92 |
-
* @return void
|
93 |
-
*/
|
94 |
-
public function processEventRequests($event_requests_async) {
|
95 |
-
$generator = $this->processEventRequestsGenerator($event_requests_async);
|
96 |
-
foreach ($generator as $promises) {
|
97 |
-
Promise\unwrap($promises);
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* This generator returns event_requests promises
|
103 |
-
* @param array|\FacebookAds\Object\ServerSide\EventRequestAsync $event_requests_async
|
104 |
-
* @return Generator|array|\GuzzleHttp\Promise\PromiseInterface $promises
|
105 |
-
*/
|
106 |
-
public function processEventRequestsGenerator($event_requests_async) {
|
107 |
-
$index = 0;
|
108 |
-
while ($index < count($event_requests_async)) {
|
109 |
-
$promises = [];
|
110 |
-
|
111 |
-
$offset = 0;
|
112 |
-
while (($index + $offset) < count($event_requests_async) && count($promises) < $this->concurrent_requests) {
|
113 |
-
$promises[] = $event_requests_async[$index + $offset]->execute();
|
114 |
-
$offset += 1;
|
115 |
-
}
|
116 |
-
$index += $offset;
|
117 |
-
|
118 |
-
yield $promises;
|
119 |
-
}
|
120 |
-
}
|
121 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/EventRequestAsync.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
|
25 |
-
namespace FacebookAds\Object\ServerSide;
|
26 |
-
|
27 |
-
use FacebookAds\Api;
|
28 |
-
use FacebookAds\ApiConfig;
|
29 |
-
use FacebookAds\Http\Client;
|
30 |
-
use GuzzleHttp\Psr7\Request;
|
31 |
-
use GuzzleHttp\Psr7\MultipartStream;
|
32 |
-
|
33 |
-
class EventRequestAsync extends EventRequest {
|
34 |
-
/**
|
35 |
-
* Return an asynchronous request Promise
|
36 |
-
* @return \GuzzleHttp\Promise\PromiseInterface
|
37 |
-
*/
|
38 |
-
public function execute() {
|
39 |
-
$normalized_param = $this->normalize();
|
40 |
-
$pixel_id = $this->container['pixel_id'];
|
41 |
-
return $this->eventPromise(
|
42 |
-
$pixel_id,
|
43 |
-
$normalized_param
|
44 |
-
);
|
45 |
-
}
|
46 |
-
|
47 |
-
private function eventPromise(string $pixel_id, array $params = array()) {
|
48 |
-
$access_token = Api::instance()->getSession()->getAccessToken();
|
49 |
-
$headers = array(
|
50 |
-
'User-Agent' => 'fbbizsdk-php-v'.ApiConfig::APIVersion,
|
51 |
-
'Accept-Encoding' => '*',
|
52 |
-
);
|
53 |
-
|
54 |
-
$domain = Client::DEFAULT_LAST_LEVEL_DOMAIN . '.' . Client::DEFAULT_GRAPH_BASE_DOMAIN;
|
55 |
-
$base_url = 'https://' . $domain . '/v' . ApiConfig::APIVersion;
|
56 |
-
|
57 |
-
$url = $base_url.'/'.$pixel_id.'/events';
|
58 |
-
|
59 |
-
$events_json = \GuzzleHttp\json_encode($params['data']);
|
60 |
-
$multipart_contents = [
|
61 |
-
[
|
62 |
-
'name' => 'access_token',
|
63 |
-
'contents' => $access_token,
|
64 |
-
'headers' => array('Content-Type' => 'multipart/form-data'),
|
65 |
-
],
|
66 |
-
[
|
67 |
-
'name' => 'data',
|
68 |
-
'contents' => $events_json,
|
69 |
-
'headers' => array('Content-Type' => 'multipart/form-data'),
|
70 |
-
]
|
71 |
-
];
|
72 |
-
|
73 |
-
foreach ($params as $key => $value) {
|
74 |
-
if ($key !== 'data') {
|
75 |
-
$multipart_contents[] = [
|
76 |
-
'name' => $key,
|
77 |
-
'contents' => $value,
|
78 |
-
'headers' => array('Content-Type' => 'multipart/form-data'),
|
79 |
-
];
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
$body = new MultipartStream($multipart_contents);
|
84 |
-
$request = new Request('POST', $url, $headers, $body);
|
85 |
-
|
86 |
-
$client = AsyncClient::getInstance()->getClient();
|
87 |
-
return $client->sendAsync($request);
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-business-sdk/test/FacebookAdsTest/Object/ServerSide/AsyncClientTest.php
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
|
25 |
-
namespace FacebookAdsTest\Object\ServerSide;
|
26 |
-
|
27 |
-
use FacebookAdsTest\AbstractUnitTestCase;
|
28 |
-
use FacebookAds\Object\ServerSide\AsyncClient;
|
29 |
-
use FacebookAds\Api;
|
30 |
-
|
31 |
-
use GuzzleHttp\HandlerStack;
|
32 |
-
use GuzzleHttp\Handler\CurlHandler;
|
33 |
-
|
34 |
-
Api::init(null, null, 'access-token', false);
|
35 |
-
|
36 |
-
class AsyncClientTest extends AbstractUnitTestCase {
|
37 |
-
public function testSingleton() {
|
38 |
-
$client1 = AsyncClient::getInstance()->getClient();
|
39 |
-
$client2 = AsyncClient::getInstance()->getClient();
|
40 |
-
|
41 |
-
$this->assertEquals($client1, $client2);
|
42 |
-
}
|
43 |
-
|
44 |
-
public function testCurlOptions() {
|
45 |
-
$async_client = AsyncClient::getInstance()->getClient();
|
46 |
-
$expected_handler = HandlerStack::create(new CurlHandler([
|
47 |
-
'options' => [
|
48 |
-
CURLOPT_CONNECTTIMEOUT => 10,
|
49 |
-
CURLOPT_TIMEOUT => 60,
|
50 |
-
CURLOPT_RETURNTRANSFER => true,
|
51 |
-
CURLOPT_HEADER => true,
|
52 |
-
CURLOPT_CAINFO => Api::instance()->getHttpClient()->getCaBundlePath(),
|
53 |
-
]
|
54 |
-
]));
|
55 |
-
|
56 |
-
$this->assertEquals($expected_handler, $async_client->getConfig()['handler']);
|
57 |
-
}
|
58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-business-sdk/test/FacebookAdsTest/Object/ServerSide/BatchProcessorTest.php
DELETED
@@ -1,166 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
|
25 |
-
namespace FacebookAdsTest\Object\ServerSide;
|
26 |
-
|
27 |
-
use FacebookAdsTest\AbstractUnitTestCase;
|
28 |
-
use FacebookAds\Object\ServerSide\Event;
|
29 |
-
use FacebookAds\Object\ServerSide\UserData;
|
30 |
-
use FacebookAds\Object\ServerSide\BatchProcessor;
|
31 |
-
use FacebookAds\Api;
|
32 |
-
use GuzzleHttp\Promise;
|
33 |
-
use Mockery as m;
|
34 |
-
|
35 |
-
class BatchProcessorTest extends AbstractUnitTestCase {
|
36 |
-
protected function setUp(): void {
|
37 |
-
$this->user_data = (new UserData())->setEmail('joe@eg.com');
|
38 |
-
$this->event = (new Event())
|
39 |
-
->setEventName('Purchase')
|
40 |
-
->setEventTime(time())
|
41 |
-
->setUserData($this->user_data);
|
42 |
-
$this->pixel_id = 'pixel-id-0';
|
43 |
-
$this->test_event_code = 'test-code-1';
|
44 |
-
$batch_size = 5;
|
45 |
-
$concurrent_requests = 2;
|
46 |
-
$this->batch_processor = new BatchProcessor($this->pixel_id, $batch_size, $concurrent_requests);
|
47 |
-
}
|
48 |
-
|
49 |
-
protected function tearDown(): void {
|
50 |
-
m::close();
|
51 |
-
}
|
52 |
-
|
53 |
-
public function testProcessEvents() {
|
54 |
-
$expected_event_request_params = array(
|
55 |
-
'events' => array_fill(0, 5, $this->event),
|
56 |
-
'test_event_code' => $this->test_event_code,
|
57 |
-
);
|
58 |
-
|
59 |
-
$mock_event_request_async = m::mock('overload:FacebookAds\Object\ServerSide\EventRequestAsync');
|
60 |
-
$mock_guzzle_promise = m::mock();
|
61 |
-
|
62 |
-
$mock_event_request_async
|
63 |
-
->shouldReceive('__construct')
|
64 |
-
->atLeast()
|
65 |
-
->once()
|
66 |
-
->with($this->pixel_id, $expected_event_request_params);
|
67 |
-
$mock_event_request_async
|
68 |
-
->shouldReceive('execute')
|
69 |
-
->atLeast()
|
70 |
-
->once()
|
71 |
-
->andReturn($mock_guzzle_promise);
|
72 |
-
$mock_guzzle_promise
|
73 |
-
->shouldReceive('wait')
|
74 |
-
->times(3);
|
75 |
-
$this->addToAssertionCount(
|
76 |
-
m::getContainer()->mockery_getExpectationCount()
|
77 |
-
);
|
78 |
-
|
79 |
-
$events = array_fill(0, 15, $this->event);
|
80 |
-
$this->batch_processor->processEvents(
|
81 |
-
array('test_event_code' => $this->test_event_code),
|
82 |
-
$events
|
83 |
-
);
|
84 |
-
}
|
85 |
-
|
86 |
-
public function testProcessEventsGenerator() {
|
87 |
-
$expected_event_request_params = array(
|
88 |
-
'events' => array_fill(0, 5, $this->event),
|
89 |
-
'test_event_code' => $this->test_event_code,
|
90 |
-
);
|
91 |
-
|
92 |
-
$mock_event_request_async = m::mock('overload:FacebookAds\Object\ServerSide\EventRequestAsync');
|
93 |
-
$mock_guzzle_promise = m::mock();
|
94 |
-
|
95 |
-
$mock_event_request_async
|
96 |
-
->shouldReceive('__construct')
|
97 |
-
->atLeast()
|
98 |
-
->once()
|
99 |
-
->with($this->pixel_id, $expected_event_request_params);
|
100 |
-
$mock_event_request_async
|
101 |
-
->shouldReceive('execute')
|
102 |
-
->atLeast()
|
103 |
-
->once()
|
104 |
-
->andReturn($mock_guzzle_promise);
|
105 |
-
$mock_guzzle_promise
|
106 |
-
->shouldReceive('wait')
|
107 |
-
->times(3);
|
108 |
-
|
109 |
-
$events = array_fill(0, 15, $this->event);
|
110 |
-
$generator = $this->batch_processor->processEventsGenerator(
|
111 |
-
array('test_event_code' => $this->test_event_code),
|
112 |
-
$events
|
113 |
-
);
|
114 |
-
$iterations = 0;
|
115 |
-
foreach ($generator as $promises) {
|
116 |
-
$iterations += 1;
|
117 |
-
Promise\unwrap($promises);
|
118 |
-
}
|
119 |
-
|
120 |
-
$this->assertEquals($iterations, 2);
|
121 |
-
}
|
122 |
-
|
123 |
-
public function testProcessEventRequests() {
|
124 |
-
$mock_event_request_async = m::mock();
|
125 |
-
$mock_guzzle_promise = m::mock();
|
126 |
-
$expected_event_request_params = array_fill(0, 5, $mock_event_request_async);
|
127 |
-
|
128 |
-
$mock_event_request_async
|
129 |
-
->shouldReceive('execute')
|
130 |
-
->times(5)
|
131 |
-
->andReturn($mock_guzzle_promise);
|
132 |
-
$mock_guzzle_promise
|
133 |
-
->shouldReceive('wait')
|
134 |
-
->times(5);
|
135 |
-
$this->addToAssertionCount(
|
136 |
-
m::getContainer()->mockery_getExpectationCount()
|
137 |
-
);
|
138 |
-
|
139 |
-
$event_requests = array_fill(0, 5, $mock_event_request_async);
|
140 |
-
$this->batch_processor->processEventRequests($event_requests);
|
141 |
-
}
|
142 |
-
|
143 |
-
public function testProcessEventRequestsGenerator() {
|
144 |
-
$mock_event_request_async = m::mock();
|
145 |
-
$mock_guzzle_promise = m::mock();
|
146 |
-
$expected_event_request_params = array_fill(0, 5, $mock_event_request_async);
|
147 |
-
|
148 |
-
$mock_event_request_async
|
149 |
-
->shouldReceive('execute')
|
150 |
-
->times(5)
|
151 |
-
->andReturn($mock_guzzle_promise);
|
152 |
-
$mock_guzzle_promise
|
153 |
-
->shouldReceive('wait')
|
154 |
-
->times(5);
|
155 |
-
|
156 |
-
$event_requests = array_fill(0, 5, $mock_event_request_async);
|
157 |
-
$generator = $this->batch_processor->processEventRequestsGenerator($event_requests);
|
158 |
-
$iterations = 0;
|
159 |
-
foreach ($generator as $promises) {
|
160 |
-
$iterations += 1;
|
161 |
-
Promise\unwrap($promises);
|
162 |
-
}
|
163 |
-
|
164 |
-
$this->assertEquals(3, $iterations);
|
165 |
-
}
|
166 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-business-sdk/test/FacebookAdsTest/Object/ServerSide/EventRequestAsyncTest.php
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
|
25 |
-
namespace FacebookAdsTest\Object\ServerSide;
|
26 |
-
|
27 |
-
use FacebookAdsTest\AbstractUnitTestCase;
|
28 |
-
use FacebookAds\Object\ServerSide\Event;
|
29 |
-
use FacebookAds\Object\ServerSide\EventRequestAsync;
|
30 |
-
use FacebookAds\Api;
|
31 |
-
|
32 |
-
class EventRequestAsyncTest extends AbstractUnitTestCase {
|
33 |
-
public function testBuilder() {
|
34 |
-
$event = new Event(array('event_name' => 'my-event'));
|
35 |
-
$expected = array(
|
36 |
-
'data' => array(array('event_name' => $event['event_name'])),
|
37 |
-
'test_event_code' => 'test-event-code-0',
|
38 |
-
'partner_agent' => 'partner-agent-1',
|
39 |
-
'namespace_id' => 'namespace-id-2',
|
40 |
-
'upload_id' => 'upload-id-3',
|
41 |
-
'upload_tag' => 'upload-tag-4',
|
42 |
-
'upload_source' => 'upload-source-5',
|
43 |
-
);
|
44 |
-
$event_request_async = (new EventRequestAsync('pixel-id'))
|
45 |
-
->setEvents(array($event))
|
46 |
-
->setTestEventCode($expected['test_event_code'])
|
47 |
-
->setPartnerAgent($expected['partner_agent'])
|
48 |
-
->setNamespaceId($expected['namespace_id'])
|
49 |
-
->setUploadId($expected['upload_id'])
|
50 |
-
->setUploadTag($expected['upload_tag'])
|
51 |
-
->setUploadSource($expected['upload_source']);
|
52 |
-
|
53 |
-
$this->assertEquals($expected, $event_request_async->normalize());
|
54 |
-
}
|
55 |
-
|
56 |
-
public function testConstructor() {
|
57 |
-
$event = new Event(array('event_name' => 'my-event'));
|
58 |
-
$expected_event = array('data' => [array('event_name' => $event['event_name'])]);
|
59 |
-
$state = array(
|
60 |
-
'test_event_code' => 'test-event-code-0',
|
61 |
-
'partner_agent' => 'partner-agent-1',
|
62 |
-
'namespace_id' => 'namespace-id-2',
|
63 |
-
'upload_id' => 'upload-id-3',
|
64 |
-
'upload_tag' => 'upload-tag-4',
|
65 |
-
'upload_source' => 'upload-source-5',
|
66 |
-
);
|
67 |
-
$data = array_merge(array('events' => array($event)), $state);
|
68 |
-
$expected = array_merge($state, $expected_event);
|
69 |
-
$event_request_async = new EventRequestAsync('pixel-id', $data);
|
70 |
-
|
71 |
-
$this->assertEquals($expected, $event_request_async->normalize());
|
72 |
-
}
|
73 |
-
|
74 |
-
public function testPromiseCancel() {
|
75 |
-
Api::init(null, null, 'access-token-123');
|
76 |
-
$event_request_async = new EventRequestAsync('pixel-id-456', array(
|
77 |
-
'test_event_code' => 'test-event-code-0',
|
78 |
-
'events' => array(new Event(array('event_name' => 'my-event')))
|
79 |
-
));
|
80 |
-
$promise = $event_request_async->execute();
|
81 |
-
$promise->cancel();
|
82 |
-
|
83 |
-
$this->assertEquals('rejected', $promise->getState());
|
84 |
-
}
|
85 |
-
|
86 |
-
public function testPromiseReject() {
|
87 |
-
Api::init(null, null, 'access-token-123');
|
88 |
-
$event_request_async = new EventRequestAsync('pixel-id-456', array(
|
89 |
-
'test_event_code' => 'test-event-code-0',
|
90 |
-
'events' => array(new Event(array('event_name' => 'my-event')))
|
91 |
-
));
|
92 |
-
$promise = $event_request_async->execute();
|
93 |
-
$promise->reject('some error');
|
94 |
-
|
95 |
-
$this->assertEquals('rejected', $promise->getState());
|
96 |
-
}
|
97 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/CHANGELOG.md
DELETED
@@ -1,1450 +0,0 @@
|
|
1 |
-
# Change Log
|
2 |
-
|
3 |
-
Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version.
|
4 |
-
|
5 |
-
## 7.2.0 - 2020-10-10
|
6 |
-
|
7 |
-
### Added
|
8 |
-
|
9 |
-
- Support for PHP 8 [#2712](https://github.com/guzzle/guzzle/pull/2712), [#2715](https://github.com/guzzle/guzzle/pull/2715), [#2789](https://github.com/guzzle/guzzle/pull/2789)
|
10 |
-
- Support passing a body summarizer to the http errors middleware [#2795](https://github.com/guzzle/guzzle/pull/2795)
|
11 |
-
|
12 |
-
### Fixed
|
13 |
-
|
14 |
-
- Handle exceptions during response creation [#2591](https://github.com/guzzle/guzzle/pull/2591)
|
15 |
-
- Fix CURLOPT_ENCODING not to be overwritten [#2595](https://github.com/guzzle/guzzle/pull/2595)
|
16 |
-
- Make sure the Request always has a body object [#2804](https://github.com/guzzle/guzzle/pull/2804)
|
17 |
-
|
18 |
-
### Changed
|
19 |
-
|
20 |
-
- The `TooManyRedirectsException` has a response [#2660](https://github.com/guzzle/guzzle/pull/2660)
|
21 |
-
- Avoid "functions" from dependencies [#2712](https://github.com/guzzle/guzzle/pull/2712)
|
22 |
-
|
23 |
-
### Deprecated
|
24 |
-
|
25 |
-
- Using environment variable GUZZLE_CURL_SELECT_TIMEOUT [#2786](https://github.com/guzzle/guzzle/pull/2786)
|
26 |
-
|
27 |
-
## 7.1.1 - 2020-09-30
|
28 |
-
|
29 |
-
### Fixed
|
30 |
-
|
31 |
-
- Incorrect EOF detection for response body streams on Windows.
|
32 |
-
|
33 |
-
### Changed
|
34 |
-
|
35 |
-
- We dont connect curl `sink` on HEAD requests.
|
36 |
-
- Removed some PHP 5 workarounds
|
37 |
-
|
38 |
-
## 7.1.0 - 2020-09-22
|
39 |
-
|
40 |
-
### Added
|
41 |
-
|
42 |
-
- `GuzzleHttp\MessageFormatterInterface`
|
43 |
-
|
44 |
-
### Fixed
|
45 |
-
|
46 |
-
- Fixed issue that caused cookies with no value not to be stored.
|
47 |
-
- On redirects, we allow all safe methods like GET, HEAD and OPTIONS.
|
48 |
-
- Fixed logging on empty responses.
|
49 |
-
- Make sure MessageFormatter::format returns string
|
50 |
-
|
51 |
-
### Deprecated
|
52 |
-
|
53 |
-
- All functions in `GuzzleHttp` has been deprecated. Use static methods on `Utils` instead.
|
54 |
-
- `ClientInterface::getConfig()`
|
55 |
-
- `Client::getConfig()`
|
56 |
-
- `Client::__call()`
|
57 |
-
- `Utils::defaultCaBundle()`
|
58 |
-
- `CurlFactory::LOW_CURL_VERSION_NUMBER`
|
59 |
-
|
60 |
-
## 7.0.1 - 2020-06-27
|
61 |
-
|
62 |
-
* Fix multiply defined functions fatal error [#2699](https://github.com/guzzle/guzzle/pull/2699)
|
63 |
-
|
64 |
-
## 7.0.0 - 2020-06-27
|
65 |
-
|
66 |
-
No changes since 7.0.0-rc1.
|
67 |
-
|
68 |
-
## 7.0.0-rc1 - 2020-06-15
|
69 |
-
|
70 |
-
### Changed
|
71 |
-
|
72 |
-
* Use error level for logging errors in Middleware [#2629](https://github.com/guzzle/guzzle/pull/2629)
|
73 |
-
* Disabled IDN support by default and require ext-intl to use it [#2675](https://github.com/guzzle/guzzle/pull/2675)
|
74 |
-
|
75 |
-
## 7.0.0-beta2 - 2020-05-25
|
76 |
-
|
77 |
-
### Added
|
78 |
-
|
79 |
-
* Using `Utils` class instead of functions in the `GuzzleHttp` namespace. [#2546](https://github.com/guzzle/guzzle/pull/2546)
|
80 |
-
* `ClientInterface::MAJOR_VERSION` [#2583](https://github.com/guzzle/guzzle/pull/2583)
|
81 |
-
|
82 |
-
### Changed
|
83 |
-
|
84 |
-
* Avoid the `getenv` function when unsafe [#2531](https://github.com/guzzle/guzzle/pull/2531)
|
85 |
-
* Added real client methods [#2529](https://github.com/guzzle/guzzle/pull/2529)
|
86 |
-
* Avoid functions due to global install conflicts [#2546](https://github.com/guzzle/guzzle/pull/2546)
|
87 |
-
* Use Symfony intl-idn polyfill [#2550](https://github.com/guzzle/guzzle/pull/2550)
|
88 |
-
* Adding methods for HTTP verbs like `Client::get()`, `Client::head()`, `Client::patch()` etc [#2529](https://github.com/guzzle/guzzle/pull/2529)
|
89 |
-
* `ConnectException` extends `TransferException` [#2541](https://github.com/guzzle/guzzle/pull/2541)
|
90 |
-
* Updated the default User Agent to "GuzzleHttp/7" [#2654](https://github.com/guzzle/guzzle/pull/2654)
|
91 |
-
|
92 |
-
### Fixed
|
93 |
-
|
94 |
-
* Various intl icu issues [#2626](https://github.com/guzzle/guzzle/pull/2626)
|
95 |
-
|
96 |
-
### Removed
|
97 |
-
|
98 |
-
* Pool option `pool_size` [#2528](https://github.com/guzzle/guzzle/pull/2528)
|
99 |
-
|
100 |
-
## 7.0.0-beta1 - 2019-12-30
|
101 |
-
|
102 |
-
The diff might look very big but 95% of Guzzle users will be able to upgrade without modification.
|
103 |
-
Please see [the upgrade document](UPGRADING.md) that describes all BC breaking changes.
|
104 |
-
|
105 |
-
### Added
|
106 |
-
|
107 |
-
* Implement PSR-18 and dropped PHP 5 support [#2421](https://github.com/guzzle/guzzle/pull/2421) [#2474](https://github.com/guzzle/guzzle/pull/2474)
|
108 |
-
* PHP 7 types [#2442](https://github.com/guzzle/guzzle/pull/2442) [#2449](https://github.com/guzzle/guzzle/pull/2449) [#2466](https://github.com/guzzle/guzzle/pull/2466) [#2497](https://github.com/guzzle/guzzle/pull/2497) [#2499](https://github.com/guzzle/guzzle/pull/2499)
|
109 |
-
* IDN support for redirects [2424](https://github.com/guzzle/guzzle/pull/2424)
|
110 |
-
|
111 |
-
### Changed
|
112 |
-
|
113 |
-
* Dont allow passing null as third argument to `BadResponseException::__construct()` [#2427](https://github.com/guzzle/guzzle/pull/2427)
|
114 |
-
* Use SAPI constant instead of method call [#2450](https://github.com/guzzle/guzzle/pull/2450)
|
115 |
-
* Use native function invocation [#2444](https://github.com/guzzle/guzzle/pull/2444)
|
116 |
-
* Better defaults for PHP installations with old ICU lib [2454](https://github.com/guzzle/guzzle/pull/2454)
|
117 |
-
* Added visibility to all constants [#2462](https://github.com/guzzle/guzzle/pull/2462)
|
118 |
-
* Dont allow passing `null` as URI to `Client::request()` and `Client::requestAsync()` [#2461](https://github.com/guzzle/guzzle/pull/2461)
|
119 |
-
* Widen the exception argument to throwable [#2495](https://github.com/guzzle/guzzle/pull/2495)
|
120 |
-
|
121 |
-
### Fixed
|
122 |
-
|
123 |
-
* Logging when Promise rejected with a string [#2311](https://github.com/guzzle/guzzle/pull/2311)
|
124 |
-
|
125 |
-
### Removed
|
126 |
-
|
127 |
-
* Class `SeekException` [#2162](https://github.com/guzzle/guzzle/pull/2162)
|
128 |
-
* `RequestException::getResponseBodySummary()` [#2425](https://github.com/guzzle/guzzle/pull/2425)
|
129 |
-
* `CookieJar::getCookieValue()` [#2433](https://github.com/guzzle/guzzle/pull/2433)
|
130 |
-
* `uri_template()` and `UriTemplate` [#2440](https://github.com/guzzle/guzzle/pull/2440)
|
131 |
-
* Request options `save_to` and `exceptions` [#2464](https://github.com/guzzle/guzzle/pull/2464)
|
132 |
-
|
133 |
-
## 6.5.2 - 2019-12-23
|
134 |
-
|
135 |
-
* idn_to_ascii() fix for old PHP versions [#2489](https://github.com/guzzle/guzzle/pull/2489)
|
136 |
-
|
137 |
-
## 6.5.1 - 2019-12-21
|
138 |
-
|
139 |
-
* Better defaults for PHP installations with old ICU lib [#2454](https://github.com/guzzle/guzzle/pull/2454)
|
140 |
-
* IDN support for redirects [#2424](https://github.com/guzzle/guzzle/pull/2424)
|
141 |
-
|
142 |
-
## 6.5.0 - 2019-12-07
|
143 |
-
|
144 |
-
* Improvement: Added support for reset internal queue in MockHandler. [#2143](https://github.com/guzzle/guzzle/pull/2143)
|
145 |
-
* Improvement: Added support to pass arbitrary options to `curl_multi_init`. [#2287](https://github.com/guzzle/guzzle/pull/2287)
|
146 |
-
* Fix: Gracefully handle passing `null` to the `header` option. [#2132](https://github.com/guzzle/guzzle/pull/2132)
|
147 |
-
* Fix: `RetryMiddleware` did not do exponential delay between retires due unit mismatch. [#2132](https://github.com/guzzle/guzzle/pull/2132)
|
148 |
-
* Fix: Prevent undefined offset when using array for ssl_key options. [#2348](https://github.com/guzzle/guzzle/pull/2348)
|
149 |
-
* Deprecated `ClientInterface::VERSION`
|
150 |
-
|
151 |
-
## 6.4.1 - 2019-10-23
|
152 |
-
|
153 |
-
* No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that
|
154 |
-
* Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar`
|
155 |
-
|
156 |
-
## 6.4.0 - 2019-10-23
|
157 |
-
|
158 |
-
* Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108)
|
159 |
-
* Fix: Test if response is readable before returning a summary in `RequestException::getResponseBodySummary()` [#2081](https://github.com/guzzle/guzzle/pull/2081)
|
160 |
-
* Fix: Add support for GUZZLE_CURL_SELECT_TIMEOUT environment variable [#2161](https://github.com/guzzle/guzzle/pull/2161)
|
161 |
-
* Improvement: Added `GuzzleHttp\Exception\InvalidArgumentException` [#2163](https://github.com/guzzle/guzzle/pull/2163)
|
162 |
-
* Improvement: Added `GuzzleHttp\_current_time()` to use `hrtime()` if that function exists. [#2242](https://github.com/guzzle/guzzle/pull/2242)
|
163 |
-
* Improvement: Added curl's `appconnect_time` in `TransferStats` [#2284](https://github.com/guzzle/guzzle/pull/2284)
|
164 |
-
* Improvement: Make GuzzleException extend Throwable wherever it's available [#2273](https://github.com/guzzle/guzzle/pull/2273)
|
165 |
-
* Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335)
|
166 |
-
* Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362)
|
167 |
-
|
168 |
-
## 6.3.3 - 2018-04-22
|
169 |
-
|
170 |
-
* Fix: Default headers when decode_content is specified
|
171 |
-
|
172 |
-
|
173 |
-
## 6.3.2 - 2018-03-26
|
174 |
-
|
175 |
-
* Fix: Release process
|
176 |
-
|
177 |
-
|
178 |
-
## 6.3.1 - 2018-03-26
|
179 |
-
|
180 |
-
* Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014)
|
181 |
-
* Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012)
|
182 |
-
* Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999)
|
183 |
-
* Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998)
|
184 |
-
* Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953)
|
185 |
-
* Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915)
|
186 |
-
* Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916)
|
187 |
-
|
188 |
-
+ Minor code cleanups, documentation fixes and clarifications.
|
189 |
-
|
190 |
-
|
191 |
-
## 6.3.0 - 2017-06-22
|
192 |
-
|
193 |
-
* Feature: force IP resolution (ipv4 or ipv6) [#1608](https://github.com/guzzle/guzzle/pull/1608), [#1659](https://github.com/guzzle/guzzle/pull/1659)
|
194 |
-
* Improvement: Don't include summary in exception message when body is empty [#1621](https://github.com/guzzle/guzzle/pull/1621)
|
195 |
-
* Improvement: Handle `on_headers` option in MockHandler [#1580](https://github.com/guzzle/guzzle/pull/1580)
|
196 |
-
* Improvement: Added SUSE Linux CA path [#1609](https://github.com/guzzle/guzzle/issues/1609)
|
197 |
-
* Improvement: Use class reference for getting the name of the class instead of using hardcoded strings [#1641](https://github.com/guzzle/guzzle/pull/1641)
|
198 |
-
* Feature: Added `read_timeout` option [#1611](https://github.com/guzzle/guzzle/pull/1611)
|
199 |
-
* Bug fix: PHP 7.x fixes [#1685](https://github.com/guzzle/guzzle/pull/1685), [#1686](https://github.com/guzzle/guzzle/pull/1686), [#1811](https://github.com/guzzle/guzzle/pull/1811)
|
200 |
-
* Deprecation: BadResponseException instantiation without a response [#1642](https://github.com/guzzle/guzzle/pull/1642)
|
201 |
-
* Feature: Added NTLM auth [#1569](https://github.com/guzzle/guzzle/pull/1569)
|
202 |
-
* Feature: Track redirect HTTP status codes [#1711](https://github.com/guzzle/guzzle/pull/1711)
|
203 |
-
* Improvement: Check handler type during construction [#1745](https://github.com/guzzle/guzzle/pull/1745)
|
204 |
-
* Improvement: Always include the Content-Length if there's a body [#1721](https://github.com/guzzle/guzzle/pull/1721)
|
205 |
-
* Feature: Added convenience method to access a cookie by name [#1318](https://github.com/guzzle/guzzle/pull/1318)
|
206 |
-
* Bug fix: Fill `CURLOPT_CAPATH` and `CURLOPT_CAINFO` properly [#1684](https://github.com/guzzle/guzzle/pull/1684)
|
207 |
-
* Improvement: Use `\GuzzleHttp\Promise\rejection_for` function instead of object init [#1827](https://github.com/guzzle/guzzle/pull/1827)
|
208 |
-
|
209 |
-
|
210 |
-
+ Minor code cleanups, documentation fixes and clarifications.
|
211 |
-
|
212 |
-
## 6.2.3 - 2017-02-28
|
213 |
-
|
214 |
-
* Fix deprecations with guzzle/psr7 version 1.4
|
215 |
-
|
216 |
-
## 6.2.2 - 2016-10-08
|
217 |
-
|
218 |
-
* Allow to pass nullable Response to delay callable
|
219 |
-
* Only add scheme when host is present
|
220 |
-
* Fix drain case where content-length is the literal string zero
|
221 |
-
* Obfuscate in-URL credentials in exceptions
|
222 |
-
|
223 |
-
## 6.2.1 - 2016-07-18
|
224 |
-
|
225 |
-
* Address HTTP_PROXY security vulnerability, CVE-2016-5385:
|
226 |
-
https://httpoxy.org/
|
227 |
-
* Fixing timeout bug with StreamHandler:
|
228 |
-
https://github.com/guzzle/guzzle/pull/1488
|
229 |
-
* Only read up to `Content-Length` in PHP StreamHandler to avoid timeouts when
|
230 |
-
a server does not honor `Connection: close`.
|
231 |
-
* Ignore URI fragment when sending requests.
|
232 |
-
|
233 |
-
## 6.2.0 - 2016-03-21
|
234 |
-
|
235 |
-
* Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`.
|
236 |
-
https://github.com/guzzle/guzzle/pull/1389
|
237 |
-
* Bug fix: Fix sleep calculation when waiting for delayed requests.
|
238 |
-
https://github.com/guzzle/guzzle/pull/1324
|
239 |
-
* Feature: More flexible history containers.
|
240 |
-
https://github.com/guzzle/guzzle/pull/1373
|
241 |
-
* Bug fix: defer sink stream opening in StreamHandler.
|
242 |
-
https://github.com/guzzle/guzzle/pull/1377
|
243 |
-
* Bug fix: do not attempt to escape cookie values.
|
244 |
-
https://github.com/guzzle/guzzle/pull/1406
|
245 |
-
* Feature: report original content encoding and length on decoded responses.
|
246 |
-
https://github.com/guzzle/guzzle/pull/1409
|
247 |
-
* Bug fix: rewind seekable request bodies before dispatching to cURL.
|
248 |
-
https://github.com/guzzle/guzzle/pull/1422
|
249 |
-
* Bug fix: provide an empty string to `http_build_query` for HHVM workaround.
|
250 |
-
https://github.com/guzzle/guzzle/pull/1367
|
251 |
-
|
252 |
-
## 6.1.1 - 2015-11-22
|
253 |
-
|
254 |
-
* Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler
|
255 |
-
https://github.com/guzzle/guzzle/commit/911bcbc8b434adce64e223a6d1d14e9a8f63e4e4
|
256 |
-
* Feature: HandlerStack is now more generic.
|
257 |
-
https://github.com/guzzle/guzzle/commit/f2102941331cda544745eedd97fc8fd46e1ee33e
|
258 |
-
* Bug fix: setting verify to false in the StreamHandler now disables peer
|
259 |
-
verification. https://github.com/guzzle/guzzle/issues/1256
|
260 |
-
* Feature: Middleware now uses an exception factory, including more error
|
261 |
-
context. https://github.com/guzzle/guzzle/pull/1282
|
262 |
-
* Feature: better support for disabled functions.
|
263 |
-
https://github.com/guzzle/guzzle/pull/1287
|
264 |
-
* Bug fix: fixed regression where MockHandler was not using `sink`.
|
265 |
-
https://github.com/guzzle/guzzle/pull/1292
|
266 |
-
|
267 |
-
## 6.1.0 - 2015-09-08
|
268 |
-
|
269 |
-
* Feature: Added the `on_stats` request option to provide access to transfer
|
270 |
-
statistics for requests. https://github.com/guzzle/guzzle/pull/1202
|
271 |
-
* Feature: Added the ability to persist session cookies in CookieJars.
|
272 |
-
https://github.com/guzzle/guzzle/pull/1195
|
273 |
-
* Feature: Some compatibility updates for Google APP Engine
|
274 |
-
https://github.com/guzzle/guzzle/pull/1216
|
275 |
-
* Feature: Added support for NO_PROXY to prevent the use of a proxy based on
|
276 |
-
a simple set of rules. https://github.com/guzzle/guzzle/pull/1197
|
277 |
-
* Feature: Cookies can now contain square brackets.
|
278 |
-
https://github.com/guzzle/guzzle/pull/1237
|
279 |
-
* Bug fix: Now correctly parsing `=` inside of quotes in Cookies.
|
280 |
-
https://github.com/guzzle/guzzle/pull/1232
|
281 |
-
* Bug fix: Cusotm cURL options now correctly override curl options of the
|
282 |
-
same name. https://github.com/guzzle/guzzle/pull/1221
|
283 |
-
* Bug fix: Content-Type header is now added when using an explicitly provided
|
284 |
-
multipart body. https://github.com/guzzle/guzzle/pull/1218
|
285 |
-
* Bug fix: Now ignoring Set-Cookie headers that have no name.
|
286 |
-
* Bug fix: Reason phrase is no longer cast to an int in some cases in the
|
287 |
-
cURL handler. https://github.com/guzzle/guzzle/pull/1187
|
288 |
-
* Bug fix: Remove the Authorization header when redirecting if the Host
|
289 |
-
header changes. https://github.com/guzzle/guzzle/pull/1207
|
290 |
-
* Bug fix: Cookie path matching fixes
|
291 |
-
https://github.com/guzzle/guzzle/issues/1129
|
292 |
-
* Bug fix: Fixing the cURL `body_as_string` setting
|
293 |
-
https://github.com/guzzle/guzzle/pull/1201
|
294 |
-
* Bug fix: quotes are no longer stripped when parsing cookies.
|
295 |
-
https://github.com/guzzle/guzzle/issues/1172
|
296 |
-
* Bug fix: `form_params` and `query` now always uses the `&` separator.
|
297 |
-
https://github.com/guzzle/guzzle/pull/1163
|
298 |
-
* Bug fix: Adding a Content-Length to PHP stream wrapper requests if not set.
|
299 |
-
https://github.com/guzzle/guzzle/pull/1189
|
300 |
-
|
301 |
-
## 6.0.2 - 2015-07-04
|
302 |
-
|
303 |
-
* Fixed a memory leak in the curl handlers in which references to callbacks
|
304 |
-
were not being removed by `curl_reset`.
|
305 |
-
* Cookies are now extracted properly before redirects.
|
306 |
-
* Cookies now allow more character ranges.
|
307 |
-
* Decoded Content-Encoding responses are now modified to correctly reflect
|
308 |
-
their state if the encoding was automatically removed by a handler. This
|
309 |
-
means that the `Content-Encoding` header may be removed an the
|
310 |
-
`Content-Length` modified to reflect the message size after removing the
|
311 |
-
encoding.
|
312 |
-
* Added a more explicit error message when trying to use `form_params` and
|
313 |
-
`multipart` in the same request.
|
314 |
-
* Several fixes for HHVM support.
|
315 |
-
* Functions are now conditionally required using an additional level of
|
316 |
-
indirection to help with global Composer installations.
|
317 |
-
|
318 |
-
## 6.0.1 - 2015-05-27
|
319 |
-
|
320 |
-
* Fixed a bug with serializing the `query` request option where the `&`
|
321 |
-
separator was missing.
|
322 |
-
* Added a better error message for when `body` is provided as an array. Please
|
323 |
-
use `form_params` or `multipart` instead.
|
324 |
-
* Various doc fixes.
|
325 |
-
|
326 |
-
## 6.0.0 - 2015-05-26
|
327 |
-
|
328 |
-
* See the UPGRADING.md document for more information.
|
329 |
-
* Added `multipart` and `form_params` request options.
|
330 |
-
* Added `synchronous` request option.
|
331 |
-
* Added the `on_headers` request option.
|
332 |
-
* Fixed `expect` handling.
|
333 |
-
* No longer adding default middlewares in the client ctor. These need to be
|
334 |
-
present on the provided handler in order to work.
|
335 |
-
* Requests are no longer initiated when sending async requests with the
|
336 |
-
CurlMultiHandler. This prevents unexpected recursion from requests completing
|
337 |
-
while ticking the cURL loop.
|
338 |
-
* Removed the semantics of setting `default` to `true`. This is no longer
|
339 |
-
required now that the cURL loop is not ticked for async requests.
|
340 |
-
* Added request and response logging middleware.
|
341 |
-
* No longer allowing self signed certificates when using the StreamHandler.
|
342 |
-
* Ensuring that `sink` is valid if saving to a file.
|
343 |
-
* Request exceptions now include a "handler context" which provides handler
|
344 |
-
specific contextual information.
|
345 |
-
* Added `GuzzleHttp\RequestOptions` to allow request options to be applied
|
346 |
-
using constants.
|
347 |
-
* `$maxHandles` has been removed from CurlMultiHandler.
|
348 |
-
* `MultipartPostBody` is now part of the `guzzlehttp/psr7` package.
|
349 |
-
|
350 |
-
## 5.3.0 - 2015-05-19
|
351 |
-
|
352 |
-
* Mock now supports `save_to`
|
353 |
-
* Marked `AbstractRequestEvent::getTransaction()` as public.
|
354 |
-
* Fixed a bug in which multiple headers using different casing would overwrite
|
355 |
-
previous headers in the associative array.
|
356 |
-
* Added `Utils::getDefaultHandler()`
|
357 |
-
* Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated.
|
358 |
-
* URL scheme is now always lowercased.
|
359 |
-
|
360 |
-
## 6.0.0-beta.1
|
361 |
-
|
362 |
-
* Requires PHP >= 5.5
|
363 |
-
* Updated to use PSR-7
|
364 |
-
* Requires immutable messages, which basically means an event based system
|
365 |
-
owned by a request instance is no longer possible.
|
366 |
-
* Utilizing the [Guzzle PSR-7 package](https://github.com/guzzle/psr7).
|
367 |
-
* Removed the dependency on `guzzlehttp/streams`. These stream abstractions
|
368 |
-
are available in the `guzzlehttp/psr7` package under the `GuzzleHttp\Psr7`
|
369 |
-
namespace.
|
370 |
-
* Added middleware and handler system
|
371 |
-
* Replaced the Guzzle event and subscriber system with a middleware system.
|
372 |
-
* No longer depends on RingPHP, but rather places the HTTP handlers directly
|
373 |
-
in Guzzle, operating on PSR-7 messages.
|
374 |
-
* Retry logic is now encapsulated in `GuzzleHttp\Middleware::retry`, which
|
375 |
-
means the `guzzlehttp/retry-subscriber` is now obsolete.
|
376 |
-
* Mocking responses is now handled using `GuzzleHttp\Handler\MockHandler`.
|
377 |
-
* Asynchronous responses
|
378 |
-
* No longer supports the `future` request option to send an async request.
|
379 |
-
Instead, use one of the `*Async` methods of a client (e.g., `requestAsync`,
|
380 |
-
`getAsync`, etc.).
|
381 |
-
* Utilizing `GuzzleHttp\Promise` instead of React's promise library to avoid
|
382 |
-
recursion required by chaining and forwarding react promises. See
|
383 |
-
https://github.com/guzzle/promises
|
384 |
-
* Added `requestAsync` and `sendAsync` to send request asynchronously.
|
385 |
-
* Added magic methods for `getAsync()`, `postAsync()`, etc. to send requests
|
386 |
-
asynchronously.
|
387 |
-
* Request options
|
388 |
-
* POST and form updates
|
389 |
-
* Added the `form_fields` and `form_files` request options.
|
390 |
-
* Removed the `GuzzleHttp\Post` namespace.
|
391 |
-
* The `body` request option no longer accepts an array for POST requests.
|
392 |
-
* The `exceptions` request option has been deprecated in favor of the
|
393 |
-
`http_errors` request options.
|
394 |
-
* The `save_to` request option has been deprecated in favor of `sink` request
|
395 |
-
option.
|
396 |
-
* Clients no longer accept an array of URI template string and variables for
|
397 |
-
URI variables. You will need to expand URI templates before passing them
|
398 |
-
into a client constructor or request method.
|
399 |
-
* Client methods `get()`, `post()`, `put()`, `patch()`, `options()`, etc. are
|
400 |
-
now magic methods that will send synchronous requests.
|
401 |
-
* Replaced `Utils.php` with plain functions in `functions.php`.
|
402 |
-
* Removed `GuzzleHttp\Collection`.
|
403 |
-
* Removed `GuzzleHttp\BatchResults`. Batched pool results are now returned as
|
404 |
-
an array.
|
405 |
-
* Removed `GuzzleHttp\Query`. Query string handling is now handled using an
|
406 |
-
associative array passed into the `query` request option. The query string
|
407 |
-
is serialized using PHP's `http_build_query`. If you need more control, you
|
408 |
-
can pass the query string in as a string.
|
409 |
-
* `GuzzleHttp\QueryParser` has been replaced with the
|
410 |
-
`GuzzleHttp\Psr7\parse_query`.
|
411 |
-
|
412 |
-
## 5.2.0 - 2015-01-27
|
413 |
-
|
414 |
-
* Added `AppliesHeadersInterface` to make applying headers to a request based
|
415 |
-
on the body more generic and not specific to `PostBodyInterface`.
|
416 |
-
* Reduced the number of stack frames needed to send requests.
|
417 |
-
* Nested futures are now resolved in the client rather than the RequestFsm
|
418 |
-
* Finishing state transitions is now handled in the RequestFsm rather than the
|
419 |
-
RingBridge.
|
420 |
-
* Added a guard in the Pool class to not use recursion for request retries.
|
421 |
-
|
422 |
-
## 5.1.0 - 2014-12-19
|
423 |
-
|
424 |
-
* Pool class no longer uses recursion when a request is intercepted.
|
425 |
-
* The size of a Pool can now be dynamically adjusted using a callback.
|
426 |
-
See https://github.com/guzzle/guzzle/pull/943.
|
427 |
-
* Setting a request option to `null` when creating a request with a client will
|
428 |
-
ensure that the option is not set. This allows you to overwrite default
|
429 |
-
request options on a per-request basis.
|
430 |
-
See https://github.com/guzzle/guzzle/pull/937.
|
431 |
-
* Added the ability to limit which protocols are allowed for redirects by
|
432 |
-
specifying a `protocols` array in the `allow_redirects` request option.
|
433 |
-
* Nested futures due to retries are now resolved when waiting for synchronous
|
434 |
-
responses. See https://github.com/guzzle/guzzle/pull/947.
|
435 |
-
* `"0"` is now an allowed URI path. See
|
436 |
-
https://github.com/guzzle/guzzle/pull/935.
|
437 |
-
* `Query` no longer typehints on the `$query` argument in the constructor,
|
438 |
-
allowing for strings and arrays.
|
439 |
-
* Exceptions thrown in the `end` event are now correctly wrapped with Guzzle
|
440 |
-
specific exceptions if necessary.
|
441 |
-
|
442 |
-
## 5.0.3 - 2014-11-03
|
443 |
-
|
444 |
-
This change updates query strings so that they are treated as un-encoded values
|
445 |
-
by default where the value represents an un-encoded value to send over the
|
446 |
-
wire. A Query object then encodes the value before sending over the wire. This
|
447 |
-
means that even value query string values (e.g., ":") are url encoded. This
|
448 |
-
makes the Query class match PHP's http_build_query function. However, if you
|
449 |
-
want to send requests over the wire using valid query string characters that do
|
450 |
-
not need to be encoded, then you can provide a string to Url::setQuery() and
|
451 |
-
pass true as the second argument to specify that the query string is a raw
|
452 |
-
string that should not be parsed or encoded (unless a call to getQuery() is
|
453 |
-
subsequently made, forcing the query-string to be converted into a Query
|
454 |
-
object).
|
455 |
-
|
456 |
-
## 5.0.2 - 2014-10-30
|
457 |
-
|
458 |
-
* Added a trailing `\r\n` to multipart/form-data payloads. See
|
459 |
-
https://github.com/guzzle/guzzle/pull/871
|
460 |
-
* Added a `GuzzleHttp\Pool::send()` convenience method to match the docs.
|
461 |
-
* Status codes are now returned as integers. See
|
462 |
-
https://github.com/guzzle/guzzle/issues/881
|
463 |
-
* No longer overwriting an existing `application/x-www-form-urlencoded` header
|
464 |
-
when sending POST requests, allowing for customized headers. See
|
465 |
-
https://github.com/guzzle/guzzle/issues/877
|
466 |
-
* Improved path URL serialization.
|
467 |
-
|
468 |
-
* No longer double percent-encoding characters in the path or query string if
|
469 |
-
they are already encoded.
|
470 |
-
* Now properly encoding the supplied path to a URL object, instead of only
|
471 |
-
encoding ' ' and '?'.
|
472 |
-
* Note: This has been changed in 5.0.3 to now encode query string values by
|
473 |
-
default unless the `rawString` argument is provided when setting the query
|
474 |
-
string on a URL: Now allowing many more characters to be present in the
|
475 |
-
query string without being percent encoded. See https://tools.ietf.org/html/rfc3986#appendix-A
|
476 |
-
|
477 |
-
## 5.0.1 - 2014-10-16
|
478 |
-
|
479 |
-
Bugfix release.
|
480 |
-
|
481 |
-
* Fixed an issue where connection errors still returned response object in
|
482 |
-
error and end events event though the response is unusable. This has been
|
483 |
-
corrected so that a response is not returned in the `getResponse` method of
|
484 |
-
these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867
|
485 |
-
* Fixed an issue where transfer statistics were not being populated in the
|
486 |
-
RingBridge. https://github.com/guzzle/guzzle/issues/866
|
487 |
-
|
488 |
-
## 5.0.0 - 2014-10-12
|
489 |
-
|
490 |
-
Adding support for non-blocking responses and some minor API cleanup.
|
491 |
-
|
492 |
-
### New Features
|
493 |
-
|
494 |
-
* Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`.
|
495 |
-
* Added a public API for creating a default HTTP adapter.
|
496 |
-
* Updated the redirect plugin to be non-blocking so that redirects are sent
|
497 |
-
concurrently. Other plugins like this can now be updated to be non-blocking.
|
498 |
-
* Added a "progress" event so that you can get upload and download progress
|
499 |
-
events.
|
500 |
-
* Added `GuzzleHttp\Pool` which implements FutureInterface and transfers
|
501 |
-
requests concurrently using a capped pool size as efficiently as possible.
|
502 |
-
* Added `hasListeners()` to EmitterInterface.
|
503 |
-
* Removed `GuzzleHttp\ClientInterface::sendAll` and marked
|
504 |
-
`GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the
|
505 |
-
recommended way).
|
506 |
-
|
507 |
-
### Breaking changes
|
508 |
-
|
509 |
-
The breaking changes in this release are relatively minor. The biggest thing to
|
510 |
-
look out for is that request and response objects no longer implement fluent
|
511 |
-
interfaces.
|
512 |
-
|
513 |
-
* Removed the fluent interfaces (i.e., `return $this`) from requests,
|
514 |
-
responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`,
|
515 |
-
`GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and
|
516 |
-
`GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of
|
517 |
-
why I did this: https://ocramius.github.io/blog/fluent-interfaces-are-evil/.
|
518 |
-
This also makes the Guzzle message interfaces compatible with the current
|
519 |
-
PSR-7 message proposal.
|
520 |
-
* Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except
|
521 |
-
for the HTTP request functions from function.php, these functions are now
|
522 |
-
implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode`
|
523 |
-
moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to
|
524 |
-
`GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to
|
525 |
-
`GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be
|
526 |
-
`GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php
|
527 |
-
caused problems for many users: they aren't PSR-4 compliant, require an
|
528 |
-
explicit include, and needed an if-guard to ensure that the functions are not
|
529 |
-
declared multiple times.
|
530 |
-
* Rewrote adapter layer.
|
531 |
-
* Removing all classes from `GuzzleHttp\Adapter`, these are now
|
532 |
-
implemented as callables that are stored in `GuzzleHttp\Ring\Client`.
|
533 |
-
* Removed the concept of "parallel adapters". Sending requests serially or
|
534 |
-
concurrently is now handled using a single adapter.
|
535 |
-
* Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The
|
536 |
-
Transaction object now exposes the request, response, and client as public
|
537 |
-
properties. The getters and setters have been removed.
|
538 |
-
* Removed the "headers" event. This event was only useful for changing the
|
539 |
-
body a response once the headers of the response were known. You can implement
|
540 |
-
a similar behavior in a number of ways. One example might be to use a
|
541 |
-
FnStream that has access to the transaction being sent. For example, when the
|
542 |
-
first byte is written, you could check if the response headers match your
|
543 |
-
expectations, and if so, change the actual stream body that is being
|
544 |
-
written to.
|
545 |
-
* Removed the `asArray` parameter from
|
546 |
-
`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
|
547 |
-
value as an array, then use the newly added `getHeaderAsArray()` method of
|
548 |
-
`MessageInterface`. This change makes the Guzzle interfaces compatible with
|
549 |
-
the PSR-7 interfaces.
|
550 |
-
* `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add
|
551 |
-
custom request options using double-dispatch (this was an implementation
|
552 |
-
detail). Instead, you should now provide an associative array to the
|
553 |
-
constructor which is a mapping of the request option name mapping to a
|
554 |
-
function that applies the option value to a request.
|
555 |
-
* Removed the concept of "throwImmediately" from exceptions and error events.
|
556 |
-
This control mechanism was used to stop a transfer of concurrent requests
|
557 |
-
from completing. This can now be handled by throwing the exception or by
|
558 |
-
cancelling a pool of requests or each outstanding future request individually.
|
559 |
-
* Updated to "GuzzleHttp\Streams" 3.0.
|
560 |
-
* `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a
|
561 |
-
`maxLen` parameter. This update makes the Guzzle streams project
|
562 |
-
compatible with the current PSR-7 proposal.
|
563 |
-
* `GuzzleHttp\Stream\Stream::__construct`,
|
564 |
-
`GuzzleHttp\Stream\Stream::factory`, and
|
565 |
-
`GuzzleHttp\Stream\Utils::create` no longer accept a size in the second
|
566 |
-
argument. They now accept an associative array of options, including the
|
567 |
-
"size" key and "metadata" key which can be used to provide custom metadata.
|
568 |
-
|
569 |
-
## 4.2.2 - 2014-09-08
|
570 |
-
|
571 |
-
* Fixed a memory leak in the CurlAdapter when reusing cURL handles.
|
572 |
-
* No longer using `request_fulluri` in stream adapter proxies.
|
573 |
-
* Relative redirects are now based on the last response, not the first response.
|
574 |
-
|
575 |
-
## 4.2.1 - 2014-08-19
|
576 |
-
|
577 |
-
* Ensuring that the StreamAdapter does not always add a Content-Type header
|
578 |
-
* Adding automated github releases with a phar and zip
|
579 |
-
|
580 |
-
## 4.2.0 - 2014-08-17
|
581 |
-
|
582 |
-
* Now merging in default options using a case-insensitive comparison.
|
583 |
-
Closes https://github.com/guzzle/guzzle/issues/767
|
584 |
-
* Added the ability to automatically decode `Content-Encoding` response bodies
|
585 |
-
using the `decode_content` request option. This is set to `true` by default
|
586 |
-
to decode the response body if it comes over the wire with a
|
587 |
-
`Content-Encoding`. Set this value to `false` to disable decoding the
|
588 |
-
response content, and pass a string to provide a request `Accept-Encoding`
|
589 |
-
header and turn on automatic response decoding. This feature now allows you
|
590 |
-
to pass an `Accept-Encoding` header in the headers of a request but still
|
591 |
-
disable automatic response decoding.
|
592 |
-
Closes https://github.com/guzzle/guzzle/issues/764
|
593 |
-
* Added the ability to throw an exception immediately when transferring
|
594 |
-
requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760
|
595 |
-
* Updating guzzlehttp/streams dependency to ~2.1
|
596 |
-
* No longer utilizing the now deprecated namespaced methods from the stream
|
597 |
-
package.
|
598 |
-
|
599 |
-
## 4.1.8 - 2014-08-14
|
600 |
-
|
601 |
-
* Fixed an issue in the CurlFactory that caused setting the `stream=false`
|
602 |
-
request option to throw an exception.
|
603 |
-
See: https://github.com/guzzle/guzzle/issues/769
|
604 |
-
* TransactionIterator now calls rewind on the inner iterator.
|
605 |
-
See: https://github.com/guzzle/guzzle/pull/765
|
606 |
-
* You can now set the `Content-Type` header to `multipart/form-data`
|
607 |
-
when creating POST requests to force multipart bodies.
|
608 |
-
See https://github.com/guzzle/guzzle/issues/768
|
609 |
-
|
610 |
-
## 4.1.7 - 2014-08-07
|
611 |
-
|
612 |
-
* Fixed an error in the HistoryPlugin that caused the same request and response
|
613 |
-
to be logged multiple times when an HTTP protocol error occurs.
|
614 |
-
* Ensuring that cURL does not add a default Content-Type when no Content-Type
|
615 |
-
has been supplied by the user. This prevents the adapter layer from modifying
|
616 |
-
the request that is sent over the wire after any listeners may have already
|
617 |
-
put the request in a desired state (e.g., signed the request).
|
618 |
-
* Throwing an exception when you attempt to send requests that have the
|
619 |
-
"stream" set to true in parallel using the MultiAdapter.
|
620 |
-
* Only calling curl_multi_select when there are active cURL handles. This was
|
621 |
-
previously changed and caused performance problems on some systems due to PHP
|
622 |
-
always selecting until the maximum select timeout.
|
623 |
-
* Fixed a bug where multipart/form-data POST fields were not correctly
|
624 |
-
aggregated (e.g., values with "&").
|
625 |
-
|
626 |
-
## 4.1.6 - 2014-08-03
|
627 |
-
|
628 |
-
* Added helper methods to make it easier to represent messages as strings,
|
629 |
-
including getting the start line and getting headers as a string.
|
630 |
-
|
631 |
-
## 4.1.5 - 2014-08-02
|
632 |
-
|
633 |
-
* Automatically retrying cURL "Connection died, retrying a fresh connect"
|
634 |
-
errors when possible.
|
635 |
-
* cURL implementation cleanup
|
636 |
-
* Allowing multiple event subscriber listeners to be registered per event by
|
637 |
-
passing an array of arrays of listener configuration.
|
638 |
-
|
639 |
-
## 4.1.4 - 2014-07-22
|
640 |
-
|
641 |
-
* Fixed a bug that caused multi-part POST requests with more than one field to
|
642 |
-
serialize incorrectly.
|
643 |
-
* Paths can now be set to "0"
|
644 |
-
* `ResponseInterface::xml` now accepts a `libxml_options` option and added a
|
645 |
-
missing default argument that was required when parsing XML response bodies.
|
646 |
-
* A `save_to` stream is now created lazily, which means that files are not
|
647 |
-
created on disk unless a request succeeds.
|
648 |
-
|
649 |
-
## 4.1.3 - 2014-07-15
|
650 |
-
|
651 |
-
* Various fixes to multipart/form-data POST uploads
|
652 |
-
* Wrapping function.php in an if-statement to ensure Guzzle can be used
|
653 |
-
globally and in a Composer install
|
654 |
-
* Fixed an issue with generating and merging in events to an event array
|
655 |
-
* POST headers are only applied before sending a request to allow you to change
|
656 |
-
the query aggregator used before uploading
|
657 |
-
* Added much more robust query string parsing
|
658 |
-
* Fixed various parsing and normalization issues with URLs
|
659 |
-
* Fixing an issue where multi-valued headers were not being utilized correctly
|
660 |
-
in the StreamAdapter
|
661 |
-
|
662 |
-
## 4.1.2 - 2014-06-18
|
663 |
-
|
664 |
-
* Added support for sending payloads with GET requests
|
665 |
-
|
666 |
-
## 4.1.1 - 2014-06-08
|
667 |
-
|
668 |
-
* Fixed an issue related to using custom message factory options in subclasses
|
669 |
-
* Fixed an issue with nested form fields in a multi-part POST
|
670 |
-
* Fixed an issue with using the `json` request option for POST requests
|
671 |
-
* Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar`
|
672 |
-
|
673 |
-
## 4.1.0 - 2014-05-27
|
674 |
-
|
675 |
-
* Added a `json` request option to easily serialize JSON payloads.
|
676 |
-
* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON.
|
677 |
-
* Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`.
|
678 |
-
* Added the ability to provide an emitter to a client in the client constructor.
|
679 |
-
* Added the ability to persist a cookie session using $_SESSION.
|
680 |
-
* Added a trait that can be used to add event listeners to an iterator.
|
681 |
-
* Removed request method constants from RequestInterface.
|
682 |
-
* Fixed warning when invalid request start-lines are received.
|
683 |
-
* Updated MessageFactory to work with custom request option methods.
|
684 |
-
* Updated cacert bundle to latest build.
|
685 |
-
|
686 |
-
4.0.2 (2014-04-16)
|
687 |
-
------------------
|
688 |
-
|
689 |
-
* Proxy requests using the StreamAdapter now properly use request_fulluri (#632)
|
690 |
-
* Added the ability to set scalars as POST fields (#628)
|
691 |
-
|
692 |
-
## 4.0.1 - 2014-04-04
|
693 |
-
|
694 |
-
* The HTTP status code of a response is now set as the exception code of
|
695 |
-
RequestException objects.
|
696 |
-
* 303 redirects will now correctly switch from POST to GET requests.
|
697 |
-
* The default parallel adapter of a client now correctly uses the MultiAdapter.
|
698 |
-
* HasDataTrait now initializes the internal data array as an empty array so
|
699 |
-
that the toArray() method always returns an array.
|
700 |
-
|
701 |
-
## 4.0.0 - 2014-03-29
|
702 |
-
|
703 |
-
* For information on changes and upgrading, see:
|
704 |
-
https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
|
705 |
-
* Added `GuzzleHttp\batch()` as a convenience function for sending requests in
|
706 |
-
parallel without needing to write asynchronous code.
|
707 |
-
* Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`.
|
708 |
-
You can now pass a callable or an array of associative arrays where each
|
709 |
-
associative array contains the "fn", "priority", and "once" keys.
|
710 |
-
|
711 |
-
## 4.0.0.rc-2 - 2014-03-25
|
712 |
-
|
713 |
-
* Removed `getConfig()` and `setConfig()` from clients to avoid confusion
|
714 |
-
around whether things like base_url, message_factory, etc. should be able to
|
715 |
-
be retrieved or modified.
|
716 |
-
* Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface
|
717 |
-
* functions.php functions were renamed using snake_case to match PHP idioms
|
718 |
-
* Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and
|
719 |
-
`GUZZLE_CURL_SELECT_TIMEOUT` environment variables
|
720 |
-
* Added the ability to specify custom `sendAll()` event priorities
|
721 |
-
* Added the ability to specify custom stream context options to the stream
|
722 |
-
adapter.
|
723 |
-
* Added a functions.php function for `get_path()` and `set_path()`
|
724 |
-
* CurlAdapter and MultiAdapter now use a callable to generate curl resources
|
725 |
-
* MockAdapter now properly reads a body and emits a `headers` event
|
726 |
-
* Updated Url class to check if a scheme and host are set before adding ":"
|
727 |
-
and "//". This allows empty Url (e.g., "") to be serialized as "".
|
728 |
-
* Parsing invalid XML no longer emits warnings
|
729 |
-
* Curl classes now properly throw AdapterExceptions
|
730 |
-
* Various performance optimizations
|
731 |
-
* Streams are created with the faster `Stream\create()` function
|
732 |
-
* Marked deprecation_proxy() as internal
|
733 |
-
* Test server is now a collection of static methods on a class
|
734 |
-
|
735 |
-
## 4.0.0-rc.1 - 2014-03-15
|
736 |
-
|
737 |
-
* See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
|
738 |
-
|
739 |
-
## 3.8.1 - 2014-01-28
|
740 |
-
|
741 |
-
* Bug: Always using GET requests when redirecting from a 303 response
|
742 |
-
* Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in
|
743 |
-
`Guzzle\Http\ClientInterface::setSslVerification()`
|
744 |
-
* Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL
|
745 |
-
* Bug: The body of a request can now be set to `"0"`
|
746 |
-
* Sending PHP stream requests no longer forces `HTTP/1.0`
|
747 |
-
* Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of
|
748 |
-
each sub-exception
|
749 |
-
* Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than
|
750 |
-
clobbering everything).
|
751 |
-
* Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators)
|
752 |
-
* Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`.
|
753 |
-
For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`.
|
754 |
-
* Now properly escaping the regular expression delimiter when matching Cookie domains.
|
755 |
-
* Network access is now disabled when loading XML documents
|
756 |
-
|
757 |
-
## 3.8.0 - 2013-12-05
|
758 |
-
|
759 |
-
* Added the ability to define a POST name for a file
|
760 |
-
* JSON response parsing now properly walks additionalProperties
|
761 |
-
* cURL error code 18 is now retried automatically in the BackoffPlugin
|
762 |
-
* Fixed a cURL error when URLs contain fragments
|
763 |
-
* Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were
|
764 |
-
CurlExceptions
|
765 |
-
* CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e)
|
766 |
-
* Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS`
|
767 |
-
* Fixed a bug that was encountered when parsing empty header parameters
|
768 |
-
* UriTemplate now has a `setRegex()` method to match the docs
|
769 |
-
* The `debug` request parameter now checks if it is truthy rather than if it exists
|
770 |
-
* Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin
|
771 |
-
* Added the ability to combine URLs using strict RFC 3986 compliance
|
772 |
-
* Command objects can now return the validation errors encountered by the command
|
773 |
-
* Various fixes to cache revalidation (#437 and 29797e5)
|
774 |
-
* Various fixes to the AsyncPlugin
|
775 |
-
* Cleaned up build scripts
|
776 |
-
|
777 |
-
## 3.7.4 - 2013-10-02
|
778 |
-
|
779 |
-
* Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430)
|
780 |
-
* Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp
|
781 |
-
(see https://github.com/aws/aws-sdk-php/issues/147)
|
782 |
-
* Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots
|
783 |
-
* Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420)
|
784 |
-
* Updated the bundled cacert.pem (#419)
|
785 |
-
* OauthPlugin now supports adding authentication to headers or query string (#425)
|
786 |
-
|
787 |
-
## 3.7.3 - 2013-09-08
|
788 |
-
|
789 |
-
* Added the ability to get the exception associated with a request/command when using `MultiTransferException` and
|
790 |
-
`CommandTransferException`.
|
791 |
-
* Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description
|
792 |
-
* Schemas are only injected into response models when explicitly configured.
|
793 |
-
* No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of
|
794 |
-
an EntityBody.
|
795 |
-
* Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator.
|
796 |
-
* Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`.
|
797 |
-
* Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody()
|
798 |
-
* Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin
|
799 |
-
* Bug fix: Visiting XML attributes first before visiting XML children when serializing requests
|
800 |
-
* Bug fix: Properly parsing headers that contain commas contained in quotes
|
801 |
-
* Bug fix: mimetype guessing based on a filename is now case-insensitive
|
802 |
-
|
803 |
-
## 3.7.2 - 2013-08-02
|
804 |
-
|
805 |
-
* Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander
|
806 |
-
See https://github.com/guzzle/guzzle/issues/371
|
807 |
-
* Bug fix: Cookie domains are now matched correctly according to RFC 6265
|
808 |
-
See https://github.com/guzzle/guzzle/issues/377
|
809 |
-
* Bug fix: GET parameters are now used when calculating an OAuth signature
|
810 |
-
* Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted
|
811 |
-
* `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched
|
812 |
-
* `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input.
|
813 |
-
See https://github.com/guzzle/guzzle/issues/379
|
814 |
-
* Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See
|
815 |
-
https://github.com/guzzle/guzzle/pull/380
|
816 |
-
* cURL multi cleanup and optimizations
|
817 |
-
|
818 |
-
## 3.7.1 - 2013-07-05
|
819 |
-
|
820 |
-
* Bug fix: Setting default options on a client now works
|
821 |
-
* Bug fix: Setting options on HEAD requests now works. See #352
|
822 |
-
* Bug fix: Moving stream factory before send event to before building the stream. See #353
|
823 |
-
* Bug fix: Cookies no longer match on IP addresses per RFC 6265
|
824 |
-
* Bug fix: Correctly parsing header parameters that are in `<>` and quotes
|
825 |
-
* Added `cert` and `ssl_key` as request options
|
826 |
-
* `Host` header can now diverge from the host part of a URL if the header is set manually
|
827 |
-
* `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter
|
828 |
-
* OAuth parameters are only added via the plugin if they aren't already set
|
829 |
-
* Exceptions are now thrown when a URL cannot be parsed
|
830 |
-
* Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails
|
831 |
-
* Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin
|
832 |
-
|
833 |
-
## 3.7.0 - 2013-06-10
|
834 |
-
|
835 |
-
* See UPGRADING.md for more information on how to upgrade.
|
836 |
-
* Requests now support the ability to specify an array of $options when creating a request to more easily modify a
|
837 |
-
request. You can pass a 'request.options' configuration setting to a client to apply default request options to
|
838 |
-
every request created by a client (e.g. default query string variables, headers, curl options, etc.).
|
839 |
-
* Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`.
|
840 |
-
See `Guzzle\Http\StaticClient::mount`.
|
841 |
-
* Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests
|
842 |
-
created by a command (e.g. custom headers, query string variables, timeout settings, etc.).
|
843 |
-
* Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the
|
844 |
-
headers of a response
|
845 |
-
* Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key
|
846 |
-
(e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`)
|
847 |
-
* ServiceBuilders now support storing and retrieving arbitrary data
|
848 |
-
* CachePlugin can now purge all resources for a given URI
|
849 |
-
* CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource
|
850 |
-
* CachePlugin now uses the Vary header to determine if a resource is a cache hit
|
851 |
-
* `Guzzle\Http\Message\Response` now implements `\Serializable`
|
852 |
-
* Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters
|
853 |
-
* `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable
|
854 |
-
* Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()`
|
855 |
-
* Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size
|
856 |
-
* `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message
|
857 |
-
* Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older
|
858 |
-
Symfony users can still use the old version of Monolog.
|
859 |
-
* Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`.
|
860 |
-
Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`.
|
861 |
-
* Several performance improvements to `Guzzle\Common\Collection`
|
862 |
-
* Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
|
863 |
-
createRequest, head, delete, put, patch, post, options, prepareRequest
|
864 |
-
* Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
|
865 |
-
* Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
|
866 |
-
* Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
|
867 |
-
`Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
|
868 |
-
resource, string, or EntityBody into the $options parameter to specify the download location of the response.
|
869 |
-
* Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
|
870 |
-
default `array()`
|
871 |
-
* Added `Guzzle\Stream\StreamInterface::isRepeatable`
|
872 |
-
* Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
|
873 |
-
$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
|
874 |
-
$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`.
|
875 |
-
* Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`.
|
876 |
-
* Removed `Guzzle\Http\ClientInterface::expandTemplate()`
|
877 |
-
* Removed `Guzzle\Http\ClientInterface::setRequestFactory()`
|
878 |
-
* Removed `Guzzle\Http\ClientInterface::getCurlMulti()`
|
879 |
-
* Removed `Guzzle\Http\Message\RequestInterface::canCache`
|
880 |
-
* Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`
|
881 |
-
* Removed `Guzzle\Http\Message\RequestInterface::isRedirect`
|
882 |
-
* Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
|
883 |
-
* You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting
|
884 |
-
`Guzzle\Common\Version::$emitWarnings` to true.
|
885 |
-
* Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use
|
886 |
-
`$request->getResponseBody()->isRepeatable()` instead.
|
887 |
-
* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
|
888 |
-
`Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
|
889 |
-
* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
|
890 |
-
`Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
|
891 |
-
* Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
|
892 |
-
* Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
|
893 |
-
* Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
|
894 |
-
* Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand.
|
895 |
-
These will work through Guzzle 4.0
|
896 |
-
* Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params].
|
897 |
-
* Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
|
898 |
-
* Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`.
|
899 |
-
* Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`.
|
900 |
-
* Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
|
901 |
-
* Marked `Guzzle\Common\Collection::inject()` as deprecated.
|
902 |
-
* Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');`
|
903 |
-
* CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
|
904 |
-
CacheStorageInterface. These two objects and interface will be removed in a future version.
|
905 |
-
* Always setting X-cache headers on cached responses
|
906 |
-
* Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
|
907 |
-
* `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
|
908 |
-
$request, Response $response);`
|
909 |
-
* `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
|
910 |
-
* `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
|
911 |
-
* Added `CacheStorageInterface::purge($url)`
|
912 |
-
* `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
|
913 |
-
$plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
|
914 |
-
CanCacheStrategyInterface $canCache = null)`
|
915 |
-
* Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
|
916 |
-
|
917 |
-
## 3.6.0 - 2013-05-29
|
918 |
-
|
919 |
-
* ServiceDescription now implements ToArrayInterface
|
920 |
-
* Added command.hidden_params to blacklist certain headers from being treated as additionalParameters
|
921 |
-
* Guzzle can now correctly parse incomplete URLs
|
922 |
-
* Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
|
923 |
-
* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
|
924 |
-
* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
|
925 |
-
* Specific header implementations can be created for complex headers. When a message creates a header, it uses a
|
926 |
-
HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
|
927 |
-
CacheControl header implementation.
|
928 |
-
* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
|
929 |
-
* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
|
930 |
-
* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
|
931 |
-
Guzzle\Http\Curl\RequestMediator
|
932 |
-
* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
|
933 |
-
* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
|
934 |
-
* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
|
935 |
-
* Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
|
936 |
-
* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
|
937 |
-
* All response header helper functions return a string rather than mixing Header objects and strings inconsistently
|
938 |
-
* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
|
939 |
-
directly via interfaces
|
940 |
-
* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
|
941 |
-
but are a no-op until removed.
|
942 |
-
* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
|
943 |
-
`Guzzle\Service\Command\ArrayCommandInterface`.
|
944 |
-
* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
|
945 |
-
on a request while the request is still being transferred
|
946 |
-
* The ability to case-insensitively search for header values
|
947 |
-
* Guzzle\Http\Message\Header::hasExactHeader
|
948 |
-
* Guzzle\Http\Message\Header::raw. Use getAll()
|
949 |
-
* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
|
950 |
-
instead.
|
951 |
-
* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
|
952 |
-
* Added the ability to cast Model objects to a string to view debug information.
|
953 |
-
|
954 |
-
## 3.5.0 - 2013-05-13
|
955 |
-
|
956 |
-
* Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times
|
957 |
-
* Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove
|
958 |
-
itself from the EventDispatcher)
|
959 |
-
* Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values
|
960 |
-
* Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too
|
961 |
-
* Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a
|
962 |
-
non-existent key
|
963 |
-
* Bug: All __call() method arguments are now required (helps with mocking frameworks)
|
964 |
-
* Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference
|
965 |
-
to help with refcount based garbage collection of resources created by sending a request
|
966 |
-
* Deprecating ZF1 cache and log adapters. These will be removed in the next major version.
|
967 |
-
* Deprecating `Response::getPreviousResponse()` (method signature still exists, but it's deprecated). Use the
|
968 |
-
HistoryPlugin for a history.
|
969 |
-
* Added a `responseBody` alias for the `response_body` location
|
970 |
-
* Refactored internals to no longer rely on Response::getRequest()
|
971 |
-
* HistoryPlugin can now be cast to a string
|
972 |
-
* HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests
|
973 |
-
and responses that are sent over the wire
|
974 |
-
* Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects
|
975 |
-
|
976 |
-
## 3.4.3 - 2013-04-30
|
977 |
-
|
978 |
-
* Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response
|
979 |
-
* Added a check to re-extract the temp cacert bundle from the phar before sending each request
|
980 |
-
|
981 |
-
## 3.4.2 - 2013-04-29
|
982 |
-
|
983 |
-
* Bug fix: Stream objects now work correctly with "a" and "a+" modes
|
984 |
-
* Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present
|
985 |
-
* Bug fix: AsyncPlugin no longer forces HEAD requests
|
986 |
-
* Bug fix: DateTime timezones are now properly handled when using the service description schema formatter
|
987 |
-
* Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails
|
988 |
-
* Setting a response on a request will write to the custom request body from the response body if one is specified
|
989 |
-
* LogPlugin now writes to php://output when STDERR is undefined
|
990 |
-
* Added the ability to set multiple POST files for the same key in a single call
|
991 |
-
* application/x-www-form-urlencoded POSTs now use the utf-8 charset by default
|
992 |
-
* Added the ability to queue CurlExceptions to the MockPlugin
|
993 |
-
* Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send)
|
994 |
-
* Configuration loading now allows remote files
|
995 |
-
|
996 |
-
## 3.4.1 - 2013-04-16
|
997 |
-
|
998 |
-
* Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti
|
999 |
-
handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost.
|
1000 |
-
* Exceptions are now properly grouped when sending requests in parallel
|
1001 |
-
* Redirects are now properly aggregated when a multi transaction fails
|
1002 |
-
* Redirects now set the response on the original object even in the event of a failure
|
1003 |
-
* Bug fix: Model names are now properly set even when using $refs
|
1004 |
-
* Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax
|
1005 |
-
* Added support for oauth_callback in OAuth signatures
|
1006 |
-
* Added support for oauth_verifier in OAuth signatures
|
1007 |
-
* Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection
|
1008 |
-
|
1009 |
-
## 3.4.0 - 2013-04-11
|
1010 |
-
|
1011 |
-
* Bug fix: URLs are now resolved correctly based on https://tools.ietf.org/html/rfc3986#section-5.2. #289
|
1012 |
-
* Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289
|
1013 |
-
* Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263
|
1014 |
-
* Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264.
|
1015 |
-
* Bug fix: Added `number` type to service descriptions.
|
1016 |
-
* Bug fix: empty parameters are removed from an OAuth signature
|
1017 |
-
* Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header
|
1018 |
-
* Bug fix: Fixed "array to string" error when validating a union of types in a service description
|
1019 |
-
* Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream
|
1020 |
-
* Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin.
|
1021 |
-
* Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs.
|
1022 |
-
* The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections.
|
1023 |
-
* Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if
|
1024 |
-
the Content-Type can be determined based on the entity body or the path of the request.
|
1025 |
-
* Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder.
|
1026 |
-
* Added support for a PSR-3 LogAdapter.
|
1027 |
-
* Added a `command.after_prepare` event
|
1028 |
-
* Added `oauth_callback` parameter to the OauthPlugin
|
1029 |
-
* Added the ability to create a custom stream class when using a stream factory
|
1030 |
-
* Added a CachingEntityBody decorator
|
1031 |
-
* Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized.
|
1032 |
-
* The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar.
|
1033 |
-
* You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies
|
1034 |
-
* POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This
|
1035 |
-
means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use
|
1036 |
-
POST fields or files (the latter is only used when emulating a form POST in the browser).
|
1037 |
-
* Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest
|
1038 |
-
|
1039 |
-
## 3.3.1 - 2013-03-10
|
1040 |
-
|
1041 |
-
* Added the ability to create PHP streaming responses from HTTP requests
|
1042 |
-
* Bug fix: Running any filters when parsing response headers with service descriptions
|
1043 |
-
* Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing
|
1044 |
-
* Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across
|
1045 |
-
response location visitors.
|
1046 |
-
* Bug fix: Removed the possibility of creating configuration files with circular dependencies
|
1047 |
-
* RequestFactory::create() now uses the key of a POST file when setting the POST file name
|
1048 |
-
* Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set
|
1049 |
-
|
1050 |
-
## 3.3.0 - 2013-03-03
|
1051 |
-
|
1052 |
-
* A large number of performance optimizations have been made
|
1053 |
-
* Bug fix: Added 'wb' as a valid write mode for streams
|
1054 |
-
* Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned
|
1055 |
-
* Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()`
|
1056 |
-
* BC: Removed `Guzzle\Http\Utils` class
|
1057 |
-
* BC: Setting a service description on a client will no longer modify the client's command factories.
|
1058 |
-
* BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using
|
1059 |
-
the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
|
1060 |
-
* BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to
|
1061 |
-
lowercase
|
1062 |
-
* Operation parameter objects are now lazy loaded internally
|
1063 |
-
* Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses
|
1064 |
-
* Added support for instantiating responseType=class responseClass classes. Classes must implement
|
1065 |
-
`Guzzle\Service\Command\ResponseClassInterface`
|
1066 |
-
* Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These
|
1067 |
-
additional properties also support locations and can be used to parse JSON responses where the outermost part of the
|
1068 |
-
JSON is an array
|
1069 |
-
* Added support for nested renaming of JSON models (rename sentAs to name)
|
1070 |
-
* CachePlugin
|
1071 |
-
* Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error
|
1072 |
-
* Debug headers can now added to cached response in the CachePlugin
|
1073 |
-
|
1074 |
-
## 3.2.0 - 2013-02-14
|
1075 |
-
|
1076 |
-
* CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients.
|
1077 |
-
* URLs with no path no longer contain a "/" by default
|
1078 |
-
* Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url.
|
1079 |
-
* BadResponseException no longer includes the full request and response message
|
1080 |
-
* Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface
|
1081 |
-
* Adding getResponseBody() to Guzzle\Http\Message\RequestInterface
|
1082 |
-
* Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription
|
1083 |
-
* Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list
|
1084 |
-
* xmlEncoding can now be customized for the XML declaration of a XML service description operation
|
1085 |
-
* Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value
|
1086 |
-
aggregation and no longer uses callbacks
|
1087 |
-
* The URL encoding implementation of Guzzle\Http\QueryString can now be customized
|
1088 |
-
* Bug fix: Filters were not always invoked for array service description parameters
|
1089 |
-
* Bug fix: Redirects now use a target response body rather than a temporary response body
|
1090 |
-
* Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded
|
1091 |
-
* Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives
|
1092 |
-
|
1093 |
-
## 3.1.2 - 2013-01-27
|
1094 |
-
|
1095 |
-
* Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the
|
1096 |
-
response body. For example, the XmlVisitor now parses the XML response into an array in the before() method.
|
1097 |
-
* Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent
|
1098 |
-
* CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444)
|
1099 |
-
* Fixed a bug where redirect responses were not chained correctly using getPreviousResponse()
|
1100 |
-
* Setting default headers on a client after setting the user-agent will not erase the user-agent setting
|
1101 |
-
|
1102 |
-
## 3.1.1 - 2013-01-20
|
1103 |
-
|
1104 |
-
* Adding wildcard support to Guzzle\Common\Collection::getPath()
|
1105 |
-
* Adding alias support to ServiceBuilder configs
|
1106 |
-
* Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface
|
1107 |
-
|
1108 |
-
## 3.1.0 - 2013-01-12
|
1109 |
-
|
1110 |
-
* BC: CurlException now extends from RequestException rather than BadResponseException
|
1111 |
-
* BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse()
|
1112 |
-
* Added getData to ServiceDescriptionInterface
|
1113 |
-
* Added context array to RequestInterface::setState()
|
1114 |
-
* Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http
|
1115 |
-
* Bug: Adding required content-type when JSON request visitor adds JSON to a command
|
1116 |
-
* Bug: Fixing the serialization of a service description with custom data
|
1117 |
-
* Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing
|
1118 |
-
an array of successful and failed responses
|
1119 |
-
* Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection
|
1120 |
-
* Added Guzzle\Http\IoEmittingEntityBody
|
1121 |
-
* Moved command filtration from validators to location visitors
|
1122 |
-
* Added `extends` attributes to service description parameters
|
1123 |
-
* Added getModels to ServiceDescriptionInterface
|
1124 |
-
|
1125 |
-
## 3.0.7 - 2012-12-19
|
1126 |
-
|
1127 |
-
* Fixing phar detection when forcing a cacert to system if null or true
|
1128 |
-
* Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()`
|
1129 |
-
* Cleaning up `Guzzle\Common\Collection::inject` method
|
1130 |
-
* Adding a response_body location to service descriptions
|
1131 |
-
|
1132 |
-
## 3.0.6 - 2012-12-09
|
1133 |
-
|
1134 |
-
* CurlMulti performance improvements
|
1135 |
-
* Adding setErrorResponses() to Operation
|
1136 |
-
* composer.json tweaks
|
1137 |
-
|
1138 |
-
## 3.0.5 - 2012-11-18
|
1139 |
-
|
1140 |
-
* Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin
|
1141 |
-
* Bug: Response body can now be a string containing "0"
|
1142 |
-
* Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert
|
1143 |
-
* Bug: QueryString::fromString now properly parses query string parameters that contain equal signs
|
1144 |
-
* Added support for XML attributes in service description responses
|
1145 |
-
* DefaultRequestSerializer now supports array URI parameter values for URI template expansion
|
1146 |
-
* Added better mimetype guessing to requests and post files
|
1147 |
-
|
1148 |
-
## 3.0.4 - 2012-11-11
|
1149 |
-
|
1150 |
-
* Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value
|
1151 |
-
* Bug: Cookies can now be added that have a name, domain, or value set to "0"
|
1152 |
-
* Bug: Using the system cacert bundle when using the Phar
|
1153 |
-
* Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures
|
1154 |
-
* Enhanced cookie jar de-duplication
|
1155 |
-
* Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added
|
1156 |
-
* Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies
|
1157 |
-
* Added the ability to create any sort of hash for a stream rather than just an MD5 hash
|
1158 |
-
|
1159 |
-
## 3.0.3 - 2012-11-04
|
1160 |
-
|
1161 |
-
* Implementing redirects in PHP rather than cURL
|
1162 |
-
* Added PECL URI template extension and using as default parser if available
|
1163 |
-
* Bug: Fixed Content-Length parsing of Response factory
|
1164 |
-
* Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams.
|
1165 |
-
* Adding ToArrayInterface throughout library
|
1166 |
-
* Fixing OauthPlugin to create unique nonce values per request
|
1167 |
-
|
1168 |
-
## 3.0.2 - 2012-10-25
|
1169 |
-
|
1170 |
-
* Magic methods are enabled by default on clients
|
1171 |
-
* Magic methods return the result of a command
|
1172 |
-
* Service clients no longer require a base_url option in the factory
|
1173 |
-
* Bug: Fixed an issue with URI templates where null template variables were being expanded
|
1174 |
-
|
1175 |
-
## 3.0.1 - 2012-10-22
|
1176 |
-
|
1177 |
-
* Models can now be used like regular collection objects by calling filter, map, etc.
|
1178 |
-
* Models no longer require a Parameter structure or initial data in the constructor
|
1179 |
-
* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator`
|
1180 |
-
|
1181 |
-
## 3.0.0 - 2012-10-15
|
1182 |
-
|
1183 |
-
* Rewrote service description format to be based on Swagger
|
1184 |
-
* Now based on JSON schema
|
1185 |
-
* Added nested input structures and nested response models
|
1186 |
-
* Support for JSON and XML input and output models
|
1187 |
-
* Renamed `commands` to `operations`
|
1188 |
-
* Removed dot class notation
|
1189 |
-
* Removed custom types
|
1190 |
-
* Broke the project into smaller top-level namespaces to be more component friendly
|
1191 |
-
* Removed support for XML configs and descriptions. Use arrays or JSON files.
|
1192 |
-
* Removed the Validation component and Inspector
|
1193 |
-
* Moved all cookie code to Guzzle\Plugin\Cookie
|
1194 |
-
* Magic methods on a Guzzle\Service\Client now return the command un-executed.
|
1195 |
-
* Calling getResult() or getResponse() on a command will lazily execute the command if needed.
|
1196 |
-
* Now shipping with cURL's CA certs and using it by default
|
1197 |
-
* Added previousResponse() method to response objects
|
1198 |
-
* No longer sending Accept and Accept-Encoding headers on every request
|
1199 |
-
* Only sending an Expect header by default when a payload is greater than 1MB
|
1200 |
-
* Added/moved client options:
|
1201 |
-
* curl.blacklist to curl.option.blacklist
|
1202 |
-
* Added ssl.certificate_authority
|
1203 |
-
* Added a Guzzle\Iterator component
|
1204 |
-
* Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin
|
1205 |
-
* Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin)
|
1206 |
-
* Added a more robust caching plugin
|
1207 |
-
* Added setBody to response objects
|
1208 |
-
* Updating LogPlugin to use a more flexible MessageFormatter
|
1209 |
-
* Added a completely revamped build process
|
1210 |
-
* Cleaning up Collection class and removing default values from the get method
|
1211 |
-
* Fixed ZF2 cache adapters
|
1212 |
-
|
1213 |
-
## 2.8.8 - 2012-10-15
|
1214 |
-
|
1215 |
-
* Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did
|
1216 |
-
|
1217 |
-
## 2.8.7 - 2012-09-30
|
1218 |
-
|
1219 |
-
* Bug: Fixed config file aliases for JSON includes
|
1220 |
-
* Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests
|
1221 |
-
* Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload
|
1222 |
-
* Bug: Hardening request and response parsing to account for missing parts
|
1223 |
-
* Bug: Fixed PEAR packaging
|
1224 |
-
* Bug: Fixed Request::getInfo
|
1225 |
-
* Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail
|
1226 |
-
* Adding the ability for the namespace Iterator factory to look in multiple directories
|
1227 |
-
* Added more getters/setters/removers from service descriptions
|
1228 |
-
* Added the ability to remove POST fields from OAuth signatures
|
1229 |
-
* OAuth plugin now supports 2-legged OAuth
|
1230 |
-
|
1231 |
-
## 2.8.6 - 2012-09-05
|
1232 |
-
|
1233 |
-
* Added the ability to modify and build service descriptions
|
1234 |
-
* Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command
|
1235 |
-
* Added a `json` parameter location
|
1236 |
-
* Now allowing dot notation for classes in the CacheAdapterFactory
|
1237 |
-
* Using the union of two arrays rather than an array_merge when extending service builder services and service params
|
1238 |
-
* Ensuring that a service is a string before doing strpos() checks on it when substituting services for references
|
1239 |
-
in service builder config files.
|
1240 |
-
* Services defined in two different config files that include one another will by default replace the previously
|
1241 |
-
defined service, but you can now create services that extend themselves and merge their settings over the previous
|
1242 |
-
* The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like
|
1243 |
-
'_default' with a default JSON configuration file.
|
1244 |
-
|
1245 |
-
## 2.8.5 - 2012-08-29
|
1246 |
-
|
1247 |
-
* Bug: Suppressed empty arrays from URI templates
|
1248 |
-
* Bug: Added the missing $options argument from ServiceDescription::factory to enable caching
|
1249 |
-
* Added support for HTTP responses that do not contain a reason phrase in the start-line
|
1250 |
-
* AbstractCommand commands are now invokable
|
1251 |
-
* Added a way to get the data used when signing an Oauth request before a request is sent
|
1252 |
-
|
1253 |
-
## 2.8.4 - 2012-08-15
|
1254 |
-
|
1255 |
-
* Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin
|
1256 |
-
* Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable.
|
1257 |
-
* Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream
|
1258 |
-
* Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream
|
1259 |
-
* Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5())
|
1260 |
-
* Added additional response status codes
|
1261 |
-
* Removed SSL information from the default User-Agent header
|
1262 |
-
* DELETE requests can now send an entity body
|
1263 |
-
* Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries
|
1264 |
-
* Added the ability of the MockPlugin to consume mocked request bodies
|
1265 |
-
* LogPlugin now exposes request and response objects in the extras array
|
1266 |
-
|
1267 |
-
## 2.8.3 - 2012-07-30
|
1268 |
-
|
1269 |
-
* Bug: Fixed a case where empty POST requests were sent as GET requests
|
1270 |
-
* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body
|
1271 |
-
* Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new
|
1272 |
-
* Added multiple inheritance to service description commands
|
1273 |
-
* Added an ApiCommandInterface and added `getParamNames()` and `hasParam()`
|
1274 |
-
* Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything
|
1275 |
-
* Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles
|
1276 |
-
|
1277 |
-
## 2.8.2 - 2012-07-24
|
1278 |
-
|
1279 |
-
* Bug: Query string values set to 0 are no longer dropped from the query string
|
1280 |
-
* Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()`
|
1281 |
-
* Bug: `+` is now treated as an encoded space when parsing query strings
|
1282 |
-
* QueryString and Collection performance improvements
|
1283 |
-
* Allowing dot notation for class paths in filters attribute of a service descriptions
|
1284 |
-
|
1285 |
-
## 2.8.1 - 2012-07-16
|
1286 |
-
|
1287 |
-
* Loosening Event Dispatcher dependency
|
1288 |
-
* POST redirects can now be customized using CURLOPT_POSTREDIR
|
1289 |
-
|
1290 |
-
## 2.8.0 - 2012-07-15
|
1291 |
-
|
1292 |
-
* BC: Guzzle\Http\Query
|
1293 |
-
* Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl)
|
1294 |
-
* Changed isEncodingValues() and isEncodingFields() to isUrlEncoding()
|
1295 |
-
* Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool)
|
1296 |
-
* Changed the aggregation functions of QueryString to be static methods
|
1297 |
-
* Can now use fromString() with querystrings that have a leading ?
|
1298 |
-
* cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters
|
1299 |
-
* Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body
|
1300 |
-
* Cookies are no longer URL decoded by default
|
1301 |
-
* Bug: URI template variables set to null are no longer expanded
|
1302 |
-
|
1303 |
-
## 2.7.2 - 2012-07-02
|
1304 |
-
|
1305 |
-
* BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser.
|
1306 |
-
* BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty()
|
1307 |
-
* CachePlugin now allows for a custom request parameter function to check if a request can be cached
|
1308 |
-
* Bug fix: CachePlugin now only caches GET and HEAD requests by default
|
1309 |
-
* Bug fix: Using header glue when transferring headers over the wire
|
1310 |
-
* Allowing deeply nested arrays for composite variables in URI templates
|
1311 |
-
* Batch divisors can now return iterators or arrays
|
1312 |
-
|
1313 |
-
## 2.7.1 - 2012-06-26
|
1314 |
-
|
1315 |
-
* Minor patch to update version number in UA string
|
1316 |
-
* Updating build process
|
1317 |
-
|
1318 |
-
## 2.7.0 - 2012-06-25
|
1319 |
-
|
1320 |
-
* BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes.
|
1321 |
-
* BC: Removed magic setX methods from commands
|
1322 |
-
* BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method
|
1323 |
-
* Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable.
|
1324 |
-
* Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity)
|
1325 |
-
* Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace
|
1326 |
-
* Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin
|
1327 |
-
* Added the ability to set POST fields and files in a service description
|
1328 |
-
* Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method
|
1329 |
-
* Adding a command.before_prepare event to clients
|
1330 |
-
* Added BatchClosureTransfer and BatchClosureDivisor
|
1331 |
-
* BatchTransferException now includes references to the batch divisor and transfer strategies
|
1332 |
-
* Fixed some tests so that they pass more reliably
|
1333 |
-
* Added Guzzle\Common\Log\ArrayLogAdapter
|
1334 |
-
|
1335 |
-
## 2.6.6 - 2012-06-10
|
1336 |
-
|
1337 |
-
* BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin
|
1338 |
-
* BC: Removing Guzzle\Service\Command\CommandSet
|
1339 |
-
* Adding generic batching system (replaces the batch queue plugin and command set)
|
1340 |
-
* Updating ZF cache and log adapters and now using ZF's composer repository
|
1341 |
-
* Bug: Setting the name of each ApiParam when creating through an ApiCommand
|
1342 |
-
* Adding result_type, result_doc, deprecated, and doc_url to service descriptions
|
1343 |
-
* Bug: Changed the default cookie header casing back to 'Cookie'
|
1344 |
-
|
1345 |
-
## 2.6.5 - 2012-06-03
|
1346 |
-
|
1347 |
-
* BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource()
|
1348 |
-
* BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from
|
1349 |
-
* BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data
|
1350 |
-
* BC: Renaming methods in the CookieJarInterface
|
1351 |
-
* Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations
|
1352 |
-
* Making the default glue for HTTP headers ';' instead of ','
|
1353 |
-
* Adding a removeValue to Guzzle\Http\Message\Header
|
1354 |
-
* Adding getCookies() to request interface.
|
1355 |
-
* Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber()
|
1356 |
-
|
1357 |
-
## 2.6.4 - 2012-05-30
|
1358 |
-
|
1359 |
-
* BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class.
|
1360 |
-
* BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand
|
1361 |
-
* Bug: Fixing magic method command calls on clients
|
1362 |
-
* Bug: Email constraint only validates strings
|
1363 |
-
* Bug: Aggregate POST fields when POST files are present in curl handle
|
1364 |
-
* Bug: Fixing default User-Agent header
|
1365 |
-
* Bug: Only appending or prepending parameters in commands if they are specified
|
1366 |
-
* Bug: Not requiring response reason phrases or status codes to match a predefined list of codes
|
1367 |
-
* Allowing the use of dot notation for class namespaces when using instance_of constraint
|
1368 |
-
* Added any_match validation constraint
|
1369 |
-
* Added an AsyncPlugin
|
1370 |
-
* Passing request object to the calculateWait method of the ExponentialBackoffPlugin
|
1371 |
-
* Allowing the result of a command object to be changed
|
1372 |
-
* Parsing location and type sub values when instantiating a service description rather than over and over at runtime
|
1373 |
-
|
1374 |
-
## 2.6.3 - 2012-05-23
|
1375 |
-
|
1376 |
-
* [BC] Guzzle\Common\FromConfigInterface no longer requires any config options.
|
1377 |
-
* [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields.
|
1378 |
-
* You can now use an array of data when creating PUT request bodies in the request factory.
|
1379 |
-
* Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable.
|
1380 |
-
* [Http] Adding support for Content-Type in multipart POST uploads per upload
|
1381 |
-
* [Http] Added support for uploading multiple files using the same name (foo[0], foo[1])
|
1382 |
-
* Adding more POST data operations for easier manipulation of POST data.
|
1383 |
-
* You can now set empty POST fields.
|
1384 |
-
* The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files.
|
1385 |
-
* Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate.
|
1386 |
-
* CS updates
|
1387 |
-
|
1388 |
-
## 2.6.2 - 2012-05-19
|
1389 |
-
|
1390 |
-
* [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method.
|
1391 |
-
|
1392 |
-
## 2.6.1 - 2012-05-19
|
1393 |
-
|
1394 |
-
* [BC] Removing 'path' support in service descriptions. Use 'uri'.
|
1395 |
-
* [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache.
|
1396 |
-
* [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it.
|
1397 |
-
* [BC] Removing Guzzle\Common\XmlElement.
|
1398 |
-
* All commands, both dynamic and concrete, have ApiCommand objects.
|
1399 |
-
* Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits.
|
1400 |
-
* Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored.
|
1401 |
-
* Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible.
|
1402 |
-
|
1403 |
-
## 2.6.0 - 2012-05-15
|
1404 |
-
|
1405 |
-
* [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder
|
1406 |
-
* [BC] Executing a Command returns the result of the command rather than the command
|
1407 |
-
* [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed.
|
1408 |
-
* [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args.
|
1409 |
-
* [BC] Moving ResourceIterator* to Guzzle\Service\Resource
|
1410 |
-
* [BC] Completely refactored ResourceIterators to iterate over a cloned command object
|
1411 |
-
* [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate
|
1412 |
-
* [BC] Guzzle\Guzzle is now deprecated
|
1413 |
-
* Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject
|
1414 |
-
* Adding Guzzle\Version class to give version information about Guzzle
|
1415 |
-
* Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate()
|
1416 |
-
* Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data
|
1417 |
-
* ServiceDescription and ServiceBuilder are now cacheable using similar configs
|
1418 |
-
* Changing the format of XML and JSON service builder configs. Backwards compatible.
|
1419 |
-
* Cleaned up Cookie parsing
|
1420 |
-
* Trimming the default Guzzle User-Agent header
|
1421 |
-
* Adding a setOnComplete() method to Commands that is called when a command completes
|
1422 |
-
* Keeping track of requests that were mocked in the MockPlugin
|
1423 |
-
* Fixed a caching bug in the CacheAdapterFactory
|
1424 |
-
* Inspector objects can be injected into a Command object
|
1425 |
-
* Refactoring a lot of code and tests to be case insensitive when dealing with headers
|
1426 |
-
* Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL
|
1427 |
-
* Adding the ability to set global option overrides to service builder configs
|
1428 |
-
* Adding the ability to include other service builder config files from within XML and JSON files
|
1429 |
-
* Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method.
|
1430 |
-
|
1431 |
-
## 2.5.0 - 2012-05-08
|
1432 |
-
|
1433 |
-
* Major performance improvements
|
1434 |
-
* [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated.
|
1435 |
-
* [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component.
|
1436 |
-
* [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}"
|
1437 |
-
* Added the ability to passed parameters to all requests created by a client
|
1438 |
-
* Added callback functionality to the ExponentialBackoffPlugin
|
1439 |
-
* Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies.
|
1440 |
-
* Rewinding request stream bodies when retrying requests
|
1441 |
-
* Exception is thrown when JSON response body cannot be decoded
|
1442 |
-
* Added configurable magic method calls to clients and commands. This is off by default.
|
1443 |
-
* Fixed a defect that added a hash to every parsed URL part
|
1444 |
-
* Fixed duplicate none generation for OauthPlugin.
|
1445 |
-
* Emitting an event each time a client is generated by a ServiceBuilder
|
1446 |
-
* Using an ApiParams object instead of a Collection for parameters of an ApiCommand
|
1447 |
-
* cache.* request parameters should be renamed to params.cache.*
|
1448 |
-
* Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle.
|
1449 |
-
* Added the ability to disable type validation of service descriptions
|
1450 |
-
* ServiceDescriptions and ServiceBuilders are now Serializable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
Copyright (c) 2011 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
|
2 |
-
|
3 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
-
of this software and associated documentation files (the "Software"), to deal
|
5 |
-
in the Software without restriction, including without limitation the rights
|
6 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
-
copies of the Software, and to permit persons to whom the Software is
|
8 |
-
furnished to do so, subject to the following conditions:
|
9 |
-
|
10 |
-
The above copyright notice and this permission notice shall be included in
|
11 |
-
all copies or substantial portions of the Software.
|
12 |
-
|
13 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/README.md
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
![Guzzle](.github/logo.png?raw=true)
|
2 |
-
|
3 |
-
# Guzzle, PHP HTTP client
|
4 |
-
|
5 |
-
[![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases)
|
6 |
-
[![Build Status](https://img.shields.io/github/workflow/status/guzzle/guzzle/CI?label=ci%20build&style=flat-square)](https://github.com/guzzle/guzzle/actions?query=workflow%3ACI)
|
7 |
-
[![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle)
|
8 |
-
|
9 |
-
Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
|
10 |
-
trivial to integrate with web services.
|
11 |
-
|
12 |
-
- Simple interface for building query strings, POST requests, streaming large
|
13 |
-
uploads, streaming large downloads, using HTTP cookies, uploading JSON data,
|
14 |
-
etc...
|
15 |
-
- Can send both synchronous and asynchronous requests using the same interface.
|
16 |
-
- Uses PSR-7 interfaces for requests, responses, and streams. This allows you
|
17 |
-
to utilize other PSR-7 compatible libraries with Guzzle.
|
18 |
-
- Supports PSR-18 allowing interoperability between other PSR-18 HTTP Clients.
|
19 |
-
- Abstracts away the underlying HTTP transport, allowing you to write
|
20 |
-
environment and transport agnostic code; i.e., no hard dependency on cURL,
|
21 |
-
PHP streams, sockets, or non-blocking event loops.
|
22 |
-
- Middleware system allows you to augment and compose client behavior.
|
23 |
-
|
24 |
-
```php
|
25 |
-
$client = new \GuzzleHttp\Client();
|
26 |
-
$response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
|
27 |
-
|
28 |
-
echo $response->getStatusCode(); // 200
|
29 |
-
echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
|
30 |
-
echo $response->getBody(); // '{"id": 1420053, "name": "guzzle", ...}'
|
31 |
-
|
32 |
-
// Send an asynchronous request.
|
33 |
-
$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
|
34 |
-
$promise = $client->sendAsync($request)->then(function ($response) {
|
35 |
-
echo 'I completed! ' . $response->getBody();
|
36 |
-
});
|
37 |
-
|
38 |
-
$promise->wait();
|
39 |
-
```
|
40 |
-
|
41 |
-
## Help and docs
|
42 |
-
|
43 |
-
We use GitHub issues only to discuss bugs and new features. For support please refer to:
|
44 |
-
|
45 |
-
- [Documentation](http://guzzlephp.org/)
|
46 |
-
- [Stack Overflow](http://stackoverflow.com/questions/tagged/guzzle)
|
47 |
-
- [#guzzle](https://app.slack.com/client/T0D2S9JCT/CE6UAAKL4) channel on [PHP-HTTP Slack](http://slack.httplug.io/)
|
48 |
-
- [Gitter](https://gitter.im/guzzle/guzzle)
|
49 |
-
|
50 |
-
|
51 |
-
## Installing Guzzle
|
52 |
-
|
53 |
-
The recommended way to install Guzzle is through
|
54 |
-
[Composer](https://getcomposer.org/).
|
55 |
-
|
56 |
-
```bash
|
57 |
-
composer require guzzlehttp/guzzle
|
58 |
-
```
|
59 |
-
|
60 |
-
|
61 |
-
## Version Guidance
|
62 |
-
|
63 |
-
| Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 | PHP Version |
|
64 |
-
|---------|------------|---------------------|--------------|---------------------|---------------------|-------|-------------|
|
65 |
-
| 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >= 5.3.3 |
|
66 |
-
| 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >= 5.4 |
|
67 |
-
| 5.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 |
|
68 |
-
| 6.x | Security fixes | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >= 5.5 |
|
69 |
-
| 7.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v7][guzzle-7-repo] | [v7][guzzle-7-docs] | Yes | >= 7.2 |
|
70 |
-
|
71 |
-
[guzzle-3-repo]: https://github.com/guzzle/guzzle3
|
72 |
-
[guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x
|
73 |
-
[guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3
|
74 |
-
[guzzle-6-repo]: https://github.com/guzzle/guzzle/tree/6.5
|
75 |
-
[guzzle-7-repo]: https://github.com/guzzle/guzzle
|
76 |
-
[guzzle-3-docs]: http://guzzle3.readthedocs.org
|
77 |
-
[guzzle-5-docs]: http://docs.guzzlephp.org/en/5.3/
|
78 |
-
[guzzle-6-docs]: http://docs.guzzlephp.org/en/6.5/
|
79 |
-
[guzzle-7-docs]: http://docs.guzzlephp.org/en/latest/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/UPGRADING.md
DELETED
@@ -1,1253 +0,0 @@
|
|
1 |
-
Guzzle Upgrade Guide
|
2 |
-
====================
|
3 |
-
|
4 |
-
6.0 to 7.0
|
5 |
-
----------
|
6 |
-
|
7 |
-
In order to take advantage of the new features of PHP, Guzzle dropped the support
|
8 |
-
of PHP 5. The minimum supported PHP version is now PHP 7.2. Type hints and return
|
9 |
-
types for functions and methods have been added wherever possible.
|
10 |
-
|
11 |
-
Please make sure:
|
12 |
-
- You are calling a function or a method with the correct type.
|
13 |
-
- If you extend a class of Guzzle; update all signatures on methods you override.
|
14 |
-
|
15 |
-
#### Other backwards compatibility breaking changes
|
16 |
-
|
17 |
-
- Class `GuzzleHttp\UriTemplate` is removed.
|
18 |
-
- Class `GuzzleHttp\Exception\SeekException` is removed.
|
19 |
-
- Classes `GuzzleHttp\Exception\BadResponseException`, `GuzzleHttp\Exception\ClientException`,
|
20 |
-
`GuzzleHttp\Exception\ServerException` can no longer be initialized with an empty
|
21 |
-
Response as argument.
|
22 |
-
- Class `GuzzleHttp\Exception\ConnectException` now extends `GuzzleHttp\Exception\TransferException`
|
23 |
-
instead of `GuzzleHttp\Exception\RequestException`.
|
24 |
-
- Function `GuzzleHttp\Exception\ConnectException::getResponse()` is removed.
|
25 |
-
- Function `GuzzleHttp\Exception\ConnectException::hasResponse()` is removed.
|
26 |
-
- Constant `GuzzleHttp\ClientInterface::VERSION` is removed. Added `GuzzleHttp\ClientInterface::MAJOR_VERSION` instead.
|
27 |
-
- Function `GuzzleHttp\Exception\RequestException::getResponseBodySummary` is removed.
|
28 |
-
Use `\GuzzleHttp\Psr7\get_message_body_summary` as an alternative.
|
29 |
-
- Function `GuzzleHttp\Cookie\CookieJar::getCookieValue` is removed.
|
30 |
-
- Request option `exception` is removed. Please use `http_errors`.
|
31 |
-
- Request option `save_to` is removed. Please use `sink`.
|
32 |
-
- Pool option `pool_size` is removed. Please use `concurrency`.
|
33 |
-
- We now look for environment variables in the `$_SERVER` super global, due to thread safety issues with `getenv`. We continue to fallback to `getenv` in CLI environments, for maximum compatibility.
|
34 |
-
- The `get`, `head`, `put`, `post`, `patch`, `delete`, `getAsync`, `headAsync`, `putAsync`, `postAsync`, `patchAsync`, and `deleteAsync` methods are now implemented as genuine methods on `GuzzleHttp\Client`, with strong typing. The original `__call` implementation remains unchanged for now, for maximum backwards compatibility, but won't be invoked under normal operation.
|
35 |
-
- The `log` middleware will log the errors with level `error` instead of `notice`
|
36 |
-
- Support for international domain names (IDN) is now disabled by default, and enabling it requires installing ext-intl, linked against a modern version of the C library (ICU 4.6 or higher).
|
37 |
-
|
38 |
-
#### Native functions calls
|
39 |
-
|
40 |
-
All internal native functions calls of Guzzle are now prefixed with a slash. This
|
41 |
-
change makes it impossible for method overloading by other libraries or applications.
|
42 |
-
Example:
|
43 |
-
|
44 |
-
```php
|
45 |
-
// Before:
|
46 |
-
curl_version();
|
47 |
-
|
48 |
-
// After:
|
49 |
-
\curl_version();
|
50 |
-
```
|
51 |
-
|
52 |
-
For the full diff you can check [here](https://github.com/guzzle/guzzle/compare/6.5.4..master).
|
53 |
-
|
54 |
-
5.0 to 6.0
|
55 |
-
----------
|
56 |
-
|
57 |
-
Guzzle now uses [PSR-7](https://www.php-fig.org/psr/psr-7/) for HTTP messages.
|
58 |
-
Due to the fact that these messages are immutable, this prompted a refactoring
|
59 |
-
of Guzzle to use a middleware based system rather than an event system. Any
|
60 |
-
HTTP message interaction (e.g., `GuzzleHttp\Message\Request`) need to be
|
61 |
-
updated to work with the new immutable PSR-7 request and response objects. Any
|
62 |
-
event listeners or subscribers need to be updated to become middleware
|
63 |
-
functions that wrap handlers (or are injected into a
|
64 |
-
`GuzzleHttp\HandlerStack`).
|
65 |
-
|
66 |
-
- Removed `GuzzleHttp\BatchResults`
|
67 |
-
- Removed `GuzzleHttp\Collection`
|
68 |
-
- Removed `GuzzleHttp\HasDataTrait`
|
69 |
-
- Removed `GuzzleHttp\ToArrayInterface`
|
70 |
-
- The `guzzlehttp/streams` dependency has been removed. Stream functionality
|
71 |
-
is now present in the `GuzzleHttp\Psr7` namespace provided by the
|
72 |
-
`guzzlehttp/psr7` package.
|
73 |
-
- Guzzle no longer uses ReactPHP promises and now uses the
|
74 |
-
`guzzlehttp/promises` library. We use a custom promise library for three
|
75 |
-
significant reasons:
|
76 |
-
1. React promises (at the time of writing this) are recursive. Promise
|
77 |
-
chaining and promise resolution will eventually blow the stack. Guzzle
|
78 |
-
promises are not recursive as they use a sort of trampolining technique.
|
79 |
-
Note: there has been movement in the React project to modify promises to
|
80 |
-
no longer utilize recursion.
|
81 |
-
2. Guzzle needs to have the ability to synchronously block on a promise to
|
82 |
-
wait for a result. Guzzle promises allows this functionality (and does
|
83 |
-
not require the use of recursion).
|
84 |
-
3. Because we need to be able to wait on a result, doing so using React
|
85 |
-
promises requires wrapping react promises with RingPHP futures. This
|
86 |
-
overhead is no longer needed, reducing stack sizes, reducing complexity,
|
87 |
-
and improving performance.
|
88 |
-
- `GuzzleHttp\Mimetypes` has been moved to a function in
|
89 |
-
`GuzzleHttp\Psr7\mimetype_from_extension` and
|
90 |
-
`GuzzleHttp\Psr7\mimetype_from_filename`.
|
91 |
-
- `GuzzleHttp\Query` and `GuzzleHttp\QueryParser` have been removed. Query
|
92 |
-
strings must now be passed into request objects as strings, or provided to
|
93 |
-
the `query` request option when creating requests with clients. The `query`
|
94 |
-
option uses PHP's `http_build_query` to convert an array to a string. If you
|
95 |
-
need a different serialization technique, you will need to pass the query
|
96 |
-
string in as a string. There are a couple helper functions that will make
|
97 |
-
working with query strings easier: `GuzzleHttp\Psr7\parse_query` and
|
98 |
-
`GuzzleHttp\Psr7\build_query`.
|
99 |
-
- Guzzle no longer has a dependency on RingPHP. Due to the use of a middleware
|
100 |
-
system based on PSR-7, using RingPHP and it's middleware system as well adds
|
101 |
-
more complexity than the benefits it provides. All HTTP handlers that were
|
102 |
-
present in RingPHP have been modified to work directly with PSR-7 messages
|
103 |
-
and placed in the `GuzzleHttp\Handler` namespace. This significantly reduces
|
104 |
-
complexity in Guzzle, removes a dependency, and improves performance. RingPHP
|
105 |
-
will be maintained for Guzzle 5 support, but will no longer be a part of
|
106 |
-
Guzzle 6.
|
107 |
-
- As Guzzle now uses a middleware based systems the event system and RingPHP
|
108 |
-
integration has been removed. Note: while the event system has been removed,
|
109 |
-
it is possible to add your own type of event system that is powered by the
|
110 |
-
middleware system.
|
111 |
-
- Removed the `Event` namespace.
|
112 |
-
- Removed the `Subscriber` namespace.
|
113 |
-
- Removed `Transaction` class
|
114 |
-
- Removed `RequestFsm`
|
115 |
-
- Removed `RingBridge`
|
116 |
-
- `GuzzleHttp\Subscriber\Cookie` is now provided by
|
117 |
-
`GuzzleHttp\Middleware::cookies`
|
118 |
-
- `GuzzleHttp\Subscriber\HttpError` is now provided by
|
119 |
-
`GuzzleHttp\Middleware::httpError`
|
120 |
-
- `GuzzleHttp\Subscriber\History` is now provided by
|
121 |
-
`GuzzleHttp\Middleware::history`
|
122 |
-
- `GuzzleHttp\Subscriber\Mock` is now provided by
|
123 |
-
`GuzzleHttp\Handler\MockHandler`
|
124 |
-
- `GuzzleHttp\Subscriber\Prepare` is now provided by
|
125 |
-
`GuzzleHttp\PrepareBodyMiddleware`
|
126 |
-
- `GuzzleHttp\Subscriber\Redirect` is now provided by
|
127 |
-
`GuzzleHttp\RedirectMiddleware`
|
128 |
-
- Guzzle now uses `Psr\Http\Message\UriInterface` (implements in
|
129 |
-
`GuzzleHttp\Psr7\Uri`) for URI support. `GuzzleHttp\Url` is now gone.
|
130 |
-
- Static functions in `GuzzleHttp\Utils` have been moved to namespaced
|
131 |
-
functions under the `GuzzleHttp` namespace. This requires either a Composer
|
132 |
-
based autoloader or you to include functions.php.
|
133 |
-
- `GuzzleHttp\ClientInterface::getDefaultOption` has been renamed to
|
134 |
-
`GuzzleHttp\ClientInterface::getConfig`.
|
135 |
-
- `GuzzleHttp\ClientInterface::setDefaultOption` has been removed.
|
136 |
-
- The `json` and `xml` methods of response objects has been removed. With the
|
137 |
-
migration to strictly adhering to PSR-7 as the interface for Guzzle messages,
|
138 |
-
adding methods to message interfaces would actually require Guzzle messages
|
139 |
-
to extend from PSR-7 messages rather then work with them directly.
|
140 |
-
|
141 |
-
## Migrating to middleware
|
142 |
-
|
143 |
-
The change to PSR-7 unfortunately required significant refactoring to Guzzle
|
144 |
-
due to the fact that PSR-7 messages are immutable. Guzzle 5 relied on an event
|
145 |
-
system from plugins. The event system relied on mutability of HTTP messages and
|
146 |
-
side effects in order to work. With immutable messages, you have to change your
|
147 |
-
workflow to become more about either returning a value (e.g., functional
|
148 |
-
middlewares) or setting a value on an object. Guzzle v6 has chosen the
|
149 |
-
functional middleware approach.
|
150 |
-
|
151 |
-
Instead of using the event system to listen for things like the `before` event,
|
152 |
-
you now create a stack based middleware function that intercepts a request on
|
153 |
-
the way in and the promise of the response on the way out. This is a much
|
154 |
-
simpler and more predictable approach than the event system and works nicely
|
155 |
-
with PSR-7 middleware. Due to the use of promises, the middleware system is
|
156 |
-
also asynchronous.
|
157 |
-
|
158 |
-
v5:
|
159 |
-
|
160 |
-
```php
|
161 |
-
use GuzzleHttp\Event\BeforeEvent;
|
162 |
-
$client = new GuzzleHttp\Client();
|
163 |
-
// Get the emitter and listen to the before event.
|
164 |
-
$client->getEmitter()->on('before', function (BeforeEvent $e) {
|
165 |
-
// Guzzle v5 events relied on mutation
|
166 |
-
$e->getRequest()->setHeader('X-Foo', 'Bar');
|
167 |
-
});
|
168 |
-
```
|
169 |
-
|
170 |
-
v6:
|
171 |
-
|
172 |
-
In v6, you can modify the request before it is sent using the `mapRequest`
|
173 |
-
middleware. The idiomatic way in v6 to modify the request/response lifecycle is
|
174 |
-
to setup a handler middleware stack up front and inject the handler into a
|
175 |
-
client.
|
176 |
-
|
177 |
-
```php
|
178 |
-
use GuzzleHttp\Middleware;
|
179 |
-
// Create a handler stack that has all of the default middlewares attached
|
180 |
-
$handler = GuzzleHttp\HandlerStack::create();
|
181 |
-
// Push the handler onto the handler stack
|
182 |
-
$handler->push(Middleware::mapRequest(function (RequestInterface $request) {
|
183 |
-
// Notice that we have to return a request object
|
184 |
-
return $request->withHeader('X-Foo', 'Bar');
|
185 |
-
}));
|
186 |
-
// Inject the handler into the client
|
187 |
-
$client = new GuzzleHttp\Client(['handler' => $handler]);
|
188 |
-
```
|
189 |
-
|
190 |
-
## POST Requests
|
191 |
-
|
192 |
-
This version added the [`form_params`](http://guzzle.readthedocs.org/en/latest/request-options.html#form_params)
|
193 |
-
and `multipart` request options. `form_params` is an associative array of
|
194 |
-
strings or array of strings and is used to serialize an
|
195 |
-
`application/x-www-form-urlencoded` POST request. The
|
196 |
-
[`multipart`](http://guzzle.readthedocs.org/en/latest/request-options.html#multipart)
|
197 |
-
option is now used to send a multipart/form-data POST request.
|
198 |
-
|
199 |
-
`GuzzleHttp\Post\PostFile` has been removed. Use the `multipart` option to add
|
200 |
-
POST files to a multipart/form-data request.
|
201 |
-
|
202 |
-
The `body` option no longer accepts an array to send POST requests. Please use
|
203 |
-
`multipart` or `form_params` instead.
|
204 |
-
|
205 |
-
The `base_url` option has been renamed to `base_uri`.
|
206 |
-
|
207 |
-
4.x to 5.0
|
208 |
-
----------
|
209 |
-
|
210 |
-
## Rewritten Adapter Layer
|
211 |
-
|
212 |
-
Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send
|
213 |
-
HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor
|
214 |
-
is still supported, but it has now been renamed to `handler`. Instead of
|
215 |
-
passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP
|
216 |
-
`callable` that follows the RingPHP specification.
|
217 |
-
|
218 |
-
## Removed Fluent Interfaces
|
219 |
-
|
220 |
-
[Fluent interfaces were removed](https://ocramius.github.io/blog/fluent-interfaces-are-evil/)
|
221 |
-
from the following classes:
|
222 |
-
|
223 |
-
- `GuzzleHttp\Collection`
|
224 |
-
- `GuzzleHttp\Url`
|
225 |
-
- `GuzzleHttp\Query`
|
226 |
-
- `GuzzleHttp\Post\PostBody`
|
227 |
-
- `GuzzleHttp\Cookie\SetCookie`
|
228 |
-
|
229 |
-
## Removed functions.php
|
230 |
-
|
231 |
-
Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following
|
232 |
-
functions can be used as replacements.
|
233 |
-
|
234 |
-
- `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode`
|
235 |
-
- `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath`
|
236 |
-
- `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path`
|
237 |
-
- `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however,
|
238 |
-
deprecated in favor of using `GuzzleHttp\Pool::batch()`.
|
239 |
-
|
240 |
-
The "procedural" global client has been removed with no replacement (e.g.,
|
241 |
-
`GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client`
|
242 |
-
object as a replacement.
|
243 |
-
|
244 |
-
## `throwImmediately` has been removed
|
245 |
-
|
246 |
-
The concept of "throwImmediately" has been removed from exceptions and error
|
247 |
-
events. This control mechanism was used to stop a transfer of concurrent
|
248 |
-
requests from completing. This can now be handled by throwing the exception or
|
249 |
-
by cancelling a pool of requests or each outstanding future request
|
250 |
-
individually.
|
251 |
-
|
252 |
-
## headers event has been removed
|
253 |
-
|
254 |
-
Removed the "headers" event. This event was only useful for changing the
|
255 |
-
body a response once the headers of the response were known. You can implement
|
256 |
-
a similar behavior in a number of ways. One example might be to use a
|
257 |
-
FnStream that has access to the transaction being sent. For example, when the
|
258 |
-
first byte is written, you could check if the response headers match your
|
259 |
-
expectations, and if so, change the actual stream body that is being
|
260 |
-
written to.
|
261 |
-
|
262 |
-
## Updates to HTTP Messages
|
263 |
-
|
264 |
-
Removed the `asArray` parameter from
|
265 |
-
`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
|
266 |
-
value as an array, then use the newly added `getHeaderAsArray()` method of
|
267 |
-
`MessageInterface`. This change makes the Guzzle interfaces compatible with
|
268 |
-
the PSR-7 interfaces.
|
269 |
-
|
270 |
-
3.x to 4.0
|
271 |
-
----------
|
272 |
-
|
273 |
-
## Overarching changes:
|
274 |
-
|
275 |
-
- Now requires PHP 5.4 or greater.
|
276 |
-
- No longer requires cURL to send requests.
|
277 |
-
- Guzzle no longer wraps every exception it throws. Only exceptions that are
|
278 |
-
recoverable are now wrapped by Guzzle.
|
279 |
-
- Various namespaces have been removed or renamed.
|
280 |
-
- No longer requiring the Symfony EventDispatcher. A custom event dispatcher
|
281 |
-
based on the Symfony EventDispatcher is
|
282 |
-
now utilized in `GuzzleHttp\Event\EmitterInterface` (resulting in significant
|
283 |
-
speed and functionality improvements).
|
284 |
-
|
285 |
-
Changes per Guzzle 3.x namespace are described below.
|
286 |
-
|
287 |
-
## Batch
|
288 |
-
|
289 |
-
The `Guzzle\Batch` namespace has been removed. This is best left to
|
290 |
-
third-parties to implement on top of Guzzle's core HTTP library.
|
291 |
-
|
292 |
-
## Cache
|
293 |
-
|
294 |
-
The `Guzzle\Cache` namespace has been removed. (Todo: No suitable replacement
|
295 |
-
has been implemented yet, but hoping to utilize a PSR cache interface).
|
296 |
-
|
297 |
-
## Common
|
298 |
-
|
299 |
-
- Removed all of the wrapped exceptions. It's better to use the standard PHP
|
300 |
-
library for unrecoverable exceptions.
|
301 |
-
- `FromConfigInterface` has been removed.
|
302 |
-
- `Guzzle\Common\Version` has been removed. The VERSION constant can be found
|
303 |
-
at `GuzzleHttp\ClientInterface::VERSION`.
|
304 |
-
|
305 |
-
### Collection
|
306 |
-
|
307 |
-
- `getAll` has been removed. Use `toArray` to convert a collection to an array.
|
308 |
-
- `inject` has been removed.
|
309 |
-
- `keySearch` has been removed.
|
310 |
-
- `getPath` no longer supports wildcard expressions. Use something better like
|
311 |
-
JMESPath for this.
|
312 |
-
- `setPath` now supports appending to an existing array via the `[]` notation.
|
313 |
-
|
314 |
-
### Events
|
315 |
-
|
316 |
-
Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses
|
317 |
-
`GuzzleHttp\Event\Emitter`.
|
318 |
-
|
319 |
-
- `Symfony\Component\EventDispatcher\EventDispatcherInterface` is replaced by
|
320 |
-
`GuzzleHttp\Event\EmitterInterface`.
|
321 |
-
- `Symfony\Component\EventDispatcher\EventDispatcher` is replaced by
|
322 |
-
`GuzzleHttp\Event\Emitter`.
|
323 |
-
- `Symfony\Component\EventDispatcher\Event` is replaced by
|
324 |
-
`GuzzleHttp\Event\Event`, and Guzzle now has an EventInterface in
|
325 |
-
`GuzzleHttp\Event\EventInterface`.
|
326 |
-
- `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and
|
327 |
-
`HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the
|
328 |
-
event emitter of a request, client, etc. now uses the `getEmitter` method
|
329 |
-
rather than the `getDispatcher` method.
|
330 |
-
|
331 |
-
#### Emitter
|
332 |
-
|
333 |
-
- Use the `once()` method to add a listener that automatically removes itself
|
334 |
-
the first time it is invoked.
|
335 |
-
- Use the `listeners()` method to retrieve a list of event listeners rather than
|
336 |
-
the `getListeners()` method.
|
337 |
-
- Use `emit()` instead of `dispatch()` to emit an event from an emitter.
|
338 |
-
- Use `attach()` instead of `addSubscriber()` and `detach()` instead of
|
339 |
-
`removeSubscriber()`.
|
340 |
-
|
341 |
-
```php
|
342 |
-
$mock = new Mock();
|
343 |
-
// 3.x
|
344 |
-
$request->getEventDispatcher()->addSubscriber($mock);
|
345 |
-
$request->getEventDispatcher()->removeSubscriber($mock);
|
346 |
-
// 4.x
|
347 |
-
$request->getEmitter()->attach($mock);
|
348 |
-
$request->getEmitter()->detach($mock);
|
349 |
-
```
|
350 |
-
|
351 |
-
Use the `on()` method to add a listener rather than the `addListener()` method.
|
352 |
-
|
353 |
-
```php
|
354 |
-
// 3.x
|
355 |
-
$request->getEventDispatcher()->addListener('foo', function (Event $event) { /* ... */ } );
|
356 |
-
// 4.x
|
357 |
-
$request->getEmitter()->on('foo', function (Event $event, $name) { /* ... */ } );
|
358 |
-
```
|
359 |
-
|
360 |
-
## Http
|
361 |
-
|
362 |
-
### General changes
|
363 |
-
|
364 |
-
- The cacert.pem certificate has been moved to `src/cacert.pem`.
|
365 |
-
- Added the concept of adapters that are used to transfer requests over the
|
366 |
-
wire.
|
367 |
-
- Simplified the event system.
|
368 |
-
- Sending requests in parallel is still possible, but batching is no longer a
|
369 |
-
concept of the HTTP layer. Instead, you must use the `complete` and `error`
|
370 |
-
events to asynchronously manage parallel request transfers.
|
371 |
-
- `Guzzle\Http\Url` has moved to `GuzzleHttp\Url`.
|
372 |
-
- `Guzzle\Http\QueryString` has moved to `GuzzleHttp\Query`.
|
373 |
-
- QueryAggregators have been rewritten so that they are simply callable
|
374 |
-
functions.
|
375 |
-
- `GuzzleHttp\StaticClient` has been removed. Use the functions provided in
|
376 |
-
`functions.php` for an easy to use static client instance.
|
377 |
-
- Exceptions in `GuzzleHttp\Exception` have been updated to all extend from
|
378 |
-
`GuzzleHttp\Exception\TransferException`.
|
379 |
-
|
380 |
-
### Client
|
381 |
-
|
382 |
-
Calling methods like `get()`, `post()`, `head()`, etc. no longer create and
|
383 |
-
return a request, but rather creates a request, sends the request, and returns
|
384 |
-
the response.
|
385 |
-
|
386 |
-
```php
|
387 |
-
// 3.0
|
388 |
-
$request = $client->get('/');
|
389 |
-
$response = $request->send();
|
390 |
-
|
391 |
-
// 4.0
|
392 |
-
$response = $client->get('/');
|
393 |
-
|
394 |
-
// or, to mirror the previous behavior
|
395 |
-
$request = $client->createRequest('GET', '/');
|
396 |
-
$response = $client->send($request);
|
397 |
-
```
|
398 |
-
|
399 |
-
`GuzzleHttp\ClientInterface` has changed.
|
400 |
-
|
401 |
-
- The `send` method no longer accepts more than one request. Use `sendAll` to
|
402 |
-
send multiple requests in parallel.
|
403 |
-
- `setUserAgent()` has been removed. Use a default request option instead. You
|
404 |
-
could, for example, do something like:
|
405 |
-
`$client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent())`.
|
406 |
-
- `setSslVerification()` has been removed. Use default request options instead,
|
407 |
-
like `$client->setConfig('defaults/verify', true)`.
|
408 |
-
|
409 |
-
`GuzzleHttp\Client` has changed.
|
410 |
-
|
411 |
-
- The constructor now accepts only an associative array. You can include a
|
412 |
-
`base_url` string or array to use a URI template as the base URL of a client.
|
413 |
-
You can also specify a `defaults` key that is an associative array of default
|
414 |
-
request options. You can pass an `adapter` to use a custom adapter,
|
415 |
-
`batch_adapter` to use a custom adapter for sending requests in parallel, or
|
416 |
-
a `message_factory` to change the factory used to create HTTP requests and
|
417 |
-
responses.
|
418 |
-
- The client no longer emits a `client.create_request` event.
|
419 |
-
- Creating requests with a client no longer automatically utilize a URI
|
420 |
-
template. You must pass an array into a creational method (e.g.,
|
421 |
-
`createRequest`, `get`, `put`, etc.) in order to expand a URI template.
|
422 |
-
|
423 |
-
### Messages
|
424 |
-
|
425 |
-
Messages no longer have references to their counterparts (i.e., a request no
|
426 |
-
longer has a reference to it's response, and a response no loger has a
|
427 |
-
reference to its request). This association is now managed through a
|
428 |
-
`GuzzleHttp\Adapter\TransactionInterface` object. You can get references to
|
429 |
-
these transaction objects using request events that are emitted over the
|
430 |
-
lifecycle of a request.
|
431 |
-
|
432 |
-
#### Requests with a body
|
433 |
-
|
434 |
-
- `GuzzleHttp\Message\EntityEnclosingRequest` and
|
435 |
-
`GuzzleHttp\Message\EntityEnclosingRequestInterface` have been removed. The
|
436 |
-
separation between requests that contain a body and requests that do not
|
437 |
-
contain a body has been removed, and now `GuzzleHttp\Message\RequestInterface`
|
438 |
-
handles both use cases.
|
439 |
-
- Any method that previously accepts a `GuzzleHttp\Response` object now accept a
|
440 |
-
`GuzzleHttp\Message\ResponseInterface`.
|
441 |
-
- `GuzzleHttp\Message\RequestFactoryInterface` has been renamed to
|
442 |
-
`GuzzleHttp\Message\MessageFactoryInterface`. This interface is used to create
|
443 |
-
both requests and responses and is implemented in
|
444 |
-
`GuzzleHttp\Message\MessageFactory`.
|
445 |
-
- POST field and file methods have been removed from the request object. You
|
446 |
-
must now use the methods made available to `GuzzleHttp\Post\PostBodyInterface`
|
447 |
-
to control the format of a POST body. Requests that are created using a
|
448 |
-
standard `GuzzleHttp\Message\MessageFactoryInterface` will automatically use
|
449 |
-
a `GuzzleHttp\Post\PostBody` body if the body was passed as an array or if
|
450 |
-
the method is POST and no body is provided.
|
451 |
-
|
452 |
-
```php
|
453 |
-
$request = $client->createRequest('POST', '/');
|
454 |
-
$request->getBody()->setField('foo', 'bar');
|
455 |
-
$request->getBody()->addFile(new PostFile('file_key', fopen('/path/to/content', 'r')));
|
456 |
-
```
|
457 |
-
|
458 |
-
#### Headers
|
459 |
-
|
460 |
-
- `GuzzleHttp\Message\Header` has been removed. Header values are now simply
|
461 |
-
represented by an array of values or as a string. Header values are returned
|
462 |
-
as a string by default when retrieving a header value from a message. You can
|
463 |
-
pass an optional argument of `true` to retrieve a header value as an array
|
464 |
-
of strings instead of a single concatenated string.
|
465 |
-
- `GuzzleHttp\PostFile` and `GuzzleHttp\PostFileInterface` have been moved to
|
466 |
-
`GuzzleHttp\Post`. This interface has been simplified and now allows the
|
467 |
-
addition of arbitrary headers.
|
468 |
-
- Custom headers like `GuzzleHttp\Message\Header\Link` have been removed. Most
|
469 |
-
of the custom headers are now handled separately in specific
|
470 |
-
subscribers/plugins, and `GuzzleHttp\Message\HeaderValues::parseParams()` has
|
471 |
-
been updated to properly handle headers that contain parameters (like the
|
472 |
-
`Link` header).
|
473 |
-
|
474 |
-
#### Responses
|
475 |
-
|
476 |
-
- `GuzzleHttp\Message\Response::getInfo()` and
|
477 |
-
`GuzzleHttp\Message\Response::setInfo()` have been removed. Use the event
|
478 |
-
system to retrieve this type of information.
|
479 |
-
- `GuzzleHttp\Message\Response::getRawHeaders()` has been removed.
|
480 |
-
- `GuzzleHttp\Message\Response::getMessage()` has been removed.
|
481 |
-
- `GuzzleHttp\Message\Response::calculateAge()` and other cache specific
|
482 |
-
methods have moved to the CacheSubscriber.
|
483 |
-
- Header specific helper functions like `getContentMd5()` have been removed.
|
484 |
-
Just use `getHeader('Content-MD5')` instead.
|
485 |
-
- `GuzzleHttp\Message\Response::setRequest()` and
|
486 |
-
`GuzzleHttp\Message\Response::getRequest()` have been removed. Use the event
|
487 |
-
system to work with request and response objects as a transaction.
|
488 |
-
- `GuzzleHttp\Message\Response::getRedirectCount()` has been removed. Use the
|
489 |
-
Redirect subscriber instead.
|
490 |
-
- `GuzzleHttp\Message\Response::isSuccessful()` and other related methods have
|
491 |
-
been removed. Use `getStatusCode()` instead.
|
492 |
-
|
493 |
-
#### Streaming responses
|
494 |
-
|
495 |
-
Streaming requests can now be created by a client directly, returning a
|
496 |
-
`GuzzleHttp\Message\ResponseInterface` object that contains a body stream
|
497 |
-
referencing an open PHP HTTP stream.
|
498 |
-
|
499 |
-
```php
|
500 |
-
// 3.0
|
501 |
-
use Guzzle\Stream\PhpStreamRequestFactory;
|
502 |
-
$request = $client->get('/');
|
503 |
-
$factory = new PhpStreamRequestFactory();
|
504 |
-
$stream = $factory->fromRequest($request);
|
505 |
-
$data = $stream->read(1024);
|
506 |
-
|
507 |
-
// 4.0
|
508 |
-
$response = $client->get('/', ['stream' => true]);
|
509 |
-
// Read some data off of the stream in the response body
|
510 |
-
$data = $response->getBody()->read(1024);
|
511 |
-
```
|
512 |
-
|
513 |
-
#### Redirects
|
514 |
-
|
515 |
-
The `configureRedirects()` method has been removed in favor of a
|
516 |
-
`allow_redirects` request option.
|
517 |
-
|
518 |
-
```php
|
519 |
-
// Standard redirects with a default of a max of 5 redirects
|
520 |
-
$request = $client->createRequest('GET', '/', ['allow_redirects' => true]);
|
521 |
-
|
522 |
-
// Strict redirects with a custom number of redirects
|
523 |
-
$request = $client->createRequest('GET', '/', [
|
524 |
-
'allow_redirects' => ['max' => 5, 'strict' => true]
|
525 |
-
]);
|
526 |
-
```
|
527 |
-
|
528 |
-
#### EntityBody
|
529 |
-
|
530 |
-
EntityBody interfaces and classes have been removed or moved to
|
531 |
-
`GuzzleHttp\Stream`. All classes and interfaces that once required
|
532 |
-
`GuzzleHttp\EntityBodyInterface` now require
|
533 |
-
`GuzzleHttp\Stream\StreamInterface`. Creating a new body for a request no
|
534 |
-
longer uses `GuzzleHttp\EntityBody::factory` but now uses
|
535 |
-
`GuzzleHttp\Stream\Stream::factory` or even better:
|
536 |
-
`GuzzleHttp\Stream\create()`.
|
537 |
-
|
538 |
-
- `Guzzle\Http\EntityBodyInterface` is now `GuzzleHttp\Stream\StreamInterface`
|
539 |
-
- `Guzzle\Http\EntityBody` is now `GuzzleHttp\Stream\Stream`
|
540 |
-
- `Guzzle\Http\CachingEntityBody` is now `GuzzleHttp\Stream\CachingStream`
|
541 |
-
- `Guzzle\Http\ReadLimitEntityBody` is now `GuzzleHttp\Stream\LimitStream`
|
542 |
-
- `Guzzle\Http\IoEmittyinEntityBody` has been removed.
|
543 |
-
|
544 |
-
#### Request lifecycle events
|
545 |
-
|
546 |
-
Requests previously submitted a large number of requests. The number of events
|
547 |
-
emitted over the lifecycle of a request has been significantly reduced to make
|
548 |
-
it easier to understand how to extend the behavior of a request. All events
|
549 |
-
emitted during the lifecycle of a request now emit a custom
|
550 |
-
`GuzzleHttp\Event\EventInterface` object that contains context providing
|
551 |
-
methods and a way in which to modify the transaction at that specific point in
|
552 |
-
time (e.g., intercept the request and set a response on the transaction).
|
553 |
-
|
554 |
-
- `request.before_send` has been renamed to `before` and now emits a
|
555 |
-
`GuzzleHttp\Event\BeforeEvent`
|
556 |
-
- `request.complete` has been renamed to `complete` and now emits a
|
557 |
-
`GuzzleHttp\Event\CompleteEvent`.
|
558 |
-
- `request.sent` has been removed. Use `complete`.
|
559 |
-
- `request.success` has been removed. Use `complete`.
|
560 |
-
- `error` is now an event that emits a `GuzzleHttp\Event\ErrorEvent`.
|
561 |
-
- `request.exception` has been removed. Use `error`.
|
562 |
-
- `request.receive.status_line` has been removed.
|
563 |
-
- `curl.callback.progress` has been removed. Use a custom `StreamInterface` to
|
564 |
-
maintain a status update.
|
565 |
-
- `curl.callback.write` has been removed. Use a custom `StreamInterface` to
|
566 |
-
intercept writes.
|
567 |
-
- `curl.callback.read` has been removed. Use a custom `StreamInterface` to
|
568 |
-
intercept reads.
|
569 |
-
|
570 |
-
`headers` is a new event that is emitted after the response headers of a
|
571 |
-
request have been received before the body of the response is downloaded. This
|
572 |
-
event emits a `GuzzleHttp\Event\HeadersEvent`.
|
573 |
-
|
574 |
-
You can intercept a request and inject a response using the `intercept()` event
|
575 |
-
of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and
|
576 |
-
`GuzzleHttp\Event\ErrorEvent` event.
|
577 |
-
|
578 |
-
See: http://docs.guzzlephp.org/en/latest/events.html
|
579 |
-
|
580 |
-
## Inflection
|
581 |
-
|
582 |
-
The `Guzzle\Inflection` namespace has been removed. This is not a core concern
|
583 |
-
of Guzzle.
|
584 |
-
|
585 |
-
## Iterator
|
586 |
-
|
587 |
-
The `Guzzle\Iterator` namespace has been removed.
|
588 |
-
|
589 |
-
- `Guzzle\Iterator\AppendIterator`, `Guzzle\Iterator\ChunkedIterator`, and
|
590 |
-
`Guzzle\Iterator\MethodProxyIterator` are nice, but not a core requirement of
|
591 |
-
Guzzle itself.
|
592 |
-
- `Guzzle\Iterator\FilterIterator` is no longer needed because an equivalent
|
593 |
-
class is shipped with PHP 5.4.
|
594 |
-
- `Guzzle\Iterator\MapIterator` is not really needed when using PHP 5.5 because
|
595 |
-
it's easier to just wrap an iterator in a generator that maps values.
|
596 |
-
|
597 |
-
For a replacement of these iterators, see https://github.com/nikic/iter
|
598 |
-
|
599 |
-
## Log
|
600 |
-
|
601 |
-
The LogPlugin has moved to https://github.com/guzzle/log-subscriber. The
|
602 |
-
`Guzzle\Log` namespace has been removed. Guzzle now relies on
|
603 |
-
`Psr\Log\LoggerInterface` for all logging. The MessageFormatter class has been
|
604 |
-
moved to `GuzzleHttp\Subscriber\Log\Formatter`.
|
605 |
-
|
606 |
-
## Parser
|
607 |
-
|
608 |
-
The `Guzzle\Parser` namespace has been removed. This was previously used to
|
609 |
-
make it possible to plug in custom parsers for cookies, messages, URI
|
610 |
-
templates, and URLs; however, this level of complexity is not needed in Guzzle
|
611 |
-
so it has been removed.
|
612 |
-
|
613 |
-
- Cookie: Cookie parsing logic has been moved to
|
614 |
-
`GuzzleHttp\Cookie\SetCookie::fromString`.
|
615 |
-
- Message: Message parsing logic for both requests and responses has been moved
|
616 |
-
to `GuzzleHttp\Message\MessageFactory::fromMessage`. Message parsing is only
|
617 |
-
used in debugging or deserializing messages, so it doesn't make sense for
|
618 |
-
Guzzle as a library to add this level of complexity to parsing messages.
|
619 |
-
- UriTemplate: URI template parsing has been moved to
|
620 |
-
`GuzzleHttp\UriTemplate`. The Guzzle library will automatically use the PECL
|
621 |
-
URI template library if it is installed.
|
622 |
-
- Url: URL parsing is now performed in `GuzzleHttp\Url::fromString` (previously
|
623 |
-
it was `Guzzle\Http\Url::factory()`). If custom URL parsing is necessary,
|
624 |
-
then developers are free to subclass `GuzzleHttp\Url`.
|
625 |
-
|
626 |
-
## Plugin
|
627 |
-
|
628 |
-
The `Guzzle\Plugin` namespace has been renamed to `GuzzleHttp\Subscriber`.
|
629 |
-
Several plugins are shipping with the core Guzzle library under this namespace.
|
630 |
-
|
631 |
-
- `GuzzleHttp\Subscriber\Cookie`: Replaces the old CookiePlugin. Cookie jar
|
632 |
-
code has moved to `GuzzleHttp\Cookie`.
|
633 |
-
- `GuzzleHttp\Subscriber\History`: Replaces the old HistoryPlugin.
|
634 |
-
- `GuzzleHttp\Subscriber\HttpError`: Throws errors when a bad HTTP response is
|
635 |
-
received.
|
636 |
-
- `GuzzleHttp\Subscriber\Mock`: Replaces the old MockPlugin.
|
637 |
-
- `GuzzleHttp\Subscriber\Prepare`: Prepares the body of a request just before
|
638 |
-
sending. This subscriber is attached to all requests by default.
|
639 |
-
- `GuzzleHttp\Subscriber\Redirect`: Replaces the RedirectPlugin.
|
640 |
-
|
641 |
-
The following plugins have been removed (third-parties are free to re-implement
|
642 |
-
these if needed):
|
643 |
-
|
644 |
-
- `GuzzleHttp\Plugin\Async` has been removed.
|
645 |
-
- `GuzzleHttp\Plugin\CurlAuth` has been removed.
|
646 |
-
- `GuzzleHttp\Plugin\ErrorResponse\ErrorResponsePlugin` has been removed. This
|
647 |
-
functionality should instead be implemented with event listeners that occur
|
648 |
-
after normal response parsing occurs in the guzzle/command package.
|
649 |
-
|
650 |
-
The following plugins are not part of the core Guzzle package, but are provided
|
651 |
-
in separate repositories:
|
652 |
-
|
653 |
-
- `Guzzle\Http\Plugin\BackoffPlugin` has been rewritten to be much simpler
|
654 |
-
to build custom retry policies using simple functions rather than various
|
655 |
-
chained classes. See: https://github.com/guzzle/retry-subscriber
|
656 |
-
- `Guzzle\Http\Plugin\Cache\CachePlugin` has moved to
|
657 |
-
https://github.com/guzzle/cache-subscriber
|
658 |
-
- `Guzzle\Http\Plugin\Log\LogPlugin` has moved to
|
659 |
-
https://github.com/guzzle/log-subscriber
|
660 |
-
- `Guzzle\Http\Plugin\Md5\Md5Plugin` has moved to
|
661 |
-
https://github.com/guzzle/message-integrity-subscriber
|
662 |
-
- `Guzzle\Http\Plugin\Mock\MockPlugin` has moved to
|
663 |
-
`GuzzleHttp\Subscriber\MockSubscriber`.
|
664 |
-
- `Guzzle\Http\Plugin\Oauth\OauthPlugin` has moved to
|
665 |
-
https://github.com/guzzle/oauth-subscriber
|
666 |
-
|
667 |
-
## Service
|
668 |
-
|
669 |
-
The service description layer of Guzzle has moved into two separate packages:
|
670 |
-
|
671 |
-
- http://github.com/guzzle/command Provides a high level abstraction over web
|
672 |
-
services by representing web service operations using commands.
|
673 |
-
- http://github.com/guzzle/guzzle-services Provides an implementation of
|
674 |
-
guzzle/command that provides request serialization and response parsing using
|
675 |
-
Guzzle service descriptions.
|
676 |
-
|
677 |
-
## Stream
|
678 |
-
|
679 |
-
Stream have moved to a separate package available at
|
680 |
-
https://github.com/guzzle/streams.
|
681 |
-
|
682 |
-
`Guzzle\Stream\StreamInterface` has been given a large update to cleanly take
|
683 |
-
on the responsibilities of `Guzzle\Http\EntityBody` and
|
684 |
-
`Guzzle\Http\EntityBodyInterface` now that they have been removed. The number
|
685 |
-
of methods implemented by the `StreamInterface` has been drastically reduced to
|
686 |
-
allow developers to more easily extend and decorate stream behavior.
|
687 |
-
|
688 |
-
## Removed methods from StreamInterface
|
689 |
-
|
690 |
-
- `getStream` and `setStream` have been removed to better encapsulate streams.
|
691 |
-
- `getMetadata` and `setMetadata` have been removed in favor of
|
692 |
-
`GuzzleHttp\Stream\MetadataStreamInterface`.
|
693 |
-
- `getWrapper`, `getWrapperData`, `getStreamType`, and `getUri` have all been
|
694 |
-
removed. This data is accessible when
|
695 |
-
using streams that implement `GuzzleHttp\Stream\MetadataStreamInterface`.
|
696 |
-
- `rewind` has been removed. Use `seek(0)` for a similar behavior.
|
697 |
-
|
698 |
-
## Renamed methods
|
699 |
-
|
700 |
-
- `detachStream` has been renamed to `detach`.
|
701 |
-
- `feof` has been renamed to `eof`.
|
702 |
-
- `ftell` has been renamed to `tell`.
|
703 |
-
- `readLine` has moved from an instance method to a static class method of
|
704 |
-
`GuzzleHttp\Stream\Stream`.
|
705 |
-
|
706 |
-
## Metadata streams
|
707 |
-
|
708 |
-
`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams
|
709 |
-
that contain additional metadata accessible via `getMetadata()`.
|
710 |
-
`GuzzleHttp\Stream\StreamInterface::getMetadata` and
|
711 |
-
`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed.
|
712 |
-
|
713 |
-
## StreamRequestFactory
|
714 |
-
|
715 |
-
The entire concept of the StreamRequestFactory has been removed. The way this
|
716 |
-
was used in Guzzle 3 broke the actual interface of sending streaming requests
|
717 |
-
(instead of getting back a Response, you got a StreamInterface). Streaming
|
718 |
-
PHP requests are now implemented through the `GuzzleHttp\Adapter\StreamAdapter`.
|
719 |
-
|
720 |
-
3.6 to 3.7
|
721 |
-
----------
|
722 |
-
|
723 |
-
### Deprecations
|
724 |
-
|
725 |
-
- You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.:
|
726 |
-
|
727 |
-
```php
|
728 |
-
\Guzzle\Common\Version::$emitWarnings = true;
|
729 |
-
```
|
730 |
-
|
731 |
-
The following APIs and options have been marked as deprecated:
|
732 |
-
|
733 |
-
- Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use `$request->getResponseBody()->isRepeatable()` instead.
|
734 |
-
- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
|
735 |
-
- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
|
736 |
-
- Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
|
737 |
-
- Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
|
738 |
-
- Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
|
739 |
-
- Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
|
740 |
-
- Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
|
741 |
-
- Marked `Guzzle\Common\Collection::inject()` as deprecated.
|
742 |
-
- Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use
|
743 |
-
`$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` or
|
744 |
-
`$client->setDefaultOption('auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));`
|
745 |
-
|
746 |
-
3.7 introduces `request.options` as a parameter for a client configuration and as an optional argument to all creational
|
747 |
-
request methods. When paired with a client's configuration settings, these options allow you to specify default settings
|
748 |
-
for various aspects of a request. Because these options make other previous configuration options redundant, several
|
749 |
-
configuration options and methods of a client and AbstractCommand have been deprecated.
|
750 |
-
|
751 |
-
- Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use `$client->getDefaultOption('headers')`.
|
752 |
-
- Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use `$client->setDefaultOption('headers/{header_name}', 'value')`.
|
753 |
-
- Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use `$client->setDefaultOption('params/{param_name}', 'value')`
|
754 |
-
- Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. These will work through Guzzle 4.0
|
755 |
-
|
756 |
-
$command = $client->getCommand('foo', array(
|
757 |
-
'command.headers' => array('Test' => '123'),
|
758 |
-
'command.response_body' => '/path/to/file'
|
759 |
-
));
|
760 |
-
|
761 |
-
// Should be changed to:
|
762 |
-
|
763 |
-
$command = $client->getCommand('foo', array(
|
764 |
-
'command.request_options' => array(
|
765 |
-
'headers' => array('Test' => '123'),
|
766 |
-
'save_as' => '/path/to/file'
|
767 |
-
)
|
768 |
-
));
|
769 |
-
|
770 |
-
### Interface changes
|
771 |
-
|
772 |
-
Additions and changes (you will need to update any implementations or subclasses you may have created):
|
773 |
-
|
774 |
-
- Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
|
775 |
-
createRequest, head, delete, put, patch, post, options, prepareRequest
|
776 |
-
- Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
|
777 |
-
- Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
|
778 |
-
- Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
|
779 |
-
`Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
|
780 |
-
resource, string, or EntityBody into the $options parameter to specify the download location of the response.
|
781 |
-
- Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
|
782 |
-
default `array()`
|
783 |
-
- Added `Guzzle\Stream\StreamInterface::isRepeatable`
|
784 |
-
- Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
|
785 |
-
|
786 |
-
The following methods were removed from interfaces. All of these methods are still available in the concrete classes
|
787 |
-
that implement them, but you should update your code to use alternative methods:
|
788 |
-
|
789 |
-
- Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
|
790 |
-
`$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
|
791 |
-
`$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))` or
|
792 |
-
`$client->setDefaultOption('headers/{header_name}', 'value')`. or
|
793 |
-
`$client->setDefaultOption('headers', array('header_name' => 'value'))`.
|
794 |
-
- Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use `$client->getConfig()->getPath('request.options/headers')`.
|
795 |
-
- Removed `Guzzle\Http\ClientInterface::expandTemplate()`. This is an implementation detail.
|
796 |
-
- Removed `Guzzle\Http\ClientInterface::setRequestFactory()`. This is an implementation detail.
|
797 |
-
- Removed `Guzzle\Http\ClientInterface::getCurlMulti()`. This is a very specific implementation detail.
|
798 |
-
- Removed `Guzzle\Http\Message\RequestInterface::canCache`. Use the CachePlugin.
|
799 |
-
- Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`. Use the HistoryPlugin.
|
800 |
-
- Removed `Guzzle\Http\Message\RequestInterface::isRedirect`. Use the HistoryPlugin.
|
801 |
-
|
802 |
-
### Cache plugin breaking changes
|
803 |
-
|
804 |
-
- CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
|
805 |
-
CacheStorageInterface. These two objects and interface will be removed in a future version.
|
806 |
-
- Always setting X-cache headers on cached responses
|
807 |
-
- Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
|
808 |
-
- `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
|
809 |
-
$request, Response $response);`
|
810 |
-
- `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
|
811 |
-
- `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
|
812 |
-
- Added `CacheStorageInterface::purge($url)`
|
813 |
-
- `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
|
814 |
-
$plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
|
815 |
-
CanCacheStrategyInterface $canCache = null)`
|
816 |
-
- Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
|
817 |
-
|
818 |
-
3.5 to 3.6
|
819 |
-
----------
|
820 |
-
|
821 |
-
* Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
|
822 |
-
* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
|
823 |
-
* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
|
824 |
-
For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader().
|
825 |
-
Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request.
|
826 |
-
* Specific header implementations can be created for complex headers. When a message creates a header, it uses a
|
827 |
-
HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
|
828 |
-
CacheControl header implementation.
|
829 |
-
* Moved getLinks() from Response to just be used on a Link header object.
|
830 |
-
|
831 |
-
If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the
|
832 |
-
HeaderInterface (e.g. toArray(), getAll(), etc.).
|
833 |
-
|
834 |
-
### Interface changes
|
835 |
-
|
836 |
-
* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
|
837 |
-
* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
|
838 |
-
* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
|
839 |
-
Guzzle\Http\Curl\RequestMediator
|
840 |
-
* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
|
841 |
-
* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
|
842 |
-
* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
|
843 |
-
|
844 |
-
### Removed deprecated functions
|
845 |
-
|
846 |
-
* Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
|
847 |
-
* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
|
848 |
-
|
849 |
-
### Deprecations
|
850 |
-
|
851 |
-
* The ability to case-insensitively search for header values
|
852 |
-
* Guzzle\Http\Message\Header::hasExactHeader
|
853 |
-
* Guzzle\Http\Message\Header::raw. Use getAll()
|
854 |
-
* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
|
855 |
-
instead.
|
856 |
-
|
857 |
-
### Other changes
|
858 |
-
|
859 |
-
* All response header helper functions return a string rather than mixing Header objects and strings inconsistently
|
860 |
-
* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
|
861 |
-
directly via interfaces
|
862 |
-
* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
|
863 |
-
but are a no-op until removed.
|
864 |
-
* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
|
865 |
-
`Guzzle\Service\Command\ArrayCommandInterface`.
|
866 |
-
* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
|
867 |
-
on a request while the request is still being transferred
|
868 |
-
* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
|
869 |
-
|
870 |
-
3.3 to 3.4
|
871 |
-
----------
|
872 |
-
|
873 |
-
Base URLs of a client now follow the rules of https://tools.ietf.org/html/rfc3986#section-5.2.2 when merging URLs.
|
874 |
-
|
875 |
-
3.2 to 3.3
|
876 |
-
----------
|
877 |
-
|
878 |
-
### Response::getEtag() quote stripping removed
|
879 |
-
|
880 |
-
`Guzzle\Http\Message\Response::getEtag()` no longer strips quotes around the ETag response header
|
881 |
-
|
882 |
-
### Removed `Guzzle\Http\Utils`
|
883 |
-
|
884 |
-
The `Guzzle\Http\Utils` class was removed. This class was only used for testing.
|
885 |
-
|
886 |
-
### Stream wrapper and type
|
887 |
-
|
888 |
-
`Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase.
|
889 |
-
|
890 |
-
### curl.emit_io became emit_io
|
891 |
-
|
892 |
-
Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using the
|
893 |
-
'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
|
894 |
-
|
895 |
-
3.1 to 3.2
|
896 |
-
----------
|
897 |
-
|
898 |
-
### CurlMulti is no longer reused globally
|
899 |
-
|
900 |
-
Before 3.2, the same CurlMulti object was reused globally for each client. This can cause issue where plugins added
|
901 |
-
to a single client can pollute requests dispatched from other clients.
|
902 |
-
|
903 |
-
If you still wish to reuse the same CurlMulti object with each client, then you can add a listener to the
|
904 |
-
ServiceBuilder's `service_builder.create_client` event to inject a custom CurlMulti object into each client as it is
|
905 |
-
created.
|
906 |
-
|
907 |
-
```php
|
908 |
-
$multi = new Guzzle\Http\Curl\CurlMulti();
|
909 |
-
$builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json');
|
910 |
-
$builder->addListener('service_builder.create_client', function ($event) use ($multi) {
|
911 |
-
$event['client']->setCurlMulti($multi);
|
912 |
-
}
|
913 |
-
});
|
914 |
-
```
|
915 |
-
|
916 |
-
### No default path
|
917 |
-
|
918 |
-
URLs no longer have a default path value of '/' if no path was specified.
|
919 |
-
|
920 |
-
Before:
|
921 |
-
|
922 |
-
```php
|
923 |
-
$request = $client->get('http://www.foo.com');
|
924 |
-
echo $request->getUrl();
|
925 |
-
// >> http://www.foo.com/
|
926 |
-
```
|
927 |
-
|
928 |
-
After:
|
929 |
-
|
930 |
-
```php
|
931 |
-
$request = $client->get('http://www.foo.com');
|
932 |
-
echo $request->getUrl();
|
933 |
-
// >> http://www.foo.com
|
934 |
-
```
|
935 |
-
|
936 |
-
### Less verbose BadResponseException
|
937 |
-
|
938 |
-
The exception message for `Guzzle\Http\Exception\BadResponseException` no longer contains the full HTTP request and
|
939 |
-
response information. You can, however, get access to the request and response object by calling `getRequest()` or
|
940 |
-
`getResponse()` on the exception object.
|
941 |
-
|
942 |
-
### Query parameter aggregation
|
943 |
-
|
944 |
-
Multi-valued query parameters are no longer aggregated using a callback function. `Guzzle\Http\Query` now has a
|
945 |
-
setAggregator() method that accepts a `Guzzle\Http\QueryAggregator\QueryAggregatorInterface` object. This object is
|
946 |
-
responsible for handling the aggregation of multi-valued query string variables into a flattened hash.
|
947 |
-
|
948 |
-
2.8 to 3.x
|
949 |
-
----------
|
950 |
-
|
951 |
-
### Guzzle\Service\Inspector
|
952 |
-
|
953 |
-
Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fromConfig`
|
954 |
-
|
955 |
-
**Before**
|
956 |
-
|
957 |
-
```php
|
958 |
-
use Guzzle\Service\Inspector;
|
959 |
-
|
960 |
-
class YourClient extends \Guzzle\Service\Client
|
961 |
-
{
|
962 |
-
public static function factory($config = array())
|
963 |
-
{
|
964 |
-
$default = array();
|
965 |
-
$required = array('base_url', 'username', 'api_key');
|
966 |
-
$config = Inspector::fromConfig($config, $default, $required);
|
967 |
-
|
968 |
-
$client = new self(
|
969 |
-
$config->get('base_url'),
|
970 |
-
$config->get('username'),
|
971 |
-
$config->get('api_key')
|
972 |
-
);
|
973 |
-
$client->setConfig($config);
|
974 |
-
|
975 |
-
$client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json'));
|
976 |
-
|
977 |
-
return $client;
|
978 |
-
}
|
979 |
-
```
|
980 |
-
|
981 |
-
**After**
|
982 |
-
|
983 |
-
```php
|
984 |
-
use Guzzle\Common\Collection;
|
985 |
-
|
986 |
-
class YourClient extends \Guzzle\Service\Client
|
987 |
-
{
|
988 |
-
public static function factory($config = array())
|
989 |
-
{
|
990 |
-
$default = array();
|
991 |
-
$required = array('base_url', 'username', 'api_key');
|
992 |
-
$config = Collection::fromConfig($config, $default, $required);
|
993 |
-
|
994 |
-
$client = new self(
|
995 |
-
$config->get('base_url'),
|
996 |
-
$config->get('username'),
|
997 |
-
$config->get('api_key')
|
998 |
-
);
|
999 |
-
$client->setConfig($config);
|
1000 |
-
|
1001 |
-
$client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json'));
|
1002 |
-
|
1003 |
-
return $client;
|
1004 |
-
}
|
1005 |
-
```
|
1006 |
-
|
1007 |
-
### Convert XML Service Descriptions to JSON
|
1008 |
-
|
1009 |
-
**Before**
|
1010 |
-
|
1011 |
-
```xml
|
1012 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
1013 |
-
<client>
|
1014 |
-
<commands>
|
1015 |
-
<!-- Groups -->
|
1016 |
-
<command name="list_groups" method="GET" uri="groups.json">
|
1017 |
-
<doc>Get a list of groups</doc>
|
1018 |
-
</command>
|
1019 |
-
<command name="search_groups" method="GET" uri='search.json?query="{{query}} type:group"'>
|
1020 |
-
<doc>Uses a search query to get a list of groups</doc>
|
1021 |
-
<param name="query" type="string" required="true" />
|
1022 |
-
</command>
|
1023 |
-
<command name="create_group" method="POST" uri="groups.json">
|
1024 |
-
<doc>Create a group</doc>
|
1025 |
-
<param name="data" type="array" location="body" filters="json_encode" doc="Group JSON"/>
|
1026 |
-
<param name="Content-Type" location="header" static="application/json"/>
|
1027 |
-
</command>
|
1028 |
-
<command name="delete_group" method="DELETE" uri="groups/{{id}}.json">
|
1029 |
-
<doc>Delete a group by ID</doc>
|
1030 |
-
<param name="id" type="integer" required="true"/>
|
1031 |
-
</command>
|
1032 |
-
<command name="get_group" method="GET" uri="groups/{{id}}.json">
|
1033 |
-
<param name="id" type="integer" required="true"/>
|
1034 |
-
</command>
|
1035 |
-
<command name="update_group" method="PUT" uri="groups/{{id}}.json">
|
1036 |
-
<doc>Update a group</doc>
|
1037 |
-
<param name="id" type="integer" required="true"/>
|
1038 |
-
<param name="data" type="array" location="body" filters="json_encode" doc="Group JSON"/>
|
1039 |
-
<param name="Content-Type" location="header" static="application/json"/>
|
1040 |
-
</command>
|
1041 |
-
</commands>
|
1042 |
-
</client>
|
1043 |
-
```
|
1044 |
-
|
1045 |
-
**After**
|
1046 |
-
|
1047 |
-
```json
|
1048 |
-
{
|
1049 |
-
"name": "Zendesk REST API v2",
|
1050 |
-
"apiVersion": "2012-12-31",
|
1051 |
-
"description":"Provides access to Zendesk views, groups, tickets, ticket fields, and users",
|
1052 |
-
"operations": {
|
1053 |
-
"list_groups": {
|
1054 |
-
"httpMethod":"GET",
|
1055 |
-
"uri": "groups.json",
|
1056 |
-
"summary": "Get a list of groups"
|
1057 |
-
},
|
1058 |
-
"search_groups":{
|
1059 |
-
"httpMethod":"GET",
|
1060 |
-
"uri": "search.json?query=\"{query} type:group\"",
|
1061 |
-
"summary": "Uses a search query to get a list of groups",
|
1062 |
-
"parameters":{
|
1063 |
-
"query":{
|
1064 |
-
"location": "uri",
|
1065 |
-
"description":"Zendesk Search Query",
|
1066 |
-
"type": "string",
|
1067 |
-
"required": true
|
1068 |
-
}
|
1069 |
-
}
|
1070 |
-
},
|
1071 |
-
"create_group": {
|
1072 |
-
"httpMethod":"POST",
|
1073 |
-
"uri": "groups.json",
|
1074 |
-
"summary": "Create a group",
|
1075 |
-
"parameters":{
|
1076 |
-
"data": {
|
1077 |
-
"type": "array",
|
1078 |
-
"location": "body",
|
1079 |
-
"description":"Group JSON",
|
1080 |
-
"filters": "json_encode",
|
1081 |
-
"required": true
|
1082 |
-
},
|
1083 |
-
"Content-Type":{
|
1084 |
-
"type": "string",
|
1085 |
-
"location":"header",
|
1086 |
-
"static": "application/json"
|
1087 |
-
}
|
1088 |
-
}
|
1089 |
-
},
|
1090 |
-
"delete_group": {
|
1091 |
-
"httpMethod":"DELETE",
|
1092 |
-
"uri": "groups/{id}.json",
|
1093 |
-
"summary": "Delete a group",
|
1094 |
-
"parameters":{
|
1095 |
-
"id":{
|
1096 |
-
"location": "uri",
|
1097 |
-
"description":"Group to delete by ID",
|
1098 |
-
"type": "integer",
|
1099 |
-
"required": true
|
1100 |
-
}
|
1101 |
-
}
|
1102 |
-
},
|
1103 |
-
"get_group": {
|
1104 |
-
"httpMethod":"GET",
|
1105 |
-
"uri": "groups/{id}.json",
|
1106 |
-
"summary": "Get a ticket",
|
1107 |
-
"parameters":{
|
1108 |
-
"id":{
|
1109 |
-
"location": "uri",
|
1110 |
-
"description":"Group to get by ID",
|
1111 |
-
"type": "integer",
|
1112 |
-
"required": true
|
1113 |
-
}
|
1114 |
-
}
|
1115 |
-
},
|
1116 |
-
"update_group": {
|
1117 |
-
"httpMethod":"PUT",
|
1118 |
-
"uri": "groups/{id}.json",
|
1119 |
-
"summary": "Update a group",
|
1120 |
-
"parameters":{
|
1121 |
-
"id": {
|
1122 |
-
"location": "uri",
|
1123 |
-
"description":"Group to update by ID",
|
1124 |
-
"type": "integer",
|
1125 |
-
"required": true
|
1126 |
-
},
|
1127 |
-
"data": {
|
1128 |
-
"type": "array",
|
1129 |
-
"location": "body",
|
1130 |
-
"description":"Group JSON",
|
1131 |
-
"filters": "json_encode",
|
1132 |
-
"required": true
|
1133 |
-
},
|
1134 |
-
"Content-Type":{
|
1135 |
-
"type": "string",
|
1136 |
-
"location":"header",
|
1137 |
-
"static": "application/json"
|
1138 |
-
}
|
1139 |
-
}
|
1140 |
-
}
|
1141 |
-
}
|
1142 |
-
```
|
1143 |
-
|
1144 |
-
### Guzzle\Service\Description\ServiceDescription
|
1145 |
-
|
1146 |
-
Commands are now called Operations
|
1147 |
-
|
1148 |
-
**Before**
|
1149 |
-
|
1150 |
-
```php
|
1151 |
-
use Guzzle\Service\Description\ServiceDescription;
|
1152 |
-
|
1153 |
-
$sd = new ServiceDescription();
|
1154 |
-
$sd->getCommands(); // @returns ApiCommandInterface[]
|
1155 |
-
$sd->hasCommand($name);
|
1156 |
-
$sd->getCommand($name); // @returns ApiCommandInterface|null
|
1157 |
-
$sd->addCommand($command); // @param ApiCommandInterface $command
|
1158 |
-
```
|
1159 |
-
|
1160 |
-
**After**
|
1161 |
-
|
1162 |
-
```php
|
1163 |
-
use Guzzle\Service\Description\ServiceDescription;
|
1164 |
-
|
1165 |
-
$sd = new ServiceDescription();
|
1166 |
-
$sd->getOperations(); // @returns OperationInterface[]
|
1167 |
-
$sd->hasOperation($name);
|
1168 |
-
$sd->getOperation($name); // @returns OperationInterface|null
|
1169 |
-
$sd->addOperation($operation); // @param OperationInterface $operation
|
1170 |
-
```
|
1171 |
-
|
1172 |
-
### Guzzle\Common\Inflection\Inflector
|
1173 |
-
|
1174 |
-
Namespace is now `Guzzle\Inflection\Inflector`
|
1175 |
-
|
1176 |
-
### Guzzle\Http\Plugin
|
1177 |
-
|
1178 |
-
Namespace is now `Guzzle\Plugin`. Many other changes occur within this namespace and are detailed in their own sections below.
|
1179 |
-
|
1180 |
-
### Guzzle\Http\Plugin\LogPlugin and Guzzle\Common\Log
|
1181 |
-
|
1182 |
-
Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively.
|
1183 |
-
|
1184 |
-
**Before**
|
1185 |
-
|
1186 |
-
```php
|
1187 |
-
use Guzzle\Common\Log\ClosureLogAdapter;
|
1188 |
-
use Guzzle\Http\Plugin\LogPlugin;
|
1189 |
-
|
1190 |
-
/** @var \Guzzle\Http\Client */
|
1191 |
-
$client;
|
1192 |
-
|
1193 |
-
// $verbosity is an integer indicating desired message verbosity level
|
1194 |
-
$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $verbosity = LogPlugin::LOG_VERBOSE);
|
1195 |
-
```
|
1196 |
-
|
1197 |
-
**After**
|
1198 |
-
|
1199 |
-
```php
|
1200 |
-
use Guzzle\Log\ClosureLogAdapter;
|
1201 |
-
use Guzzle\Log\MessageFormatter;
|
1202 |
-
use Guzzle\Plugin\Log\LogPlugin;
|
1203 |
-
|
1204 |
-
/** @var \Guzzle\Http\Client */
|
1205 |
-
$client;
|
1206 |
-
|
1207 |
-
// $format is a string indicating desired message format -- @see MessageFormatter
|
1208 |
-
$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $format = MessageFormatter::DEBUG_FORMAT);
|
1209 |
-
```
|
1210 |
-
|
1211 |
-
### Guzzle\Http\Plugin\CurlAuthPlugin
|
1212 |
-
|
1213 |
-
Now `Guzzle\Plugin\CurlAuth\CurlAuthPlugin`.
|
1214 |
-
|
1215 |
-
### Guzzle\Http\Plugin\ExponentialBackoffPlugin
|
1216 |
-
|
1217 |
-
Now `Guzzle\Plugin\Backoff\BackoffPlugin`, and other changes.
|
1218 |
-
|
1219 |
-
**Before**
|
1220 |
-
|
1221 |
-
```php
|
1222 |
-
use Guzzle\Http\Plugin\ExponentialBackoffPlugin;
|
1223 |
-
|
1224 |
-
$backoffPlugin = new ExponentialBackoffPlugin($maxRetries, array_merge(
|
1225 |
-
ExponentialBackoffPlugin::getDefaultFailureCodes(), array(429)
|
1226 |
-
));
|
1227 |
-
|
1228 |
-
$client->addSubscriber($backoffPlugin);
|
1229 |
-
```
|
1230 |
-
|
1231 |
-
**After**
|
1232 |
-
|
1233 |
-
```php
|
1234 |
-
use Guzzle\Plugin\Backoff\BackoffPlugin;
|
1235 |
-
use Guzzle\Plugin\Backoff\HttpBackoffStrategy;
|
1236 |
-
|
1237 |
-
// Use convenient factory method instead -- see implementation for ideas of what
|
1238 |
-
// you can do with chaining backoff strategies
|
1239 |
-
$backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, array_merge(
|
1240 |
-
HttpBackoffStrategy::getDefaultFailureCodes(), array(429)
|
1241 |
-
));
|
1242 |
-
$client->addSubscriber($backoffPlugin);
|
1243 |
-
```
|
1244 |
-
|
1245 |
-
### Known Issues
|
1246 |
-
|
1247 |
-
#### [BUG] Accept-Encoding header behavior changed unintentionally.
|
1248 |
-
|
1249 |
-
(See #217) (Fixed in 09daeb8c666fb44499a0646d655a8ae36456575e)
|
1250 |
-
|
1251 |
-
In version 2.8 setting the `Accept-Encoding` header would set the CURLOPT_ENCODING option, which permitted cURL to
|
1252 |
-
properly handle gzip/deflate compressed responses from the server. In versions affected by this bug this does not happen.
|
1253 |
-
See issue #217 for a workaround, or use a version containing the fix.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/composer.json
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "guzzlehttp/guzzle",
|
3 |
-
"type": "library",
|
4 |
-
"description": "Guzzle is a PHP HTTP client library",
|
5 |
-
"keywords": [
|
6 |
-
"framework",
|
7 |
-
"http",
|
8 |
-
"rest",
|
9 |
-
"web service",
|
10 |
-
"curl",
|
11 |
-
"client",
|
12 |
-
"HTTP client",
|
13 |
-
"PSR-7",
|
14 |
-
"PSR-18"
|
15 |
-
],
|
16 |
-
"homepage": "http://guzzlephp.org/",
|
17 |
-
"license": "MIT",
|
18 |
-
"authors": [
|
19 |
-
{
|
20 |
-
"name": "Michael Dowling",
|
21 |
-
"email": "mtdowling@gmail.com",
|
22 |
-
"homepage": "https://github.com/mtdowling"
|
23 |
-
},
|
24 |
-
{
|
25 |
-
"name": "Márk Sági-Kazár",
|
26 |
-
"email": "mark.sagikazar@gmail.com",
|
27 |
-
"homepage": "https://sagikazarmark.hu"
|
28 |
-
}
|
29 |
-
],
|
30 |
-
"require": {
|
31 |
-
"php": "^7.2.5 || ^8.0",
|
32 |
-
"ext-json": "*",
|
33 |
-
"guzzlehttp/promises": "^1.4",
|
34 |
-
"guzzlehttp/psr7": "^1.7",
|
35 |
-
"psr/http-client": "^1.0"
|
36 |
-
},
|
37 |
-
"provide": {
|
38 |
-
"psr/http-client-implementation": "1.0"
|
39 |
-
},
|
40 |
-
"require-dev": {
|
41 |
-
"ext-curl": "*",
|
42 |
-
"php-http/client-integration-tests": "^3.0",
|
43 |
-
"phpunit/phpunit": "^8.5.5 || ^9.3.5",
|
44 |
-
"psr/log": "^1.1"
|
45 |
-
},
|
46 |
-
"suggest": {
|
47 |
-
"ext-curl": "Required for CURL handler support",
|
48 |
-
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
|
49 |
-
"psr/log": "Required for using the Log middleware"
|
50 |
-
},
|
51 |
-
"config": {
|
52 |
-
"sort-packages": true
|
53 |
-
},
|
54 |
-
"extra": {
|
55 |
-
"branch-alias": {
|
56 |
-
"dev-master": "7.1-dev"
|
57 |
-
}
|
58 |
-
},
|
59 |
-
"autoload": {
|
60 |
-
"psr-4": {
|
61 |
-
"GuzzleHttp\\": "src/"
|
62 |
-
},
|
63 |
-
"files": [
|
64 |
-
"src/functions_include.php"
|
65 |
-
]
|
66 |
-
},
|
67 |
-
"autoload-dev": {
|
68 |
-
"psr-4": {
|
69 |
-
"GuzzleHttp\\Tests\\": "tests/"
|
70 |
-
}
|
71 |
-
}
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/BodySummarizer.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use Psr\Http\Message\MessageInterface;
|
6 |
-
|
7 |
-
final class BodySummarizer implements BodySummarizerInterface
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
* @var int|null
|
11 |
-
*/
|
12 |
-
private $truncateAt;
|
13 |
-
|
14 |
-
public function __construct(int $truncateAt = null)
|
15 |
-
{
|
16 |
-
$this->truncateAt = $truncateAt;
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Returns a summarized message body.
|
21 |
-
*/
|
22 |
-
public function summarize(MessageInterface $message): ?string
|
23 |
-
{
|
24 |
-
return $this->truncateAt === null
|
25 |
-
? \GuzzleHttp\Psr7\Message::bodySummary($message)
|
26 |
-
: \GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt);
|
27 |
-
}
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use Psr\Http\Message\MessageInterface;
|
6 |
-
|
7 |
-
interface BodySummarizerInterface
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
* Returns a summarized message body.
|
11 |
-
*/
|
12 |
-
public function summarize(MessageInterface $message): ?string;
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Client.php
DELETED
@@ -1,474 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Cookie\CookieJar;
|
6 |
-
use GuzzleHttp\Exception\GuzzleException;
|
7 |
-
use GuzzleHttp\Exception\InvalidArgumentException;
|
8 |
-
use GuzzleHttp\Promise as P;
|
9 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
10 |
-
use Psr\Http\Message\RequestInterface;
|
11 |
-
use Psr\Http\Message\ResponseInterface;
|
12 |
-
use Psr\Http\Message\UriInterface;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @final
|
16 |
-
*/
|
17 |
-
class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
|
18 |
-
{
|
19 |
-
use ClientTrait;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @var array Default request options
|
23 |
-
*/
|
24 |
-
private $config;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Clients accept an array of constructor parameters.
|
28 |
-
*
|
29 |
-
* Here's an example of creating a client using a base_uri and an array of
|
30 |
-
* default request options to apply to each request:
|
31 |
-
*
|
32 |
-
* $client = new Client([
|
33 |
-
* 'base_uri' => 'http://www.foo.com/1.0/',
|
34 |
-
* 'timeout' => 0,
|
35 |
-
* 'allow_redirects' => false,
|
36 |
-
* 'proxy' => '192.168.16.1:10'
|
37 |
-
* ]);
|
38 |
-
*
|
39 |
-
* Client configuration settings include the following options:
|
40 |
-
*
|
41 |
-
* - handler: (callable) Function that transfers HTTP requests over the
|
42 |
-
* wire. The function is called with a Psr7\Http\Message\RequestInterface
|
43 |
-
* and array of transfer options, and must return a
|
44 |
-
* GuzzleHttp\Promise\PromiseInterface that is fulfilled with a
|
45 |
-
* Psr7\Http\Message\ResponseInterface on success.
|
46 |
-
* If no handler is provided, a default handler will be created
|
47 |
-
* that enables all of the request options below by attaching all of the
|
48 |
-
* default middleware to the handler.
|
49 |
-
* - base_uri: (string|UriInterface) Base URI of the client that is merged
|
50 |
-
* into relative URIs. Can be a string or instance of UriInterface.
|
51 |
-
* - **: any request option
|
52 |
-
*
|
53 |
-
* @param array $config Client configuration settings.
|
54 |
-
*
|
55 |
-
* @see \GuzzleHttp\RequestOptions for a list of available request options.
|
56 |
-
*/
|
57 |
-
public function __construct(array $config = [])
|
58 |
-
{
|
59 |
-
if (!isset($config['handler'])) {
|
60 |
-
$config['handler'] = HandlerStack::create();
|
61 |
-
} elseif (!\is_callable($config['handler'])) {
|
62 |
-
throw new InvalidArgumentException('handler must be a callable');
|
63 |
-
}
|
64 |
-
|
65 |
-
// Convert the base_uri to a UriInterface
|
66 |
-
if (isset($config['base_uri'])) {
|
67 |
-
$config['base_uri'] = Psr7\Utils::uriFor($config['base_uri']);
|
68 |
-
}
|
69 |
-
|
70 |
-
$this->configureDefaults($config);
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* @param string $method
|
75 |
-
* @param array $args
|
76 |
-
*
|
77 |
-
* @return PromiseInterface|ResponseInterface
|
78 |
-
*
|
79 |
-
* @deprecated Client::__call will be removed in guzzlehttp/guzzle:8.0.
|
80 |
-
*/
|
81 |
-
public function __call($method, $args)
|
82 |
-
{
|
83 |
-
if (\count($args) < 1) {
|
84 |
-
throw new InvalidArgumentException('Magic request methods require a URI and optional options array');
|
85 |
-
}
|
86 |
-
|
87 |
-
$uri = $args[0];
|
88 |
-
$opts = $args[1] ?? [];
|
89 |
-
|
90 |
-
return \substr($method, -5) === 'Async'
|
91 |
-
? $this->requestAsync(\substr($method, 0, -5), $uri, $opts)
|
92 |
-
: $this->request($method, $uri, $opts);
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Asynchronously send an HTTP request.
|
97 |
-
*
|
98 |
-
* @param array $options Request options to apply to the given
|
99 |
-
* request and to the transfer. See \GuzzleHttp\RequestOptions.
|
100 |
-
*/
|
101 |
-
public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface
|
102 |
-
{
|
103 |
-
// Merge the base URI into the request URI if needed.
|
104 |
-
$options = $this->prepareDefaults($options);
|
105 |
-
|
106 |
-
return $this->transfer(
|
107 |
-
$request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')),
|
108 |
-
$options
|
109 |
-
);
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Send an HTTP request.
|
114 |
-
*
|
115 |
-
* @param array $options Request options to apply to the given
|
116 |
-
* request and to the transfer. See \GuzzleHttp\RequestOptions.
|
117 |
-
*
|
118 |
-
* @throws GuzzleException
|
119 |
-
*/
|
120 |
-
public function send(RequestInterface $request, array $options = []): ResponseInterface
|
121 |
-
{
|
122 |
-
$options[RequestOptions::SYNCHRONOUS] = true;
|
123 |
-
return $this->sendAsync($request, $options)->wait();
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* The HttpClient PSR (PSR-18) specify this method.
|
128 |
-
*
|
129 |
-
* @inheritDoc
|
130 |
-
*/
|
131 |
-
public function sendRequest(RequestInterface $request): ResponseInterface
|
132 |
-
{
|
133 |
-
$options[RequestOptions::SYNCHRONOUS] = true;
|
134 |
-
$options[RequestOptions::ALLOW_REDIRECTS] = false;
|
135 |
-
$options[RequestOptions::HTTP_ERRORS] = false;
|
136 |
-
|
137 |
-
return $this->sendAsync($request, $options)->wait();
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Create and send an asynchronous HTTP request.
|
142 |
-
*
|
143 |
-
* Use an absolute path to override the base path of the client, or a
|
144 |
-
* relative path to append to the base path of the client. The URL can
|
145 |
-
* contain the query string as well. Use an array to provide a URL
|
146 |
-
* template and additional variables to use in the URL template expansion.
|
147 |
-
*
|
148 |
-
* @param string $method HTTP method
|
149 |
-
* @param string|UriInterface $uri URI object or string.
|
150 |
-
* @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
|
151 |
-
*/
|
152 |
-
public function requestAsync(string $method, $uri = '', array $options = []): PromiseInterface
|
153 |
-
{
|
154 |
-
$options = $this->prepareDefaults($options);
|
155 |
-
// Remove request modifying parameter because it can be done up-front.
|
156 |
-
$headers = $options['headers'] ?? [];
|
157 |
-
$body = $options['body'] ?? null;
|
158 |
-
$version = $options['version'] ?? '1.1';
|
159 |
-
// Merge the URI into the base URI.
|
160 |
-
$uri = $this->buildUri(Psr7\Utils::uriFor($uri), $options);
|
161 |
-
if (\is_array($body)) {
|
162 |
-
throw $this->invalidBody();
|
163 |
-
}
|
164 |
-
$request = new Psr7\Request($method, $uri, $headers, $body, $version);
|
165 |
-
// Remove the option so that they are not doubly-applied.
|
166 |
-
unset($options['headers'], $options['body'], $options['version']);
|
167 |
-
|
168 |
-
return $this->transfer($request, $options);
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Create and send an HTTP request.
|
173 |
-
*
|
174 |
-
* Use an absolute path to override the base path of the client, or a
|
175 |
-
* relative path to append to the base path of the client. The URL can
|
176 |
-
* contain the query string as well.
|
177 |
-
*
|
178 |
-
* @param string $method HTTP method.
|
179 |
-
* @param string|UriInterface $uri URI object or string.
|
180 |
-
* @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
|
181 |
-
*
|
182 |
-
* @throws GuzzleException
|
183 |
-
*/
|
184 |
-
public function request(string $method, $uri = '', array $options = []): ResponseInterface
|
185 |
-
{
|
186 |
-
$options[RequestOptions::SYNCHRONOUS] = true;
|
187 |
-
return $this->requestAsync($method, $uri, $options)->wait();
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Get a client configuration option.
|
192 |
-
*
|
193 |
-
* These options include default request options of the client, a "handler"
|
194 |
-
* (if utilized by the concrete client), and a "base_uri" if utilized by
|
195 |
-
* the concrete client.
|
196 |
-
*
|
197 |
-
* @param string|null $option The config option to retrieve.
|
198 |
-
*
|
199 |
-
* @return mixed
|
200 |
-
*
|
201 |
-
* @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0.
|
202 |
-
*/
|
203 |
-
public function getConfig(?string $option = null)
|
204 |
-
{
|
205 |
-
return $option === null
|
206 |
-
? $this->config
|
207 |
-
: (isset($this->config[$option]) ? $this->config[$option] : null);
|
208 |
-
}
|
209 |
-
|
210 |
-
private function buildUri(UriInterface $uri, array $config): UriInterface
|
211 |
-
{
|
212 |
-
if (isset($config['base_uri'])) {
|
213 |
-
$uri = Psr7\UriResolver::resolve(Psr7\Utils::uriFor($config['base_uri']), $uri);
|
214 |
-
}
|
215 |
-
|
216 |
-
if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) {
|
217 |
-
$idnOptions = ($config['idn_conversion'] === true) ? \IDNA_DEFAULT : $config['idn_conversion'];
|
218 |
-
$uri = Utils::idnUriConvert($uri, $idnOptions);
|
219 |
-
}
|
220 |
-
|
221 |
-
return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
|
222 |
-
}
|
223 |
-
|
224 |
-
/**
|
225 |
-
* Configures the default options for a client.
|
226 |
-
*/
|
227 |
-
private function configureDefaults(array $config): void
|
228 |
-
{
|
229 |
-
$defaults = [
|
230 |
-
'allow_redirects' => RedirectMiddleware::$defaultSettings,
|
231 |
-
'http_errors' => true,
|
232 |
-
'decode_content' => true,
|
233 |
-
'verify' => true,
|
234 |
-
'cookies' => false,
|
235 |
-
'idn_conversion' => false,
|
236 |
-
];
|
237 |
-
|
238 |
-
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
|
239 |
-
|
240 |
-
// We can only trust the HTTP_PROXY environment variable in a CLI
|
241 |
-
// process due to the fact that PHP has no reliable mechanism to
|
242 |
-
// get environment variables that start with "HTTP_".
|
243 |
-
if (\PHP_SAPI === 'cli' && ($proxy = Utils::getenv('HTTP_PROXY'))) {
|
244 |
-
$defaults['proxy']['http'] = $proxy;
|
245 |
-
}
|
246 |
-
|
247 |
-
if ($proxy = Utils::getenv('HTTPS_PROXY')) {
|
248 |
-
$defaults['proxy']['https'] = $proxy;
|
249 |
-
}
|
250 |
-
|
251 |
-
if ($noProxy = Utils::getenv('NO_PROXY')) {
|
252 |
-
$cleanedNoProxy = \str_replace(' ', '', $noProxy);
|
253 |
-
$defaults['proxy']['no'] = \explode(',', $cleanedNoProxy);
|
254 |
-
}
|
255 |
-
|
256 |
-
$this->config = $config + $defaults;
|
257 |
-
|
258 |
-
if (!empty($config['cookies']) && $config['cookies'] === true) {
|
259 |
-
$this->config['cookies'] = new CookieJar();
|
260 |
-
}
|
261 |
-
|
262 |
-
// Add the default user-agent header.
|
263 |
-
if (!isset($this->config['headers'])) {
|
264 |
-
$this->config['headers'] = ['User-Agent' => Utils::defaultUserAgent()];
|
265 |
-
} else {
|
266 |
-
// Add the User-Agent header if one was not already set.
|
267 |
-
foreach (\array_keys($this->config['headers']) as $name) {
|
268 |
-
if (\strtolower($name) === 'user-agent') {
|
269 |
-
return;
|
270 |
-
}
|
271 |
-
}
|
272 |
-
$this->config['headers']['User-Agent'] = Utils::defaultUserAgent();
|
273 |
-
}
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Merges default options into the array.
|
278 |
-
*
|
279 |
-
* @param array $options Options to modify by reference
|
280 |
-
*/
|
281 |
-
private function prepareDefaults(array $options): array
|
282 |
-
{
|
283 |
-
$defaults = $this->config;
|
284 |
-
|
285 |
-
if (!empty($defaults['headers'])) {
|
286 |
-
// Default headers are only added if they are not present.
|
287 |
-
$defaults['_conditional'] = $defaults['headers'];
|
288 |
-
unset($defaults['headers']);
|
289 |
-
}
|
290 |
-
|
291 |
-
// Special handling for headers is required as they are added as
|
292 |
-
// conditional headers and as headers passed to a request ctor.
|
293 |
-
if (\array_key_exists('headers', $options)) {
|
294 |
-
// Allows default headers to be unset.
|
295 |
-
if ($options['headers'] === null) {
|
296 |
-
$defaults['_conditional'] = [];
|
297 |
-
unset($options['headers']);
|
298 |
-
} elseif (!\is_array($options['headers'])) {
|
299 |
-
throw new InvalidArgumentException('headers must be an array');
|
300 |
-
}
|
301 |
-
}
|
302 |
-
|
303 |
-
// Shallow merge defaults underneath options.
|
304 |
-
$result = $options + $defaults;
|
305 |
-
|
306 |
-
// Remove null values.
|
307 |
-
foreach ($result as $k => $v) {
|
308 |
-
if ($v === null) {
|
309 |
-
unset($result[$k]);
|
310 |
-
}
|
311 |
-
}
|
312 |
-
|
313 |
-
return $result;
|
314 |
-
}
|
315 |
-
|
316 |
-
/**
|
317 |
-
* Transfers the given request and applies request options.
|
318 |
-
*
|
319 |
-
* The URI of the request is not modified and the request options are used
|
320 |
-
* as-is without merging in default options.
|
321 |
-
*
|
322 |
-
* @param array $options See \GuzzleHttp\RequestOptions.
|
323 |
-
*/
|
324 |
-
private function transfer(RequestInterface $request, array $options): PromiseInterface
|
325 |
-
{
|
326 |
-
$request = $this->applyOptions($request, $options);
|
327 |
-
/** @var HandlerStack $handler */
|
328 |
-
$handler = $options['handler'];
|
329 |
-
|
330 |
-
try {
|
331 |
-
return P\Create::promiseFor($handler($request, $options));
|
332 |
-
} catch (\Exception $e) {
|
333 |
-
return P\Create::rejectionFor($e);
|
334 |
-
}
|
335 |
-
}
|
336 |
-
|
337 |
-
/**
|
338 |
-
* Applies the array of request options to a request.
|
339 |
-
*/
|
340 |
-
private function applyOptions(RequestInterface $request, array &$options): RequestInterface
|
341 |
-
{
|
342 |
-
$modify = [
|
343 |
-
'set_headers' => [],
|
344 |
-
];
|
345 |
-
|
346 |
-
if (isset($options['headers'])) {
|
347 |
-
$modify['set_headers'] = $options['headers'];
|
348 |
-
unset($options['headers']);
|
349 |
-
}
|
350 |
-
|
351 |
-
if (isset($options['form_params'])) {
|
352 |
-
if (isset($options['multipart'])) {
|
353 |
-
throw new InvalidArgumentException('You cannot use '
|
354 |
-
. 'form_params and multipart at the same time. Use the '
|
355 |
-
. 'form_params option if you want to send application/'
|
356 |
-
. 'x-www-form-urlencoded requests, and the multipart '
|
357 |
-
. 'option to send multipart/form-data requests.');
|
358 |
-
}
|
359 |
-
$options['body'] = \http_build_query($options['form_params'], '', '&');
|
360 |
-
unset($options['form_params']);
|
361 |
-
// Ensure that we don't have the header in different case and set the new value.
|
362 |
-
$options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']);
|
363 |
-
$options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
|
364 |
-
}
|
365 |
-
|
366 |
-
if (isset($options['multipart'])) {
|
367 |
-
$options['body'] = new Psr7\MultipartStream($options['multipart']);
|
368 |
-
unset($options['multipart']);
|
369 |
-
}
|
370 |
-
|
371 |
-
if (isset($options['json'])) {
|
372 |
-
$options['body'] = Utils::jsonEncode($options['json']);
|
373 |
-
unset($options['json']);
|
374 |
-
// Ensure that we don't have the header in different case and set the new value.
|
375 |
-
$options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']);
|
376 |
-
$options['_conditional']['Content-Type'] = 'application/json';
|
377 |
-
}
|
378 |
-
|
379 |
-
if (!empty($options['decode_content'])
|
380 |
-
&& $options['decode_content'] !== true
|
381 |
-
) {
|
382 |
-
// Ensure that we don't have the header in different case and set the new value.
|
383 |
-
$options['_conditional'] = Psr7\Utils::caselessRemove(['Accept-Encoding'], $options['_conditional']);
|
384 |
-
$modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
|
385 |
-
}
|
386 |
-
|
387 |
-
if (isset($options['body'])) {
|
388 |
-
if (\is_array($options['body'])) {
|
389 |
-
throw $this->invalidBody();
|
390 |
-
}
|
391 |
-
$modify['body'] = Psr7\Utils::streamFor($options['body']);
|
392 |
-
unset($options['body']);
|
393 |
-
}
|
394 |
-
|
395 |
-
if (!empty($options['auth']) && \is_array($options['auth'])) {
|
396 |
-
$value = $options['auth'];
|
397 |
-
$type = isset($value[2]) ? \strtolower($value[2]) : 'basic';
|
398 |
-
switch ($type) {
|
399 |
-
case 'basic':
|
400 |
-
// Ensure that we don't have the header in different case and set the new value.
|
401 |
-
$modify['set_headers'] = Psr7\Utils::caselessRemove(['Authorization'], $modify['set_headers']);
|
402 |
-
$modify['set_headers']['Authorization'] = 'Basic '
|
403 |
-
. \base64_encode("$value[0]:$value[1]");
|
404 |
-
break;
|
405 |
-
case 'digest':
|
406 |
-
// @todo: Do not rely on curl
|
407 |
-
$options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_DIGEST;
|
408 |
-
$options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]";
|
409 |
-
break;
|
410 |
-
case 'ntlm':
|
411 |
-
$options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_NTLM;
|
412 |
-
$options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]";
|
413 |
-
break;
|
414 |
-
}
|
415 |
-
}
|
416 |
-
|
417 |
-
if (isset($options['query'])) {
|
418 |
-
$value = $options['query'];
|
419 |
-
if (\is_array($value)) {
|
420 |
-
$value = \http_build_query($value, '', '&', \PHP_QUERY_RFC3986);
|
421 |
-
}
|
422 |
-
if (!\is_string($value)) {
|
423 |
-
throw new InvalidArgumentException('query must be a string or array');
|
424 |
-
}
|
425 |
-
$modify['query'] = $value;
|
426 |
-
unset($options['query']);
|
427 |
-
}
|
428 |
-
|
429 |
-
// Ensure that sink is not an invalid value.
|
430 |
-
if (isset($options['sink'])) {
|
431 |
-
// TODO: Add more sink validation?
|
432 |
-
if (\is_bool($options['sink'])) {
|
433 |
-
throw new InvalidArgumentException('sink must not be a boolean');
|
434 |
-
}
|
435 |
-
}
|
436 |
-
|
437 |
-
$request = Psr7\Utils::modifyRequest($request, $modify);
|
438 |
-
if ($request->getBody() instanceof Psr7\MultipartStream) {
|
439 |
-
// Use a multipart/form-data POST if a Content-Type is not set.
|
440 |
-
// Ensure that we don't have the header in different case and set the new value.
|
441 |
-
$options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']);
|
442 |
-
$options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
|
443 |
-
. $request->getBody()->getBoundary();
|
444 |
-
}
|
445 |
-
|
446 |
-
// Merge in conditional headers if they are not present.
|
447 |
-
if (isset($options['_conditional'])) {
|
448 |
-
// Build up the changes so it's in a single clone of the message.
|
449 |
-
$modify = [];
|
450 |
-
foreach ($options['_conditional'] as $k => $v) {
|
451 |
-
if (!$request->hasHeader($k)) {
|
452 |
-
$modify['set_headers'][$k] = $v;
|
453 |
-
}
|
454 |
-
}
|
455 |
-
$request = Psr7\Utils::modifyRequest($request, $modify);
|
456 |
-
// Don't pass this internal value along to middleware/handlers.
|
457 |
-
unset($options['_conditional']);
|
458 |
-
}
|
459 |
-
|
460 |
-
return $request;
|
461 |
-
}
|
462 |
-
|
463 |
-
/**
|
464 |
-
* Return an InvalidArgumentException with pre-set message.
|
465 |
-
*/
|
466 |
-
private function invalidBody(): InvalidArgumentException
|
467 |
-
{
|
468 |
-
return new InvalidArgumentException('Passing in the "body" request '
|
469 |
-
. 'option as an array to send a request is not supported. '
|
470 |
-
. 'Please use the "form_params" request option to send a '
|
471 |
-
. 'application/x-www-form-urlencoded request, or the "multipart" '
|
472 |
-
. 'request option to send a multipart/form-data request.');
|
473 |
-
}
|
474 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/ClientInterface.php
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Exception\GuzzleException;
|
6 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
7 |
-
use Psr\Http\Message\RequestInterface;
|
8 |
-
use Psr\Http\Message\ResponseInterface;
|
9 |
-
use Psr\Http\Message\UriInterface;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Client interface for sending HTTP requests.
|
13 |
-
*/
|
14 |
-
interface ClientInterface
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* The Guzzle major version.
|
18 |
-
*/
|
19 |
-
const MAJOR_VERSION = 7;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Send an HTTP request.
|
23 |
-
*
|
24 |
-
* @param RequestInterface $request Request to send
|
25 |
-
* @param array $options Request options to apply to the given
|
26 |
-
* request and to the transfer.
|
27 |
-
*
|
28 |
-
* @throws GuzzleException
|
29 |
-
*/
|
30 |
-
public function send(RequestInterface $request, array $options = []): ResponseInterface;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Asynchronously send an HTTP request.
|
34 |
-
*
|
35 |
-
* @param RequestInterface $request Request to send
|
36 |
-
* @param array $options Request options to apply to the given
|
37 |
-
* request and to the transfer.
|
38 |
-
*/
|
39 |
-
public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Create and send an HTTP request.
|
43 |
-
*
|
44 |
-
* Use an absolute path to override the base path of the client, or a
|
45 |
-
* relative path to append to the base path of the client. The URL can
|
46 |
-
* contain the query string as well.
|
47 |
-
*
|
48 |
-
* @param string $method HTTP method.
|
49 |
-
* @param string|UriInterface $uri URI object or string.
|
50 |
-
* @param array $options Request options to apply.
|
51 |
-
*
|
52 |
-
* @throws GuzzleException
|
53 |
-
*/
|
54 |
-
public function request(string $method, $uri, array $options = []): ResponseInterface;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Create and send an asynchronous HTTP request.
|
58 |
-
*
|
59 |
-
* Use an absolute path to override the base path of the client, or a
|
60 |
-
* relative path to append to the base path of the client. The URL can
|
61 |
-
* contain the query string as well. Use an array to provide a URL
|
62 |
-
* template and additional variables to use in the URL template expansion.
|
63 |
-
*
|
64 |
-
* @param string $method HTTP method
|
65 |
-
* @param string|UriInterface $uri URI object or string.
|
66 |
-
* @param array $options Request options to apply.
|
67 |
-
*/
|
68 |
-
public function requestAsync(string $method, $uri, array $options = []): PromiseInterface;
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Get a client configuration option.
|
72 |
-
*
|
73 |
-
* These options include default request options of the client, a "handler"
|
74 |
-
* (if utilized by the concrete client), and a "base_uri" if utilized by
|
75 |
-
* the concrete client.
|
76 |
-
*
|
77 |
-
* @param string|null $option The config option to retrieve.
|
78 |
-
*
|
79 |
-
* @return mixed
|
80 |
-
*
|
81 |
-
* @deprecated ClientInterface::getConfig will be removed in guzzlehttp/guzzle:8.0.
|
82 |
-
*/
|
83 |
-
public function getConfig(?string $option = null);
|
84 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/ClientTrait.php
DELETED
@@ -1,241 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Exception\GuzzleException;
|
6 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
7 |
-
use Psr\Http\Message\ResponseInterface;
|
8 |
-
use Psr\Http\Message\UriInterface;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Client interface for sending HTTP requests.
|
12 |
-
*/
|
13 |
-
trait ClientTrait
|
14 |
-
{
|
15 |
-
/**
|
16 |
-
* Create and send an HTTP request.
|
17 |
-
*
|
18 |
-
* Use an absolute path to override the base path of the client, or a
|
19 |
-
* relative path to append to the base path of the client. The URL can
|
20 |
-
* contain the query string as well.
|
21 |
-
*
|
22 |
-
* @param string $method HTTP method.
|
23 |
-
* @param string|UriInterface $uri URI object or string.
|
24 |
-
* @param array $options Request options to apply.
|
25 |
-
*
|
26 |
-
* @throws GuzzleException
|
27 |
-
*/
|
28 |
-
abstract public function request(string $method, $uri, array $options = []): ResponseInterface;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Create and send an HTTP GET request.
|
32 |
-
*
|
33 |
-
* Use an absolute path to override the base path of the client, or a
|
34 |
-
* relative path to append to the base path of the client. The URL can
|
35 |
-
* contain the query string as well.
|
36 |
-
*
|
37 |
-
* @param string|UriInterface $uri URI object or string.
|
38 |
-
* @param array $options Request options to apply.
|
39 |
-
*
|
40 |
-
* @throws GuzzleException
|
41 |
-
*/
|
42 |
-
public function get($uri, array $options = []): ResponseInterface
|
43 |
-
{
|
44 |
-
return $this->request('GET', $uri, $options);
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Create and send an HTTP HEAD request.
|
49 |
-
*
|
50 |
-
* Use an absolute path to override the base path of the client, or a
|
51 |
-
* relative path to append to the base path of the client. The URL can
|
52 |
-
* contain the query string as well.
|
53 |
-
*
|
54 |
-
* @param string|UriInterface $uri URI object or string.
|
55 |
-
* @param array $options Request options to apply.
|
56 |
-
*
|
57 |
-
* @throws GuzzleException
|
58 |
-
*/
|
59 |
-
public function head($uri, array $options = []): ResponseInterface
|
60 |
-
{
|
61 |
-
return $this->request('HEAD', $uri, $options);
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Create and send an HTTP PUT request.
|
66 |
-
*
|
67 |
-
* Use an absolute path to override the base path of the client, or a
|
68 |
-
* relative path to append to the base path of the client. The URL can
|
69 |
-
* contain the query string as well.
|
70 |
-
*
|
71 |
-
* @param string|UriInterface $uri URI object or string.
|
72 |
-
* @param array $options Request options to apply.
|
73 |
-
*
|
74 |
-
* @throws GuzzleException
|
75 |
-
*/
|
76 |
-
public function put($uri, array $options = []): ResponseInterface
|
77 |
-
{
|
78 |
-
return $this->request('PUT', $uri, $options);
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Create and send an HTTP POST request.
|
83 |
-
*
|
84 |
-
* Use an absolute path to override the base path of the client, or a
|
85 |
-
* relative path to append to the base path of the client. The URL can
|
86 |
-
* contain the query string as well.
|
87 |
-
*
|
88 |
-
* @param string|UriInterface $uri URI object or string.
|
89 |
-
* @param array $options Request options to apply.
|
90 |
-
*
|
91 |
-
* @throws GuzzleException
|
92 |
-
*/
|
93 |
-
public function post($uri, array $options = []): ResponseInterface
|
94 |
-
{
|
95 |
-
return $this->request('POST', $uri, $options);
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Create and send an HTTP PATCH request.
|
100 |
-
*
|
101 |
-
* Use an absolute path to override the base path of the client, or a
|
102 |
-
* relative path to append to the base path of the client. The URL can
|
103 |
-
* contain the query string as well.
|
104 |
-
*
|
105 |
-
* @param string|UriInterface $uri URI object or string.
|
106 |
-
* @param array $options Request options to apply.
|
107 |
-
*
|
108 |
-
* @throws GuzzleException
|
109 |
-
*/
|
110 |
-
public function patch($uri, array $options = []): ResponseInterface
|
111 |
-
{
|
112 |
-
return $this->request('PATCH', $uri, $options);
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Create and send an HTTP DELETE request.
|
117 |
-
*
|
118 |
-
* Use an absolute path to override the base path of the client, or a
|
119 |
-
* relative path to append to the base path of the client. The URL can
|
120 |
-
* contain the query string as well.
|
121 |
-
*
|
122 |
-
* @param string|UriInterface $uri URI object or string.
|
123 |
-
* @param array $options Request options to apply.
|
124 |
-
*
|
125 |
-
* @throws GuzzleException
|
126 |
-
*/
|
127 |
-
public function delete($uri, array $options = []): ResponseInterface
|
128 |
-
{
|
129 |
-
return $this->request('DELETE', $uri, $options);
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Create and send an asynchronous HTTP request.
|
134 |
-
*
|
135 |
-
* Use an absolute path to override the base path of the client, or a
|
136 |
-
* relative path to append to the base path of the client. The URL can
|
137 |
-
* contain the query string as well. Use an array to provide a URL
|
138 |
-
* template and additional variables to use in the URL template expansion.
|
139 |
-
*
|
140 |
-
* @param string $method HTTP method
|
141 |
-
* @param string|UriInterface $uri URI object or string.
|
142 |
-
* @param array $options Request options to apply.
|
143 |
-
*/
|
144 |
-
abstract public function requestAsync(string $method, $uri, array $options = []): PromiseInterface;
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Create and send an asynchronous HTTP GET request.
|
148 |
-
*
|
149 |
-
* Use an absolute path to override the base path of the client, or a
|
150 |
-
* relative path to append to the base path of the client. The URL can
|
151 |
-
* contain the query string as well. Use an array to provide a URL
|
152 |
-
* template and additional variables to use in the URL template expansion.
|
153 |
-
*
|
154 |
-
* @param string|UriInterface $uri URI object or string.
|
155 |
-
* @param array $options Request options to apply.
|
156 |
-
*/
|
157 |
-
public function getAsync($uri, array $options = []): PromiseInterface
|
158 |
-
{
|
159 |
-
return $this->requestAsync('GET', $uri, $options);
|
160 |
-
}
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Create and send an asynchronous HTTP HEAD request.
|
164 |
-
*
|
165 |
-
* Use an absolute path to override the base path of the client, or a
|
166 |
-
* relative path to append to the base path of the client. The URL can
|
167 |
-
* contain the query string as well. Use an array to provide a URL
|
168 |
-
* template and additional variables to use in the URL template expansion.
|
169 |
-
*
|
170 |
-
* @param string|UriInterface $uri URI object or string.
|
171 |
-
* @param array $options Request options to apply.
|
172 |
-
*/
|
173 |
-
public function headAsync($uri, array $options = []): PromiseInterface
|
174 |
-
{
|
175 |
-
return $this->requestAsync('HEAD', $uri, $options);
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Create and send an asynchronous HTTP PUT request.
|
180 |
-
*
|
181 |
-
* Use an absolute path to override the base path of the client, or a
|
182 |
-
* relative path to append to the base path of the client. The URL can
|
183 |
-
* contain the query string as well. Use an array to provide a URL
|
184 |
-
* template and additional variables to use in the URL template expansion.
|
185 |
-
*
|
186 |
-
* @param string|UriInterface $uri URI object or string.
|
187 |
-
* @param array $options Request options to apply.
|
188 |
-
*/
|
189 |
-
public function putAsync($uri, array $options = []): PromiseInterface
|
190 |
-
{
|
191 |
-
return $this->requestAsync('PUT', $uri, $options);
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Create and send an asynchronous HTTP POST request.
|
196 |
-
*
|
197 |
-
* Use an absolute path to override the base path of the client, or a
|
198 |
-
* relative path to append to the base path of the client. The URL can
|
199 |
-
* contain the query string as well. Use an array to provide a URL
|
200 |
-
* template and additional variables to use in the URL template expansion.
|
201 |
-
*
|
202 |
-
* @param string|UriInterface $uri URI object or string.
|
203 |
-
* @param array $options Request options to apply.
|
204 |
-
*/
|
205 |
-
public function postAsync($uri, array $options = []): PromiseInterface
|
206 |
-
{
|
207 |
-
return $this->requestAsync('POST', $uri, $options);
|
208 |
-
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Create and send an asynchronous HTTP PATCH request.
|
212 |
-
*
|
213 |
-
* Use an absolute path to override the base path of the client, or a
|
214 |
-
* relative path to append to the base path of the client. The URL can
|
215 |
-
* contain the query string as well. Use an array to provide a URL
|
216 |
-
* template and additional variables to use in the URL template expansion.
|
217 |
-
*
|
218 |
-
* @param string|UriInterface $uri URI object or string.
|
219 |
-
* @param array $options Request options to apply.
|
220 |
-
*/
|
221 |
-
public function patchAsync($uri, array $options = []): PromiseInterface
|
222 |
-
{
|
223 |
-
return $this->requestAsync('PATCH', $uri, $options);
|
224 |
-
}
|
225 |
-
|
226 |
-
/**
|
227 |
-
* Create and send an asynchronous HTTP DELETE request.
|
228 |
-
*
|
229 |
-
* Use an absolute path to override the base path of the client, or a
|
230 |
-
* relative path to append to the base path of the client. The URL can
|
231 |
-
* contain the query string as well. Use an array to provide a URL
|
232 |
-
* template and additional variables to use in the URL template expansion.
|
233 |
-
*
|
234 |
-
* @param string|UriInterface $uri URI object or string.
|
235 |
-
* @param array $options Request options to apply.
|
236 |
-
*/
|
237 |
-
public function deleteAsync($uri, array $options = []): PromiseInterface
|
238 |
-
{
|
239 |
-
return $this->requestAsync('DELETE', $uri, $options);
|
240 |
-
}
|
241 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
DELETED
@@ -1,313 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Cookie;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
use Psr\Http\Message\ResponseInterface;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Cookie jar that stores cookies as an array
|
10 |
-
*/
|
11 |
-
class CookieJar implements CookieJarInterface
|
12 |
-
{
|
13 |
-
/**
|
14 |
-
* @var SetCookie[] Loaded cookie data
|
15 |
-
*/
|
16 |
-
private $cookies = [];
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @var bool
|
20 |
-
*/
|
21 |
-
private $strictMode;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @param bool $strictMode Set to true to throw exceptions when invalid
|
25 |
-
* cookies are added to the cookie jar.
|
26 |
-
* @param array $cookieArray Array of SetCookie objects or a hash of
|
27 |
-
* arrays that can be used with the SetCookie
|
28 |
-
* constructor
|
29 |
-
*/
|
30 |
-
public function __construct(bool $strictMode = false, array $cookieArray = [])
|
31 |
-
{
|
32 |
-
$this->strictMode = $strictMode;
|
33 |
-
|
34 |
-
foreach ($cookieArray as $cookie) {
|
35 |
-
if (!($cookie instanceof SetCookie)) {
|
36 |
-
$cookie = new SetCookie($cookie);
|
37 |
-
}
|
38 |
-
$this->setCookie($cookie);
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Create a new Cookie jar from an associative array and domain.
|
44 |
-
*
|
45 |
-
* @param array $cookies Cookies to create the jar from
|
46 |
-
* @param string $domain Domain to set the cookies to
|
47 |
-
*/
|
48 |
-
public static function fromArray(array $cookies, string $domain): self
|
49 |
-
{
|
50 |
-
$cookieJar = new self();
|
51 |
-
foreach ($cookies as $name => $value) {
|
52 |
-
$cookieJar->setCookie(new SetCookie([
|
53 |
-
'Domain' => $domain,
|
54 |
-
'Name' => $name,
|
55 |
-
'Value' => $value,
|
56 |
-
'Discard' => true
|
57 |
-
]));
|
58 |
-
}
|
59 |
-
|
60 |
-
return $cookieJar;
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Evaluate if this cookie should be persisted to storage
|
65 |
-
* that survives between requests.
|
66 |
-
*
|
67 |
-
* @param SetCookie $cookie Being evaluated.
|
68 |
-
* @param bool $allowSessionCookies If we should persist session cookies
|
69 |
-
*/
|
70 |
-
public static function shouldPersist(SetCookie $cookie, bool $allowSessionCookies = false): bool
|
71 |
-
{
|
72 |
-
if ($cookie->getExpires() || $allowSessionCookies) {
|
73 |
-
if (!$cookie->getDiscard()) {
|
74 |
-
return true;
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
return false;
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Finds and returns the cookie based on the name
|
83 |
-
*
|
84 |
-
* @param string $name cookie name to search for
|
85 |
-
*
|
86 |
-
* @return SetCookie|null cookie that was found or null if not found
|
87 |
-
*/
|
88 |
-
public function getCookieByName(string $name): ?SetCookie
|
89 |
-
{
|
90 |
-
foreach ($this->cookies as $cookie) {
|
91 |
-
if ($cookie->getName() !== null && \strcasecmp($cookie->getName(), $name) === 0) {
|
92 |
-
return $cookie;
|
93 |
-
}
|
94 |
-
}
|
95 |
-
|
96 |
-
return null;
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* @inheritDoc
|
101 |
-
*/
|
102 |
-
public function toArray(): array
|
103 |
-
{
|
104 |
-
return \array_map(static function (SetCookie $cookie): array {
|
105 |
-
return $cookie->toArray();
|
106 |
-
}, $this->getIterator()->getArrayCopy());
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* @inheritDoc
|
111 |
-
*/
|
112 |
-
public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void
|
113 |
-
{
|
114 |
-
if (!$domain) {
|
115 |
-
$this->cookies = [];
|
116 |
-
return;
|
117 |
-
} elseif (!$path) {
|
118 |
-
$this->cookies = \array_filter(
|
119 |
-
$this->cookies,
|
120 |
-
static function (SetCookie $cookie) use ($domain): bool {
|
121 |
-
return !$cookie->matchesDomain($domain);
|
122 |
-
}
|
123 |
-
);
|
124 |
-
} elseif (!$name) {
|
125 |
-
$this->cookies = \array_filter(
|
126 |
-
$this->cookies,
|
127 |
-
static function (SetCookie $cookie) use ($path, $domain): bool {
|
128 |
-
return !($cookie->matchesPath($path) &&
|
129 |
-
$cookie->matchesDomain($domain));
|
130 |
-
}
|
131 |
-
);
|
132 |
-
} else {
|
133 |
-
$this->cookies = \array_filter(
|
134 |
-
$this->cookies,
|
135 |
-
static function (SetCookie $cookie) use ($path, $domain, $name) {
|
136 |
-
return !($cookie->getName() == $name &&
|
137 |
-
$cookie->matchesPath($path) &&
|
138 |
-
$cookie->matchesDomain($domain));
|
139 |
-
}
|
140 |
-
);
|
141 |
-
}
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* @inheritDoc
|
146 |
-
*/
|
147 |
-
public function clearSessionCookies(): void
|
148 |
-
{
|
149 |
-
$this->cookies = \array_filter(
|
150 |
-
$this->cookies,
|
151 |
-
static function (SetCookie $cookie): bool {
|
152 |
-
return !$cookie->getDiscard() && $cookie->getExpires();
|
153 |
-
}
|
154 |
-
);
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* @inheritDoc
|
159 |
-
*/
|
160 |
-
public function setCookie(SetCookie $cookie): bool
|
161 |
-
{
|
162 |
-
// If the name string is empty (but not 0), ignore the set-cookie
|
163 |
-
// string entirely.
|
164 |
-
$name = $cookie->getName();
|
165 |
-
if (!$name && $name !== '0') {
|
166 |
-
return false;
|
167 |
-
}
|
168 |
-
|
169 |
-
// Only allow cookies with set and valid domain, name, value
|
170 |
-
$result = $cookie->validate();
|
171 |
-
if ($result !== true) {
|
172 |
-
if ($this->strictMode) {
|
173 |
-
throw new \RuntimeException('Invalid cookie: ' . $result);
|
174 |
-
}
|
175 |
-
$this->removeCookieIfEmpty($cookie);
|
176 |
-
return false;
|
177 |
-
}
|
178 |
-
|
179 |
-
// Resolve conflicts with previously set cookies
|
180 |
-
foreach ($this->cookies as $i => $c) {
|
181 |
-
|
182 |
-
// Two cookies are identical, when their path, and domain are
|
183 |
-
// identical.
|
184 |
-
if ($c->getPath() != $cookie->getPath() ||
|
185 |
-
$c->getDomain() != $cookie->getDomain() ||
|
186 |
-
$c->getName() != $cookie->getName()
|
187 |
-
) {
|
188 |
-
continue;
|
189 |
-
}
|
190 |
-
|
191 |
-
// The previously set cookie is a discard cookie and this one is
|
192 |
-
// not so allow the new cookie to be set
|
193 |
-
if (!$cookie->getDiscard() && $c->getDiscard()) {
|
194 |
-
unset($this->cookies[$i]);
|
195 |
-
continue;
|
196 |
-
}
|
197 |
-
|
198 |
-
// If the new cookie's expiration is further into the future, then
|
199 |
-
// replace the old cookie
|
200 |
-
if ($cookie->getExpires() > $c->getExpires()) {
|
201 |
-
unset($this->cookies[$i]);
|
202 |
-
continue;
|
203 |
-
}
|
204 |
-
|
205 |
-
// If the value has changed, we better change it
|
206 |
-
if ($cookie->getValue() !== $c->getValue()) {
|
207 |
-
unset($this->cookies[$i]);
|
208 |
-
continue;
|
209 |
-
}
|
210 |
-
|
211 |
-
// The cookie exists, so no need to continue
|
212 |
-
return false;
|
213 |
-
}
|
214 |
-
|
215 |
-
$this->cookies[] = $cookie;
|
216 |
-
|
217 |
-
return true;
|
218 |
-
}
|
219 |
-
|
220 |
-
public function count(): int
|
221 |
-
{
|
222 |
-
return \count($this->cookies);
|
223 |
-
}
|
224 |
-
|
225 |
-
/**
|
226 |
-
* @return \ArrayIterator<int, SetCookie>
|
227 |
-
*/
|
228 |
-
public function getIterator(): \ArrayIterator
|
229 |
-
{
|
230 |
-
return new \ArrayIterator(\array_values($this->cookies));
|
231 |
-
}
|
232 |
-
|
233 |
-
public function extractCookies(RequestInterface $request, ResponseInterface $response): void
|
234 |
-
{
|
235 |
-
if ($cookieHeader = $response->getHeader('Set-Cookie')) {
|
236 |
-
foreach ($cookieHeader as $cookie) {
|
237 |
-
$sc = SetCookie::fromString($cookie);
|
238 |
-
if (!$sc->getDomain()) {
|
239 |
-
$sc->setDomain($request->getUri()->getHost());
|
240 |
-
}
|
241 |
-
if (0 !== \strpos($sc->getPath(), '/')) {
|
242 |
-
$sc->setPath($this->getCookiePathFromRequest($request));
|
243 |
-
}
|
244 |
-
$this->setCookie($sc);
|
245 |
-
}
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Computes cookie path following RFC 6265 section 5.1.4
|
251 |
-
*
|
252 |
-
* @link https://tools.ietf.org/html/rfc6265#section-5.1.4
|
253 |
-
*/
|
254 |
-
private function getCookiePathFromRequest(RequestInterface $request): string
|
255 |
-
{
|
256 |
-
$uriPath = $request->getUri()->getPath();
|
257 |
-
if ('' === $uriPath) {
|
258 |
-
return '/';
|
259 |
-
}
|
260 |
-
if (0 !== \strpos($uriPath, '/')) {
|
261 |
-
return '/';
|
262 |
-
}
|
263 |
-
if ('/' === $uriPath) {
|
264 |
-
return '/';
|
265 |
-
}
|
266 |
-
$lastSlashPos = \strrpos($uriPath, '/');
|
267 |
-
if (0 === $lastSlashPos || false === $lastSlashPos) {
|
268 |
-
return '/';
|
269 |
-
}
|
270 |
-
|
271 |
-
return \substr($uriPath, 0, $lastSlashPos);
|
272 |
-
}
|
273 |
-
|
274 |
-
public function withCookieHeader(RequestInterface $request): RequestInterface
|
275 |
-
{
|
276 |
-
$values = [];
|
277 |
-
$uri = $request->getUri();
|
278 |
-
$scheme = $uri->getScheme();
|
279 |
-
$host = $uri->getHost();
|
280 |
-
$path = $uri->getPath() ?: '/';
|
281 |
-
|
282 |
-
foreach ($this->cookies as $cookie) {
|
283 |
-
if ($cookie->matchesPath($path) &&
|
284 |
-
$cookie->matchesDomain($host) &&
|
285 |
-
!$cookie->isExpired() &&
|
286 |
-
(!$cookie->getSecure() || $scheme === 'https')
|
287 |
-
) {
|
288 |
-
$values[] = $cookie->getName() . '='
|
289 |
-
. $cookie->getValue();
|
290 |
-
}
|
291 |
-
}
|
292 |
-
|
293 |
-
return $values
|
294 |
-
? $request->withHeader('Cookie', \implode('; ', $values))
|
295 |
-
: $request;
|
296 |
-
}
|
297 |
-
|
298 |
-
/**
|
299 |
-
* If a cookie already exists and the server asks to set it again with a
|
300 |
-
* null value, the cookie must be deleted.
|
301 |
-
*/
|
302 |
-
private function removeCookieIfEmpty(SetCookie $cookie): void
|
303 |
-
{
|
304 |
-
$cookieValue = $cookie->getValue();
|
305 |
-
if ($cookieValue === null || $cookieValue === '') {
|
306 |
-
$this->clear(
|
307 |
-
$cookie->getDomain(),
|
308 |
-
$cookie->getPath(),
|
309 |
-
$cookie->getName()
|
310 |
-
);
|
311 |
-
}
|
312 |
-
}
|
313 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Cookie;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
use Psr\Http\Message\ResponseInterface;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Stores HTTP cookies.
|
10 |
-
*
|
11 |
-
* It extracts cookies from HTTP requests, and returns them in HTTP responses.
|
12 |
-
* CookieJarInterface instances automatically expire contained cookies when
|
13 |
-
* necessary. Subclasses are also responsible for storing and retrieving
|
14 |
-
* cookies from a file, database, etc.
|
15 |
-
*
|
16 |
-
* @link https://docs.python.org/2/library/cookielib.html Inspiration
|
17 |
-
* @extends \IteratorAggregate<SetCookie>
|
18 |
-
*/
|
19 |
-
interface CookieJarInterface extends \Countable, \IteratorAggregate
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* Create a request with added cookie headers.
|
23 |
-
*
|
24 |
-
* If no matching cookies are found in the cookie jar, then no Cookie
|
25 |
-
* header is added to the request and the same request is returned.
|
26 |
-
*
|
27 |
-
* @param RequestInterface $request Request object to modify.
|
28 |
-
*
|
29 |
-
* @return RequestInterface returns the modified request.
|
30 |
-
*/
|
31 |
-
public function withCookieHeader(RequestInterface $request): RequestInterface;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Extract cookies from an HTTP response and store them in the CookieJar.
|
35 |
-
*
|
36 |
-
* @param RequestInterface $request Request that was sent
|
37 |
-
* @param ResponseInterface $response Response that was received
|
38 |
-
*/
|
39 |
-
public function extractCookies(RequestInterface $request, ResponseInterface $response): void;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Sets a cookie in the cookie jar.
|
43 |
-
*
|
44 |
-
* @param SetCookie $cookie Cookie to set.
|
45 |
-
*
|
46 |
-
* @return bool Returns true on success or false on failure
|
47 |
-
*/
|
48 |
-
public function setCookie(SetCookie $cookie): bool;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Remove cookies currently held in the cookie jar.
|
52 |
-
*
|
53 |
-
* Invoking this method without arguments will empty the whole cookie jar.
|
54 |
-
* If given a $domain argument only cookies belonging to that domain will
|
55 |
-
* be removed. If given a $domain and $path argument, cookies belonging to
|
56 |
-
* the specified path within that domain are removed. If given all three
|
57 |
-
* arguments, then the cookie with the specified name, path and domain is
|
58 |
-
* removed.
|
59 |
-
*
|
60 |
-
* @param string|null $domain Clears cookies matching a domain
|
61 |
-
* @param string|null $path Clears cookies matching a domain and path
|
62 |
-
* @param string|null $name Clears cookies matching a domain, path, and name
|
63 |
-
*/
|
64 |
-
public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void;
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Discard all sessions cookies.
|
68 |
-
*
|
69 |
-
* Removes cookies that don't have an expire field or a have a discard
|
70 |
-
* field set to true. To be called when the user agent shuts down according
|
71 |
-
* to RFC 2965.
|
72 |
-
*/
|
73 |
-
public function clearSessionCookies(): void;
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Converts the cookie jar to an array.
|
77 |
-
*/
|
78 |
-
public function toArray(): array;
|
79 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Cookie;
|
4 |
-
|
5 |
-
use GuzzleHttp\Utils;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Persists non-session cookies using a JSON formatted file
|
9 |
-
*/
|
10 |
-
class FileCookieJar extends CookieJar
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* @var string filename
|
14 |
-
*/
|
15 |
-
private $filename;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var bool Control whether to persist session cookies or not.
|
19 |
-
*/
|
20 |
-
private $storeSessionCookies;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Create a new FileCookieJar object
|
24 |
-
*
|
25 |
-
* @param string $cookieFile File to store the cookie data
|
26 |
-
* @param bool $storeSessionCookies Set to true to store session cookies
|
27 |
-
* in the cookie jar.
|
28 |
-
*
|
29 |
-
* @throws \RuntimeException if the file cannot be found or created
|
30 |
-
*/
|
31 |
-
public function __construct(string $cookieFile, bool $storeSessionCookies = false)
|
32 |
-
{
|
33 |
-
parent::__construct();
|
34 |
-
$this->filename = $cookieFile;
|
35 |
-
$this->storeSessionCookies = $storeSessionCookies;
|
36 |
-
|
37 |
-
if (\file_exists($cookieFile)) {
|
38 |
-
$this->load($cookieFile);
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Saves the file when shutting down
|
44 |
-
*/
|
45 |
-
public function __destruct()
|
46 |
-
{
|
47 |
-
$this->save($this->filename);
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Saves the cookies to a file.
|
52 |
-
*
|
53 |
-
* @param string $filename File to save
|
54 |
-
*
|
55 |
-
* @throws \RuntimeException if the file cannot be found or created
|
56 |
-
*/
|
57 |
-
public function save(string $filename): void
|
58 |
-
{
|
59 |
-
$json = [];
|
60 |
-
/** @var SetCookie $cookie */
|
61 |
-
foreach ($this as $cookie) {
|
62 |
-
if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
|
63 |
-
$json[] = $cookie->toArray();
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
$jsonStr = Utils::jsonEncode($json);
|
68 |
-
if (false === \file_put_contents($filename, $jsonStr, \LOCK_EX)) {
|
69 |
-
throw new \RuntimeException("Unable to save file {$filename}");
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Load cookies from a JSON formatted file.
|
75 |
-
*
|
76 |
-
* Old cookies are kept unless overwritten by newly loaded ones.
|
77 |
-
*
|
78 |
-
* @param string $filename Cookie file to load.
|
79 |
-
*
|
80 |
-
* @throws \RuntimeException if the file cannot be loaded.
|
81 |
-
*/
|
82 |
-
public function load(string $filename): void
|
83 |
-
{
|
84 |
-
$json = \file_get_contents($filename);
|
85 |
-
if (false === $json) {
|
86 |
-
throw new \RuntimeException("Unable to load file {$filename}");
|
87 |
-
}
|
88 |
-
if ($json === '') {
|
89 |
-
return;
|
90 |
-
}
|
91 |
-
|
92 |
-
$data = Utils::jsonDecode($json, true);
|
93 |
-
if (\is_array($data)) {
|
94 |
-
foreach ($data as $cookie) {
|
95 |
-
$this->setCookie(new SetCookie($cookie));
|
96 |
-
}
|
97 |
-
} elseif (\is_scalar($data) && !empty($data)) {
|
98 |
-
throw new \RuntimeException("Invalid cookie file: {$filename}");
|
99 |
-
}
|
100 |
-
}
|
101 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Cookie;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Persists cookies in the client session
|
7 |
-
*/
|
8 |
-
class SessionCookieJar extends CookieJar
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* @var string session key
|
12 |
-
*/
|
13 |
-
private $sessionKey;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @var bool Control whether to persist session cookies or not.
|
17 |
-
*/
|
18 |
-
private $storeSessionCookies;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Create a new SessionCookieJar object
|
22 |
-
*
|
23 |
-
* @param string $sessionKey Session key name to store the cookie
|
24 |
-
* data in session
|
25 |
-
* @param bool $storeSessionCookies Set to true to store session cookies
|
26 |
-
* in the cookie jar.
|
27 |
-
*/
|
28 |
-
public function __construct(string $sessionKey, bool $storeSessionCookies = false)
|
29 |
-
{
|
30 |
-
parent::__construct();
|
31 |
-
$this->sessionKey = $sessionKey;
|
32 |
-
$this->storeSessionCookies = $storeSessionCookies;
|
33 |
-
$this->load();
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Saves cookies to session when shutting down
|
38 |
-
*/
|
39 |
-
public function __destruct()
|
40 |
-
{
|
41 |
-
$this->save();
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Save cookies to the client session
|
46 |
-
*/
|
47 |
-
public function save(): void
|
48 |
-
{
|
49 |
-
$json = [];
|
50 |
-
/** @var SetCookie $cookie */
|
51 |
-
foreach ($this as $cookie) {
|
52 |
-
if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
|
53 |
-
$json[] = $cookie->toArray();
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
$_SESSION[$this->sessionKey] = \json_encode($json);
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Load the contents of the client session into the data array
|
62 |
-
*/
|
63 |
-
protected function load(): void
|
64 |
-
{
|
65 |
-
if (!isset($_SESSION[$this->sessionKey])) {
|
66 |
-
return;
|
67 |
-
}
|
68 |
-
$data = \json_decode($_SESSION[$this->sessionKey], true);
|
69 |
-
if (\is_array($data)) {
|
70 |
-
foreach ($data as $cookie) {
|
71 |
-
$this->setCookie(new SetCookie($cookie));
|
72 |
-
}
|
73 |
-
} elseif (\strlen($data)) {
|
74 |
-
throw new \RuntimeException("Invalid cookie data");
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
DELETED
@@ -1,410 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Cookie;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Set-Cookie object
|
7 |
-
*/
|
8 |
-
class SetCookie
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* @var array
|
12 |
-
*/
|
13 |
-
private static $defaults = [
|
14 |
-
'Name' => null,
|
15 |
-
'Value' => null,
|
16 |
-
'Domain' => null,
|
17 |
-
'Path' => '/',
|
18 |
-
'Max-Age' => null,
|
19 |
-
'Expires' => null,
|
20 |
-
'Secure' => false,
|
21 |
-
'Discard' => false,
|
22 |
-
'HttpOnly' => false
|
23 |
-
];
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var array Cookie data
|
27 |
-
*/
|
28 |
-
private $data;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Create a new SetCookie object from a string.
|
32 |
-
*
|
33 |
-
* @param string $cookie Set-Cookie header string
|
34 |
-
*/
|
35 |
-
public static function fromString(string $cookie): self
|
36 |
-
{
|
37 |
-
// Create the default return array
|
38 |
-
$data = self::$defaults;
|
39 |
-
// Explode the cookie string using a series of semicolons
|
40 |
-
$pieces = \array_filter(\array_map('trim', \explode(';', $cookie)));
|
41 |
-
// The name of the cookie (first kvp) must exist and include an equal sign.
|
42 |
-
if (!isset($pieces[0]) || \strpos($pieces[0], '=') === false) {
|
43 |
-
return new self($data);
|
44 |
-
}
|
45 |
-
|
46 |
-
// Add the cookie pieces into the parsed data array
|
47 |
-
foreach ($pieces as $part) {
|
48 |
-
$cookieParts = \explode('=', $part, 2);
|
49 |
-
$key = \trim($cookieParts[0]);
|
50 |
-
$value = isset($cookieParts[1])
|
51 |
-
? \trim($cookieParts[1], " \n\r\t\0\x0B")
|
52 |
-
: true;
|
53 |
-
|
54 |
-
// Only check for non-cookies when cookies have been found
|
55 |
-
if (!isset($data['Name'])) {
|
56 |
-
$data['Name'] = $key;
|
57 |
-
$data['Value'] = $value;
|
58 |
-
} else {
|
59 |
-
foreach (\array_keys(self::$defaults) as $search) {
|
60 |
-
if (!\strcasecmp($search, $key)) {
|
61 |
-
$data[$search] = $value;
|
62 |
-
continue 2;
|
63 |
-
}
|
64 |
-
}
|
65 |
-
$data[$key] = $value;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
return new self($data);
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* @param array $data Array of cookie data provided by a Cookie parser
|
74 |
-
*/
|
75 |
-
public function __construct(array $data = [])
|
76 |
-
{
|
77 |
-
/** @var array|null $replaced will be null in case of replace error */
|
78 |
-
$replaced = \array_replace(self::$defaults, $data);
|
79 |
-
if ($replaced === null) {
|
80 |
-
throw new \InvalidArgumentException('Unable to replace the default values for the Cookie.');
|
81 |
-
}
|
82 |
-
|
83 |
-
$this->data = $replaced;
|
84 |
-
// Extract the Expires value and turn it into a UNIX timestamp if needed
|
85 |
-
if (!$this->getExpires() && $this->getMaxAge()) {
|
86 |
-
// Calculate the Expires date
|
87 |
-
$this->setExpires(\time() + $this->getMaxAge());
|
88 |
-
} elseif (null !== ($expires = $this->getExpires()) && !\is_numeric($expires)) {
|
89 |
-
$this->setExpires($expires);
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
public function __toString()
|
94 |
-
{
|
95 |
-
$str = $this->data['Name'] . '=' . $this->data['Value'] . '; ';
|
96 |
-
foreach ($this->data as $k => $v) {
|
97 |
-
if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) {
|
98 |
-
if ($k === 'Expires') {
|
99 |
-
$str .= 'Expires=' . \gmdate('D, d M Y H:i:s \G\M\T', $v) . '; ';
|
100 |
-
} else {
|
101 |
-
$str .= ($v === true ? $k : "{$k}={$v}") . '; ';
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
return \rtrim($str, '; ');
|
107 |
-
}
|
108 |
-
|
109 |
-
public function toArray(): array
|
110 |
-
{
|
111 |
-
return $this->data;
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Get the cookie name.
|
116 |
-
*
|
117 |
-
* @return string
|
118 |
-
*/
|
119 |
-
public function getName()
|
120 |
-
{
|
121 |
-
return $this->data['Name'];
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Set the cookie name.
|
126 |
-
*
|
127 |
-
* @param string $name Cookie name
|
128 |
-
*/
|
129 |
-
public function setName($name): void
|
130 |
-
{
|
131 |
-
$this->data['Name'] = $name;
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Get the cookie value.
|
136 |
-
*
|
137 |
-
* @return string|null
|
138 |
-
*/
|
139 |
-
public function getValue()
|
140 |
-
{
|
141 |
-
return $this->data['Value'];
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Set the cookie value.
|
146 |
-
*
|
147 |
-
* @param string $value Cookie value
|
148 |
-
*/
|
149 |
-
public function setValue($value): void
|
150 |
-
{
|
151 |
-
$this->data['Value'] = $value;
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Get the domain.
|
156 |
-
*
|
157 |
-
* @return string|null
|
158 |
-
*/
|
159 |
-
public function getDomain()
|
160 |
-
{
|
161 |
-
return $this->data['Domain'];
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Set the domain of the cookie.
|
166 |
-
*
|
167 |
-
* @param string $domain
|
168 |
-
*/
|
169 |
-
public function setDomain($domain): void
|
170 |
-
{
|
171 |
-
$this->data['Domain'] = $domain;
|
172 |
-
}
|
173 |
-
|
174 |
-
/**
|
175 |
-
* Get the path.
|
176 |
-
*
|
177 |
-
* @return string
|
178 |
-
*/
|
179 |
-
public function getPath()
|
180 |
-
{
|
181 |
-
return $this->data['Path'];
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Set the path of the cookie.
|
186 |
-
*
|
187 |
-
* @param string $path Path of the cookie
|
188 |
-
*/
|
189 |
-
public function setPath($path): void
|
190 |
-
{
|
191 |
-
$this->data['Path'] = $path;
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Maximum lifetime of the cookie in seconds.
|
196 |
-
*
|
197 |
-
* @return int|null
|
198 |
-
*/
|
199 |
-
public function getMaxAge()
|
200 |
-
{
|
201 |
-
return $this->data['Max-Age'];
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Set the max-age of the cookie.
|
206 |
-
*
|
207 |
-
* @param int $maxAge Max age of the cookie in seconds
|
208 |
-
*/
|
209 |
-
public function setMaxAge($maxAge): void
|
210 |
-
{
|
211 |
-
$this->data['Max-Age'] = $maxAge;
|
212 |
-
}
|
213 |
-
|
214 |
-
/**
|
215 |
-
* The UNIX timestamp when the cookie Expires.
|
216 |
-
*
|
217 |
-
* @return string|int|null
|
218 |
-
*/
|
219 |
-
public function getExpires()
|
220 |
-
{
|
221 |
-
return $this->data['Expires'];
|
222 |
-
}
|
223 |
-
|
224 |
-
/**
|
225 |
-
* Set the unix timestamp for which the cookie will expire.
|
226 |
-
*
|
227 |
-
* @param int|string $timestamp Unix timestamp or any English textual datetime description.
|
228 |
-
*/
|
229 |
-
public function setExpires($timestamp): void
|
230 |
-
{
|
231 |
-
$this->data['Expires'] = \is_numeric($timestamp)
|
232 |
-
? (int) $timestamp
|
233 |
-
: \strtotime($timestamp);
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Get whether or not this is a secure cookie.
|
238 |
-
*
|
239 |
-
* @return bool|null
|
240 |
-
*/
|
241 |
-
public function getSecure()
|
242 |
-
{
|
243 |
-
return $this->data['Secure'];
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* Set whether or not the cookie is secure.
|
248 |
-
*
|
249 |
-
* @param bool $secure Set to true or false if secure
|
250 |
-
*/
|
251 |
-
public function setSecure($secure): void
|
252 |
-
{
|
253 |
-
$this->data['Secure'] = $secure;
|
254 |
-
}
|
255 |
-
|
256 |
-
/**
|
257 |
-
* Get whether or not this is a session cookie.
|
258 |
-
*
|
259 |
-
* @return bool|null
|
260 |
-
*/
|
261 |
-
public function getDiscard()
|
262 |
-
{
|
263 |
-
return $this->data['Discard'];
|
264 |
-
}
|
265 |
-
|
266 |
-
/**
|
267 |
-
* Set whether or not this is a session cookie.
|
268 |
-
*
|
269 |
-
* @param bool $discard Set to true or false if this is a session cookie
|
270 |
-
*/
|
271 |
-
public function setDiscard($discard): void
|
272 |
-
{
|
273 |
-
$this->data['Discard'] = $discard;
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Get whether or not this is an HTTP only cookie.
|
278 |
-
*
|
279 |
-
* @return bool
|
280 |
-
*/
|
281 |
-
public function getHttpOnly()
|
282 |
-
{
|
283 |
-
return $this->data['HttpOnly'];
|
284 |
-
}
|
285 |
-
|
286 |
-
/**
|
287 |
-
* Set whether or not this is an HTTP only cookie.
|
288 |
-
*
|
289 |
-
* @param bool $httpOnly Set to true or false if this is HTTP only
|
290 |
-
*/
|
291 |
-
public function setHttpOnly($httpOnly): void
|
292 |
-
{
|
293 |
-
$this->data['HttpOnly'] = $httpOnly;
|
294 |
-
}
|
295 |
-
|
296 |
-
/**
|
297 |
-
* Check if the cookie matches a path value.
|
298 |
-
*
|
299 |
-
* A request-path path-matches a given cookie-path if at least one of
|
300 |
-
* the following conditions holds:
|
301 |
-
*
|
302 |
-
* - The cookie-path and the request-path are identical.
|
303 |
-
* - The cookie-path is a prefix of the request-path, and the last
|
304 |
-
* character of the cookie-path is %x2F ("/").
|
305 |
-
* - The cookie-path is a prefix of the request-path, and the first
|
306 |
-
* character of the request-path that is not included in the cookie-
|
307 |
-
* path is a %x2F ("/") character.
|
308 |
-
*
|
309 |
-
* @param string $requestPath Path to check against
|
310 |
-
*/
|
311 |
-
public function matchesPath(string $requestPath): bool
|
312 |
-
{
|
313 |
-
$cookiePath = $this->getPath();
|
314 |
-
|
315 |
-
// Match on exact matches or when path is the default empty "/"
|
316 |
-
if ($cookiePath === '/' || $cookiePath == $requestPath) {
|
317 |
-
return true;
|
318 |
-
}
|
319 |
-
|
320 |
-
// Ensure that the cookie-path is a prefix of the request path.
|
321 |
-
if (0 !== \strpos($requestPath, $cookiePath)) {
|
322 |
-
return false;
|
323 |
-
}
|
324 |
-
|
325 |
-
// Match if the last character of the cookie-path is "/"
|
326 |
-
if (\substr($cookiePath, -1, 1) === '/') {
|
327 |
-
return true;
|
328 |
-
}
|
329 |
-
|
330 |
-
// Match if the first character not included in cookie path is "/"
|
331 |
-
return \substr($requestPath, \strlen($cookiePath), 1) === '/';
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Check if the cookie matches a domain value.
|
336 |
-
*
|
337 |
-
* @param string $domain Domain to check against
|
338 |
-
*/
|
339 |
-
public function matchesDomain(string $domain): bool
|
340 |
-
{
|
341 |
-
$cookieDomain = $this->getDomain();
|
342 |
-
if (null === $cookieDomain) {
|
343 |
-
return true;
|
344 |
-
}
|
345 |
-
|
346 |
-
// Remove the leading '.' as per spec in RFC 6265.
|
347 |
-
// https://tools.ietf.org/html/rfc6265#section-5.2.3
|
348 |
-
$cookieDomain = \ltrim($cookieDomain, '.');
|
349 |
-
|
350 |
-
// Domain not set or exact match.
|
351 |
-
if (!$cookieDomain || !\strcasecmp($domain, $cookieDomain)) {
|
352 |
-
return true;
|
353 |
-
}
|
354 |
-
|
355 |
-
// Matching the subdomain according to RFC 6265.
|
356 |
-
// https://tools.ietf.org/html/rfc6265#section-5.1.3
|
357 |
-
if (\filter_var($domain, \FILTER_VALIDATE_IP)) {
|
358 |
-
return false;
|
359 |
-
}
|
360 |
-
|
361 |
-
return (bool) \preg_match('/\.' . \preg_quote($cookieDomain, '/') . '$/', $domain);
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Check if the cookie is expired.
|
366 |
-
*/
|
367 |
-
public function isExpired(): bool
|
368 |
-
{
|
369 |
-
return $this->getExpires() !== null && \time() > $this->getExpires();
|
370 |
-
}
|
371 |
-
|
372 |
-
/**
|
373 |
-
* Check if the cookie is valid according to RFC 6265.
|
374 |
-
*
|
375 |
-
* @return bool|string Returns true if valid or an error message if invalid
|
376 |
-
*/
|
377 |
-
public function validate()
|
378 |
-
{
|
379 |
-
$name = $this->getName();
|
380 |
-
if ($name === '') {
|
381 |
-
return 'The cookie name must not be empty';
|
382 |
-
}
|
383 |
-
|
384 |
-
// Check if any of the invalid characters are present in the cookie name
|
385 |
-
if (\preg_match(
|
386 |
-
'/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/',
|
387 |
-
$name
|
388 |
-
)) {
|
389 |
-
return 'Cookie name must not contain invalid characters: ASCII '
|
390 |
-
. 'Control characters (0-31;127), space, tab and the '
|
391 |
-
. 'following characters: ()<>@,;:\"/?={}';
|
392 |
-
}
|
393 |
-
|
394 |
-
// Value must not be null. 0 and empty string are valid. Empty strings
|
395 |
-
// are technically against RFC 6265, but known to happen in the wild.
|
396 |
-
$value = $this->getValue();
|
397 |
-
if ($value === null) {
|
398 |
-
return 'The cookie value must not be empty';
|
399 |
-
}
|
400 |
-
|
401 |
-
// Domains must not be empty, but can be 0. "0" is not a valid internet
|
402 |
-
// domain, but may be used as server name in a private network.
|
403 |
-
$domain = $this->getDomain();
|
404 |
-
if ($domain === null || $domain === '') {
|
405 |
-
return 'The cookie domain must not be empty';
|
406 |
-
}
|
407 |
-
|
408 |
-
return true;
|
409 |
-
}
|
410 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Exception;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
use Psr\Http\Message\ResponseInterface;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Exception when an HTTP error occurs (4xx or 5xx error)
|
10 |
-
*/
|
11 |
-
class BadResponseException extends RequestException
|
12 |
-
{
|
13 |
-
public function __construct(
|
14 |
-
string $message,
|
15 |
-
RequestInterface $request,
|
16 |
-
ResponseInterface $response,
|
17 |
-
\Throwable $previous = null,
|
18 |
-
array $handlerContext = []
|
19 |
-
) {
|
20 |
-
parent::__construct($message, $request, $response, $previous, $handlerContext);
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Current exception and the ones that extend it will always have a response.
|
25 |
-
*/
|
26 |
-
public function hasResponse(): bool
|
27 |
-
{
|
28 |
-
return true;
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* This function narrows the return type from the parent class and does not allow it to be nullable.
|
33 |
-
*/
|
34 |
-
public function getResponse(): ResponseInterface
|
35 |
-
{
|
36 |
-
/** @var ResponseInterface */
|
37 |
-
return parent::getResponse();
|
38 |
-
}
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Exception/ClientException.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Exception;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Exception when a client error is encountered (4xx codes)
|
7 |
-
*/
|
8 |
-
class ClientException extends BadResponseException
|
9 |
-
{
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Exception;
|
4 |
-
|
5 |
-
use Psr\Http\Client\NetworkExceptionInterface;
|
6 |
-
use Psr\Http\Message\RequestInterface;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Exception thrown when a connection cannot be established.
|
10 |
-
*
|
11 |
-
* Note that no response is present for a ConnectException
|
12 |
-
*/
|
13 |
-
class ConnectException extends TransferException implements NetworkExceptionInterface
|
14 |
-
{
|
15 |
-
/**
|
16 |
-
* @var RequestInterface
|
17 |
-
*/
|
18 |
-
private $request;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var array
|
22 |
-
*/
|
23 |
-
private $handlerContext;
|
24 |
-
|
25 |
-
public function __construct(
|
26 |
-
string $message,
|
27 |
-
RequestInterface $request,
|
28 |
-
\Throwable $previous = null,
|
29 |
-
array $handlerContext = []
|
30 |
-
) {
|
31 |
-
parent::__construct($message, 0, $previous);
|
32 |
-
$this->request = $request;
|
33 |
-
$this->handlerContext = $handlerContext;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Get the request that caused the exception
|
38 |
-
*/
|
39 |
-
public function getRequest(): RequestInterface
|
40 |
-
{
|
41 |
-
return $this->request;
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Get contextual information about the error from the underlying handler.
|
46 |
-
*
|
47 |
-
* The contents of this array will vary depending on which handler you are
|
48 |
-
* using. It may also be just an empty array. Relying on this data will
|
49 |
-
* couple you to a specific handler, but can give more debug information
|
50 |
-
* when needed.
|
51 |
-
*/
|
52 |
-
public function getHandlerContext(): array
|
53 |
-
{
|
54 |
-
return $this->handlerContext;
|
55 |
-
}
|
56 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Exception;
|
4 |
-
|
5 |
-
use Psr\Http\Client\ClientExceptionInterface;
|
6 |
-
|
7 |
-
interface GuzzleException extends ClientExceptionInterface
|
8 |
-
{
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Exception;
|
4 |
-
|
5 |
-
final class InvalidArgumentException extends \InvalidArgumentException implements GuzzleException
|
6 |
-
{
|
7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Exception/RequestException.php
DELETED
@@ -1,166 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Exception;
|
4 |
-
|
5 |
-
use GuzzleHttp\BodySummarizer;
|
6 |
-
use GuzzleHttp\BodySummarizerInterface;
|
7 |
-
use Psr\Http\Client\RequestExceptionInterface;
|
8 |
-
use Psr\Http\Message\RequestInterface;
|
9 |
-
use Psr\Http\Message\ResponseInterface;
|
10 |
-
use Psr\Http\Message\UriInterface;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* HTTP Request exception
|
14 |
-
*/
|
15 |
-
class RequestException extends TransferException implements RequestExceptionInterface
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* @var RequestInterface
|
19 |
-
*/
|
20 |
-
private $request;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var ResponseInterface|null
|
24 |
-
*/
|
25 |
-
private $response;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var array
|
29 |
-
*/
|
30 |
-
private $handlerContext;
|
31 |
-
|
32 |
-
public function __construct(
|
33 |
-
string $message,
|
34 |
-
RequestInterface $request,
|
35 |
-
ResponseInterface $response = null,
|
36 |
-
\Throwable $previous = null,
|
37 |
-
array $handlerContext = []
|
38 |
-
) {
|
39 |
-
// Set the code of the exception if the response is set and not future.
|
40 |
-
$code = $response ? $response->getStatusCode() : 0;
|
41 |
-
parent::__construct($message, $code, $previous);
|
42 |
-
$this->request = $request;
|
43 |
-
$this->response = $response;
|
44 |
-
$this->handlerContext = $handlerContext;
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Wrap non-RequestExceptions with a RequestException
|
49 |
-
*/
|
50 |
-
public static function wrapException(RequestInterface $request, \Throwable $e): RequestException
|
51 |
-
{
|
52 |
-
return $e instanceof RequestException ? $e : new RequestException($e->getMessage(), $request, null, $e);
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Factory method to create a new exception with a normalized error message
|
57 |
-
*
|
58 |
-
* @param RequestInterface $request Request sent
|
59 |
-
* @param ResponseInterface $response Response received
|
60 |
-
* @param \Throwable|null $previous Previous exception
|
61 |
-
* @param array $handlerContext Optional handler context
|
62 |
-
* @param BodySummarizerInterface|null $bodySummarizer Optional body summarizer
|
63 |
-
*/
|
64 |
-
public static function create(
|
65 |
-
RequestInterface $request,
|
66 |
-
ResponseInterface $response = null,
|
67 |
-
\Throwable $previous = null,
|
68 |
-
array $handlerContext = [],
|
69 |
-
BodySummarizerInterface $bodySummarizer = null
|
70 |
-
): self {
|
71 |
-
if (!$response) {
|
72 |
-
return new self(
|
73 |
-
'Error completing request',
|
74 |
-
$request,
|
75 |
-
null,
|
76 |
-
$previous,
|
77 |
-
$handlerContext
|
78 |
-
);
|
79 |
-
}
|
80 |
-
|
81 |
-
$level = (int) \floor($response->getStatusCode() / 100);
|
82 |
-
if ($level === 4) {
|
83 |
-
$label = 'Client error';
|
84 |
-
$className = ClientException::class;
|
85 |
-
} elseif ($level === 5) {
|
86 |
-
$label = 'Server error';
|
87 |
-
$className = ServerException::class;
|
88 |
-
} else {
|
89 |
-
$label = 'Unsuccessful request';
|
90 |
-
$className = __CLASS__;
|
91 |
-
}
|
92 |
-
|
93 |
-
$uri = $request->getUri();
|
94 |
-
$uri = static::obfuscateUri($uri);
|
95 |
-
|
96 |
-
// Client Error: `GET /` resulted in a `404 Not Found` response:
|
97 |
-
// <html> ... (truncated)
|
98 |
-
$message = \sprintf(
|
99 |
-
'%s: `%s %s` resulted in a `%s %s` response',
|
100 |
-
$label,
|
101 |
-
$request->getMethod(),
|
102 |
-
$uri,
|
103 |
-
$response->getStatusCode(),
|
104 |
-
$response->getReasonPhrase()
|
105 |
-
);
|
106 |
-
|
107 |
-
$summary = ($bodySummarizer ?? new BodySummarizer())->summarize($response);
|
108 |
-
|
109 |
-
if ($summary !== null) {
|
110 |
-
$message .= ":\n{$summary}\n";
|
111 |
-
}
|
112 |
-
|
113 |
-
return new $className($message, $request, $response, $previous, $handlerContext);
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Obfuscates URI if there is a username and a password present
|
118 |
-
*/
|
119 |
-
private static function obfuscateUri(UriInterface $uri): UriInterface
|
120 |
-
{
|
121 |
-
$userInfo = $uri->getUserInfo();
|
122 |
-
|
123 |
-
if (false !== ($pos = \strpos($userInfo, ':'))) {
|
124 |
-
return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***');
|
125 |
-
}
|
126 |
-
|
127 |
-
return $uri;
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Get the request that caused the exception
|
132 |
-
*/
|
133 |
-
public function getRequest(): RequestInterface
|
134 |
-
{
|
135 |
-
return $this->request;
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Get the associated response
|
140 |
-
*/
|
141 |
-
public function getResponse(): ?ResponseInterface
|
142 |
-
{
|
143 |
-
return $this->response;
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Check if a response was received
|
148 |
-
*/
|
149 |
-
public function hasResponse(): bool
|
150 |
-
{
|
151 |
-
return $this->response !== null;
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Get contextual information about the error from the underlying handler.
|
156 |
-
*
|
157 |
-
* The contents of this array will vary depending on which handler you are
|
158 |
-
* using. It may also be just an empty array. Relying on this data will
|
159 |
-
* couple you to a specific handler, but can give more debug information
|
160 |
-
* when needed.
|
161 |
-
*/
|
162 |
-
public function getHandlerContext(): array
|
163 |
-
{
|
164 |
-
return $this->handlerContext;
|
165 |
-
}
|
166 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Exception/ServerException.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Exception;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Exception when a server error is encountered (5xx codes)
|
7 |
-
*/
|
8 |
-
class ServerException extends BadResponseException
|
9 |
-
{
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Exception;
|
4 |
-
|
5 |
-
class TooManyRedirectsException extends RequestException
|
6 |
-
{
|
7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Exception/TransferException.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Exception;
|
4 |
-
|
5 |
-
class TransferException extends \RuntimeException implements GuzzleException
|
6 |
-
{
|
7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
DELETED
@@ -1,586 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Handler;
|
4 |
-
|
5 |
-
use GuzzleHttp\Exception\ConnectException;
|
6 |
-
use GuzzleHttp\Exception\RequestException;
|
7 |
-
use GuzzleHttp\Promise as P;
|
8 |
-
use GuzzleHttp\Promise\FulfilledPromise;
|
9 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
10 |
-
use GuzzleHttp\Psr7\LazyOpenStream;
|
11 |
-
use GuzzleHttp\TransferStats;
|
12 |
-
use GuzzleHttp\Utils;
|
13 |
-
use Psr\Http\Message\RequestInterface;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Creates curl resources from a request
|
17 |
-
*
|
18 |
-
* @final
|
19 |
-
*/
|
20 |
-
class CurlFactory implements CurlFactoryInterface
|
21 |
-
{
|
22 |
-
public const CURL_VERSION_STR = 'curl_version';
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @deprecated
|
26 |
-
*/
|
27 |
-
public const LOW_CURL_VERSION_NUMBER = '7.21.2';
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @var resource[]|\CurlHandle[]
|
31 |
-
*/
|
32 |
-
private $handles = [];
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @var int Total number of idle handles to keep in cache
|
36 |
-
*/
|
37 |
-
private $maxHandles;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* @param int $maxHandles Maximum number of idle handles.
|
41 |
-
*/
|
42 |
-
public function __construct(int $maxHandles)
|
43 |
-
{
|
44 |
-
$this->maxHandles = $maxHandles;
|
45 |
-
}
|
46 |
-
|
47 |
-
public function create(RequestInterface $request, array $options): EasyHandle
|
48 |
-
{
|
49 |
-
if (isset($options['curl']['body_as_string'])) {
|
50 |
-
$options['_body_as_string'] = $options['curl']['body_as_string'];
|
51 |
-
unset($options['curl']['body_as_string']);
|
52 |
-
}
|
53 |
-
|
54 |
-
$easy = new EasyHandle;
|
55 |
-
$easy->request = $request;
|
56 |
-
$easy->options = $options;
|
57 |
-
$conf = $this->getDefaultConf($easy);
|
58 |
-
$this->applyMethod($easy, $conf);
|
59 |
-
$this->applyHandlerOptions($easy, $conf);
|
60 |
-
$this->applyHeaders($easy, $conf);
|
61 |
-
unset($conf['_headers']);
|
62 |
-
|
63 |
-
// Add handler options from the request configuration options
|
64 |
-
if (isset($options['curl'])) {
|
65 |
-
$conf = \array_replace($conf, $options['curl']);
|
66 |
-
}
|
67 |
-
|
68 |
-
$conf[\CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy);
|
69 |
-
$easy->handle = $this->handles ? \array_pop($this->handles) : \curl_init();
|
70 |
-
curl_setopt_array($easy->handle, $conf);
|
71 |
-
|
72 |
-
return $easy;
|
73 |
-
}
|
74 |
-
|
75 |
-
public function release(EasyHandle $easy): void
|
76 |
-
{
|
77 |
-
$resource = $easy->handle;
|
78 |
-
unset($easy->handle);
|
79 |
-
|
80 |
-
if (\count($this->handles) >= $this->maxHandles) {
|
81 |
-
\curl_close($resource);
|
82 |
-
} else {
|
83 |
-
// Remove all callback functions as they can hold onto references
|
84 |
-
// and are not cleaned up by curl_reset. Using curl_setopt_array
|
85 |
-
// does not work for some reason, so removing each one
|
86 |
-
// individually.
|
87 |
-
\curl_setopt($resource, \CURLOPT_HEADERFUNCTION, null);
|
88 |
-
\curl_setopt($resource, \CURLOPT_READFUNCTION, null);
|
89 |
-
\curl_setopt($resource, \CURLOPT_WRITEFUNCTION, null);
|
90 |
-
\curl_setopt($resource, \CURLOPT_PROGRESSFUNCTION, null);
|
91 |
-
\curl_reset($resource);
|
92 |
-
$this->handles[] = $resource;
|
93 |
-
}
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Completes a cURL transaction, either returning a response promise or a
|
98 |
-
* rejected promise.
|
99 |
-
*
|
100 |
-
* @param callable(RequestInterface, array): PromiseInterface $handler
|
101 |
-
* @param CurlFactoryInterface $factory Dictates how the handle is released
|
102 |
-
*/
|
103 |
-
public static function finish(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory): PromiseInterface
|
104 |
-
{
|
105 |
-
if (isset($easy->options['on_stats'])) {
|
106 |
-
self::invokeStats($easy);
|
107 |
-
}
|
108 |
-
|
109 |
-
if (!$easy->response || $easy->errno) {
|
110 |
-
return self::finishError($handler, $easy, $factory);
|
111 |
-
}
|
112 |
-
|
113 |
-
// Return the response if it is present and there is no error.
|
114 |
-
$factory->release($easy);
|
115 |
-
|
116 |
-
// Rewind the body of the response if possible.
|
117 |
-
$body = $easy->response->getBody();
|
118 |
-
if ($body->isSeekable()) {
|
119 |
-
$body->rewind();
|
120 |
-
}
|
121 |
-
|
122 |
-
return new FulfilledPromise($easy->response);
|
123 |
-
}
|
124 |
-
|
125 |
-
private static function invokeStats(EasyHandle $easy): void
|
126 |
-
{
|
127 |
-
$curlStats = \curl_getinfo($easy->handle);
|
128 |
-
$curlStats['appconnect_time'] = \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME);
|
129 |
-
$stats = new TransferStats(
|
130 |
-
$easy->request,
|
131 |
-
$easy->response,
|
132 |
-
$curlStats['total_time'],
|
133 |
-
$easy->errno,
|
134 |
-
$curlStats
|
135 |
-
);
|
136 |
-
($easy->options['on_stats'])($stats);
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* @param callable(RequestInterface, array): PromiseInterface $handler
|
141 |
-
*/
|
142 |
-
private static function finishError(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory): PromiseInterface
|
143 |
-
{
|
144 |
-
// Get error information and release the handle to the factory.
|
145 |
-
$ctx = [
|
146 |
-
'errno' => $easy->errno,
|
147 |
-
'error' => \curl_error($easy->handle),
|
148 |
-
'appconnect_time' => \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME),
|
149 |
-
] + \curl_getinfo($easy->handle);
|
150 |
-
$ctx[self::CURL_VERSION_STR] = \curl_version()['version'];
|
151 |
-
$factory->release($easy);
|
152 |
-
|
153 |
-
// Retry when nothing is present or when curl failed to rewind.
|
154 |
-
if (empty($easy->options['_err_message']) && (!$easy->errno || $easy->errno == 65)) {
|
155 |
-
return self::retryFailedRewind($handler, $easy, $ctx);
|
156 |
-
}
|
157 |
-
|
158 |
-
return self::createRejection($easy, $ctx);
|
159 |
-
}
|
160 |
-
|
161 |
-
private static function createRejection(EasyHandle $easy, array $ctx): PromiseInterface
|
162 |
-
{
|
163 |
-
static $connectionErrors = [
|
164 |
-
\CURLE_OPERATION_TIMEOUTED => true,
|
165 |
-
\CURLE_COULDNT_RESOLVE_HOST => true,
|
166 |
-
\CURLE_COULDNT_CONNECT => true,
|
167 |
-
\CURLE_SSL_CONNECT_ERROR => true,
|
168 |
-
\CURLE_GOT_NOTHING => true,
|
169 |
-
];
|
170 |
-
|
171 |
-
if ($easy->createResponseException) {
|
172 |
-
return P\Create::rejectionFor(
|
173 |
-
new RequestException(
|
174 |
-
'An error was encountered while creating the response',
|
175 |
-
$easy->request,
|
176 |
-
$easy->response,
|
177 |
-
$easy->createResponseException,
|
178 |
-
$ctx
|
179 |
-
)
|
180 |
-
);
|
181 |
-
}
|
182 |
-
|
183 |
-
// If an exception was encountered during the onHeaders event, then
|
184 |
-
// return a rejected promise that wraps that exception.
|
185 |
-
if ($easy->onHeadersException) {
|
186 |
-
return P\Create::rejectionFor(
|
187 |
-
new RequestException(
|
188 |
-
'An error was encountered during the on_headers event',
|
189 |
-
$easy->request,
|
190 |
-
$easy->response,
|
191 |
-
$easy->onHeadersException,
|
192 |
-
$ctx
|
193 |
-
)
|
194 |
-
);
|
195 |
-
}
|
196 |
-
|
197 |
-
$message = \sprintf(
|
198 |
-
'cURL error %s: %s (%s)',
|
199 |
-
$ctx['errno'],
|
200 |
-
$ctx['error'],
|
201 |
-
'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'
|
202 |
-
);
|
203 |
-
$uriString = (string) $easy->request->getUri();
|
204 |
-
if ($uriString !== '' && false === \strpos($ctx['error'], $uriString)) {
|
205 |
-
$message .= \sprintf(' for %s', $uriString);
|
206 |
-
}
|
207 |
-
|
208 |
-
// Create a connection exception if it was a specific error code.
|
209 |
-
$error = isset($connectionErrors[$easy->errno])
|
210 |
-
? new ConnectException($message, $easy->request, null, $ctx)
|
211 |
-
: new RequestException($message, $easy->request, $easy->response, null, $ctx);
|
212 |
-
|
213 |
-
return P\Create::rejectionFor($error);
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* @return array<int|string, mixed>
|
218 |
-
*/
|
219 |
-
private function getDefaultConf(EasyHandle $easy): array
|
220 |
-
{
|
221 |
-
$conf = [
|
222 |
-
'_headers' => $easy->request->getHeaders(),
|
223 |
-
\CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(),
|
224 |
-
\CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''),
|
225 |
-
\CURLOPT_RETURNTRANSFER => false,
|
226 |
-
\CURLOPT_HEADER => false,
|
227 |
-
\CURLOPT_CONNECTTIMEOUT => 150,
|
228 |
-
];
|
229 |
-
|
230 |
-
if (\defined('CURLOPT_PROTOCOLS')) {
|
231 |
-
$conf[\CURLOPT_PROTOCOLS] = \CURLPROTO_HTTP | \CURLPROTO_HTTPS;
|
232 |
-
}
|
233 |
-
|
234 |
-
$version = $easy->request->getProtocolVersion();
|
235 |
-
if ($version == 1.1) {
|
236 |
-
$conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1;
|
237 |
-
} elseif ($version == 2.0) {
|
238 |
-
$conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0;
|
239 |
-
} else {
|
240 |
-
$conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0;
|
241 |
-
}
|
242 |
-
|
243 |
-
return $conf;
|
244 |
-
}
|
245 |
-
|
246 |
-
private function applyMethod(EasyHandle $easy, array &$conf): void
|
247 |
-
{
|
248 |
-
$body = $easy->request->getBody();
|
249 |
-
$size = $body->getSize();
|
250 |
-
|
251 |
-
if ($size === null || $size > 0) {
|
252 |
-
$this->applyBody($easy->request, $easy->options, $conf);
|
253 |
-
return;
|
254 |
-
}
|
255 |
-
|
256 |
-
$method = $easy->request->getMethod();
|
257 |
-
if ($method === 'PUT' || $method === 'POST') {
|
258 |
-
// See https://tools.ietf.org/html/rfc7230#section-3.3.2
|
259 |
-
if (!$easy->request->hasHeader('Content-Length')) {
|
260 |
-
$conf[\CURLOPT_HTTPHEADER][] = 'Content-Length: 0';
|
261 |
-
}
|
262 |
-
} elseif ($method === 'HEAD') {
|
263 |
-
$conf[\CURLOPT_NOBODY] = true;
|
264 |
-
unset(
|
265 |
-
$conf[\CURLOPT_WRITEFUNCTION],
|
266 |
-
$conf[\CURLOPT_READFUNCTION],
|
267 |
-
$conf[\CURLOPT_FILE],
|
268 |
-
$conf[\CURLOPT_INFILE]
|
269 |
-
);
|
270 |
-
}
|
271 |
-
}
|
272 |
-
|
273 |
-
private function applyBody(RequestInterface $request, array $options, array &$conf): void
|
274 |
-
{
|
275 |
-
$size = $request->hasHeader('Content-Length')
|
276 |
-
? (int) $request->getHeaderLine('Content-Length')
|
277 |
-
: null;
|
278 |
-
|
279 |
-
// Send the body as a string if the size is less than 1MB OR if the
|
280 |
-
// [curl][body_as_string] request value is set.
|
281 |
-
if (($size !== null && $size < 1000000) || !empty($options['_body_as_string'])) {
|
282 |
-
$conf[\CURLOPT_POSTFIELDS] = (string) $request->getBody();
|
283 |
-
// Don't duplicate the Content-Length header
|
284 |
-
$this->removeHeader('Content-Length', $conf);
|
285 |
-
$this->removeHeader('Transfer-Encoding', $conf);
|
286 |
-
} else {
|
287 |
-
$conf[\CURLOPT_UPLOAD] = true;
|
288 |
-
if ($size !== null) {
|
289 |
-
$conf[\CURLOPT_INFILESIZE] = $size;
|
290 |
-
$this->removeHeader('Content-Length', $conf);
|
291 |
-
}
|
292 |
-
$body = $request->getBody();
|
293 |
-
if ($body->isSeekable()) {
|
294 |
-
$body->rewind();
|
295 |
-
}
|
296 |
-
$conf[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body) {
|
297 |
-
return $body->read($length);
|
298 |
-
};
|
299 |
-
}
|
300 |
-
|
301 |
-
// If the Expect header is not present, prevent curl from adding it
|
302 |
-
if (!$request->hasHeader('Expect')) {
|
303 |
-
$conf[\CURLOPT_HTTPHEADER][] = 'Expect:';
|
304 |
-
}
|
305 |
-
|
306 |
-
// cURL sometimes adds a content-type by default. Prevent this.
|
307 |
-
if (!$request->hasHeader('Content-Type')) {
|
308 |
-
$conf[\CURLOPT_HTTPHEADER][] = 'Content-Type:';
|
309 |
-
}
|
310 |
-
}
|
311 |
-
|
312 |
-
private function applyHeaders(EasyHandle $easy, array &$conf): void
|
313 |
-
{
|
314 |
-
foreach ($conf['_headers'] as $name => $values) {
|
315 |
-
foreach ($values as $value) {
|
316 |
-
$value = (string) $value;
|
317 |
-
if ($value === '') {
|
318 |
-
// cURL requires a special format for empty headers.
|
319 |
-
// See https://github.com/guzzle/guzzle/issues/1882 for more details.
|
320 |
-
$conf[\CURLOPT_HTTPHEADER][] = "$name;";
|
321 |
-
} else {
|
322 |
-
$conf[\CURLOPT_HTTPHEADER][] = "$name: $value";
|
323 |
-
}
|
324 |
-
}
|
325 |
-
}
|
326 |
-
|
327 |
-
// Remove the Accept header if one was not set
|
328 |
-
if (!$easy->request->hasHeader('Accept')) {
|
329 |
-
$conf[\CURLOPT_HTTPHEADER][] = 'Accept:';
|
330 |
-
}
|
331 |
-
}
|
332 |
-
|
333 |
-
/**
|
334 |
-
* Remove a header from the options array.
|
335 |
-
*
|
336 |
-
* @param string $name Case-insensitive header to remove
|
337 |
-
* @param array $options Array of options to modify
|
338 |
-
*/
|
339 |
-
private function removeHeader(string $name, array &$options): void
|
340 |
-
{
|
341 |
-
foreach (\array_keys($options['_headers']) as $key) {
|
342 |
-
if (!\strcasecmp($key, $name)) {
|
343 |
-
unset($options['_headers'][$key]);
|
344 |
-
return;
|
345 |
-
}
|
346 |
-
}
|
347 |
-
}
|
348 |
-
|
349 |
-
private function applyHandlerOptions(EasyHandle $easy, array &$conf): void
|
350 |
-
{
|
351 |
-
$options = $easy->options;
|
352 |
-
if (isset($options['verify'])) {
|
353 |
-
if ($options['verify'] === false) {
|
354 |
-
unset($conf[\CURLOPT_CAINFO]);
|
355 |
-
$conf[\CURLOPT_SSL_VERIFYHOST] = 0;
|
356 |
-
$conf[\CURLOPT_SSL_VERIFYPEER] = false;
|
357 |
-
} else {
|
358 |
-
$conf[\CURLOPT_SSL_VERIFYHOST] = 2;
|
359 |
-
$conf[\CURLOPT_SSL_VERIFYPEER] = true;
|
360 |
-
if (\is_string($options['verify'])) {
|
361 |
-
// Throw an error if the file/folder/link path is not valid or doesn't exist.
|
362 |
-
if (!\file_exists($options['verify'])) {
|
363 |
-
throw new \InvalidArgumentException("SSL CA bundle not found: {$options['verify']}");
|
364 |
-
}
|
365 |
-
// If it's a directory or a link to a directory use CURLOPT_CAPATH.
|
366 |
-
// If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO.
|
367 |
-
if (
|
368 |
-
\is_dir($options['verify']) ||
|
369 |
-
(
|
370 |
-
\is_link($options['verify']) === true &&
|
371 |
-
($verifyLink = \readlink($options['verify'])) !== false &&
|
372 |
-
\is_dir($verifyLink)
|
373 |
-
)
|
374 |
-
) {
|
375 |
-
$conf[\CURLOPT_CAPATH] = $options['verify'];
|
376 |
-
} else {
|
377 |
-
$conf[\CURLOPT_CAINFO] = $options['verify'];
|
378 |
-
}
|
379 |
-
}
|
380 |
-
}
|
381 |
-
}
|
382 |
-
|
383 |
-
if (!isset($options['curl'][\CURLOPT_ENCODING]) && !empty($options['decode_content'])) {
|
384 |
-
$accept = $easy->request->getHeaderLine('Accept-Encoding');
|
385 |
-
if ($accept) {
|
386 |
-
$conf[\CURLOPT_ENCODING] = $accept;
|
387 |
-
} else {
|
388 |
-
$conf[\CURLOPT_ENCODING] = '';
|
389 |
-
// Don't let curl send the header over the wire
|
390 |
-
$conf[\CURLOPT_HTTPHEADER][] = 'Accept-Encoding:';
|
391 |
-
}
|
392 |
-
}
|
393 |
-
|
394 |
-
if (!isset($options['sink'])) {
|
395 |
-
// Use a default temp stream if no sink was set.
|
396 |
-
$options['sink'] = \fopen('php://temp', 'w+');
|
397 |
-
}
|
398 |
-
$sink = $options['sink'];
|
399 |
-
if (!\is_string($sink)) {
|
400 |
-
$sink = \GuzzleHttp\Psr7\stream_for($sink);
|
401 |
-
} elseif (!\is_dir(\dirname($sink))) {
|
402 |
-
// Ensure that the directory exists before failing in curl.
|
403 |
-
throw new \RuntimeException(\sprintf('Directory %s does not exist for sink value of %s', \dirname($sink), $sink));
|
404 |
-
} else {
|
405 |
-
$sink = new LazyOpenStream($sink, 'w+');
|
406 |
-
}
|
407 |
-
$easy->sink = $sink;
|
408 |
-
$conf[\CURLOPT_WRITEFUNCTION] = static function ($ch, $write) use ($sink): int {
|
409 |
-
return $sink->write($write);
|
410 |
-
};
|
411 |
-
|
412 |
-
$timeoutRequiresNoSignal = false;
|
413 |
-
if (isset($options['timeout'])) {
|
414 |
-
$timeoutRequiresNoSignal |= $options['timeout'] < 1;
|
415 |
-
$conf[\CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000;
|
416 |
-
}
|
417 |
-
|
418 |
-
// CURL default value is CURL_IPRESOLVE_WHATEVER
|
419 |
-
if (isset($options['force_ip_resolve'])) {
|
420 |
-
if ('v4' === $options['force_ip_resolve']) {
|
421 |
-
$conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4;
|
422 |
-
} elseif ('v6' === $options['force_ip_resolve']) {
|
423 |
-
$conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V6;
|
424 |
-
}
|
425 |
-
}
|
426 |
-
|
427 |
-
if (isset($options['connect_timeout'])) {
|
428 |
-
$timeoutRequiresNoSignal |= $options['connect_timeout'] < 1;
|
429 |
-
$conf[\CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000;
|
430 |
-
}
|
431 |
-
|
432 |
-
if ($timeoutRequiresNoSignal && \strtoupper(\substr(\PHP_OS, 0, 3)) !== 'WIN') {
|
433 |
-
$conf[\CURLOPT_NOSIGNAL] = true;
|
434 |
-
}
|
435 |
-
|
436 |
-
if (isset($options['proxy'])) {
|
437 |
-
if (!\is_array($options['proxy'])) {
|
438 |
-
$conf[\CURLOPT_PROXY] = $options['proxy'];
|
439 |
-
} else {
|
440 |
-
$scheme = $easy->request->getUri()->getScheme();
|
441 |
-
if (isset($options['proxy'][$scheme])) {
|
442 |
-
$host = $easy->request->getUri()->getHost();
|
443 |
-
if (!isset($options['proxy']['no']) || !Utils::isHostInNoProxy($host, $options['proxy']['no'])) {
|
444 |
-
$conf[\CURLOPT_PROXY] = $options['proxy'][$scheme];
|
445 |
-
}
|
446 |
-
}
|
447 |
-
}
|
448 |
-
}
|
449 |
-
|
450 |
-
if (isset($options['cert'])) {
|
451 |
-
$cert = $options['cert'];
|
452 |
-
if (\is_array($cert)) {
|
453 |
-
$conf[\CURLOPT_SSLCERTPASSWD] = $cert[1];
|
454 |
-
$cert = $cert[0];
|
455 |
-
}
|
456 |
-
if (!\file_exists($cert)) {
|
457 |
-
throw new \InvalidArgumentException("SSL certificate not found: {$cert}");
|
458 |
-
}
|
459 |
-
$conf[\CURLOPT_SSLCERT] = $cert;
|
460 |
-
}
|
461 |
-
|
462 |
-
if (isset($options['ssl_key'])) {
|
463 |
-
if (\is_array($options['ssl_key'])) {
|
464 |
-
if (\count($options['ssl_key']) === 2) {
|
465 |
-
[$sslKey, $conf[\CURLOPT_SSLKEYPASSWD]] = $options['ssl_key'];
|
466 |
-
} else {
|
467 |
-
[$sslKey] = $options['ssl_key'];
|
468 |
-
}
|
469 |
-
}
|
470 |
-
|
471 |
-
$sslKey = $sslKey ?? $options['ssl_key'];
|
472 |
-
|
473 |
-
if (!\file_exists($sslKey)) {
|
474 |
-
throw new \InvalidArgumentException("SSL private key not found: {$sslKey}");
|
475 |
-
}
|
476 |
-
$conf[\CURLOPT_SSLKEY] = $sslKey;
|
477 |
-
}
|
478 |
-
|
479 |
-
if (isset($options['progress'])) {
|
480 |
-
$progress = $options['progress'];
|
481 |
-
if (!\is_callable($progress)) {
|
482 |
-
throw new \InvalidArgumentException('progress client option must be callable');
|
483 |
-
}
|
484 |
-
$conf[\CURLOPT_NOPROGRESS] = false;
|
485 |
-
$conf[\CURLOPT_PROGRESSFUNCTION] = static function ($resource, int $downloadSize, int $downloaded, int $uploadSize, int $uploaded) use ($progress) {
|
486 |
-
$progress($downloadSize, $downloaded, $uploadSize, $uploaded);
|
487 |
-
};
|
488 |
-
}
|
489 |
-
|
490 |
-
if (!empty($options['debug'])) {
|
491 |
-
$conf[\CURLOPT_STDERR] = Utils::debugResource($options['debug']);
|
492 |
-
$conf[\CURLOPT_VERBOSE] = true;
|
493 |
-
}
|
494 |
-
}
|
495 |
-
|
496 |
-
/**
|
497 |
-
* This function ensures that a response was set on a transaction. If one
|
498 |
-
* was not set, then the request is retried if possible. This error
|
499 |
-
* typically means you are sending a payload, curl encountered a
|
500 |
-
* "Connection died, retrying a fresh connect" error, tried to rewind the
|
501 |
-
* stream, and then encountered a "necessary data rewind wasn't possible"
|
502 |
-
* error, causing the request to be sent through curl_multi_info_read()
|
503 |
-
* without an error status.
|
504 |
-
*
|
505 |
-
* @param callable(RequestInterface, array): PromiseInterface $handler
|
506 |
-
*/
|
507 |
-
private static function retryFailedRewind(callable $handler, EasyHandle $easy, array $ctx): PromiseInterface
|
508 |
-
{
|
509 |
-
try {
|
510 |
-
// Only rewind if the body has been read from.
|
511 |
-
$body = $easy->request->getBody();
|
512 |
-
if ($body->tell() > 0) {
|
513 |
-
$body->rewind();
|
514 |
-
}
|
515 |
-
} catch (\RuntimeException $e) {
|
516 |
-
$ctx['error'] = 'The connection unexpectedly failed without '
|
517 |
-
. 'providing an error. The request would have been retried, '
|
518 |
-
. 'but attempting to rewind the request body failed. '
|
519 |
-
. 'Exception: ' . $e;
|
520 |
-
return self::createRejection($easy, $ctx);
|
521 |
-
}
|
522 |
-
|
523 |
-
// Retry no more than 3 times before giving up.
|
524 |
-
if (!isset($easy->options['_curl_retries'])) {
|
525 |
-
$easy->options['_curl_retries'] = 1;
|
526 |
-
} elseif ($easy->options['_curl_retries'] == 2) {
|
527 |
-
$ctx['error'] = 'The cURL request was retried 3 times '
|
528 |
-
. 'and did not succeed. The most likely reason for the failure '
|
529 |
-
. 'is that cURL was unable to rewind the body of the request '
|
530 |
-
. 'and subsequent retries resulted in the same error. Turn on '
|
531 |
-
. 'the debug option to see what went wrong. See '
|
532 |
-
. 'https://bugs.php.net/bug.php?id=47204 for more information.';
|
533 |
-
return self::createRejection($easy, $ctx);
|
534 |
-
} else {
|
535 |
-
$easy->options['_curl_retries']++;
|
536 |
-
}
|
537 |
-
|
538 |
-
return $handler($easy->request, $easy->options);
|
539 |
-
}
|
540 |
-
|
541 |
-
private function createHeaderFn(EasyHandle $easy): callable
|
542 |
-
{
|
543 |
-
if (isset($easy->options['on_headers'])) {
|
544 |
-
$onHeaders = $easy->options['on_headers'];
|
545 |
-
|
546 |
-
if (!\is_callable($onHeaders)) {
|
547 |
-
throw new \InvalidArgumentException('on_headers must be callable');
|
548 |
-
}
|
549 |
-
} else {
|
550 |
-
$onHeaders = null;
|
551 |
-
}
|
552 |
-
|
553 |
-
return static function ($ch, $h) use (
|
554 |
-
$onHeaders,
|
555 |
-
$easy,
|
556 |
-
&$startingResponse
|
557 |
-
) {
|
558 |
-
$value = \trim($h);
|
559 |
-
if ($value === '') {
|
560 |
-
$startingResponse = true;
|
561 |
-
try {
|
562 |
-
$easy->createResponse();
|
563 |
-
} catch (\Exception $e) {
|
564 |
-
$easy->createResponseException = $e;
|
565 |
-
return -1;
|
566 |
-
}
|
567 |
-
if ($onHeaders !== null) {
|
568 |
-
try {
|
569 |
-
$onHeaders($easy->response);
|
570 |
-
} catch (\Exception $e) {
|
571 |
-
// Associate the exception with the handle and trigger
|
572 |
-
// a curl header write error by returning 0.
|
573 |
-
$easy->onHeadersException = $e;
|
574 |
-
return -1;
|
575 |
-
}
|
576 |
-
}
|
577 |
-
} elseif ($startingResponse) {
|
578 |
-
$startingResponse = false;
|
579 |
-
$easy->headers = [$value];
|
580 |
-
} else {
|
581 |
-
$easy->headers[] = $value;
|
582 |
-
}
|
583 |
-
return \strlen($h);
|
584 |
-
};
|
585 |
-
}
|
586 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Handler;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
|
7 |
-
interface CurlFactoryInterface
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
* Creates a cURL handle resource.
|
11 |
-
*
|
12 |
-
* @param RequestInterface $request Request
|
13 |
-
* @param array $options Transfer options
|
14 |
-
*
|
15 |
-
* @throws \RuntimeException when an option cannot be applied
|
16 |
-
*/
|
17 |
-
public function create(RequestInterface $request, array $options): EasyHandle;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Release an easy handle, allowing it to be reused or closed.
|
21 |
-
*
|
22 |
-
* This function must call unset on the easy handle's "handle" property.
|
23 |
-
*/
|
24 |
-
public function release(EasyHandle $easy): void;
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Handler;
|
4 |
-
|
5 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
6 |
-
use Psr\Http\Message\RequestInterface;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* HTTP handler that uses cURL easy handles as a transport layer.
|
10 |
-
*
|
11 |
-
* When using the CurlHandler, custom curl options can be specified as an
|
12 |
-
* associative array of curl option constants mapping to values in the
|
13 |
-
* **curl** key of the "client" key of the request.
|
14 |
-
*
|
15 |
-
* @final
|
16 |
-
*/
|
17 |
-
class CurlHandler
|
18 |
-
{
|
19 |
-
/**
|
20 |
-
* @var CurlFactoryInterface
|
21 |
-
*/
|
22 |
-
private $factory;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Accepts an associative array of options:
|
26 |
-
*
|
27 |
-
* - factory: Optional curl factory used to create cURL handles.
|
28 |
-
*
|
29 |
-
* @param array $options Array of options to use with the handler
|
30 |
-
*/
|
31 |
-
public function __construct(array $options = [])
|
32 |
-
{
|
33 |
-
$this->factory = $options['handle_factory']
|
34 |
-
?? new CurlFactory(3);
|
35 |
-
}
|
36 |
-
|
37 |
-
public function __invoke(RequestInterface $request, array $options): PromiseInterface
|
38 |
-
{
|
39 |
-
if (isset($options['delay'])) {
|
40 |
-
\usleep($options['delay'] * 1000);
|
41 |
-
}
|
42 |
-
|
43 |
-
$easy = $this->factory->create($request, $options);
|
44 |
-
\curl_exec($easy->handle);
|
45 |
-
$easy->errno = \curl_errno($easy->handle);
|
46 |
-
|
47 |
-
return CurlFactory::finish($this, $easy, $this->factory);
|
48 |
-
}
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
DELETED
@@ -1,253 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Handler;
|
4 |
-
|
5 |
-
use GuzzleHttp\Promise as P;
|
6 |
-
use GuzzleHttp\Promise\Promise;
|
7 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
8 |
-
use GuzzleHttp\Utils;
|
9 |
-
use Psr\Http\Message\RequestInterface;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Returns an asynchronous response using curl_multi_* functions.
|
13 |
-
*
|
14 |
-
* When using the CurlMultiHandler, custom curl options can be specified as an
|
15 |
-
* associative array of curl option constants mapping to values in the
|
16 |
-
* **curl** key of the provided request options.
|
17 |
-
*
|
18 |
-
* @property resource|\CurlMultiHandle $_mh Internal use only. Lazy loaded multi-handle.
|
19 |
-
*
|
20 |
-
* @final
|
21 |
-
*/
|
22 |
-
class CurlMultiHandler
|
23 |
-
{
|
24 |
-
/**
|
25 |
-
* @var CurlFactoryInterface
|
26 |
-
*/
|
27 |
-
private $factory;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @var int
|
31 |
-
*/
|
32 |
-
private $selectTimeout;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @var resource|\CurlMultiHandle|null the currently executing resource in `curl_multi_exec`.
|
36 |
-
*/
|
37 |
-
private $active;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* @var array Request entry handles, indexed by handle id in `addRequest`.
|
41 |
-
*
|
42 |
-
* @see CurlMultiHandler::addRequest
|
43 |
-
*/
|
44 |
-
private $handles = [];
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var array<int, float> An array of delay times, indexed by handle id in `addRequest`.
|
48 |
-
*
|
49 |
-
* @see CurlMultiHandler::addRequest
|
50 |
-
*/
|
51 |
-
private $delays = [];
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @var array<mixed> An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt()
|
55 |
-
*/
|
56 |
-
private $options = [];
|
57 |
-
|
58 |
-
/**
|
59 |
-
* This handler accepts the following options:
|
60 |
-
*
|
61 |
-
* - handle_factory: An optional factory used to create curl handles
|
62 |
-
* - select_timeout: Optional timeout (in seconds) to block before timing
|
63 |
-
* out while selecting curl handles. Defaults to 1 second.
|
64 |
-
* - options: An associative array of CURLMOPT_* options and
|
65 |
-
* corresponding values for curl_multi_setopt()
|
66 |
-
*/
|
67 |
-
public function __construct(array $options = [])
|
68 |
-
{
|
69 |
-
$this->factory = $options['handle_factory'] ?? new CurlFactory(50);
|
70 |
-
|
71 |
-
if (isset($options['select_timeout'])) {
|
72 |
-
$this->selectTimeout = $options['select_timeout'];
|
73 |
-
} elseif ($selectTimeout = Utils::getenv('GUZZLE_CURL_SELECT_TIMEOUT')) {
|
74 |
-
@trigger_error('Since guzzlehttp/guzzle 7.2.0: Using environment variable GUZZLE_CURL_SELECT_TIMEOUT is deprecated. Use option "select_timeout" instead.', \E_USER_DEPRECATED);
|
75 |
-
$this->selectTimeout = (int) $selectTimeout;
|
76 |
-
} else {
|
77 |
-
$this->selectTimeout = 1;
|
78 |
-
}
|
79 |
-
|
80 |
-
$this->options = $options['options'] ?? [];
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* @param string $name
|
85 |
-
*
|
86 |
-
* @return resource|\CurlMultiHandle
|
87 |
-
*
|
88 |
-
* @throws \BadMethodCallException when another field as `_mh` will be gotten
|
89 |
-
* @throws \RuntimeException when curl can not initialize a multi handle
|
90 |
-
*/
|
91 |
-
public function __get($name)
|
92 |
-
{
|
93 |
-
if ($name !== '_mh') {
|
94 |
-
throw new \BadMethodCallException("Can not get other property as '_mh'.");
|
95 |
-
}
|
96 |
-
|
97 |
-
$multiHandle = \curl_multi_init();
|
98 |
-
|
99 |
-
if (false === $multiHandle) {
|
100 |
-
throw new \RuntimeException('Can not initialize curl multi handle.');
|
101 |
-
}
|
102 |
-
|
103 |
-
$this->_mh = $multiHandle;
|
104 |
-
|
105 |
-
foreach ($this->options as $option => $value) {
|
106 |
-
// A warning is raised in case of a wrong option.
|
107 |
-
curl_multi_setopt($this->_mh, $option, $value);
|
108 |
-
}
|
109 |
-
|
110 |
-
return $this->_mh;
|
111 |
-
}
|
112 |
-
|
113 |
-
public function __destruct()
|
114 |
-
{
|
115 |
-
if (isset($this->_mh)) {
|
116 |
-
\curl_multi_close($this->_mh);
|
117 |
-
unset($this->_mh);
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
public function __invoke(RequestInterface $request, array $options): PromiseInterface
|
122 |
-
{
|
123 |
-
$easy = $this->factory->create($request, $options);
|
124 |
-
$id = (int) $easy->handle;
|
125 |
-
|
126 |
-
$promise = new Promise(
|
127 |
-
[$this, 'execute'],
|
128 |
-
function () use ($id) {
|
129 |
-
return $this->cancel($id);
|
130 |
-
}
|
131 |
-
);
|
132 |
-
|
133 |
-
$this->addRequest(['easy' => $easy, 'deferred' => $promise]);
|
134 |
-
|
135 |
-
return $promise;
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Ticks the curl event loop.
|
140 |
-
*/
|
141 |
-
public function tick(): void
|
142 |
-
{
|
143 |
-
// Add any delayed handles if needed.
|
144 |
-
if ($this->delays) {
|
145 |
-
$currentTime = Utils::currentTime();
|
146 |
-
foreach ($this->delays as $id => $delay) {
|
147 |
-
if ($currentTime >= $delay) {
|
148 |
-
unset($this->delays[$id]);
|
149 |
-
\curl_multi_add_handle(
|
150 |
-
$this->_mh,
|
151 |
-
$this->handles[$id]['easy']->handle
|
152 |
-
);
|
153 |
-
}
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
// Step through the task queue which may add additional requests.
|
158 |
-
P\Utils::queue()->run();
|
159 |
-
|
160 |
-
if ($this->active && \curl_multi_select($this->_mh, $this->selectTimeout) === -1) {
|
161 |
-
// Perform a usleep if a select returns -1.
|
162 |
-
// See: https://bugs.php.net/bug.php?id=61141
|
163 |
-
\usleep(250);
|
164 |
-
}
|
165 |
-
|
166 |
-
while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM);
|
167 |
-
|
168 |
-
$this->processMessages();
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Runs until all outstanding connections have completed.
|
173 |
-
*/
|
174 |
-
public function execute(): void
|
175 |
-
{
|
176 |
-
$queue = P\Utils::queue();
|
177 |
-
|
178 |
-
while ($this->handles || !$queue->isEmpty()) {
|
179 |
-
// If there are no transfers, then sleep for the next delay
|
180 |
-
if (!$this->active && $this->delays) {
|
181 |
-
\usleep($this->timeToNext());
|
182 |
-
}
|
183 |
-
$this->tick();
|
184 |
-
}
|
185 |
-
}
|
186 |
-
|
187 |
-
private function addRequest(array $entry): void
|
188 |
-
{
|
189 |
-
$easy = $entry['easy'];
|
190 |
-
$id = (int) $easy->handle;
|
191 |
-
$this->handles[$id] = $entry;
|
192 |
-
if (empty($easy->options['delay'])) {
|
193 |
-
\curl_multi_add_handle($this->_mh, $easy->handle);
|
194 |
-
} else {
|
195 |
-
$this->delays[$id] = Utils::currentTime() + ($easy->options['delay'] / 1000);
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Cancels a handle from sending and removes references to it.
|
201 |
-
*
|
202 |
-
* @param int $id Handle ID to cancel and remove.
|
203 |
-
*
|
204 |
-
* @return bool True on success, false on failure.
|
205 |
-
*/
|
206 |
-
private function cancel($id): bool
|
207 |
-
{
|
208 |
-
// Cannot cancel if it has been processed.
|
209 |
-
if (!isset($this->handles[$id])) {
|
210 |
-
return false;
|
211 |
-
}
|
212 |
-
|
213 |
-
$handle = $this->handles[$id]['easy']->handle;
|
214 |
-
unset($this->delays[$id], $this->handles[$id]);
|
215 |
-
\curl_multi_remove_handle($this->_mh, $handle);
|
216 |
-
\curl_close($handle);
|
217 |
-
|
218 |
-
return true;
|
219 |
-
}
|
220 |
-
|
221 |
-
private function processMessages(): void
|
222 |
-
{
|
223 |
-
while ($done = \curl_multi_info_read($this->_mh)) {
|
224 |
-
$id = (int) $done['handle'];
|
225 |
-
\curl_multi_remove_handle($this->_mh, $done['handle']);
|
226 |
-
|
227 |
-
if (!isset($this->handles[$id])) {
|
228 |
-
// Probably was cancelled.
|
229 |
-
continue;
|
230 |
-
}
|
231 |
-
|
232 |
-
$entry = $this->handles[$id];
|
233 |
-
unset($this->handles[$id], $this->delays[$id]);
|
234 |
-
$entry['easy']->errno = $done['result'];
|
235 |
-
$entry['deferred']->resolve(
|
236 |
-
CurlFactory::finish($this, $entry['easy'], $this->factory)
|
237 |
-
);
|
238 |
-
}
|
239 |
-
}
|
240 |
-
|
241 |
-
private function timeToNext(): int
|
242 |
-
{
|
243 |
-
$currentTime = Utils::currentTime();
|
244 |
-
$nextTime = \PHP_INT_MAX;
|
245 |
-
foreach ($this->delays as $time) {
|
246 |
-
if ($time < $nextTime) {
|
247 |
-
$nextTime = $time;
|
248 |
-
}
|
249 |
-
}
|
250 |
-
|
251 |
-
return ((int) \max(0, $nextTime - $currentTime)) * 1000000;
|
252 |
-
}
|
253 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php
DELETED
@@ -1,118 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Handler;
|
4 |
-
|
5 |
-
use GuzzleHttp\Psr7\Response;
|
6 |
-
use GuzzleHttp\Utils;
|
7 |
-
use Psr\Http\Message\RequestInterface;
|
8 |
-
use Psr\Http\Message\ResponseInterface;
|
9 |
-
use Psr\Http\Message\StreamInterface;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Represents a cURL easy handle and the data it populates.
|
13 |
-
*
|
14 |
-
* @internal
|
15 |
-
*/
|
16 |
-
final class EasyHandle
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @var resource|\CurlHandle cURL resource
|
20 |
-
*/
|
21 |
-
public $handle;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @var StreamInterface Where data is being written
|
25 |
-
*/
|
26 |
-
public $sink;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @var array Received HTTP headers so far
|
30 |
-
*/
|
31 |
-
public $headers = [];
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @var ResponseInterface|null Received response (if any)
|
35 |
-
*/
|
36 |
-
public $response;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @var RequestInterface Request being sent
|
40 |
-
*/
|
41 |
-
public $request;
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @var array Request options
|
45 |
-
*/
|
46 |
-
public $options = [];
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @var int cURL error number (if any)
|
50 |
-
*/
|
51 |
-
public $errno = 0;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @var \Throwable|null Exception during on_headers (if any)
|
55 |
-
*/
|
56 |
-
public $onHeadersException;
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @var \Exception|null Exception during createResponse (if any)
|
60 |
-
*/
|
61 |
-
public $createResponseException;
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Attach a response to the easy handle based on the received headers.
|
65 |
-
*
|
66 |
-
* @throws \RuntimeException if no headers have been received.
|
67 |
-
*/
|
68 |
-
public function createResponse(): void
|
69 |
-
{
|
70 |
-
if (empty($this->headers)) {
|
71 |
-
throw new \RuntimeException('No headers have been received');
|
72 |
-
}
|
73 |
-
|
74 |
-
// HTTP-version SP status-code SP reason-phrase
|
75 |
-
$startLine = \explode(' ', \array_shift($this->headers), 3);
|
76 |
-
$headers = Utils::headersFromLines($this->headers);
|
77 |
-
$normalizedKeys = Utils::normalizeHeaderKeys($headers);
|
78 |
-
|
79 |
-
if (!empty($this->options['decode_content']) && isset($normalizedKeys['content-encoding'])) {
|
80 |
-
$headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']];
|
81 |
-
unset($headers[$normalizedKeys['content-encoding']]);
|
82 |
-
if (isset($normalizedKeys['content-length'])) {
|
83 |
-
$headers['x-encoded-content-length'] = $headers[$normalizedKeys['content-length']];
|
84 |
-
|
85 |
-
$bodyLength = (int) $this->sink->getSize();
|
86 |
-
if ($bodyLength) {
|
87 |
-
$headers[$normalizedKeys['content-length']] = $bodyLength;
|
88 |
-
} else {
|
89 |
-
unset($headers[$normalizedKeys['content-length']]);
|
90 |
-
}
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
$statusCode = (int) $startLine[1];
|
95 |
-
|
96 |
-
// Attach a response to the easy handle with the parsed headers.
|
97 |
-
$this->response = new Response(
|
98 |
-
$statusCode,
|
99 |
-
$headers,
|
100 |
-
$this->sink,
|
101 |
-
\substr($startLine[0], 5),
|
102 |
-
isset($startLine[2]) ? (string) $startLine[2] : null
|
103 |
-
);
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* @param string $name
|
108 |
-
*
|
109 |
-
* @return void
|
110 |
-
*
|
111 |
-
* @throws \BadMethodCallException
|
112 |
-
*/
|
113 |
-
public function __get($name)
|
114 |
-
{
|
115 |
-
$msg = $name === 'handle' ? 'The EasyHandle has been released' : 'Invalid property: ' . $name;
|
116 |
-
throw new \BadMethodCallException($msg);
|
117 |
-
}
|
118 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
DELETED
@@ -1,211 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Handler;
|
4 |
-
|
5 |
-
use GuzzleHttp\Exception\RequestException;
|
6 |
-
use GuzzleHttp\HandlerStack;
|
7 |
-
use GuzzleHttp\Promise as P;
|
8 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
9 |
-
use GuzzleHttp\TransferStats;
|
10 |
-
use GuzzleHttp\Utils;
|
11 |
-
use Psr\Http\Message\RequestInterface;
|
12 |
-
use Psr\Http\Message\ResponseInterface;
|
13 |
-
use Psr\Http\Message\StreamInterface;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Handler that returns responses or throw exceptions from a queue.
|
17 |
-
*
|
18 |
-
* @final
|
19 |
-
*/
|
20 |
-
class MockHandler implements \Countable
|
21 |
-
{
|
22 |
-
/**
|
23 |
-
* @var array
|
24 |
-
*/
|
25 |
-
private $queue = [];
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var RequestInterface|null
|
29 |
-
*/
|
30 |
-
private $lastRequest;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @var array
|
34 |
-
*/
|
35 |
-
private $lastOptions = [];
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @var callable|null
|
39 |
-
*/
|
40 |
-
private $onFulfilled;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @var callable|null
|
44 |
-
*/
|
45 |
-
private $onRejected;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Creates a new MockHandler that uses the default handler stack list of
|
49 |
-
* middlewares.
|
50 |
-
*
|
51 |
-
* @param array|null $queue Array of responses, callables, or exceptions.
|
52 |
-
* @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
|
53 |
-
* @param callable|null $onRejected Callback to invoke when the return value is rejected.
|
54 |
-
*/
|
55 |
-
public static function createWithMiddleware(array $queue = null, callable $onFulfilled = null, callable $onRejected = null): HandlerStack
|
56 |
-
{
|
57 |
-
return HandlerStack::create(new self($queue, $onFulfilled, $onRejected));
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* The passed in value must be an array of
|
62 |
-
* {@see \Psr\Http\Message\ResponseInterface} objects, Exceptions,
|
63 |
-
* callables, or Promises.
|
64 |
-
*
|
65 |
-
* @param array<int, mixed>|null $queue The parameters to be passed to the append function, as an indexed array.
|
66 |
-
* @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
|
67 |
-
* @param callable|null $onRejected Callback to invoke when the return value is rejected.
|
68 |
-
*/
|
69 |
-
public function __construct(array $queue = null, callable $onFulfilled = null, callable $onRejected = null)
|
70 |
-
{
|
71 |
-
$this->onFulfilled = $onFulfilled;
|
72 |
-
$this->onRejected = $onRejected;
|
73 |
-
|
74 |
-
if ($queue) {
|
75 |
-
// array_values included for BC
|
76 |
-
$this->append(...array_values($queue));
|
77 |
-
}
|
78 |
-
}
|
79 |
-
|
80 |
-
public function __invoke(RequestInterface $request, array $options): PromiseInterface
|
81 |
-
{
|
82 |
-
if (!$this->queue) {
|
83 |
-
throw new \OutOfBoundsException('Mock queue is empty');
|
84 |
-
}
|
85 |
-
|
86 |
-
if (isset($options['delay']) && \is_numeric($options['delay'])) {
|
87 |
-
\usleep((int) $options['delay'] * 1000);
|
88 |
-
}
|
89 |
-
|
90 |
-
$this->lastRequest = $request;
|
91 |
-
$this->lastOptions = $options;
|
92 |
-
$response = \array_shift($this->queue);
|
93 |
-
|
94 |
-
if (isset($options['on_headers'])) {
|
95 |
-
if (!\is_callable($options['on_headers'])) {
|
96 |
-
throw new \InvalidArgumentException('on_headers must be callable');
|
97 |
-
}
|
98 |
-
try {
|
99 |
-
$options['on_headers']($response);
|
100 |
-
} catch (\Exception $e) {
|
101 |
-
$msg = 'An error was encountered during the on_headers event';
|
102 |
-
$response = new RequestException($msg, $request, $response, $e);
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
if (\is_callable($response)) {
|
107 |
-
$response = $response($request, $options);
|
108 |
-
}
|
109 |
-
|
110 |
-
$response = $response instanceof \Throwable
|
111 |
-
? P\Create::rejectionFor($response)
|
112 |
-
: P\Create::promiseFor($response);
|
113 |
-
|
114 |
-
return $response->then(
|
115 |
-
function (?ResponseInterface $value) use ($request, $options) {
|
116 |
-
$this->invokeStats($request, $options, $value);
|
117 |
-
if ($this->onFulfilled) {
|
118 |
-
($this->onFulfilled)($value);
|
119 |
-
}
|
120 |
-
|
121 |
-
if ($value !== null && isset($options['sink'])) {
|
122 |
-
$contents = (string) $value->getBody();
|
123 |
-
$sink = $options['sink'];
|
124 |
-
|
125 |
-
if (\is_resource($sink)) {
|
126 |
-
\fwrite($sink, $contents);
|
127 |
-
} elseif (\is_string($sink)) {
|
128 |
-
\file_put_contents($sink, $contents);
|
129 |
-
} elseif ($sink instanceof StreamInterface) {
|
130 |
-
$sink->write($contents);
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
return $value;
|
135 |
-
},
|
136 |
-
function ($reason) use ($request, $options) {
|
137 |
-
$this->invokeStats($request, $options, null, $reason);
|
138 |
-
if ($this->onRejected) {
|
139 |
-
($this->onRejected)($reason);
|
140 |
-
}
|
141 |
-
return P\Create::rejectionFor($reason);
|
142 |
-
}
|
143 |
-
);
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Adds one or more variadic requests, exceptions, callables, or promises
|
148 |
-
* to the queue.
|
149 |
-
*
|
150 |
-
* @param mixed ...$values
|
151 |
-
*/
|
152 |
-
public function append(...$values): void
|
153 |
-
{
|
154 |
-
foreach ($values as $value) {
|
155 |
-
if ($value instanceof ResponseInterface
|
156 |
-
|| $value instanceof \Throwable
|
157 |
-
|| $value instanceof PromiseInterface
|
158 |
-
|| \is_callable($value)
|
159 |
-
) {
|
160 |
-
$this->queue[] = $value;
|
161 |
-
} else {
|
162 |
-
throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found ' . Utils::describeType($value));
|
163 |
-
}
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Get the last received request.
|
169 |
-
*/
|
170 |
-
public function getLastRequest(): ?RequestInterface
|
171 |
-
{
|
172 |
-
return $this->lastRequest;
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Get the last received request options.
|
177 |
-
*/
|
178 |
-
public function getLastOptions(): array
|
179 |
-
{
|
180 |
-
return $this->lastOptions;
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* Returns the number of remaining items in the queue.
|
185 |
-
*/
|
186 |
-
public function count(): int
|
187 |
-
{
|
188 |
-
return \count($this->queue);
|
189 |
-
}
|
190 |
-
|
191 |
-
public function reset(): void
|
192 |
-
{
|
193 |
-
$this->queue = [];
|
194 |
-
}
|
195 |
-
|
196 |
-
/**
|
197 |
-
* @param mixed $reason Promise or reason.
|
198 |
-
*/
|
199 |
-
private function invokeStats(
|
200 |
-
RequestInterface $request,
|
201 |
-
array $options,
|
202 |
-
ResponseInterface $response = null,
|
203 |
-
$reason = null
|
204 |
-
): void {
|
205 |
-
if (isset($options['on_stats'])) {
|
206 |
-
$transferTime = $options['transfer_time'] ?? 0;
|
207 |
-
$stats = new TransferStats($request, $response, $transferTime, $reason);
|
208 |
-
($options['on_stats'])($stats);
|
209 |
-
}
|
210 |
-
}
|
211 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Handler/Proxy.php
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Handler;
|
4 |
-
|
5 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
6 |
-
use GuzzleHttp\RequestOptions;
|
7 |
-
use Psr\Http\Message\RequestInterface;
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Provides basic proxies for handlers.
|
11 |
-
*
|
12 |
-
* @final
|
13 |
-
*/
|
14 |
-
class Proxy
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* Sends synchronous requests to a specific handler while sending all other
|
18 |
-
* requests to another handler.
|
19 |
-
*
|
20 |
-
* @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for normal responses
|
21 |
-
* @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $sync Handler used for synchronous responses.
|
22 |
-
*
|
23 |
-
* @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
|
24 |
-
*/
|
25 |
-
public static function wrapSync(callable $default, callable $sync): callable
|
26 |
-
{
|
27 |
-
return static function (RequestInterface $request, array $options) use ($default, $sync): PromiseInterface {
|
28 |
-
return empty($options[RequestOptions::SYNCHRONOUS]) ? $default($request, $options) : $sync($request, $options);
|
29 |
-
};
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Sends streaming requests to a streaming compatible handler while sending
|
34 |
-
* all other requests to a default handler.
|
35 |
-
*
|
36 |
-
* This, for example, could be useful for taking advantage of the
|
37 |
-
* performance benefits of curl while still supporting true streaming
|
38 |
-
* through the StreamHandler.
|
39 |
-
*
|
40 |
-
* @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for non-streaming responses
|
41 |
-
* @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $streaming Handler used for streaming responses
|
42 |
-
*
|
43 |
-
* @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
|
44 |
-
*/
|
45 |
-
public static function wrapStreaming(callable $default, callable $streaming): callable
|
46 |
-
{
|
47 |
-
return static function (RequestInterface $request, array $options) use ($default, $streaming): PromiseInterface {
|
48 |
-
return empty($options['stream']) ? $default($request, $options) : $streaming($request, $options);
|
49 |
-
};
|
50 |
-
}
|
51 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
DELETED
@@ -1,527 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Handler;
|
4 |
-
|
5 |
-
use GuzzleHttp\Exception\ConnectException;
|
6 |
-
use GuzzleHttp\Exception\RequestException;
|
7 |
-
use GuzzleHttp\Promise as P;
|
8 |
-
use GuzzleHttp\Promise\FulfilledPromise;
|
9 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
10 |
-
use GuzzleHttp\Psr7;
|
11 |
-
use GuzzleHttp\TransferStats;
|
12 |
-
use GuzzleHttp\Utils;
|
13 |
-
use Psr\Http\Message\RequestInterface;
|
14 |
-
use Psr\Http\Message\ResponseInterface;
|
15 |
-
use Psr\Http\Message\StreamInterface;
|
16 |
-
use Psr\Http\Message\UriInterface;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* HTTP handler that uses PHP's HTTP stream wrapper.
|
20 |
-
*
|
21 |
-
* @final
|
22 |
-
*/
|
23 |
-
class StreamHandler
|
24 |
-
{
|
25 |
-
/**
|
26 |
-
* @var array
|
27 |
-
*/
|
28 |
-
private $lastHeaders = [];
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Sends an HTTP request.
|
32 |
-
*
|
33 |
-
* @param RequestInterface $request Request to send.
|
34 |
-
* @param array $options Request transfer options.
|
35 |
-
*/
|
36 |
-
public function __invoke(RequestInterface $request, array $options): PromiseInterface
|
37 |
-
{
|
38 |
-
// Sleep if there is a delay specified.
|
39 |
-
if (isset($options['delay'])) {
|
40 |
-
\usleep($options['delay'] * 1000);
|
41 |
-
}
|
42 |
-
|
43 |
-
$startTime = isset($options['on_stats']) ? Utils::currentTime() : null;
|
44 |
-
|
45 |
-
try {
|
46 |
-
// Does not support the expect header.
|
47 |
-
$request = $request->withoutHeader('Expect');
|
48 |
-
|
49 |
-
// Append a content-length header if body size is zero to match
|
50 |
-
// cURL's behavior.
|
51 |
-
if (0 === $request->getBody()->getSize()) {
|
52 |
-
$request = $request->withHeader('Content-Length', '0');
|
53 |
-
}
|
54 |
-
|
55 |
-
return $this->createResponse(
|
56 |
-
$request,
|
57 |
-
$options,
|
58 |
-
$this->createStream($request, $options),
|
59 |
-
$startTime
|
60 |
-
);
|
61 |
-
} catch (\InvalidArgumentException $e) {
|
62 |
-
throw $e;
|
63 |
-
} catch (\Exception $e) {
|
64 |
-
// Determine if the error was a networking error.
|
65 |
-
$message = $e->getMessage();
|
66 |
-
// This list can probably get more comprehensive.
|
67 |
-
if (false !== \strpos($message, 'getaddrinfo') // DNS lookup failed
|
68 |
-
|| false !== \strpos($message, 'Connection refused')
|
69 |
-
|| false !== \strpos($message, "couldn't connect to host") // error on HHVM
|
70 |
-
|| false !== \strpos($message, "connection attempt failed")
|
71 |
-
) {
|
72 |
-
$e = new ConnectException($e->getMessage(), $request, $e);
|
73 |
-
} else {
|
74 |
-
$e = RequestException::wrapException($request, $e);
|
75 |
-
}
|
76 |
-
$this->invokeStats($options, $request, $startTime, null, $e);
|
77 |
-
|
78 |
-
return P\Create::rejectionFor($e);
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
private function invokeStats(
|
83 |
-
array $options,
|
84 |
-
RequestInterface $request,
|
85 |
-
?float $startTime,
|
86 |
-
ResponseInterface $response = null,
|
87 |
-
\Throwable $error = null
|
88 |
-
): void {
|
89 |
-
if (isset($options['on_stats'])) {
|
90 |
-
$stats = new TransferStats($request, $response, Utils::currentTime() - $startTime, $error, []);
|
91 |
-
($options['on_stats'])($stats);
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* @param resource $stream
|
97 |
-
*/
|
98 |
-
private function createResponse(RequestInterface $request, array $options, $stream, ?float $startTime): PromiseInterface
|
99 |
-
{
|
100 |
-
$hdrs = $this->lastHeaders;
|
101 |
-
$this->lastHeaders = [];
|
102 |
-
$parts = \explode(' ', \array_shift($hdrs), 3);
|
103 |
-
$ver = \explode('/', $parts[0])[1];
|
104 |
-
$status = (int) $parts[1];
|
105 |
-
$reason = $parts[2] ?? null;
|
106 |
-
$headers = Utils::headersFromLines($hdrs);
|
107 |
-
[$stream, $headers] = $this->checkDecode($options, $headers, $stream);
|
108 |
-
$stream = Psr7\Utils::streamFor($stream);
|
109 |
-
$sink = $stream;
|
110 |
-
|
111 |
-
if (\strcasecmp('HEAD', $request->getMethod())) {
|
112 |
-
$sink = $this->createSink($stream, $options);
|
113 |
-
}
|
114 |
-
|
115 |
-
$response = new Psr7\Response($status, $headers, $sink, $ver, $reason);
|
116 |
-
|
117 |
-
if (isset($options['on_headers'])) {
|
118 |
-
try {
|
119 |
-
$options['on_headers']($response);
|
120 |
-
} catch (\Exception $e) {
|
121 |
-
$msg = 'An error was encountered during the on_headers event';
|
122 |
-
$ex = new RequestException($msg, $request, $response, $e);
|
123 |
-
return P\Create::rejectionFor($ex);
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
// Do not drain when the request is a HEAD request because they have
|
128 |
-
// no body.
|
129 |
-
if ($sink !== $stream) {
|
130 |
-
$this->drain($stream, $sink, $response->getHeaderLine('Content-Length'));
|
131 |
-
}
|
132 |
-
|
133 |
-
$this->invokeStats($options, $request, $startTime, $response, null);
|
134 |
-
|
135 |
-
return new FulfilledPromise($response);
|
136 |
-
}
|
137 |
-
|
138 |
-
private function createSink(StreamInterface $stream, array $options): StreamInterface
|
139 |
-
{
|
140 |
-
if (!empty($options['stream'])) {
|
141 |
-
return $stream;
|
142 |
-
}
|
143 |
-
|
144 |
-
$sink = $options['sink'] ?? \fopen('php://temp', 'r+');
|
145 |
-
|
146 |
-
return \is_string($sink) ? new Psr7\LazyOpenStream($sink, 'w+') : Psr7\Utils::streamFor($sink);
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* @param resource $stream
|
151 |
-
*/
|
152 |
-
private function checkDecode(array $options, array $headers, $stream): array
|
153 |
-
{
|
154 |
-
// Automatically decode responses when instructed.
|
155 |
-
if (!empty($options['decode_content'])) {
|
156 |
-
$normalizedKeys = Utils::normalizeHeaderKeys($headers);
|
157 |
-
if (isset($normalizedKeys['content-encoding'])) {
|
158 |
-
$encoding = $headers[$normalizedKeys['content-encoding']];
|
159 |
-
if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') {
|
160 |
-
$stream = new Psr7\InflateStream(Psr7\Utils::streamFor($stream));
|
161 |
-
$headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']];
|
162 |
-
|
163 |
-
// Remove content-encoding header
|
164 |
-
unset($headers[$normalizedKeys['content-encoding']]);
|
165 |
-
|
166 |
-
// Fix content-length header
|
167 |
-
if (isset($normalizedKeys['content-length'])) {
|
168 |
-
$headers['x-encoded-content-length'] = $headers[$normalizedKeys['content-length']];
|
169 |
-
$length = (int) $stream->getSize();
|
170 |
-
if ($length === 0) {
|
171 |
-
unset($headers[$normalizedKeys['content-length']]);
|
172 |
-
} else {
|
173 |
-
$headers[$normalizedKeys['content-length']] = [$length];
|
174 |
-
}
|
175 |
-
}
|
176 |
-
}
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
return [$stream, $headers];
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* Drains the source stream into the "sink" client option.
|
185 |
-
*
|
186 |
-
* @param string $contentLength Header specifying the amount of
|
187 |
-
* data to read.
|
188 |
-
*
|
189 |
-
* @throws \RuntimeException when the sink option is invalid.
|
190 |
-
*/
|
191 |
-
private function drain(StreamInterface $source, StreamInterface $sink, string $contentLength): StreamInterface
|
192 |
-
{
|
193 |
-
// If a content-length header is provided, then stop reading once
|
194 |
-
// that number of bytes has been read. This can prevent infinitely
|
195 |
-
// reading from a stream when dealing with servers that do not honor
|
196 |
-
// Connection: Close headers.
|
197 |
-
Psr7\Utils::copyToStream(
|
198 |
-
$source,
|
199 |
-
$sink,
|
200 |
-
(\strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1
|
201 |
-
);
|
202 |
-
|
203 |
-
$sink->seek(0);
|
204 |
-
$source->close();
|
205 |
-
|
206 |
-
return $sink;
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Create a resource and check to ensure it was created successfully
|
211 |
-
*
|
212 |
-
* @param callable $callback Callable that returns stream resource
|
213 |
-
*
|
214 |
-
* @return resource
|
215 |
-
*
|
216 |
-
* @throws \RuntimeException on error
|
217 |
-
*/
|
218 |
-
private function createResource(callable $callback)
|
219 |
-
{
|
220 |
-
$errors = [];
|
221 |
-
\set_error_handler(static function ($_, $msg, $file, $line) use (&$errors): bool {
|
222 |
-
$errors[] = [
|
223 |
-
'message' => $msg,
|
224 |
-
'file' => $file,
|
225 |
-
'line' => $line
|
226 |
-
];
|
227 |
-
return true;
|
228 |
-
});
|
229 |
-
|
230 |
-
$resource = $callback();
|
231 |
-
\restore_error_handler();
|
232 |
-
|
233 |
-
if (!$resource) {
|
234 |
-
$message = 'Error creating resource: ';
|
235 |
-
foreach ($errors as $err) {
|
236 |
-
foreach ($err as $key => $value) {
|
237 |
-
$message .= "[$key] $value" . \PHP_EOL;
|
238 |
-
}
|
239 |
-
}
|
240 |
-
throw new \RuntimeException(\trim($message));
|
241 |
-
}
|
242 |
-
|
243 |
-
return $resource;
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* @return resource
|
248 |
-
*/
|
249 |
-
private function createStream(RequestInterface $request, array $options)
|
250 |
-
{
|
251 |
-
static $methods;
|
252 |
-
if (!$methods) {
|
253 |
-
$methods = \array_flip(\get_class_methods(__CLASS__));
|
254 |
-
}
|
255 |
-
|
256 |
-
// HTTP/1.1 streams using the PHP stream wrapper require a
|
257 |
-
// Connection: close header
|
258 |
-
if ($request->getProtocolVersion() == '1.1'
|
259 |
-
&& !$request->hasHeader('Connection')
|
260 |
-
) {
|
261 |
-
$request = $request->withHeader('Connection', 'close');
|
262 |
-
}
|
263 |
-
|
264 |
-
// Ensure SSL is verified by default
|
265 |
-
if (!isset($options['verify'])) {
|
266 |
-
$options['verify'] = true;
|
267 |
-
}
|
268 |
-
|
269 |
-
$params = [];
|
270 |
-
$context = $this->getDefaultContext($request);
|
271 |
-
|
272 |
-
if (isset($options['on_headers']) && !\is_callable($options['on_headers'])) {
|
273 |
-
throw new \InvalidArgumentException('on_headers must be callable');
|
274 |
-
}
|
275 |
-
|
276 |
-
if (!empty($options)) {
|
277 |
-
foreach ($options as $key => $value) {
|
278 |
-
$method = "add_{$key}";
|
279 |
-
if (isset($methods[$method])) {
|
280 |
-
$this->{$method}($request, $context, $value, $params);
|
281 |
-
}
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
-
if (isset($options['stream_context'])) {
|
286 |
-
if (!\is_array($options['stream_context'])) {
|
287 |
-
throw new \InvalidArgumentException('stream_context must be an array');
|
288 |
-
}
|
289 |
-
$context = \array_replace_recursive($context, $options['stream_context']);
|
290 |
-
}
|
291 |
-
|
292 |
-
// Microsoft NTLM authentication only supported with curl handler
|
293 |
-
if (isset($options['auth'][2]) && 'ntlm' === $options['auth'][2]) {
|
294 |
-
throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler');
|
295 |
-
}
|
296 |
-
|
297 |
-
$uri = $this->resolveHost($request, $options);
|
298 |
-
|
299 |
-
$contextResource = $this->createResource(
|
300 |
-
static function () use ($context, $params) {
|
301 |
-
return \stream_context_create($context, $params);
|
302 |
-
}
|
303 |
-
);
|
304 |
-
|
305 |
-
return $this->createResource(
|
306 |
-
function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) {
|
307 |
-
$resource = \fopen((string) $uri, 'r', false, $contextResource);
|
308 |
-
$this->lastHeaders = $http_response_header;
|
309 |
-
|
310 |
-
if (false === $resource) {
|
311 |
-
throw new ConnectException(sprintf('Connection refused for URI %s', $uri), $request, null, $context);
|
312 |
-
}
|
313 |
-
|
314 |
-
if (isset($options['read_timeout'])) {
|
315 |
-
$readTimeout = $options['read_timeout'];
|
316 |
-
$sec = (int) $readTimeout;
|
317 |
-
$usec = ($readTimeout - $sec) * 100000;
|
318 |
-
\stream_set_timeout($resource, $sec, $usec);
|
319 |
-
}
|
320 |
-
|
321 |
-
return $resource;
|
322 |
-
}
|
323 |
-
);
|
324 |
-
}
|
325 |
-
|
326 |
-
private function resolveHost(RequestInterface $request, array $options): UriInterface
|
327 |
-
{
|
328 |
-
$uri = $request->getUri();
|
329 |
-
|
330 |
-
if (isset($options['force_ip_resolve']) && !\filter_var($uri->getHost(), \FILTER_VALIDATE_IP)) {
|
331 |
-
if ('v4' === $options['force_ip_resolve']) {
|
332 |
-
$records = \dns_get_record($uri->getHost(), \DNS_A);
|
333 |
-
if (false === $records || !isset($records[0]['ip'])) {
|
334 |
-
throw new ConnectException(\sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request);
|
335 |
-
}
|
336 |
-
return $uri->withHost($records[0]['ip']);
|
337 |
-
}
|
338 |
-
if ('v6' === $options['force_ip_resolve']) {
|
339 |
-
$records = \dns_get_record($uri->getHost(), \DNS_AAAA);
|
340 |
-
if (false === $records || !isset($records[0]['ipv6'])) {
|
341 |
-
throw new ConnectException(\sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request);
|
342 |
-
}
|
343 |
-
return $uri->withHost('[' . $records[0]['ipv6'] . ']');
|
344 |
-
}
|
345 |
-
}
|
346 |
-
|
347 |
-
return $uri;
|
348 |
-
}
|
349 |
-
|
350 |
-
private function getDefaultContext(RequestInterface $request): array
|
351 |
-
{
|
352 |
-
$headers = '';
|
353 |
-
foreach ($request->getHeaders() as $name => $value) {
|
354 |
-
foreach ($value as $val) {
|
355 |
-
$headers .= "$name: $val\r\n";
|
356 |
-
}
|
357 |
-
}
|
358 |
-
|
359 |
-
$context = [
|
360 |
-
'http' => [
|
361 |
-
'method' => $request->getMethod(),
|
362 |
-
'header' => $headers,
|
363 |
-
'protocol_version' => $request->getProtocolVersion(),
|
364 |
-
'ignore_errors' => true,
|
365 |
-
'follow_location' => 0,
|
366 |
-
],
|
367 |
-
];
|
368 |
-
|
369 |
-
$body = (string) $request->getBody();
|
370 |
-
|
371 |
-
if (!empty($body)) {
|
372 |
-
$context['http']['content'] = $body;
|
373 |
-
// Prevent the HTTP handler from adding a Content-Type header.
|
374 |
-
if (!$request->hasHeader('Content-Type')) {
|
375 |
-
$context['http']['header'] .= "Content-Type:\r\n";
|
376 |
-
}
|
377 |
-
}
|
378 |
-
|
379 |
-
$context['http']['header'] = \rtrim($context['http']['header']);
|
380 |
-
|
381 |
-
return $context;
|
382 |
-
}
|
383 |
-
|
384 |
-
/**
|
385 |
-
* @param mixed $value as passed via Request transfer options.
|
386 |
-
*/
|
387 |
-
private function add_proxy(RequestInterface $request, array &$options, $value, array &$params): void
|
388 |
-
{
|
389 |
-
if (!\is_array($value)) {
|
390 |
-
$options['http']['proxy'] = $value;
|
391 |
-
} else {
|
392 |
-
$scheme = $request->getUri()->getScheme();
|
393 |
-
if (isset($value[$scheme])) {
|
394 |
-
if (!isset($value['no']) || !Utils::isHostInNoProxy($request->getUri()->getHost(), $value['no'])) {
|
395 |
-
$options['http']['proxy'] = $value[$scheme];
|
396 |
-
}
|
397 |
-
}
|
398 |
-
}
|
399 |
-
}
|
400 |
-
|
401 |
-
/**
|
402 |
-
* @param mixed $value as passed via Request transfer options.
|
403 |
-
*/
|
404 |
-
private function add_timeout(RequestInterface $request, array &$options, $value, array &$params): void
|
405 |
-
{
|
406 |
-
if ($value > 0) {
|
407 |
-
$options['http']['timeout'] = $value;
|
408 |
-
}
|
409 |
-
}
|
410 |
-
|
411 |
-
/**
|
412 |
-
* @param mixed $value as passed via Request transfer options.
|
413 |
-
*/
|
414 |
-
private function add_verify(RequestInterface $request, array &$options, $value, array &$params): void
|
415 |
-
{
|
416 |
-
if ($value === false) {
|
417 |
-
$options['ssl']['verify_peer'] = false;
|
418 |
-
$options['ssl']['verify_peer_name'] = false;
|
419 |
-
|
420 |
-
return;
|
421 |
-
}
|
422 |
-
|
423 |
-
if (\is_string($value)) {
|
424 |
-
$options['ssl']['cafile'] = $value;
|
425 |
-
if (!\file_exists($value)) {
|
426 |
-
throw new \RuntimeException("SSL CA bundle not found: $value");
|
427 |
-
}
|
428 |
-
} elseif ($value !== true) {
|
429 |
-
throw new \InvalidArgumentException('Invalid verify request option');
|
430 |
-
}
|
431 |
-
|
432 |
-
$options['ssl']['verify_peer'] = true;
|
433 |
-
$options['ssl']['verify_peer_name'] = true;
|
434 |
-
$options['ssl']['allow_self_signed'] = false;
|
435 |
-
}
|
436 |
-
|
437 |
-
/**
|
438 |
-
* @param mixed $value as passed via Request transfer options.
|
439 |
-
*/
|
440 |
-
private function add_cert(RequestInterface $request, array &$options, $value, array &$params): void
|
441 |
-
{
|
442 |
-
if (\is_array($value)) {
|
443 |
-
$options['ssl']['passphrase'] = $value[1];
|
444 |
-
$value = $value[0];
|
445 |
-
}
|
446 |
-
|
447 |
-
if (!\file_exists($value)) {
|
448 |
-
throw new \RuntimeException("SSL certificate not found: {$value}");
|
449 |
-
}
|
450 |
-
|
451 |
-
$options['ssl']['local_cert'] = $value;
|
452 |
-
}
|
453 |
-
|
454 |
-
/**
|
455 |
-
* @param mixed $value as passed via Request transfer options.
|
456 |
-
*/
|
457 |
-
private function add_progress(RequestInterface $request, array &$options, $value, array &$params): void
|
458 |
-
{
|
459 |
-
self::addNotification(
|
460 |
-
$params,
|
461 |
-
static function ($code, $a, $b, $c, $transferred, $total) use ($value) {
|
462 |
-
if ($code == \STREAM_NOTIFY_PROGRESS) {
|
463 |
-
$value($total, $transferred, null, null);
|
464 |
-
}
|
465 |
-
}
|
466 |
-
);
|
467 |
-
}
|
468 |
-
|
469 |
-
/**
|
470 |
-
* @param mixed $value as passed via Request transfer options.
|
471 |
-
*/
|
472 |
-
private function add_debug(RequestInterface $request, array &$options, $value, array &$params): void
|
473 |
-
{
|
474 |
-
if ($value === false) {
|
475 |
-
return;
|
476 |
-
}
|
477 |
-
|
478 |
-
static $map = [
|
479 |
-
\STREAM_NOTIFY_CONNECT => 'CONNECT',
|
480 |
-
\STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED',
|
481 |
-
\STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT',
|
482 |
-
\STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS',
|
483 |
-
\STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS',
|
484 |
-
\STREAM_NOTIFY_REDIRECTED => 'REDIRECTED',
|
485 |
-
\STREAM_NOTIFY_PROGRESS => 'PROGRESS',
|
486 |
-
\STREAM_NOTIFY_FAILURE => 'FAILURE',
|
487 |
-
\STREAM_NOTIFY_COMPLETED => 'COMPLETED',
|
488 |
-
\STREAM_NOTIFY_RESOLVE => 'RESOLVE',
|
489 |
-
];
|
490 |
-
static $args = ['severity', 'message', 'message_code', 'bytes_transferred', 'bytes_max'];
|
491 |
-
|
492 |
-
$value = Utils::debugResource($value);
|
493 |
-
$ident = $request->getMethod() . ' ' . $request->getUri()->withFragment('');
|
494 |
-
self::addNotification(
|
495 |
-
$params,
|
496 |
-
static function (int $code, ...$passed) use ($ident, $value, $map, $args): void {
|
497 |
-
\fprintf($value, '<%s> [%s] ', $ident, $map[$code]);
|
498 |
-
foreach (\array_filter($passed) as $i => $v) {
|
499 |
-
\fwrite($value, $args[$i] . ': "' . $v . '" ');
|
500 |
-
}
|
501 |
-
\fwrite($value, "\n");
|
502 |
-
}
|
503 |
-
);
|
504 |
-
}
|
505 |
-
|
506 |
-
private static function addNotification(array &$params, callable $notify): void
|
507 |
-
{
|
508 |
-
// Wrap the existing function if needed.
|
509 |
-
if (!isset($params['notification'])) {
|
510 |
-
$params['notification'] = $notify;
|
511 |
-
} else {
|
512 |
-
$params['notification'] = self::callArray([
|
513 |
-
$params['notification'],
|
514 |
-
$notify
|
515 |
-
]);
|
516 |
-
}
|
517 |
-
}
|
518 |
-
|
519 |
-
private static function callArray(array $functions): callable
|
520 |
-
{
|
521 |
-
return static function (...$args) use ($functions) {
|
522 |
-
foreach ($functions as $fn) {
|
523 |
-
$fn(...$args);
|
524 |
-
}
|
525 |
-
};
|
526 |
-
}
|
527 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/HandlerStack.php
DELETED
@@ -1,271 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
6 |
-
use Psr\Http\Message\RequestInterface;
|
7 |
-
use Psr\Http\Message\ResponseInterface;
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Creates a composed Guzzle handler function by stacking middlewares on top of
|
11 |
-
* an HTTP handler function.
|
12 |
-
*
|
13 |
-
* @final
|
14 |
-
*/
|
15 |
-
class HandlerStack
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* @var null|callable(RequestInterface, array): PromiseInterface
|
19 |
-
*/
|
20 |
-
private $handler;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var array{(callable(callable(RequestInterface, array): PromiseInterface): callable), (string|null)}[]
|
24 |
-
*/
|
25 |
-
private $stack = [];
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var null|callable(RequestInterface, array): PromiseInterface
|
29 |
-
*/
|
30 |
-
private $cached;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Creates a default handler stack that can be used by clients.
|
34 |
-
*
|
35 |
-
* The returned handler will wrap the provided handler or use the most
|
36 |
-
* appropriate default handler for your system. The returned HandlerStack has
|
37 |
-
* support for cookies, redirects, HTTP error exceptions, and preparing a body
|
38 |
-
* before sending.
|
39 |
-
*
|
40 |
-
* The returned handler stack can be passed to a client in the "handler"
|
41 |
-
* option.
|
42 |
-
*
|
43 |
-
* @param null|callable(RequestInterface, array): PromiseInterface $handler HTTP handler function to use with the stack. If no
|
44 |
-
* handler is provided, the best handler for your
|
45 |
-
* system will be utilized.
|
46 |
-
*/
|
47 |
-
public static function create(?callable $handler = null): self
|
48 |
-
{
|
49 |
-
$stack = new self($handler ?: Utils::chooseHandler());
|
50 |
-
$stack->push(Middleware::httpErrors(), 'http_errors');
|
51 |
-
$stack->push(Middleware::redirect(), 'allow_redirects');
|
52 |
-
$stack->push(Middleware::cookies(), 'cookies');
|
53 |
-
$stack->push(Middleware::prepareBody(), 'prepare_body');
|
54 |
-
|
55 |
-
return $stack;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @param null|callable(RequestInterface, array): PromiseInterface $handler Underlying HTTP handler.
|
60 |
-
*/
|
61 |
-
public function __construct(callable $handler = null)
|
62 |
-
{
|
63 |
-
$this->handler = $handler;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Invokes the handler stack as a composed handler
|
68 |
-
*
|
69 |
-
* @return ResponseInterface|PromiseInterface
|
70 |
-
*/
|
71 |
-
public function __invoke(RequestInterface $request, array $options)
|
72 |
-
{
|
73 |
-
$handler = $this->resolve();
|
74 |
-
|
75 |
-
return $handler($request, $options);
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Dumps a string representation of the stack.
|
80 |
-
*
|
81 |
-
* @return string
|
82 |
-
*/
|
83 |
-
public function __toString()
|
84 |
-
{
|
85 |
-
$depth = 0;
|
86 |
-
$stack = [];
|
87 |
-
|
88 |
-
if ($this->handler !== null) {
|
89 |
-
$stack[] = "0) Handler: " . $this->debugCallable($this->handler);
|
90 |
-
}
|
91 |
-
|
92 |
-
$result = '';
|
93 |
-
foreach (\array_reverse($this->stack) as $tuple) {
|
94 |
-
$depth++;
|
95 |
-
$str = "{$depth}) Name: '{$tuple[1]}', ";
|
96 |
-
$str .= "Function: " . $this->debugCallable($tuple[0]);
|
97 |
-
$result = "> {$str}\n{$result}";
|
98 |
-
$stack[] = $str;
|
99 |
-
}
|
100 |
-
|
101 |
-
foreach (\array_keys($stack) as $k) {
|
102 |
-
$result .= "< {$stack[$k]}\n";
|
103 |
-
}
|
104 |
-
|
105 |
-
return $result;
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Set the HTTP handler that actually returns a promise.
|
110 |
-
*
|
111 |
-
* @param callable(RequestInterface, array): PromiseInterface $handler Accepts a request and array of options and
|
112 |
-
* returns a Promise.
|
113 |
-
*/
|
114 |
-
public function setHandler(callable $handler): void
|
115 |
-
{
|
116 |
-
$this->handler = $handler;
|
117 |
-
$this->cached = null;
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Returns true if the builder has a handler.
|
122 |
-
*/
|
123 |
-
public function hasHandler(): bool
|
124 |
-
{
|
125 |
-
return $this->handler !== null ;
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Unshift a middleware to the bottom of the stack.
|
130 |
-
*
|
131 |
-
* @param callable(callable): callable $middleware Middleware function
|
132 |
-
* @param string $name Name to register for this middleware.
|
133 |
-
*/
|
134 |
-
public function unshift(callable $middleware, ?string $name = null): void
|
135 |
-
{
|
136 |
-
\array_unshift($this->stack, [$middleware, $name]);
|
137 |
-
$this->cached = null;
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Push a middleware to the top of the stack.
|
142 |
-
*
|
143 |
-
* @param callable(callable): callable $middleware Middleware function
|
144 |
-
* @param string $name Name to register for this middleware.
|
145 |
-
*/
|
146 |
-
public function push(callable $middleware, string $name = ''): void
|
147 |
-
{
|
148 |
-
$this->stack[] = [$middleware, $name];
|
149 |
-
$this->cached = null;
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Add a middleware before another middleware by name.
|
154 |
-
*
|
155 |
-
* @param string $findName Middleware to find
|
156 |
-
* @param callable(callable): callable $middleware Middleware function
|
157 |
-
* @param string $withName Name to register for this middleware.
|
158 |
-
*/
|
159 |
-
public function before(string $findName, callable $middleware, string $withName = ''): void
|
160 |
-
{
|
161 |
-
$this->splice($findName, $withName, $middleware, true);
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Add a middleware after another middleware by name.
|
166 |
-
*
|
167 |
-
* @param string $findName Middleware to find
|
168 |
-
* @param callable(callable): callable $middleware Middleware function
|
169 |
-
* @param string $withName Name to register for this middleware.
|
170 |
-
*/
|
171 |
-
public function after(string $findName, callable $middleware, string $withName = ''): void
|
172 |
-
{
|
173 |
-
$this->splice($findName, $withName, $middleware, false);
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Remove a middleware by instance or name from the stack.
|
178 |
-
*
|
179 |
-
* @param callable|string $remove Middleware to remove by instance or name.
|
180 |
-
*/
|
181 |
-
public function remove($remove): void
|
182 |
-
{
|
183 |
-
$this->cached = null;
|
184 |
-
$idx = \is_callable($remove) ? 0 : 1;
|
185 |
-
$this->stack = \array_values(\array_filter(
|
186 |
-
$this->stack,
|
187 |
-
static function ($tuple) use ($idx, $remove) {
|
188 |
-
return $tuple[$idx] !== $remove;
|
189 |
-
}
|
190 |
-
));
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Compose the middleware and handler into a single callable function.
|
195 |
-
*
|
196 |
-
* @return callable(RequestInterface, array): PromiseInterface
|
197 |
-
*/
|
198 |
-
public function resolve(): callable
|
199 |
-
{
|
200 |
-
if ($this->cached === null) {
|
201 |
-
if (($prev = $this->handler) === null) {
|
202 |
-
throw new \LogicException('No handler has been specified');
|
203 |
-
}
|
204 |
-
|
205 |
-
foreach (\array_reverse($this->stack) as $fn) {
|
206 |
-
/** @var callable(RequestInterface, array): PromiseInterface $prev */
|
207 |
-
$prev = $fn[0]($prev);
|
208 |
-
}
|
209 |
-
|
210 |
-
$this->cached = $prev;
|
211 |
-
}
|
212 |
-
|
213 |
-
return $this->cached;
|
214 |
-
}
|
215 |
-
|
216 |
-
private function findByName(string $name): int
|
217 |
-
{
|
218 |
-
foreach ($this->stack as $k => $v) {
|
219 |
-
if ($v[1] === $name) {
|
220 |
-
return $k;
|
221 |
-
}
|
222 |
-
}
|
223 |
-
|
224 |
-
throw new \InvalidArgumentException("Middleware not found: $name");
|
225 |
-
}
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Splices a function into the middleware list at a specific position.
|
229 |
-
*/
|
230 |
-
private function splice(string $findName, string $withName, callable $middleware, bool $before): void
|
231 |
-
{
|
232 |
-
$this->cached = null;
|
233 |
-
$idx = $this->findByName($findName);
|
234 |
-
$tuple = [$middleware, $withName];
|
235 |
-
|
236 |
-
if ($before) {
|
237 |
-
if ($idx === 0) {
|
238 |
-
\array_unshift($this->stack, $tuple);
|
239 |
-
} else {
|
240 |
-
$replacement = [$tuple, $this->stack[$idx]];
|
241 |
-
\array_splice($this->stack, $idx, 1, $replacement);
|
242 |
-
}
|
243 |
-
} elseif ($idx === \count($this->stack) - 1) {
|
244 |
-
$this->stack[] = $tuple;
|
245 |
-
} else {
|
246 |
-
$replacement = [$this->stack[$idx], $tuple];
|
247 |
-
\array_splice($this->stack, $idx, 1, $replacement);
|
248 |
-
}
|
249 |
-
}
|
250 |
-
|
251 |
-
/**
|
252 |
-
* Provides a debug string for a given callable.
|
253 |
-
*
|
254 |
-
* @param callable $fn Function to write as a string.
|
255 |
-
*/
|
256 |
-
private function debugCallable($fn): string
|
257 |
-
{
|
258 |
-
if (\is_string($fn)) {
|
259 |
-
return "callable({$fn})";
|
260 |
-
}
|
261 |
-
|
262 |
-
if (\is_array($fn)) {
|
263 |
-
return \is_string($fn[0])
|
264 |
-
? "callable({$fn[0]}::{$fn[1]})"
|
265 |
-
: "callable(['" . \get_class($fn[0]) . "', '{$fn[1]}'])";
|
266 |
-
}
|
267 |
-
|
268 |
-
/** @var object $fn */
|
269 |
-
return 'callable(' . \spl_object_hash($fn) . ')';
|
270 |
-
}
|
271 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/MessageFormatter.php
DELETED
@@ -1,198 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use Psr\Http\Message\MessageInterface;
|
6 |
-
use Psr\Http\Message\RequestInterface;
|
7 |
-
use Psr\Http\Message\ResponseInterface;
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Formats log messages using variable substitutions for requests, responses,
|
11 |
-
* and other transactional data.
|
12 |
-
*
|
13 |
-
* The following variable substitutions are supported:
|
14 |
-
*
|
15 |
-
* - {request}: Full HTTP request message
|
16 |
-
* - {response}: Full HTTP response message
|
17 |
-
* - {ts}: ISO 8601 date in GMT
|
18 |
-
* - {date_iso_8601} ISO 8601 date in GMT
|
19 |
-
* - {date_common_log} Apache common log date using the configured timezone.
|
20 |
-
* - {host}: Host of the request
|
21 |
-
* - {method}: Method of the request
|
22 |
-
* - {uri}: URI of the request
|
23 |
-
* - {version}: Protocol version
|
24 |
-
* - {target}: Request target of the request (path + query + fragment)
|
25 |
-
* - {hostname}: Hostname of the machine that sent the request
|
26 |
-
* - {code}: Status code of the response (if available)
|
27 |
-
* - {phrase}: Reason phrase of the response (if available)
|
28 |
-
* - {error}: Any error messages (if available)
|
29 |
-
* - {req_header_*}: Replace `*` with the lowercased name of a request header to add to the message
|
30 |
-
* - {res_header_*}: Replace `*` with the lowercased name of a response header to add to the message
|
31 |
-
* - {req_headers}: Request headers
|
32 |
-
* - {res_headers}: Response headers
|
33 |
-
* - {req_body}: Request body
|
34 |
-
* - {res_body}: Response body
|
35 |
-
*
|
36 |
-
* @final
|
37 |
-
*/
|
38 |
-
class MessageFormatter implements MessageFormatterInterface
|
39 |
-
{
|
40 |
-
/**
|
41 |
-
* Apache Common Log Format.
|
42 |
-
*
|
43 |
-
* @link https://httpd.apache.org/docs/2.4/logs.html#common
|
44 |
-
*
|
45 |
-
* @var string
|
46 |
-
*/
|
47 |
-
public const CLF = "{hostname} {req_header_User-Agent} - [{date_common_log}] \"{method} {target} HTTP/{version}\" {code} {res_header_Content-Length}";
|
48 |
-
public const DEBUG = ">>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}";
|
49 |
-
public const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}';
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @var string Template used to format log messages
|
53 |
-
*/
|
54 |
-
private $template;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @param string $template Log message template
|
58 |
-
*/
|
59 |
-
public function __construct(?string $template = self::CLF)
|
60 |
-
{
|
61 |
-
$this->template = $template ?: self::CLF;
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Returns a formatted message string.
|
66 |
-
*
|
67 |
-
* @param RequestInterface $request Request that was sent
|
68 |
-
* @param ResponseInterface|null $response Response that was received
|
69 |
-
* @param \Throwable|null $error Exception that was received
|
70 |
-
*/
|
71 |
-
public function format(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null): string
|
72 |
-
{
|
73 |
-
$cache = [];
|
74 |
-
|
75 |
-
/** @var string */
|
76 |
-
return \preg_replace_callback(
|
77 |
-
'/{\s*([A-Za-z_\-\.0-9]+)\s*}/',
|
78 |
-
function (array $matches) use ($request, $response, $error, &$cache) {
|
79 |
-
if (isset($cache[$matches[1]])) {
|
80 |
-
return $cache[$matches[1]];
|
81 |
-
}
|
82 |
-
|
83 |
-
$result = '';
|
84 |
-
switch ($matches[1]) {
|
85 |
-
case 'request':
|
86 |
-
$result = Psr7\Message::toString($request);
|
87 |
-
break;
|
88 |
-
case 'response':
|
89 |
-
$result = $response ? Psr7\Message::toString($response) : '';
|
90 |
-
break;
|
91 |
-
case 'req_headers':
|
92 |
-
$result = \trim($request->getMethod()
|
93 |
-
. ' ' . $request->getRequestTarget())
|
94 |
-
. ' HTTP/' . $request->getProtocolVersion() . "\r\n"
|
95 |
-
. $this->headers($request);
|
96 |
-
break;
|
97 |
-
case 'res_headers':
|
98 |
-
$result = $response ?
|
99 |
-
\sprintf(
|
100 |
-
'HTTP/%s %d %s',
|
101 |
-
$response->getProtocolVersion(),
|
102 |
-
$response->getStatusCode(),
|
103 |
-
$response->getReasonPhrase()
|
104 |
-
) . "\r\n" . $this->headers($response)
|
105 |
-
: 'NULL';
|
106 |
-
break;
|
107 |
-
case 'req_body':
|
108 |
-
$result = $request->getBody()->__toString();
|
109 |
-
break;
|
110 |
-
case 'res_body':
|
111 |
-
if (!$response instanceof ResponseInterface) {
|
112 |
-
$result = 'NULL';
|
113 |
-
break;
|
114 |
-
}
|
115 |
-
|
116 |
-
$body = $response->getBody();
|
117 |
-
|
118 |
-
if (!$body->isSeekable()) {
|
119 |
-
$result = 'RESPONSE_NOT_LOGGEABLE';
|
120 |
-
break;
|
121 |
-
}
|
122 |
-
|
123 |
-
$result = $response->getBody()->__toString();
|
124 |
-
break;
|
125 |
-
case 'ts':
|
126 |
-
case 'date_iso_8601':
|
127 |
-
$result = \gmdate('c');
|
128 |
-
break;
|
129 |
-
case 'date_common_log':
|
130 |
-
$result = \date('d/M/Y:H:i:s O');
|
131 |
-
break;
|
132 |
-
case 'method':
|
133 |
-
$result = $request->getMethod();
|
134 |
-
break;
|
135 |
-
case 'version':
|
136 |
-
$result = $request->getProtocolVersion();
|
137 |
-
break;
|
138 |
-
case 'uri':
|
139 |
-
case 'url':
|
140 |
-
$result = $request->getUri();
|
141 |
-
break;
|
142 |
-
case 'target':
|
143 |
-
$result = $request->getRequestTarget();
|
144 |
-
break;
|
145 |
-
case 'req_version':
|
146 |
-
$result = $request->getProtocolVersion();
|
147 |
-
break;
|
148 |
-
case 'res_version':
|
149 |
-
$result = $response
|
150 |
-
? $response->getProtocolVersion()
|
151 |
-
: 'NULL';
|
152 |
-
break;
|
153 |
-
case 'host':
|
154 |
-
$result = $request->getHeaderLine('Host');
|
155 |
-
break;
|
156 |
-
case 'hostname':
|
157 |
-
$result = \gethostname();
|
158 |
-
break;
|
159 |
-
case 'code':
|
160 |
-
$result = $response ? $response->getStatusCode() : 'NULL';
|
161 |
-
break;
|
162 |
-
case 'phrase':
|
163 |
-
$result = $response ? $response->getReasonPhrase() : 'NULL';
|
164 |
-
break;
|
165 |
-
case 'error':
|
166 |
-
$result = $error ? $error->getMessage() : 'NULL';
|
167 |
-
break;
|
168 |
-
default:
|
169 |
-
// handle prefixed dynamic headers
|
170 |
-
if (\strpos($matches[1], 'req_header_') === 0) {
|
171 |
-
$result = $request->getHeaderLine(\substr($matches[1], 11));
|
172 |
-
} elseif (\strpos($matches[1], 'res_header_') === 0) {
|
173 |
-
$result = $response
|
174 |
-
? $response->getHeaderLine(\substr($matches[1], 11))
|
175 |
-
: 'NULL';
|
176 |
-
}
|
177 |
-
}
|
178 |
-
|
179 |
-
$cache[$matches[1]] = $result;
|
180 |
-
return $result;
|
181 |
-
},
|
182 |
-
$this->template
|
183 |
-
);
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Get headers from message as string
|
188 |
-
*/
|
189 |
-
private function headers(MessageInterface $message): string
|
190 |
-
{
|
191 |
-
$result = '';
|
192 |
-
foreach ($message->getHeaders() as $name => $values) {
|
193 |
-
$result .= $name . ': ' . \implode(', ', $values) . "\r\n";
|
194 |
-
}
|
195 |
-
|
196 |
-
return \trim($result);
|
197 |
-
}
|
198 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
use Psr\Http\Message\ResponseInterface;
|
7 |
-
|
8 |
-
interface MessageFormatterInterface
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* Returns a formatted message string.
|
12 |
-
*
|
13 |
-
* @param RequestInterface $request Request that was sent
|
14 |
-
* @param ResponseInterface|null $response Response that was received
|
15 |
-
* @param \Throwable|null $error Exception that was received
|
16 |
-
*/
|
17 |
-
public function format(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null): string;
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Middleware.php
DELETED
@@ -1,260 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Cookie\CookieJarInterface;
|
6 |
-
use GuzzleHttp\Exception\RequestException;
|
7 |
-
use GuzzleHttp\Promise as P;
|
8 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
9 |
-
use Psr\Http\Message\RequestInterface;
|
10 |
-
use Psr\Http\Message\ResponseInterface;
|
11 |
-
use Psr\Log\LoggerInterface;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Functions used to create and wrap handlers with handler middleware.
|
15 |
-
*/
|
16 |
-
final class Middleware
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* Middleware that adds cookies to requests.
|
20 |
-
*
|
21 |
-
* The options array must be set to a CookieJarInterface in order to use
|
22 |
-
* cookies. This is typically handled for you by a client.
|
23 |
-
*
|
24 |
-
* @return callable Returns a function that accepts the next handler.
|
25 |
-
*/
|
26 |
-
public static function cookies(): callable
|
27 |
-
{
|
28 |
-
return static function (callable $handler): callable {
|
29 |
-
return static function ($request, array $options) use ($handler) {
|
30 |
-
if (empty($options['cookies'])) {
|
31 |
-
return $handler($request, $options);
|
32 |
-
} elseif (!($options['cookies'] instanceof CookieJarInterface)) {
|
33 |
-
throw new \InvalidArgumentException('cookies must be an instance of GuzzleHttp\Cookie\CookieJarInterface');
|
34 |
-
}
|
35 |
-
$cookieJar = $options['cookies'];
|
36 |
-
$request = $cookieJar->withCookieHeader($request);
|
37 |
-
return $handler($request, $options)
|
38 |
-
->then(
|
39 |
-
static function (ResponseInterface $response) use ($cookieJar, $request): ResponseInterface {
|
40 |
-
$cookieJar->extractCookies($request, $response);
|
41 |
-
return $response;
|
42 |
-
}
|
43 |
-
);
|
44 |
-
};
|
45 |
-
};
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Middleware that throws exceptions for 4xx or 5xx responses when the
|
50 |
-
* "http_error" request option is set to true.
|
51 |
-
*
|
52 |
-
* @param BodySummarizerInterface|null $bodySummarizer The body summarizer to use in exception messages.
|
53 |
-
*
|
54 |
-
* @return callable(callable): callable Returns a function that accepts the next handler.
|
55 |
-
*/
|
56 |
-
public static function httpErrors(BodySummarizerInterface $bodySummarizer = null): callable
|
57 |
-
{
|
58 |
-
return static function (callable $handler) use ($bodySummarizer): callable {
|
59 |
-
return static function ($request, array $options) use ($handler, $bodySummarizer) {
|
60 |
-
if (empty($options['http_errors'])) {
|
61 |
-
return $handler($request, $options);
|
62 |
-
}
|
63 |
-
return $handler($request, $options)->then(
|
64 |
-
static function (ResponseInterface $response) use ($request, $bodySummarizer) {
|
65 |
-
$code = $response->getStatusCode();
|
66 |
-
if ($code < 400) {
|
67 |
-
return $response;
|
68 |
-
}
|
69 |
-
throw RequestException::create($request, $response, null, [], $bodySummarizer);
|
70 |
-
}
|
71 |
-
);
|
72 |
-
};
|
73 |
-
};
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Middleware that pushes history data to an ArrayAccess container.
|
78 |
-
*
|
79 |
-
* @param array|\ArrayAccess<int, array> $container Container to hold the history (by reference).
|
80 |
-
*
|
81 |
-
* @return callable(callable): callable Returns a function that accepts the next handler.
|
82 |
-
*
|
83 |
-
* @throws \InvalidArgumentException if container is not an array or ArrayAccess.
|
84 |
-
*/
|
85 |
-
public static function history(&$container): callable
|
86 |
-
{
|
87 |
-
if (!\is_array($container) && !$container instanceof \ArrayAccess) {
|
88 |
-
throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess');
|
89 |
-
}
|
90 |
-
|
91 |
-
return static function (callable $handler) use (&$container): callable {
|
92 |
-
return static function (RequestInterface $request, array $options) use ($handler, &$container) {
|
93 |
-
return $handler($request, $options)->then(
|
94 |
-
static function ($value) use ($request, &$container, $options) {
|
95 |
-
$container[] = [
|
96 |
-
'request' => $request,
|
97 |
-
'response' => $value,
|
98 |
-
'error' => null,
|
99 |
-
'options' => $options
|
100 |
-
];
|
101 |
-
return $value;
|
102 |
-
},
|
103 |
-
static function ($reason) use ($request, &$container, $options) {
|
104 |
-
$container[] = [
|
105 |
-
'request' => $request,
|
106 |
-
'response' => null,
|
107 |
-
'error' => $reason,
|
108 |
-
'options' => $options
|
109 |
-
];
|
110 |
-
return P\Create::rejectionFor($reason);
|
111 |
-
}
|
112 |
-
);
|
113 |
-
};
|
114 |
-
};
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Middleware that invokes a callback before and after sending a request.
|
119 |
-
*
|
120 |
-
* The provided listener cannot modify or alter the response. It simply
|
121 |
-
* "taps" into the chain to be notified before returning the promise. The
|
122 |
-
* before listener accepts a request and options array, and the after
|
123 |
-
* listener accepts a request, options array, and response promise.
|
124 |
-
*
|
125 |
-
* @param callable $before Function to invoke before forwarding the request.
|
126 |
-
* @param callable $after Function invoked after forwarding.
|
127 |
-
*
|
128 |
-
* @return callable Returns a function that accepts the next handler.
|
129 |
-
*/
|
130 |
-
public static function tap(callable $before = null, callable $after = null): callable
|
131 |
-
{
|
132 |
-
return static function (callable $handler) use ($before, $after): callable {
|
133 |
-
return static function (RequestInterface $request, array $options) use ($handler, $before, $after) {
|
134 |
-
if ($before) {
|
135 |
-
$before($request, $options);
|
136 |
-
}
|
137 |
-
$response = $handler($request, $options);
|
138 |
-
if ($after) {
|
139 |
-
$after($request, $options, $response);
|
140 |
-
}
|
141 |
-
return $response;
|
142 |
-
};
|
143 |
-
};
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Middleware that handles request redirects.
|
148 |
-
*
|
149 |
-
* @return callable Returns a function that accepts the next handler.
|
150 |
-
*/
|
151 |
-
public static function redirect(): callable
|
152 |
-
{
|
153 |
-
return static function (callable $handler): RedirectMiddleware {
|
154 |
-
return new RedirectMiddleware($handler);
|
155 |
-
};
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Middleware that retries requests based on the boolean result of
|
160 |
-
* invoking the provided "decider" function.
|
161 |
-
*
|
162 |
-
* If no delay function is provided, a simple implementation of exponential
|
163 |
-
* backoff will be utilized.
|
164 |
-
*
|
165 |
-
* @param callable $decider Function that accepts the number of retries,
|
166 |
-
* a request, [response], and [exception] and
|
167 |
-
* returns true if the request is to be retried.
|
168 |
-
* @param callable $delay Function that accepts the number of retries and
|
169 |
-
* returns the number of milliseconds to delay.
|
170 |
-
*
|
171 |
-
* @return callable Returns a function that accepts the next handler.
|
172 |
-
*/
|
173 |
-
public static function retry(callable $decider, callable $delay = null): callable
|
174 |
-
{
|
175 |
-
return static function (callable $handler) use ($decider, $delay): RetryMiddleware {
|
176 |
-
return new RetryMiddleware($decider, $handler, $delay);
|
177 |
-
};
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Middleware that logs requests, responses, and errors using a message
|
182 |
-
* formatter.
|
183 |
-
*
|
184 |
-
* @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests.
|
185 |
-
*
|
186 |
-
* @param LoggerInterface $logger Logs messages.
|
187 |
-
* @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings.
|
188 |
-
* @param string $logLevel Level at which to log requests.
|
189 |
-
*
|
190 |
-
* @return callable Returns a function that accepts the next handler.
|
191 |
-
*/
|
192 |
-
public static function log(LoggerInterface $logger, $formatter, string $logLevel = 'info'): callable
|
193 |
-
{
|
194 |
-
// To be compatible with Guzzle 7.1.x we need to allow users to pass a MessageFormatter
|
195 |
-
if (!$formatter instanceof MessageFormatter && !$formatter instanceof MessageFormatterInterface) {
|
196 |
-
throw new \LogicException(sprintf('Argument 2 to %s::log() must be of type %s', self::class, MessageFormatterInterface::class));
|
197 |
-
}
|
198 |
-
|
199 |
-
return static function (callable $handler) use ($logger, $formatter, $logLevel): callable {
|
200 |
-
return static function (RequestInterface $request, array $options = []) use ($handler, $logger, $formatter, $logLevel) {
|
201 |
-
return $handler($request, $options)->then(
|
202 |
-
static function ($response) use ($logger, $request, $formatter, $logLevel): ResponseInterface {
|
203 |
-
$message = $formatter->format($request, $response);
|
204 |
-
$logger->log($logLevel, $message);
|
205 |
-
return $response;
|
206 |
-
},
|
207 |
-
static function ($reason) use ($logger, $request, $formatter): PromiseInterface {
|
208 |
-
$response = $reason instanceof RequestException ? $reason->getResponse() : null;
|
209 |
-
$message = $formatter->format($request, $response, P\Create::exceptionFor($reason));
|
210 |
-
$logger->error($message);
|
211 |
-
return P\Create::rejectionFor($reason);
|
212 |
-
}
|
213 |
-
);
|
214 |
-
};
|
215 |
-
};
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
-
* This middleware adds a default content-type if possible, a default
|
220 |
-
* content-length or transfer-encoding header, and the expect header.
|
221 |
-
*/
|
222 |
-
public static function prepareBody(): callable
|
223 |
-
{
|
224 |
-
return static function (callable $handler): PrepareBodyMiddleware {
|
225 |
-
return new PrepareBodyMiddleware($handler);
|
226 |
-
};
|
227 |
-
}
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Middleware that applies a map function to the request before passing to
|
231 |
-
* the next handler.
|
232 |
-
*
|
233 |
-
* @param callable $fn Function that accepts a RequestInterface and returns
|
234 |
-
* a RequestInterface.
|
235 |
-
*/
|
236 |
-
public static function mapRequest(callable $fn): callable
|
237 |
-
{
|
238 |
-
return static function (callable $handler) use ($fn): callable {
|
239 |
-
return static function (RequestInterface $request, array $options) use ($handler, $fn) {
|
240 |
-
return $handler($fn($request), $options);
|
241 |
-
};
|
242 |
-
};
|
243 |
-
}
|
244 |
-
|
245 |
-
/**
|
246 |
-
* Middleware that applies a map function to the resolved promise's
|
247 |
-
* response.
|
248 |
-
*
|
249 |
-
* @param callable $fn Function that accepts a ResponseInterface and
|
250 |
-
* returns a ResponseInterface.
|
251 |
-
*/
|
252 |
-
public static function mapResponse(callable $fn): callable
|
253 |
-
{
|
254 |
-
return static function (callable $handler) use ($fn): callable {
|
255 |
-
return static function (RequestInterface $request, array $options) use ($handler, $fn) {
|
256 |
-
return $handler($request, $options)->then($fn);
|
257 |
-
};
|
258 |
-
};
|
259 |
-
}
|
260 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Pool.php
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Promise as P;
|
6 |
-
use GuzzleHttp\Promise\EachPromise;
|
7 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
8 |
-
use GuzzleHttp\Promise\PromisorInterface;
|
9 |
-
use Psr\Http\Message\RequestInterface;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Sends an iterator of requests concurrently using a capped pool size.
|
13 |
-
*
|
14 |
-
* The pool will read from an iterator until it is cancelled or until the
|
15 |
-
* iterator is consumed. When a request is yielded, the request is sent after
|
16 |
-
* applying the "request_options" request options (if provided in the ctor).
|
17 |
-
*
|
18 |
-
* When a function is yielded by the iterator, the function is provided the
|
19 |
-
* "request_options" array that should be merged on top of any existing
|
20 |
-
* options, and the function MUST then return a wait-able promise.
|
21 |
-
*
|
22 |
-
* @final
|
23 |
-
*/
|
24 |
-
class Pool implements PromisorInterface
|
25 |
-
{
|
26 |
-
/**
|
27 |
-
* @var EachPromise
|
28 |
-
*/
|
29 |
-
private $each;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @param ClientInterface $client Client used to send the requests.
|
33 |
-
* @param array|\Iterator $requests Requests or functions that return
|
34 |
-
* requests to send concurrently.
|
35 |
-
* @param array $config Associative array of options
|
36 |
-
* - concurrency: (int) Maximum number of requests to send concurrently
|
37 |
-
* - options: Array of request options to apply to each request.
|
38 |
-
* - fulfilled: (callable) Function to invoke when a request completes.
|
39 |
-
* - rejected: (callable) Function to invoke when a request is rejected.
|
40 |
-
*/
|
41 |
-
public function __construct(ClientInterface $client, $requests, array $config = [])
|
42 |
-
{
|
43 |
-
if (!isset($config['concurrency'])) {
|
44 |
-
$config['concurrency'] = 25;
|
45 |
-
}
|
46 |
-
|
47 |
-
if (isset($config['options'])) {
|
48 |
-
$opts = $config['options'];
|
49 |
-
unset($config['options']);
|
50 |
-
} else {
|
51 |
-
$opts = [];
|
52 |
-
}
|
53 |
-
|
54 |
-
$iterable = P\Create::iterFor($requests);
|
55 |
-
$requests = static function () use ($iterable, $client, $opts) {
|
56 |
-
foreach ($iterable as $key => $rfn) {
|
57 |
-
if ($rfn instanceof RequestInterface) {
|
58 |
-
yield $key => $client->sendAsync($rfn, $opts);
|
59 |
-
} elseif (\is_callable($rfn)) {
|
60 |
-
yield $key => $rfn($opts);
|
61 |
-
} else {
|
62 |
-
throw new \InvalidArgumentException('Each value yielded by the iterator must be a Psr7\Http\Message\RequestInterface or a callable that returns a promise that fulfills with a Psr7\Message\Http\ResponseInterface object.');
|
63 |
-
}
|
64 |
-
}
|
65 |
-
};
|
66 |
-
|
67 |
-
$this->each = new EachPromise($requests(), $config);
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Get promise
|
72 |
-
*/
|
73 |
-
public function promise(): PromiseInterface
|
74 |
-
{
|
75 |
-
return $this->each->promise();
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Sends multiple requests concurrently and returns an array of responses
|
80 |
-
* and exceptions that uses the same ordering as the provided requests.
|
81 |
-
*
|
82 |
-
* IMPORTANT: This method keeps every request and response in memory, and
|
83 |
-
* as such, is NOT recommended when sending a large number or an
|
84 |
-
* indeterminate number of requests concurrently.
|
85 |
-
*
|
86 |
-
* @param ClientInterface $client Client used to send the requests
|
87 |
-
* @param array|\Iterator $requests Requests to send concurrently.
|
88 |
-
* @param array $options Passes through the options available in
|
89 |
-
* {@see \GuzzleHttp\Pool::__construct}
|
90 |
-
*
|
91 |
-
* @return array Returns an array containing the response or an exception
|
92 |
-
* in the same order that the requests were sent.
|
93 |
-
*
|
94 |
-
* @throws \InvalidArgumentException if the event format is incorrect.
|
95 |
-
*/
|
96 |
-
public static function batch(ClientInterface $client, $requests, array $options = []): array
|
97 |
-
{
|
98 |
-
$res = [];
|
99 |
-
self::cmpCallback($options, 'fulfilled', $res);
|
100 |
-
self::cmpCallback($options, 'rejected', $res);
|
101 |
-
$pool = new static($client, $requests, $options);
|
102 |
-
$pool->promise()->wait();
|
103 |
-
\ksort($res);
|
104 |
-
|
105 |
-
return $res;
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Execute callback(s)
|
110 |
-
*/
|
111 |
-
private static function cmpCallback(array &$options, string $name, array &$results): void
|
112 |
-
{
|
113 |
-
if (!isset($options[$name])) {
|
114 |
-
$options[$name] = static function ($v, $k) use (&$results) {
|
115 |
-
$results[$k] = $v;
|
116 |
-
};
|
117 |
-
} else {
|
118 |
-
$currentFn = $options[$name];
|
119 |
-
$options[$name] = static function ($v, $k) use (&$results, $currentFn) {
|
120 |
-
$currentFn($v, $k);
|
121 |
-
$results[$k] = $v;
|
122 |
-
};
|
123 |
-
}
|
124 |
-
}
|
125 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php
DELETED
@@ -1,104 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
6 |
-
use Psr\Http\Message\RequestInterface;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Prepares requests that contain a body, adding the Content-Length,
|
10 |
-
* Content-Type, and Expect headers.
|
11 |
-
*
|
12 |
-
* @final
|
13 |
-
*/
|
14 |
-
class PrepareBodyMiddleware
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* @var callable(RequestInterface, array): PromiseInterface
|
18 |
-
*/
|
19 |
-
private $nextHandler;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke.
|
23 |
-
*/
|
24 |
-
public function __construct(callable $nextHandler)
|
25 |
-
{
|
26 |
-
$this->nextHandler = $nextHandler;
|
27 |
-
}
|
28 |
-
|
29 |
-
public function __invoke(RequestInterface $request, array $options): PromiseInterface
|
30 |
-
{
|
31 |
-
$fn = $this->nextHandler;
|
32 |
-
|
33 |
-
// Don't do anything if the request has no body.
|
34 |
-
if ($request->getBody()->getSize() === 0) {
|
35 |
-
return $fn($request, $options);
|
36 |
-
}
|
37 |
-
|
38 |
-
$modify = [];
|
39 |
-
|
40 |
-
// Add a default content-type if possible.
|
41 |
-
if (!$request->hasHeader('Content-Type')) {
|
42 |
-
if ($uri = $request->getBody()->getMetadata('uri')) {
|
43 |
-
if (is_string($uri) && $type = Psr7\MimeType::fromFilename($uri)) {
|
44 |
-
$modify['set_headers']['Content-Type'] = $type;
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
// Add a default content-length or transfer-encoding header.
|
50 |
-
if (!$request->hasHeader('Content-Length')
|
51 |
-
&& !$request->hasHeader('Transfer-Encoding')
|
52 |
-
) {
|
53 |
-
$size = $request->getBody()->getSize();
|
54 |
-
if ($size !== null) {
|
55 |
-
$modify['set_headers']['Content-Length'] = $size;
|
56 |
-
} else {
|
57 |
-
$modify['set_headers']['Transfer-Encoding'] = 'chunked';
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
// Add the expect header if needed.
|
62 |
-
$this->addExpectHeader($request, $options, $modify);
|
63 |
-
|
64 |
-
return $fn(Psr7\Utils::modifyRequest($request, $modify), $options);
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Add expect header
|
69 |
-
*/
|
70 |
-
private function addExpectHeader(RequestInterface $request, array $options, array &$modify): void
|
71 |
-
{
|
72 |
-
// Determine if the Expect header should be used
|
73 |
-
if ($request->hasHeader('Expect')) {
|
74 |
-
return;
|
75 |
-
}
|
76 |
-
|
77 |
-
$expect = $options['expect'] ?? null;
|
78 |
-
|
79 |
-
// Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0
|
80 |
-
if ($expect === false || $request->getProtocolVersion() < 1.1) {
|
81 |
-
return;
|
82 |
-
}
|
83 |
-
|
84 |
-
// The expect header is unconditionally enabled
|
85 |
-
if ($expect === true) {
|
86 |
-
$modify['set_headers']['Expect'] = '100-Continue';
|
87 |
-
return;
|
88 |
-
}
|
89 |
-
|
90 |
-
// By default, send the expect header when the payload is > 1mb
|
91 |
-
if ($expect === null) {
|
92 |
-
$expect = 1048576;
|
93 |
-
}
|
94 |
-
|
95 |
-
// Always add if the body cannot be rewound, the size cannot be
|
96 |
-
// determined, or the size is greater than the cutoff threshold
|
97 |
-
$body = $request->getBody();
|
98 |
-
$size = $body->getSize();
|
99 |
-
|
100 |
-
if ($size === null || $size >= (int) $expect || !$body->isSeekable()) {
|
101 |
-
$modify['set_headers']['Expect'] = '100-Continue';
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
DELETED
@@ -1,216 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Exception\BadResponseException;
|
6 |
-
use GuzzleHttp\Exception\TooManyRedirectsException;
|
7 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
8 |
-
use Psr\Http\Message\RequestInterface;
|
9 |
-
use Psr\Http\Message\ResponseInterface;
|
10 |
-
use Psr\Http\Message\UriInterface;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Request redirect middleware.
|
14 |
-
*
|
15 |
-
* Apply this middleware like other middleware using
|
16 |
-
* {@see \GuzzleHttp\Middleware::redirect()}.
|
17 |
-
*
|
18 |
-
* @final
|
19 |
-
*/
|
20 |
-
class RedirectMiddleware
|
21 |
-
{
|
22 |
-
public const HISTORY_HEADER = 'X-Guzzle-Redirect-History';
|
23 |
-
|
24 |
-
public const STATUS_HISTORY_HEADER = 'X-Guzzle-Redirect-Status-History';
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @var array
|
28 |
-
*/
|
29 |
-
public static $defaultSettings = [
|
30 |
-
'max' => 5,
|
31 |
-
'protocols' => ['http', 'https'],
|
32 |
-
'strict' => false,
|
33 |
-
'referer' => false,
|
34 |
-
'track_redirects' => false,
|
35 |
-
];
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @var callable(RequestInterface, array): PromiseInterface
|
39 |
-
*/
|
40 |
-
private $nextHandler;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke.
|
44 |
-
*/
|
45 |
-
public function __construct(callable $nextHandler)
|
46 |
-
{
|
47 |
-
$this->nextHandler = $nextHandler;
|
48 |
-
}
|
49 |
-
|
50 |
-
public function __invoke(RequestInterface $request, array $options): PromiseInterface
|
51 |
-
{
|
52 |
-
$fn = $this->nextHandler;
|
53 |
-
|
54 |
-
if (empty($options['allow_redirects'])) {
|
55 |
-
return $fn($request, $options);
|
56 |
-
}
|
57 |
-
|
58 |
-
if ($options['allow_redirects'] === true) {
|
59 |
-
$options['allow_redirects'] = self::$defaultSettings;
|
60 |
-
} elseif (!\is_array($options['allow_redirects'])) {
|
61 |
-
throw new \InvalidArgumentException('allow_redirects must be true, false, or array');
|
62 |
-
} else {
|
63 |
-
// Merge the default settings with the provided settings
|
64 |
-
$options['allow_redirects'] += self::$defaultSettings;
|
65 |
-
}
|
66 |
-
|
67 |
-
if (empty($options['allow_redirects']['max'])) {
|
68 |
-
return $fn($request, $options);
|
69 |
-
}
|
70 |
-
|
71 |
-
return $fn($request, $options)
|
72 |
-
->then(function (ResponseInterface $response) use ($request, $options) {
|
73 |
-
return $this->checkRedirect($request, $options, $response);
|
74 |
-
});
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* @return ResponseInterface|PromiseInterface
|
79 |
-
*/
|
80 |
-
public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response)
|
81 |
-
{
|
82 |
-
if (\strpos((string) $response->getStatusCode(), '3') !== 0
|
83 |
-
|| !$response->hasHeader('Location')
|
84 |
-
) {
|
85 |
-
return $response;
|
86 |
-
}
|
87 |
-
|
88 |
-
$this->guardMax($request, $response, $options);
|
89 |
-
$nextRequest = $this->modifyRequest($request, $options, $response);
|
90 |
-
|
91 |
-
if (isset($options['allow_redirects']['on_redirect'])) {
|
92 |
-
($options['allow_redirects']['on_redirect'])(
|
93 |
-
$request,
|
94 |
-
$response,
|
95 |
-
$nextRequest->getUri()
|
96 |
-
);
|
97 |
-
}
|
98 |
-
|
99 |
-
$promise = $this($nextRequest, $options);
|
100 |
-
|
101 |
-
// Add headers to be able to track history of redirects.
|
102 |
-
if (!empty($options['allow_redirects']['track_redirects'])) {
|
103 |
-
return $this->withTracking(
|
104 |
-
$promise,
|
105 |
-
(string) $nextRequest->getUri(),
|
106 |
-
$response->getStatusCode()
|
107 |
-
);
|
108 |
-
}
|
109 |
-
|
110 |
-
return $promise;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Enable tracking on promise.
|
115 |
-
*/
|
116 |
-
private function withTracking(PromiseInterface $promise, string $uri, int $statusCode): PromiseInterface
|
117 |
-
{
|
118 |
-
return $promise->then(
|
119 |
-
static function (ResponseInterface $response) use ($uri, $statusCode) {
|
120 |
-
// Note that we are pushing to the front of the list as this
|
121 |
-
// would be an earlier response than what is currently present
|
122 |
-
// in the history header.
|
123 |
-
$historyHeader = $response->getHeader(self::HISTORY_HEADER);
|
124 |
-
$statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER);
|
125 |
-
\array_unshift($historyHeader, $uri);
|
126 |
-
\array_unshift($statusHeader, (string) $statusCode);
|
127 |
-
|
128 |
-
return $response->withHeader(self::HISTORY_HEADER, $historyHeader)
|
129 |
-
->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader);
|
130 |
-
}
|
131 |
-
);
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Check for too many redirects
|
136 |
-
*
|
137 |
-
* @throws TooManyRedirectsException Too many redirects.
|
138 |
-
*/
|
139 |
-
private function guardMax(RequestInterface $request, ResponseInterface $response, array &$options): void
|
140 |
-
{
|
141 |
-
$current = $options['__redirect_count']
|
142 |
-
?? 0;
|
143 |
-
$options['__redirect_count'] = $current + 1;
|
144 |
-
$max = $options['allow_redirects']['max'];
|
145 |
-
|
146 |
-
if ($options['__redirect_count'] > $max) {
|
147 |
-
throw new TooManyRedirectsException("Will not follow more than {$max} redirects", $request, $response);
|
148 |
-
}
|
149 |
-
}
|
150 |
-
|
151 |
-
public function modifyRequest(RequestInterface $request, array $options, ResponseInterface $response): RequestInterface
|
152 |
-
{
|
153 |
-
// Request modifications to apply.
|
154 |
-
$modify = [];
|
155 |
-
$protocols = $options['allow_redirects']['protocols'];
|
156 |
-
|
157 |
-
// Use a GET request if this is an entity enclosing request and we are
|
158 |
-
// not forcing RFC compliance, but rather emulating what all browsers
|
159 |
-
// would do.
|
160 |
-
$statusCode = $response->getStatusCode();
|
161 |
-
if ($statusCode == 303 ||
|
162 |
-
($statusCode <= 302 && !$options['allow_redirects']['strict'])
|
163 |
-
) {
|
164 |
-
$safeMethods = ['GET', 'HEAD', 'OPTIONS'];
|
165 |
-
$requestMethod = $request->getMethod();
|
166 |
-
|
167 |
-
$modify['method'] = in_array($requestMethod, $safeMethods) ? $requestMethod : 'GET';
|
168 |
-
$modify['body'] = '';
|
169 |
-
}
|
170 |
-
|
171 |
-
$uri = $this->redirectUri($request, $response, $protocols);
|
172 |
-
if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) {
|
173 |
-
$idnOptions = ($options['idn_conversion'] === true) ? \IDNA_DEFAULT : $options['idn_conversion'];
|
174 |
-
$uri = Utils::idnUriConvert($uri, $idnOptions);
|
175 |
-
}
|
176 |
-
|
177 |
-
$modify['uri'] = $uri;
|
178 |
-
Psr7\Message::rewindBody($request);
|
179 |
-
|
180 |
-
// Add the Referer header if it is told to do so and only
|
181 |
-
// add the header if we are not redirecting from https to http.
|
182 |
-
if ($options['allow_redirects']['referer']
|
183 |
-
&& $modify['uri']->getScheme() === $request->getUri()->getScheme()
|
184 |
-
) {
|
185 |
-
$uri = $request->getUri()->withUserInfo('');
|
186 |
-
$modify['set_headers']['Referer'] = (string) $uri;
|
187 |
-
} else {
|
188 |
-
$modify['remove_headers'][] = 'Referer';
|
189 |
-
}
|
190 |
-
|
191 |
-
// Remove Authorization header if host is different.
|
192 |
-
if ($request->getUri()->getHost() !== $modify['uri']->getHost()) {
|
193 |
-
$modify['remove_headers'][] = 'Authorization';
|
194 |
-
}
|
195 |
-
|
196 |
-
return Psr7\Utils::modifyRequest($request, $modify);
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Set the appropriate URL on the request based on the location header
|
201 |
-
*/
|
202 |
-
private function redirectUri(RequestInterface $request, ResponseInterface $response, array $protocols): UriInterface
|
203 |
-
{
|
204 |
-
$location = Psr7\UriResolver::resolve(
|
205 |
-
$request->getUri(),
|
206 |
-
new Psr7\Uri($response->getHeaderLine('Location'))
|
207 |
-
);
|
208 |
-
|
209 |
-
// Ensure that the redirect URI is allowed based on the protocols.
|
210 |
-
if (!\in_array($location->getScheme(), $protocols)) {
|
211 |
-
throw new BadResponseException(\sprintf('Redirect URI, %s, does not use one of the allowed redirect protocols: %s', $location, \implode(', ', $protocols)), $request, $response);
|
212 |
-
}
|
213 |
-
|
214 |
-
return $location;
|
215 |
-
}
|
216 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/RequestOptions.php
DELETED
@@ -1,264 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* This class contains a list of built-in Guzzle request options.
|
7 |
-
*
|
8 |
-
* More documentation for each option can be found at http://guzzlephp.org/.
|
9 |
-
*
|
10 |
-
* @link http://docs.guzzlephp.org/en/v6/request-options.html
|
11 |
-
*/
|
12 |
-
final class RequestOptions
|
13 |
-
{
|
14 |
-
/**
|
15 |
-
* allow_redirects: (bool|array) Controls redirect behavior. Pass false
|
16 |
-
* to disable redirects, pass true to enable redirects, pass an
|
17 |
-
* associative to provide custom redirect settings. Defaults to "false".
|
18 |
-
* This option only works if your handler has the RedirectMiddleware. When
|
19 |
-
* passing an associative array, you can provide the following key value
|
20 |
-
* pairs:
|
21 |
-
*
|
22 |
-
* - max: (int, default=5) maximum number of allowed redirects.
|
23 |
-
* - strict: (bool, default=false) Set to true to use strict redirects
|
24 |
-
* meaning redirect POST requests with POST requests vs. doing what most
|
25 |
-
* browsers do which is redirect POST requests with GET requests
|
26 |
-
* - referer: (bool, default=false) Set to true to enable the Referer
|
27 |
-
* header.
|
28 |
-
* - protocols: (array, default=['http', 'https']) Allowed redirect
|
29 |
-
* protocols.
|
30 |
-
* - on_redirect: (callable) PHP callable that is invoked when a redirect
|
31 |
-
* is encountered. The callable is invoked with the request, the redirect
|
32 |
-
* response that was received, and the effective URI. Any return value
|
33 |
-
* from the on_redirect function is ignored.
|
34 |
-
*/
|
35 |
-
public const ALLOW_REDIRECTS = 'allow_redirects';
|
36 |
-
|
37 |
-
/**
|
38 |
-
* auth: (array) Pass an array of HTTP authentication parameters to use
|
39 |
-
* with the request. The array must contain the username in index [0],
|
40 |
-
* the password in index [1], and you can optionally provide a built-in
|
41 |
-
* authentication type in index [2]. Pass null to disable authentication
|
42 |
-
* for a request.
|
43 |
-
*/
|
44 |
-
public const AUTH = 'auth';
|
45 |
-
|
46 |
-
/**
|
47 |
-
* body: (resource|string|null|int|float|StreamInterface|callable|\Iterator)
|
48 |
-
* Body to send in the request.
|
49 |
-
*/
|
50 |
-
public const BODY = 'body';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* cert: (string|array) Set to a string to specify the path to a file
|
54 |
-
* containing a PEM formatted SSL client side certificate. If a password
|
55 |
-
* is required, then set cert to an array containing the path to the PEM
|
56 |
-
* file in the first array element followed by the certificate password
|
57 |
-
* in the second array element.
|
58 |
-
*/
|
59 |
-
public const CERT = 'cert';
|
60 |
-
|
61 |
-
/**
|
62 |
-
* cookies: (bool|GuzzleHttp\Cookie\CookieJarInterface, default=false)
|
63 |
-
* Specifies whether or not cookies are used in a request or what cookie
|
64 |
-
* jar to use or what cookies to send. This option only works if your
|
65 |
-
* handler has the `cookie` middleware. Valid values are `false` and
|
66 |
-
* an instance of {@see \GuzzleHttp\Cookie\CookieJarInterface}.
|
67 |
-
*/
|
68 |
-
public const COOKIES = 'cookies';
|
69 |
-
|
70 |
-
/**
|
71 |
-
* connect_timeout: (float, default=0) Float describing the number of
|
72 |
-
* seconds to wait while trying to connect to a server. Use 0 to wait
|
73 |
-
* indefinitely (the default behavior).
|
74 |
-
*/
|
75 |
-
public const CONNECT_TIMEOUT = 'connect_timeout';
|
76 |
-
|
77 |
-
/**
|
78 |
-
* debug: (bool|resource) Set to true or set to a PHP stream returned by
|
79 |
-
* fopen() enable debug output with the HTTP handler used to send a
|
80 |
-
* request.
|
81 |
-
*/
|
82 |
-
public const DEBUG = 'debug';
|
83 |
-
|
84 |
-
/**
|
85 |
-
* decode_content: (bool, default=true) Specify whether or not
|
86 |
-
* Content-Encoding responses (gzip, deflate, etc.) are automatically
|
87 |
-
* decoded.
|
88 |
-
*/
|
89 |
-
public const DECODE_CONTENT = 'decode_content';
|
90 |
-
|
91 |
-
/**
|
92 |
-
* delay: (int) The amount of time to delay before sending in milliseconds.
|
93 |
-
*/
|
94 |
-
public const DELAY = 'delay';
|
95 |
-
|
96 |
-
/**
|
97 |
-
* expect: (bool|integer) Controls the behavior of the
|
98 |
-
* "Expect: 100-Continue" header.
|
99 |
-
*
|
100 |
-
* Set to `true` to enable the "Expect: 100-Continue" header for all
|
101 |
-
* requests that sends a body. Set to `false` to disable the
|
102 |
-
* "Expect: 100-Continue" header for all requests. Set to a number so that
|
103 |
-
* the size of the payload must be greater than the number in order to send
|
104 |
-
* the Expect header. Setting to a number will send the Expect header for
|
105 |
-
* all requests in which the size of the payload cannot be determined or
|
106 |
-
* where the body is not rewindable.
|
107 |
-
*
|
108 |
-
* By default, Guzzle will add the "Expect: 100-Continue" header when the
|
109 |
-
* size of the body of a request is greater than 1 MB and a request is
|
110 |
-
* using HTTP/1.1.
|
111 |
-
*/
|
112 |
-
public const EXPECT = 'expect';
|
113 |
-
|
114 |
-
/**
|
115 |
-
* form_params: (array) Associative array of form field names to values
|
116 |
-
* where each value is a string or array of strings. Sets the Content-Type
|
117 |
-
* header to application/x-www-form-urlencoded when no Content-Type header
|
118 |
-
* is already present.
|
119 |
-
*/
|
120 |
-
public const FORM_PARAMS = 'form_params';
|
121 |
-
|
122 |
-
/**
|
123 |
-
* headers: (array) Associative array of HTTP headers. Each value MUST be
|
124 |
-
* a string or array of strings.
|
125 |
-
*/
|
126 |
-
public const HEADERS = 'headers';
|
127 |
-
|
128 |
-
/**
|
129 |
-
* http_errors: (bool, default=true) Set to false to disable exceptions
|
130 |
-
* when a non- successful HTTP response is received. By default,
|
131 |
-
* exceptions will be thrown for 4xx and 5xx responses. This option only
|
132 |
-
* works if your handler has the `httpErrors` middleware.
|
133 |
-
*/
|
134 |
-
public const HTTP_ERRORS = 'http_errors';
|
135 |
-
|
136 |
-
/**
|
137 |
-
* idn: (bool|int, default=true) A combination of IDNA_* constants for
|
138 |
-
* idn_to_ascii() PHP's function (see "options" parameter). Set to false to
|
139 |
-
* disable IDN support completely, or to true to use the default
|
140 |
-
* configuration (IDNA_DEFAULT constant).
|
141 |
-
*/
|
142 |
-
public const IDN_CONVERSION = 'idn_conversion';
|
143 |
-
|
144 |
-
/**
|
145 |
-
* json: (mixed) Adds JSON data to a request. The provided value is JSON
|
146 |
-
* encoded and a Content-Type header of application/json will be added to
|
147 |
-
* the request if no Content-Type header is already present.
|
148 |
-
*/
|
149 |
-
public const JSON = 'json';
|
150 |
-
|
151 |
-
/**
|
152 |
-
* multipart: (array) Array of associative arrays, each containing a
|
153 |
-
* required "name" key mapping to the form field, name, a required
|
154 |
-
* "contents" key mapping to a StreamInterface|resource|string, an
|
155 |
-
* optional "headers" associative array of custom headers, and an
|
156 |
-
* optional "filename" key mapping to a string to send as the filename in
|
157 |
-
* the part. If no "filename" key is present, then no "filename" attribute
|
158 |
-
* will be added to the part.
|
159 |
-
*/
|
160 |
-
public const MULTIPART = 'multipart';
|
161 |
-
|
162 |
-
/**
|
163 |
-
* on_headers: (callable) A callable that is invoked when the HTTP headers
|
164 |
-
* of the response have been received but the body has not yet begun to
|
165 |
-
* download.
|
166 |
-
*/
|
167 |
-
public const ON_HEADERS = 'on_headers';
|
168 |
-
|
169 |
-
/**
|
170 |
-
* on_stats: (callable) allows you to get access to transfer statistics of
|
171 |
-
* a request and access the lower level transfer details of the handler
|
172 |
-
* associated with your client. ``on_stats`` is a callable that is invoked
|
173 |
-
* when a handler has finished sending a request. The callback is invoked
|
174 |
-
* with transfer statistics about the request, the response received, or
|
175 |
-
* the error encountered. Included in the data is the total amount of time
|
176 |
-
* taken to send the request.
|
177 |
-
*/
|
178 |
-
public const ON_STATS = 'on_stats';
|
179 |
-
|
180 |
-
/**
|
181 |
-
* progress: (callable) Defines a function to invoke when transfer
|
182 |
-
* progress is made. The function accepts the following positional
|
183 |
-
* arguments: the total number of bytes expected to be downloaded, the
|
184 |
-
* number of bytes downloaded so far, the number of bytes expected to be
|
185 |
-
* uploaded, the number of bytes uploaded so far.
|
186 |
-
*/
|
187 |
-
public const PROGRESS = 'progress';
|
188 |
-
|
189 |
-
/**
|
190 |
-
* proxy: (string|array) Pass a string to specify an HTTP proxy, or an
|
191 |
-
* array to specify different proxies for different protocols (where the
|
192 |
-
* key is the protocol and the value is a proxy string).
|
193 |
-
*/
|
194 |
-
public const PROXY = 'proxy';
|
195 |
-
|
196 |
-
/**
|
197 |
-
* query: (array|string) Associative array of query string values to add
|
198 |
-
* to the request. This option uses PHP's http_build_query() to create
|
199 |
-
* the string representation. Pass a string value if you need more
|
200 |
-
* control than what this method provides
|
201 |
-
*/
|
202 |
-
public const QUERY = 'query';
|
203 |
-
|
204 |
-
/**
|
205 |
-
* sink: (resource|string|StreamInterface) Where the data of the
|
206 |
-
* response is written to. Defaults to a PHP temp stream. Providing a
|
207 |
-
* string will write data to a file by the given name.
|
208 |
-
*/
|
209 |
-
public const SINK = 'sink';
|
210 |
-
|
211 |
-
/**
|
212 |
-
* synchronous: (bool) Set to true to inform HTTP handlers that you intend
|
213 |
-
* on waiting on the response. This can be useful for optimizations. Note
|
214 |
-
* that a promise is still returned if you are using one of the async
|
215 |
-
* client methods.
|
216 |
-
*/
|
217 |
-
public const SYNCHRONOUS = 'synchronous';
|
218 |
-
|
219 |
-
/**
|
220 |
-
* ssl_key: (array|string) Specify the path to a file containing a private
|
221 |
-
* SSL key in PEM format. If a password is required, then set to an array
|
222 |
-
* containing the path to the SSL key in the first array element followed
|
223 |
-
* by the password required for the certificate in the second element.
|
224 |
-
*/
|
225 |
-
public const SSL_KEY = 'ssl_key';
|
226 |
-
|
227 |
-
/**
|
228 |
-
* stream: Set to true to attempt to stream a response rather than
|
229 |
-
* download it all up-front.
|
230 |
-
*/
|
231 |
-
public const STREAM = 'stream';
|
232 |
-
|
233 |
-
/**
|
234 |
-
* verify: (bool|string, default=true) Describes the SSL certificate
|
235 |
-
* verification behavior of a request. Set to true to enable SSL
|
236 |
-
* certificate verification using the system CA bundle when available
|
237 |
-
* (the default). Set to false to disable certificate verification (this
|
238 |
-
* is insecure!). Set to a string to provide the path to a CA bundle on
|
239 |
-
* disk to enable verification using a custom certificate.
|
240 |
-
*/
|
241 |
-
public const VERIFY = 'verify';
|
242 |
-
|
243 |
-
/**
|
244 |
-
* timeout: (float, default=0) Float describing the timeout of the
|
245 |
-
* request in seconds. Use 0 to wait indefinitely (the default behavior).
|
246 |
-
*/
|
247 |
-
public const TIMEOUT = 'timeout';
|
248 |
-
|
249 |
-
/**
|
250 |
-
* read_timeout: (float, default=default_socket_timeout ini setting) Float describing
|
251 |
-
* the body read timeout, for stream requests.
|
252 |
-
*/
|
253 |
-
public const READ_TIMEOUT = 'read_timeout';
|
254 |
-
|
255 |
-
/**
|
256 |
-
* version: (float) Specifies the HTTP protocol version to attempt to use.
|
257 |
-
*/
|
258 |
-
public const VERSION = 'version';
|
259 |
-
|
260 |
-
/**
|
261 |
-
* force_ip_resolve: (bool) Force client to use only ipv4 or ipv6 protocol
|
262 |
-
*/
|
263 |
-
public const FORCE_IP_RESOLVE = 'force_ip_resolve';
|
264 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/RetryMiddleware.php
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Promise as P;
|
6 |
-
use GuzzleHttp\Promise\PromiseInterface;
|
7 |
-
use Psr\Http\Message\RequestInterface;
|
8 |
-
use Psr\Http\Message\ResponseInterface;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Middleware that retries requests based on the boolean result of
|
12 |
-
* invoking the provided "decider" function.
|
13 |
-
*
|
14 |
-
* @final
|
15 |
-
*/
|
16 |
-
class RetryMiddleware
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @var callable(RequestInterface, array): PromiseInterface
|
20 |
-
*/
|
21 |
-
private $nextHandler;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @var callable
|
25 |
-
*/
|
26 |
-
private $decider;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @var callable(int)
|
30 |
-
*/
|
31 |
-
private $delay;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @param callable $decider Function that accepts the number of retries,
|
35 |
-
* a request, [response], and [exception] and
|
36 |
-
* returns true if the request is to be
|
37 |
-
* retried.
|
38 |
-
* @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke.
|
39 |
-
* @param null|callable(int): int $delay Function that accepts the number of retries
|
40 |
-
* and returns the number of
|
41 |
-
* milliseconds to delay.
|
42 |
-
*/
|
43 |
-
public function __construct(callable $decider, callable $nextHandler, callable $delay = null)
|
44 |
-
{
|
45 |
-
$this->decider = $decider;
|
46 |
-
$this->nextHandler = $nextHandler;
|
47 |
-
$this->delay = $delay ?: __CLASS__ . '::exponentialDelay';
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Default exponential backoff delay function.
|
52 |
-
*
|
53 |
-
* @return int milliseconds.
|
54 |
-
*/
|
55 |
-
public static function exponentialDelay(int $retries): int
|
56 |
-
{
|
57 |
-
return (int) \pow(2, $retries - 1) * 1000;
|
58 |
-
}
|
59 |
-
|
60 |
-
public function __invoke(RequestInterface $request, array $options): PromiseInterface
|
61 |
-
{
|
62 |
-
if (!isset($options['retries'])) {
|
63 |
-
$options['retries'] = 0;
|
64 |
-
}
|
65 |
-
|
66 |
-
$fn = $this->nextHandler;
|
67 |
-
return $fn($request, $options)
|
68 |
-
->then(
|
69 |
-
$this->onFulfilled($request, $options),
|
70 |
-
$this->onRejected($request, $options)
|
71 |
-
);
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Execute fulfilled closure
|
76 |
-
*/
|
77 |
-
private function onFulfilled(RequestInterface $request, array $options): callable
|
78 |
-
{
|
79 |
-
return function ($value) use ($request, $options) {
|
80 |
-
if (!($this->decider)(
|
81 |
-
$options['retries'],
|
82 |
-
$request,
|
83 |
-
$value,
|
84 |
-
null
|
85 |
-
)) {
|
86 |
-
return $value;
|
87 |
-
}
|
88 |
-
return $this->doRetry($request, $options, $value);
|
89 |
-
};
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Execute rejected closure
|
94 |
-
*/
|
95 |
-
private function onRejected(RequestInterface $req, array $options): callable
|
96 |
-
{
|
97 |
-
return function ($reason) use ($req, $options) {
|
98 |
-
if (!($this->decider)(
|
99 |
-
$options['retries'],
|
100 |
-
$req,
|
101 |
-
null,
|
102 |
-
$reason
|
103 |
-
)) {
|
104 |
-
return P\Create::rejectionFor($reason);
|
105 |
-
}
|
106 |
-
return $this->doRetry($req, $options);
|
107 |
-
};
|
108 |
-
}
|
109 |
-
|
110 |
-
private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null): PromiseInterface
|
111 |
-
{
|
112 |
-
$options['delay'] = ($this->delay)(++$options['retries'], $response);
|
113 |
-
|
114 |
-
return $this($request, $options);
|
115 |
-
}
|
116 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/TransferStats.php
DELETED
@@ -1,133 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
use Psr\Http\Message\ResponseInterface;
|
7 |
-
use Psr\Http\Message\UriInterface;
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Represents data at the point after it was transferred either successfully
|
11 |
-
* or after a network error.
|
12 |
-
*/
|
13 |
-
final class TransferStats
|
14 |
-
{
|
15 |
-
/**
|
16 |
-
* @var RequestInterface
|
17 |
-
*/
|
18 |
-
private $request;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var ResponseInterface|null
|
22 |
-
*/
|
23 |
-
private $response;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var float|null
|
27 |
-
*/
|
28 |
-
private $transferTime;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @var array
|
32 |
-
*/
|
33 |
-
private $handlerStats;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @var mixed|null
|
37 |
-
*/
|
38 |
-
private $handlerErrorData;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @param RequestInterface $request Request that was sent.
|
42 |
-
* @param ResponseInterface|null $response Response received (if any)
|
43 |
-
* @param float|null $transferTime Total handler transfer time.
|
44 |
-
* @param mixed $handlerErrorData Handler error data.
|
45 |
-
* @param array $handlerStats Handler specific stats.
|
46 |
-
*/
|
47 |
-
public function __construct(
|
48 |
-
RequestInterface $request,
|
49 |
-
?ResponseInterface $response = null,
|
50 |
-
?float $transferTime = null,
|
51 |
-
$handlerErrorData = null,
|
52 |
-
array $handlerStats = []
|
53 |
-
) {
|
54 |
-
$this->request = $request;
|
55 |
-
$this->response = $response;
|
56 |
-
$this->transferTime = $transferTime;
|
57 |
-
$this->handlerErrorData = $handlerErrorData;
|
58 |
-
$this->handlerStats = $handlerStats;
|
59 |
-
}
|
60 |
-
|
61 |
-
public function getRequest(): RequestInterface
|
62 |
-
{
|
63 |
-
return $this->request;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Returns the response that was received (if any).
|
68 |
-
*/
|
69 |
-
public function getResponse(): ?ResponseInterface
|
70 |
-
{
|
71 |
-
return $this->response;
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Returns true if a response was received.
|
76 |
-
*/
|
77 |
-
public function hasResponse(): bool
|
78 |
-
{
|
79 |
-
return $this->response !== null;
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Gets handler specific error data.
|
84 |
-
*
|
85 |
-
* This might be an exception, a integer representing an error code, or
|
86 |
-
* anything else. Relying on this value assumes that you know what handler
|
87 |
-
* you are using.
|
88 |
-
*
|
89 |
-
* @return mixed
|
90 |
-
*/
|
91 |
-
public function getHandlerErrorData()
|
92 |
-
{
|
93 |
-
return $this->handlerErrorData;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Get the effective URI the request was sent to.
|
98 |
-
*/
|
99 |
-
public function getEffectiveUri(): UriInterface
|
100 |
-
{
|
101 |
-
return $this->request->getUri();
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Get the estimated time the request was being transferred by the handler.
|
106 |
-
*
|
107 |
-
* @return float|null Time in seconds.
|
108 |
-
*/
|
109 |
-
public function getTransferTime(): ?float
|
110 |
-
{
|
111 |
-
return $this->transferTime;
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Gets an array of all of the handler specific transfer data.
|
116 |
-
*/
|
117 |
-
public function getHandlerStats(): array
|
118 |
-
{
|
119 |
-
return $this->handlerStats;
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Get a specific handler statistic from the handler by name.
|
124 |
-
*
|
125 |
-
* @param string $stat Handler specific transfer stat to retrieve.
|
126 |
-
*
|
127 |
-
* @return mixed|null
|
128 |
-
*/
|
129 |
-
public function getHandlerStat(string $stat)
|
130 |
-
{
|
131 |
-
return isset($this->handlerStats[$stat]) ? $this->handlerStats[$stat] : null;
|
132 |
-
}
|
133 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/Utils.php
DELETED
@@ -1,387 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
use GuzzleHttp\Exception\InvalidArgumentException;
|
6 |
-
use GuzzleHttp\Handler\CurlHandler;
|
7 |
-
use GuzzleHttp\Handler\CurlMultiHandler;
|
8 |
-
use GuzzleHttp\Handler\Proxy;
|
9 |
-
use GuzzleHttp\Handler\StreamHandler;
|
10 |
-
use Psr\Http\Message\UriInterface;
|
11 |
-
|
12 |
-
final class Utils
|
13 |
-
{
|
14 |
-
/**
|
15 |
-
* Debug function used to describe the provided value type and class.
|
16 |
-
*
|
17 |
-
* @param mixed $input
|
18 |
-
*
|
19 |
-
* @return string Returns a string containing the type of the variable and
|
20 |
-
* if a class is provided, the class name.
|
21 |
-
*/
|
22 |
-
public static function describeType($input): string
|
23 |
-
{
|
24 |
-
switch (\gettype($input)) {
|
25 |
-
case 'object':
|
26 |
-
return 'object(' . \get_class($input) . ')';
|
27 |
-
case 'array':
|
28 |
-
return 'array(' . \count($input) . ')';
|
29 |
-
default:
|
30 |
-
\ob_start();
|
31 |
-
\var_dump($input);
|
32 |
-
// normalize float vs double
|
33 |
-
/** @var string $varDumpContent */
|
34 |
-
$varDumpContent = \ob_get_clean();
|
35 |
-
|
36 |
-
return \str_replace('double(', 'float(', \rtrim($varDumpContent));
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Parses an array of header lines into an associative array of headers.
|
42 |
-
*
|
43 |
-
* @param iterable $lines Header lines array of strings in the following
|
44 |
-
* format: "Name: Value"
|
45 |
-
*/
|
46 |
-
public static function headersFromLines(iterable $lines): array
|
47 |
-
{
|
48 |
-
$headers = [];
|
49 |
-
|
50 |
-
foreach ($lines as $line) {
|
51 |
-
$parts = \explode(':', $line, 2);
|
52 |
-
$headers[\trim($parts[0])][] = isset($parts[1]) ? \trim($parts[1]) : null;
|
53 |
-
}
|
54 |
-
|
55 |
-
return $headers;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Returns a debug stream based on the provided variable.
|
60 |
-
*
|
61 |
-
* @param mixed $value Optional value
|
62 |
-
*
|
63 |
-
* @return resource
|
64 |
-
*/
|
65 |
-
public static function debugResource($value = null)
|
66 |
-
{
|
67 |
-
if (\is_resource($value)) {
|
68 |
-
return $value;
|
69 |
-
}
|
70 |
-
if (\defined('STDOUT')) {
|
71 |
-
return \STDOUT;
|
72 |
-
}
|
73 |
-
|
74 |
-
$resource = \fopen('php://output', 'w');
|
75 |
-
if (false === $resource) {
|
76 |
-
throw new \RuntimeException('Can not open php output for writing to debug the resource.');
|
77 |
-
}
|
78 |
-
|
79 |
-
return $resource;
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Chooses and creates a default handler to use based on the environment.
|
84 |
-
*
|
85 |
-
* The returned handler is not wrapped by any default middlewares.
|
86 |
-
*
|
87 |
-
* @throws \RuntimeException if no viable Handler is available.
|
88 |
-
*
|
89 |
-
* @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system.
|
90 |
-
*/
|
91 |
-
public static function chooseHandler(): callable
|
92 |
-
{
|
93 |
-
$handler = null;
|
94 |
-
if (\function_exists('curl_multi_exec') && \function_exists('curl_exec')) {
|
95 |
-
$handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler());
|
96 |
-
} elseif (\function_exists('curl_exec')) {
|
97 |
-
$handler = new CurlHandler();
|
98 |
-
} elseif (\function_exists('curl_multi_exec')) {
|
99 |
-
$handler = new CurlMultiHandler();
|
100 |
-
}
|
101 |
-
|
102 |
-
if (\ini_get('allow_url_fopen')) {
|
103 |
-
$handler = $handler
|
104 |
-
? Proxy::wrapStreaming($handler, new StreamHandler())
|
105 |
-
: new StreamHandler();
|
106 |
-
} elseif (!$handler) {
|
107 |
-
throw new \RuntimeException('GuzzleHttp requires cURL, the allow_url_fopen ini setting, or a custom HTTP handler.');
|
108 |
-
}
|
109 |
-
|
110 |
-
return $handler;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Get the default User-Agent string to use with Guzzle.
|
115 |
-
*/
|
116 |
-
public static function defaultUserAgent(): string
|
117 |
-
{
|
118 |
-
return sprintf('GuzzleHttp/%d', ClientInterface::MAJOR_VERSION);
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Returns the default cacert bundle for the current system.
|
123 |
-
*
|
124 |
-
* First, the openssl.cafile and curl.cainfo php.ini settings are checked.
|
125 |
-
* If those settings are not configured, then the common locations for
|
126 |
-
* bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X
|
127 |
-
* and Windows are checked. If any of these file locations are found on
|
128 |
-
* disk, they will be utilized.
|
129 |
-
*
|
130 |
-
* Note: the result of this function is cached for subsequent calls.
|
131 |
-
*
|
132 |
-
* @throws \RuntimeException if no bundle can be found.
|
133 |
-
*
|
134 |
-
* @deprecated Utils::defaultCaBundle will be removed in guzzlehttp/guzzle:8.0. This method is not needed in PHP 5.6+.
|
135 |
-
*/
|
136 |
-
public static function defaultCaBundle(): string
|
137 |
-
{
|
138 |
-
static $cached = null;
|
139 |
-
static $cafiles = [
|
140 |
-
// Red Hat, CentOS, Fedora (provided by the ca-certificates package)
|
141 |
-
'/etc/pki/tls/certs/ca-bundle.crt',
|
142 |
-
// Ubuntu, Debian (provided by the ca-certificates package)
|
143 |
-
'/etc/ssl/certs/ca-certificates.crt',
|
144 |
-
// FreeBSD (provided by the ca_root_nss package)
|
145 |
-
'/usr/local/share/certs/ca-root-nss.crt',
|
146 |
-
// SLES 12 (provided by the ca-certificates package)
|
147 |
-
'/var/lib/ca-certificates/ca-bundle.pem',
|
148 |
-
// OS X provided by homebrew (using the default path)
|
149 |
-
'/usr/local/etc/openssl/cert.pem',
|
150 |
-
// Google app engine
|
151 |
-
'/etc/ca-certificates.crt',
|
152 |
-
// Windows?
|
153 |
-
'C:\\windows\\system32\\curl-ca-bundle.crt',
|
154 |
-
'C:\\windows\\curl-ca-bundle.crt',
|
155 |
-
];
|
156 |
-
|
157 |
-
if ($cached) {
|
158 |
-
return $cached;
|
159 |
-
}
|
160 |
-
|
161 |
-
if ($ca = \ini_get('openssl.cafile')) {
|
162 |
-
return $cached = $ca;
|
163 |
-
}
|
164 |
-
|
165 |
-
if ($ca = \ini_get('curl.cainfo')) {
|
166 |
-
return $cached = $ca;
|
167 |
-
}
|
168 |
-
|
169 |
-
foreach ($cafiles as $filename) {
|
170 |
-
if (\file_exists($filename)) {
|
171 |
-
return $cached = $filename;
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
throw new \RuntimeException(
|
176 |
-
<<< EOT
|
177 |
-
No system CA bundle could be found in any of the the common system locations.
|
178 |
-
PHP versions earlier than 5.6 are not properly configured to use the system's
|
179 |
-
CA bundle by default. In order to verify peer certificates, you will need to
|
180 |
-
supply the path on disk to a certificate bundle to the 'verify' request
|
181 |
-
option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not
|
182 |
-
need a specific certificate bundle, then Mozilla provides a commonly used CA
|
183 |
-
bundle which can be downloaded here (provided by the maintainer of cURL):
|
184 |
-
https://curl.haxx.se/ca/cacert.pem. Once
|
185 |
-
you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP
|
186 |
-
ini setting to point to the path to the file, allowing you to omit the 'verify'
|
187 |
-
request option. See https://curl.haxx.se/docs/sslcerts.html for more
|
188 |
-
information.
|
189 |
-
EOT
|
190 |
-
);
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Creates an associative array of lowercase header names to the actual
|
195 |
-
* header casing.
|
196 |
-
*/
|
197 |
-
public static function normalizeHeaderKeys(array $headers): array
|
198 |
-
{
|
199 |
-
$result = [];
|
200 |
-
foreach (\array_keys($headers) as $key) {
|
201 |
-
$result[\strtolower($key)] = $key;
|
202 |
-
}
|
203 |
-
|
204 |
-
return $result;
|
205 |
-
}
|
206 |
-
|
207 |
-
/**
|
208 |
-
* Returns true if the provided host matches any of the no proxy areas.
|
209 |
-
*
|
210 |
-
* This method will strip a port from the host if it is present. Each pattern
|
211 |
-
* can be matched with an exact match (e.g., "foo.com" == "foo.com") or a
|
212 |
-
* partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" ==
|
213 |
-
* "baz.foo.com", but ".foo.com" != "foo.com").
|
214 |
-
*
|
215 |
-
* Areas are matched in the following cases:
|
216 |
-
* 1. "*" (without quotes) always matches any hosts.
|
217 |
-
* 2. An exact match.
|
218 |
-
* 3. The area starts with "." and the area is the last part of the host. e.g.
|
219 |
-
* '.mit.edu' will match any host that ends with '.mit.edu'.
|
220 |
-
*
|
221 |
-
* @param string $host Host to check against the patterns.
|
222 |
-
* @param string[] $noProxyArray An array of host patterns.
|
223 |
-
*
|
224 |
-
* @throws InvalidArgumentException
|
225 |
-
*/
|
226 |
-
public static function isHostInNoProxy(string $host, array $noProxyArray): bool
|
227 |
-
{
|
228 |
-
if (\strlen($host) === 0) {
|
229 |
-
throw new InvalidArgumentException('Empty host provided');
|
230 |
-
}
|
231 |
-
|
232 |
-
// Strip port if present.
|
233 |
-
if (\strpos($host, ':')) {
|
234 |
-
/** @var string[] $hostParts will never be false because of the checks above */
|
235 |
-
$hostParts = \explode($host, ':', 2);
|
236 |
-
$host = $hostParts[0];
|
237 |
-
}
|
238 |
-
|
239 |
-
foreach ($noProxyArray as $area) {
|
240 |
-
// Always match on wildcards.
|
241 |
-
if ($area === '*') {
|
242 |
-
return true;
|
243 |
-
} elseif (empty($area)) {
|
244 |
-
// Don't match on empty values.
|
245 |
-
continue;
|
246 |
-
} elseif ($area === $host) {
|
247 |
-
// Exact matches.
|
248 |
-
return true;
|
249 |
-
}
|
250 |
-
// Special match if the area when prefixed with ".". Remove any
|
251 |
-
// existing leading "." and add a new leading ".".
|
252 |
-
$area = '.' . \ltrim($area, '.');
|
253 |
-
if (\substr($host, -(\strlen($area))) === $area) {
|
254 |
-
return true;
|
255 |
-
}
|
256 |
-
}
|
257 |
-
|
258 |
-
return false;
|
259 |
-
}
|
260 |
-
|
261 |
-
/**
|
262 |
-
* Wrapper for json_decode that throws when an error occurs.
|
263 |
-
*
|
264 |
-
* @param string $json JSON data to parse
|
265 |
-
* @param bool $assoc When true, returned objects will be converted
|
266 |
-
* into associative arrays.
|
267 |
-
* @param int $depth User specified recursion depth.
|
268 |
-
* @param int $options Bitmask of JSON decode options.
|
269 |
-
*
|
270 |
-
* @return object|array|string|int|float|bool|null
|
271 |
-
*
|
272 |
-
* @throws InvalidArgumentException if the JSON cannot be decoded.
|
273 |
-
*
|
274 |
-
* @link https://www.php.net/manual/en/function.json-decode.php
|
275 |
-
*/
|
276 |
-
public static function jsonDecode(string $json, bool $assoc = false, int $depth = 512, int $options = 0)
|
277 |
-
{
|
278 |
-
$data = \json_decode($json, $assoc, $depth, $options);
|
279 |
-
if (\JSON_ERROR_NONE !== \json_last_error()) {
|
280 |
-
throw new InvalidArgumentException('json_decode error: ' . \json_last_error_msg());
|
281 |
-
}
|
282 |
-
|
283 |
-
return $data;
|
284 |
-
}
|
285 |
-
|
286 |
-
/**
|
287 |
-
* Wrapper for JSON encoding that throws when an error occurs.
|
288 |
-
*
|
289 |
-
* @param mixed $value The value being encoded
|
290 |
-
* @param int $options JSON encode option bitmask
|
291 |
-
* @param int $depth Set the maximum depth. Must be greater than zero.
|
292 |
-
*
|
293 |
-
* @throws InvalidArgumentException if the JSON cannot be encoded.
|
294 |
-
*
|
295 |
-
* @link https://www.php.net/manual/en/function.json-encode.php
|
296 |
-
*/
|
297 |
-
public static function jsonEncode($value, int $options = 0, int $depth = 512): string
|
298 |
-
{
|
299 |
-
$json = \json_encode($value, $options, $depth);
|
300 |
-
if (\JSON_ERROR_NONE !== \json_last_error()) {
|
301 |
-
throw new InvalidArgumentException('json_encode error: ' . \json_last_error_msg());
|
302 |
-
}
|
303 |
-
|
304 |
-
/** @var string */
|
305 |
-
return $json;
|
306 |
-
}
|
307 |
-
|
308 |
-
/**
|
309 |
-
* Wrapper for the hrtime() or microtime() functions
|
310 |
-
* (depending on the PHP version, one of the two is used)
|
311 |
-
*
|
312 |
-
* @return float UNIX timestamp
|
313 |
-
*
|
314 |
-
* @internal
|
315 |
-
*/
|
316 |
-
public static function currentTime(): float
|
317 |
-
{
|
318 |
-
return (float) \function_exists('hrtime') ? \hrtime(true) / 1e9 : \microtime(true);
|
319 |
-
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
* @throws InvalidArgumentException
|
323 |
-
*
|
324 |
-
* @internal
|
325 |
-
*/
|
326 |
-
public static function idnUriConvert(UriInterface $uri, int $options = 0): UriInterface
|
327 |
-
{
|
328 |
-
if ($uri->getHost()) {
|
329 |
-
$asciiHost = self::idnToAsci($uri->getHost(), $options, $info);
|
330 |
-
if ($asciiHost === false) {
|
331 |
-
$errorBitSet = $info['errors'] ?? 0;
|
332 |
-
|
333 |
-
$errorConstants = array_filter(array_keys(get_defined_constants()), static function ($name) {
|
334 |
-
return substr($name, 0, 11) === 'IDNA_ERROR_';
|
335 |
-
});
|
336 |
-
|
337 |
-
$errors = [];
|
338 |
-
foreach ($errorConstants as $errorConstant) {
|
339 |
-
if ($errorBitSet & constant($errorConstant)) {
|
340 |
-
$errors[] = $errorConstant;
|
341 |
-
}
|
342 |
-
}
|
343 |
-
|
344 |
-
$errorMessage = 'IDN conversion failed';
|
345 |
-
if ($errors) {
|
346 |
-
$errorMessage .= ' (errors: ' . implode(', ', $errors) . ')';
|
347 |
-
}
|
348 |
-
|
349 |
-
throw new InvalidArgumentException($errorMessage);
|
350 |
-
}
|
351 |
-
if ($uri->getHost() !== $asciiHost) {
|
352 |
-
// Replace URI only if the ASCII version is different
|
353 |
-
$uri = $uri->withHost($asciiHost);
|
354 |
-
}
|
355 |
-
}
|
356 |
-
|
357 |
-
return $uri;
|
358 |
-
}
|
359 |
-
|
360 |
-
/**
|
361 |
-
* @internal
|
362 |
-
*/
|
363 |
-
public static function getenv(string $name): ?string
|
364 |
-
{
|
365 |
-
if (isset($_SERVER[$name])) {
|
366 |
-
return (string) $_SERVER[$name];
|
367 |
-
}
|
368 |
-
|
369 |
-
if (\PHP_SAPI === 'cli' && ($value = \getenv($name)) !== false && $value !== null) {
|
370 |
-
return (string) $value;
|
371 |
-
}
|
372 |
-
|
373 |
-
return null;
|
374 |
-
}
|
375 |
-
|
376 |
-
/**
|
377 |
-
* @return string|false
|
378 |
-
*/
|
379 |
-
private static function idnToAsci(string $domain, int $options, ?array &$info = [])
|
380 |
-
{
|
381 |
-
if (\function_exists('idn_to_ascii') && \defined('INTL_IDNA_VARIANT_UTS46')) {
|
382 |
-
return \idn_to_ascii($domain, $options, \INTL_IDNA_VARIANT_UTS46, $info);
|
383 |
-
}
|
384 |
-
|
385 |
-
throw new \Error('ext-idn or symfony/polyfill-intl-idn not loaded or too old');
|
386 |
-
}
|
387 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/functions.php
DELETED
@@ -1,167 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Debug function used to describe the provided value type and class.
|
7 |
-
*
|
8 |
-
* @param mixed $input Any type of variable to describe the type of. This
|
9 |
-
* parameter misses a typehint because of that.
|
10 |
-
*
|
11 |
-
* @return string Returns a string containing the type of the variable and
|
12 |
-
* if a class is provided, the class name.
|
13 |
-
*
|
14 |
-
* @deprecated describe_type will be removed in guzzlehttp/guzzle:8.0. Use Utils::describeType instead.
|
15 |
-
*/
|
16 |
-
function describe_type($input): string
|
17 |
-
{
|
18 |
-
return Utils::describeType($input);
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Parses an array of header lines into an associative array of headers.
|
23 |
-
*
|
24 |
-
* @param iterable $lines Header lines array of strings in the following
|
25 |
-
* format: "Name: Value"
|
26 |
-
*
|
27 |
-
* @deprecated headers_from_lines will be removed in guzzlehttp/guzzle:8.0. Use Utils::headersFromLines instead.
|
28 |
-
*/
|
29 |
-
function headers_from_lines(iterable $lines): array
|
30 |
-
{
|
31 |
-
return Utils::headersFromLines($lines);
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Returns a debug stream based on the provided variable.
|
36 |
-
*
|
37 |
-
* @param mixed $value Optional value
|
38 |
-
*
|
39 |
-
* @return resource
|
40 |
-
*
|
41 |
-
* @deprecated debug_resource will be removed in guzzlehttp/guzzle:8.0. Use Utils::debugResource instead.
|
42 |
-
*/
|
43 |
-
function debug_resource($value = null)
|
44 |
-
{
|
45 |
-
return Utils::debugResource($value);
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Chooses and creates a default handler to use based on the environment.
|
50 |
-
*
|
51 |
-
* The returned handler is not wrapped by any default middlewares.
|
52 |
-
*
|
53 |
-
* @throws \RuntimeException if no viable Handler is available.
|
54 |
-
*
|
55 |
-
* @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system.
|
56 |
-
*
|
57 |
-
* @deprecated choose_handler will be removed in guzzlehttp/guzzle:8.0. Use Utils::chooseHandler instead.
|
58 |
-
*/
|
59 |
-
function choose_handler(): callable
|
60 |
-
{
|
61 |
-
return Utils::chooseHandler();
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Get the default User-Agent string to use with Guzzle.
|
66 |
-
*
|
67 |
-
* @deprecated default_user_agent will be removed in guzzlehttp/guzzle:8.0. Use Utils::defaultUserAgent instead.
|
68 |
-
*/
|
69 |
-
function default_user_agent(): string
|
70 |
-
{
|
71 |
-
return Utils::defaultUserAgent();
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Returns the default cacert bundle for the current system.
|
76 |
-
*
|
77 |
-
* First, the openssl.cafile and curl.cainfo php.ini settings are checked.
|
78 |
-
* If those settings are not configured, then the common locations for
|
79 |
-
* bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X
|
80 |
-
* and Windows are checked. If any of these file locations are found on
|
81 |
-
* disk, they will be utilized.
|
82 |
-
*
|
83 |
-
* Note: the result of this function is cached for subsequent calls.
|
84 |
-
*
|
85 |
-
* @throws \RuntimeException if no bundle can be found.
|
86 |
-
*
|
87 |
-
* @deprecated default_ca_bundle will be removed in guzzlehttp/guzzle:8.0. This function is not needed in PHP 5.6+.
|
88 |
-
*/
|
89 |
-
function default_ca_bundle(): string
|
90 |
-
{
|
91 |
-
return Utils::defaultCaBundle();
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Creates an associative array of lowercase header names to the actual
|
96 |
-
* header casing.
|
97 |
-
*
|
98 |
-
* @deprecated normalize_header_keys will be removed in guzzlehttp/guzzle:8.0. Use Utils::normalizeHeaderKeys instead.
|
99 |
-
*/
|
100 |
-
function normalize_header_keys(array $headers): array
|
101 |
-
{
|
102 |
-
return Utils::normalizeHeaderKeys($headers);
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Returns true if the provided host matches any of the no proxy areas.
|
107 |
-
*
|
108 |
-
* This method will strip a port from the host if it is present. Each pattern
|
109 |
-
* can be matched with an exact match (e.g., "foo.com" == "foo.com") or a
|
110 |
-
* partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" ==
|
111 |
-
* "baz.foo.com", but ".foo.com" != "foo.com").
|
112 |
-
*
|
113 |
-
* Areas are matched in the following cases:
|
114 |
-
* 1. "*" (without quotes) always matches any hosts.
|
115 |
-
* 2. An exact match.
|
116 |
-
* 3. The area starts with "." and the area is the last part of the host. e.g.
|
117 |
-
* '.mit.edu' will match any host that ends with '.mit.edu'.
|
118 |
-
*
|
119 |
-
* @param string $host Host to check against the patterns.
|
120 |
-
* @param string[] $noProxyArray An array of host patterns.
|
121 |
-
*
|
122 |
-
* @throws Exception\InvalidArgumentException
|
123 |
-
*
|
124 |
-
* @deprecated is_host_in_noproxy will be removed in guzzlehttp/guzzle:8.0. Use Utils::isHostInNoProxy instead.
|
125 |
-
*/
|
126 |
-
function is_host_in_noproxy(string $host, array $noProxyArray): bool
|
127 |
-
{
|
128 |
-
return Utils::isHostInNoProxy($host, $noProxyArray);
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Wrapper for json_decode that throws when an error occurs.
|
133 |
-
*
|
134 |
-
* @param string $json JSON data to parse
|
135 |
-
* @param bool $assoc When true, returned objects will be converted
|
136 |
-
* into associative arrays.
|
137 |
-
* @param int $depth User specified recursion depth.
|
138 |
-
* @param int $options Bitmask of JSON decode options.
|
139 |
-
*
|
140 |
-
* @return object|array|string|int|float|bool|null
|
141 |
-
*
|
142 |
-
* @throws Exception\InvalidArgumentException if the JSON cannot be decoded.
|
143 |
-
*
|
144 |
-
* @link https://www.php.net/manual/en/function.json-decode.php
|
145 |
-
* @deprecated json_decode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonDecode instead.
|
146 |
-
*/
|
147 |
-
function json_decode(string $json, bool $assoc = false, int $depth = 512, int $options = 0)
|
148 |
-
{
|
149 |
-
return Utils::jsonDecode($json, $assoc, $depth, $options);
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Wrapper for JSON encoding that throws when an error occurs.
|
154 |
-
*
|
155 |
-
* @param mixed $value The value being encoded
|
156 |
-
* @param int $options JSON encode option bitmask
|
157 |
-
* @param int $depth Set the maximum depth. Must be greater than zero.
|
158 |
-
*
|
159 |
-
* @throws Exception\InvalidArgumentException if the JSON cannot be encoded.
|
160 |
-
*
|
161 |
-
* @link https://www.php.net/manual/en/function.json-encode.php
|
162 |
-
* @deprecated json_encode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonEncode instead.
|
163 |
-
*/
|
164 |
-
function json_encode($value, int $options = 0, int $depth = 512): string
|
165 |
-
{
|
166 |
-
return Utils::jsonEncode($value, $options, $depth);
|
167 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/src/functions_include.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Don't redefine the functions if included multiple times.
|
4 |
-
if (!\function_exists('GuzzleHttp\describe_type')) {
|
5 |
-
require __DIR__ . '/functions.php';
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/.php_cs.dist
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$config = PhpCsFixer\Config::create()
|
4 |
-
->setRiskyAllowed(true)
|
5 |
-
->setRules([
|
6 |
-
'@PSR2' => true,
|
7 |
-
'array_syntax' => ['syntax' => 'short'],
|
8 |
-
'binary_operator_spaces' => ['operators' => ['=>' => null]],
|
9 |
-
'blank_line_after_opening_tag' => true,
|
10 |
-
'class_attributes_separation' => ['elements' => ['method']],
|
11 |
-
'compact_nullable_typehint' => true,
|
12 |
-
'concat_space' => ['spacing' => 'one'],
|
13 |
-
'declare_equal_normalize' => ['space' => 'none'],
|
14 |
-
'declare_strict_types' => false,
|
15 |
-
'dir_constant' => true,
|
16 |
-
'final_static_access' => true,
|
17 |
-
'fully_qualified_strict_types' => true,
|
18 |
-
'function_to_constant' => true,
|
19 |
-
'function_typehint_space' => true,
|
20 |
-
'header_comment' => false,
|
21 |
-
'is_null' => ['use_yoda_style' => false],
|
22 |
-
'list_syntax' => ['syntax' => 'short'],
|
23 |
-
'lowercase_cast' => true,
|
24 |
-
'magic_method_casing' => true,
|
25 |
-
'modernize_types_casting' => true,
|
26 |
-
'multiline_comment_opening_closing' => true,
|
27 |
-
//'native_constant_invocation' => true,
|
28 |
-
'no_alias_functions' => true,
|
29 |
-
'no_alternative_syntax' => true,
|
30 |
-
'no_blank_lines_after_phpdoc' => true,
|
31 |
-
'no_empty_comment' => true,
|
32 |
-
'no_empty_phpdoc' => true,
|
33 |
-
'no_extra_blank_lines' => true,
|
34 |
-
'no_leading_import_slash' => true,
|
35 |
-
'no_leading_namespace_whitespace' => true,
|
36 |
-
'no_spaces_around_offset' => true,
|
37 |
-
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
|
38 |
-
'no_trailing_comma_in_singleline_array' => true,
|
39 |
-
'no_unneeded_control_parentheses' => true,
|
40 |
-
'no_unset_cast' => true,
|
41 |
-
'no_unused_imports' => true,
|
42 |
-
'no_useless_else' => true,
|
43 |
-
'no_useless_return' => true,
|
44 |
-
'no_whitespace_in_blank_line' => true,
|
45 |
-
'normalize_index_brace' => true,
|
46 |
-
'ordered_imports' => true,
|
47 |
-
'php_unit_construct' => true,
|
48 |
-
'php_unit_dedicate_assert' => ['target' => 'newest'],
|
49 |
-
'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'],
|
50 |
-
'php_unit_expectation' => ['target' => 'newest'],
|
51 |
-
'php_unit_mock' => ['target' => 'newest'],
|
52 |
-
'php_unit_mock_short_will_return' => true,
|
53 |
-
'php_unit_no_expectation_annotation' => ['target' => 'newest'],
|
54 |
-
'php_unit_test_annotation' => ['style' => 'prefix'],
|
55 |
-
//'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
|
56 |
-
'phpdoc_align' => ['align' => 'vertical'],
|
57 |
-
//'phpdoc_line_span' => ['method' => 'multi', 'property' => 'multi'],
|
58 |
-
'phpdoc_no_package' => true,
|
59 |
-
'phpdoc_no_useless_inheritdoc' => true,
|
60 |
-
'phpdoc_scalar' => true,
|
61 |
-
'phpdoc_separation' => true,
|
62 |
-
'phpdoc_single_line_var_spacing' => true,
|
63 |
-
'phpdoc_trim' => true,
|
64 |
-
'phpdoc_trim_consecutive_blank_line_separation' => true,
|
65 |
-
'phpdoc_types' => true,
|
66 |
-
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
|
67 |
-
'phpdoc_var_without_name' => true,
|
68 |
-
'return_assignment' => true,
|
69 |
-
'short_scalar_cast' => true,
|
70 |
-
'single_trait_insert_per_statement' => true,
|
71 |
-
'standardize_not_equals' => true,
|
72 |
-
//'static_lambda' => true,
|
73 |
-
'ternary_to_null_coalescing' => true,
|
74 |
-
'trim_array_spaces' => true,
|
75 |
-
'visibility_required' => true,
|
76 |
-
'yoda_style' => false,
|
77 |
-
// 'native_function_invocation' => true,
|
78 |
-
'braces' => ['allow_single_line_closure'=>true],
|
79 |
-
])
|
80 |
-
->setFinder(
|
81 |
-
PhpCsFixer\Finder::create()
|
82 |
-
->in(__DIR__.'/src')
|
83 |
-
->in(__DIR__.'/tests')
|
84 |
-
->name('*.php')
|
85 |
-
)
|
86 |
-
;
|
87 |
-
|
88 |
-
return $config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/CHANGELOG.md
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
# CHANGELOG
|
2 |
-
|
3 |
-
|
4 |
-
## 1.4.0 - 2020-09-30
|
5 |
-
|
6 |
-
### Added
|
7 |
-
|
8 |
-
- Support for PHP 8
|
9 |
-
- Optional `$recursive` flag to `all`
|
10 |
-
- Replaced functions by static methods
|
11 |
-
|
12 |
-
### Fixed
|
13 |
-
|
14 |
-
- Fix empty `each` processing
|
15 |
-
- Fix promise handling for Iterators of non-unique keys
|
16 |
-
- Fixed `method_exists` crashes on PHP 8
|
17 |
-
- Memory leak on exceptions
|
18 |
-
|
19 |
-
|
20 |
-
## 1.3.1 - 2016-12-20
|
21 |
-
|
22 |
-
### Fixed
|
23 |
-
|
24 |
-
- `wait()` foreign promise compatibility
|
25 |
-
|
26 |
-
|
27 |
-
## 1.3.0 - 2016-11-18
|
28 |
-
|
29 |
-
### Added
|
30 |
-
|
31 |
-
- Adds support for custom task queues.
|
32 |
-
|
33 |
-
### Fixed
|
34 |
-
|
35 |
-
- Fixed coroutine promise memory leak.
|
36 |
-
|
37 |
-
|
38 |
-
## 1.2.0 - 2016-05-18
|
39 |
-
|
40 |
-
### Changed
|
41 |
-
|
42 |
-
- Update to now catch `\Throwable` on PHP 7+
|
43 |
-
|
44 |
-
|
45 |
-
## 1.1.0 - 2016-03-07
|
46 |
-
|
47 |
-
### Changed
|
48 |
-
|
49 |
-
- Update EachPromise to prevent recurring on a iterator when advancing, as this
|
50 |
-
could trigger fatal generator errors.
|
51 |
-
- Update Promise to allow recursive waiting without unwrapping exceptions.
|
52 |
-
|
53 |
-
|
54 |
-
## 1.0.3 - 2015-10-15
|
55 |
-
|
56 |
-
### Changed
|
57 |
-
|
58 |
-
- Update EachPromise to immediately resolve when the underlying promise iterator
|
59 |
-
is empty. Previously, such a promise would throw an exception when its `wait`
|
60 |
-
function was called.
|
61 |
-
|
62 |
-
|
63 |
-
## 1.0.2 - 2015-05-15
|
64 |
-
|
65 |
-
### Changed
|
66 |
-
|
67 |
-
- Conditionally require functions.php.
|
68 |
-
|
69 |
-
|
70 |
-
## 1.0.1 - 2015-06-24
|
71 |
-
|
72 |
-
### Changed
|
73 |
-
|
74 |
-
- Updating EachPromise to call next on the underlying promise iterator as late
|
75 |
-
as possible to ensure that generators that generate new requests based on
|
76 |
-
callbacks are not iterated until after callbacks are invoked.
|
77 |
-
|
78 |
-
|
79 |
-
## 1.0.0 - 2015-05-12
|
80 |
-
|
81 |
-
- Initial release
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
Copyright (c) 2015-2016 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
|
2 |
-
|
3 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
-
of this software and associated documentation files (the "Software"), to deal
|
5 |
-
in the Software without restriction, including without limitation the rights
|
6 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
-
copies of the Software, and to permit persons to whom the Software is
|
8 |
-
furnished to do so, subject to the following conditions:
|
9 |
-
|
10 |
-
The above copyright notice and this permission notice shall be included in
|
11 |
-
all copies or substantial portions of the Software.
|
12 |
-
|
13 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/Makefile
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
all: clean test
|
2 |
-
|
3 |
-
test:
|
4 |
-
vendor/bin/phpunit
|
5 |
-
|
6 |
-
coverage:
|
7 |
-
vendor/bin/phpunit --coverage-html=artifacts/coverage
|
8 |
-
|
9 |
-
view-coverage:
|
10 |
-
open artifacts/coverage/index.html
|
11 |
-
|
12 |
-
clean:
|
13 |
-
rm -rf artifacts/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/README.md
DELETED
@@ -1,532 +0,0 @@
|
|
1 |
-
# Guzzle Promises
|
2 |
-
|
3 |
-
[Promises/A+](https://promisesaplus.com/) implementation that handles promise
|
4 |
-
chaining and resolution iteratively, allowing for "infinite" promise chaining
|
5 |
-
while keeping the stack size constant. Read [this blog post](https://blog.domenic.me/youre-missing-the-point-of-promises/)
|
6 |
-
for a general introduction to promises.
|
7 |
-
|
8 |
-
- [Features](#features)
|
9 |
-
- [Quick start](#quick-start)
|
10 |
-
- [Synchronous wait](#synchronous-wait)
|
11 |
-
- [Cancellation](#cancellation)
|
12 |
-
- [API](#api)
|
13 |
-
- [Promise](#promise)
|
14 |
-
- [FulfilledPromise](#fulfilledpromise)
|
15 |
-
- [RejectedPromise](#rejectedpromise)
|
16 |
-
- [Promise interop](#promise-interop)
|
17 |
-
- [Implementation notes](#implementation-notes)
|
18 |
-
|
19 |
-
|
20 |
-
# Features
|
21 |
-
|
22 |
-
- [Promises/A+](https://promisesaplus.com/) implementation.
|
23 |
-
- Promise resolution and chaining is handled iteratively, allowing for
|
24 |
-
"infinite" promise chaining.
|
25 |
-
- Promises have a synchronous `wait` method.
|
26 |
-
- Promises can be cancelled.
|
27 |
-
- Works with any object that has a `then` function.
|
28 |
-
- C# style async/await coroutine promises using
|
29 |
-
`GuzzleHttp\Promise\Coroutine::of()`.
|
30 |
-
|
31 |
-
|
32 |
-
# Quick start
|
33 |
-
|
34 |
-
A *promise* represents the eventual result of an asynchronous operation. The
|
35 |
-
primary way of interacting with a promise is through its `then` method, which
|
36 |
-
registers callbacks to receive either a promise's eventual value or the reason
|
37 |
-
why the promise cannot be fulfilled.
|
38 |
-
|
39 |
-
|
40 |
-
## Callbacks
|
41 |
-
|
42 |
-
Callbacks are registered with the `then` method by providing an optional
|
43 |
-
`$onFulfilled` followed by an optional `$onRejected` function.
|
44 |
-
|
45 |
-
|
46 |
-
```php
|
47 |
-
use GuzzleHttp\Promise\Promise;
|
48 |
-
|
49 |
-
$promise = new Promise();
|
50 |
-
$promise->then(
|
51 |
-
// $onFulfilled
|
52 |
-
function ($value) {
|
53 |
-
echo 'The promise was fulfilled.';
|
54 |
-
},
|
55 |
-
// $onRejected
|
56 |
-
function ($reason) {
|
57 |
-
echo 'The promise was rejected.';
|
58 |
-
}
|
59 |
-
);
|
60 |
-
```
|
61 |
-
|
62 |
-
*Resolving* a promise means that you either fulfill a promise with a *value* or
|
63 |
-
reject a promise with a *reason*. Resolving a promises triggers callbacks
|
64 |
-
registered with the promises's `then` method. These callbacks are triggered
|
65 |
-
only once and in the order in which they were added.
|
66 |
-
|
67 |
-
|
68 |
-
## Resolving a promise
|
69 |
-
|
70 |
-
Promises are fulfilled using the `resolve($value)` method. Resolving a promise
|
71 |
-
with any value other than a `GuzzleHttp\Promise\RejectedPromise` will trigger
|
72 |
-
all of the onFulfilled callbacks (resolving a promise with a rejected promise
|
73 |
-
will reject the promise and trigger the `$onRejected` callbacks).
|
74 |
-
|
75 |
-
```php
|
76 |
-
use GuzzleHttp\Promise\Promise;
|
77 |
-
|
78 |
-
$promise = new Promise();
|
79 |
-
$promise
|
80 |
-
->then(function ($value) {
|
81 |
-
// Return a value and don't break the chain
|
82 |
-
return "Hello, " . $value;
|
83 |
-
})
|
84 |
-
// This then is executed after the first then and receives the value
|
85 |
-
// returned from the first then.
|
86 |
-
->then(function ($value) {
|
87 |
-
echo $value;
|
88 |
-
});
|
89 |
-
|
90 |
-
// Resolving the promise triggers the $onFulfilled callbacks and outputs
|
91 |
-
// "Hello, reader."
|
92 |
-
$promise->resolve('reader.');
|
93 |
-
```
|
94 |
-
|
95 |
-
|
96 |
-
## Promise forwarding
|
97 |
-
|
98 |
-
Promises can be chained one after the other. Each then in the chain is a new
|
99 |
-
promise. The return value of a promise is what's forwarded to the next
|
100 |
-
promise in the chain. Returning a promise in a `then` callback will cause the
|
101 |
-
subsequent promises in the chain to only be fulfilled when the returned promise
|
102 |
-
has been fulfilled. The next promise in the chain will be invoked with the
|
103 |
-
resolved value of the promise.
|
104 |
-
|
105 |
-
```php
|
106 |
-
use GuzzleHttp\Promise\Promise;
|
107 |
-
|
108 |
-
$promise = new Promise();
|
109 |
-
$nextPromise = new Promise();
|
110 |
-
|
111 |
-
$promise
|
112 |
-
->then(function ($value) use ($nextPromise) {
|
113 |
-
echo $value;
|
114 |
-
return $nextPromise;
|
115 |
-
})
|
116 |
-
->then(function ($value) {
|
117 |
-
echo $value;
|
118 |
-
});
|
119 |
-
|
120 |
-
// Triggers the first callback and outputs "A"
|
121 |
-
$promise->resolve('A');
|
122 |
-
// Triggers the second callback and outputs "B"
|
123 |
-
$nextPromise->resolve('B');
|
124 |
-
```
|
125 |
-
|
126 |
-
## Promise rejection
|
127 |
-
|
128 |
-
When a promise is rejected, the `$onRejected` callbacks are invoked with the
|
129 |
-
rejection reason.
|
130 |
-
|
131 |
-
```php
|
132 |
-
use GuzzleHttp\Promise\Promise;
|
133 |
-
|
134 |
-
$promise = new Promise();
|
135 |
-
$promise->then(null, function ($reason) {
|
136 |
-
echo $reason;
|
137 |
-
});
|
138 |
-
|
139 |
-
$promise->reject('Error!');
|
140 |
-
// Outputs "Error!"
|
141 |
-
```
|
142 |
-
|
143 |
-
## Rejection forwarding
|
144 |
-
|
145 |
-
If an exception is thrown in an `$onRejected` callback, subsequent
|
146 |
-
`$onRejected` callbacks are invoked with the thrown exception as the reason.
|
147 |
-
|
148 |
-
```php
|
149 |
-
use GuzzleHttp\Promise\Promise;
|
150 |
-
|
151 |
-
$promise = new Promise();
|
152 |
-
$promise->then(null, function ($reason) {
|
153 |
-
throw new Exception($reason);
|
154 |
-
})->then(null, function ($reason) {
|
155 |
-
assert($reason->getMessage() === 'Error!');
|
156 |
-
});
|
157 |
-
|
158 |
-
$promise->reject('Error!');
|
159 |
-
```
|
160 |
-
|
161 |
-
You can also forward a rejection down the promise chain by returning a
|
162 |
-
`GuzzleHttp\Promise\RejectedPromise` in either an `$onFulfilled` or
|
163 |
-
`$onRejected` callback.
|
164 |
-
|
165 |
-
```php
|
166 |
-
use GuzzleHttp\Promise\Promise;
|
167 |
-
use GuzzleHttp\Promise\RejectedPromise;
|
168 |
-
|
169 |
-
$promise = new Promise();
|
170 |
-
$promise->then(null, function ($reason) {
|
171 |
-
return new RejectedPromise($reason);
|
172 |
-
})->then(null, function ($reason) {
|
173 |
-
assert($reason === 'Error!');
|
174 |
-
});
|
175 |
-
|
176 |
-
$promise->reject('Error!');
|
177 |
-
```
|
178 |
-
|
179 |
-
If an exception is not thrown in a `$onRejected` callback and the callback
|
180 |
-
does not return a rejected promise, downstream `$onFulfilled` callbacks are
|
181 |
-
invoked using the value returned from the `$onRejected` callback.
|
182 |
-
|
183 |
-
```php
|
184 |
-
use GuzzleHttp\Promise\Promise;
|
185 |
-
|
186 |
-
$promise = new Promise();
|
187 |
-
$promise
|
188 |
-
->then(null, function ($reason) {
|
189 |
-
return "It's ok";
|
190 |
-
})
|
191 |
-
->then(function ($value) {
|
192 |
-
assert($value === "It's ok");
|
193 |
-
});
|
194 |
-
|
195 |
-
$promise->reject('Error!');
|
196 |
-
```
|
197 |
-
|
198 |
-
# Synchronous wait
|
199 |
-
|
200 |
-
You can synchronously force promises to complete using a promise's `wait`
|
201 |
-
method. When creating a promise, you can provide a wait function that is used
|
202 |
-
to synchronously force a promise to complete. When a wait function is invoked
|
203 |
-
it is expected to deliver a value to the promise or reject the promise. If the
|
204 |
-
wait function does not deliver a value, then an exception is thrown. The wait
|
205 |
-
function provided to a promise constructor is invoked when the `wait` function
|
206 |
-
of the promise is called.
|
207 |
-
|
208 |
-
```php
|
209 |
-
$promise = new Promise(function () use (&$promise) {
|
210 |
-
$promise->resolve('foo');
|
211 |
-
});
|
212 |
-
|
213 |
-
// Calling wait will return the value of the promise.
|
214 |
-
echo $promise->wait(); // outputs "foo"
|
215 |
-
```
|
216 |
-
|
217 |
-
If an exception is encountered while invoking the wait function of a promise,
|
218 |
-
the promise is rejected with the exception and the exception is thrown.
|
219 |
-
|
220 |
-
```php
|
221 |
-
$promise = new Promise(function () use (&$promise) {
|
222 |
-
throw new Exception('foo');
|
223 |
-
});
|
224 |
-
|
225 |
-
$promise->wait(); // throws the exception.
|
226 |
-
```
|
227 |
-
|
228 |
-
Calling `wait` on a promise that has been fulfilled will not trigger the wait
|
229 |
-
function. It will simply return the previously resolved value.
|
230 |
-
|
231 |
-
```php
|
232 |
-
$promise = new Promise(function () { die('this is not called!'); });
|
233 |
-
$promise->resolve('foo');
|
234 |
-
echo $promise->wait(); // outputs "foo"
|
235 |
-
```
|
236 |
-
|
237 |
-
Calling `wait` on a promise that has been rejected will throw an exception. If
|
238 |
-
the rejection reason is an instance of `\Exception` the reason is thrown.
|
239 |
-
Otherwise, a `GuzzleHttp\Promise\RejectionException` is thrown and the reason
|
240 |
-
can be obtained by calling the `getReason` method of the exception.
|
241 |
-
|
242 |
-
```php
|
243 |
-
$promise = new Promise();
|
244 |
-
$promise->reject('foo');
|
245 |
-
$promise->wait();
|
246 |
-
```
|
247 |
-
|
248 |
-
> PHP Fatal error: Uncaught exception 'GuzzleHttp\Promise\RejectionException' with message 'The promise was rejected with value: foo'
|
249 |
-
|
250 |
-
|
251 |
-
## Unwrapping a promise
|
252 |
-
|
253 |
-
When synchronously waiting on a promise, you are joining the state of the
|
254 |
-
promise into the current state of execution (i.e., return the value of the
|
255 |
-
promise if it was fulfilled or throw an exception if it was rejected). This is
|
256 |
-
called "unwrapping" the promise. Waiting on a promise will by default unwrap
|
257 |
-
the promise state.
|
258 |
-
|
259 |
-
You can force a promise to resolve and *not* unwrap the state of the promise
|
260 |
-
by passing `false` to the first argument of the `wait` function:
|
261 |
-
|
262 |
-
```php
|
263 |
-
$promise = new Promise();
|
264 |
-
$promise->reject('foo');
|
265 |
-
// This will not throw an exception. It simply ensures the promise has
|
266 |
-
// been resolved.
|
267 |
-
$promise->wait(false);
|
268 |
-
```
|
269 |
-
|
270 |
-
When unwrapping a promise, the resolved value of the promise will be waited
|
271 |
-
upon until the unwrapped value is not a promise. This means that if you resolve
|
272 |
-
promise A with a promise B and unwrap promise A, the value returned by the
|
273 |
-
wait function will be the value delivered to promise B.
|
274 |
-
|
275 |
-
**Note**: when you do not unwrap the promise, no value is returned.
|
276 |
-
|
277 |
-
|
278 |
-
# Cancellation
|
279 |
-
|
280 |
-
You can cancel a promise that has not yet been fulfilled using the `cancel()`
|
281 |
-
method of a promise. When creating a promise you can provide an optional
|
282 |
-
cancel function that when invoked cancels the action of computing a resolution
|
283 |
-
of the promise.
|
284 |
-
|
285 |
-
|
286 |
-
# API
|
287 |
-
|
288 |
-
|
289 |
-
## Promise
|
290 |
-
|
291 |
-
When creating a promise object, you can provide an optional `$waitFn` and
|
292 |
-
`$cancelFn`. `$waitFn` is a function that is invoked with no arguments and is
|
293 |
-
expected to resolve the promise. `$cancelFn` is a function with no arguments
|
294 |
-
that is expected to cancel the computation of a promise. It is invoked when the
|
295 |
-
`cancel()` method of a promise is called.
|
296 |
-
|
297 |
-
```php
|
298 |
-
use GuzzleHttp\Promise\Promise;
|
299 |
-
|
300 |
-
$promise = new Promise(
|
301 |
-
function () use (&$promise) {
|
302 |
-
$promise->resolve('waited');
|
303 |
-
},
|
304 |
-
function () {
|
305 |
-
// do something that will cancel the promise computation (e.g., close
|
306 |
-
// a socket, cancel a database query, etc...)
|
307 |
-
}
|
308 |
-
);
|
309 |
-
|
310 |
-
assert('waited' === $promise->wait());
|
311 |
-
```
|
312 |
-
|
313 |
-
A promise has the following methods:
|
314 |
-
|
315 |
-
- `then(callable $onFulfilled, callable $onRejected) : PromiseInterface`
|
316 |
-
|
317 |
-
Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.
|
318 |
-
|
319 |
-
- `otherwise(callable $onRejected) : PromiseInterface`
|
320 |
-
|
321 |
-
Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled.
|
322 |
-
|
323 |
-
- `wait($unwrap = true) : mixed`
|
324 |
-
|
325 |
-
Synchronously waits on the promise to complete.
|
326 |
-
|
327 |
-
`$unwrap` controls whether or not the value of the promise is returned for a
|
328 |
-
fulfilled promise or if an exception is thrown if the promise is rejected.
|
329 |
-
This is set to `true` by default.
|
330 |
-
|
331 |
-
- `cancel()`
|
332 |
-
|
333 |
-
Attempts to cancel the promise if possible. The promise being cancelled and
|
334 |
-
the parent most ancestor that has not yet been resolved will also be
|
335 |
-
cancelled. Any promises waiting on the cancelled promise to resolve will also
|
336 |
-
be cancelled.
|
337 |
-
|
338 |
-
- `getState() : string`
|
339 |
-
|
340 |
-
Returns the state of the promise. One of `pending`, `fulfilled`, or
|
341 |
-
`rejected`.
|
342 |
-
|
343 |
-
- `resolve($value)`
|
344 |
-
|
345 |
-
Fulfills the promise with the given `$value`.
|
346 |
-
|
347 |
-
- `reject($reason)`
|
348 |
-
|
349 |
-
Rejects the promise with the given `$reason`.
|
350 |
-
|
351 |
-
|
352 |
-
## FulfilledPromise
|
353 |
-
|
354 |
-
A fulfilled promise can be created to represent a promise that has been
|
355 |
-
fulfilled.
|
356 |
-
|
357 |
-
```php
|
358 |
-
use GuzzleHttp\Promise\FulfilledPromise;
|
359 |
-
|
360 |
-
$promise = new FulfilledPromise('value');
|
361 |
-
|
362 |
-
// Fulfilled callbacks are immediately invoked.
|
363 |
-
$promise->then(function ($value) {
|
364 |
-
echo $value;
|
365 |
-
});
|
366 |
-
```
|
367 |
-
|
368 |
-
|
369 |
-
## RejectedPromise
|
370 |
-
|
371 |
-
A rejected promise can be created to represent a promise that has been
|
372 |
-
rejected.
|
373 |
-
|
374 |
-
```php
|
375 |
-
use GuzzleHttp\Promise\RejectedPromise;
|
376 |
-
|
377 |
-
$promise = new RejectedPromise('Error');
|
378 |
-
|
379 |
-
// Rejected callbacks are immediately invoked.
|
380 |
-
$promise->then(null, function ($reason) {
|
381 |
-
echo $reason;
|
382 |
-
});
|
383 |
-
```
|
384 |
-
|
385 |
-
|
386 |
-
# Promise interop
|
387 |
-
|
388 |
-
This library works with foreign promises that have a `then` method. This means
|
389 |
-
you can use Guzzle promises with [React promises](https://github.com/reactphp/promise)
|
390 |
-
for example. When a foreign promise is returned inside of a then method
|
391 |
-
callback, promise resolution will occur recursively.
|
392 |
-
|
393 |
-
```php
|
394 |
-
// Create a React promise
|
395 |
-
$deferred = new React\Promise\Deferred();
|
396 |
-
$reactPromise = $deferred->promise();
|
397 |
-
|
398 |
-
// Create a Guzzle promise that is fulfilled with a React promise.
|
399 |
-
$guzzlePromise = new GuzzleHttp\Promise\Promise();
|
400 |
-
$guzzlePromise->then(function ($value) use ($reactPromise) {
|
401 |
-
// Do something something with the value...
|
402 |
-
// Return the React promise
|
403 |
-
return $reactPromise;
|
404 |
-
});
|
405 |
-
```
|
406 |
-
|
407 |
-
Please note that wait and cancel chaining is no longer possible when forwarding
|
408 |
-
a foreign promise. You will need to wrap a third-party promise with a Guzzle
|
409 |
-
promise in order to utilize wait and cancel functions with foreign promises.
|
410 |
-
|
411 |
-
|
412 |
-
## Event Loop Integration
|
413 |
-
|
414 |
-
In order to keep the stack size constant, Guzzle promises are resolved
|
415 |
-
asynchronously using a task queue. When waiting on promises synchronously, the
|
416 |
-
task queue will be automatically run to ensure that the blocking promise and
|
417 |
-
any forwarded promises are resolved. When using promises asynchronously in an
|
418 |
-
event loop, you will need to run the task queue on each tick of the loop. If
|
419 |
-
you do not run the task queue, then promises will not be resolved.
|
420 |
-
|
421 |
-
You can run the task queue using the `run()` method of the global task queue
|
422 |
-
instance.
|
423 |
-
|
424 |
-
```php
|
425 |
-
// Get the global task queue
|
426 |
-
$queue = GuzzleHttp\Promise\Utils::queue();
|
427 |
-
$queue->run();
|
428 |
-
```
|
429 |
-
|
430 |
-
For example, you could use Guzzle promises with React using a periodic timer:
|
431 |
-
|
432 |
-
```php
|
433 |
-
$loop = React\EventLoop\Factory::create();
|
434 |
-
$loop->addPeriodicTimer(0, [$queue, 'run']);
|
435 |
-
```
|
436 |
-
|
437 |
-
*TODO*: Perhaps adding a `futureTick()` on each tick would be faster?
|
438 |
-
|
439 |
-
|
440 |
-
# Implementation notes
|
441 |
-
|
442 |
-
|
443 |
-
## Promise resolution and chaining is handled iteratively
|
444 |
-
|
445 |
-
By shuffling pending handlers from one owner to another, promises are
|
446 |
-
resolved iteratively, allowing for "infinite" then chaining.
|
447 |
-
|
448 |
-
```php
|
449 |
-
<?php
|
450 |
-
require 'vendor/autoload.php';
|
451 |
-
|
452 |
-
use GuzzleHttp\Promise\Promise;
|
453 |
-
|
454 |
-
$parent = new Promise();
|
455 |
-
$p = $parent;
|
456 |
-
|
457 |
-
for ($i = 0; $i < 1000; $i++) {
|
458 |
-
$p = $p->then(function ($v) {
|
459 |
-
// The stack size remains constant (a good thing)
|
460 |
-
echo xdebug_get_stack_depth() . ', ';
|
461 |
-
return $v + 1;
|
462 |
-
});
|
463 |
-
}
|
464 |
-
|
465 |
-
$parent->resolve(0);
|
466 |
-
var_dump($p->wait()); // int(1000)
|
467 |
-
|
468 |
-
```
|
469 |
-
|
470 |
-
When a promise is fulfilled or rejected with a non-promise value, the promise
|
471 |
-
then takes ownership of the handlers of each child promise and delivers values
|
472 |
-
down the chain without using recursion.
|
473 |
-
|
474 |
-
When a promise is resolved with another promise, the original promise transfers
|
475 |
-
all of its pending handlers to the new promise. When the new promise is
|
476 |
-
eventually resolved, all of the pending handlers are delivered the forwarded
|
477 |
-
value.
|
478 |
-
|
479 |
-
|
480 |
-
## A promise is the deferred.
|
481 |
-
|
482 |
-
Some promise libraries implement promises using a deferred object to represent
|
483 |
-
a computation and a promise object to represent the delivery of the result of
|
484 |
-
the computation. This is a nice separation of computation and delivery because
|
485 |
-
consumers of the promise cannot modify the value that will be eventually
|
486 |
-
delivered.
|
487 |
-
|
488 |
-
One side effect of being able to implement promise resolution and chaining
|
489 |
-
iteratively is that you need to be able for one promise to reach into the state
|
490 |
-
of another promise to shuffle around ownership of handlers. In order to achieve
|
491 |
-
this without making the handlers of a promise publicly mutable, a promise is
|
492 |
-
also the deferred value, allowing promises of the same parent class to reach
|
493 |
-
into and modify the private properties of promises of the same type. While this
|
494 |
-
does allow consumers of the value to modify the resolution or rejection of the
|
495 |
-
deferred, it is a small price to pay for keeping the stack size constant.
|
496 |
-
|
497 |
-
```php
|
498 |
-
$promise = new Promise();
|
499 |
-
$promise->then(function ($value) { echo $value; });
|
500 |
-
// The promise is the deferred value, so you can deliver a value to it.
|
501 |
-
$promise->resolve('foo');
|
502 |
-
// prints "foo"
|
503 |
-
```
|
504 |
-
|
505 |
-
|
506 |
-
## Upgrading from Function API
|
507 |
-
|
508 |
-
A static API was first introduced in 1.4.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API will be removed in 2.0.0. A migration table has been provided here for your convenience:
|
509 |
-
|
510 |
-
| Original Function | Replacement Method |
|
511 |
-
|----------------|----------------|
|
512 |
-
| `queue` | `Utils::queue` |
|
513 |
-
| `task` | `Utils::task` |
|
514 |
-
| `promise_for` | `Create::promiseFor` |
|
515 |
-
| `rejection_for` | `Create::rejectionFor` |
|
516 |
-
| `exception_for` | `Create::exceptionFor` |
|
517 |
-
| `iter_for` | `Create::iterFor` |
|
518 |
-
| `inspect` | `Utils::inspect` |
|
519 |
-
| `inspect_all` | `Utils::inspectAll` |
|
520 |
-
| `unwrap` | `Utils::unwrap` |
|
521 |
-
| `all` | `Utils::all` |
|
522 |
-
| `some` | `Utils::some` |
|
523 |
-
| `any` | `Utils::any` |
|
524 |
-
| `settle` | `Utils::settle` |
|
525 |
-
| `each` | `Each::of` |
|
526 |
-
| `each_limit` | `Each::ofLimit` |
|
527 |
-
| `each_limit_all` | `Each::ofLimitAll` |
|
528 |
-
| `!is_fulfilled` | `Is::pending` |
|
529 |
-
| `is_fulfilled` | `Is::fulfilled` |
|
530 |
-
| `is_rejected` | `Is::rejected` |
|
531 |
-
| `is_settled` | `Is::settled` |
|
532 |
-
| `coroutine` | `Coroutine::of` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/composer.json
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "guzzlehttp/promises",
|
3 |
-
"description": "Guzzle promises library",
|
4 |
-
"keywords": ["promise"],
|
5 |
-
"license": "MIT",
|
6 |
-
"authors": [
|
7 |
-
{
|
8 |
-
"name": "Michael Dowling",
|
9 |
-
"email": "mtdowling@gmail.com",
|
10 |
-
"homepage": "https://github.com/mtdowling"
|
11 |
-
}
|
12 |
-
],
|
13 |
-
"require": {
|
14 |
-
"php": ">=5.5"
|
15 |
-
},
|
16 |
-
"require-dev": {
|
17 |
-
"symfony/phpunit-bridge": "^4.4 || ^5.1"
|
18 |
-
},
|
19 |
-
"autoload": {
|
20 |
-
"psr-4": {
|
21 |
-
"GuzzleHttp\\Promise\\": "src/"
|
22 |
-
},
|
23 |
-
"files": ["src/functions_include.php"]
|
24 |
-
},
|
25 |
-
"autoload-dev": {
|
26 |
-
"psr-4": {
|
27 |
-
"GuzzleHttp\\Promise\\Tests\\": "tests/"
|
28 |
-
}
|
29 |
-
},
|
30 |
-
"scripts": {
|
31 |
-
"test": "vendor/bin/simple-phpunit",
|
32 |
-
"test-ci": "vendor/bin/simple-phpunit --coverage-text"
|
33 |
-
},
|
34 |
-
"extra": {
|
35 |
-
"branch-alias": {
|
36 |
-
"dev-master": "1.4-dev"
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/phpstan-baseline.neon
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
parameters:
|
2 |
-
ignoreErrors:
|
3 |
-
-
|
4 |
-
message: "#^Parameter \\#1 \\$function of function register_shutdown_function expects callable\\(\\)\\: void, Closure\\(\\)\\: mixed given\\.$#"
|
5 |
-
count: 1
|
6 |
-
path: src/TaskQueue.php
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/phpstan.neon.dist
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
includes:
|
2 |
-
- phpstan-baseline.neon
|
3 |
-
|
4 |
-
parameters:
|
5 |
-
level: 5
|
6 |
-
paths:
|
7 |
-
- src
|
8 |
-
|
9 |
-
ignoreErrors:
|
10 |
-
- "#^Dead catch - Exception is already caught by Throwable above\\.$#"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/psalm.xml
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<psalm
|
3 |
-
errorLevel="4"
|
4 |
-
resolveFromConfigFile="true"
|
5 |
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
6 |
-
xmlns="https://getpsalm.org/schema/config"
|
7 |
-
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
8 |
-
>
|
9 |
-
<projectFiles>
|
10 |
-
<directory name="src" />
|
11 |
-
<ignoreFiles>
|
12 |
-
<directory name="vendor" />
|
13 |
-
</ignoreFiles>
|
14 |
-
</projectFiles>
|
15 |
-
</psalm>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/AggregateException.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Exception thrown when too many errors occur in the some() or any() methods.
|
7 |
-
*/
|
8 |
-
class AggregateException extends RejectionException
|
9 |
-
{
|
10 |
-
public function __construct($msg, array $reasons)
|
11 |
-
{
|
12 |
-
parent::__construct(
|
13 |
-
$reasons,
|
14 |
-
sprintf('%s; %d rejected promises', $msg, count($reasons))
|
15 |
-
);
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/CancellationException.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Exception that is set as the reason for a promise that has been cancelled.
|
7 |
-
*/
|
8 |
-
class CancellationException extends RejectionException
|
9 |
-
{
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/Coroutine.php
DELETED
@@ -1,169 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
use Exception;
|
6 |
-
use Generator;
|
7 |
-
use Throwable;
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Creates a promise that is resolved using a generator that yields values or
|
11 |
-
* promises (somewhat similar to C#'s async keyword).
|
12 |
-
*
|
13 |
-
* When called, the Coroutine::of method will start an instance of the generator
|
14 |
-
* and returns a promise that is fulfilled with its final yielded value.
|
15 |
-
*
|
16 |
-
* Control is returned back to the generator when the yielded promise settles.
|
17 |
-
* This can lead to less verbose code when doing lots of sequential async calls
|
18 |
-
* with minimal processing in between.
|
19 |
-
*
|
20 |
-
* use GuzzleHttp\Promise;
|
21 |
-
*
|
22 |
-
* function createPromise($value) {
|
23 |
-
* return new Promise\FulfilledPromise($value);
|
24 |
-
* }
|
25 |
-
*
|
26 |
-
* $promise = Promise\Coroutine::of(function () {
|
27 |
-
* $value = (yield createPromise('a'));
|
28 |
-
* try {
|
29 |
-
* $value = (yield createPromise($value . 'b'));
|
30 |
-
* } catch (\Exception $e) {
|
31 |
-
* // The promise was rejected.
|
32 |
-
* }
|
33 |
-
* yield $value . 'c';
|
34 |
-
* });
|
35 |
-
*
|
36 |
-
* // Outputs "abc"
|
37 |
-
* $promise->then(function ($v) { echo $v; });
|
38 |
-
*
|
39 |
-
* @param callable $generatorFn Generator function to wrap into a promise.
|
40 |
-
*
|
41 |
-
* @return Promise
|
42 |
-
*
|
43 |
-
* @link https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration
|
44 |
-
*/
|
45 |
-
final class Coroutine implements PromiseInterface
|
46 |
-
{
|
47 |
-
/**
|
48 |
-
* @var PromiseInterface|null
|
49 |
-
*/
|
50 |
-
private $currentPromise;
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @var Generator
|
54 |
-
*/
|
55 |
-
private $generator;
|
56 |
-
|
57 |
-
/**
|
58 |
-
* @var Promise
|
59 |
-
*/
|
60 |
-
private $result;
|
61 |
-
|
62 |
-
public function __construct(callable $generatorFn)
|
63 |
-
{
|
64 |
-
$this->generator = $generatorFn();
|
65 |
-
$this->result = new Promise(function () {
|
66 |
-
while (isset($this->currentPromise)) {
|
67 |
-
$this->currentPromise->wait();
|
68 |
-
}
|
69 |
-
});
|
70 |
-
try {
|
71 |
-
$this->nextCoroutine($this->generator->current());
|
72 |
-
} catch (\Exception $exception) {
|
73 |
-
$this->result->reject($exception);
|
74 |
-
} catch (Throwable $throwable) {
|
75 |
-
$this->result->reject($throwable);
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Create a new coroutine.
|
81 |
-
*
|
82 |
-
* @return self
|
83 |
-
*/
|
84 |
-
public static function of(callable $generatorFn)
|
85 |
-
{
|
86 |
-
return new self($generatorFn);
|
87 |
-
}
|
88 |
-
|
89 |
-
public function then(
|
90 |
-
callable $onFulfilled = null,
|
91 |
-
callable $onRejected = null
|
92 |
-
) {
|
93 |
-
return $this->result->then($onFulfilled, $onRejected);
|
94 |
-
}
|
95 |
-
|
96 |
-
public function otherwise(callable $onRejected)
|
97 |
-
{
|
98 |
-
return $this->result->otherwise($onRejected);
|
99 |
-
}
|
100 |
-
|
101 |
-
public function wait($unwrap = true)
|
102 |
-
{
|
103 |
-
return $this->result->wait($unwrap);
|
104 |
-
}
|
105 |
-
|
106 |
-
public function getState()
|
107 |
-
{
|
108 |
-
return $this->result->getState();
|
109 |
-
}
|
110 |
-
|
111 |
-
public function resolve($value)
|
112 |
-
{
|
113 |
-
$this->result->resolve($value);
|
114 |
-
}
|
115 |
-
|
116 |
-
public function reject($reason)
|
117 |
-
{
|
118 |
-
$this->result->reject($reason);
|
119 |
-
}
|
120 |
-
|
121 |
-
public function cancel()
|
122 |
-
{
|
123 |
-
$this->currentPromise->cancel();
|
124 |
-
$this->result->cancel();
|
125 |
-
}
|
126 |
-
|
127 |
-
private function nextCoroutine($yielded)
|
128 |
-
{
|
129 |
-
$this->currentPromise = Create::promiseFor($yielded)
|
130 |
-
->then([$this, '_handleSuccess'], [$this, '_handleFailure']);
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* @internal
|
135 |
-
*/
|
136 |
-
public function _handleSuccess($value)
|
137 |
-
{
|
138 |
-
unset($this->currentPromise);
|
139 |
-
try {
|
140 |
-
$next = $this->generator->send($value);
|
141 |
-
if ($this->generator->valid()) {
|
142 |
-
$this->nextCoroutine($next);
|
143 |
-
} else {
|
144 |
-
$this->result->resolve($value);
|
145 |
-
}
|
146 |
-
} catch (Exception $exception) {
|
147 |
-
$this->result->reject($exception);
|
148 |
-
} catch (Throwable $throwable) {
|
149 |
-
$this->result->reject($throwable);
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* @internal
|
155 |
-
*/
|
156 |
-
public function _handleFailure($reason)
|
157 |
-
{
|
158 |
-
unset($this->currentPromise);
|
159 |
-
try {
|
160 |
-
$nextYield = $this->generator->throw(Create::exceptionFor($reason));
|
161 |
-
// The throw was caught, so keep iterating on the coroutine
|
162 |
-
$this->nextCoroutine($nextYield);
|
163 |
-
} catch (Exception $exception) {
|
164 |
-
$this->result->reject($exception);
|
165 |
-
} catch (Throwable $throwable) {
|
166 |
-
$this->result->reject($throwable);
|
167 |
-
}
|
168 |
-
}
|
169 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/Create.php
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
final class Create
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Creates a promise for a value if the value is not a promise.
|
9 |
-
*
|
10 |
-
* @param mixed $value Promise or value.
|
11 |
-
*
|
12 |
-
* @return PromiseInterface
|
13 |
-
*/
|
14 |
-
public static function promiseFor($value)
|
15 |
-
{
|
16 |
-
if ($value instanceof PromiseInterface) {
|
17 |
-
return $value;
|
18 |
-
}
|
19 |
-
|
20 |
-
// Return a Guzzle promise that shadows the given promise.
|
21 |
-
if (is_object($value) && method_exists($value, 'then')) {
|
22 |
-
$wfn = method_exists($value, 'wait') ? [$value, 'wait'] : null;
|
23 |
-
$cfn = method_exists($value, 'cancel') ? [$value, 'cancel'] : null;
|
24 |
-
$promise = new Promise($wfn, $cfn);
|
25 |
-
$value->then([$promise, 'resolve'], [$promise, 'reject']);
|
26 |
-
return $promise;
|
27 |
-
}
|
28 |
-
|
29 |
-
return new FulfilledPromise($value);
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Creates a rejected promise for a reason if the reason is not a promise.
|
34 |
-
* If the provided reason is a promise, then it is returned as-is.
|
35 |
-
*
|
36 |
-
* @param mixed $reason Promise or reason.
|
37 |
-
*
|
38 |
-
* @return PromiseInterface
|
39 |
-
*/
|
40 |
-
public static function rejectionFor($reason)
|
41 |
-
{
|
42 |
-
if ($reason instanceof PromiseInterface) {
|
43 |
-
return $reason;
|
44 |
-
}
|
45 |
-
|
46 |
-
return new RejectedPromise($reason);
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Create an exception for a rejected promise value.
|
51 |
-
*
|
52 |
-
* @param mixed $reason
|
53 |
-
*
|
54 |
-
* @return \Exception|\Throwable
|
55 |
-
*/
|
56 |
-
public static function exceptionFor($reason)
|
57 |
-
{
|
58 |
-
if ($reason instanceof \Exception || $reason instanceof \Throwable) {
|
59 |
-
return $reason;
|
60 |
-
}
|
61 |
-
|
62 |
-
return new RejectionException($reason);
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Returns an iterator for the given value.
|
67 |
-
*
|
68 |
-
* @param mixed $value
|
69 |
-
*
|
70 |
-
* @return \Iterator
|
71 |
-
*/
|
72 |
-
public static function iterFor($value)
|
73 |
-
{
|
74 |
-
if ($value instanceof \Iterator) {
|
75 |
-
return $value;
|
76 |
-
}
|
77 |
-
|
78 |
-
if (is_array($value)) {
|
79 |
-
return new \ArrayIterator($value);
|
80 |
-
}
|
81 |
-
|
82 |
-
return new \ArrayIterator([$value]);
|
83 |
-
}
|
84 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/Each.php
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
final class Each
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Given an iterator that yields promises or values, returns a promise that
|
9 |
-
* is fulfilled with a null value when the iterator has been consumed or
|
10 |
-
* the aggregate promise has been fulfilled or rejected.
|
11 |
-
*
|
12 |
-
* $onFulfilled is a function that accepts the fulfilled value, iterator
|
13 |
-
* index, and the aggregate promise. The callback can invoke any necessary
|
14 |
-
* side effects and choose to resolve or reject the aggregate if needed.
|
15 |
-
*
|
16 |
-
* $onRejected is a function that accepts the rejection reason, iterator
|
17 |
-
* index, and the aggregate promise. The callback can invoke any necessary
|
18 |
-
* side effects and choose to resolve or reject the aggregate if needed.
|
19 |
-
*
|
20 |
-
* @param mixed $iterable Iterator or array to iterate over.
|
21 |
-
* @param callable $onFulfilled
|
22 |
-
* @param callable $onRejected
|
23 |
-
*
|
24 |
-
* @return PromiseInterface
|
25 |
-
*/
|
26 |
-
public static function of(
|
27 |
-
$iterable,
|
28 |
-
callable $onFulfilled = null,
|
29 |
-
callable $onRejected = null
|
30 |
-
) {
|
31 |
-
return (new EachPromise($iterable, [
|
32 |
-
'fulfilled' => $onFulfilled,
|
33 |
-
'rejected' => $onRejected
|
34 |
-
]))->promise();
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Like of, but only allows a certain number of outstanding promises at any
|
39 |
-
* given time.
|
40 |
-
*
|
41 |
-
* $concurrency may be an integer or a function that accepts the number of
|
42 |
-
* pending promises and returns a numeric concurrency limit value to allow
|
43 |
-
* for dynamic a concurrency size.
|
44 |
-
*
|
45 |
-
* @param mixed $iterable
|
46 |
-
* @param int|callable $concurrency
|
47 |
-
* @param callable $onFulfilled
|
48 |
-
* @param callable $onRejected
|
49 |
-
*
|
50 |
-
* @return PromiseInterface
|
51 |
-
*/
|
52 |
-
public static function ofLimit(
|
53 |
-
$iterable,
|
54 |
-
$concurrency,
|
55 |
-
callable $onFulfilled = null,
|
56 |
-
callable $onRejected = null
|
57 |
-
) {
|
58 |
-
return (new EachPromise($iterable, [
|
59 |
-
'fulfilled' => $onFulfilled,
|
60 |
-
'rejected' => $onRejected,
|
61 |
-
'concurrency' => $concurrency
|
62 |
-
]))->promise();
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Like limit, but ensures that no promise in the given $iterable argument
|
67 |
-
* is rejected. If any promise is rejected, then the aggregate promise is
|
68 |
-
* rejected with the encountered rejection.
|
69 |
-
*
|
70 |
-
* @param mixed $iterable
|
71 |
-
* @param int|callable $concurrency
|
72 |
-
* @param callable $onFulfilled
|
73 |
-
*
|
74 |
-
* @return PromiseInterface
|
75 |
-
*/
|
76 |
-
public static function ofLimitAll(
|
77 |
-
$iterable,
|
78 |
-
$concurrency,
|
79 |
-
callable $onFulfilled = null
|
80 |
-
) {
|
81 |
-
return each_limit(
|
82 |
-
$iterable,
|
83 |
-
$concurrency,
|
84 |
-
$onFulfilled,
|
85 |
-
function ($reason, $idx, PromiseInterface $aggregate) {
|
86 |
-
$aggregate->reject($reason);
|
87 |
-
}
|
88 |
-
);
|
89 |
-
}
|
90 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/EachPromise.php
DELETED
@@ -1,253 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Represents a promise that iterates over many promises and invokes
|
7 |
-
* side-effect functions in the process.
|
8 |
-
*/
|
9 |
-
class EachPromise implements PromisorInterface
|
10 |
-
{
|
11 |
-
private $pending = [];
|
12 |
-
|
13 |
-
/** @var \Iterator|null */
|
14 |
-
private $iterable;
|
15 |
-
|
16 |
-
/** @var callable|int|null */
|
17 |
-
private $concurrency;
|
18 |
-
|
19 |
-
/** @var callable|null */
|
20 |
-
private $onFulfilled;
|
21 |
-
|
22 |
-
/** @var callable|null */
|
23 |
-
private $onRejected;
|
24 |
-
|
25 |
-
/** @var Promise|null */
|
26 |
-
private $aggregate;
|
27 |
-
|
28 |
-
/** @var bool|null */
|
29 |
-
private $mutex;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Configuration hash can include the following key value pairs:
|
33 |
-
*
|
34 |
-
* - fulfilled: (callable) Invoked when a promise fulfills. The function
|
35 |
-
* is invoked with three arguments: the fulfillment value, the index
|
36 |
-
* position from the iterable list of the promise, and the aggregate
|
37 |
-
* promise that manages all of the promises. The aggregate promise may
|
38 |
-
* be resolved from within the callback to short-circuit the promise.
|
39 |
-
* - rejected: (callable) Invoked when a promise is rejected. The
|
40 |
-
* function is invoked with three arguments: the rejection reason, the
|
41 |
-
* index position from the iterable list of the promise, and the
|
42 |
-
* aggregate promise that manages all of the promises. The aggregate
|
43 |
-
* promise may be resolved from within the callback to short-circuit
|
44 |
-
* the promise.
|
45 |
-
* - concurrency: (integer) Pass this configuration option to limit the
|
46 |
-
* allowed number of outstanding concurrently executing promises,
|
47 |
-
* creating a capped pool of promises. There is no limit by default.
|
48 |
-
*
|
49 |
-
* @param mixed $iterable Promises or values to iterate.
|
50 |
-
* @param array $config Configuration options
|
51 |
-
*/
|
52 |
-
public function __construct($iterable, array $config = [])
|
53 |
-
{
|
54 |
-
$this->iterable = Create::iterFor($iterable);
|
55 |
-
|
56 |
-
if (isset($config['concurrency'])) {
|
57 |
-
$this->concurrency = $config['concurrency'];
|
58 |
-
}
|
59 |
-
|
60 |
-
if (isset($config['fulfilled'])) {
|
61 |
-
$this->onFulfilled = $config['fulfilled'];
|
62 |
-
}
|
63 |
-
|
64 |
-
if (isset($config['rejected'])) {
|
65 |
-
$this->onRejected = $config['rejected'];
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
/** @psalm-suppress InvalidNullableReturnType */
|
70 |
-
public function promise()
|
71 |
-
{
|
72 |
-
if ($this->aggregate) {
|
73 |
-
return $this->aggregate;
|
74 |
-
}
|
75 |
-
|
76 |
-
try {
|
77 |
-
$this->createPromise();
|
78 |
-
/** @psalm-assert Promise $this->aggregate */
|
79 |
-
$this->iterable->rewind();
|
80 |
-
if (!$this->checkIfFinished()) {
|
81 |
-
$this->refillPending();
|
82 |
-
}
|
83 |
-
} catch (\Throwable $e) {
|
84 |
-
/**
|
85 |
-
* @psalm-suppress NullReference
|
86 |
-
* @phpstan-ignore-next-line
|
87 |
-
*/
|
88 |
-
$this->aggregate->reject($e);
|
89 |
-
} catch (\Exception $e) {
|
90 |
-
/**
|
91 |
-
* @psalm-suppress NullReference
|
92 |
-
* @phpstan-ignore-next-line
|
93 |
-
*/
|
94 |
-
$this->aggregate->reject($e);
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* @psalm-suppress NullableReturnStatement
|
99 |
-
* @phpstan-ignore-next-line
|
100 |
-
*/
|
101 |
-
return $this->aggregate;
|
102 |
-
}
|
103 |
-
|
104 |
-
private function createPromise()
|
105 |
-
{
|
106 |
-
$this->mutex = false;
|
107 |
-
$this->aggregate = new Promise(function () {
|
108 |
-
reset($this->pending);
|
109 |
-
// Consume a potentially fluctuating list of promises while
|
110 |
-
// ensuring that indexes are maintained (precluding array_shift).
|
111 |
-
while ($promise = current($this->pending)) {
|
112 |
-
next($this->pending);
|
113 |
-
$promise->wait();
|
114 |
-
if (Is::settled($this->aggregate)) {
|
115 |
-
return;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
});
|
119 |
-
|
120 |
-
// Clear the references when the promise is resolved.
|
121 |
-
$clearFn = function () {
|
122 |
-
$this->iterable = $this->concurrency = $this->pending = null;
|
123 |
-
$this->onFulfilled = $this->onRejected = null;
|
124 |
-
};
|
125 |
-
|
126 |
-
$this->aggregate->then($clearFn, $clearFn);
|
127 |
-
}
|
128 |
-
|
129 |
-
private function refillPending()
|
130 |
-
{
|
131 |
-
if (!$this->concurrency) {
|
132 |
-
// Add all pending promises.
|
133 |
-
while ($this->addPending() && $this->advanceIterator());
|
134 |
-
return;
|
135 |
-
}
|
136 |
-
|
137 |
-
// Add only up to N pending promises.
|
138 |
-
$concurrency = is_callable($this->concurrency)
|
139 |
-
? call_user_func($this->concurrency, count($this->pending))
|
140 |
-
: $this->concurrency;
|
141 |
-
$concurrency = max($concurrency - count($this->pending), 0);
|
142 |
-
// Concurrency may be set to 0 to disallow new promises.
|
143 |
-
if (!$concurrency) {
|
144 |
-
return;
|
145 |
-
}
|
146 |
-
// Add the first pending promise.
|
147 |
-
$this->addPending();
|
148 |
-
// Note this is special handling for concurrency=1 so that we do
|
149 |
-
// not advance the iterator after adding the first promise. This
|
150 |
-
// helps work around issues with generators that might not have the
|
151 |
-
// next value to yield until promise callbacks are called.
|
152 |
-
while (--$concurrency
|
153 |
-
&& $this->advanceIterator()
|
154 |
-
&& $this->addPending());
|
155 |
-
}
|
156 |
-
|
157 |
-
private function addPending()
|
158 |
-
{
|
159 |
-
if (!$this->iterable || !$this->iterable->valid()) {
|
160 |
-
return false;
|
161 |
-
}
|
162 |
-
|
163 |
-
$promise = Create::promiseFor($this->iterable->current());
|
164 |
-
$key = $this->iterable->key();
|
165 |
-
|
166 |
-
// Iterable keys may not be unique, so we add the promises at the end
|
167 |
-
// of the pending array and retrieve the array index being used
|
168 |
-
$this->pending[] = null;
|
169 |
-
end($this->pending);
|
170 |
-
$idx = key($this->pending);
|
171 |
-
|
172 |
-
$this->pending[$idx] = $promise->then(
|
173 |
-
function ($value) use ($idx, $key) {
|
174 |
-
if ($this->onFulfilled) {
|
175 |
-
call_user_func(
|
176 |
-
$this->onFulfilled,
|
177 |
-
$value,
|
178 |
-
$key,
|
179 |
-
$this->aggregate
|
180 |
-
);
|
181 |
-
}
|
182 |
-
$this->step($idx);
|
183 |
-
},
|
184 |
-
function ($reason) use ($idx, $key) {
|
185 |
-
if ($this->onRejected) {
|
186 |
-
call_user_func(
|
187 |
-
$this->onRejected,
|
188 |
-
$reason,
|
189 |
-
$key,
|
190 |
-
$this->aggregate
|
191 |
-
);
|
192 |
-
}
|
193 |
-
$this->step($idx);
|
194 |
-
}
|
195 |
-
);
|
196 |
-
|
197 |
-
return true;
|
198 |
-
}
|
199 |
-
|
200 |
-
private function advanceIterator()
|
201 |
-
{
|
202 |
-
// Place a lock on the iterator so that we ensure to not recurse,
|
203 |
-
// preventing fatal generator errors.
|
204 |
-
if ($this->mutex) {
|
205 |
-
return false;
|
206 |
-
}
|
207 |
-
|
208 |
-
$this->mutex = true;
|
209 |
-
|
210 |
-
try {
|
211 |
-
$this->iterable->next();
|
212 |
-
$this->mutex = false;
|
213 |
-
return true;
|
214 |
-
} catch (\Throwable $e) {
|
215 |
-
$this->aggregate->reject($e);
|
216 |
-
$this->mutex = false;
|
217 |
-
return false;
|
218 |
-
} catch (\Exception $e) {
|
219 |
-
$this->aggregate->reject($e);
|
220 |
-
$this->mutex = false;
|
221 |
-
return false;
|
222 |
-
}
|
223 |
-
}
|
224 |
-
|
225 |
-
private function step($idx)
|
226 |
-
{
|
227 |
-
// If the promise was already resolved, then ignore this step.
|
228 |
-
if (Is::settled($this->aggregate)) {
|
229 |
-
return;
|
230 |
-
}
|
231 |
-
|
232 |
-
unset($this->pending[$idx]);
|
233 |
-
|
234 |
-
// Only refill pending promises if we are not locked, preventing the
|
235 |
-
// EachPromise to recursively invoke the provided iterator, which
|
236 |
-
// cause a fatal error: "Cannot resume an already running generator"
|
237 |
-
if ($this->advanceIterator() && !$this->checkIfFinished()) {
|
238 |
-
// Add more pending promises if possible.
|
239 |
-
$this->refillPending();
|
240 |
-
}
|
241 |
-
}
|
242 |
-
|
243 |
-
private function checkIfFinished()
|
244 |
-
{
|
245 |
-
if (!$this->pending && !$this->iterable->valid()) {
|
246 |
-
// Resolve the promise if there's nothing left to do.
|
247 |
-
$this->aggregate->resolve(null);
|
248 |
-
return true;
|
249 |
-
}
|
250 |
-
|
251 |
-
return false;
|
252 |
-
}
|
253 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/FulfilledPromise.php
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* A promise that has been fulfilled.
|
7 |
-
*
|
8 |
-
* Thenning off of this promise will invoke the onFulfilled callback
|
9 |
-
* immediately and ignore other callbacks.
|
10 |
-
*/
|
11 |
-
class FulfilledPromise implements PromiseInterface
|
12 |
-
{
|
13 |
-
private $value;
|
14 |
-
|
15 |
-
public function __construct($value)
|
16 |
-
{
|
17 |
-
if (is_object($value) && method_exists($value, 'then')) {
|
18 |
-
throw new \InvalidArgumentException(
|
19 |
-
'You cannot create a FulfilledPromise with a promise.'
|
20 |
-
);
|
21 |
-
}
|
22 |
-
|
23 |
-
$this->value = $value;
|
24 |
-
}
|
25 |
-
|
26 |
-
public function then(
|
27 |
-
callable $onFulfilled = null,
|
28 |
-
callable $onRejected = null
|
29 |
-
) {
|
30 |
-
// Return itself if there is no onFulfilled function.
|
31 |
-
if (!$onFulfilled) {
|
32 |
-
return $this;
|
33 |
-
}
|
34 |
-
|
35 |
-
$queue = Utils::queue();
|
36 |
-
$p = new Promise([$queue, 'run']);
|
37 |
-
$value = $this->value;
|
38 |
-
$queue->add(static function () use ($p, $value, $onFulfilled) {
|
39 |
-
if (Is::pending($p)) {
|
40 |
-
try {
|
41 |
-
$p->resolve($onFulfilled($value));
|
42 |
-
} catch (\Throwable $e) {
|
43 |
-
$p->reject($e);
|
44 |
-
} catch (\Exception $e) {
|
45 |
-
$p->reject($e);
|
46 |
-
}
|
47 |
-
}
|
48 |
-
});
|
49 |
-
|
50 |
-
return $p;
|
51 |
-
}
|
52 |
-
|
53 |
-
public function otherwise(callable $onRejected)
|
54 |
-
{
|
55 |
-
return $this->then(null, $onRejected);
|
56 |
-
}
|
57 |
-
|
58 |
-
public function wait($unwrap = true, $defaultDelivery = null)
|
59 |
-
{
|
60 |
-
return $unwrap ? $this->value : null;
|
61 |
-
}
|
62 |
-
|
63 |
-
public function getState()
|
64 |
-
{
|
65 |
-
return self::FULFILLED;
|
66 |
-
}
|
67 |
-
|
68 |
-
public function resolve($value)
|
69 |
-
{
|
70 |
-
if ($value !== $this->value) {
|
71 |
-
throw new \LogicException("Cannot resolve a fulfilled promise");
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
public function reject($reason)
|
76 |
-
{
|
77 |
-
throw new \LogicException("Cannot reject a fulfilled promise");
|
78 |
-
}
|
79 |
-
|
80 |
-
public function cancel()
|
81 |
-
{
|
82 |
-
// pass
|
83 |
-
}
|
84 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/Is.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
final class Is
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Returns true if a promise is pending.
|
9 |
-
*
|
10 |
-
* @return bool
|
11 |
-
*/
|
12 |
-
public static function pending(PromiseInterface $promise)
|
13 |
-
{
|
14 |
-
return $promise->getState() === PromiseInterface::PENDING;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Returns true if a promise is fulfilled or rejected.
|
19 |
-
*
|
20 |
-
* @return bool
|
21 |
-
*/
|
22 |
-
public static function settled(PromiseInterface $promise)
|
23 |
-
{
|
24 |
-
return $promise->getState() !== PromiseInterface::PENDING;
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Returns true if a promise is fulfilled.
|
29 |
-
*
|
30 |
-
* @return bool
|
31 |
-
*/
|
32 |
-
public static function fulfilled(PromiseInterface $promise)
|
33 |
-
{
|
34 |
-
return $promise->getState() === PromiseInterface::FULFILLED;
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Returns true if a promise is rejected.
|
39 |
-
*
|
40 |
-
* @return bool
|
41 |
-
*/
|
42 |
-
public static function rejected(PromiseInterface $promise)
|
43 |
-
{
|
44 |
-
return $promise->getState() === PromiseInterface::REJECTED;
|
45 |
-
}
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/Promise.php
DELETED
@@ -1,278 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Promises/A+ implementation that avoids recursion when possible.
|
7 |
-
*
|
8 |
-
* @link https://promisesaplus.com/
|
9 |
-
*/
|
10 |
-
class Promise implements PromiseInterface
|
11 |
-
{
|
12 |
-
private $state = self::PENDING;
|
13 |
-
private $result;
|
14 |
-
private $cancelFn;
|
15 |
-
private $waitFn;
|
16 |
-
private $waitList;
|
17 |
-
private $handlers = [];
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @param callable $waitFn Fn that when invoked resolves the promise.
|
21 |
-
* @param callable $cancelFn Fn that when invoked cancels the promise.
|
22 |
-
*/
|
23 |
-
public function __construct(
|
24 |
-
callable $waitFn = null,
|
25 |
-
callable $cancelFn = null
|
26 |
-
) {
|
27 |
-
$this->waitFn = $waitFn;
|
28 |
-
$this->cancelFn = $cancelFn;
|
29 |
-
}
|
30 |
-
|
31 |
-
public function then(
|
32 |
-
callable $onFulfilled = null,
|
33 |
-
callable $onRejected = null
|
34 |
-
) {
|
35 |
-
if ($this->state === self::PENDING) {
|
36 |
-
$p = new Promise(null, [$this, 'cancel']);
|
37 |
-
$this->handlers[] = [$p, $onFulfilled, $onRejected];
|
38 |
-
$p->waitList = $this->waitList;
|
39 |
-
$p->waitList[] = $this;
|
40 |
-
return $p;
|
41 |
-
}
|
42 |
-
|
43 |
-
// Return a fulfilled promise and immediately invoke any callbacks.
|
44 |
-
if ($this->state === self::FULFILLED) {
|
45 |
-
$promise = Create::promiseFor($this->result);
|
46 |
-
return $onFulfilled ? $promise->then($onFulfilled) : $promise;
|
47 |
-
}
|
48 |
-
|
49 |
-
// It's either cancelled or rejected, so return a rejected promise
|
50 |
-
// and immediately invoke any callbacks.
|
51 |
-
$rejection = Create::rejectionFor($this->result);
|
52 |
-
return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
|
53 |
-
}
|
54 |
-
|
55 |
-
public function otherwise(callable $onRejected)
|
56 |
-
{
|
57 |
-
return $this->then(null, $onRejected);
|
58 |
-
}
|
59 |
-
|
60 |
-
public function wait($unwrap = true)
|
61 |
-
{
|
62 |
-
$this->waitIfPending();
|
63 |
-
|
64 |
-
if ($this->result instanceof PromiseInterface) {
|
65 |
-
return $this->result->wait($unwrap);
|
66 |
-
}
|
67 |
-
if ($unwrap) {
|
68 |
-
if ($this->state === self::FULFILLED) {
|
69 |
-
return $this->result;
|
70 |
-
}
|
71 |
-
// It's rejected so "unwrap" and throw an exception.
|
72 |
-
throw Create::exceptionFor($this->result);
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
public function getState()
|
77 |
-
{
|
78 |
-
return $this->state;
|
79 |
-
}
|
80 |
-
|
81 |
-
public function cancel()
|
82 |
-
{
|
83 |
-
if ($this->state !== self::PENDING) {
|
84 |
-
return;
|
85 |
-
}
|
86 |
-
|
87 |
-
$this->waitFn = $this->waitList = null;
|
88 |
-
|
89 |
-
if ($this->cancelFn) {
|
90 |
-
$fn = $this->cancelFn;
|
91 |
-
$this->cancelFn = null;
|
92 |
-
try {
|
93 |
-
$fn();
|
94 |
-
} catch (\Throwable $e) {
|
95 |
-
$this->reject($e);
|
96 |
-
} catch (\Exception $e) {
|
97 |
-
$this->reject($e);
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
// Reject the promise only if it wasn't rejected in a then callback.
|
102 |
-
/** @psalm-suppress RedundantCondition */
|
103 |
-
if ($this->state === self::PENDING) {
|
104 |
-
$this->reject(new CancellationException('Promise has been cancelled'));
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
public function resolve($value)
|
109 |
-
{
|
110 |
-
$this->settle(self::FULFILLED, $value);
|
111 |
-
}
|
112 |
-
|
113 |
-
public function reject($reason)
|
114 |
-
{
|
115 |
-
$this->settle(self::REJECTED, $reason);
|
116 |
-
}
|
117 |
-
|
118 |
-
private function settle($state, $value)
|
119 |
-
{
|
120 |
-
if ($this->state !== self::PENDING) {
|
121 |
-
// Ignore calls with the same resolution.
|
122 |
-
if ($state === $this->state && $value === $this->result) {
|
123 |
-
return;
|
124 |
-
}
|
125 |
-
throw $this->state === $state
|
126 |
-
? new \LogicException("The promise is already {$state}.")
|
127 |
-
: new \LogicException("Cannot change a {$this->state} promise to {$state}");
|
128 |
-
}
|
129 |
-
|
130 |
-
if ($value === $this) {
|
131 |
-
throw new \LogicException('Cannot fulfill or reject a promise with itself');
|
132 |
-
}
|
133 |
-
|
134 |
-
// Clear out the state of the promise but stash the handlers.
|
135 |
-
$this->state = $state;
|
136 |
-
$this->result = $value;
|
137 |
-
$handlers = $this->handlers;
|
138 |
-
$this->handlers = null;
|
139 |
-
$this->waitList = $this->waitFn = null;
|
140 |
-
$this->cancelFn = null;
|
141 |
-
|
142 |
-
if (!$handlers) {
|
143 |
-
return;
|
144 |
-
}
|
145 |
-
|
146 |
-
// If the value was not a settled promise or a thenable, then resolve
|
147 |
-
// it in the task queue using the correct ID.
|
148 |
-
if (!is_object($value) || !method_exists($value, 'then')) {
|
149 |
-
$id = $state === self::FULFILLED ? 1 : 2;
|
150 |
-
// It's a success, so resolve the handlers in the queue.
|
151 |
-
Utils::queue()->add(static function () use ($id, $value, $handlers) {
|
152 |
-
foreach ($handlers as $handler) {
|
153 |
-
self::callHandler($id, $value, $handler);
|
154 |
-
}
|
155 |
-
});
|
156 |
-
} elseif ($value instanceof Promise && Is::pending($value)) {
|
157 |
-
// We can just merge our handlers onto the next promise.
|
158 |
-
$value->handlers = array_merge($value->handlers, $handlers);
|
159 |
-
} else {
|
160 |
-
// Resolve the handlers when the forwarded promise is resolved.
|
161 |
-
$value->then(
|
162 |
-
static function ($value) use ($handlers) {
|
163 |
-
foreach ($handlers as $handler) {
|
164 |
-
self::callHandler(1, $value, $handler);
|
165 |
-
}
|
166 |
-
},
|
167 |
-
static function ($reason) use ($handlers) {
|
168 |
-
foreach ($handlers as $handler) {
|
169 |
-
self::callHandler(2, $reason, $handler);
|
170 |
-
}
|
171 |
-
}
|
172 |
-
);
|
173 |
-
}
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Call a stack of handlers using a specific callback index and value.
|
178 |
-
*
|
179 |
-
* @param int $index 1 (resolve) or 2 (reject).
|
180 |
-
* @param mixed $value Value to pass to the callback.
|
181 |
-
* @param array $handler Array of handler data (promise and callbacks).
|
182 |
-
*/
|
183 |
-
private static function callHandler($index, $value, array $handler)
|
184 |
-
{
|
185 |
-
/** @var PromiseInterface $promise */
|
186 |
-
$promise = $handler[0];
|
187 |
-
|
188 |
-
// The promise may have been cancelled or resolved before placing
|
189 |
-
// this thunk in the queue.
|
190 |
-
if (Is::settled($promise)) {
|
191 |
-
return;
|
192 |
-
}
|
193 |
-
|
194 |
-
try {
|
195 |
-
if (isset($handler[$index])) {
|
196 |
-
/*
|
197 |
-
* If $f throws an exception, then $handler will be in the exception
|
198 |
-
* stack trace. Since $handler contains a reference to the callable
|
199 |
-
* itself we get a circular reference. We clear the $handler
|
200 |
-
* here to avoid that memory leak.
|
201 |
-
*/
|
202 |
-
$f = $handler[$index];
|
203 |
-
unset($handler);
|
204 |
-
$promise->resolve($f($value));
|
205 |
-
} elseif ($index === 1) {
|
206 |
-
// Forward resolution values as-is.
|
207 |
-
$promise->resolve($value);
|
208 |
-
} else {
|
209 |
-
// Forward rejections down the chain.
|
210 |
-
$promise->reject($value);
|
211 |
-
}
|
212 |
-
} catch (\Throwable $reason) {
|
213 |
-
$promise->reject($reason);
|
214 |
-
} catch (\Exception $reason) {
|
215 |
-
$promise->reject($reason);
|
216 |
-
}
|
217 |
-
}
|
218 |
-
|
219 |
-
private function waitIfPending()
|
220 |
-
{
|
221 |
-
if ($this->state !== self::PENDING) {
|
222 |
-
return;
|
223 |
-
} elseif ($this->waitFn) {
|
224 |
-
$this->invokeWaitFn();
|
225 |
-
} elseif ($this->waitList) {
|
226 |
-
$this->invokeWaitList();
|
227 |
-
} else {
|
228 |
-
// If there's no wait function, then reject the promise.
|
229 |
-
$this->reject('Cannot wait on a promise that has '
|
230 |
-
. 'no internal wait function. You must provide a wait '
|
231 |
-
. 'function when constructing the promise to be able to '
|
232 |
-
. 'wait on a promise.');
|
233 |
-
}
|
234 |
-
|
235 |
-
Utils::queue()->run();
|
236 |
-
|
237 |
-
/** @psalm-suppress RedundantCondition */
|
238 |
-
if ($this->state === self::PENDING) {
|
239 |
-
$this->reject('Invoking the wait callback did not resolve the promise');
|
240 |
-
}
|
241 |
-
}
|
242 |
-
|
243 |
-
private function invokeWaitFn()
|
244 |
-
{
|
245 |
-
try {
|
246 |
-
$wfn = $this->waitFn;
|
247 |
-
$this->waitFn = null;
|
248 |
-
$wfn(true);
|
249 |
-
} catch (\Exception $reason) {
|
250 |
-
if ($this->state === self::PENDING) {
|
251 |
-
// The promise has not been resolved yet, so reject the promise
|
252 |
-
// with the exception.
|
253 |
-
$this->reject($reason);
|
254 |
-
} else {
|
255 |
-
// The promise was already resolved, so there's a problem in
|
256 |
-
// the application.
|
257 |
-
throw $reason;
|
258 |
-
}
|
259 |
-
}
|
260 |
-
}
|
261 |
-
|
262 |
-
private function invokeWaitList()
|
263 |
-
{
|
264 |
-
$waitList = $this->waitList;
|
265 |
-
$this->waitList = null;
|
266 |
-
|
267 |
-
foreach ($waitList as $result) {
|
268 |
-
do {
|
269 |
-
$result->waitIfPending();
|
270 |
-
$result = $result->result;
|
271 |
-
} while ($result instanceof Promise);
|
272 |
-
|
273 |
-
if ($result instanceof PromiseInterface) {
|
274 |
-
$result->wait(false);
|
275 |
-
}
|
276 |
-
}
|
277 |
-
}
|
278 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/PromiseInterface.php
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* A promise represents the eventual result of an asynchronous operation.
|
7 |
-
*
|
8 |
-
* The primary way of interacting with a promise is through its then method,
|
9 |
-
* which registers callbacks to receive either a promise’s eventual value or
|
10 |
-
* the reason why the promise cannot be fulfilled.
|
11 |
-
*
|
12 |
-
* @link https://promisesaplus.com/
|
13 |
-
*/
|
14 |
-
interface PromiseInterface
|
15 |
-
{
|
16 |
-
const PENDING = 'pending';
|
17 |
-
const FULFILLED = 'fulfilled';
|
18 |
-
const REJECTED = 'rejected';
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Appends fulfillment and rejection handlers to the promise, and returns
|
22 |
-
* a new promise resolving to the return value of the called handler.
|
23 |
-
*
|
24 |
-
* @param callable $onFulfilled Invoked when the promise fulfills.
|
25 |
-
* @param callable $onRejected Invoked when the promise is rejected.
|
26 |
-
*
|
27 |
-
* @return PromiseInterface
|
28 |
-
*/
|
29 |
-
public function then(
|
30 |
-
callable $onFulfilled = null,
|
31 |
-
callable $onRejected = null
|
32 |
-
);
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Appends a rejection handler callback to the promise, and returns a new
|
36 |
-
* promise resolving to the return value of the callback if it is called,
|
37 |
-
* or to its original fulfillment value if the promise is instead
|
38 |
-
* fulfilled.
|
39 |
-
*
|
40 |
-
* @param callable $onRejected Invoked when the promise is rejected.
|
41 |
-
*
|
42 |
-
* @return PromiseInterface
|
43 |
-
*/
|
44 |
-
public function otherwise(callable $onRejected);
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Get the state of the promise ("pending", "rejected", or "fulfilled").
|
48 |
-
*
|
49 |
-
* The three states can be checked against the constants defined on
|
50 |
-
* PromiseInterface: PENDING, FULFILLED, and REJECTED.
|
51 |
-
*
|
52 |
-
* @return string
|
53 |
-
*/
|
54 |
-
public function getState();
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Resolve the promise with the given value.
|
58 |
-
*
|
59 |
-
* @param mixed $value
|
60 |
-
*
|
61 |
-
* @throws \RuntimeException if the promise is already resolved.
|
62 |
-
*/
|
63 |
-
public function resolve($value);
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Reject the promise with the given reason.
|
67 |
-
*
|
68 |
-
* @param mixed $reason
|
69 |
-
*
|
70 |
-
* @throws \RuntimeException if the promise is already resolved.
|
71 |
-
*/
|
72 |
-
public function reject($reason);
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Cancels the promise if possible.
|
76 |
-
*
|
77 |
-
* @link https://github.com/promises-aplus/cancellation-spec/issues/7
|
78 |
-
*/
|
79 |
-
public function cancel();
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Waits until the promise completes if possible.
|
83 |
-
*
|
84 |
-
* Pass $unwrap as true to unwrap the result of the promise, either
|
85 |
-
* returning the resolved value or throwing the rejected exception.
|
86 |
-
*
|
87 |
-
* If the promise cannot be waited on, then the promise will be rejected.
|
88 |
-
*
|
89 |
-
* @param bool $unwrap
|
90 |
-
*
|
91 |
-
* @return mixed
|
92 |
-
*
|
93 |
-
* @throws \LogicException if the promise has no wait function or if the
|
94 |
-
* promise does not settle after waiting.
|
95 |
-
*/
|
96 |
-
public function wait($unwrap = true);
|
97 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/PromisorInterface.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Interface used with classes that return a promise.
|
7 |
-
*/
|
8 |
-
interface PromisorInterface
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* Returns a promise.
|
12 |
-
*
|
13 |
-
* @return PromiseInterface
|
14 |
-
*/
|
15 |
-
public function promise();
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/RejectedPromise.php
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* A promise that has been rejected.
|
7 |
-
*
|
8 |
-
* Thenning off of this promise will invoke the onRejected callback
|
9 |
-
* immediately and ignore other callbacks.
|
10 |
-
*/
|
11 |
-
class RejectedPromise implements PromiseInterface
|
12 |
-
{
|
13 |
-
private $reason;
|
14 |
-
|
15 |
-
public function __construct($reason)
|
16 |
-
{
|
17 |
-
if (is_object($reason) && method_exists($reason, 'then')) {
|
18 |
-
throw new \InvalidArgumentException(
|
19 |
-
'You cannot create a RejectedPromise with a promise.'
|
20 |
-
);
|
21 |
-
}
|
22 |
-
|
23 |
-
$this->reason = $reason;
|
24 |
-
}
|
25 |
-
|
26 |
-
public function then(
|
27 |
-
callable $onFulfilled = null,
|
28 |
-
callable $onRejected = null
|
29 |
-
) {
|
30 |
-
// If there's no onRejected callback then just return self.
|
31 |
-
if (!$onRejected) {
|
32 |
-
return $this;
|
33 |
-
}
|
34 |
-
|
35 |
-
$queue = Utils::queue();
|
36 |
-
$reason = $this->reason;
|
37 |
-
$p = new Promise([$queue, 'run']);
|
38 |
-
$queue->add(static function () use ($p, $reason, $onRejected) {
|
39 |
-
if (Is::pending($p)) {
|
40 |
-
try {
|
41 |
-
// Return a resolved promise if onRejected does not throw.
|
42 |
-
$p->resolve($onRejected($reason));
|
43 |
-
} catch (\Throwable $e) {
|
44 |
-
// onRejected threw, so return a rejected promise.
|
45 |
-
$p->reject($e);
|
46 |
-
} catch (\Exception $e) {
|
47 |
-
// onRejected threw, so return a rejected promise.
|
48 |
-
$p->reject($e);
|
49 |
-
}
|
50 |
-
}
|
51 |
-
});
|
52 |
-
|
53 |
-
return $p;
|
54 |
-
}
|
55 |
-
|
56 |
-
public function otherwise(callable $onRejected)
|
57 |
-
{
|
58 |
-
return $this->then(null, $onRejected);
|
59 |
-
}
|
60 |
-
|
61 |
-
public function wait($unwrap = true, $defaultDelivery = null)
|
62 |
-
{
|
63 |
-
if ($unwrap) {
|
64 |
-
throw Create::exceptionFor($this->reason);
|
65 |
-
}
|
66 |
-
|
67 |
-
return null;
|
68 |
-
}
|
69 |
-
|
70 |
-
public function getState()
|
71 |
-
{
|
72 |
-
return self::REJECTED;
|
73 |
-
}
|
74 |
-
|
75 |
-
public function resolve($value)
|
76 |
-
{
|
77 |
-
throw new \LogicException("Cannot resolve a rejected promise");
|
78 |
-
}
|
79 |
-
|
80 |
-
public function reject($reason)
|
81 |
-
{
|
82 |
-
if ($reason !== $this->reason) {
|
83 |
-
throw new \LogicException("Cannot reject a rejected promise");
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
public function cancel()
|
88 |
-
{
|
89 |
-
// pass
|
90 |
-
}
|
91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/RejectionException.php
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* A special exception that is thrown when waiting on a rejected promise.
|
7 |
-
*
|
8 |
-
* The reason value is available via the getReason() method.
|
9 |
-
*/
|
10 |
-
class RejectionException extends \RuntimeException
|
11 |
-
{
|
12 |
-
/** @var mixed Rejection reason. */
|
13 |
-
private $reason;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @param mixed $reason Rejection reason.
|
17 |
-
* @param string $description Optional description
|
18 |
-
*/
|
19 |
-
public function __construct($reason, $description = null)
|
20 |
-
{
|
21 |
-
$this->reason = $reason;
|
22 |
-
|
23 |
-
$message = 'The promise was rejected';
|
24 |
-
|
25 |
-
if ($description) {
|
26 |
-
$message .= ' with reason: ' . $description;
|
27 |
-
} elseif (is_string($reason)
|
28 |
-
|| (is_object($reason) && method_exists($reason, '__toString'))
|
29 |
-
) {
|
30 |
-
$message .= ' with reason: ' . $this->reason;
|
31 |
-
} elseif ($reason instanceof \JsonSerializable) {
|
32 |
-
$message .= ' with reason: '
|
33 |
-
. json_encode($this->reason, JSON_PRETTY_PRINT);
|
34 |
-
}
|
35 |
-
|
36 |
-
parent::__construct($message);
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Returns the rejection reason.
|
41 |
-
*
|
42 |
-
* @return mixed
|
43 |
-
*/
|
44 |
-
public function getReason()
|
45 |
-
{
|
46 |
-
return $this->reason;
|
47 |
-
}
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/TaskQueue.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* A task queue that executes tasks in a FIFO order.
|
7 |
-
*
|
8 |
-
* This task queue class is used to settle promises asynchronously and
|
9 |
-
* maintains a constant stack size. You can use the task queue asynchronously
|
10 |
-
* by calling the `run()` function of the global task queue in an event loop.
|
11 |
-
*
|
12 |
-
* GuzzleHttp\Promise\Utils::queue()->run();
|
13 |
-
*/
|
14 |
-
class TaskQueue implements TaskQueueInterface
|
15 |
-
{
|
16 |
-
private $enableShutdown = true;
|
17 |
-
private $queue = [];
|
18 |
-
|
19 |
-
public function __construct($withShutdown = true)
|
20 |
-
{
|
21 |
-
if ($withShutdown) {
|
22 |
-
register_shutdown_function(function () {
|
23 |
-
if ($this->enableShutdown) {
|
24 |
-
// Only run the tasks if an E_ERROR didn't occur.
|
25 |
-
$err = error_get_last();
|
26 |
-
if (!$err || ($err['type'] ^ E_ERROR)) {
|
27 |
-
$this->run();
|
28 |
-
}
|
29 |
-
}
|
30 |
-
});
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
public function isEmpty()
|
35 |
-
{
|
36 |
-
return !$this->queue;
|
37 |
-
}
|
38 |
-
|
39 |
-
public function add(callable $task)
|
40 |
-
{
|
41 |
-
$this->queue[] = $task;
|
42 |
-
}
|
43 |
-
|
44 |
-
public function run()
|
45 |
-
{
|
46 |
-
while ($task = array_shift($this->queue)) {
|
47 |
-
/** @var callable $task */
|
48 |
-
$task();
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* The task queue will be run and exhausted by default when the process
|
54 |
-
* exits IFF the exit is not the result of a PHP E_ERROR error.
|
55 |
-
*
|
56 |
-
* You can disable running the automatic shutdown of the queue by calling
|
57 |
-
* this function. If you disable the task queue shutdown process, then you
|
58 |
-
* MUST either run the task queue (as a result of running your event loop
|
59 |
-
* or manually using the run() method) or wait on each outstanding promise.
|
60 |
-
*
|
61 |
-
* Note: This shutdown will occur before any destructors are triggered.
|
62 |
-
*/
|
63 |
-
public function disableShutdown()
|
64 |
-
{
|
65 |
-
$this->enableShutdown = false;
|
66 |
-
}
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/TaskQueueInterface.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
interface TaskQueueInterface
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Returns true if the queue is empty.
|
9 |
-
*
|
10 |
-
* @return bool
|
11 |
-
*/
|
12 |
-
public function isEmpty();
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Adds a task to the queue that will be executed the next time run is
|
16 |
-
* called.
|
17 |
-
*/
|
18 |
-
public function add(callable $task);
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Execute all of the pending task in the queue.
|
22 |
-
*/
|
23 |
-
public function run();
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/Utils.php
DELETED
@@ -1,274 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
final class Utils
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Get the global task queue used for promise resolution.
|
9 |
-
*
|
10 |
-
* This task queue MUST be run in an event loop in order for promises to be
|
11 |
-
* settled asynchronously. It will be automatically run when synchronously
|
12 |
-
* waiting on a promise.
|
13 |
-
*
|
14 |
-
* <code>
|
15 |
-
* while ($eventLoop->isRunning()) {
|
16 |
-
* GuzzleHttp\Promise\Utils::queue()->run();
|
17 |
-
* }
|
18 |
-
* </code>
|
19 |
-
*
|
20 |
-
* @param TaskQueueInterface $assign Optionally specify a new queue instance.
|
21 |
-
*
|
22 |
-
* @return TaskQueueInterface
|
23 |
-
*/
|
24 |
-
public static function queue(TaskQueueInterface $assign = null)
|
25 |
-
{
|
26 |
-
static $queue;
|
27 |
-
|
28 |
-
if ($assign) {
|
29 |
-
$queue = $assign;
|
30 |
-
} elseif (!$queue) {
|
31 |
-
$queue = new TaskQueue();
|
32 |
-
}
|
33 |
-
|
34 |
-
return $queue;
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Adds a function to run in the task queue when it is next `run()` and
|
39 |
-
* returns a promise that is fulfilled or rejected with the result.
|
40 |
-
*
|
41 |
-
* @param callable $task Task function to run.
|
42 |
-
*
|
43 |
-
* @return PromiseInterface
|
44 |
-
*/
|
45 |
-
public static function task(callable $task)
|
46 |
-
{
|
47 |
-
$queue = self::queue();
|
48 |
-
$promise = new Promise([$queue, 'run']);
|
49 |
-
$queue->add(function () use ($task, $promise) {
|
50 |
-
try {
|
51 |
-
$promise->resolve($task());
|
52 |
-
} catch (\Throwable $e) {
|
53 |
-
$promise->reject($e);
|
54 |
-
} catch (\Exception $e) {
|
55 |
-
$promise->reject($e);
|
56 |
-
}
|
57 |
-
});
|
58 |
-
|
59 |
-
return $promise;
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Synchronously waits on a promise to resolve and returns an inspection
|
64 |
-
* state array.
|
65 |
-
*
|
66 |
-
* Returns a state associative array containing a "state" key mapping to a
|
67 |
-
* valid promise state. If the state of the promise is "fulfilled", the
|
68 |
-
* array will contain a "value" key mapping to the fulfilled value of the
|
69 |
-
* promise. If the promise is rejected, the array will contain a "reason"
|
70 |
-
* key mapping to the rejection reason of the promise.
|
71 |
-
*
|
72 |
-
* @param PromiseInterface $promise Promise or value.
|
73 |
-
*
|
74 |
-
* @return array
|
75 |
-
*/
|
76 |
-
public static function inspect(PromiseInterface $promise)
|
77 |
-
{
|
78 |
-
try {
|
79 |
-
return [
|
80 |
-
'state' => PromiseInterface::FULFILLED,
|
81 |
-
'value' => $promise->wait()
|
82 |
-
];
|
83 |
-
} catch (RejectionException $e) {
|
84 |
-
return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()];
|
85 |
-
} catch (\Throwable $e) {
|
86 |
-
return ['state' => PromiseInterface::REJECTED, 'reason' => $e];
|
87 |
-
} catch (\Exception $e) {
|
88 |
-
return ['state' => PromiseInterface::REJECTED, 'reason' => $e];
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Waits on all of the provided promises, but does not unwrap rejected
|
94 |
-
* promises as thrown exception.
|
95 |
-
*
|
96 |
-
* Returns an array of inspection state arrays.
|
97 |
-
*
|
98 |
-
* @see inspect for the inspection state array format.
|
99 |
-
*
|
100 |
-
* @param PromiseInterface[] $promises Traversable of promises to wait upon.
|
101 |
-
*
|
102 |
-
* @return array
|
103 |
-
*/
|
104 |
-
public static function inspectAll($promises)
|
105 |
-
{
|
106 |
-
$results = [];
|
107 |
-
foreach ($promises as $key => $promise) {
|
108 |
-
$results[$key] = inspect($promise);
|
109 |
-
}
|
110 |
-
|
111 |
-
return $results;
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Waits on all of the provided promises and returns the fulfilled values.
|
116 |
-
*
|
117 |
-
* Returns an array that contains the value of each promise (in the same
|
118 |
-
* order the promises were provided). An exception is thrown if any of the
|
119 |
-
* promises are rejected.
|
120 |
-
*
|
121 |
-
* @param iterable<PromiseInterface> $promises Iterable of PromiseInterface objects to wait on.
|
122 |
-
*
|
123 |
-
* @return array
|
124 |
-
*
|
125 |
-
* @throws \Exception on error
|
126 |
-
* @throws \Throwable on error in PHP >=7
|
127 |
-
*/
|
128 |
-
public static function unwrap($promises)
|
129 |
-
{
|
130 |
-
$results = [];
|
131 |
-
foreach ($promises as $key => $promise) {
|
132 |
-
$results[$key] = $promise->wait();
|
133 |
-
}
|
134 |
-
|
135 |
-
return $results;
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Given an array of promises, return a promise that is fulfilled when all
|
140 |
-
* the items in the array are fulfilled.
|
141 |
-
*
|
142 |
-
* The promise's fulfillment value is an array with fulfillment values at
|
143 |
-
* respective positions to the original array. If any promise in the array
|
144 |
-
* rejects, the returned promise is rejected with the rejection reason.
|
145 |
-
*
|
146 |
-
* @param mixed $promises Promises or values.
|
147 |
-
* @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution.
|
148 |
-
*
|
149 |
-
* @return PromiseInterface
|
150 |
-
*/
|
151 |
-
public static function all($promises, $recursive = false)
|
152 |
-
{
|
153 |
-
$results = [];
|
154 |
-
$promise = Each::of(
|
155 |
-
$promises,
|
156 |
-
function ($value, $idx) use (&$results) {
|
157 |
-
$results[$idx] = $value;
|
158 |
-
},
|
159 |
-
function ($reason, $idx, Promise $aggregate) {
|
160 |
-
$aggregate->reject($reason);
|
161 |
-
}
|
162 |
-
)->then(function () use (&$results) {
|
163 |
-
ksort($results);
|
164 |
-
return $results;
|
165 |
-
});
|
166 |
-
|
167 |
-
if (true === $recursive) {
|
168 |
-
$promise = $promise->then(function ($results) use ($recursive, &$promises) {
|
169 |
-
foreach ($promises as $promise) {
|
170 |
-
if (Is::pending($promise)) {
|
171 |
-
return self::all($promises, $recursive);
|
172 |
-
}
|
173 |
-
}
|
174 |
-
return $results;
|
175 |
-
});
|
176 |
-
}
|
177 |
-
|
178 |
-
return $promise;
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Initiate a competitive race between multiple promises or values (values
|
183 |
-
* will become immediately fulfilled promises).
|
184 |
-
*
|
185 |
-
* When count amount of promises have been fulfilled, the returned promise
|
186 |
-
* is fulfilled with an array that contains the fulfillment values of the
|
187 |
-
* winners in order of resolution.
|
188 |
-
*
|
189 |
-
* This promise is rejected with a {@see AggregateException} if the number
|
190 |
-
* of fulfilled promises is less than the desired $count.
|
191 |
-
*
|
192 |
-
* @param int $count Total number of promises.
|
193 |
-
* @param mixed $promises Promises or values.
|
194 |
-
*
|
195 |
-
* @return PromiseInterface
|
196 |
-
*/
|
197 |
-
public static function some($count, $promises)
|
198 |
-
{
|
199 |
-
$results = [];
|
200 |
-
$rejections = [];
|
201 |
-
|
202 |
-
return Each::of(
|
203 |
-
$promises,
|
204 |
-
function ($value, $idx, PromiseInterface $p) use (&$results, $count) {
|
205 |
-
if (Is::settled($p)) {
|
206 |
-
return;
|
207 |
-
}
|
208 |
-
$results[$idx] = $value;
|
209 |
-
if (count($results) >= $count) {
|
210 |
-
$p->resolve(null);
|
211 |
-
}
|
212 |
-
},
|
213 |
-
function ($reason) use (&$rejections) {
|
214 |
-
$rejections[] = $reason;
|
215 |
-
}
|
216 |
-
)->then(
|
217 |
-
function () use (&$results, &$rejections, $count) {
|
218 |
-
if (count($results) !== $count) {
|
219 |
-
throw new AggregateException(
|
220 |
-
'Not enough promises to fulfill count',
|
221 |
-
$rejections
|
222 |
-
);
|
223 |
-
}
|
224 |
-
ksort($results);
|
225 |
-
return array_values($results);
|
226 |
-
}
|
227 |
-
);
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Like some(), with 1 as count. However, if the promise fulfills, the
|
232 |
-
* fulfillment value is not an array of 1 but the value directly.
|
233 |
-
*
|
234 |
-
* @param mixed $promises Promises or values.
|
235 |
-
*
|
236 |
-
* @return PromiseInterface
|
237 |
-
*/
|
238 |
-
public static function any($promises)
|
239 |
-
{
|
240 |
-
return self::some(1, $promises)->then(function ($values) {
|
241 |
-
return $values[0];
|
242 |
-
});
|
243 |
-
}
|
244 |
-
|
245 |
-
/**
|
246 |
-
* Returns a promise that is fulfilled when all of the provided promises have
|
247 |
-
* been fulfilled or rejected.
|
248 |
-
*
|
249 |
-
* The returned promise is fulfilled with an array of inspection state arrays.
|
250 |
-
*
|
251 |
-
* @see inspect for the inspection state array format.
|
252 |
-
*
|
253 |
-
* @param mixed $promises Promises or values.
|
254 |
-
*
|
255 |
-
* @return PromiseInterface
|
256 |
-
*/
|
257 |
-
public static function settle($promises)
|
258 |
-
{
|
259 |
-
$results = [];
|
260 |
-
|
261 |
-
return Each::of(
|
262 |
-
$promises,
|
263 |
-
function ($value, $idx) use (&$results) {
|
264 |
-
$results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value];
|
265 |
-
},
|
266 |
-
function ($reason, $idx) use (&$results) {
|
267 |
-
$results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason];
|
268 |
-
}
|
269 |
-
)->then(function () use (&$results) {
|
270 |
-
ksort($results);
|
271 |
-
return $results;
|
272 |
-
});
|
273 |
-
}
|
274 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/functions.php
DELETED
@@ -1,363 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Promise;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Get the global task queue used for promise resolution.
|
7 |
-
*
|
8 |
-
* This task queue MUST be run in an event loop in order for promises to be
|
9 |
-
* settled asynchronously. It will be automatically run when synchronously
|
10 |
-
* waiting on a promise.
|
11 |
-
*
|
12 |
-
* <code>
|
13 |
-
* while ($eventLoop->isRunning()) {
|
14 |
-
* GuzzleHttp\Promise\queue()->run();
|
15 |
-
* }
|
16 |
-
* </code>
|
17 |
-
*
|
18 |
-
* @param TaskQueueInterface $assign Optionally specify a new queue instance.
|
19 |
-
*
|
20 |
-
* @return TaskQueueInterface
|
21 |
-
*
|
22 |
-
* @deprecated queue will be removed in guzzlehttp/promises:2.0. Use Utils::queue instead.
|
23 |
-
*/
|
24 |
-
function queue(TaskQueueInterface $assign = null)
|
25 |
-
{
|
26 |
-
return Utils::queue($assign);
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Adds a function to run in the task queue when it is next `run()` and returns
|
31 |
-
* a promise that is fulfilled or rejected with the result.
|
32 |
-
*
|
33 |
-
* @param callable $task Task function to run.
|
34 |
-
*
|
35 |
-
* @return PromiseInterface
|
36 |
-
*
|
37 |
-
* @deprecated task will be removed in guzzlehttp/promises:2.0. Use Utils::task instead.
|
38 |
-
*/
|
39 |
-
function task(callable $task)
|
40 |
-
{
|
41 |
-
return Utils::task($task);
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Creates a promise for a value if the value is not a promise.
|
46 |
-
*
|
47 |
-
* @param mixed $value Promise or value.
|
48 |
-
*
|
49 |
-
* @return PromiseInterface
|
50 |
-
*
|
51 |
-
* @deprecated promise_for will be removed in guzzlehttp/promises:2.0. Use Create::promiseFor instead.
|
52 |
-
*/
|
53 |
-
function promise_for($value)
|
54 |
-
{
|
55 |
-
return Create::promiseFor($value);
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Creates a rejected promise for a reason if the reason is not a promise. If
|
60 |
-
* the provided reason is a promise, then it is returned as-is.
|
61 |
-
*
|
62 |
-
* @param mixed $reason Promise or reason.
|
63 |
-
*
|
64 |
-
* @return PromiseInterface
|
65 |
-
*
|
66 |
-
* @deprecated rejection_for will be removed in guzzlehttp/promises:2.0. Use Create::rejectionFor instead.
|
67 |
-
*/
|
68 |
-
function rejection_for($reason)
|
69 |
-
{
|
70 |
-
return Create::rejectionFor($reason);
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Create an exception for a rejected promise value.
|
75 |
-
*
|
76 |
-
* @param mixed $reason
|
77 |
-
*
|
78 |
-
* @return \Exception|\Throwable
|
79 |
-
*
|
80 |
-
* @deprecated exception_for will be removed in guzzlehttp/promises:2.0. Use Create::exceptionFor instead.
|
81 |
-
*/
|
82 |
-
function exception_for($reason)
|
83 |
-
{
|
84 |
-
return Create::exceptionFor($reason);
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Returns an iterator for the given value.
|
89 |
-
*
|
90 |
-
* @param mixed $value
|
91 |
-
*
|
92 |
-
* @return \Iterator
|
93 |
-
*
|
94 |
-
* @deprecated iter_for will be removed in guzzlehttp/promises:2.0. Use Create::iterFor instead.
|
95 |
-
*/
|
96 |
-
function iter_for($value)
|
97 |
-
{
|
98 |
-
return Create::iterFor($value);
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Synchronously waits on a promise to resolve and returns an inspection state
|
103 |
-
* array.
|
104 |
-
*
|
105 |
-
* Returns a state associative array containing a "state" key mapping to a
|
106 |
-
* valid promise state. If the state of the promise is "fulfilled", the array
|
107 |
-
* will contain a "value" key mapping to the fulfilled value of the promise. If
|
108 |
-
* the promise is rejected, the array will contain a "reason" key mapping to
|
109 |
-
* the rejection reason of the promise.
|
110 |
-
*
|
111 |
-
* @param PromiseInterface $promise Promise or value.
|
112 |
-
*
|
113 |
-
* @return array
|
114 |
-
*
|
115 |
-
* @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspect instead.
|
116 |
-
*/
|
117 |
-
function inspect(PromiseInterface $promise)
|
118 |
-
{
|
119 |
-
return Utils::inspect($promise);
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Waits on all of the provided promises, but does not unwrap rejected promises
|
124 |
-
* as thrown exception.
|
125 |
-
*
|
126 |
-
* Returns an array of inspection state arrays.
|
127 |
-
*
|
128 |
-
* @see inspect for the inspection state array format.
|
129 |
-
*
|
130 |
-
* @param PromiseInterface[] $promises Traversable of promises to wait upon.
|
131 |
-
*
|
132 |
-
* @return array
|
133 |
-
*
|
134 |
-
* @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspectAll instead.
|
135 |
-
*/
|
136 |
-
function inspect_all($promises)
|
137 |
-
{
|
138 |
-
return Utils::inspectAll($promises);
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Waits on all of the provided promises and returns the fulfilled values.
|
143 |
-
*
|
144 |
-
* Returns an array that contains the value of each promise (in the same order
|
145 |
-
* the promises were provided). An exception is thrown if any of the promises
|
146 |
-
* are rejected.
|
147 |
-
*
|
148 |
-
* @param iterable<PromiseInterface> $promises Iterable of PromiseInterface objects to wait on.
|
149 |
-
*
|
150 |
-
* @return array
|
151 |
-
*
|
152 |
-
* @throws \Exception on error
|
153 |
-
* @throws \Throwable on error in PHP >=7
|
154 |
-
*
|
155 |
-
* @deprecated unwrap will be removed in guzzlehttp/promises:2.0. Use Utils::unwrap instead.
|
156 |
-
*/
|
157 |
-
function unwrap($promises)
|
158 |
-
{
|
159 |
-
return Utils::unwrap($promises);
|
160 |
-
}
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Given an array of promises, return a promise that is fulfilled when all the
|
164 |
-
* items in the array are fulfilled.
|
165 |
-
*
|
166 |
-
* The promise's fulfillment value is an array with fulfillment values at
|
167 |
-
* respective positions to the original array. If any promise in the array
|
168 |
-
* rejects, the returned promise is rejected with the rejection reason.
|
169 |
-
*
|
170 |
-
* @param mixed $promises Promises or values.
|
171 |
-
* @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution.
|
172 |
-
*
|
173 |
-
* @return PromiseInterface
|
174 |
-
*
|
175 |
-
* @deprecated all will be removed in guzzlehttp/promises:2.0. Use Utils::all instead.
|
176 |
-
*/
|
177 |
-
function all($promises, $recursive = false)
|
178 |
-
{
|
179 |
-
return Utils::all($promises, $recursive);
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Initiate a competitive race between multiple promises or values (values will
|
184 |
-
* become immediately fulfilled promises).
|
185 |
-
*
|
186 |
-
* When count amount of promises have been fulfilled, the returned promise is
|
187 |
-
* fulfilled with an array that contains the fulfillment values of the winners
|
188 |
-
* in order of resolution.
|
189 |
-
*
|
190 |
-
* This promise is rejected with a {@see AggregateException} if the number of
|
191 |
-
* fulfilled promises is less than the desired $count.
|
192 |
-
*
|
193 |
-
* @param int $count Total number of promises.
|
194 |
-
* @param mixed $promises Promises or values.
|
195 |
-
*
|
196 |
-
* @return PromiseInterface
|
197 |
-
*
|
198 |
-
* @deprecated some will be removed in guzzlehttp/promises:2.0. Use Utils::some instead.
|
199 |
-
*/
|
200 |
-
function some($count, $promises)
|
201 |
-
{
|
202 |
-
return Utils::some($count, $promises);
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Like some(), with 1 as count. However, if the promise fulfills, the
|
207 |
-
* fulfillment value is not an array of 1 but the value directly.
|
208 |
-
*
|
209 |
-
* @param mixed $promises Promises or values.
|
210 |
-
*
|
211 |
-
* @return PromiseInterface
|
212 |
-
*
|
213 |
-
* @deprecated any will be removed in guzzlehttp/promises:2.0. Use Utils::any instead.
|
214 |
-
*/
|
215 |
-
function any($promises)
|
216 |
-
{
|
217 |
-
return Utils::any($promises);
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Returns a promise that is fulfilled when all of the provided promises have
|
222 |
-
* been fulfilled or rejected.
|
223 |
-
*
|
224 |
-
* The returned promise is fulfilled with an array of inspection state arrays.
|
225 |
-
*
|
226 |
-
* @see inspect for the inspection state array format.
|
227 |
-
*
|
228 |
-
* @param mixed $promises Promises or values.
|
229 |
-
*
|
230 |
-
* @return PromiseInterface
|
231 |
-
*
|
232 |
-
* @deprecated settle will be removed in guzzlehttp/promises:2.0. Use Utils::settle instead.
|
233 |
-
*/
|
234 |
-
function settle($promises)
|
235 |
-
{
|
236 |
-
return Utils::settle($promises);
|
237 |
-
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Given an iterator that yields promises or values, returns a promise that is
|
241 |
-
* fulfilled with a null value when the iterator has been consumed or the
|
242 |
-
* aggregate promise has been fulfilled or rejected.
|
243 |
-
*
|
244 |
-
* $onFulfilled is a function that accepts the fulfilled value, iterator index,
|
245 |
-
* and the aggregate promise. The callback can invoke any necessary side
|
246 |
-
* effects and choose to resolve or reject the aggregate if needed.
|
247 |
-
*
|
248 |
-
* $onRejected is a function that accepts the rejection reason, iterator index,
|
249 |
-
* and the aggregate promise. The callback can invoke any necessary side
|
250 |
-
* effects and choose to resolve or reject the aggregate if needed.
|
251 |
-
*
|
252 |
-
* @param mixed $iterable Iterator or array to iterate over.
|
253 |
-
* @param callable $onFulfilled
|
254 |
-
* @param callable $onRejected
|
255 |
-
*
|
256 |
-
* @return PromiseInterface
|
257 |
-
*
|
258 |
-
* @deprecated each will be removed in guzzlehttp/promises:2.0. Use Each::of instead.
|
259 |
-
*/
|
260 |
-
function each(
|
261 |
-
$iterable,
|
262 |
-
callable $onFulfilled = null,
|
263 |
-
callable $onRejected = null
|
264 |
-
) {
|
265 |
-
return Each::of($iterable, $onFulfilled, $onRejected);
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Like each, but only allows a certain number of outstanding promises at any
|
270 |
-
* given time.
|
271 |
-
*
|
272 |
-
* $concurrency may be an integer or a function that accepts the number of
|
273 |
-
* pending promises and returns a numeric concurrency limit value to allow for
|
274 |
-
* dynamic a concurrency size.
|
275 |
-
*
|
276 |
-
* @param mixed $iterable
|
277 |
-
* @param int|callable $concurrency
|
278 |
-
* @param callable $onFulfilled
|
279 |
-
* @param callable $onRejected
|
280 |
-
*
|
281 |
-
* @return PromiseInterface
|
282 |
-
*
|
283 |
-
* @deprecated each_limit will be removed in guzzlehttp/promises:2.0. Use Each::ofLimit instead.
|
284 |
-
*/
|
285 |
-
function each_limit(
|
286 |
-
$iterable,
|
287 |
-
$concurrency,
|
288 |
-
callable $onFulfilled = null,
|
289 |
-
callable $onRejected = null
|
290 |
-
) {
|
291 |
-
return Each::ofLimit($iterable, $concurrency, $onFulfilled, $onRejected);
|
292 |
-
}
|
293 |
-
|
294 |
-
/**
|
295 |
-
* Like each_limit, but ensures that no promise in the given $iterable argument
|
296 |
-
* is rejected. If any promise is rejected, then the aggregate promise is
|
297 |
-
* rejected with the encountered rejection.
|
298 |
-
*
|
299 |
-
* @param mixed $iterable
|
300 |
-
* @param int|callable $concurrency
|
301 |
-
* @param callable $onFulfilled
|
302 |
-
*
|
303 |
-
* @return PromiseInterface
|
304 |
-
*
|
305 |
-
* @deprecated each_limit_all will be removed in guzzlehttp/promises:2.0. Use Each::ofLimitAll instead.
|
306 |
-
*/
|
307 |
-
function each_limit_all(
|
308 |
-
$iterable,
|
309 |
-
$concurrency,
|
310 |
-
callable $onFulfilled = null
|
311 |
-
) {
|
312 |
-
return Each::ofLimitAll($iterable, $concurrency, $onFulfilled);
|
313 |
-
}
|
314 |
-
|
315 |
-
/**
|
316 |
-
* Returns true if a promise is fulfilled.
|
317 |
-
*
|
318 |
-
* @return bool
|
319 |
-
*
|
320 |
-
* @deprecated is_fulfilled will be removed in guzzlehttp/promises:2.0. Use Is::fulfilled instead.
|
321 |
-
*/
|
322 |
-
function is_fulfilled(PromiseInterface $promise)
|
323 |
-
{
|
324 |
-
return Is::fulfilled($promise);
|
325 |
-
}
|
326 |
-
|
327 |
-
/**
|
328 |
-
* Returns true if a promise is rejected.
|
329 |
-
*
|
330 |
-
* @return bool
|
331 |
-
*
|
332 |
-
* @deprecated is_rejected will be removed in guzzlehttp/promises:2.0. Use Is::rejected instead.
|
333 |
-
*/
|
334 |
-
function is_rejected(PromiseInterface $promise)
|
335 |
-
{
|
336 |
-
return Is::rejected($promise);
|
337 |
-
}
|
338 |
-
|
339 |
-
/**
|
340 |
-
* Returns true if a promise is fulfilled or rejected.
|
341 |
-
*
|
342 |
-
* @return bool
|
343 |
-
*
|
344 |
-
* @deprecated is_settled will be removed in guzzlehttp/promises:2.0. Use Is::settled instead.
|
345 |
-
*/
|
346 |
-
function is_settled(PromiseInterface $promise)
|
347 |
-
{
|
348 |
-
return Is::settled($promise);
|
349 |
-
}
|
350 |
-
|
351 |
-
/**
|
352 |
-
* Create a new coroutine.
|
353 |
-
*
|
354 |
-
* @see Coroutine
|
355 |
-
*
|
356 |
-
* @return PromiseInterface
|
357 |
-
*
|
358 |
-
* @deprecated coroutine will be removed in guzzlehttp/promises:2.0. Use Coroutine::of instead.
|
359 |
-
*/
|
360 |
-
function coroutine(callable $generatorFn)
|
361 |
-
{
|
362 |
-
return Coroutine::of($generatorFn);
|
363 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/promises/src/functions_include.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Don't redefine the functions if included multiple times.
|
4 |
-
if (!function_exists('GuzzleHttp\Promise\promise_for')) {
|
5 |
-
require __DIR__ . '/functions.php';
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/CHANGELOG.md
DELETED
@@ -1,270 +0,0 @@
|
|
1 |
-
# Change Log
|
2 |
-
|
3 |
-
|
4 |
-
All notable changes to this project will be documented in this file.
|
5 |
-
|
6 |
-
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
7 |
-
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
8 |
-
|
9 |
-
|
10 |
-
## [Unreleased]
|
11 |
-
|
12 |
-
## [1.7.0] - 2020-09-30
|
13 |
-
|
14 |
-
### Added
|
15 |
-
|
16 |
-
- Replaced functions by static methods
|
17 |
-
|
18 |
-
### Fixed
|
19 |
-
|
20 |
-
- Converting a non-seekable stream to a string
|
21 |
-
- Handle multiple Set-Cookie correctly
|
22 |
-
- Ignore array keys in header values when merging
|
23 |
-
- Allow multibyte characters to be parsed in `Message:bodySummary()`
|
24 |
-
|
25 |
-
### Changed
|
26 |
-
|
27 |
-
- Restored partial HHVM 3 support
|
28 |
-
|
29 |
-
|
30 |
-
## [1.6.1] - 2019-07-02
|
31 |
-
|
32 |
-
### Fixed
|
33 |
-
|
34 |
-
- Accept null and bool header values again
|
35 |
-
|
36 |
-
|
37 |
-
## [1.6.0] - 2019-06-30
|
38 |
-
|
39 |
-
### Added
|
40 |
-
|
41 |
-
- Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244)
|
42 |
-
- Added MIME type for WEBP image format (#246)
|
43 |
-
- Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272)
|
44 |
-
|
45 |
-
### Changed
|
46 |
-
|
47 |
-
- Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262)
|
48 |
-
- Accept port number 0 to be valid (#270)
|
49 |
-
|
50 |
-
### Fixed
|
51 |
-
|
52 |
-
- Fixed subsequent reads from `php://input` in ServerRequest (#247)
|
53 |
-
- Fixed readable/writable detection for certain stream modes (#248)
|
54 |
-
- Fixed encoding of special characters in the `userInfo` component of an URI (#253)
|
55 |
-
|
56 |
-
|
57 |
-
## [1.5.2] - 2018-12-04
|
58 |
-
|
59 |
-
### Fixed
|
60 |
-
|
61 |
-
- Check body size when getting the message summary
|
62 |
-
|
63 |
-
|
64 |
-
## [1.5.1] - 2018-12-04
|
65 |
-
|
66 |
-
### Fixed
|
67 |
-
|
68 |
-
- Get the summary of a body only if it is readable
|
69 |
-
|
70 |
-
|
71 |
-
## [1.5.0] - 2018-12-03
|
72 |
-
|
73 |
-
### Added
|
74 |
-
|
75 |
-
- Response first-line to response string exception (fixes #145)
|
76 |
-
- A test for #129 behavior
|
77 |
-
- `get_message_body_summary` function in order to get the message summary
|
78 |
-
- `3gp` and `mkv` mime types
|
79 |
-
|
80 |
-
### Changed
|
81 |
-
|
82 |
-
- Clarify exception message when stream is detached
|
83 |
-
|
84 |
-
### Deprecated
|
85 |
-
|
86 |
-
- Deprecated parsing folded header lines as per RFC 7230
|
87 |
-
|
88 |
-
### Fixed
|
89 |
-
|
90 |
-
- Fix `AppendStream::detach` to not close streams
|
91 |
-
- `InflateStream` preserves `isSeekable` attribute of the underlying stream
|
92 |
-
- `ServerRequest::getUriFromGlobals` to support URLs in query parameters
|
93 |
-
|
94 |
-
|
95 |
-
Several other fixes and improvements.
|
96 |
-
|
97 |
-
|
98 |
-
## [1.4.2] - 2017-03-20
|
99 |
-
|
100 |
-
### Fixed
|
101 |
-
|
102 |
-
- Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
|
103 |
-
calls to `trigger_error` when deprecated methods are invoked.
|
104 |
-
|
105 |
-
|
106 |
-
## [1.4.1] - 2017-02-27
|
107 |
-
|
108 |
-
### Added
|
109 |
-
|
110 |
-
- Rriggering of silenced deprecation warnings.
|
111 |
-
|
112 |
-
### Fixed
|
113 |
-
|
114 |
-
- Reverted BC break by reintroducing behavior to automagically fix a URI with a
|
115 |
-
relative path and an authority by adding a leading slash to the path. It's only
|
116 |
-
deprecated now.
|
117 |
-
|
118 |
-
|
119 |
-
## [1.4.0] - 2017-02-21
|
120 |
-
|
121 |
-
### Added
|
122 |
-
|
123 |
-
- Added common URI utility methods based on RFC 3986 (see documentation in the readme):
|
124 |
-
- `Uri::isDefaultPort`
|
125 |
-
- `Uri::isAbsolute`
|
126 |
-
- `Uri::isNetworkPathReference`
|
127 |
-
- `Uri::isAbsolutePathReference`
|
128 |
-
- `Uri::isRelativePathReference`
|
129 |
-
- `Uri::isSameDocumentReference`
|
130 |
-
- `Uri::composeComponents`
|
131 |
-
- `UriNormalizer::normalize`
|
132 |
-
- `UriNormalizer::isEquivalent`
|
133 |
-
- `UriResolver::relativize`
|
134 |
-
|
135 |
-
### Changed
|
136 |
-
|
137 |
-
- Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
|
138 |
-
- Allow `parse_response` to parse a response without delimiting space and reason.
|
139 |
-
- Ensure each URI modification results in a valid URI according to PSR-7 discussions.
|
140 |
-
Invalid modifications will throw an exception instead of returning a wrong URI or
|
141 |
-
doing some magic.
|
142 |
-
- `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
|
143 |
-
because the path of a URI with an authority must start with a slash "/" or be empty
|
144 |
-
- `(new Uri())->withScheme('http')` will return `'http://localhost'`
|
145 |
-
|
146 |
-
### Deprecated
|
147 |
-
|
148 |
-
- `Uri::resolve` in favor of `UriResolver::resolve`
|
149 |
-
- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
|
150 |
-
|
151 |
-
### Fixed
|
152 |
-
|
153 |
-
- `Stream::read` when length parameter <= 0.
|
154 |
-
- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
|
155 |
-
- `ServerRequest::getUriFromGlobals` when `Host` header contains port.
|
156 |
-
- Compatibility of URIs with `file` scheme and empty host.
|
157 |
-
|
158 |
-
|
159 |
-
## [1.3.1] - 2016-06-25
|
160 |
-
|
161 |
-
### Fixed
|
162 |
-
|
163 |
-
- `Uri::__toString` for network path references, e.g. `//example.org`.
|
164 |
-
- Missing lowercase normalization for host.
|
165 |
-
- Handling of URI components in case they are `'0'` in a lot of places,
|
166 |
-
e.g. as a user info password.
|
167 |
-
- `Uri::withAddedHeader` to correctly merge headers with different case.
|
168 |
-
- Trimming of header values in `Uri::withAddedHeader`. Header values may
|
169 |
-
be surrounded by whitespace which should be ignored according to RFC 7230
|
170 |
-
Section 3.2.4. This does not apply to header names.
|
171 |
-
- `Uri::withAddedHeader` with an array of header values.
|
172 |
-
- `Uri::resolve` when base path has no slash and handling of fragment.
|
173 |
-
- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the
|
174 |
-
key/value both in encoded as well as decoded form to those methods. This is
|
175 |
-
consistent with withPath, withQuery etc.
|
176 |
-
- `ServerRequest::withoutAttribute` when attribute value is null.
|
177 |
-
|
178 |
-
|
179 |
-
## [1.3.0] - 2016-04-13
|
180 |
-
|
181 |
-
### Added
|
182 |
-
|
183 |
-
- Remaining interfaces needed for full PSR7 compatibility
|
184 |
-
(ServerRequestInterface, UploadedFileInterface, etc.).
|
185 |
-
- Support for stream_for from scalars.
|
186 |
-
|
187 |
-
### Changed
|
188 |
-
|
189 |
-
- Can now extend Uri.
|
190 |
-
|
191 |
-
### Fixed
|
192 |
-
- A bug in validating request methods by making it more permissive.
|
193 |
-
|
194 |
-
|
195 |
-
## [1.2.3] - 2016-02-18
|
196 |
-
|
197 |
-
### Fixed
|
198 |
-
|
199 |
-
- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
|
200 |
-
streams, which can sometimes return fewer bytes than requested with `fread`.
|
201 |
-
- Handling of gzipped responses with FNAME headers.
|
202 |
-
|
203 |
-
|
204 |
-
## [1.2.2] - 2016-01-22
|
205 |
-
|
206 |
-
### Added
|
207 |
-
|
208 |
-
- Support for URIs without any authority.
|
209 |
-
- Support for HTTP 451 'Unavailable For Legal Reasons.'
|
210 |
-
- Support for using '0' as a filename.
|
211 |
-
- Support for including non-standard ports in Host headers.
|
212 |
-
|
213 |
-
|
214 |
-
## [1.2.1] - 2015-11-02
|
215 |
-
|
216 |
-
### Changes
|
217 |
-
|
218 |
-
- Now supporting negative offsets when seeking to SEEK_END.
|
219 |
-
|
220 |
-
|
221 |
-
## [1.2.0] - 2015-08-15
|
222 |
-
|
223 |
-
### Changed
|
224 |
-
|
225 |
-
- Body as `"0"` is now properly added to a response.
|
226 |
-
- Now allowing forward seeking in CachingStream.
|
227 |
-
- Now properly parsing HTTP requests that contain proxy targets in
|
228 |
-
`parse_request`.
|
229 |
-
- functions.php is now conditionally required.
|
230 |
-
- user-info is no longer dropped when resolving URIs.
|
231 |
-
|
232 |
-
|
233 |
-
## [1.1.0] - 2015-06-24
|
234 |
-
|
235 |
-
### Changed
|
236 |
-
|
237 |
-
- URIs can now be relative.
|
238 |
-
- `multipart/form-data` headers are now overridden case-insensitively.
|
239 |
-
- URI paths no longer encode the following characters because they are allowed
|
240 |
-
in URIs: "(", ")", "*", "!", "'"
|
241 |
-
- A port is no longer added to a URI when the scheme is missing and no port is
|
242 |
-
present.
|
243 |
-
|
244 |
-
|
245 |
-
## 1.0.0 - 2015-05-19
|
246 |
-
|
247 |
-
Initial release.
|
248 |
-
|
249 |
-
Currently unsupported:
|
250 |
-
|
251 |
-
- `Psr\Http\Message\ServerRequestInterface`
|
252 |
-
- `Psr\Http\Message\UploadedFileInterface`
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
[Unreleased]: https://github.com/guzzle/psr7/compare/1.6.0...HEAD
|
257 |
-
[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0
|
258 |
-
[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2
|
259 |
-
[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1
|
260 |
-
[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0
|
261 |
-
[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2
|
262 |
-
[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1
|
263 |
-
[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0
|
264 |
-
[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1
|
265 |
-
[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0
|
266 |
-
[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3
|
267 |
-
[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2
|
268 |
-
[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1
|
269 |
-
[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0
|
270 |
-
[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
Copyright (c) 2015 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
|
2 |
-
|
3 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
-
of this software and associated documentation files (the "Software"), to deal
|
5 |
-
in the Software without restriction, including without limitation the rights
|
6 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
-
copies of the Software, and to permit persons to whom the Software is
|
8 |
-
furnished to do so, subject to the following conditions:
|
9 |
-
|
10 |
-
The above copyright notice and this permission notice shall be included in
|
11 |
-
all copies or substantial portions of the Software.
|
12 |
-
|
13 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/README.md
DELETED
@@ -1,809 +0,0 @@
|
|
1 |
-
# PSR-7 Message Implementation
|
2 |
-
|
3 |
-
This repository contains a full [PSR-7](http://www.php-fig.org/psr/psr-7/)
|
4 |
-
message implementation, several stream decorators, and some helpful
|
5 |
-
functionality like query string parsing.
|
6 |
-
|
7 |
-
|
8 |
-
[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7)
|
9 |
-
|
10 |
-
|
11 |
-
# Stream implementation
|
12 |
-
|
13 |
-
This package comes with a number of stream implementations and stream
|
14 |
-
decorators.
|
15 |
-
|
16 |
-
|
17 |
-
## AppendStream
|
18 |
-
|
19 |
-
`GuzzleHttp\Psr7\AppendStream`
|
20 |
-
|
21 |
-
Reads from multiple streams, one after the other.
|
22 |
-
|
23 |
-
```php
|
24 |
-
use GuzzleHttp\Psr7;
|
25 |
-
|
26 |
-
$a = Psr7\Utils::streamFor('abc, ');
|
27 |
-
$b = Psr7\Utils::streamFor('123.');
|
28 |
-
$composed = new Psr7\AppendStream([$a, $b]);
|
29 |
-
|
30 |
-
$composed->addStream(Psr7\Utils::streamFor(' Above all listen to me'));
|
31 |
-
|
32 |
-
echo $composed; // abc, 123. Above all listen to me.
|
33 |
-
```
|
34 |
-
|
35 |
-
|
36 |
-
## BufferStream
|
37 |
-
|
38 |
-
`GuzzleHttp\Psr7\BufferStream`
|
39 |
-
|
40 |
-
Provides a buffer stream that can be written to fill a buffer, and read
|
41 |
-
from to remove bytes from the buffer.
|
42 |
-
|
43 |
-
This stream returns a "hwm" metadata value that tells upstream consumers
|
44 |
-
what the configured high water mark of the stream is, or the maximum
|
45 |
-
preferred size of the buffer.
|
46 |
-
|
47 |
-
```php
|
48 |
-
use GuzzleHttp\Psr7;
|
49 |
-
|
50 |
-
// When more than 1024 bytes are in the buffer, it will begin returning
|
51 |
-
// false to writes. This is an indication that writers should slow down.
|
52 |
-
$buffer = new Psr7\BufferStream(1024);
|
53 |
-
```
|
54 |
-
|
55 |
-
|
56 |
-
## CachingStream
|
57 |
-
|
58 |
-
The CachingStream is used to allow seeking over previously read bytes on
|
59 |
-
non-seekable streams. This can be useful when transferring a non-seekable
|
60 |
-
entity body fails due to needing to rewind the stream (for example, resulting
|
61 |
-
from a redirect). Data that is read from the remote stream will be buffered in
|
62 |
-
a PHP temp stream so that previously read bytes are cached first in memory,
|
63 |
-
then on disk.
|
64 |
-
|
65 |
-
```php
|
66 |
-
use GuzzleHttp\Psr7;
|
67 |
-
|
68 |
-
$original = Psr7\Utils::streamFor(fopen('http://www.google.com', 'r'));
|
69 |
-
$stream = new Psr7\CachingStream($original);
|
70 |
-
|
71 |
-
$stream->read(1024);
|
72 |
-
echo $stream->tell();
|
73 |
-
// 1024
|
74 |
-
|
75 |
-
$stream->seek(0);
|
76 |
-
echo $stream->tell();
|
77 |
-
// 0
|
78 |
-
```
|
79 |
-
|
80 |
-
|
81 |
-
## DroppingStream
|
82 |
-
|
83 |
-
`GuzzleHttp\Psr7\DroppingStream`
|
84 |
-
|
85 |
-
Stream decorator that begins dropping data once the size of the underlying
|
86 |
-
stream becomes too full.
|
87 |
-
|
88 |
-
```php
|
89 |
-
use GuzzleHttp\Psr7;
|
90 |
-
|
91 |
-
// Create an empty stream
|
92 |
-
$stream = Psr7\Utils::streamFor();
|
93 |
-
|
94 |
-
// Start dropping data when the stream has more than 10 bytes
|
95 |
-
$dropping = new Psr7\DroppingStream($stream, 10);
|
96 |
-
|
97 |
-
$dropping->write('01234567890123456789');
|
98 |
-
echo $stream; // 0123456789
|
99 |
-
```
|
100 |
-
|
101 |
-
|
102 |
-
## FnStream
|
103 |
-
|
104 |
-
`GuzzleHttp\Psr7\FnStream`
|
105 |
-
|
106 |
-
Compose stream implementations based on a hash of functions.
|
107 |
-
|
108 |
-
Allows for easy testing and extension of a provided stream without needing
|
109 |
-
to create a concrete class for a simple extension point.
|
110 |
-
|
111 |
-
```php
|
112 |
-
|
113 |
-
use GuzzleHttp\Psr7;
|
114 |
-
|
115 |
-
$stream = Psr7\Utils::streamFor('hi');
|
116 |
-
$fnStream = Psr7\FnStream::decorate($stream, [
|
117 |
-
'rewind' => function () use ($stream) {
|
118 |
-
echo 'About to rewind - ';
|
119 |
-
$stream->rewind();
|
120 |
-
echo 'rewound!';
|
121 |
-
}
|
122 |
-
]);
|
123 |
-
|
124 |
-
$fnStream->rewind();
|
125 |
-
// Outputs: About to rewind - rewound!
|
126 |
-
```
|
127 |
-
|
128 |
-
|
129 |
-
## InflateStream
|
130 |
-
|
131 |
-
`GuzzleHttp\Psr7\InflateStream`
|
132 |
-
|
133 |
-
Uses PHP's zlib.inflate filter to inflate deflate or gzipped content.
|
134 |
-
|
135 |
-
This stream decorator skips the first 10 bytes of the given stream to remove
|
136 |
-
the gzip header, converts the provided stream to a PHP stream resource,
|
137 |
-
then appends the zlib.inflate filter. The stream is then converted back
|
138 |
-
to a Guzzle stream resource to be used as a Guzzle stream.
|
139 |
-
|
140 |
-
|
141 |
-
## LazyOpenStream
|
142 |
-
|
143 |
-
`GuzzleHttp\Psr7\LazyOpenStream`
|
144 |
-
|
145 |
-
Lazily reads or writes to a file that is opened only after an IO operation
|
146 |
-
take place on the stream.
|
147 |
-
|
148 |
-
```php
|
149 |
-
use GuzzleHttp\Psr7;
|
150 |
-
|
151 |
-
$stream = new Psr7\LazyOpenStream('/path/to/file', 'r');
|
152 |
-
// The file has not yet been opened...
|
153 |
-
|
154 |
-
echo $stream->read(10);
|
155 |
-
// The file is opened and read from only when needed.
|
156 |
-
```
|
157 |
-
|
158 |
-
|
159 |
-
## LimitStream
|
160 |
-
|
161 |
-
`GuzzleHttp\Psr7\LimitStream`
|
162 |
-
|
163 |
-
LimitStream can be used to read a subset or slice of an existing stream object.
|
164 |
-
This can be useful for breaking a large file into smaller pieces to be sent in
|
165 |
-
chunks (e.g. Amazon S3's multipart upload API).
|
166 |
-
|
167 |
-
```php
|
168 |
-
use GuzzleHttp\Psr7;
|
169 |
-
|
170 |
-
$original = Psr7\Utils::streamFor(fopen('/tmp/test.txt', 'r+'));
|
171 |
-
echo $original->getSize();
|
172 |
-
// >>> 1048576
|
173 |
-
|
174 |
-
// Limit the size of the body to 1024 bytes and start reading from byte 2048
|
175 |
-
$stream = new Psr7\LimitStream($original, 1024, 2048);
|
176 |
-
echo $stream->getSize();
|
177 |
-
// >>> 1024
|
178 |
-
echo $stream->tell();
|
179 |
-
// >>> 0
|
180 |
-
```
|
181 |
-
|
182 |
-
|
183 |
-
## MultipartStream
|
184 |
-
|
185 |
-
`GuzzleHttp\Psr7\MultipartStream`
|
186 |
-
|
187 |
-
Stream that when read returns bytes for a streaming multipart or
|
188 |
-
multipart/form-data stream.
|
189 |
-
|
190 |
-
|
191 |
-
## NoSeekStream
|
192 |
-
|
193 |
-
`GuzzleHttp\Psr7\NoSeekStream`
|
194 |
-
|
195 |
-
NoSeekStream wraps a stream and does not allow seeking.
|
196 |
-
|
197 |
-
```php
|
198 |
-
use GuzzleHttp\Psr7;
|
199 |
-
|
200 |
-
$original = Psr7\Utils::streamFor('foo');
|
201 |
-
$noSeek = new Psr7\NoSeekStream($original);
|
202 |
-
|
203 |
-
echo $noSeek->read(3);
|
204 |
-
// foo
|
205 |
-
var_export($noSeek->isSeekable());
|
206 |
-
// false
|
207 |
-
$noSeek->seek(0);
|
208 |
-
var_export($noSeek->read(3));
|
209 |
-
// NULL
|
210 |
-
```
|
211 |
-
|
212 |
-
|
213 |
-
## PumpStream
|
214 |
-
|
215 |
-
`GuzzleHttp\Psr7\PumpStream`
|
216 |
-
|
217 |
-
Provides a read only stream that pumps data from a PHP callable.
|
218 |
-
|
219 |
-
When invoking the provided callable, the PumpStream will pass the amount of
|
220 |
-
data requested to read to the callable. The callable can choose to ignore
|
221 |
-
this value and return fewer or more bytes than requested. Any extra data
|
222 |
-
returned by the provided callable is buffered internally until drained using
|
223 |
-
the read() function of the PumpStream. The provided callable MUST return
|
224 |
-
false when there is no more data to read.
|
225 |
-
|
226 |
-
|
227 |
-
## Implementing stream decorators
|
228 |
-
|
229 |
-
Creating a stream decorator is very easy thanks to the
|
230 |
-
`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that
|
231 |
-
implement `Psr\Http\Message\StreamInterface` by proxying to an underlying
|
232 |
-
stream. Just `use` the `StreamDecoratorTrait` and implement your custom
|
233 |
-
methods.
|
234 |
-
|
235 |
-
For example, let's say we wanted to call a specific function each time the last
|
236 |
-
byte is read from a stream. This could be implemented by overriding the
|
237 |
-
`read()` method.
|
238 |
-
|
239 |
-
```php
|
240 |
-
use Psr\Http\Message\StreamInterface;
|
241 |
-
use GuzzleHttp\Psr7\StreamDecoratorTrait;
|
242 |
-
|
243 |
-
class EofCallbackStream implements StreamInterface
|
244 |
-
{
|
245 |
-
use StreamDecoratorTrait;
|
246 |
-
|
247 |
-
private $callback;
|
248 |
-
|
249 |
-
public function __construct(StreamInterface $stream, callable $cb)
|
250 |
-
{
|
251 |
-
$this->stream = $stream;
|
252 |
-
$this->callback = $cb;
|
253 |
-
}
|
254 |
-
|
255 |
-
public function read($length)
|
256 |
-
{
|
257 |
-
$result = $this->stream->read($length);
|
258 |
-
|
259 |
-
// Invoke the callback when EOF is hit.
|
260 |
-
if ($this->eof()) {
|
261 |
-
call_user_func($this->callback);
|
262 |
-
}
|
263 |
-
|
264 |
-
return $result;
|
265 |
-
}
|
266 |
-
}
|
267 |
-
```
|
268 |
-
|
269 |
-
This decorator could be added to any existing stream and used like so:
|
270 |
-
|
271 |
-
```php
|
272 |
-
use GuzzleHttp\Psr7;
|
273 |
-
|
274 |
-
$original = Psr7\Utils::streamFor('foo');
|
275 |
-
|
276 |
-
$eofStream = new EofCallbackStream($original, function () {
|
277 |
-
echo 'EOF!';
|
278 |
-
});
|
279 |
-
|
280 |
-
$eofStream->read(2);
|
281 |
-
$eofStream->read(1);
|
282 |
-
// echoes "EOF!"
|
283 |
-
$eofStream->seek(0);
|
284 |
-
$eofStream->read(3);
|
285 |
-
// echoes "EOF!"
|
286 |
-
```
|
287 |
-
|
288 |
-
|
289 |
-
## PHP StreamWrapper
|
290 |
-
|
291 |
-
You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a
|
292 |
-
PSR-7 stream as a PHP stream resource.
|
293 |
-
|
294 |
-
Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP
|
295 |
-
stream from a PSR-7 stream.
|
296 |
-
|
297 |
-
```php
|
298 |
-
use GuzzleHttp\Psr7\StreamWrapper;
|
299 |
-
|
300 |
-
$stream = GuzzleHttp\Psr7\Utils::streamFor('hello!');
|
301 |
-
$resource = StreamWrapper::getResource($stream);
|
302 |
-
echo fread($resource, 6); // outputs hello!
|
303 |
-
```
|
304 |
-
|
305 |
-
|
306 |
-
# Static API
|
307 |
-
|
308 |
-
There are various static methods available under the `GuzzleHttp\Psr7` namespace.
|
309 |
-
|
310 |
-
|
311 |
-
## `GuzzleHttp\Psr7\Message::toString`
|
312 |
-
|
313 |
-
`public static function toString(MessageInterface $message): string`
|
314 |
-
|
315 |
-
Returns the string representation of an HTTP message.
|
316 |
-
|
317 |
-
```php
|
318 |
-
$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com');
|
319 |
-
echo GuzzleHttp\Psr7\Message::toString($request);
|
320 |
-
```
|
321 |
-
|
322 |
-
|
323 |
-
## `GuzzleHttp\Psr7\Message::bodySummary`
|
324 |
-
|
325 |
-
`public static function bodySummary(MessageInterface $message, int $truncateAt = 120): string|null`
|
326 |
-
|
327 |
-
Get a short summary of the message body.
|
328 |
-
|
329 |
-
Will return `null` if the response is not printable.
|
330 |
-
|
331 |
-
|
332 |
-
## `GuzzleHttp\Psr7\Message::rewindBody`
|
333 |
-
|
334 |
-
`public static function rewindBody(MessageInterface $message): void`
|
335 |
-
|
336 |
-
Attempts to rewind a message body and throws an exception on failure.
|
337 |
-
|
338 |
-
The body of the message will only be rewound if a call to `tell()`
|
339 |
-
returns a value other than `0`.
|
340 |
-
|
341 |
-
|
342 |
-
## `GuzzleHttp\Psr7\Message::parseMessage`
|
343 |
-
|
344 |
-
`public static function parseMessage(string $message): array`
|
345 |
-
|
346 |
-
Parses an HTTP message into an associative array.
|
347 |
-
|
348 |
-
The array contains the "start-line" key containing the start line of
|
349 |
-
the message, "headers" key containing an associative array of header
|
350 |
-
array values, and a "body" key containing the body of the message.
|
351 |
-
|
352 |
-
|
353 |
-
## `GuzzleHttp\Psr7\Message::parseRequestUri`
|
354 |
-
|
355 |
-
`public static function parseRequestUri(string $path, array $headers): string`
|
356 |
-
|
357 |
-
Constructs a URI for an HTTP request message.
|
358 |
-
|
359 |
-
|
360 |
-
## `GuzzleHttp\Psr7\Message::parseRequest`
|
361 |
-
|
362 |
-
`public static function parseRequest(string $message): Request`
|
363 |
-
|
364 |
-
Parses a request message string into a request object.
|
365 |
-
|
366 |
-
|
367 |
-
## `GuzzleHttp\Psr7\Message::parseResponse`
|
368 |
-
|
369 |
-
`public static function parseResponse(string $message): Response`
|
370 |
-
|
371 |
-
Parses a response message string into a response object.
|
372 |
-
|
373 |
-
|
374 |
-
## `GuzzleHttp\Psr7\Header::parse`
|
375 |
-
|
376 |
-
`public static function parse(string|array $header): array`
|
377 |
-
|
378 |
-
Parse an array of header values containing ";" separated data into an
|
379 |
-
array of associative arrays representing the header key value pair data
|
380 |
-
of the header. When a parameter does not contain a value, but just
|
381 |
-
contains a key, this function will inject a key with a '' string value.
|
382 |
-
|
383 |
-
|
384 |
-
## `GuzzleHttp\Psr7\Header::normalize`
|
385 |
-
|
386 |
-
`public static function normalize(string|array $header): array`
|
387 |
-
|
388 |
-
Converts an array of header values that may contain comma separated
|
389 |
-
headers into an array of headers with no comma separated values.
|
390 |
-
|
391 |
-
|
392 |
-
## `GuzzleHttp\Psr7\Query::parse`
|
393 |
-
|
394 |
-
`public static function parse(string $str, int|bool $urlEncoding = true): array`
|
395 |
-
|
396 |
-
Parse a query string into an associative array.
|
397 |
-
|
398 |
-
If multiple values are found for the same key, the value of that key
|
399 |
-
value pair will become an array. This function does not parse nested
|
400 |
-
PHP style arrays into an associative array (e.g., `foo[a]=1&foo[b]=2`
|
401 |
-
will be parsed into `['foo[a]' => '1', 'foo[b]' => '2'])`.
|
402 |
-
|
403 |
-
|
404 |
-
## `GuzzleHttp\Psr7\Query::build`
|
405 |
-
|
406 |
-
`public static function build(array $params, int|false $encoding = PHP_QUERY_RFC3986): string`
|
407 |
-
|
408 |
-
Build a query string from an array of key value pairs.
|
409 |
-
|
410 |
-
This function can use the return value of `parse()` to build a query
|
411 |
-
string. This function does not modify the provided keys when an array is
|
412 |
-
encountered (like `http_build_query()` would).
|
413 |
-
|
414 |
-
|
415 |
-
## `GuzzleHttp\Psr7\Utils::caselessRemove`
|
416 |
-
|
417 |
-
`public static function caselessRemove(iterable<string> $keys, $keys, array $data): array`
|
418 |
-
|
419 |
-
Remove the items given by the keys, case insensitively from the data.
|
420 |
-
|
421 |
-
|
422 |
-
## `GuzzleHttp\Psr7\Utils::copyToStream`
|
423 |
-
|
424 |
-
`public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void`
|
425 |
-
|
426 |
-
Copy the contents of a stream into another stream until the given number
|
427 |
-
of bytes have been read.
|
428 |
-
|
429 |
-
|
430 |
-
## `GuzzleHttp\Psr7\Utils::copyToString`
|
431 |
-
|
432 |
-
`public static function copyToString(StreamInterface $stream, int $maxLen = -1): string`
|
433 |
-
|
434 |
-
Copy the contents of a stream into a string until the given number of
|
435 |
-
bytes have been read.
|
436 |
-
|
437 |
-
|
438 |
-
## `GuzzleHttp\Psr7\Utils::hash`
|
439 |
-
|
440 |
-
`public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string`
|
441 |
-
|
442 |
-
Calculate a hash of a stream.
|
443 |
-
|
444 |
-
This method reads the entire stream to calculate a rolling hash, based on
|
445 |
-
PHP's `hash_init` functions.
|
446 |
-
|
447 |
-
|
448 |
-
## `GuzzleHttp\Psr7\Utils::modifyRequest`
|
449 |
-
|
450 |
-
`public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface`
|
451 |
-
|
452 |
-
Clone and modify a request with the given changes.
|
453 |
-
|
454 |
-
This method is useful for reducing the number of clones needed to mutate
|
455 |
-
a message.
|
456 |
-
|
457 |
-
- method: (string) Changes the HTTP method.
|
458 |
-
- set_headers: (array) Sets the given headers.
|
459 |
-
- remove_headers: (array) Remove the given headers.
|
460 |
-
- body: (mixed) Sets the given body.
|
461 |
-
- uri: (UriInterface) Set the URI.
|
462 |
-
- query: (string) Set the query string value of the URI.
|
463 |
-
- version: (string) Set the protocol version.
|
464 |
-
|
465 |
-
|
466 |
-
## `GuzzleHttp\Psr7\Utils::readLine`
|
467 |
-
|
468 |
-
`public static function readLine(StreamInterface $stream, int $maxLength = null): string`
|
469 |
-
|
470 |
-
Read a line from the stream up to the maximum allowed buffer length.
|
471 |
-
|
472 |
-
|
473 |
-
## `GuzzleHttp\Psr7\Utils::streamFor`
|
474 |
-
|
475 |
-
`public static function streamFor(resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource = '', array $options = []): StreamInterface`
|
476 |
-
|
477 |
-
Create a new stream based on the input type.
|
478 |
-
|
479 |
-
Options is an associative array that can contain the following keys:
|
480 |
-
|
481 |
-
- metadata: Array of custom metadata.
|
482 |
-
- size: Size of the stream.
|
483 |
-
|
484 |
-
This method accepts the following `$resource` types:
|
485 |
-
|
486 |
-
- `Psr\Http\Message\StreamInterface`: Returns the value as-is.
|
487 |
-
- `string`: Creates a stream object that uses the given string as the contents.
|
488 |
-
- `resource`: Creates a stream object that wraps the given PHP stream resource.
|
489 |
-
- `Iterator`: If the provided value implements `Iterator`, then a read-only
|
490 |
-
stream object will be created that wraps the given iterable. Each time the
|
491 |
-
stream is read from, data from the iterator will fill a buffer and will be
|
492 |
-
continuously called until the buffer is equal to the requested read size.
|
493 |
-
Subsequent read calls will first read from the buffer and then call `next`
|
494 |
-
on the underlying iterator until it is exhausted.
|
495 |
-
- `object` with `__toString()`: If the object has the `__toString()` method,
|
496 |
-
the object will be cast to a string and then a stream will be returned that
|
497 |
-
uses the string value.
|
498 |
-
- `NULL`: When `null` is passed, an empty stream object is returned.
|
499 |
-
- `callable` When a callable is passed, a read-only stream object will be
|
500 |
-
created that invokes the given callable. The callable is invoked with the
|
501 |
-
number of suggested bytes to read. The callable can return any number of
|
502 |
-
bytes, but MUST return `false` when there is no more data to return. The
|
503 |
-
stream object that wraps the callable will invoke the callable until the
|
504 |
-
number of requested bytes are available. Any additional bytes will be
|
505 |
-
buffered and used in subsequent reads.
|
506 |
-
|
507 |
-
```php
|
508 |
-
$stream = GuzzleHttp\Psr7\Utils::streamFor('foo');
|
509 |
-
$stream = GuzzleHttp\Psr7\Utils::streamFor(fopen('/path/to/file', 'r'));
|
510 |
-
|
511 |
-
$generator = function ($bytes) {
|
512 |
-
for ($i = 0; $i < $bytes; $i++) {
|
513 |
-
yield ' ';
|
514 |
-
}
|
515 |
-
}
|
516 |
-
|
517 |
-
$stream = GuzzleHttp\Psr7\Utils::streamFor($generator(100));
|
518 |
-
```
|
519 |
-
|
520 |
-
|
521 |
-
## `GuzzleHttp\Psr7\Utils::tryFopen`
|
522 |
-
|
523 |
-
`public static function tryFopen(string $filename, string $mode): resource`
|
524 |
-
|
525 |
-
Safely opens a PHP stream resource using a filename.
|
526 |
-
|
527 |
-
When fopen fails, PHP normally raises a warning. This function adds an
|
528 |
-
error handler that checks for errors and throws an exception instead.
|
529 |
-
|
530 |
-
|
531 |
-
## `GuzzleHttp\Psr7\Utils::uriFor`
|
532 |
-
|
533 |
-
`public static function uriFor(string|UriInterface $uri): UriInterface`
|
534 |
-
|
535 |
-
Returns a UriInterface for the given value.
|
536 |
-
|
537 |
-
This function accepts a string or UriInterface and returns a
|
538 |
-
UriInterface for the given value. If the value is already a
|
539 |
-
UriInterface, it is returned as-is.
|
540 |
-
|
541 |
-
|
542 |
-
## `GuzzleHttp\Psr7\MimeType::fromFilename`
|
543 |
-
|
544 |
-
`public static function fromFilename(string $filename): string|null`
|
545 |
-
|
546 |
-
Determines the mimetype of a file by looking at its extension.
|
547 |
-
|
548 |
-
|
549 |
-
## `GuzzleHttp\Psr7\MimeType::fromExtension`
|
550 |
-
|
551 |
-
`public static function fromExtension(string $extension): string|null`
|
552 |
-
|
553 |
-
Maps a file extensions to a mimetype.
|
554 |
-
|
555 |
-
|
556 |
-
## Upgrading from Function API
|
557 |
-
|
558 |
-
The static API was first introduced in 1.7.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API will be removed in 2.0.0. A migration table has been provided here for your convenience:
|
559 |
-
|
560 |
-
| Original Function | Replacement Method |
|
561 |
-
|----------------|----------------|
|
562 |
-
| `str` | `Message::toString` |
|
563 |
-
| `uri_for` | `Utils::uriFor` |
|
564 |
-
| `stream_for` | `Utils::streamFor` |
|
565 |
-
| `parse_header` | `Header::parse` |
|
566 |
-
| `normalize_header` | `Header::normalize` |
|
567 |
-
| `modify_request` | `Utils::modifyRequest` |
|
568 |
-
| `rewind_body` | `Message::rewindBody` |
|
569 |
-
| `try_fopen` | `Utils::tryFopen` |
|
570 |
-
| `copy_to_string` | `Utils::copyToString` |
|
571 |
-
| `copy_to_stream` | `Utils::copyToStream` |
|
572 |
-
| `hash` | `Utils::hash` |
|
573 |
-
| `readline` | `Utils::readLine` |
|
574 |
-
| `parse_request` | `Message::parseRequest` |
|
575 |
-
| `parse_response` | `Message::parseResponse` |
|
576 |
-
| `parse_query` | `Query::parse` |
|
577 |
-
| `build_query` | `Query::build` |
|
578 |
-
| `mimetype_from_filename` | `MimeType::fromFilename` |
|
579 |
-
| `mimetype_from_extension` | `MimeType::fromExtension` |
|
580 |
-
| `_parse_message` | `Message::parseMessage` |
|
581 |
-
| `_parse_request_uri` | `Message::parseRequestUri` |
|
582 |
-
| `get_message_body_summary` | `Message::bodySummary` |
|
583 |
-
| `_caseless_remove` | `Utils::caselessRemove` |
|
584 |
-
|
585 |
-
|
586 |
-
# Additional URI Methods
|
587 |
-
|
588 |
-
Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class,
|
589 |
-
this library also provides additional functionality when working with URIs as static methods.
|
590 |
-
|
591 |
-
## URI Types
|
592 |
-
|
593 |
-
An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference.
|
594 |
-
An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI,
|
595 |
-
the base URI. Relative references can be divided into several forms according to
|
596 |
-
[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2):
|
597 |
-
|
598 |
-
- network-path references, e.g. `//example.com/path`
|
599 |
-
- absolute-path references, e.g. `/path`
|
600 |
-
- relative-path references, e.g. `subpath`
|
601 |
-
|
602 |
-
The following methods can be used to identify the type of the URI.
|
603 |
-
|
604 |
-
### `GuzzleHttp\Psr7\Uri::isAbsolute`
|
605 |
-
|
606 |
-
`public static function isAbsolute(UriInterface $uri): bool`
|
607 |
-
|
608 |
-
Whether the URI is absolute, i.e. it has a scheme.
|
609 |
-
|
610 |
-
### `GuzzleHttp\Psr7\Uri::isNetworkPathReference`
|
611 |
-
|
612 |
-
`public static function isNetworkPathReference(UriInterface $uri): bool`
|
613 |
-
|
614 |
-
Whether the URI is a network-path reference. A relative reference that begins with two slash characters is
|
615 |
-
termed an network-path reference.
|
616 |
-
|
617 |
-
### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference`
|
618 |
-
|
619 |
-
`public static function isAbsolutePathReference(UriInterface $uri): bool`
|
620 |
-
|
621 |
-
Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is
|
622 |
-
termed an absolute-path reference.
|
623 |
-
|
624 |
-
### `GuzzleHttp\Psr7\Uri::isRelativePathReference`
|
625 |
-
|
626 |
-
`public static function isRelativePathReference(UriInterface $uri): bool`
|
627 |
-
|
628 |
-
Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is
|
629 |
-
termed a relative-path reference.
|
630 |
-
|
631 |
-
### `GuzzleHttp\Psr7\Uri::isSameDocumentReference`
|
632 |
-
|
633 |
-
`public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool`
|
634 |
-
|
635 |
-
Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its
|
636 |
-
fragment component, identical to the base URI. When no base URI is given, only an empty URI reference
|
637 |
-
(apart from its fragment) is considered a same-document reference.
|
638 |
-
|
639 |
-
## URI Components
|
640 |
-
|
641 |
-
Additional methods to work with URI components.
|
642 |
-
|
643 |
-
### `GuzzleHttp\Psr7\Uri::isDefaultPort`
|
644 |
-
|
645 |
-
`public static function isDefaultPort(UriInterface $uri): bool`
|
646 |
-
|
647 |
-
Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null
|
648 |
-
or the standard port. This method can be used independently of the implementation.
|
649 |
-
|
650 |
-
### `GuzzleHttp\Psr7\Uri::composeComponents`
|
651 |
-
|
652 |
-
`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string`
|
653 |
-
|
654 |
-
Composes a URI reference string from its various components according to
|
655 |
-
[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called
|
656 |
-
manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`.
|
657 |
-
|
658 |
-
### `GuzzleHttp\Psr7\Uri::fromParts`
|
659 |
-
|
660 |
-
`public static function fromParts(array $parts): UriInterface`
|
661 |
-
|
662 |
-
Creates a URI from a hash of [`parse_url`](http://php.net/manual/en/function.parse-url.php) components.
|
663 |
-
|
664 |
-
|
665 |
-
### `GuzzleHttp\Psr7\Uri::withQueryValue`
|
666 |
-
|
667 |
-
`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface`
|
668 |
-
|
669 |
-
Creates a new URI with a specific query string value. Any existing query string values that exactly match the
|
670 |
-
provided key are removed and replaced with the given key value pair. A value of null will set the query string
|
671 |
-
key without a value, e.g. "key" instead of "key=value".
|
672 |
-
|
673 |
-
### `GuzzleHttp\Psr7\Uri::withQueryValues`
|
674 |
-
|
675 |
-
`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface`
|
676 |
-
|
677 |
-
Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an
|
678 |
-
associative array of key => value.
|
679 |
-
|
680 |
-
### `GuzzleHttp\Psr7\Uri::withoutQueryValue`
|
681 |
-
|
682 |
-
`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface`
|
683 |
-
|
684 |
-
Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the
|
685 |
-
provided key are removed.
|
686 |
-
|
687 |
-
## Reference Resolution
|
688 |
-
|
689 |
-
`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according
|
690 |
-
to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers
|
691 |
-
do when resolving a link in a website based on the current request URI.
|
692 |
-
|
693 |
-
### `GuzzleHttp\Psr7\UriResolver::resolve`
|
694 |
-
|
695 |
-
`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface`
|
696 |
-
|
697 |
-
Converts the relative URI into a new URI that is resolved against the base URI.
|
698 |
-
|
699 |
-
### `GuzzleHttp\Psr7\UriResolver::removeDotSegments`
|
700 |
-
|
701 |
-
`public static function removeDotSegments(string $path): string`
|
702 |
-
|
703 |
-
Removes dot segments from a path and returns the new path according to
|
704 |
-
[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4).
|
705 |
-
|
706 |
-
### `GuzzleHttp\Psr7\UriResolver::relativize`
|
707 |
-
|
708 |
-
`public static function relativize(UriInterface $base, UriInterface $target): UriInterface`
|
709 |
-
|
710 |
-
Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve():
|
711 |
-
|
712 |
-
```php
|
713 |
-
(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target))
|
714 |
-
```
|
715 |
-
|
716 |
-
One use-case is to use the current request URI as base URI and then generate relative links in your documents
|
717 |
-
to reduce the document size or offer self-contained downloadable document archives.
|
718 |
-
|
719 |
-
```php
|
720 |
-
$base = new Uri('http://example.com/a/b/');
|
721 |
-
echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'.
|
722 |
-
echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'.
|
723 |
-
echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'.
|
724 |
-
echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'.
|
725 |
-
```
|
726 |
-
|
727 |
-
## Normalization and Comparison
|
728 |
-
|
729 |
-
`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to
|
730 |
-
[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6).
|
731 |
-
|
732 |
-
### `GuzzleHttp\Psr7\UriNormalizer::normalize`
|
733 |
-
|
734 |
-
`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface`
|
735 |
-
|
736 |
-
Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface.
|
737 |
-
This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask
|
738 |
-
of normalizations to apply. The following normalizations are available:
|
739 |
-
|
740 |
-
- `UriNormalizer::PRESERVING_NORMALIZATIONS`
|
741 |
-
|
742 |
-
Default normalizations which only include the ones that preserve semantics.
|
743 |
-
|
744 |
-
- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING`
|
745 |
-
|
746 |
-
All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized.
|
747 |
-
|
748 |
-
Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b`
|
749 |
-
|
750 |
-
- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS`
|
751 |
-
|
752 |
-
Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of
|
753 |
-
ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should
|
754 |
-
not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved
|
755 |
-
characters by URI normalizers.
|
756 |
-
|
757 |
-
Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/`
|
758 |
-
|
759 |
-
- `UriNormalizer::CONVERT_EMPTY_PATH`
|
760 |
-
|
761 |
-
Converts the empty path to "/" for http and https URIs.
|
762 |
-
|
763 |
-
Example: `http://example.org` → `http://example.org/`
|
764 |
-
|
765 |
-
- `UriNormalizer::REMOVE_DEFAULT_HOST`
|
766 |
-
|
767 |
-
Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host
|
768 |
-
"localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to
|
769 |
-
RFC 3986.
|
770 |
-
|
771 |
-
Example: `file://localhost/myfile` → `file:///myfile`
|
772 |
-
|
773 |
-
- `UriNormalizer::REMOVE_DEFAULT_PORT`
|
774 |
-
|
775 |
-
Removes the default port of the given URI scheme from the URI.
|
776 |
-
|
777 |
-
Example: `http://example.org:80/` → `http://example.org/`
|
778 |
-
|
779 |
-
- `UriNormalizer::REMOVE_DOT_SEGMENTS`
|
780 |
-
|
781 |
-
Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would
|
782 |
-
change the semantics of the URI reference.
|
783 |
-
|
784 |
-
Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html`
|
785 |
-
|
786 |
-
- `UriNormalizer::REMOVE_DUPLICATE_SLASHES`
|
787 |
-
|
788 |
-
Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes
|
789 |
-
and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization
|
790 |
-
may change the semantics. Encoded slashes (%2F) are not removed.
|
791 |
-
|
792 |
-
Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html`
|
793 |
-
|
794 |
-
- `UriNormalizer::SORT_QUERY_PARAMETERS`
|
795 |
-
|
796 |
-
Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be
|
797 |
-
significant (this is not defined by the standard). So this normalization is not safe and may change the semantics
|
798 |
-
of the URI.
|
799 |
-
|
800 |
-
Example: `?lang=en&article=fred` → `?article=fred&lang=en`
|
801 |
-
|
802 |
-
### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent`
|
803 |
-
|
804 |
-
`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool`
|
805 |
-
|
806 |
-
Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given
|
807 |
-
`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent.
|
808 |
-
This of course assumes they will be resolved against the same base URI. If this is not the case, determination of
|
809 |
-
equivalence or difference of relative references does not mean anything.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/composer.json
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "guzzlehttp/psr7",
|
3 |
-
"type": "library",
|
4 |
-
"description": "PSR-7 message implementation that also provides common utility methods",
|
5 |
-
"keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
|
6 |
-
"license": "MIT",
|
7 |
-
"authors": [
|
8 |
-
{
|
9 |
-
"name": "Michael Dowling",
|
10 |
-
"email": "mtdowling@gmail.com",
|
11 |
-
"homepage": "https://github.com/mtdowling"
|
12 |
-
},
|
13 |
-
{
|
14 |
-
"name": "Tobias Schultze",
|
15 |
-
"homepage": "https://github.com/Tobion"
|
16 |
-
}
|
17 |
-
],
|
18 |
-
"require": {
|
19 |
-
"php": ">=5.4.0",
|
20 |
-
"psr/http-message": "~1.0",
|
21 |
-
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
|
22 |
-
},
|
23 |
-
"require-dev": {
|
24 |
-
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10",
|
25 |
-
"ext-zlib": "*"
|
26 |
-
},
|
27 |
-
"provide": {
|
28 |
-
"psr/http-message-implementation": "1.0"
|
29 |
-
},
|
30 |
-
"suggest": {
|
31 |
-
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
|
32 |
-
},
|
33 |
-
"autoload": {
|
34 |
-
"psr-4": {
|
35 |
-
"GuzzleHttp\\Psr7\\": "src/"
|
36 |
-
},
|
37 |
-
"files": ["src/functions_include.php"]
|
38 |
-
},
|
39 |
-
"autoload-dev": {
|
40 |
-
"psr-4": {
|
41 |
-
"GuzzleHttp\\Tests\\Psr7\\": "tests/"
|
42 |
-
}
|
43 |
-
},
|
44 |
-
"extra": {
|
45 |
-
"branch-alias": {
|
46 |
-
"dev-master": "1.7-dev"
|
47 |
-
}
|
48 |
-
}
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/AppendStream.php
DELETED
@@ -1,244 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Reads from multiple streams, one after the other.
|
9 |
-
*
|
10 |
-
* This is a read-only stream decorator.
|
11 |
-
*/
|
12 |
-
class AppendStream implements StreamInterface
|
13 |
-
{
|
14 |
-
/** @var StreamInterface[] Streams being decorated */
|
15 |
-
private $streams = [];
|
16 |
-
|
17 |
-
private $seekable = true;
|
18 |
-
private $current = 0;
|
19 |
-
private $pos = 0;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @param StreamInterface[] $streams Streams to decorate. Each stream must
|
23 |
-
* be readable.
|
24 |
-
*/
|
25 |
-
public function __construct(array $streams = [])
|
26 |
-
{
|
27 |
-
foreach ($streams as $stream) {
|
28 |
-
$this->addStream($stream);
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
public function __toString()
|
33 |
-
{
|
34 |
-
try {
|
35 |
-
$this->rewind();
|
36 |
-
return $this->getContents();
|
37 |
-
} catch (\Exception $e) {
|
38 |
-
return '';
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Add a stream to the AppendStream
|
44 |
-
*
|
45 |
-
* @param StreamInterface $stream Stream to append. Must be readable.
|
46 |
-
*
|
47 |
-
* @throws \InvalidArgumentException if the stream is not readable
|
48 |
-
*/
|
49 |
-
public function addStream(StreamInterface $stream)
|
50 |
-
{
|
51 |
-
if (!$stream->isReadable()) {
|
52 |
-
throw new \InvalidArgumentException('Each stream must be readable');
|
53 |
-
}
|
54 |
-
|
55 |
-
// The stream is only seekable if all streams are seekable
|
56 |
-
if (!$stream->isSeekable()) {
|
57 |
-
$this->seekable = false;
|
58 |
-
}
|
59 |
-
|
60 |
-
$this->streams[] = $stream;
|
61 |
-
}
|
62 |
-
|
63 |
-
public function getContents()
|
64 |
-
{
|
65 |
-
return Utils::copyToString($this);
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Closes each attached stream.
|
70 |
-
*
|
71 |
-
* {@inheritdoc}
|
72 |
-
*/
|
73 |
-
public function close()
|
74 |
-
{
|
75 |
-
$this->pos = $this->current = 0;
|
76 |
-
$this->seekable = true;
|
77 |
-
|
78 |
-
foreach ($this->streams as $stream) {
|
79 |
-
$stream->close();
|
80 |
-
}
|
81 |
-
|
82 |
-
$this->streams = [];
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Detaches each attached stream.
|
87 |
-
*
|
88 |
-
* Returns null as it's not clear which underlying stream resource to return.
|
89 |
-
*
|
90 |
-
* {@inheritdoc}
|
91 |
-
*/
|
92 |
-
public function detach()
|
93 |
-
{
|
94 |
-
$this->pos = $this->current = 0;
|
95 |
-
$this->seekable = true;
|
96 |
-
|
97 |
-
foreach ($this->streams as $stream) {
|
98 |
-
$stream->detach();
|
99 |
-
}
|
100 |
-
|
101 |
-
$this->streams = [];
|
102 |
-
|
103 |
-
return null;
|
104 |
-
}
|
105 |
-
|
106 |
-
public function tell()
|
107 |
-
{
|
108 |
-
return $this->pos;
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Tries to calculate the size by adding the size of each stream.
|
113 |
-
*
|
114 |
-
* If any of the streams do not return a valid number, then the size of the
|
115 |
-
* append stream cannot be determined and null is returned.
|
116 |
-
*
|
117 |
-
* {@inheritdoc}
|
118 |
-
*/
|
119 |
-
public function getSize()
|
120 |
-
{
|
121 |
-
$size = 0;
|
122 |
-
|
123 |
-
foreach ($this->streams as $stream) {
|
124 |
-
$s = $stream->getSize();
|
125 |
-
if ($s === null) {
|
126 |
-
return null;
|
127 |
-
}
|
128 |
-
$size += $s;
|
129 |
-
}
|
130 |
-
|
131 |
-
return $size;
|
132 |
-
}
|
133 |
-
|
134 |
-
public function eof()
|
135 |
-
{
|
136 |
-
return !$this->streams ||
|
137 |
-
($this->current >= count($this->streams) - 1 &&
|
138 |
-
$this->streams[$this->current]->eof());
|
139 |
-
}
|
140 |
-
|
141 |
-
public function rewind()
|
142 |
-
{
|
143 |
-
$this->seek(0);
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Attempts to seek to the given position. Only supports SEEK_SET.
|
148 |
-
*
|
149 |
-
* {@inheritdoc}
|
150 |
-
*/
|
151 |
-
public function seek($offset, $whence = SEEK_SET)
|
152 |
-
{
|
153 |
-
if (!$this->seekable) {
|
154 |
-
throw new \RuntimeException('This AppendStream is not seekable');
|
155 |
-
} elseif ($whence !== SEEK_SET) {
|
156 |
-
throw new \RuntimeException('The AppendStream can only seek with SEEK_SET');
|
157 |
-
}
|
158 |
-
|
159 |
-
$this->pos = $this->current = 0;
|
160 |
-
|
161 |
-
// Rewind each stream
|
162 |
-
foreach ($this->streams as $i => $stream) {
|
163 |
-
try {
|
164 |
-
$stream->rewind();
|
165 |
-
} catch (\Exception $e) {
|
166 |
-
throw new \RuntimeException('Unable to seek stream '
|
167 |
-
. $i . ' of the AppendStream', 0, $e);
|
168 |
-
}
|
169 |
-
}
|
170 |
-
|
171 |
-
// Seek to the actual position by reading from each stream
|
172 |
-
while ($this->pos < $offset && !$this->eof()) {
|
173 |
-
$result = $this->read(min(8096, $offset - $this->pos));
|
174 |
-
if ($result === '') {
|
175 |
-
break;
|
176 |
-
}
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Reads from all of the appended streams until the length is met or EOF.
|
182 |
-
*
|
183 |
-
* {@inheritdoc}
|
184 |
-
*/
|
185 |
-
public function read($length)
|
186 |
-
{
|
187 |
-
$buffer = '';
|
188 |
-
$total = count($this->streams) - 1;
|
189 |
-
$remaining = $length;
|
190 |
-
$progressToNext = false;
|
191 |
-
|
192 |
-
while ($remaining > 0) {
|
193 |
-
|
194 |
-
// Progress to the next stream if needed.
|
195 |
-
if ($progressToNext || $this->streams[$this->current]->eof()) {
|
196 |
-
$progressToNext = false;
|
197 |
-
if ($this->current === $total) {
|
198 |
-
break;
|
199 |
-
}
|
200 |
-
$this->current++;
|
201 |
-
}
|
202 |
-
|
203 |
-
$result = $this->streams[$this->current]->read($remaining);
|
204 |
-
|
205 |
-
// Using a loose comparison here to match on '', false, and null
|
206 |
-
if ($result == null) {
|
207 |
-
$progressToNext = true;
|
208 |
-
continue;
|
209 |
-
}
|
210 |
-
|
211 |
-
$buffer .= $result;
|
212 |
-
$remaining = $length - strlen($buffer);
|
213 |
-
}
|
214 |
-
|
215 |
-
$this->pos += strlen($buffer);
|
216 |
-
|
217 |
-
return $buffer;
|
218 |
-
}
|
219 |
-
|
220 |
-
public function isReadable()
|
221 |
-
{
|
222 |
-
return true;
|
223 |
-
}
|
224 |
-
|
225 |
-
public function isWritable()
|
226 |
-
{
|
227 |
-
return false;
|
228 |
-
}
|
229 |
-
|
230 |
-
public function isSeekable()
|
231 |
-
{
|
232 |
-
return $this->seekable;
|
233 |
-
}
|
234 |
-
|
235 |
-
public function write($string)
|
236 |
-
{
|
237 |
-
throw new \RuntimeException('Cannot write to an AppendStream');
|
238 |
-
}
|
239 |
-
|
240 |
-
public function getMetadata($key = null)
|
241 |
-
{
|
242 |
-
return $key ? null : [];
|
243 |
-
}
|
244 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/BufferStream.php
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Provides a buffer stream that can be written to to fill a buffer, and read
|
9 |
-
* from to remove bytes from the buffer.
|
10 |
-
*
|
11 |
-
* This stream returns a "hwm" metadata value that tells upstream consumers
|
12 |
-
* what the configured high water mark of the stream is, or the maximum
|
13 |
-
* preferred size of the buffer.
|
14 |
-
*/
|
15 |
-
class BufferStream implements StreamInterface
|
16 |
-
{
|
17 |
-
private $hwm;
|
18 |
-
private $buffer = '';
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @param int $hwm High water mark, representing the preferred maximum
|
22 |
-
* buffer size. If the size of the buffer exceeds the high
|
23 |
-
* water mark, then calls to write will continue to succeed
|
24 |
-
* but will return false to inform writers to slow down
|
25 |
-
* until the buffer has been drained by reading from it.
|
26 |
-
*/
|
27 |
-
public function __construct($hwm = 16384)
|
28 |
-
{
|
29 |
-
$this->hwm = $hwm;
|
30 |
-
}
|
31 |
-
|
32 |
-
public function __toString()
|
33 |
-
{
|
34 |
-
return $this->getContents();
|
35 |
-
}
|
36 |
-
|
37 |
-
public function getContents()
|
38 |
-
{
|
39 |
-
$buffer = $this->buffer;
|
40 |
-
$this->buffer = '';
|
41 |
-
|
42 |
-
return $buffer;
|
43 |
-
}
|
44 |
-
|
45 |
-
public function close()
|
46 |
-
{
|
47 |
-
$this->buffer = '';
|
48 |
-
}
|
49 |
-
|
50 |
-
public function detach()
|
51 |
-
{
|
52 |
-
$this->close();
|
53 |
-
|
54 |
-
return null;
|
55 |
-
}
|
56 |
-
|
57 |
-
public function getSize()
|
58 |
-
{
|
59 |
-
return strlen($this->buffer);
|
60 |
-
}
|
61 |
-
|
62 |
-
public function isReadable()
|
63 |
-
{
|
64 |
-
return true;
|
65 |
-
}
|
66 |
-
|
67 |
-
public function isWritable()
|
68 |
-
{
|
69 |
-
return true;
|
70 |
-
}
|
71 |
-
|
72 |
-
public function isSeekable()
|
73 |
-
{
|
74 |
-
return false;
|
75 |
-
}
|
76 |
-
|
77 |
-
public function rewind()
|
78 |
-
{
|
79 |
-
$this->seek(0);
|
80 |
-
}
|
81 |
-
|
82 |
-
public function seek($offset, $whence = SEEK_SET)
|
83 |
-
{
|
84 |
-
throw new \RuntimeException('Cannot seek a BufferStream');
|
85 |
-
}
|
86 |
-
|
87 |
-
public function eof()
|
88 |
-
{
|
89 |
-
return strlen($this->buffer) === 0;
|
90 |
-
}
|
91 |
-
|
92 |
-
public function tell()
|
93 |
-
{
|
94 |
-
throw new \RuntimeException('Cannot determine the position of a BufferStream');
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Reads data from the buffer.
|
99 |
-
*/
|
100 |
-
public function read($length)
|
101 |
-
{
|
102 |
-
$currentLength = strlen($this->buffer);
|
103 |
-
|
104 |
-
if ($length >= $currentLength) {
|
105 |
-
// No need to slice the buffer because we don't have enough data.
|
106 |
-
$result = $this->buffer;
|
107 |
-
$this->buffer = '';
|
108 |
-
} else {
|
109 |
-
// Slice up the result to provide a subset of the buffer.
|
110 |
-
$result = substr($this->buffer, 0, $length);
|
111 |
-
$this->buffer = substr($this->buffer, $length);
|
112 |
-
}
|
113 |
-
|
114 |
-
return $result;
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Writes data to the buffer.
|
119 |
-
*/
|
120 |
-
public function write($string)
|
121 |
-
{
|
122 |
-
$this->buffer .= $string;
|
123 |
-
|
124 |
-
// TODO: What should happen here?
|
125 |
-
if (strlen($this->buffer) >= $this->hwm) {
|
126 |
-
return false;
|
127 |
-
}
|
128 |
-
|
129 |
-
return strlen($string);
|
130 |
-
}
|
131 |
-
|
132 |
-
public function getMetadata($key = null)
|
133 |
-
{
|
134 |
-
if ($key == 'hwm') {
|
135 |
-
return $this->hwm;
|
136 |
-
}
|
137 |
-
|
138 |
-
return $key ? null : [];
|
139 |
-
}
|
140 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/CachingStream.php
DELETED
@@ -1,139 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Stream decorator that can cache previously read bytes from a sequentially
|
9 |
-
* read stream.
|
10 |
-
*/
|
11 |
-
class CachingStream implements StreamInterface
|
12 |
-
{
|
13 |
-
use StreamDecoratorTrait;
|
14 |
-
|
15 |
-
/** @var StreamInterface Stream being wrapped */
|
16 |
-
private $remoteStream;
|
17 |
-
|
18 |
-
/** @var int Number of bytes to skip reading due to a write on the buffer */
|
19 |
-
private $skipReadBytes = 0;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* We will treat the buffer object as the body of the stream
|
23 |
-
*
|
24 |
-
* @param StreamInterface $stream Stream to cache
|
25 |
-
* @param StreamInterface $target Optionally specify where data is cached
|
26 |
-
*/
|
27 |
-
public function __construct(
|
28 |
-
StreamInterface $stream,
|
29 |
-
StreamInterface $target = null
|
30 |
-
) {
|
31 |
-
$this->remoteStream = $stream;
|
32 |
-
$this->stream = $target ?: new Stream(fopen('php://temp', 'r+'));
|
33 |
-
}
|
34 |
-
|
35 |
-
public function getSize()
|
36 |
-
{
|
37 |
-
return max($this->stream->getSize(), $this->remoteStream->getSize());
|
38 |
-
}
|
39 |
-
|
40 |
-
public function rewind()
|
41 |
-
{
|
42 |
-
$this->seek(0);
|
43 |
-
}
|
44 |
-
|
45 |
-
public function seek($offset, $whence = SEEK_SET)
|
46 |
-
{
|
47 |
-
if ($whence == SEEK_SET) {
|
48 |
-
$byte = $offset;
|
49 |
-
} elseif ($whence == SEEK_CUR) {
|
50 |
-
$byte = $offset + $this->tell();
|
51 |
-
} elseif ($whence == SEEK_END) {
|
52 |
-
$size = $this->remoteStream->getSize();
|
53 |
-
if ($size === null) {
|
54 |
-
$size = $this->cacheEntireStream();
|
55 |
-
}
|
56 |
-
$byte = $size + $offset;
|
57 |
-
} else {
|
58 |
-
throw new \InvalidArgumentException('Invalid whence');
|
59 |
-
}
|
60 |
-
|
61 |
-
$diff = $byte - $this->stream->getSize();
|
62 |
-
|
63 |
-
if ($diff > 0) {
|
64 |
-
// Read the remoteStream until we have read in at least the amount
|
65 |
-
// of bytes requested, or we reach the end of the file.
|
66 |
-
while ($diff > 0 && !$this->remoteStream->eof()) {
|
67 |
-
$this->read($diff);
|
68 |
-
$diff = $byte - $this->stream->getSize();
|
69 |
-
}
|
70 |
-
} else {
|
71 |
-
// We can just do a normal seek since we've already seen this byte.
|
72 |
-
$this->stream->seek($byte);
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
public function read($length)
|
77 |
-
{
|
78 |
-
// Perform a regular read on any previously read data from the buffer
|
79 |
-
$data = $this->stream->read($length);
|
80 |
-
$remaining = $length - strlen($data);
|
81 |
-
|
82 |
-
// More data was requested so read from the remote stream
|
83 |
-
if ($remaining) {
|
84 |
-
// If data was written to the buffer in a position that would have
|
85 |
-
// been filled from the remote stream, then we must skip bytes on
|
86 |
-
// the remote stream to emulate overwriting bytes from that
|
87 |
-
// position. This mimics the behavior of other PHP stream wrappers.
|
88 |
-
$remoteData = $this->remoteStream->read(
|
89 |
-
$remaining + $this->skipReadBytes
|
90 |
-
);
|
91 |
-
|
92 |
-
if ($this->skipReadBytes) {
|
93 |
-
$len = strlen($remoteData);
|
94 |
-
$remoteData = substr($remoteData, $this->skipReadBytes);
|
95 |
-
$this->skipReadBytes = max(0, $this->skipReadBytes - $len);
|
96 |
-
}
|
97 |
-
|
98 |
-
$data .= $remoteData;
|
99 |
-
$this->stream->write($remoteData);
|
100 |
-
}
|
101 |
-
|
102 |
-
return $data;
|
103 |
-
}
|
104 |
-
|
105 |
-
public function write($string)
|
106 |
-
{
|
107 |
-
// When appending to the end of the currently read stream, you'll want
|
108 |
-
// to skip bytes from being read from the remote stream to emulate
|
109 |
-
// other stream wrappers. Basically replacing bytes of data of a fixed
|
110 |
-
// length.
|
111 |
-
$overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell();
|
112 |
-
if ($overflow > 0) {
|
113 |
-
$this->skipReadBytes += $overflow;
|
114 |
-
}
|
115 |
-
|
116 |
-
return $this->stream->write($string);
|
117 |
-
}
|
118 |
-
|
119 |
-
public function eof()
|
120 |
-
{
|
121 |
-
return $this->stream->eof() && $this->remoteStream->eof();
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Close both the remote stream and buffer stream
|
126 |
-
*/
|
127 |
-
public function close()
|
128 |
-
{
|
129 |
-
$this->remoteStream->close() && $this->stream->close();
|
130 |
-
}
|
131 |
-
|
132 |
-
private function cacheEntireStream()
|
133 |
-
{
|
134 |
-
$target = new FnStream(['write' => 'strlen']);
|
135 |
-
Utils::copyToStream($this, $target);
|
136 |
-
|
137 |
-
return $this->tell();
|
138 |
-
}
|
139 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/DroppingStream.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Stream decorator that begins dropping data once the size of the underlying
|
9 |
-
* stream becomes too full.
|
10 |
-
*/
|
11 |
-
class DroppingStream implements StreamInterface
|
12 |
-
{
|
13 |
-
use StreamDecoratorTrait;
|
14 |
-
|
15 |
-
private $maxLength;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @param StreamInterface $stream Underlying stream to decorate.
|
19 |
-
* @param int $maxLength Maximum size before dropping data.
|
20 |
-
*/
|
21 |
-
public function __construct(StreamInterface $stream, $maxLength)
|
22 |
-
{
|
23 |
-
$this->stream = $stream;
|
24 |
-
$this->maxLength = $maxLength;
|
25 |
-
}
|
26 |
-
|
27 |
-
public function write($string)
|
28 |
-
{
|
29 |
-
$diff = $this->maxLength - $this->stream->getSize();
|
30 |
-
|
31 |
-
// Begin returning 0 when the underlying stream is too large.
|
32 |
-
if ($diff <= 0) {
|
33 |
-
return 0;
|
34 |
-
}
|
35 |
-
|
36 |
-
// Write the stream or a subset of the stream if needed.
|
37 |
-
if (strlen($string) < $diff) {
|
38 |
-
return $this->stream->write($string);
|
39 |
-
}
|
40 |
-
|
41 |
-
return $this->stream->write(substr($string, 0, $diff));
|
42 |
-
}
|
43 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/FnStream.php
DELETED
@@ -1,160 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Compose stream implementations based on a hash of functions.
|
9 |
-
*
|
10 |
-
* Allows for easy testing and extension of a provided stream without needing
|
11 |
-
* to create a concrete class for a simple extension point.
|
12 |
-
*/
|
13 |
-
class FnStream implements StreamInterface
|
14 |
-
{
|
15 |
-
/** @var array */
|
16 |
-
private $methods;
|
17 |
-
|
18 |
-
/** @var array Methods that must be implemented in the given array */
|
19 |
-
private static $slots = ['__toString', 'close', 'detach', 'rewind',
|
20 |
-
'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write',
|
21 |
-
'isReadable', 'read', 'getContents', 'getMetadata'];
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @param array $methods Hash of method name to a callable.
|
25 |
-
*/
|
26 |
-
public function __construct(array $methods)
|
27 |
-
{
|
28 |
-
$this->methods = $methods;
|
29 |
-
|
30 |
-
// Create the functions on the class
|
31 |
-
foreach ($methods as $name => $fn) {
|
32 |
-
$this->{'_fn_' . $name} = $fn;
|
33 |
-
}
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Lazily determine which methods are not implemented.
|
38 |
-
*
|
39 |
-
* @throws \BadMethodCallException
|
40 |
-
*/
|
41 |
-
public function __get($name)
|
42 |
-
{
|
43 |
-
throw new \BadMethodCallException(str_replace('_fn_', '', $name)
|
44 |
-
. '() is not implemented in the FnStream');
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* The close method is called on the underlying stream only if possible.
|
49 |
-
*/
|
50 |
-
public function __destruct()
|
51 |
-
{
|
52 |
-
if (isset($this->_fn_close)) {
|
53 |
-
call_user_func($this->_fn_close);
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* An unserialize would allow the __destruct to run when the unserialized value goes out of scope.
|
59 |
-
* @throws \LogicException
|
60 |
-
*/
|
61 |
-
public function __wakeup()
|
62 |
-
{
|
63 |
-
throw new \LogicException('FnStream should never be unserialized');
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Adds custom functionality to an underlying stream by intercepting
|
68 |
-
* specific method calls.
|
69 |
-
*
|
70 |
-
* @param StreamInterface $stream Stream to decorate
|
71 |
-
* @param array $methods Hash of method name to a closure
|
72 |
-
*
|
73 |
-
* @return FnStream
|
74 |
-
*/
|
75 |
-
public static function decorate(StreamInterface $stream, array $methods)
|
76 |
-
{
|
77 |
-
// If any of the required methods were not provided, then simply
|
78 |
-
// proxy to the decorated stream.
|
79 |
-
foreach (array_diff(self::$slots, array_keys($methods)) as $diff) {
|
80 |
-
$methods[$diff] = [$stream, $diff];
|
81 |
-
}
|
82 |
-
|
83 |
-
return new self($methods);
|
84 |
-
}
|
85 |
-
|
86 |
-
public function __toString()
|
87 |
-
{
|
88 |
-
return call_user_func($this->_fn___toString);
|
89 |
-
}
|
90 |
-
|
91 |
-
public function close()
|
92 |
-
{
|
93 |
-
return call_user_func($this->_fn_close);
|
94 |
-
}
|
95 |
-
|
96 |
-
public function detach()
|
97 |
-
{
|
98 |
-
return call_user_func($this->_fn_detach);
|
99 |
-
}
|
100 |
-
|
101 |
-
public function getSize()
|
102 |
-
{
|
103 |
-
return call_user_func($this->_fn_getSize);
|
104 |
-
}
|
105 |
-
|
106 |
-
public function tell()
|
107 |
-
{
|
108 |
-
return call_user_func($this->_fn_tell);
|
109 |
-
}
|
110 |
-
|
111 |
-
public function eof()
|
112 |
-
{
|
113 |
-
return call_user_func($this->_fn_eof);
|
114 |
-
}
|
115 |
-
|
116 |
-
public function isSeekable()
|
117 |
-
{
|
118 |
-
return call_user_func($this->_fn_isSeekable);
|
119 |
-
}
|
120 |
-
|
121 |
-
public function rewind()
|
122 |
-
{
|
123 |
-
call_user_func($this->_fn_rewind);
|
124 |
-
}
|
125 |
-
|
126 |
-
public function seek($offset, $whence = SEEK_SET)
|
127 |
-
{
|
128 |
-
call_user_func($this->_fn_seek, $offset, $whence);
|
129 |
-
}
|
130 |
-
|
131 |
-
public function isWritable()
|
132 |
-
{
|
133 |
-
return call_user_func($this->_fn_isWritable);
|
134 |
-
}
|
135 |
-
|
136 |
-
public function write($string)
|
137 |
-
{
|
138 |
-
return call_user_func($this->_fn_write, $string);
|
139 |
-
}
|
140 |
-
|
141 |
-
public function isReadable()
|
142 |
-
{
|
143 |
-
return call_user_func($this->_fn_isReadable);
|
144 |
-
}
|
145 |
-
|
146 |
-
public function read($length)
|
147 |
-
{
|
148 |
-
return call_user_func($this->_fn_read, $length);
|
149 |
-
}
|
150 |
-
|
151 |
-
public function getContents()
|
152 |
-
{
|
153 |
-
return call_user_func($this->_fn_getContents);
|
154 |
-
}
|
155 |
-
|
156 |
-
public function getMetadata($key = null)
|
157 |
-
{
|
158 |
-
return call_user_func($this->_fn_getMetadata, $key);
|
159 |
-
}
|
160 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/Header.php
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
final class Header
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Parse an array of header values containing ";" separated data into an
|
9 |
-
* array of associative arrays representing the header key value pair data
|
10 |
-
* of the header. When a parameter does not contain a value, but just
|
11 |
-
* contains a key, this function will inject a key with a '' string value.
|
12 |
-
*
|
13 |
-
* @param string|array $header Header to parse into components.
|
14 |
-
*
|
15 |
-
* @return array Returns the parsed header values.
|
16 |
-
*/
|
17 |
-
public static function parse($header)
|
18 |
-
{
|
19 |
-
static $trimmed = "\"' \n\t\r";
|
20 |
-
$params = $matches = [];
|
21 |
-
|
22 |
-
foreach (self::normalize($header) as $val) {
|
23 |
-
$part = [];
|
24 |
-
foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) {
|
25 |
-
if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) {
|
26 |
-
$m = $matches[0];
|
27 |
-
if (isset($m[1])) {
|
28 |
-
$part[trim($m[0], $trimmed)] = trim($m[1], $trimmed);
|
29 |
-
} else {
|
30 |
-
$part[] = trim($m[0], $trimmed);
|
31 |
-
}
|
32 |
-
}
|
33 |
-
}
|
34 |
-
if ($part) {
|
35 |
-
$params[] = $part;
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
return $params;
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Converts an array of header values that may contain comma separated
|
44 |
-
* headers into an array of headers with no comma separated values.
|
45 |
-
*
|
46 |
-
* @param string|array $header Header to normalize.
|
47 |
-
*
|
48 |
-
* @return array Returns the normalized header field values.
|
49 |
-
*/
|
50 |
-
public static function normalize($header)
|
51 |
-
{
|
52 |
-
if (!is_array($header)) {
|
53 |
-
return array_map('trim', explode(',', $header));
|
54 |
-
}
|
55 |
-
|
56 |
-
$result = [];
|
57 |
-
foreach ($header as $value) {
|
58 |
-
foreach ((array) $value as $v) {
|
59 |
-
if (strpos($v, ',') === false) {
|
60 |
-
$result[] = $v;
|
61 |
-
continue;
|
62 |
-
}
|
63 |
-
foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) {
|
64 |
-
$result[] = trim($vv);
|
65 |
-
}
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
return $result;
|
70 |
-
}
|
71 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/InflateStream.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Uses PHP's zlib.inflate filter to inflate deflate or gzipped content.
|
9 |
-
*
|
10 |
-
* This stream decorator skips the first 10 bytes of the given stream to remove
|
11 |
-
* the gzip header, converts the provided stream to a PHP stream resource,
|
12 |
-
* then appends the zlib.inflate filter. The stream is then converted back
|
13 |
-
* to a Guzzle stream resource to be used as a Guzzle stream.
|
14 |
-
*
|
15 |
-
* @link http://tools.ietf.org/html/rfc1952
|
16 |
-
* @link http://php.net/manual/en/filters.compression.php
|
17 |
-
*/
|
18 |
-
class InflateStream implements StreamInterface
|
19 |
-
{
|
20 |
-
use StreamDecoratorTrait;
|
21 |
-
|
22 |
-
public function __construct(StreamInterface $stream)
|
23 |
-
{
|
24 |
-
// read the first 10 bytes, ie. gzip header
|
25 |
-
$header = $stream->read(10);
|
26 |
-
$filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header);
|
27 |
-
// Skip the header, that is 10 + length of filename + 1 (nil) bytes
|
28 |
-
$stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
|
29 |
-
$resource = StreamWrapper::getResource($stream);
|
30 |
-
stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
|
31 |
-
$this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @param StreamInterface $stream
|
36 |
-
* @param $header
|
37 |
-
* @return int
|
38 |
-
*/
|
39 |
-
private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header)
|
40 |
-
{
|
41 |
-
$filename_header_length = 0;
|
42 |
-
|
43 |
-
if (substr(bin2hex($header), 6, 2) === '08') {
|
44 |
-
// we have a filename, read until nil
|
45 |
-
$filename_header_length = 1;
|
46 |
-
while ($stream->read(1) !== chr(0)) {
|
47 |
-
$filename_header_length++;
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
return $filename_header_length;
|
52 |
-
}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/LazyOpenStream.php
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Lazily reads or writes to a file that is opened only after an IO operation
|
9 |
-
* take place on the stream.
|
10 |
-
*/
|
11 |
-
class LazyOpenStream implements StreamInterface
|
12 |
-
{
|
13 |
-
use StreamDecoratorTrait;
|
14 |
-
|
15 |
-
/** @var string File to open */
|
16 |
-
private $filename;
|
17 |
-
|
18 |
-
/** @var string $mode */
|
19 |
-
private $mode;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @param string $filename File to lazily open
|
23 |
-
* @param string $mode fopen mode to use when opening the stream
|
24 |
-
*/
|
25 |
-
public function __construct($filename, $mode)
|
26 |
-
{
|
27 |
-
$this->filename = $filename;
|
28 |
-
$this->mode = $mode;
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Creates the underlying stream lazily when required.
|
33 |
-
*
|
34 |
-
* @return StreamInterface
|
35 |
-
*/
|
36 |
-
protected function createStream()
|
37 |
-
{
|
38 |
-
return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode));
|
39 |
-
}
|
40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/LimitStream.php
DELETED
@@ -1,156 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Decorator used to return only a subset of a stream
|
10 |
-
*/
|
11 |
-
class LimitStream implements StreamInterface
|
12 |
-
{
|
13 |
-
use StreamDecoratorTrait;
|
14 |
-
|
15 |
-
/** @var int Offset to start reading from */
|
16 |
-
private $offset;
|
17 |
-
|
18 |
-
/** @var int Limit the number of bytes that can be read */
|
19 |
-
private $limit;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @param StreamInterface $stream Stream to wrap
|
23 |
-
* @param int $limit Total number of bytes to allow to be read
|
24 |
-
* from the stream. Pass -1 for no limit.
|
25 |
-
* @param int $offset Position to seek to before reading (only
|
26 |
-
* works on seekable streams).
|
27 |
-
*/
|
28 |
-
public function __construct(
|
29 |
-
StreamInterface $stream,
|
30 |
-
$limit = -1,
|
31 |
-
$offset = 0
|
32 |
-
) {
|
33 |
-
$this->stream = $stream;
|
34 |
-
$this->setLimit($limit);
|
35 |
-
$this->setOffset($offset);
|
36 |
-
}
|
37 |
-
|
38 |
-
public function eof()
|
39 |
-
{
|
40 |
-
// Always return true if the underlying stream is EOF
|
41 |
-
if ($this->stream->eof()) {
|
42 |
-
return true;
|
43 |
-
}
|
44 |
-
|
45 |
-
// No limit and the underlying stream is not at EOF
|
46 |
-
if ($this->limit == -1) {
|
47 |
-
return false;
|
48 |
-
}
|
49 |
-
|
50 |
-
return $this->stream->tell() >= $this->offset + $this->limit;
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Returns the size of the limited subset of data
|
55 |
-
* {@inheritdoc}
|
56 |
-
*/
|
57 |
-
public function getSize()
|
58 |
-
{
|
59 |
-
if (null === ($length = $this->stream->getSize())) {
|
60 |
-
return null;
|
61 |
-
} elseif ($this->limit == -1) {
|
62 |
-
return $length - $this->offset;
|
63 |
-
} else {
|
64 |
-
return min($this->limit, $length - $this->offset);
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Allow for a bounded seek on the read limited stream
|
70 |
-
* {@inheritdoc}
|
71 |
-
*/
|
72 |
-
public function seek($offset, $whence = SEEK_SET)
|
73 |
-
{
|
74 |
-
if ($whence !== SEEK_SET || $offset < 0) {
|
75 |
-
throw new \RuntimeException(sprintf(
|
76 |
-
'Cannot seek to offset %s with whence %s',
|
77 |
-
$offset,
|
78 |
-
$whence
|
79 |
-
));
|
80 |
-
}
|
81 |
-
|
82 |
-
$offset += $this->offset;
|
83 |
-
|
84 |
-
if ($this->limit !== -1) {
|
85 |
-
if ($offset > $this->offset + $this->limit) {
|
86 |
-
$offset = $this->offset + $this->limit;
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
$this->stream->seek($offset);
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Give a relative tell()
|
95 |
-
* {@inheritdoc}
|
96 |
-
*/
|
97 |
-
public function tell()
|
98 |
-
{
|
99 |
-
return $this->stream->tell() - $this->offset;
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Set the offset to start limiting from
|
104 |
-
*
|
105 |
-
* @param int $offset Offset to seek to and begin byte limiting from
|
106 |
-
*
|
107 |
-
* @throws \RuntimeException if the stream cannot be seeked.
|
108 |
-
*/
|
109 |
-
public function setOffset($offset)
|
110 |
-
{
|
111 |
-
$current = $this->stream->tell();
|
112 |
-
|
113 |
-
if ($current !== $offset) {
|
114 |
-
// If the stream cannot seek to the offset position, then read to it
|
115 |
-
if ($this->stream->isSeekable()) {
|
116 |
-
$this->stream->seek($offset);
|
117 |
-
} elseif ($current > $offset) {
|
118 |
-
throw new \RuntimeException("Could not seek to stream offset $offset");
|
119 |
-
} else {
|
120 |
-
$this->stream->read($offset - $current);
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
$this->offset = $offset;
|
125 |
-
}
|
126 |
-
|
127 |
-
/**
|
128 |
-
* Set the limit of bytes that the decorator allows to be read from the
|
129 |
-
* stream.
|
130 |
-
*
|
131 |
-
* @param int $limit Number of bytes to allow to be read from the stream.
|
132 |
-
* Use -1 for no limit.
|
133 |
-
*/
|
134 |
-
public function setLimit($limit)
|
135 |
-
{
|
136 |
-
$this->limit = $limit;
|
137 |
-
}
|
138 |
-
|
139 |
-
public function read($length)
|
140 |
-
{
|
141 |
-
if ($this->limit == -1) {
|
142 |
-
return $this->stream->read($length);
|
143 |
-
}
|
144 |
-
|
145 |
-
// Check if the current position is less than the total allowed
|
146 |
-
// bytes + original offset
|
147 |
-
$remaining = ($this->offset + $this->limit) - $this->stream->tell();
|
148 |
-
if ($remaining > 0) {
|
149 |
-
// Only return the amount of requested data, ensuring that the byte
|
150 |
-
// limit is not exceeded
|
151 |
-
return $this->stream->read(min($remaining, $length));
|
152 |
-
}
|
153 |
-
|
154 |
-
return '';
|
155 |
-
}
|
156 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/Message.php
DELETED
@@ -1,252 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\MessageInterface;
|
6 |
-
use Psr\Http\Message\RequestInterface;
|
7 |
-
use Psr\Http\Message\ResponseInterface;
|
8 |
-
|
9 |
-
final class Message
|
10 |
-
{
|
11 |
-
/**
|
12 |
-
* Returns the string representation of an HTTP message.
|
13 |
-
*
|
14 |
-
* @param MessageInterface $message Message to convert to a string.
|
15 |
-
*
|
16 |
-
* @return string
|
17 |
-
*/
|
18 |
-
public static function toString(MessageInterface $message)
|
19 |
-
{
|
20 |
-
if ($message instanceof RequestInterface) {
|
21 |
-
$msg = trim($message->getMethod() . ' '
|
22 |
-
. $message->getRequestTarget())
|
23 |
-
. ' HTTP/' . $message->getProtocolVersion();
|
24 |
-
if (!$message->hasHeader('host')) {
|
25 |
-
$msg .= "\r\nHost: " . $message->getUri()->getHost();
|
26 |
-
}
|
27 |
-
} elseif ($message instanceof ResponseInterface) {
|
28 |
-
$msg = 'HTTP/' . $message->getProtocolVersion() . ' '
|
29 |
-
. $message->getStatusCode() . ' '
|
30 |
-
. $message->getReasonPhrase();
|
31 |
-
} else {
|
32 |
-
throw new \InvalidArgumentException('Unknown message type');
|
33 |
-
}
|
34 |
-
|
35 |
-
foreach ($message->getHeaders() as $name => $values) {
|
36 |
-
if (strtolower($name) === 'set-cookie') {
|
37 |
-
foreach ($values as $value) {
|
38 |
-
$msg .= "\r\n{$name}: " . $value;
|
39 |
-
}
|
40 |
-
} else {
|
41 |
-
$msg .= "\r\n{$name}: " . implode(', ', $values);
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
return "{$msg}\r\n\r\n" . $message->getBody();
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Get a short summary of the message body.
|
50 |
-
*
|
51 |
-
* Will return `null` if the response is not printable.
|
52 |
-
*
|
53 |
-
* @param MessageInterface $message The message to get the body summary
|
54 |
-
* @param int $truncateAt The maximum allowed size of the summary
|
55 |
-
*
|
56 |
-
* @return string|null
|
57 |
-
*/
|
58 |
-
public static function bodySummary(MessageInterface $message, $truncateAt = 120)
|
59 |
-
{
|
60 |
-
$body = $message->getBody();
|
61 |
-
|
62 |
-
if (!$body->isSeekable() || !$body->isReadable()) {
|
63 |
-
return null;
|
64 |
-
}
|
65 |
-
|
66 |
-
$size = $body->getSize();
|
67 |
-
|
68 |
-
if ($size === 0) {
|
69 |
-
return null;
|
70 |
-
}
|
71 |
-
|
72 |
-
$summary = $body->read($truncateAt);
|
73 |
-
$body->rewind();
|
74 |
-
|
75 |
-
if ($size > $truncateAt) {
|
76 |
-
$summary .= ' (truncated...)';
|
77 |
-
}
|
78 |
-
|
79 |
-
// Matches any printable character, including unicode characters:
|
80 |
-
// letters, marks, numbers, punctuation, spacing, and separators.
|
81 |
-
if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/u', $summary)) {
|
82 |
-
return null;
|
83 |
-
}
|
84 |
-
|
85 |
-
return $summary;
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Attempts to rewind a message body and throws an exception on failure.
|
90 |
-
*
|
91 |
-
* The body of the message will only be rewound if a call to `tell()`
|
92 |
-
* returns a value other than `0`.
|
93 |
-
*
|
94 |
-
* @param MessageInterface $message Message to rewind
|
95 |
-
*
|
96 |
-
* @throws \RuntimeException
|
97 |
-
*/
|
98 |
-
public static function rewindBody(MessageInterface $message)
|
99 |
-
{
|
100 |
-
$body = $message->getBody();
|
101 |
-
|
102 |
-
if ($body->tell()) {
|
103 |
-
$body->rewind();
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Parses an HTTP message into an associative array.
|
109 |
-
*
|
110 |
-
* The array contains the "start-line" key containing the start line of
|
111 |
-
* the message, "headers" key containing an associative array of header
|
112 |
-
* array values, and a "body" key containing the body of the message.
|
113 |
-
*
|
114 |
-
* @param string $message HTTP request or response to parse.
|
115 |
-
*
|
116 |
-
* @return array
|
117 |
-
*/
|
118 |
-
public static function parseMessage($message)
|
119 |
-
{
|
120 |
-
if (!$message) {
|
121 |
-
throw new \InvalidArgumentException('Invalid message');
|
122 |
-
}
|
123 |
-
|
124 |
-
$message = ltrim($message, "\r\n");
|
125 |
-
|
126 |
-
$messageParts = preg_split("/\r?\n\r?\n/", $message, 2);
|
127 |
-
|
128 |
-
if ($messageParts === false || count($messageParts) !== 2) {
|
129 |
-
throw new \InvalidArgumentException('Invalid message: Missing header delimiter');
|
130 |
-
}
|
131 |
-
|
132 |
-
list($rawHeaders, $body) = $messageParts;
|
133 |
-
$rawHeaders .= "\r\n"; // Put back the delimiter we split previously
|
134 |
-
$headerParts = preg_split("/\r?\n/", $rawHeaders, 2);
|
135 |
-
|
136 |
-
if ($headerParts === false || count($headerParts) !== 2) {
|
137 |
-
throw new \InvalidArgumentException('Invalid message: Missing status line');
|
138 |
-
}
|
139 |
-
|
140 |
-
list($startLine, $rawHeaders) = $headerParts;
|
141 |
-
|
142 |
-
if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') {
|
143 |
-
// Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0
|
144 |
-
$rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders);
|
145 |
-
}
|
146 |
-
|
147 |
-
/** @var array[] $headerLines */
|
148 |
-
$count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER);
|
149 |
-
|
150 |
-
// If these aren't the same, then one line didn't match and there's an invalid header.
|
151 |
-
if ($count !== substr_count($rawHeaders, "\n")) {
|
152 |
-
// Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
|
153 |
-
if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
|
154 |
-
throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
|
155 |
-
}
|
156 |
-
|
157 |
-
throw new \InvalidArgumentException('Invalid header syntax');
|
158 |
-
}
|
159 |
-
|
160 |
-
$headers = [];
|
161 |
-
|
162 |
-
foreach ($headerLines as $headerLine) {
|
163 |
-
$headers[$headerLine[1]][] = $headerLine[2];
|
164 |
-
}
|
165 |
-
|
166 |
-
return [
|
167 |
-
'start-line' => $startLine,
|
168 |
-
'headers' => $headers,
|
169 |
-
'body' => $body,
|
170 |
-
];
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Constructs a URI for an HTTP request message.
|
175 |
-
*
|
176 |
-
* @param string $path Path from the start-line
|
177 |
-
* @param array $headers Array of headers (each value an array).
|
178 |
-
*
|
179 |
-
* @return string
|
180 |
-
*/
|
181 |
-
public static function parseRequestUri($path, array $headers)
|
182 |
-
{
|
183 |
-
$hostKey = array_filter(array_keys($headers), function ($k) {
|
184 |
-
return strtolower($k) === 'host';
|
185 |
-
});
|
186 |
-
|
187 |
-
// If no host is found, then a full URI cannot be constructed.
|
188 |
-
if (!$hostKey) {
|
189 |
-
return $path;
|
190 |
-
}
|
191 |
-
|
192 |
-
$host = $headers[reset($hostKey)][0];
|
193 |
-
$scheme = substr($host, -4) === ':443' ? 'https' : 'http';
|
194 |
-
|
195 |
-
return $scheme . '://' . $host . '/' . ltrim($path, '/');
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Parses a request message string into a request object.
|
200 |
-
*
|
201 |
-
* @param string $message Request message string.
|
202 |
-
*
|
203 |
-
* @return Request
|
204 |
-
*/
|
205 |
-
public static function parseRequest($message)
|
206 |
-
{
|
207 |
-
$data = self::parseMessage($message);
|
208 |
-
$matches = [];
|
209 |
-
if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) {
|
210 |
-
throw new \InvalidArgumentException('Invalid request string');
|
211 |
-
}
|
212 |
-
$parts = explode(' ', $data['start-line'], 3);
|
213 |
-
$version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1';
|
214 |
-
|
215 |
-
$request = new Request(
|
216 |
-
$parts[0],
|
217 |
-
$matches[1] === '/' ? self::parseRequestUri($parts[1], $data['headers']) : $parts[1],
|
218 |
-
$data['headers'],
|
219 |
-
$data['body'],
|
220 |
-
$version
|
221 |
-
);
|
222 |
-
|
223 |
-
return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]);
|
224 |
-
}
|
225 |
-
|
226 |
-
/**
|
227 |
-
* Parses a response message string into a response object.
|
228 |
-
*
|
229 |
-
* @param string $message Response message string.
|
230 |
-
*
|
231 |
-
* @return Response
|
232 |
-
*/
|
233 |
-
public static function parseResponse($message)
|
234 |
-
{
|
235 |
-
$data = self::parseMessage($message);
|
236 |
-
// According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space
|
237 |
-
// between status-code and reason-phrase is required. But browsers accept
|
238 |
-
// responses without space and reason as well.
|
239 |
-
if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
|
240 |
-
throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']);
|
241 |
-
}
|
242 |
-
$parts = explode(' ', $data['start-line'], 3);
|
243 |
-
|
244 |
-
return new Response(
|
245 |
-
(int) $parts[1],
|
246 |
-
$data['headers'],
|
247 |
-
$data['body'],
|
248 |
-
explode('/', $parts[0])[1],
|
249 |
-
isset($parts[2]) ? $parts[2] : null
|
250 |
-
);
|
251 |
-
}
|
252 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/MessageTrait.php
DELETED
@@ -1,214 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Trait implementing functionality common to requests and responses.
|
9 |
-
*/
|
10 |
-
trait MessageTrait
|
11 |
-
{
|
12 |
-
/** @var array Map of all registered headers, as original name => array of values */
|
13 |
-
private $headers = [];
|
14 |
-
|
15 |
-
/** @var array Map of lowercase header name => original name at registration */
|
16 |
-
private $headerNames = [];
|
17 |
-
|
18 |
-
/** @var string */
|
19 |
-
private $protocol = '1.1';
|
20 |
-
|
21 |
-
/** @var StreamInterface|null */
|
22 |
-
private $stream;
|
23 |
-
|
24 |
-
public function getProtocolVersion()
|
25 |
-
{
|
26 |
-
return $this->protocol;
|
27 |
-
}
|
28 |
-
|
29 |
-
public function withProtocolVersion($version)
|
30 |
-
{
|
31 |
-
if ($this->protocol === $version) {
|
32 |
-
return $this;
|
33 |
-
}
|
34 |
-
|
35 |
-
$new = clone $this;
|
36 |
-
$new->protocol = $version;
|
37 |
-
return $new;
|
38 |
-
}
|
39 |
-
|
40 |
-
public function getHeaders()
|
41 |
-
{
|
42 |
-
return $this->headers;
|
43 |
-
}
|
44 |
-
|
45 |
-
public function hasHeader($header)
|
46 |
-
{
|
47 |
-
return isset($this->headerNames[strtolower($header)]);
|
48 |
-
}
|
49 |
-
|
50 |
-
public function getHeader($header)
|
51 |
-
{
|
52 |
-
$header = strtolower($header);
|
53 |
-
|
54 |
-
if (!isset($this->headerNames[$header])) {
|
55 |
-
return [];
|
56 |
-
}
|
57 |
-
|
58 |
-
$header = $this->headerNames[$header];
|
59 |
-
|
60 |
-
return $this->headers[$header];
|
61 |
-
}
|
62 |
-
|
63 |
-
public function getHeaderLine($header)
|
64 |
-
{
|
65 |
-
return implode(', ', $this->getHeader($header));
|
66 |
-
}
|
67 |
-
|
68 |
-
public function withHeader($header, $value)
|
69 |
-
{
|
70 |
-
$this->assertHeader($header);
|
71 |
-
$value = $this->normalizeHeaderValue($value);
|
72 |
-
$normalized = strtolower($header);
|
73 |
-
|
74 |
-
$new = clone $this;
|
75 |
-
if (isset($new->headerNames[$normalized])) {
|
76 |
-
unset($new->headers[$new->headerNames[$normalized]]);
|
77 |
-
}
|
78 |
-
$new->headerNames[$normalized] = $header;
|
79 |
-
$new->headers[$header] = $value;
|
80 |
-
|
81 |
-
return $new;
|
82 |
-
}
|
83 |
-
|
84 |
-
public function withAddedHeader($header, $value)
|
85 |
-
{
|
86 |
-
$this->assertHeader($header);
|
87 |
-
$value = $this->normalizeHeaderValue($value);
|
88 |
-
$normalized = strtolower($header);
|
89 |
-
|
90 |
-
$new = clone $this;
|
91 |
-
if (isset($new->headerNames[$normalized])) {
|
92 |
-
$header = $this->headerNames[$normalized];
|
93 |
-
$new->headers[$header] = array_merge($this->headers[$header], $value);
|
94 |
-
} else {
|
95 |
-
$new->headerNames[$normalized] = $header;
|
96 |
-
$new->headers[$header] = $value;
|
97 |
-
}
|
98 |
-
|
99 |
-
return $new;
|
100 |
-
}
|
101 |
-
|
102 |
-
public function withoutHeader($header)
|
103 |
-
{
|
104 |
-
$normalized = strtolower($header);
|
105 |
-
|
106 |
-
if (!isset($this->headerNames[$normalized])) {
|
107 |
-
return $this;
|
108 |
-
}
|
109 |
-
|
110 |
-
$header = $this->headerNames[$normalized];
|
111 |
-
|
112 |
-
$new = clone $this;
|
113 |
-
unset($new->headers[$header], $new->headerNames[$normalized]);
|
114 |
-
|
115 |
-
return $new;
|
116 |
-
}
|
117 |
-
|
118 |
-
public function getBody()
|
119 |
-
{
|
120 |
-
if (!$this->stream) {
|
121 |
-
$this->stream = Utils::streamFor('');
|
122 |
-
}
|
123 |
-
|
124 |
-
return $this->stream;
|
125 |
-
}
|
126 |
-
|
127 |
-
public function withBody(StreamInterface $body)
|
128 |
-
{
|
129 |
-
if ($body === $this->stream) {
|
130 |
-
return $this;
|
131 |
-
}
|
132 |
-
|
133 |
-
$new = clone $this;
|
134 |
-
$new->stream = $body;
|
135 |
-
return $new;
|
136 |
-
}
|
137 |
-
|
138 |
-
private function setHeaders(array $headers)
|
139 |
-
{
|
140 |
-
$this->headerNames = $this->headers = [];
|
141 |
-
foreach ($headers as $header => $value) {
|
142 |
-
if (is_int($header)) {
|
143 |
-
// Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec
|
144 |
-
// and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass.
|
145 |
-
$header = (string) $header;
|
146 |
-
}
|
147 |
-
$this->assertHeader($header);
|
148 |
-
$value = $this->normalizeHeaderValue($value);
|
149 |
-
$normalized = strtolower($header);
|
150 |
-
if (isset($this->headerNames[$normalized])) {
|
151 |
-
$header = $this->headerNames[$normalized];
|
152 |
-
$this->headers[$header] = array_merge($this->headers[$header], $value);
|
153 |
-
} else {
|
154 |
-
$this->headerNames[$normalized] = $header;
|
155 |
-
$this->headers[$header] = $value;
|
156 |
-
}
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
private function normalizeHeaderValue($value)
|
161 |
-
{
|
162 |
-
if (!is_array($value)) {
|
163 |
-
return $this->trimHeaderValues([$value]);
|
164 |
-
}
|
165 |
-
|
166 |
-
if (count($value) === 0) {
|
167 |
-
throw new \InvalidArgumentException('Header value can not be an empty array.');
|
168 |
-
}
|
169 |
-
|
170 |
-
return $this->trimHeaderValues($value);
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Trims whitespace from the header values.
|
175 |
-
*
|
176 |
-
* Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field.
|
177 |
-
*
|
178 |
-
* header-field = field-name ":" OWS field-value OWS
|
179 |
-
* OWS = *( SP / HTAB )
|
180 |
-
*
|
181 |
-
* @param string[] $values Header values
|
182 |
-
*
|
183 |
-
* @return string[] Trimmed header values
|
184 |
-
*
|
185 |
-
* @see https://tools.ietf.org/html/rfc7230#section-3.2.4
|
186 |
-
*/
|
187 |
-
private function trimHeaderValues(array $values)
|
188 |
-
{
|
189 |
-
return array_map(function ($value) {
|
190 |
-
if (!is_scalar($value) && null !== $value) {
|
191 |
-
throw new \InvalidArgumentException(sprintf(
|
192 |
-
'Header value must be scalar or null but %s provided.',
|
193 |
-
is_object($value) ? get_class($value) : gettype($value)
|
194 |
-
));
|
195 |
-
}
|
196 |
-
|
197 |
-
return trim((string) $value, " \t");
|
198 |
-
}, array_values($values));
|
199 |
-
}
|
200 |
-
|
201 |
-
private function assertHeader($header)
|
202 |
-
{
|
203 |
-
if (!is_string($header)) {
|
204 |
-
throw new \InvalidArgumentException(sprintf(
|
205 |
-
'Header name must be a string but %s provided.',
|
206 |
-
is_object($header) ? get_class($header) : gettype($header)
|
207 |
-
));
|
208 |
-
}
|
209 |
-
|
210 |
-
if ($header === '') {
|
211 |
-
throw new \InvalidArgumentException('Header name can not be empty.');
|
212 |
-
}
|
213 |
-
}
|
214 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/MimeType.php
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
final class MimeType
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Determines the mimetype of a file by looking at its extension.
|
9 |
-
*
|
10 |
-
* @param string $filename
|
11 |
-
*
|
12 |
-
* @return string|null
|
13 |
-
*/
|
14 |
-
public static function fromFilename($filename)
|
15 |
-
{
|
16 |
-
return self::fromExtension(pathinfo($filename, PATHINFO_EXTENSION));
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Maps a file extensions to a mimetype.
|
21 |
-
*
|
22 |
-
* @param string $extension string The file extension.
|
23 |
-
*
|
24 |
-
* @return string|null
|
25 |
-
*
|
26 |
-
* @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
|
27 |
-
*/
|
28 |
-
public static function fromExtension($extension)
|
29 |
-
{
|
30 |
-
static $mimetypes = [
|
31 |
-
'3gp' => 'video/3gpp',
|
32 |
-
'7z' => 'application/x-7z-compressed',
|
33 |
-
'aac' => 'audio/x-aac',
|
34 |
-
'ai' => 'application/postscript',
|
35 |
-
'aif' => 'audio/x-aiff',
|
36 |
-
'asc' => 'text/plain',
|
37 |
-
'asf' => 'video/x-ms-asf',
|
38 |
-
'atom' => 'application/atom+xml',
|
39 |
-
'avi' => 'video/x-msvideo',
|
40 |
-
'bmp' => 'image/bmp',
|
41 |
-
'bz2' => 'application/x-bzip2',
|
42 |
-
'cer' => 'application/pkix-cert',
|
43 |
-
'crl' => 'application/pkix-crl',
|
44 |
-
'crt' => 'application/x-x509-ca-cert',
|
45 |
-
'css' => 'text/css',
|
46 |
-
'csv' => 'text/csv',
|
47 |
-
'cu' => 'application/cu-seeme',
|
48 |
-
'deb' => 'application/x-debian-package',
|
49 |
-
'doc' => 'application/msword',
|
50 |
-
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
51 |
-
'dvi' => 'application/x-dvi',
|
52 |
-
'eot' => 'application/vnd.ms-fontobject',
|
53 |
-
'eps' => 'application/postscript',
|
54 |
-
'epub' => 'application/epub+zip',
|
55 |
-
'etx' => 'text/x-setext',
|
56 |
-
'flac' => 'audio/flac',
|
57 |
-
'flv' => 'video/x-flv',
|
58 |
-
'gif' => 'image/gif',
|
59 |
-
'gz' => 'application/gzip',
|
60 |
-
'htm' => 'text/html',
|
61 |
-
'html' => 'text/html',
|
62 |
-
'ico' => 'image/x-icon',
|
63 |
-
'ics' => 'text/calendar',
|
64 |
-
'ini' => 'text/plain',
|
65 |
-
'iso' => 'application/x-iso9660-image',
|
66 |
-
'jar' => 'application/java-archive',
|
67 |
-
'jpe' => 'image/jpeg',
|
68 |
-
'jpeg' => 'image/jpeg',
|
69 |
-
'jpg' => 'image/jpeg',
|
70 |
-
'js' => 'text/javascript',
|
71 |
-
'json' => 'application/json',
|
72 |
-
'latex' => 'application/x-latex',
|
73 |
-
'log' => 'text/plain',
|
74 |
-
'm4a' => 'audio/mp4',
|
75 |
-
'm4v' => 'video/mp4',
|
76 |
-
'mid' => 'audio/midi',
|
77 |
-
'midi' => 'audio/midi',
|
78 |
-
'mov' => 'video/quicktime',
|
79 |
-
'mkv' => 'video/x-matroska',
|
80 |
-
'mp3' => 'audio/mpeg',
|
81 |
-
'mp4' => 'video/mp4',
|
82 |
-
'mp4a' => 'audio/mp4',
|
83 |
-
'mp4v' => 'video/mp4',
|
84 |
-
'mpe' => 'video/mpeg',
|
85 |
-
'mpeg' => 'video/mpeg',
|
86 |
-
'mpg' => 'video/mpeg',
|
87 |
-
'mpg4' => 'video/mp4',
|
88 |
-
'oga' => 'audio/ogg',
|
89 |
-
'ogg' => 'audio/ogg',
|
90 |
-
'ogv' => 'video/ogg',
|
91 |
-
'ogx' => 'application/ogg',
|
92 |
-
'pbm' => 'image/x-portable-bitmap',
|
93 |
-
'pdf' => 'application/pdf',
|
94 |
-
'pgm' => 'image/x-portable-graymap',
|
95 |
-
'png' => 'image/png',
|
96 |
-
'pnm' => 'image/x-portable-anymap',
|
97 |
-
'ppm' => 'image/x-portable-pixmap',
|
98 |
-
'ppt' => 'application/vnd.ms-powerpoint',
|
99 |
-
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
100 |
-
'ps' => 'application/postscript',
|
101 |
-
'qt' => 'video/quicktime',
|
102 |
-
'rar' => 'application/x-rar-compressed',
|
103 |
-
'ras' => 'image/x-cmu-raster',
|
104 |
-
'rss' => 'application/rss+xml',
|
105 |
-
'rtf' => 'application/rtf',
|
106 |
-
'sgm' => 'text/sgml',
|
107 |
-
'sgml' => 'text/sgml',
|
108 |
-
'svg' => 'image/svg+xml',
|
109 |
-
'swf' => 'application/x-shockwave-flash',
|
110 |
-
'tar' => 'application/x-tar',
|
111 |
-
'tif' => 'image/tiff',
|
112 |
-
'tiff' => 'image/tiff',
|
113 |
-
'torrent' => 'application/x-bittorrent',
|
114 |
-
'ttf' => 'application/x-font-ttf',
|
115 |
-
'txt' => 'text/plain',
|
116 |
-
'wav' => 'audio/x-wav',
|
117 |
-
'webm' => 'video/webm',
|
118 |
-
'webp' => 'image/webp',
|
119 |
-
'wma' => 'audio/x-ms-wma',
|
120 |
-
'wmv' => 'video/x-ms-wmv',
|
121 |
-
'woff' => 'application/x-font-woff',
|
122 |
-
'wsdl' => 'application/wsdl+xml',
|
123 |
-
'xbm' => 'image/x-xbitmap',
|
124 |
-
'xls' => 'application/vnd.ms-excel',
|
125 |
-
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
126 |
-
'xml' => 'application/xml',
|
127 |
-
'xpm' => 'image/x-xpixmap',
|
128 |
-
'xwd' => 'image/x-xwindowdump',
|
129 |
-
'yaml' => 'text/yaml',
|
130 |
-
'yml' => 'text/yaml',
|
131 |
-
'zip' => 'application/zip',
|
132 |
-
];
|
133 |
-
|
134 |
-
$extension = strtolower($extension);
|
135 |
-
|
136 |
-
return isset($mimetypes[$extension])
|
137 |
-
? $mimetypes[$extension]
|
138 |
-
: null;
|
139 |
-
}
|
140 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/MultipartStream.php
DELETED
@@ -1,154 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Stream that when read returns bytes for a streaming multipart or
|
9 |
-
* multipart/form-data stream.
|
10 |
-
*/
|
11 |
-
class MultipartStream implements StreamInterface
|
12 |
-
{
|
13 |
-
use StreamDecoratorTrait;
|
14 |
-
|
15 |
-
private $boundary;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @param array $elements Array of associative arrays, each containing a
|
19 |
-
* required "name" key mapping to the form field,
|
20 |
-
* name, a required "contents" key mapping to a
|
21 |
-
* StreamInterface/resource/string, an optional
|
22 |
-
* "headers" associative array of custom headers,
|
23 |
-
* and an optional "filename" key mapping to a
|
24 |
-
* string to send as the filename in the part.
|
25 |
-
* @param string $boundary You can optionally provide a specific boundary
|
26 |
-
*
|
27 |
-
* @throws \InvalidArgumentException
|
28 |
-
*/
|
29 |
-
public function __construct(array $elements = [], $boundary = null)
|
30 |
-
{
|
31 |
-
$this->boundary = $boundary ?: sha1(uniqid('', true));
|
32 |
-
$this->stream = $this->createStream($elements);
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Get the boundary
|
37 |
-
*
|
38 |
-
* @return string
|
39 |
-
*/
|
40 |
-
public function getBoundary()
|
41 |
-
{
|
42 |
-
return $this->boundary;
|
43 |
-
}
|
44 |
-
|
45 |
-
public function isWritable()
|
46 |
-
{
|
47 |
-
return false;
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Get the headers needed before transferring the content of a POST file
|
52 |
-
*/
|
53 |
-
private function getHeaders(array $headers)
|
54 |
-
{
|
55 |
-
$str = '';
|
56 |
-
foreach ($headers as $key => $value) {
|
57 |
-
$str .= "{$key}: {$value}\r\n";
|
58 |
-
}
|
59 |
-
|
60 |
-
return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n";
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Create the aggregate stream that will be used to upload the POST data
|
65 |
-
*/
|
66 |
-
protected function createStream(array $elements)
|
67 |
-
{
|
68 |
-
$stream = new AppendStream();
|
69 |
-
|
70 |
-
foreach ($elements as $element) {
|
71 |
-
$this->addElement($stream, $element);
|
72 |
-
}
|
73 |
-
|
74 |
-
// Add the trailing boundary with CRLF
|
75 |
-
$stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n"));
|
76 |
-
|
77 |
-
return $stream;
|
78 |
-
}
|
79 |
-
|
80 |
-
private function addElement(AppendStream $stream, array $element)
|
81 |
-
{
|
82 |
-
foreach (['contents', 'name'] as $key) {
|
83 |
-
if (!array_key_exists($key, $element)) {
|
84 |
-
throw new \InvalidArgumentException("A '{$key}' key is required");
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
$element['contents'] = Utils::streamFor($element['contents']);
|
89 |
-
|
90 |
-
if (empty($element['filename'])) {
|
91 |
-
$uri = $element['contents']->getMetadata('uri');
|
92 |
-
if (substr($uri, 0, 6) !== 'php://') {
|
93 |
-
$element['filename'] = $uri;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
list($body, $headers) = $this->createElement(
|
98 |
-
$element['name'],
|
99 |
-
$element['contents'],
|
100 |
-
isset($element['filename']) ? $element['filename'] : null,
|
101 |
-
isset($element['headers']) ? $element['headers'] : []
|
102 |
-
);
|
103 |
-
|
104 |
-
$stream->addStream(Utils::streamFor($this->getHeaders($headers)));
|
105 |
-
$stream->addStream($body);
|
106 |
-
$stream->addStream(Utils::streamFor("\r\n"));
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* @return array
|
111 |
-
*/
|
112 |
-
private function createElement($name, StreamInterface $stream, $filename, array $headers)
|
113 |
-
{
|
114 |
-
// Set a default content-disposition header if one was no provided
|
115 |
-
$disposition = $this->getHeader($headers, 'content-disposition');
|
116 |
-
if (!$disposition) {
|
117 |
-
$headers['Content-Disposition'] = ($filename === '0' || $filename)
|
118 |
-
? sprintf('form-data; name="%s"; filename="%s"',
|
119 |
-
$name,
|
120 |
-
basename($filename))
|
121 |
-
: "form-data; name=\"{$name}\"";
|
122 |
-
}
|
123 |
-
|
124 |
-
// Set a default content-length header if one was no provided
|
125 |
-
$length = $this->getHeader($headers, 'content-length');
|
126 |
-
if (!$length) {
|
127 |
-
if ($length = $stream->getSize()) {
|
128 |
-
$headers['Content-Length'] = (string) $length;
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
// Set a default Content-Type if one was not supplied
|
133 |
-
$type = $this->getHeader($headers, 'content-type');
|
134 |
-
if (!$type && ($filename === '0' || $filename)) {
|
135 |
-
if ($type = MimeType::fromFilename($filename)) {
|
136 |
-
$headers['Content-Type'] = $type;
|
137 |
-
}
|
138 |
-
}
|
139 |
-
|
140 |
-
return [$stream, $headers];
|
141 |
-
}
|
142 |
-
|
143 |
-
private function getHeader(array $headers, $key)
|
144 |
-
{
|
145 |
-
$lowercaseHeader = strtolower($key);
|
146 |
-
foreach ($headers as $k => $v) {
|
147 |
-
if (strtolower($k) === $lowercaseHeader) {
|
148 |
-
return $v;
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
return null;
|
153 |
-
}
|
154 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/NoSeekStream.php
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Stream decorator that prevents a stream from being seeked
|
9 |
-
*/
|
10 |
-
class NoSeekStream implements StreamInterface
|
11 |
-
{
|
12 |
-
use StreamDecoratorTrait;
|
13 |
-
|
14 |
-
public function seek($offset, $whence = SEEK_SET)
|
15 |
-
{
|
16 |
-
throw new \RuntimeException('Cannot seek a NoSeekStream');
|
17 |
-
}
|
18 |
-
|
19 |
-
public function isSeekable()
|
20 |
-
{
|
21 |
-
return false;
|
22 |
-
}
|
23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/PumpStream.php
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Provides a read only stream that pumps data from a PHP callable.
|
9 |
-
*
|
10 |
-
* When invoking the provided callable, the PumpStream will pass the amount of
|
11 |
-
* data requested to read to the callable. The callable can choose to ignore
|
12 |
-
* this value and return fewer or more bytes than requested. Any extra data
|
13 |
-
* returned by the provided callable is buffered internally until drained using
|
14 |
-
* the read() function of the PumpStream. The provided callable MUST return
|
15 |
-
* false when there is no more data to read.
|
16 |
-
*/
|
17 |
-
class PumpStream implements StreamInterface
|
18 |
-
{
|
19 |
-
/** @var callable */
|
20 |
-
private $source;
|
21 |
-
|
22 |
-
/** @var int */
|
23 |
-
private $size;
|
24 |
-
|
25 |
-
/** @var int */
|
26 |
-
private $tellPos = 0;
|
27 |
-
|
28 |
-
/** @var array */
|
29 |
-
private $metadata;
|
30 |
-
|
31 |
-
/** @var BufferStream */
|
32 |
-
private $buffer;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @param callable $source Source of the stream data. The callable MAY
|
36 |
-
* accept an integer argument used to control the
|
37 |
-
* amount of data to return. The callable MUST
|
38 |
-
* return a string when called, or false on error
|
39 |
-
* or EOF.
|
40 |
-
* @param array $options Stream options:
|
41 |
-
* - metadata: Hash of metadata to use with stream.
|
42 |
-
* - size: Size of the stream, if known.
|
43 |
-
*/
|
44 |
-
public function __construct(callable $source, array $options = [])
|
45 |
-
{
|
46 |
-
$this->source = $source;
|
47 |
-
$this->size = isset($options['size']) ? $options['size'] : null;
|
48 |
-
$this->metadata = isset($options['metadata']) ? $options['metadata'] : [];
|
49 |
-
$this->buffer = new BufferStream();
|
50 |
-
}
|
51 |
-
|
52 |
-
public function __toString()
|
53 |
-
{
|
54 |
-
try {
|
55 |
-
return Utils::copyToString($this);
|
56 |
-
} catch (\Exception $e) {
|
57 |
-
return '';
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
public function close()
|
62 |
-
{
|
63 |
-
$this->detach();
|
64 |
-
}
|
65 |
-
|
66 |
-
public function detach()
|
67 |
-
{
|
68 |
-
$this->tellPos = false;
|
69 |
-
$this->source = null;
|
70 |
-
|
71 |
-
return null;
|
72 |
-
}
|
73 |
-
|
74 |
-
public function getSize()
|
75 |
-
{
|
76 |
-
return $this->size;
|
77 |
-
}
|
78 |
-
|
79 |
-
public function tell()
|
80 |
-
{
|
81 |
-
return $this->tellPos;
|
82 |
-
}
|
83 |
-
|
84 |
-
public function eof()
|
85 |
-
{
|
86 |
-
return !$this->source;
|
87 |
-
}
|
88 |
-
|
89 |
-
public function isSeekable()
|
90 |
-
{
|
91 |
-
return false;
|
92 |
-
}
|
93 |
-
|
94 |
-
public function rewind()
|
95 |
-
{
|
96 |
-
$this->seek(0);
|
97 |
-
}
|
98 |
-
|
99 |
-
public function seek($offset, $whence = SEEK_SET)
|
100 |
-
{
|
101 |
-
throw new \RuntimeException('Cannot seek a PumpStream');
|
102 |
-
}
|
103 |
-
|
104 |
-
public function isWritable()
|
105 |
-
{
|
106 |
-
return false;
|
107 |
-
}
|
108 |
-
|
109 |
-
public function write($string)
|
110 |
-
{
|
111 |
-
throw new \RuntimeException('Cannot write to a PumpStream');
|
112 |
-
}
|
113 |
-
|
114 |
-
public function isReadable()
|
115 |
-
{
|
116 |
-
return true;
|
117 |
-
}
|
118 |
-
|
119 |
-
public function read($length)
|
120 |
-
{
|
121 |
-
$data = $this->buffer->read($length);
|
122 |
-
$readLen = strlen($data);
|
123 |
-
$this->tellPos += $readLen;
|
124 |
-
$remaining = $length - $readLen;
|
125 |
-
|
126 |
-
if ($remaining) {
|
127 |
-
$this->pump($remaining);
|
128 |
-
$data .= $this->buffer->read($remaining);
|
129 |
-
$this->tellPos += strlen($data) - $readLen;
|
130 |
-
}
|
131 |
-
|
132 |
-
return $data;
|
133 |
-
}
|
134 |
-
|
135 |
-
public function getContents()
|
136 |
-
{
|
137 |
-
$result = '';
|
138 |
-
while (!$this->eof()) {
|
139 |
-
$result .= $this->read(1000000);
|
140 |
-
}
|
141 |
-
|
142 |
-
return $result;
|
143 |
-
}
|
144 |
-
|
145 |
-
public function getMetadata($key = null)
|
146 |
-
{
|
147 |
-
if (!$key) {
|
148 |
-
return $this->metadata;
|
149 |
-
}
|
150 |
-
|
151 |
-
return isset($this->metadata[$key]) ? $this->metadata[$key] : null;
|
152 |
-
}
|
153 |
-
|
154 |
-
private function pump($length)
|
155 |
-
{
|
156 |
-
if ($this->source) {
|
157 |
-
do {
|
158 |
-
$data = call_user_func($this->source, $length);
|
159 |
-
if ($data === false || $data === null) {
|
160 |
-
$this->source = null;
|
161 |
-
return;
|
162 |
-
}
|
163 |
-
$this->buffer->write($data);
|
164 |
-
$length -= strlen($data);
|
165 |
-
} while ($length > 0);
|
166 |
-
}
|
167 |
-
}
|
168 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/Query.php
DELETED
@@ -1,108 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
final class Query
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Parse a query string into an associative array.
|
9 |
-
*
|
10 |
-
* If multiple values are found for the same key, the value of that key
|
11 |
-
* value pair will become an array. This function does not parse nested
|
12 |
-
* PHP style arrays into an associative array (e.g., `foo[a]=1&foo[b]=2`
|
13 |
-
* will be parsed into `['foo[a]' => '1', 'foo[b]' => '2'])`.
|
14 |
-
*
|
15 |
-
* @param string $str Query string to parse
|
16 |
-
* @param int|bool $urlEncoding How the query string is encoded
|
17 |
-
*
|
18 |
-
* @return array
|
19 |
-
*/
|
20 |
-
public static function parse($str, $urlEncoding = true)
|
21 |
-
{
|
22 |
-
$result = [];
|
23 |
-
|
24 |
-
if ($str === '') {
|
25 |
-
return $result;
|
26 |
-
}
|
27 |
-
|
28 |
-
if ($urlEncoding === true) {
|
29 |
-
$decoder = function ($value) {
|
30 |
-
return rawurldecode(str_replace('+', ' ', $value));
|
31 |
-
};
|
32 |
-
} elseif ($urlEncoding === PHP_QUERY_RFC3986) {
|
33 |
-
$decoder = 'rawurldecode';
|
34 |
-
} elseif ($urlEncoding === PHP_QUERY_RFC1738) {
|
35 |
-
$decoder = 'urldecode';
|
36 |
-
} else {
|
37 |
-
$decoder = function ($str) { return $str; };
|
38 |
-
}
|
39 |
-
|
40 |
-
foreach (explode('&', $str) as $kvp) {
|
41 |
-
$parts = explode('=', $kvp, 2);
|
42 |
-
$key = $decoder($parts[0]);
|
43 |
-
$value = isset($parts[1]) ? $decoder($parts[1]) : null;
|
44 |
-
if (!isset($result[$key])) {
|
45 |
-
$result[$key] = $value;
|
46 |
-
} else {
|
47 |
-
if (!is_array($result[$key])) {
|
48 |
-
$result[$key] = [$result[$key]];
|
49 |
-
}
|
50 |
-
$result[$key][] = $value;
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
return $result;
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Build a query string from an array of key value pairs.
|
59 |
-
*
|
60 |
-
* This function can use the return value of `parse()` to build a query
|
61 |
-
* string. This function does not modify the provided keys when an array is
|
62 |
-
* encountered (like `http_build_query()` would).
|
63 |
-
*
|
64 |
-
* @param array $params Query string parameters.
|
65 |
-
* @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
|
66 |
-
* to encode using RFC3986, or PHP_QUERY_RFC1738
|
67 |
-
* to encode using RFC1738.
|
68 |
-
* @return string
|
69 |
-
*/
|
70 |
-
public static function build(array $params, $encoding = PHP_QUERY_RFC3986)
|
71 |
-
{
|
72 |
-
if (!$params) {
|
73 |
-
return '';
|
74 |
-
}
|
75 |
-
|
76 |
-
if ($encoding === false) {
|
77 |
-
$encoder = function ($str) { return $str; };
|
78 |
-
} elseif ($encoding === PHP_QUERY_RFC3986) {
|
79 |
-
$encoder = 'rawurlencode';
|
80 |
-
} elseif ($encoding === PHP_QUERY_RFC1738) {
|
81 |
-
$encoder = 'urlencode';
|
82 |
-
} else {
|
83 |
-
throw new \InvalidArgumentException('Invalid type');
|
84 |
-
}
|
85 |
-
|
86 |
-
$qs = '';
|
87 |
-
foreach ($params as $k => $v) {
|
88 |
-
$k = $encoder($k);
|
89 |
-
if (!is_array($v)) {
|
90 |
-
$qs .= $k;
|
91 |
-
if ($v !== null) {
|
92 |
-
$qs .= '=' . $encoder($v);
|
93 |
-
}
|
94 |
-
$qs .= '&';
|
95 |
-
} else {
|
96 |
-
foreach ($v as $vv) {
|
97 |
-
$qs .= $k;
|
98 |
-
if ($vv !== null) {
|
99 |
-
$qs .= '=' . $encoder($vv);
|
100 |
-
}
|
101 |
-
$qs .= '&';
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
return $qs ? (string) substr($qs, 0, -1) : '';
|
107 |
-
}
|
108 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/Request.php
DELETED
@@ -1,152 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use InvalidArgumentException;
|
6 |
-
use Psr\Http\Message\RequestInterface;
|
7 |
-
use Psr\Http\Message\StreamInterface;
|
8 |
-
use Psr\Http\Message\UriInterface;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* PSR-7 request implementation.
|
12 |
-
*/
|
13 |
-
class Request implements RequestInterface
|
14 |
-
{
|
15 |
-
use MessageTrait;
|
16 |
-
|
17 |
-
/** @var string */
|
18 |
-
private $method;
|
19 |
-
|
20 |
-
/** @var null|string */
|
21 |
-
private $requestTarget;
|
22 |
-
|
23 |
-
/** @var UriInterface */
|
24 |
-
private $uri;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @param string $method HTTP method
|
28 |
-
* @param string|UriInterface $uri URI
|
29 |
-
* @param array $headers Request headers
|
30 |
-
* @param string|null|resource|StreamInterface $body Request body
|
31 |
-
* @param string $version Protocol version
|
32 |
-
*/
|
33 |
-
public function __construct(
|
34 |
-
$method,
|
35 |
-
$uri,
|
36 |
-
array $headers = [],
|
37 |
-
$body = null,
|
38 |
-
$version = '1.1'
|
39 |
-
) {
|
40 |
-
$this->assertMethod($method);
|
41 |
-
if (!($uri instanceof UriInterface)) {
|
42 |
-
$uri = new Uri($uri);
|
43 |
-
}
|
44 |
-
|
45 |
-
$this->method = strtoupper($method);
|
46 |
-
$this->uri = $uri;
|
47 |
-
$this->setHeaders($headers);
|
48 |
-
$this->protocol = $version;
|
49 |
-
|
50 |
-
if (!isset($this->headerNames['host'])) {
|
51 |
-
$this->updateHostFromUri();
|
52 |
-
}
|
53 |
-
|
54 |
-
if ($body !== '' && $body !== null) {
|
55 |
-
$this->stream = Utils::streamFor($body);
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
public function getRequestTarget()
|
60 |
-
{
|
61 |
-
if ($this->requestTarget !== null) {
|
62 |
-
return $this->requestTarget;
|
63 |
-
}
|
64 |
-
|
65 |
-
$target = $this->uri->getPath();
|
66 |
-
if ($target == '') {
|
67 |
-
$target = '/';
|
68 |
-
}
|
69 |
-
if ($this->uri->getQuery() != '') {
|
70 |
-
$target .= '?' . $this->uri->getQuery();
|
71 |
-
}
|
72 |
-
|
73 |
-
return $target;
|
74 |
-
}
|
75 |
-
|
76 |
-
public function withRequestTarget($requestTarget)
|
77 |
-
{
|
78 |
-
if (preg_match('#\s#', $requestTarget)) {
|
79 |
-
throw new InvalidArgumentException(
|
80 |
-
'Invalid request target provided; cannot contain whitespace'
|
81 |
-
);
|
82 |
-
}
|
83 |
-
|
84 |
-
$new = clone $this;
|
85 |
-
$new->requestTarget = $requestTarget;
|
86 |
-
return $new;
|
87 |
-
}
|
88 |
-
|
89 |
-
public function getMethod()
|
90 |
-
{
|
91 |
-
return $this->method;
|
92 |
-
}
|
93 |
-
|
94 |
-
public function withMethod($method)
|
95 |
-
{
|
96 |
-
$this->assertMethod($method);
|
97 |
-
$new = clone $this;
|
98 |
-
$new->method = strtoupper($method);
|
99 |
-
return $new;
|
100 |
-
}
|
101 |
-
|
102 |
-
public function getUri()
|
103 |
-
{
|
104 |
-
return $this->uri;
|
105 |
-
}
|
106 |
-
|
107 |
-
public function withUri(UriInterface $uri, $preserveHost = false)
|
108 |
-
{
|
109 |
-
if ($uri === $this->uri) {
|
110 |
-
return $this;
|
111 |
-
}
|
112 |
-
|
113 |
-
$new = clone $this;
|
114 |
-
$new->uri = $uri;
|
115 |
-
|
116 |
-
if (!$preserveHost || !isset($this->headerNames['host'])) {
|
117 |
-
$new->updateHostFromUri();
|
118 |
-
}
|
119 |
-
|
120 |
-
return $new;
|
121 |
-
}
|
122 |
-
|
123 |
-
private function updateHostFromUri()
|
124 |
-
{
|
125 |
-
$host = $this->uri->getHost();
|
126 |
-
|
127 |
-
if ($host == '') {
|
128 |
-
return;
|
129 |
-
}
|
130 |
-
|
131 |
-
if (($port = $this->uri->getPort()) !== null) {
|
132 |
-
$host .= ':' . $port;
|
133 |
-
}
|
134 |
-
|
135 |
-
if (isset($this->headerNames['host'])) {
|
136 |
-
$header = $this->headerNames['host'];
|
137 |
-
} else {
|
138 |
-
$header = 'Host';
|
139 |
-
$this->headerNames['host'] = 'Host';
|
140 |
-
}
|
141 |
-
// Ensure Host is the first header.
|
142 |
-
// See: http://tools.ietf.org/html/rfc7230#section-5.4
|
143 |
-
$this->headers = [$header => [$host]] + $this->headers;
|
144 |
-
}
|
145 |
-
|
146 |
-
private function assertMethod($method)
|
147 |
-
{
|
148 |
-
if (!is_string($method) || $method === '') {
|
149 |
-
throw new \InvalidArgumentException('Method must be a non-empty string.');
|
150 |
-
}
|
151 |
-
}
|
152 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/Response.php
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\ResponseInterface;
|
6 |
-
use Psr\Http\Message\StreamInterface;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* PSR-7 response implementation.
|
10 |
-
*/
|
11 |
-
class Response implements ResponseInterface
|
12 |
-
{
|
13 |
-
use MessageTrait;
|
14 |
-
|
15 |
-
/** @var array Map of standard HTTP status code/reason phrases */
|
16 |
-
private static $phrases = [
|
17 |
-
100 => 'Continue',
|
18 |
-
101 => 'Switching Protocols',
|
19 |
-
102 => 'Processing',
|
20 |
-
200 => 'OK',
|
21 |
-
201 => 'Created',
|
22 |
-
202 => 'Accepted',
|
23 |
-
203 => 'Non-Authoritative Information',
|
24 |
-
204 => 'No Content',
|
25 |
-
205 => 'Reset Content',
|
26 |
-
206 => 'Partial Content',
|
27 |
-
207 => 'Multi-status',
|
28 |
-
208 => 'Already Reported',
|
29 |
-
300 => 'Multiple Choices',
|
30 |
-
301 => 'Moved Permanently',
|
31 |
-
302 => 'Found',
|
32 |
-
303 => 'See Other',
|
33 |
-
304 => 'Not Modified',
|
34 |
-
305 => 'Use Proxy',
|
35 |
-
306 => 'Switch Proxy',
|
36 |
-
307 => 'Temporary Redirect',
|
37 |
-
400 => 'Bad Request',
|
38 |
-
401 => 'Unauthorized',
|
39 |
-
402 => 'Payment Required',
|
40 |
-
403 => 'Forbidden',
|
41 |
-
404 => 'Not Found',
|
42 |
-
405 => 'Method Not Allowed',
|
43 |
-
406 => 'Not Acceptable',
|
44 |
-
407 => 'Proxy Authentication Required',
|
45 |
-
408 => 'Request Time-out',
|
46 |
-
409 => 'Conflict',
|
47 |
-
410 => 'Gone',
|
48 |
-
411 => 'Length Required',
|
49 |
-
412 => 'Precondition Failed',
|
50 |
-
413 => 'Request Entity Too Large',
|
51 |
-
414 => 'Request-URI Too Large',
|
52 |
-
415 => 'Unsupported Media Type',
|
53 |
-
416 => 'Requested range not satisfiable',
|
54 |
-
417 => 'Expectation Failed',
|
55 |
-
418 => 'I\'m a teapot',
|
56 |
-
422 => 'Unprocessable Entity',
|
57 |
-
423 => 'Locked',
|
58 |
-
424 => 'Failed Dependency',
|
59 |
-
425 => 'Unordered Collection',
|
60 |
-
426 => 'Upgrade Required',
|
61 |
-
428 => 'Precondition Required',
|
62 |
-
429 => 'Too Many Requests',
|
63 |
-
431 => 'Request Header Fields Too Large',
|
64 |
-
451 => 'Unavailable For Legal Reasons',
|
65 |
-
500 => 'Internal Server Error',
|
66 |
-
501 => 'Not Implemented',
|
67 |
-
502 => 'Bad Gateway',
|
68 |
-
503 => 'Service Unavailable',
|
69 |
-
504 => 'Gateway Time-out',
|
70 |
-
505 => 'HTTP Version not supported',
|
71 |
-
506 => 'Variant Also Negotiates',
|
72 |
-
507 => 'Insufficient Storage',
|
73 |
-
508 => 'Loop Detected',
|
74 |
-
511 => 'Network Authentication Required',
|
75 |
-
];
|
76 |
-
|
77 |
-
/** @var string */
|
78 |
-
private $reasonPhrase = '';
|
79 |
-
|
80 |
-
/** @var int */
|
81 |
-
private $statusCode = 200;
|
82 |
-
|
83 |
-
/**
|
84 |
-
* @param int $status Status code
|
85 |
-
* @param array $headers Response headers
|
86 |
-
* @param string|null|resource|StreamInterface $body Response body
|
87 |
-
* @param string $version Protocol version
|
88 |
-
* @param string|null $reason Reason phrase (when empty a default will be used based on the status code)
|
89 |
-
*/
|
90 |
-
public function __construct(
|
91 |
-
$status = 200,
|
92 |
-
array $headers = [],
|
93 |
-
$body = null,
|
94 |
-
$version = '1.1',
|
95 |
-
$reason = null
|
96 |
-
) {
|
97 |
-
$this->assertStatusCodeIsInteger($status);
|
98 |
-
$status = (int) $status;
|
99 |
-
$this->assertStatusCodeRange($status);
|
100 |
-
|
101 |
-
$this->statusCode = $status;
|
102 |
-
|
103 |
-
if ($body !== '' && $body !== null) {
|
104 |
-
$this->stream = Utils::streamFor($body);
|
105 |
-
}
|
106 |
-
|
107 |
-
$this->setHeaders($headers);
|
108 |
-
if ($reason == '' && isset(self::$phrases[$this->statusCode])) {
|
109 |
-
$this->reasonPhrase = self::$phrases[$this->statusCode];
|
110 |
-
} else {
|
111 |
-
$this->reasonPhrase = (string) $reason;
|
112 |
-
}
|
113 |
-
|
114 |
-
$this->protocol = $version;
|
115 |
-
}
|
116 |
-
|
117 |
-
public function getStatusCode()
|
118 |
-
{
|
119 |
-
return $this->statusCode;
|
120 |
-
}
|
121 |
-
|
122 |
-
public function getReasonPhrase()
|
123 |
-
{
|
124 |
-
return $this->reasonPhrase;
|
125 |
-
}
|
126 |
-
|
127 |
-
public function withStatus($code, $reasonPhrase = '')
|
128 |
-
{
|
129 |
-
$this->assertStatusCodeIsInteger($code);
|
130 |
-
$code = (int) $code;
|
131 |
-
$this->assertStatusCodeRange($code);
|
132 |
-
|
133 |
-
$new = clone $this;
|
134 |
-
$new->statusCode = $code;
|
135 |
-
if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) {
|
136 |
-
$reasonPhrase = self::$phrases[$new->statusCode];
|
137 |
-
}
|
138 |
-
$new->reasonPhrase = (string) $reasonPhrase;
|
139 |
-
return $new;
|
140 |
-
}
|
141 |
-
|
142 |
-
private function assertStatusCodeIsInteger($statusCode)
|
143 |
-
{
|
144 |
-
if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) {
|
145 |
-
throw new \InvalidArgumentException('Status code must be an integer value.');
|
146 |
-
}
|
147 |
-
}
|
148 |
-
|
149 |
-
private function assertStatusCodeRange($statusCode)
|
150 |
-
{
|
151 |
-
if ($statusCode < 100 || $statusCode >= 600) {
|
152 |
-
throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.');
|
153 |
-
}
|
154 |
-
}
|
155 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/Rfc7230.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
final class Rfc7230
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Header related regular expressions (copied from amphp/http package)
|
9 |
-
* (Note: once we require PHP 7.x we could just depend on the upstream package)
|
10 |
-
*
|
11 |
-
* Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons.
|
12 |
-
*
|
13 |
-
* @link https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15
|
14 |
-
* @license https://github.com/amphp/http/blob/v1.0.1/LICENSE
|
15 |
-
*/
|
16 |
-
const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m";
|
17 |
-
const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)";
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/ServerRequest.php
DELETED
@@ -1,378 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use InvalidArgumentException;
|
6 |
-
use Psr\Http\Message\ServerRequestInterface;
|
7 |
-
use Psr\Http\Message\UriInterface;
|
8 |
-
use Psr\Http\Message\StreamInterface;
|
9 |
-
use Psr\Http\Message\UploadedFileInterface;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Server-side HTTP request
|
13 |
-
*
|
14 |
-
* Extends the Request definition to add methods for accessing incoming data,
|
15 |
-
* specifically server parameters, cookies, matched path parameters, query
|
16 |
-
* string arguments, body parameters, and upload file information.
|
17 |
-
*
|
18 |
-
* "Attributes" are discovered via decomposing the request (and usually
|
19 |
-
* specifically the URI path), and typically will be injected by the application.
|
20 |
-
*
|
21 |
-
* Requests are considered immutable; all methods that might change state are
|
22 |
-
* implemented such that they retain the internal state of the current
|
23 |
-
* message and return a new instance that contains the changed state.
|
24 |
-
*/
|
25 |
-
class ServerRequest extends Request implements ServerRequestInterface
|
26 |
-
{
|
27 |
-
/**
|
28 |
-
* @var array
|
29 |
-
*/
|
30 |
-
private $attributes = [];
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @var array
|
34 |
-
*/
|
35 |
-
private $cookieParams = [];
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @var null|array|object
|
39 |
-
*/
|
40 |
-
private $parsedBody;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @var array
|
44 |
-
*/
|
45 |
-
private $queryParams = [];
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @var array
|
49 |
-
*/
|
50 |
-
private $serverParams;
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @var array
|
54 |
-
*/
|
55 |
-
private $uploadedFiles = [];
|
56 |
-
|
57 |
-
/**
|
58 |
-
* @param string $method HTTP method
|
59 |
-
* @param string|UriInterface $uri URI
|
60 |
-
* @param array $headers Request headers
|
61 |
-
* @param string|null|resource|StreamInterface $body Request body
|
62 |
-
* @param string $version Protocol version
|
63 |
-
* @param array $serverParams Typically the $_SERVER superglobal
|
64 |
-
*/
|
65 |
-
public function __construct(
|
66 |
-
$method,
|
67 |
-
$uri,
|
68 |
-
array $headers = [],
|
69 |
-
$body = null,
|
70 |
-
$version = '1.1',
|
71 |
-
array $serverParams = []
|
72 |
-
) {
|
73 |
-
$this->serverParams = $serverParams;
|
74 |
-
|
75 |
-
parent::__construct($method, $uri, $headers, $body, $version);
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Return an UploadedFile instance array.
|
80 |
-
*
|
81 |
-
* @param array $files A array which respect $_FILES structure
|
82 |
-
*
|
83 |
-
* @return array
|
84 |
-
*
|
85 |
-
* @throws InvalidArgumentException for unrecognized values
|
86 |
-
*/
|
87 |
-
public static function normalizeFiles(array $files)
|
88 |
-
{
|
89 |
-
$normalized = [];
|
90 |
-
|
91 |
-
foreach ($files as $key => $value) {
|
92 |
-
if ($value instanceof UploadedFileInterface) {
|
93 |
-
$normalized[$key] = $value;
|
94 |
-
} elseif (is_array($value) && isset($value['tmp_name'])) {
|
95 |
-
$normalized[$key] = self::createUploadedFileFromSpec($value);
|
96 |
-
} elseif (is_array($value)) {
|
97 |
-
$normalized[$key] = self::normalizeFiles($value);
|
98 |
-
continue;
|
99 |
-
} else {
|
100 |
-
throw new InvalidArgumentException('Invalid value in files specification');
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
return $normalized;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Create and return an UploadedFile instance from a $_FILES specification.
|
109 |
-
*
|
110 |
-
* If the specification represents an array of values, this method will
|
111 |
-
* delegate to normalizeNestedFileSpec() and return that return value.
|
112 |
-
*
|
113 |
-
* @param array $value $_FILES struct
|
114 |
-
* @return array|UploadedFileInterface
|
115 |
-
*/
|
116 |
-
private static function createUploadedFileFromSpec(array $value)
|
117 |
-
{
|
118 |
-
if (is_array($value['tmp_name'])) {
|
119 |
-
return self::normalizeNestedFileSpec($value);
|
120 |
-
}
|
121 |
-
|
122 |
-
return new UploadedFile(
|
123 |
-
$value['tmp_name'],
|
124 |
-
(int) $value['size'],
|
125 |
-
(int) $value['error'],
|
126 |
-
$value['name'],
|
127 |
-
$value['type']
|
128 |
-
);
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Normalize an array of file specifications.
|
133 |
-
*
|
134 |
-
* Loops through all nested files and returns a normalized array of
|
135 |
-
* UploadedFileInterface instances.
|
136 |
-
*
|
137 |
-
* @param array $files
|
138 |
-
* @return UploadedFileInterface[]
|
139 |
-
*/
|
140 |
-
private static function normalizeNestedFileSpec(array $files = [])
|
141 |
-
{
|
142 |
-
$normalizedFiles = [];
|
143 |
-
|
144 |
-
foreach (array_keys($files['tmp_name']) as $key) {
|
145 |
-
$spec = [
|
146 |
-
'tmp_name' => $files['tmp_name'][$key],
|
147 |
-
'size' => $files['size'][$key],
|
148 |
-
'error' => $files['error'][$key],
|
149 |
-
'name' => $files['name'][$key],
|
150 |
-
'type' => $files['type'][$key],
|
151 |
-
];
|
152 |
-
$normalizedFiles[$key] = self::createUploadedFileFromSpec($spec);
|
153 |
-
}
|
154 |
-
|
155 |
-
return $normalizedFiles;
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Return a ServerRequest populated with superglobals:
|
160 |
-
* $_GET
|
161 |
-
* $_POST
|
162 |
-
* $_COOKIE
|
163 |
-
* $_FILES
|
164 |
-
* $_SERVER
|
165 |
-
*
|
166 |
-
* @return ServerRequestInterface
|
167 |
-
*/
|
168 |
-
public static function fromGlobals()
|
169 |
-
{
|
170 |
-
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
|
171 |
-
$headers = getallheaders();
|
172 |
-
$uri = self::getUriFromGlobals();
|
173 |
-
$body = new CachingStream(new LazyOpenStream('php://input', 'r+'));
|
174 |
-
$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';
|
175 |
-
|
176 |
-
$serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER);
|
177 |
-
|
178 |
-
return $serverRequest
|
179 |
-
->withCookieParams($_COOKIE)
|
180 |
-
->withQueryParams($_GET)
|
181 |
-
->withParsedBody($_POST)
|
182 |
-
->withUploadedFiles(self::normalizeFiles($_FILES));
|
183 |
-
}
|
184 |
-
|
185 |
-
private static function extractHostAndPortFromAuthority($authority)
|
186 |
-
{
|
187 |
-
$uri = 'http://'.$authority;
|
188 |
-
$parts = parse_url($uri);
|
189 |
-
if (false === $parts) {
|
190 |
-
return [null, null];
|
191 |
-
}
|
192 |
-
|
193 |
-
$host = isset($parts['host']) ? $parts['host'] : null;
|
194 |
-
$port = isset($parts['port']) ? $parts['port'] : null;
|
195 |
-
|
196 |
-
return [$host, $port];
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Get a Uri populated with values from $_SERVER.
|
201 |
-
*
|
202 |
-
* @return UriInterface
|
203 |
-
*/
|
204 |
-
public static function getUriFromGlobals()
|
205 |
-
{
|
206 |
-
$uri = new Uri('');
|
207 |
-
|
208 |
-
$uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
|
209 |
-
|
210 |
-
$hasPort = false;
|
211 |
-
if (isset($_SERVER['HTTP_HOST'])) {
|
212 |
-
list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
|
213 |
-
if ($host !== null) {
|
214 |
-
$uri = $uri->withHost($host);
|
215 |
-
}
|
216 |
-
|
217 |
-
if ($port !== null) {
|
218 |
-
$hasPort = true;
|
219 |
-
$uri = $uri->withPort($port);
|
220 |
-
}
|
221 |
-
} elseif (isset($_SERVER['SERVER_NAME'])) {
|
222 |
-
$uri = $uri->withHost($_SERVER['SERVER_NAME']);
|
223 |
-
} elseif (isset($_SERVER['SERVER_ADDR'])) {
|
224 |
-
$uri = $uri->withHost($_SERVER['SERVER_ADDR']);
|
225 |
-
}
|
226 |
-
|
227 |
-
if (!$hasPort && isset($_SERVER['SERVER_PORT'])) {
|
228 |
-
$uri = $uri->withPort($_SERVER['SERVER_PORT']);
|
229 |
-
}
|
230 |
-
|
231 |
-
$hasQuery = false;
|
232 |
-
if (isset($_SERVER['REQUEST_URI'])) {
|
233 |
-
$requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2);
|
234 |
-
$uri = $uri->withPath($requestUriParts[0]);
|
235 |
-
if (isset($requestUriParts[1])) {
|
236 |
-
$hasQuery = true;
|
237 |
-
$uri = $uri->withQuery($requestUriParts[1]);
|
238 |
-
}
|
239 |
-
}
|
240 |
-
|
241 |
-
if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) {
|
242 |
-
$uri = $uri->withQuery($_SERVER['QUERY_STRING']);
|
243 |
-
}
|
244 |
-
|
245 |
-
return $uri;
|
246 |
-
}
|
247 |
-
|
248 |
-
|
249 |
-
/**
|
250 |
-
* {@inheritdoc}
|
251 |
-
*/
|
252 |
-
public function getServerParams()
|
253 |
-
{
|
254 |
-
return $this->serverParams;
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* {@inheritdoc}
|
259 |
-
*/
|
260 |
-
public function getUploadedFiles()
|
261 |
-
{
|
262 |
-
return $this->uploadedFiles;
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* {@inheritdoc}
|
267 |
-
*/
|
268 |
-
public function withUploadedFiles(array $uploadedFiles)
|
269 |
-
{
|
270 |
-
$new = clone $this;
|
271 |
-
$new->uploadedFiles = $uploadedFiles;
|
272 |
-
|
273 |
-
return $new;
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* {@inheritdoc}
|
278 |
-
*/
|
279 |
-
public function getCookieParams()
|
280 |
-
{
|
281 |
-
return $this->cookieParams;
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* {@inheritdoc}
|
286 |
-
*/
|
287 |
-
public function withCookieParams(array $cookies)
|
288 |
-
{
|
289 |
-
$new = clone $this;
|
290 |
-
$new->cookieParams = $cookies;
|
291 |
-
|
292 |
-
return $new;
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* {@inheritdoc}
|
297 |
-
*/
|
298 |
-
public function getQueryParams()
|
299 |
-
{
|
300 |
-
return $this->queryParams;
|
301 |
-
}
|
302 |
-
|
303 |
-
/**
|
304 |
-
* {@inheritdoc}
|
305 |
-
*/
|
306 |
-
public function withQueryParams(array $query)
|
307 |
-
{
|
308 |
-
$new = clone $this;
|
309 |
-
$new->queryParams = $query;
|
310 |
-
|
311 |
-
return $new;
|
312 |
-
}
|
313 |
-
|
314 |
-
/**
|
315 |
-
* {@inheritdoc}
|
316 |
-
*/
|
317 |
-
public function getParsedBody()
|
318 |
-
{
|
319 |
-
return $this->parsedBody;
|
320 |
-
}
|
321 |
-
|
322 |
-
/**
|
323 |
-
* {@inheritdoc}
|
324 |
-
*/
|
325 |
-
public function withParsedBody($data)
|
326 |
-
{
|
327 |
-
$new = clone $this;
|
328 |
-
$new->parsedBody = $data;
|
329 |
-
|
330 |
-
return $new;
|
331 |
-
}
|
332 |
-
|
333 |
-
/**
|
334 |
-
* {@inheritdoc}
|
335 |
-
*/
|
336 |
-
public function getAttributes()
|
337 |
-
{
|
338 |
-
return $this->attributes;
|
339 |
-
}
|
340 |
-
|
341 |
-
/**
|
342 |
-
* {@inheritdoc}
|
343 |
-
*/
|
344 |
-
public function getAttribute($attribute, $default = null)
|
345 |
-
{
|
346 |
-
if (false === array_key_exists($attribute, $this->attributes)) {
|
347 |
-
return $default;
|
348 |
-
}
|
349 |
-
|
350 |
-
return $this->attributes[$attribute];
|
351 |
-
}
|
352 |
-
|
353 |
-
/**
|
354 |
-
* {@inheritdoc}
|
355 |
-
*/
|
356 |
-
public function withAttribute($attribute, $value)
|
357 |
-
{
|
358 |
-
$new = clone $this;
|
359 |
-
$new->attributes[$attribute] = $value;
|
360 |
-
|
361 |
-
return $new;
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* {@inheritdoc}
|
366 |
-
*/
|
367 |
-
public function withoutAttribute($attribute)
|
368 |
-
{
|
369 |
-
if (false === array_key_exists($attribute, $this->attributes)) {
|
370 |
-
return $this;
|
371 |
-
}
|
372 |
-
|
373 |
-
$new = clone $this;
|
374 |
-
unset($new->attributes[$attribute]);
|
375 |
-
|
376 |
-
return $new;
|
377 |
-
}
|
378 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/Stream.php
DELETED
@@ -1,270 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* PHP stream implementation.
|
9 |
-
*
|
10 |
-
* @var $stream
|
11 |
-
*/
|
12 |
-
class Stream implements StreamInterface
|
13 |
-
{
|
14 |
-
/**
|
15 |
-
* Resource modes.
|
16 |
-
*
|
17 |
-
* @var string
|
18 |
-
*
|
19 |
-
* @see http://php.net/manual/function.fopen.php
|
20 |
-
* @see http://php.net/manual/en/function.gzopen.php
|
21 |
-
*/
|
22 |
-
const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/';
|
23 |
-
const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/';
|
24 |
-
|
25 |
-
private $stream;
|
26 |
-
private $size;
|
27 |
-
private $seekable;
|
28 |
-
private $readable;
|
29 |
-
private $writable;
|
30 |
-
private $uri;
|
31 |
-
private $customMetadata;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* This constructor accepts an associative array of options.
|
35 |
-
*
|
36 |
-
* - size: (int) If a read stream would otherwise have an indeterminate
|
37 |
-
* size, but the size is known due to foreknowledge, then you can
|
38 |
-
* provide that size, in bytes.
|
39 |
-
* - metadata: (array) Any additional metadata to return when the metadata
|
40 |
-
* of the stream is accessed.
|
41 |
-
*
|
42 |
-
* @param resource $stream Stream resource to wrap.
|
43 |
-
* @param array $options Associative array of options.
|
44 |
-
*
|
45 |
-
* @throws \InvalidArgumentException if the stream is not a stream resource
|
46 |
-
*/
|
47 |
-
public function __construct($stream, $options = [])
|
48 |
-
{
|
49 |
-
if (!is_resource($stream)) {
|
50 |
-
throw new \InvalidArgumentException('Stream must be a resource');
|
51 |
-
}
|
52 |
-
|
53 |
-
if (isset($options['size'])) {
|
54 |
-
$this->size = $options['size'];
|
55 |
-
}
|
56 |
-
|
57 |
-
$this->customMetadata = isset($options['metadata'])
|
58 |
-
? $options['metadata']
|
59 |
-
: [];
|
60 |
-
|
61 |
-
$this->stream = $stream;
|
62 |
-
$meta = stream_get_meta_data($this->stream);
|
63 |
-
$this->seekable = $meta['seekable'];
|
64 |
-
$this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']);
|
65 |
-
$this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']);
|
66 |
-
$this->uri = $this->getMetadata('uri');
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Closes the stream when the destructed
|
71 |
-
*/
|
72 |
-
public function __destruct()
|
73 |
-
{
|
74 |
-
$this->close();
|
75 |
-
}
|
76 |
-
|
77 |
-
public function __toString()
|
78 |
-
{
|
79 |
-
try {
|
80 |
-
if ($this->isSeekable()) {
|
81 |
-
$this->seek(0);
|
82 |
-
}
|
83 |
-
return $this->getContents();
|
84 |
-
} catch (\Exception $e) {
|
85 |
-
return '';
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
public function getContents()
|
90 |
-
{
|
91 |
-
if (!isset($this->stream)) {
|
92 |
-
throw new \RuntimeException('Stream is detached');
|
93 |
-
}
|
94 |
-
|
95 |
-
$contents = stream_get_contents($this->stream);
|
96 |
-
|
97 |
-
if ($contents === false) {
|
98 |
-
throw new \RuntimeException('Unable to read stream contents');
|
99 |
-
}
|
100 |
-
|
101 |
-
return $contents;
|
102 |
-
}
|
103 |
-
|
104 |
-
public function close()
|
105 |
-
{
|
106 |
-
if (isset($this->stream)) {
|
107 |
-
if (is_resource($this->stream)) {
|
108 |
-
fclose($this->stream);
|
109 |
-
}
|
110 |
-
$this->detach();
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
public function detach()
|
115 |
-
{
|
116 |
-
if (!isset($this->stream)) {
|
117 |
-
return null;
|
118 |
-
}
|
119 |
-
|
120 |
-
$result = $this->stream;
|
121 |
-
unset($this->stream);
|
122 |
-
$this->size = $this->uri = null;
|
123 |
-
$this->readable = $this->writable = $this->seekable = false;
|
124 |
-
|
125 |
-
return $result;
|
126 |
-
}
|
127 |
-
|
128 |
-
public function getSize()
|
129 |
-
{
|
130 |
-
if ($this->size !== null) {
|
131 |
-
return $this->size;
|
132 |
-
}
|
133 |
-
|
134 |
-
if (!isset($this->stream)) {
|
135 |
-
return null;
|
136 |
-
}
|
137 |
-
|
138 |
-
// Clear the stat cache if the stream has a URI
|
139 |
-
if ($this->uri) {
|
140 |
-
clearstatcache(true, $this->uri);
|
141 |
-
}
|
142 |
-
|
143 |
-
$stats = fstat($this->stream);
|
144 |
-
if (isset($stats['size'])) {
|
145 |
-
$this->size = $stats['size'];
|
146 |
-
return $this->size;
|
147 |
-
}
|
148 |
-
|
149 |
-
return null;
|
150 |
-
}
|
151 |
-
|
152 |
-
public function isReadable()
|
153 |
-
{
|
154 |
-
return $this->readable;
|
155 |
-
}
|
156 |
-
|
157 |
-
public function isWritable()
|
158 |
-
{
|
159 |
-
return $this->writable;
|
160 |
-
}
|
161 |
-
|
162 |
-
public function isSeekable()
|
163 |
-
{
|
164 |
-
return $this->seekable;
|
165 |
-
}
|
166 |
-
|
167 |
-
public function eof()
|
168 |
-
{
|
169 |
-
if (!isset($this->stream)) {
|
170 |
-
throw new \RuntimeException('Stream is detached');
|
171 |
-
}
|
172 |
-
|
173 |
-
return feof($this->stream);
|
174 |
-
}
|
175 |
-
|
176 |
-
public function tell()
|
177 |
-
{
|
178 |
-
if (!isset($this->stream)) {
|
179 |
-
throw new \RuntimeException('Stream is detached');
|
180 |
-
}
|
181 |
-
|
182 |
-
$result = ftell($this->stream);
|
183 |
-
|
184 |
-
if ($result === false) {
|
185 |
-
throw new \RuntimeException('Unable to determine stream position');
|
186 |
-
}
|
187 |
-
|
188 |
-
return $result;
|
189 |
-
}
|
190 |
-
|
191 |
-
public function rewind()
|
192 |
-
{
|
193 |
-
$this->seek(0);
|
194 |
-
}
|
195 |
-
|
196 |
-
public function seek($offset, $whence = SEEK_SET)
|
197 |
-
{
|
198 |
-
$whence = (int) $whence;
|
199 |
-
|
200 |
-
if (!isset($this->stream)) {
|
201 |
-
throw new \RuntimeException('Stream is detached');
|
202 |
-
}
|
203 |
-
if (!$this->seekable) {
|
204 |
-
throw new \RuntimeException('Stream is not seekable');
|
205 |
-
}
|
206 |
-
if (fseek($this->stream, $offset, $whence) === -1) {
|
207 |
-
throw new \RuntimeException('Unable to seek to stream position '
|
208 |
-
. $offset . ' with whence ' . var_export($whence, true));
|
209 |
-
}
|
210 |
-
}
|
211 |
-
|
212 |
-
public function read($length)
|
213 |
-
{
|
214 |
-
if (!isset($this->stream)) {
|
215 |
-
throw new \RuntimeException('Stream is detached');
|
216 |
-
}
|
217 |
-
if (!$this->readable) {
|
218 |
-
throw new \RuntimeException('Cannot read from non-readable stream');
|
219 |
-
}
|
220 |
-
if ($length < 0) {
|
221 |
-
throw new \RuntimeException('Length parameter cannot be negative');
|
222 |
-
}
|
223 |
-
|
224 |
-
if (0 === $length) {
|
225 |
-
return '';
|
226 |
-
}
|
227 |
-
|
228 |
-
$string = fread($this->stream, $length);
|
229 |
-
if (false === $string) {
|
230 |
-
throw new \RuntimeException('Unable to read from stream');
|
231 |
-
}
|
232 |
-
|
233 |
-
return $string;
|
234 |
-
}
|
235 |
-
|
236 |
-
public function write($string)
|
237 |
-
{
|
238 |
-
if (!isset($this->stream)) {
|
239 |
-
throw new \RuntimeException('Stream is detached');
|
240 |
-
}
|
241 |
-
if (!$this->writable) {
|
242 |
-
throw new \RuntimeException('Cannot write to a non-writable stream');
|
243 |
-
}
|
244 |
-
|
245 |
-
// We can't know the size after writing anything
|
246 |
-
$this->size = null;
|
247 |
-
$result = fwrite($this->stream, $string);
|
248 |
-
|
249 |
-
if ($result === false) {
|
250 |
-
throw new \RuntimeException('Unable to write to stream');
|
251 |
-
}
|
252 |
-
|
253 |
-
return $result;
|
254 |
-
}
|
255 |
-
|
256 |
-
public function getMetadata($key = null)
|
257 |
-
{
|
258 |
-
if (!isset($this->stream)) {
|
259 |
-
return $key ? null : [];
|
260 |
-
} elseif (!$key) {
|
261 |
-
return $this->customMetadata + stream_get_meta_data($this->stream);
|
262 |
-
} elseif (isset($this->customMetadata[$key])) {
|
263 |
-
return $this->customMetadata[$key];
|
264 |
-
}
|
265 |
-
|
266 |
-
$meta = stream_get_meta_data($this->stream);
|
267 |
-
|
268 |
-
return isset($meta[$key]) ? $meta[$key] : null;
|
269 |
-
}
|
270 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php
DELETED
@@ -1,151 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Stream decorator trait
|
9 |
-
* @property StreamInterface stream
|
10 |
-
*/
|
11 |
-
trait StreamDecoratorTrait
|
12 |
-
{
|
13 |
-
/**
|
14 |
-
* @param StreamInterface $stream Stream to decorate
|
15 |
-
*/
|
16 |
-
public function __construct(StreamInterface $stream)
|
17 |
-
{
|
18 |
-
$this->stream = $stream;
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Magic method used to create a new stream if streams are not added in
|
23 |
-
* the constructor of a decorator (e.g., LazyOpenStream).
|
24 |
-
*
|
25 |
-
* @param string $name Name of the property (allows "stream" only).
|
26 |
-
*
|
27 |
-
* @return StreamInterface
|
28 |
-
*/
|
29 |
-
public function __get($name)
|
30 |
-
{
|
31 |
-
if ($name == 'stream') {
|
32 |
-
$this->stream = $this->createStream();
|
33 |
-
return $this->stream;
|
34 |
-
}
|
35 |
-
|
36 |
-
throw new \UnexpectedValueException("$name not found on class");
|
37 |
-
}
|
38 |
-
|
39 |
-
public function __toString()
|
40 |
-
{
|
41 |
-
try {
|
42 |
-
if ($this->isSeekable()) {
|
43 |
-
$this->seek(0);
|
44 |
-
}
|
45 |
-
return $this->getContents();
|
46 |
-
} catch (\Exception $e) {
|
47 |
-
// Really, PHP? https://bugs.php.net/bug.php?id=53648
|
48 |
-
trigger_error('StreamDecorator::__toString exception: '
|
49 |
-
. (string) $e, E_USER_ERROR);
|
50 |
-
return '';
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
public function getContents()
|
55 |
-
{
|
56 |
-
return Utils::copyToString($this);
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Allow decorators to implement custom methods
|
61 |
-
*
|
62 |
-
* @param string $method Missing method name
|
63 |
-
* @param array $args Method arguments
|
64 |
-
*
|
65 |
-
* @return mixed
|
66 |
-
*/
|
67 |
-
public function __call($method, array $args)
|
68 |
-
{
|
69 |
-
$result = call_user_func_array([$this->stream, $method], $args);
|
70 |
-
|
71 |
-
// Always return the wrapped object if the result is a return $this
|
72 |
-
return $result === $this->stream ? $this : $result;
|
73 |
-
}
|
74 |
-
|
75 |
-
public function close()
|
76 |
-
{
|
77 |
-
$this->stream->close();
|
78 |
-
}
|
79 |
-
|
80 |
-
public function getMetadata($key = null)
|
81 |
-
{
|
82 |
-
return $this->stream->getMetadata($key);
|
83 |
-
}
|
84 |
-
|
85 |
-
public function detach()
|
86 |
-
{
|
87 |
-
return $this->stream->detach();
|
88 |
-
}
|
89 |
-
|
90 |
-
public function getSize()
|
91 |
-
{
|
92 |
-
return $this->stream->getSize();
|
93 |
-
}
|
94 |
-
|
95 |
-
public function eof()
|
96 |
-
{
|
97 |
-
return $this->stream->eof();
|
98 |
-
}
|
99 |
-
|
100 |
-
public function tell()
|
101 |
-
{
|
102 |
-
return $this->stream->tell();
|
103 |
-
}
|
104 |
-
|
105 |
-
public function isReadable()
|
106 |
-
{
|
107 |
-
return $this->stream->isReadable();
|
108 |
-
}
|
109 |
-
|
110 |
-
public function isWritable()
|
111 |
-
{
|
112 |
-
return $this->stream->isWritable();
|
113 |
-
}
|
114 |
-
|
115 |
-
public function isSeekable()
|
116 |
-
{
|
117 |
-
return $this->stream->isSeekable();
|
118 |
-
}
|
119 |
-
|
120 |
-
public function rewind()
|
121 |
-
{
|
122 |
-
$this->seek(0);
|
123 |
-
}
|
124 |
-
|
125 |
-
public function seek($offset, $whence = SEEK_SET)
|
126 |
-
{
|
127 |
-
$this->stream->seek($offset, $whence);
|
128 |
-
}
|
129 |
-
|
130 |
-
public function read($length)
|
131 |
-
{
|
132 |
-
return $this->stream->read($length);
|
133 |
-
}
|
134 |
-
|
135 |
-
public function write($string)
|
136 |
-
{
|
137 |
-
return $this->stream->write($string);
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Implement in subclasses to dynamically create streams when requested.
|
142 |
-
*
|
143 |
-
* @return StreamInterface
|
144 |
-
*
|
145 |
-
* @throws \BadMethodCallException
|
146 |
-
*/
|
147 |
-
protected function createStream()
|
148 |
-
{
|
149 |
-
throw new \BadMethodCallException('Not implemented');
|
150 |
-
}
|
151 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/StreamWrapper.php
DELETED
@@ -1,163 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\StreamInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Converts Guzzle streams into PHP stream resources.
|
9 |
-
*/
|
10 |
-
class StreamWrapper
|
11 |
-
{
|
12 |
-
/** @var resource */
|
13 |
-
public $context;
|
14 |
-
|
15 |
-
/** @var StreamInterface */
|
16 |
-
private $stream;
|
17 |
-
|
18 |
-
/** @var string r, r+, or w */
|
19 |
-
private $mode;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Returns a resource representing the stream.
|
23 |
-
*
|
24 |
-
* @param StreamInterface $stream The stream to get a resource for
|
25 |
-
*
|
26 |
-
* @return resource
|
27 |
-
*
|
28 |
-
* @throws \InvalidArgumentException if stream is not readable or writable
|
29 |
-
*/
|
30 |
-
public static function getResource(StreamInterface $stream)
|
31 |
-
{
|
32 |
-
self::register();
|
33 |
-
|
34 |
-
if ($stream->isReadable()) {
|
35 |
-
$mode = $stream->isWritable() ? 'r+' : 'r';
|
36 |
-
} elseif ($stream->isWritable()) {
|
37 |
-
$mode = 'w';
|
38 |
-
} else {
|
39 |
-
throw new \InvalidArgumentException('The stream must be readable, '
|
40 |
-
. 'writable, or both.');
|
41 |
-
}
|
42 |
-
|
43 |
-
return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Creates a stream context that can be used to open a stream as a php stream resource.
|
48 |
-
*
|
49 |
-
* @param StreamInterface $stream
|
50 |
-
*
|
51 |
-
* @return resource
|
52 |
-
*/
|
53 |
-
public static function createStreamContext(StreamInterface $stream)
|
54 |
-
{
|
55 |
-
return stream_context_create([
|
56 |
-
'guzzle' => ['stream' => $stream]
|
57 |
-
]);
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Registers the stream wrapper if needed
|
62 |
-
*/
|
63 |
-
public static function register()
|
64 |
-
{
|
65 |
-
if (!in_array('guzzle', stream_get_wrappers())) {
|
66 |
-
stream_wrapper_register('guzzle', __CLASS__);
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
public function stream_open($path, $mode, $options, &$opened_path)
|
71 |
-
{
|
72 |
-
$options = stream_context_get_options($this->context);
|
73 |
-
|
74 |
-
if (!isset($options['guzzle']['stream'])) {
|
75 |
-
return false;
|
76 |
-
}
|
77 |
-
|
78 |
-
$this->mode = $mode;
|
79 |
-
$this->stream = $options['guzzle']['stream'];
|
80 |
-
|
81 |
-
return true;
|
82 |
-
}
|
83 |
-
|
84 |
-
public function stream_read($count)
|
85 |
-
{
|
86 |
-
return $this->stream->read($count);
|
87 |
-
}
|
88 |
-
|
89 |
-
public function stream_write($data)
|
90 |
-
{
|
91 |
-
return (int) $this->stream->write($data);
|
92 |
-
}
|
93 |
-
|
94 |
-
public function stream_tell()
|
95 |
-
{
|
96 |
-
return $this->stream->tell();
|
97 |
-
}
|
98 |
-
|
99 |
-
public function stream_eof()
|
100 |
-
{
|
101 |
-
return $this->stream->eof();
|
102 |
-
}
|
103 |
-
|
104 |
-
public function stream_seek($offset, $whence)
|
105 |
-
{
|
106 |
-
$this->stream->seek($offset, $whence);
|
107 |
-
|
108 |
-
return true;
|
109 |
-
}
|
110 |
-
|
111 |
-
public function stream_cast($cast_as)
|
112 |
-
{
|
113 |
-
$stream = clone($this->stream);
|
114 |
-
|
115 |
-
return $stream->detach();
|
116 |
-
}
|
117 |
-
|
118 |
-
public function stream_stat()
|
119 |
-
{
|
120 |
-
static $modeMap = [
|
121 |
-
'r' => 33060,
|
122 |
-
'rb' => 33060,
|
123 |
-
'r+' => 33206,
|
124 |
-
'w' => 33188,
|
125 |
-
'wb' => 33188
|
126 |
-
];
|
127 |
-
|
128 |
-
return [
|
129 |
-
'dev' => 0,
|
130 |
-
'ino' => 0,
|
131 |
-
'mode' => $modeMap[$this->mode],
|
132 |
-
'nlink' => 0,
|
133 |
-
'uid' => 0,
|
134 |
-
'gid' => 0,
|
135 |
-
'rdev' => 0,
|
136 |
-
'size' => $this->stream->getSize() ?: 0,
|
137 |
-
'atime' => 0,
|
138 |
-
'mtime' => 0,
|
139 |
-
'ctime' => 0,
|
140 |
-
'blksize' => 0,
|
141 |
-
'blocks' => 0
|
142 |
-
];
|
143 |
-
}
|
144 |
-
|
145 |
-
public function url_stat($path, $flags)
|
146 |
-
{
|
147 |
-
return [
|
148 |
-
'dev' => 0,
|
149 |
-
'ino' => 0,
|
150 |
-
'mode' => 0,
|
151 |
-
'nlink' => 0,
|
152 |
-
'uid' => 0,
|
153 |
-
'gid' => 0,
|
154 |
-
'rdev' => 0,
|
155 |
-
'size' => 0,
|
156 |
-
'atime' => 0,
|
157 |
-
'mtime' => 0,
|
158 |
-
'ctime' => 0,
|
159 |
-
'blksize' => 0,
|
160 |
-
'blocks' => 0
|
161 |
-
];
|
162 |
-
}
|
163 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/UploadedFile.php
DELETED
@@ -1,325 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use InvalidArgumentException;
|
6 |
-
use Psr\Http\Message\StreamInterface;
|
7 |
-
use Psr\Http\Message\UploadedFileInterface;
|
8 |
-
use RuntimeException;
|
9 |
-
|
10 |
-
class UploadedFile implements UploadedFileInterface
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* @var int[]
|
14 |
-
*/
|
15 |
-
private static $errors = [
|
16 |
-
UPLOAD_ERR_OK,
|
17 |
-
UPLOAD_ERR_INI_SIZE,
|
18 |
-
UPLOAD_ERR_FORM_SIZE,
|
19 |
-
UPLOAD_ERR_PARTIAL,
|
20 |
-
UPLOAD_ERR_NO_FILE,
|
21 |
-
UPLOAD_ERR_NO_TMP_DIR,
|
22 |
-
UPLOAD_ERR_CANT_WRITE,
|
23 |
-
UPLOAD_ERR_EXTENSION,
|
24 |
-
];
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @var string
|
28 |
-
*/
|
29 |
-
private $clientFilename;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @var string
|
33 |
-
*/
|
34 |
-
private $clientMediaType;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @var int
|
38 |
-
*/
|
39 |
-
private $error;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @var null|string
|
43 |
-
*/
|
44 |
-
private $file;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var bool
|
48 |
-
*/
|
49 |
-
private $moved = false;
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @var int
|
53 |
-
*/
|
54 |
-
private $size;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @var StreamInterface|null
|
58 |
-
*/
|
59 |
-
private $stream;
|
60 |
-
|
61 |
-
/**
|
62 |
-
* @param StreamInterface|string|resource $streamOrFile
|
63 |
-
* @param int $size
|
64 |
-
* @param int $errorStatus
|
65 |
-
* @param string|null $clientFilename
|
66 |
-
* @param string|null $clientMediaType
|
67 |
-
*/
|
68 |
-
public function __construct(
|
69 |
-
$streamOrFile,
|
70 |
-
$size,
|
71 |
-
$errorStatus,
|
72 |
-
$clientFilename = null,
|
73 |
-
$clientMediaType = null
|
74 |
-
) {
|
75 |
-
$this->setError($errorStatus);
|
76 |
-
$this->setSize($size);
|
77 |
-
$this->setClientFilename($clientFilename);
|
78 |
-
$this->setClientMediaType($clientMediaType);
|
79 |
-
|
80 |
-
if ($this->isOk()) {
|
81 |
-
$this->setStreamOrFile($streamOrFile);
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Depending on the value set file or stream variable
|
87 |
-
*
|
88 |
-
* @param mixed $streamOrFile
|
89 |
-
*
|
90 |
-
* @throws InvalidArgumentException
|
91 |
-
*/
|
92 |
-
private function setStreamOrFile($streamOrFile)
|
93 |
-
{
|
94 |
-
if (is_string($streamOrFile)) {
|
95 |
-
$this->file = $streamOrFile;
|
96 |
-
} elseif (is_resource($streamOrFile)) {
|
97 |
-
$this->stream = new Stream($streamOrFile);
|
98 |
-
} elseif ($streamOrFile instanceof StreamInterface) {
|
99 |
-
$this->stream = $streamOrFile;
|
100 |
-
} else {
|
101 |
-
throw new InvalidArgumentException(
|
102 |
-
'Invalid stream or file provided for UploadedFile'
|
103 |
-
);
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* @param int $error
|
109 |
-
*
|
110 |
-
* @throws InvalidArgumentException
|
111 |
-
*/
|
112 |
-
private function setError($error)
|
113 |
-
{
|
114 |
-
if (false === is_int($error)) {
|
115 |
-
throw new InvalidArgumentException(
|
116 |
-
'Upload file error status must be an integer'
|
117 |
-
);
|
118 |
-
}
|
119 |
-
|
120 |
-
if (false === in_array($error, UploadedFile::$errors)) {
|
121 |
-
throw new InvalidArgumentException(
|
122 |
-
'Invalid error status for UploadedFile'
|
123 |
-
);
|
124 |
-
}
|
125 |
-
|
126 |
-
$this->error = $error;
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* @param int $size
|
131 |
-
*
|
132 |
-
* @throws InvalidArgumentException
|
133 |
-
*/
|
134 |
-
private function setSize($size)
|
135 |
-
{
|
136 |
-
if (false === is_int($size)) {
|
137 |
-
throw new InvalidArgumentException(
|
138 |
-
'Upload file size must be an integer'
|
139 |
-
);
|
140 |
-
}
|
141 |
-
|
142 |
-
$this->size = $size;
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* @param mixed $param
|
147 |
-
* @return boolean
|
148 |
-
*/
|
149 |
-
private function isStringOrNull($param)
|
150 |
-
{
|
151 |
-
return in_array(gettype($param), ['string', 'NULL']);
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* @param mixed $param
|
156 |
-
* @return boolean
|
157 |
-
*/
|
158 |
-
private function isStringNotEmpty($param)
|
159 |
-
{
|
160 |
-
return is_string($param) && false === empty($param);
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* @param string|null $clientFilename
|
165 |
-
*
|
166 |
-
* @throws InvalidArgumentException
|
167 |
-
*/
|
168 |
-
private function setClientFilename($clientFilename)
|
169 |
-
{
|
170 |
-
if (false === $this->isStringOrNull($clientFilename)) {
|
171 |
-
throw new InvalidArgumentException(
|
172 |
-
'Upload file client filename must be a string or null'
|
173 |
-
);
|
174 |
-
}
|
175 |
-
|
176 |
-
$this->clientFilename = $clientFilename;
|
177 |
-
}
|
178 |
-
|
179 |
-
/**
|
180 |
-
* @param string|null $clientMediaType
|
181 |
-
*
|
182 |
-
* @throws InvalidArgumentException
|
183 |
-
*/
|
184 |
-
private function setClientMediaType($clientMediaType)
|
185 |
-
{
|
186 |
-
if (false === $this->isStringOrNull($clientMediaType)) {
|
187 |
-
throw new InvalidArgumentException(
|
188 |
-
'Upload file client media type must be a string or null'
|
189 |
-
);
|
190 |
-
}
|
191 |
-
|
192 |
-
$this->clientMediaType = $clientMediaType;
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Return true if there is no upload error
|
197 |
-
*
|
198 |
-
* @return boolean
|
199 |
-
*/
|
200 |
-
private function isOk()
|
201 |
-
{
|
202 |
-
return $this->error === UPLOAD_ERR_OK;
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* @return boolean
|
207 |
-
*/
|
208 |
-
public function isMoved()
|
209 |
-
{
|
210 |
-
return $this->moved;
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* @throws RuntimeException if is moved or not ok
|
215 |
-
*/
|
216 |
-
private function validateActive()
|
217 |
-
{
|
218 |
-
if (false === $this->isOk()) {
|
219 |
-
throw new RuntimeException('Cannot retrieve stream due to upload error');
|
220 |
-
}
|
221 |
-
|
222 |
-
if ($this->isMoved()) {
|
223 |
-
throw new RuntimeException('Cannot retrieve stream after it has already been moved');
|
224 |
-
}
|
225 |
-
}
|
226 |
-
|
227 |
-
/**
|
228 |
-
* {@inheritdoc}
|
229 |
-
*
|
230 |
-
* @throws RuntimeException if the upload was not successful.
|
231 |
-
*/
|
232 |
-
public function getStream()
|
233 |
-
{
|
234 |
-
$this->validateActive();
|
235 |
-
|
236 |
-
if ($this->stream instanceof StreamInterface) {
|
237 |
-
return $this->stream;
|
238 |
-
}
|
239 |
-
|
240 |
-
return new LazyOpenStream($this->file, 'r+');
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* {@inheritdoc}
|
245 |
-
*
|
246 |
-
* @see http://php.net/is_uploaded_file
|
247 |
-
* @see http://php.net/move_uploaded_file
|
248 |
-
*
|
249 |
-
* @param string $targetPath Path to which to move the uploaded file.
|
250 |
-
*
|
251 |
-
* @throws RuntimeException if the upload was not successful.
|
252 |
-
* @throws InvalidArgumentException if the $path specified is invalid.
|
253 |
-
* @throws RuntimeException on any error during the move operation, or on
|
254 |
-
* the second or subsequent call to the method.
|
255 |
-
*/
|
256 |
-
public function moveTo($targetPath)
|
257 |
-
{
|
258 |
-
$this->validateActive();
|
259 |
-
|
260 |
-
if (false === $this->isStringNotEmpty($targetPath)) {
|
261 |
-
throw new InvalidArgumentException(
|
262 |
-
'Invalid path provided for move operation; must be a non-empty string'
|
263 |
-
);
|
264 |
-
}
|
265 |
-
|
266 |
-
if ($this->file) {
|
267 |
-
$this->moved = php_sapi_name() == 'cli'
|
268 |
-
? rename($this->file, $targetPath)
|
269 |
-
: move_uploaded_file($this->file, $targetPath);
|
270 |
-
} else {
|
271 |
-
Utils::copyToStream(
|
272 |
-
$this->getStream(),
|
273 |
-
new LazyOpenStream($targetPath, 'w')
|
274 |
-
);
|
275 |
-
|
276 |
-
$this->moved = true;
|
277 |
-
}
|
278 |
-
|
279 |
-
if (false === $this->moved) {
|
280 |
-
throw new RuntimeException(
|
281 |
-
sprintf('Uploaded file could not be moved to %s', $targetPath)
|
282 |
-
);
|
283 |
-
}
|
284 |
-
}
|
285 |
-
|
286 |
-
/**
|
287 |
-
* {@inheritdoc}
|
288 |
-
*
|
289 |
-
* @return int|null The file size in bytes or null if unknown.
|
290 |
-
*/
|
291 |
-
public function getSize()
|
292 |
-
{
|
293 |
-
return $this->size;
|
294 |
-
}
|
295 |
-
|
296 |
-
/**
|
297 |
-
* {@inheritdoc}
|
298 |
-
*
|
299 |
-
* @see http://php.net/manual/en/features.file-upload.errors.php
|
300 |
-
* @return int One of PHP's UPLOAD_ERR_XXX constants.
|
301 |
-
*/
|
302 |
-
public function getError()
|
303 |
-
{
|
304 |
-
return $this->error;
|
305 |
-
}
|
306 |
-
|
307 |
-
/**
|
308 |
-
* {@inheritdoc}
|
309 |
-
*
|
310 |
-
* @return string|null The filename sent by the client or null if none
|
311 |
-
* was provided.
|
312 |
-
*/
|
313 |
-
public function getClientFilename()
|
314 |
-
{
|
315 |
-
return $this->clientFilename;
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* {@inheritdoc}
|
320 |
-
*/
|
321 |
-
public function getClientMediaType()
|
322 |
-
{
|
323 |
-
return $this->clientMediaType;
|
324 |
-
}
|
325 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/Uri.php
DELETED
@@ -1,761 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\UriInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* PSR-7 URI implementation.
|
9 |
-
*
|
10 |
-
* @author Michael Dowling
|
11 |
-
* @author Tobias Schultze
|
12 |
-
* @author Matthew Weier O'Phinney
|
13 |
-
*/
|
14 |
-
class Uri implements UriInterface
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* Absolute http and https URIs require a host per RFC 7230 Section 2.7
|
18 |
-
* but in generic URIs the host can be empty. So for http(s) URIs
|
19 |
-
* we apply this default host when no host is given yet to form a
|
20 |
-
* valid URI.
|
21 |
-
*/
|
22 |
-
const HTTP_DEFAULT_HOST = 'localhost';
|
23 |
-
|
24 |
-
private static $defaultPorts = [
|
25 |
-
'http' => 80,
|
26 |
-
'https' => 443,
|
27 |
-
'ftp' => 21,
|
28 |
-
'gopher' => 70,
|
29 |
-
'nntp' => 119,
|
30 |
-
'news' => 119,
|
31 |
-
'telnet' => 23,
|
32 |
-
'tn3270' => 23,
|
33 |
-
'imap' => 143,
|
34 |
-
'pop' => 110,
|
35 |
-
'ldap' => 389,
|
36 |
-
];
|
37 |
-
|
38 |
-
private static $charUnreserved = 'a-zA-Z0-9_\-\.~';
|
39 |
-
private static $charSubDelims = '!\$&\'\(\)\*\+,;=';
|
40 |
-
private static $replaceQuery = ['=' => '%3D', '&' => '%26'];
|
41 |
-
|
42 |
-
/** @var string Uri scheme. */
|
43 |
-
private $scheme = '';
|
44 |
-
|
45 |
-
/** @var string Uri user info. */
|
46 |
-
private $userInfo = '';
|
47 |
-
|
48 |
-
/** @var string Uri host. */
|
49 |
-
private $host = '';
|
50 |
-
|
51 |
-
/** @var int|null Uri port. */
|
52 |
-
private $port;
|
53 |
-
|
54 |
-
/** @var string Uri path. */
|
55 |
-
private $path = '';
|
56 |
-
|
57 |
-
/** @var string Uri query string. */
|
58 |
-
private $query = '';
|
59 |
-
|
60 |
-
/** @var string Uri fragment. */
|
61 |
-
private $fragment = '';
|
62 |
-
|
63 |
-
/**
|
64 |
-
* @param string $uri URI to parse
|
65 |
-
*/
|
66 |
-
public function __construct($uri = '')
|
67 |
-
{
|
68 |
-
// weak type check to also accept null until we can add scalar type hints
|
69 |
-
if ($uri != '') {
|
70 |
-
$parts = parse_url($uri);
|
71 |
-
if ($parts === false) {
|
72 |
-
throw new \InvalidArgumentException("Unable to parse URI: $uri");
|
73 |
-
}
|
74 |
-
$this->applyParts($parts);
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
public function __toString()
|
79 |
-
{
|
80 |
-
return self::composeComponents(
|
81 |
-
$this->scheme,
|
82 |
-
$this->getAuthority(),
|
83 |
-
$this->path,
|
84 |
-
$this->query,
|
85 |
-
$this->fragment
|
86 |
-
);
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Composes a URI reference string from its various components.
|
91 |
-
*
|
92 |
-
* Usually this method does not need to be called manually but instead is used indirectly via
|
93 |
-
* `Psr\Http\Message\UriInterface::__toString`.
|
94 |
-
*
|
95 |
-
* PSR-7 UriInterface treats an empty component the same as a missing component as
|
96 |
-
* getQuery(), getFragment() etc. always return a string. This explains the slight
|
97 |
-
* difference to RFC 3986 Section 5.3.
|
98 |
-
*
|
99 |
-
* Another adjustment is that the authority separator is added even when the authority is missing/empty
|
100 |
-
* for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with
|
101 |
-
* `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But
|
102 |
-
* `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to
|
103 |
-
* that format).
|
104 |
-
*
|
105 |
-
* @param string $scheme
|
106 |
-
* @param string $authority
|
107 |
-
* @param string $path
|
108 |
-
* @param string $query
|
109 |
-
* @param string $fragment
|
110 |
-
*
|
111 |
-
* @return string
|
112 |
-
*
|
113 |
-
* @link https://tools.ietf.org/html/rfc3986#section-5.3
|
114 |
-
*/
|
115 |
-
public static function composeComponents($scheme, $authority, $path, $query, $fragment)
|
116 |
-
{
|
117 |
-
$uri = '';
|
118 |
-
|
119 |
-
// weak type checks to also accept null until we can add scalar type hints
|
120 |
-
if ($scheme != '') {
|
121 |
-
$uri .= $scheme . ':';
|
122 |
-
}
|
123 |
-
|
124 |
-
if ($authority != ''|| $scheme === 'file') {
|
125 |
-
$uri .= '//' . $authority;
|
126 |
-
}
|
127 |
-
|
128 |
-
$uri .= $path;
|
129 |
-
|
130 |
-
if ($query != '') {
|
131 |
-
$uri .= '?' . $query;
|
132 |
-
}
|
133 |
-
|
134 |
-
if ($fragment != '') {
|
135 |
-
$uri .= '#' . $fragment;
|
136 |
-
}
|
137 |
-
|
138 |
-
return $uri;
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Whether the URI has the default port of the current scheme.
|
143 |
-
*
|
144 |
-
* `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used
|
145 |
-
* independently of the implementation.
|
146 |
-
*
|
147 |
-
* @param UriInterface $uri
|
148 |
-
*
|
149 |
-
* @return bool
|
150 |
-
*/
|
151 |
-
public static function isDefaultPort(UriInterface $uri)
|
152 |
-
{
|
153 |
-
return $uri->getPort() === null
|
154 |
-
|| (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]);
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Whether the URI is absolute, i.e. it has a scheme.
|
159 |
-
*
|
160 |
-
* An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true
|
161 |
-
* if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative
|
162 |
-
* to another URI, the base URI. Relative references can be divided into several forms:
|
163 |
-
* - network-path references, e.g. '//example.com/path'
|
164 |
-
* - absolute-path references, e.g. '/path'
|
165 |
-
* - relative-path references, e.g. 'subpath'
|
166 |
-
*
|
167 |
-
* @param UriInterface $uri
|
168 |
-
*
|
169 |
-
* @return bool
|
170 |
-
* @see Uri::isNetworkPathReference
|
171 |
-
* @see Uri::isAbsolutePathReference
|
172 |
-
* @see Uri::isRelativePathReference
|
173 |
-
* @link https://tools.ietf.org/html/rfc3986#section-4
|
174 |
-
*/
|
175 |
-
public static function isAbsolute(UriInterface $uri)
|
176 |
-
{
|
177 |
-
return $uri->getScheme() !== '';
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Whether the URI is a network-path reference.
|
182 |
-
*
|
183 |
-
* A relative reference that begins with two slash characters is termed an network-path reference.
|
184 |
-
*
|
185 |
-
* @param UriInterface $uri
|
186 |
-
*
|
187 |
-
* @return bool
|
188 |
-
* @link https://tools.ietf.org/html/rfc3986#section-4.2
|
189 |
-
*/
|
190 |
-
public static function isNetworkPathReference(UriInterface $uri)
|
191 |
-
{
|
192 |
-
return $uri->getScheme() === '' && $uri->getAuthority() !== '';
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Whether the URI is a absolute-path reference.
|
197 |
-
*
|
198 |
-
* A relative reference that begins with a single slash character is termed an absolute-path reference.
|
199 |
-
*
|
200 |
-
* @param UriInterface $uri
|
201 |
-
*
|
202 |
-
* @return bool
|
203 |
-
* @link https://tools.ietf.org/html/rfc3986#section-4.2
|
204 |
-
*/
|
205 |
-
public static function isAbsolutePathReference(UriInterface $uri)
|
206 |
-
{
|
207 |
-
return $uri->getScheme() === ''
|
208 |
-
&& $uri->getAuthority() === ''
|
209 |
-
&& isset($uri->getPath()[0])
|
210 |
-
&& $uri->getPath()[0] === '/';
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Whether the URI is a relative-path reference.
|
215 |
-
*
|
216 |
-
* A relative reference that does not begin with a slash character is termed a relative-path reference.
|
217 |
-
*
|
218 |
-
* @param UriInterface $uri
|
219 |
-
*
|
220 |
-
* @return bool
|
221 |
-
* @link https://tools.ietf.org/html/rfc3986#section-4.2
|
222 |
-
*/
|
223 |
-
public static function isRelativePathReference(UriInterface $uri)
|
224 |
-
{
|
225 |
-
return $uri->getScheme() === ''
|
226 |
-
&& $uri->getAuthority() === ''
|
227 |
-
&& (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/');
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Whether the URI is a same-document reference.
|
232 |
-
*
|
233 |
-
* A same-document reference refers to a URI that is, aside from its fragment
|
234 |
-
* component, identical to the base URI. When no base URI is given, only an empty
|
235 |
-
* URI reference (apart from its fragment) is considered a same-document reference.
|
236 |
-
*
|
237 |
-
* @param UriInterface $uri The URI to check
|
238 |
-
* @param UriInterface|null $base An optional base URI to compare against
|
239 |
-
*
|
240 |
-
* @return bool
|
241 |
-
* @link https://tools.ietf.org/html/rfc3986#section-4.4
|
242 |
-
*/
|
243 |
-
public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null)
|
244 |
-
{
|
245 |
-
if ($base !== null) {
|
246 |
-
$uri = UriResolver::resolve($base, $uri);
|
247 |
-
|
248 |
-
return ($uri->getScheme() === $base->getScheme())
|
249 |
-
&& ($uri->getAuthority() === $base->getAuthority())
|
250 |
-
&& ($uri->getPath() === $base->getPath())
|
251 |
-
&& ($uri->getQuery() === $base->getQuery());
|
252 |
-
}
|
253 |
-
|
254 |
-
return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === '';
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Removes dot segments from a path and returns the new path.
|
259 |
-
*
|
260 |
-
* @param string $path
|
261 |
-
*
|
262 |
-
* @return string
|
263 |
-
*
|
264 |
-
* @deprecated since version 1.4. Use UriResolver::removeDotSegments instead.
|
265 |
-
* @see UriResolver::removeDotSegments
|
266 |
-
*/
|
267 |
-
public static function removeDotSegments($path)
|
268 |
-
{
|
269 |
-
return UriResolver::removeDotSegments($path);
|
270 |
-
}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* Converts the relative URI into a new URI that is resolved against the base URI.
|
274 |
-
*
|
275 |
-
* @param UriInterface $base Base URI
|
276 |
-
* @param string|UriInterface $rel Relative URI
|
277 |
-
*
|
278 |
-
* @return UriInterface
|
279 |
-
*
|
280 |
-
* @deprecated since version 1.4. Use UriResolver::resolve instead.
|
281 |
-
* @see UriResolver::resolve
|
282 |
-
*/
|
283 |
-
public static function resolve(UriInterface $base, $rel)
|
284 |
-
{
|
285 |
-
if (!($rel instanceof UriInterface)) {
|
286 |
-
$rel = new self($rel);
|
287 |
-
}
|
288 |
-
|
289 |
-
return UriResolver::resolve($base, $rel);
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Creates a new URI with a specific query string value removed.
|
294 |
-
*
|
295 |
-
* Any existing query string values that exactly match the provided key are
|
296 |
-
* removed.
|
297 |
-
*
|
298 |
-
* @param UriInterface $uri URI to use as a base.
|
299 |
-
* @param string $key Query string key to remove.
|
300 |
-
*
|
301 |
-
* @return UriInterface
|
302 |
-
*/
|
303 |
-
public static function withoutQueryValue(UriInterface $uri, $key)
|
304 |
-
{
|
305 |
-
$result = self::getFilteredQueryString($uri, [$key]);
|
306 |
-
|
307 |
-
return $uri->withQuery(implode('&', $result));
|
308 |
-
}
|
309 |
-
|
310 |
-
/**
|
311 |
-
* Creates a new URI with a specific query string value.
|
312 |
-
*
|
313 |
-
* Any existing query string values that exactly match the provided key are
|
314 |
-
* removed and replaced with the given key value pair.
|
315 |
-
*
|
316 |
-
* A value of null will set the query string key without a value, e.g. "key"
|
317 |
-
* instead of "key=value".
|
318 |
-
*
|
319 |
-
* @param UriInterface $uri URI to use as a base.
|
320 |
-
* @param string $key Key to set.
|
321 |
-
* @param string|null $value Value to set
|
322 |
-
*
|
323 |
-
* @return UriInterface
|
324 |
-
*/
|
325 |
-
public static function withQueryValue(UriInterface $uri, $key, $value)
|
326 |
-
{
|
327 |
-
$result = self::getFilteredQueryString($uri, [$key]);
|
328 |
-
|
329 |
-
$result[] = self::generateQueryString($key, $value);
|
330 |
-
|
331 |
-
return $uri->withQuery(implode('&', $result));
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Creates a new URI with multiple specific query string values.
|
336 |
-
*
|
337 |
-
* It has the same behavior as withQueryValue() but for an associative array of key => value.
|
338 |
-
*
|
339 |
-
* @param UriInterface $uri URI to use as a base.
|
340 |
-
* @param array $keyValueArray Associative array of key and values
|
341 |
-
*
|
342 |
-
* @return UriInterface
|
343 |
-
*/
|
344 |
-
public static function withQueryValues(UriInterface $uri, array $keyValueArray)
|
345 |
-
{
|
346 |
-
$result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
|
347 |
-
|
348 |
-
foreach ($keyValueArray as $key => $value) {
|
349 |
-
$result[] = self::generateQueryString($key, $value);
|
350 |
-
}
|
351 |
-
|
352 |
-
return $uri->withQuery(implode('&', $result));
|
353 |
-
}
|
354 |
-
|
355 |
-
/**
|
356 |
-
* Creates a URI from a hash of `parse_url` components.
|
357 |
-
*
|
358 |
-
* @param array $parts
|
359 |
-
*
|
360 |
-
* @return UriInterface
|
361 |
-
* @link http://php.net/manual/en/function.parse-url.php
|
362 |
-
*
|
363 |
-
* @throws \InvalidArgumentException If the components do not form a valid URI.
|
364 |
-
*/
|
365 |
-
public static function fromParts(array $parts)
|
366 |
-
{
|
367 |
-
$uri = new self();
|
368 |
-
$uri->applyParts($parts);
|
369 |
-
$uri->validateState();
|
370 |
-
|
371 |
-
return $uri;
|
372 |
-
}
|
373 |
-
|
374 |
-
public function getScheme()
|
375 |
-
{
|
376 |
-
return $this->scheme;
|
377 |
-
}
|
378 |
-
|
379 |
-
public function getAuthority()
|
380 |
-
{
|
381 |
-
$authority = $this->host;
|
382 |
-
if ($this->userInfo !== '') {
|
383 |
-
$authority = $this->userInfo . '@' . $authority;
|
384 |
-
}
|
385 |
-
|
386 |
-
if ($this->port !== null) {
|
387 |
-
$authority .= ':' . $this->port;
|
388 |
-
}
|
389 |
-
|
390 |
-
return $authority;
|
391 |
-
}
|
392 |
-
|
393 |
-
public function getUserInfo()
|
394 |
-
{
|
395 |
-
return $this->userInfo;
|
396 |
-
}
|
397 |
-
|
398 |
-
public function getHost()
|
399 |
-
{
|
400 |
-
return $this->host;
|
401 |
-
}
|
402 |
-
|
403 |
-
public function getPort()
|
404 |
-
{
|
405 |
-
return $this->port;
|
406 |
-
}
|
407 |
-
|
408 |
-
public function getPath()
|
409 |
-
{
|
410 |
-
return $this->path;
|
411 |
-
}
|
412 |
-
|
413 |
-
public function getQuery()
|
414 |
-
{
|
415 |
-
return $this->query;
|
416 |
-
}
|
417 |
-
|
418 |
-
public function getFragment()
|
419 |
-
{
|
420 |
-
return $this->fragment;
|
421 |
-
}
|
422 |
-
|
423 |
-
public function withScheme($scheme)
|
424 |
-
{
|
425 |
-
$scheme = $this->filterScheme($scheme);
|
426 |
-
|
427 |
-
if ($this->scheme === $scheme) {
|
428 |
-
return $this;
|
429 |
-
}
|
430 |
-
|
431 |
-
$new = clone $this;
|
432 |
-
$new->scheme = $scheme;
|
433 |
-
$new->removeDefaultPort();
|
434 |
-
$new->validateState();
|
435 |
-
|
436 |
-
return $new;
|
437 |
-
}
|
438 |
-
|
439 |
-
public function withUserInfo($user, $password = null)
|
440 |
-
{
|
441 |
-
$info = $this->filterUserInfoComponent($user);
|
442 |
-
if ($password !== null) {
|
443 |
-
$info .= ':' . $this->filterUserInfoComponent($password);
|
444 |
-
}
|
445 |
-
|
446 |
-
if ($this->userInfo === $info) {
|
447 |
-
return $this;
|
448 |
-
}
|
449 |
-
|
450 |
-
$new = clone $this;
|
451 |
-
$new->userInfo = $info;
|
452 |
-
$new->validateState();
|
453 |
-
|
454 |
-
return $new;
|
455 |
-
}
|
456 |
-
|
457 |
-
public function withHost($host)
|
458 |
-
{
|
459 |
-
$host = $this->filterHost($host);
|
460 |
-
|
461 |
-
if ($this->host === $host) {
|
462 |
-
return $this;
|
463 |
-
}
|
464 |
-
|
465 |
-
$new = clone $this;
|
466 |
-
$new->host = $host;
|
467 |
-
$new->validateState();
|
468 |
-
|
469 |
-
return $new;
|
470 |
-
}
|
471 |
-
|
472 |
-
public function withPort($port)
|
473 |
-
{
|
474 |
-
$port = $this->filterPort($port);
|
475 |
-
|
476 |
-
if ($this->port === $port) {
|
477 |
-
return $this;
|
478 |
-
}
|
479 |
-
|
480 |
-
$new = clone $this;
|
481 |
-
$new->port = $port;
|
482 |
-
$new->removeDefaultPort();
|
483 |
-
$new->validateState();
|
484 |
-
|
485 |
-
return $new;
|
486 |
-
}
|
487 |
-
|
488 |
-
public function withPath($path)
|
489 |
-
{
|
490 |
-
$path = $this->filterPath($path);
|
491 |
-
|
492 |
-
if ($this->path === $path) {
|
493 |
-
return $this;
|
494 |
-
}
|
495 |
-
|
496 |
-
$new = clone $this;
|
497 |
-
$new->path = $path;
|
498 |
-
$new->validateState();
|
499 |
-
|
500 |
-
return $new;
|
501 |
-
}
|
502 |
-
|
503 |
-
public function withQuery($query)
|
504 |
-
{
|
505 |
-
$query = $this->filterQueryAndFragment($query);
|
506 |
-
|
507 |
-
if ($this->query === $query) {
|
508 |
-
return $this;
|
509 |
-
}
|
510 |
-
|
511 |
-
$new = clone $this;
|
512 |
-
$new->query = $query;
|
513 |
-
|
514 |
-
return $new;
|
515 |
-
}
|
516 |
-
|
517 |
-
public function withFragment($fragment)
|
518 |
-
{
|
519 |
-
$fragment = $this->filterQueryAndFragment($fragment);
|
520 |
-
|
521 |
-
if ($this->fragment === $fragment) {
|
522 |
-
return $this;
|
523 |
-
}
|
524 |
-
|
525 |
-
$new = clone $this;
|
526 |
-
$new->fragment = $fragment;
|
527 |
-
|
528 |
-
return $new;
|
529 |
-
}
|
530 |
-
|
531 |
-
/**
|
532 |
-
* Apply parse_url parts to a URI.
|
533 |
-
*
|
534 |
-
* @param array $parts Array of parse_url parts to apply.
|
535 |
-
*/
|
536 |
-
private function applyParts(array $parts)
|
537 |
-
{
|
538 |
-
$this->scheme = isset($parts['scheme'])
|
539 |
-
? $this->filterScheme($parts['scheme'])
|
540 |
-
: '';
|
541 |
-
$this->userInfo = isset($parts['user'])
|
542 |
-
? $this->filterUserInfoComponent($parts['user'])
|
543 |
-
: '';
|
544 |
-
$this->host = isset($parts['host'])
|
545 |
-
? $this->filterHost($parts['host'])
|
546 |
-
: '';
|
547 |
-
$this->port = isset($parts['port'])
|
548 |
-
? $this->filterPort($parts['port'])
|
549 |
-
: null;
|
550 |
-
$this->path = isset($parts['path'])
|
551 |
-
? $this->filterPath($parts['path'])
|
552 |
-
: '';
|
553 |
-
$this->query = isset($parts['query'])
|
554 |
-
? $this->filterQueryAndFragment($parts['query'])
|
555 |
-
: '';
|
556 |
-
$this->fragment = isset($parts['fragment'])
|
557 |
-
? $this->filterQueryAndFragment($parts['fragment'])
|
558 |
-
: '';
|
559 |
-
if (isset($parts['pass'])) {
|
560 |
-
$this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']);
|
561 |
-
}
|
562 |
-
|
563 |
-
$this->removeDefaultPort();
|
564 |
-
}
|
565 |
-
|
566 |
-
/**
|
567 |
-
* @param string $scheme
|
568 |
-
*
|
569 |
-
* @return string
|
570 |
-
*
|
571 |
-
* @throws \InvalidArgumentException If the scheme is invalid.
|
572 |
-
*/
|
573 |
-
private function filterScheme($scheme)
|
574 |
-
{
|
575 |
-
if (!is_string($scheme)) {
|
576 |
-
throw new \InvalidArgumentException('Scheme must be a string');
|
577 |
-
}
|
578 |
-
|
579 |
-
return strtolower($scheme);
|
580 |
-
}
|
581 |
-
|
582 |
-
/**
|
583 |
-
* @param string $component
|
584 |
-
*
|
585 |
-
* @return string
|
586 |
-
*
|
587 |
-
* @throws \InvalidArgumentException If the user info is invalid.
|
588 |
-
*/
|
589 |
-
private function filterUserInfoComponent($component)
|
590 |
-
{
|
591 |
-
if (!is_string($component)) {
|
592 |
-
throw new \InvalidArgumentException('User info must be a string');
|
593 |
-
}
|
594 |
-
|
595 |
-
return preg_replace_callback(
|
596 |
-
'/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/',
|
597 |
-
[$this, 'rawurlencodeMatchZero'],
|
598 |
-
$component
|
599 |
-
);
|
600 |
-
}
|
601 |
-
|
602 |
-
/**
|
603 |
-
* @param string $host
|
604 |
-
*
|
605 |
-
* @return string
|
606 |
-
*
|
607 |
-
* @throws \InvalidArgumentException If the host is invalid.
|
608 |
-
*/
|
609 |
-
private function filterHost($host)
|
610 |
-
{
|
611 |
-
if (!is_string($host)) {
|
612 |
-
throw new \InvalidArgumentException('Host must be a string');
|
613 |
-
}
|
614 |
-
|
615 |
-
return strtolower($host);
|
616 |
-
}
|
617 |
-
|
618 |
-
/**
|
619 |
-
* @param int|null $port
|
620 |
-
*
|
621 |
-
* @return int|null
|
622 |
-
*
|
623 |
-
* @throws \InvalidArgumentException If the port is invalid.
|
624 |
-
*/
|
625 |
-
private function filterPort($port)
|
626 |
-
{
|
627 |
-
if ($port === null) {
|
628 |
-
return null;
|
629 |
-
}
|
630 |
-
|
631 |
-
$port = (int) $port;
|
632 |
-
if (0 > $port || 0xffff < $port) {
|
633 |
-
throw new \InvalidArgumentException(
|
634 |
-
sprintf('Invalid port: %d. Must be between 0 and 65535', $port)
|
635 |
-
);
|
636 |
-
}
|
637 |
-
|
638 |
-
return $port;
|
639 |
-
}
|
640 |
-
|
641 |
-
/**
|
642 |
-
* @param UriInterface $uri
|
643 |
-
* @param array $keys
|
644 |
-
*
|
645 |
-
* @return array
|
646 |
-
*/
|
647 |
-
private static function getFilteredQueryString(UriInterface $uri, array $keys)
|
648 |
-
{
|
649 |
-
$current = $uri->getQuery();
|
650 |
-
|
651 |
-
if ($current === '') {
|
652 |
-
return [];
|
653 |
-
}
|
654 |
-
|
655 |
-
$decodedKeys = array_map('rawurldecode', $keys);
|
656 |
-
|
657 |
-
return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
|
658 |
-
return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
|
659 |
-
});
|
660 |
-
}
|
661 |
-
|
662 |
-
/**
|
663 |
-
* @param string $key
|
664 |
-
* @param string|null $value
|
665 |
-
*
|
666 |
-
* @return string
|
667 |
-
*/
|
668 |
-
private static function generateQueryString($key, $value)
|
669 |
-
{
|
670 |
-
// Query string separators ("=", "&") within the key or value need to be encoded
|
671 |
-
// (while preventing double-encoding) before setting the query string. All other
|
672 |
-
// chars that need percent-encoding will be encoded by withQuery().
|
673 |
-
$queryString = strtr($key, self::$replaceQuery);
|
674 |
-
|
675 |
-
if ($value !== null) {
|
676 |
-
$queryString .= '=' . strtr($value, self::$replaceQuery);
|
677 |
-
}
|
678 |
-
|
679 |
-
return $queryString;
|
680 |
-
}
|
681 |
-
|
682 |
-
private function removeDefaultPort()
|
683 |
-
{
|
684 |
-
if ($this->port !== null && self::isDefaultPort($this)) {
|
685 |
-
$this->port = null;
|
686 |
-
}
|
687 |
-
}
|
688 |
-
|
689 |
-
/**
|
690 |
-
* Filters the path of a URI
|
691 |
-
*
|
692 |
-
* @param string $path
|
693 |
-
*
|
694 |
-
* @return string
|
695 |
-
*
|
696 |
-
* @throws \InvalidArgumentException If the path is invalid.
|
697 |
-
*/
|
698 |
-
private function filterPath($path)
|
699 |
-
{
|
700 |
-
if (!is_string($path)) {
|
701 |
-
throw new \InvalidArgumentException('Path must be a string');
|
702 |
-
}
|
703 |
-
|
704 |
-
return preg_replace_callback(
|
705 |
-
'/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
|
706 |
-
[$this, 'rawurlencodeMatchZero'],
|
707 |
-
$path
|
708 |
-
);
|
709 |
-
}
|
710 |
-
|
711 |
-
/**
|
712 |
-
* Filters the query string or fragment of a URI.
|
713 |
-
*
|
714 |
-
* @param string $str
|
715 |
-
*
|
716 |
-
* @return string
|
717 |
-
*
|
718 |
-
* @throws \InvalidArgumentException If the query or fragment is invalid.
|
719 |
-
*/
|
720 |
-
private function filterQueryAndFragment($str)
|
721 |
-
{
|
722 |
-
if (!is_string($str)) {
|
723 |
-
throw new \InvalidArgumentException('Query and fragment must be a string');
|
724 |
-
}
|
725 |
-
|
726 |
-
return preg_replace_callback(
|
727 |
-
'/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
|
728 |
-
[$this, 'rawurlencodeMatchZero'],
|
729 |
-
$str
|
730 |
-
);
|
731 |
-
}
|
732 |
-
|
733 |
-
private function rawurlencodeMatchZero(array $match)
|
734 |
-
{
|
735 |
-
return rawurlencode($match[0]);
|
736 |
-
}
|
737 |
-
|
738 |
-
private function validateState()
|
739 |
-
{
|
740 |
-
if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) {
|
741 |
-
$this->host = self::HTTP_DEFAULT_HOST;
|
742 |
-
}
|
743 |
-
|
744 |
-
if ($this->getAuthority() === '') {
|
745 |
-
if (0 === strpos($this->path, '//')) {
|
746 |
-
throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"');
|
747 |
-
}
|
748 |
-
if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) {
|
749 |
-
throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon');
|
750 |
-
}
|
751 |
-
} elseif (isset($this->path[0]) && $this->path[0] !== '/') {
|
752 |
-
@trigger_error(
|
753 |
-
'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' .
|
754 |
-
'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.',
|
755 |
-
E_USER_DEPRECATED
|
756 |
-
);
|
757 |
-
$this->path = '/'. $this->path;
|
758 |
-
//throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty');
|
759 |
-
}
|
760 |
-
}
|
761 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/UriNormalizer.php
DELETED
@@ -1,217 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\UriInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Provides methods to normalize and compare URIs.
|
9 |
-
*
|
10 |
-
* @author Tobias Schultze
|
11 |
-
*
|
12 |
-
* @link https://tools.ietf.org/html/rfc3986#section-6
|
13 |
-
*/
|
14 |
-
final class UriNormalizer
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* Default normalizations which only include the ones that preserve semantics.
|
18 |
-
*
|
19 |
-
* self::CAPITALIZE_PERCENT_ENCODING | self::DECODE_UNRESERVED_CHARACTERS | self::CONVERT_EMPTY_PATH |
|
20 |
-
* self::REMOVE_DEFAULT_HOST | self::REMOVE_DEFAULT_PORT | self::REMOVE_DOT_SEGMENTS
|
21 |
-
*/
|
22 |
-
const PRESERVING_NORMALIZATIONS = 63;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized.
|
26 |
-
*
|
27 |
-
* Example: http://example.org/a%c2%b1b → http://example.org/a%C2%B1b
|
28 |
-
*/
|
29 |
-
const CAPITALIZE_PERCENT_ENCODING = 1;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Decodes percent-encoded octets of unreserved characters.
|
33 |
-
*
|
34 |
-
* For consistency, percent-encoded octets in the ranges of ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39),
|
35 |
-
* hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers and,
|
36 |
-
* when found in a URI, should be decoded to their corresponding unreserved characters by URI normalizers.
|
37 |
-
*
|
38 |
-
* Example: http://example.org/%7Eusern%61me/ → http://example.org/~username/
|
39 |
-
*/
|
40 |
-
const DECODE_UNRESERVED_CHARACTERS = 2;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Converts the empty path to "/" for http and https URIs.
|
44 |
-
*
|
45 |
-
* Example: http://example.org → http://example.org/
|
46 |
-
*/
|
47 |
-
const CONVERT_EMPTY_PATH = 4;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Removes the default host of the given URI scheme from the URI.
|
51 |
-
*
|
52 |
-
* Only the "file" scheme defines the default host "localhost".
|
53 |
-
* All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile`
|
54 |
-
* are equivalent according to RFC 3986. The first format is not accepted
|
55 |
-
* by PHPs stream functions and thus already normalized implicitly to the
|
56 |
-
* second format in the Uri class. See `GuzzleHttp\Psr7\Uri::composeComponents`.
|
57 |
-
*
|
58 |
-
* Example: file://localhost/myfile → file:///myfile
|
59 |
-
*/
|
60 |
-
const REMOVE_DEFAULT_HOST = 8;
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Removes the default port of the given URI scheme from the URI.
|
64 |
-
*
|
65 |
-
* Example: http://example.org:80/ → http://example.org/
|
66 |
-
*/
|
67 |
-
const REMOVE_DEFAULT_PORT = 16;
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Removes unnecessary dot-segments.
|
71 |
-
*
|
72 |
-
* Dot-segments in relative-path references are not removed as it would
|
73 |
-
* change the semantics of the URI reference.
|
74 |
-
*
|
75 |
-
* Example: http://example.org/../a/b/../c/./d.html → http://example.org/a/c/d.html
|
76 |
-
*/
|
77 |
-
const REMOVE_DOT_SEGMENTS = 32;
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Paths which include two or more adjacent slashes are converted to one.
|
81 |
-
*
|
82 |
-
* Webservers usually ignore duplicate slashes and treat those URIs equivalent.
|
83 |
-
* But in theory those URIs do not need to be equivalent. So this normalization
|
84 |
-
* may change the semantics. Encoded slashes (%2F) are not removed.
|
85 |
-
*
|
86 |
-
* Example: http://example.org//foo///bar.html → http://example.org/foo/bar.html
|
87 |
-
*/
|
88 |
-
const REMOVE_DUPLICATE_SLASHES = 64;
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Sort query parameters with their values in alphabetical order.
|
92 |
-
*
|
93 |
-
* However, the order of parameters in a URI may be significant (this is not defined by the standard).
|
94 |
-
* So this normalization is not safe and may change the semantics of the URI.
|
95 |
-
*
|
96 |
-
* Example: ?lang=en&article=fred → ?article=fred&lang=en
|
97 |
-
*
|
98 |
-
* Note: The sorting is neither locale nor Unicode aware (the URI query does not get decoded at all) as the
|
99 |
-
* purpose is to be able to compare URIs in a reproducible way, not to have the params sorted perfectly.
|
100 |
-
*/
|
101 |
-
const SORT_QUERY_PARAMETERS = 128;
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Returns a normalized URI.
|
105 |
-
*
|
106 |
-
* The scheme and host component are already normalized to lowercase per PSR-7 UriInterface.
|
107 |
-
* This methods adds additional normalizations that can be configured with the $flags parameter.
|
108 |
-
*
|
109 |
-
* PSR-7 UriInterface cannot distinguish between an empty component and a missing component as
|
110 |
-
* getQuery(), getFragment() etc. always return a string. This means the URIs "/?#" and "/" are
|
111 |
-
* treated equivalent which is not necessarily true according to RFC 3986. But that difference
|
112 |
-
* is highly uncommon in reality. So this potential normalization is implied in PSR-7 as well.
|
113 |
-
*
|
114 |
-
* @param UriInterface $uri The URI to normalize
|
115 |
-
* @param int $flags A bitmask of normalizations to apply, see constants
|
116 |
-
*
|
117 |
-
* @return UriInterface The normalized URI
|
118 |
-
* @link https://tools.ietf.org/html/rfc3986#section-6.2
|
119 |
-
*/
|
120 |
-
public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS)
|
121 |
-
{
|
122 |
-
if ($flags & self::CAPITALIZE_PERCENT_ENCODING) {
|
123 |
-
$uri = self::capitalizePercentEncoding($uri);
|
124 |
-
}
|
125 |
-
|
126 |
-
if ($flags & self::DECODE_UNRESERVED_CHARACTERS) {
|
127 |
-
$uri = self::decodeUnreservedCharacters($uri);
|
128 |
-
}
|
129 |
-
|
130 |
-
if ($flags & self::CONVERT_EMPTY_PATH && $uri->getPath() === '' &&
|
131 |
-
($uri->getScheme() === 'http' || $uri->getScheme() === 'https')
|
132 |
-
) {
|
133 |
-
$uri = $uri->withPath('/');
|
134 |
-
}
|
135 |
-
|
136 |
-
if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') {
|
137 |
-
$uri = $uri->withHost('');
|
138 |
-
}
|
139 |
-
|
140 |
-
if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) {
|
141 |
-
$uri = $uri->withPort(null);
|
142 |
-
}
|
143 |
-
|
144 |
-
if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) {
|
145 |
-
$uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath()));
|
146 |
-
}
|
147 |
-
|
148 |
-
if ($flags & self::REMOVE_DUPLICATE_SLASHES) {
|
149 |
-
$uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath()));
|
150 |
-
}
|
151 |
-
|
152 |
-
if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') {
|
153 |
-
$queryKeyValues = explode('&', $uri->getQuery());
|
154 |
-
sort($queryKeyValues);
|
155 |
-
$uri = $uri->withQuery(implode('&', $queryKeyValues));
|
156 |
-
}
|
157 |
-
|
158 |
-
return $uri;
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Whether two URIs can be considered equivalent.
|
163 |
-
*
|
164 |
-
* Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also
|
165 |
-
* accepts relative URI references and returns true when they are equivalent. This of course assumes they will be
|
166 |
-
* resolved against the same base URI. If this is not the case, determination of equivalence or difference of
|
167 |
-
* relative references does not mean anything.
|
168 |
-
*
|
169 |
-
* @param UriInterface $uri1 An URI to compare
|
170 |
-
* @param UriInterface $uri2 An URI to compare
|
171 |
-
* @param int $normalizations A bitmask of normalizations to apply, see constants
|
172 |
-
*
|
173 |
-
* @return bool
|
174 |
-
* @link https://tools.ietf.org/html/rfc3986#section-6.1
|
175 |
-
*/
|
176 |
-
public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS)
|
177 |
-
{
|
178 |
-
return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations);
|
179 |
-
}
|
180 |
-
|
181 |
-
private static function capitalizePercentEncoding(UriInterface $uri)
|
182 |
-
{
|
183 |
-
$regex = '/(?:%[A-Fa-f0-9]{2})++/';
|
184 |
-
|
185 |
-
$callback = function (array $match) {
|
186 |
-
return strtoupper($match[0]);
|
187 |
-
};
|
188 |
-
|
189 |
-
return
|
190 |
-
$uri->withPath(
|
191 |
-
preg_replace_callback($regex, $callback, $uri->getPath())
|
192 |
-
)->withQuery(
|
193 |
-
preg_replace_callback($regex, $callback, $uri->getQuery())
|
194 |
-
);
|
195 |
-
}
|
196 |
-
|
197 |
-
private static function decodeUnreservedCharacters(UriInterface $uri)
|
198 |
-
{
|
199 |
-
$regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i';
|
200 |
-
|
201 |
-
$callback = function (array $match) {
|
202 |
-
return rawurldecode($match[0]);
|
203 |
-
};
|
204 |
-
|
205 |
-
return
|
206 |
-
$uri->withPath(
|
207 |
-
preg_replace_callback($regex, $callback, $uri->getPath())
|
208 |
-
)->withQuery(
|
209 |
-
preg_replace_callback($regex, $callback, $uri->getQuery())
|
210 |
-
);
|
211 |
-
}
|
212 |
-
|
213 |
-
private function __construct()
|
214 |
-
{
|
215 |
-
// cannot be instantiated
|
216 |
-
}
|
217 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/UriResolver.php
DELETED
@@ -1,220 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\UriInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Resolves a URI reference in the context of a base URI and the opposite way.
|
9 |
-
*
|
10 |
-
* @author Tobias Schultze
|
11 |
-
*
|
12 |
-
* @link https://tools.ietf.org/html/rfc3986#section-5
|
13 |
-
*/
|
14 |
-
final class UriResolver
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* Removes dot segments from a path and returns the new path.
|
18 |
-
*
|
19 |
-
* @param string $path
|
20 |
-
*
|
21 |
-
* @return string
|
22 |
-
* @link http://tools.ietf.org/html/rfc3986#section-5.2.4
|
23 |
-
*/
|
24 |
-
public static function removeDotSegments($path)
|
25 |
-
{
|
26 |
-
if ($path === '' || $path === '/') {
|
27 |
-
return $path;
|
28 |
-
}
|
29 |
-
|
30 |
-
$results = [];
|
31 |
-
$segments = explode('/', $path);
|
32 |
-
foreach ($segments as $segment) {
|
33 |
-
if ($segment === '..') {
|
34 |
-
array_pop($results);
|
35 |
-
} elseif ($segment !== '.') {
|
36 |
-
$results[] = $segment;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
$newPath = implode('/', $results);
|
41 |
-
|
42 |
-
if ($path[0] === '/' && (!isset($newPath[0]) || $newPath[0] !== '/')) {
|
43 |
-
// Re-add the leading slash if necessary for cases like "/.."
|
44 |
-
$newPath = '/' . $newPath;
|
45 |
-
} elseif ($newPath !== '' && ($segment === '.' || $segment === '..')) {
|
46 |
-
// Add the trailing slash if necessary
|
47 |
-
// If newPath is not empty, then $segment must be set and is the last segment from the foreach
|
48 |
-
$newPath .= '/';
|
49 |
-
}
|
50 |
-
|
51 |
-
return $newPath;
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Converts the relative URI into a new URI that is resolved against the base URI.
|
56 |
-
*
|
57 |
-
* @param UriInterface $base Base URI
|
58 |
-
* @param UriInterface $rel Relative URI
|
59 |
-
*
|
60 |
-
* @return UriInterface
|
61 |
-
* @link http://tools.ietf.org/html/rfc3986#section-5.2
|
62 |
-
*/
|
63 |
-
public static function resolve(UriInterface $base, UriInterface $rel)
|
64 |
-
{
|
65 |
-
if ((string) $rel === '') {
|
66 |
-
// we can simply return the same base URI instance for this same-document reference
|
67 |
-
return $base;
|
68 |
-
}
|
69 |
-
|
70 |
-
if ($rel->getScheme() != '') {
|
71 |
-
return $rel->withPath(self::removeDotSegments($rel->getPath()));
|
72 |
-
}
|
73 |
-
|
74 |
-
if ($rel->getAuthority() != '') {
|
75 |
-
$targetAuthority = $rel->getAuthority();
|
76 |
-
$targetPath = self::removeDotSegments($rel->getPath());
|
77 |
-
$targetQuery = $rel->getQuery();
|
78 |
-
} else {
|
79 |
-
$targetAuthority = $base->getAuthority();
|
80 |
-
if ($rel->getPath() === '') {
|
81 |
-
$targetPath = $base->getPath();
|
82 |
-
$targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery();
|
83 |
-
} else {
|
84 |
-
if ($rel->getPath()[0] === '/') {
|
85 |
-
$targetPath = $rel->getPath();
|
86 |
-
} else {
|
87 |
-
if ($targetAuthority != '' && $base->getPath() === '') {
|
88 |
-
$targetPath = '/' . $rel->getPath();
|
89 |
-
} else {
|
90 |
-
$lastSlashPos = strrpos($base->getPath(), '/');
|
91 |
-
if ($lastSlashPos === false) {
|
92 |
-
$targetPath = $rel->getPath();
|
93 |
-
} else {
|
94 |
-
$targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath();
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
$targetPath = self::removeDotSegments($targetPath);
|
99 |
-
$targetQuery = $rel->getQuery();
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
return new Uri(Uri::composeComponents(
|
104 |
-
$base->getScheme(),
|
105 |
-
$targetAuthority,
|
106 |
-
$targetPath,
|
107 |
-
$targetQuery,
|
108 |
-
$rel->getFragment()
|
109 |
-
));
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Returns the target URI as a relative reference from the base URI.
|
114 |
-
*
|
115 |
-
* This method is the counterpart to resolve():
|
116 |
-
*
|
117 |
-
* (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target))
|
118 |
-
*
|
119 |
-
* One use-case is to use the current request URI as base URI and then generate relative links in your documents
|
120 |
-
* to reduce the document size or offer self-contained downloadable document archives.
|
121 |
-
*
|
122 |
-
* $base = new Uri('http://example.com/a/b/');
|
123 |
-
* echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'.
|
124 |
-
* echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'.
|
125 |
-
* echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'.
|
126 |
-
* echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'.
|
127 |
-
*
|
128 |
-
* This method also accepts a target that is already relative and will try to relativize it further. Only a
|
129 |
-
* relative-path reference will be returned as-is.
|
130 |
-
*
|
131 |
-
* echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well
|
132 |
-
*
|
133 |
-
* @param UriInterface $base Base URI
|
134 |
-
* @param UriInterface $target Target URI
|
135 |
-
*
|
136 |
-
* @return UriInterface The relative URI reference
|
137 |
-
*/
|
138 |
-
public static function relativize(UriInterface $base, UriInterface $target)
|
139 |
-
{
|
140 |
-
if ($target->getScheme() !== '' &&
|
141 |
-
($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')
|
142 |
-
) {
|
143 |
-
return $target;
|
144 |
-
}
|
145 |
-
|
146 |
-
if (Uri::isRelativePathReference($target)) {
|
147 |
-
// As the target is already highly relative we return it as-is. It would be possible to resolve
|
148 |
-
// the target with `$target = self::resolve($base, $target);` and then try make it more relative
|
149 |
-
// by removing a duplicate query. But let's not do that automatically.
|
150 |
-
return $target;
|
151 |
-
}
|
152 |
-
|
153 |
-
if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) {
|
154 |
-
return $target->withScheme('');
|
155 |
-
}
|
156 |
-
|
157 |
-
// We must remove the path before removing the authority because if the path starts with two slashes, the URI
|
158 |
-
// would turn invalid. And we also cannot set a relative path before removing the authority, as that is also
|
159 |
-
// invalid.
|
160 |
-
$emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost('');
|
161 |
-
|
162 |
-
if ($base->getPath() !== $target->getPath()) {
|
163 |
-
return $emptyPathUri->withPath(self::getRelativePath($base, $target));
|
164 |
-
}
|
165 |
-
|
166 |
-
if ($base->getQuery() === $target->getQuery()) {
|
167 |
-
// Only the target fragment is left. And it must be returned even if base and target fragment are the same.
|
168 |
-
return $emptyPathUri->withQuery('');
|
169 |
-
}
|
170 |
-
|
171 |
-
// If the base URI has a query but the target has none, we cannot return an empty path reference as it would
|
172 |
-
// inherit the base query component when resolving.
|
173 |
-
if ($target->getQuery() === '') {
|
174 |
-
$segments = explode('/', $target->getPath());
|
175 |
-
$lastSegment = end($segments);
|
176 |
-
|
177 |
-
return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment);
|
178 |
-
}
|
179 |
-
|
180 |
-
return $emptyPathUri;
|
181 |
-
}
|
182 |
-
|
183 |
-
private static function getRelativePath(UriInterface $base, UriInterface $target)
|
184 |
-
{
|
185 |
-
$sourceSegments = explode('/', $base->getPath());
|
186 |
-
$targetSegments = explode('/', $target->getPath());
|
187 |
-
array_pop($sourceSegments);
|
188 |
-
$targetLastSegment = array_pop($targetSegments);
|
189 |
-
foreach ($sourceSegments as $i => $segment) {
|
190 |
-
if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) {
|
191 |
-
unset($sourceSegments[$i], $targetSegments[$i]);
|
192 |
-
} else {
|
193 |
-
break;
|
194 |
-
}
|
195 |
-
}
|
196 |
-
$targetSegments[] = $targetLastSegment;
|
197 |
-
$relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments);
|
198 |
-
|
199 |
-
// A reference to am empty last segment or an empty first sub-segment must be prefixed with "./".
|
200 |
-
// This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used
|
201 |
-
// as the first segment of a relative-path reference, as it would be mistaken for a scheme name.
|
202 |
-
if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) {
|
203 |
-
$relativePath = "./$relativePath";
|
204 |
-
} elseif ('/' === $relativePath[0]) {
|
205 |
-
if ($base->getAuthority() != '' && $base->getPath() === '') {
|
206 |
-
// In this case an extra slash is added by resolve() automatically. So we must not add one here.
|
207 |
-
$relativePath = ".$relativePath";
|
208 |
-
} else {
|
209 |
-
$relativePath = "./$relativePath";
|
210 |
-
}
|
211 |
-
}
|
212 |
-
|
213 |
-
return $relativePath;
|
214 |
-
}
|
215 |
-
|
216 |
-
private function __construct()
|
217 |
-
{
|
218 |
-
// cannot be instantiated
|
219 |
-
}
|
220 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/Utils.php
DELETED
@@ -1,398 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
use Psr\Http\Message\ServerRequestInterface;
|
7 |
-
use Psr\Http\Message\StreamInterface;
|
8 |
-
use Psr\Http\Message\UriInterface;
|
9 |
-
|
10 |
-
final class Utils
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* Remove the items given by the keys, case insensitively from the data.
|
14 |
-
*
|
15 |
-
* @param iterable<string> $keys
|
16 |
-
*
|
17 |
-
* @return array
|
18 |
-
*/
|
19 |
-
public static function caselessRemove($keys, array $data)
|
20 |
-
{
|
21 |
-
$result = [];
|
22 |
-
|
23 |
-
foreach ($keys as &$key) {
|
24 |
-
$key = strtolower($key);
|
25 |
-
}
|
26 |
-
|
27 |
-
foreach ($data as $k => $v) {
|
28 |
-
if (!in_array(strtolower($k), $keys)) {
|
29 |
-
$result[$k] = $v;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
return $result;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Copy the contents of a stream into another stream until the given number
|
38 |
-
* of bytes have been read.
|
39 |
-
*
|
40 |
-
* @param StreamInterface $source Stream to read from
|
41 |
-
* @param StreamInterface $dest Stream to write to
|
42 |
-
* @param int $maxLen Maximum number of bytes to read. Pass -1
|
43 |
-
* to read the entire stream.
|
44 |
-
*
|
45 |
-
* @throws \RuntimeException on error.
|
46 |
-
*/
|
47 |
-
public static function copyToStream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)
|
48 |
-
{
|
49 |
-
$bufferSize = 8192;
|
50 |
-
|
51 |
-
if ($maxLen === -1) {
|
52 |
-
while (!$source->eof()) {
|
53 |
-
if (!$dest->write($source->read($bufferSize))) {
|
54 |
-
break;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
} else {
|
58 |
-
$remaining = $maxLen;
|
59 |
-
while ($remaining > 0 && !$source->eof()) {
|
60 |
-
$buf = $source->read(min($bufferSize, $remaining));
|
61 |
-
$len = strlen($buf);
|
62 |
-
if (!$len) {
|
63 |
-
break;
|
64 |
-
}
|
65 |
-
$remaining -= $len;
|
66 |
-
$dest->write($buf);
|
67 |
-
}
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Copy the contents of a stream into a string until the given number of
|
73 |
-
* bytes have been read.
|
74 |
-
*
|
75 |
-
* @param StreamInterface $stream Stream to read
|
76 |
-
* @param int $maxLen Maximum number of bytes to read. Pass -1
|
77 |
-
* to read the entire stream.
|
78 |
-
* @return string
|
79 |
-
*
|
80 |
-
* @throws \RuntimeException on error.
|
81 |
-
*/
|
82 |
-
public static function copyToString(StreamInterface $stream, $maxLen = -1)
|
83 |
-
{
|
84 |
-
$buffer = '';
|
85 |
-
|
86 |
-
if ($maxLen === -1) {
|
87 |
-
while (!$stream->eof()) {
|
88 |
-
$buf = $stream->read(1048576);
|
89 |
-
// Using a loose equality here to match on '' and false.
|
90 |
-
if ($buf == null) {
|
91 |
-
break;
|
92 |
-
}
|
93 |
-
$buffer .= $buf;
|
94 |
-
}
|
95 |
-
return $buffer;
|
96 |
-
}
|
97 |
-
|
98 |
-
$len = 0;
|
99 |
-
while (!$stream->eof() && $len < $maxLen) {
|
100 |
-
$buf = $stream->read($maxLen - $len);
|
101 |
-
// Using a loose equality here to match on '' and false.
|
102 |
-
if ($buf == null) {
|
103 |
-
break;
|
104 |
-
}
|
105 |
-
$buffer .= $buf;
|
106 |
-
$len = strlen($buffer);
|
107 |
-
}
|
108 |
-
|
109 |
-
return $buffer;
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Calculate a hash of a stream.
|
114 |
-
*
|
115 |
-
* This method reads the entire stream to calculate a rolling hash, based
|
116 |
-
* on PHP's `hash_init` functions.
|
117 |
-
*
|
118 |
-
* @param StreamInterface $stream Stream to calculate the hash for
|
119 |
-
* @param string $algo Hash algorithm (e.g. md5, crc32, etc)
|
120 |
-
* @param bool $rawOutput Whether or not to use raw output
|
121 |
-
*
|
122 |
-
* @return string Returns the hash of the stream
|
123 |
-
*
|
124 |
-
* @throws \RuntimeException on error.
|
125 |
-
*/
|
126 |
-
public static function hash(StreamInterface $stream, $algo, $rawOutput = false)
|
127 |
-
{
|
128 |
-
$pos = $stream->tell();
|
129 |
-
|
130 |
-
if ($pos > 0) {
|
131 |
-
$stream->rewind();
|
132 |
-
}
|
133 |
-
|
134 |
-
$ctx = hash_init($algo);
|
135 |
-
while (!$stream->eof()) {
|
136 |
-
hash_update($ctx, $stream->read(1048576));
|
137 |
-
}
|
138 |
-
|
139 |
-
$out = hash_final($ctx, (bool) $rawOutput);
|
140 |
-
$stream->seek($pos);
|
141 |
-
|
142 |
-
return $out;
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Clone and modify a request with the given changes.
|
147 |
-
*
|
148 |
-
* This method is useful for reducing the number of clones needed to mutate
|
149 |
-
* a message.
|
150 |
-
*
|
151 |
-
* The changes can be one of:
|
152 |
-
* - method: (string) Changes the HTTP method.
|
153 |
-
* - set_headers: (array) Sets the given headers.
|
154 |
-
* - remove_headers: (array) Remove the given headers.
|
155 |
-
* - body: (mixed) Sets the given body.
|
156 |
-
* - uri: (UriInterface) Set the URI.
|
157 |
-
* - query: (string) Set the query string value of the URI.
|
158 |
-
* - version: (string) Set the protocol version.
|
159 |
-
*
|
160 |
-
* @param RequestInterface $request Request to clone and modify.
|
161 |
-
* @param array $changes Changes to apply.
|
162 |
-
*
|
163 |
-
* @return RequestInterface
|
164 |
-
*/
|
165 |
-
public static function modifyRequest(RequestInterface $request, array $changes)
|
166 |
-
{
|
167 |
-
if (!$changes) {
|
168 |
-
return $request;
|
169 |
-
}
|
170 |
-
|
171 |
-
$headers = $request->getHeaders();
|
172 |
-
|
173 |
-
if (!isset($changes['uri'])) {
|
174 |
-
$uri = $request->getUri();
|
175 |
-
} else {
|
176 |
-
// Remove the host header if one is on the URI
|
177 |
-
if ($host = $changes['uri']->getHost()) {
|
178 |
-
$changes['set_headers']['Host'] = $host;
|
179 |
-
|
180 |
-
if ($port = $changes['uri']->getPort()) {
|
181 |
-
$standardPorts = ['http' => 80, 'https' => 443];
|
182 |
-
$scheme = $changes['uri']->getScheme();
|
183 |
-
if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) {
|
184 |
-
$changes['set_headers']['Host'] .= ':'.$port;
|
185 |
-
}
|
186 |
-
}
|
187 |
-
}
|
188 |
-
$uri = $changes['uri'];
|
189 |
-
}
|
190 |
-
|
191 |
-
if (!empty($changes['remove_headers'])) {
|
192 |
-
$headers = self::caselessRemove($changes['remove_headers'], $headers);
|
193 |
-
}
|
194 |
-
|
195 |
-
if (!empty($changes['set_headers'])) {
|
196 |
-
$headers = self::caselessRemove(array_keys($changes['set_headers']), $headers);
|
197 |
-
$headers = $changes['set_headers'] + $headers;
|
198 |
-
}
|
199 |
-
|
200 |
-
if (isset($changes['query'])) {
|
201 |
-
$uri = $uri->withQuery($changes['query']);
|
202 |
-
}
|
203 |
-
|
204 |
-
if ($request instanceof ServerRequestInterface) {
|
205 |
-
return (new ServerRequest(
|
206 |
-
isset($changes['method']) ? $changes['method'] : $request->getMethod(),
|
207 |
-
$uri,
|
208 |
-
$headers,
|
209 |
-
isset($changes['body']) ? $changes['body'] : $request->getBody(),
|
210 |
-
isset($changes['version'])
|
211 |
-
? $changes['version']
|
212 |
-
: $request->getProtocolVersion(),
|
213 |
-
$request->getServerParams()
|
214 |
-
))
|
215 |
-
->withParsedBody($request->getParsedBody())
|
216 |
-
->withQueryParams($request->getQueryParams())
|
217 |
-
->withCookieParams($request->getCookieParams())
|
218 |
-
->withUploadedFiles($request->getUploadedFiles());
|
219 |
-
}
|
220 |
-
|
221 |
-
return new Request(
|
222 |
-
isset($changes['method']) ? $changes['method'] : $request->getMethod(),
|
223 |
-
$uri,
|
224 |
-
$headers,
|
225 |
-
isset($changes['body']) ? $changes['body'] : $request->getBody(),
|
226 |
-
isset($changes['version'])
|
227 |
-
? $changes['version']
|
228 |
-
: $request->getProtocolVersion()
|
229 |
-
);
|
230 |
-
}
|
231 |
-
|
232 |
-
/**
|
233 |
-
* Read a line from the stream up to the maximum allowed buffer length.
|
234 |
-
*
|
235 |
-
* @param StreamInterface $stream Stream to read from
|
236 |
-
* @param int|null $maxLength Maximum buffer length
|
237 |
-
*
|
238 |
-
* @return string
|
239 |
-
*/
|
240 |
-
public static function readLine(StreamInterface $stream, $maxLength = null)
|
241 |
-
{
|
242 |
-
$buffer = '';
|
243 |
-
$size = 0;
|
244 |
-
|
245 |
-
while (!$stream->eof()) {
|
246 |
-
// Using a loose equality here to match on '' and false.
|
247 |
-
if (null == ($byte = $stream->read(1))) {
|
248 |
-
return $buffer;
|
249 |
-
}
|
250 |
-
$buffer .= $byte;
|
251 |
-
// Break when a new line is found or the max length - 1 is reached
|
252 |
-
if ($byte === "\n" || ++$size === $maxLength - 1) {
|
253 |
-
break;
|
254 |
-
}
|
255 |
-
}
|
256 |
-
|
257 |
-
return $buffer;
|
258 |
-
}
|
259 |
-
|
260 |
-
/**
|
261 |
-
* Create a new stream based on the input type.
|
262 |
-
*
|
263 |
-
* Options is an associative array that can contain the following keys:
|
264 |
-
* - metadata: Array of custom metadata.
|
265 |
-
* - size: Size of the stream.
|
266 |
-
*
|
267 |
-
* This method accepts the following `$resource` types:
|
268 |
-
* - `Psr\Http\Message\StreamInterface`: Returns the value as-is.
|
269 |
-
* - `string`: Creates a stream object that uses the given string as the contents.
|
270 |
-
* - `resource`: Creates a stream object that wraps the given PHP stream resource.
|
271 |
-
* - `Iterator`: If the provided value implements `Iterator`, then a read-only
|
272 |
-
* stream object will be created that wraps the given iterable. Each time the
|
273 |
-
* stream is read from, data from the iterator will fill a buffer and will be
|
274 |
-
* continuously called until the buffer is equal to the requested read size.
|
275 |
-
* Subsequent read calls will first read from the buffer and then call `next`
|
276 |
-
* on the underlying iterator until it is exhausted.
|
277 |
-
* - `object` with `__toString()`: If the object has the `__toString()` method,
|
278 |
-
* the object will be cast to a string and then a stream will be returned that
|
279 |
-
* uses the string value.
|
280 |
-
* - `NULL`: When `null` is passed, an empty stream object is returned.
|
281 |
-
* - `callable` When a callable is passed, a read-only stream object will be
|
282 |
-
* created that invokes the given callable. The callable is invoked with the
|
283 |
-
* number of suggested bytes to read. The callable can return any number of
|
284 |
-
* bytes, but MUST return `false` when there is no more data to return. The
|
285 |
-
* stream object that wraps the callable will invoke the callable until the
|
286 |
-
* number of requested bytes are available. Any additional bytes will be
|
287 |
-
* buffered and used in subsequent reads.
|
288 |
-
*
|
289 |
-
* @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data
|
290 |
-
* @param array $options Additional options
|
291 |
-
*
|
292 |
-
* @return StreamInterface
|
293 |
-
*
|
294 |
-
* @throws \InvalidArgumentException if the $resource arg is not valid.
|
295 |
-
*/
|
296 |
-
public static function streamFor($resource = '', array $options = [])
|
297 |
-
{
|
298 |
-
if (is_scalar($resource)) {
|
299 |
-
$stream = fopen('php://temp', 'r+');
|
300 |
-
if ($resource !== '') {
|
301 |
-
fwrite($stream, $resource);
|
302 |
-
fseek($stream, 0);
|
303 |
-
}
|
304 |
-
return new Stream($stream, $options);
|
305 |
-
}
|
306 |
-
|
307 |
-
switch (gettype($resource)) {
|
308 |
-
case 'resource':
|
309 |
-
return new Stream($resource, $options);
|
310 |
-
case 'object':
|
311 |
-
if ($resource instanceof StreamInterface) {
|
312 |
-
return $resource;
|
313 |
-
} elseif ($resource instanceof \Iterator) {
|
314 |
-
return new PumpStream(function () use ($resource) {
|
315 |
-
if (!$resource->valid()) {
|
316 |
-
return false;
|
317 |
-
}
|
318 |
-
$result = $resource->current();
|
319 |
-
$resource->next();
|
320 |
-
return $result;
|
321 |
-
}, $options);
|
322 |
-
} elseif (method_exists($resource, '__toString')) {
|
323 |
-
return Utils::streamFor((string) $resource, $options);
|
324 |
-
}
|
325 |
-
break;
|
326 |
-
case 'NULL':
|
327 |
-
return new Stream(fopen('php://temp', 'r+'), $options);
|
328 |
-
}
|
329 |
-
|
330 |
-
if (is_callable($resource)) {
|
331 |
-
return new PumpStream($resource, $options);
|
332 |
-
}
|
333 |
-
|
334 |
-
throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource));
|
335 |
-
}
|
336 |
-
|
337 |
-
/**
|
338 |
-
* Safely opens a PHP stream resource using a filename.
|
339 |
-
*
|
340 |
-
* When fopen fails, PHP normally raises a warning. This function adds an
|
341 |
-
* error handler that checks for errors and throws an exception instead.
|
342 |
-
*
|
343 |
-
* @param string $filename File to open
|
344 |
-
* @param string $mode Mode used to open the file
|
345 |
-
*
|
346 |
-
* @return resource
|
347 |
-
*
|
348 |
-
* @throws \RuntimeException if the file cannot be opened
|
349 |
-
*/
|
350 |
-
public static function tryFopen($filename, $mode)
|
351 |
-
{
|
352 |
-
$ex = null;
|
353 |
-
set_error_handler(function () use ($filename, $mode, &$ex) {
|
354 |
-
$ex = new \RuntimeException(sprintf(
|
355 |
-
'Unable to open %s using mode %s: %s',
|
356 |
-
$filename,
|
357 |
-
$mode,
|
358 |
-
func_get_args()[1]
|
359 |
-
));
|
360 |
-
});
|
361 |
-
|
362 |
-
$handle = fopen($filename, $mode);
|
363 |
-
restore_error_handler();
|
364 |
-
|
365 |
-
if ($ex) {
|
366 |
-
/** @var $ex \RuntimeException */
|
367 |
-
throw $ex;
|
368 |
-
}
|
369 |
-
|
370 |
-
return $handle;
|
371 |
-
}
|
372 |
-
|
373 |
-
/**
|
374 |
-
* Returns a UriInterface for the given value.
|
375 |
-
*
|
376 |
-
* This function accepts a string or UriInterface and returns a
|
377 |
-
* UriInterface for the given value. If the value is already a
|
378 |
-
* UriInterface, it is returned as-is.
|
379 |
-
*
|
380 |
-
* @param string|UriInterface $uri
|
381 |
-
*
|
382 |
-
* @return UriInterface
|
383 |
-
*
|
384 |
-
* @throws \InvalidArgumentException
|
385 |
-
*/
|
386 |
-
public static function uriFor($uri)
|
387 |
-
{
|
388 |
-
if ($uri instanceof UriInterface) {
|
389 |
-
return $uri;
|
390 |
-
}
|
391 |
-
|
392 |
-
if (is_string($uri)) {
|
393 |
-
return new Uri($uri);
|
394 |
-
}
|
395 |
-
|
396 |
-
throw new \InvalidArgumentException('URI must be a string or UriInterface');
|
397 |
-
}
|
398 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/functions.php
DELETED
@@ -1,417 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace GuzzleHttp\Psr7;
|
4 |
-
|
5 |
-
use Psr\Http\Message\MessageInterface;
|
6 |
-
use Psr\Http\Message\RequestInterface;
|
7 |
-
use Psr\Http\Message\StreamInterface;
|
8 |
-
use Psr\Http\Message\UriInterface;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Returns the string representation of an HTTP message.
|
12 |
-
*
|
13 |
-
* @param MessageInterface $message Message to convert to a string.
|
14 |
-
*
|
15 |
-
* @return string
|
16 |
-
*
|
17 |
-
* @deprecated str will be removed in guzzlehttp/psr7:2.0. Use Message::toString instead.
|
18 |
-
*/
|
19 |
-
function str(MessageInterface $message)
|
20 |
-
{
|
21 |
-
return Message::toString($message);
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Returns a UriInterface for the given value.
|
26 |
-
*
|
27 |
-
* This function accepts a string or UriInterface and returns a
|
28 |
-
* UriInterface for the given value. If the value is already a
|
29 |
-
* UriInterface, it is returned as-is.
|
30 |
-
*
|
31 |
-
* @param string|UriInterface $uri
|
32 |
-
*
|
33 |
-
* @return UriInterface
|
34 |
-
*
|
35 |
-
* @throws \InvalidArgumentException
|
36 |
-
*
|
37 |
-
* @deprecated uri_for will be removed in guzzlehttp/psr7:2.0. Use Utils::uriFor instead.
|
38 |
-
*/
|
39 |
-
function uri_for($uri)
|
40 |
-
{
|
41 |
-
return Utils::uriFor($uri);
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Create a new stream based on the input type.
|
46 |
-
*
|
47 |
-
* Options is an associative array that can contain the following keys:
|
48 |
-
* - metadata: Array of custom metadata.
|
49 |
-
* - size: Size of the stream.
|
50 |
-
*
|
51 |
-
* This method accepts the following `$resource` types:
|
52 |
-
* - `Psr\Http\Message\StreamInterface`: Returns the value as-is.
|
53 |
-
* - `string`: Creates a stream object that uses the given string as the contents.
|
54 |
-
* - `resource`: Creates a stream object that wraps the given PHP stream resource.
|
55 |
-
* - `Iterator`: If the provided value implements `Iterator`, then a read-only
|
56 |
-
* stream object will be created that wraps the given iterable. Each time the
|
57 |
-
* stream is read from, data from the iterator will fill a buffer and will be
|
58 |
-
* continuously called until the buffer is equal to the requested read size.
|
59 |
-
* Subsequent read calls will first read from the buffer and then call `next`
|
60 |
-
* on the underlying iterator until it is exhausted.
|
61 |
-
* - `object` with `__toString()`: If the object has the `__toString()` method,
|
62 |
-
* the object will be cast to a string and then a stream will be returned that
|
63 |
-
* uses the string value.
|
64 |
-
* - `NULL`: When `null` is passed, an empty stream object is returned.
|
65 |
-
* - `callable` When a callable is passed, a read-only stream object will be
|
66 |
-
* created that invokes the given callable. The callable is invoked with the
|
67 |
-
* number of suggested bytes to read. The callable can return any number of
|
68 |
-
* bytes, but MUST return `false` when there is no more data to return. The
|
69 |
-
* stream object that wraps the callable will invoke the callable until the
|
70 |
-
* number of requested bytes are available. Any additional bytes will be
|
71 |
-
* buffered and used in subsequent reads.
|
72 |
-
*
|
73 |
-
* @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data
|
74 |
-
* @param array $options Additional options
|
75 |
-
*
|
76 |
-
* @return StreamInterface
|
77 |
-
*
|
78 |
-
* @throws \InvalidArgumentException if the $resource arg is not valid.
|
79 |
-
*
|
80 |
-
* @deprecated stream_for will be removed in guzzlehttp/psr7:2.0. Use Utils::streamFor instead.
|
81 |
-
*/
|
82 |
-
function stream_for($resource = '', array $options = [])
|
83 |
-
{
|
84 |
-
return Utils::streamFor($resource, $options);
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Parse an array of header values containing ";" separated data into an
|
89 |
-
* array of associative arrays representing the header key value pair data
|
90 |
-
* of the header. When a parameter does not contain a value, but just
|
91 |
-
* contains a key, this function will inject a key with a '' string value.
|
92 |
-
*
|
93 |
-
* @param string|array $header Header to parse into components.
|
94 |
-
*
|
95 |
-
* @return array Returns the parsed header values.
|
96 |
-
*
|
97 |
-
* @deprecated parse_header will be removed in guzzlehttp/psr7:2.0. Use Header::parse instead.
|
98 |
-
*/
|
99 |
-
function parse_header($header)
|
100 |
-
{
|
101 |
-
return Header::parse($header);
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Converts an array of header values that may contain comma separated
|
106 |
-
* headers into an array of headers with no comma separated values.
|
107 |
-
*
|
108 |
-
* @param string|array $header Header to normalize.
|
109 |
-
*
|
110 |
-
* @return array Returns the normalized header field values.
|
111 |
-
*
|
112 |
-
* @deprecated normalize_header will be removed in guzzlehttp/psr7:2.0. Use Header::normalize instead.
|
113 |
-
*/
|
114 |
-
function normalize_header($header)
|
115 |
-
{
|
116 |
-
return Header::normalize($header);
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Clone and modify a request with the given changes.
|
121 |
-
*
|
122 |
-
* This method is useful for reducing the number of clones needed to mutate a
|
123 |
-
* message.
|
124 |
-
*
|
125 |
-
* The changes can be one of:
|
126 |
-
* - method: (string) Changes the HTTP method.
|
127 |
-
* - set_headers: (array) Sets the given headers.
|
128 |
-
* - remove_headers: (array) Remove the given headers.
|
129 |
-
* - body: (mixed) Sets the given body.
|
130 |
-
* - uri: (UriInterface) Set the URI.
|
131 |
-
* - query: (string) Set the query string value of the URI.
|
132 |
-
* - version: (string) Set the protocol version.
|
133 |
-
*
|
134 |
-
* @param RequestInterface $request Request to clone and modify.
|
135 |
-
* @param array $changes Changes to apply.
|
136 |
-
*
|
137 |
-
* @return RequestInterface
|
138 |
-
*
|
139 |
-
* @deprecated modify_request will be removed in guzzlehttp/psr7:2.0. Use Utils::modifyRequest instead.
|
140 |
-
*/
|
141 |
-
function modify_request(RequestInterface $request, array $changes)
|
142 |
-
{
|
143 |
-
return Utils::modifyRequest($request, $changes);
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Attempts to rewind a message body and throws an exception on failure.
|
148 |
-
*
|
149 |
-
* The body of the message will only be rewound if a call to `tell()` returns a
|
150 |
-
* value other than `0`.
|
151 |
-
*
|
152 |
-
* @param MessageInterface $message Message to rewind
|
153 |
-
*
|
154 |
-
* @throws \RuntimeException
|
155 |
-
*
|
156 |
-
* @deprecated rewind_body will be removed in guzzlehttp/psr7:2.0. Use Message::rewindBody instead.
|
157 |
-
*/
|
158 |
-
function rewind_body(MessageInterface $message)
|
159 |
-
{
|
160 |
-
Message::rewindBody($message);
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Safely opens a PHP stream resource using a filename.
|
165 |
-
*
|
166 |
-
* When fopen fails, PHP normally raises a warning. This function adds an
|
167 |
-
* error handler that checks for errors and throws an exception instead.
|
168 |
-
*
|
169 |
-
* @param string $filename File to open
|
170 |
-
* @param string $mode Mode used to open the file
|
171 |
-
*
|
172 |
-
* @return resource
|
173 |
-
*
|
174 |
-
* @throws \RuntimeException if the file cannot be opened
|
175 |
-
*
|
176 |
-
* @deprecated try_fopen will be removed in guzzlehttp/psr7:2.0. Use Utils::tryFopen instead.
|
177 |
-
*/
|
178 |
-
function try_fopen($filename, $mode)
|
179 |
-
{
|
180 |
-
return Utils::tryFopen($filename, $mode);
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* Copy the contents of a stream into a string until the given number of
|
185 |
-
* bytes have been read.
|
186 |
-
*
|
187 |
-
* @param StreamInterface $stream Stream to read
|
188 |
-
* @param int $maxLen Maximum number of bytes to read. Pass -1
|
189 |
-
* to read the entire stream.
|
190 |
-
* @return string
|
191 |
-
*
|
192 |
-
* @throws \RuntimeException on error.
|
193 |
-
*
|
194 |
-
* @deprecated copy_to_string will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToString instead.
|
195 |
-
*/
|
196 |
-
function copy_to_string(StreamInterface $stream, $maxLen = -1)
|
197 |
-
{
|
198 |
-
return Utils::copyToString($stream, $maxLen);
|
199 |
-
}
|
200 |
-
|
201 |
-
/**
|
202 |
-
* Copy the contents of a stream into another stream until the given number
|
203 |
-
* of bytes have been read.
|
204 |
-
*
|
205 |
-
* @param StreamInterface $source Stream to read from
|
206 |
-
* @param StreamInterface $dest Stream to write to
|
207 |
-
* @param int $maxLen Maximum number of bytes to read. Pass -1
|
208 |
-
* to read the entire stream.
|
209 |
-
*
|
210 |
-
* @throws \RuntimeException on error.
|
211 |
-
*
|
212 |
-
* @deprecated copy_to_stream will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToStream instead.
|
213 |
-
*/
|
214 |
-
function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)
|
215 |
-
{
|
216 |
-
return Utils::copyToStream($source, $dest, $maxLen);
|
217 |
-
}
|
218 |
-
|
219 |
-
/**
|
220 |
-
* Calculate a hash of a stream.
|
221 |
-
*
|
222 |
-
* This method reads the entire stream to calculate a rolling hash, based on
|
223 |
-
* PHP's `hash_init` functions.
|
224 |
-
*
|
225 |
-
* @param StreamInterface $stream Stream to calculate the hash for
|
226 |
-
* @param string $algo Hash algorithm (e.g. md5, crc32, etc)
|
227 |
-
* @param bool $rawOutput Whether or not to use raw output
|
228 |
-
*
|
229 |
-
* @return string Returns the hash of the stream
|
230 |
-
*
|
231 |
-
* @throws \RuntimeException on error.
|
232 |
-
*
|
233 |
-
* @deprecated hash will be removed in guzzlehttp/psr7:2.0. Use Utils::hash instead.
|
234 |
-
*/
|
235 |
-
function hash(StreamInterface $stream, $algo, $rawOutput = false)
|
236 |
-
{
|
237 |
-
return Utils::hash($stream, $algo, $rawOutput);
|
238 |
-
}
|
239 |
-
|
240 |
-
/**
|
241 |
-
* Read a line from the stream up to the maximum allowed buffer length.
|
242 |
-
*
|
243 |
-
* @param StreamInterface $stream Stream to read from
|
244 |
-
* @param int|null $maxLength Maximum buffer length
|
245 |
-
*
|
246 |
-
* @return string
|
247 |
-
*
|
248 |
-
* @deprecated readline will be removed in guzzlehttp/psr7:2.0. Use Utils::readLine instead.
|
249 |
-
*/
|
250 |
-
function readline(StreamInterface $stream, $maxLength = null)
|
251 |
-
{
|
252 |
-
return Utils::readLine($stream, $maxLength);
|
253 |
-
}
|
254 |
-
|
255 |
-
/**
|
256 |
-
* Parses a request message string into a request object.
|
257 |
-
*
|
258 |
-
* @param string $message Request message string.
|
259 |
-
*
|
260 |
-
* @return Request
|
261 |
-
*
|
262 |
-
* @deprecated parse_request will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequest instead.
|
263 |
-
*/
|
264 |
-
function parse_request($message)
|
265 |
-
{
|
266 |
-
return Message::parseRequest($message);
|
267 |
-
}
|
268 |
-
|
269 |
-
/**
|
270 |
-
* Parses a response message string into a response object.
|
271 |
-
*
|
272 |
-
* @param string $message Response message string.
|
273 |
-
*
|
274 |
-
* @return Response
|
275 |
-
*
|
276 |
-
* @deprecated parse_response will be removed in guzzlehttp/psr7:2.0. Use Message::parseResponse instead.
|
277 |
-
*/
|
278 |
-
function parse_response($message)
|
279 |
-
{
|
280 |
-
return Message::parseResponse($message);
|
281 |
-
}
|
282 |
-
|
283 |
-
/**
|
284 |
-
* Parse a query string into an associative array.
|
285 |
-
*
|
286 |
-
* If multiple values are found for the same key, the value of that key value
|
287 |
-
* pair will become an array. This function does not parse nested PHP style
|
288 |
-
* arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed
|
289 |
-
* into `['foo[a]' => '1', 'foo[b]' => '2'])`.
|
290 |
-
*
|
291 |
-
* @param string $str Query string to parse
|
292 |
-
* @param int|bool $urlEncoding How the query string is encoded
|
293 |
-
*
|
294 |
-
* @return array
|
295 |
-
*
|
296 |
-
* @deprecated parse_query will be removed in guzzlehttp/psr7:2.0. Use Query::parse instead.
|
297 |
-
*/
|
298 |
-
function parse_query($str, $urlEncoding = true)
|
299 |
-
{
|
300 |
-
return Query::parse($str, $urlEncoding);
|
301 |
-
}
|
302 |
-
|
303 |
-
/**
|
304 |
-
* Build a query string from an array of key value pairs.
|
305 |
-
*
|
306 |
-
* This function can use the return value of `parse_query()` to build a query
|
307 |
-
* string. This function does not modify the provided keys when an array is
|
308 |
-
* encountered (like `http_build_query()` would).
|
309 |
-
*
|
310 |
-
* @param array $params Query string parameters.
|
311 |
-
* @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
|
312 |
-
* to encode using RFC3986, or PHP_QUERY_RFC1738
|
313 |
-
* to encode using RFC1738.
|
314 |
-
* @return string
|
315 |
-
*
|
316 |
-
* @deprecated build_query will be removed in guzzlehttp/psr7:2.0. Use Query::build instead.
|
317 |
-
*/
|
318 |
-
function build_query(array $params, $encoding = PHP_QUERY_RFC3986)
|
319 |
-
{
|
320 |
-
return Query::build($params, $encoding);
|
321 |
-
}
|
322 |
-
|
323 |
-
/**
|
324 |
-
* Determines the mimetype of a file by looking at its extension.
|
325 |
-
*
|
326 |
-
* @param string $filename
|
327 |
-
*
|
328 |
-
* @return string|null
|
329 |
-
*
|
330 |
-
* @deprecated mimetype_from_filename will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromFilename instead.
|
331 |
-
*/
|
332 |
-
function mimetype_from_filename($filename)
|
333 |
-
{
|
334 |
-
return MimeType::fromFilename($filename);
|
335 |
-
}
|
336 |
-
|
337 |
-
/**
|
338 |
-
* Maps a file extensions to a mimetype.
|
339 |
-
*
|
340 |
-
* @param $extension string The file extension.
|
341 |
-
*
|
342 |
-
* @return string|null
|
343 |
-
*
|
344 |
-
* @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
|
345 |
-
* @deprecated mimetype_from_extension will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromExtension instead.
|
346 |
-
*/
|
347 |
-
function mimetype_from_extension($extension)
|
348 |
-
{
|
349 |
-
return MimeType::fromExtension($extension);
|
350 |
-
}
|
351 |
-
|
352 |
-
/**
|
353 |
-
* Parses an HTTP message into an associative array.
|
354 |
-
*
|
355 |
-
* The array contains the "start-line" key containing the start line of
|
356 |
-
* the message, "headers" key containing an associative array of header
|
357 |
-
* array values, and a "body" key containing the body of the message.
|
358 |
-
*
|
359 |
-
* @param string $message HTTP request or response to parse.
|
360 |
-
*
|
361 |
-
* @return array
|
362 |
-
*
|
363 |
-
* @internal
|
364 |
-
* @deprecated _parse_message will be removed in guzzlehttp/psr7:2.0. Use Message::parseMessage instead.
|
365 |
-
*/
|
366 |
-
function _parse_message($message)
|
367 |
-
{
|
368 |
-
return Message::parseMessage($message);
|
369 |
-
}
|
370 |
-
|
371 |
-
/**
|
372 |
-
* Constructs a URI for an HTTP request message.
|
373 |
-
*
|
374 |
-
* @param string $path Path from the start-line
|
375 |
-
* @param array $headers Array of headers (each value an array).
|
376 |
-
*
|
377 |
-
* @return string
|
378 |
-
*
|
379 |
-
* @internal
|
380 |
-
* @deprecated _parse_request_uri will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequestUri instead.
|
381 |
-
*/
|
382 |
-
function _parse_request_uri($path, array $headers)
|
383 |
-
{
|
384 |
-
return Message::parseRequestUri($path, $headers);
|
385 |
-
}
|
386 |
-
|
387 |
-
/**
|
388 |
-
* Get a short summary of the message body.
|
389 |
-
*
|
390 |
-
* Will return `null` if the response is not printable.
|
391 |
-
*
|
392 |
-
* @param MessageInterface $message The message to get the body summary
|
393 |
-
* @param int $truncateAt The maximum allowed size of the summary
|
394 |
-
*
|
395 |
-
* @return string|null
|
396 |
-
*
|
397 |
-
* @deprecated get_message_body_summary will be removed in guzzlehttp/psr7:2.0. Use Message::bodySummary instead.
|
398 |
-
*/
|
399 |
-
function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
|
400 |
-
{
|
401 |
-
return Message::bodySummary($message, $truncateAt);
|
402 |
-
}
|
403 |
-
|
404 |
-
/**
|
405 |
-
* Remove the items given by the keys, case insensitively from the data.
|
406 |
-
*
|
407 |
-
* @param iterable<string> $keys
|
408 |
-
*
|
409 |
-
* @return array
|
410 |
-
*
|
411 |
-
* @internal
|
412 |
-
* @deprecated _caseless_remove will be removed in guzzlehttp/psr7:2.0. Use Utils::caselessRemove instead.
|
413 |
-
*/
|
414 |
-
function _caseless_remove($keys, array $data)
|
415 |
-
{
|
416 |
-
return Utils::caselessRemove($keys, $data);
|
417 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/psr7/src/functions_include.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Don't redefine the functions if included multiple times.
|
4 |
-
if (!function_exists('GuzzleHttp\Psr7\str')) {
|
5 |
-
require __DIR__ . '/functions.php';
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-client/CHANGELOG.md
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
# Changelog
|
2 |
-
|
3 |
-
All notable changes to this project will be documented in this file, in reverse chronological order by release.
|
4 |
-
|
5 |
-
## 1.0.1
|
6 |
-
|
7 |
-
Allow installation with PHP 8. No code changes.
|
8 |
-
|
9 |
-
## 1.0.0
|
10 |
-
|
11 |
-
First stable release. No changes since 0.3.0.
|
12 |
-
|
13 |
-
## 0.3.0
|
14 |
-
|
15 |
-
Added Interface suffix on exceptions
|
16 |
-
|
17 |
-
## 0.2.0
|
18 |
-
|
19 |
-
All exceptions are in `Psr\Http\Client` namespace
|
20 |
-
|
21 |
-
## 0.1.0
|
22 |
-
|
23 |
-
First release
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-client/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
Copyright (c) 2017 PHP Framework Interoperability Group
|
2 |
-
|
3 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
-
of this software and associated documentation files (the "Software"), to deal
|
5 |
-
in the Software without restriction, including without limitation the rights
|
6 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
-
copies of the Software, and to permit persons to whom the Software is
|
8 |
-
furnished to do so, subject to the following conditions:
|
9 |
-
|
10 |
-
The above copyright notice and this permission notice shall be included in
|
11 |
-
all copies or substantial portions of the Software.
|
12 |
-
|
13 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-client/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
HTTP Client
|
2 |
-
===========
|
3 |
-
|
4 |
-
This repository holds all the common code related to [PSR-18 (HTTP Client)][psr-url].
|
5 |
-
|
6 |
-
Note that this is not a HTTP Client implementation of its own. It is merely abstractions that describe the components of a HTTP Client.
|
7 |
-
|
8 |
-
The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist.
|
9 |
-
|
10 |
-
[psr-url]: http://www.php-fig.org/psr/psr-18
|
11 |
-
[package-url]: https://packagist.org/packages/psr/http-client
|
12 |
-
[implementation-url]: https://packagist.org/providers/psr/http-client-implementation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-client/composer.json
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "psr/http-client",
|
3 |
-
"description": "Common interface for HTTP clients",
|
4 |
-
"keywords": ["psr", "psr-18", "http", "http-client"],
|
5 |
-
"homepage": "https://github.com/php-fig/http-client",
|
6 |
-
"license": "MIT",
|
7 |
-
"authors": [
|
8 |
-
{
|
9 |
-
"name": "PHP-FIG",
|
10 |
-
"homepage": "http://www.php-fig.org/"
|
11 |
-
}
|
12 |
-
],
|
13 |
-
"require": {
|
14 |
-
"php": "^7.0 || ^8.0",
|
15 |
-
"psr/http-message": "^1.0"
|
16 |
-
},
|
17 |
-
"autoload": {
|
18 |
-
"psr-4": {
|
19 |
-
"Psr\\Http\\Client\\": "src/"
|
20 |
-
}
|
21 |
-
},
|
22 |
-
"extra": {
|
23 |
-
"branch-alias": {
|
24 |
-
"dev-master": "1.0.x-dev"
|
25 |
-
}
|
26 |
-
}
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-client/src/ClientExceptionInterface.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Client;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Every HTTP client related exception MUST implement this interface.
|
7 |
-
*/
|
8 |
-
interface ClientExceptionInterface extends \Throwable
|
9 |
-
{
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-client/src/ClientInterface.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Client;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
use Psr\Http\Message\ResponseInterface;
|
7 |
-
|
8 |
-
interface ClientInterface
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* Sends a PSR-7 request and returns a PSR-7 response.
|
12 |
-
*
|
13 |
-
* @param RequestInterface $request
|
14 |
-
*
|
15 |
-
* @return ResponseInterface
|
16 |
-
*
|
17 |
-
* @throws \Psr\Http\Client\ClientExceptionInterface If an error happens while processing the request.
|
18 |
-
*/
|
19 |
-
public function sendRequest(RequestInterface $request): ResponseInterface;
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-client/src/NetworkExceptionInterface.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Client;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Thrown when the request cannot be completed because of network issues.
|
9 |
-
*
|
10 |
-
* There is no response object as this exception is thrown when no response has been received.
|
11 |
-
*
|
12 |
-
* Example: the target host name can not be resolved or the connection failed.
|
13 |
-
*/
|
14 |
-
interface NetworkExceptionInterface extends ClientExceptionInterface
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* Returns the request.
|
18 |
-
*
|
19 |
-
* The request object MAY be a different object from the one passed to ClientInterface::sendRequest()
|
20 |
-
*
|
21 |
-
* @return RequestInterface
|
22 |
-
*/
|
23 |
-
public function getRequest(): RequestInterface;
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-client/src/RequestExceptionInterface.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Client;
|
4 |
-
|
5 |
-
use Psr\Http\Message\RequestInterface;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Exception for when a request failed.
|
9 |
-
*
|
10 |
-
* Examples:
|
11 |
-
* - Request is invalid (e.g. method is missing)
|
12 |
-
* - Runtime request errors (e.g. the body stream is not seekable)
|
13 |
-
*/
|
14 |
-
interface RequestExceptionInterface extends ClientExceptionInterface
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* Returns the request.
|
18 |
-
*
|
19 |
-
* The request object MAY be a different object from the one passed to ClientInterface::sendRequest()
|
20 |
-
*
|
21 |
-
* @return RequestInterface
|
22 |
-
*/
|
23 |
-
public function getRequest(): RequestInterface;
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/CHANGELOG.md
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
# Changelog
|
2 |
-
|
3 |
-
All notable changes to this project will be documented in this file, in reverse chronological order by release.
|
4 |
-
|
5 |
-
## 1.0.1 - 2016-08-06
|
6 |
-
|
7 |
-
### Added
|
8 |
-
|
9 |
-
- Nothing.
|
10 |
-
|
11 |
-
### Deprecated
|
12 |
-
|
13 |
-
- Nothing.
|
14 |
-
|
15 |
-
### Removed
|
16 |
-
|
17 |
-
- Nothing.
|
18 |
-
|
19 |
-
### Fixed
|
20 |
-
|
21 |
-
- Updated all `@return self` annotation references in interfaces to use
|
22 |
-
`@return static`, which more closelly follows the semantics of the
|
23 |
-
specification.
|
24 |
-
- Updated the `MessageInterface::getHeaders()` return annotation to use the
|
25 |
-
value `string[][]`, indicating the format is a nested array of strings.
|
26 |
-
- Updated the `@link` annotation for `RequestInterface::withRequestTarget()`
|
27 |
-
to point to the correct section of RFC 7230.
|
28 |
-
- Updated the `ServerRequestInterface::withUploadedFiles()` parameter annotation
|
29 |
-
to add the parameter name (`$uploadedFiles`).
|
30 |
-
- Updated a `@throws` annotation for the `UploadedFileInterface::moveTo()`
|
31 |
-
method to correctly reference the method parameter (it was referencing an
|
32 |
-
incorrect parameter name previously).
|
33 |
-
|
34 |
-
## 1.0.0 - 2016-05-18
|
35 |
-
|
36 |
-
Initial stable release; reflects accepted PSR-7 specification.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
Copyright (c) 2014 PHP Framework Interoperability Group
|
2 |
-
|
3 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
-
of this software and associated documentation files (the "Software"), to deal
|
5 |
-
in the Software without restriction, including without limitation the rights
|
6 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
-
copies of the Software, and to permit persons to whom the Software is
|
8 |
-
furnished to do so, subject to the following conditions:
|
9 |
-
|
10 |
-
The above copyright notice and this permission notice shall be included in
|
11 |
-
all copies or substantial portions of the Software.
|
12 |
-
|
13 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
PSR Http Message
|
2 |
-
================
|
3 |
-
|
4 |
-
This repository holds all interfaces/classes/traits related to
|
5 |
-
[PSR-7](http://www.php-fig.org/psr/psr-7/).
|
6 |
-
|
7 |
-
Note that this is not a HTTP message implementation of its own. It is merely an
|
8 |
-
interface that describes a HTTP message. See the specification for more details.
|
9 |
-
|
10 |
-
Usage
|
11 |
-
-----
|
12 |
-
|
13 |
-
We'll certainly need some stuff in here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/composer.json
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "psr/http-message",
|
3 |
-
"description": "Common interface for HTTP messages",
|
4 |
-
"keywords": ["psr", "psr-7", "http", "http-message", "request", "response"],
|
5 |
-
"homepage": "https://github.com/php-fig/http-message",
|
6 |
-
"license": "MIT",
|
7 |
-
"authors": [
|
8 |
-
{
|
9 |
-
"name": "PHP-FIG",
|
10 |
-
"homepage": "http://www.php-fig.org/"
|
11 |
-
}
|
12 |
-
],
|
13 |
-
"require": {
|
14 |
-
"php": ">=5.3.0"
|
15 |
-
},
|
16 |
-
"autoload": {
|
17 |
-
"psr-4": {
|
18 |
-
"Psr\\Http\\Message\\": "src/"
|
19 |
-
}
|
20 |
-
},
|
21 |
-
"extra": {
|
22 |
-
"branch-alias": {
|
23 |
-
"dev-master": "1.0.x-dev"
|
24 |
-
}
|
25 |
-
}
|
26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/src/MessageInterface.php
DELETED
@@ -1,187 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Message;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* HTTP messages consist of requests from a client to a server and responses
|
7 |
-
* from a server to a client. This interface defines the methods common to
|
8 |
-
* each.
|
9 |
-
*
|
10 |
-
* Messages are considered immutable; all methods that might change state MUST
|
11 |
-
* be implemented such that they retain the internal state of the current
|
12 |
-
* message and return an instance that contains the changed state.
|
13 |
-
*
|
14 |
-
* @link http://www.ietf.org/rfc/rfc7230.txt
|
15 |
-
* @link http://www.ietf.org/rfc/rfc7231.txt
|
16 |
-
*/
|
17 |
-
interface MessageInterface
|
18 |
-
{
|
19 |
-
/**
|
20 |
-
* Retrieves the HTTP protocol version as a string.
|
21 |
-
*
|
22 |
-
* The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").
|
23 |
-
*
|
24 |
-
* @return string HTTP protocol version.
|
25 |
-
*/
|
26 |
-
public function getProtocolVersion();
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Return an instance with the specified HTTP protocol version.
|
30 |
-
*
|
31 |
-
* The version string MUST contain only the HTTP version number (e.g.,
|
32 |
-
* "1.1", "1.0").
|
33 |
-
*
|
34 |
-
* This method MUST be implemented in such a way as to retain the
|
35 |
-
* immutability of the message, and MUST return an instance that has the
|
36 |
-
* new protocol version.
|
37 |
-
*
|
38 |
-
* @param string $version HTTP protocol version
|
39 |
-
* @return static
|
40 |
-
*/
|
41 |
-
public function withProtocolVersion($version);
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Retrieves all message header values.
|
45 |
-
*
|
46 |
-
* The keys represent the header name as it will be sent over the wire, and
|
47 |
-
* each value is an array of strings associated with the header.
|
48 |
-
*
|
49 |
-
* // Represent the headers as a string
|
50 |
-
* foreach ($message->getHeaders() as $name => $values) {
|
51 |
-
* echo $name . ": " . implode(", ", $values);
|
52 |
-
* }
|
53 |
-
*
|
54 |
-
* // Emit headers iteratively:
|
55 |
-
* foreach ($message->getHeaders() as $name => $values) {
|
56 |
-
* foreach ($values as $value) {
|
57 |
-
* header(sprintf('%s: %s', $name, $value), false);
|
58 |
-
* }
|
59 |
-
* }
|
60 |
-
*
|
61 |
-
* While header names are not case-sensitive, getHeaders() will preserve the
|
62 |
-
* exact case in which headers were originally specified.
|
63 |
-
*
|
64 |
-
* @return string[][] Returns an associative array of the message's headers. Each
|
65 |
-
* key MUST be a header name, and each value MUST be an array of strings
|
66 |
-
* for that header.
|
67 |
-
*/
|
68 |
-
public function getHeaders();
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Checks if a header exists by the given case-insensitive name.
|
72 |
-
*
|
73 |
-
* @param string $name Case-insensitive header field name.
|
74 |
-
* @return bool Returns true if any header names match the given header
|
75 |
-
* name using a case-insensitive string comparison. Returns false if
|
76 |
-
* no matching header name is found in the message.
|
77 |
-
*/
|
78 |
-
public function hasHeader($name);
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Retrieves a message header value by the given case-insensitive name.
|
82 |
-
*
|
83 |
-
* This method returns an array of all the header values of the given
|
84 |
-
* case-insensitive header name.
|
85 |
-
*
|
86 |
-
* If the header does not appear in the message, this method MUST return an
|
87 |
-
* empty array.
|
88 |
-
*
|
89 |
-
* @param string $name Case-insensitive header field name.
|
90 |
-
* @return string[] An array of string values as provided for the given
|
91 |
-
* header. If the header does not appear in the message, this method MUST
|
92 |
-
* return an empty array.
|
93 |
-
*/
|
94 |
-
public function getHeader($name);
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Retrieves a comma-separated string of the values for a single header.
|
98 |
-
*
|
99 |
-
* This method returns all of the header values of the given
|
100 |
-
* case-insensitive header name as a string concatenated together using
|
101 |
-
* a comma.
|
102 |
-
*
|
103 |
-
* NOTE: Not all header values may be appropriately represented using
|
104 |
-
* comma concatenation. For such headers, use getHeader() instead
|
105 |
-
* and supply your own delimiter when concatenating.
|
106 |
-
*
|
107 |
-
* If the header does not appear in the message, this method MUST return
|
108 |
-
* an empty string.
|
109 |
-
*
|
110 |
-
* @param string $name Case-insensitive header field name.
|
111 |
-
* @return string A string of values as provided for the given header
|
112 |
-
* concatenated together using a comma. If the header does not appear in
|
113 |
-
* the message, this method MUST return an empty string.
|
114 |
-
*/
|
115 |
-
public function getHeaderLine($name);
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Return an instance with the provided value replacing the specified header.
|
119 |
-
*
|
120 |
-
* While header names are case-insensitive, the casing of the header will
|
121 |
-
* be preserved by this function, and returned from getHeaders().
|
122 |
-
*
|
123 |
-
* This method MUST be implemented in such a way as to retain the
|
124 |
-
* immutability of the message, and MUST return an instance that has the
|
125 |
-
* new and/or updated header and value.
|
126 |
-
*
|
127 |
-
* @param string $name Case-insensitive header field name.
|
128 |
-
* @param string|string[] $value Header value(s).
|
129 |
-
* @return static
|
130 |
-
* @throws \InvalidArgumentException for invalid header names or values.
|
131 |
-
*/
|
132 |
-
public function withHeader($name, $value);
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Return an instance with the specified header appended with the given value.
|
136 |
-
*
|
137 |
-
* Existing values for the specified header will be maintained. The new
|
138 |
-
* value(s) will be appended to the existing list. If the header did not
|
139 |
-
* exist previously, it will be added.
|
140 |
-
*
|
141 |
-
* This method MUST be implemented in such a way as to retain the
|
142 |
-
* immutability of the message, and MUST return an instance that has the
|
143 |
-
* new header and/or value.
|
144 |
-
*
|
145 |
-
* @param string $name Case-insensitive header field name to add.
|
146 |
-
* @param string|string[] $value Header value(s).
|
147 |
-
* @return static
|
148 |
-
* @throws \InvalidArgumentException for invalid header names or values.
|
149 |
-
*/
|
150 |
-
public function withAddedHeader($name, $value);
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Return an instance without the specified header.
|
154 |
-
*
|
155 |
-
* Header resolution MUST be done without case-sensitivity.
|
156 |
-
*
|
157 |
-
* This method MUST be implemented in such a way as to retain the
|
158 |
-
* immutability of the message, and MUST return an instance that removes
|
159 |
-
* the named header.
|
160 |
-
*
|
161 |
-
* @param string $name Case-insensitive header field name to remove.
|
162 |
-
* @return static
|
163 |
-
*/
|
164 |
-
public function withoutHeader($name);
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Gets the body of the message.
|
168 |
-
*
|
169 |
-
* @return StreamInterface Returns the body as a stream.
|
170 |
-
*/
|
171 |
-
public function getBody();
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Return an instance with the specified message body.
|
175 |
-
*
|
176 |
-
* The body MUST be a StreamInterface object.
|
177 |
-
*
|
178 |
-
* This method MUST be implemented in such a way as to retain the
|
179 |
-
* immutability of the message, and MUST return a new instance that has the
|
180 |
-
* new body stream.
|
181 |
-
*
|
182 |
-
* @param StreamInterface $body Body.
|
183 |
-
* @return static
|
184 |
-
* @throws \InvalidArgumentException When the body is not valid.
|
185 |
-
*/
|
186 |
-
public function withBody(StreamInterface $body);
|
187 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/src/RequestInterface.php
DELETED
@@ -1,129 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Message;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Representation of an outgoing, client-side request.
|
7 |
-
*
|
8 |
-
* Per the HTTP specification, this interface includes properties for
|
9 |
-
* each of the following:
|
10 |
-
*
|
11 |
-
* - Protocol version
|
12 |
-
* - HTTP method
|
13 |
-
* - URI
|
14 |
-
* - Headers
|
15 |
-
* - Message body
|
16 |
-
*
|
17 |
-
* During construction, implementations MUST attempt to set the Host header from
|
18 |
-
* a provided URI if no Host header is provided.
|
19 |
-
*
|
20 |
-
* Requests are considered immutable; all methods that might change state MUST
|
21 |
-
* be implemented such that they retain the internal state of the current
|
22 |
-
* message and return an instance that contains the changed state.
|
23 |
-
*/
|
24 |
-
interface RequestInterface extends MessageInterface
|
25 |
-
{
|
26 |
-
/**
|
27 |
-
* Retrieves the message's request target.
|
28 |
-
*
|
29 |
-
* Retrieves the message's request-target either as it will appear (for
|
30 |
-
* clients), as it appeared at request (for servers), or as it was
|
31 |
-
* specified for the instance (see withRequestTarget()).
|
32 |
-
*
|
33 |
-
* In most cases, this will be the origin-form of the composed URI,
|
34 |
-
* unless a value was provided to the concrete implementation (see
|
35 |
-
* withRequestTarget() below).
|
36 |
-
*
|
37 |
-
* If no URI is available, and no request-target has been specifically
|
38 |
-
* provided, this method MUST return the string "/".
|
39 |
-
*
|
40 |
-
* @return string
|
41 |
-
*/
|
42 |
-
public function getRequestTarget();
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Return an instance with the specific request-target.
|
46 |
-
*
|
47 |
-
* If the request needs a non-origin-form request-target — e.g., for
|
48 |
-
* specifying an absolute-form, authority-form, or asterisk-form —
|
49 |
-
* this method may be used to create an instance with the specified
|
50 |
-
* request-target, verbatim.
|
51 |
-
*
|
52 |
-
* This method MUST be implemented in such a way as to retain the
|
53 |
-
* immutability of the message, and MUST return an instance that has the
|
54 |
-
* changed request target.
|
55 |
-
*
|
56 |
-
* @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
|
57 |
-
* request-target forms allowed in request messages)
|
58 |
-
* @param mixed $requestTarget
|
59 |
-
* @return static
|
60 |
-
*/
|
61 |
-
public function withRequestTarget($requestTarget);
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Retrieves the HTTP method of the request.
|
65 |
-
*
|
66 |
-
* @return string Returns the request method.
|
67 |
-
*/
|
68 |
-
public function getMethod();
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Return an instance with the provided HTTP method.
|
72 |
-
*
|
73 |
-
* While HTTP method names are typically all uppercase characters, HTTP
|
74 |
-
* method names are case-sensitive and thus implementations SHOULD NOT
|
75 |
-
* modify the given string.
|
76 |
-
*
|
77 |
-
* This method MUST be implemented in such a way as to retain the
|
78 |
-
* immutability of the message, and MUST return an instance that has the
|
79 |
-
* changed request method.
|
80 |
-
*
|
81 |
-
* @param string $method Case-sensitive method.
|
82 |
-
* @return static
|
83 |
-
* @throws \InvalidArgumentException for invalid HTTP methods.
|
84 |
-
*/
|
85 |
-
public function withMethod($method);
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Retrieves the URI instance.
|
89 |
-
*
|
90 |
-
* This method MUST return a UriInterface instance.
|
91 |
-
*
|
92 |
-
* @link http://tools.ietf.org/html/rfc3986#section-4.3
|
93 |
-
* @return UriInterface Returns a UriInterface instance
|
94 |
-
* representing the URI of the request.
|
95 |
-
*/
|
96 |
-
public function getUri();
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Returns an instance with the provided URI.
|
100 |
-
*
|
101 |
-
* This method MUST update the Host header of the returned request by
|
102 |
-
* default if the URI contains a host component. If the URI does not
|
103 |
-
* contain a host component, any pre-existing Host header MUST be carried
|
104 |
-
* over to the returned request.
|
105 |
-
*
|
106 |
-
* You can opt-in to preserving the original state of the Host header by
|
107 |
-
* setting `$preserveHost` to `true`. When `$preserveHost` is set to
|
108 |
-
* `true`, this method interacts with the Host header in the following ways:
|
109 |
-
*
|
110 |
-
* - If the Host header is missing or empty, and the new URI contains
|
111 |
-
* a host component, this method MUST update the Host header in the returned
|
112 |
-
* request.
|
113 |
-
* - If the Host header is missing or empty, and the new URI does not contain a
|
114 |
-
* host component, this method MUST NOT update the Host header in the returned
|
115 |
-
* request.
|
116 |
-
* - If a Host header is present and non-empty, this method MUST NOT update
|
117 |
-
* the Host header in the returned request.
|
118 |
-
*
|
119 |
-
* This method MUST be implemented in such a way as to retain the
|
120 |
-
* immutability of the message, and MUST return an instance that has the
|
121 |
-
* new UriInterface instance.
|
122 |
-
*
|
123 |
-
* @link http://tools.ietf.org/html/rfc3986#section-4.3
|
124 |
-
* @param UriInterface $uri New request URI to use.
|
125 |
-
* @param bool $preserveHost Preserve the original state of the Host header.
|
126 |
-
* @return static
|
127 |
-
*/
|
128 |
-
public function withUri(UriInterface $uri, $preserveHost = false);
|
129 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/src/ResponseInterface.php
DELETED
@@ -1,68 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Message;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Representation of an outgoing, server-side response.
|
7 |
-
*
|
8 |
-
* Per the HTTP specification, this interface includes properties for
|
9 |
-
* each of the following:
|
10 |
-
*
|
11 |
-
* - Protocol version
|
12 |
-
* - Status code and reason phrase
|
13 |
-
* - Headers
|
14 |
-
* - Message body
|
15 |
-
*
|
16 |
-
* Responses are considered immutable; all methods that might change state MUST
|
17 |
-
* be implemented such that they retain the internal state of the current
|
18 |
-
* message and return an instance that contains the changed state.
|
19 |
-
*/
|
20 |
-
interface ResponseInterface extends MessageInterface
|
21 |
-
{
|
22 |
-
/**
|
23 |
-
* Gets the response status code.
|
24 |
-
*
|
25 |
-
* The status code is a 3-digit integer result code of the server's attempt
|
26 |
-
* to understand and satisfy the request.
|
27 |
-
*
|
28 |
-
* @return int Status code.
|
29 |
-
*/
|
30 |
-
public function getStatusCode();
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Return an instance with the specified status code and, optionally, reason phrase.
|
34 |
-
*
|
35 |
-
* If no reason phrase is specified, implementations MAY choose to default
|
36 |
-
* to the RFC 7231 or IANA recommended reason phrase for the response's
|
37 |
-
* status code.
|
38 |
-
*
|
39 |
-
* This method MUST be implemented in such a way as to retain the
|
40 |
-
* immutability of the message, and MUST return an instance that has the
|
41 |
-
* updated status and reason phrase.
|
42 |
-
*
|
43 |
-
* @link http://tools.ietf.org/html/rfc7231#section-6
|
44 |
-
* @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
|
45 |
-
* @param int $code The 3-digit integer result code to set.
|
46 |
-
* @param string $reasonPhrase The reason phrase to use with the
|
47 |
-
* provided status code; if none is provided, implementations MAY
|
48 |
-
* use the defaults as suggested in the HTTP specification.
|
49 |
-
* @return static
|
50 |
-
* @throws \InvalidArgumentException For invalid status code arguments.
|
51 |
-
*/
|
52 |
-
public function withStatus($code, $reasonPhrase = '');
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Gets the response reason phrase associated with the status code.
|
56 |
-
*
|
57 |
-
* Because a reason phrase is not a required element in a response
|
58 |
-
* status line, the reason phrase value MAY be null. Implementations MAY
|
59 |
-
* choose to return the default RFC 7231 recommended reason phrase (or those
|
60 |
-
* listed in the IANA HTTP Status Code Registry) for the response's
|
61 |
-
* status code.
|
62 |
-
*
|
63 |
-
* @link http://tools.ietf.org/html/rfc7231#section-6
|
64 |
-
* @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
|
65 |
-
* @return string Reason phrase; must return an empty string if none present.
|
66 |
-
*/
|
67 |
-
public function getReasonPhrase();
|
68 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/src/ServerRequestInterface.php
DELETED
@@ -1,261 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Message;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Representation of an incoming, server-side HTTP request.
|
7 |
-
*
|
8 |
-
* Per the HTTP specification, this interface includes properties for
|
9 |
-
* each of the following:
|
10 |
-
*
|
11 |
-
* - Protocol version
|
12 |
-
* - HTTP method
|
13 |
-
* - URI
|
14 |
-
* - Headers
|
15 |
-
* - Message body
|
16 |
-
*
|
17 |
-
* Additionally, it encapsulates all data as it has arrived to the
|
18 |
-
* application from the CGI and/or PHP environment, including:
|
19 |
-
*
|
20 |
-
* - The values represented in $_SERVER.
|
21 |
-
* - Any cookies provided (generally via $_COOKIE)
|
22 |
-
* - Query string arguments (generally via $_GET, or as parsed via parse_str())
|
23 |
-
* - Upload files, if any (as represented by $_FILES)
|
24 |
-
* - Deserialized body parameters (generally from $_POST)
|
25 |
-
*
|
26 |
-
* $_SERVER values MUST be treated as immutable, as they represent application
|
27 |
-
* state at the time of request; as such, no methods are provided to allow
|
28 |
-
* modification of those values. The other values provide such methods, as they
|
29 |
-
* can be restored from $_SERVER or the request body, and may need treatment
|
30 |
-
* during the application (e.g., body parameters may be deserialized based on
|
31 |
-
* content type).
|
32 |
-
*
|
33 |
-
* Additionally, this interface recognizes the utility of introspecting a
|
34 |
-
* request to derive and match additional parameters (e.g., via URI path
|
35 |
-
* matching, decrypting cookie values, deserializing non-form-encoded body
|
36 |
-
* content, matching authorization headers to users, etc). These parameters
|
37 |
-
* are stored in an "attributes" property.
|
38 |
-
*
|
39 |
-
* Requests are considered immutable; all methods that might change state MUST
|
40 |
-
* be implemented such that they retain the internal state of the current
|
41 |
-
* message and return an instance that contains the changed state.
|
42 |
-
*/
|
43 |
-
interface ServerRequestInterface extends RequestInterface
|
44 |
-
{
|
45 |
-
/**
|
46 |
-
* Retrieve server parameters.
|
47 |
-
*
|
48 |
-
* Retrieves data related to the incoming request environment,
|
49 |
-
* typically derived from PHP's $_SERVER superglobal. The data IS NOT
|
50 |
-
* REQUIRED to originate from $_SERVER.
|
51 |
-
*
|
52 |
-
* @return array
|
53 |
-
*/
|
54 |
-
public function getServerParams();
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Retrieve cookies.
|
58 |
-
*
|
59 |
-
* Retrieves cookies sent by the client to the server.
|
60 |
-
*
|
61 |
-
* The data MUST be compatible with the structure of the $_COOKIE
|
62 |
-
* superglobal.
|
63 |
-
*
|
64 |
-
* @return array
|
65 |
-
*/
|
66 |
-
public function getCookieParams();
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Return an instance with the specified cookies.
|
70 |
-
*
|
71 |
-
* The data IS NOT REQUIRED to come from the $_COOKIE superglobal, but MUST
|
72 |
-
* be compatible with the structure of $_COOKIE. Typically, this data will
|
73 |
-
* be injected at instantiation.
|
74 |
-
*
|
75 |
-
* This method MUST NOT update the related Cookie header of the request
|
76 |
-
* instance, nor related values in the server params.
|
77 |
-
*
|
78 |
-
* This method MUST be implemented in such a way as to retain the
|
79 |
-
* immutability of the message, and MUST return an instance that has the
|
80 |
-
* updated cookie values.
|
81 |
-
*
|
82 |
-
* @param array $cookies Array of key/value pairs representing cookies.
|
83 |
-
* @return static
|
84 |
-
*/
|
85 |
-
public function withCookieParams(array $cookies);
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Retrieve query string arguments.
|
89 |
-
*
|
90 |
-
* Retrieves the deserialized query string arguments, if any.
|
91 |
-
*
|
92 |
-
* Note: the query params might not be in sync with the URI or server
|
93 |
-
* params. If you need to ensure you are only getting the original
|
94 |
-
* values, you may need to parse the query string from `getUri()->getQuery()`
|
95 |
-
* or from the `QUERY_STRING` server param.
|
96 |
-
*
|
97 |
-
* @return array
|
98 |
-
*/
|
99 |
-
public function getQueryParams();
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Return an instance with the specified query string arguments.
|
103 |
-
*
|
104 |
-
* These values SHOULD remain immutable over the course of the incoming
|
105 |
-
* request. They MAY be injected during instantiation, such as from PHP's
|
106 |
-
* $_GET superglobal, or MAY be derived from some other value such as the
|
107 |
-
* URI. In cases where the arguments are parsed from the URI, the data
|
108 |
-
* MUST be compatible with what PHP's parse_str() would return for
|
109 |
-
* purposes of how duplicate query parameters are handled, and how nested
|
110 |
-
* sets are handled.
|
111 |
-
*
|
112 |
-
* Setting query string arguments MUST NOT change the URI stored by the
|
113 |
-
* request, nor the values in the server params.
|
114 |
-
*
|
115 |
-
* This method MUST be implemented in such a way as to retain the
|
116 |
-
* immutability of the message, and MUST return an instance that has the
|
117 |
-
* updated query string arguments.
|
118 |
-
*
|
119 |
-
* @param array $query Array of query string arguments, typically from
|
120 |
-
* $_GET.
|
121 |
-
* @return static
|
122 |
-
*/
|
123 |
-
public function withQueryParams(array $query);
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Retrieve normalized file upload data.
|
127 |
-
*
|
128 |
-
* This method returns upload metadata in a normalized tree, with each leaf
|
129 |
-
* an instance of Psr\Http\Message\UploadedFileInterface.
|
130 |
-
*
|
131 |
-
* These values MAY be prepared from $_FILES or the message body during
|
132 |
-
* instantiation, or MAY be injected via withUploadedFiles().
|
133 |
-
*
|
134 |
-
* @return array An array tree of UploadedFileInterface instances; an empty
|
135 |
-
* array MUST be returned if no data is present.
|
136 |
-
*/
|
137 |
-
public function getUploadedFiles();
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Create a new instance with the specified uploaded files.
|
141 |
-
*
|
142 |
-
* This method MUST be implemented in such a way as to retain the
|
143 |
-
* immutability of the message, and MUST return an instance that has the
|
144 |
-
* updated body parameters.
|
145 |
-
*
|
146 |
-
* @param array $uploadedFiles An array tree of UploadedFileInterface instances.
|
147 |
-
* @return static
|
148 |
-
* @throws \InvalidArgumentException if an invalid structure is provided.
|
149 |
-
*/
|
150 |
-
public function withUploadedFiles(array $uploadedFiles);
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Retrieve any parameters provided in the request body.
|
154 |
-
*
|
155 |
-
* If the request Content-Type is either application/x-www-form-urlencoded
|
156 |
-
* or multipart/form-data, and the request method is POST, this method MUST
|
157 |
-
* return the contents of $_POST.
|
158 |
-
*
|
159 |
-
* Otherwise, this method may return any results of deserializing
|
160 |
-
* the request body content; as parsing returns structured content, the
|
161 |
-
* potential types MUST be arrays or objects only. A null value indicates
|
162 |
-
* the absence of body content.
|
163 |
-
*
|
164 |
-
* @return null|array|object The deserialized body parameters, if any.
|
165 |
-
* These will typically be an array or object.
|
166 |
-
*/
|
167 |
-
public function getParsedBody();
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Return an instance with the specified body parameters.
|
171 |
-
*
|
172 |
-
* These MAY be injected during instantiation.
|
173 |
-
*
|
174 |
-
* If the request Content-Type is either application/x-www-form-urlencoded
|
175 |
-
* or multipart/form-data, and the request method is POST, use this method
|
176 |
-
* ONLY to inject the contents of $_POST.
|
177 |
-
*
|
178 |
-
* The data IS NOT REQUIRED to come from $_POST, but MUST be the results of
|
179 |
-
* deserializing the request body content. Deserialization/parsing returns
|
180 |
-
* structured data, and, as such, this method ONLY accepts arrays or objects,
|
181 |
-
* or a null value if nothing was available to parse.
|
182 |
-
*
|
183 |
-
* As an example, if content negotiation determines that the request data
|
184 |
-
* is a JSON payload, this method could be used to create a request
|
185 |
-
* instance with the deserialized parameters.
|
186 |
-
*
|
187 |
-
* This method MUST be implemented in such a way as to retain the
|
188 |
-
* immutability of the message, and MUST return an instance that has the
|
189 |
-
* updated body parameters.
|
190 |
-
*
|
191 |
-
* @param null|array|object $data The deserialized body data. This will
|
192 |
-
* typically be in an array or object.
|
193 |
-
* @return static
|
194 |
-
* @throws \InvalidArgumentException if an unsupported argument type is
|
195 |
-
* provided.
|
196 |
-
*/
|
197 |
-
public function withParsedBody($data);
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Retrieve attributes derived from the request.
|
201 |
-
*
|
202 |
-
* The request "attributes" may be used to allow injection of any
|
203 |
-
* parameters derived from the request: e.g., the results of path
|
204 |
-
* match operations; the results of decrypting cookies; the results of
|
205 |
-
* deserializing non-form-encoded message bodies; etc. Attributes
|
206 |
-
* will be application and request specific, and CAN be mutable.
|
207 |
-
*
|
208 |
-
* @return array Attributes derived from the request.
|
209 |
-
*/
|
210 |
-
public function getAttributes();
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Retrieve a single derived request attribute.
|
214 |
-
*
|
215 |
-
* Retrieves a single derived request attribute as described in
|
216 |
-
* getAttributes(). If the attribute has not been previously set, returns
|
217 |
-
* the default value as provided.
|
218 |
-
*
|
219 |
-
* This method obviates the need for a hasAttribute() method, as it allows
|
220 |
-
* specifying a default value to return if the attribute is not found.
|
221 |
-
*
|
222 |
-
* @see getAttributes()
|
223 |
-
* @param string $name The attribute name.
|
224 |
-
* @param mixed $default Default value to return if the attribute does not exist.
|
225 |
-
* @return mixed
|
226 |
-
*/
|
227 |
-
public function getAttribute($name, $default = null);
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Return an instance with the specified derived request attribute.
|
231 |
-
*
|
232 |
-
* This method allows setting a single derived request attribute as
|
233 |
-
* described in getAttributes().
|
234 |
-
*
|
235 |
-
* This method MUST be implemented in such a way as to retain the
|
236 |
-
* immutability of the message, and MUST return an instance that has the
|
237 |
-
* updated attribute.
|
238 |
-
*
|
239 |
-
* @see getAttributes()
|
240 |
-
* @param string $name The attribute name.
|
241 |
-
* @param mixed $value The value of the attribute.
|
242 |
-
* @return static
|
243 |
-
*/
|
244 |
-
public function withAttribute($name, $value);
|
245 |
-
|
246 |
-
/**
|
247 |
-
* Return an instance that removes the specified derived request attribute.
|
248 |
-
*
|
249 |
-
* This method allows removing a single derived request attribute as
|
250 |
-
* described in getAttributes().
|
251 |
-
*
|
252 |
-
* This method MUST be implemented in such a way as to retain the
|
253 |
-
* immutability of the message, and MUST return an instance that removes
|
254 |
-
* the attribute.
|
255 |
-
*
|
256 |
-
* @see getAttributes()
|
257 |
-
* @param string $name The attribute name.
|
258 |
-
* @return static
|
259 |
-
*/
|
260 |
-
public function withoutAttribute($name);
|
261 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/src/StreamInterface.php
DELETED
@@ -1,158 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Message;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Describes a data stream.
|
7 |
-
*
|
8 |
-
* Typically, an instance will wrap a PHP stream; this interface provides
|
9 |
-
* a wrapper around the most common operations, including serialization of
|
10 |
-
* the entire stream to a string.
|
11 |
-
*/
|
12 |
-
interface StreamInterface
|
13 |
-
{
|
14 |
-
/**
|
15 |
-
* Reads all data from the stream into a string, from the beginning to end.
|
16 |
-
*
|
17 |
-
* This method MUST attempt to seek to the beginning of the stream before
|
18 |
-
* reading data and read the stream until the end is reached.
|
19 |
-
*
|
20 |
-
* Warning: This could attempt to load a large amount of data into memory.
|
21 |
-
*
|
22 |
-
* This method MUST NOT raise an exception in order to conform with PHP's
|
23 |
-
* string casting operations.
|
24 |
-
*
|
25 |
-
* @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
|
26 |
-
* @return string
|
27 |
-
*/
|
28 |
-
public function __toString();
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Closes the stream and any underlying resources.
|
32 |
-
*
|
33 |
-
* @return void
|
34 |
-
*/
|
35 |
-
public function close();
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Separates any underlying resources from the stream.
|
39 |
-
*
|
40 |
-
* After the stream has been detached, the stream is in an unusable state.
|
41 |
-
*
|
42 |
-
* @return resource|null Underlying PHP stream, if any
|
43 |
-
*/
|
44 |
-
public function detach();
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Get the size of the stream if known.
|
48 |
-
*
|
49 |
-
* @return int|null Returns the size in bytes if known, or null if unknown.
|
50 |
-
*/
|
51 |
-
public function getSize();
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Returns the current position of the file read/write pointer
|
55 |
-
*
|
56 |
-
* @return int Position of the file pointer
|
57 |
-
* @throws \RuntimeException on error.
|
58 |
-
*/
|
59 |
-
public function tell();
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Returns true if the stream is at the end of the stream.
|
63 |
-
*
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function eof();
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Returns whether or not the stream is seekable.
|
70 |
-
*
|
71 |
-
* @return bool
|
72 |
-
*/
|
73 |
-
public function isSeekable();
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Seek to a position in the stream.
|
77 |
-
*
|
78 |
-
* @link http://www.php.net/manual/en/function.fseek.php
|
79 |
-
* @param int $offset Stream offset
|
80 |
-
* @param int $whence Specifies how the cursor position will be calculated
|
81 |
-
* based on the seek offset. Valid values are identical to the built-in
|
82 |
-
* PHP $whence values for `fseek()`. SEEK_SET: Set position equal to
|
83 |
-
* offset bytes SEEK_CUR: Set position to current location plus offset
|
84 |
-
* SEEK_END: Set position to end-of-stream plus offset.
|
85 |
-
* @throws \RuntimeException on failure.
|
86 |
-
*/
|
87 |
-
public function seek($offset, $whence = SEEK_SET);
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Seek to the beginning of the stream.
|
91 |
-
*
|
92 |
-
* If the stream is not seekable, this method will raise an exception;
|
93 |
-
* otherwise, it will perform a seek(0).
|
94 |
-
*
|
95 |
-
* @see seek()
|
96 |
-
* @link http://www.php.net/manual/en/function.fseek.php
|
97 |
-
* @throws \RuntimeException on failure.
|
98 |
-
*/
|
99 |
-
public function rewind();
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Returns whether or not the stream is writable.
|
103 |
-
*
|
104 |
-
* @return bool
|
105 |
-
*/
|
106 |
-
public function isWritable();
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Write data to the stream.
|
110 |
-
*
|
111 |
-
* @param string $string The string that is to be written.
|
112 |
-
* @return int Returns the number of bytes written to the stream.
|
113 |
-
* @throws \RuntimeException on failure.
|
114 |
-
*/
|
115 |
-
public function write($string);
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Returns whether or not the stream is readable.
|
119 |
-
*
|
120 |
-
* @return bool
|
121 |
-
*/
|
122 |
-
public function isReadable();
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Read data from the stream.
|
126 |
-
*
|
127 |
-
* @param int $length Read up to $length bytes from the object and return
|
128 |
-
* them. Fewer than $length bytes may be returned if underlying stream
|
129 |
-
* call returns fewer bytes.
|
130 |
-
* @return string Returns the data read from the stream, or an empty string
|
131 |
-
* if no bytes are available.
|
132 |
-
* @throws \RuntimeException if an error occurs.
|
133 |
-
*/
|
134 |
-
public function read($length);
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Returns the remaining contents in a string
|
138 |
-
*
|
139 |
-
* @return string
|
140 |
-
* @throws \RuntimeException if unable to read or an error occurs while
|
141 |
-
* reading.
|
142 |
-
*/
|
143 |
-
public function getContents();
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Get stream metadata as an associative array or retrieve a specific key.
|
147 |
-
*
|
148 |
-
* The keys returned are identical to the keys returned from PHP's
|
149 |
-
* stream_get_meta_data() function.
|
150 |
-
*
|
151 |
-
* @link http://php.net/manual/en/function.stream-get-meta-data.php
|
152 |
-
* @param string $key Specific metadata to retrieve.
|
153 |
-
* @return array|mixed|null Returns an associative array if no key is
|
154 |
-
* provided. Returns a specific key value if a key is provided and the
|
155 |
-
* value is found, or null if the key is not found.
|
156 |
-
*/
|
157 |
-
public function getMetadata($key = null);
|
158 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/src/UploadedFileInterface.php
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Psr\Http\Message;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Value object representing a file uploaded through an HTTP request.
|
7 |
-
*
|
8 |
-
* Instances of this interface are considered immutable; all methods that
|
9 |
-
* might change state MUST be implemented such that they retain the internal
|
10 |
-
* state of the current instance and return an instance that contains the
|
11 |
-
* changed state.
|
12 |
-
*/
|
13 |
-
interface UploadedFileInterface
|
14 |
-
{
|
15 |
-
/**
|
16 |
-
* Retrieve a stream representing the uploaded file.
|
17 |
-
*
|
18 |
-
* This method MUST return a StreamInterface instance, representing the
|
19 |
-
* uploaded file. The purpose of this method is to allow utilizing native PHP
|
20 |
-
* stream functionality to manipulate the file upload, such as
|
21 |
-
* stream_copy_to_stream() (though the result will need to be decorated in a
|
22 |
-
* native PHP stream wrapper to work with such functions).
|
23 |
-
*
|
24 |
-
* If the moveTo() method has been called previously, this method MUST raise
|
25 |
-
* an exception.
|
26 |
-
*
|
27 |
-
* @return StreamInterface Stream representation of the uploaded file.
|
28 |
-
* @throws \RuntimeException in cases when no stream is available or can be
|
29 |
-
* created.
|
30 |
-
*/
|
31 |
-
public function getStream();
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Move the uploaded file to a new location.
|
35 |
-
*
|
36 |
-
* Use this method as an alternative to move_uploaded_file(). This method is
|
37 |
-
* guaranteed to work in both SAPI and non-SAPI environments.
|
38 |
-
* Implementations must determine which environment they are in, and use the
|
39 |
-
* appropriate method (move_uploaded_file(), rename(), or a stream
|
40 |
-
* operation) to perform the operation.
|
41 |
-
*
|
42 |
-
* $targetPath may be an absolute path, or a relative path. If it is a
|
43 |
-
* relative path, resolution should be the same as used by PHP's rename()
|
44 |
-
* function.
|
45 |
-
*
|
46 |
-
* The original file or stream MUST be removed on completion.
|
47 |
-
*
|
48 |
-
* If this method is called more than once, any subsequent calls MUST raise
|
49 |
-
* an exception.
|
50 |
-
*
|
51 |
-
* When used in an SAPI environment where $_FILES is populated, when writing
|
52 |
-
* files via moveTo(), is_uploaded_file() and move_uploaded_file() SHOULD be
|
53 |
-
* used to ensure permissions and upload status are verified correctly.
|
54 |
-
*
|
55 |
-
* If you wish to move to a stream, use getStream(), as SAPI operations
|
56 |
-
* cannot guarantee writing to stream destinations.
|
57 |
-
*
|
58 |
-
* @see http://php.net/is_uploaded_file
|
59 |
-
* @see http://php.net/move_uploaded_file
|
60 |
-
* @param string $targetPath Path to which to move the uploaded file.
|
61 |
-
* @throws \InvalidArgumentException if the $targetPath specified is invalid.
|
62 |
-
* @throws \RuntimeException on any error during the move operation, or on
|
63 |
-
* the second or subsequent call to the method.
|
64 |
-
*/
|
65 |
-
public function moveTo($targetPath);
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Retrieve the file size.
|
69 |
-
*
|
70 |
-
* Implementations SHOULD return the value stored in the "size" key of
|
71 |
-
* the file in the $_FILES array if available, as PHP calculates this based
|
72 |
-
* on the actual size transmitted.
|
73 |
-
*
|
74 |
-
* @return int|null The file size in bytes or null if unknown.
|
75 |
-
*/
|
76 |
-
public function getSize();
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Retrieve the error associated with the uploaded file.
|
80 |
-
*
|
81 |
-
* The return value MUST be one of PHP's UPLOAD_ERR_XXX constants.
|
82 |
-
*
|
83 |
-
* If the file was uploaded successfully, this method MUST return
|
84 |
-
* UPLOAD_ERR_OK.
|
85 |
-
*
|
86 |
-
* Implementations SHOULD return the value stored in the "error" key of
|
87 |
-
* the file in the $_FILES array.
|
88 |
-
*
|
89 |
-
* @see http://php.net/manual/en/features.file-upload.errors.php
|
90 |
-
* @return int One of PHP's UPLOAD_ERR_XXX constants.
|
91 |
-
*/
|
92 |
-
public function getError();
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Retrieve the filename sent by the client.
|
96 |
-
*
|
97 |
-
* Do not trust the value returned by this method. A client could send
|
98 |
-
* a malicious filename with the intention to corrupt or hack your
|
99 |
-
* application.
|
100 |
-
*
|
101 |
-
* Implementations SHOULD return the value stored in the "name" key of
|
102 |
-
* the file in the $_FILES array.
|
103 |
-
*
|
104 |
-
* @return string|null The filename sent by the client or null if none
|
105 |
-
* was provided.
|
106 |
-
*/
|
107 |
-
public function getClientFilename();
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Retrieve the media type sent by the client.
|
111 |
-
*
|
112 |
-
* Do not trust the value returned by this method. A client could send
|
113 |
-
* a malicious media type with the intention to corrupt or hack your
|
114 |
-
* application.
|
115 |
-
*
|
116 |
-
* Implementations SHOULD return the value stored in the "type" key of
|
117 |
-
* the file in the $_FILES array.
|
118 |
-
*
|
119 |
-
* @return string|null The media type sent by the client or null if none
|
120 |
-
* was provided.
|
121 |
-
*/
|
122 |
-
public function getClientMediaType();
|
123 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/psr/http-message/src/UriInterface.php
DELETED
@@ -1,323 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Psr\Http\Message;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Value object representing a URI.
|
6 |
-
*
|
7 |
-
* This interface is meant to represent URIs according to RFC 3986 and to
|
8 |
-
* provide methods for most common operations. Additional functionality for
|
9 |
-
* working with URIs can be provided on top of the interface or externally.
|
10 |
-
* Its primary use is for HTTP requests, but may also be used in other
|
11 |
-
* contexts.
|
12 |
-
*
|
13 |
-
* Instances of this interface are considered immutable; all methods that
|
14 |
-
* might change state MUST be implemented such that they retain the internal
|
15 |
-
* state of the current instance and return an instance that contains the
|
16 |
-
* changed state.
|
17 |
-
*
|
18 |
-
* Typically the Host header will be also be present in the request message.
|
19 |
-
* For server-side requests, the scheme will typically be discoverable in the
|
20 |
-
* server parameters.
|
21 |
-
*
|
22 |
-
* @link http://tools.ietf.org/html/rfc3986 (the URI specification)
|
23 |
-
*/
|
24 |
-
interface UriInterface
|
25 |
-
{
|
26 |
-
/**
|
27 |
-
* Retrieve the scheme component of the URI.
|
28 |
-
*
|
29 |
-
* If no scheme is present, this method MUST return an empty string.
|
30 |
-
*
|
31 |
-
* The value returned MUST be normalized to lowercase, per RFC 3986
|
32 |
-
* Section 3.1.
|
33 |
-
*
|
34 |
-
* The trailing ":" character is not part of the scheme and MUST NOT be
|
35 |
-
* added.
|
36 |
-
*
|
37 |
-
* @see https://tools.ietf.org/html/rfc3986#section-3.1
|
38 |
-
* @return string The URI scheme.
|
39 |
-
*/
|
40 |
-
public function getScheme();
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Retrieve the authority component of the URI.
|
44 |
-
*
|
45 |
-
* If no authority information is present, this method MUST return an empty
|
46 |
-
* string.
|
47 |
-
*
|
48 |
-
* The authority syntax of the URI is:
|
49 |
-
*
|
50 |
-
* <pre>
|
51 |
-
* [user-info@]host[:port]
|
52 |
-
* </pre>
|
53 |
-
*
|
54 |
-
* If the port component is not set or is the standard port for the current
|
55 |
-
* scheme, it SHOULD NOT be included.
|
56 |
-
*
|
57 |
-
* @see https://tools.ietf.org/html/rfc3986#section-3.2
|
58 |
-
* @return string The URI authority, in "[user-info@]host[:port]" format.
|
59 |
-
*/
|
60 |
-
public function getAuthority();
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Retrieve the user information component of the URI.
|
64 |
-
*
|
65 |
-
* If no user information is present, this method MUST return an empty
|
66 |
-
* string.
|
67 |
-
*
|
68 |
-
* If a user is present in the URI, this will return that value;
|
69 |
-
* additionally, if the password is also present, it will be appended to the
|
70 |
-
* user value, with a colon (":") separating the values.
|
71 |
-
*
|
72 |
-
* The trailing "@" character is not part of the user information and MUST
|
73 |
-
* NOT be added.
|
74 |
-
*
|
75 |
-
* @return string The URI user information, in "username[:password]" format.
|
76 |
-
*/
|
77 |
-
public function getUserInfo();
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Retrieve the host component of the URI.
|
81 |
-
*
|
82 |
-
* If no host is present, this method MUST return an empty string.
|
83 |
-
*
|
84 |
-
* The value returned MUST be normalized to lowercase, per RFC 3986
|
85 |
-
* Section 3.2.2.
|
86 |
-
*
|
87 |
-
* @see http://tools.ietf.org/html/rfc3986#section-3.2.2
|
88 |
-
* @return string The URI host.
|
89 |
-
*/
|
90 |
-
public function getHost();
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Retrieve the port component of the URI.
|
94 |
-
*
|
95 |
-
* If a port is present, and it is non-standard for the current scheme,
|
96 |
-
* this method MUST return it as an integer. If the port is the standard port
|
97 |
-
* used with the current scheme, this method SHOULD return null.
|
98 |
-
*
|
99 |
-
* If no port is present, and no scheme is present, this method MUST return
|
100 |
-
* a null value.
|
101 |
-
*
|
102 |
-
* If no port is present, but a scheme is present, this method MAY return
|
103 |
-
* the standard port for that scheme, but SHOULD return null.
|
104 |
-
*
|
105 |
-
* @return null|int The URI port.
|
106 |
-
*/
|
107 |
-
public function getPort();
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Retrieve the path component of the URI.
|
111 |
-
*
|
112 |
-
* The path can either be empty or absolute (starting with a slash) or
|
113 |
-
* rootless (not starting with a slash). Implementations MUST support all
|
114 |
-
* three syntaxes.
|
115 |
-
*
|
116 |
-
* Normally, the empty path "" and absolute path "/" are considered equal as
|
117 |
-
* defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically
|
118 |
-
* do this normalization because in contexts with a trimmed base path, e.g.
|
119 |
-
* the front controller, this difference becomes significant. It's the task
|
120 |
-
* of the user to handle both "" and "/".
|
121 |
-
*
|
122 |
-
* The value returned MUST be percent-encoded, but MUST NOT double-encode
|
123 |
-
* any characters. To determine what characters to encode, please refer to
|
124 |
-
* RFC 3986, Sections 2 and 3.3.
|
125 |
-
*
|
126 |
-
* As an example, if the value should include a slash ("/") not intended as
|
127 |
-
* delimiter between path segments, that value MUST be passed in encoded
|
128 |
-
* form (e.g., "%2F") to the instance.
|
129 |
-
*
|
130 |
-
* @see https://tools.ietf.org/html/rfc3986#section-2
|
131 |
-
* @see https://tools.ietf.org/html/rfc3986#section-3.3
|
132 |
-
* @return string The URI path.
|
133 |
-
*/
|
134 |
-
public function getPath();
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Retrieve the query string of the URI.
|
138 |
-
*
|
139 |
-
* If no query string is present, this method MUST return an empty string.
|
140 |
-
*
|
141 |
-
* The leading "?" character is not part of the query and MUST NOT be
|
142 |
-
* added.
|
143 |
-
*
|
144 |
-
* The value returned MUST be percent-encoded, but MUST NOT double-encode
|
145 |
-
* any characters. To determine what characters to encode, please refer to
|
146 |
-
* RFC 3986, Sections 2 and 3.4.
|
147 |
-
*
|
148 |
-
* As an example, if a value in a key/value pair of the query string should
|
149 |
-
* include an ampersand ("&") not intended as a delimiter between values,
|
150 |
-
* that value MUST be passed in encoded form (e.g., "%26") to the instance.
|
151 |
-
*
|
152 |
-
* @see https://tools.ietf.org/html/rfc3986#section-2
|
153 |
-
* @see https://tools.ietf.org/html/rfc3986#section-3.4
|
154 |
-
* @return string The URI query string.
|
155 |
-
*/
|
156 |
-
public function getQuery();
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Retrieve the fragment component of the URI.
|
160 |
-
*
|
161 |
-
* If no fragment is present, this method MUST return an empty string.
|
162 |
-
*
|
163 |
-
* The leading "#" character is not part of the fragment and MUST NOT be
|
164 |
-
* added.
|
165 |
-
*
|
166 |
-
* The value returned MUST be percent-encoded, but MUST NOT double-encode
|
167 |
-
* any characters. To determine what characters to encode, please refer to
|
168 |
-
* RFC 3986, Sections 2 and 3.5.
|
169 |
-
*
|
170 |
-
* @see https://tools.ietf.org/html/rfc3986#section-2
|
171 |
-
* @see https://tools.ietf.org/html/rfc3986#section-3.5
|
172 |
-
* @return string The URI fragment.
|
173 |
-
*/
|
174 |
-
public function getFragment();
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Return an instance with the specified scheme.
|
178 |
-
*
|
179 |
-
* This method MUST retain the state of the current instance, and return
|
180 |
-
* an instance that contains the specified scheme.
|
181 |
-
*
|
182 |
-
* Implementations MUST support the schemes "http" and "https" case
|
183 |
-
* insensitively, and MAY accommodate other schemes if required.
|
184 |
-
*
|
185 |
-
* An empty scheme is equivalent to removing the scheme.
|
186 |
-
*
|
187 |
-
* @param string $scheme The scheme to use with the new instance.
|
188 |
-
* @return static A new instance with the specified scheme.
|
189 |
-
* @throws \InvalidArgumentException for invalid or unsupported schemes.
|
190 |
-
*/
|
191 |
-
public function withScheme($scheme);
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Return an instance with the specified user information.
|
195 |
-
*
|
196 |
-
* This method MUST retain the state of the current instance, and return
|
197 |
-
* an instance that contains the specified user information.
|
198 |
-
*
|
199 |
-
* Password is optional, but the user information MUST include the
|
200 |
-
* user; an empty string for the user is equivalent to removing user
|
201 |
-
* information.
|
202 |
-
*
|
203 |
-
* @param string $user The user name to use for authority.
|
204 |
-
* @param null|string $password The password associated with $user.
|
205 |
-
* @return static A new instance with the specified user information.
|
206 |
-
*/
|
207 |
-
public function withUserInfo($user, $password = null);
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Return an instance with the specified host.
|
211 |
-
*
|
212 |
-
* This method MUST retain the state of the current instance, and return
|
213 |
-
* an instance that contains the specified host.
|
214 |
-
*
|
215 |
-
* An empty host value is equivalent to removing the host.
|
216 |
-
*
|
217 |
-
* @param string $host The hostname to use with the new instance.
|
218 |
-
* @return static A new instance with the specified host.
|
219 |
-
* @throws \InvalidArgumentException for invalid hostnames.
|
220 |
-
*/
|
221 |
-
public function withHost($host);
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Return an instance with the specified port.
|
225 |
-
*
|
226 |
-
* This method MUST retain the state of the current instance, and return
|
227 |
-
* an instance that contains the specified port.
|
228 |
-
*
|
229 |
-
* Implementations MUST raise an exception for ports outside the
|
230 |
-
* established TCP and UDP port ranges.
|
231 |
-
*
|
232 |
-
* A null value provided for the port is equivalent to removing the port
|
233 |
-
* information.
|
234 |
-
*
|
235 |
-
* @param null|int $port The port to use with the new instance; a null value
|
236 |
-
* removes the port information.
|
237 |
-
* @return static A new instance with the specified port.
|
238 |
-
* @throws \InvalidArgumentException for invalid ports.
|
239 |
-
*/
|
240 |
-
public function withPort($port);
|
241 |
-
|
242 |
-
/**
|
243 |
-
* Return an instance with the specified path.
|
244 |
-
*
|
245 |
-
* This method MUST retain the state of the current instance, and return
|
246 |
-
* an instance that contains the specified path.
|
247 |
-
*
|
248 |
-
* The path can either be empty or absolute (starting with a slash) or
|
249 |
-
* rootless (not starting with a slash). Implementations MUST support all
|
250 |
-
* three syntaxes.
|
251 |
-
*
|
252 |
-
* If the path is intended to be domain-relative rather than path relative then
|
253 |
-
* it must begin with a slash ("/"). Paths not starting with a slash ("/")
|
254 |
-
* are assumed to be relative to some base path known to the application or
|
255 |
-
* consumer.
|
256 |
-
*
|
257 |
-
* Users can provide both encoded and decoded path characters.
|
258 |
-
* Implementations ensure the correct encoding as outlined in getPath().
|
259 |
-
*
|
260 |
-
* @param string $path The path to use with the new instance.
|
261 |
-
* @return static A new instance with the specified path.
|
262 |
-
* @throws \InvalidArgumentException for invalid paths.
|
263 |
-
*/
|
264 |
-
public function withPath($path);
|
265 |
-
|
266 |
-
/**
|
267 |
-
* Return an instance with the specified query string.
|
268 |
-
*
|
269 |
-
* This method MUST retain the state of the current instance, and return
|
270 |
-
* an instance that contains the specified query string.
|
271 |
-
*
|
272 |
-
* Users can provide both encoded and decoded query characters.
|
273 |
-
* Implementations ensure the correct encoding as outlined in getQuery().
|
274 |
-
*
|
275 |
-
* An empty query string value is equivalent to removing the query string.
|
276 |
-
*
|
277 |
-
* @param string $query The query string to use with the new instance.
|
278 |
-
* @return static A new instance with the specified query string.
|
279 |
-
* @throws \InvalidArgumentException for invalid query strings.
|
280 |
-
*/
|
281 |
-
public function withQuery($query);
|
282 |
-
|
283 |
-
/**
|
284 |
-
* Return an instance with the specified URI fragment.
|
285 |
-
*
|
286 |
-
* This method MUST retain the state of the current instance, and return
|
287 |
-
* an instance that contains the specified URI fragment.
|
288 |
-
*
|
289 |
-
* Users can provide both encoded and decoded fragment characters.
|
290 |
-
* Implementations ensure the correct encoding as outlined in getFragment().
|
291 |
-
*
|
292 |
-
* An empty fragment value is equivalent to removing the fragment.
|
293 |
-
*
|
294 |
-
* @param string $fragment The fragment to use with the new instance.
|
295 |
-
* @return static A new instance with the specified fragment.
|
296 |
-
*/
|
297 |
-
public function withFragment($fragment);
|
298 |
-
|
299 |
-
/**
|
300 |
-
* Return the string representation as a URI reference.
|
301 |
-
*
|
302 |
-
* Depending on which components of the URI are present, the resulting
|
303 |
-
* string is either a full URI or relative reference according to RFC 3986,
|
304 |
-
* Section 4.1. The method concatenates the various components of the URI,
|
305 |
-
* using the appropriate delimiters:
|
306 |
-
*
|
307 |
-
* - If a scheme is present, it MUST be suffixed by ":".
|
308 |
-
* - If an authority is present, it MUST be prefixed by "//".
|
309 |
-
* - The path can be concatenated without delimiters. But there are two
|
310 |
-
* cases where the path has to be adjusted to make the URI reference
|
311 |
-
* valid as PHP does not allow to throw an exception in __toString():
|
312 |
-
* - If the path is rootless and an authority is present, the path MUST
|
313 |
-
* be prefixed by "/".
|
314 |
-
* - If the path is starting with more than one "/" and no authority is
|
315 |
-
* present, the starting slashes MUST be reduced to one.
|
316 |
-
* - If a query is present, it MUST be prefixed by "?".
|
317 |
-
* - If a fragment is present, it MUST be prefixed by "#".
|
318 |
-
*
|
319 |
-
* @see http://tools.ietf.org/html/rfc3986#section-4.1
|
320 |
-
* @return string
|
321 |
-
*/
|
322 |
-
public function __toString();
|
323 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/ralouphie/getallheaders/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
The MIT License (MIT)
|
2 |
-
|
3 |
-
Copyright (c) 2014 Ralph Khattar
|
4 |
-
|
5 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
-
of this software and associated documentation files (the "Software"), to deal
|
7 |
-
in the Software without restriction, including without limitation the rights
|
8 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
-
copies of the Software, and to permit persons to whom the Software is
|
10 |
-
furnished to do so, subject to the following conditions:
|
11 |
-
|
12 |
-
The above copyright notice and this permission notice shall be included in all
|
13 |
-
copies or substantial portions of the Software.
|
14 |
-
|
15 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
-
SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/ralouphie/getallheaders/README.md
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
getallheaders
|
2 |
-
=============
|
3 |
-
|
4 |
-
PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3.
|
5 |
-
|
6 |
-
[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders)
|
7 |
-
[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master)
|
8 |
-
[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders)
|
9 |
-
[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders)
|
10 |
-
[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders)
|
11 |
-
|
12 |
-
|
13 |
-
This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php).
|
14 |
-
|
15 |
-
## Install
|
16 |
-
|
17 |
-
For PHP version **`>= 5.6`**:
|
18 |
-
|
19 |
-
```
|
20 |
-
composer require ralouphie/getallheaders
|
21 |
-
```
|
22 |
-
|
23 |
-
For PHP version **`< 5.6`**:
|
24 |
-
|
25 |
-
```
|
26 |
-
composer require ralouphie/getallheaders "^2"
|
27 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/ralouphie/getallheaders/composer.json
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "ralouphie/getallheaders",
|
3 |
-
"description": "A polyfill for getallheaders.",
|
4 |
-
"license": "MIT",
|
5 |
-
"authors": [
|
6 |
-
{
|
7 |
-
"name": "Ralph Khattar",
|
8 |
-
"email": "ralph.khattar@gmail.com"
|
9 |
-
}
|
10 |
-
],
|
11 |
-
"require": {
|
12 |
-
"php": ">=5.6"
|
13 |
-
},
|
14 |
-
"require-dev": {
|
15 |
-
"phpunit/phpunit": "^5 || ^6.5",
|
16 |
-
"php-coveralls/php-coveralls": "^2.1"
|
17 |
-
},
|
18 |
-
"autoload": {
|
19 |
-
"files": ["src/getallheaders.php"]
|
20 |
-
},
|
21 |
-
"autoload-dev": {
|
22 |
-
"psr-4": {
|
23 |
-
"getallheaders\\Tests\\": "tests/"
|
24 |
-
}
|
25 |
-
}
|
26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/ralouphie/getallheaders/src/getallheaders.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (!function_exists('getallheaders')) {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Get all HTTP header key/values as an associative array for the current request.
|
7 |
-
*
|
8 |
-
* @return string[string] The HTTP header key/value pairs.
|
9 |
-
*/
|
10 |
-
function getallheaders()
|
11 |
-
{
|
12 |
-
$headers = array();
|
13 |
-
|
14 |
-
$copy_server = array(
|
15 |
-
'CONTENT_TYPE' => 'Content-Type',
|
16 |
-
'CONTENT_LENGTH' => 'Content-Length',
|
17 |
-
'CONTENT_MD5' => 'Content-Md5',
|
18 |
-
);
|
19 |
-
|
20 |
-
foreach ($_SERVER as $key => $value) {
|
21 |
-
if (substr($key, 0, 5) === 'HTTP_') {
|
22 |
-
$key = substr($key, 5);
|
23 |
-
if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) {
|
24 |
-
$key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key))));
|
25 |
-
$headers[$key] = $value;
|
26 |
-
}
|
27 |
-
} elseif (isset($copy_server[$key])) {
|
28 |
-
$headers[$copy_server[$key]] = $value;
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
if (!isset($headers['Authorization'])) {
|
33 |
-
if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
|
34 |
-
$headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
|
35 |
-
} elseif (isset($_SERVER['PHP_AUTH_USER'])) {
|
36 |
-
$basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
|
37 |
-
$headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass);
|
38 |
-
} elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) {
|
39 |
-
$headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST'];
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
return $headers;
|
44 |
-
}
|
45 |
-
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|