Orbit Fox by ThemeIsle - Version 2.10.18

Version Description

Download this release

Release Info

Developer themeisle
Plugin Icon 128x128 Orbit Fox by ThemeIsle
Version 2.10.18
Comparing to
See all releases

Code changes from version 2.10.17 to 2.10.18

Files changed (276) hide show
  1. CHANGELOG.md +5 -0
  2. core/includes/class-orbit-fox.php +1 -1
  3. languages/themeisle-companion.pot +3 -3
  4. obfx_modules/elementor-widgets/init.php +1 -0
  5. readme.md +8 -0
  6. readme.txt +8 -0
  7. themeisle-companion.php +1 -1
  8. vendor/autoload.php +1 -1
  9. vendor/codeinwp/themeisle-sdk/CHANGELOG.md +6 -0
  10. vendor/codeinwp/themeisle-sdk/load.php +69 -2
  11. vendor/codeinwp/themeisle-sdk/src/Loader.php +1 -0
  12. vendor/codeinwp/themeisle-sdk/src/Modules/Compatibilities.php +236 -0
  13. vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php +112 -10
  14. vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php +8 -6
  15. vendor/codeinwp/themeisle-sdk/src/Product.php +25 -1
  16. vendor/codeinwp/themeisle-sdk/start.php +1 -0
  17. vendor/composer/autoload_classmap.php +103 -34
  18. vendor/composer/autoload_files.php +2 -2
  19. vendor/composer/autoload_psr4.php +6 -3
  20. vendor/composer/autoload_real.php +7 -9
  21. vendor/composer/autoload_static.php +139 -51
  22. vendor/composer/installed.json +539 -220
  23. vendor/composer/installed.php +87 -55
  24. vendor/composer/platform_check.php +0 -26
  25. vendor/guzzlehttp/psr7/.php_cs.dist +0 -56
  26. vendor/guzzlehttp/psr7/CHANGELOG.md +0 -318
  27. vendor/guzzlehttp/psr7/README.md +0 -844
  28. vendor/guzzlehttp/psr7/src/AppendStream.php +0 -246
  29. vendor/guzzlehttp/psr7/src/BufferStream.php +0 -142
  30. vendor/guzzlehttp/psr7/src/CachingStream.php +0 -147
  31. vendor/guzzlehttp/psr7/src/DroppingStream.php +0 -45
  32. vendor/guzzlehttp/psr7/src/FnStream.php +0 -163
  33. vendor/guzzlehttp/psr7/src/Header.php +0 -71
  34. vendor/guzzlehttp/psr7/src/InflateStream.php +0 -56
  35. vendor/guzzlehttp/psr7/src/LazyOpenStream.php +0 -42
  36. vendor/guzzlehttp/psr7/src/LimitStream.php +0 -157
  37. vendor/guzzlehttp/psr7/src/Message.php +0 -252
  38. vendor/guzzlehttp/psr7/src/MessageTrait.php +0 -270
  39. vendor/guzzlehttp/psr7/src/MimeType.php +0 -140
  40. vendor/guzzlehttp/psr7/src/MultipartStream.php +0 -158
  41. vendor/guzzlehttp/psr7/src/NoSeekStream.php +0 -25
  42. vendor/guzzlehttp/psr7/src/PumpStream.php +0 -170
  43. vendor/guzzlehttp/psr7/src/Query.php +0 -113
  44. vendor/guzzlehttp/psr7/src/Request.php +0 -152
  45. vendor/guzzlehttp/psr7/src/Response.php +0 -155
  46. vendor/guzzlehttp/psr7/src/Rfc7230.php +0 -19
  47. vendor/guzzlehttp/psr7/src/ServerRequest.php +0 -379
  48. vendor/guzzlehttp/psr7/src/Stream.php +0 -270
  49. vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php +0 -152
  50. vendor/guzzlehttp/psr7/src/StreamWrapper.php +0 -165
  51. vendor/guzzlehttp/psr7/src/UploadedFile.php +0 -328
  52. vendor/guzzlehttp/psr7/src/Uri.php +0 -810
  53. vendor/guzzlehttp/psr7/src/UriComparator.php +0 -55
  54. vendor/guzzlehttp/psr7/src/UriNormalizer.php +0 -219
  55. vendor/guzzlehttp/psr7/src/UriResolver.php +0 -222
  56. vendor/guzzlehttp/psr7/src/Utils.php +0 -428
  57. vendor/guzzlehttp/psr7/src/functions.php +0 -422
  58. vendor/guzzlehttp/psr7/src/functions_include.php +0 -6
  59. vendor/mailerlite/mailerlite-api-v2-php-sdk/LICENSE.md +21 -0
  60. vendor/mailerlite/mailerlite-api-v2-php-sdk/README.md +13 -6
  61. vendor/mailerlite/mailerlite-api-v2-php-sdk/phpunit.xml.bak +16 -0
  62. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Batch.php +45 -0
  63. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Campaigns.php +16 -4
  64. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Fields.php +13 -1
  65. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Groups.php +6 -1
  66. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Segments.php +6 -1
  67. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Settings.php +6 -1
  68. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Stats.php +6 -1
  69. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Subscribers.php +37 -1
  70. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/WooCommerce.php +125 -0
  71. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Common/BatchRequest.php +107 -0
  72. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Common/RestClient.php +62 -24
  73. vendor/mailerlite/mailerlite-api-v2-php-sdk/src/MailerLite.php +19 -1
  74. vendor/nyholm/psr7/CHANGELOG.md +138 -0
  75. vendor/{ralouphie/getallheaders → nyholm/psr7}/LICENSE +2 -2
  76. vendor/nyholm/psr7/README.md +110 -0
  77. vendor/nyholm/psr7/src/Factory/HttplugFactory.php +45 -0
  78. vendor/nyholm/psr7/src/Factory/Psr17Factory.php +78 -0
  79. vendor/nyholm/psr7/src/MessageTrait.php +207 -0
  80. vendor/nyholm/psr7/src/Request.php +47 -0
  81. vendor/nyholm/psr7/src/RequestTrait.php +113 -0
  82. vendor/nyholm/psr7/src/Response.php +90 -0
  83. vendor/nyholm/psr7/src/ServerRequest.php +182 -0
  84. vendor/nyholm/psr7/src/Stream.php +306 -0
  85. vendor/nyholm/psr7/src/UploadedFile.php +179 -0
  86. vendor/nyholm/psr7/src/Uri.php +312 -0
  87. vendor/php-http/client-common/.php_cs.dist +24 -0
  88. vendor/php-http/client-common/CHANGELOG.md +276 -0
  89. vendor/php-http/client-common/LICENSE +19 -0
  90. vendor/php-http/client-common/README.md +55 -0
  91. vendor/php-http/client-common/src/BatchClient.php +42 -0
  92. vendor/php-http/client-common/src/BatchClientInterface.php +34 -0
  93. vendor/php-http/client-common/src/BatchResult.php +157 -0
  94. vendor/php-http/client-common/src/Deferred.php +152 -0
  95. vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php +25 -0
  96. vendor/php-http/client-common/src/EmulatedHttpClient.php +24 -0
  97. vendor/php-http/client-common/src/Exception/BatchException.php +37 -0
  98. vendor/php-http/client-common/src/Exception/CircularRedirectionException.php +16 -0
  99. vendor/php-http/client-common/src/Exception/ClientErrorException.php +16 -0
  100. vendor/php-http/client-common/src/Exception/HttpClientNoMatchException.php +33 -0
  101. vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php +16 -0
  102. vendor/php-http/client-common/src/Exception/LoopException.php +16 -0
  103. vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php +16 -0
  104. vendor/php-http/client-common/src/Exception/ServerErrorException.php +16 -0
  105. vendor/php-http/client-common/src/FlexibleHttpClient.php +36 -0
  106. vendor/php-http/client-common/src/HttpAsyncClientDecorator.php +31 -0
  107. vendor/php-http/client-common/src/HttpAsyncClientEmulator.php +39 -0
  108. vendor/php-http/client-common/src/HttpClientDecorator.php +32 -0
  109. vendor/php-http/client-common/src/HttpClientEmulator.php +35 -0
  110. vendor/php-http/client-common/src/HttpClientPool.php +24 -0
  111. vendor/php-http/client-common/src/HttpClientPool/HttpClientPool.php +70 -0
  112. vendor/php-http/client-common/src/HttpClientPool/HttpClientPoolItem.php +181 -0
  113. vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php +45 -0
  114. vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php +31 -0
  115. vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php +42 -0
  116. vendor/php-http/client-common/src/HttpClientRouter.php +74 -0
  117. vendor/php-http/client-common/src/HttpClientRouterInterface.php +27 -0
  118. vendor/php-http/client-common/src/HttpMethodsClient.php +150 -0
  119. vendor/php-http/client-common/src/HttpMethodsClientInterface.php +116 -0
  120. vendor/php-http/client-common/src/Plugin.php +33 -0
  121. vendor/php-http/client-common/src/Plugin/AddHostPlugin.php +76 -0
  122. vendor/php-http/client-common/src/Plugin/AddPathPlugin.php +78 -0
  123. vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php +38 -0
  124. vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php +57 -0
  125. vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php +39 -0
  126. vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php +122 -0
  127. vendor/php-http/client-common/src/Plugin/CookiePlugin.php +180 -0
  128. vendor/php-http/client-common/src/Plugin/DecoderPlugin.php +135 -0
  129. vendor/php-http/client-common/src/Plugin/ErrorPlugin.php +92 -0
  130. vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php +48 -0
  131. vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php +46 -0
  132. vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php +44 -0
  133. vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php +44 -0
  134. vendor/php-http/client-common/src/Plugin/HistoryPlugin.php +49 -0
  135. vendor/php-http/client-common/src/Plugin/Journal.php +33 -0
  136. vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php +50 -0
  137. vendor/php-http/client-common/src/Plugin/RedirectPlugin.php +265 -0
  138. vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php +56 -0
  139. vendor/php-http/client-common/src/Plugin/RequestSeekableBodyPlugin.php +29 -0
  140. vendor/php-http/client-common/src/Plugin/ResponseSeekableBodyPlugin.php +32 -0
  141. vendor/php-http/client-common/src/Plugin/RetryPlugin.php +179 -0
  142. vendor/php-http/client-common/src/Plugin/SeekableBodyPlugin.php +47 -0
  143. vendor/php-http/client-common/src/Plugin/VersionBridgePlugin.php +24 -0
  144. vendor/php-http/client-common/src/PluginChain.php +62 -0
  145. vendor/php-http/client-common/src/PluginClient.php +130 -0
  146. vendor/php-http/client-common/src/PluginClientBuilder.php +76 -0
  147. vendor/php-http/client-common/src/PluginClientFactory.php +68 -0
  148. vendor/php-http/client-common/src/VersionBridgeClient.php +24 -0
  149. vendor/php-http/curl-client/.php_cs +0 -9
  150. vendor/php-http/curl-client/.styleci.yml +0 -4
  151. vendor/php-http/curl-client/CHANGELOG.md +0 -173
  152. vendor/php-http/curl-client/README.md +0 -44
  153. vendor/php-http/curl-client/puli.json +0 -242
  154. vendor/php-http/curl-client/src/Client.php +0 -372
  155. vendor/php-http/curl-client/src/CurlPromise.php +0 -109
  156. vendor/php-http/curl-client/src/MultiRunner.php +0 -129
  157. vendor/php-http/curl-client/src/PromiseCore.php +0 -241
  158. vendor/php-http/curl-client/src/ResponseBuilder.php +0 -22
  159. vendor/php-http/discovery/.php-cs-fixer.php +16 -0
  160. vendor/php-http/discovery/CHANGELOG.md +93 -6
  161. vendor/php-http/discovery/src/ClassDiscovery.php +20 -4
  162. vendor/php-http/discovery/src/Exception.php +3 -1
  163. vendor/php-http/discovery/src/Exception/NoCandidateFoundException.php +0 -1
  164. vendor/php-http/discovery/src/Exception/NotFoundException.php +1 -1
  165. vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php +1 -5
  166. vendor/php-http/discovery/src/HttpClientDiscovery.php +1 -5
  167. vendor/php-http/discovery/src/MessageFactoryDiscovery.php +1 -5
  168. vendor/php-http/discovery/src/Psr17FactoryDiscovery.php +13 -1
  169. vendor/php-http/discovery/src/Psr18ClientDiscovery.php +1 -5
  170. vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php +96 -28
  171. vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php +24 -0
  172. vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php +1 -1
  173. vendor/php-http/discovery/src/Strategy/MockClientStrategy.php +5 -7
  174. vendor/php-http/discovery/src/StreamFactoryDiscovery.php +1 -5
  175. vendor/php-http/discovery/src/UriFactoryDiscovery.php +1 -5
  176. vendor/php-http/httplug/.php-cs-fixer.dist.php +16 -0
  177. vendor/php-http/httplug/CHANGELOG.md +72 -8
  178. vendor/php-http/httplug/LICENSE +2 -2
  179. vendor/php-http/httplug/README.md +25 -20
  180. vendor/php-http/httplug/src/Exception.php +3 -1
  181. vendor/php-http/httplug/src/Exception/HttpException.php +2 -11
  182. vendor/php-http/httplug/src/Exception/NetworkException.php +15 -1
  183. vendor/php-http/httplug/src/Exception/RequestAwareTrait.php +26 -0
  184. vendor/php-http/httplug/src/Exception/RequestException.php +5 -19
  185. vendor/php-http/httplug/src/HttpAsyncClient.php +1 -3
  186. vendor/php-http/httplug/src/HttpClient.php +5 -18
  187. vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php +0 -3
  188. vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php +6 -4
  189. vendor/php-http/message/CHANGELOG.md +62 -2
  190. vendor/php-http/message/README.md +1 -11
  191. vendor/php-http/message/src/Authentication.php +7 -4
  192. vendor/php-http/message/src/Authentication/Header.php +36 -0
  193. vendor/php-http/message/src/Authentication/Matching.php +1 -6
  194. vendor/php-http/message/src/Authentication/QueryParam.php +1 -4
  195. vendor/php-http/message/src/Authentication/RequestConditional.php +0 -4
  196. vendor/php-http/message/src/Authentication/Wsse.php +13 -3
  197. vendor/php-http/message/src/Builder/ResponseBuilder.php +9 -11
  198. vendor/php-http/message/src/Cookie.php +4 -6
  199. vendor/php-http/message/src/CookieJar.php +5 -13
  200. vendor/php-http/message/src/CookieUtil.php +1 -1
  201. vendor/php-http/message/src/Decorator/RequestDecorator.php +0 -2
  202. vendor/php-http/message/src/Decorator/ResponseDecorator.php +0 -2
  203. vendor/php-http/message/src/Encoding/CompressStream.php +1 -2
  204. vendor/php-http/message/src/Encoding/DecompressStream.php +1 -2
  205. vendor/php-http/message/src/Encoding/DeflateStream.php +1 -2
  206. vendor/php-http/message/src/Encoding/Filter/Chunk.php +1 -0
  207. vendor/php-http/message/src/Encoding/FilteredStream.php +3 -5
  208. vendor/php-http/message/src/Encoding/GzipDecodeStream.php +1 -2
  209. vendor/php-http/message/src/Encoding/GzipEncodeStream.php +1 -2
  210. vendor/php-http/message/src/Encoding/InflateStream.php +1 -2
  211. vendor/php-http/message/src/Formatter.php +7 -4
  212. vendor/php-http/message/src/Formatter/CurlCommandFormatter.php +15 -3
  213. vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php +35 -10
  214. vendor/php-http/message/src/Formatter/SimpleFormatter.php +10 -0
  215. vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php +26 -5
  216. vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php +2 -0
  217. vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php +4 -2
  218. vendor/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php +0 -3
  219. vendor/php-http/message/src/Stream/BufferedStream.php +3 -0
  220. vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php +15 -3
  221. vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php +7 -0
  222. vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php +2 -0
  223. vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php +9 -2
  224. vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php +9 -2
  225. vendor/php-http/message/src/UriFactory/SlimUriFactory.php +2 -0
  226. vendor/php-http/promise/CHANGELOG.md +13 -0
  227. vendor/php-http/promise/README.md +2 -3
  228. vendor/php-http/promise/src/Promise.php +4 -4
  229. vendor/psr/http-client/CHANGELOG.md +23 -0
  230. vendor/{guzzlehttp/psr7 → psr/http-client}/LICENSE +6 -13
  231. vendor/psr/http-client/README.md +12 -0
  232. vendor/psr/http-client/src/ClientExceptionInterface.php +10 -0
  233. vendor/psr/http-client/src/ClientInterface.php +20 -0
  234. vendor/psr/http-client/src/NetworkExceptionInterface.php +24 -0
  235. vendor/psr/http-client/src/RequestExceptionInterface.php +24 -0
  236. vendor/psr/http-factory/.pullapprove.yml +7 -0
  237. vendor/psr/http-factory/LICENSE +21 -0
  238. vendor/psr/http-factory/README.md +10 -0
  239. vendor/psr/http-factory/src/RequestFactoryInterface.php +18 -0
  240. vendor/psr/http-factory/src/ResponseFactoryInterface.php +18 -0
  241. vendor/psr/http-factory/src/ServerRequestFactoryInterface.php +24 -0
  242. vendor/psr/http-factory/src/StreamFactoryInterface.php +45 -0
  243. vendor/psr/http-factory/src/UploadedFileFactoryInterface.php +34 -0
  244. vendor/psr/http-factory/src/UriFactoryInterface.php +17 -0
  245. vendor/ralouphie/getallheaders/README.md +0 -27
  246. vendor/ralouphie/getallheaders/src/getallheaders.php +0 -46
  247. vendor/symfony/deprecation-contracts/CHANGELOG.md +5 -0
  248. vendor/{php-http/curl-client → symfony/deprecation-contracts}/LICENSE +1 -1
  249. vendor/symfony/deprecation-contracts/README.md +26 -0
  250. vendor/symfony/deprecation-contracts/function.php +27 -0
  251. vendor/symfony/options-resolver/CHANGELOG.md +86 -0
  252. vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php +104 -0
  253. vendor/symfony/options-resolver/Exception/AccessException.php +22 -0
  254. vendor/symfony/options-resolver/Exception/ExceptionInterface.php +21 -0
  255. vendor/symfony/options-resolver/Exception/InvalidArgumentException.php +21 -0
  256. vendor/symfony/options-resolver/Exception/InvalidOptionsException.php +23 -0
  257. vendor/symfony/options-resolver/Exception/MissingOptionsException.php +23 -0
  258. vendor/symfony/options-resolver/Exception/NoConfigurationException.php +26 -0
  259. vendor/symfony/options-resolver/Exception/NoSuchOptionException.php +26 -0
  260. vendor/symfony/options-resolver/Exception/OptionDefinitionException.php +21 -0
  261. vendor/symfony/options-resolver/Exception/UndefinedOptionsException.php +24 -0
  262. vendor/symfony/options-resolver/LICENSE +19 -0
  263. vendor/symfony/options-resolver/OptionConfigurator.php +137 -0
  264. vendor/symfony/options-resolver/Options.php +22 -0
  265. vendor/symfony/options-resolver/OptionsResolver.php +1300 -0
  266. vendor/symfony/options-resolver/README.md +15 -0
  267. vendor/symfony/polyfill-php80/LICENSE +19 -0
  268. vendor/symfony/polyfill-php80/Php80.php +115 -0
  269. vendor/symfony/polyfill-php80/PhpToken.php +103 -0
  270. vendor/symfony/polyfill-php80/README.md +25 -0
  271. vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php +22 -0
  272. vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php +7 -0
  273. vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +11 -0
  274. vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +7 -0
  275. vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +7 -0
  276. vendor/symfony/polyfill-php80/bootstrap.php +42 -0
CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  ##### [Version 2.10.17](https://github.com/Codeinwp/themeisle-companion/compare/v2.10.16...v2.10.17) (2022-09-05)
2
 
3
  * Remove deprecated Gutenberg blocks module
1
+ ##### [Version 2.10.18](https://github.com/Codeinwp/themeisle-companion/compare/v2.10.17...v2.10.18) (2022-09-13)
2
+
3
+ * Update depencies
4
+ * Fix usage of outdated php-http/discovery package may break some sites running PHP 7.4 or higher
5
+
6
  ##### [Version 2.10.17](https://github.com/Codeinwp/themeisle-companion/compare/v2.10.16...v2.10.17) (2022-09-05)
7
 
8
  * Remove deprecated Gutenberg blocks module
core/includes/class-orbit-fox.php CHANGED
@@ -69,7 +69,7 @@ class Orbit_Fox {
69
 
70
  $this->plugin_name = 'orbit-fox';
71
 
72
- $this->version = '2.10.17';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
69
 
70
  $this->plugin_name = 'orbit-fox';
71
 
72
+ $this->version = '2.10.18';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
languages/themeisle-companion.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Orbit Fox Companion 2.10.17\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/Codeinwp/themeisle-companion/issues\n"
8
- "POT-Creation-Date: 2022-09-05 10:45:33+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -2043,7 +2043,7 @@ msgstr ""
2043
  msgid "10+ more Elementor and Gutenberg widgets"
2044
  msgstr ""
2045
 
2046
- #: obfx_modules/elementor-widgets/init.php:58
2047
  msgid "Learn more"
2048
  msgstr ""
2049
 
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Orbit Fox Companion 2.10.18\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/Codeinwp/themeisle-companion/issues\n"
8
+ "POT-Creation-Date: 2022-09-13 14:29:14+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
2043
  msgid "10+ more Elementor and Gutenberg widgets"
2044
  msgstr ""
2045
 
2046
+ #: obfx_modules/elementor-widgets/init.php:59
2047
  msgid "Learn more"
2048
  msgstr ""
2049
 
obfx_modules/elementor-widgets/init.php CHANGED
@@ -50,6 +50,7 @@ class Elementor_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract {
50
  array(
51
  'utm_source' => 'wpadmin',
52
  'utm_medium' => 'orbitfox',
 
53
  'utm_campaign' => 'elementorwidgets',
54
  ),
55
  'https://themeisle.com/themes/neve/pricing/'
50
  array(
51
  'utm_source' => 'wpadmin',
52
  'utm_medium' => 'orbitfox',
53
+ 'utm_content' => 'neve',
54
  'utm_campaign' => 'elementorwidgets',
55
  ),
56
  'https://themeisle.com/themes/neve/pricing/'
readme.md CHANGED
@@ -107,6 +107,14 @@ Activating the Orbit Fox plugin is just like any other plugin. If you've uploade
107
 
108
  ## Changelog ##
109
 
 
 
 
 
 
 
 
 
110
  ##### [Version 2.10.17](https://github.com/Codeinwp/themeisle-companion/compare/v2.10.16...v2.10.17) (2022-09-05)
111
 
112
  * Remove deprecated Gutenberg blocks module
107
 
108
  ## Changelog ##
109
 
110
+ ##### [Version 2.10.18](https://github.com/Codeinwp/themeisle-companion/compare/v2.10.17...v2.10.18) (2022-09-13)
111
+
112
+ * Update depencies
113
+ * Fix usage of outdated php-http/discovery package may break some sites running PHP 7.4 or higher
114
+
115
+
116
+
117
+
118
  ##### [Version 2.10.17](https://github.com/Codeinwp/themeisle-companion/compare/v2.10.16...v2.10.17) (2022-09-05)
119
 
120
  * Remove deprecated Gutenberg blocks module
readme.txt CHANGED
@@ -107,6 +107,14 @@ Activating the Orbit Fox plugin is just like any other plugin. If you've uploade
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
 
110
  ##### [Version 2.10.17](https://github.com/Codeinwp/themeisle-companion/compare/v2.10.16...v2.10.17) (2022-09-05)
111
 
112
  * Remove deprecated Gutenberg blocks module
107
 
108
  == Changelog ==
109
 
110
+ ##### [Version 2.10.18](https://github.com/Codeinwp/themeisle-companion/compare/v2.10.17...v2.10.18) (2022-09-13)
111
+
112
+ * Update depencies
113
+ * Fix usage of outdated php-http/discovery package may break some sites running PHP 7.4 or higher
114
+
115
+
116
+
117
+
118
  ##### [Version 2.10.17](https://github.com/Codeinwp/themeisle-companion/compare/v2.10.16...v2.10.17) (2022-09-05)
119
 
120
  * Remove deprecated Gutenberg blocks module
themeisle-companion.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: Orbit Fox Companion
16
  * Plugin URI: https://orbitfox.com/
17
  * Description: This swiss-knife plugin comes with a quality template library, menu/sharing icons modules, Gutenberg blocks, and newly added Elementor/BeaverBuilder page builder widgets on each release.
18
- * Version: 2.10.17
19
  * Author: Themeisle
20
  * Author URI: https://orbitfox.com/
21
  * License: GPL-2.0+
15
  * Plugin Name: Orbit Fox Companion
16
  * Plugin URI: https://orbitfox.com/
17
  * Description: This swiss-knife plugin comes with a quality template library, menu/sharing icons modules, Gutenberg blocks, and newly added Elementor/BeaverBuilder page builder widgets on each release.
18
+ * Version: 2.10.18
19
  * Author: Themeisle
20
  * Author URI: https://orbitfox.com/
21
  * License: GPL-2.0+
vendor/autoload.php CHANGED
@@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
- return ComposerAutoloaderInit30e8e22007888ae720651c031afd07f4::getLoader();
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
+ return ComposerAutoloaderInit64eb01b4d71e339a1f4c3fb7643dc86a::getLoader();
vendor/codeinwp/themeisle-sdk/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  ##### [Version 3.2.28](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.27...v3.2.28) (2022-08-30)
2
 
3
  * Adds utm handler
1
+ ##### [Version 3.2.29](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.28...v3.2.29) (2022-09-08)
2
+
3
+ * Adds compatibility mechanism
4
+ * Adds content utms
5
+ * Adds usage time on uninstall feedback
6
+
7
  ##### [Version 3.2.28](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.27...v3.2.28) (2022-08-30)
8
 
9
  * Adds utm handler
vendor/codeinwp/themeisle-sdk/load.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  return;
15
  }
16
  // Current SDK version and path.
17
- $themeisle_sdk_version = '3.2.28';
18
  $themeisle_sdk_path = dirname( __FILE__ );
19
 
20
  global $themeisle_sdk_max_version;
@@ -91,13 +91,29 @@ if ( ! function_exists( 'tsdk_utmify' ) ) {
91
  $current_page = sanitize_key( str_replace( '.php', '', $current_page ) );
92
  }
93
  $location = $location === null ? $current_page : $location;
94
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  return esc_url_raw(
96
  add_query_arg(
97
  [
98
  'utm_source' => 'wpadmin',
99
  'utm_medium' => $location,
100
  'utm_campaign' => $area,
 
101
  ],
102
  $url
103
  )
@@ -106,3 +122,54 @@ if ( ! function_exists( 'tsdk_utmify' ) ) {
106
 
107
  add_filter( 'tsdk_utmify', 'tsdk_utmify', 10, 3 );
108
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  return;
15
  }
16
  // Current SDK version and path.
17
+ $themeisle_sdk_version = '3.2.29';
18
  $themeisle_sdk_path = dirname( __FILE__ );
19
 
20
  global $themeisle_sdk_max_version;
91
  $current_page = sanitize_key( str_replace( '.php', '', $current_page ) );
92
  }
93
  $location = $location === null ? $current_page : $location;
94
+ $content = sanitize_key(
95
+ trim(
96
+ str_replace(
97
+ [
98
+ 'https://',
99
+ 'themeisle.com',
100
+ '/themes/',
101
+ '/plugins/',
102
+ '/upgrade',
103
+ ],
104
+ '',
105
+ $url
106
+ ),
107
+ '/'
108
+ )
109
+ );
110
  return esc_url_raw(
111
  add_query_arg(
112
  [
113
  'utm_source' => 'wpadmin',
114
  'utm_medium' => $location,
115
  'utm_campaign' => $area,
116
+ 'utm_content' => $content,
117
  ],
118
  $url
119
  )
122
 
123
  add_filter( 'tsdk_utmify', 'tsdk_utmify', 10, 3 );
124
  }
125
+
126
+
127
+ if ( ! function_exists( 'tsdk_lstatus' ) ) {
128
+ /**
129
+ * Check license status.
130
+ *
131
+ * @param string $file Product basefile.
132
+ *
133
+ * @return string Status.
134
+ */
135
+ function tsdk_lstatus( $file ) {
136
+ return \ThemeisleSDK\Modules\Licenser::status( $file );
137
+ }
138
+ }
139
+ if ( ! function_exists( 'tsdk_lis_valid' ) ) {
140
+ /**
141
+ * Check if license is valid.
142
+ *
143
+ * @param string $file Product basefile.
144
+ *
145
+ * @return bool Validness.
146
+ */
147
+ function tsdk_lis_valid( $file ) {
148
+ return \ThemeisleSDK\Modules\Licenser::is_valid( $file );
149
+ }
150
+ }
151
+ if ( ! function_exists( 'tsdk_lplan' ) ) {
152
+ /**
153
+ * Get license plan.
154
+ *
155
+ * @param string $file Product basefile.
156
+ *
157
+ * @return string Plan.
158
+ */
159
+ function tsdk_lplan( $file ) {
160
+ return \ThemeisleSDK\Modules\Licenser::plan( $file );
161
+ }
162
+ }
163
+
164
+ if ( ! function_exists( 'tsdk_lkey' ) ) {
165
+ /**
166
+ * Get license key.
167
+ *
168
+ * @param string $file Product basefile.
169
+ *
170
+ * @return string Key.
171
+ */
172
+ function tsdk_lkey( $file ) {
173
+ return \ThemeisleSDK\Modules\Licenser::key( $file );
174
+ }
175
+ }
vendor/codeinwp/themeisle-sdk/src/Loader.php CHANGED
@@ -56,6 +56,7 @@ final class Loader {
56
  'recommendation',
57
  'notification',
58
  'promotions',
 
59
  ];
60
 
61
  /**
56
  'recommendation',
57
  'notification',
58
  'promotions',
59
+ 'compatibilities',
60
  ];
61
 
62
  /**
vendor/codeinwp/themeisle-sdk/src/Modules/Compatibilities.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The compatibilities model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Modules
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ use ThemeisleSDK\Common\Abstract_Module;
15
+ use ThemeisleSDK\Product;
16
+
17
+ // Exit if accessed directly.
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ /**
23
+ * Promotions module for ThemeIsle SDK.
24
+ */
25
+ class Compatibilities extends Abstract_Module {
26
+ const REQUIRED = 'required';
27
+ const TESTED_UP = 'tested_up';
28
+
29
+ /**
30
+ * Should we load this module.
31
+ *
32
+ * @param Product $product Product object.
33
+ *
34
+ * @return bool
35
+ */
36
+ public function can_load( $product ) {
37
+ if ( $this->is_from_partner( $product ) ) {
38
+ return false;
39
+ }
40
+ if ( $product->is_theme() && ! current_user_can( 'switch_themes' ) ) {
41
+ return false;
42
+ }
43
+
44
+ if ( $product->is_plugin() && ! current_user_can( 'install_plugins' ) ) {
45
+ return false;
46
+ }
47
+
48
+ return true;
49
+ }
50
+
51
+ /**
52
+ * Registers the hooks.
53
+ *
54
+ * @param Product $product Product to load.
55
+ *
56
+ * @throws \Exception If the configuration is invalid.
57
+ *
58
+ * @return Compatibilities Module instance.
59
+ */
60
+ public function load( $product ) {
61
+
62
+
63
+ $this->product = $product;
64
+
65
+ $compatibilities = apply_filters( 'themeisle_sdk_compatibilities/' . $this->product->get_slug(), [] );
66
+ if ( empty( $compatibilities ) ) {
67
+ return $this;
68
+ }
69
+ $requirement = null;
70
+ $check_type = null;
71
+ foreach ( $compatibilities as $compatibility ) {
72
+
73
+ if ( empty( $compatibility['basefile'] ) ) {
74
+ return $this;
75
+ }
76
+ $requirement = new Product( $compatibility['basefile'] );
77
+ $tested_up = isset( $compatibility[ self::TESTED_UP ] ) ? $compatibility[ self::TESTED_UP ] : '999';
78
+ $required = $compatibility[ self::REQUIRED ];
79
+ if ( ! version_compare( $required, $tested_up, '<' ) ) {
80
+ throw new \Exception( sprintf( 'Invalid required/tested_up configuration. Required version %s should be lower than tested_up %s.', $required, $tested_up ) );
81
+ }
82
+ $check_type = self::REQUIRED;
83
+ if ( ! version_compare( $requirement->get_version(), $required, '<' ) ) {
84
+ $check_type = self::TESTED_UP;
85
+ if ( version_compare( $requirement->get_version(), $tested_up . '.9999', '<' ) ) {
86
+ return $this;
87
+ }
88
+ }
89
+
90
+ break;
91
+ }
92
+ if ( empty( $requirement ) ) {
93
+ return $this;
94
+ }
95
+ if ( $check_type === self::REQUIRED ) {
96
+ $this->mark_required( $product, $requirement );
97
+ }
98
+ if ( $check_type === self::TESTED_UP ) {
99
+ $this->mark_testedup( $product, $requirement );
100
+ }
101
+
102
+ return $this;
103
+ }
104
+
105
+ /**
106
+ * Mark the product tested up.
107
+ *
108
+ * @param Product $product Product object.
109
+ * @param Product $requirement Requirement object.
110
+ *
111
+ * @return void
112
+ */
113
+ public function mark_testedup( $product, $requirement ) {
114
+ add_action(
115
+ 'admin_head',
116
+ function () use ( $product, $requirement ) {
117
+ $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : '';
118
+
119
+ if ( empty( $screen ) || ! isset( $screen->id ) ) {
120
+ return;
121
+ }
122
+ if ( $requirement->is_theme() && $screen->id === 'themes' ) {
123
+ ?>
124
+ <script type="text/javascript">
125
+ jQuery(document).ready(function ($) {
126
+ setInterval(checkTheme, 500);
127
+ function checkTheme() {
128
+ var theme = jQuery( '.theme.active[data-slug="<?php echo esc_attr( $requirement->get_slug() ); ?>"]' );
129
+ var notice_id = 'testedup<?php echo esc_attr( $requirement->get_slug() . $product->get_slug() ); ?>';
130
+ var product_name = '<?php echo esc_attr( $product->get_friendly_name() ); ?>';
131
+ if (theme.length > 0 && jQuery('#' + notice_id).length === 0) {
132
+ theme.find('.theme-id-container').prepend('<div style="bottom:100%;top:auto;" id="'+notice_id+'" class="notice notice-warning"><strong>Warning:</strong> This theme has not been tested with your current version of <strong>' + product_name +'</strong>. Please update '+product_name+' plugin.</div>');
133
+ }
134
+ if (theme.length > 0 && jQuery('#' + notice_id + 'overlay').length === 0) {
135
+ jQuery('.theme-overlay.active .theme-author').after('<div style="bottom:100%;top:auto;" id="'+notice_id+'overlay" class="notice notice-warning"><p><strong>Warning:</strong> This theme has not been tested with your current version of <strong>' + product_name +'</strong>. Please update '+product_name+' plugin.</p></div>');
136
+ }
137
+ }
138
+ })
139
+
140
+ </script>
141
+ <?php
142
+ }
143
+ if ( $requirement->is_plugin() && $screen->id === 'plugins' ) {
144
+ ?>
145
+ <script type="text/javascript">
146
+ jQuery(document).ready(function ($) {
147
+ setInterval(checkPlugin, 500);
148
+ function checkPlugin() {
149
+ var plugin = jQuery( '.plugins .active[data-slug="<?php echo esc_attr( $requirement->get_slug() ); ?>"]' );
150
+ var notice_id = 'testedup<?php echo esc_attr( $requirement->get_slug() . $product->get_slug() ); ?>';
151
+ var product_name = '<?php echo esc_attr( $product->get_friendly_name() ); ?>';
152
+ var product_type = '<?php echo ( $product->is_plugin() ? 'plugin' : 'theme' ); ?>';
153
+ if (plugin.length > 0 && jQuery('#' + notice_id).length === 0) {
154
+ plugin.find('.column-description').append('<div style="bottom:100%;top:auto;" id="'+notice_id+'" class="notice notice-warning notice-alt notice-inline"><strong>Warning:</strong> This plugin has not been tested with your current version of <strong>' + product_name +'</strong>. Please update '+product_name+' '+product_type+'.</div>');
155
+ }
156
+ }
157
+ })
158
+
159
+ </script>
160
+ <?php
161
+ }
162
+ }
163
+ );
164
+
165
+ }
166
+
167
+ /**
168
+ * Mark the product requirements.
169
+ *
170
+ * @param Product $product Product object.
171
+ * @param Product $requirement Requirement object.
172
+ *
173
+ * @return void
174
+ */
175
+ public function mark_required( $product, $requirement ) {
176
+ add_filter(
177
+ 'upgrader_pre_download',
178
+ function ( $return, $package, $upgrader ) use ( $product, $requirement ) {
179
+ /**
180
+ * Upgrader object.
181
+ *
182
+ * @var \WP_Upgrader $upgrader Upgrader object.
183
+ */
184
+ $should_block = false;
185
+ if ( $product->is_theme()
186
+ && property_exists( $upgrader, 'skin' )
187
+ && property_exists( $upgrader->skin, 'theme_info' )
188
+ && $upgrader->skin->theme_info->template === $product->get_slug() ) {
189
+ $should_block = true;
190
+
191
+ }
192
+ if ( ! $should_block && $product->is_plugin()
193
+ && property_exists( $upgrader, 'skin' )
194
+ && property_exists( $upgrader->skin, 'plugin_info' )
195
+ && $upgrader->skin->plugin_info['Name'] === $product->get_name() ) {
196
+ $should_block = true;
197
+ }
198
+ if ( $should_block ) {
199
+ echo( sprintf(
200
+ '%s update requires a newer version of %s. Please %supdate%s %s %s.',
201
+ esc_attr( $product->get_friendly_name() ),
202
+ esc_attr( $requirement->get_friendly_name() ),
203
+ '<a href="' . esc_url( admin_url( $requirement->is_theme() ? 'themes.php' : 'plugins.php' ) ) . '">',
204
+ '</a>',
205
+ esc_attr( $requirement->get_friendly_name() ),
206
+ esc_attr( $requirement->is_theme() ? 'theme' : 'plugin' )
207
+ ) );
208
+ $upgrader->maintenance_mode( false );
209
+ die();
210
+ }
211
+
212
+ return $return;
213
+ },
214
+ 10,
215
+ 3
216
+ );
217
+
218
+ add_action(
219
+ 'admin_notices',
220
+ function () use ( $product, $requirement ) {
221
+ echo '<div class="notice notice-error "><p>';
222
+ echo( sprintf(
223
+ '%s requires a newer version of %s. Please %supdate%s %s %s to the latest version.',
224
+ '<strong>' . esc_attr( $product->get_friendly_name() ) . '</strong>',
225
+ '<strong>' . esc_attr( $requirement->get_friendly_name() ) . '</strong>',
226
+ '<a href="' . esc_url( admin_url( $requirement->is_theme() ? 'themes.php' : 'plugins.php' ) ) . '">',
227
+ '</a>',
228
+ '<strong>' . esc_attr( $requirement->get_friendly_name() ) . '</strong>',
229
+ esc_attr( $requirement->is_theme() ? 'theme' : 'plugin' )
230
+ ) );
231
+ echo '</p></div>';
232
+ }
233
+ );
234
+
235
+ }
236
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php CHANGED
@@ -24,13 +24,30 @@ if ( ! defined( 'ABSPATH' ) ) {
24
  * Licenser module for ThemeIsle SDK.
25
  */
26
  class Licenser extends Abstract_Module {
27
-
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Number of max failed checks before showing the license message.
30
  *
31
  * @var int $max_failed Maximum failed checks allowed before show the notice
32
  */
33
- private static $max_failed = 2;
 
 
 
 
 
 
34
  /**
35
  * License key string.
36
  *
@@ -215,6 +232,76 @@ class Licenser extends Abstract_Module {
215
  return ( 'valid' === $status && isset( $license_data->is_expired ) && 'yes' === $license_data->is_expired ) ? 'active_expired' : $status;
216
  }
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  /**
219
  * Return the last error message.
220
  *
@@ -256,12 +343,7 @@ class Licenser extends Abstract_Module {
256
  * @return int License plan.
257
  */
258
  public function get_plan() {
259
- $license_data = get_option( $this->product->get_key() . '_license_data', '' );
260
- if ( ! isset( $license_data->price_id ) ) {
261
- return - 1;
262
- }
263
-
264
- return (int) $license_data->price_id;
265
  }
266
 
267
  /**
@@ -379,7 +461,7 @@ class Licenser extends Abstract_Module {
379
  return $this->get_api_url();
380
  }
381
 
382
- return $this->get_api_url() . '/checkout/?edd_license_key=' . $license_data->key . '&download_id=' . $license_data->download_id;
383
  }
384
 
385
  /**
@@ -853,7 +935,13 @@ class Licenser extends Abstract_Module {
853
  $this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
854
  $this->register_license_hooks();
855
  }
856
-
 
 
 
 
 
 
857
  $namespace = apply_filters( 'themesle_sdk_namespace_' . md5( $product->get_basefile() ), false );
858
 
859
  if ( false !== $namespace ) {
@@ -880,6 +968,20 @@ class Licenser extends Abstract_Module {
880
  );
881
  add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
882
  add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 ); //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
 
 
 
 
 
 
 
 
 
 
 
 
 
 
883
 
884
  return $this;
885
  }
24
  * Licenser module for ThemeIsle SDK.
25
  */
26
  class Licenser extends Abstract_Module {
27
+ /**
28
+ * License VALID status string.
29
+ */
30
+ const STATUS_VALID = 'valid';
31
+ /**
32
+ * License NOT_ACTIVE status string.
33
+ */
34
+ const STATUS_NOT_ACTIVE = 'not_active';
35
+ /**
36
+ * License active expired status string.
37
+ */
38
+ const STATUS_ACTIVE_EXPIRED = 'active_expired';
39
  /**
40
  * Number of max failed checks before showing the license message.
41
  *
42
  * @var int $max_failed Maximum failed checks allowed before show the notice
43
  */
44
+ private static $max_failed = 1;
45
+ /**
46
+ * Flag to check if the global actions were loaded.
47
+ *
48
+ * @var bool If the globals actions were loaded.
49
+ */
50
+ private static $globals_loaded = false;
51
  /**
52
  * License key string.
53
  *
232
  return ( 'valid' === $status && isset( $license_data->is_expired ) && 'yes' === $license_data->is_expired ) ? 'active_expired' : $status;
233
  }
234
 
235
+ /**
236
+ * Check status.
237
+ *
238
+ * @param string $product_file Product basefile.
239
+ *
240
+ * @return string Status license.
241
+ */
242
+ public static function status( $product_file ) {
243
+ $product = Product::get( $product_file );
244
+ if ( ! $product->requires_license() ) {
245
+ return self::STATUS_VALID;
246
+ }
247
+ $license_data = self::get_license_data( $product->get_key() );
248
+
249
+ $status = isset( $license_data->license ) ? $license_data->license : self::STATUS_NOT_ACTIVE;
250
+
251
+ return ( 'valid' === $status && isset( $license_data->is_expired ) && 'yes' === $license_data->is_expired ) ? 'active_expired' : $status;
252
+ }
253
+
254
+ /**
255
+ * Product license data.
256
+ *
257
+ * @param string $key Product key.
258
+ *
259
+ * @return false|mixed|null
260
+ */
261
+ private static function get_license_data( $key ) {
262
+ $license_data = get_option( $key . '_license_data', '' );
263
+
264
+ return isset( $license_data->license ) ? $license_data : false;
265
+ }
266
+
267
+ /**
268
+ * Check if license is valid.
269
+ *
270
+ * @param string $product_file Product basefile.
271
+ *
272
+ * @return bool Is valid?
273
+ */
274
+ public static function is_valid( $product_file ) {
275
+ return self::status( $product_file ) === self::STATUS_VALID;
276
+ }
277
+
278
+ /**
279
+ * Get product plan.
280
+ *
281
+ * @param string $product_file Product file.
282
+ *
283
+ * @return int Plan id.
284
+ */
285
+ public static function plan( $product_file ) {
286
+ $product = Product::get( $product_file );
287
+ $data = self::get_license_data( $product->get_key() );
288
+
289
+ return isset( $data->price_id ) ? (int) $data->price_id : - 1;
290
+ }
291
+
292
+ /**
293
+ * Get product license key.
294
+ *
295
+ * @param string $product_file Product file.
296
+ *
297
+ * @return string
298
+ */
299
+ public static function key( $product_file ) {
300
+ $product = Product::get( $product_file );
301
+
302
+ return $product->get_license();
303
+ }
304
+
305
  /**
306
  * Return the last error message.
307
  *
343
  * @return int License plan.
344
  */
345
  public function get_plan() {
346
+ return self::plan( $this->product->get_basefile() );
 
 
 
 
 
347
  }
348
 
349
  /**
461
  return $this->get_api_url();
462
  }
463
 
464
+ return trim( $this->get_api_url(), '/' ) . '/checkout/?edd_license_key=' . $license_data->key . '&download_id=' . $license_data->download_id;
465
  }
466
 
467
  /**
935
  $this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
936
  $this->register_license_hooks();
937
  }
938
+ if ( ! self::$globals_loaded ) {
939
+ add_filter( 'themeisle_sdk_license/status', [ __CLASS__, 'status' ], 999, 1 );
940
+ add_filter( 'themeisle_sdk_license/is-valid', [ __CLASS__, 'is_valid' ], 999, 1 );
941
+ add_filter( 'themeisle_sdk_license/plan', [ __CLASS__, 'plan' ], 999, 1 );
942
+ add_filter( 'themeisle_sdk_license/key', [ __CLASS__, 'key' ], 999, 1 );
943
+ $globals_loaded = true;
944
+ }
945
  $namespace = apply_filters( 'themesle_sdk_namespace_' . md5( $product->get_basefile() ), false );
946
 
947
  if ( false !== $namespace ) {
968
  );
969
  add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
970
  add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 ); //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
971
+ if ( ! self::is_valid( $product->get_basefile() ) ) {
972
+ add_filter(
973
+ 'plugin_action_links_' . plugin_basename( $product->get_basefile() ),
974
+ function ( $actions ) {
975
+ if ( $this->get_license_status( true ) !== self::STATUS_ACTIVE_EXPIRED ) {
976
+ return $actions;
977
+ }
978
+ $new_actions['deactivate'] = $actions['deactivate'];
979
+ $new_actions['renew_link'] = '<a style="color:#d63638" href="' . esc_url( $this->renew_url() ) . '" target="_blank" rel="external noopener noreferrer">Renew license to update</a>';
980
+
981
+ return $new_actions;
982
+ }
983
+ );
984
+ }
985
 
986
  return $this;
987
  }
vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php CHANGED
@@ -701,10 +701,11 @@ class Uninstall_Feedback extends Abstract_Module {
701
  $disclosure_new_labels = apply_filters( $this->product->get_slug() . '_themeisle_sdk_disclosure_content_labels', [], $this->product );
702
  $disclosure_labels = array_merge(
703
  [
704
- 'title' => 'Below is a detailed view of all data that ThemeIsle will receive if you fill in this survey. No domain name, email address or IP addresses are transmited after you submit the survey.',
705
  'items' => [
706
  sprintf( '%s %s version %s %s %s %s', '<strong>', ucwords( $this->product->get_type() ), '</strong>', '<code>', $this->product->get_version(), '</code>' ),
707
  sprintf( '%sCurrent website:%s %s %s %s', '<strong>', '</strong>', '<code>', get_site_url(), '</code>' ),
 
708
  sprintf( '%s Uninstall reason %s %s Selected reason from the above survey %s ', '<strong>', '</strong>', '<i>', '</i>' ),
709
  ],
710
  ],
@@ -785,11 +786,12 @@ class Uninstall_Feedback extends Abstract_Module {
785
  * @return bool Is the request succesfull?
786
  */
787
  protected function call_api( $attributes ) {
788
- $slug = $this->product->get_slug();
789
- $version = $this->product->get_version();
790
- $attributes['slug'] = $slug;
791
- $attributes['version'] = $version;
792
- $attributes['url'] = get_site_url();
 
793
 
794
  $response = wp_remote_post(
795
  self::FEEDBACK_ENDPOINT,
701
  $disclosure_new_labels = apply_filters( $this->product->get_slug() . '_themeisle_sdk_disclosure_content_labels', [], $this->product );
702
  $disclosure_labels = array_merge(
703
  [
704
+ 'title' => 'Below is a detailed view of all data that ThemeIsle will receive if you fill in this survey. No email address or IP addresses are transmitted after you submit the survey.',
705
  'items' => [
706
  sprintf( '%s %s version %s %s %s %s', '<strong>', ucwords( $this->product->get_type() ), '</strong>', '<code>', $this->product->get_version(), '</code>' ),
707
  sprintf( '%sCurrent website:%s %s %s %s', '<strong>', '</strong>', '<code>', get_site_url(), '</code>' ),
708
+ sprintf( '%sUsage time:%s %s %s%s', '<strong>', '</strong>', '<code>', ( time() - $this->product->get_install_time() ), 's</code>' ),
709
  sprintf( '%s Uninstall reason %s %s Selected reason from the above survey %s ', '<strong>', '</strong>', '<i>', '</i>' ),
710
  ],
711
  ],
786
  * @return bool Is the request succesfull?
787
  */
788
  protected function call_api( $attributes ) {
789
+ $slug = $this->product->get_slug();
790
+ $version = $this->product->get_version();
791
+ $attributes['slug'] = $slug;
792
+ $attributes['version'] = $version;
793
+ $attributes['url'] = get_site_url();
794
+ $attributes['active_time'] = ( time() - $this->product->get_install_time() );
795
 
796
  $response = wp_remote_post(
797
  self::FEEDBACK_ENDPOINT,
vendor/codeinwp/themeisle-sdk/src/Product.php CHANGED
@@ -106,10 +106,17 @@ class Product {
106
  * @var string $version The product version.
107
  */
108
  private $version;
 
 
 
 
 
 
109
  /**
110
  * Root api endpoint.
111
  */
112
  const API_URL = 'https://api.themeisle.com/';
 
113
  /**
114
  * ThemeIsle_SDK_Product constructor.
115
  *
@@ -128,8 +135,25 @@ class Product {
128
  $install = time();
129
  update_option( $this->get_key() . '_install', time() );
130
  }
131
- $this->install = $install;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
 
133
  }
134
 
135
  /**
106
  * @var string $version The product version.
107
  */
108
  private $version;
109
+ /**
110
+ * Holds a map of loaded products objects.
111
+ *
112
+ * @var array Array of loaded products.
113
+ */
114
+ private static $cached_products = [];
115
  /**
116
  * Root api endpoint.
117
  */
118
  const API_URL = 'https://api.themeisle.com/';
119
+
120
  /**
121
  * ThemeIsle_SDK_Product constructor.
122
  *
135
  $install = time();
136
  update_option( $this->get_key() . '_install', time() );
137
  }
138
+ $this->install = $install;
139
+ self::$cached_products[ crc32( $basefile ) ] = $this;
140
+ }
141
+
142
+ /**
143
+ * Return a product.
144
+ *
145
+ * @param string $basefile Product basefile.
146
+ *
147
+ * @return Product Product Object.
148
+ */
149
+ public static function get( $basefile ) {
150
+ $key = crc32( $basefile );
151
+ if ( isset( self::$cached_products[ $key ] ) ) {
152
+ return self::$cached_products[ $key ];
153
+ }
154
+ self::$cached_products[ $key ] = new Product( $basefile );
155
 
156
+ return self::$cached_products[ $key ];
157
  }
158
 
159
  /**
vendor/codeinwp/themeisle-sdk/start.php CHANGED
@@ -33,6 +33,7 @@ $files_to_load = [
33
  $themeisle_library_path . '/src/Modules/Review.php',
34
  $themeisle_library_path . '/src/Modules/Recommendation.php',
35
  $themeisle_library_path . '/src/Modules/Promotions.php',
 
36
  ];
37
 
38
  $files_to_load = array_merge( $files_to_load, apply_filters( 'themeisle_sdk_required_files', [] ) );
33
  $themeisle_library_path . '/src/Modules/Review.php',
34
  $themeisle_library_path . '/src/Modules/Recommendation.php',
35
  $themeisle_library_path . '/src/Modules/Promotions.php',
36
+ $themeisle_library_path . '/src/Modules/Compatibilities.php',
37
  ];
38
 
39
  $files_to_load = array_merge( $files_to_load, apply_filters( 'themeisle_sdk_required_files', [] ) );
vendor/composer/autoload_classmap.php CHANGED
@@ -6,45 +6,71 @@ $vendorDir = dirname(__DIR__);
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  'Clue\\StreamFilter\\CallbackFilter' => $vendorDir . '/clue/stream-filter/src/CallbackFilter.php',
10
  'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
11
- 'GuzzleHttp\\Psr7\\AppendStream' => $vendorDir . '/guzzlehttp/psr7/src/AppendStream.php',
12
- 'GuzzleHttp\\Psr7\\BufferStream' => $vendorDir . '/guzzlehttp/psr7/src/BufferStream.php',
13
- 'GuzzleHttp\\Psr7\\CachingStream' => $vendorDir . '/guzzlehttp/psr7/src/CachingStream.php',
14
- 'GuzzleHttp\\Psr7\\DroppingStream' => $vendorDir . '/guzzlehttp/psr7/src/DroppingStream.php',
15
- 'GuzzleHttp\\Psr7\\FnStream' => $vendorDir . '/guzzlehttp/psr7/src/FnStream.php',
16
- 'GuzzleHttp\\Psr7\\Header' => $vendorDir . '/guzzlehttp/psr7/src/Header.php',
17
- 'GuzzleHttp\\Psr7\\InflateStream' => $vendorDir . '/guzzlehttp/psr7/src/InflateStream.php',
18
- 'GuzzleHttp\\Psr7\\LazyOpenStream' => $vendorDir . '/guzzlehttp/psr7/src/LazyOpenStream.php',
19
- 'GuzzleHttp\\Psr7\\LimitStream' => $vendorDir . '/guzzlehttp/psr7/src/LimitStream.php',
20
- 'GuzzleHttp\\Psr7\\Message' => $vendorDir . '/guzzlehttp/psr7/src/Message.php',
21
- 'GuzzleHttp\\Psr7\\MessageTrait' => $vendorDir . '/guzzlehttp/psr7/src/MessageTrait.php',
22
- 'GuzzleHttp\\Psr7\\MimeType' => $vendorDir . '/guzzlehttp/psr7/src/MimeType.php',
23
- 'GuzzleHttp\\Psr7\\MultipartStream' => $vendorDir . '/guzzlehttp/psr7/src/MultipartStream.php',
24
- 'GuzzleHttp\\Psr7\\NoSeekStream' => $vendorDir . '/guzzlehttp/psr7/src/NoSeekStream.php',
25
- 'GuzzleHttp\\Psr7\\PumpStream' => $vendorDir . '/guzzlehttp/psr7/src/PumpStream.php',
26
- 'GuzzleHttp\\Psr7\\Query' => $vendorDir . '/guzzlehttp/psr7/src/Query.php',
27
- 'GuzzleHttp\\Psr7\\Request' => $vendorDir . '/guzzlehttp/psr7/src/Request.php',
28
- 'GuzzleHttp\\Psr7\\Response' => $vendorDir . '/guzzlehttp/psr7/src/Response.php',
29
- 'GuzzleHttp\\Psr7\\Rfc7230' => $vendorDir . '/guzzlehttp/psr7/src/Rfc7230.php',
30
- 'GuzzleHttp\\Psr7\\ServerRequest' => $vendorDir . '/guzzlehttp/psr7/src/ServerRequest.php',
31
- 'GuzzleHttp\\Psr7\\Stream' => $vendorDir . '/guzzlehttp/psr7/src/Stream.php',
32
- 'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => $vendorDir . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php',
33
- 'GuzzleHttp\\Psr7\\StreamWrapper' => $vendorDir . '/guzzlehttp/psr7/src/StreamWrapper.php',
34
- 'GuzzleHttp\\Psr7\\UploadedFile' => $vendorDir . '/guzzlehttp/psr7/src/UploadedFile.php',
35
- 'GuzzleHttp\\Psr7\\Uri' => $vendorDir . '/guzzlehttp/psr7/src/Uri.php',
36
- 'GuzzleHttp\\Psr7\\UriComparator' => $vendorDir . '/guzzlehttp/psr7/src/UriComparator.php',
37
- 'GuzzleHttp\\Psr7\\UriNormalizer' => $vendorDir . '/guzzlehttp/psr7/src/UriNormalizer.php',
38
- 'GuzzleHttp\\Psr7\\UriResolver' => $vendorDir . '/guzzlehttp/psr7/src/UriResolver.php',
39
- 'GuzzleHttp\\Psr7\\Utils' => $vendorDir . '/guzzlehttp/psr7/src/Utils.php',
40
- 'Http\\Client\\Curl\\Client' => $vendorDir . '/php-http/curl-client/src/Client.php',
41
- 'Http\\Client\\Curl\\CurlPromise' => $vendorDir . '/php-http/curl-client/src/CurlPromise.php',
42
- 'Http\\Client\\Curl\\MultiRunner' => $vendorDir . '/php-http/curl-client/src/MultiRunner.php',
43
- 'Http\\Client\\Curl\\PromiseCore' => $vendorDir . '/php-http/curl-client/src/PromiseCore.php',
44
- 'Http\\Client\\Curl\\ResponseBuilder' => $vendorDir . '/php-http/curl-client/src/ResponseBuilder.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  'Http\\Client\\Exception' => $vendorDir . '/php-http/httplug/src/Exception.php',
46
  'Http\\Client\\Exception\\HttpException' => $vendorDir . '/php-http/httplug/src/Exception/HttpException.php',
47
  'Http\\Client\\Exception\\NetworkException' => $vendorDir . '/php-http/httplug/src/Exception/NetworkException.php',
 
48
  'Http\\Client\\Exception\\RequestException' => $vendorDir . '/php-http/httplug/src/Exception/RequestException.php',
49
  'Http\\Client\\Exception\\TransferException' => $vendorDir . '/php-http/httplug/src/Exception/TransferException.php',
50
  'Http\\Client\\HttpAsyncClient' => $vendorDir . '/php-http/httplug/src/HttpAsyncClient.php',
@@ -77,6 +103,7 @@ return array(
77
  'Http\\Message\\Authentication\\BasicAuth' => $vendorDir . '/php-http/message/src/Authentication/BasicAuth.php',
78
  'Http\\Message\\Authentication\\Bearer' => $vendorDir . '/php-http/message/src/Authentication/Bearer.php',
79
  'Http\\Message\\Authentication\\Chain' => $vendorDir . '/php-http/message/src/Authentication/Chain.php',
 
80
  'Http\\Message\\Authentication\\Matching' => $vendorDir . '/php-http/message/src/Authentication/Matching.php',
81
  'Http\\Message\\Authentication\\QueryParam' => $vendorDir . '/php-http/message/src/Authentication/QueryParam.php',
82
  'Http\\Message\\Authentication\\RequestConditional' => $vendorDir . '/php-http/message/src/Authentication/RequestConditional.php',
@@ -127,6 +154,7 @@ return array(
127
  'Http\\Promise\\FulfilledPromise' => $vendorDir . '/php-http/promise/src/FulfilledPromise.php',
128
  'Http\\Promise\\Promise' => $vendorDir . '/php-http/promise/src/Promise.php',
129
  'Http\\Promise\\RejectedPromise' => $vendorDir . '/php-http/promise/src/RejectedPromise.php',
 
130
  'MailerLiteApi\\Api\\Campaigns' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Campaigns.php',
131
  'MailerLiteApi\\Api\\Fields' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Fields.php',
132
  'MailerLiteApi\\Api\\Groups' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Groups.php',
@@ -134,17 +162,58 @@ return array(
134
  'MailerLiteApi\\Api\\Settings' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Settings.php',
135
  'MailerLiteApi\\Api\\Stats' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Stats.php',
136
  'MailerLiteApi\\Api\\Subscribers' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Subscribers.php',
 
137
  'MailerLiteApi\\Common\\ApiAbstract' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/ApiAbstract.php',
138
  'MailerLiteApi\\Common\\ApiConstants' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/ApiConstants.php',
 
139
  'MailerLiteApi\\Common\\Collection' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/Collection.php',
140
  'MailerLiteApi\\Common\\RestClient' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/RestClient.php',
141
  'MailerLiteApi\\Exceptions\\MailerLiteSdkException' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Exceptions/MailerLiteSdkException.php',
142
  'MailerLiteApi\\MailerLite' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/MailerLite.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  'Psr\\Http\\Message\\MessageInterface' => $vendorDir . '/psr/http-message/src/MessageInterface.php',
 
144
  'Psr\\Http\\Message\\RequestInterface' => $vendorDir . '/psr/http-message/src/RequestInterface.php',
 
145
  'Psr\\Http\\Message\\ResponseInterface' => $vendorDir . '/psr/http-message/src/ResponseInterface.php',
 
146
  'Psr\\Http\\Message\\ServerRequestInterface' => $vendorDir . '/psr/http-message/src/ServerRequestInterface.php',
 
147
  'Psr\\Http\\Message\\StreamInterface' => $vendorDir . '/psr/http-message/src/StreamInterface.php',
 
148
  'Psr\\Http\\Message\\UploadedFileInterface' => $vendorDir . '/psr/http-message/src/UploadedFileInterface.php',
 
149
  'Psr\\Http\\Message\\UriInterface' => $vendorDir . '/psr/http-message/src/UriInterface.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
10
  'Clue\\StreamFilter\\CallbackFilter' => $vendorDir . '/clue/stream-filter/src/CallbackFilter.php',
11
  'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
12
+ 'Http\\Client\\Common\\BatchClient' => $vendorDir . '/php-http/client-common/src/BatchClient.php',
13
+ 'Http\\Client\\Common\\BatchClientInterface' => $vendorDir . '/php-http/client-common/src/BatchClientInterface.php',
14
+ 'Http\\Client\\Common\\BatchResult' => $vendorDir . '/php-http/client-common/src/BatchResult.php',
15
+ 'Http\\Client\\Common\\Deferred' => $vendorDir . '/php-http/client-common/src/Deferred.php',
16
+ 'Http\\Client\\Common\\EmulatedHttpAsyncClient' => $vendorDir . '/php-http/client-common/src/EmulatedHttpAsyncClient.php',
17
+ 'Http\\Client\\Common\\EmulatedHttpClient' => $vendorDir . '/php-http/client-common/src/EmulatedHttpClient.php',
18
+ 'Http\\Client\\Common\\Exception\\BatchException' => $vendorDir . '/php-http/client-common/src/Exception/BatchException.php',
19
+ 'Http\\Client\\Common\\Exception\\CircularRedirectionException' => $vendorDir . '/php-http/client-common/src/Exception/CircularRedirectionException.php',
20
+ 'Http\\Client\\Common\\Exception\\ClientErrorException' => $vendorDir . '/php-http/client-common/src/Exception/ClientErrorException.php',
21
+ 'Http\\Client\\Common\\Exception\\HttpClientNoMatchException' => $vendorDir . '/php-http/client-common/src/Exception/HttpClientNoMatchException.php',
22
+ 'Http\\Client\\Common\\Exception\\HttpClientNotFoundException' => $vendorDir . '/php-http/client-common/src/Exception/HttpClientNotFoundException.php',
23
+ 'Http\\Client\\Common\\Exception\\LoopException' => $vendorDir . '/php-http/client-common/src/Exception/LoopException.php',
24
+ 'Http\\Client\\Common\\Exception\\MultipleRedirectionException' => $vendorDir . '/php-http/client-common/src/Exception/MultipleRedirectionException.php',
25
+ 'Http\\Client\\Common\\Exception\\ServerErrorException' => $vendorDir . '/php-http/client-common/src/Exception/ServerErrorException.php',
26
+ 'Http\\Client\\Common\\FlexibleHttpClient' => $vendorDir . '/php-http/client-common/src/FlexibleHttpClient.php',
27
+ 'Http\\Client\\Common\\HttpAsyncClientDecorator' => $vendorDir . '/php-http/client-common/src/HttpAsyncClientDecorator.php',
28
+ 'Http\\Client\\Common\\HttpAsyncClientEmulator' => $vendorDir . '/php-http/client-common/src/HttpAsyncClientEmulator.php',
29
+ 'Http\\Client\\Common\\HttpClientDecorator' => $vendorDir . '/php-http/client-common/src/HttpClientDecorator.php',
30
+ 'Http\\Client\\Common\\HttpClientEmulator' => $vendorDir . '/php-http/client-common/src/HttpClientEmulator.php',
31
+ 'Http\\Client\\Common\\HttpClientPool' => $vendorDir . '/php-http/client-common/src/HttpClientPool.php',
32
+ 'Http\\Client\\Common\\HttpClientPool\\HttpClientPool' => $vendorDir . '/php-http/client-common/src/HttpClientPool/HttpClientPool.php',
33
+ 'Http\\Client\\Common\\HttpClientPool\\HttpClientPoolItem' => $vendorDir . '/php-http/client-common/src/HttpClientPool/HttpClientPoolItem.php',
34
+ 'Http\\Client\\Common\\HttpClientPool\\LeastUsedClientPool' => $vendorDir . '/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php',
35
+ 'Http\\Client\\Common\\HttpClientPool\\RandomClientPool' => $vendorDir . '/php-http/client-common/src/HttpClientPool/RandomClientPool.php',
36
+ 'Http\\Client\\Common\\HttpClientPool\\RoundRobinClientPool' => $vendorDir . '/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php',
37
+ 'Http\\Client\\Common\\HttpClientRouter' => $vendorDir . '/php-http/client-common/src/HttpClientRouter.php',
38
+ 'Http\\Client\\Common\\HttpClientRouterInterface' => $vendorDir . '/php-http/client-common/src/HttpClientRouterInterface.php',
39
+ 'Http\\Client\\Common\\HttpMethodsClient' => $vendorDir . '/php-http/client-common/src/HttpMethodsClient.php',
40
+ 'Http\\Client\\Common\\HttpMethodsClientInterface' => $vendorDir . '/php-http/client-common/src/HttpMethodsClientInterface.php',
41
+ 'Http\\Client\\Common\\Plugin' => $vendorDir . '/php-http/client-common/src/Plugin.php',
42
+ 'Http\\Client\\Common\\PluginChain' => $vendorDir . '/php-http/client-common/src/PluginChain.php',
43
+ 'Http\\Client\\Common\\PluginClient' => $vendorDir . '/php-http/client-common/src/PluginClient.php',
44
+ 'Http\\Client\\Common\\PluginClientBuilder' => $vendorDir . '/php-http/client-common/src/PluginClientBuilder.php',
45
+ 'Http\\Client\\Common\\PluginClientFactory' => $vendorDir . '/php-http/client-common/src/PluginClientFactory.php',
46
+ 'Http\\Client\\Common\\Plugin\\AddHostPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/AddHostPlugin.php',
47
+ 'Http\\Client\\Common\\Plugin\\AddPathPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/AddPathPlugin.php',
48
+ 'Http\\Client\\Common\\Plugin\\AuthenticationPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/AuthenticationPlugin.php',
49
+ 'Http\\Client\\Common\\Plugin\\BaseUriPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/BaseUriPlugin.php',
50
+ 'Http\\Client\\Common\\Plugin\\ContentLengthPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/ContentLengthPlugin.php',
51
+ 'Http\\Client\\Common\\Plugin\\ContentTypePlugin' => $vendorDir . '/php-http/client-common/src/Plugin/ContentTypePlugin.php',
52
+ 'Http\\Client\\Common\\Plugin\\CookiePlugin' => $vendorDir . '/php-http/client-common/src/Plugin/CookiePlugin.php',
53
+ 'Http\\Client\\Common\\Plugin\\DecoderPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/DecoderPlugin.php',
54
+ 'Http\\Client\\Common\\Plugin\\ErrorPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/ErrorPlugin.php',
55
+ 'Http\\Client\\Common\\Plugin\\HeaderAppendPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/HeaderAppendPlugin.php',
56
+ 'Http\\Client\\Common\\Plugin\\HeaderDefaultsPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php',
57
+ 'Http\\Client\\Common\\Plugin\\HeaderRemovePlugin' => $vendorDir . '/php-http/client-common/src/Plugin/HeaderRemovePlugin.php',
58
+ 'Http\\Client\\Common\\Plugin\\HeaderSetPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/HeaderSetPlugin.php',
59
+ 'Http\\Client\\Common\\Plugin\\HistoryPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/HistoryPlugin.php',
60
+ 'Http\\Client\\Common\\Plugin\\Journal' => $vendorDir . '/php-http/client-common/src/Plugin/Journal.php',
61
+ 'Http\\Client\\Common\\Plugin\\QueryDefaultsPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php',
62
+ 'Http\\Client\\Common\\Plugin\\RedirectPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/RedirectPlugin.php',
63
+ 'Http\\Client\\Common\\Plugin\\RequestMatcherPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/RequestMatcherPlugin.php',
64
+ 'Http\\Client\\Common\\Plugin\\RequestSeekableBodyPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/RequestSeekableBodyPlugin.php',
65
+ 'Http\\Client\\Common\\Plugin\\ResponseSeekableBodyPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/ResponseSeekableBodyPlugin.php',
66
+ 'Http\\Client\\Common\\Plugin\\RetryPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/RetryPlugin.php',
67
+ 'Http\\Client\\Common\\Plugin\\SeekableBodyPlugin' => $vendorDir . '/php-http/client-common/src/Plugin/SeekableBodyPlugin.php',
68
+ 'Http\\Client\\Common\\Plugin\\VersionBridgePlugin' => $vendorDir . '/php-http/client-common/src/Plugin/VersionBridgePlugin.php',
69
+ 'Http\\Client\\Common\\VersionBridgeClient' => $vendorDir . '/php-http/client-common/src/VersionBridgeClient.php',
70
  'Http\\Client\\Exception' => $vendorDir . '/php-http/httplug/src/Exception.php',
71
  'Http\\Client\\Exception\\HttpException' => $vendorDir . '/php-http/httplug/src/Exception/HttpException.php',
72
  'Http\\Client\\Exception\\NetworkException' => $vendorDir . '/php-http/httplug/src/Exception/NetworkException.php',
73
+ 'Http\\Client\\Exception\\RequestAwareTrait' => $vendorDir . '/php-http/httplug/src/Exception/RequestAwareTrait.php',
74
  'Http\\Client\\Exception\\RequestException' => $vendorDir . '/php-http/httplug/src/Exception/RequestException.php',
75
  'Http\\Client\\Exception\\TransferException' => $vendorDir . '/php-http/httplug/src/Exception/TransferException.php',
76
  'Http\\Client\\HttpAsyncClient' => $vendorDir . '/php-http/httplug/src/HttpAsyncClient.php',
103
  'Http\\Message\\Authentication\\BasicAuth' => $vendorDir . '/php-http/message/src/Authentication/BasicAuth.php',
104
  'Http\\Message\\Authentication\\Bearer' => $vendorDir . '/php-http/message/src/Authentication/Bearer.php',
105
  'Http\\Message\\Authentication\\Chain' => $vendorDir . '/php-http/message/src/Authentication/Chain.php',
106
+ 'Http\\Message\\Authentication\\Header' => $vendorDir . '/php-http/message/src/Authentication/Header.php',
107
  'Http\\Message\\Authentication\\Matching' => $vendorDir . '/php-http/message/src/Authentication/Matching.php',
108
  'Http\\Message\\Authentication\\QueryParam' => $vendorDir . '/php-http/message/src/Authentication/QueryParam.php',
109
  'Http\\Message\\Authentication\\RequestConditional' => $vendorDir . '/php-http/message/src/Authentication/RequestConditional.php',
154
  'Http\\Promise\\FulfilledPromise' => $vendorDir . '/php-http/promise/src/FulfilledPromise.php',
155
  'Http\\Promise\\Promise' => $vendorDir . '/php-http/promise/src/Promise.php',
156
  'Http\\Promise\\RejectedPromise' => $vendorDir . '/php-http/promise/src/RejectedPromise.php',
157
+ 'MailerLiteApi\\Api\\Batch' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Batch.php',
158
  'MailerLiteApi\\Api\\Campaigns' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Campaigns.php',
159
  'MailerLiteApi\\Api\\Fields' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Fields.php',
160
  'MailerLiteApi\\Api\\Groups' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Groups.php',
162
  'MailerLiteApi\\Api\\Settings' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Settings.php',
163
  'MailerLiteApi\\Api\\Stats' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Stats.php',
164
  'MailerLiteApi\\Api\\Subscribers' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Subscribers.php',
165
+ 'MailerLiteApi\\Api\\WooCommerce' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/WooCommerce.php',
166
  'MailerLiteApi\\Common\\ApiAbstract' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/ApiAbstract.php',
167
  'MailerLiteApi\\Common\\ApiConstants' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/ApiConstants.php',
168
+ 'MailerLiteApi\\Common\\BatchRequest' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/BatchRequest.php',
169
  'MailerLiteApi\\Common\\Collection' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/Collection.php',
170
  'MailerLiteApi\\Common\\RestClient' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/RestClient.php',
171
  'MailerLiteApi\\Exceptions\\MailerLiteSdkException' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/Exceptions/MailerLiteSdkException.php',
172
  'MailerLiteApi\\MailerLite' => $vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src/MailerLite.php',
173
+ 'Nyholm\\Psr7\\Factory\\HttplugFactory' => $vendorDir . '/nyholm/psr7/src/Factory/HttplugFactory.php',
174
+ 'Nyholm\\Psr7\\Factory\\Psr17Factory' => $vendorDir . '/nyholm/psr7/src/Factory/Psr17Factory.php',
175
+ 'Nyholm\\Psr7\\MessageTrait' => $vendorDir . '/nyholm/psr7/src/MessageTrait.php',
176
+ 'Nyholm\\Psr7\\Request' => $vendorDir . '/nyholm/psr7/src/Request.php',
177
+ 'Nyholm\\Psr7\\RequestTrait' => $vendorDir . '/nyholm/psr7/src/RequestTrait.php',
178
+ 'Nyholm\\Psr7\\Response' => $vendorDir . '/nyholm/psr7/src/Response.php',
179
+ 'Nyholm\\Psr7\\ServerRequest' => $vendorDir . '/nyholm/psr7/src/ServerRequest.php',
180
+ 'Nyholm\\Psr7\\Stream' => $vendorDir . '/nyholm/psr7/src/Stream.php',
181
+ 'Nyholm\\Psr7\\UploadedFile' => $vendorDir . '/nyholm/psr7/src/UploadedFile.php',
182
+ 'Nyholm\\Psr7\\Uri' => $vendorDir . '/nyholm/psr7/src/Uri.php',
183
+ 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
184
+ 'Psr\\Http\\Client\\ClientExceptionInterface' => $vendorDir . '/psr/http-client/src/ClientExceptionInterface.php',
185
+ 'Psr\\Http\\Client\\ClientInterface' => $vendorDir . '/psr/http-client/src/ClientInterface.php',
186
+ 'Psr\\Http\\Client\\NetworkExceptionInterface' => $vendorDir . '/psr/http-client/src/NetworkExceptionInterface.php',
187
+ 'Psr\\Http\\Client\\RequestExceptionInterface' => $vendorDir . '/psr/http-client/src/RequestExceptionInterface.php',
188
  'Psr\\Http\\Message\\MessageInterface' => $vendorDir . '/psr/http-message/src/MessageInterface.php',
189
+ 'Psr\\Http\\Message\\RequestFactoryInterface' => $vendorDir . '/psr/http-factory/src/RequestFactoryInterface.php',
190
  'Psr\\Http\\Message\\RequestInterface' => $vendorDir . '/psr/http-message/src/RequestInterface.php',
191
+ 'Psr\\Http\\Message\\ResponseFactoryInterface' => $vendorDir . '/psr/http-factory/src/ResponseFactoryInterface.php',
192
  'Psr\\Http\\Message\\ResponseInterface' => $vendorDir . '/psr/http-message/src/ResponseInterface.php',
193
+ 'Psr\\Http\\Message\\ServerRequestFactoryInterface' => $vendorDir . '/psr/http-factory/src/ServerRequestFactoryInterface.php',
194
  'Psr\\Http\\Message\\ServerRequestInterface' => $vendorDir . '/psr/http-message/src/ServerRequestInterface.php',
195
+ 'Psr\\Http\\Message\\StreamFactoryInterface' => $vendorDir . '/psr/http-factory/src/StreamFactoryInterface.php',
196
  'Psr\\Http\\Message\\StreamInterface' => $vendorDir . '/psr/http-message/src/StreamInterface.php',
197
+ 'Psr\\Http\\Message\\UploadedFileFactoryInterface' => $vendorDir . '/psr/http-factory/src/UploadedFileFactoryInterface.php',
198
  'Psr\\Http\\Message\\UploadedFileInterface' => $vendorDir . '/psr/http-message/src/UploadedFileInterface.php',
199
+ 'Psr\\Http\\Message\\UriFactoryInterface' => $vendorDir . '/psr/http-factory/src/UriFactoryInterface.php',
200
  'Psr\\Http\\Message\\UriInterface' => $vendorDir . '/psr/http-message/src/UriInterface.php',
201
+ 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
202
+ 'Symfony\\Component\\OptionsResolver\\Debug\\OptionsResolverIntrospector' => $vendorDir . '/symfony/options-resolver/Debug/OptionsResolverIntrospector.php',
203
+ 'Symfony\\Component\\OptionsResolver\\Exception\\AccessException' => $vendorDir . '/symfony/options-resolver/Exception/AccessException.php',
204
+ 'Symfony\\Component\\OptionsResolver\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/options-resolver/Exception/ExceptionInterface.php',
205
+ 'Symfony\\Component\\OptionsResolver\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/options-resolver/Exception/InvalidArgumentException.php',
206
+ 'Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/InvalidOptionsException.php',
207
+ 'Symfony\\Component\\OptionsResolver\\Exception\\MissingOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/MissingOptionsException.php',
208
+ 'Symfony\\Component\\OptionsResolver\\Exception\\NoConfigurationException' => $vendorDir . '/symfony/options-resolver/Exception/NoConfigurationException.php',
209
+ 'Symfony\\Component\\OptionsResolver\\Exception\\NoSuchOptionException' => $vendorDir . '/symfony/options-resolver/Exception/NoSuchOptionException.php',
210
+ 'Symfony\\Component\\OptionsResolver\\Exception\\OptionDefinitionException' => $vendorDir . '/symfony/options-resolver/Exception/OptionDefinitionException.php',
211
+ 'Symfony\\Component\\OptionsResolver\\Exception\\UndefinedOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/UndefinedOptionsException.php',
212
+ 'Symfony\\Component\\OptionsResolver\\OptionConfigurator' => $vendorDir . '/symfony/options-resolver/OptionConfigurator.php',
213
+ 'Symfony\\Component\\OptionsResolver\\Options' => $vendorDir . '/symfony/options-resolver/Options.php',
214
+ 'Symfony\\Component\\OptionsResolver\\OptionsResolver' => $vendorDir . '/symfony/options-resolver/OptionsResolver.php',
215
+ 'Symfony\\Polyfill\\Php80\\Php80' => $vendorDir . '/symfony/polyfill-php80/Php80.php',
216
+ 'Symfony\\Polyfill\\Php80\\PhpToken' => $vendorDir . '/symfony/polyfill-php80/PhpToken.php',
217
+ 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
218
+ 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
219
  );
vendor/composer/autoload_files.php CHANGED
@@ -7,9 +7,9 @@ $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
  '9c67151ae59aff4788964ce8eb2a0f43' => $vendorDir . '/clue/stream-filter/src/functions_include.php',
 
10
  '8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php',
11
- '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
12
- 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
13
  '2e85745cdd367ff6e5579a8598f422b9' => $vendorDir . '/codeinwp/elementor-extra-widgets/load.php',
14
  '62bc7c35996f19a64625f7ff3ba2fb5e' => $vendorDir . '/codeinwp/full-width-page-templates/load.php',
15
  '7b1f4385ddfc86d120fe4380e8cb0fa6' => $vendorDir . '/codeinwp/themeisle-content-forms/load.php',
7
 
8
  return array(
9
  '9c67151ae59aff4788964ce8eb2a0f43' => $vendorDir . '/clue/stream-filter/src/functions_include.php',
10
+ '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
11
  '8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php',
12
+ 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
 
13
  '2e85745cdd367ff6e5579a8598f422b9' => $vendorDir . '/codeinwp/elementor-extra-widgets/load.php',
14
  '62bc7c35996f19a64625f7ff3ba2fb5e' => $vendorDir . '/codeinwp/full-width-page-templates/load.php',
15
  '7b1f4385ddfc86d120fe4380e8cb0fa6' => $vendorDir . '/codeinwp/themeisle-content-forms/load.php',
vendor/composer/autoload_psr4.php CHANGED
@@ -6,13 +6,16 @@ $vendorDir = dirname(__DIR__);
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
 
 
 
 
10
  'MailerLiteApi\\' => array($vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src'),
11
  'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'),
12
  'Http\\Message\\' => array($vendorDir . '/php-http/message-factory/src', $vendorDir . '/php-http/message/src'),
13
  'Http\\Discovery\\' => array($vendorDir . '/php-http/discovery/src'),
14
- 'Http\\Client\\Curl\\' => array($vendorDir . '/php-http/curl-client/src'),
15
  'Http\\Client\\' => array($vendorDir . '/php-http/httplug/src'),
16
- 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
17
  'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'),
18
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
10
+ 'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
11
+ 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
12
+ 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
13
+ 'Nyholm\\Psr7\\' => array($vendorDir . '/nyholm/psr7/src'),
14
  'MailerLiteApi\\' => array($vendorDir . '/mailerlite/mailerlite-api-v2-php-sdk/src'),
15
  'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'),
16
  'Http\\Message\\' => array($vendorDir . '/php-http/message-factory/src', $vendorDir . '/php-http/message/src'),
17
  'Http\\Discovery\\' => array($vendorDir . '/php-http/discovery/src'),
18
+ 'Http\\Client\\Common\\' => array($vendorDir . '/php-http/client-common/src'),
19
  'Http\\Client\\' => array($vendorDir . '/php-http/httplug/src'),
 
20
  'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'),
21
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit30e8e22007888ae720651c031afd07f4
6
  {
7
  private static $loader;
8
 
@@ -22,20 +22,18 @@ class ComposerAutoloaderInit30e8e22007888ae720651c031afd07f4
22
  return self::$loader;
23
  }
24
 
25
- require __DIR__ . '/platform_check.php';
26
-
27
- spl_autoload_register(array('ComposerAutoloaderInit30e8e22007888ae720651c031afd07f4', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29
- spl_autoload_unregister(array('ComposerAutoloaderInit30e8e22007888ae720651c031afd07f4', 'loadClassLoader'));
30
 
31
  require __DIR__ . '/autoload_static.php';
32
- call_user_func(\Composer\Autoload\ComposerStaticInit30e8e22007888ae720651c031afd07f4::getInitializer($loader));
33
 
34
  $loader->register(true);
35
 
36
- $includeFiles = \Composer\Autoload\ComposerStaticInit30e8e22007888ae720651c031afd07f4::$files;
37
  foreach ($includeFiles as $fileIdentifier => $file) {
38
- composerRequire30e8e22007888ae720651c031afd07f4($fileIdentifier, $file);
39
  }
40
 
41
  return $loader;
@@ -47,7 +45,7 @@ class ComposerAutoloaderInit30e8e22007888ae720651c031afd07f4
47
  * @param string $file
48
  * @return void
49
  */
50
- function composerRequire30e8e22007888ae720651c031afd07f4($fileIdentifier, $file)
51
  {
52
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
53
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit64eb01b4d71e339a1f4c3fb7643dc86a
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit64eb01b4d71e339a1f4c3fb7643dc86a', 'loadClassLoader'), true, true);
 
 
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit64eb01b4d71e339a1f4c3fb7643dc86a', 'loadClassLoader'));
28
 
29
  require __DIR__ . '/autoload_static.php';
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit64eb01b4d71e339a1f4c3fb7643dc86a::getInitializer($loader));
31
 
32
  $loader->register(true);
33
 
34
+ $includeFiles = \Composer\Autoload\ComposerStaticInit64eb01b4d71e339a1f4c3fb7643dc86a::$files;
35
  foreach ($includeFiles as $fileIdentifier => $file) {
36
+ composerRequire64eb01b4d71e339a1f4c3fb7643dc86a($fileIdentifier, $file);
37
  }
38
 
39
  return $loader;
45
  * @param string $file
46
  * @return void
47
  */
48
+ function composerRequire64eb01b4d71e339a1f4c3fb7643dc86a($fileIdentifier, $file)
49
  {
50
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
51
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
vendor/composer/autoload_static.php CHANGED
@@ -4,13 +4,13 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit30e8e22007888ae720651c031afd07f4
8
  {
9
  public static $files = array (
10
  '9c67151ae59aff4788964ce8eb2a0f43' => __DIR__ . '/..' . '/clue/stream-filter/src/functions_include.php',
 
11
  '8cff32064859f4559445b89279f3199c' => __DIR__ . '/..' . '/php-http/message/src/filters.php',
12
- '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
13
- 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
14
  '2e85745cdd367ff6e5579a8598f422b9' => __DIR__ . '/..' . '/codeinwp/elementor-extra-widgets/load.php',
15
  '62bc7c35996f19a64625f7ff3ba2fb5e' => __DIR__ . '/..' . '/codeinwp/full-width-page-templates/load.php',
16
  '7b1f4385ddfc86d120fe4380e8cb0fa6' => __DIR__ . '/..' . '/codeinwp/themeisle-content-forms/load.php',
@@ -19,9 +19,19 @@ class ComposerStaticInit30e8e22007888ae720651c031afd07f4
19
  );
20
 
21
  public static $prefixLengthsPsr4 = array (
 
 
 
 
 
22
  'P' =>
23
  array (
24
  'Psr\\Http\\Message\\' => 17,
 
 
 
 
 
25
  ),
26
  'M' =>
27
  array (
@@ -32,13 +42,9 @@ class ComposerStaticInit30e8e22007888ae720651c031afd07f4
32
  'Http\\Promise\\' => 13,
33
  'Http\\Message\\' => 13,
34
  'Http\\Discovery\\' => 15,
35
- 'Http\\Client\\Curl\\' => 17,
36
  'Http\\Client\\' => 12,
37
  ),
38
- 'G' =>
39
- array (
40
- 'GuzzleHttp\\Psr7\\' => 16,
41
- ),
42
  'C' =>
43
  array (
44
  'Clue\\StreamFilter\\' => 18,
@@ -46,9 +52,26 @@ class ComposerStaticInit30e8e22007888ae720651c031afd07f4
46
  );
47
 
48
  public static $prefixDirsPsr4 = array (
 
 
 
 
 
 
 
 
49
  'Psr\\Http\\Message\\' =>
50
  array (
51
  0 => __DIR__ . '/..' . '/psr/http-message/src',
 
 
 
 
 
 
 
 
 
52
  ),
53
  'MailerLiteApi\\' =>
54
  array (
@@ -67,18 +90,14 @@ class ComposerStaticInit30e8e22007888ae720651c031afd07f4
67
  array (
68
  0 => __DIR__ . '/..' . '/php-http/discovery/src',
69
  ),
70
- 'Http\\Client\\Curl\\' =>
71
  array (
72
- 0 => __DIR__ . '/..' . '/php-http/curl-client/src',
73
  ),
74
  'Http\\Client\\' =>
75
  array (
76
  0 => __DIR__ . '/..' . '/php-http/httplug/src',
77
  ),
78
- 'GuzzleHttp\\Psr7\\' =>
79
- array (
80
- 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
81
- ),
82
  'Clue\\StreamFilter\\' =>
83
  array (
84
  0 => __DIR__ . '/..' . '/clue/stream-filter/src',
@@ -86,45 +105,71 @@ class ComposerStaticInit30e8e22007888ae720651c031afd07f4
86
  );
87
 
88
  public static $classMap = array (
 
89
  'Clue\\StreamFilter\\CallbackFilter' => __DIR__ . '/..' . '/clue/stream-filter/src/CallbackFilter.php',
90
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
91
- 'GuzzleHttp\\Psr7\\AppendStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/AppendStream.php',
92
- 'GuzzleHttp\\Psr7\\BufferStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/BufferStream.php',
93
- 'GuzzleHttp\\Psr7\\CachingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/CachingStream.php',
94
- 'GuzzleHttp\\Psr7\\DroppingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/DroppingStream.php',
95
- 'GuzzleHttp\\Psr7\\FnStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/FnStream.php',
96
- 'GuzzleHttp\\Psr7\\Header' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Header.php',
97
- 'GuzzleHttp\\Psr7\\InflateStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/InflateStream.php',
98
- 'GuzzleHttp\\Psr7\\LazyOpenStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LazyOpenStream.php',
99
- 'GuzzleHttp\\Psr7\\LimitStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LimitStream.php',
100
- 'GuzzleHttp\\Psr7\\Message' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Message.php',
101
- 'GuzzleHttp\\Psr7\\MessageTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MessageTrait.php',
102
- 'GuzzleHttp\\Psr7\\MimeType' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MimeType.php',
103
- 'GuzzleHttp\\Psr7\\MultipartStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MultipartStream.php',
104
- 'GuzzleHttp\\Psr7\\NoSeekStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/NoSeekStream.php',
105
- 'GuzzleHttp\\Psr7\\PumpStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/PumpStream.php',
106
- 'GuzzleHttp\\Psr7\\Query' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Query.php',
107
- 'GuzzleHttp\\Psr7\\Request' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Request.php',
108
- 'GuzzleHttp\\Psr7\\Response' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Response.php',
109
- 'GuzzleHttp\\Psr7\\Rfc7230' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Rfc7230.php',
110
- 'GuzzleHttp\\Psr7\\ServerRequest' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/ServerRequest.php',
111
- 'GuzzleHttp\\Psr7\\Stream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Stream.php',
112
- 'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php',
113
- 'GuzzleHttp\\Psr7\\StreamWrapper' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamWrapper.php',
114
- 'GuzzleHttp\\Psr7\\UploadedFile' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UploadedFile.php',
115
- 'GuzzleHttp\\Psr7\\Uri' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Uri.php',
116
- 'GuzzleHttp\\Psr7\\UriComparator' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriComparator.php',
117
- 'GuzzleHttp\\Psr7\\UriNormalizer' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriNormalizer.php',
118
- 'GuzzleHttp\\Psr7\\UriResolver' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriResolver.php',
119
- 'GuzzleHttp\\Psr7\\Utils' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Utils.php',
120
- 'Http\\Client\\Curl\\Client' => __DIR__ . '/..' . '/php-http/curl-client/src/Client.php',
121
- 'Http\\Client\\Curl\\CurlPromise' => __DIR__ . '/..' . '/php-http/curl-client/src/CurlPromise.php',
122
- 'Http\\Client\\Curl\\MultiRunner' => __DIR__ . '/..' . '/php-http/curl-client/src/MultiRunner.php',
123
- 'Http\\Client\\Curl\\PromiseCore' => __DIR__ . '/..' . '/php-http/curl-client/src/PromiseCore.php',
124
- 'Http\\Client\\Curl\\ResponseBuilder' => __DIR__ . '/..' . '/php-http/curl-client/src/ResponseBuilder.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  'Http\\Client\\Exception' => __DIR__ . '/..' . '/php-http/httplug/src/Exception.php',
126
  'Http\\Client\\Exception\\HttpException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/HttpException.php',
127
  'Http\\Client\\Exception\\NetworkException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/NetworkException.php',
 
128
  'Http\\Client\\Exception\\RequestException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/RequestException.php',
129
  'Http\\Client\\Exception\\TransferException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/TransferException.php',
130
  'Http\\Client\\HttpAsyncClient' => __DIR__ . '/..' . '/php-http/httplug/src/HttpAsyncClient.php',
@@ -157,6 +202,7 @@ class ComposerStaticInit30e8e22007888ae720651c031afd07f4
157
  'Http\\Message\\Authentication\\BasicAuth' => __DIR__ . '/..' . '/php-http/message/src/Authentication/BasicAuth.php',
158
  'Http\\Message\\Authentication\\Bearer' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Bearer.php',
159
  'Http\\Message\\Authentication\\Chain' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Chain.php',
 
160
  'Http\\Message\\Authentication\\Matching' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Matching.php',
161
  'Http\\Message\\Authentication\\QueryParam' => __DIR__ . '/..' . '/php-http/message/src/Authentication/QueryParam.php',
162
  'Http\\Message\\Authentication\\RequestConditional' => __DIR__ . '/..' . '/php-http/message/src/Authentication/RequestConditional.php',
@@ -207,6 +253,7 @@ class ComposerStaticInit30e8e22007888ae720651c031afd07f4
207
  'Http\\Promise\\FulfilledPromise' => __DIR__ . '/..' . '/php-http/promise/src/FulfilledPromise.php',
208
  'Http\\Promise\\Promise' => __DIR__ . '/..' . '/php-http/promise/src/Promise.php',
209
  'Http\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/php-http/promise/src/RejectedPromise.php',
 
210
  'MailerLiteApi\\Api\\Campaigns' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Campaigns.php',
211
  'MailerLiteApi\\Api\\Fields' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Fields.php',
212
  'MailerLiteApi\\Api\\Groups' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Groups.php',
@@ -214,27 +261,68 @@ class ComposerStaticInit30e8e22007888ae720651c031afd07f4
214
  'MailerLiteApi\\Api\\Settings' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Settings.php',
215
  'MailerLiteApi\\Api\\Stats' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Stats.php',
216
  'MailerLiteApi\\Api\\Subscribers' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Subscribers.php',
 
217
  'MailerLiteApi\\Common\\ApiAbstract' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/ApiAbstract.php',
218
  'MailerLiteApi\\Common\\ApiConstants' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/ApiConstants.php',
 
219
  'MailerLiteApi\\Common\\Collection' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/Collection.php',
220
  'MailerLiteApi\\Common\\RestClient' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/RestClient.php',
221
  'MailerLiteApi\\Exceptions\\MailerLiteSdkException' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Exceptions/MailerLiteSdkException.php',
222
  'MailerLiteApi\\MailerLite' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/MailerLite.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  'Psr\\Http\\Message\\MessageInterface' => __DIR__ . '/..' . '/psr/http-message/src/MessageInterface.php',
 
224
  'Psr\\Http\\Message\\RequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/RequestInterface.php',
 
225
  'Psr\\Http\\Message\\ResponseInterface' => __DIR__ . '/..' . '/psr/http-message/src/ResponseInterface.php',
 
226
  'Psr\\Http\\Message\\ServerRequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/ServerRequestInterface.php',
 
227
  'Psr\\Http\\Message\\StreamInterface' => __DIR__ . '/..' . '/psr/http-message/src/StreamInterface.php',
 
228
  'Psr\\Http\\Message\\UploadedFileInterface' => __DIR__ . '/..' . '/psr/http-message/src/UploadedFileInterface.php',
 
229
  'Psr\\Http\\Message\\UriInterface' => __DIR__ . '/..' . '/psr/http-message/src/UriInterface.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  );
231
 
232
  public static function getInitializer(ClassLoader $loader)
233
  {
234
  return \Closure::bind(function () use ($loader) {
235
- $loader->prefixLengthsPsr4 = ComposerStaticInit30e8e22007888ae720651c031afd07f4::$prefixLengthsPsr4;
236
- $loader->prefixDirsPsr4 = ComposerStaticInit30e8e22007888ae720651c031afd07f4::$prefixDirsPsr4;
237
- $loader->classMap = ComposerStaticInit30e8e22007888ae720651c031afd07f4::$classMap;
238
 
239
  }, null, ClassLoader::class);
240
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit64eb01b4d71e339a1f4c3fb7643dc86a
8
  {
9
  public static $files = array (
10
  '9c67151ae59aff4788964ce8eb2a0f43' => __DIR__ . '/..' . '/clue/stream-filter/src/functions_include.php',
11
+ '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
12
  '8cff32064859f4559445b89279f3199c' => __DIR__ . '/..' . '/php-http/message/src/filters.php',
13
+ 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
 
14
  '2e85745cdd367ff6e5579a8598f422b9' => __DIR__ . '/..' . '/codeinwp/elementor-extra-widgets/load.php',
15
  '62bc7c35996f19a64625f7ff3ba2fb5e' => __DIR__ . '/..' . '/codeinwp/full-width-page-templates/load.php',
16
  '7b1f4385ddfc86d120fe4380e8cb0fa6' => __DIR__ . '/..' . '/codeinwp/themeisle-content-forms/load.php',
19
  );
20
 
21
  public static $prefixLengthsPsr4 = array (
22
+ 'S' =>
23
+ array (
24
+ 'Symfony\\Polyfill\\Php80\\' => 23,
25
+ 'Symfony\\Component\\OptionsResolver\\' => 34,
26
+ ),
27
  'P' =>
28
  array (
29
  'Psr\\Http\\Message\\' => 17,
30
+ 'Psr\\Http\\Client\\' => 16,
31
+ ),
32
+ 'N' =>
33
+ array (
34
+ 'Nyholm\\Psr7\\' => 12,
35
  ),
36
  'M' =>
37
  array (
42
  'Http\\Promise\\' => 13,
43
  'Http\\Message\\' => 13,
44
  'Http\\Discovery\\' => 15,
45
+ 'Http\\Client\\Common\\' => 19,
46
  'Http\\Client\\' => 12,
47
  ),
 
 
 
 
48
  'C' =>
49
  array (
50
  'Clue\\StreamFilter\\' => 18,
52
  );
53
 
54
  public static $prefixDirsPsr4 = array (
55
+ 'Symfony\\Polyfill\\Php80\\' =>
56
+ array (
57
+ 0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
58
+ ),
59
+ 'Symfony\\Component\\OptionsResolver\\' =>
60
+ array (
61
+ 0 => __DIR__ . '/..' . '/symfony/options-resolver',
62
+ ),
63
  'Psr\\Http\\Message\\' =>
64
  array (
65
  0 => __DIR__ . '/..' . '/psr/http-message/src',
66
+ 1 => __DIR__ . '/..' . '/psr/http-factory/src',
67
+ ),
68
+ 'Psr\\Http\\Client\\' =>
69
+ array (
70
+ 0 => __DIR__ . '/..' . '/psr/http-client/src',
71
+ ),
72
+ 'Nyholm\\Psr7\\' =>
73
+ array (
74
+ 0 => __DIR__ . '/..' . '/nyholm/psr7/src',
75
  ),
76
  'MailerLiteApi\\' =>
77
  array (
90
  array (
91
  0 => __DIR__ . '/..' . '/php-http/discovery/src',
92
  ),
93
+ 'Http\\Client\\Common\\' =>
94
  array (
95
+ 0 => __DIR__ . '/..' . '/php-http/client-common/src',
96
  ),
97
  'Http\\Client\\' =>
98
  array (
99
  0 => __DIR__ . '/..' . '/php-http/httplug/src',
100
  ),
 
 
 
 
101
  'Clue\\StreamFilter\\' =>
102
  array (
103
  0 => __DIR__ . '/..' . '/clue/stream-filter/src',
105
  );
106
 
107
  public static $classMap = array (
108
+ 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
109
  'Clue\\StreamFilter\\CallbackFilter' => __DIR__ . '/..' . '/clue/stream-filter/src/CallbackFilter.php',
110
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
111
+ 'Http\\Client\\Common\\BatchClient' => __DIR__ . '/..' . '/php-http/client-common/src/BatchClient.php',
112
+ 'Http\\Client\\Common\\BatchClientInterface' => __DIR__ . '/..' . '/php-http/client-common/src/BatchClientInterface.php',
113
+ 'Http\\Client\\Common\\BatchResult' => __DIR__ . '/..' . '/php-http/client-common/src/BatchResult.php',
114
+ 'Http\\Client\\Common\\Deferred' => __DIR__ . '/..' . '/php-http/client-common/src/Deferred.php',
115
+ 'Http\\Client\\Common\\EmulatedHttpAsyncClient' => __DIR__ . '/..' . '/php-http/client-common/src/EmulatedHttpAsyncClient.php',
116
+ 'Http\\Client\\Common\\EmulatedHttpClient' => __DIR__ . '/..' . '/php-http/client-common/src/EmulatedHttpClient.php',
117
+ 'Http\\Client\\Common\\Exception\\BatchException' => __DIR__ . '/..' . '/php-http/client-common/src/Exception/BatchException.php',
118
+ 'Http\\Client\\Common\\Exception\\CircularRedirectionException' => __DIR__ . '/..' . '/php-http/client-common/src/Exception/CircularRedirectionException.php',
119
+ 'Http\\Client\\Common\\Exception\\ClientErrorException' => __DIR__ . '/..' . '/php-http/client-common/src/Exception/ClientErrorException.php',
120
+ 'Http\\Client\\Common\\Exception\\HttpClientNoMatchException' => __DIR__ . '/..' . '/php-http/client-common/src/Exception/HttpClientNoMatchException.php',
121
+ 'Http\\Client\\Common\\Exception\\HttpClientNotFoundException' => __DIR__ . '/..' . '/php-http/client-common/src/Exception/HttpClientNotFoundException.php',
122
+ 'Http\\Client\\Common\\Exception\\LoopException' => __DIR__ . '/..' . '/php-http/client-common/src/Exception/LoopException.php',
123
+ 'Http\\Client\\Common\\Exception\\MultipleRedirectionException' => __DIR__ . '/..' . '/php-http/client-common/src/Exception/MultipleRedirectionException.php',
124
+ 'Http\\Client\\Common\\Exception\\ServerErrorException' => __DIR__ . '/..' . '/php-http/client-common/src/Exception/ServerErrorException.php',
125
+ 'Http\\Client\\Common\\FlexibleHttpClient' => __DIR__ . '/..' . '/php-http/client-common/src/FlexibleHttpClient.php',
126
+ 'Http\\Client\\Common\\HttpAsyncClientDecorator' => __DIR__ . '/..' . '/php-http/client-common/src/HttpAsyncClientDecorator.php',
127
+ 'Http\\Client\\Common\\HttpAsyncClientEmulator' => __DIR__ . '/..' . '/php-http/client-common/src/HttpAsyncClientEmulator.php',
128
+ 'Http\\Client\\Common\\HttpClientDecorator' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientDecorator.php',
129
+ 'Http\\Client\\Common\\HttpClientEmulator' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientEmulator.php',
130
+ 'Http\\Client\\Common\\HttpClientPool' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientPool.php',
131
+ 'Http\\Client\\Common\\HttpClientPool\\HttpClientPool' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientPool/HttpClientPool.php',
132
+ 'Http\\Client\\Common\\HttpClientPool\\HttpClientPoolItem' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientPool/HttpClientPoolItem.php',
133
+ 'Http\\Client\\Common\\HttpClientPool\\LeastUsedClientPool' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php',
134
+ 'Http\\Client\\Common\\HttpClientPool\\RandomClientPool' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientPool/RandomClientPool.php',
135
+ 'Http\\Client\\Common\\HttpClientPool\\RoundRobinClientPool' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php',
136
+ 'Http\\Client\\Common\\HttpClientRouter' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientRouter.php',
137
+ 'Http\\Client\\Common\\HttpClientRouterInterface' => __DIR__ . '/..' . '/php-http/client-common/src/HttpClientRouterInterface.php',
138
+ 'Http\\Client\\Common\\HttpMethodsClient' => __DIR__ . '/..' . '/php-http/client-common/src/HttpMethodsClient.php',
139
+ 'Http\\Client\\Common\\HttpMethodsClientInterface' => __DIR__ . '/..' . '/php-http/client-common/src/HttpMethodsClientInterface.php',
140
+ 'Http\\Client\\Common\\Plugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin.php',
141
+ 'Http\\Client\\Common\\PluginChain' => __DIR__ . '/..' . '/php-http/client-common/src/PluginChain.php',
142
+ 'Http\\Client\\Common\\PluginClient' => __DIR__ . '/..' . '/php-http/client-common/src/PluginClient.php',
143
+ 'Http\\Client\\Common\\PluginClientBuilder' => __DIR__ . '/..' . '/php-http/client-common/src/PluginClientBuilder.php',
144
+ 'Http\\Client\\Common\\PluginClientFactory' => __DIR__ . '/..' . '/php-http/client-common/src/PluginClientFactory.php',
145
+ 'Http\\Client\\Common\\Plugin\\AddHostPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/AddHostPlugin.php',
146
+ 'Http\\Client\\Common\\Plugin\\AddPathPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/AddPathPlugin.php',
147
+ 'Http\\Client\\Common\\Plugin\\AuthenticationPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/AuthenticationPlugin.php',
148
+ 'Http\\Client\\Common\\Plugin\\BaseUriPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/BaseUriPlugin.php',
149
+ 'Http\\Client\\Common\\Plugin\\ContentLengthPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/ContentLengthPlugin.php',
150
+ 'Http\\Client\\Common\\Plugin\\ContentTypePlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/ContentTypePlugin.php',
151
+ 'Http\\Client\\Common\\Plugin\\CookiePlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/CookiePlugin.php',
152
+ 'Http\\Client\\Common\\Plugin\\DecoderPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/DecoderPlugin.php',
153
+ 'Http\\Client\\Common\\Plugin\\ErrorPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/ErrorPlugin.php',
154
+ 'Http\\Client\\Common\\Plugin\\HeaderAppendPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/HeaderAppendPlugin.php',
155
+ 'Http\\Client\\Common\\Plugin\\HeaderDefaultsPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php',
156
+ 'Http\\Client\\Common\\Plugin\\HeaderRemovePlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/HeaderRemovePlugin.php',
157
+ 'Http\\Client\\Common\\Plugin\\HeaderSetPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/HeaderSetPlugin.php',
158
+ 'Http\\Client\\Common\\Plugin\\HistoryPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/HistoryPlugin.php',
159
+ 'Http\\Client\\Common\\Plugin\\Journal' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/Journal.php',
160
+ 'Http\\Client\\Common\\Plugin\\QueryDefaultsPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php',
161
+ 'Http\\Client\\Common\\Plugin\\RedirectPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/RedirectPlugin.php',
162
+ 'Http\\Client\\Common\\Plugin\\RequestMatcherPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/RequestMatcherPlugin.php',
163
+ 'Http\\Client\\Common\\Plugin\\RequestSeekableBodyPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/RequestSeekableBodyPlugin.php',
164
+ 'Http\\Client\\Common\\Plugin\\ResponseSeekableBodyPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/ResponseSeekableBodyPlugin.php',
165
+ 'Http\\Client\\Common\\Plugin\\RetryPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/RetryPlugin.php',
166
+ 'Http\\Client\\Common\\Plugin\\SeekableBodyPlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/SeekableBodyPlugin.php',
167
+ 'Http\\Client\\Common\\Plugin\\VersionBridgePlugin' => __DIR__ . '/..' . '/php-http/client-common/src/Plugin/VersionBridgePlugin.php',
168
+ 'Http\\Client\\Common\\VersionBridgeClient' => __DIR__ . '/..' . '/php-http/client-common/src/VersionBridgeClient.php',
169
  'Http\\Client\\Exception' => __DIR__ . '/..' . '/php-http/httplug/src/Exception.php',
170
  'Http\\Client\\Exception\\HttpException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/HttpException.php',
171
  'Http\\Client\\Exception\\NetworkException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/NetworkException.php',
172
+ 'Http\\Client\\Exception\\RequestAwareTrait' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/RequestAwareTrait.php',
173
  'Http\\Client\\Exception\\RequestException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/RequestException.php',
174
  'Http\\Client\\Exception\\TransferException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/TransferException.php',
175
  'Http\\Client\\HttpAsyncClient' => __DIR__ . '/..' . '/php-http/httplug/src/HttpAsyncClient.php',
202
  'Http\\Message\\Authentication\\BasicAuth' => __DIR__ . '/..' . '/php-http/message/src/Authentication/BasicAuth.php',
203
  'Http\\Message\\Authentication\\Bearer' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Bearer.php',
204
  'Http\\Message\\Authentication\\Chain' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Chain.php',
205
+ 'Http\\Message\\Authentication\\Header' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Header.php',
206
  'Http\\Message\\Authentication\\Matching' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Matching.php',
207
  'Http\\Message\\Authentication\\QueryParam' => __DIR__ . '/..' . '/php-http/message/src/Authentication/QueryParam.php',
208
  'Http\\Message\\Authentication\\RequestConditional' => __DIR__ . '/..' . '/php-http/message/src/Authentication/RequestConditional.php',
253
  'Http\\Promise\\FulfilledPromise' => __DIR__ . '/..' . '/php-http/promise/src/FulfilledPromise.php',
254
  'Http\\Promise\\Promise' => __DIR__ . '/..' . '/php-http/promise/src/Promise.php',
255
  'Http\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/php-http/promise/src/RejectedPromise.php',
256
+ 'MailerLiteApi\\Api\\Batch' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Batch.php',
257
  'MailerLiteApi\\Api\\Campaigns' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Campaigns.php',
258
  'MailerLiteApi\\Api\\Fields' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Fields.php',
259
  'MailerLiteApi\\Api\\Groups' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Groups.php',
261
  'MailerLiteApi\\Api\\Settings' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Settings.php',
262
  'MailerLiteApi\\Api\\Stats' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Stats.php',
263
  'MailerLiteApi\\Api\\Subscribers' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Subscribers.php',
264
+ 'MailerLiteApi\\Api\\WooCommerce' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Api/WooCommerce.php',
265
  'MailerLiteApi\\Common\\ApiAbstract' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/ApiAbstract.php',
266
  'MailerLiteApi\\Common\\ApiConstants' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/ApiConstants.php',
267
+ 'MailerLiteApi\\Common\\BatchRequest' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/BatchRequest.php',
268
  'MailerLiteApi\\Common\\Collection' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/Collection.php',
269
  'MailerLiteApi\\Common\\RestClient' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Common/RestClient.php',
270
  'MailerLiteApi\\Exceptions\\MailerLiteSdkException' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/Exceptions/MailerLiteSdkException.php',
271
  'MailerLiteApi\\MailerLite' => __DIR__ . '/..' . '/mailerlite/mailerlite-api-v2-php-sdk/src/MailerLite.php',
272
+ 'Nyholm\\Psr7\\Factory\\HttplugFactory' => __DIR__ . '/..' . '/nyholm/psr7/src/Factory/HttplugFactory.php',
273
+ 'Nyholm\\Psr7\\Factory\\Psr17Factory' => __DIR__ . '/..' . '/nyholm/psr7/src/Factory/Psr17Factory.php',
274
+ 'Nyholm\\Psr7\\MessageTrait' => __DIR__ . '/..' . '/nyholm/psr7/src/MessageTrait.php',
275
+ 'Nyholm\\Psr7\\Request' => __DIR__ . '/..' . '/nyholm/psr7/src/Request.php',
276
+ 'Nyholm\\Psr7\\RequestTrait' => __DIR__ . '/..' . '/nyholm/psr7/src/RequestTrait.php',
277
+ 'Nyholm\\Psr7\\Response' => __DIR__ . '/..' . '/nyholm/psr7/src/Response.php',
278
+ 'Nyholm\\Psr7\\ServerRequest' => __DIR__ . '/..' . '/nyholm/psr7/src/ServerRequest.php',
279
+ 'Nyholm\\Psr7\\Stream' => __DIR__ . '/..' . '/nyholm/psr7/src/Stream.php',
280
+ 'Nyholm\\Psr7\\UploadedFile' => __DIR__ . '/..' . '/nyholm/psr7/src/UploadedFile.php',
281
+ 'Nyholm\\Psr7\\Uri' => __DIR__ . '/..' . '/nyholm/psr7/src/Uri.php',
282
+ 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
283
+ 'Psr\\Http\\Client\\ClientExceptionInterface' => __DIR__ . '/..' . '/psr/http-client/src/ClientExceptionInterface.php',
284
+ 'Psr\\Http\\Client\\ClientInterface' => __DIR__ . '/..' . '/psr/http-client/src/ClientInterface.php',
285
+ 'Psr\\Http\\Client\\NetworkExceptionInterface' => __DIR__ . '/..' . '/psr/http-client/src/NetworkExceptionInterface.php',
286
+ 'Psr\\Http\\Client\\RequestExceptionInterface' => __DIR__ . '/..' . '/psr/http-client/src/RequestExceptionInterface.php',
287
  'Psr\\Http\\Message\\MessageInterface' => __DIR__ . '/..' . '/psr/http-message/src/MessageInterface.php',
288
+ 'Psr\\Http\\Message\\RequestFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/RequestFactoryInterface.php',
289
  'Psr\\Http\\Message\\RequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/RequestInterface.php',
290
+ 'Psr\\Http\\Message\\ResponseFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/ResponseFactoryInterface.php',
291
  'Psr\\Http\\Message\\ResponseInterface' => __DIR__ . '/..' . '/psr/http-message/src/ResponseInterface.php',
292
+ 'Psr\\Http\\Message\\ServerRequestFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/ServerRequestFactoryInterface.php',
293
  'Psr\\Http\\Message\\ServerRequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/ServerRequestInterface.php',
294
+ 'Psr\\Http\\Message\\StreamFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/StreamFactoryInterface.php',
295
  'Psr\\Http\\Message\\StreamInterface' => __DIR__ . '/..' . '/psr/http-message/src/StreamInterface.php',
296
+ 'Psr\\Http\\Message\\UploadedFileFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/UploadedFileFactoryInterface.php',
297
  'Psr\\Http\\Message\\UploadedFileInterface' => __DIR__ . '/..' . '/psr/http-message/src/UploadedFileInterface.php',
298
+ 'Psr\\Http\\Message\\UriFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/UriFactoryInterface.php',
299
  'Psr\\Http\\Message\\UriInterface' => __DIR__ . '/..' . '/psr/http-message/src/UriInterface.php',
300
+ 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
301
+ 'Symfony\\Component\\OptionsResolver\\Debug\\OptionsResolverIntrospector' => __DIR__ . '/..' . '/symfony/options-resolver/Debug/OptionsResolverIntrospector.php',
302
+ 'Symfony\\Component\\OptionsResolver\\Exception\\AccessException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/AccessException.php',
303
+ 'Symfony\\Component\\OptionsResolver\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/ExceptionInterface.php',
304
+ 'Symfony\\Component\\OptionsResolver\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/InvalidArgumentException.php',
305
+ 'Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/InvalidOptionsException.php',
306
+ 'Symfony\\Component\\OptionsResolver\\Exception\\MissingOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/MissingOptionsException.php',
307
+ 'Symfony\\Component\\OptionsResolver\\Exception\\NoConfigurationException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/NoConfigurationException.php',
308
+ 'Symfony\\Component\\OptionsResolver\\Exception\\NoSuchOptionException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/NoSuchOptionException.php',
309
+ 'Symfony\\Component\\OptionsResolver\\Exception\\OptionDefinitionException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/OptionDefinitionException.php',
310
+ 'Symfony\\Component\\OptionsResolver\\Exception\\UndefinedOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/UndefinedOptionsException.php',
311
+ 'Symfony\\Component\\OptionsResolver\\OptionConfigurator' => __DIR__ . '/..' . '/symfony/options-resolver/OptionConfigurator.php',
312
+ 'Symfony\\Component\\OptionsResolver\\Options' => __DIR__ . '/..' . '/symfony/options-resolver/Options.php',
313
+ 'Symfony\\Component\\OptionsResolver\\OptionsResolver' => __DIR__ . '/..' . '/symfony/options-resolver/OptionsResolver.php',
314
+ 'Symfony\\Polyfill\\Php80\\Php80' => __DIR__ . '/..' . '/symfony/polyfill-php80/Php80.php',
315
+ 'Symfony\\Polyfill\\Php80\\PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/PhpToken.php',
316
+ 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
317
+ 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
318
  );
319
 
320
  public static function getInitializer(ClassLoader $loader)
321
  {
322
  return \Closure::bind(function () use ($loader) {
323
+ $loader->prefixLengthsPsr4 = ComposerStaticInit64eb01b4d71e339a1f4c3fb7643dc86a::$prefixLengthsPsr4;
324
+ $loader->prefixDirsPsr4 = ComposerStaticInit64eb01b4d71e339a1f4c3fb7643dc86a::$prefixDirsPsr4;
325
+ $loader->classMap = ComposerStaticInit64eb01b4d71e339a1f4c3fb7643dc86a::$classMap;
326
 
327
  }, null, ClassLoader::class);
328
  }
vendor/composer/installed.json CHANGED
@@ -53,6 +53,10 @@
53
  "stream_filter_append",
54
  "stream_filter_register"
55
  ],
 
 
 
 
56
  "funding": [
57
  {
58
  "url": "https://clue.engineering/support",
@@ -147,22 +151,23 @@
147
  "source": {
148
  "type": "git",
149
  "url": "https://github.com/Codeinwp/themeisle-content-forms.git",
150
- "reference": "73f9d5696603b0aa2e25b9c035e4abfaf5bd2d68"
151
  },
152
  "dist": {
153
  "type": "zip",
154
- "url": "https://api.github.com/repos/Codeinwp/themeisle-content-forms/zipball/73f9d5696603b0aa2e25b9c035e4abfaf5bd2d68",
155
- "reference": "73f9d5696603b0aa2e25b9c035e4abfaf5bd2d68",
156
  "shasum": ""
157
  },
158
  "require": {
159
- "mailerlite/mailerlite-api-v2-php-sdk": "^0.2.3"
160
  },
161
  "require-dev": {
162
  "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
163
  "wptrt/wpthemereview": "*"
164
  },
165
- "time": "2021-08-02T12:22:21+00:00",
 
166
  "type": "library",
167
  "installation-source": "dist",
168
  "autoload": {
@@ -191,23 +196,23 @@
191
  },
192
  {
193
  "name": "codeinwp/themeisle-sdk",
194
- "version": "3.2.28",
195
- "version_normalized": "3.2.28.0",
196
  "source": {
197
  "type": "git",
198
  "url": "https://github.com/Codeinwp/themeisle-sdk.git",
199
- "reference": "89aafa06d90d8b2d79804e6030d5f3610f596434"
200
  },
201
  "dist": {
202
  "type": "zip",
203
- "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/89aafa06d90d8b2d79804e6030d5f3610f596434",
204
- "reference": "89aafa06d90d8b2d79804e6030d5f3610f596434",
205
  "shasum": ""
206
  },
207
  "require-dev": {
208
  "codeinwp/phpcs-ruleset": "dev-main"
209
  },
210
- "time": "2022-08-30T13:45:55+00:00",
211
  "type": "library",
212
  "installation-source": "dist",
213
  "notification-url": "https://packagist.org/downloads/",
@@ -228,207 +233,194 @@
228
  ],
229
  "support": {
230
  "issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
231
- "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.2.28"
232
  },
233
  "install-path": "../codeinwp/themeisle-sdk"
234
  },
235
  {
236
- "name": "guzzlehttp/psr7",
237
- "version": "1.9.0",
238
- "version_normalized": "1.9.0.0",
239
  "source": {
240
  "type": "git",
241
- "url": "https://github.com/guzzle/psr7.git",
242
- "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318"
243
  },
244
  "dist": {
245
  "type": "zip",
246
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318",
247
- "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318",
248
  "shasum": ""
249
  },
250
  "require": {
251
- "php": ">=5.4.0",
252
- "psr/http-message": "~1.0",
253
- "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
254
- },
255
- "provide": {
256
- "psr/http-message-implementation": "1.0"
257
  },
258
  "require-dev": {
259
- "ext-zlib": "*",
260
- "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
261
  },
262
- "suggest": {
263
- "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
264
- },
265
- "time": "2022-06-20T21:43:03+00:00",
266
  "type": "library",
267
- "extra": {
268
- "branch-alias": {
269
- "dev-master": "1.9-dev"
270
- }
271
- },
272
  "installation-source": "dist",
273
  "autoload": {
274
- "files": [
275
- "src/functions_include.php"
276
- ],
277
  "psr-4": {
278
- "GuzzleHttp\\Psr7\\": "src/"
279
  }
280
  },
281
  "notification-url": "https://packagist.org/downloads/",
282
  "license": [
283
  "MIT"
284
  ],
285
- "authors": [
286
- {
287
- "name": "Graham Campbell",
288
- "email": "hello@gjcampbell.co.uk",
289
- "homepage": "https://github.com/GrahamCampbell"
290
- },
291
- {
292
- "name": "Michael Dowling",
293
- "email": "mtdowling@gmail.com",
294
- "homepage": "https://github.com/mtdowling"
295
- },
296
- {
297
- "name": "George Mponos",
298
- "email": "gmponos@gmail.com",
299
- "homepage": "https://github.com/gmponos"
300
- },
301
- {
302
- "name": "Tobias Nyholm",
303
- "email": "tobias.nyholm@gmail.com",
304
- "homepage": "https://github.com/Nyholm"
305
- },
306
- {
307
- "name": "Márk Sági-Kazár",
308
- "email": "mark.sagikazar@gmail.com",
309
- "homepage": "https://github.com/sagikazarmark"
310
- },
311
- {
312
- "name": "Tobias Schultze",
313
- "email": "webmaster@tubo-world.de",
314
- "homepage": "https://github.com/Tobion"
315
- }
316
- ],
317
- "description": "PSR-7 message implementation that also provides common utility methods",
318
  "keywords": [
319
- "http",
320
- "message",
321
- "psr-7",
322
- "request",
323
- "response",
324
- "stream",
325
- "uri",
326
- "url"
327
- ],
328
- "funding": [
329
- {
330
- "url": "https://github.com/GrahamCampbell",
331
- "type": "github"
332
- },
333
- {
334
- "url": "https://github.com/Nyholm",
335
- "type": "github"
336
- },
337
- {
338
- "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
339
- "type": "tidelift"
340
- }
341
  ],
342
- "install-path": "../guzzlehttp/psr7"
 
 
 
 
343
  },
344
  {
345
- "name": "mailerlite/mailerlite-api-v2-php-sdk",
346
- "version": "0.2.3",
347
- "version_normalized": "0.2.3.0",
348
  "source": {
349
  "type": "git",
350
- "url": "https://github.com/mailerlite/mailerlite-api-v2-php-sdk.git",
351
- "reference": "2bae0aac12c4588bc0197d2e2dde5a55429b9e44"
352
  },
353
  "dist": {
354
  "type": "zip",
355
- "url": "https://api.github.com/repos/mailerlite/mailerlite-api-v2-php-sdk/zipball/2bae0aac12c4588bc0197d2e2dde5a55429b9e44",
356
- "reference": "2bae0aac12c4588bc0197d2e2dde5a55429b9e44",
357
  "shasum": ""
358
  },
359
  "require": {
360
- "guzzlehttp/psr7": "~1.2",
361
- "php": "^5.5|^7.0",
362
- "php-http/curl-client": "^1.4",
363
- "php-http/httplug": "^1.0",
364
- "php-http/message": "^1.2"
 
 
 
365
  },
366
  "require-dev": {
367
- "mockery/mockery": "^0.9.4",
368
- "php-http/guzzle6-adapter": "^1.0",
369
- "phpunit/phpunit": "5.3.*"
 
370
  },
371
- "time": "2019-01-31T13:14:26+00:00",
372
  "type": "library",
 
 
 
 
 
373
  "installation-source": "dist",
374
  "autoload": {
375
  "psr-4": {
376
- "MailerLiteApi\\": "src"
377
  }
378
  },
379
  "notification-url": "https://packagist.org/downloads/",
380
  "license": [
381
  "MIT"
382
  ],
383
- "description": "MailerLite API v2 PHP SDK",
384
- "homepage": "https://github.com/mailerlite/mailerlite-api-v2-php-sdk",
 
 
 
 
 
 
 
 
 
 
385
  "keywords": [
386
- "email",
387
- "mailerlite",
388
- "marketing",
389
- "sdk"
390
  ],
391
- "install-path": "../mailerlite/mailerlite-api-v2-php-sdk"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  },
393
  {
394
- "name": "php-http/curl-client",
395
- "version": "v1.7.1",
396
- "version_normalized": "1.7.1.0",
397
  "source": {
398
  "type": "git",
399
- "url": "https://github.com/php-http/curl-client.git",
400
- "reference": "6341a93d00e5d953fc868a3928b5167e6513f2b6"
401
  },
402
  "dist": {
403
  "type": "zip",
404
- "url": "https://api.github.com/repos/php-http/curl-client/zipball/6341a93d00e5d953fc868a3928b5167e6513f2b6",
405
- "reference": "6341a93d00e5d953fc868a3928b5167e6513f2b6",
406
  "shasum": ""
407
  },
408
  "require": {
409
- "ext-curl": "*",
410
- "php": "^5.5 || ^7.0",
411
- "php-http/discovery": "^1.0",
412
- "php-http/httplug": "^1.0",
413
- "php-http/message": "^1.2",
414
- "php-http/message-factory": "^1.0.2"
415
- },
416
- "provide": {
417
- "php-http/async-client-implementation": "1.0",
418
- "php-http/client-implementation": "1.0"
419
  },
420
  "require-dev": {
421
- "guzzlehttp/psr7": "^1.0",
422
- "php-http/client-integration-tests": "^0.6",
423
- "phpunit/phpunit": "^4.8.27",
424
- "zendframework/zend-diactoros": "^1.0"
 
 
425
  },
426
- "time": "2018-03-26T19:21:48+00:00",
 
 
 
 
 
 
 
427
  "type": "library",
 
 
 
 
 
428
  "installation-source": "dist",
429
  "autoload": {
430
  "psr-4": {
431
- "Http\\Client\\Curl\\": "src/"
432
  }
433
  },
434
  "notification-url": "https://packagist.org/downloads/",
@@ -437,54 +429,59 @@
437
  ],
438
  "authors": [
439
  {
440
- "name": "Михаил Красильников",
441
- "email": "m.krasilnikov@yandex.ru"
442
  }
443
  ],
444
- "description": "cURL client for PHP-HTTP",
445
- "homepage": "http://php-http.org",
446
  "keywords": [
447
- "curl",
448
- "http"
 
 
449
  ],
450
- "install-path": "../php-http/curl-client"
 
 
 
 
451
  },
452
  {
453
  "name": "php-http/discovery",
454
- "version": "1.6.1",
455
- "version_normalized": "1.6.1.0",
456
  "source": {
457
  "type": "git",
458
  "url": "https://github.com/php-http/discovery.git",
459
- "reference": "684855f2c2e9d0a61868b8f8d6bd0295c8a4b651"
460
  },
461
  "dist": {
462
  "type": "zip",
463
- "url": "https://api.github.com/repos/php-http/discovery/zipball/684855f2c2e9d0a61868b8f8d6bd0295c8a4b651",
464
- "reference": "684855f2c2e9d0a61868b8f8d6bd0295c8a4b651",
465
  "shasum": ""
466
  },
467
  "require": {
468
- "php": "^5.5 || ^7.0"
469
  },
470
  "conflict": {
471
  "nyholm/psr7": "<1.0"
472
  },
473
  "require-dev": {
 
474
  "php-http/httplug": "^1.0 || ^2.0",
475
  "php-http/message-factory": "^1.0",
476
- "phpspec/phpspec": "^2.4",
477
- "puli/composer-plugin": "1.0.0-beta10"
478
  },
479
  "suggest": {
480
- "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories",
481
- "puli/composer-plugin": "Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details."
482
  },
483
- "time": "2019-02-23T07:42:53+00:00",
484
  "type": "library",
485
  "extra": {
486
  "branch-alias": {
487
- "dev-master": "1.5-dev"
488
  }
489
  },
490
  "installation-source": "dist",
@@ -514,37 +511,42 @@
514
  "message",
515
  "psr7"
516
  ],
 
 
 
 
517
  "install-path": "../php-http/discovery"
518
  },
519
  {
520
  "name": "php-http/httplug",
521
- "version": "v1.1.0",
522
- "version_normalized": "1.1.0.0",
523
  "source": {
524
  "type": "git",
525
  "url": "https://github.com/php-http/httplug.git",
526
- "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018"
527
  },
528
  "dist": {
529
  "type": "zip",
530
- "url": "https://api.github.com/repos/php-http/httplug/zipball/1c6381726c18579c4ca2ef1ec1498fdae8bdf018",
531
- "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018",
532
  "shasum": ""
533
  },
534
  "require": {
535
- "php": ">=5.4",
536
- "php-http/promise": "^1.0",
 
537
  "psr/http-message": "^1.0"
538
  },
539
  "require-dev": {
540
- "henrikbjorn/phpspec-code-coverage": "^1.0",
541
- "phpspec/phpspec": "^2.4"
542
  },
543
- "time": "2016-08-31T08:30:17+00:00",
544
  "type": "library",
545
  "extra": {
546
  "branch-alias": {
547
- "dev-master": "1.1-dev"
548
  }
549
  },
550
  "installation-source": "dist",
@@ -564,7 +566,8 @@
564
  },
565
  {
566
  "name": "Márk Sági-Kazár",
567
- "email": "mark.sagikazar@gmail.com"
 
568
  }
569
  ],
570
  "description": "HTTPlug, the HTTP client abstraction for PHP",
@@ -573,26 +576,30 @@
573
  "client",
574
  "http"
575
  ],
 
 
 
 
576
  "install-path": "../php-http/httplug"
577
  },
578
  {
579
  "name": "php-http/message",
580
- "version": "1.7.2",
581
- "version_normalized": "1.7.2.0",
582
  "source": {
583
  "type": "git",
584
  "url": "https://github.com/php-http/message.git",
585
- "reference": "b159ffe570dffd335e22ef0b91a946eacb182fa1"
586
  },
587
  "dist": {
588
  "type": "zip",
589
- "url": "https://api.github.com/repos/php-http/message/zipball/b159ffe570dffd335e22ef0b91a946eacb182fa1",
590
- "reference": "b159ffe570dffd335e22ef0b91a946eacb182fa1",
591
  "shasum": ""
592
  },
593
  "require": {
594
- "clue/stream-filter": "^1.4",
595
- "php": "^5.4 || ^7.0",
596
  "php-http/message-factory": "^1.0.2",
597
  "psr/http-message": "^1.0"
598
  },
@@ -600,26 +607,24 @@
600
  "php-http/message-factory-implementation": "1.0"
601
  },
602
  "require-dev": {
603
- "akeneo/phpspec-skip-example-extension": "^1.0",
604
- "coduo/phpspec-data-provider-extension": "^1.0",
605
  "ext-zlib": "*",
606
  "guzzlehttp/psr7": "^1.0",
607
- "henrikbjorn/phpspec-code-coverage": "^1.0",
608
- "phpspec/phpspec": "^2.4",
609
- "slim/slim": "^3.0",
610
- "zendframework/zend-diactoros": "^1.0"
611
  },
612
  "suggest": {
613
  "ext-zlib": "Used with compressor/decompressor streams",
614
  "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
615
- "slim/slim": "Used with Slim Framework PSR-7 implementation",
616
- "zendframework/zend-diactoros": "Used with Diactoros Factories"
617
  },
618
- "time": "2018-11-01T09:32:41+00:00",
619
  "type": "library",
620
  "extra": {
621
  "branch-alias": {
622
- "dev-master": "1.6-dev"
623
  }
624
  },
625
  "installation-source": "dist",
@@ -648,6 +653,10 @@
648
  "message",
649
  "psr-7"
650
  ],
 
 
 
 
651
  "install-path": "../php-http/message"
652
  },
653
  {
@@ -701,28 +710,35 @@
701
  "stream",
702
  "uri"
703
  ],
 
 
 
 
704
  "install-path": "../php-http/message-factory"
705
  },
706
  {
707
  "name": "php-http/promise",
708
- "version": "v1.0.0",
709
- "version_normalized": "1.0.0.0",
710
  "source": {
711
  "type": "git",
712
  "url": "https://github.com/php-http/promise.git",
713
- "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980"
714
  },
715
  "dist": {
716
  "type": "zip",
717
- "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980",
718
- "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980",
719
  "shasum": ""
720
  },
 
 
 
721
  "require-dev": {
722
- "henrikbjorn/phpspec-code-coverage": "^1.0",
723
- "phpspec/phpspec": "^2.4"
724
  },
725
- "time": "2016-01-26T13:27:02+00:00",
726
  "type": "library",
727
  "extra": {
728
  "branch-alias": {
@@ -740,13 +756,13 @@
740
  "MIT"
741
  ],
742
  "authors": [
743
- {
744
- "name": "Márk Sági-Kazár",
745
- "email": "mark.sagikazar@gmail.com"
746
- },
747
  {
748
  "name": "Joel Wurtz",
749
  "email": "joel.wurtz@gmail.com"
 
 
 
 
750
  }
751
  ],
752
  "description": "Promise used for asynchronous HTTP requests",
@@ -754,8 +770,125 @@
754
  "keywords": [
755
  "promise"
756
  ],
 
 
 
 
757
  "install-path": "../php-http/promise"
758
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
759
  {
760
  "name": "psr/http-message",
761
  "version": "1.0.1",
@@ -807,36 +940,190 @@
807
  "request",
808
  "response"
809
  ],
 
 
 
810
  "install-path": "../psr/http-message"
811
  },
812
  {
813
- "name": "ralouphie/getallheaders",
814
- "version": "3.0.3",
815
- "version_normalized": "3.0.3.0",
816
  "source": {
817
  "type": "git",
818
- "url": "https://github.com/ralouphie/getallheaders.git",
819
- "reference": "120b605dfeb996808c31b6477290a714d356e822"
820
  },
821
  "dist": {
822
  "type": "zip",
823
- "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
824
- "reference": "120b605dfeb996808c31b6477290a714d356e822",
825
  "shasum": ""
826
  },
827
  "require": {
828
- "php": ">=5.6"
829
  },
830
- "require-dev": {
831
- "php-coveralls/php-coveralls": "^2.1",
832
- "phpunit/phpunit": "^5 || ^6.5"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
833
  },
834
- "time": "2019-03-08T08:55:37+00:00",
 
 
 
 
 
 
 
 
 
 
835
  "type": "library",
836
  "installation-source": "dist",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
  "autoload": {
838
  "files": [
839
- "src/getallheaders.php"
 
 
 
 
 
 
840
  ]
841
  },
842
  "notification-url": "https://packagist.org/downloads/",
@@ -845,12 +1132,44 @@
845
  ],
846
  "authors": [
847
  {
848
- "name": "Ralph Khattar",
849
- "email": "ralph.khattar@gmail.com"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
  }
851
  ],
852
- "description": "A polyfill for getallheaders.",
853
- "install-path": "../ralouphie/getallheaders"
854
  }
855
  ],
856
  "dev": false,
53
  "stream_filter_append",
54
  "stream_filter_register"
55
  ],
56
+ "support": {
57
+ "issues": "https://github.com/clue/stream-filter/issues",
58
+ "source": "https://github.com/clue/stream-filter/tree/v1.6.0"
59
+ },
60
  "funding": [
61
  {
62
  "url": "https://clue.engineering/support",
151
  "source": {
152
  "type": "git",
153
  "url": "https://github.com/Codeinwp/themeisle-content-forms.git",
154
+ "reference": "ef5d7612d06636f444ee7bc460ee063d2bebfb26"
155
  },
156
  "dist": {
157
  "type": "zip",
158
+ "url": "https://api.github.com/repos/Codeinwp/themeisle-content-forms/zipball/ef5d7612d06636f444ee7bc460ee063d2bebfb26",
159
+ "reference": "ef5d7612d06636f444ee7bc460ee063d2bebfb26",
160
  "shasum": ""
161
  },
162
  "require": {
163
+ "mailerlite/mailerlite-api-v2-php-sdk": "^0.3.2"
164
  },
165
  "require-dev": {
166
  "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
167
  "wptrt/wpthemereview": "*"
168
  },
169
+ "time": "2022-09-08T08:28:40+00:00",
170
+ "default-branch": true,
171
  "type": "library",
172
  "installation-source": "dist",
173
  "autoload": {
196
  },
197
  {
198
  "name": "codeinwp/themeisle-sdk",
199
+ "version": "3.2.29",
200
+ "version_normalized": "3.2.29.0",
201
  "source": {
202
  "type": "git",
203
  "url": "https://github.com/Codeinwp/themeisle-sdk.git",
204
+ "reference": "9456fb0944ec69c3975de04aaf56233ddc2f828c"
205
  },
206
  "dist": {
207
  "type": "zip",
208
+ "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/9456fb0944ec69c3975de04aaf56233ddc2f828c",
209
+ "reference": "9456fb0944ec69c3975de04aaf56233ddc2f828c",
210
  "shasum": ""
211
  },
212
  "require-dev": {
213
  "codeinwp/phpcs-ruleset": "dev-main"
214
  },
215
+ "time": "2022-09-08T15:34:21+00:00",
216
  "type": "library",
217
  "installation-source": "dist",
218
  "notification-url": "https://packagist.org/downloads/",
233
  ],
234
  "support": {
235
  "issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
236
+ "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.2.29"
237
  },
238
  "install-path": "../codeinwp/themeisle-sdk"
239
  },
240
  {
241
+ "name": "mailerlite/mailerlite-api-v2-php-sdk",
242
+ "version": "0.3.2",
243
+ "version_normalized": "0.3.2.0",
244
  "source": {
245
  "type": "git",
246
+ "url": "https://github.com/mailerlite/mailerlite-api-v2-php-sdk.git",
247
+ "reference": "9fb6b8adb3b0dd9eb964ba5169b229516c73fd78"
248
  },
249
  "dist": {
250
  "type": "zip",
251
+ "url": "https://api.github.com/repos/mailerlite/mailerlite-api-v2-php-sdk/zipball/9fb6b8adb3b0dd9eb964ba5169b229516c73fd78",
252
+ "reference": "9fb6b8adb3b0dd9eb964ba5169b229516c73fd78",
253
  "shasum": ""
254
  },
255
  "require": {
256
+ "ext-json": "*",
257
+ "nyholm/psr7": "^1.0",
258
+ "php": "^7.1 || ^8.0",
259
+ "php-http/client-common": "^2.0",
260
+ "php-http/discovery": "^1.7"
 
261
  },
262
  "require-dev": {
263
+ "php-http/guzzle6-adapter": "^2.0",
264
+ "phpunit/phpunit": "6.* | 7.* | 8.* | 9.*"
265
  },
266
+ "time": "2021-08-11T08:24:13+00:00",
 
 
 
267
  "type": "library",
 
 
 
 
 
268
  "installation-source": "dist",
269
  "autoload": {
 
 
 
270
  "psr-4": {
271
+ "MailerLiteApi\\": "src"
272
  }
273
  },
274
  "notification-url": "https://packagist.org/downloads/",
275
  "license": [
276
  "MIT"
277
  ],
278
+ "description": "MailerLite API v2 PHP SDK",
279
+ "homepage": "https://github.com/mailerlite/mailerlite-api-v2-php-sdk",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  "keywords": [
281
+ "email",
282
+ "mailerlite",
283
+ "marketing",
284
+ "sdk"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  ],
286
+ "support": {
287
+ "issues": "https://github.com/mailerlite/mailerlite-api-v2-php-sdk/issues",
288
+ "source": "https://github.com/mailerlite/mailerlite-api-v2-php-sdk/tree/0.3.2"
289
+ },
290
+ "install-path": "../mailerlite/mailerlite-api-v2-php-sdk"
291
  },
292
  {
293
+ "name": "nyholm/psr7",
294
+ "version": "1.5.1",
295
+ "version_normalized": "1.5.1.0",
296
  "source": {
297
  "type": "git",
298
+ "url": "https://github.com/Nyholm/psr7.git",
299
+ "reference": "f734364e38a876a23be4d906a2a089e1315be18a"
300
  },
301
  "dist": {
302
  "type": "zip",
303
+ "url": "https://api.github.com/repos/Nyholm/psr7/zipball/f734364e38a876a23be4d906a2a089e1315be18a",
304
+ "reference": "f734364e38a876a23be4d906a2a089e1315be18a",
305
  "shasum": ""
306
  },
307
  "require": {
308
+ "php": ">=7.1",
309
+ "php-http/message-factory": "^1.0",
310
+ "psr/http-factory": "^1.0",
311
+ "psr/http-message": "^1.0"
312
+ },
313
+ "provide": {
314
+ "psr/http-factory-implementation": "1.0",
315
+ "psr/http-message-implementation": "1.0"
316
  },
317
  "require-dev": {
318
+ "http-interop/http-factory-tests": "^0.9",
319
+ "php-http/psr7-integration-tests": "^1.0",
320
+ "phpunit/phpunit": "^7.5 || 8.5 || 9.4",
321
+ "symfony/error-handler": "^4.4"
322
  },
323
+ "time": "2022-06-22T07:13:36+00:00",
324
  "type": "library",
325
+ "extra": {
326
+ "branch-alias": {
327
+ "dev-master": "1.4-dev"
328
+ }
329
+ },
330
  "installation-source": "dist",
331
  "autoload": {
332
  "psr-4": {
333
+ "Nyholm\\Psr7\\": "src/"
334
  }
335
  },
336
  "notification-url": "https://packagist.org/downloads/",
337
  "license": [
338
  "MIT"
339
  ],
340
+ "authors": [
341
+ {
342
+ "name": "Tobias Nyholm",
343
+ "email": "tobias.nyholm@gmail.com"
344
+ },
345
+ {
346
+ "name": "Martijn van der Ven",
347
+ "email": "martijn@vanderven.se"
348
+ }
349
+ ],
350
+ "description": "A fast PHP7 implementation of PSR-7",
351
+ "homepage": "https://tnyholm.se",
352
  "keywords": [
353
+ "psr-17",
354
+ "psr-7"
 
 
355
  ],
356
+ "support": {
357
+ "issues": "https://github.com/Nyholm/psr7/issues",
358
+ "source": "https://github.com/Nyholm/psr7/tree/1.5.1"
359
+ },
360
+ "funding": [
361
+ {
362
+ "url": "https://github.com/Zegnat",
363
+ "type": "github"
364
+ },
365
+ {
366
+ "url": "https://github.com/nyholm",
367
+ "type": "github"
368
+ }
369
+ ],
370
+ "install-path": "../nyholm/psr7"
371
  },
372
  {
373
+ "name": "php-http/client-common",
374
+ "version": "2.5.0",
375
+ "version_normalized": "2.5.0.0",
376
  "source": {
377
  "type": "git",
378
+ "url": "https://github.com/php-http/client-common.git",
379
+ "reference": "d135751167d57e27c74de674d6a30cef2dc8e054"
380
  },
381
  "dist": {
382
  "type": "zip",
383
+ "url": "https://api.github.com/repos/php-http/client-common/zipball/d135751167d57e27c74de674d6a30cef2dc8e054",
384
+ "reference": "d135751167d57e27c74de674d6a30cef2dc8e054",
385
  "shasum": ""
386
  },
387
  "require": {
388
+ "php": "^7.1 || ^8.0",
389
+ "php-http/httplug": "^2.0",
390
+ "php-http/message": "^1.6",
391
+ "php-http/message-factory": "^1.0",
392
+ "psr/http-client": "^1.0",
393
+ "psr/http-factory": "^1.0",
394
+ "psr/http-message": "^1.0",
395
+ "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0",
396
+ "symfony/polyfill-php80": "^1.17"
 
397
  },
398
  "require-dev": {
399
+ "doctrine/instantiator": "^1.1",
400
+ "guzzlehttp/psr7": "^1.4",
401
+ "nyholm/psr7": "^1.2",
402
+ "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
403
+ "phpspec/prophecy": "^1.10.2",
404
+ "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3"
405
  },
406
+ "suggest": {
407
+ "ext-json": "To detect JSON responses with the ContentTypePlugin",
408
+ "ext-libxml": "To detect XML responses with the ContentTypePlugin",
409
+ "php-http/cache-plugin": "PSR-6 Cache plugin",
410
+ "php-http/logger-plugin": "PSR-3 Logger plugin",
411
+ "php-http/stopwatch-plugin": "Symfony Stopwatch plugin"
412
+ },
413
+ "time": "2021-11-26T15:01:24+00:00",
414
  "type": "library",
415
+ "extra": {
416
+ "branch-alias": {
417
+ "dev-master": "2.3.x-dev"
418
+ }
419
+ },
420
  "installation-source": "dist",
421
  "autoload": {
422
  "psr-4": {
423
+ "Http\\Client\\Common\\": "src/"
424
  }
425
  },
426
  "notification-url": "https://packagist.org/downloads/",
429
  ],
430
  "authors": [
431
  {
432
+ "name": "Márk Sági-Kazár",
433
+ "email": "mark.sagikazar@gmail.com"
434
  }
435
  ],
436
+ "description": "Common HTTP Client implementations and tools for HTTPlug",
437
+ "homepage": "http://httplug.io",
438
  "keywords": [
439
+ "client",
440
+ "common",
441
+ "http",
442
+ "httplug"
443
  ],
444
+ "support": {
445
+ "issues": "https://github.com/php-http/client-common/issues",
446
+ "source": "https://github.com/php-http/client-common/tree/2.5.0"
447
+ },
448
+ "install-path": "../php-http/client-common"
449
  },
450
  {
451
  "name": "php-http/discovery",
452
+ "version": "1.14.3",
453
+ "version_normalized": "1.14.3.0",
454
  "source": {
455
  "type": "git",
456
  "url": "https://github.com/php-http/discovery.git",
457
+ "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735"
458
  },
459
  "dist": {
460
  "type": "zip",
461
+ "url": "https://api.github.com/repos/php-http/discovery/zipball/31d8ee46d0215108df16a8527c7438e96a4d7735",
462
+ "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735",
463
  "shasum": ""
464
  },
465
  "require": {
466
+ "php": "^7.1 || ^8.0"
467
  },
468
  "conflict": {
469
  "nyholm/psr7": "<1.0"
470
  },
471
  "require-dev": {
472
+ "graham-campbell/phpspec-skip-example-extension": "^5.0",
473
  "php-http/httplug": "^1.0 || ^2.0",
474
  "php-http/message-factory": "^1.0",
475
+ "phpspec/phpspec": "^5.1 || ^6.1"
 
476
  },
477
  "suggest": {
478
+ "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories"
 
479
  },
480
+ "time": "2022-07-11T14:04:40+00:00",
481
  "type": "library",
482
  "extra": {
483
  "branch-alias": {
484
+ "dev-master": "1.9-dev"
485
  }
486
  },
487
  "installation-source": "dist",
511
  "message",
512
  "psr7"
513
  ],
514
+ "support": {
515
+ "issues": "https://github.com/php-http/discovery/issues",
516
+ "source": "https://github.com/php-http/discovery/tree/1.14.3"
517
+ },
518
  "install-path": "../php-http/discovery"
519
  },
520
  {
521
  "name": "php-http/httplug",
522
+ "version": "2.3.0",
523
+ "version_normalized": "2.3.0.0",
524
  "source": {
525
  "type": "git",
526
  "url": "https://github.com/php-http/httplug.git",
527
+ "reference": "f640739f80dfa1152533976e3c112477f69274eb"
528
  },
529
  "dist": {
530
  "type": "zip",
531
+ "url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb",
532
+ "reference": "f640739f80dfa1152533976e3c112477f69274eb",
533
  "shasum": ""
534
  },
535
  "require": {
536
+ "php": "^7.1 || ^8.0",
537
+ "php-http/promise": "^1.1",
538
+ "psr/http-client": "^1.0",
539
  "psr/http-message": "^1.0"
540
  },
541
  "require-dev": {
542
+ "friends-of-phpspec/phpspec-code-coverage": "^4.1",
543
+ "phpspec/phpspec": "^5.1 || ^6.0"
544
  },
545
+ "time": "2022-02-21T09:52:22+00:00",
546
  "type": "library",
547
  "extra": {
548
  "branch-alias": {
549
+ "dev-master": "2.x-dev"
550
  }
551
  },
552
  "installation-source": "dist",
566
  },
567
  {
568
  "name": "Márk Sági-Kazár",
569
+ "email": "mark.sagikazar@gmail.com",
570
+ "homepage": "https://sagikazarmark.hu"
571
  }
572
  ],
573
  "description": "HTTPlug, the HTTP client abstraction for PHP",
576
  "client",
577
  "http"
578
  ],
579
+ "support": {
580
+ "issues": "https://github.com/php-http/httplug/issues",
581
+ "source": "https://github.com/php-http/httplug/tree/2.3.0"
582
+ },
583
  "install-path": "../php-http/httplug"
584
  },
585
  {
586
  "name": "php-http/message",
587
+ "version": "1.13.0",
588
+ "version_normalized": "1.13.0.0",
589
  "source": {
590
  "type": "git",
591
  "url": "https://github.com/php-http/message.git",
592
+ "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361"
593
  },
594
  "dist": {
595
  "type": "zip",
596
+ "url": "https://api.github.com/repos/php-http/message/zipball/7886e647a30a966a1a8d1dad1845b71ca8678361",
597
+ "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361",
598
  "shasum": ""
599
  },
600
  "require": {
601
+ "clue/stream-filter": "^1.5",
602
+ "php": "^7.1 || ^8.0",
603
  "php-http/message-factory": "^1.0.2",
604
  "psr/http-message": "^1.0"
605
  },
607
  "php-http/message-factory-implementation": "1.0"
608
  },
609
  "require-dev": {
610
+ "ergebnis/composer-normalize": "^2.6",
 
611
  "ext-zlib": "*",
612
  "guzzlehttp/psr7": "^1.0",
613
+ "laminas/laminas-diactoros": "^2.0",
614
+ "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
615
+ "slim/slim": "^3.0"
 
616
  },
617
  "suggest": {
618
  "ext-zlib": "Used with compressor/decompressor streams",
619
  "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
620
+ "laminas/laminas-diactoros": "Used with Diactoros Factories",
621
+ "slim/slim": "Used with Slim Framework PSR-7 implementation"
622
  },
623
+ "time": "2022-02-11T13:41:14+00:00",
624
  "type": "library",
625
  "extra": {
626
  "branch-alias": {
627
+ "dev-master": "1.10-dev"
628
  }
629
  },
630
  "installation-source": "dist",
653
  "message",
654
  "psr-7"
655
  ],
656
+ "support": {
657
+ "issues": "https://github.com/php-http/message/issues",
658
+ "source": "https://github.com/php-http/message/tree/1.13.0"
659
+ },
660
  "install-path": "../php-http/message"
661
  },
662
  {
710
  "stream",
711
  "uri"
712
  ],
713
+ "support": {
714
+ "issues": "https://github.com/php-http/message-factory/issues",
715
+ "source": "https://github.com/php-http/message-factory/tree/master"
716
+ },
717
  "install-path": "../php-http/message-factory"
718
  },
719
  {
720
  "name": "php-http/promise",
721
+ "version": "1.1.0",
722
+ "version_normalized": "1.1.0.0",
723
  "source": {
724
  "type": "git",
725
  "url": "https://github.com/php-http/promise.git",
726
+ "reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88"
727
  },
728
  "dist": {
729
  "type": "zip",
730
+ "url": "https://api.github.com/repos/php-http/promise/zipball/4c4c1f9b7289a2ec57cde7f1e9762a5789506f88",
731
+ "reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88",
732
  "shasum": ""
733
  },
734
+ "require": {
735
+ "php": "^7.1 || ^8.0"
736
+ },
737
  "require-dev": {
738
+ "friends-of-phpspec/phpspec-code-coverage": "^4.3.2",
739
+ "phpspec/phpspec": "^5.1.2 || ^6.2"
740
  },
741
+ "time": "2020-07-07T09:29:14+00:00",
742
  "type": "library",
743
  "extra": {
744
  "branch-alias": {
756
  "MIT"
757
  ],
758
  "authors": [
 
 
 
 
759
  {
760
  "name": "Joel Wurtz",
761
  "email": "joel.wurtz@gmail.com"
762
+ },
763
+ {
764
+ "name": "Márk Sági-Kazár",
765
+ "email": "mark.sagikazar@gmail.com"
766
  }
767
  ],
768
  "description": "Promise used for asynchronous HTTP requests",
770
  "keywords": [
771
  "promise"
772
  ],
773
+ "support": {
774
+ "issues": "https://github.com/php-http/promise/issues",
775
+ "source": "https://github.com/php-http/promise/tree/1.1.0"
776
+ },
777
  "install-path": "../php-http/promise"
778
  },
779
+ {
780
+ "name": "psr/http-client",
781
+ "version": "1.0.1",
782
+ "version_normalized": "1.0.1.0",
783
+ "source": {
784
+ "type": "git",
785
+ "url": "https://github.com/php-fig/http-client.git",
786
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
787
+ },
788
+ "dist": {
789
+ "type": "zip",
790
+ "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
791
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
792
+ "shasum": ""
793
+ },
794
+ "require": {
795
+ "php": "^7.0 || ^8.0",
796
+ "psr/http-message": "^1.0"
797
+ },
798
+ "time": "2020-06-29T06:28:15+00:00",
799
+ "type": "library",
800
+ "extra": {
801
+ "branch-alias": {
802
+ "dev-master": "1.0.x-dev"
803
+ }
804
+ },
805
+ "installation-source": "dist",
806
+ "autoload": {
807
+ "psr-4": {
808
+ "Psr\\Http\\Client\\": "src/"
809
+ }
810
+ },
811
+ "notification-url": "https://packagist.org/downloads/",
812
+ "license": [
813
+ "MIT"
814
+ ],
815
+ "authors": [
816
+ {
817
+ "name": "PHP-FIG",
818
+ "homepage": "http://www.php-fig.org/"
819
+ }
820
+ ],
821
+ "description": "Common interface for HTTP clients",
822
+ "homepage": "https://github.com/php-fig/http-client",
823
+ "keywords": [
824
+ "http",
825
+ "http-client",
826
+ "psr",
827
+ "psr-18"
828
+ ],
829
+ "support": {
830
+ "source": "https://github.com/php-fig/http-client/tree/master"
831
+ },
832
+ "install-path": "../psr/http-client"
833
+ },
834
+ {
835
+ "name": "psr/http-factory",
836
+ "version": "1.0.1",
837
+ "version_normalized": "1.0.1.0",
838
+ "source": {
839
+ "type": "git",
840
+ "url": "https://github.com/php-fig/http-factory.git",
841
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
842
+ },
843
+ "dist": {
844
+ "type": "zip",
845
+ "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
846
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
847
+ "shasum": ""
848
+ },
849
+ "require": {
850
+ "php": ">=7.0.0",
851
+ "psr/http-message": "^1.0"
852
+ },
853
+ "time": "2019-04-30T12:38:16+00:00",
854
+ "type": "library",
855
+ "extra": {
856
+ "branch-alias": {
857
+ "dev-master": "1.0.x-dev"
858
+ }
859
+ },
860
+ "installation-source": "dist",
861
+ "autoload": {
862
+ "psr-4": {
863
+ "Psr\\Http\\Message\\": "src/"
864
+ }
865
+ },
866
+ "notification-url": "https://packagist.org/downloads/",
867
+ "license": [
868
+ "MIT"
869
+ ],
870
+ "authors": [
871
+ {
872
+ "name": "PHP-FIG",
873
+ "homepage": "http://www.php-fig.org/"
874
+ }
875
+ ],
876
+ "description": "Common interfaces for PSR-7 HTTP message factories",
877
+ "keywords": [
878
+ "factory",
879
+ "http",
880
+ "message",
881
+ "psr",
882
+ "psr-17",
883
+ "psr-7",
884
+ "request",
885
+ "response"
886
+ ],
887
+ "support": {
888
+ "source": "https://github.com/php-fig/http-factory/tree/master"
889
+ },
890
+ "install-path": "../psr/http-factory"
891
+ },
892
  {
893
  "name": "psr/http-message",
894
  "version": "1.0.1",
940
  "request",
941
  "response"
942
  ],
943
+ "support": {
944
+ "source": "https://github.com/php-fig/http-message/tree/master"
945
+ },
946
  "install-path": "../psr/http-message"
947
  },
948
  {
949
+ "name": "symfony/deprecation-contracts",
950
+ "version": "v3.1.1",
951
+ "version_normalized": "3.1.1.0",
952
  "source": {
953
  "type": "git",
954
+ "url": "https://github.com/symfony/deprecation-contracts.git",
955
+ "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918"
956
  },
957
  "dist": {
958
  "type": "zip",
959
+ "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918",
960
+ "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918",
961
  "shasum": ""
962
  },
963
  "require": {
964
+ "php": ">=8.1"
965
  },
966
+ "time": "2022-02-25T11:15:52+00:00",
967
+ "type": "library",
968
+ "extra": {
969
+ "branch-alias": {
970
+ "dev-main": "3.1-dev"
971
+ },
972
+ "thanks": {
973
+ "name": "symfony/contracts",
974
+ "url": "https://github.com/symfony/contracts"
975
+ }
976
+ },
977
+ "installation-source": "dist",
978
+ "autoload": {
979
+ "files": [
980
+ "function.php"
981
+ ]
982
+ },
983
+ "notification-url": "https://packagist.org/downloads/",
984
+ "license": [
985
+ "MIT"
986
+ ],
987
+ "authors": [
988
+ {
989
+ "name": "Nicolas Grekas",
990
+ "email": "p@tchwork.com"
991
+ },
992
+ {
993
+ "name": "Symfony Community",
994
+ "homepage": "https://symfony.com/contributors"
995
+ }
996
+ ],
997
+ "description": "A generic function and convention to trigger deprecation notices",
998
+ "homepage": "https://symfony.com",
999
+ "support": {
1000
+ "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1"
1001
+ },
1002
+ "funding": [
1003
+ {
1004
+ "url": "https://symfony.com/sponsor",
1005
+ "type": "custom"
1006
+ },
1007
+ {
1008
+ "url": "https://github.com/fabpot",
1009
+ "type": "github"
1010
+ },
1011
+ {
1012
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1013
+ "type": "tidelift"
1014
+ }
1015
+ ],
1016
+ "install-path": "../symfony/deprecation-contracts"
1017
+ },
1018
+ {
1019
+ "name": "symfony/options-resolver",
1020
+ "version": "v6.1.0",
1021
+ "version_normalized": "6.1.0.0",
1022
+ "source": {
1023
+ "type": "git",
1024
+ "url": "https://github.com/symfony/options-resolver.git",
1025
+ "reference": "a3016f5442e28386ded73c43a32a5b68586dd1c4"
1026
  },
1027
+ "dist": {
1028
+ "type": "zip",
1029
+ "url": "https://api.github.com/repos/symfony/options-resolver/zipball/a3016f5442e28386ded73c43a32a5b68586dd1c4",
1030
+ "reference": "a3016f5442e28386ded73c43a32a5b68586dd1c4",
1031
+ "shasum": ""
1032
+ },
1033
+ "require": {
1034
+ "php": ">=8.1",
1035
+ "symfony/deprecation-contracts": "^2.1|^3"
1036
+ },
1037
+ "time": "2022-02-25T11:15:52+00:00",
1038
  "type": "library",
1039
  "installation-source": "dist",
1040
+ "autoload": {
1041
+ "psr-4": {
1042
+ "Symfony\\Component\\OptionsResolver\\": ""
1043
+ },
1044
+ "exclude-from-classmap": [
1045
+ "/Tests/"
1046
+ ]
1047
+ },
1048
+ "notification-url": "https://packagist.org/downloads/",
1049
+ "license": [
1050
+ "MIT"
1051
+ ],
1052
+ "authors": [
1053
+ {
1054
+ "name": "Fabien Potencier",
1055
+ "email": "fabien@symfony.com"
1056
+ },
1057
+ {
1058
+ "name": "Symfony Community",
1059
+ "homepage": "https://symfony.com/contributors"
1060
+ }
1061
+ ],
1062
+ "description": "Provides an improved replacement for the array_replace PHP function",
1063
+ "homepage": "https://symfony.com",
1064
+ "keywords": [
1065
+ "config",
1066
+ "configuration",
1067
+ "options"
1068
+ ],
1069
+ "support": {
1070
+ "source": "https://github.com/symfony/options-resolver/tree/v6.1.0"
1071
+ },
1072
+ "funding": [
1073
+ {
1074
+ "url": "https://symfony.com/sponsor",
1075
+ "type": "custom"
1076
+ },
1077
+ {
1078
+ "url": "https://github.com/fabpot",
1079
+ "type": "github"
1080
+ },
1081
+ {
1082
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1083
+ "type": "tidelift"
1084
+ }
1085
+ ],
1086
+ "install-path": "../symfony/options-resolver"
1087
+ },
1088
+ {
1089
+ "name": "symfony/polyfill-php80",
1090
+ "version": "v1.26.0",
1091
+ "version_normalized": "1.26.0.0",
1092
+ "source": {
1093
+ "type": "git",
1094
+ "url": "https://github.com/symfony/polyfill-php80.git",
1095
+ "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
1096
+ },
1097
+ "dist": {
1098
+ "type": "zip",
1099
+ "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
1100
+ "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
1101
+ "shasum": ""
1102
+ },
1103
+ "require": {
1104
+ "php": ">=7.1"
1105
+ },
1106
+ "time": "2022-05-10T07:21:04+00:00",
1107
+ "type": "library",
1108
+ "extra": {
1109
+ "branch-alias": {
1110
+ "dev-main": "1.26-dev"
1111
+ },
1112
+ "thanks": {
1113
+ "name": "symfony/polyfill",
1114
+ "url": "https://github.com/symfony/polyfill"
1115
+ }
1116
+ },
1117
+ "installation-source": "dist",
1118
  "autoload": {
1119
  "files": [
1120
+ "bootstrap.php"
1121
+ ],
1122
+ "psr-4": {
1123
+ "Symfony\\Polyfill\\Php80\\": ""
1124
+ },
1125
+ "classmap": [
1126
+ "Resources/stubs"
1127
  ]
1128
  },
1129
  "notification-url": "https://packagist.org/downloads/",
1132
  ],
1133
  "authors": [
1134
  {
1135
+ "name": "Ion Bazan",
1136
+ "email": "ion.bazan@gmail.com"
1137
+ },
1138
+ {
1139
+ "name": "Nicolas Grekas",
1140
+ "email": "p@tchwork.com"
1141
+ },
1142
+ {
1143
+ "name": "Symfony Community",
1144
+ "homepage": "https://symfony.com/contributors"
1145
+ }
1146
+ ],
1147
+ "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
1148
+ "homepage": "https://symfony.com",
1149
+ "keywords": [
1150
+ "compatibility",
1151
+ "polyfill",
1152
+ "portable",
1153
+ "shim"
1154
+ ],
1155
+ "support": {
1156
+ "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0"
1157
+ },
1158
+ "funding": [
1159
+ {
1160
+ "url": "https://symfony.com/sponsor",
1161
+ "type": "custom"
1162
+ },
1163
+ {
1164
+ "url": "https://github.com/fabpot",
1165
+ "type": "github"
1166
+ },
1167
+ {
1168
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1169
+ "type": "tidelift"
1170
  }
1171
  ],
1172
+ "install-path": "../symfony/polyfill-php80"
 
1173
  }
1174
  ],
1175
  "dev": false,
vendor/composer/installed.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php return array(
2
  'root' => array(
3
  'name' => 'codeinwp/themeisle-companion',
4
- 'pretty_version' => 'v2.10.17',
5
- 'version' => '2.10.17.0',
6
- 'reference' => '6827c962a5cd336812cde91c121138c9faa47528',
7
  'type' => 'wordpress-plugin',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
@@ -38,9 +38,9 @@
38
  'dev_requirement' => false,
39
  ),
40
  'codeinwp/themeisle-companion' => array(
41
- 'pretty_version' => 'v2.10.17',
42
- 'version' => '2.10.17.0',
43
- 'reference' => '6827c962a5cd336812cde91c121138c9faa47528',
44
  'type' => 'wordpress-plugin',
45
  'install_path' => __DIR__ . '/../../',
46
  'aliases' => array(),
@@ -49,82 +49,72 @@
49
  'codeinwp/themeisle-content-forms' => array(
50
  'pretty_version' => 'dev-master',
51
  'version' => 'dev-master',
52
- 'reference' => '73f9d5696603b0aa2e25b9c035e4abfaf5bd2d68',
53
  'type' => 'library',
54
  'install_path' => __DIR__ . '/../codeinwp/themeisle-content-forms',
55
- 'aliases' => array(),
 
 
56
  'dev_requirement' => false,
57
  ),
58
  'codeinwp/themeisle-sdk' => array(
59
- 'pretty_version' => '3.2.28',
60
- 'version' => '3.2.28.0',
61
- 'reference' => '89aafa06d90d8b2d79804e6030d5f3610f596434',
62
  'type' => 'library',
63
  'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
64
  'aliases' => array(),
65
  'dev_requirement' => false,
66
  ),
67
- 'guzzlehttp/psr7' => array(
68
- 'pretty_version' => '1.9.0',
69
- 'version' => '1.9.0.0',
70
- 'reference' => 'e98e3e6d4f86621a9b75f623996e6bbdeb4b9318',
71
- 'type' => 'library',
72
- 'install_path' => __DIR__ . '/../guzzlehttp/psr7',
73
- 'aliases' => array(),
74
- 'dev_requirement' => false,
75
- ),
76
  'mailerlite/mailerlite-api-v2-php-sdk' => array(
77
- 'pretty_version' => '0.2.3',
78
- 'version' => '0.2.3.0',
79
- 'reference' => '2bae0aac12c4588bc0197d2e2dde5a55429b9e44',
80
  'type' => 'library',
81
  'install_path' => __DIR__ . '/../mailerlite/mailerlite-api-v2-php-sdk',
82
  'aliases' => array(),
83
  'dev_requirement' => false,
84
  ),
85
- 'php-http/async-client-implementation' => array(
86
- 'dev_requirement' => false,
87
- 'provided' => array(
88
- 0 => '1.0',
89
- ),
90
- ),
91
- 'php-http/client-implementation' => array(
92
  'dev_requirement' => false,
93
- 'provided' => array(
94
- 0 => '1.0',
95
- ),
96
  ),
97
- 'php-http/curl-client' => array(
98
- 'pretty_version' => 'v1.7.1',
99
- 'version' => '1.7.1.0',
100
- 'reference' => '6341a93d00e5d953fc868a3928b5167e6513f2b6',
101
  'type' => 'library',
102
- 'install_path' => __DIR__ . '/../php-http/curl-client',
103
  'aliases' => array(),
104
  'dev_requirement' => false,
105
  ),
106
  'php-http/discovery' => array(
107
- 'pretty_version' => '1.6.1',
108
- 'version' => '1.6.1.0',
109
- 'reference' => '684855f2c2e9d0a61868b8f8d6bd0295c8a4b651',
110
  'type' => 'library',
111
  'install_path' => __DIR__ . '/../php-http/discovery',
112
  'aliases' => array(),
113
  'dev_requirement' => false,
114
  ),
115
  'php-http/httplug' => array(
116
- 'pretty_version' => 'v1.1.0',
117
- 'version' => '1.1.0.0',
118
- 'reference' => '1c6381726c18579c4ca2ef1ec1498fdae8bdf018',
119
  'type' => 'library',
120
  'install_path' => __DIR__ . '/../php-http/httplug',
121
  'aliases' => array(),
122
  'dev_requirement' => false,
123
  ),
124
  'php-http/message' => array(
125
- 'pretty_version' => '1.7.2',
126
- 'version' => '1.7.2.0',
127
- 'reference' => 'b159ffe570dffd335e22ef0b91a946eacb182fa1',
128
  'type' => 'library',
129
  'install_path' => __DIR__ . '/../php-http/message',
130
  'aliases' => array(),
@@ -146,14 +136,38 @@
146
  ),
147
  ),
148
  'php-http/promise' => array(
149
- 'pretty_version' => 'v1.0.0',
150
- 'version' => '1.0.0.0',
151
- 'reference' => 'dc494cdc9d7160b9a09bd5573272195242ce7980',
152
  'type' => 'library',
153
  'install_path' => __DIR__ . '/../php-http/promise',
154
  'aliases' => array(),
155
  'dev_requirement' => false,
156
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  'psr/http-message' => array(
158
  'pretty_version' => '1.0.1',
159
  'version' => '1.0.1.0',
@@ -169,12 +183,30 @@
169
  0 => '1.0',
170
  ),
171
  ),
172
- 'ralouphie/getallheaders' => array(
173
- 'pretty_version' => '3.0.3',
174
- 'version' => '3.0.3.0',
175
- 'reference' => '120b605dfeb996808c31b6477290a714d356e822',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  'type' => 'library',
177
- 'install_path' => __DIR__ . '/../ralouphie/getallheaders',
178
  'aliases' => array(),
179
  'dev_requirement' => false,
180
  ),
1
  <?php return array(
2
  'root' => array(
3
  'name' => 'codeinwp/themeisle-companion',
4
+ 'pretty_version' => 'v2.10.18',
5
+ 'version' => '2.10.18.0',
6
+ 'reference' => 'b4f2dd5e48349270a2a92931c0ae13d75566b9b6',
7
  'type' => 'wordpress-plugin',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
38
  'dev_requirement' => false,
39
  ),
40
  'codeinwp/themeisle-companion' => array(
41
+ 'pretty_version' => 'v2.10.18',
42
+ 'version' => '2.10.18.0',
43
+ 'reference' => 'b4f2dd5e48349270a2a92931c0ae13d75566b9b6',
44
  'type' => 'wordpress-plugin',
45
  'install_path' => __DIR__ . '/../../',
46
  'aliases' => array(),
49
  'codeinwp/themeisle-content-forms' => array(
50
  'pretty_version' => 'dev-master',
51
  'version' => 'dev-master',
52
+ 'reference' => 'ef5d7612d06636f444ee7bc460ee063d2bebfb26',
53
  'type' => 'library',
54
  'install_path' => __DIR__ . '/../codeinwp/themeisle-content-forms',
55
+ 'aliases' => array(
56
+ 0 => '9999999-dev',
57
+ ),
58
  'dev_requirement' => false,
59
  ),
60
  'codeinwp/themeisle-sdk' => array(
61
+ 'pretty_version' => '3.2.29',
62
+ 'version' => '3.2.29.0',
63
+ 'reference' => '9456fb0944ec69c3975de04aaf56233ddc2f828c',
64
  'type' => 'library',
65
  'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
66
  'aliases' => array(),
67
  'dev_requirement' => false,
68
  ),
 
 
 
 
 
 
 
 
 
69
  'mailerlite/mailerlite-api-v2-php-sdk' => array(
70
+ 'pretty_version' => '0.3.2',
71
+ 'version' => '0.3.2.0',
72
+ 'reference' => '9fb6b8adb3b0dd9eb964ba5169b229516c73fd78',
73
  'type' => 'library',
74
  'install_path' => __DIR__ . '/../mailerlite/mailerlite-api-v2-php-sdk',
75
  'aliases' => array(),
76
  'dev_requirement' => false,
77
  ),
78
+ 'nyholm/psr7' => array(
79
+ 'pretty_version' => '1.5.1',
80
+ 'version' => '1.5.1.0',
81
+ 'reference' => 'f734364e38a876a23be4d906a2a089e1315be18a',
82
+ 'type' => 'library',
83
+ 'install_path' => __DIR__ . '/../nyholm/psr7',
84
+ 'aliases' => array(),
85
  'dev_requirement' => false,
 
 
 
86
  ),
87
+ 'php-http/client-common' => array(
88
+ 'pretty_version' => '2.5.0',
89
+ 'version' => '2.5.0.0',
90
+ 'reference' => 'd135751167d57e27c74de674d6a30cef2dc8e054',
91
  'type' => 'library',
92
+ 'install_path' => __DIR__ . '/../php-http/client-common',
93
  'aliases' => array(),
94
  'dev_requirement' => false,
95
  ),
96
  'php-http/discovery' => array(
97
+ 'pretty_version' => '1.14.3',
98
+ 'version' => '1.14.3.0',
99
+ 'reference' => '31d8ee46d0215108df16a8527c7438e96a4d7735',
100
  'type' => 'library',
101
  'install_path' => __DIR__ . '/../php-http/discovery',
102
  'aliases' => array(),
103
  'dev_requirement' => false,
104
  ),
105
  'php-http/httplug' => array(
106
+ 'pretty_version' => '2.3.0',
107
+ 'version' => '2.3.0.0',
108
+ 'reference' => 'f640739f80dfa1152533976e3c112477f69274eb',
109
  'type' => 'library',
110
  'install_path' => __DIR__ . '/../php-http/httplug',
111
  'aliases' => array(),
112
  'dev_requirement' => false,
113
  ),
114
  'php-http/message' => array(
115
+ 'pretty_version' => '1.13.0',
116
+ 'version' => '1.13.0.0',
117
+ 'reference' => '7886e647a30a966a1a8d1dad1845b71ca8678361',
118
  'type' => 'library',
119
  'install_path' => __DIR__ . '/../php-http/message',
120
  'aliases' => array(),
136
  ),
137
  ),
138
  'php-http/promise' => array(
139
+ 'pretty_version' => '1.1.0',
140
+ 'version' => '1.1.0.0',
141
+ 'reference' => '4c4c1f9b7289a2ec57cde7f1e9762a5789506f88',
142
  'type' => 'library',
143
  'install_path' => __DIR__ . '/../php-http/promise',
144
  'aliases' => array(),
145
  'dev_requirement' => false,
146
  ),
147
+ 'psr/http-client' => array(
148
+ 'pretty_version' => '1.0.1',
149
+ 'version' => '1.0.1.0',
150
+ 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
151
+ 'type' => 'library',
152
+ 'install_path' => __DIR__ . '/../psr/http-client',
153
+ 'aliases' => array(),
154
+ 'dev_requirement' => false,
155
+ ),
156
+ 'psr/http-factory' => array(
157
+ 'pretty_version' => '1.0.1',
158
+ 'version' => '1.0.1.0',
159
+ 'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be',
160
+ 'type' => 'library',
161
+ 'install_path' => __DIR__ . '/../psr/http-factory',
162
+ 'aliases' => array(),
163
+ 'dev_requirement' => false,
164
+ ),
165
+ 'psr/http-factory-implementation' => array(
166
+ 'dev_requirement' => false,
167
+ 'provided' => array(
168
+ 0 => '1.0',
169
+ ),
170
+ ),
171
  'psr/http-message' => array(
172
  'pretty_version' => '1.0.1',
173
  'version' => '1.0.1.0',
183
  0 => '1.0',
184
  ),
185
  ),
186
+ 'symfony/deprecation-contracts' => array(
187
+ 'pretty_version' => 'v3.1.1',
188
+ 'version' => '3.1.1.0',
189
+ 'reference' => '07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918',
190
+ 'type' => 'library',
191
+ 'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
192
+ 'aliases' => array(),
193
+ 'dev_requirement' => false,
194
+ ),
195
+ 'symfony/options-resolver' => array(
196
+ 'pretty_version' => 'v6.1.0',
197
+ 'version' => '6.1.0.0',
198
+ 'reference' => 'a3016f5442e28386ded73c43a32a5b68586dd1c4',
199
+ 'type' => 'library',
200
+ 'install_path' => __DIR__ . '/../symfony/options-resolver',
201
+ 'aliases' => array(),
202
+ 'dev_requirement' => false,
203
+ ),
204
+ 'symfony/polyfill-php80' => array(
205
+ 'pretty_version' => 'v1.26.0',
206
+ 'version' => '1.26.0.0',
207
+ 'reference' => 'cfa0ae98841b9e461207c13ab093d76b0fa7bace',
208
  'type' => 'library',
209
+ 'install_path' => __DIR__ . '/../symfony/polyfill-php80',
210
  'aliases' => array(),
211
  'dev_requirement' => false,
212
  ),
vendor/composer/platform_check.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- // platform_check.php @generated by Composer
4
-
5
- $issues = array();
6
-
7
- if (!(PHP_VERSION_ID >= 50600)) {
8
- $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
9
- }
10
-
11
- if ($issues) {
12
- if (!headers_sent()) {
13
- header('HTTP/1.1 500 Internal Server Error');
14
- }
15
- if (!ini_get('display_errors')) {
16
- if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17
- fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
18
- } elseif (!headers_sent()) {
19
- echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
20
- }
21
- }
22
- trigger_error(
23
- 'Composer detected issues in your platform: ' . implode(' ', $issues),
24
- E_USER_ERROR
25
- );
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/.php_cs.dist DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
-
3
- $config = PhpCsFixer\Config::create()
4
- ->setRiskyAllowed(true)
5
- ->setRules([
6
- '@PSR2' => true,
7
- 'array_syntax' => ['syntax' => 'short'],
8
- 'concat_space' => ['spacing' => 'one'],
9
- 'declare_strict_types' => false,
10
- 'final_static_access' => true,
11
- 'fully_qualified_strict_types' => true,
12
- 'header_comment' => false,
13
- 'is_null' => ['use_yoda_style' => true],
14
- 'list_syntax' => ['syntax' => 'long'],
15
- 'lowercase_cast' => true,
16
- 'magic_method_casing' => true,
17
- 'modernize_types_casting' => true,
18
- 'multiline_comment_opening_closing' => true,
19
- 'no_alias_functions' => true,
20
- 'no_alternative_syntax' => true,
21
- 'no_blank_lines_after_phpdoc' => true,
22
- 'no_empty_comment' => true,
23
- 'no_empty_phpdoc' => true,
24
- 'no_empty_statement' => true,
25
- 'no_extra_blank_lines' => true,
26
- 'no_leading_import_slash' => true,
27
- 'no_trailing_comma_in_singleline_array' => true,
28
- 'no_unset_cast' => true,
29
- 'no_unused_imports' => true,
30
- 'no_whitespace_in_blank_line' => true,
31
- 'ordered_imports' => true,
32
- 'php_unit_ordered_covers' => true,
33
- 'php_unit_test_annotation' => ['style' => 'prefix'],
34
- 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
35
- 'phpdoc_align' => ['align' => 'vertical'],
36
- 'phpdoc_no_useless_inheritdoc' => true,
37
- 'phpdoc_scalar' => true,
38
- 'phpdoc_separation' => true,
39
- 'phpdoc_single_line_var_spacing' => true,
40
- 'phpdoc_trim' => true,
41
- 'phpdoc_trim_consecutive_blank_line_separation' => true,
42
- 'phpdoc_types' => true,
43
- 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
44
- 'phpdoc_var_without_name' => true,
45
- 'single_trait_insert_per_statement' => true,
46
- 'standardize_not_equals' => true,
47
- ])
48
- ->setFinder(
49
- PhpCsFixer\Finder::create()
50
- ->in(__DIR__.'/src')
51
- ->in(__DIR__.'/tests')
52
- ->name('*.php')
53
- )
54
- ;
55
-
56
- return $config;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/CHANGELOG.md DELETED
@@ -1,318 +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](https://keepachangelog.com/en/1.0.0/)
7
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
-
9
-
10
- ## Unreleased
11
-
12
- ## 1.9.0 - 2022-06-20
13
-
14
- ### Added
15
-
16
- - Added `UriComparator::isCrossOrigin` method
17
-
18
- ## 1.8.5 - 2022-03-20
19
-
20
- ### Fixed
21
-
22
- - Correct header value validation
23
-
24
- ## 1.8.4 - 2022-03-20
25
-
26
- ### Fixed
27
-
28
- - Validate header values properly
29
-
30
- ## 1.8.3 - 2021-10-05
31
-
32
- ### Fixed
33
-
34
- - Return `null` in caching stream size if remote size is `null`
35
-
36
- ## 1.8.2 - 2021-04-26
37
-
38
- ### Fixed
39
-
40
- - Handle possibly unset `url` in `stream_get_meta_data`
41
-
42
- ## 1.8.1 - 2021-03-21
43
-
44
- ### Fixed
45
-
46
- - Issue parsing IPv6 URLs
47
- - Issue modifying ServerRequest lost all its attributes
48
-
49
- ## 1.8.0 - 2021-03-21
50
-
51
- ### Added
52
-
53
- - Locale independent URL parsing
54
- - Most classes got a `@final` annotation to prepare for 2.0
55
-
56
- ### Fixed
57
-
58
- - Issue when creating stream from `php://input` and curl-ext is not installed
59
- - Broken `Utils::tryFopen()` on PHP 8
60
-
61
- ## 1.7.0 - 2020-09-30
62
-
63
- ### Added
64
-
65
- - Replaced functions by static methods
66
-
67
- ### Fixed
68
-
69
- - Converting a non-seekable stream to a string
70
- - Handle multiple Set-Cookie correctly
71
- - Ignore array keys in header values when merging
72
- - Allow multibyte characters to be parsed in `Message:bodySummary()`
73
-
74
- ### Changed
75
-
76
- - Restored partial HHVM 3 support
77
-
78
-
79
- ## [1.6.1] - 2019-07-02
80
-
81
- ### Fixed
82
-
83
- - Accept null and bool header values again
84
-
85
-
86
- ## [1.6.0] - 2019-06-30
87
-
88
- ### Added
89
-
90
- - Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244)
91
- - Added MIME type for WEBP image format (#246)
92
- - Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272)
93
-
94
- ### Changed
95
-
96
- - Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262)
97
- - Accept port number 0 to be valid (#270)
98
-
99
- ### Fixed
100
-
101
- - Fixed subsequent reads from `php://input` in ServerRequest (#247)
102
- - Fixed readable/writable detection for certain stream modes (#248)
103
- - Fixed encoding of special characters in the `userInfo` component of an URI (#253)
104
-
105
-
106
- ## [1.5.2] - 2018-12-04
107
-
108
- ### Fixed
109
-
110
- - Check body size when getting the message summary
111
-
112
-
113
- ## [1.5.1] - 2018-12-04
114
-
115
- ### Fixed
116
-
117
- - Get the summary of a body only if it is readable
118
-
119
-
120
- ## [1.5.0] - 2018-12-03
121
-
122
- ### Added
123
-
124
- - Response first-line to response string exception (fixes #145)
125
- - A test for #129 behavior
126
- - `get_message_body_summary` function in order to get the message summary
127
- - `3gp` and `mkv` mime types
128
-
129
- ### Changed
130
-
131
- - Clarify exception message when stream is detached
132
-
133
- ### Deprecated
134
-
135
- - Deprecated parsing folded header lines as per RFC 7230
136
-
137
- ### Fixed
138
-
139
- - Fix `AppendStream::detach` to not close streams
140
- - `InflateStream` preserves `isSeekable` attribute of the underlying stream
141
- - `ServerRequest::getUriFromGlobals` to support URLs in query parameters
142
-
143
-
144
- Several other fixes and improvements.
145
-
146
-
147
- ## [1.4.2] - 2017-03-20
148
-
149
- ### Fixed
150
-
151
- - Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
152
- calls to `trigger_error` when deprecated methods are invoked.
153
-
154
-
155
- ## [1.4.1] - 2017-02-27
156
-
157
- ### Added
158
-
159
- - Rriggering of silenced deprecation warnings.
160
-
161
- ### Fixed
162
-
163
- - Reverted BC break by reintroducing behavior to automagically fix a URI with a
164
- relative path and an authority by adding a leading slash to the path. It's only
165
- deprecated now.
166
-
167
-
168
- ## [1.4.0] - 2017-02-21
169
-
170
- ### Added
171
-
172
- - Added common URI utility methods based on RFC 3986 (see documentation in the readme):
173
- - `Uri::isDefaultPort`
174
- - `Uri::isAbsolute`
175
- - `Uri::isNetworkPathReference`
176
- - `Uri::isAbsolutePathReference`
177
- - `Uri::isRelativePathReference`
178
- - `Uri::isSameDocumentReference`
179
- - `Uri::composeComponents`
180
- - `UriNormalizer::normalize`
181
- - `UriNormalizer::isEquivalent`
182
- - `UriResolver::relativize`
183
-
184
- ### Changed
185
-
186
- - Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
187
- - Allow `parse_response` to parse a response without delimiting space and reason.
188
- - Ensure each URI modification results in a valid URI according to PSR-7 discussions.
189
- Invalid modifications will throw an exception instead of returning a wrong URI or
190
- doing some magic.
191
- - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
192
- because the path of a URI with an authority must start with a slash "/" or be empty
193
- - `(new Uri())->withScheme('http')` will return `'http://localhost'`
194
-
195
- ### Deprecated
196
-
197
- - `Uri::resolve` in favor of `UriResolver::resolve`
198
- - `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
199
-
200
- ### Fixed
201
-
202
- - `Stream::read` when length parameter <= 0.
203
- - `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
204
- - `ServerRequest::getUriFromGlobals` when `Host` header contains port.
205
- - Compatibility of URIs with `file` scheme and empty host.
206
-
207
-
208
- ## [1.3.1] - 2016-06-25
209
-
210
- ### Fixed
211
-
212
- - `Uri::__toString` for network path references, e.g. `//example.org`.
213
- - Missing lowercase normalization for host.
214
- - Handling of URI components in case they are `'0'` in a lot of places,
215
- e.g. as a user info password.
216
- - `Uri::withAddedHeader` to correctly merge headers with different case.
217
- - Trimming of header values in `Uri::withAddedHeader`. Header values may
218
- be surrounded by whitespace which should be ignored according to RFC 7230
219
- Section 3.2.4. This does not apply to header names.
220
- - `Uri::withAddedHeader` with an array of header values.
221
- - `Uri::resolve` when base path has no slash and handling of fragment.
222
- - Handling of encoding in `Uri::with(out)QueryValue` so one can pass the
223
- key/value both in encoded as well as decoded form to those methods. This is
224
- consistent with withPath, withQuery etc.
225
- - `ServerRequest::withoutAttribute` when attribute value is null.
226
-
227
-
228
- ## [1.3.0] - 2016-04-13
229
-
230
- ### Added
231
-
232
- - Remaining interfaces needed for full PSR7 compatibility
233
- (ServerRequestInterface, UploadedFileInterface, etc.).
234
- - Support for stream_for from scalars.
235
-
236
- ### Changed
237
-
238
- - Can now extend Uri.
239
-
240
- ### Fixed
241
- - A bug in validating request methods by making it more permissive.
242
-
243
-
244
- ## [1.2.3] - 2016-02-18
245
-
246
- ### Fixed
247
-
248
- - Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
249
- streams, which can sometimes return fewer bytes than requested with `fread`.
250
- - Handling of gzipped responses with FNAME headers.
251
-
252
-
253
- ## [1.2.2] - 2016-01-22
254
-
255
- ### Added
256
-
257
- - Support for URIs without any authority.
258
- - Support for HTTP 451 'Unavailable For Legal Reasons.'
259
- - Support for using '0' as a filename.
260
- - Support for including non-standard ports in Host headers.
261
-
262
-
263
- ## [1.2.1] - 2015-11-02
264
-
265
- ### Changes
266
-
267
- - Now supporting negative offsets when seeking to SEEK_END.
268
-
269
-
270
- ## [1.2.0] - 2015-08-15
271
-
272
- ### Changed
273
-
274
- - Body as `"0"` is now properly added to a response.
275
- - Now allowing forward seeking in CachingStream.
276
- - Now properly parsing HTTP requests that contain proxy targets in
277
- `parse_request`.
278
- - functions.php is now conditionally required.
279
- - user-info is no longer dropped when resolving URIs.
280
-
281
-
282
- ## [1.1.0] - 2015-06-24
283
-
284
- ### Changed
285
-
286
- - URIs can now be relative.
287
- - `multipart/form-data` headers are now overridden case-insensitively.
288
- - URI paths no longer encode the following characters because they are allowed
289
- in URIs: "(", ")", "*", "!", "'"
290
- - A port is no longer added to a URI when the scheme is missing and no port is
291
- present.
292
-
293
-
294
- ## 1.0.0 - 2015-05-19
295
-
296
- Initial release.
297
-
298
- Currently unsupported:
299
-
300
- - `Psr\Http\Message\ServerRequestInterface`
301
- - `Psr\Http\Message\UploadedFileInterface`
302
-
303
-
304
-
305
- [1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0
306
- [1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2
307
- [1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1
308
- [1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0
309
- [1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2
310
- [1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1
311
- [1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0
312
- [1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1
313
- [1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0
314
- [1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3
315
- [1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2
316
- [1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1
317
- [1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0
318
- [1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/README.md DELETED
@@ -1,844 +0,0 @@
1
- # PSR-7 Message Implementation
2
-
3
- This repository contains a full [PSR-7](https://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`](https://www.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
- ## Cross-Origin Detection
688
-
689
- `GuzzleHttp\Psr7\UriComparator` provides methods to determine if a modified URL should be considered cross-origin.
690
-
691
- ### `GuzzleHttp\Psr7\UriComparator::isCrossOrigin`
692
-
693
- `public static function isCrossOrigin(UriInterface $original, UriInterface $modified): bool`
694
-
695
- Determines if a modified URL should be considered cross-origin with respect to an original URL.
696
-
697
- ## Reference Resolution
698
-
699
- `GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according
700
- to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers
701
- do when resolving a link in a website based on the current request URI.
702
-
703
- ### `GuzzleHttp\Psr7\UriResolver::resolve`
704
-
705
- `public static function resolve(UriInterface $base, UriInterface $rel): UriInterface`
706
-
707
- Converts the relative URI into a new URI that is resolved against the base URI.
708
-
709
- ### `GuzzleHttp\Psr7\UriResolver::removeDotSegments`
710
-
711
- `public static function removeDotSegments(string $path): string`
712
-
713
- Removes dot segments from a path and returns the new path according to
714
- [RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4).
715
-
716
- ### `GuzzleHttp\Psr7\UriResolver::relativize`
717
-
718
- `public static function relativize(UriInterface $base, UriInterface $target): UriInterface`
719
-
720
- Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve():
721
-
722
- ```php
723
- (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target))
724
- ```
725
-
726
- One use-case is to use the current request URI as base URI and then generate relative links in your documents
727
- to reduce the document size or offer self-contained downloadable document archives.
728
-
729
- ```php
730
- $base = new Uri('http://example.com/a/b/');
731
- echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'.
732
- echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'.
733
- echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'.
734
- echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'.
735
- ```
736
-
737
- ## Normalization and Comparison
738
-
739
- `GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to
740
- [RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6).
741
-
742
- ### `GuzzleHttp\Psr7\UriNormalizer::normalize`
743
-
744
- `public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface`
745
-
746
- Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface.
747
- This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask
748
- of normalizations to apply. The following normalizations are available:
749
-
750
- - `UriNormalizer::PRESERVING_NORMALIZATIONS`
751
-
752
- Default normalizations which only include the ones that preserve semantics.
753
-
754
- - `UriNormalizer::CAPITALIZE_PERCENT_ENCODING`
755
-
756
- All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized.
757
-
758
- Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b`
759
-
760
- - `UriNormalizer::DECODE_UNRESERVED_CHARACTERS`
761
-
762
- Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of
763
- ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should
764
- not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved
765
- characters by URI normalizers.
766
-
767
- Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/`
768
-
769
- - `UriNormalizer::CONVERT_EMPTY_PATH`
770
-
771
- Converts the empty path to "/" for http and https URIs.
772
-
773
- Example: `http://example.org` → `http://example.org/`
774
-
775
- - `UriNormalizer::REMOVE_DEFAULT_HOST`
776
-
777
- Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host
778
- "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to
779
- RFC 3986.
780
-
781
- Example: `file://localhost/myfile` → `file:///myfile`
782
-
783
- - `UriNormalizer::REMOVE_DEFAULT_PORT`
784
-
785
- Removes the default port of the given URI scheme from the URI.
786
-
787
- Example: `http://example.org:80/` → `http://example.org/`
788
-
789
- - `UriNormalizer::REMOVE_DOT_SEGMENTS`
790
-
791
- Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would
792
- change the semantics of the URI reference.
793
-
794
- Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html`
795
-
796
- - `UriNormalizer::REMOVE_DUPLICATE_SLASHES`
797
-
798
- Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes
799
- and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization
800
- may change the semantics. Encoded slashes (%2F) are not removed.
801
-
802
- Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html`
803
-
804
- - `UriNormalizer::SORT_QUERY_PARAMETERS`
805
-
806
- Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be
807
- significant (this is not defined by the standard). So this normalization is not safe and may change the semantics
808
- of the URI.
809
-
810
- Example: `?lang=en&article=fred` → `?article=fred&lang=en`
811
-
812
- ### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent`
813
-
814
- `public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool`
815
-
816
- Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given
817
- `$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent.
818
- This of course assumes they will be resolved against the same base URI. If this is not the case, determination of
819
- equivalence or difference of relative references does not mean anything.
820
-
821
-
822
- ## Version Guidance
823
-
824
- | Version | Status | PHP Version |
825
- |---------|----------------|------------------|
826
- | 1.x | Security fixes | >=5.4,<8.1 |
827
- | 2.x | Latest | ^7.2.5 \|\| ^8.0 |
828
-
829
-
830
- ## Security
831
-
832
- If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/psr7/security/policy) for more information.
833
-
834
-
835
- ## License
836
-
837
- Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information.
838
-
839
-
840
- ## For Enterprise
841
-
842
- Available as part of the Tidelift Subscription
843
-
844
- The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-psr7?utm_source=packagist-guzzlehttp-psr7&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/AppendStream.php DELETED
@@ -1,246 +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
- * @final
13
- */
14
- class AppendStream implements StreamInterface
15
- {
16
- /** @var StreamInterface[] Streams being decorated */
17
- private $streams = [];
18
-
19
- private $seekable = true;
20
- private $current = 0;
21
- private $pos = 0;
22
-
23
- /**
24
- * @param StreamInterface[] $streams Streams to decorate. Each stream must
25
- * be readable.
26
- */
27
- public function __construct(array $streams = [])
28
- {
29
- foreach ($streams as $stream) {
30
- $this->addStream($stream);
31
- }
32
- }
33
-
34
- public function __toString()
35
- {
36
- try {
37
- $this->rewind();
38
- return $this->getContents();
39
- } catch (\Exception $e) {
40
- return '';
41
- }
42
- }
43
-
44
- /**
45
- * Add a stream to the AppendStream
46
- *
47
- * @param StreamInterface $stream Stream to append. Must be readable.
48
- *
49
- * @throws \InvalidArgumentException if the stream is not readable
50
- */
51
- public function addStream(StreamInterface $stream)
52
- {
53
- if (!$stream->isReadable()) {
54
- throw new \InvalidArgumentException('Each stream must be readable');
55
- }
56
-
57
- // The stream is only seekable if all streams are seekable
58
- if (!$stream->isSeekable()) {
59
- $this->seekable = false;
60
- }
61
-
62
- $this->streams[] = $stream;
63
- }
64
-
65
- public function getContents()
66
- {
67
- return Utils::copyToString($this);
68
- }
69
-
70
- /**
71
- * Closes each attached stream.
72
- *
73
- * {@inheritdoc}
74
- */
75
- public function close()
76
- {
77
- $this->pos = $this->current = 0;
78
- $this->seekable = true;
79
-
80
- foreach ($this->streams as $stream) {
81
- $stream->close();
82
- }
83
-
84
- $this->streams = [];
85
- }
86
-
87
- /**
88
- * Detaches each attached stream.
89
- *
90
- * Returns null as it's not clear which underlying stream resource to return.
91
- *
92
- * {@inheritdoc}
93
- */
94
- public function detach()
95
- {
96
- $this->pos = $this->current = 0;
97
- $this->seekable = true;
98
-
99
- foreach ($this->streams as $stream) {
100
- $stream->detach();
101
- }
102
-
103
- $this->streams = [];
104
-
105
- return null;
106
- }
107
-
108
- public function tell()
109
- {
110
- return $this->pos;
111
- }
112
-
113
- /**
114
- * Tries to calculate the size by adding the size of each stream.
115
- *
116
- * If any of the streams do not return a valid number, then the size of the
117
- * append stream cannot be determined and null is returned.
118
- *
119
- * {@inheritdoc}
120
- */
121
- public function getSize()
122
- {
123
- $size = 0;
124
-
125
- foreach ($this->streams as $stream) {
126
- $s = $stream->getSize();
127
- if ($s === null) {
128
- return null;
129
- }
130
- $size += $s;
131
- }
132
-
133
- return $size;
134
- }
135
-
136
- public function eof()
137
- {
138
- return !$this->streams ||
139
- ($this->current >= count($this->streams) - 1 &&
140
- $this->streams[$this->current]->eof());
141
- }
142
-
143
- public function rewind()
144
- {
145
- $this->seek(0);
146
- }
147
-
148
- /**
149
- * Attempts to seek to the given position. Only supports SEEK_SET.
150
- *
151
- * {@inheritdoc}
152
- */
153
- public function seek($offset, $whence = SEEK_SET)
154
- {
155
- if (!$this->seekable) {
156
- throw new \RuntimeException('This AppendStream is not seekable');
157
- } elseif ($whence !== SEEK_SET) {
158
- throw new \RuntimeException('The AppendStream can only seek with SEEK_SET');
159
- }
160
-
161
- $this->pos = $this->current = 0;
162
-
163
- // Rewind each stream
164
- foreach ($this->streams as $i => $stream) {
165
- try {
166
- $stream->rewind();
167
- } catch (\Exception $e) {
168
- throw new \RuntimeException('Unable to seek stream '
169
- . $i . ' of the AppendStream', 0, $e);
170
- }
171
- }
172
-
173
- // Seek to the actual position by reading from each stream
174
- while ($this->pos < $offset && !$this->eof()) {
175
- $result = $this->read(min(8096, $offset - $this->pos));
176
- if ($result === '') {
177
- break;
178
- }
179
- }
180
- }
181
-
182
- /**
183
- * Reads from all of the appended streams until the length is met or EOF.
184
- *
185
- * {@inheritdoc}
186
- */
187
- public function read($length)
188
- {
189
- $buffer = '';
190
- $total = count($this->streams) - 1;
191
- $remaining = $length;
192
- $progressToNext = false;
193
-
194
- while ($remaining > 0) {
195
-
196
- // Progress to the next stream if needed.
197
- if ($progressToNext || $this->streams[$this->current]->eof()) {
198
- $progressToNext = false;
199
- if ($this->current === $total) {
200
- break;
201
- }
202
- $this->current++;
203
- }
204
-
205
- $result = $this->streams[$this->current]->read($remaining);
206
-
207
- // Using a loose comparison here to match on '', false, and null
208
- if ($result == null) {
209
- $progressToNext = true;
210
- continue;
211
- }
212
-
213
- $buffer .= $result;
214
- $remaining = $length - strlen($buffer);
215
- }
216
-
217
- $this->pos += strlen($buffer);
218
-
219
- return $buffer;
220
- }
221
-
222
- public function isReadable()
223
- {
224
- return true;
225
- }
226
-
227
- public function isWritable()
228
- {
229
- return false;
230
- }
231
-
232
- public function isSeekable()
233
- {
234
- return $this->seekable;
235
- }
236
-
237
- public function write($string)
238
- {
239
- throw new \RuntimeException('Cannot write to an AppendStream');
240
- }
241
-
242
- public function getMetadata($key = null)
243
- {
244
- return $key ? null : [];
245
- }
246
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/BufferStream.php DELETED
@@ -1,142 +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
- * @final
16
- */
17
- class BufferStream implements StreamInterface
18
- {
19
- private $hwm;
20
- private $buffer = '';
21
-
22
- /**
23
- * @param int $hwm High water mark, representing the preferred maximum
24
- * buffer size. If the size of the buffer exceeds the high
25
- * water mark, then calls to write will continue to succeed
26
- * but will return false to inform writers to slow down
27
- * until the buffer has been drained by reading from it.
28
- */
29
- public function __construct($hwm = 16384)
30
- {
31
- $this->hwm = $hwm;
32
- }
33
-
34
- public function __toString()
35
- {
36
- return $this->getContents();
37
- }
38
-
39
- public function getContents()
40
- {
41
- $buffer = $this->buffer;
42
- $this->buffer = '';
43
-
44
- return $buffer;
45
- }
46
-
47
- public function close()
48
- {
49
- $this->buffer = '';
50
- }
51
-
52
- public function detach()
53
- {
54
- $this->close();
55
-
56
- return null;
57
- }
58
-
59
- public function getSize()
60
- {
61
- return strlen($this->buffer);
62
- }
63
-
64
- public function isReadable()
65
- {
66
- return true;
67
- }
68
-
69
- public function isWritable()
70
- {
71
- return true;
72
- }
73
-
74
- public function isSeekable()
75
- {
76
- return false;
77
- }
78
-
79
- public function rewind()
80
- {
81
- $this->seek(0);
82
- }
83
-
84
- public function seek($offset, $whence = SEEK_SET)
85
- {
86
- throw new \RuntimeException('Cannot seek a BufferStream');
87
- }
88
-
89
- public function eof()
90
- {
91
- return strlen($this->buffer) === 0;
92
- }
93
-
94
- public function tell()
95
- {
96
- throw new \RuntimeException('Cannot determine the position of a BufferStream');
97
- }
98
-
99
- /**
100
- * Reads data from the buffer.
101
- */
102
- public function read($length)
103
- {
104
- $currentLength = strlen($this->buffer);
105
-
106
- if ($length >= $currentLength) {
107
- // No need to slice the buffer because we don't have enough data.
108
- $result = $this->buffer;
109
- $this->buffer = '';
110
- } else {
111
- // Slice up the result to provide a subset of the buffer.
112
- $result = substr($this->buffer, 0, $length);
113
- $this->buffer = substr($this->buffer, $length);
114
- }
115
-
116
- return $result;
117
- }
118
-
119
- /**
120
- * Writes data to the buffer.
121
- */
122
- public function write($string)
123
- {
124
- $this->buffer .= $string;
125
-
126
- // TODO: What should happen here?
127
- if (strlen($this->buffer) >= $this->hwm) {
128
- return false;
129
- }
130
-
131
- return strlen($string);
132
- }
133
-
134
- public function getMetadata($key = null)
135
- {
136
- if ($key == 'hwm') {
137
- return $this->hwm;
138
- }
139
-
140
- return $key ? null : [];
141
- }
142
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/CachingStream.php DELETED
@@ -1,147 +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
- * @final
12
- */
13
- class CachingStream implements StreamInterface
14
- {
15
- use StreamDecoratorTrait;
16
-
17
- /** @var StreamInterface Stream being wrapped */
18
- private $remoteStream;
19
-
20
- /** @var int Number of bytes to skip reading due to a write on the buffer */
21
- private $skipReadBytes = 0;
22
-
23
- /**
24
- * We will treat the buffer object as the body of the stream
25
- *
26
- * @param StreamInterface $stream Stream to cache. The cursor is assumed to be at the beginning of the stream.
27
- * @param StreamInterface $target Optionally specify where data is cached
28
- */
29
- public function __construct(
30
- StreamInterface $stream,
31
- StreamInterface $target = null
32
- ) {
33
- $this->remoteStream = $stream;
34
- $this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+'));
35
- }
36
-
37
- public function getSize()
38
- {
39
- $remoteSize = $this->remoteStream->getSize();
40
-
41
- if (null === $remoteSize) {
42
- return null;
43
- }
44
-
45
- return max($this->stream->getSize(), $remoteSize);
46
- }
47
-
48
- public function rewind()
49
- {
50
- $this->seek(0);
51
- }
52
-
53
- public function seek($offset, $whence = SEEK_SET)
54
- {
55
- if ($whence == SEEK_SET) {
56
- $byte = $offset;
57
- } elseif ($whence == SEEK_CUR) {
58
- $byte = $offset + $this->tell();
59
- } elseif ($whence == SEEK_END) {
60
- $size = $this->remoteStream->getSize();
61
- if ($size === null) {
62
- $size = $this->cacheEntireStream();
63
- }
64
- $byte = $size + $offset;
65
- } else {
66
- throw new \InvalidArgumentException('Invalid whence');
67
- }
68
-
69
- $diff = $byte - $this->stream->getSize();
70
-
71
- if ($diff > 0) {
72
- // Read the remoteStream until we have read in at least the amount
73
- // of bytes requested, or we reach the end of the file.
74
- while ($diff > 0 && !$this->remoteStream->eof()) {
75
- $this->read($diff);
76
- $diff = $byte - $this->stream->getSize();
77
- }
78
- } else {
79
- // We can just do a normal seek since we've already seen this byte.
80
- $this->stream->seek($byte);
81
- }
82
- }
83
-
84
- public function read($length)
85
- {
86
- // Perform a regular read on any previously read data from the buffer
87
- $data = $this->stream->read($length);
88
- $remaining = $length - strlen($data);
89
-
90
- // More data was requested so read from the remote stream
91
- if ($remaining) {
92
- // If data was written to the buffer in a position that would have
93
- // been filled from the remote stream, then we must skip bytes on
94
- // the remote stream to emulate overwriting bytes from that
95
- // position. This mimics the behavior of other PHP stream wrappers.
96
- $remoteData = $this->remoteStream->read(
97
- $remaining + $this->skipReadBytes
98
- );
99
-
100
- if ($this->skipReadBytes) {
101
- $len = strlen($remoteData);
102
- $remoteData = substr($remoteData, $this->skipReadBytes);
103
- $this->skipReadBytes = max(0, $this->skipReadBytes - $len);
104
- }
105
-
106
- $data .= $remoteData;
107
- $this->stream->write($remoteData);
108
- }
109
-
110
- return $data;
111
- }
112
-
113
- public function write($string)
114
- {
115
- // When appending to the end of the currently read stream, you'll want
116
- // to skip bytes from being read from the remote stream to emulate
117
- // other stream wrappers. Basically replacing bytes of data of a fixed
118
- // length.
119
- $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell();
120
- if ($overflow > 0) {
121
- $this->skipReadBytes += $overflow;
122
- }
123
-
124
- return $this->stream->write($string);
125
- }
126
-
127
- public function eof()
128
- {
129
- return $this->stream->eof() && $this->remoteStream->eof();
130
- }
131
-
132
- /**
133
- * Close both the remote stream and buffer stream
134
- */
135
- public function close()
136
- {
137
- $this->remoteStream->close() && $this->stream->close();
138
- }
139
-
140
- private function cacheEntireStream()
141
- {
142
- $target = new FnStream(['write' => 'strlen']);
143
- Utils::copyToStream($this, $target);
144
-
145
- return $this->tell();
146
- }
147
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/DroppingStream.php DELETED
@@ -1,45 +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
- * @final
12
- */
13
- class DroppingStream implements StreamInterface
14
- {
15
- use StreamDecoratorTrait;
16
-
17
- private $maxLength;
18
-
19
- /**
20
- * @param StreamInterface $stream Underlying stream to decorate.
21
- * @param int $maxLength Maximum size before dropping data.
22
- */
23
- public function __construct(StreamInterface $stream, $maxLength)
24
- {
25
- $this->stream = $stream;
26
- $this->maxLength = $maxLength;
27
- }
28
-
29
- public function write($string)
30
- {
31
- $diff = $this->maxLength - $this->stream->getSize();
32
-
33
- // Begin returning 0 when the underlying stream is too large.
34
- if ($diff <= 0) {
35
- return 0;
36
- }
37
-
38
- // Write the stream or a subset of the stream if needed.
39
- if (strlen($string) < $diff) {
40
- return $this->stream->write($string);
41
- }
42
-
43
- return $this->stream->write(substr($string, 0, $diff));
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/FnStream.php DELETED
@@ -1,163 +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
- * @final
14
- */
15
- class FnStream implements StreamInterface
16
- {
17
- /** @var array */
18
- private $methods;
19
-
20
- /** @var array Methods that must be implemented in the given array */
21
- private static $slots = ['__toString', 'close', 'detach', 'rewind',
22
- 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write',
23
- 'isReadable', 'read', 'getContents', 'getMetadata'];
24
-
25
- /**
26
- * @param array $methods Hash of method name to a callable.
27
- */
28
- public function __construct(array $methods)
29
- {
30
- $this->methods = $methods;
31
-
32
- // Create the functions on the class
33
- foreach ($methods as $name => $fn) {
34
- $this->{'_fn_' . $name} = $fn;
35
- }
36
- }
37
-
38
- /**
39
- * Lazily determine which methods are not implemented.
40
- *
41
- * @throws \BadMethodCallException
42
- */
43
- public function __get($name)
44
- {
45
- throw new \BadMethodCallException(str_replace('_fn_', '', $name)
46
- . '() is not implemented in the FnStream');
47
- }
48
-
49
- /**
50
- * The close method is called on the underlying stream only if possible.
51
- */
52
- public function __destruct()
53
- {
54
- if (isset($this->_fn_close)) {
55
- call_user_func($this->_fn_close);
56
- }
57
- }
58
-
59
- /**
60
- * An unserialize would allow the __destruct to run when the unserialized value goes out of scope.
61
- *
62
- * @throws \LogicException
63
- */
64
- public function __wakeup()
65
- {
66
- throw new \LogicException('FnStream should never be unserialized');
67
- }
68
-
69
- /**
70
- * Adds custom functionality to an underlying stream by intercepting
71
- * specific method calls.
72
- *
73
- * @param StreamInterface $stream Stream to decorate
74
- * @param array $methods Hash of method name to a closure
75
- *
76
- * @return FnStream
77
- */
78
- public static function decorate(StreamInterface $stream, array $methods)
79
- {
80
- // If any of the required methods were not provided, then simply
81
- // proxy to the decorated stream.
82
- foreach (array_diff(self::$slots, array_keys($methods)) as $diff) {
83
- $methods[$diff] = [$stream, $diff];
84
- }
85
-
86
- return new self($methods);
87
- }
88
-
89
- public function __toString()
90
- {
91
- return call_user_func($this->_fn___toString);
92
- }
93
-
94
- public function close()
95
- {
96
- return call_user_func($this->_fn_close);
97
- }
98
-
99
- public function detach()
100
- {
101
- return call_user_func($this->_fn_detach);
102
- }
103
-
104
- public function getSize()
105
- {
106
- return call_user_func($this->_fn_getSize);
107
- }
108
-
109
- public function tell()
110
- {
111
- return call_user_func($this->_fn_tell);
112
- }
113
-
114
- public function eof()
115
- {
116
- return call_user_func($this->_fn_eof);
117
- }
118
-
119
- public function isSeekable()
120
- {
121
- return call_user_func($this->_fn_isSeekable);
122
- }
123
-
124
- public function rewind()
125
- {
126
- call_user_func($this->_fn_rewind);
127
- }
128
-
129
- public function seek($offset, $whence = SEEK_SET)
130
- {
131
- call_user_func($this->_fn_seek, $offset, $whence);
132
- }
133
-
134
- public function isWritable()
135
- {
136
- return call_user_func($this->_fn_isWritable);
137
- }
138
-
139
- public function write($string)
140
- {
141
- return call_user_func($this->_fn_write, $string);
142
- }
143
-
144
- public function isReadable()
145
- {
146
- return call_user_func($this->_fn_isReadable);
147
- }
148
-
149
- public function read($length)
150
- {
151
- return call_user_func($this->_fn_read, $length);
152
- }
153
-
154
- public function getContents()
155
- {
156
- return call_user_func($this->_fn_getContents);
157
- }
158
-
159
- public function getMetadata($key = null)
160
- {
161
- return call_user_func($this->_fn_getMetadata, $key);
162
- }
163
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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,56 +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
- * @final
19
- */
20
- class InflateStream implements StreamInterface
21
- {
22
- use StreamDecoratorTrait;
23
-
24
- public function __construct(StreamInterface $stream)
25
- {
26
- // read the first 10 bytes, ie. gzip header
27
- $header = $stream->read(10);
28
- $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header);
29
- // Skip the header, that is 10 + length of filename + 1 (nil) bytes
30
- $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
31
- $resource = StreamWrapper::getResource($stream);
32
- stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
33
- $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
34
- }
35
-
36
- /**
37
- * @param StreamInterface $stream
38
- * @param $header
39
- *
40
- * @return int
41
- */
42
- private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header)
43
- {
44
- $filename_header_length = 0;
45
-
46
- if (substr(bin2hex($header), 6, 2) === '08') {
47
- // we have a filename, read until nil
48
- $filename_header_length = 1;
49
- while ($stream->read(1) !== chr(0)) {
50
- $filename_header_length++;
51
- }
52
- }
53
-
54
- return $filename_header_length;
55
- }
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/LazyOpenStream.php DELETED
@@ -1,42 +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
- * @final
12
- */
13
- class LazyOpenStream implements StreamInterface
14
- {
15
- use StreamDecoratorTrait;
16
-
17
- /** @var string File to open */
18
- private $filename;
19
-
20
- /** @var string */
21
- private $mode;
22
-
23
- /**
24
- * @param string $filename File to lazily open
25
- * @param string $mode fopen mode to use when opening the stream
26
- */
27
- public function __construct($filename, $mode)
28
- {
29
- $this->filename = $filename;
30
- $this->mode = $mode;
31
- }
32
-
33
- /**
34
- * Creates the underlying stream lazily when required.
35
- *
36
- * @return StreamInterface
37
- */
38
- protected function createStream()
39
- {
40
- return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode));
41
- }
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/LimitStream.php DELETED
@@ -1,157 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Psr7;
4
-
5
- use Psr\Http\Message\StreamInterface;
6
-
7
- /**
8
- * Decorator used to return only a subset of a stream.
9
- *
10
- * @final
11
- */
12
- class LimitStream implements StreamInterface
13
- {
14
- use StreamDecoratorTrait;
15
-
16
- /** @var int Offset to start reading from */
17
- private $offset;
18
-
19
- /** @var int Limit the number of bytes that can be read */
20
- private $limit;
21
-
22
- /**
23
- * @param StreamInterface $stream Stream to wrap
24
- * @param int $limit Total number of bytes to allow to be read
25
- * from the stream. Pass -1 for no limit.
26
- * @param int $offset Position to seek to before reading (only
27
- * works on seekable streams).
28
- */
29
- public function __construct(
30
- StreamInterface $stream,
31
- $limit = -1,
32
- $offset = 0
33
- ) {
34
- $this->stream = $stream;
35
- $this->setLimit($limit);
36
- $this->setOffset($offset);
37
- }
38
-
39
- public function eof()
40
- {
41
- // Always return true if the underlying stream is EOF
42
- if ($this->stream->eof()) {
43
- return true;
44
- }
45
-
46
- // No limit and the underlying stream is not at EOF
47
- if ($this->limit == -1) {
48
- return false;
49
- }
50
-
51
- return $this->stream->tell() >= $this->offset + $this->limit;
52
- }
53
-
54
- /**
55
- * Returns the size of the limited subset of data
56
- * {@inheritdoc}
57
- */
58
- public function getSize()
59
- {
60
- if (null === ($length = $this->stream->getSize())) {
61
- return null;
62
- } elseif ($this->limit == -1) {
63
- return $length - $this->offset;
64
- } else {
65
- return min($this->limit, $length - $this->offset);
66
- }
67
- }
68
-
69
- /**
70
- * Allow for a bounded seek on the read limited stream
71
- * {@inheritdoc}
72
- */
73
- public function seek($offset, $whence = SEEK_SET)
74
- {
75
- if ($whence !== SEEK_SET || $offset < 0) {
76
- throw new \RuntimeException(sprintf(
77
- 'Cannot seek to offset %s with whence %s',
78
- $offset,
79
- $whence
80
- ));
81
- }
82
-
83
- $offset += $this->offset;
84
-
85
- if ($this->limit !== -1) {
86
- if ($offset > $this->offset + $this->limit) {
87
- $offset = $this->offset + $this->limit;
88
- }
89
- }
90
-
91
- $this->stream->seek($offset);
92
- }
93
-
94
- /**
95
- * Give a relative tell()
96
- * {@inheritdoc}
97
- */
98
- public function tell()
99
- {
100
- return $this->stream->tell() - $this->offset;
101
- }
102
-
103
- /**
104
- * Set the offset to start limiting from
105
- *
106
- * @param int $offset Offset to seek to and begin byte limiting from
107
- *
108
- * @throws \RuntimeException if the stream cannot be seeked.
109
- */
110
- public function setOffset($offset)
111
- {
112
- $current = $this->stream->tell();
113
-
114
- if ($current !== $offset) {
115
- // If the stream cannot seek to the offset position, then read to it
116
- if ($this->stream->isSeekable()) {
117
- $this->stream->seek($offset);
118
- } elseif ($current > $offset) {
119
- throw new \RuntimeException("Could not seek to stream offset $offset");
120
- } else {
121
- $this->stream->read($offset - $current);
122
- }
123
- }
124
-
125
- $this->offset = $offset;
126
- }
127
-
128
- /**
129
- * Set the limit of bytes that the decorator allows to be read from the
130
- * stream.
131
- *
132
- * @param int $limit Number of bytes to allow to be read from the stream.
133
- * Use -1 for no limit.
134
- */
135
- public function setLimit($limit)
136
- {
137
- $this->limit = $limit;
138
- }
139
-
140
- public function read($length)
141
- {
142
- if ($this->limit == -1) {
143
- return $this->stream->read($length);
144
- }
145
-
146
- // Check if the current position is less than the total allowed
147
- // bytes + original offset
148
- $remaining = ($this->offset + $this->limit) - $this->stream->tell();
149
- if ($remaining > 0) {
150
- // Only return the amount of requested data, ensuring that the byte
151
- // limit is not exceeded
152
- return $this->stream->read(min($remaining, $length));
153
- }
154
-
155
- return '';
156
- }
157
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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,270 +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
- /**
161
- * @param mixed $value
162
- *
163
- * @return string[]
164
- */
165
- private function normalizeHeaderValue($value)
166
- {
167
- if (!is_array($value)) {
168
- return $this->trimAndValidateHeaderValues([$value]);
169
- }
170
-
171
- if (count($value) === 0) {
172
- throw new \InvalidArgumentException('Header value can not be an empty array.');
173
- }
174
-
175
- return $this->trimAndValidateHeaderValues($value);
176
- }
177
-
178
- /**
179
- * Trims whitespace from the header values.
180
- *
181
- * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field.
182
- *
183
- * header-field = field-name ":" OWS field-value OWS
184
- * OWS = *( SP / HTAB )
185
- *
186
- * @param mixed[] $values Header values
187
- *
188
- * @return string[] Trimmed header values
189
- *
190
- * @see https://tools.ietf.org/html/rfc7230#section-3.2.4
191
- */
192
- private function trimAndValidateHeaderValues(array $values)
193
- {
194
- return array_map(function ($value) {
195
- if (!is_scalar($value) && null !== $value) {
196
- throw new \InvalidArgumentException(sprintf(
197
- 'Header value must be scalar or null but %s provided.',
198
- is_object($value) ? get_class($value) : gettype($value)
199
- ));
200
- }
201
-
202
- $trimmed = trim((string) $value, " \t");
203
- $this->assertValue($trimmed);
204
-
205
- return $trimmed;
206
- }, array_values($values));
207
- }
208
-
209
- /**
210
- * @see https://tools.ietf.org/html/rfc7230#section-3.2
211
- *
212
- * @param mixed $header
213
- *
214
- * @return void
215
- */
216
- private function assertHeader($header)
217
- {
218
- if (!is_string($header)) {
219
- throw new \InvalidArgumentException(sprintf(
220
- 'Header name must be a string but %s provided.',
221
- is_object($header) ? get_class($header) : gettype($header)
222
- ));
223
- }
224
-
225
- if ($header === '') {
226
- throw new \InvalidArgumentException('Header name can not be empty.');
227
- }
228
-
229
- if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) {
230
- throw new \InvalidArgumentException(
231
- sprintf(
232
- '"%s" is not valid header name',
233
- $header
234
- )
235
- );
236
- }
237
- }
238
-
239
- /**
240
- * @param string $value
241
- *
242
- * @return void
243
- *
244
- * @see https://tools.ietf.org/html/rfc7230#section-3.2
245
- *
246
- * field-value = *( field-content / obs-fold )
247
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
248
- * field-vchar = VCHAR / obs-text
249
- * VCHAR = %x21-7E
250
- * obs-text = %x80-FF
251
- * obs-fold = CRLF 1*( SP / HTAB )
252
- */
253
- private function assertValue($value)
254
- {
255
- // The regular expression intentionally does not support the obs-fold production, because as
256
- // per RFC 7230#3.2.4:
257
- //
258
- // A sender MUST NOT generate a message that includes
259
- // line folding (i.e., that has any field-value that contains a match to
260
- // the obs-fold rule) unless the message is intended for packaging
261
- // within the message/http media type.
262
- //
263
- // Clients must not send a request with line folding and a server sending folded headers is
264
- // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting
265
- // folding is not likely to break any legitimate use case.
266
- if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) {
267
- throw new \InvalidArgumentException(sprintf('"%s" is not valid header value', $value));
268
- }
269
- }
270
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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,158 +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
- * @final
12
- */
13
- class MultipartStream implements StreamInterface
14
- {
15
- use StreamDecoratorTrait;
16
-
17
- private $boundary;
18
-
19
- /**
20
- * @param array $elements Array of associative arrays, each containing a
21
- * required "name" key mapping to the form field,
22
- * name, a required "contents" key mapping to a
23
- * StreamInterface/resource/string, an optional
24
- * "headers" associative array of custom headers,
25
- * and an optional "filename" key mapping to a
26
- * string to send as the filename in the part.
27
- * @param string $boundary You can optionally provide a specific boundary
28
- *
29
- * @throws \InvalidArgumentException
30
- */
31
- public function __construct(array $elements = [], $boundary = null)
32
- {
33
- $this->boundary = $boundary ?: sha1(uniqid('', true));
34
- $this->stream = $this->createStream($elements);
35
- }
36
-
37
- /**
38
- * Get the boundary
39
- *
40
- * @return string
41
- */
42
- public function getBoundary()
43
- {
44
- return $this->boundary;
45
- }
46
-
47
- public function isWritable()
48
- {
49
- return false;
50
- }
51
-
52
- /**
53
- * Get the headers needed before transferring the content of a POST file
54
- */
55
- private function getHeaders(array $headers)
56
- {
57
- $str = '';
58
- foreach ($headers as $key => $value) {
59
- $str .= "{$key}: {$value}\r\n";
60
- }
61
-
62
- return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n";
63
- }
64
-
65
- /**
66
- * Create the aggregate stream that will be used to upload the POST data
67
- */
68
- protected function createStream(array $elements)
69
- {
70
- $stream = new AppendStream();
71
-
72
- foreach ($elements as $element) {
73
- $this->addElement($stream, $element);
74
- }
75
-
76
- // Add the trailing boundary with CRLF
77
- $stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n"));
78
-
79
- return $stream;
80
- }
81
-
82
- private function addElement(AppendStream $stream, array $element)
83
- {
84
- foreach (['contents', 'name'] as $key) {
85
- if (!array_key_exists($key, $element)) {
86
- throw new \InvalidArgumentException("A '{$key}' key is required");
87
- }
88
- }
89
-
90
- $element['contents'] = Utils::streamFor($element['contents']);
91
-
92
- if (empty($element['filename'])) {
93
- $uri = $element['contents']->getMetadata('uri');
94
- if (substr($uri, 0, 6) !== 'php://') {
95
- $element['filename'] = $uri;
96
- }
97
- }
98
-
99
- list($body, $headers) = $this->createElement(
100
- $element['name'],
101
- $element['contents'],
102
- isset($element['filename']) ? $element['filename'] : null,
103
- isset($element['headers']) ? $element['headers'] : []
104
- );
105
-
106
- $stream->addStream(Utils::streamFor($this->getHeaders($headers)));
107
- $stream->addStream($body);
108
- $stream->addStream(Utils::streamFor("\r\n"));
109
- }
110
-
111
- /**
112
- * @return array
113
- */
114
- private function createElement($name, StreamInterface $stream, $filename, array $headers)
115
- {
116
- // Set a default content-disposition header if one was no provided
117
- $disposition = $this->getHeader($headers, 'content-disposition');
118
- if (!$disposition) {
119
- $headers['Content-Disposition'] = ($filename === '0' || $filename)
120
- ? sprintf(
121
- 'form-data; name="%s"; filename="%s"',
122
- $name,
123
- basename($filename)
124
- )
125
- : "form-data; name=\"{$name}\"";
126
- }
127
-
128
- // Set a default content-length header if one was no provided
129
- $length = $this->getHeader($headers, 'content-length');
130
- if (!$length) {
131
- if ($length = $stream->getSize()) {
132
- $headers['Content-Length'] = (string) $length;
133
- }
134
- }
135
-
136
- // Set a default Content-Type if one was not supplied
137
- $type = $this->getHeader($headers, 'content-type');
138
- if (!$type && ($filename === '0' || $filename)) {
139
- if ($type = MimeType::fromFilename($filename)) {
140
- $headers['Content-Type'] = $type;
141
- }
142
- }
143
-
144
- return [$stream, $headers];
145
- }
146
-
147
- private function getHeader(array $headers, $key)
148
- {
149
- $lowercaseHeader = strtolower($key);
150
- foreach ($headers as $k => $v) {
151
- if (strtolower($k) === $lowercaseHeader) {
152
- return $v;
153
- }
154
- }
155
-
156
- return null;
157
- }
158
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/NoSeekStream.php DELETED
@@ -1,25 +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
- * @final
11
- */
12
- class NoSeekStream implements StreamInterface
13
- {
14
- use StreamDecoratorTrait;
15
-
16
- public function seek($offset, $whence = SEEK_SET)
17
- {
18
- throw new \RuntimeException('Cannot seek a NoSeekStream');
19
- }
20
-
21
- public function isSeekable()
22
- {
23
- return false;
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/PumpStream.php DELETED
@@ -1,170 +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
- * @final
18
- */
19
- class PumpStream implements StreamInterface
20
- {
21
- /** @var callable */
22
- private $source;
23
-
24
- /** @var int */
25
- private $size;
26
-
27
- /** @var int */
28
- private $tellPos = 0;
29
-
30
- /** @var array */
31
- private $metadata;
32
-
33
- /** @var BufferStream */
34
- private $buffer;
35
-
36
- /**
37
- * @param callable $source Source of the stream data. The callable MAY
38
- * accept an integer argument used to control the
39
- * amount of data to return. The callable MUST
40
- * return a string when called, or false on error
41
- * or EOF.
42
- * @param array $options Stream options:
43
- * - metadata: Hash of metadata to use with stream.
44
- * - size: Size of the stream, if known.
45
- */
46
- public function __construct(callable $source, array $options = [])
47
- {
48
- $this->source = $source;
49
- $this->size = isset($options['size']) ? $options['size'] : null;
50
- $this->metadata = isset($options['metadata']) ? $options['metadata'] : [];
51
- $this->buffer = new BufferStream();
52
- }
53
-
54
- public function __toString()
55
- {
56
- try {
57
- return Utils::copyToString($this);
58
- } catch (\Exception $e) {
59
- return '';
60
- }
61
- }
62
-
63
- public function close()
64
- {
65
- $this->detach();
66
- }
67
-
68
- public function detach()
69
- {
70
- $this->tellPos = false;
71
- $this->source = null;
72
-
73
- return null;
74
- }
75
-
76
- public function getSize()
77
- {
78
- return $this->size;
79
- }
80
-
81
- public function tell()
82
- {
83
- return $this->tellPos;
84
- }
85
-
86
- public function eof()
87
- {
88
- return !$this->source;
89
- }
90
-
91
- public function isSeekable()
92
- {
93
- return false;
94
- }
95
-
96
- public function rewind()
97
- {
98
- $this->seek(0);
99
- }
100
-
101
- public function seek($offset, $whence = SEEK_SET)
102
- {
103
- throw new \RuntimeException('Cannot seek a PumpStream');
104
- }
105
-
106
- public function isWritable()
107
- {
108
- return false;
109
- }
110
-
111
- public function write($string)
112
- {
113
- throw new \RuntimeException('Cannot write to a PumpStream');
114
- }
115
-
116
- public function isReadable()
117
- {
118
- return true;
119
- }
120
-
121
- public function read($length)
122
- {
123
- $data = $this->buffer->read($length);
124
- $readLen = strlen($data);
125
- $this->tellPos += $readLen;
126
- $remaining = $length - $readLen;
127
-
128
- if ($remaining) {
129
- $this->pump($remaining);
130
- $data .= $this->buffer->read($remaining);
131
- $this->tellPos += strlen($data) - $readLen;
132
- }
133
-
134
- return $data;
135
- }
136
-
137
- public function getContents()
138
- {
139
- $result = '';
140
- while (!$this->eof()) {
141
- $result .= $this->read(1000000);
142
- }
143
-
144
- return $result;
145
- }
146
-
147
- public function getMetadata($key = null)
148
- {
149
- if (!$key) {
150
- return $this->metadata;
151
- }
152
-
153
- return isset($this->metadata[$key]) ? $this->metadata[$key] : null;
154
- }
155
-
156
- private function pump($length)
157
- {
158
- if ($this->source) {
159
- do {
160
- $data = call_user_func($this->source, $length);
161
- if ($data === false || $data === null) {
162
- $this->source = null;
163
- return;
164
- }
165
- $this->buffer->write($data);
166
- $length -= strlen($data);
167
- } while ($length > 0);
168
- }
169
- }
170
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/Query.php DELETED
@@ -1,113 +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) {
38
- return $str;
39
- };
40
- }
41
-
42
- foreach (explode('&', $str) as $kvp) {
43
- $parts = explode('=', $kvp, 2);
44
- $key = $decoder($parts[0]);
45
- $value = isset($parts[1]) ? $decoder($parts[1]) : null;
46
- if (!isset($result[$key])) {
47
- $result[$key] = $value;
48
- } else {
49
- if (!is_array($result[$key])) {
50
- $result[$key] = [$result[$key]];
51
- }
52
- $result[$key][] = $value;
53
- }
54
- }
55
-
56
- return $result;
57
- }
58
-
59
- /**
60
- * Build a query string from an array of key value pairs.
61
- *
62
- * This function can use the return value of `parse()` to build a query
63
- * string. This function does not modify the provided keys when an array is
64
- * encountered (like `http_build_query()` would).
65
- *
66
- * @param array $params Query string parameters.
67
- * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
68
- * to encode using RFC3986, or PHP_QUERY_RFC1738
69
- * to encode using RFC1738.
70
- *
71
- * @return string
72
- */
73
- public static function build(array $params, $encoding = PHP_QUERY_RFC3986)
74
- {
75
- if (!$params) {
76
- return '';
77
- }
78
-
79
- if ($encoding === false) {
80
- $encoder = function ($str) {
81
- return $str;
82
- };
83
- } elseif ($encoding === PHP_QUERY_RFC3986) {
84
- $encoder = 'rawurlencode';
85
- } elseif ($encoding === PHP_QUERY_RFC1738) {
86
- $encoder = 'urlencode';
87
- } else {
88
- throw new \InvalidArgumentException('Invalid type');
89
- }
90
-
91
- $qs = '';
92
- foreach ($params as $k => $v) {
93
- $k = $encoder($k);
94
- if (!is_array($v)) {
95
- $qs .= $k;
96
- if ($v !== null) {
97
- $qs .= '=' . $encoder($v);
98
- }
99
- $qs .= '&';
100
- } else {
101
- foreach ($v as $vv) {
102
- $qs .= $k;
103
- if ($vv !== null) {
104
- $qs .= '=' . $encoder($vv);
105
- }
106
- $qs .= '&';
107
- }
108
- }
109
- }
110
-
111
- return $qs ? (string) substr($qs, 0, -1) : '';
112
- }
113
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 string|null */
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|resource|StreamInterface|null $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|resource|StreamInterface|null $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,19 +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
- *
15
- * @license https://github.com/amphp/http/blob/v1.0.1/LICENSE
16
- */
17
- const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m";
18
- const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)";
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/ServerRequest.php DELETED
@@ -1,379 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Psr7;
4
-
5
- use InvalidArgumentException;
6
- use Psr\Http\Message\ServerRequestInterface;
7
- use Psr\Http\Message\StreamInterface;
8
- use Psr\Http\Message\UploadedFileInterface;
9
- use Psr\Http\Message\UriInterface;
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 array|object|null
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|resource|StreamInterface|null $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
- *
115
- * @return array|UploadedFileInterface
116
- */
117
- private static function createUploadedFileFromSpec(array $value)
118
- {
119
- if (is_array($value['tmp_name'])) {
120
- return self::normalizeNestedFileSpec($value);
121
- }
122
-
123
- return new UploadedFile(
124
- $value['tmp_name'],
125
- (int) $value['size'],
126
- (int) $value['error'],
127
- $value['name'],
128
- $value['type']
129
- );
130
- }
131
-
132
- /**
133
- * Normalize an array of file specifications.
134
- *
135
- * Loops through all nested files and returns a normalized array of
136
- * UploadedFileInterface instances.
137
- *
138
- * @param array $files
139
- *
140
- * @return UploadedFileInterface[]
141
- */
142
- private static function normalizeNestedFileSpec(array $files = [])
143
- {
144
- $normalizedFiles = [];
145
-
146
- foreach (array_keys($files['tmp_name']) as $key) {
147
- $spec = [
148
- 'tmp_name' => $files['tmp_name'][$key],
149
- 'size' => $files['size'][$key],
150
- 'error' => $files['error'][$key],
151
- 'name' => $files['name'][$key],
152
- 'type' => $files['type'][$key],
153
- ];
154
- $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec);
155
- }
156
-
157
- return $normalizedFiles;
158
- }
159
-
160
- /**
161
- * Return a ServerRequest populated with superglobals:
162
- * $_GET
163
- * $_POST
164
- * $_COOKIE
165
- * $_FILES
166
- * $_SERVER
167
- *
168
- * @return ServerRequestInterface
169
- */
170
- public static function fromGlobals()
171
- {
172
- $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
173
- $headers = getallheaders();
174
- $uri = self::getUriFromGlobals();
175
- $body = new CachingStream(new LazyOpenStream('php://input', 'r+'));
176
- $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';
177
-
178
- $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER);
179
-
180
- return $serverRequest
181
- ->withCookieParams($_COOKIE)
182
- ->withQueryParams($_GET)
183
- ->withParsedBody($_POST)
184
- ->withUploadedFiles(self::normalizeFiles($_FILES));
185
- }
186
-
187
- private static function extractHostAndPortFromAuthority($authority)
188
- {
189
- $uri = 'http://' . $authority;
190
- $parts = parse_url($uri);
191
- if (false === $parts) {
192
- return [null, null];
193
- }
194
-
195
- $host = isset($parts['host']) ? $parts['host'] : null;
196
- $port = isset($parts['port']) ? $parts['port'] : null;
197
-
198
- return [$host, $port];
199
- }
200
-
201
- /**
202
- * Get a Uri populated with values from $_SERVER.
203
- *
204
- * @return UriInterface
205
- */
206
- public static function getUriFromGlobals()
207
- {
208
- $uri = new Uri('');
209
-
210
- $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
211
-
212
- $hasPort = false;
213
- if (isset($_SERVER['HTTP_HOST'])) {
214
- list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
215
- if ($host !== null) {
216
- $uri = $uri->withHost($host);
217
- }
218
-
219
- if ($port !== null) {
220
- $hasPort = true;
221
- $uri = $uri->withPort($port);
222
- }
223
- } elseif (isset($_SERVER['SERVER_NAME'])) {
224
- $uri = $uri->withHost($_SERVER['SERVER_NAME']);
225
- } elseif (isset($_SERVER['SERVER_ADDR'])) {
226
- $uri = $uri->withHost($_SERVER['SERVER_ADDR']);
227
- }
228
-
229
- if (!$hasPort && isset($_SERVER['SERVER_PORT'])) {
230
- $uri = $uri->withPort($_SERVER['SERVER_PORT']);
231
- }
232
-
233
- $hasQuery = false;
234
- if (isset($_SERVER['REQUEST_URI'])) {
235
- $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2);
236
- $uri = $uri->withPath($requestUriParts[0]);
237
- if (isset($requestUriParts[1])) {
238
- $hasQuery = true;
239
- $uri = $uri->withQuery($requestUriParts[1]);
240
- }
241
- }
242
-
243
- if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) {
244
- $uri = $uri->withQuery($_SERVER['QUERY_STRING']);
245
- }
246
-
247
- return $uri;
248
- }
249
-
250
- /**
251
- * {@inheritdoc}
252
- */
253
- public function getServerParams()
254
- {
255
- return $this->serverParams;
256
- }
257
-
258
- /**
259
- * {@inheritdoc}
260
- */
261
- public function getUploadedFiles()
262
- {
263
- return $this->uploadedFiles;
264
- }
265
-
266
- /**
267
- * {@inheritdoc}
268
- */
269
- public function withUploadedFiles(array $uploadedFiles)
270
- {
271
- $new = clone $this;
272
- $new->uploadedFiles = $uploadedFiles;
273
-
274
- return $new;
275
- }
276
-
277
- /**
278
- * {@inheritdoc}
279
- */
280
- public function getCookieParams()
281
- {
282
- return $this->cookieParams;
283
- }
284
-
285
- /**
286
- * {@inheritdoc}
287
- */
288
- public function withCookieParams(array $cookies)
289
- {
290
- $new = clone $this;
291
- $new->cookieParams = $cookies;
292
-
293
- return $new;
294
- }
295
-
296
- /**
297
- * {@inheritdoc}
298
- */
299
- public function getQueryParams()
300
- {
301
- return $this->queryParams;
302
- }
303
-
304
- /**
305
- * {@inheritdoc}
306
- */
307
- public function withQueryParams(array $query)
308
- {
309
- $new = clone $this;
310
- $new->queryParams = $query;
311
-
312
- return $new;
313
- }
314
-
315
- /**
316
- * {@inheritdoc}
317
- */
318
- public function getParsedBody()
319
- {
320
- return $this->parsedBody;
321
- }
322
-
323
- /**
324
- * {@inheritdoc}
325
- */
326
- public function withParsedBody($data)
327
- {
328
- $new = clone $this;
329
- $new->parsedBody = $data;
330
-
331
- return $new;
332
- }
333
-
334
- /**
335
- * {@inheritdoc}
336
- */
337
- public function getAttributes()
338
- {
339
- return $this->attributes;
340
- }
341
-
342
- /**
343
- * {@inheritdoc}
344
- */
345
- public function getAttribute($attribute, $default = null)
346
- {
347
- if (false === array_key_exists($attribute, $this->attributes)) {
348
- return $default;
349
- }
350
-
351
- return $this->attributes[$attribute];
352
- }
353
-
354
- /**
355
- * {@inheritdoc}
356
- */
357
- public function withAttribute($attribute, $value)
358
- {
359
- $new = clone $this;
360
- $new->attributes[$attribute] = $value;
361
-
362
- return $new;
363
- }
364
-
365
- /**
366
- * {@inheritdoc}
367
- */
368
- public function withoutAttribute($attribute)
369
- {
370
- if (false === array_key_exists($attribute, $this->attributes)) {
371
- return $this;
372
- }
373
-
374
- $new = clone $this;
375
- unset($new->attributes[$attribute]);
376
-
377
- return $new;
378
- }
379
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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,152 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Psr7;
4
-
5
- use Psr\Http\Message\StreamInterface;
6
-
7
- /**
8
- * Stream decorator trait
9
- *
10
- * @property StreamInterface stream
11
- */
12
- trait StreamDecoratorTrait
13
- {
14
- /**
15
- * @param StreamInterface $stream Stream to decorate
16
- */
17
- public function __construct(StreamInterface $stream)
18
- {
19
- $this->stream = $stream;
20
- }
21
-
22
- /**
23
- * Magic method used to create a new stream if streams are not added in
24
- * the constructor of a decorator (e.g., LazyOpenStream).
25
- *
26
- * @param string $name Name of the property (allows "stream" only).
27
- *
28
- * @return StreamInterface
29
- */
30
- public function __get($name)
31
- {
32
- if ($name == 'stream') {
33
- $this->stream = $this->createStream();
34
- return $this->stream;
35
- }
36
-
37
- throw new \UnexpectedValueException("$name not found on class");
38
- }
39
-
40
- public function __toString()
41
- {
42
- try {
43
- if ($this->isSeekable()) {
44
- $this->seek(0);
45
- }
46
- return $this->getContents();
47
- } catch (\Exception $e) {
48
- // Really, PHP? https://bugs.php.net/bug.php?id=53648
49
- trigger_error('StreamDecorator::__toString exception: '
50
- . (string) $e, E_USER_ERROR);
51
- return '';
52
- }
53
- }
54
-
55
- public function getContents()
56
- {
57
- return Utils::copyToString($this);
58
- }
59
-
60
- /**
61
- * Allow decorators to implement custom methods
62
- *
63
- * @param string $method Missing method name
64
- * @param array $args Method arguments
65
- *
66
- * @return mixed
67
- */
68
- public function __call($method, array $args)
69
- {
70
- $result = call_user_func_array([$this->stream, $method], $args);
71
-
72
- // Always return the wrapped object if the result is a return $this
73
- return $result === $this->stream ? $this : $result;
74
- }
75
-
76
- public function close()
77
- {
78
- $this->stream->close();
79
- }
80
-
81
- public function getMetadata($key = null)
82
- {
83
- return $this->stream->getMetadata($key);
84
- }
85
-
86
- public function detach()
87
- {
88
- return $this->stream->detach();
89
- }
90
-
91
- public function getSize()
92
- {
93
- return $this->stream->getSize();
94
- }
95
-
96
- public function eof()
97
- {
98
- return $this->stream->eof();
99
- }
100
-
101
- public function tell()
102
- {
103
- return $this->stream->tell();
104
- }
105
-
106
- public function isReadable()
107
- {
108
- return $this->stream->isReadable();
109
- }
110
-
111
- public function isWritable()
112
- {
113
- return $this->stream->isWritable();
114
- }
115
-
116
- public function isSeekable()
117
- {
118
- return $this->stream->isSeekable();
119
- }
120
-
121
- public function rewind()
122
- {
123
- $this->seek(0);
124
- }
125
-
126
- public function seek($offset, $whence = SEEK_SET)
127
- {
128
- $this->stream->seek($offset, $whence);
129
- }
130
-
131
- public function read($length)
132
- {
133
- return $this->stream->read($length);
134
- }
135
-
136
- public function write($string)
137
- {
138
- return $this->stream->write($string);
139
- }
140
-
141
- /**
142
- * Implement in subclasses to dynamically create streams when requested.
143
- *
144
- * @return StreamInterface
145
- *
146
- * @throws \BadMethodCallException
147
- */
148
- protected function createStream()
149
- {
150
- throw new \BadMethodCallException('Not implemented');
151
- }
152
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/StreamWrapper.php DELETED
@@ -1,165 +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
- * @final
11
- */
12
- class StreamWrapper
13
- {
14
- /** @var resource */
15
- public $context;
16
-
17
- /** @var StreamInterface */
18
- private $stream;
19
-
20
- /** @var string r, r+, or w */
21
- private $mode;
22
-
23
- /**
24
- * Returns a resource representing the stream.
25
- *
26
- * @param StreamInterface $stream The stream to get a resource for
27
- *
28
- * @return resource
29
- *
30
- * @throws \InvalidArgumentException if stream is not readable or writable
31
- */
32
- public static function getResource(StreamInterface $stream)
33
- {
34
- self::register();
35
-
36
- if ($stream->isReadable()) {
37
- $mode = $stream->isWritable() ? 'r+' : 'r';
38
- } elseif ($stream->isWritable()) {
39
- $mode = 'w';
40
- } else {
41
- throw new \InvalidArgumentException('The stream must be readable, '
42
- . 'writable, or both.');
43
- }
44
-
45
- return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
46
- }
47
-
48
- /**
49
- * Creates a stream context that can be used to open a stream as a php stream resource.
50
- *
51
- * @param StreamInterface $stream
52
- *
53
- * @return resource
54
- */
55
- public static function createStreamContext(StreamInterface $stream)
56
- {
57
- return stream_context_create([
58
- 'guzzle' => ['stream' => $stream]
59
- ]);
60
- }
61
-
62
- /**
63
- * Registers the stream wrapper if needed
64
- */
65
- public static function register()
66
- {
67
- if (!in_array('guzzle', stream_get_wrappers())) {
68
- stream_wrapper_register('guzzle', __CLASS__);
69
- }
70
- }
71
-
72
- public function stream_open($path, $mode, $options, &$opened_path)
73
- {
74
- $options = stream_context_get_options($this->context);
75
-
76
- if (!isset($options['guzzle']['stream'])) {
77
- return false;
78
- }
79
-
80
- $this->mode = $mode;
81
- $this->stream = $options['guzzle']['stream'];
82
-
83
- return true;
84
- }
85
-
86
- public function stream_read($count)
87
- {
88
- return $this->stream->read($count);
89
- }
90
-
91
- public function stream_write($data)
92
- {
93
- return (int) $this->stream->write($data);
94
- }
95
-
96
- public function stream_tell()
97
- {
98
- return $this->stream->tell();
99
- }
100
-
101
- public function stream_eof()
102
- {
103
- return $this->stream->eof();
104
- }
105
-
106
- public function stream_seek($offset, $whence)
107
- {
108
- $this->stream->seek($offset, $whence);
109
-
110
- return true;
111
- }
112
-
113
- public function stream_cast($cast_as)
114
- {
115
- $stream = clone($this->stream);
116
-
117
- return $stream->detach();
118
- }
119
-
120
- public function stream_stat()
121
- {
122
- static $modeMap = [
123
- 'r' => 33060,
124
- 'rb' => 33060,
125
- 'r+' => 33206,
126
- 'w' => 33188,
127
- 'wb' => 33188
128
- ];
129
-
130
- return [
131
- 'dev' => 0,
132
- 'ino' => 0,
133
- 'mode' => $modeMap[$this->mode],
134
- 'nlink' => 0,
135
- 'uid' => 0,
136
- 'gid' => 0,
137
- 'rdev' => 0,
138
- 'size' => $this->stream->getSize() ?: 0,
139
- 'atime' => 0,
140
- 'mtime' => 0,
141
- 'ctime' => 0,
142
- 'blksize' => 0,
143
- 'blocks' => 0
144
- ];
145
- }
146
-
147
- public function url_stat($path, $flags)
148
- {
149
- return [
150
- 'dev' => 0,
151
- 'ino' => 0,
152
- 'mode' => 0,
153
- 'nlink' => 0,
154
- 'uid' => 0,
155
- 'gid' => 0,
156
- 'rdev' => 0,
157
- 'size' => 0,
158
- 'atime' => 0,
159
- 'mtime' => 0,
160
- 'ctime' => 0,
161
- 'blksize' => 0,
162
- 'blocks' => 0
163
- ];
164
- }
165
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/UploadedFile.php DELETED
@@ -1,328 +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 string|null
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
- *
148
- * @return bool
149
- */
150
- private function isStringOrNull($param)
151
- {
152
- return in_array(gettype($param), ['string', 'NULL']);
153
- }
154
-
155
- /**
156
- * @param mixed $param
157
- *
158
- * @return bool
159
- */
160
- private function isStringNotEmpty($param)
161
- {
162
- return is_string($param) && false === empty($param);
163
- }
164
-
165
- /**
166
- * @param string|null $clientFilename
167
- *
168
- * @throws InvalidArgumentException
169
- */
170
- private function setClientFilename($clientFilename)
171
- {
172
- if (false === $this->isStringOrNull($clientFilename)) {
173
- throw new InvalidArgumentException(
174
- 'Upload file client filename must be a string or null'
175
- );
176
- }
177
-
178
- $this->clientFilename = $clientFilename;
179
- }
180
-
181
- /**
182
- * @param string|null $clientMediaType
183
- *
184
- * @throws InvalidArgumentException
185
- */
186
- private function setClientMediaType($clientMediaType)
187
- {
188
- if (false === $this->isStringOrNull($clientMediaType)) {
189
- throw new InvalidArgumentException(
190
- 'Upload file client media type must be a string or null'
191
- );
192
- }
193
-
194
- $this->clientMediaType = $clientMediaType;
195
- }
196
-
197
- /**
198
- * Return true if there is no upload error
199
- *
200
- * @return bool
201
- */
202
- private function isOk()
203
- {
204
- return $this->error === UPLOAD_ERR_OK;
205
- }
206
-
207
- /**
208
- * @return bool
209
- */
210
- public function isMoved()
211
- {
212
- return $this->moved;
213
- }
214
-
215
- /**
216
- * @throws RuntimeException if is moved or not ok
217
- */
218
- private function validateActive()
219
- {
220
- if (false === $this->isOk()) {
221
- throw new RuntimeException('Cannot retrieve stream due to upload error');
222
- }
223
-
224
- if ($this->isMoved()) {
225
- throw new RuntimeException('Cannot retrieve stream after it has already been moved');
226
- }
227
- }
228
-
229
- /**
230
- * {@inheritdoc}
231
- *
232
- * @throws RuntimeException if the upload was not successful.
233
- */
234
- public function getStream()
235
- {
236
- $this->validateActive();
237
-
238
- if ($this->stream instanceof StreamInterface) {
239
- return $this->stream;
240
- }
241
-
242
- return new LazyOpenStream($this->file, 'r+');
243
- }
244
-
245
- /**
246
- * {@inheritdoc}
247
- *
248
- * @see http://php.net/is_uploaded_file
249
- * @see http://php.net/move_uploaded_file
250
- *
251
- * @param string $targetPath Path to which to move the uploaded file.
252
- *
253
- * @throws RuntimeException if the upload was not successful.
254
- * @throws InvalidArgumentException if the $path specified is invalid.
255
- * @throws RuntimeException on any error during the move operation, or on
256
- * the second or subsequent call to the method.
257
- */
258
- public function moveTo($targetPath)
259
- {
260
- $this->validateActive();
261
-
262
- if (false === $this->isStringNotEmpty($targetPath)) {
263
- throw new InvalidArgumentException(
264
- 'Invalid path provided for move operation; must be a non-empty string'
265
- );
266
- }
267
-
268
- if ($this->file) {
269
- $this->moved = php_sapi_name() == 'cli'
270
- ? rename($this->file, $targetPath)
271
- : move_uploaded_file($this->file, $targetPath);
272
- } else {
273
- Utils::copyToStream(
274
- $this->getStream(),
275
- new LazyOpenStream($targetPath, 'w')
276
- );
277
-
278
- $this->moved = true;
279
- }
280
-
281
- if (false === $this->moved) {
282
- throw new RuntimeException(
283
- sprintf('Uploaded file could not be moved to %s', $targetPath)
284
- );
285
- }
286
- }
287
-
288
- /**
289
- * {@inheritdoc}
290
- *
291
- * @return int|null The file size in bytes or null if unknown.
292
- */
293
- public function getSize()
294
- {
295
- return $this->size;
296
- }
297
-
298
- /**
299
- * {@inheritdoc}
300
- *
301
- * @see http://php.net/manual/en/features.file-upload.errors.php
302
- *
303
- * @return int One of PHP's UPLOAD_ERR_XXX constants.
304
- */
305
- public function getError()
306
- {
307
- return $this->error;
308
- }
309
-
310
- /**
311
- * {@inheritdoc}
312
- *
313
- * @return string|null The filename sent by the client or null if none
314
- * was provided.
315
- */
316
- public function getClientFilename()
317
- {
318
- return $this->clientFilename;
319
- }
320
-
321
- /**
322
- * {@inheritdoc}
323
- */
324
- public function getClientMediaType()
325
- {
326
- return $this->clientMediaType;
327
- }
328
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/Uri.php DELETED
@@ -1,810 +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 = self::parse($uri);
71
- if ($parts === false) {
72
- throw new \InvalidArgumentException("Unable to parse URI: $uri");
73
- }
74
- $this->applyParts($parts);
75
- }
76
- }
77
-
78
- /**
79
- * UTF-8 aware \parse_url() replacement.
80
- *
81
- * The internal function produces broken output for non ASCII domain names
82
- * (IDN) when used with locales other than "C".
83
- *
84
- * On the other hand, cURL understands IDN correctly only when UTF-8 locale
85
- * is configured ("C.UTF-8", "en_US.UTF-8", etc.).
86
- *
87
- * @see https://bugs.php.net/bug.php?id=52923
88
- * @see https://www.php.net/manual/en/function.parse-url.php#114817
89
- * @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING
90
- *
91
- * @param string $url
92
- *
93
- * @return array|false
94
- */
95
- private static function parse($url)
96
- {
97
- // If IPv6
98
- $prefix = '';
99
- if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) {
100
- $prefix = $matches[1];
101
- $url = $matches[2];
102
- }
103
-
104
- $encodedUrl = preg_replace_callback(
105
- '%[^:/@?&=#]+%usD',
106
- static function ($matches) {
107
- return urlencode($matches[0]);
108
- },
109
- $url
110
- );
111
-
112
- $result = parse_url($prefix . $encodedUrl);
113
-
114
- if ($result === false) {
115
- return false;
116
- }
117
-
118
- return array_map('urldecode', $result);
119
- }
120
-
121
- public function __toString()
122
- {
123
- return self::composeComponents(
124
- $this->scheme,
125
- $this->getAuthority(),
126
- $this->path,
127
- $this->query,
128
- $this->fragment
129
- );
130
- }
131
-
132
- /**
133
- * Composes a URI reference string from its various components.
134
- *
135
- * Usually this method does not need to be called manually but instead is used indirectly via
136
- * `Psr\Http\Message\UriInterface::__toString`.
137
- *
138
- * PSR-7 UriInterface treats an empty component the same as a missing component as
139
- * getQuery(), getFragment() etc. always return a string. This explains the slight
140
- * difference to RFC 3986 Section 5.3.
141
- *
142
- * Another adjustment is that the authority separator is added even when the authority is missing/empty
143
- * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with
144
- * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But
145
- * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to
146
- * that format).
147
- *
148
- * @param string $scheme
149
- * @param string $authority
150
- * @param string $path
151
- * @param string $query
152
- * @param string $fragment
153
- *
154
- * @return string
155
- *
156
- * @link https://tools.ietf.org/html/rfc3986#section-5.3
157
- */
158
- public static function composeComponents($scheme, $authority, $path, $query, $fragment)
159
- {
160
- $uri = '';
161
-
162
- // weak type checks to also accept null until we can add scalar type hints
163
- if ($scheme != '') {
164
- $uri .= $scheme . ':';
165
- }
166
-
167
- if ($authority != ''|| $scheme === 'file') {
168
- $uri .= '//' . $authority;
169
- }
170
-
171
- $uri .= $path;
172
-
173
- if ($query != '') {
174
- $uri .= '?' . $query;
175
- }
176
-
177
- if ($fragment != '') {
178
- $uri .= '#' . $fragment;
179
- }
180
-
181
- return $uri;
182
- }
183
-
184
- /**
185
- * Whether the URI has the default port of the current scheme.
186
- *
187
- * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used
188
- * independently of the implementation.
189
- *
190
- * @param UriInterface $uri
191
- *
192
- * @return bool
193
- */
194
- public static function isDefaultPort(UriInterface $uri)
195
- {
196
- return $uri->getPort() === null
197
- || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]);
198
- }
199
-
200
- /**
201
- * Whether the URI is absolute, i.e. it has a scheme.
202
- *
203
- * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true
204
- * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative
205
- * to another URI, the base URI. Relative references can be divided into several forms:
206
- * - network-path references, e.g. '//example.com/path'
207
- * - absolute-path references, e.g. '/path'
208
- * - relative-path references, e.g. 'subpath'
209
- *
210
- * @param UriInterface $uri
211
- *
212
- * @return bool
213
- *
214
- * @see Uri::isNetworkPathReference
215
- * @see Uri::isAbsolutePathReference
216
- * @see Uri::isRelativePathReference
217
- * @link https://tools.ietf.org/html/rfc3986#section-4
218
- */
219
- public static function isAbsolute(UriInterface $uri)
220
- {
221
- return $uri->getScheme() !== '';
222
- }
223
-
224
- /**
225
- * Whether the URI is a network-path reference.
226
- *
227
- * A relative reference that begins with two slash characters is termed an network-path reference.
228
- *
229
- * @param UriInterface $uri
230
- *
231
- * @return bool
232
- *
233
- * @link https://tools.ietf.org/html/rfc3986#section-4.2
234
- */
235
- public static function isNetworkPathReference(UriInterface $uri)
236
- {
237
- return $uri->getScheme() === '' && $uri->getAuthority() !== '';
238
- }
239
-
240
- /**
241
- * Whether the URI is a absolute-path reference.
242
- *
243
- * A relative reference that begins with a single slash character is termed an absolute-path reference.
244
- *
245
- * @param UriInterface $uri
246
- *
247
- * @return bool
248
- *
249
- * @link https://tools.ietf.org/html/rfc3986#section-4.2
250
- */
251
- public static function isAbsolutePathReference(UriInterface $uri)
252
- {
253
- return $uri->getScheme() === ''
254
- && $uri->getAuthority() === ''
255
- && isset($uri->getPath()[0])
256
- && $uri->getPath()[0] === '/';
257
- }
258
-
259
- /**
260
- * Whether the URI is a relative-path reference.
261
- *
262
- * A relative reference that does not begin with a slash character is termed a relative-path reference.
263
- *
264
- * @param UriInterface $uri
265
- *
266
- * @return bool
267
- *
268
- * @link https://tools.ietf.org/html/rfc3986#section-4.2
269
- */
270
- public static function isRelativePathReference(UriInterface $uri)
271
- {
272
- return $uri->getScheme() === ''
273
- && $uri->getAuthority() === ''
274
- && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/');
275
- }
276
-
277
- /**
278
- * Whether the URI is a same-document reference.
279
- *
280
- * A same-document reference refers to a URI that is, aside from its fragment
281
- * component, identical to the base URI. When no base URI is given, only an empty
282
- * URI reference (apart from its fragment) is considered a same-document reference.
283
- *
284
- * @param UriInterface $uri The URI to check
285
- * @param UriInterface|null $base An optional base URI to compare against
286
- *
287
- * @return bool
288
- *
289
- * @link https://tools.ietf.org/html/rfc3986#section-4.4
290
- */
291
- public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null)
292
- {
293
- if ($base !== null) {
294
- $uri = UriResolver::resolve($base, $uri);
295
-
296
- return ($uri->getScheme() === $base->getScheme())
297
- && ($uri->getAuthority() === $base->getAuthority())
298
- && ($uri->getPath() === $base->getPath())
299
- && ($uri->getQuery() === $base->getQuery());
300
- }
301
-
302
- return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === '';
303
- }
304
-
305
- /**
306
- * Removes dot segments from a path and returns the new path.
307
- *
308
- * @param string $path
309
- *
310
- * @return string
311
- *
312
- * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead.
313
- * @see UriResolver::removeDotSegments
314
- */
315
- public static function removeDotSegments($path)
316
- {
317
- return UriResolver::removeDotSegments($path);
318
- }
319
-
320
- /**
321
- * Converts the relative URI into a new URI that is resolved against the base URI.
322
- *
323
- * @param UriInterface $base Base URI
324
- * @param string|UriInterface $rel Relative URI
325
- *
326
- * @return UriInterface
327
- *
328
- * @deprecated since version 1.4. Use UriResolver::resolve instead.
329
- * @see UriResolver::resolve
330
- */
331
- public static function resolve(UriInterface $base, $rel)
332
- {
333
- if (!($rel instanceof UriInterface)) {
334
- $rel = new self($rel);
335
- }
336
-
337
- return UriResolver::resolve($base, $rel);
338
- }
339
-
340
- /**
341
- * Creates a new URI with a specific query string value removed.
342
- *
343
- * Any existing query string values that exactly match the provided key are
344
- * removed.
345
- *
346
- * @param UriInterface $uri URI to use as a base.
347
- * @param string $key Query string key to remove.
348
- *
349
- * @return UriInterface
350
- */
351
- public static function withoutQueryValue(UriInterface $uri, $key)
352
- {
353
- $result = self::getFilteredQueryString($uri, [$key]);
354
-
355
- return $uri->withQuery(implode('&', $result));
356
- }
357
-
358
- /**
359
- * Creates a new URI with a specific query string value.
360
- *
361
- * Any existing query string values that exactly match the provided key are
362
- * removed and replaced with the given key value pair.
363
- *
364
- * A value of null will set the query string key without a value, e.g. "key"
365
- * instead of "key=value".
366
- *
367
- * @param UriInterface $uri URI to use as a base.
368
- * @param string $key Key to set.
369
- * @param string|null $value Value to set
370
- *
371
- * @return UriInterface
372
- */
373
- public static function withQueryValue(UriInterface $uri, $key, $value)
374
- {
375
- $result = self::getFilteredQueryString($uri, [$key]);
376
-
377
- $result[] = self::generateQueryString($key, $value);
378
-
379
- return $uri->withQuery(implode('&', $result));
380
- }
381
-
382
- /**
383
- * Creates a new URI with multiple specific query string values.
384
- *
385
- * It has the same behavior as withQueryValue() but for an associative array of key => value.
386
- *
387
- * @param UriInterface $uri URI to use as a base.
388
- * @param array $keyValueArray Associative array of key and values
389
- *
390
- * @return UriInterface
391
- */
392
- public static function withQueryValues(UriInterface $uri, array $keyValueArray)
393
- {
394
- $result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
395
-
396
- foreach ($keyValueArray as $key => $value) {
397
- $result[] = self::generateQueryString($key, $value);
398
- }
399
-
400
- return $uri->withQuery(implode('&', $result));
401
- }
402
-
403
- /**
404
- * Creates a URI from a hash of `parse_url` components.
405
- *
406
- * @param array $parts
407
- *
408
- * @return UriInterface
409
- *
410
- * @link http://php.net/manual/en/function.parse-url.php
411
- *
412
- * @throws \InvalidArgumentException If the components do not form a valid URI.
413
- */
414
- public static function fromParts(array $parts)
415
- {
416
- $uri = new self();
417
- $uri->applyParts($parts);
418
- $uri->validateState();
419
-
420
- return $uri;
421
- }
422
-
423
- public function getScheme()
424
- {
425
- return $this->scheme;
426
- }
427
-
428
- public function getAuthority()
429
- {
430
- $authority = $this->host;
431
- if ($this->userInfo !== '') {
432
- $authority = $this->userInfo . '@' . $authority;
433
- }
434
-
435
- if ($this->port !== null) {
436
- $authority .= ':' . $this->port;
437
- }
438
-
439
- return $authority;
440
- }
441
-
442
- public function getUserInfo()
443
- {
444
- return $this->userInfo;
445
- }
446
-
447
- public function getHost()
448
- {
449
- return $this->host;
450
- }
451
-
452
- public function getPort()
453
- {
454
- return $this->port;
455
- }
456
-
457
- public function getPath()
458
- {
459
- return $this->path;
460
- }
461
-
462
- public function getQuery()
463
- {
464
- return $this->query;
465
- }
466
-
467
- public function getFragment()
468
- {
469
- return $this->fragment;
470
- }
471
-
472
- public function withScheme($scheme)
473
- {
474
- $scheme = $this->filterScheme($scheme);
475
-
476
- if ($this->scheme === $scheme) {
477
- return $this;
478
- }
479
-
480
- $new = clone $this;
481
- $new->scheme = $scheme;
482
- $new->removeDefaultPort();
483
- $new->validateState();
484
-
485
- return $new;
486
- }
487
-
488
- public function withUserInfo($user, $password = null)
489
- {
490
- $info = $this->filterUserInfoComponent($user);
491
- if ($password !== null) {
492
- $info .= ':' . $this->filterUserInfoComponent($password);
493
- }
494
-
495
- if ($this->userInfo === $info) {
496
- return $this;
497
- }
498
-
499
- $new = clone $this;
500
- $new->userInfo = $info;
501
- $new->validateState();
502
-
503
- return $new;
504
- }
505
-
506
- public function withHost($host)
507
- {
508
- $host = $this->filterHost($host);
509
-
510
- if ($this->host === $host) {
511
- return $this;
512
- }
513
-
514
- $new = clone $this;
515
- $new->host = $host;
516
- $new->validateState();
517
-
518
- return $new;
519
- }
520
-
521
- public function withPort($port)
522
- {
523
- $port = $this->filterPort($port);
524
-
525
- if ($this->port === $port) {
526
- return $this;
527
- }
528
-
529
- $new = clone $this;
530
- $new->port = $port;
531
- $new->removeDefaultPort();
532
- $new->validateState();
533
-
534
- return $new;
535
- }
536
-
537
- public function withPath($path)
538
- {
539
- $path = $this->filterPath($path);
540
-
541
- if ($this->path === $path) {
542
- return $this;
543
- }
544
-
545
- $new = clone $this;
546
- $new->path = $path;
547
- $new->validateState();
548
-
549
- return $new;
550
- }
551
-
552
- public function withQuery($query)
553
- {
554
- $query = $this->filterQueryAndFragment($query);
555
-
556
- if ($this->query === $query) {
557
- return $this;
558
- }
559
-
560
- $new = clone $this;
561
- $new->query = $query;
562
-
563
- return $new;
564
- }
565
-
566
- public function withFragment($fragment)
567
- {
568
- $fragment = $this->filterQueryAndFragment($fragment);
569
-
570
- if ($this->fragment === $fragment) {
571
- return $this;
572
- }
573
-
574
- $new = clone $this;
575
- $new->fragment = $fragment;
576
-
577
- return $new;
578
- }
579
-
580
- /**
581
- * Apply parse_url parts to a URI.
582
- *
583
- * @param array $parts Array of parse_url parts to apply.
584
- */
585
- private function applyParts(array $parts)
586
- {
587
- $this->scheme = isset($parts['scheme'])
588
- ? $this->filterScheme($parts['scheme'])
589
- : '';
590
- $this->userInfo = isset($parts['user'])
591
- ? $this->filterUserInfoComponent($parts['user'])
592
- : '';
593
- $this->host = isset($parts['host'])
594
- ? $this->filterHost($parts['host'])
595
- : '';
596
- $this->port = isset($parts['port'])
597
- ? $this->filterPort($parts['port'])
598
- : null;
599
- $this->path = isset($parts['path'])
600
- ? $this->filterPath($parts['path'])
601
- : '';
602
- $this->query = isset($parts['query'])
603
- ? $this->filterQueryAndFragment($parts['query'])
604
- : '';
605
- $this->fragment = isset($parts['fragment'])
606
- ? $this->filterQueryAndFragment($parts['fragment'])
607
- : '';
608
- if (isset($parts['pass'])) {
609
- $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']);
610
- }
611
-
612
- $this->removeDefaultPort();
613
- }
614
-
615
- /**
616
- * @param string $scheme
617
- *
618
- * @return string
619
- *
620
- * @throws \InvalidArgumentException If the scheme is invalid.
621
- */
622
- private function filterScheme($scheme)
623
- {
624
- if (!is_string($scheme)) {
625
- throw new \InvalidArgumentException('Scheme must be a string');
626
- }
627
-
628
- return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
629
- }
630
-
631
- /**
632
- * @param string $component
633
- *
634
- * @return string
635
- *
636
- * @throws \InvalidArgumentException If the user info is invalid.
637
- */
638
- private function filterUserInfoComponent($component)
639
- {
640
- if (!is_string($component)) {
641
- throw new \InvalidArgumentException('User info must be a string');
642
- }
643
-
644
- return preg_replace_callback(
645
- '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/',
646
- [$this, 'rawurlencodeMatchZero'],
647
- $component
648
- );
649
- }
650
-
651
- /**
652
- * @param string $host
653
- *
654
- * @return string
655
- *
656
- * @throws \InvalidArgumentException If the host is invalid.
657
- */
658
- private function filterHost($host)
659
- {
660
- if (!is_string($host)) {
661
- throw new \InvalidArgumentException('Host must be a string');
662
- }
663
-
664
- return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
665
- }
666
-
667
- /**
668
- * @param int|null $port
669
- *
670
- * @return int|null
671
- *
672
- * @throws \InvalidArgumentException If the port is invalid.
673
- */
674
- private function filterPort($port)
675
- {
676
- if ($port === null) {
677
- return null;
678
- }
679
-
680
- $port = (int) $port;
681
- if (0 > $port || 0xffff < $port) {
682
- throw new \InvalidArgumentException(
683
- sprintf('Invalid port: %d. Must be between 0 and 65535', $port)
684
- );
685
- }
686
-
687
- return $port;
688
- }
689
-
690
- /**
691
- * @param UriInterface $uri
692
- * @param array $keys
693
- *
694
- * @return array
695
- */
696
- private static function getFilteredQueryString(UriInterface $uri, array $keys)
697
- {
698
- $current = $uri->getQuery();
699
-
700
- if ($current === '') {
701
- return [];
702
- }
703
-
704
- $decodedKeys = array_map('rawurldecode', $keys);
705
-
706
- return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
707
- return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
708
- });
709
- }
710
-
711
- /**
712
- * @param string $key
713
- * @param string|null $value
714
- *
715
- * @return string
716
- */
717
- private static function generateQueryString($key, $value)
718
- {
719
- // Query string separators ("=", "&") within the key or value need to be encoded
720
- // (while preventing double-encoding) before setting the query string. All other
721
- // chars that need percent-encoding will be encoded by withQuery().
722
- $queryString = strtr($key, self::$replaceQuery);
723
-
724
- if ($value !== null) {
725
- $queryString .= '=' . strtr($value, self::$replaceQuery);
726
- }
727
-
728
- return $queryString;
729
- }
730
-
731
- private function removeDefaultPort()
732
- {
733
- if ($this->port !== null && self::isDefaultPort($this)) {
734
- $this->port = null;
735
- }
736
- }
737
-
738
- /**
739
- * Filters the path of a URI
740
- *
741
- * @param string $path
742
- *
743
- * @return string
744
- *
745
- * @throws \InvalidArgumentException If the path is invalid.
746
- */
747
- private function filterPath($path)
748
- {
749
- if (!is_string($path)) {
750
- throw new \InvalidArgumentException('Path must be a string');
751
- }
752
-
753
- return preg_replace_callback(
754
- '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
755
- [$this, 'rawurlencodeMatchZero'],
756
- $path
757
- );
758
- }
759
-
760
- /**
761
- * Filters the query string or fragment of a URI.
762
- *
763
- * @param string $str
764
- *
765
- * @return string
766
- *
767
- * @throws \InvalidArgumentException If the query or fragment is invalid.
768
- */
769
- private function filterQueryAndFragment($str)
770
- {
771
- if (!is_string($str)) {
772
- throw new \InvalidArgumentException('Query and fragment must be a string');
773
- }
774
-
775
- return preg_replace_callback(
776
- '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
777
- [$this, 'rawurlencodeMatchZero'],
778
- $str
779
- );
780
- }
781
-
782
- private function rawurlencodeMatchZero(array $match)
783
- {
784
- return rawurlencode($match[0]);
785
- }
786
-
787
- private function validateState()
788
- {
789
- if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) {
790
- $this->host = self::HTTP_DEFAULT_HOST;
791
- }
792
-
793
- if ($this->getAuthority() === '') {
794
- if (0 === strpos($this->path, '//')) {
795
- throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"');
796
- }
797
- if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) {
798
- throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon');
799
- }
800
- } elseif (isset($this->path[0]) && $this->path[0] !== '/') {
801
- @trigger_error(
802
- 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' .
803
- 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.',
804
- E_USER_DEPRECATED
805
- );
806
- $this->path = '/' . $this->path;
807
- //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty');
808
- }
809
- }
810
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/UriComparator.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Psr7;
4
-
5
- use Psr\Http\Message\UriInterface;
6
-
7
- /**
8
- * Provides methods to determine if a modified URL should be considered cross-origin.
9
- *
10
- * @author Graham Campbell
11
- */
12
- final class UriComparator
13
- {
14
- /**
15
- * Determines if a modified URL should be considered cross-origin with
16
- * respect to an original URL.
17
- *
18
- * @return bool
19
- */
20
- public static function isCrossOrigin(UriInterface $original, UriInterface $modified)
21
- {
22
- if (\strcasecmp($original->getHost(), $modified->getHost()) !== 0) {
23
- return true;
24
- }
25
-
26
- if ($original->getScheme() !== $modified->getScheme()) {
27
- return true;
28
- }
29
-
30
- if (self::computePort($original) !== self::computePort($modified)) {
31
- return true;
32
- }
33
-
34
- return false;
35
- }
36
-
37
- /**
38
- * @return int
39
- */
40
- private static function computePort(UriInterface $uri)
41
- {
42
- $port = $uri->getPort();
43
-
44
- if (null !== $port) {
45
- return $port;
46
- }
47
-
48
- return 'https' === $uri->getScheme() ? 443 : 80;
49
- }
50
-
51
- private function __construct()
52
- {
53
- // cannot be instantiated
54
- }
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/UriNormalizer.php DELETED
@@ -1,219 +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
- *
119
- * @link https://tools.ietf.org/html/rfc3986#section-6.2
120
- */
121
- public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS)
122
- {
123
- if ($flags & self::CAPITALIZE_PERCENT_ENCODING) {
124
- $uri = self::capitalizePercentEncoding($uri);
125
- }
126
-
127
- if ($flags & self::DECODE_UNRESERVED_CHARACTERS) {
128
- $uri = self::decodeUnreservedCharacters($uri);
129
- }
130
-
131
- if ($flags & self::CONVERT_EMPTY_PATH && $uri->getPath() === '' &&
132
- ($uri->getScheme() === 'http' || $uri->getScheme() === 'https')
133
- ) {
134
- $uri = $uri->withPath('/');
135
- }
136
-
137
- if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') {
138
- $uri = $uri->withHost('');
139
- }
140
-
141
- if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) {
142
- $uri = $uri->withPort(null);
143
- }
144
-
145
- if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) {
146
- $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath()));
147
- }
148
-
149
- if ($flags & self::REMOVE_DUPLICATE_SLASHES) {
150
- $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath()));
151
- }
152
-
153
- if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') {
154
- $queryKeyValues = explode('&', $uri->getQuery());
155
- sort($queryKeyValues);
156
- $uri = $uri->withQuery(implode('&', $queryKeyValues));
157
- }
158
-
159
- return $uri;
160
- }
161
-
162
- /**
163
- * Whether two URIs can be considered equivalent.
164
- *
165
- * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also
166
- * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be
167
- * resolved against the same base URI. If this is not the case, determination of equivalence or difference of
168
- * relative references does not mean anything.
169
- *
170
- * @param UriInterface $uri1 An URI to compare
171
- * @param UriInterface $uri2 An URI to compare
172
- * @param int $normalizations A bitmask of normalizations to apply, see constants
173
- *
174
- * @return bool
175
- *
176
- * @link https://tools.ietf.org/html/rfc3986#section-6.1
177
- */
178
- public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS)
179
- {
180
- return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations);
181
- }
182
-
183
- private static function capitalizePercentEncoding(UriInterface $uri)
184
- {
185
- $regex = '/(?:%[A-Fa-f0-9]{2})++/';
186
-
187
- $callback = function (array $match) {
188
- return strtoupper($match[0]);
189
- };
190
-
191
- return
192
- $uri->withPath(
193
- preg_replace_callback($regex, $callback, $uri->getPath())
194
- )->withQuery(
195
- preg_replace_callback($regex, $callback, $uri->getQuery())
196
- );
197
- }
198
-
199
- private static function decodeUnreservedCharacters(UriInterface $uri)
200
- {
201
- $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i';
202
-
203
- $callback = function (array $match) {
204
- return rawurldecode($match[0]);
205
- };
206
-
207
- return
208
- $uri->withPath(
209
- preg_replace_callback($regex, $callback, $uri->getPath())
210
- )->withQuery(
211
- preg_replace_callback($regex, $callback, $uri->getQuery())
212
- );
213
- }
214
-
215
- private function __construct()
216
- {
217
- // cannot be instantiated
218
- }
219
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/UriResolver.php DELETED
@@ -1,222 +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
- *
23
- * @link http://tools.ietf.org/html/rfc3986#section-5.2.4
24
- */
25
- public static function removeDotSegments($path)
26
- {
27
- if ($path === '' || $path === '/') {
28
- return $path;
29
- }
30
-
31
- $results = [];
32
- $segments = explode('/', $path);
33
- foreach ($segments as $segment) {
34
- if ($segment === '..') {
35
- array_pop($results);
36
- } elseif ($segment !== '.') {
37
- $results[] = $segment;
38
- }
39
- }
40
-
41
- $newPath = implode('/', $results);
42
-
43
- if ($path[0] === '/' && (!isset($newPath[0]) || $newPath[0] !== '/')) {
44
- // Re-add the leading slash if necessary for cases like "/.."
45
- $newPath = '/' . $newPath;
46
- } elseif ($newPath !== '' && ($segment === '.' || $segment === '..')) {
47
- // Add the trailing slash if necessary
48
- // If newPath is not empty, then $segment must be set and is the last segment from the foreach
49
- $newPath .= '/';
50
- }
51
-
52
- return $newPath;
53
- }
54
-
55
- /**
56
- * Converts the relative URI into a new URI that is resolved against the base URI.
57
- *
58
- * @param UriInterface $base Base URI
59
- * @param UriInterface $rel Relative URI
60
- *
61
- * @return UriInterface
62
- *
63
- * @link http://tools.ietf.org/html/rfc3986#section-5.2
64
- */
65
- public static function resolve(UriInterface $base, UriInterface $rel)
66
- {
67
- if ((string) $rel === '') {
68
- // we can simply return the same base URI instance for this same-document reference
69
- return $base;
70
- }
71
-
72
- if ($rel->getScheme() != '') {
73
- return $rel->withPath(self::removeDotSegments($rel->getPath()));
74
- }
75
-
76
- if ($rel->getAuthority() != '') {
77
- $targetAuthority = $rel->getAuthority();
78
- $targetPath = self::removeDotSegments($rel->getPath());
79
- $targetQuery = $rel->getQuery();
80
- } else {
81
- $targetAuthority = $base->getAuthority();
82
- if ($rel->getPath() === '') {
83
- $targetPath = $base->getPath();
84
- $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery();
85
- } else {
86
- if ($rel->getPath()[0] === '/') {
87
- $targetPath = $rel->getPath();
88
- } else {
89
- if ($targetAuthority != '' && $base->getPath() === '') {
90
- $targetPath = '/' . $rel->getPath();
91
- } else {
92
- $lastSlashPos = strrpos($base->getPath(), '/');
93
- if ($lastSlashPos === false) {
94
- $targetPath = $rel->getPath();
95
- } else {
96
- $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath();
97
- }
98
- }
99
- }
100
- $targetPath = self::removeDotSegments($targetPath);
101
- $targetQuery = $rel->getQuery();
102
- }
103
- }
104
-
105
- return new Uri(Uri::composeComponents(
106
- $base->getScheme(),
107
- $targetAuthority,
108
- $targetPath,
109
- $targetQuery,
110
- $rel->getFragment()
111
- ));
112
- }
113
-
114
- /**
115
- * Returns the target URI as a relative reference from the base URI.
116
- *
117
- * This method is the counterpart to resolve():
118
- *
119
- * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target))
120
- *
121
- * One use-case is to use the current request URI as base URI and then generate relative links in your documents
122
- * to reduce the document size or offer self-contained downloadable document archives.
123
- *
124
- * $base = new Uri('http://example.com/a/b/');
125
- * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'.
126
- * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'.
127
- * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'.
128
- * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'.
129
- *
130
- * This method also accepts a target that is already relative and will try to relativize it further. Only a
131
- * relative-path reference will be returned as-is.
132
- *
133
- * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well
134
- *
135
- * @param UriInterface $base Base URI
136
- * @param UriInterface $target Target URI
137
- *
138
- * @return UriInterface The relative URI reference
139
- */
140
- public static function relativize(UriInterface $base, UriInterface $target)
141
- {
142
- if ($target->getScheme() !== '' &&
143
- ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')
144
- ) {
145
- return $target;
146
- }
147
-
148
- if (Uri::isRelativePathReference($target)) {
149
- // As the target is already highly relative we return it as-is. It would be possible to resolve
150
- // the target with `$target = self::resolve($base, $target);` and then try make it more relative
151
- // by removing a duplicate query. But let's not do that automatically.
152
- return $target;
153
- }
154
-
155
- if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) {
156
- return $target->withScheme('');
157
- }
158
-
159
- // We must remove the path before removing the authority because if the path starts with two slashes, the URI
160
- // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also
161
- // invalid.
162
- $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost('');
163
-
164
- if ($base->getPath() !== $target->getPath()) {
165
- return $emptyPathUri->withPath(self::getRelativePath($base, $target));
166
- }
167
-
168
- if ($base->getQuery() === $target->getQuery()) {
169
- // Only the target fragment is left. And it must be returned even if base and target fragment are the same.
170
- return $emptyPathUri->withQuery('');
171
- }
172
-
173
- // If the base URI has a query but the target has none, we cannot return an empty path reference as it would
174
- // inherit the base query component when resolving.
175
- if ($target->getQuery() === '') {
176
- $segments = explode('/', $target->getPath());
177
- $lastSegment = end($segments);
178
-
179
- return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment);
180
- }
181
-
182
- return $emptyPathUri;
183
- }
184
-
185
- private static function getRelativePath(UriInterface $base, UriInterface $target)
186
- {
187
- $sourceSegments = explode('/', $base->getPath());
188
- $targetSegments = explode('/', $target->getPath());
189
- array_pop($sourceSegments);
190
- $targetLastSegment = array_pop($targetSegments);
191
- foreach ($sourceSegments as $i => $segment) {
192
- if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) {
193
- unset($sourceSegments[$i], $targetSegments[$i]);
194
- } else {
195
- break;
196
- }
197
- }
198
- $targetSegments[] = $targetLastSegment;
199
- $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments);
200
-
201
- // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./".
202
- // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used
203
- // as the first segment of a relative-path reference, as it would be mistaken for a scheme name.
204
- if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) {
205
- $relativePath = "./$relativePath";
206
- } elseif ('/' === $relativePath[0]) {
207
- if ($base->getAuthority() != '' && $base->getPath() === '') {
208
- // In this case an extra slash is added by resolve() automatically. So we must not add one here.
209
- $relativePath = ".$relativePath";
210
- } else {
211
- $relativePath = "./$relativePath";
212
- }
213
- }
214
-
215
- return $relativePath;
216
- }
217
-
218
- private function __construct()
219
- {
220
- // cannot be instantiated
221
- }
222
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/Utils.php DELETED
@@ -1,428 +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
- *
79
- * @return string
80
- *
81
- * @throws \RuntimeException on error.
82
- */
83
- public static function copyToString(StreamInterface $stream, $maxLen = -1)
84
- {
85
- $buffer = '';
86
-
87
- if ($maxLen === -1) {
88
- while (!$stream->eof()) {
89
- $buf = $stream->read(1048576);
90
- // Using a loose equality here to match on '' and false.
91
- if ($buf == null) {
92
- break;
93
- }
94
- $buffer .= $buf;
95
- }
96
- return $buffer;
97
- }
98
-
99
- $len = 0;
100
- while (!$stream->eof() && $len < $maxLen) {
101
- $buf = $stream->read($maxLen - $len);
102
- // Using a loose equality here to match on '' and false.
103
- if ($buf == null) {
104
- break;
105
- }
106
- $buffer .= $buf;
107
- $len = strlen($buffer);
108
- }
109
-
110
- return $buffer;
111
- }
112
-
113
- /**
114
- * Calculate a hash of a stream.
115
- *
116
- * This method reads the entire stream to calculate a rolling hash, based
117
- * on PHP's `hash_init` functions.
118
- *
119
- * @param StreamInterface $stream Stream to calculate the hash for
120
- * @param string $algo Hash algorithm (e.g. md5, crc32, etc)
121
- * @param bool $rawOutput Whether or not to use raw output
122
- *
123
- * @return string Returns the hash of the stream
124
- *
125
- * @throws \RuntimeException on error.
126
- */
127
- public static function hash(StreamInterface $stream, $algo, $rawOutput = false)
128
- {
129
- $pos = $stream->tell();
130
-
131
- if ($pos > 0) {
132
- $stream->rewind();
133
- }
134
-
135
- $ctx = hash_init($algo);
136
- while (!$stream->eof()) {
137
- hash_update($ctx, $stream->read(1048576));
138
- }
139
-
140
- $out = hash_final($ctx, (bool) $rawOutput);
141
- $stream->seek($pos);
142
-
143
- return $out;
144
- }
145
-
146
- /**
147
- * Clone and modify a request with the given changes.
148
- *
149
- * This method is useful for reducing the number of clones needed to mutate
150
- * a message.
151
- *
152
- * The changes can be one of:
153
- * - method: (string) Changes the HTTP method.
154
- * - set_headers: (array) Sets the given headers.
155
- * - remove_headers: (array) Remove the given headers.
156
- * - body: (mixed) Sets the given body.
157
- * - uri: (UriInterface) Set the URI.
158
- * - query: (string) Set the query string value of the URI.
159
- * - version: (string) Set the protocol version.
160
- *
161
- * @param RequestInterface $request Request to clone and modify.
162
- * @param array $changes Changes to apply.
163
- *
164
- * @return RequestInterface
165
- */
166
- public static function modifyRequest(RequestInterface $request, array $changes)
167
- {
168
- if (!$changes) {
169
- return $request;
170
- }
171
-
172
- $headers = $request->getHeaders();
173
-
174
- if (!isset($changes['uri'])) {
175
- $uri = $request->getUri();
176
- } else {
177
- // Remove the host header if one is on the URI
178
- if ($host = $changes['uri']->getHost()) {
179
- $changes['set_headers']['Host'] = $host;
180
-
181
- if ($port = $changes['uri']->getPort()) {
182
- $standardPorts = ['http' => 80, 'https' => 443];
183
- $scheme = $changes['uri']->getScheme();
184
- if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) {
185
- $changes['set_headers']['Host'] .= ':' . $port;
186
- }
187
- }
188
- }
189
- $uri = $changes['uri'];
190
- }
191
-
192
- if (!empty($changes['remove_headers'])) {
193
- $headers = self::caselessRemove($changes['remove_headers'], $headers);
194
- }
195
-
196
- if (!empty($changes['set_headers'])) {
197
- $headers = self::caselessRemove(array_keys($changes['set_headers']), $headers);
198
- $headers = $changes['set_headers'] + $headers;
199
- }
200
-
201
- if (isset($changes['query'])) {
202
- $uri = $uri->withQuery($changes['query']);
203
- }
204
-
205
- if ($request instanceof ServerRequestInterface) {
206
- $new = (new ServerRequest(
207
- isset($changes['method']) ? $changes['method'] : $request->getMethod(),
208
- $uri,
209
- $headers,
210
- isset($changes['body']) ? $changes['body'] : $request->getBody(),
211
- isset($changes['version'])
212
- ? $changes['version']
213
- : $request->getProtocolVersion(),
214
- $request->getServerParams()
215
- ))
216
- ->withParsedBody($request->getParsedBody())
217
- ->withQueryParams($request->getQueryParams())
218
- ->withCookieParams($request->getCookieParams())
219
- ->withUploadedFiles($request->getUploadedFiles());
220
-
221
- foreach ($request->getAttributes() as $key => $value) {
222
- $new = $new->withAttribute($key, $value);
223
- }
224
-
225
- return $new;
226
- }
227
-
228
- return new Request(
229
- isset($changes['method']) ? $changes['method'] : $request->getMethod(),
230
- $uri,
231
- $headers,
232
- isset($changes['body']) ? $changes['body'] : $request->getBody(),
233
- isset($changes['version'])
234
- ? $changes['version']
235
- : $request->getProtocolVersion()
236
- );
237
- }
238
-
239
- /**
240
- * Read a line from the stream up to the maximum allowed buffer length.
241
- *
242
- * @param StreamInterface $stream Stream to read from
243
- * @param int|null $maxLength Maximum buffer length
244
- *
245
- * @return string
246
- */
247
- public static function readLine(StreamInterface $stream, $maxLength = null)
248
- {
249
- $buffer = '';
250
- $size = 0;
251
-
252
- while (!$stream->eof()) {
253
- // Using a loose equality here to match on '' and false.
254
- if (null == ($byte = $stream->read(1))) {
255
- return $buffer;
256
- }
257
- $buffer .= $byte;
258
- // Break when a new line is found or the max length - 1 is reached
259
- if ($byte === "\n" || ++$size === $maxLength - 1) {
260
- break;
261
- }
262
- }
263
-
264
- return $buffer;
265
- }
266
-
267
- /**
268
- * Create a new stream based on the input type.
269
- *
270
- * Options is an associative array that can contain the following keys:
271
- * - metadata: Array of custom metadata.
272
- * - size: Size of the stream.
273
- *
274
- * This method accepts the following `$resource` types:
275
- * - `Psr\Http\Message\StreamInterface`: Returns the value as-is.
276
- * - `string`: Creates a stream object that uses the given string as the contents.
277
- * - `resource`: Creates a stream object that wraps the given PHP stream resource.
278
- * - `Iterator`: If the provided value implements `Iterator`, then a read-only
279
- * stream object will be created that wraps the given iterable. Each time the
280
- * stream is read from, data from the iterator will fill a buffer and will be
281
- * continuously called until the buffer is equal to the requested read size.
282
- * Subsequent read calls will first read from the buffer and then call `next`
283
- * on the underlying iterator until it is exhausted.
284
- * - `object` with `__toString()`: If the object has the `__toString()` method,
285
- * the object will be cast to a string and then a stream will be returned that
286
- * uses the string value.
287
- * - `NULL`: When `null` is passed, an empty stream object is returned.
288
- * - `callable` When a callable is passed, a read-only stream object will be
289
- * created that invokes the given callable. The callable is invoked with the
290
- * number of suggested bytes to read. The callable can return any number of
291
- * bytes, but MUST return `false` when there is no more data to return. The
292
- * stream object that wraps the callable will invoke the callable until the
293
- * number of requested bytes are available. Any additional bytes will be
294
- * buffered and used in subsequent reads.
295
- *
296
- * @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data
297
- * @param array $options Additional options
298
- *
299
- * @return StreamInterface
300
- *
301
- * @throws \InvalidArgumentException if the $resource arg is not valid.
302
- */
303
- public static function streamFor($resource = '', array $options = [])
304
- {
305
- if (is_scalar($resource)) {
306
- $stream = self::tryFopen('php://temp', 'r+');
307
- if ($resource !== '') {
308
- fwrite($stream, $resource);
309
- fseek($stream, 0);
310
- }
311
- return new Stream($stream, $options);
312
- }
313
-
314
- switch (gettype($resource)) {
315
- case 'resource':
316
- /*
317
- * The 'php://input' is a special stream with quirks and inconsistencies.
318
- * We avoid using that stream by reading it into php://temp
319
- */
320
- $metaData = \stream_get_meta_data($resource);
321
- if (isset($metaData['uri']) && $metaData['uri'] === 'php://input') {
322
- $stream = self::tryFopen('php://temp', 'w+');
323
- fwrite($stream, stream_get_contents($resource));
324
- fseek($stream, 0);
325
- $resource = $stream;
326
- }
327
- return new Stream($resource, $options);
328
- case 'object':
329
- if ($resource instanceof StreamInterface) {
330
- return $resource;
331
- } elseif ($resource instanceof \Iterator) {
332
- return new PumpStream(function () use ($resource) {
333
- if (!$resource->valid()) {
334
- return false;
335
- }
336
- $result = $resource->current();
337
- $resource->next();
338
- return $result;
339
- }, $options);
340
- } elseif (method_exists($resource, '__toString')) {
341
- return Utils::streamFor((string) $resource, $options);
342
- }
343
- break;
344
- case 'NULL':
345
- return new Stream(self::tryFopen('php://temp', 'r+'), $options);
346
- }
347
-
348
- if (is_callable($resource)) {
349
- return new PumpStream($resource, $options);
350
- }
351
-
352
- throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource));
353
- }
354
-
355
- /**
356
- * Safely opens a PHP stream resource using a filename.
357
- *
358
- * When fopen fails, PHP normally raises a warning. This function adds an
359
- * error handler that checks for errors and throws an exception instead.
360
- *
361
- * @param string $filename File to open
362
- * @param string $mode Mode used to open the file
363
- *
364
- * @return resource
365
- *
366
- * @throws \RuntimeException if the file cannot be opened
367
- */
368
- public static function tryFopen($filename, $mode)
369
- {
370
- $ex = null;
371
- set_error_handler(function () use ($filename, $mode, &$ex) {
372
- $ex = new \RuntimeException(sprintf(
373
- 'Unable to open "%s" using mode "%s": %s',
374
- $filename,
375
- $mode,
376
- func_get_args()[1]
377
- ));
378
-
379
- return true;
380
- });
381
-
382
- try {
383
- $handle = fopen($filename, $mode);
384
- } catch (\Throwable $e) {
385
- $ex = new \RuntimeException(sprintf(
386
- 'Unable to open "%s" using mode "%s": %s',
387
- $filename,
388
- $mode,
389
- $e->getMessage()
390
- ), 0, $e);
391
- }
392
-
393
- restore_error_handler();
394
-
395
- if ($ex) {
396
- /** @var $ex \RuntimeException */
397
- throw $ex;
398
- }
399
-
400
- return $handle;
401
- }
402
-
403
- /**
404
- * Returns a UriInterface for the given value.
405
- *
406
- * This function accepts a string or UriInterface and returns a
407
- * UriInterface for the given value. If the value is already a
408
- * UriInterface, it is returned as-is.
409
- *
410
- * @param string|UriInterface $uri
411
- *
412
- * @return UriInterface
413
- *
414
- * @throws \InvalidArgumentException
415
- */
416
- public static function uriFor($uri)
417
- {
418
- if ($uri instanceof UriInterface) {
419
- return $uri;
420
- }
421
-
422
- if (is_string($uri)) {
423
- return new Uri($uri);
424
- }
425
-
426
- throw new \InvalidArgumentException('URI must be a string or UriInterface');
427
- }
428
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/src/functions.php DELETED
@@ -1,422 +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|int|float|bool|StreamInterface|callable|\Iterator|null $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
- *
191
- * @return string
192
- *
193
- * @throws \RuntimeException on error.
194
- *
195
- * @deprecated copy_to_string will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToString instead.
196
- */
197
- function copy_to_string(StreamInterface $stream, $maxLen = -1)
198
- {
199
- return Utils::copyToString($stream, $maxLen);
200
- }
201
-
202
- /**
203
- * Copy the contents of a stream into another stream until the given number
204
- * of bytes have been read.
205
- *
206
- * @param StreamInterface $source Stream to read from
207
- * @param StreamInterface $dest Stream to write to
208
- * @param int $maxLen Maximum number of bytes to read. Pass -1
209
- * to read the entire stream.
210
- *
211
- * @throws \RuntimeException on error.
212
- *
213
- * @deprecated copy_to_stream will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToStream instead.
214
- */
215
- function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)
216
- {
217
- return Utils::copyToStream($source, $dest, $maxLen);
218
- }
219
-
220
- /**
221
- * Calculate a hash of a stream.
222
- *
223
- * This method reads the entire stream to calculate a rolling hash, based on
224
- * PHP's `hash_init` functions.
225
- *
226
- * @param StreamInterface $stream Stream to calculate the hash for
227
- * @param string $algo Hash algorithm (e.g. md5, crc32, etc)
228
- * @param bool $rawOutput Whether or not to use raw output
229
- *
230
- * @return string Returns the hash of the stream
231
- *
232
- * @throws \RuntimeException on error.
233
- *
234
- * @deprecated hash will be removed in guzzlehttp/psr7:2.0. Use Utils::hash instead.
235
- */
236
- function hash(StreamInterface $stream, $algo, $rawOutput = false)
237
- {
238
- return Utils::hash($stream, $algo, $rawOutput);
239
- }
240
-
241
- /**
242
- * Read a line from the stream up to the maximum allowed buffer length.
243
- *
244
- * @param StreamInterface $stream Stream to read from
245
- * @param int|null $maxLength Maximum buffer length
246
- *
247
- * @return string
248
- *
249
- * @deprecated readline will be removed in guzzlehttp/psr7:2.0. Use Utils::readLine instead.
250
- */
251
- function readline(StreamInterface $stream, $maxLength = null)
252
- {
253
- return Utils::readLine($stream, $maxLength);
254
- }
255
-
256
- /**
257
- * Parses a request message string into a request object.
258
- *
259
- * @param string $message Request message string.
260
- *
261
- * @return Request
262
- *
263
- * @deprecated parse_request will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequest instead.
264
- */
265
- function parse_request($message)
266
- {
267
- return Message::parseRequest($message);
268
- }
269
-
270
- /**
271
- * Parses a response message string into a response object.
272
- *
273
- * @param string $message Response message string.
274
- *
275
- * @return Response
276
- *
277
- * @deprecated parse_response will be removed in guzzlehttp/psr7:2.0. Use Message::parseResponse instead.
278
- */
279
- function parse_response($message)
280
- {
281
- return Message::parseResponse($message);
282
- }
283
-
284
- /**
285
- * Parse a query string into an associative array.
286
- *
287
- * If multiple values are found for the same key, the value of that key value
288
- * pair will become an array. This function does not parse nested PHP style
289
- * arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed
290
- * into `['foo[a]' => '1', 'foo[b]' => '2'])`.
291
- *
292
- * @param string $str Query string to parse
293
- * @param int|bool $urlEncoding How the query string is encoded
294
- *
295
- * @return array
296
- *
297
- * @deprecated parse_query will be removed in guzzlehttp/psr7:2.0. Use Query::parse instead.
298
- */
299
- function parse_query($str, $urlEncoding = true)
300
- {
301
- return Query::parse($str, $urlEncoding);
302
- }
303
-
304
- /**
305
- * Build a query string from an array of key value pairs.
306
- *
307
- * This function can use the return value of `parse_query()` to build a query
308
- * string. This function does not modify the provided keys when an array is
309
- * encountered (like `http_build_query()` would).
310
- *
311
- * @param array $params Query string parameters.
312
- * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
313
- * to encode using RFC3986, or PHP_QUERY_RFC1738
314
- * to encode using RFC1738.
315
- *
316
- * @return string
317
- *
318
- * @deprecated build_query will be removed in guzzlehttp/psr7:2.0. Use Query::build instead.
319
- */
320
- function build_query(array $params, $encoding = PHP_QUERY_RFC3986)
321
- {
322
- return Query::build($params, $encoding);
323
- }
324
-
325
- /**
326
- * Determines the mimetype of a file by looking at its extension.
327
- *
328
- * @param string $filename
329
- *
330
- * @return string|null
331
- *
332
- * @deprecated mimetype_from_filename will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromFilename instead.
333
- */
334
- function mimetype_from_filename($filename)
335
- {
336
- return MimeType::fromFilename($filename);
337
- }
338
-
339
- /**
340
- * Maps a file extensions to a mimetype.
341
- *
342
- * @param $extension string The file extension.
343
- *
344
- * @return string|null
345
- *
346
- * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
347
- * @deprecated mimetype_from_extension will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromExtension instead.
348
- */
349
- function mimetype_from_extension($extension)
350
- {
351
- return MimeType::fromExtension($extension);
352
- }
353
-
354
- /**
355
- * Parses an HTTP message into an associative array.
356
- *
357
- * The array contains the "start-line" key containing the start line of
358
- * the message, "headers" key containing an associative array of header
359
- * array values, and a "body" key containing the body of the message.
360
- *
361
- * @param string $message HTTP request or response to parse.
362
- *
363
- * @return array
364
- *
365
- * @internal
366
- *
367
- * @deprecated _parse_message will be removed in guzzlehttp/psr7:2.0. Use Message::parseMessage instead.
368
- */
369
- function _parse_message($message)
370
- {
371
- return Message::parseMessage($message);
372
- }
373
-
374
- /**
375
- * Constructs a URI for an HTTP request message.
376
- *
377
- * @param string $path Path from the start-line
378
- * @param array $headers Array of headers (each value an array).
379
- *
380
- * @return string
381
- *
382
- * @internal
383
- *
384
- * @deprecated _parse_request_uri will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequestUri instead.
385
- */
386
- function _parse_request_uri($path, array $headers)
387
- {
388
- return Message::parseRequestUri($path, $headers);
389
- }
390
-
391
- /**
392
- * Get a short summary of the message body.
393
- *
394
- * Will return `null` if the response is not printable.
395
- *
396
- * @param MessageInterface $message The message to get the body summary
397
- * @param int $truncateAt The maximum allowed size of the summary
398
- *
399
- * @return string|null
400
- *
401
- * @deprecated get_message_body_summary will be removed in guzzlehttp/psr7:2.0. Use Message::bodySummary instead.
402
- */
403
- function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
404
- {
405
- return Message::bodySummary($message, $truncateAt);
406
- }
407
-
408
- /**
409
- * Remove the items given by the keys, case insensitively from the data.
410
- *
411
- * @param iterable<string> $keys
412
- *
413
- * @return array
414
- *
415
- * @internal
416
- *
417
- * @deprecated _caseless_remove will be removed in guzzlehttp/psr7:2.0. Use Utils::caselessRemove instead.
418
- */
419
- function _caseless_remove($keys, array $data)
420
- {
421
- return Utils::caselessRemove($keys, $data);
422
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/mailerlite/mailerlite-api-v2-php-sdk/LICENSE.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2019 MailerLite
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/mailerlite/mailerlite-api-v2-php-sdk/README.md CHANGED
@@ -2,11 +2,11 @@
2
 
3
  It is an official PHP SDK for MailerLite API v2.
4
 
5
- You can find more examples and information about MailerLite API v2 here: [http://developers.mailerlite.com](http://developers.mailerlite.com)
6
 
7
  ## Getting started
8
 
9
- In order to use this library you need to have at least PHP 5.6 version.
10
 
11
  There are two ways to use MailerLite PHP SDK:
12
 
@@ -20,9 +20,16 @@ Then you will need to run this simple command using CLI:
20
  composer require mailerlite/mailerlite-api-v2-php-sdk
21
  ```
22
 
 
 
 
 
 
 
 
23
  ##### Manual (preferable for shared hostings)
24
 
25
- This way is preferable only if you are using shared hosting and do not have a possibility to use Composer. You will need to download [this archive](http://bit.ly/ml-php-sdk-0_1_10), extract it and place its contents in root folder of your project. The next step is the same as using Composer, you will need to require `vendor/autoload.php` file in your index.php and lets dive in!
26
 
27
  ## Usage examples
28
 
@@ -66,9 +73,9 @@ $fields = $fieldsApi->get(); // returns array of fields
66
 
67
  ## Use your preferred HTTP client
68
 
69
- MailerLite SDK uses cURL as default HTTP client but it is easy to use your preferred client. It is achieved by using [HTTPlug](http://httplug.io) which is PSR-7 compliant HTTP client abstraction.
70
 
71
- Here is an example how to use [Guzzle](http://docs.guzzlephp.org/) instead of cURL:
72
 
73
  ```php
74
  $guzzle = new \GuzzleHttp\Client();
@@ -85,4 +92,4 @@ You are welcome to create SDK for any other programming language.
85
 
86
  If you have any troubles using our API or SDK free to contact our support by email [info@mailerlite.com](mailto:info@mailerlite)
87
 
88
- Official documentation is at [http://developers.mailerlite.com](http://developers.mailerlite.com)
2
 
3
  It is an official PHP SDK for MailerLite API v2.
4
 
5
+ You can find more examples and information about MailerLite API v2 here: [https://developers.mailerlite.com](https://developers.mailerlite.com)
6
 
7
  ## Getting started
8
 
9
+ In order to use this library you need to have at least PHP 7.1 version.
10
 
11
  There are two ways to use MailerLite PHP SDK:
12
 
20
  composer require mailerlite/mailerlite-api-v2-php-sdk
21
  ```
22
 
23
+ This library is built atop of [PSR-7](https://www.php-fig.org/psr/psr-7/) and
24
+ [PSR-18](https://www.php-fig.org/psr/psr-18/). If you are receiving `Http\Discovery\Exception\DiscoveryFailedException` exception, you will need to run:
25
+
26
+ ```bash
27
+ composer require php-http/guzzle6-adapter
28
+ ```
29
+
30
  ##### Manual (preferable for shared hostings)
31
 
32
+ This way is preferable only if you are using shared hosting and do not have a possibility to use Composer. You will need to download [this archive](https://bit.ly/32jmi7M)(v0.2.3), extract it and place its contents in root folder of your project. The next step is the same as using Composer, you will need to require `vendor/autoload.php` file in your index.php and lets dive in!
33
 
34
  ## Usage examples
35
 
73
 
74
  ## Use your preferred HTTP client
75
 
76
+ MailerLite SDK uses cURL as default HTTP client but it is easy to use your preferred client. It is achieved by using [HTTPlug](https://httplug.io) which is PSR-7 compliant HTTP client abstraction.
77
 
78
+ Here is an example how to use [Guzzle](https://docs.guzzlephp.org/) instead of cURL:
79
 
80
  ```php
81
  $guzzle = new \GuzzleHttp\Client();
92
 
93
  If you have any troubles using our API or SDK free to contact our support by email [info@mailerlite.com](mailto:info@mailerlite)
94
 
95
+ Official documentation is at [https://developers.mailerlite.com](https://developers.mailerlite.com)
vendor/mailerlite/mailerlite-api-v2-php-sdk/phpunit.xml.bak ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <phpunit bootstrap="tests/bootstrap.php"
2
+ colors="true"
3
+ stopOnFailure="false">
4
+ <testsuites>
5
+ <testsuite name="client">
6
+ <directory>tests</directory>
7
+ </testsuite>
8
+ </testsuites>
9
+ <logging>
10
+ <log type="tap" target="build/report.tap"/>
11
+ <log type="junit" target="build/report.junit.xml"/>
12
+ <!-- <log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
13
+ <log type="coverage-text" target="build/coverage.txt"/>
14
+ <log type="coverage-clover" target="build/logs/clover.xml"/> -->
15
+ </logging>
16
+ </phpunit>
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Batch.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace MailerLiteApi\Api;
4
+
5
+ use MailerLiteApi\Common\ApiAbstract;
6
+ use MailerLiteApi\Common\BatchRequest;
7
+ use MailerLiteApi\Exceptions\MailerLiteSdkException;
8
+
9
+ /**
10
+ * Class Batch
11
+ *
12
+ * @package MailerLiteApi\Api
13
+ */
14
+ class Batch extends ApiAbstract
15
+ {
16
+
17
+ protected $endpoint = 'batch';
18
+
19
+ /**
20
+ * @param BatchRequest[] $requests
21
+ *
22
+ * @return \MailerLiteApi\Common\Collection
23
+ */
24
+ public function send(array $requests)
25
+ {
26
+ if ( ! count($requests)) {
27
+ throw new MailerLiteSdkException("Provide at least one request");
28
+ }
29
+
30
+ foreach ($requests as &$request) {
31
+ if ( ! is_object($request) || get_class($request) != BatchRequest::class) {
32
+ throw new MailerLiteSdkException("All requests must be of type ".BatchRequest::class);
33
+ }
34
+
35
+ $request = $request->toArray();
36
+ }
37
+
38
+ $response = $this->restClient->post($this->endpoint, [
39
+ 'requests' => $requests,
40
+ ]);
41
+
42
+ return $response['body'];
43
+ }
44
+
45
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Campaigns.php CHANGED
@@ -3,7 +3,13 @@
3
  namespace MailerLiteApi\Api;
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
 
6
 
 
 
 
 
 
7
  class Campaigns extends ApiAbstract {
8
 
9
  protected $endpoint = 'campaigns';
@@ -13,11 +19,17 @@ class Campaigns extends ApiAbstract {
13
  *
14
  * @param int $campaignId
15
  * @param array $contentData
16
- * @param array $params
17
  * @return [type]
18
  */
19
- public function addContent($campaignId, $contentData = [], $params = [])
20
  {
 
 
 
 
 
 
 
21
  $endpoint = $this->endpoint . '/' . $campaignId . '/content';
22
 
23
  $response = $this->restClient->put($endpoint, $contentData);
@@ -59,7 +71,7 @@ class Campaigns extends ApiAbstract {
59
  /**
60
  * Get collection of items
61
  * @param array $fields
62
- * @return [type]
63
  */
64
  public function get($type = 'sent', $fields = ['*'])
65
  {
@@ -78,4 +90,4 @@ class Campaigns extends ApiAbstract {
78
 
79
  return $entities;
80
  }
81
- }
3
  namespace MailerLiteApi\Api;
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
+ use MailerLiteApi\Exceptions\MailerLiteSdkException;
7
 
8
+ /**
9
+ * Class Campaigns
10
+ *
11
+ * @package MailerLiteApi\Api
12
+ */
13
  class Campaigns extends ApiAbstract {
14
 
15
  protected $endpoint = 'campaigns';
19
  *
20
  * @param int $campaignId
21
  * @param array $contentData
 
22
  * @return [type]
23
  */
24
+ public function addContent(int $campaignId, array $contentData)
25
  {
26
+ if ( ! array_key_exists('html', $contentData)) {
27
+ throw new MailerLiteSdkException("HTML must be provided");
28
+ }
29
+ if ( ! array_key_exists('plain', $contentData)) {
30
+ throw new MailerLiteSdkException("Plain text must be provided");
31
+ }
32
+
33
  $endpoint = $this->endpoint . '/' . $campaignId . '/content';
34
 
35
  $response = $this->restClient->put($endpoint, $contentData);
71
  /**
72
  * Get collection of items
73
  * @param array $fields
74
+ * @return \MailerLiteApi\Common\Collection
75
  */
76
  public function get($type = 'sent', $fields = ['*'])
77
  {
90
 
91
  return $entities;
92
  }
93
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Fields.php CHANGED
@@ -4,8 +4,20 @@ namespace MailerLiteApi\Api;
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
 
 
 
 
 
7
  class Fields extends ApiAbstract {
8
 
9
  protected $endpoint = 'fields';
10
 
11
- }
 
 
 
 
 
 
 
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
7
+ /**
8
+ * Class Fields
9
+ *
10
+ * @package MailerLiteApi\Api
11
+ */
12
  class Fields extends ApiAbstract {
13
 
14
  protected $endpoint = 'fields';
15
 
16
+ public function getAccountFields() {
17
+
18
+ $response = $this->restClient->get($this->endpoint);
19
+
20
+ return $response['body'];
21
+ }
22
+
23
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Groups.php CHANGED
@@ -4,6 +4,11 @@ namespace MailerLiteApi\Api;
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
 
 
 
 
 
7
  class Groups extends ApiAbstract {
8
 
9
  protected $endpoint = 'groups';
@@ -102,4 +107,4 @@ class Groups extends ApiAbstract {
102
 
103
  return $response['body'];
104
  }
105
- }
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
7
+ /**
8
+ * Class Groups
9
+ *
10
+ * @package MailerLiteApi\Api
11
+ */
12
  class Groups extends ApiAbstract {
13
 
14
  protected $endpoint = 'groups';
107
 
108
  return $response['body'];
109
  }
110
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Segments.php CHANGED
@@ -4,8 +4,13 @@ namespace MailerLiteApi\Api;
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
 
 
 
 
 
7
  class Segments extends ApiAbstract {
8
 
9
  protected $endpoint = 'segments';
10
 
11
- }
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
7
+ /**
8
+ * Class Segments
9
+ *
10
+ * @package MailerLiteApi\Api
11
+ */
12
  class Segments extends ApiAbstract {
13
 
14
  protected $endpoint = 'segments';
15
 
16
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Settings.php CHANGED
@@ -4,6 +4,11 @@ namespace MailerLiteApi\Api;
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
 
 
 
 
 
7
  class Settings extends ApiAbstract {
8
 
9
  protected $endpoint = 'settings';
@@ -33,4 +38,4 @@ class Settings extends ApiAbstract {
33
  return $response['body'];
34
  }
35
 
36
- }
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
7
+ /**
8
+ * Class Settings
9
+ *
10
+ * @package MailerLiteApi\Api
11
+ */
12
  class Settings extends ApiAbstract {
13
 
14
  protected $endpoint = 'settings';
38
  return $response['body'];
39
  }
40
 
41
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Stats.php CHANGED
@@ -4,6 +4,11 @@ namespace MailerLiteApi\Api;
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
 
 
 
 
 
7
  class Stats extends ApiAbstract {
8
 
9
  protected $endpoint = 'stats';
@@ -22,4 +27,4 @@ class Stats extends ApiAbstract {
22
  return $response['body'];
23
  }
24
 
25
- }
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
7
+ /**
8
+ * Class Stats
9
+ *
10
+ * @package MailerLiteApi\Api
11
+ */
12
  class Stats extends ApiAbstract {
13
 
14
  protected $endpoint = 'stats';
27
  return $response['body'];
28
  }
29
 
30
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/Subscribers.php CHANGED
@@ -4,8 +4,19 @@ namespace MailerLiteApi\Api;
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
 
 
 
 
 
7
  class Subscribers extends ApiAbstract {
8
 
 
 
 
 
 
 
9
  protected $endpoint = 'subscribers';
10
 
11
  /**
@@ -66,4 +77,29 @@ class Subscribers extends ApiAbstract {
66
  return $response['body'];
67
  }
68
 
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  use MailerLiteApi\Common\ApiAbstract;
6
 
7
+ /**
8
+ * Class Subscribers
9
+ *
10
+ * @package MailerLiteApi\Api
11
+ */
12
  class Subscribers extends ApiAbstract {
13
 
14
+ const TYPE_ACTIVE = 'active';
15
+ const TYPE_UNSUBSCRIBED = 'unsubscribed';
16
+ const TYPE_BOUNCED = 'bounced';
17
+ const TYPE_JUNK = 'junk';
18
+ const TYPE_UNCONFIRMED = 'unconfirmed';
19
+
20
  protected $endpoint = 'subscribers';
21
 
22
  /**
77
  return $response['body'];
78
  }
79
 
80
+ /**
81
+ * Get all subscribers
82
+ *
83
+ * @param string[] $fields
84
+ * @param null|string $type
85
+ *
86
+ * @return \MailerLiteApi\Common\Collection
87
+ */
88
+ public function get($fields = ['*'], $type = null)
89
+ {
90
+ $params = $this->prepareParams();
91
+
92
+ if ( ! empty($fields) && is_array($fields) && $fields != ['*']) {
93
+ $params['fields'] = $fields;
94
+ }
95
+
96
+ if ($type !== null) {
97
+ $params['type'] = $type;
98
+ }
99
+
100
+ $response = $this->restClient->get($this->endpoint, $params);
101
+
102
+ return $this->generateCollection($response['body']);
103
+ }
104
+
105
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Api/WooCommerce.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace MailerLiteApi\Api;
4
+
5
+ use MailerLiteApi\Common\ApiAbstract;
6
+
7
+ /**
8
+ * Class WooCommerce
9
+ *
10
+ * @package MailerLiteApi\Api
11
+ */
12
+ class WooCommerce extends ApiAbstract
13
+ {
14
+ protected $endpoint = 'woocommerce';
15
+
16
+ public function setConsumerData( $consumerKey, $consumerSecret, $store, $currency, $group_id, $resubscribe, $ignoreList, $create_segments)
17
+ {
18
+ $endpoint = $this->endpoint . '/consumer_data';
19
+
20
+ $params = array_merge($this->prepareParams(),
21
+ ['consumer_key' => $consumerKey,
22
+ 'consumer_secret' => $consumerSecret,
23
+ 'store' => $store,
24
+ 'currency' => $currency,
25
+ 'group_id' => $group_id,
26
+ 'resubscribe' => $resubscribe,
27
+ 'ignore_list' => $ignoreList,
28
+ 'create_segments' => $create_segments]);
29
+
30
+ $response = $this->restClient->post( $endpoint, $params );
31
+
32
+ return $response['body'];
33
+ }
34
+
35
+ public function saveOrder($orderData, $shop)
36
+ {
37
+ $endpoint = 'woocommerce/alternative_save_order';
38
+
39
+ $params = array_merge($this->prepareParams(), ['order_data' => $orderData, 'shop' => $shop] );
40
+ $response = $this->restClient->post( $endpoint, $params );
41
+ if (isset($response['body'])){
42
+ return $response['body'];
43
+ } else {
44
+ return true;
45
+ }
46
+ }
47
+
48
+ public function toggleShopConnection($shop, $activeState)
49
+ {
50
+ $shopName = parse_url($shop, PHP_URL_HOST);
51
+ $endpoint = 'woocommerce/toggle_shop_connection';
52
+
53
+ $params = array_merge($this->prepareParams(), ['active_state' => $activeState, 'shop' => $shopName] );
54
+ return $this->restClient->post( $endpoint, $params );
55
+ }
56
+
57
+ public function sendCartData($shopUrl, $cartData)
58
+ {
59
+ $endpoint = 'woocommerce/save_cart';
60
+
61
+ $params = array_merge($this->prepareParams(), ['cart_data' => $cartData, 'shop' => $shopUrl] );
62
+ $response = $this->restClient->post( $endpoint, $params );
63
+ if (isset($response['body'])){
64
+ return $response['body'];
65
+ } else {
66
+ return true;
67
+ }
68
+ }
69
+
70
+ public function sendSubscriberData($data)
71
+ {
72
+ $endpoint = 'woocommerce/save_subscriber';
73
+
74
+ $params = array_merge($this->prepareParams(), ['data'=>$data] );
75
+ $response = $this->restClient->post( $endpoint, $params );
76
+
77
+ if (isset($response['body'])){
78
+ return $response['body'];
79
+ } else {
80
+ return false;
81
+ }
82
+ }
83
+
84
+ public function sendOrderProcessingData($data)
85
+ {
86
+ $endpoint = 'woocommerce/order_processing';
87
+
88
+ $params = array_merge($this->prepareParams(), ['data'=>$data] );
89
+ $response = $this->restClient->post( $endpoint, $params );
90
+
91
+ if (isset($response['body'])){
92
+ return $response['body'];
93
+ } else {
94
+ return true;
95
+ }
96
+ }
97
+
98
+ public function getShopSettings($shopUrl)
99
+ {
100
+ $shopName = parse_url($shopUrl, PHP_URL_HOST);
101
+ $endpoint = 'woocommerce/settings/'.$shopName;
102
+
103
+ return $this->restClient->get( $endpoint);
104
+ }
105
+
106
+ public function validateAccount()
107
+ {
108
+ $endpoint = 'woocommerce/initial_account_settings';
109
+ return $this->restClient->get($endpoint);
110
+ }
111
+
112
+ public function syncCustomer($email, $fields, $shopUrl)
113
+ {
114
+ $endpoint = 'woocommerce/sync_customer';
115
+ $params = array_merge($this->prepareParams(), ['email' => $email, 'subscriber_fields' => $fields, 'shop' => $shopUrl] );
116
+
117
+ $response = $this->restClient->post( $endpoint, $params );
118
+
119
+ if (isset($response['body'])) {
120
+ return $response['body'];
121
+ } else {
122
+ return true;
123
+ }
124
+ }
125
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Common/BatchRequest.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace MailerLiteApi\Common;
4
+
5
+ /**
6
+ * Class BatchRequest
7
+ *
8
+ * @package MailerLiteApi\Common
9
+ */
10
+ class BatchRequest
11
+ {
12
+
13
+ const METHOD_GET = 'GET';
14
+
15
+ const METHOD_POST = 'POST';
16
+
17
+ const METHOD_PUT = 'PUT';
18
+
19
+ const METHOD_DELETE = 'DELETE';
20
+
21
+ /** @var string $method */
22
+ protected $method = self::METHOD_GET;
23
+
24
+ /** @var string $path */
25
+ protected $path = '';
26
+
27
+ /** @var null|array $body */
28
+ protected $body = null;
29
+
30
+ /**
31
+ * @return string
32
+ */
33
+ public function getMethod(): string
34
+ {
35
+ return $this->method;
36
+ }
37
+
38
+ /**
39
+ * @param string $method
40
+ *
41
+ * @return BatchRequest
42
+ */
43
+ public function setMethod(string $method): BatchRequest
44
+ {
45
+ $this->method = $method;
46
+
47
+ return $this;
48
+ }
49
+
50
+ /**
51
+ * @return string
52
+ */
53
+ public function getPath(): string
54
+ {
55
+ return $this->path;
56
+ }
57
+
58
+ /**
59
+ * @param string $path
60
+ *
61
+ * @return BatchRequest
62
+ */
63
+ public function setPath(string $path): BatchRequest
64
+ {
65
+ $this->path = $path;
66
+
67
+ return $this;
68
+ }
69
+
70
+ /**
71
+ * @return null
72
+ */
73
+ public function getBody()
74
+ {
75
+ return $this->body;
76
+ }
77
+
78
+ /**
79
+ * @param null|array $body
80
+ *
81
+ * @return BatchRequest
82
+ */
83
+ public function setBody($body)
84
+ {
85
+ $this->body = $body;
86
+
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ * @return array
92
+ */
93
+ public function toArray(): array
94
+ {
95
+ $array = [
96
+ 'method' => $this->getMethod(),
97
+ 'path' => $this->getPath(),
98
+ ];
99
+
100
+ if ($body = $this->getBody()) {
101
+ $array['body'] = $body;
102
+ }
103
+
104
+ return $array;
105
+ }
106
+
107
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/Common/RestClient.php CHANGED
@@ -3,14 +3,12 @@
3
  namespace MailerLiteApi\Common;
4
 
5
  use Http\Client\HttpClient;
6
- use Http\Client\Curl\Client as CurlClient;
7
-
8
- use GuzzleHttp\Psr7\Request;
9
- use MailerLiteApi\Common\ApiConstants;
10
  use Psr\Http\Message\ResponseInterface;
11
-
12
- use Http\Message\MessageFactory\GuzzleMessageFactory;
13
- use Http\Message\StreamFactory\GuzzleStreamFactory;
14
 
15
  class RestClient {
16
 
@@ -20,10 +18,14 @@ class RestClient {
20
 
21
  public $baseUrl;
22
 
 
 
 
 
23
  /**
24
- * @param string $baseUrl
25
- * @param string $apiKey
26
- * @param HttpClient $httpClient
27
  */
28
  public function __construct($baseUrl, $apiKey, HttpClient $httpClient = null)
29
  {
@@ -90,11 +92,25 @@ class RestClient {
90
  */
91
  protected function send($method, $endpointUri, $body = null, array $headers = [])
92
  {
 
93
  $headers = array_merge($headers, self::getDefaultHeaders());
94
  $endpointUrl = $this->baseUrl . $endpointUri;
95
 
96
- $request = new Request($method, $endpointUrl, $headers, json_encode($body));
97
- $response = $this->getHttpClient()->sendRequest($request);
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  return $this->handleResponse($response);
100
  }
@@ -117,30 +133,52 @@ class RestClient {
117
  }
118
 
119
  /**
120
- * @return HttpClient
121
  */
122
  protected function getHttpClient()
123
  {
124
  if (is_null($this->httpClient)) {
125
- $options = [
126
- CURLOPT_CONNECTTIMEOUT => 10,
127
- CURLOPT_SSL_VERIFYPEER => false
128
- ];
129
-
130
- $this->httpClient = new CurlClient(new GuzzleMessageFactory(), new GuzzleStreamFactory(), $options);
131
  }
132
 
133
  return $this->httpClient;
134
  }
135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  /**
137
  * @return array
138
  */
139
  protected function getDefaultHeaders() {
140
- return [
141
- 'User-Agent' => ApiConstants::SDK_USER_AGENT . '/' . ApiConstants::SDK_VERSION,
142
- 'X-MailerLite-ApiKey' => $this->apiKey,
143
- 'Content-Type' => 'application/json'
144
  ];
 
 
 
 
 
 
 
145
  }
146
- }
3
  namespace MailerLiteApi\Common;
4
 
5
  use Http\Client\HttpClient;
6
+ use Http\Discovery\Psr17FactoryDiscovery;
7
+ use Http\Discovery\Psr18ClientDiscovery;
8
+ use Psr\Http\Client\ClientInterface;
9
+ use Psr\Http\Message\RequestFactoryInterface;
10
  use Psr\Http\Message\ResponseInterface;
11
+ use Psr\Http\Message\StreamFactoryInterface;
 
 
12
 
13
  class RestClient {
14
 
18
 
19
  public $baseUrl;
20
 
21
+ public $requestFactory;
22
+
23
+ public $streamFactory;
24
+
25
  /**
26
+ * @param string $baseUrl
27
+ * @param string $apiKey
28
+ * @param \Http\Client\HttpClient|null $httpClient
29
  */
30
  public function __construct($baseUrl, $apiKey, HttpClient $httpClient = null)
31
  {
92
  */
93
  protected function send($method, $endpointUri, $body = null, array $headers = [])
94
  {
95
+
96
  $headers = array_merge($headers, self::getDefaultHeaders());
97
  $endpointUrl = $this->baseUrl . $endpointUri;
98
 
99
+ $request = $this->getRequestFactory()->createRequest($method, $endpointUrl);
100
+
101
+ if ($body) {
102
+ $stream = $this->getStreamFactory()
103
+ ->createStream(json_encode($body));
104
+ $request = $request->withBody($stream);
105
+ }
106
+
107
+ foreach ($headers as $name => $value) {
108
+ $request = $request->withAddedHeader($name, $value);
109
+ }
110
+
111
+ $response = $this->getHttpClient()->sendRequest(
112
+ $request
113
+ );
114
 
115
  return $this->handleResponse($response);
116
  }
133
  }
134
 
135
  /**
136
+ * @return ClientInterface
137
  */
138
  protected function getHttpClient()
139
  {
140
  if (is_null($this->httpClient)) {
141
+ $this->httpClient = Psr18ClientDiscovery::find();
 
 
 
 
 
142
  }
143
 
144
  return $this->httpClient;
145
  }
146
 
147
+ /**
148
+ * @return HttpClient
149
+ */
150
+ protected function getRequestFactory(): RequestFactoryInterface
151
+ {
152
+ if (null === $this->requestFactory) {
153
+ $this->requestFactory = Psr17FactoryDiscovery::findRequestFactory();
154
+ }
155
+
156
+ return $this->requestFactory;
157
+ }
158
+
159
+ private function getStreamFactory(): StreamFactoryInterface
160
+ {
161
+ if (null === $this->streamFactory) {
162
+ $this->streamFactory = Psr17FactoryDiscovery::findStreamFactory();
163
+ }
164
+
165
+ return $this->streamFactory;
166
+ }
167
+
168
  /**
169
  * @return array
170
  */
171
  protected function getDefaultHeaders() {
172
+ $headers = [
173
+ 'User-Agent' => ApiConstants::SDK_USER_AGENT.'/'.ApiConstants::SDK_VERSION,
174
+ 'Content-Type' => 'application/json',
 
175
  ];
176
+
177
+ // Only adding it when provided. Not required for RestClientTest
178
+ if ($this->apiKey) {
179
+ $headers['X-MailerLite-ApiKey'] = $this->apiKey;
180
+ }
181
+
182
+ return $headers;
183
  }
184
+ }
vendor/mailerlite/mailerlite-api-v2-php-sdk/src/MailerLite.php CHANGED
@@ -8,6 +8,11 @@ use MailerLiteApi\Common\ApiConstants;
8
  use MailerLiteApi\Common\RestClient;
9
  use MailerLiteApi\Exceptions\MailerLiteSdkException;
10
 
 
 
 
 
 
11
  class MailerLite {
12
 
13
  /**
@@ -89,6 +94,11 @@ class MailerLite {
89
  return new \MailerLiteApi\Api\Settings($this->restClient);
90
  }
91
 
 
 
 
 
 
92
  /**
93
  * @return \MailerLiteApi\Api\Segments
94
  */
@@ -97,6 +107,14 @@ class MailerLite {
97
  return new \MailerLiteApi\Api\Segments($this->restClient);
98
  }
99
 
 
 
 
 
 
 
 
 
100
  /**
101
  * @param string $version
102
  * @return string
@@ -106,4 +124,4 @@ class MailerLite {
106
  return ApiConstants::BASE_URL . $version . '/';
107
  }
108
 
109
- }
8
  use MailerLiteApi\Common\RestClient;
9
  use MailerLiteApi\Exceptions\MailerLiteSdkException;
10
 
11
+ /**
12
+ * Class MailerLite
13
+ *
14
+ * @package MailerLiteApi
15
+ */
16
  class MailerLite {
17
 
18
  /**
94
  return new \MailerLiteApi\Api\Settings($this->restClient);
95
  }
96
 
97
+ public function woocommerce()
98
+ {
99
+ return new \MailerLiteApi\Api\WooCommerce($this->restClient);
100
+ }
101
+
102
  /**
103
  * @return \MailerLiteApi\Api\Segments
104
  */
107
  return new \MailerLiteApi\Api\Segments($this->restClient);
108
  }
109
 
110
+ /**
111
+ * @return \MailerLiteApi\Api\Batch
112
+ */
113
+ public function batch()
114
+ {
115
+ return new \MailerLiteApi\Api\Batch($this->restClient);
116
+ }
117
+
118
  /**
119
  * @param string $version
120
  * @return string
124
  return ApiConstants::BASE_URL . $version . '/';
125
  }
126
 
127
+ }
vendor/nyholm/psr7/CHANGELOG.md ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.5.1
6
+
7
+ ### Fixed
8
+
9
+ - Fixed deprecations on PHP 8.1
10
+
11
+ ## 1.5.0
12
+
13
+ ### Added
14
+
15
+ - Add explicit `@return mixed`
16
+ - Add explicit return types to HttplugFactory
17
+
18
+ ### Fixed
19
+
20
+ - Improve error handling with streams
21
+
22
+ ## 1.4.1
23
+
24
+ ### Fixed
25
+
26
+ - `Psr17Factory::createStreamFromFile`, `UploadedFile::moveTo`, and
27
+ `UploadedFile::getStream` no longer throw `ValueError` in PHP 8.
28
+
29
+ ## 1.4.0
30
+
31
+ ### Removed
32
+
33
+ The `final` keyword was replaced by `@final` annotation.
34
+
35
+ ## 1.3.2
36
+
37
+ ### Fixed
38
+
39
+ - `Stream::read()` must not return boolean.
40
+ - Improved exception message when using wrong HTTP status code.
41
+
42
+ ## 1.3.1
43
+
44
+ ### Fixed
45
+
46
+ - Allow installation on PHP8
47
+
48
+ ## 1.3.0
49
+
50
+ ### Added
51
+
52
+ - Make Stream::__toString() compatible with throwing exceptions on PHP 7.4.
53
+
54
+ ### Fixed
55
+
56
+ - Support for UTF-8 hostnames
57
+ - Support for numeric header names
58
+
59
+ ## 1.2.1
60
+
61
+ ### Changed
62
+
63
+ - Added `.github` and `phpstan.neon.dist` to `.gitattributes`.
64
+
65
+ ## 1.2.0
66
+
67
+ ### Changed
68
+
69
+ - Change minimal port number to 0 (unix socket)
70
+ - Updated `Psr17Factory::createResponse` to respect the specification. If second
71
+ argument is not used, a standard reason phrase. If an empty string is passed,
72
+ then the reason phrase will be empty.
73
+
74
+ ### Fixed
75
+
76
+ - Check for seekable on the stream resource.
77
+ - Fixed the `Response::$reason` should never be null.
78
+
79
+ ## 1.1.0
80
+
81
+ ### Added
82
+
83
+ - Improved performance
84
+ - More tests for `UploadedFile` and `HttplugFactory`
85
+
86
+ ### Removed
87
+
88
+ - Dead code
89
+
90
+ ## 1.0.1
91
+
92
+ ### Fixed
93
+
94
+ - Handle `fopen` failing in createStreamFromFile according to PSR-7.
95
+ - Reduce execution path to speed up performance.
96
+ - Fixed typos.
97
+ - Code style.
98
+
99
+ ## 1.0.0
100
+
101
+ ### Added
102
+
103
+ - Support for final PSR-17 (HTTP factories). (`Psr17Factory`)
104
+ - Support for numeric header values.
105
+ - Support for empty header values.
106
+ - All classes are final
107
+ - `HttplugFactory` that implements factory interfaces from HTTPlug.
108
+
109
+ ### Changed
110
+
111
+ - `ServerRequest` does not extend `Request`.
112
+
113
+ ### Removed
114
+
115
+ - The HTTPlug discovery strategy was removed since it is included in php-http/discovery 1.4.
116
+ - `UploadedFileFactory()` was removed in favor for `Psr17Factory`.
117
+ - `ServerRequestFactory()` was removed in favor for `Psr17Factory`.
118
+ - `StreamFactory`, `UriFactory`, abd `MessageFactory`. Use `HttplugFactory` instead.
119
+ - `ServerRequestFactory::createServerRequestFromArray`, `ServerRequestFactory::createServerRequestFromArrays` and
120
+ `ServerRequestFactory::createServerRequestFromGlobals`. Please use the new `nyholm/psr7-server` instead.
121
+
122
+ ## 0.3.0
123
+
124
+ ### Added
125
+
126
+ - Return types.
127
+ - Many `InvalidArgumentException`s are thrown when you use invalid arguments.
128
+ - Integration tests for `UploadedFile` and `ServerRequest`.
129
+
130
+ ### Changed
131
+
132
+ - We dropped PHP7.0 support.
133
+ - PSR-17 factories have been marked as internal. They do not fall under our BC promise until PSR-17 is accepted.
134
+ - `UploadedFileFactory::createUploadedFile` does not accept a string file path.
135
+
136
+ ## 0.2.3
137
+
138
+ No changelog before this release
vendor/{ralouphie/getallheaders → nyholm/psr7}/LICENSE RENAMED
@@ -1,6 +1,6 @@
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
1
+ MIT License
2
 
3
+ Copyright (c) 2016 Tobias Nyholm
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
vendor/nyholm/psr7/README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PSR-7 implementation
2
+
3
+ [![Latest Version](https://img.shields.io/github/release/Nyholm/psr7.svg?style=flat-square)](https://github.com/Nyholm/psr7/releases)
4
+ [![Build Status](https://img.shields.io/travis/Nyholm/psr7/master.svg?style=flat-square)](https://travis-ci.org/Nyholm/psr7)
5
+ [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/Nyholm/psr7.svg?style=flat-square)](https://scrutinizer-ci.com/g/Nyholm/psr7)
6
+ [![Quality Score](https://img.shields.io/scrutinizer/g/Nyholm/psr7.svg?style=flat-square)](https://scrutinizer-ci.com/g/Nyholm/psr7)
7
+ [![Total Downloads](https://poser.pugx.org/nyholm/psr7/downloads)](https://packagist.org/packages/nyholm/psr7)
8
+ [![Monthly Downloads](https://poser.pugx.org/nyholm/psr7/d/monthly.png)](https://packagist.org/packages/nyholm/psr7)
9
+ [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
10
+
11
+
12
+ A super lightweight PSR-7 implementation. Very strict and very fast.
13
+
14
+ | Description | Guzzle | Laminas | Slim | Nyholm |
15
+ | ---- | ------ | ---- | ---- | ------ |
16
+ | Lines of code | 3.300 | 3.100 | 1.900 | 1.000 |
17
+ | PSR-7* | 66% | 100% | 75% | 100% |
18
+ | PSR-17 | No | Yes | Yes | Yes |
19
+ | HTTPlug | No | No | No | Yes |
20
+ | Performance (runs per second)** | 14.553 | 14.703 | 13.416 | 17.734 |
21
+
22
+ \* Percent of completed tests in https://github.com/php-http/psr7-integration-tests
23
+
24
+ \** Benchmark with 50.000 runs. See https://github.com/devanych/psr-http-benchmark (higher is better)
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ composer require nyholm/psr7
30
+ ```
31
+
32
+ If you are using Symfony Flex then you get all message factories registered as services.
33
+
34
+ ## Usage
35
+
36
+ The PSR-7 objects do not contain any other public methods than those defined in
37
+ the [PSR-7 specification](https://www.php-fig.org/psr/psr-7/).
38
+
39
+ ### Create objects
40
+
41
+ Use the PSR-17 factory to create requests, streams, URIs etc.
42
+
43
+ ```php
44
+ $psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
45
+ $request = $psr17Factory->createRequest('GET', 'http://tnyholm.se');
46
+ $stream = $psr17Factory->createStream('foobar');
47
+ ```
48
+
49
+ ### Sending a request
50
+
51
+ With [HTTPlug](http://httplug.io/) or any other PSR-18 (HTTP client) you may send
52
+ requests like:
53
+
54
+ ```bash
55
+ composer require kriswallsmith/buzz
56
+ ```
57
+
58
+ ```php
59
+ $psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
60
+ $psr18Client = new \Buzz\Client\Curl($psr17Factory);
61
+
62
+ $request = $psr17Factory->createRequest('GET', 'http://tnyholm.se');
63
+ $response = $psr18Client->sendRequest($request);
64
+ ```
65
+
66
+ ### Create server requests
67
+
68
+ The [`nyholm/psr7-server`](https://github.com/Nyholm/psr7-server) package can be used
69
+ to create server requests from PHP superglobals.
70
+
71
+ ```bash
72
+ composer require nyholm/psr7-server
73
+ ```
74
+
75
+ ```php
76
+ $psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
77
+
78
+ $creator = new \Nyholm\Psr7Server\ServerRequestCreator(
79
+ $psr17Factory, // ServerRequestFactory
80
+ $psr17Factory, // UriFactory
81
+ $psr17Factory, // UploadedFileFactory
82
+ $psr17Factory // StreamFactory
83
+ );
84
+
85
+ $serverRequest = $creator->fromGlobals();
86
+ ```
87
+
88
+ ### Emitting a response
89
+
90
+ ```bash
91
+ composer require laminas/laminas-httphandlerrunner
92
+ ```
93
+
94
+ ```php
95
+ $psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
96
+
97
+ $responseBody = $psr17Factory->createStream('Hello world');
98
+ $response = $psr17Factory->createResponse(200)->withBody($responseBody);
99
+ (new \Laminas\HttpHandlerRunner\Emitter\SapiEmitter())->emit($response);
100
+ ```
101
+
102
+ ## Our goal
103
+
104
+ This package is currently maintained by [Tobias Nyholm](http://nyholm.se) and
105
+ [Martijn van der Ven](https://vanderven.se/martijn/). They have decided that the
106
+ goal of this library should be to provide a super strict implementation of
107
+ [PSR-7](https://www.php-fig.org/psr/psr-7/) that is blazing fast.
108
+
109
+ The package will never include any extra features nor helper methods. All our classes
110
+ and functions exist because they are required to fulfill the PSR-7 specification.
vendor/nyholm/psr7/src/Factory/HttplugFactory.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7\Factory;
6
+
7
+ use Http\Message\{MessageFactory, StreamFactory, UriFactory};
8
+ use Nyholm\Psr7\{Request, Response, Stream, Uri};
9
+ use Psr\Http\Message\RequestInterface;
10
+ use Psr\Http\Message\ResponseInterface;
11
+ use Psr\Http\Message\StreamInterface;
12
+ use Psr\Http\Message\UriInterface;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ * @author Martijn van der Ven <martijn@vanderven.se>
17
+ *
18
+ * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
19
+ */
20
+ class HttplugFactory implements MessageFactory, StreamFactory, UriFactory
21
+ {
22
+ public function createRequest($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1'): RequestInterface
23
+ {
24
+ return new Request($method, $uri, $headers, $body, $protocolVersion);
25
+ }
26
+
27
+ public function createResponse($statusCode = 200, $reasonPhrase = null, array $headers = [], $body = null, $version = '1.1'): ResponseInterface
28
+ {
29
+ return new Response((int) $statusCode, $headers, $body, $version, $reasonPhrase);
30
+ }
31
+
32
+ public function createStream($body = null): StreamInterface
33
+ {
34
+ return Stream::create($body ?? '');
35
+ }
36
+
37
+ public function createUri($uri = ''): UriInterface
38
+ {
39
+ if ($uri instanceof UriInterface) {
40
+ return $uri;
41
+ }
42
+
43
+ return new Uri($uri);
44
+ }
45
+ }
vendor/nyholm/psr7/src/Factory/Psr17Factory.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7\Factory;
6
+
7
+ use Nyholm\Psr7\{Request, Response, ServerRequest, Stream, UploadedFile, Uri};
8
+ use Psr\Http\Message\{RequestFactoryInterface, RequestInterface, ResponseFactoryInterface, ResponseInterface, ServerRequestFactoryInterface, ServerRequestInterface, StreamFactoryInterface, StreamInterface, UploadedFileFactoryInterface, UploadedFileInterface, UriFactoryInterface, UriInterface};
9
+
10
+ /**
11
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
12
+ * @author Martijn van der Ven <martijn@vanderven.se>
13
+ *
14
+ * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
15
+ */
16
+ class Psr17Factory implements RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface, UriFactoryInterface
17
+ {
18
+ public function createRequest(string $method, $uri): RequestInterface
19
+ {
20
+ return new Request($method, $uri);
21
+ }
22
+
23
+ public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
24
+ {
25
+ if (2 > \func_num_args()) {
26
+ // This will make the Response class to use a custom reasonPhrase
27
+ $reasonPhrase = null;
28
+ }
29
+
30
+ return new Response($code, [], null, '1.1', $reasonPhrase);
31
+ }
32
+
33
+ public function createStream(string $content = ''): StreamInterface
34
+ {
35
+ return Stream::create($content);
36
+ }
37
+
38
+ public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
39
+ {
40
+ if ('' === $filename) {
41
+ throw new \RuntimeException('Path cannot be empty');
42
+ }
43
+
44
+ if (false === $resource = @\fopen($filename, $mode)) {
45
+ if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) {
46
+ throw new \InvalidArgumentException(\sprintf('The mode "%s" is invalid.', $mode));
47
+ }
48
+
49
+ throw new \RuntimeException(\sprintf('The file "%s" cannot be opened: %s', $filename, \error_get_last()['message'] ?? ''));
50
+ }
51
+
52
+ return Stream::create($resource);
53
+ }
54
+
55
+ public function createStreamFromResource($resource): StreamInterface
56
+ {
57
+ return Stream::create($resource);
58
+ }
59
+
60
+ public function createUploadedFile(StreamInterface $stream, int $size = null, int $error = \UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null): UploadedFileInterface
61
+ {
62
+ if (null === $size) {
63
+ $size = $stream->getSize();
64
+ }
65
+
66
+ return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
67
+ }
68
+
69
+ public function createUri(string $uri = ''): UriInterface
70
+ {
71
+ return new Uri($uri);
72
+ }
73
+
74
+ public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
75
+ {
76
+ return new ServerRequest($method, $uri, [], null, '1.1', $serverParams);
77
+ }
78
+ }
vendor/nyholm/psr7/src/MessageTrait.php ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7;
6
+
7
+ use Psr\Http\Message\StreamInterface;
8
+
9
+ /**
10
+ * Trait implementing functionality common to requests and responses.
11
+ *
12
+ * @author Michael Dowling and contributors to guzzlehttp/psr7
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ * @author Martijn van der Ven <martijn@vanderven.se>
15
+ *
16
+ * @internal should not be used outside of Nyholm/Psr7 as it does not fall under our BC promise
17
+ */
18
+ trait MessageTrait
19
+ {
20
+ /** @var array Map of all registered headers, as original name => array of values */
21
+ private $headers = [];
22
+
23
+ /** @var array Map of lowercase header name => original name at registration */
24
+ private $headerNames = [];
25
+
26
+ /** @var string */
27
+ private $protocol = '1.1';
28
+
29
+ /** @var StreamInterface|null */
30
+ private $stream;
31
+
32
+ public function getProtocolVersion(): string
33
+ {
34
+ return $this->protocol;
35
+ }
36
+
37
+ public function withProtocolVersion($version): self
38
+ {
39
+ if ($this->protocol === $version) {
40
+ return $this;
41
+ }
42
+
43
+ $new = clone $this;
44
+ $new->protocol = $version;
45
+
46
+ return $new;
47
+ }
48
+
49
+ public function getHeaders(): array
50
+ {
51
+ return $this->headers;
52
+ }
53
+
54
+ public function hasHeader($header): bool
55
+ {
56
+ return isset($this->headerNames[\strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]);
57
+ }
58
+
59
+ public function getHeader($header): array
60
+ {
61
+ $header = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
62
+ if (!isset($this->headerNames[$header])) {
63
+ return [];
64
+ }
65
+
66
+ $header = $this->headerNames[$header];
67
+
68
+ return $this->headers[$header];
69
+ }
70
+
71
+ public function getHeaderLine($header): string
72
+ {
73
+ return \implode(', ', $this->getHeader($header));
74
+ }
75
+
76
+ public function withHeader($header, $value): self
77
+ {
78
+ $value = $this->validateAndTrimHeader($header, $value);
79
+ $normalized = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
80
+
81
+ $new = clone $this;
82
+ if (isset($new->headerNames[$normalized])) {
83
+ unset($new->headers[$new->headerNames[$normalized]]);
84
+ }
85
+ $new->headerNames[$normalized] = $header;
86
+ $new->headers[$header] = $value;
87
+
88
+ return $new;
89
+ }
90
+
91
+ public function withAddedHeader($header, $value): self
92
+ {
93
+ if (!\is_string($header) || '' === $header) {
94
+ throw new \InvalidArgumentException('Header name must be an RFC 7230 compatible string.');
95
+ }
96
+
97
+ $new = clone $this;
98
+ $new->setHeaders([$header => $value]);
99
+
100
+ return $new;
101
+ }
102
+
103
+ public function withoutHeader($header): self
104
+ {
105
+ $normalized = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
106
+ if (!isset($this->headerNames[$normalized])) {
107
+ return $this;
108
+ }
109
+
110
+ $header = $this->headerNames[$normalized];
111
+ $new = clone $this;
112
+ unset($new->headers[$header], $new->headerNames[$normalized]);
113
+
114
+ return $new;
115
+ }
116
+
117
+ public function getBody(): StreamInterface
118
+ {
119
+ if (null === $this->stream) {
120
+ $this->stream = Stream::create('');
121
+ }
122
+
123
+ return $this->stream;
124
+ }
125
+
126
+ public function withBody(StreamInterface $body): self
127
+ {
128
+ if ($body === $this->stream) {
129
+ return $this;
130
+ }
131
+
132
+ $new = clone $this;
133
+ $new->stream = $body;
134
+
135
+ return $new;
136
+ }
137
+
138
+ private function setHeaders(array $headers): void
139
+ {
140
+ foreach ($headers as $header => $value) {
141
+ if (\is_int($header)) {
142
+ // If a header name was set to a numeric string, PHP will cast the key to an int.
143
+ // We must cast it back to a string in order to comply with validation.
144
+ $header = (string) $header;
145
+ }
146
+ $value = $this->validateAndTrimHeader($header, $value);
147
+ $normalized = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
148
+ if (isset($this->headerNames[$normalized])) {
149
+ $header = $this->headerNames[$normalized];
150
+ $this->headers[$header] = \array_merge($this->headers[$header], $value);
151
+ } else {
152
+ $this->headerNames[$normalized] = $header;
153
+ $this->headers[$header] = $value;
154
+ }
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Make sure the header complies with RFC 7230.
160
+ *
161
+ * Header names must be a non-empty string consisting of token characters.
162
+ *
163
+ * Header values must be strings consisting of visible characters with all optional
164
+ * leading and trailing whitespace stripped. This method will always strip such
165
+ * optional whitespace. Note that the method does not allow folding whitespace within
166
+ * the values as this was deprecated for almost all instances by the RFC.
167
+ *
168
+ * header-field = field-name ":" OWS field-value OWS
169
+ * field-name = 1*( "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^"
170
+ * / "_" / "`" / "|" / "~" / %x30-39 / ( %x41-5A / %x61-7A ) )
171
+ * OWS = *( SP / HTAB )
172
+ * field-value = *( ( %x21-7E / %x80-FF ) [ 1*( SP / HTAB ) ( %x21-7E / %x80-FF ) ] )
173
+ *
174
+ * @see https://tools.ietf.org/html/rfc7230#section-3.2.4
175
+ */
176
+ private function validateAndTrimHeader($header, $values): array
177
+ {
178
+ if (!\is_string($header) || 1 !== \preg_match("@^[!#$%&'*+.^_`|~0-9A-Za-z-]+$@", $header)) {
179
+ throw new \InvalidArgumentException('Header name must be an RFC 7230 compatible string.');
180
+ }
181
+
182
+ if (!\is_array($values)) {
183
+ // This is simple, just one value.
184
+ if ((!\is_numeric($values) && !\is_string($values)) || 1 !== \preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $values)) {
185
+ throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings.');
186
+ }
187
+
188
+ return [\trim((string) $values, " \t")];
189
+ }
190
+
191
+ if (empty($values)) {
192
+ throw new \InvalidArgumentException('Header values must be a string or an array of strings, empty array given.');
193
+ }
194
+
195
+ // Assert Non empty array
196
+ $returnValues = [];
197
+ foreach ($values as $v) {
198
+ if ((!\is_numeric($v) && !\is_string($v)) || 1 !== \preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $v)) {
199
+ throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings.');
200
+ }
201
+
202
+ $returnValues[] = \trim((string) $v, " \t");
203
+ }
204
+
205
+ return $returnValues;
206
+ }
207
+ }
vendor/nyholm/psr7/src/Request.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7;
6
+
7
+ use Psr\Http\Message\{RequestInterface, StreamInterface, UriInterface};
8
+
9
+ /**
10
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
11
+ * @author Martijn van der Ven <martijn@vanderven.se>
12
+ *
13
+ * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
14
+ */
15
+ class Request implements RequestInterface
16
+ {
17
+ use MessageTrait;
18
+ use RequestTrait;
19
+
20
+ /**
21
+ * @param string $method HTTP method
22
+ * @param string|UriInterface $uri URI
23
+ * @param array $headers Request headers
24
+ * @param string|resource|StreamInterface|null $body Request body
25
+ * @param string $version Protocol version
26
+ */
27
+ public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1')
28
+ {
29
+ if (!($uri instanceof UriInterface)) {
30
+ $uri = new Uri($uri);
31
+ }
32
+
33
+ $this->method = $method;
34
+ $this->uri = $uri;
35
+ $this->setHeaders($headers);
36
+ $this->protocol = $version;
37
+
38
+ if (!$this->hasHeader('Host')) {
39
+ $this->updateHostFromUri();
40
+ }
41
+
42
+ // If we got no body, defer initialization of the stream until Request::getBody()
43
+ if ('' !== $body && null !== $body) {
44
+ $this->stream = Stream::create($body);
45
+ }
46
+ }
47
+ }
vendor/nyholm/psr7/src/RequestTrait.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7;
6
+
7
+ use Psr\Http\Message\UriInterface;
8
+
9
+ /**
10
+ * @author Michael Dowling and contributors to guzzlehttp/psr7
11
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
12
+ * @author Martijn van der Ven <martijn@vanderven.se>
13
+ *
14
+ * @internal should not be used outside of Nyholm/Psr7 as it does not fall under our BC promise
15
+ */
16
+ trait RequestTrait
17
+ {
18
+ /** @var string */
19
+ private $method;
20
+
21
+ /** @var string|null */
22
+ private $requestTarget;
23
+
24
+ /** @var UriInterface|null */
25
+ private $uri;
26
+
27
+ public function getRequestTarget(): string
28
+ {
29
+ if (null !== $this->requestTarget) {
30
+ return $this->requestTarget;
31
+ }
32
+
33
+ if ('' === $target = $this->uri->getPath()) {
34
+ $target = '/';
35
+ }
36
+ if ('' !== $this->uri->getQuery()) {
37
+ $target .= '?' . $this->uri->getQuery();
38
+ }
39
+
40
+ return $target;
41
+ }
42
+
43
+ public function withRequestTarget($requestTarget): self
44
+ {
45
+ if (\preg_match('#\s#', $requestTarget)) {
46
+ throw new \InvalidArgumentException('Invalid request target provided; cannot contain whitespace');
47
+ }
48
+
49
+ $new = clone $this;
50
+ $new->requestTarget = $requestTarget;
51
+
52
+ return $new;
53
+ }
54
+
55
+ public function getMethod(): string
56
+ {
57
+ return $this->method;
58
+ }
59
+
60
+ public function withMethod($method): self
61
+ {
62
+ if (!\is_string($method)) {
63
+ throw new \InvalidArgumentException('Method must be a string');
64
+ }
65
+
66
+ $new = clone $this;
67
+ $new->method = $method;
68
+
69
+ return $new;
70
+ }
71
+
72
+ public function getUri(): UriInterface
73
+ {
74
+ return $this->uri;
75
+ }
76
+
77
+ public function withUri(UriInterface $uri, $preserveHost = false): self
78
+ {
79
+ if ($uri === $this->uri) {
80
+ return $this;
81
+ }
82
+
83
+ $new = clone $this;
84
+ $new->uri = $uri;
85
+
86
+ if (!$preserveHost || !$this->hasHeader('Host')) {
87
+ $new->updateHostFromUri();
88
+ }
89
+
90
+ return $new;
91
+ }
92
+
93
+ private function updateHostFromUri(): void
94
+ {
95
+ if ('' === $host = $this->uri->getHost()) {
96
+ return;
97
+ }
98
+
99
+ if (null !== ($port = $this->uri->getPort())) {
100
+ $host .= ':' . $port;
101
+ }
102
+
103
+ if (isset($this->headerNames['host'])) {
104
+ $header = $this->headerNames['host'];
105
+ } else {
106
+ $this->headerNames['host'] = $header = 'Host';
107
+ }
108
+
109
+ // Ensure Host is the first header.
110
+ // See: http://tools.ietf.org/html/rfc7230#section-5.4
111
+ $this->headers = [$header => [$host]] + $this->headers;
112
+ }
113
+ }
vendor/nyholm/psr7/src/Response.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7;
6
+
7
+ use Psr\Http\Message\{ResponseInterface, StreamInterface};
8
+
9
+ /**
10
+ * @author Michael Dowling and contributors to guzzlehttp/psr7
11
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
12
+ * @author Martijn van der Ven <martijn@vanderven.se>
13
+ *
14
+ * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
15
+ */
16
+ class Response implements ResponseInterface
17
+ {
18
+ use MessageTrait;
19
+
20
+ /** @var array Map of standard HTTP status code/reason phrases */
21
+ private const PHRASES = [
22
+ 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing',
23
+ 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported',
24
+ 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect',
25
+ 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons',
26
+ 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 511 => 'Network Authentication Required',
27
+ ];
28
+
29
+ /** @var string */
30
+ private $reasonPhrase = '';
31
+
32
+ /** @var int */
33
+ private $statusCode;
34
+
35
+ /**
36
+ * @param int $status Status code
37
+ * @param array $headers Response headers
38
+ * @param string|resource|StreamInterface|null $body Response body
39
+ * @param string $version Protocol version
40
+ * @param string|null $reason Reason phrase (when empty a default will be used based on the status code)
41
+ */
42
+ public function __construct(int $status = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
43
+ {
44
+ // If we got no body, defer initialization of the stream until Response::getBody()
45
+ if ('' !== $body && null !== $body) {
46
+ $this->stream = Stream::create($body);
47
+ }
48
+
49
+ $this->statusCode = $status;
50
+ $this->setHeaders($headers);
51
+ if (null === $reason && isset(self::PHRASES[$this->statusCode])) {
52
+ $this->reasonPhrase = self::PHRASES[$status];
53
+ } else {
54
+ $this->reasonPhrase = $reason ?? '';
55
+ }
56
+
57
+ $this->protocol = $version;
58
+ }
59
+
60
+ public function getStatusCode(): int
61
+ {
62
+ return $this->statusCode;
63
+ }
64
+
65
+ public function getReasonPhrase(): string
66
+ {
67
+ return $this->reasonPhrase;
68
+ }
69
+
70
+ public function withStatus($code, $reasonPhrase = ''): self
71
+ {
72
+ if (!\is_int($code) && !\is_string($code)) {
73
+ throw new \InvalidArgumentException('Status code has to be an integer');
74
+ }
75
+
76
+ $code = (int) $code;
77
+ if ($code < 100 || $code > 599) {
78
+ throw new \InvalidArgumentException(\sprintf('Status code has to be an integer between 100 and 599. A status code of %d was given', $code));
79
+ }
80
+
81
+ $new = clone $this;
82
+ $new->statusCode = $code;
83
+ if ((null === $reasonPhrase || '' === $reasonPhrase) && isset(self::PHRASES[$new->statusCode])) {
84
+ $reasonPhrase = self::PHRASES[$new->statusCode];
85
+ }
86
+ $new->reasonPhrase = $reasonPhrase;
87
+
88
+ return $new;
89
+ }
90
+ }
vendor/nyholm/psr7/src/ServerRequest.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7;
6
+
7
+ use Psr\Http\Message\{ServerRequestInterface, StreamInterface, UploadedFileInterface, UriInterface};
8
+
9
+ /**
10
+ * @author Michael Dowling and contributors to guzzlehttp/psr7
11
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
12
+ * @author Martijn van der Ven <martijn@vanderven.se>
13
+ *
14
+ * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
15
+ */
16
+ class ServerRequest implements ServerRequestInterface
17
+ {
18
+ use MessageTrait;
19
+ use RequestTrait;
20
+
21
+ /** @var array */
22
+ private $attributes = [];
23
+
24
+ /** @var array */
25
+ private $cookieParams = [];
26
+
27
+ /** @var array|object|null */
28
+ private $parsedBody;
29
+
30
+ /** @var array */
31
+ private $queryParams = [];
32
+
33
+ /** @var array */
34
+ private $serverParams;
35
+
36
+ /** @var UploadedFileInterface[] */
37
+ private $uploadedFiles = [];
38
+
39
+ /**
40
+ * @param string $method HTTP method
41
+ * @param string|UriInterface $uri URI
42
+ * @param array $headers Request headers
43
+ * @param string|resource|StreamInterface|null $body Request body
44
+ * @param string $version Protocol version
45
+ * @param array $serverParams Typically the $_SERVER superglobal
46
+ */
47
+ public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1', array $serverParams = [])
48
+ {
49
+ $this->serverParams = $serverParams;
50
+
51
+ if (!($uri instanceof UriInterface)) {
52
+ $uri = new Uri($uri);
53
+ }
54
+
55
+ $this->method = $method;
56
+ $this->uri = $uri;
57
+ $this->setHeaders($headers);
58
+ $this->protocol = $version;
59
+
60
+ if (!$this->hasHeader('Host')) {
61
+ $this->updateHostFromUri();
62
+ }
63
+
64
+ // If we got no body, defer initialization of the stream until ServerRequest::getBody()
65
+ if ('' !== $body && null !== $body) {
66
+ $this->stream = Stream::create($body);
67
+ }
68
+ }
69
+
70
+ public function getServerParams(): array
71
+ {
72
+ return $this->serverParams;
73
+ }
74
+
75
+ public function getUploadedFiles(): array
76
+ {
77
+ return $this->uploadedFiles;
78
+ }
79
+
80
+ /**
81
+ * @return static
82
+ */
83
+ public function withUploadedFiles(array $uploadedFiles)
84
+ {
85
+ $new = clone $this;
86
+ $new->uploadedFiles = $uploadedFiles;
87
+
88
+ return $new;
89
+ }
90
+
91
+ public function getCookieParams(): array
92
+ {
93
+ return $this->cookieParams;
94
+ }
95
+
96
+ /**
97
+ * @return static
98
+ */
99
+ public function withCookieParams(array $cookies)
100
+ {
101
+ $new = clone $this;
102
+ $new->cookieParams = $cookies;
103
+
104
+ return $new;
105
+ }
106
+
107
+ public function getQueryParams(): array
108
+ {
109
+ return $this->queryParams;
110
+ }
111
+
112
+ /**
113
+ * @return static
114
+ */
115
+ public function withQueryParams(array $query)
116
+ {
117
+ $new = clone $this;
118
+ $new->queryParams = $query;
119
+
120
+ return $new;
121
+ }
122
+
123
+ /**
124
+ * @return array|object|null
125
+ */
126
+ public function getParsedBody()
127
+ {
128
+ return $this->parsedBody;
129
+ }
130
+
131
+ /**
132
+ * @return static
133
+ */
134
+ public function withParsedBody($data)
135
+ {
136
+ if (!\is_array($data) && !\is_object($data) && null !== $data) {
137
+ throw new \InvalidArgumentException('First parameter to withParsedBody MUST be object, array or null');
138
+ }
139
+
140
+ $new = clone $this;
141
+ $new->parsedBody = $data;
142
+
143
+ return $new;
144
+ }
145
+
146
+ public function getAttributes(): array
147
+ {
148
+ return $this->attributes;
149
+ }
150
+
151
+ /**
152
+ * @return mixed
153
+ */
154
+ public function getAttribute($attribute, $default = null)
155
+ {
156
+ if (false === \array_key_exists($attribute, $this->attributes)) {
157
+ return $default;
158
+ }
159
+
160
+ return $this->attributes[$attribute];
161
+ }
162
+
163
+ public function withAttribute($attribute, $value): self
164
+ {
165
+ $new = clone $this;
166
+ $new->attributes[$attribute] = $value;
167
+
168
+ return $new;
169
+ }
170
+
171
+ public function withoutAttribute($attribute): self
172
+ {
173
+ if (false === \array_key_exists($attribute, $this->attributes)) {
174
+ return $this;
175
+ }
176
+
177
+ $new = clone $this;
178
+ unset($new->attributes[$attribute]);
179
+
180
+ return $new;
181
+ }
182
+ }
vendor/nyholm/psr7/src/Stream.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7;
6
+
7
+ use Psr\Http\Message\StreamInterface;
8
+ use Symfony\Component\Debug\ErrorHandler as SymfonyLegacyErrorHandler;
9
+ use Symfony\Component\ErrorHandler\ErrorHandler as SymfonyErrorHandler;
10
+
11
+ /**
12
+ * @author Michael Dowling and contributors to guzzlehttp/psr7
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ * @author Martijn van der Ven <martijn@vanderven.se>
15
+ *
16
+ * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
17
+ */
18
+ class Stream implements StreamInterface
19
+ {
20
+ /** @var resource|null A resource reference */
21
+ private $stream;
22
+
23
+ /** @var bool */
24
+ private $seekable;
25
+
26
+ /** @var bool */
27
+ private $readable;
28
+
29
+ /** @var bool */
30
+ private $writable;
31
+
32
+ /** @var array|mixed|void|bool|null */
33
+ private $uri;
34
+
35
+ /** @var int|null */
36
+ private $size;
37
+
38
+ /** @var array Hash of readable and writable stream types */
39
+ private const READ_WRITE_HASH = [
40
+ 'read' => [
41
+ 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
42
+ 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
43
+ 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true,
44
+ 'x+t' => true, 'c+t' => true, 'a+' => true,
45
+ ],
46
+ 'write' => [
47
+ 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true,
48
+ 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true,
49
+ 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true,
50
+ 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true,
51
+ ],
52
+ ];
53
+
54
+ private function __construct()
55
+ {
56
+ }
57
+
58
+ /**
59
+ * Creates a new PSR-7 stream.
60
+ *
61
+ * @param string|resource|StreamInterface $body
62
+ *
63
+ * @throws \InvalidArgumentException
64
+ */
65
+ public static function create($body = ''): StreamInterface
66
+ {
67
+ if ($body instanceof StreamInterface) {
68
+ return $body;
69
+ }
70
+
71
+ if (\is_string($body)) {
72
+ $resource = \fopen('php://temp', 'rw+');
73
+ \fwrite($resource, $body);
74
+ $body = $resource;
75
+ }
76
+
77
+ if (\is_resource($body)) {
78
+ $new = new self();
79
+ $new->stream = $body;
80
+ $meta = \stream_get_meta_data($new->stream);
81
+ $new->seekable = $meta['seekable'] && 0 === \fseek($new->stream, 0, \SEEK_CUR);
82
+ $new->readable = isset(self::READ_WRITE_HASH['read'][$meta['mode']]);
83
+ $new->writable = isset(self::READ_WRITE_HASH['write'][$meta['mode']]);
84
+
85
+ return $new;
86
+ }
87
+
88
+ throw new \InvalidArgumentException('First argument to Stream::create() must be a string, resource or StreamInterface.');
89
+ }
90
+
91
+ /**
92
+ * Closes the stream when the destructed.
93
+ */
94
+ public function __destruct()
95
+ {
96
+ $this->close();
97
+ }
98
+
99
+ /**
100
+ * @return string
101
+ */
102
+ public function __toString()
103
+ {
104
+ try {
105
+ if ($this->isSeekable()) {
106
+ $this->seek(0);
107
+ }
108
+
109
+ return $this->getContents();
110
+ } catch (\Throwable $e) {
111
+ if (\PHP_VERSION_ID >= 70400) {
112
+ throw $e;
113
+ }
114
+
115
+ if (\is_array($errorHandler = \set_error_handler('var_dump'))) {
116
+ $errorHandler = $errorHandler[0] ?? null;
117
+ }
118
+ \restore_error_handler();
119
+
120
+ if ($e instanceof \Error || $errorHandler instanceof SymfonyErrorHandler || $errorHandler instanceof SymfonyLegacyErrorHandler) {
121
+ return \trigger_error((string) $e, \E_USER_ERROR);
122
+ }
123
+
124
+ return '';
125
+ }
126
+ }
127
+
128
+ public function close(): void
129
+ {
130
+ if (isset($this->stream)) {
131
+ if (\is_resource($this->stream)) {
132
+ \fclose($this->stream);
133
+ }
134
+ $this->detach();
135
+ }
136
+ }
137
+
138
+ public function detach()
139
+ {
140
+ if (!isset($this->stream)) {
141
+ return null;
142
+ }
143
+
144
+ $result = $this->stream;
145
+ unset($this->stream);
146
+ $this->size = $this->uri = null;
147
+ $this->readable = $this->writable = $this->seekable = false;
148
+
149
+ return $result;
150
+ }
151
+
152
+ private function getUri()
153
+ {
154
+ if (false !== $this->uri) {
155
+ $this->uri = $this->getMetadata('uri') ?? false;
156
+ }
157
+
158
+ return $this->uri;
159
+ }
160
+
161
+ public function getSize(): ?int
162
+ {
163
+ if (null !== $this->size) {
164
+ return $this->size;
165
+ }
166
+
167
+ if (!isset($this->stream)) {
168
+ return null;
169
+ }
170
+
171
+ // Clear the stat cache if the stream has a URI
172
+ if ($uri = $this->getUri()) {
173
+ \clearstatcache(true, $uri);
174
+ }
175
+
176
+ $stats = \fstat($this->stream);
177
+ if (isset($stats['size'])) {
178
+ $this->size = $stats['size'];
179
+
180
+ return $this->size;
181
+ }
182
+
183
+ return null;
184
+ }
185
+
186
+ public function tell(): int
187
+ {
188
+ if (!isset($this->stream)) {
189
+ throw new \RuntimeException('Stream is detached');
190
+ }
191
+
192
+ if (false === $result = @\ftell($this->stream)) {
193
+ throw new \RuntimeException('Unable to determine stream position: ' . (\error_get_last()['message'] ?? ''));
194
+ }
195
+
196
+ return $result;
197
+ }
198
+
199
+ public function eof(): bool
200
+ {
201
+ return !isset($this->stream) || \feof($this->stream);
202
+ }
203
+
204
+ public function isSeekable(): bool
205
+ {
206
+ return $this->seekable;
207
+ }
208
+
209
+ public function seek($offset, $whence = \SEEK_SET): void
210
+ {
211
+ if (!isset($this->stream)) {
212
+ throw new \RuntimeException('Stream is detached');
213
+ }
214
+
215
+ if (!$this->seekable) {
216
+ throw new \RuntimeException('Stream is not seekable');
217
+ }
218
+
219
+ if (-1 === \fseek($this->stream, $offset, $whence)) {
220
+ throw new \RuntimeException('Unable to seek to stream position "' . $offset . '" with whence ' . \var_export($whence, true));
221
+ }
222
+ }
223
+
224
+ public function rewind(): void
225
+ {
226
+ $this->seek(0);
227
+ }
228
+
229
+ public function isWritable(): bool
230
+ {
231
+ return $this->writable;
232
+ }
233
+
234
+ public function write($string): int
235
+ {
236
+ if (!isset($this->stream)) {
237
+ throw new \RuntimeException('Stream is detached');
238
+ }
239
+
240
+ if (!$this->writable) {
241
+ throw new \RuntimeException('Cannot write to a non-writable stream');
242
+ }
243
+
244
+ // We can't know the size after writing anything
245
+ $this->size = null;
246
+
247
+ if (false === $result = @\fwrite($this->stream, $string)) {
248
+ throw new \RuntimeException('Unable to write to stream: ' . (\error_get_last()['message'] ?? ''));
249
+ }
250
+
251
+ return $result;
252
+ }
253
+
254
+ public function isReadable(): bool
255
+ {
256
+ return $this->readable;
257
+ }
258
+
259
+ public function read($length): string
260
+ {
261
+ if (!isset($this->stream)) {
262
+ throw new \RuntimeException('Stream is detached');
263
+ }
264
+
265
+ if (!$this->readable) {
266
+ throw new \RuntimeException('Cannot read from non-readable stream');
267
+ }
268
+
269
+ if (false === $result = @\fread($this->stream, $length)) {
270
+ throw new \RuntimeException('Unable to read from stream: ' . (\error_get_last()['message'] ?? ''));
271
+ }
272
+
273
+ return $result;
274
+ }
275
+
276
+ public function getContents(): string
277
+ {
278
+ if (!isset($this->stream)) {
279
+ throw new \RuntimeException('Stream is detached');
280
+ }
281
+
282
+ if (false === $contents = @\stream_get_contents($this->stream)) {
283
+ throw new \RuntimeException('Unable to read stream contents: ' . (\error_get_last()['message'] ?? ''));
284
+ }
285
+
286
+ return $contents;
287
+ }
288
+
289
+ /**
290
+ * @return mixed
291
+ */
292
+ public function getMetadata($key = null)
293
+ {
294
+ if (!isset($this->stream)) {
295
+ return $key ? null : [];
296
+ }
297
+
298
+ $meta = \stream_get_meta_data($this->stream);
299
+
300
+ if (null === $key) {
301
+ return $meta;
302
+ }
303
+
304
+ return $meta[$key] ?? null;
305
+ }
306
+ }
vendor/nyholm/psr7/src/UploadedFile.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7;
6
+
7
+ use Psr\Http\Message\{StreamInterface, UploadedFileInterface};
8
+
9
+ /**
10
+ * @author Michael Dowling and contributors to guzzlehttp/psr7
11
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
12
+ * @author Martijn van der Ven <martijn@vanderven.se>
13
+ *
14
+ * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
15
+ */
16
+ class UploadedFile implements UploadedFileInterface
17
+ {
18
+ /** @var array */
19
+ private const ERRORS = [
20
+ \UPLOAD_ERR_OK => 1,
21
+ \UPLOAD_ERR_INI_SIZE => 1,
22
+ \UPLOAD_ERR_FORM_SIZE => 1,
23
+ \UPLOAD_ERR_PARTIAL => 1,
24
+ \UPLOAD_ERR_NO_FILE => 1,
25
+ \UPLOAD_ERR_NO_TMP_DIR => 1,
26
+ \UPLOAD_ERR_CANT_WRITE => 1,
27
+ \UPLOAD_ERR_EXTENSION => 1,
28
+ ];
29
+
30
+ /** @var string */
31
+ private $clientFilename;
32
+
33
+ /** @var string */
34
+ private $clientMediaType;
35
+
36
+ /** @var int */
37
+ private $error;
38
+
39
+ /** @var string|null */
40
+ private $file;
41
+
42
+ /** @var bool */
43
+ private $moved = false;
44
+
45
+ /** @var int */
46
+ private $size;
47
+
48
+ /** @var StreamInterface|null */
49
+ private $stream;
50
+
51
+ /**
52
+ * @param StreamInterface|string|resource $streamOrFile
53
+ * @param int $size
54
+ * @param int $errorStatus
55
+ * @param string|null $clientFilename
56
+ * @param string|null $clientMediaType
57
+ */
58
+ public function __construct($streamOrFile, $size, $errorStatus, $clientFilename = null, $clientMediaType = null)
59
+ {
60
+ if (false === \is_int($errorStatus) || !isset(self::ERRORS[$errorStatus])) {
61
+ throw new \InvalidArgumentException('Upload file error status must be an integer value and one of the "UPLOAD_ERR_*" constants.');
62
+ }
63
+
64
+ if (false === \is_int($size)) {
65
+ throw new \InvalidArgumentException('Upload file size must be an integer');
66
+ }
67
+
68
+ if (null !== $clientFilename && !\is_string($clientFilename)) {
69
+ throw new \InvalidArgumentException('Upload file client filename must be a string or null');
70
+ }
71
+
72
+ if (null !== $clientMediaType && !\is_string($clientMediaType)) {
73
+ throw new \InvalidArgumentException('Upload file client media type must be a string or null');
74
+ }
75
+
76
+ $this->error = $errorStatus;
77
+ $this->size = $size;
78
+ $this->clientFilename = $clientFilename;
79
+ $this->clientMediaType = $clientMediaType;
80
+
81
+ if (\UPLOAD_ERR_OK === $this->error) {
82
+ // Depending on the value set file or stream variable.
83
+ if (\is_string($streamOrFile) && '' !== $streamOrFile) {
84
+ $this->file = $streamOrFile;
85
+ } elseif (\is_resource($streamOrFile)) {
86
+ $this->stream = Stream::create($streamOrFile);
87
+ } elseif ($streamOrFile instanceof StreamInterface) {
88
+ $this->stream = $streamOrFile;
89
+ } else {
90
+ throw new \InvalidArgumentException('Invalid stream or file provided for UploadedFile');
91
+ }
92
+ }
93
+ }
94
+
95
+ /**
96
+ * @throws \RuntimeException if is moved or not ok
97
+ */
98
+ private function validateActive(): void
99
+ {
100
+ if (\UPLOAD_ERR_OK !== $this->error) {
101
+ throw new \RuntimeException('Cannot retrieve stream due to upload error');
102
+ }
103
+
104
+ if ($this->moved) {
105
+ throw new \RuntimeException('Cannot retrieve stream after it has already been moved');
106
+ }
107
+ }
108
+
109
+ public function getStream(): StreamInterface
110
+ {
111
+ $this->validateActive();
112
+
113
+ if ($this->stream instanceof StreamInterface) {
114
+ return $this->stream;
115
+ }
116
+
117
+ if (false === $resource = @\fopen($this->file, 'r')) {
118
+ throw new \RuntimeException(\sprintf('The file "%s" cannot be opened: %s', $this->file, \error_get_last()['message'] ?? ''));
119
+ }
120
+
121
+ return Stream::create($resource);
122
+ }
123
+
124
+ public function moveTo($targetPath): void
125
+ {
126
+ $this->validateActive();
127
+
128
+ if (!\is_string($targetPath) || '' === $targetPath) {
129
+ throw new \InvalidArgumentException('Invalid path provided for move operation; must be a non-empty string');
130
+ }
131
+
132
+ if (null !== $this->file) {
133
+ $this->moved = 'cli' === \PHP_SAPI ? @\rename($this->file, $targetPath) : @\move_uploaded_file($this->file, $targetPath);
134
+
135
+ if (false === $this->moved) {
136
+ throw new \RuntimeException(\sprintf('Uploaded file could not be moved to "%s": %s', $targetPath, \error_get_last()['message'] ?? ''));
137
+ }
138
+ } else {
139
+ $stream = $this->getStream();
140
+ if ($stream->isSeekable()) {
141
+ $stream->rewind();
142
+ }
143
+
144
+ if (false === $resource = @\fopen($targetPath, 'w')) {
145
+ throw new \RuntimeException(\sprintf('The file "%s" cannot be opened: %s', $targetPath, \error_get_last()['message'] ?? ''));
146
+ }
147
+
148
+ $dest = Stream::create($resource);
149
+
150
+ while (!$stream->eof()) {
151
+ if (!$dest->write($stream->read(1048576))) {
152
+ break;
153
+ }
154
+ }
155
+
156
+ $this->moved = true;
157
+ }
158
+ }
159
+
160
+ public function getSize(): int
161
+ {
162
+ return $this->size;
163
+ }
164
+
165
+ public function getError(): int
166
+ {
167
+ return $this->error;
168
+ }
169
+
170
+ public function getClientFilename(): ?string
171
+ {
172
+ return $this->clientFilename;
173
+ }
174
+
175
+ public function getClientMediaType(): ?string
176
+ {
177
+ return $this->clientMediaType;
178
+ }
179
+ }
vendor/nyholm/psr7/src/Uri.php ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Nyholm\Psr7;
6
+
7
+ use Psr\Http\Message\UriInterface;
8
+
9
+ /**
10
+ * PSR-7 URI implementation.
11
+ *
12
+ * @author Michael Dowling
13
+ * @author Tobias Schultze
14
+ * @author Matthew Weier O'Phinney
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ * @author Martijn van der Ven <martijn@vanderven.se>
17
+ *
18
+ * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
19
+ */
20
+ class Uri implements UriInterface
21
+ {
22
+ private const SCHEMES = ['http' => 80, 'https' => 443];
23
+
24
+ private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
25
+
26
+ private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
27
+
28
+ /** @var string Uri scheme. */
29
+ private $scheme = '';
30
+
31
+ /** @var string Uri user info. */
32
+ private $userInfo = '';
33
+
34
+ /** @var string Uri host. */
35
+ private $host = '';
36
+
37
+ /** @var int|null Uri port. */
38
+ private $port;
39
+
40
+ /** @var string Uri path. */
41
+ private $path = '';
42
+
43
+ /** @var string Uri query string. */
44
+ private $query = '';
45
+
46
+ /** @var string Uri fragment. */
47
+ private $fragment = '';
48
+
49
+ public function __construct(string $uri = '')
50
+ {
51
+ if ('' !== $uri) {
52
+ if (false === $parts = \parse_url($uri)) {
53
+ throw new \InvalidArgumentException(\sprintf('Unable to parse URI: "%s"', $uri));
54
+ }
55
+
56
+ // Apply parse_url parts to a URI.
57
+ $this->scheme = isset($parts['scheme']) ? \strtr($parts['scheme'], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') : '';
58
+ $this->userInfo = $parts['user'] ?? '';
59
+ $this->host = isset($parts['host']) ? \strtr($parts['host'], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') : '';
60
+ $this->port = isset($parts['port']) ? $this->filterPort($parts['port']) : null;
61
+ $this->path = isset($parts['path']) ? $this->filterPath($parts['path']) : '';
62
+ $this->query = isset($parts['query']) ? $this->filterQueryAndFragment($parts['query']) : '';
63
+ $this->fragment = isset($parts['fragment']) ? $this->filterQueryAndFragment($parts['fragment']) : '';
64
+ if (isset($parts['pass'])) {
65
+ $this->userInfo .= ':' . $parts['pass'];
66
+ }
67
+ }
68
+ }
69
+
70
+ public function __toString(): string
71
+ {
72
+ return self::createUriString($this->scheme, $this->getAuthority(), $this->path, $this->query, $this->fragment);
73
+ }
74
+
75
+ public function getScheme(): string
76
+ {
77
+ return $this->scheme;
78
+ }
79
+
80
+ public function getAuthority(): string
81
+ {
82
+ if ('' === $this->host) {
83
+ return '';
84
+ }
85
+
86
+ $authority = $this->host;
87
+ if ('' !== $this->userInfo) {
88
+ $authority = $this->userInfo . '@' . $authority;
89
+ }
90
+
91
+ if (null !== $this->port) {
92
+ $authority .= ':' . $this->port;
93
+ }
94
+
95
+ return $authority;
96
+ }
97
+
98
+ public function getUserInfo(): string
99
+ {
100
+ return $this->userInfo;
101
+ }
102
+
103
+ public function getHost(): string
104
+ {
105
+ return $this->host;
106
+ }
107
+
108
+ public function getPort(): ?int
109
+ {
110
+ return $this->port;
111
+ }
112
+
113
+ public function getPath(): string
114
+ {
115
+ return $this->path;
116
+ }
117
+
118
+ public function getQuery(): string
119
+ {
120
+ return $this->query;
121
+ }
122
+
123
+ public function getFragment(): string
124
+ {
125
+ return $this->fragment;
126
+ }
127
+
128
+ public function withScheme($scheme): self
129
+ {
130
+ if (!\is_string($scheme)) {
131
+ throw new \InvalidArgumentException('Scheme must be a string');
132
+ }
133
+
134
+ if ($this->scheme === $scheme = \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')) {
135
+ return $this;
136
+ }
137
+
138
+ $new = clone $this;
139
+ $new->scheme = $scheme;
140
+ $new->port = $new->filterPort($new->port);
141
+
142
+ return $new;
143
+ }
144
+
145
+ public function withUserInfo($user, $password = null): self
146
+ {
147
+ $info = $user;
148
+ if (null !== $password && '' !== $password) {
149
+ $info .= ':' . $password;
150
+ }
151
+
152
+ if ($this->userInfo === $info) {
153
+ return $this;
154
+ }
155
+
156
+ $new = clone $this;
157
+ $new->userInfo = $info;
158
+
159
+ return $new;
160
+ }
161
+
162
+ public function withHost($host): self
163
+ {
164
+ if (!\is_string($host)) {
165
+ throw new \InvalidArgumentException('Host must be a string');
166
+ }
167
+
168
+ if ($this->host === $host = \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')) {
169
+ return $this;
170
+ }
171
+
172
+ $new = clone $this;
173
+ $new->host = $host;
174
+
175
+ return $new;
176
+ }
177
+
178
+ public function withPort($port): self
179
+ {
180
+ if ($this->port === $port = $this->filterPort($port)) {
181
+ return $this;
182
+ }
183
+
184
+ $new = clone $this;
185
+ $new->port = $port;
186
+
187
+ return $new;
188
+ }
189
+
190
+ public function withPath($path): self
191
+ {
192
+ if ($this->path === $path = $this->filterPath($path)) {
193
+ return $this;
194
+ }
195
+
196
+ $new = clone $this;
197
+ $new->path = $path;
198
+
199
+ return $new;
200
+ }
201
+
202
+ public function withQuery($query): self
203
+ {
204
+ if ($this->query === $query = $this->filterQueryAndFragment($query)) {
205
+ return $this;
206
+ }
207
+
208
+ $new = clone $this;
209
+ $new->query = $query;
210
+
211
+ return $new;
212
+ }
213
+
214
+ public function withFragment($fragment): self
215
+ {
216
+ if ($this->fragment === $fragment = $this->filterQueryAndFragment($fragment)) {
217
+ return $this;
218
+ }
219
+
220
+ $new = clone $this;
221
+ $new->fragment = $fragment;
222
+
223
+ return $new;
224
+ }
225
+
226
+ /**
227
+ * Create a URI string from its various parts.
228
+ */
229
+ private static function createUriString(string $scheme, string $authority, string $path, string $query, string $fragment): string
230
+ {
231
+ $uri = '';
232
+ if ('' !== $scheme) {
233
+ $uri .= $scheme . ':';
234
+ }
235
+
236
+ if ('' !== $authority) {
237
+ $uri .= '//' . $authority;
238
+ }
239
+
240
+ if ('' !== $path) {
241
+ if ('/' !== $path[0]) {
242
+ if ('' !== $authority) {
243
+ // If the path is rootless and an authority is present, the path MUST be prefixed by "/"
244
+ $path = '/' . $path;
245
+ }
246
+ } elseif (isset($path[1]) && '/' === $path[1]) {
247
+ if ('' === $authority) {
248
+ // If the path is starting with more than one "/" and no authority is present, the
249
+ // starting slashes MUST be reduced to one.
250
+ $path = '/' . \ltrim($path, '/');
251
+ }
252
+ }
253
+
254
+ $uri .= $path;
255
+ }
256
+
257
+ if ('' !== $query) {
258
+ $uri .= '?' . $query;
259
+ }
260
+
261
+ if ('' !== $fragment) {
262
+ $uri .= '#' . $fragment;
263
+ }
264
+
265
+ return $uri;
266
+ }
267
+
268
+ /**
269
+ * Is a given port non-standard for the current scheme?
270
+ */
271
+ private static function isNonStandardPort(string $scheme, int $port): bool
272
+ {
273
+ return !isset(self::SCHEMES[$scheme]) || $port !== self::SCHEMES[$scheme];
274
+ }
275
+
276
+ private function filterPort($port): ?int
277
+ {
278
+ if (null === $port) {
279
+ return null;
280
+ }
281
+
282
+ $port = (int) $port;
283
+ if (0 > $port || 0xffff < $port) {
284
+ throw new \InvalidArgumentException(\sprintf('Invalid port: %d. Must be between 0 and 65535', $port));
285
+ }
286
+
287
+ return self::isNonStandardPort($this->scheme, $port) ? $port : null;
288
+ }
289
+
290
+ private function filterPath($path): string
291
+ {
292
+ if (!\is_string($path)) {
293
+ throw new \InvalidArgumentException('Path must be a string');
294
+ }
295
+
296
+ return \preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', [__CLASS__, 'rawurlencodeMatchZero'], $path);
297
+ }
298
+
299
+ private function filterQueryAndFragment($str): string
300
+ {
301
+ if (!\is_string($str)) {
302
+ throw new \InvalidArgumentException('Query and fragment must be a string');
303
+ }
304
+
305
+ return \preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', [__CLASS__, 'rawurlencodeMatchZero'], $str);
306
+ }
307
+
308
+ private static function rawurlencodeMatchZero(array $match): string
309
+ {
310
+ return \rawurlencode($match[0]);
311
+ }
312
+ }
vendor/php-http/client-common/.php_cs.dist ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Configuration for fabpot/php-cs-fixer
5
+ *
6
+ * @link https://github.com/FriendsOfPHP/PHP-CS-Fixer
7
+ */
8
+
9
+ $finder = PhpCsFixer\Finder::create()
10
+ ->in('src')
11
+ ->in('spec')
12
+ ;
13
+ return PhpCsFixer\Config::create()
14
+ ->setRules([
15
+ '@PSR2' => true,
16
+ '@Symfony' => true,
17
+ 'array_syntax' => [
18
+ 'syntax' => 'short',
19
+ ],
20
+ 'no_empty_phpdoc' => true,
21
+ 'phpdoc_to_comment' => false,
22
+ 'single_line_throw' => false,
23
+ ])
24
+ ->setFinder($finder);
vendor/php-http/client-common/CHANGELOG.md ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+ ## 2.5.0 - 2021-11-26
4
+
5
+ ### Added
6
+
7
+ - Support for Symfony 6
8
+ - Support for PHP 8.1
9
+
10
+ ### Changed
11
+
12
+ - Dropped support for Symfony 2 and 3 - please keep using version 2.4.0 of this library if you can't update Symfony.
13
+
14
+ ## 2.4.0 - 2021-07-05
15
+
16
+ ### Added
17
+
18
+ - `strict` option to `RedirectPlugin` to allow preserving the request method on redirections with status 300, 301 and 302.
19
+
20
+ ## 2.3.0 - 2020-07-21
21
+
22
+ ### Fixed
23
+
24
+ - HttpMethodsClient with PSR RequestFactory
25
+ - Bug in the cookie plugin with empty cookies
26
+ - Bug when parsing null-valued date headers
27
+
28
+ ### Changed
29
+
30
+ - Deprecation when constructing a HttpMethodsClient with PSR RequestFactory but without a StreamFactory
31
+
32
+ ## 2.2.1 - 2020-07-13
33
+
34
+ ### Fixed
35
+
36
+ - Support for PHP 8
37
+ - Plugin callable phpdoc
38
+
39
+ ## 2.2.0 - 2020-07-02
40
+
41
+ ### Added
42
+
43
+ - Plugin client builder for making a `PluginClient`
44
+ - Support for the PSR-17 request factory in `HttpMethodsClient`
45
+
46
+ ### Changed
47
+
48
+ - Restored support for `symfony/options-resolver: ^2.6`
49
+ - Consistent implementation of union type checking
50
+
51
+ ### Fixed
52
+
53
+ - Memory leak when using the `PluginClient` with plugins
54
+
55
+ ## 2.1.0 - 2019-11-18
56
+
57
+ ### Added
58
+
59
+ - Support Symfony 5
60
+
61
+ ## 2.0.0 - 2019-02-03
62
+
63
+ ### Changed
64
+
65
+ - HttpClientRouter now throws a HttpClientNoMatchException instead of a RequestException if it can not find a client for the request.
66
+ - RetryPlugin will only retry exceptions when there is no response, or a response in the 5xx HTTP code range.
67
+ - RetryPlugin also retries when no exception is thrown if the responses has HTTP code in the 5xx range.
68
+ The callbacks for exception handling have been renamed and callbacks for response handling have been added.
69
+ - Abstract method `HttpClientPool::chooseHttpClient()` has now an explicit return type (`Http\Client\Common\HttpClientPoolItem`)
70
+ - Interface method `Plugin::handleRequest(...)` has now an explicit return type (`Http\Promise\Promise`)
71
+ - Made classes final that are not intended to be extended.
72
+ - Added interfaces for BatchClient, HttpClientRouter and HttpMethodsClient.
73
+ (These interfaces use the `Interface` suffix to avoid name collisions.)
74
+ - Added an interface for HttpClientPool and moved the abstract class to the HttpClientPool sub namespace.
75
+ - AddPathPlugin: Do not add the prefix if the URL already has the same prefix.
76
+ - All exceptions in `Http\Client\Common\Exception` are final.
77
+
78
+ ### Removed
79
+
80
+ - Deprecated option `debug_plugins` has been removed from `PluginClient`
81
+ - Deprecated options `decider` and `delay` have been removed from `RetryPlugin`, use `exception_decider` and `exception_delay` instead.
82
+
83
+ ## 1.11.0 - 2021-07-11
84
+
85
+ ### Changed
86
+
87
+ - Backported from version 2: AddPathPlugin: Do not add the prefix if the URL already has the same prefix.
88
+
89
+ ## 1.10.0 - 2019-11-18
90
+
91
+ ### Added
92
+
93
+ - Support for Symfony 5
94
+
95
+ ## 1.9.1 - 2019-02-02
96
+
97
+ ### Added
98
+
99
+ - Updated type hints in doc blocks.
100
+
101
+ ## 1.9.0 - 2019-01-03
102
+
103
+ ### Added
104
+
105
+ - Support for PSR-18 clients
106
+ - Added traits `VersionBridgePlugin` and `VersionBridgeClient` to help plugins and clients to support both
107
+ 1.x and 2.x version of `php-http/client-common` and `php-http/httplug`.
108
+
109
+ ### Changed
110
+
111
+ - RetryPlugin: Renamed the configuration options for the exception retry callback from `decider` to `exception_decider`
112
+ and `delay` to `exception_delay`. The old names still work but are deprecated.
113
+
114
+ ## 1.8.2 - 2018-12-14
115
+
116
+ ### Changed
117
+
118
+ - When multiple cookies exist, a single header with all cookies is sent as per RFC 6265 Section 5.4
119
+ - AddPathPlugin will now trim of ending slashes in paths
120
+
121
+ ## 1.8.1 - 2018-10-09
122
+
123
+ ### Fixed
124
+
125
+ - Reverted change to RetryPlugin so it again waits when retrying to avoid "can only throw objects" error.
126
+
127
+ ## 1.8.0 - 2018-09-21
128
+
129
+ ### Added
130
+
131
+ - Add an option on ErrorPlugin to only throw exception on response with 5XX status code.
132
+
133
+ ### Changed
134
+
135
+ - AddPathPlugin no longer add prefix multiple times if a request is restarted - it now only adds the prefix if that request chain has not yet passed through the AddPathPlugin
136
+ - RetryPlugin no longer wait for retried requests and use a deferred promise instead
137
+
138
+ ### Fixed
139
+
140
+ - Decoder plugin will now remove header when there is no more encoding, instead of setting to an empty array
141
+
142
+ ## 1.7.0 - 2017-11-30
143
+
144
+ ### Added
145
+
146
+ - Symfony 4 support
147
+
148
+ ### Changed
149
+
150
+ - Strict comparison in DecoderPlugin
151
+
152
+ ## 1.6.0 - 2017-10-16
153
+
154
+ ### Added
155
+
156
+ - Add HttpClientPool client to leverage load balancing and fallback mechanism [see the documentation](http://docs.php-http.org/en/latest/components/client-common.html) for more details.
157
+ - `PluginClientFactory` to create `PluginClient` instances.
158
+ - Added new option 'delay' for `RetryPlugin`.
159
+ - Added new option 'decider' for `RetryPlugin`.
160
+ - Supports more cookie date formats in the Cookie Plugin
161
+
162
+ ### Changed
163
+
164
+ - The `RetryPlugin` does now wait between retries. To disable/change this feature you must write something like:
165
+
166
+ ```php
167
+ $plugin = new RetryPlugin(['delay' => function(RequestInterface $request, Exception $e, $retries) {
168
+ return 0;
169
+ });
170
+ ```
171
+
172
+ ### Deprecated
173
+
174
+ - The `debug_plugins` option for `PluginClient` is deprecated and will be removed in 2.0. Use the decorator design pattern instead like in [ProfilePlugin](https://github.com/php-http/HttplugBundle/blob/de33f9c14252f22093a5ec7d84f17535ab31a384/Collector/ProfilePlugin.php).
175
+
176
+ ## 1.5.0 - 2017-03-30
177
+
178
+ ### Added
179
+
180
+ - `QueryDefaultsPlugin` to add default query parameters.
181
+
182
+ ## 1.4.2 - 2017-03-18
183
+
184
+ ### Deprecated
185
+
186
+ - `DecoderPlugin` does not longer claim to support `compress` content encoding
187
+
188
+ ### Fixed
189
+
190
+ - `CookiePlugin` allows main domain cookies to be sent/stored for subdomains
191
+ - `DecoderPlugin` uses the right `FilteredStream` to handle `deflate` content encoding
192
+
193
+
194
+ ## 1.4.1 - 2017-02-20
195
+
196
+ ### Fixed
197
+
198
+ - Cast return value of `StreamInterface::getSize` to string in `ContentLengthPlugin`
199
+
200
+
201
+ ## 1.4.0 - 2016-11-04
202
+
203
+ ### Added
204
+
205
+ - Add Path plugin
206
+ - Base URI plugin that combines Add Host and Add Path plugins
207
+
208
+
209
+ ## 1.3.0 - 2016-10-16
210
+
211
+ ### Changed
212
+
213
+ - Fix Emulated Trait to use Http based promise which respect the HttpAsyncClient interface
214
+ - Require Httplug 1.1 where we use HTTP specific promises.
215
+ - RedirectPlugin: use the full URL instead of the URI to properly keep track of redirects
216
+ - Add AddPathPlugin for API URLs with base path
217
+ - Add BaseUriPlugin that combines AddHostPlugin and AddPathPlugin
218
+
219
+
220
+ ## 1.2.1 - 2016-07-26
221
+
222
+ ### Changed
223
+
224
+ - AddHostPlugin also sets the port if specified
225
+
226
+
227
+ ## 1.2.0 - 2016-07-14
228
+
229
+ ### Added
230
+
231
+ - Suggest separate plugins in composer.json
232
+ - Introduced `debug_plugins` option for `PluginClient`
233
+
234
+
235
+ ## 1.1.0 - 2016-05-04
236
+
237
+ ### Added
238
+
239
+ - Add a flexible http client providing both contract, and only emulating what's necessary
240
+ - HTTP Client Router: route requests to underlying clients
241
+ - Plugin client and core plugins moved here from `php-http/plugins`
242
+
243
+ ### Deprecated
244
+
245
+ - Extending client classes, they will be made final in version 2.0
246
+
247
+
248
+ ## 1.0.0 - 2016-01-27
249
+
250
+ ### Changed
251
+
252
+ - Remove useless interface in BatchException
253
+
254
+
255
+ ## 0.2.0 - 2016-01-12
256
+
257
+ ### Changed
258
+
259
+ - Updated package files
260
+ - Updated HTTPlug to RC1
261
+
262
+
263
+ ## 0.1.1 - 2015-12-26
264
+
265
+ ### Added
266
+
267
+ - Emulated clients
268
+
269
+
270
+ ## 0.1.0 - 2015-12-25
271
+
272
+ ### Added
273
+
274
+ - Batch client from utils
275
+ - Methods client from utils
276
+ - Emulators and decorators from client-tools
vendor/php-http/client-common/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2015-2016 PHP HTTP Team <team@php-http.org>
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 furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ 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/php-http/client-common/README.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HTTP Client Common
2
+
3
+ [![Latest Version](https://img.shields.io/github/release/php-http/client-common.svg?style=flat-square)](https://github.com/php-http/client-common/releases)
4
+ [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5
+ [![Build Status](https://img.shields.io/travis/php-http/client-common/master.svg?style=flat-square)](https://travis-ci.org/php-http/client-common)
6
+ [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/client-common.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/client-common)
7
+ [![Quality Score](https://img.shields.io/scrutinizer/g/php-http/client-common.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/client-common)
8
+ [![Total Downloads](https://img.shields.io/packagist/dt/php-http/client-common.svg?style=flat-square)](https://packagist.org/packages/php-http/client-common)
9
+
10
+ **Common HTTP Client implementations and tools for HTTPlug.**
11
+
12
+
13
+ ## Install
14
+
15
+ Via Composer
16
+
17
+ ``` bash
18
+ $ composer require php-http/client-common
19
+ ```
20
+
21
+
22
+ ## Usage
23
+
24
+ This package provides common tools for HTTP Clients:
25
+
26
+ - BatchClient to handle sending requests in parallel
27
+ - A convenience client with HTTP method names as class methods
28
+ - Emulator, decorator layers for sync/async clients
29
+
30
+
31
+ ## Documentation
32
+
33
+ Please see the [official documentation](http://docs.php-http.org/en/latest/components/client-common.html).
34
+
35
+
36
+ ## Testing
37
+
38
+ ``` bash
39
+ $ composer test
40
+ ```
41
+
42
+
43
+ ## Contributing
44
+
45
+ Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).
46
+
47
+
48
+ ## Security
49
+
50
+ If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
51
+
52
+
53
+ ## License
54
+
55
+ The MIT License (MIT). Please see [License File](LICENSE) for more information.
vendor/php-http/client-common/src/BatchClient.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\Common\Exception\BatchException;
8
+ use Psr\Http\Client\ClientExceptionInterface;
9
+ use Psr\Http\Client\ClientInterface;
10
+
11
+ final class BatchClient implements BatchClientInterface
12
+ {
13
+ /**
14
+ * @var ClientInterface
15
+ */
16
+ private $client;
17
+
18
+ public function __construct(ClientInterface $client)
19
+ {
20
+ $this->client = $client;
21
+ }
22
+
23
+ public function sendRequests(array $requests): BatchResult
24
+ {
25
+ $batchResult = new BatchResult();
26
+
27
+ foreach ($requests as $request) {
28
+ try {
29
+ $response = $this->client->sendRequest($request);
30
+ $batchResult = $batchResult->addResponse($request, $response);
31
+ } catch (ClientExceptionInterface $e) {
32
+ $batchResult = $batchResult->addException($request, $e);
33
+ }
34
+ }
35
+
36
+ if ($batchResult->hasExceptions()) {
37
+ throw new BatchException($batchResult);
38
+ }
39
+
40
+ return $batchResult;
41
+ }
42
+ }
vendor/php-http/client-common/src/BatchClientInterface.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\Common\Exception\BatchException;
8
+ use Psr\Http\Message\RequestInterface;
9
+
10
+ /**
11
+ * BatchClient allow to sends multiple request and retrieve a Batch Result.
12
+ *
13
+ * This implementation simply loops over the requests and uses sendRequest with each of them.
14
+ *
15
+ * @author Joel Wurtz <jwurtz@jolicode.com>
16
+ */
17
+ interface BatchClientInterface
18
+ {
19
+ /**
20
+ * Send several requests.
21
+ *
22
+ * You may not assume that the requests are executed in a particular order. If the order matters
23
+ * for your application, use sendRequest sequentially.
24
+ *
25
+ * @param RequestInterface[] $requests The requests to send
26
+ *
27
+ * @return BatchResult Containing one result per request
28
+ *
29
+ * @throws BatchException If one or more requests fails. The exception gives access to the
30
+ * BatchResult with a map of request to result for success, request to
31
+ * exception for failures
32
+ */
33
+ public function sendRequests(array $requests): BatchResult;
34
+ }
vendor/php-http/client-common/src/BatchResult.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Psr\Http\Client\ClientExceptionInterface;
8
+ use Psr\Http\Message\RequestInterface;
9
+ use Psr\Http\Message\ResponseInterface;
10
+
11
+ /**
12
+ * Responses and exceptions returned from parallel request execution.
13
+ *
14
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
15
+ */
16
+ final class BatchResult
17
+ {
18
+ /**
19
+ * @var \SplObjectStorage<RequestInterface, ResponseInterface>
20
+ */
21
+ private $responses;
22
+
23
+ /**
24
+ * @var \SplObjectStorage<RequestInterface, ClientExceptionInterface>
25
+ */
26
+ private $exceptions;
27
+
28
+ public function __construct()
29
+ {
30
+ $this->responses = new \SplObjectStorage();
31
+ $this->exceptions = new \SplObjectStorage();
32
+ }
33
+
34
+ /**
35
+ * Checks if there are any successful responses at all.
36
+ */
37
+ public function hasResponses(): bool
38
+ {
39
+ return $this->responses->count() > 0;
40
+ }
41
+
42
+ /**
43
+ * Returns all successful responses.
44
+ *
45
+ * @return ResponseInterface[]
46
+ */
47
+ public function getResponses(): array
48
+ {
49
+ $responses = [];
50
+
51
+ foreach ($this->responses as $request) {
52
+ $responses[] = $this->responses[$request];
53
+ }
54
+
55
+ return $responses;
56
+ }
57
+
58
+ /**
59
+ * Checks if there is a successful response for a request.
60
+ */
61
+ public function isSuccessful(RequestInterface $request): bool
62
+ {
63
+ return $this->responses->contains($request);
64
+ }
65
+
66
+ /**
67
+ * Returns the response for a successful request.
68
+ *
69
+ * @throws \UnexpectedValueException If request was not part of the batch or failed
70
+ */
71
+ public function getResponseFor(RequestInterface $request): ResponseInterface
72
+ {
73
+ try {
74
+ return $this->responses[$request];
75
+ } catch (\UnexpectedValueException $e) {
76
+ throw new \UnexpectedValueException('Request not found', $e->getCode(), $e);
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Adds a response in an immutable way.
82
+ *
83
+ * @return BatchResult the new BatchResult with this request-response pair added to it
84
+ */
85
+ public function addResponse(RequestInterface $request, ResponseInterface $response): self
86
+ {
87
+ $new = clone $this;
88
+ $new->responses->attach($request, $response);
89
+
90
+ return $new;
91
+ }
92
+
93
+ /**
94
+ * Checks if there are any unsuccessful requests at all.
95
+ */
96
+ public function hasExceptions(): bool
97
+ {
98
+ return $this->exceptions->count() > 0;
99
+ }
100
+
101
+ /**
102
+ * Returns all exceptions for the unsuccessful requests.
103
+ *
104
+ * @return ClientExceptionInterface[]
105
+ */
106
+ public function getExceptions(): array
107
+ {
108
+ $exceptions = [];
109
+
110
+ foreach ($this->exceptions as $request) {
111
+ $exceptions[] = $this->exceptions[$request];
112
+ }
113
+
114
+ return $exceptions;
115
+ }
116
+
117
+ /**
118
+ * Checks if there is an exception for a request, meaning the request failed.
119
+ */
120
+ public function isFailed(RequestInterface $request): bool
121
+ {
122
+ return $this->exceptions->contains($request);
123
+ }
124
+
125
+ /**
126
+ * Returns the exception for a failed request.
127
+ *
128
+ * @throws \UnexpectedValueException If request was not part of the batch or was successful
129
+ */
130
+ public function getExceptionFor(RequestInterface $request): ClientExceptionInterface
131
+ {
132
+ try {
133
+ return $this->exceptions[$request];
134
+ } catch (\UnexpectedValueException $e) {
135
+ throw new \UnexpectedValueException('Request not found', $e->getCode(), $e);
136
+ }
137
+ }
138
+
139
+ /**
140
+ * Adds an exception in an immutable way.
141
+ *
142
+ * @return BatchResult the new BatchResult with this request-exception pair added to it
143
+ */
144
+ public function addException(RequestInterface $request, ClientExceptionInterface $exception): self
145
+ {
146
+ $new = clone $this;
147
+ $new->exceptions->attach($request, $exception);
148
+
149
+ return $new;
150
+ }
151
+
152
+ public function __clone()
153
+ {
154
+ $this->responses = clone $this->responses;
155
+ $this->exceptions = clone $this->exceptions;
156
+ }
157
+ }
vendor/php-http/client-common/src/Deferred.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Promise\Promise;
8
+ use Psr\Http\Client\ClientExceptionInterface;
9
+ use Psr\Http\Message\ResponseInterface;
10
+
11
+ /**
12
+ * A deferred allow to return a promise which has not been resolved yet.
13
+ */
14
+ final class Deferred implements Promise
15
+ {
16
+ /**
17
+ * @var ResponseInterface|null
18
+ */
19
+ private $value;
20
+
21
+ /**
22
+ * @var ClientExceptionInterface|null
23
+ */
24
+ private $failure;
25
+
26
+ /**
27
+ * @var string
28
+ */
29
+ private $state;
30
+
31
+ /**
32
+ * @var callable
33
+ */
34
+ private $waitCallback;
35
+
36
+ /**
37
+ * @var callable[]
38
+ */
39
+ private $onFulfilledCallbacks;
40
+
41
+ /**
42
+ * @var callable[]
43
+ */
44
+ private $onRejectedCallbacks;
45
+
46
+ public function __construct(callable $waitCallback)
47
+ {
48
+ $this->waitCallback = $waitCallback;
49
+ $this->state = Promise::PENDING;
50
+ $this->onFulfilledCallbacks = [];
51
+ $this->onRejectedCallbacks = [];
52
+ }
53
+
54
+ /**
55
+ * {@inheritdoc}
56
+ */
57
+ public function then(callable $onFulfilled = null, callable $onRejected = null): Promise
58
+ {
59
+ $deferred = new self($this->waitCallback);
60
+
61
+ $this->onFulfilledCallbacks[] = function (ResponseInterface $response) use ($onFulfilled, $deferred) {
62
+ try {
63
+ if (null !== $onFulfilled) {
64
+ $response = $onFulfilled($response);
65
+ }
66
+ $deferred->resolve($response);
67
+ } catch (ClientExceptionInterface $exception) {
68
+ $deferred->reject($exception);
69
+ }
70
+ };
71
+
72
+ $this->onRejectedCallbacks[] = function (ClientExceptionInterface $exception) use ($onRejected, $deferred) {
73
+ try {
74
+ if (null !== $onRejected) {
75
+ $response = $onRejected($exception);
76
+ $deferred->resolve($response);
77
+
78
+ return;
79
+ }
80
+ $deferred->reject($exception);
81
+ } catch (ClientExceptionInterface $newException) {
82
+ $deferred->reject($newException);
83
+ }
84
+ };
85
+
86
+ return $deferred;
87
+ }
88
+
89
+ /**
90
+ * {@inheritdoc}
91
+ */
92
+ public function getState(): string
93
+ {
94
+ return $this->state;
95
+ }
96
+
97
+ /**
98
+ * Resolve this deferred with a Response.
99
+ */
100
+ public function resolve(ResponseInterface $response): void
101
+ {
102
+ if (Promise::PENDING !== $this->state) {
103
+ return;
104
+ }
105
+
106
+ $this->value = $response;
107
+ $this->state = Promise::FULFILLED;
108
+
109
+ foreach ($this->onFulfilledCallbacks as $onFulfilledCallback) {
110
+ $onFulfilledCallback($response);
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Reject this deferred with an Exception.
116
+ */
117
+ public function reject(ClientExceptionInterface $exception): void
118
+ {
119
+ if (Promise::PENDING !== $this->state) {
120
+ return;
121
+ }
122
+
123
+ $this->failure = $exception;
124
+ $this->state = Promise::REJECTED;
125
+
126
+ foreach ($this->onRejectedCallbacks as $onRejectedCallback) {
127
+ $onRejectedCallback($exception);
128
+ }
129
+ }
130
+
131
+ /**
132
+ * {@inheritdoc}
133
+ */
134
+ public function wait($unwrap = true)
135
+ {
136
+ if (Promise::PENDING === $this->state) {
137
+ $callback = $this->waitCallback;
138
+ $callback();
139
+ }
140
+
141
+ if (!$unwrap) {
142
+ return null;
143
+ }
144
+
145
+ if (Promise::FULFILLED === $this->state) {
146
+ return $this->value;
147
+ }
148
+
149
+ /** @var ClientExceptionInterface */
150
+ throw $this->failure;
151
+ }
152
+ }
vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\HttpAsyncClient;
8
+ use Http\Client\HttpClient;
9
+ use Psr\Http\Client\ClientInterface;
10
+
11
+ /**
12
+ * Emulates an async HTTP client with the help of a synchronous client.
13
+ *
14
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
15
+ */
16
+ final class EmulatedHttpAsyncClient implements HttpClient, HttpAsyncClient
17
+ {
18
+ use HttpAsyncClientEmulator;
19
+ use HttpClientDecorator;
20
+
21
+ public function __construct(ClientInterface $httpClient)
22
+ {
23
+ $this->httpClient = $httpClient;
24
+ }
25
+ }
vendor/php-http/client-common/src/EmulatedHttpClient.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\HttpAsyncClient;
8
+ use Http\Client\HttpClient;
9
+
10
+ /**
11
+ * Emulates a synchronous HTTP client with the help of an asynchronous client.
12
+ *
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ final class EmulatedHttpClient implements HttpClient, HttpAsyncClient
16
+ {
17
+ use HttpAsyncClientDecorator;
18
+ use HttpClientEmulator;
19
+
20
+ public function __construct(HttpAsyncClient $httpAsyncClient)
21
+ {
22
+ $this->httpAsyncClient = $httpAsyncClient;
23
+ }
24
+ }
vendor/php-http/client-common/src/Exception/BatchException.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Exception;
6
+
7
+ use Http\Client\Common\BatchResult;
8
+ use Http\Client\Exception\TransferException;
9
+
10
+ /**
11
+ * This exception is thrown when HttpClient::sendRequests led to at least one failure.
12
+ *
13
+ * It gives access to a BatchResult with the request-exception and request-response pairs.
14
+ *
15
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
16
+ */
17
+ final class BatchException extends TransferException
18
+ {
19
+ /**
20
+ * @var BatchResult
21
+ */
22
+ private $result;
23
+
24
+ public function __construct(BatchResult $result)
25
+ {
26
+ $this->result = $result;
27
+ parent::__construct();
28
+ }
29
+
30
+ /**
31
+ * Returns the BatchResult that contains all responses and exceptions.
32
+ */
33
+ public function getResult(): BatchResult
34
+ {
35
+ return $this->result;
36
+ }
37
+ }
vendor/php-http/client-common/src/Exception/CircularRedirectionException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Exception;
6
+
7
+ use Http\Client\Exception\HttpException;
8
+
9
+ /**
10
+ * Thrown when circular redirection is detected.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class CircularRedirectionException extends HttpException
15
+ {
16
+ }
vendor/php-http/client-common/src/Exception/ClientErrorException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Exception;
6
+
7
+ use Http\Client\Exception\HttpException;
8
+
9
+ /**
10
+ * Thrown when there is a client error (4xx).
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class ClientErrorException extends HttpException
15
+ {
16
+ }
vendor/php-http/client-common/src/Exception/HttpClientNoMatchException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Exception;
6
+
7
+ use Http\Client\Exception\TransferException;
8
+ use Psr\Http\Message\RequestInterface;
9
+
10
+ /**
11
+ * Thrown when a http client match in the HTTPClientRouter.
12
+ *
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ final class HttpClientNoMatchException extends TransferException
16
+ {
17
+ /**
18
+ * @var RequestInterface
19
+ */
20
+ private $request;
21
+
22
+ public function __construct(string $message, RequestInterface $request, \Exception $previous = null)
23
+ {
24
+ $this->request = $request;
25
+
26
+ parent::__construct($message, 0, $previous);
27
+ }
28
+
29
+ public function getRequest(): RequestInterface
30
+ {
31
+ return $this->request;
32
+ }
33
+ }
vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Exception;
6
+
7
+ use Http\Client\Exception\TransferException;
8
+
9
+ /**
10
+ * Thrown when a http client cannot be chosen in a pool.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class HttpClientNotFoundException extends TransferException
15
+ {
16
+ }
vendor/php-http/client-common/src/Exception/LoopException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Exception;
6
+
7
+ use Http\Client\Exception\RequestException;
8
+
9
+ /**
10
+ * Thrown when the Plugin Client detects an endless loop.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class LoopException extends RequestException
15
+ {
16
+ }
vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Exception;
6
+
7
+ use Http\Client\Exception\HttpException;
8
+
9
+ /**
10
+ * Redirect location cannot be chosen.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class MultipleRedirectionException extends HttpException
15
+ {
16
+ }
vendor/php-http/client-common/src/Exception/ServerErrorException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Exception;
6
+
7
+ use Http\Client\Exception\HttpException;
8
+
9
+ /**
10
+ * Thrown when there is a server error (5xx).
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class ServerErrorException extends HttpException
15
+ {
16
+ }
vendor/php-http/client-common/src/FlexibleHttpClient.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\HttpAsyncClient;
8
+ use Http\Client\HttpClient;
9
+ use Psr\Http\Client\ClientInterface;
10
+
11
+ /**
12
+ * A flexible http client, which implements both interface and will emulate
13
+ * one contract, the other, or none at all depending on the injected client contract.
14
+ *
15
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
16
+ */
17
+ final class FlexibleHttpClient implements HttpClient, HttpAsyncClient
18
+ {
19
+ use HttpClientDecorator;
20
+ use HttpAsyncClientDecorator;
21
+
22
+ /**
23
+ * @param ClientInterface|HttpAsyncClient $client
24
+ */
25
+ public function __construct($client)
26
+ {
27
+ if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) {
28
+ throw new \TypeError(
29
+ sprintf('%s::__construct(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client))
30
+ );
31
+ }
32
+
33
+ $this->httpClient = $client instanceof ClientInterface ? $client : new EmulatedHttpClient($client);
34
+ $this->httpAsyncClient = $client instanceof HttpAsyncClient ? $client : new EmulatedHttpAsyncClient($client);
35
+ }
36
+ }
vendor/php-http/client-common/src/HttpAsyncClientDecorator.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\HttpAsyncClient;
8
+ use Psr\Http\Message\RequestInterface;
9
+
10
+ /**
11
+ * Decorates an HTTP Async Client.
12
+ *
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ trait HttpAsyncClientDecorator
16
+ {
17
+ /**
18
+ * @var HttpAsyncClient
19
+ */
20
+ protected $httpAsyncClient;
21
+
22
+ /**
23
+ * {@inheritdoc}
24
+ *
25
+ * @see HttpAsyncClient::sendAsyncRequest
26
+ */
27
+ public function sendAsyncRequest(RequestInterface $request)
28
+ {
29
+ return $this->httpAsyncClient->sendAsyncRequest($request);
30
+ }
31
+ }
vendor/php-http/client-common/src/HttpAsyncClientEmulator.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\Exception;
8
+ use Http\Client\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+ use Psr\Http\Message\ResponseInterface;
11
+
12
+ /**
13
+ * Emulates an HTTP Async Client in an HTTP Client.
14
+ *
15
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
16
+ */
17
+ trait HttpAsyncClientEmulator
18
+ {
19
+ /**
20
+ * {@inheritdoc}
21
+ *
22
+ * @see HttpClient::sendRequest
23
+ */
24
+ abstract public function sendRequest(RequestInterface $request): ResponseInterface;
25
+
26
+ /**
27
+ * {@inheritdoc}
28
+ *
29
+ * @see HttpAsyncClient::sendAsyncRequest
30
+ */
31
+ public function sendAsyncRequest(RequestInterface $request)
32
+ {
33
+ try {
34
+ return new Promise\HttpFulfilledPromise($this->sendRequest($request));
35
+ } catch (Exception $e) {
36
+ return new Promise\HttpRejectedPromise($e);
37
+ }
38
+ }
39
+ }
vendor/php-http/client-common/src/HttpClientDecorator.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Psr\Http\Client\ClientInterface;
8
+ use Psr\Http\Message\RequestInterface;
9
+ use Psr\Http\Message\ResponseInterface;
10
+
11
+ /**
12
+ * Decorates an HTTP Client.
13
+ *
14
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
15
+ */
16
+ trait HttpClientDecorator
17
+ {
18
+ /**
19
+ * @var ClientInterface
20
+ */
21
+ protected $httpClient;
22
+
23
+ /**
24
+ * {@inheritdoc}
25
+ *
26
+ * @see ClientInterface::sendRequest
27
+ */
28
+ public function sendRequest(RequestInterface $request): ResponseInterface
29
+ {
30
+ return $this->httpClient->sendRequest($request);
31
+ }
32
+ }
vendor/php-http/client-common/src/HttpClientEmulator.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Psr\Http\Message\RequestInterface;
8
+ use Psr\Http\Message\ResponseInterface;
9
+
10
+ /**
11
+ * Emulates an HTTP Client in an HTTP Async Client.
12
+ *
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ trait HttpClientEmulator
16
+ {
17
+ /**
18
+ * {@inheritdoc}
19
+ *
20
+ * @see HttpClient::sendRequest
21
+ */
22
+ public function sendRequest(RequestInterface $request): ResponseInterface
23
+ {
24
+ $promise = $this->sendAsyncRequest($request);
25
+
26
+ return $promise->wait();
27
+ }
28
+
29
+ /**
30
+ * {@inheritdoc}
31
+ *
32
+ * @see HttpAsyncClient::sendAsyncRequest
33
+ */
34
+ abstract public function sendAsyncRequest(RequestInterface $request);
35
+ }
vendor/php-http/client-common/src/HttpClientPool.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\Common\HttpClientPool\HttpClientPoolItem;
8
+ use Http\Client\HttpAsyncClient;
9
+ use Http\Client\HttpClient;
10
+ use Psr\Http\Client\ClientInterface;
11
+
12
+ /**
13
+ * A http client pool allows to send requests on a pool of different http client using a specific strategy (least used,
14
+ * round robin, ...).
15
+ */
16
+ interface HttpClientPool extends HttpAsyncClient, HttpClient
17
+ {
18
+ /**
19
+ * Add a client to the pool.
20
+ *
21
+ * @param ClientInterface|HttpAsyncClient|HttpClientPoolItem $client
22
+ */
23
+ public function addHttpClient($client): void;
24
+ }
vendor/php-http/client-common/src/HttpClientPool/HttpClientPool.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\HttpClientPool;
6
+
7
+ use Http\Client\Common\Exception\HttpClientNotFoundException;
8
+ use Http\Client\Common\HttpClientPool as HttpClientPoolInterface;
9
+ use Http\Client\HttpAsyncClient;
10
+ use Psr\Http\Client\ClientInterface;
11
+ use Psr\Http\Message\RequestInterface;
12
+ use Psr\Http\Message\ResponseInterface;
13
+
14
+ /**
15
+ * A http client pool allows to send requests on a pool of different http client using a specific strategy (least used,
16
+ * round robin, ...).
17
+ */
18
+ abstract class HttpClientPool implements HttpClientPoolInterface
19
+ {
20
+ /**
21
+ * @var HttpClientPoolItem[]
22
+ */
23
+ protected $clientPool = [];
24
+
25
+ /**
26
+ * Add a client to the pool.
27
+ *
28
+ * @param ClientInterface|HttpAsyncClient $client
29
+ */
30
+ public function addHttpClient($client): void
31
+ {
32
+ // no need to check for HttpClientPoolItem here, since it extends the other interfaces
33
+ if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) {
34
+ throw new \TypeError(
35
+ sprintf('%s::addHttpClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client))
36
+ );
37
+ }
38
+
39
+ if (!$client instanceof HttpClientPoolItem) {
40
+ $client = new HttpClientPoolItem($client);
41
+ }
42
+
43
+ $this->clientPool[] = $client;
44
+ }
45
+
46
+ /**
47
+ * Return an http client given a specific strategy.
48
+ *
49
+ * @throws HttpClientNotFoundException When no http client has been found into the pool
50
+ *
51
+ * @return HttpClientPoolItem Return a http client that can do both sync or async
52
+ */
53
+ abstract protected function chooseHttpClient(): HttpClientPoolItem;
54
+
55
+ /**
56
+ * {@inheritdoc}
57
+ */
58
+ public function sendAsyncRequest(RequestInterface $request)
59
+ {
60
+ return $this->chooseHttpClient()->sendAsyncRequest($request);
61
+ }
62
+
63
+ /**
64
+ * {@inheritdoc}
65
+ */
66
+ public function sendRequest(RequestInterface $request): ResponseInterface
67
+ {
68
+ return $this->chooseHttpClient()->sendRequest($request);
69
+ }
70
+ }
vendor/php-http/client-common/src/HttpClientPool/HttpClientPoolItem.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\HttpClientPool;
6
+
7
+ use Http\Client\Common\FlexibleHttpClient;
8
+ use Http\Client\Exception;
9
+ use Http\Client\HttpAsyncClient;
10
+ use Http\Client\HttpClient;
11
+ use Psr\Http\Client\ClientInterface;
12
+ use Psr\Http\Message\RequestInterface;
13
+ use Psr\Http\Message\ResponseInterface;
14
+
15
+ /**
16
+ * A HttpClientPoolItem represent a HttpClient inside a Pool.
17
+ *
18
+ * It is disabled when a request failed and can be reenabled after a certain number of seconds.
19
+ * It also keep tracks of the current number of open requests the client is currently being sending
20
+ * (only usable for async method).
21
+ *
22
+ * This class is used internally in the client pools and is not supposed to be used anywhere else.
23
+ *
24
+ * @final
25
+ *
26
+ * @internal
27
+ *
28
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
29
+ */
30
+ class HttpClientPoolItem implements HttpClient, HttpAsyncClient
31
+ {
32
+ /**
33
+ * @var int Number of request this client is currently sending
34
+ */
35
+ private $sendingRequestCount = 0;
36
+
37
+ /**
38
+ * @var \DateTime|null Time when this client has been disabled or null if enable
39
+ */
40
+ private $disabledAt;
41
+
42
+ /**
43
+ * Number of seconds until this client is enabled again after an error.
44
+ *
45
+ * null: never reenable this client.
46
+ *
47
+ * @var int|null
48
+ */
49
+ private $reenableAfter;
50
+
51
+ /**
52
+ * @var FlexibleHttpClient A http client responding to async and sync request
53
+ */
54
+ private $client;
55
+
56
+ /**
57
+ * @param ClientInterface|HttpAsyncClient $client
58
+ * @param int|null $reenableAfter Number of seconds until this client is enabled again after an error
59
+ */
60
+ public function __construct($client, int $reenableAfter = null)
61
+ {
62
+ if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) {
63
+ throw new \TypeError(
64
+ sprintf('%s::__construct(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client))
65
+ );
66
+ }
67
+
68
+ $this->client = new FlexibleHttpClient($client);
69
+ $this->reenableAfter = $reenableAfter;
70
+ }
71
+
72
+ /**
73
+ * {@inheritdoc}
74
+ */
75
+ public function sendRequest(RequestInterface $request): ResponseInterface
76
+ {
77
+ if ($this->isDisabled()) {
78
+ throw new Exception\RequestException('Cannot send the request as this client has been disabled', $request);
79
+ }
80
+
81
+ try {
82
+ $this->incrementRequestCount();
83
+ $response = $this->client->sendRequest($request);
84
+ $this->decrementRequestCount();
85
+ } catch (Exception $e) {
86
+ $this->disable();
87
+ $this->decrementRequestCount();
88
+
89
+ throw $e;
90
+ }
91
+
92
+ return $response;
93
+ }
94
+
95
+ /**
96
+ * {@inheritdoc}
97
+ */
98
+ public function sendAsyncRequest(RequestInterface $request)
99
+ {
100
+ if ($this->isDisabled()) {
101
+ throw new Exception\RequestException('Cannot send the request as this client has been disabled', $request);
102
+ }
103
+
104
+ $this->incrementRequestCount();
105
+
106
+ return $this->client->sendAsyncRequest($request)->then(function ($response) {
107
+ $this->decrementRequestCount();
108
+
109
+ return $response;
110
+ }, function ($exception) {
111
+ $this->disable();
112
+ $this->decrementRequestCount();
113
+
114
+ throw $exception;
115
+ });
116
+ }
117
+
118
+ /**
119
+ * Whether this client is disabled or not.
120
+ *
121
+ * If the client was disabled, calling this method checks if the client can
122
+ * be reenabled and if so enables it.
123
+ */
124
+ public function isDisabled(): bool
125
+ {
126
+ if (null !== $this->reenableAfter && null !== $this->disabledAt) {
127
+ // Reenable after a certain time
128
+ $now = new \DateTime();
129
+
130
+ if (($now->getTimestamp() - $this->disabledAt->getTimestamp()) >= $this->reenableAfter) {
131
+ $this->enable();
132
+
133
+ return false;
134
+ }
135
+
136
+ return true;
137
+ }
138
+
139
+ return null !== $this->disabledAt;
140
+ }
141
+
142
+ /**
143
+ * Get current number of request that are currently being sent by the underlying HTTP client.
144
+ */
145
+ public function getSendingRequestCount(): int
146
+ {
147
+ return $this->sendingRequestCount;
148
+ }
149
+
150
+ /**
151
+ * Increment the request count.
152
+ */
153
+ private function incrementRequestCount(): void
154
+ {
155
+ ++$this->sendingRequestCount;
156
+ }
157
+
158
+ /**
159
+ * Decrement the request count.
160
+ */
161
+ private function decrementRequestCount(): void
162
+ {
163
+ --$this->sendingRequestCount;
164
+ }
165
+
166
+ /**
167
+ * Enable the current client.
168
+ */
169
+ private function enable(): void
170
+ {
171
+ $this->disabledAt = null;
172
+ }
173
+
174
+ /**
175
+ * Disable the current client.
176
+ */
177
+ private function disable(): void
178
+ {
179
+ $this->disabledAt = new \DateTime('now');
180
+ }
181
+ }
vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\HttpClientPool;
6
+
7
+ use Http\Client\Common\Exception\HttpClientNotFoundException;
8
+
9
+ /**
10
+ * LeastUsedClientPool will choose the client with the less current request in the pool.
11
+ *
12
+ * This strategy is only useful when doing async request
13
+ *
14
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
15
+ */
16
+ final class LeastUsedClientPool extends HttpClientPool
17
+ {
18
+ /**
19
+ * {@inheritdoc}
20
+ */
21
+ protected function chooseHttpClient(): HttpClientPoolItem
22
+ {
23
+ $clientPool = array_filter($this->clientPool, function (HttpClientPoolItem $clientPoolItem) {
24
+ return !$clientPoolItem->isDisabled();
25
+ });
26
+
27
+ if (0 === count($clientPool)) {
28
+ throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool');
29
+ }
30
+
31
+ usort($clientPool, function (HttpClientPoolItem $clientA, HttpClientPoolItem $clientB) {
32
+ if ($clientA->getSendingRequestCount() === $clientB->getSendingRequestCount()) {
33
+ return 0;
34
+ }
35
+
36
+ if ($clientA->getSendingRequestCount() < $clientB->getSendingRequestCount()) {
37
+ return -1;
38
+ }
39
+
40
+ return 1;
41
+ });
42
+
43
+ return reset($clientPool);
44
+ }
45
+ }
vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\HttpClientPool;
6
+
7
+ use Http\Client\Common\Exception\HttpClientNotFoundException;
8
+
9
+ /**
10
+ * RoundRobinClientPool will choose the next client in the pool.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class RandomClientPool extends HttpClientPool
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ protected function chooseHttpClient(): HttpClientPoolItem
20
+ {
21
+ $clientPool = array_filter($this->clientPool, function (HttpClientPoolItem $clientPoolItem) {
22
+ return !$clientPoolItem->isDisabled();
23
+ });
24
+
25
+ if (0 === count($clientPool)) {
26
+ throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool');
27
+ }
28
+
29
+ return $clientPool[array_rand($clientPool)];
30
+ }
31
+ }
vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\HttpClientPool;
6
+
7
+ use Http\Client\Common\Exception\HttpClientNotFoundException;
8
+
9
+ /**
10
+ * RoundRobinClientPool will choose the next client in the pool.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class RoundRobinClientPool extends HttpClientPool
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ protected function chooseHttpClient(): HttpClientPoolItem
20
+ {
21
+ $last = current($this->clientPool);
22
+
23
+ do {
24
+ $client = next($this->clientPool);
25
+
26
+ if (false === $client) {
27
+ $client = reset($this->clientPool);
28
+
29
+ if (false === $client) {
30
+ throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool');
31
+ }
32
+ }
33
+
34
+ // Case when there is only one and the last one has been disabled
35
+ if ($last === $client && $client->isDisabled()) {
36
+ throw new HttpClientNotFoundException('Cannot choose a http client as there is no one enabled in the pool');
37
+ }
38
+ } while ($client->isDisabled());
39
+
40
+ return $client;
41
+ }
42
+ }
vendor/php-http/client-common/src/HttpClientRouter.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\Common\Exception\HttpClientNoMatchException;
8
+ use Http\Client\HttpAsyncClient;
9
+ use Http\Message\RequestMatcher;
10
+ use Psr\Http\Client\ClientInterface;
11
+ use Psr\Http\Message\RequestInterface;
12
+ use Psr\Http\Message\ResponseInterface;
13
+
14
+ /**
15
+ * {@inheritdoc}
16
+ *
17
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
18
+ */
19
+ final class HttpClientRouter implements HttpClientRouterInterface
20
+ {
21
+ /**
22
+ * @var (array{matcher: RequestMatcher, client: FlexibleHttpClient})[]
23
+ */
24
+ private $clients = [];
25
+
26
+ /**
27
+ * {@inheritdoc}
28
+ */
29
+ public function sendRequest(RequestInterface $request): ResponseInterface
30
+ {
31
+ return $this->chooseHttpClient($request)->sendRequest($request);
32
+ }
33
+
34
+ /**
35
+ * {@inheritdoc}
36
+ */
37
+ public function sendAsyncRequest(RequestInterface $request)
38
+ {
39
+ return $this->chooseHttpClient($request)->sendAsyncRequest($request);
40
+ }
41
+
42
+ /**
43
+ * Add a client to the router.
44
+ *
45
+ * @param ClientInterface|HttpAsyncClient $client
46
+ */
47
+ public function addClient($client, RequestMatcher $requestMatcher): void
48
+ {
49
+ if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) {
50
+ throw new \TypeError(
51
+ sprintf('%s::addClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client))
52
+ );
53
+ }
54
+
55
+ $this->clients[] = [
56
+ 'matcher' => $requestMatcher,
57
+ 'client' => new FlexibleHttpClient($client),
58
+ ];
59
+ }
60
+
61
+ /**
62
+ * Choose an HTTP client given a specific request.
63
+ */
64
+ private function chooseHttpClient(RequestInterface $request): FlexibleHttpClient
65
+ {
66
+ foreach ($this->clients as $client) {
67
+ if ($client['matcher']->matches($request)) {
68
+ return $client['client'];
69
+ }
70
+ }
71
+
72
+ throw new HttpClientNoMatchException('No client found for the specified request', $request);
73
+ }
74
+ }
vendor/php-http/client-common/src/HttpClientRouterInterface.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\HttpAsyncClient;
8
+ use Http\Client\HttpClient;
9
+ use Http\Message\RequestMatcher;
10
+ use Psr\Http\Client\ClientInterface;
11
+
12
+ /**
13
+ * Route a request to a specific client in the stack based using a RequestMatcher.
14
+ *
15
+ * This is not a HttpClientPool client because it uses a matcher to select the client.
16
+ *
17
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
18
+ */
19
+ interface HttpClientRouterInterface extends HttpClient, HttpAsyncClient
20
+ {
21
+ /**
22
+ * Add a client to the router.
23
+ *
24
+ * @param ClientInterface|HttpAsyncClient $client
25
+ */
26
+ public function addClient($client, RequestMatcher $requestMatcher): void;
27
+ }
vendor/php-http/client-common/src/HttpMethodsClient.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Message\RequestFactory;
8
+ use Psr\Http\Client\ClientInterface;
9
+ use Psr\Http\Message\RequestFactoryInterface;
10
+ use Psr\Http\Message\RequestInterface;
11
+ use Psr\Http\Message\ResponseInterface;
12
+ use Psr\Http\Message\StreamFactoryInterface;
13
+ use Psr\Http\Message\StreamInterface;
14
+ use Psr\Http\Message\UriInterface;
15
+
16
+ final class HttpMethodsClient implements HttpMethodsClientInterface
17
+ {
18
+ /**
19
+ * @var ClientInterface
20
+ */
21
+ private $httpClient;
22
+
23
+ /**
24
+ * @var RequestFactory|RequestFactoryInterface
25
+ */
26
+ private $requestFactory;
27
+
28
+ /**
29
+ * @var StreamFactoryInterface|null
30
+ */
31
+ private $streamFactory;
32
+
33
+ /**
34
+ * @param RequestFactory|RequestFactoryInterface $requestFactory
35
+ */
36
+ public function __construct(ClientInterface $httpClient, $requestFactory, StreamFactoryInterface $streamFactory = null)
37
+ {
38
+ if (!$requestFactory instanceof RequestFactory && !$requestFactory instanceof RequestFactoryInterface) {
39
+ throw new \TypeError(
40
+ sprintf('%s::__construct(): Argument #2 ($requestFactory) must be of type %s|%s, %s given', self::class, RequestFactory::class, RequestFactoryInterface::class, get_debug_type($requestFactory))
41
+ );
42
+ }
43
+
44
+ if (!$requestFactory instanceof RequestFactory && null === $streamFactory) {
45
+ @trigger_error(sprintf('Passing a %s without a %s to %s::__construct() is deprecated as of version 2.3 and will be disallowed in version 3.0. A stream factory is required to create a request with a non-empty string body.', RequestFactoryInterface::class, StreamFactoryInterface::class, self::class));
46
+ }
47
+
48
+ $this->httpClient = $httpClient;
49
+ $this->requestFactory = $requestFactory;
50
+ $this->streamFactory = $streamFactory;
51
+ }
52
+
53
+ public function get($uri, array $headers = []): ResponseInterface
54
+ {
55
+ return $this->send('GET', $uri, $headers, null);
56
+ }
57
+
58
+ public function head($uri, array $headers = []): ResponseInterface
59
+ {
60
+ return $this->send('HEAD', $uri, $headers, null);
61
+ }
62
+
63
+ public function trace($uri, array $headers = []): ResponseInterface
64
+ {
65
+ return $this->send('TRACE', $uri, $headers, null);
66
+ }
67
+
68
+ public function post($uri, array $headers = [], $body = null): ResponseInterface
69
+ {
70
+ return $this->send('POST', $uri, $headers, $body);
71
+ }
72
+
73
+ public function put($uri, array $headers = [], $body = null): ResponseInterface
74
+ {
75
+ return $this->send('PUT', $uri, $headers, $body);
76
+ }
77
+
78
+ public function patch($uri, array $headers = [], $body = null): ResponseInterface
79
+ {
80
+ return $this->send('PATCH', $uri, $headers, $body);
81
+ }
82
+
83
+ public function delete($uri, array $headers = [], $body = null): ResponseInterface
84
+ {
85
+ return $this->send('DELETE', $uri, $headers, $body);
86
+ }
87
+
88
+ public function options($uri, array $headers = [], $body = null): ResponseInterface
89
+ {
90
+ return $this->send('OPTIONS', $uri, $headers, $body);
91
+ }
92
+
93
+ public function send(string $method, $uri, array $headers = [], $body = null): ResponseInterface
94
+ {
95
+ if (!is_string($uri) && !$uri instanceof UriInterface) {
96
+ throw new \TypeError(
97
+ sprintf('%s::send(): Argument #2 ($uri) must be of type string|%s, %s given', self::class, UriInterface::class, get_debug_type($uri))
98
+ );
99
+ }
100
+
101
+ if (!is_string($body) && !$body instanceof StreamInterface && null !== $body) {
102
+ throw new \TypeError(
103
+ sprintf('%s::send(): Argument #4 ($body) must be of type string|%s|null, %s given', self::class, StreamInterface::class, get_debug_type($body))
104
+ );
105
+ }
106
+
107
+ return $this->sendRequest(
108
+ self::createRequest($method, $uri, $headers, $body)
109
+ );
110
+ }
111
+
112
+ /**
113
+ * @param string|UriInterface $uri
114
+ * @param string|StreamInterface|null $body
115
+ */
116
+ private function createRequest(string $method, $uri, array $headers = [], $body = null): RequestInterface
117
+ {
118
+ if ($this->requestFactory instanceof RequestFactory) {
119
+ return $this->requestFactory->createRequest(
120
+ $method,
121
+ $uri,
122
+ $headers,
123
+ $body
124
+ );
125
+ }
126
+
127
+ $request = $this->requestFactory->createRequest($method, $uri);
128
+
129
+ foreach ($headers as $key => $value) {
130
+ $request = $request->withHeader($key, $value);
131
+ }
132
+
133
+ if (null !== $body && '' !== $body) {
134
+ if (null === $this->streamFactory) {
135
+ throw new \RuntimeException('Cannot create request: A stream factory is required to create a request with a non-empty string body.');
136
+ }
137
+
138
+ $request = $request->withBody(
139
+ is_string($body) ? $this->streamFactory->createStream($body) : $body
140
+ );
141
+ }
142
+
143
+ return $request;
144
+ }
145
+
146
+ public function sendRequest(RequestInterface $request): ResponseInterface
147
+ {
148
+ return $this->httpClient->sendRequest($request);
149
+ }
150
+ }
vendor/php-http/client-common/src/HttpMethodsClientInterface.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\Exception;
8
+ use Http\Client\HttpClient;
9
+ use Psr\Http\Message\ResponseInterface;
10
+ use Psr\Http\Message\StreamInterface;
11
+ use Psr\Http\Message\UriInterface;
12
+
13
+ /**
14
+ * Convenience HTTP client that integrates the MessageFactory in order to send
15
+ * requests in the following form:.
16
+ *
17
+ * $client
18
+ * ->get('/foo')
19
+ * ->post('/bar')
20
+ * ;
21
+ *
22
+ * The client also exposes the sendRequest methods of the wrapped HttpClient.
23
+ *
24
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
25
+ * @author David Buchmann <mail@davidbu.ch>
26
+ */
27
+ interface HttpMethodsClientInterface extends HttpClient
28
+ {
29
+ /**
30
+ * Sends a GET request.
31
+ *
32
+ * @param string|UriInterface $uri
33
+ *
34
+ * @throws Exception
35
+ */
36
+ public function get($uri, array $headers = []): ResponseInterface;
37
+
38
+ /**
39
+ * Sends an HEAD request.
40
+ *
41
+ * @param string|UriInterface $uri
42
+ *
43
+ * @throws Exception
44
+ */
45
+ public function head($uri, array $headers = []): ResponseInterface;
46
+
47
+ /**
48
+ * Sends a TRACE request.
49
+ *
50
+ * @param string|UriInterface $uri
51
+ *
52
+ * @throws Exception
53
+ */
54
+ public function trace($uri, array $headers = []): ResponseInterface;
55
+
56
+ /**
57
+ * Sends a POST request.
58
+ *
59
+ * @param string|UriInterface $uri
60
+ * @param string|StreamInterface|null $body
61
+ *
62
+ * @throws Exception
63
+ */
64
+ public function post($uri, array $headers = [], $body = null): ResponseInterface;
65
+
66
+ /**
67
+ * Sends a PUT request.
68
+ *
69
+ * @param string|UriInterface $uri
70
+ * @param string|StreamInterface|null $body
71
+ *
72
+ * @throws Exception
73
+ */
74
+ public function put($uri, array $headers = [], $body = null): ResponseInterface;
75
+
76
+ /**
77
+ * Sends a PATCH request.
78
+ *
79
+ * @param string|UriInterface $uri
80
+ * @param string|StreamInterface|null $body
81
+ *
82
+ * @throws Exception
83
+ */
84
+ public function patch($uri, array $headers = [], $body = null): ResponseInterface;
85
+
86
+ /**
87
+ * Sends a DELETE request.
88
+ *
89
+ * @param string|UriInterface $uri
90
+ * @param string|StreamInterface|null $body
91
+ *
92
+ * @throws Exception
93
+ */
94
+ public function delete($uri, array $headers = [], $body = null): ResponseInterface;
95
+
96
+ /**
97
+ * Sends an OPTIONS request.
98
+ *
99
+ * @param string|UriInterface $uri
100
+ * @param string|StreamInterface|null $body
101
+ *
102
+ * @throws Exception
103
+ */
104
+ public function options($uri, array $headers = [], $body = null): ResponseInterface;
105
+
106
+ /**
107
+ * Sends a request with any HTTP method.
108
+ *
109
+ * @param string $method HTTP method to use
110
+ * @param string|UriInterface $uri
111
+ * @param string|StreamInterface|null $body
112
+ *
113
+ * @throws Exception
114
+ */
115
+ public function send(string $method, $uri, array $headers = [], $body = null): ResponseInterface;
116
+ }
vendor/php-http/client-common/src/Plugin.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Promise\Promise;
8
+ use Psr\Http\Message\RequestInterface;
9
+
10
+ /**
11
+ * A plugin is a middleware to transform the request and/or the response.
12
+ *
13
+ * The plugin can:
14
+ * - break the chain and return a response
15
+ * - dispatch the request to the next middleware
16
+ * - restart the request
17
+ *
18
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
19
+ */
20
+ interface Plugin
21
+ {
22
+ /**
23
+ * Handle the request and return the response coming from the next callable.
24
+ *
25
+ * @see http://docs.php-http.org/en/latest/plugins/build-your-own.html
26
+ *
27
+ * @param callable(RequestInterface): Promise $next Next middleware in the chain, the request is passed as the first argument
28
+ * @param callable(RequestInterface): Promise $first First middleware in the chain, used to to restart a request
29
+ *
30
+ * @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient)
31
+ */
32
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise;
33
+ }
vendor/php-http/client-common/src/Plugin/AddHostPlugin.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+ use Psr\Http\Message\UriInterface;
11
+ use Symfony\Component\OptionsResolver\OptionsResolver;
12
+
13
+ /**
14
+ * Add schema, host and port to a request. Can be set to overwrite the schema and host if desired.
15
+ *
16
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
17
+ */
18
+ final class AddHostPlugin implements Plugin
19
+ {
20
+ /**
21
+ * @var UriInterface
22
+ */
23
+ private $host;
24
+
25
+ /**
26
+ * @var bool
27
+ */
28
+ private $replace;
29
+
30
+ /**
31
+ * @param array{'replace'?: bool} $config
32
+ *
33
+ * Configuration options:
34
+ * - replace: True will replace all hosts, false will only add host when none is specified.
35
+ */
36
+ public function __construct(UriInterface $host, array $config = [])
37
+ {
38
+ if ('' === $host->getHost()) {
39
+ throw new \LogicException('Host can not be empty');
40
+ }
41
+
42
+ $this->host = $host;
43
+
44
+ $resolver = new OptionsResolver();
45
+ $this->configureOptions($resolver);
46
+ $options = $resolver->resolve($config);
47
+
48
+ $this->replace = $options['replace'];
49
+ }
50
+
51
+ /**
52
+ * {@inheritdoc}
53
+ */
54
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
55
+ {
56
+ if ($this->replace || '' === $request->getUri()->getHost()) {
57
+ $uri = $request->getUri()
58
+ ->withHost($this->host->getHost())
59
+ ->withScheme($this->host->getScheme())
60
+ ->withPort($this->host->getPort())
61
+ ;
62
+
63
+ $request = $request->withUri($uri);
64
+ }
65
+
66
+ return $next($request);
67
+ }
68
+
69
+ private function configureOptions(OptionsResolver $resolver): void
70
+ {
71
+ $resolver->setDefaults([
72
+ 'replace' => false,
73
+ ]);
74
+ $resolver->setAllowedTypes('replace', 'bool');
75
+ }
76
+ }
vendor/php-http/client-common/src/Plugin/AddPathPlugin.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+ use Psr\Http\Message\UriInterface;
11
+
12
+ /**
13
+ * Prepend a base path to the request URI. Useful for base API URLs like http://domain.com/api.
14
+ *
15
+ * @author Sullivan Senechal <soullivaneuh@gmail.com>
16
+ */
17
+ final class AddPathPlugin implements Plugin
18
+ {
19
+ /**
20
+ * @var UriInterface
21
+ */
22
+ private $uri;
23
+
24
+ public function __construct(UriInterface $uri)
25
+ {
26
+ if ('' === $uri->getPath()) {
27
+ throw new \LogicException('URI path cannot be empty');
28
+ }
29
+
30
+ if ('/' === substr($uri->getPath(), -1)) {
31
+ $uri = $uri->withPath(rtrim($uri->getPath(), '/'));
32
+ }
33
+
34
+ $this->uri = $uri;
35
+ }
36
+
37
+ /**
38
+ * Adds a prefix in the beginning of the URL's path.
39
+ *
40
+ * The prefix is not added if that prefix is already on the URL's path. This will fail on the edge
41
+ * case of the prefix being repeated, for example if `https://example.com/api/api/foo` is a valid
42
+ * URL on the server and the configured prefix is `/api`.
43
+ *
44
+ * We looked at other solutions, but they are all much more complicated, while still having edge
45
+ * cases:
46
+ * - Doing an spl_object_hash on `$first` will lead to collisions over time because over time the
47
+ * hash can collide.
48
+ * - Have the PluginClient provide a magic header to identify the request chain and only apply
49
+ * this plugin once.
50
+ *
51
+ * There are 2 reasons for the AddPathPlugin to be executed twice on the same request:
52
+ * - A plugin can restart the chain by calling `$first`, e.g. redirect
53
+ * - A plugin can call `$next` more than once, e.g. retry
54
+ *
55
+ * Depending on the scenario, the path should or should not be added. E.g. `$first` could
56
+ * be called after a redirect response from the server. The server likely already has the
57
+ * correct path.
58
+ *
59
+ * No solution fits all use cases. This implementation will work fine for the common use cases.
60
+ * If you have a specific situation where this is not the right thing, you can build a custom plugin
61
+ * that does exactly what you need.
62
+ *
63
+ * {@inheritdoc}
64
+ */
65
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
66
+ {
67
+ $prepend = $this->uri->getPath();
68
+ $path = $request->getUri()->getPath();
69
+
70
+ if (substr($path, 0, strlen($prepend)) !== $prepend) {
71
+ $request = $request->withUri($request->getUri()
72
+ ->withPath($prepend.$path)
73
+ );
74
+ }
75
+
76
+ return $next($request);
77
+ }
78
+ }
vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Message\Authentication;
9
+ use Http\Promise\Promise;
10
+ use Psr\Http\Message\RequestInterface;
11
+
12
+ /**
13
+ * Send an authenticated request.
14
+ *
15
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
16
+ */
17
+ final class AuthenticationPlugin implements Plugin
18
+ {
19
+ /**
20
+ * @var Authentication An authentication system
21
+ */
22
+ private $authentication;
23
+
24
+ public function __construct(Authentication $authentication)
25
+ {
26
+ $this->authentication = $authentication;
27
+ }
28
+
29
+ /**
30
+ * {@inheritdoc}
31
+ */
32
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
33
+ {
34
+ $request = $this->authentication->authenticate($request);
35
+
36
+ return $next($request);
37
+ }
38
+ }
vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+ use Psr\Http\Message\UriInterface;
11
+
12
+ /**
13
+ * Combines the AddHostPlugin and AddPathPlugin.
14
+ *
15
+ * @author Sullivan Senechal <soullivaneuh@gmail.com>
16
+ */
17
+ final class BaseUriPlugin implements Plugin
18
+ {
19
+ /**
20
+ * @var AddHostPlugin
21
+ */
22
+ private $addHostPlugin;
23
+
24
+ /**
25
+ * @var AddPathPlugin|null
26
+ */
27
+ private $addPathPlugin = null;
28
+
29
+ /**
30
+ * @param UriInterface $uri Has to contain a host name and can have a path
31
+ * @param array $hostConfig Config for AddHostPlugin. @see AddHostPlugin::configureOptions
32
+ */
33
+ public function __construct(UriInterface $uri, array $hostConfig = [])
34
+ {
35
+ $this->addHostPlugin = new AddHostPlugin($uri, $hostConfig);
36
+
37
+ if (rtrim($uri->getPath(), '/')) {
38
+ $this->addPathPlugin = new AddPathPlugin($uri);
39
+ }
40
+ }
41
+
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
46
+ {
47
+ $addHostNext = function (RequestInterface $request) use ($next, $first) {
48
+ return $this->addHostPlugin->handleRequest($request, $next, $first);
49
+ };
50
+
51
+ if ($this->addPathPlugin) {
52
+ return $this->addPathPlugin->handleRequest($request, $addHostNext, $first);
53
+ }
54
+
55
+ return $addHostNext($request);
56
+ }
57
+ }
vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Message\Encoding\ChunkStream;
9
+ use Http\Promise\Promise;
10
+ use Psr\Http\Message\RequestInterface;
11
+
12
+ /**
13
+ * Allow to set the correct content length header on the request or to transfer it as a chunk if not possible.
14
+ *
15
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
16
+ */
17
+ final class ContentLengthPlugin implements Plugin
18
+ {
19
+ /**
20
+ * {@inheritdoc}
21
+ */
22
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
23
+ {
24
+ if (!$request->hasHeader('Content-Length')) {
25
+ $stream = $request->getBody();
26
+
27
+ // Cannot determine the size so we use a chunk stream
28
+ if (null === $stream->getSize()) {
29
+ $stream = new ChunkStream($stream);
30
+ $request = $request->withBody($stream);
31
+ $request = $request->withAddedHeader('Transfer-Encoding', 'chunked');
32
+ } else {
33
+ $request = $request->withHeader('Content-Length', (string) $stream->getSize());
34
+ }
35
+ }
36
+
37
+ return $next($request);
38
+ }
39
+ }
vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+ use Psr\Http\Message\StreamInterface;
11
+ use Symfony\Component\OptionsResolver\OptionsResolver;
12
+
13
+ /**
14
+ * Allow to set the correct content type header on the request automatically only if it is not set.
15
+ *
16
+ * @author Karim Pinchon <karim.pinchon@gmail.com>
17
+ */
18
+ final class ContentTypePlugin implements Plugin
19
+ {
20
+ /**
21
+ * Allow to disable the content type detection when stream is too large (as it can consume a lot of resource).
22
+ *
23
+ * @var bool
24
+ *
25
+ * true skip the content type detection
26
+ * false detect the content type (default value)
27
+ */
28
+ private $skipDetection;
29
+
30
+ /**
31
+ * Determine the size stream limit for which the detection as to be skipped (default to 16Mb).
32
+ *
33
+ * @var int
34
+ */
35
+ private $sizeLimit;
36
+
37
+ /**
38
+ * @param array{'skip_detection'?: bool, 'size_limit'?: int} $config
39
+ *
40
+ * Configuration options:
41
+ * - skip_detection: true skip detection if stream size is bigger than $size_limit
42
+ * - size_limit: size stream limit for which the detection as to be skipped.
43
+ */
44
+ public function __construct(array $config = [])
45
+ {
46
+ $resolver = new OptionsResolver();
47
+ $resolver->setDefaults([
48
+ 'skip_detection' => false,
49
+ 'size_limit' => 16000000,
50
+ ]);
51
+ $resolver->setAllowedTypes('skip_detection', 'bool');
52
+ $resolver->setAllowedTypes('size_limit', 'int');
53
+
54
+ $options = $resolver->resolve($config);
55
+
56
+ $this->skipDetection = $options['skip_detection'];
57
+ $this->sizeLimit = $options['size_limit'];
58
+ }
59
+
60
+ /**
61
+ * {@inheritdoc}
62
+ */
63
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
64
+ {
65
+ if (!$request->hasHeader('Content-Type')) {
66
+ $stream = $request->getBody();
67
+ $streamSize = $stream->getSize();
68
+
69
+ if (!$stream->isSeekable()) {
70
+ return $next($request);
71
+ }
72
+
73
+ if (0 === $streamSize) {
74
+ return $next($request);
75
+ }
76
+
77
+ if ($this->skipDetection && (null === $streamSize || $streamSize >= $this->sizeLimit)) {
78
+ return $next($request);
79
+ }
80
+
81
+ if ($this->isJson($stream)) {
82
+ $request = $request->withHeader('Content-Type', 'application/json');
83
+
84
+ return $next($request);
85
+ }
86
+
87
+ if ($this->isXml($stream)) {
88
+ $request = $request->withHeader('Content-Type', 'application/xml');
89
+
90
+ return $next($request);
91
+ }
92
+ }
93
+
94
+ return $next($request);
95
+ }
96
+
97
+ private function isJson(StreamInterface $stream): bool
98
+ {
99
+ if (!function_exists('json_decode')) {
100
+ return false;
101
+ }
102
+ $stream->rewind();
103
+
104
+ json_decode($stream->getContents());
105
+
106
+ return JSON_ERROR_NONE === json_last_error();
107
+ }
108
+
109
+ private function isXml(StreamInterface $stream): bool
110
+ {
111
+ if (!function_exists('simplexml_load_string')) {
112
+ return false;
113
+ }
114
+ $stream->rewind();
115
+
116
+ $previousValue = libxml_use_internal_errors(true);
117
+ $isXml = simplexml_load_string($stream->getContents());
118
+ libxml_use_internal_errors($previousValue);
119
+
120
+ return false !== $isXml;
121
+ }
122
+ }
vendor/php-http/client-common/src/Plugin/CookiePlugin.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Client\Exception\TransferException;
9
+ use Http\Message\Cookie;
10
+ use Http\Message\CookieJar;
11
+ use Http\Message\CookieUtil;
12
+ use Http\Message\Exception\UnexpectedValueException;
13
+ use Http\Promise\Promise;
14
+ use Psr\Http\Message\RequestInterface;
15
+ use Psr\Http\Message\ResponseInterface;
16
+
17
+ /**
18
+ * Handle request cookies.
19
+ *
20
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
21
+ */
22
+ final class CookiePlugin implements Plugin
23
+ {
24
+ /**
25
+ * Cookie storage.
26
+ *
27
+ * @var CookieJar
28
+ */
29
+ private $cookieJar;
30
+
31
+ public function __construct(CookieJar $cookieJar)
32
+ {
33
+ $this->cookieJar = $cookieJar;
34
+ }
35
+
36
+ /**
37
+ * {@inheritdoc}
38
+ */
39
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
40
+ {
41
+ $cookies = [];
42
+ foreach ($this->cookieJar->getCookies() as $cookie) {
43
+ if ($cookie->isExpired()) {
44
+ continue;
45
+ }
46
+
47
+ if (!$cookie->matchDomain($request->getUri()->getHost())) {
48
+ continue;
49
+ }
50
+
51
+ if (!$cookie->matchPath($request->getUri()->getPath())) {
52
+ continue;
53
+ }
54
+
55
+ if ($cookie->isSecure() && ('https' !== $request->getUri()->getScheme())) {
56
+ continue;
57
+ }
58
+
59
+ $cookies[] = sprintf('%s=%s', $cookie->getName(), $cookie->getValue());
60
+ }
61
+
62
+ if (!empty($cookies)) {
63
+ $request = $request->withAddedHeader('Cookie', implode('; ', array_unique($cookies)));
64
+ }
65
+
66
+ return $next($request)->then(function (ResponseInterface $response) use ($request) {
67
+ if ($response->hasHeader('Set-Cookie')) {
68
+ $setCookies = $response->getHeader('Set-Cookie');
69
+
70
+ foreach ($setCookies as $setCookie) {
71
+ $cookie = $this->createCookie($request, $setCookie);
72
+
73
+ // Cookie invalid do not use it
74
+ if (null === $cookie) {
75
+ continue;
76
+ }
77
+
78
+ // Restrict setting cookie from another domain
79
+ if (!preg_match("/\.{$cookie->getDomain()}$/", '.'.$request->getUri()->getHost())) {
80
+ continue;
81
+ }
82
+
83
+ $this->cookieJar->addCookie($cookie);
84
+ }
85
+ }
86
+
87
+ return $response;
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Creates a cookie from a string.
93
+ *
94
+ * @throws TransferException
95
+ */
96
+ private function createCookie(RequestInterface $request, string $setCookieHeader): ?Cookie
97
+ {
98
+ $parts = array_map('trim', explode(';', $setCookieHeader));
99
+
100
+ if ('' === $parts[0] || false === strpos($parts[0], '=')) {
101
+ return null;
102
+ }
103
+
104
+ list($name, $cookieValue) = $this->createValueKey(array_shift($parts));
105
+
106
+ $maxAge = null;
107
+ $expires = null;
108
+ $domain = $request->getUri()->getHost();
109
+ $path = $request->getUri()->getPath();
110
+ $secure = false;
111
+ $httpOnly = false;
112
+
113
+ // Add the cookie pieces into the parsed data array
114
+ foreach ($parts as $part) {
115
+ list($key, $value) = $this->createValueKey($part);
116
+
117
+ switch (strtolower($key)) {
118
+ case 'expires':
119
+ try {
120
+ $expires = CookieUtil::parseDate((string) $value);
121
+ } catch (UnexpectedValueException $e) {
122
+ throw new TransferException(
123
+ sprintf(
124
+ 'Cookie header `%s` expires value `%s` could not be converted to date',
125
+ $name,
126
+ $value
127
+ ),
128
+ 0,
129
+ $e
130
+ );
131
+ }
132
+
133
+ break;
134
+
135
+ case 'max-age':
136
+ $maxAge = (int) $value;
137
+
138
+ break;
139
+
140
+ case 'domain':
141
+ $domain = $value;
142
+
143
+ break;
144
+
145
+ case 'path':
146
+ $path = $value;
147
+
148
+ break;
149
+
150
+ case 'secure':
151
+ $secure = true;
152
+
153
+ break;
154
+
155
+ case 'httponly':
156
+ $httpOnly = true;
157
+
158
+ break;
159
+ }
160
+ }
161
+
162
+ return new Cookie($name, $cookieValue, $maxAge, $domain, $path, $secure, $httpOnly, $expires);
163
+ }
164
+
165
+ /**
166
+ * Separates key/value pair from cookie.
167
+ *
168
+ * @param string $part A single cookie value in format key=value
169
+ *
170
+ * @return array{0:string, 1:?string}
171
+ */
172
+ private function createValueKey(string $part): array
173
+ {
174
+ $parts = explode('=', $part, 2);
175
+ $key = trim($parts[0]);
176
+ $value = isset($parts[1]) ? trim($parts[1]) : null;
177
+
178
+ return [$key, $value];
179
+ }
180
+ }
vendor/php-http/client-common/src/Plugin/DecoderPlugin.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Message\Encoding;
9
+ use Http\Promise\Promise;
10
+ use Psr\Http\Message\RequestInterface;
11
+ use Psr\Http\Message\ResponseInterface;
12
+ use Psr\Http\Message\StreamInterface;
13
+ use Symfony\Component\OptionsResolver\OptionsResolver;
14
+
15
+ /**
16
+ * Allow to decode response body with a chunk, deflate, compress or gzip encoding.
17
+ *
18
+ * If zlib is not installed, only chunked encoding can be handled.
19
+ *
20
+ * If Content-Encoding is not disabled, the plugin will add an Accept-Encoding header for the encoding methods it supports.
21
+ *
22
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
23
+ */
24
+ final class DecoderPlugin implements Plugin
25
+ {
26
+ /**
27
+ * @var bool Whether this plugin decode stream with value in the Content-Encoding header (default to true).
28
+ *
29
+ * If set to false only the Transfer-Encoding header will be used
30
+ */
31
+ private $useContentEncoding;
32
+
33
+ /**
34
+ * @param array{'use_content_encoding'?: bool} $config
35
+ *
36
+ * Configuration options:
37
+ * - use_content_encoding: Whether this plugin should look at the Content-Encoding header first or only at the Transfer-Encoding (defaults to true).
38
+ */
39
+ public function __construct(array $config = [])
40
+ {
41
+ $resolver = new OptionsResolver();
42
+ $resolver->setDefaults([
43
+ 'use_content_encoding' => true,
44
+ ]);
45
+ $resolver->setAllowedTypes('use_content_encoding', 'bool');
46
+ $options = $resolver->resolve($config);
47
+
48
+ $this->useContentEncoding = $options['use_content_encoding'];
49
+ }
50
+
51
+ /**
52
+ * {@inheritdoc}
53
+ */
54
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
55
+ {
56
+ $encodings = extension_loaded('zlib') ? ['gzip', 'deflate'] : ['identity'];
57
+
58
+ if ($this->useContentEncoding) {
59
+ $request = $request->withHeader('Accept-Encoding', $encodings);
60
+ }
61
+ $encodings[] = 'chunked';
62
+ $request = $request->withHeader('TE', $encodings);
63
+
64
+ return $next($request)->then(function (ResponseInterface $response) {
65
+ return $this->decodeResponse($response);
66
+ });
67
+ }
68
+
69
+ /**
70
+ * Decode a response body given its Transfer-Encoding or Content-Encoding value.
71
+ */
72
+ private function decodeResponse(ResponseInterface $response): ResponseInterface
73
+ {
74
+ $response = $this->decodeOnEncodingHeader('Transfer-Encoding', $response);
75
+
76
+ if ($this->useContentEncoding) {
77
+ $response = $this->decodeOnEncodingHeader('Content-Encoding', $response);
78
+ }
79
+
80
+ return $response;
81
+ }
82
+
83
+ /**
84
+ * Decode a response on a specific header (content encoding or transfer encoding mainly).
85
+ */
86
+ private function decodeOnEncodingHeader(string $headerName, ResponseInterface $response): ResponseInterface
87
+ {
88
+ if ($response->hasHeader($headerName)) {
89
+ $encodings = $response->getHeader($headerName);
90
+ $newEncodings = [];
91
+
92
+ while ($encoding = array_pop($encodings)) {
93
+ $stream = $this->decorateStream($encoding, $response->getBody());
94
+
95
+ if (false === $stream) {
96
+ array_unshift($newEncodings, $encoding);
97
+
98
+ continue;
99
+ }
100
+
101
+ $response = $response->withBody($stream);
102
+ }
103
+
104
+ if (\count($newEncodings) > 0) {
105
+ $response = $response->withHeader($headerName, $newEncodings);
106
+ } else {
107
+ $response = $response->withoutHeader($headerName);
108
+ }
109
+ }
110
+
111
+ return $response;
112
+ }
113
+
114
+ /**
115
+ * Decorate a stream given an encoding.
116
+ *
117
+ * @return StreamInterface|false A new stream interface or false if encoding is not supported
118
+ */
119
+ private function decorateStream(string $encoding, StreamInterface $stream)
120
+ {
121
+ if ('chunked' === strtolower($encoding)) {
122
+ return new Encoding\DechunkStream($stream);
123
+ }
124
+
125
+ if ('deflate' === strtolower($encoding)) {
126
+ return new Encoding\DecompressStream($stream);
127
+ }
128
+
129
+ if ('gzip' === strtolower($encoding)) {
130
+ return new Encoding\GzipDecodeStream($stream);
131
+ }
132
+
133
+ return false;
134
+ }
135
+ }
vendor/php-http/client-common/src/Plugin/ErrorPlugin.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Exception\ClientErrorException;
8
+ use Http\Client\Common\Exception\ServerErrorException;
9
+ use Http\Client\Common\Plugin;
10
+ use Http\Promise\Promise;
11
+ use Psr\Http\Message\RequestInterface;
12
+ use Psr\Http\Message\ResponseInterface;
13
+ use Symfony\Component\OptionsResolver\OptionsResolver;
14
+
15
+ /**
16
+ * Throw exception when the response of a request is not acceptable.
17
+ *
18
+ * Status codes 400-499 lead to a ClientErrorException, status 500-599 to a ServerErrorException.
19
+ *
20
+ * Warning
21
+ * =======
22
+ *
23
+ * Throwing an exception on a valid response violates the PSR-18 specification.
24
+ * This plugin is provided as a convenience when writing a small application.
25
+ * When providing a client to a third party library, this plugin must not be
26
+ * included, or the third party library will have problems with error handling.
27
+ *
28
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
29
+ */
30
+ final class ErrorPlugin implements Plugin
31
+ {
32
+ /**
33
+ * @var bool Whether this plugin should only throw 5XX Exceptions (default to false).
34
+ *
35
+ * If set to true 4XX Responses code will never throw an exception
36
+ */
37
+ private $onlyServerException;
38
+
39
+ /**
40
+ * @param array{'only_server_exception'?: bool} $config
41
+ *
42
+ * Configuration options:
43
+ * - only_server_exception: Whether this plugin should only throw 5XX Exceptions (default to false).
44
+ */
45
+ public function __construct(array $config = [])
46
+ {
47
+ $resolver = new OptionsResolver();
48
+ $resolver->setDefaults([
49
+ 'only_server_exception' => false,
50
+ ]);
51
+ $resolver->setAllowedTypes('only_server_exception', 'bool');
52
+ $options = $resolver->resolve($config);
53
+
54
+ $this->onlyServerException = $options['only_server_exception'];
55
+ }
56
+
57
+ /**
58
+ * {@inheritdoc}
59
+ */
60
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
61
+ {
62
+ $promise = $next($request);
63
+
64
+ return $promise->then(function (ResponseInterface $response) use ($request) {
65
+ return $this->transformResponseToException($request, $response);
66
+ });
67
+ }
68
+
69
+ /**
70
+ * Transform response to an error if possible.
71
+ *
72
+ * @param RequestInterface $request Request of the call
73
+ * @param ResponseInterface $response Response of the call
74
+ *
75
+ * @throws ClientErrorException If response status code is a 4xx
76
+ * @throws ServerErrorException If response status code is a 5xx
77
+ *
78
+ * @return ResponseInterface If status code is not in 4xx or 5xx return response
79
+ */
80
+ private function transformResponseToException(RequestInterface $request, ResponseInterface $response): ResponseInterface
81
+ {
82
+ if (!$this->onlyServerException && $response->getStatusCode() >= 400 && $response->getStatusCode() < 500) {
83
+ throw new ClientErrorException($response->getReasonPhrase(), $request, $response);
84
+ }
85
+
86
+ if ($response->getStatusCode() >= 500 && $response->getStatusCode() < 600) {
87
+ throw new ServerErrorException($response->getReasonPhrase(), $request, $response);
88
+ }
89
+
90
+ return $response;
91
+ }
92
+ }
vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+
11
+ /**
12
+ * Append headers to the request.
13
+ *
14
+ * If the header already exists the value will be appended to the current value.
15
+ *
16
+ * This only makes sense for headers that can have multiple values like 'Forwarded'
17
+ *
18
+ * @see https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
19
+ *
20
+ * @author Soufiane Ghzal <sghzal@gmail.com>
21
+ */
22
+ final class HeaderAppendPlugin implements Plugin
23
+ {
24
+ /**
25
+ * @var array
26
+ */
27
+ private $headers;
28
+
29
+ /**
30
+ * @param array $headers Hashmap of header name to header value
31
+ */
32
+ public function __construct(array $headers)
33
+ {
34
+ $this->headers = $headers;
35
+ }
36
+
37
+ /**
38
+ * {@inheritdoc}
39
+ */
40
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
41
+ {
42
+ foreach ($this->headers as $header => $headerValue) {
43
+ $request = $request->withAddedHeader($header, $headerValue);
44
+ }
45
+
46
+ return $next($request);
47
+ }
48
+ }
vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+
11
+ /**
12
+ * Set header to default value if it does not exist.
13
+ *
14
+ * If a given header already exists the value wont be replaced and the request wont be changed.
15
+ *
16
+ * @author Soufiane Ghzal <sghzal@gmail.com>
17
+ */
18
+ final class HeaderDefaultsPlugin implements Plugin
19
+ {
20
+ /**
21
+ * @var array
22
+ */
23
+ private $headers = [];
24
+
25
+ /**
26
+ * @param array $headers Hashmap of header name to header value
27
+ */
28
+ public function __construct(array $headers)
29
+ {
30
+ $this->headers = $headers;
31
+ }
32
+
33
+ /**
34
+ * {@inheritdoc}
35
+ */
36
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
37
+ {
38
+ foreach ($this->headers as $header => $headerValue) {
39
+ if (!$request->hasHeader($header)) {
40
+ $request = $request->withHeader($header, $headerValue);
41
+ }
42
+ }
43
+
44
+ return $next($request);
45
+ }
46
+ }
vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+
11
+ /**
12
+ * Removes headers from the request.
13
+ *
14
+ * @author Soufiane Ghzal <sghzal@gmail.com>
15
+ */
16
+ final class HeaderRemovePlugin implements Plugin
17
+ {
18
+ /**
19
+ * @var array
20
+ */
21
+ private $headers = [];
22
+
23
+ /**
24
+ * @param array $headers List of header names to remove from the request
25
+ */
26
+ public function __construct(array $headers)
27
+ {
28
+ $this->headers = $headers;
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
35
+ {
36
+ foreach ($this->headers as $header) {
37
+ if ($request->hasHeader($header)) {
38
+ $request = $request->withoutHeader($header);
39
+ }
40
+ }
41
+
42
+ return $next($request);
43
+ }
44
+ }
vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+
11
+ /**
12
+ * Set headers on the request.
13
+ *
14
+ * If the header does not exist it wil be set, if the header already exists it will be replaced.
15
+ *
16
+ * @author Soufiane Ghzal <sghzal@gmail.com>
17
+ */
18
+ final class HeaderSetPlugin implements Plugin
19
+ {
20
+ /**
21
+ * @var array
22
+ */
23
+ private $headers;
24
+
25
+ /**
26
+ * @param array $headers Hashmap of header name to header value
27
+ */
28
+ public function __construct(array $headers)
29
+ {
30
+ $this->headers = $headers;
31
+ }
32
+
33
+ /**
34
+ * {@inheritdoc}
35
+ */
36
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
37
+ {
38
+ foreach ($this->headers as $header => $headerValue) {
39
+ $request = $request->withHeader($header, $headerValue);
40
+ }
41
+
42
+ return $next($request);
43
+ }
44
+ }
vendor/php-http/client-common/src/Plugin/HistoryPlugin.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Client\ClientExceptionInterface;
10
+ use Psr\Http\Message\RequestInterface;
11
+ use Psr\Http\Message\ResponseInterface;
12
+
13
+ /**
14
+ * Record HTTP calls.
15
+ *
16
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
17
+ */
18
+ final class HistoryPlugin implements Plugin
19
+ {
20
+ /**
21
+ * Journal use to store request / responses / exception.
22
+ *
23
+ * @var Journal
24
+ */
25
+ private $journal;
26
+
27
+ public function __construct(Journal $journal)
28
+ {
29
+ $this->journal = $journal;
30
+ }
31
+
32
+ /**
33
+ * {@inheritdoc}
34
+ */
35
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
36
+ {
37
+ $journal = $this->journal;
38
+
39
+ return $next($request)->then(function (ResponseInterface $response) use ($request, $journal) {
40
+ $journal->addSuccess($request, $response);
41
+
42
+ return $response;
43
+ }, function (ClientExceptionInterface $exception) use ($request, $journal) {
44
+ $journal->addFailure($request, $exception);
45
+
46
+ throw $exception;
47
+ });
48
+ }
49
+ }
vendor/php-http/client-common/src/Plugin/Journal.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Psr\Http\Client\ClientExceptionInterface;
8
+ use Psr\Http\Message\RequestInterface;
9
+ use Psr\Http\Message\ResponseInterface;
10
+
11
+ /**
12
+ * Records history of HTTP calls.
13
+ *
14
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
15
+ */
16
+ interface Journal
17
+ {
18
+ /**
19
+ * Record a successful call.
20
+ *
21
+ * @param RequestInterface $request Request use to make the call
22
+ * @param ResponseInterface $response Response returned by the call
23
+ */
24
+ public function addSuccess(RequestInterface $request, ResponseInterface $response);
25
+
26
+ /**
27
+ * Record a failed call.
28
+ *
29
+ * @param RequestInterface $request Request use to make the call
30
+ * @param ClientExceptionInterface $exception Exception returned by the call
31
+ */
32
+ public function addFailure(RequestInterface $request, ClientExceptionInterface $exception);
33
+ }
vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+
11
+ /**
12
+ * Set query to default value if it does not exist.
13
+ *
14
+ * If a given query parameter already exists the value wont be replaced and the request wont be changed.
15
+ *
16
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
17
+ */
18
+ final class QueryDefaultsPlugin implements Plugin
19
+ {
20
+ /**
21
+ * @var array
22
+ */
23
+ private $queryParams = [];
24
+
25
+ /**
26
+ * @param array $queryParams Hashmap of query name to query value. Names and values must not be url encoded as
27
+ * this plugin will encode them
28
+ */
29
+ public function __construct(array $queryParams)
30
+ {
31
+ $this->queryParams = $queryParams;
32
+ }
33
+
34
+ /**
35
+ * {@inheritdoc}
36
+ */
37
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
38
+ {
39
+ $uri = $request->getUri();
40
+
41
+ parse_str($uri->getQuery(), $query);
42
+ $query += $this->queryParams;
43
+
44
+ $request = $request->withUri(
45
+ $uri->withQuery(http_build_query($query))
46
+ );
47
+
48
+ return $next($request);
49
+ }
50
+ }
vendor/php-http/client-common/src/Plugin/RedirectPlugin.php ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Exception\CircularRedirectionException;
8
+ use Http\Client\Common\Exception\MultipleRedirectionException;
9
+ use Http\Client\Common\Plugin;
10
+ use Http\Client\Exception\HttpException;
11
+ use Http\Promise\Promise;
12
+ use Psr\Http\Message\RequestInterface;
13
+ use Psr\Http\Message\ResponseInterface;
14
+ use Psr\Http\Message\UriInterface;
15
+ use Symfony\Component\OptionsResolver\OptionsResolver;
16
+
17
+ /**
18
+ * Follow redirections.
19
+ *
20
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
21
+ */
22
+ final class RedirectPlugin implements Plugin
23
+ {
24
+ /**
25
+ * Rule on how to redirect, change method for the new request.
26
+ *
27
+ * @var array
28
+ */
29
+ private $redirectCodes = [
30
+ 300 => [
31
+ 'switch' => [
32
+ 'unless' => ['GET', 'HEAD'],
33
+ 'to' => 'GET',
34
+ ],
35
+ 'multiple' => true,
36
+ 'permanent' => false,
37
+ ],
38
+ 301 => [
39
+ 'switch' => [
40
+ 'unless' => ['GET', 'HEAD'],
41
+ 'to' => 'GET',
42
+ ],
43
+ 'multiple' => false,
44
+ 'permanent' => true,
45
+ ],
46
+ 302 => [
47
+ 'switch' => [
48
+ 'unless' => ['GET', 'HEAD'],
49
+ 'to' => 'GET',
50
+ ],
51
+ 'multiple' => false,
52
+ 'permanent' => false,
53
+ ],
54
+ 303 => [
55
+ 'switch' => [
56
+ 'unless' => ['GET', 'HEAD'],
57
+ 'to' => 'GET',
58
+ ],
59
+ 'multiple' => false,
60
+ 'permanent' => false,
61
+ ],
62
+ 307 => [
63
+ 'switch' => false,
64
+ 'multiple' => false,
65
+ 'permanent' => false,
66
+ ],
67
+ 308 => [
68
+ 'switch' => false,
69
+ 'multiple' => false,
70
+ 'permanent' => true,
71
+ ],
72
+ ];
73
+
74
+ /**
75
+ * Determine how header should be preserved from old request.
76
+ *
77
+ * @var bool|array
78
+ *
79
+ * true will keep all previous headers (default value)
80
+ * false will ditch all previous headers
81
+ * string[] will keep only headers with the specified names
82
+ */
83
+ private $preserveHeader;
84
+
85
+ /**
86
+ * Store all previous redirect from 301 / 308 status code.
87
+ *
88
+ * @var array
89
+ */
90
+ private $redirectStorage = [];
91
+
92
+ /**
93
+ * Whether the location header must be directly used for a multiple redirection status code (300).
94
+ *
95
+ * @var bool
96
+ */
97
+ private $useDefaultForMultiple;
98
+
99
+ /**
100
+ * @var string[][] Chain identifier => list of URLs for this chain
101
+ */
102
+ private $circularDetection = [];
103
+
104
+ /**
105
+ * @param array{'preserve_header'?: bool|string[], 'use_default_for_multiple'?: bool, 'strict'?: bool} $config
106
+ *
107
+ * Configuration options:
108
+ * - preserve_header: True keeps all headers, false remove all of them, an array is interpreted as a list of header names to keep
109
+ * - use_default_for_multiple: Whether the location header must be directly used for a multiple redirection status code (300)
110
+ * - strict: When true, redirect codes 300, 301, 302 will not modify request method and body.
111
+ */
112
+ public function __construct(array $config = [])
113
+ {
114
+ $resolver = new OptionsResolver();
115
+ $resolver->setDefaults([
116
+ 'preserve_header' => true,
117
+ 'use_default_for_multiple' => true,
118
+ 'strict' => false,
119
+ ]);
120
+ $resolver->setAllowedTypes('preserve_header', ['bool', 'array']);
121
+ $resolver->setAllowedTypes('use_default_for_multiple', 'bool');
122
+ $resolver->setAllowedTypes('strict', 'bool');
123
+ $resolver->setNormalizer('preserve_header', function (OptionsResolver $resolver, $value) {
124
+ if (is_bool($value) && false === $value) {
125
+ return [];
126
+ }
127
+
128
+ return $value;
129
+ });
130
+ $options = $resolver->resolve($config);
131
+
132
+ $this->preserveHeader = $options['preserve_header'];
133
+ $this->useDefaultForMultiple = $options['use_default_for_multiple'];
134
+
135
+ if ($options['strict']) {
136
+ $this->redirectCodes[300]['switch'] = false;
137
+ $this->redirectCodes[301]['switch'] = false;
138
+ $this->redirectCodes[302]['switch'] = false;
139
+ }
140
+ }
141
+
142
+ /**
143
+ * {@inheritdoc}
144
+ */
145
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
146
+ {
147
+ // Check in storage
148
+ if (array_key_exists((string) $request->getUri(), $this->redirectStorage)) {
149
+ $uri = $this->redirectStorage[(string) $request->getUri()]['uri'];
150
+ $statusCode = $this->redirectStorage[(string) $request->getUri()]['status'];
151
+ $redirectRequest = $this->buildRedirectRequest($request, $uri, $statusCode);
152
+
153
+ return $first($redirectRequest);
154
+ }
155
+
156
+ return $next($request)->then(function (ResponseInterface $response) use ($request, $first): ResponseInterface {
157
+ $statusCode = $response->getStatusCode();
158
+
159
+ if (!array_key_exists($statusCode, $this->redirectCodes)) {
160
+ return $response;
161
+ }
162
+
163
+ $uri = $this->createUri($response, $request);
164
+ $redirectRequest = $this->buildRedirectRequest($request, $uri, $statusCode);
165
+ $chainIdentifier = spl_object_hash((object) $first);
166
+
167
+ if (!array_key_exists($chainIdentifier, $this->circularDetection)) {
168
+ $this->circularDetection[$chainIdentifier] = [];
169
+ }
170
+
171
+ $this->circularDetection[$chainIdentifier][] = (string) $request->getUri();
172
+
173
+ if (in_array((string) $redirectRequest->getUri(), $this->circularDetection[$chainIdentifier])) {
174
+ throw new CircularRedirectionException('Circular redirection detected', $request, $response);
175
+ }
176
+
177
+ if ($this->redirectCodes[$statusCode]['permanent']) {
178
+ $this->redirectStorage[(string) $request->getUri()] = [
179
+ 'uri' => $uri,
180
+ 'status' => $statusCode,
181
+ ];
182
+ }
183
+
184
+ // Call redirect request synchronously
185
+ return $first($redirectRequest)->wait();
186
+ });
187
+ }
188
+
189
+ private function buildRedirectRequest(RequestInterface $originalRequest, UriInterface $targetUri, int $statusCode): RequestInterface
190
+ {
191
+ $originalRequest = $originalRequest->withUri($targetUri);
192
+
193
+ if (false !== $this->redirectCodes[$statusCode]['switch'] && !in_array($originalRequest->getMethod(), $this->redirectCodes[$statusCode]['switch']['unless'])) {
194
+ $originalRequest = $originalRequest->withMethod($this->redirectCodes[$statusCode]['switch']['to']);
195
+ }
196
+
197
+ if (is_array($this->preserveHeader)) {
198
+ $headers = array_keys($originalRequest->getHeaders());
199
+
200
+ foreach ($headers as $name) {
201
+ if (!in_array($name, $this->preserveHeader)) {
202
+ $originalRequest = $originalRequest->withoutHeader($name);
203
+ }
204
+ }
205
+ }
206
+
207
+ return $originalRequest;
208
+ }
209
+
210
+ /**
211
+ * Creates a new Uri from the old request and the location header.
212
+ *
213
+ * @throws HttpException If location header is not usable (missing or incorrect)
214
+ * @throws MultipleRedirectionException If a 300 status code is received and default location cannot be resolved (doesn't use the location header or not present)
215
+ */
216
+ private function createUri(ResponseInterface $redirectResponse, RequestInterface $originalRequest): UriInterface
217
+ {
218
+ if ($this->redirectCodes[$redirectResponse->getStatusCode()]['multiple'] && (!$this->useDefaultForMultiple || !$redirectResponse->hasHeader('Location'))) {
219
+ throw new MultipleRedirectionException('Cannot choose a redirection', $originalRequest, $redirectResponse);
220
+ }
221
+
222
+ if (!$redirectResponse->hasHeader('Location')) {
223
+ throw new HttpException('Redirect status code, but no location header present in the response', $originalRequest, $redirectResponse);
224
+ }
225
+
226
+ $location = $redirectResponse->getHeaderLine('Location');
227
+ $parsedLocation = parse_url($location);
228
+
229
+ if (false === $parsedLocation) {
230
+ throw new HttpException(sprintf('Location %s could not be parsed', $location), $originalRequest, $redirectResponse);
231
+ }
232
+
233
+ $uri = $originalRequest->getUri();
234
+
235
+ if (array_key_exists('scheme', $parsedLocation)) {
236
+ $uri = $uri->withScheme($parsedLocation['scheme']);
237
+ }
238
+
239
+ if (array_key_exists('host', $parsedLocation)) {
240
+ $uri = $uri->withHost($parsedLocation['host']);
241
+ }
242
+
243
+ if (array_key_exists('port', $parsedLocation)) {
244
+ $uri = $uri->withPort($parsedLocation['port']);
245
+ }
246
+
247
+ if (array_key_exists('path', $parsedLocation)) {
248
+ $uri = $uri->withPath($parsedLocation['path']);
249
+ }
250
+
251
+ if (array_key_exists('query', $parsedLocation)) {
252
+ $uri = $uri->withQuery($parsedLocation['query']);
253
+ } else {
254
+ $uri = $uri->withQuery('');
255
+ }
256
+
257
+ if (array_key_exists('fragment', $parsedLocation)) {
258
+ $uri = $uri->withFragment($parsedLocation['fragment']);
259
+ } else {
260
+ $uri = $uri->withFragment('');
261
+ }
262
+
263
+ return $uri;
264
+ }
265
+ }
vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Message\RequestMatcher;
9
+ use Http\Promise\Promise;
10
+ use Psr\Http\Message\RequestInterface;
11
+
12
+ /**
13
+ * Apply a delegated plugin based on a request match.
14
+ *
15
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
16
+ */
17
+ final class RequestMatcherPlugin implements Plugin
18
+ {
19
+ /**
20
+ * @var RequestMatcher
21
+ */
22
+ private $requestMatcher;
23
+
24
+ /**
25
+ * @var Plugin|null
26
+ */
27
+ private $successPlugin;
28
+
29
+ /**
30
+ * @var Plugin|null
31
+ */
32
+ private $failurePlugin;
33
+
34
+ public function __construct(RequestMatcher $requestMatcher, ?Plugin $delegateOnMatch, Plugin $delegateOnNoMatch = null)
35
+ {
36
+ $this->requestMatcher = $requestMatcher;
37
+ $this->successPlugin = $delegateOnMatch;
38
+ $this->failurePlugin = $delegateOnNoMatch;
39
+ }
40
+
41
+ /**
42
+ * {@inheritdoc}
43
+ */
44
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
45
+ {
46
+ if ($this->requestMatcher->matches($request)) {
47
+ if (null !== $this->successPlugin) {
48
+ return $this->successPlugin->handleRequest($request, $next, $first);
49
+ }
50
+ } elseif (null !== $this->failurePlugin) {
51
+ return $this->failurePlugin->handleRequest($request, $next, $first);
52
+ }
53
+
54
+ return $next($request);
55
+ }
56
+ }
vendor/php-http/client-common/src/Plugin/RequestSeekableBodyPlugin.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Message\Stream\BufferedStream;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+
11
+ /**
12
+ * Allow body used in request to be always seekable.
13
+ *
14
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
15
+ */
16
+ final class RequestSeekableBodyPlugin extends SeekableBodyPlugin
17
+ {
18
+ /**
19
+ * {@inheritdoc}
20
+ */
21
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
22
+ {
23
+ if (!$request->getBody()->isSeekable()) {
24
+ $request = $request->withBody(new BufferedStream($request->getBody(), $this->useFileBuffer, $this->memoryBufferSize));
25
+ }
26
+
27
+ return $next($request);
28
+ }
29
+ }
vendor/php-http/client-common/src/Plugin/ResponseSeekableBodyPlugin.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Message\Stream\BufferedStream;
8
+ use Http\Promise\Promise;
9
+ use Psr\Http\Message\RequestInterface;
10
+ use Psr\Http\Message\ResponseInterface;
11
+
12
+ /**
13
+ * Allow body used in response to be always seekable.
14
+ *
15
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
16
+ */
17
+ final class ResponseSeekableBodyPlugin extends SeekableBodyPlugin
18
+ {
19
+ /**
20
+ * {@inheritdoc}
21
+ */
22
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
23
+ {
24
+ return $next($request)->then(function (ResponseInterface $response) {
25
+ if ($response->getBody()->isSeekable()) {
26
+ return $response;
27
+ }
28
+
29
+ return $response->withBody(new BufferedStream($response->getBody(), $this->useFileBuffer, $this->memoryBufferSize));
30
+ });
31
+ }
32
+ }
vendor/php-http/client-common/src/Plugin/RetryPlugin.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Client\Exception\HttpException;
9
+ use Http\Promise\Promise;
10
+ use Psr\Http\Client\ClientExceptionInterface;
11
+ use Psr\Http\Message\RequestInterface;
12
+ use Psr\Http\Message\ResponseInterface;
13
+ use Symfony\Component\OptionsResolver\OptionsResolver;
14
+
15
+ /**
16
+ * Retry the request if an exception is thrown.
17
+ *
18
+ * By default will retry only one time.
19
+ *
20
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
21
+ */
22
+ final class RetryPlugin implements Plugin
23
+ {
24
+ /**
25
+ * Number of retry before sending an exception.
26
+ *
27
+ * @var int
28
+ */
29
+ private $retry;
30
+
31
+ /**
32
+ * @var callable
33
+ */
34
+ private $errorResponseDelay;
35
+
36
+ /**
37
+ * @var callable
38
+ */
39
+ private $errorResponseDecider;
40
+
41
+ /**
42
+ * @var callable
43
+ */
44
+ private $exceptionDecider;
45
+
46
+ /**
47
+ * @var callable
48
+ */
49
+ private $exceptionDelay;
50
+
51
+ /**
52
+ * Store the retry counter for each request.
53
+ *
54
+ * @var array
55
+ */
56
+ private $retryStorage = [];
57
+
58
+ /**
59
+ * @param array{'retries'?: int, 'error_response_decider'?: callable, 'exception_decider'?: callable, 'error_response_delay'?: callable, 'exception_delay'?: callable} $config
60
+ *
61
+ * Configuration options:
62
+ * - retries: Number of retries to attempt if an exception occurs before letting the exception bubble up
63
+ * - error_response_decider: A callback that gets a request and response to decide whether the request should be retried
64
+ * - exception_decider: A callback that gets a request and an exception to decide after a failure whether the request should be retried
65
+ * - error_response_delay: A callback that gets a request and response and the current number of retries and returns how many microseconds we should wait before trying again
66
+ * - exception_delay: A callback that gets a request, an exception and the current number of retries and returns how many microseconds we should wait before trying again
67
+ */
68
+ public function __construct(array $config = [])
69
+ {
70
+ $resolver = new OptionsResolver();
71
+ $resolver->setDefaults([
72
+ 'retries' => 1,
73
+ 'error_response_decider' => function (RequestInterface $request, ResponseInterface $response) {
74
+ // do not retry client errors
75
+ return $response->getStatusCode() >= 500 && $response->getStatusCode() < 600;
76
+ },
77
+ 'exception_decider' => function (RequestInterface $request, ClientExceptionInterface $e) {
78
+ // do not retry client errors
79
+ return !$e instanceof HttpException || $e->getCode() >= 500 && $e->getCode() < 600;
80
+ },
81
+ 'error_response_delay' => __CLASS__.'::defaultErrorResponseDelay',
82
+ 'exception_delay' => __CLASS__.'::defaultExceptionDelay',
83
+ ]);
84
+
85
+ $resolver->setAllowedTypes('retries', 'int');
86
+ $resolver->setAllowedTypes('error_response_decider', 'callable');
87
+ $resolver->setAllowedTypes('exception_decider', 'callable');
88
+ $resolver->setAllowedTypes('error_response_delay', 'callable');
89
+ $resolver->setAllowedTypes('exception_delay', 'callable');
90
+ $options = $resolver->resolve($config);
91
+
92
+ $this->retry = $options['retries'];
93
+ $this->errorResponseDecider = $options['error_response_decider'];
94
+ $this->errorResponseDelay = $options['error_response_delay'];
95
+ $this->exceptionDecider = $options['exception_decider'];
96
+ $this->exceptionDelay = $options['exception_delay'];
97
+ }
98
+
99
+ /**
100
+ * {@inheritdoc}
101
+ */
102
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
103
+ {
104
+ $chainIdentifier = spl_object_hash((object) $first);
105
+
106
+ return $next($request)->then(function (ResponseInterface $response) use ($request, $next, $first, $chainIdentifier) {
107
+ if (!array_key_exists($chainIdentifier, $this->retryStorage)) {
108
+ $this->retryStorage[$chainIdentifier] = 0;
109
+ }
110
+
111
+ if ($this->retryStorage[$chainIdentifier] >= $this->retry) {
112
+ unset($this->retryStorage[$chainIdentifier]);
113
+
114
+ return $response;
115
+ }
116
+
117
+ if (call_user_func($this->errorResponseDecider, $request, $response)) {
118
+ /** @var int $time */
119
+ $time = call_user_func($this->errorResponseDelay, $request, $response, $this->retryStorage[$chainIdentifier]);
120
+ $response = $this->retry($request, $next, $first, $chainIdentifier, $time);
121
+ }
122
+
123
+ if (array_key_exists($chainIdentifier, $this->retryStorage)) {
124
+ unset($this->retryStorage[$chainIdentifier]);
125
+ }
126
+
127
+ return $response;
128
+ }, function (ClientExceptionInterface $exception) use ($request, $next, $first, $chainIdentifier) {
129
+ if (!array_key_exists($chainIdentifier, $this->retryStorage)) {
130
+ $this->retryStorage[$chainIdentifier] = 0;
131
+ }
132
+
133
+ if ($this->retryStorage[$chainIdentifier] >= $this->retry) {
134
+ unset($this->retryStorage[$chainIdentifier]);
135
+
136
+ throw $exception;
137
+ }
138
+
139
+ if (!call_user_func($this->exceptionDecider, $request, $exception)) {
140
+ throw $exception;
141
+ }
142
+
143
+ /** @var int $time */
144
+ $time = call_user_func($this->exceptionDelay, $request, $exception, $this->retryStorage[$chainIdentifier]);
145
+
146
+ return $this->retry($request, $next, $first, $chainIdentifier, $time);
147
+ });
148
+ }
149
+
150
+ /**
151
+ * @param int $retries The number of retries we made before. First time this get called it will be 0.
152
+ */
153
+ public static function defaultErrorResponseDelay(RequestInterface $request, ResponseInterface $response, int $retries): int
154
+ {
155
+ return pow(2, $retries) * 500000;
156
+ }
157
+
158
+ /**
159
+ * @param int $retries The number of retries we made before. First time this get called it will be 0.
160
+ */
161
+ public static function defaultExceptionDelay(RequestInterface $request, ClientExceptionInterface $e, int $retries): int
162
+ {
163
+ return pow(2, $retries) * 500000;
164
+ }
165
+
166
+ /**
167
+ * @throws \Exception if retrying returns a failed promise
168
+ */
169
+ private function retry(RequestInterface $request, callable $next, callable $first, string $chainIdentifier, int $delay): ResponseInterface
170
+ {
171
+ usleep($delay);
172
+
173
+ // Retry synchronously
174
+ ++$this->retryStorage[$chainIdentifier];
175
+ $promise = $this->handleRequest($request, $next, $first);
176
+
177
+ return $promise->wait();
178
+ }
179
+ }
vendor/php-http/client-common/src/Plugin/SeekableBodyPlugin.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Client\Common\Plugin;
8
+ use Symfony\Component\OptionsResolver\OptionsResolver;
9
+
10
+ /**
11
+ * @internal
12
+ */
13
+ abstract class SeekableBodyPlugin implements Plugin
14
+ {
15
+ /**
16
+ * @var bool
17
+ */
18
+ protected $useFileBuffer;
19
+
20
+ /**
21
+ * @var int
22
+ */
23
+ protected $memoryBufferSize;
24
+
25
+ /**
26
+ * @param array{'use_file_buffer'?: bool, 'memory_boffer_size'?: int} $config
27
+ *
28
+ * Configuration options:
29
+ * - use_file_buffer: Whether this plugin should use a file as a buffer if the stream is too big, defaults to true
30
+ * - memory_buffer_size: Max memory size in bytes to use for the buffer before it use a file, defaults to 2097152 (2 mb)
31
+ */
32
+ public function __construct(array $config = [])
33
+ {
34
+ $resolver = new OptionsResolver();
35
+ $resolver->setDefaults([
36
+ 'use_file_buffer' => true,
37
+ 'memory_buffer_size' => 2097152,
38
+ ]);
39
+ $resolver->setAllowedTypes('use_file_buffer', 'bool');
40
+ $resolver->setAllowedTypes('memory_buffer_size', 'int');
41
+
42
+ $options = $resolver->resolve($config);
43
+
44
+ $this->useFileBuffer = $options['use_file_buffer'];
45
+ $this->memoryBufferSize = $options['memory_buffer_size'];
46
+ }
47
+ }
vendor/php-http/client-common/src/Plugin/VersionBridgePlugin.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common\Plugin;
6
+
7
+ use Http\Promise\Promise;
8
+ use Psr\Http\Message\RequestInterface;
9
+
10
+ /**
11
+ * A plugin that helps you migrate from php-http/client-common 1.x to 2.x. This
12
+ * will also help you to support PHP5 at the same time you support 2.x.
13
+ *
14
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
15
+ */
16
+ trait VersionBridgePlugin
17
+ {
18
+ abstract protected function doHandleRequest(RequestInterface $request, callable $next, callable $first);
19
+
20
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
21
+ {
22
+ return $this->doHandleRequest($request, $next, $first);
23
+ }
24
+ }
vendor/php-http/client-common/src/PluginChain.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use function array_reverse;
8
+ use Http\Client\Common\Exception\LoopException;
9
+ use Http\Promise\Promise;
10
+ use Psr\Http\Message\RequestInterface;
11
+
12
+ final class PluginChain
13
+ {
14
+ /** @var Plugin[] */
15
+ private $plugins;
16
+
17
+ /** @var callable(RequestInterface): Promise */
18
+ private $clientCallable;
19
+
20
+ /** @var int */
21
+ private $maxRestarts;
22
+
23
+ /** @var int */
24
+ private $restarts = 0;
25
+
26
+ /**
27
+ * @param Plugin[] $plugins A plugin chain
28
+ * @param callable(RequestInterface): Promise $clientCallable Callable making the HTTP call
29
+ * @param array{'max_restarts'?: int} $options
30
+ */
31
+ public function __construct(array $plugins, callable $clientCallable, array $options = [])
32
+ {
33
+ $this->plugins = $plugins;
34
+ $this->clientCallable = $clientCallable;
35
+ $this->maxRestarts = (int) ($options['max_restarts'] ?? 0);
36
+ }
37
+
38
+ private function createChain(): callable
39
+ {
40
+ $lastCallable = $this->clientCallable;
41
+ $reversedPlugins = array_reverse($this->plugins);
42
+
43
+ foreach ($reversedPlugins as $plugin) {
44
+ $lastCallable = function (RequestInterface $request) use ($plugin, $lastCallable) {
45
+ return $plugin->handleRequest($request, $lastCallable, $this);
46
+ };
47
+ }
48
+
49
+ return $lastCallable;
50
+ }
51
+
52
+ public function __invoke(RequestInterface $request): Promise
53
+ {
54
+ if ($this->restarts > $this->maxRestarts) {
55
+ throw new LoopException('Too many restarts in plugin client', $request);
56
+ }
57
+
58
+ ++$this->restarts;
59
+
60
+ return $this->createChain()($request);
61
+ }
62
+ }
vendor/php-http/client-common/src/PluginClient.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\Exception as HttplugException;
8
+ use Http\Client\HttpAsyncClient;
9
+ use Http\Client\HttpClient;
10
+ use Http\Client\Promise\HttpFulfilledPromise;
11
+ use Http\Client\Promise\HttpRejectedPromise;
12
+ use Http\Promise\Promise;
13
+ use Psr\Http\Client\ClientInterface;
14
+ use Psr\Http\Message\RequestInterface;
15
+ use Psr\Http\Message\ResponseInterface;
16
+ use Symfony\Component\OptionsResolver\OptionsResolver;
17
+
18
+ /**
19
+ * The client managing plugins and providing a decorator around HTTP Clients.
20
+ *
21
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
22
+ */
23
+ final class PluginClient implements HttpClient, HttpAsyncClient
24
+ {
25
+ /**
26
+ * An HTTP async client.
27
+ *
28
+ * @var HttpAsyncClient
29
+ */
30
+ private $client;
31
+
32
+ /**
33
+ * The plugin chain.
34
+ *
35
+ * @var Plugin[]
36
+ */
37
+ private $plugins;
38
+
39
+ /**
40
+ * A list of options.
41
+ *
42
+ * @var array
43
+ */
44
+ private $options;
45
+
46
+ /**
47
+ * @param ClientInterface|HttpAsyncClient $client An HTTP async client
48
+ * @param Plugin[] $plugins A plugin chain
49
+ * @param array{'max_restarts'?: int} $options
50
+ */
51
+ public function __construct($client, array $plugins = [], array $options = [])
52
+ {
53
+ if ($client instanceof HttpAsyncClient) {
54
+ $this->client = $client;
55
+ } elseif ($client instanceof ClientInterface) {
56
+ $this->client = new EmulatedHttpAsyncClient($client);
57
+ } else {
58
+ throw new \TypeError(
59
+ sprintf('%s::__construct(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client))
60
+ );
61
+ }
62
+
63
+ $this->plugins = $plugins;
64
+ $this->options = $this->configure($options);
65
+ }
66
+
67
+ /**
68
+ * {@inheritdoc}
69
+ */
70
+ public function sendRequest(RequestInterface $request): ResponseInterface
71
+ {
72
+ // If the client doesn't support sync calls, call async
73
+ if (!$this->client instanceof ClientInterface) {
74
+ return $this->sendAsyncRequest($request)->wait();
75
+ }
76
+
77
+ // Else we want to use the synchronous call of the underlying client,
78
+ // and not the async one in the case we have both an async and sync call
79
+ $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) {
80
+ try {
81
+ return new HttpFulfilledPromise($this->client->sendRequest($request));
82
+ } catch (HttplugException $exception) {
83
+ return new HttpRejectedPromise($exception);
84
+ }
85
+ });
86
+
87
+ return $pluginChain($request)->wait();
88
+ }
89
+
90
+ /**
91
+ * {@inheritdoc}
92
+ */
93
+ public function sendAsyncRequest(RequestInterface $request)
94
+ {
95
+ $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) {
96
+ return $this->client->sendAsyncRequest($request);
97
+ });
98
+
99
+ return $pluginChain($request);
100
+ }
101
+
102
+ /**
103
+ * Configure the plugin client.
104
+ */
105
+ private function configure(array $options = []): array
106
+ {
107
+ $resolver = new OptionsResolver();
108
+ $resolver->setDefaults([
109
+ 'max_restarts' => 10,
110
+ ]);
111
+
112
+ $resolver->setAllowedTypes('max_restarts', 'int');
113
+
114
+ return $resolver->resolve($options);
115
+ }
116
+
117
+ /**
118
+ * Create the plugin chain.
119
+ *
120
+ * @param Plugin[] $plugins A plugin chain
121
+ * @param callable $clientCallable Callable making the HTTP call
122
+ *
123
+ * @return callable(RequestInterface): Promise
124
+ */
125
+ private function createPluginChain(array $plugins, callable $clientCallable): callable
126
+ {
127
+ /** @var callable(RequestInterface): Promise */
128
+ return new PluginChain($plugins, $clientCallable, $this->options);
129
+ }
130
+ }
vendor/php-http/client-common/src/PluginClientBuilder.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\HttpAsyncClient;
8
+ use Psr\Http\Client\ClientInterface;
9
+
10
+ /**
11
+ * Build an instance of a PluginClient with a dynamic list of plugins.
12
+ *
13
+ * @author Baptiste Clavié <clavie.b@gmail.com>
14
+ */
15
+ final class PluginClientBuilder
16
+ {
17
+ /** @var Plugin[][] List of plugins ordered by priority [priority => Plugin[]]). */
18
+ private $plugins = [];
19
+
20
+ /** @var array Array of options to give to the plugin client */
21
+ private $options = [];
22
+
23
+ /**
24
+ * @param int $priority Priority of the plugin. The higher comes first.
25
+ */
26
+ public function addPlugin(Plugin $plugin, int $priority = 0): self
27
+ {
28
+ $this->plugins[$priority][] = $plugin;
29
+
30
+ return $this;
31
+ }
32
+
33
+ /**
34
+ * @param mixed $value
35
+ */
36
+ public function setOption(string $name, $value): self
37
+ {
38
+ $this->options[$name] = $value;
39
+
40
+ return $this;
41
+ }
42
+
43
+ public function removeOption(string $name): self
44
+ {
45
+ unset($this->options[$name]);
46
+
47
+ return $this;
48
+ }
49
+
50
+ /**
51
+ * @param ClientInterface|HttpAsyncClient $client
52
+ */
53
+ public function createClient($client): PluginClient
54
+ {
55
+ if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) {
56
+ throw new \TypeError(
57
+ sprintf('%s::createClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client))
58
+ );
59
+ }
60
+
61
+ $plugins = $this->plugins;
62
+
63
+ if (0 === count($plugins)) {
64
+ $plugins[] = [];
65
+ }
66
+
67
+ krsort($plugins);
68
+ $plugins = array_merge(...$plugins);
69
+
70
+ return new PluginClient(
71
+ $client,
72
+ array_values($plugins),
73
+ $this->options
74
+ );
75
+ }
76
+ }
vendor/php-http/client-common/src/PluginClientFactory.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Http\Client\HttpAsyncClient;
8
+ use Psr\Http\Client\ClientInterface;
9
+
10
+ /**
11
+ * Factory to create PluginClient instances. Using this factory instead of calling PluginClient constructor will enable
12
+ * the Symfony profiling without any configuration.
13
+ *
14
+ * @author Fabien Bourigault <bourigaultfabien@gmail.com>
15
+ */
16
+ final class PluginClientFactory
17
+ {
18
+ /**
19
+ * @var (callable(ClientInterface|HttpAsyncClient, Plugin[], array): PluginClient)|null
20
+ */
21
+ private static $factory;
22
+
23
+ /**
24
+ * Set the factory to use.
25
+ * The callable to provide must have the same arguments and return type as PluginClientFactory::createClient.
26
+ * This is used by the HTTPlugBundle to provide a better Symfony integration.
27
+ * Unlike the createClient method, this one is static to allow zero configuration profiling by hooking into early
28
+ * application execution.
29
+ *
30
+ * @internal
31
+ *
32
+ * @param callable(ClientInterface|HttpAsyncClient, Plugin[], array): PluginClient $factory
33
+ */
34
+ public static function setFactory(callable $factory): void
35
+ {
36
+ static::$factory = $factory;
37
+ }
38
+
39
+ /**
40
+ * @param ClientInterface|HttpAsyncClient $client
41
+ * @param Plugin[] $plugins
42
+ * @param array{'client_name'?: string} $options
43
+ *
44
+ * Configuration options:
45
+ * - client_name: to give client a name which may be used when displaying client information
46
+ * like in the HTTPlugBundle profiler.
47
+ *
48
+ * @see PluginClient constructor for PluginClient specific $options.
49
+ */
50
+ public function createClient($client, array $plugins = [], array $options = []): PluginClient
51
+ {
52
+ if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) {
53
+ throw new \TypeError(
54
+ sprintf('%s::createClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client))
55
+ );
56
+ }
57
+
58
+ if (static::$factory) {
59
+ $factory = static::$factory;
60
+
61
+ return $factory($client, $plugins, $options);
62
+ }
63
+
64
+ unset($options['client_name']);
65
+
66
+ return new PluginClient($client, $plugins, $options);
67
+ }
68
+ }
vendor/php-http/client-common/src/VersionBridgeClient.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Http\Client\Common;
6
+
7
+ use Psr\Http\Message\RequestInterface;
8
+ use Psr\Http\Message\ResponseInterface;
9
+
10
+ /**
11
+ * A client that helps you migrate from php-http/httplug 1.x to 2.x. This
12
+ * will also help you to support PHP5 at the same time you support 2.x.
13
+ *
14
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
15
+ */
16
+ trait VersionBridgeClient
17
+ {
18
+ abstract protected function doSendRequest(RequestInterface $request);
19
+
20
+ public function sendRequest(RequestInterface $request): ResponseInterface
21
+ {
22
+ return $this->doSendRequest($request);
23
+ }
24
+ }
vendor/php-http/curl-client/.php_cs DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- return Symfony\CS\Config\Config::create()
4
- ->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
5
- ->fixers([])
6
- ->finder(
7
- Symfony\CS\Finder\DefaultFinder::create()->in(__DIR__ . '/src')
8
- )
9
- ;
 
 
 
 
 
 
 
 
 
vendor/php-http/curl-client/.styleci.yml DELETED
@@ -1,4 +0,0 @@
1
- preset: psr2
2
- finder:
3
- path:
4
- - "src"
 
 
 
 
vendor/php-http/curl-client/CHANGELOG.md DELETED
@@ -1,173 +0,0 @@
1
- # Change Log
2
-
3
- ## Unreleased
4
-
5
-
6
- ## 1.7.1 - 2018-03-36
7
-
8
- ### Fixed
9
-
10
- - #36: Failure evaluating code: is_resource($handle) (string assertions are deprecated in PHP 7.2)
11
-
12
-
13
- ## 1.7 - 2017-02-09
14
-
15
- ### Changed
16
-
17
- - #30: Make sure we rewind streams
18
-
19
- ## 1.6.2 - 2017-01-02
20
-
21
- ### Fixed
22
-
23
- - #29: Request not using CURLOPT_POSTFIELDS have content-length set to
24
-
25
- ### Changed
26
-
27
- - Use binary mode to create response body stream.
28
-
29
-
30
- ## 1.6.1 - 2016-11-11
31
-
32
- ### Fixed
33
-
34
- - #27: ErrorPlugin and sendAsyncRequest() incompatibility
35
-
36
-
37
- ## 1.6 - 2016-09-12
38
-
39
- ### Changed
40
-
41
- - `Client::sendRequest` now throws `Http\Client\Exception\NetworkException` on network errors.
42
- - `\UnexpectedValueException` replaced with `Http\Client\Exception\RequestException` in
43
- `Client::sendRequest` and `Client::sendAsyncRequest`
44
-
45
-
46
- ## 1.5.1 - 2016-08-29
47
-
48
- ### Fixed
49
-
50
- - #26: Combining CurlClient with StopwatchPlugin causes Promise onRejected handler to never be
51
- invoked.
52
-
53
-
54
- ## 1.5 - 2016-08-03
55
-
56
- ### Changed
57
-
58
- - Request body can be send with any method except GET, HEAD and TRACE.
59
- - #25: Make discovery a hard dependency.
60
-
61
-
62
- ## 1.4.2 - 2016-06-14
63
-
64
- ### Added
65
-
66
- - #23: "php-http/async-client-implementation" added to "provide" section.
67
-
68
-
69
- ## 1.4.1 - 2016-05-30
70
-
71
- ### Fixed
72
-
73
- - #22: Cannot create the client using `HttpClientDiscovery`.
74
-
75
-
76
- ## 1.4 - 2016-03-30
77
-
78
- ### Changed
79
-
80
- - #20: Minimize memory usage when reading large response body.
81
-
82
-
83
- ## 1.3 - 2016-03-14
84
-
85
- ### Fixed
86
-
87
- - #18: Invalid "Expect" header.
88
-
89
- ### Removed
90
-
91
- - #13: Remove HeaderParser.
92
-
93
-
94
- ## 1.2 - 2016-03-09
95
-
96
- ### Added
97
-
98
- - #16: Make sure discovery can find the curl client
99
-
100
- ### Fixed
101
-
102
- - #15: "Out of memory" sending large files.
103
-
104
-
105
- ## 1.1.0 - 2016-01-29
106
-
107
- ### Changed
108
-
109
- - Switch to php-http/message 1.0.
110
-
111
-
112
- ## 1.0.0 - 2016-01-28
113
-
114
- First stable release.
115
-
116
-
117
- ## 0.7.0 - 2016-01-26
118
-
119
- ### Changed
120
-
121
- - Migrate from `php-http/discovery` and `php-http/utils` to `php-http/message`.
122
-
123
- ## 0.6.0 - 2016-01-12
124
-
125
- ### Changed
126
-
127
- - Root namespace changed from `Http\Curl` to `Http\Client\Curl`.
128
- - Main client class name renamed from `CurlHttpClient` to `Client`.
129
- - Minimum required [php-http/discovery](https://packagist.org/packages/php-http/discovery)
130
- version changed to 0.5.
131
-
132
-
133
- ## 0.5.0 - 2015-12-18
134
-
135
- ### Changed
136
-
137
- - Compatibility with php-http/httplug 1.0 beta
138
- - Switch to php-http/discovery 0.4
139
-
140
-
141
- ## 0.4.0 - 2015-12-16
142
-
143
- ### Changed
144
-
145
- - Switch to php-http/message-factory 1.0
146
-
147
-
148
- ## 0.3.1 - 2015-12-14
149
-
150
- ### Changed
151
-
152
- - Requirements fixed.
153
-
154
-
155
- ## 0.3.0 - 2015-11-24
156
-
157
- ### Changed
158
-
159
- - Use cURL constants as options keys.
160
-
161
-
162
- ## 0.2.0 - 2015-11-17
163
-
164
- ### Added
165
-
166
- - HttpAsyncClient support.
167
-
168
-
169
- ## 0.1.0 - 2015-11-11
170
-
171
- ### Added
172
-
173
- - Initial release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/php-http/curl-client/README.md DELETED
@@ -1,44 +0,0 @@
1
- # Curl client for PHP HTTP
2
-
3
- [![Latest Version](https://img.shields.io/github/release/php-http/curl-client.svg?style=flat-square)](https://github.com/php-http/curl-client/releases)
4
- [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5
- [![Build Status](https://img.shields.io/travis/php-http/curl-client.svg?style=flat-square)](https://travis-ci.org/php-http/curl-client)
6
- [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/curl-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/curl-client)
7
- [![Quality Score](https://img.shields.io/scrutinizer/g/php-http/curl-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/curl-client)
8
- [![Total Downloads](https://img.shields.io/packagist/dt/php-http/curl-client.svg?style=flat-square)](https://packagist.org/packages/php-http/curl-client)
9
-
10
- The cURL client use the cURL PHP extension which must be activated in your `php.ini`.
11
-
12
-
13
- ## Install
14
-
15
- Via Composer
16
-
17
- ``` bash
18
- $ composer require php-http/curl-client
19
- ```
20
-
21
- ## Documentation
22
-
23
- Please see the [official documentation](http://docs.php-http.org/en/latest/clients/curl-client.html).
24
-
25
- ## Testing
26
-
27
- ``` bash
28
- $ composer test
29
- ```
30
-
31
- ## Contributing
32
-
33
- Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.
34
-
35
-
36
- ## Security
37
-
38
- If you discover any security related issues, please contact us at
39
- [security@php-http.org](mailto:security@php-http.org).
40
-
41
-
42
- ## License
43
-
44
- The MIT License (MIT). Please see [License File](LICENSE) for more information.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/php-http/curl-client/puli.json DELETED
@@ -1,242 +0,0 @@
1
- {
2
- "version": "1.0",
3
- "name": "php-http/curl-client",
4
- "bindings": {
5
- "98239b8b-103b-4f47-94c7-4cba49a05a1f": {
6
- "_class": "Puli\\Discovery\\Binding\\ClassBinding",
7
- "class": "Http\\Client\\Curl\\Client",
8
- "type": "Http\\Client\\HttpAsyncClient"
9
- },
10
- "a6a79968-2aa5-427c-bbe1-a581d9a48321": {
11
- "_class": "Puli\\Discovery\\Binding\\ClassBinding",
12
- "class": "Http\\Client\\Curl\\Client",
13
- "type": "Http\\Client\\HttpClient"
14
- }
15
- },
16
- "config": {
17
- "bootstrap-file": "vendor/autoload.php"
18
- },
19
- "packages": {
20
- "clue/stream-filter": {
21
- "install-path": "vendor/clue/stream-filter",
22
- "installer": "composer",
23
- "env": "dev"
24
- },
25
- "doctrine/instantiator": {
26
- "install-path": "vendor/doctrine/instantiator",
27
- "installer": "composer",
28
- "env": "dev"
29
- },
30
- "guzzlehttp/psr7": {
31
- "install-path": "vendor/guzzlehttp/psr7",
32
- "installer": "composer",
33
- "env": "dev"
34
- },
35
- "justinrainbow/json-schema": {
36
- "install-path": "vendor/justinrainbow/json-schema",
37
- "installer": "composer",
38
- "env": "dev"
39
- },
40
- "paragonie/random_compat": {
41
- "install-path": "vendor/paragonie/random_compat",
42
- "installer": "composer",
43
- "env": "dev"
44
- },
45
- "php-http/adapter-integration-tests": {
46
- "install-path": "vendor/php-http/adapter-integration-tests",
47
- "installer": "composer",
48
- "env": "dev"
49
- },
50
- "php-http/discovery": {
51
- "install-path": "vendor/php-http/discovery",
52
- "installer": "composer",
53
- "env": "dev"
54
- },
55
- "php-http/httplug": {
56
- "install-path": "vendor/php-http/httplug",
57
- "installer": "composer"
58
- },
59
- "php-http/message": {
60
- "install-path": "vendor/php-http/message",
61
- "installer": "composer",
62
- "env": "dev"
63
- },
64
- "php-http/message-factory": {
65
- "install-path": "vendor/php-http/message-factory",
66
- "installer": "composer"
67
- },
68
- "php-http/promise": {
69
- "install-path": "vendor/php-http/promise",
70
- "installer": "composer"
71
- },
72
- "phpdocumentor/reflection-docblock": {
73
- "install-path": "vendor/phpdocumentor/reflection-docblock",
74
- "installer": "composer",
75
- "env": "dev"
76
- },
77
- "phpspec/prophecy": {
78
- "install-path": "vendor/phpspec/prophecy",
79
- "installer": "composer",
80
- "env": "dev"
81
- },
82
- "phpunit/php-code-coverage": {
83
- "install-path": "vendor/phpunit/php-code-coverage",
84
- "installer": "composer",
85
- "env": "dev"
86
- },
87
- "phpunit/php-file-iterator": {
88
- "install-path": "vendor/phpunit/php-file-iterator",
89
- "installer": "composer",
90
- "env": "dev"
91
- },
92
- "phpunit/php-text-template": {
93
- "install-path": "vendor/phpunit/php-text-template",
94
- "installer": "composer",
95
- "env": "dev"
96
- },
97
- "phpunit/php-timer": {
98
- "install-path": "vendor/phpunit/php-timer",
99
- "installer": "composer",
100
- "env": "dev"
101
- },
102
- "phpunit/php-token-stream": {
103
- "install-path": "vendor/phpunit/php-token-stream",
104
- "installer": "composer",
105
- "env": "dev"
106
- },
107
- "phpunit/phpunit": {
108
- "install-path": "vendor/phpunit/phpunit",
109
- "installer": "composer",
110
- "env": "dev"
111
- },
112
- "phpunit/phpunit-mock-objects": {
113
- "install-path": "vendor/phpunit/phpunit-mock-objects",
114
- "installer": "composer",
115
- "env": "dev"
116
- },
117
- "psr/http-message": {
118
- "install-path": "vendor/psr/http-message",
119
- "installer": "composer"
120
- },
121
- "psr/log": {
122
- "install-path": "vendor/psr/log",
123
- "installer": "composer",
124
- "env": "dev"
125
- },
126
- "puli/composer-plugin": {
127
- "install-path": "vendor/puli/composer-plugin",
128
- "installer": "composer",
129
- "env": "dev"
130
- },
131
- "puli/discovery": {
132
- "install-path": "vendor/puli/discovery",
133
- "installer": "composer",
134
- "env": "dev"
135
- },
136
- "puli/repository": {
137
- "install-path": "vendor/puli/repository",
138
- "installer": "composer",
139
- "env": "dev"
140
- },
141
- "puli/url-generator": {
142
- "install-path": "vendor/puli/url-generator",
143
- "installer": "composer",
144
- "env": "dev"
145
- },
146
- "ramsey/uuid": {
147
- "install-path": "vendor/ramsey/uuid",
148
- "installer": "composer",
149
- "env": "dev"
150
- },
151
- "sebastian/comparator": {
152
- "install-path": "vendor/sebastian/comparator",
153
- "installer": "composer",
154
- "env": "dev"
155
- },
156
- "sebastian/diff": {
157
- "install-path": "vendor/sebastian/diff",
158
- "installer": "composer",
159
- "env": "dev"
160
- },
161
- "sebastian/environment": {
162
- "install-path": "vendor/sebastian/environment",
163
- "installer": "composer",
164
- "env": "dev"
165
- },
166
- "sebastian/exporter": {
167
- "install-path": "vendor/sebastian/exporter",
168
- "installer": "composer",
169
- "env": "dev"
170
- },
171
- "sebastian/global-state": {
172
- "install-path": "vendor/sebastian/global-state",
173
- "installer": "composer",
174
- "env": "dev"
175
- },
176
- "sebastian/recursion-context": {
177
- "install-path": "vendor/sebastian/recursion-context",
178
- "installer": "composer",
179
- "env": "dev"
180
- },
181
- "sebastian/version": {
182
- "install-path": "vendor/sebastian/version",
183
- "installer": "composer",
184
- "env": "dev"
185
- },
186
- "seld/jsonlint": {
187
- "install-path": "vendor/seld/jsonlint",
188
- "installer": "composer",
189
- "env": "dev"
190
- },
191
- "symfony/filesystem": {
192
- "install-path": "vendor/symfony/filesystem",
193
- "installer": "composer",
194
- "env": "dev"
195
- },
196
- "symfony/process": {
197
- "install-path": "vendor/symfony/process",
198
- "installer": "composer",
199
- "env": "dev"
200
- },
201
- "symfony/yaml": {
202
- "install-path": "vendor/symfony/yaml",
203
- "installer": "composer",
204
- "env": "dev"
205
- },
206
- "th3n3rd/cartesian-product": {
207
- "install-path": "vendor/th3n3rd/cartesian-product",
208
- "installer": "composer",
209
- "env": "dev"
210
- },
211
- "webmozart/assert": {
212
- "install-path": "vendor/webmozart/assert",
213
- "installer": "composer",
214
- "env": "dev"
215
- },
216
- "webmozart/expression": {
217
- "install-path": "vendor/webmozart/expression",
218
- "installer": "composer",
219
- "env": "dev"
220
- },
221
- "webmozart/glob": {
222
- "install-path": "vendor/webmozart/glob",
223
- "installer": "composer",
224
- "env": "dev"
225
- },
226
- "webmozart/json": {
227
- "install-path": "vendor/webmozart/json",
228
- "installer": "composer",
229
- "env": "dev"
230
- },
231
- "webmozart/path-util": {
232
- "install-path": "vendor/webmozart/path-util",
233
- "installer": "composer",
234
- "env": "dev"
235
- },
236
- "zendframework/zend-diactoros": {
237
- "install-path": "vendor/zendframework/zend-diactoros",
238
- "installer": "composer",
239
- "env": "dev"
240
- }
241
- }
242
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/php-http/curl-client/src/Client.php DELETED
@@ -1,372 +0,0 @@
1
- <?php
2
-
3
- namespace Http\Client\Curl;
4
-
5
- use Http\Client\Exception;
6
- use Http\Client\HttpAsyncClient;
7
- use Http\Client\HttpClient;
8
- use Http\Discovery\MessageFactoryDiscovery;
9
- use Http\Discovery\StreamFactoryDiscovery;
10
- use Http\Message\MessageFactory;
11
- use Http\Message\StreamFactory;
12
- use Http\Promise\Promise;
13
- use Psr\Http\Message\RequestInterface;
14
- use Psr\Http\Message\ResponseInterface;
15
-
16
- /**
17
- * PSR-7 compatible cURL based HTTP client.
18
- *
19
- * @license http://opensource.org/licenses/MIT MIT
20
- * @author Михаил Красильников <m.krasilnikov@yandex.ru>
21
- * @author Blake Williams <github@shabbyrobe.org>
22
- *
23
- * @api
24
- *
25
- * @since 1.0
26
- */
27
- class Client implements HttpClient, HttpAsyncClient
28
- {
29
- /**
30
- * cURL options.
31
- *
32
- * @var array
33
- */
34
- private $options;
35
-
36
- /**
37
- * PSR-7 message factory.
38
- *
39
- * @var MessageFactory
40
- */
41
- private $messageFactory;
42
-
43
- /**
44
- * PSR-7 stream factory.
45
- *
46
- * @var StreamFactory
47
- */
48
- private $streamFactory;
49
-
50
- /**
51
- * cURL synchronous requests handle.
52
- *
53
- * @var resource|null
54
- */
55
- private $handle = null;
56
-
57
- /**
58
- * Simultaneous requests runner.
59
- *
60
- * @var MultiRunner|null
61
- */
62
- private $multiRunner = null;
63
-
64
- /**
65
- * Create new client.
66
- *
67
- * @param MessageFactory|null $messageFactory HTTP Message factory
68
- * @param StreamFactory|null $streamFactory HTTP Stream factory
69
- * @param array $options cURL options (see http://php.net/curl_setopt)
70
- *
71
- * @throws \Http\Discovery\Exception\NotFoundException If factory discovery failed
72
- *
73
- * @since 1.0
74
- */
75
- public function __construct(
76
- MessageFactory $messageFactory = null,
77
- StreamFactory $streamFactory = null,
78
- array $options = []
79
- ) {
80
- $this->messageFactory = $messageFactory ?: MessageFactoryDiscovery::find();
81
- $this->streamFactory = $streamFactory ?: StreamFactoryDiscovery::find();
82
- $this->options = $options;
83
- }
84
-
85
- /**
86
- * Release resources if still active.
87
- */
88
- public function __destruct()
89
- {
90
- if (is_resource($this->handle)) {
91
- curl_close($this->handle);
92
- }
93
- }
94
-
95
- /**
96
- * Sends a PSR-7 request.
97
- *
98
- * @param RequestInterface $request
99
- *
100
- * @return ResponseInterface
101
- *
102
- * @throws \Http\Client\Exception\NetworkException In case of network problems
103
- * @throws \Http\Client\Exception\RequestException On invalid request
104
- * @throws \InvalidArgumentException For invalid header names or values
105
- * @throws \RuntimeException If creating the body stream fails
106
- *
107
- * @since 1.6 \UnexpectedValueException replaced with RequestException
108
- * @since 1.6 Throw NetworkException on network errors
109
- * @since 1.0
110
- */
111
- public function sendRequest(RequestInterface $request)
112
- {
113
- $responseBuilder = $this->createResponseBuilder();
114
- $options = $this->createCurlOptions($request, $responseBuilder);
115
-
116
- if (is_resource($this->handle)) {
117
- curl_reset($this->handle);
118
- } else {
119
- $this->handle = curl_init();
120
- }
121
-
122
- curl_setopt_array($this->handle, $options);
123
- curl_exec($this->handle);
124
-
125
- $errno = curl_errno($this->handle);
126
- switch ($errno) {
127
- case CURLE_OK:
128
- // All OK, no actions needed.
129
- break;
130
- case CURLE_COULDNT_RESOLVE_PROXY:
131
- case CURLE_COULDNT_RESOLVE_HOST:
132
- case CURLE_COULDNT_CONNECT:
133
- case CURLE_OPERATION_TIMEOUTED:
134
- case CURLE_SSL_CONNECT_ERROR:
135
- throw new Exception\NetworkException(curl_error($this->handle), $request);
136
- default:
137
- throw new Exception\RequestException(curl_error($this->handle), $request);
138
- }
139
-
140
- $response = $responseBuilder->getResponse();
141
- $response->getBody()->seek(0);
142
-
143
- return $response;
144
- }
145
-
146
- /**
147
- * Sends a PSR-7 request in an asynchronous way.
148
- *
149
- * @param RequestInterface $request
150
- *
151
- * @return Promise
152
- *
153
- * @throws \Http\Client\Exception\RequestException On invalid request
154
- * @throws \InvalidArgumentException For invalid header names or values
155
- * @throws \RuntimeException If creating the body stream fails
156
- *
157
- * @since 1.6 \UnexpectedValueException replaced with RequestException
158
- * @since 1.0
159
- */
160
- public function sendAsyncRequest(RequestInterface $request)
161
- {
162
- if (!$this->multiRunner instanceof MultiRunner) {
163
- $this->multiRunner = new MultiRunner();
164
- }
165
-
166
- $handle = curl_init();
167
- $responseBuilder = $this->createResponseBuilder();
168
- $options = $this->createCurlOptions($request, $responseBuilder);
169
- curl_setopt_array($handle, $options);
170
-
171
- $core = new PromiseCore($request, $handle, $responseBuilder);
172
- $promise = new CurlPromise($core, $this->multiRunner);
173
- $this->multiRunner->add($core);
174
-
175
- return $promise;
176
- }
177
-
178
- /**
179
- * Generates cURL options.
180
- *
181
- * @param RequestInterface $request
182
- * @param ResponseBuilder $responseBuilder
183
- *
184
- * @throws \Http\Client\Exception\RequestException On invalid request
185
- * @throws \InvalidArgumentException For invalid header names or values
186
- * @throws \RuntimeException if can not read body
187
- *
188
- * @return array
189
- */
190
- private function createCurlOptions(RequestInterface $request, ResponseBuilder $responseBuilder)
191
- {
192
- $options = $this->options;
193
-
194
- $options[CURLOPT_HEADER] = false;
195
- $options[CURLOPT_RETURNTRANSFER] = false;
196
- $options[CURLOPT_FOLLOWLOCATION] = false;
197
-
198
- try {
199
- $options[CURLOPT_HTTP_VERSION]
200
- = $this->getProtocolVersion($request->getProtocolVersion());
201
- } catch (\UnexpectedValueException $e) {
202
- throw new Exception\RequestException($e->getMessage(), $request);
203
- }
204
- $options[CURLOPT_URL] = (string) $request->getUri();
205
-
206
- $options = $this->addRequestBodyOptions($request, $options);
207
-
208
- $options[CURLOPT_HTTPHEADER] = $this->createHeaders($request, $options);
209
-
210
- if ($request->getUri()->getUserInfo()) {
211
- $options[CURLOPT_USERPWD] = $request->getUri()->getUserInfo();
212
- }
213
-
214
- $options[CURLOPT_HEADERFUNCTION] = function ($ch, $data) use ($responseBuilder) {
215
- $str = trim($data);
216
- if ('' !== $str) {
217
- if (strpos(strtolower($str), 'http/') === 0) {
218
- $responseBuilder->setStatus($str)->getResponse();
219
- } else {
220
- $responseBuilder->addHeader($str);
221
- }
222
- }
223
-
224
- return strlen($data);
225
- };
226
-
227
- $options[CURLOPT_WRITEFUNCTION] = function ($ch, $data) use ($responseBuilder) {
228
- return $responseBuilder->getResponse()->getBody()->write($data);
229
- };
230
-
231
- return $options;
232
- }
233
-
234
- /**
235
- * Return cURL constant for specified HTTP version.
236
- *
237
- * @param string $requestVersion
238
- *
239
- * @throws \UnexpectedValueException if unsupported version requested
240
- *
241
- * @return int
242
- */
243
- private function getProtocolVersion($requestVersion)
244
- {
245
- switch ($requestVersion) {
246
- case '1.0':
247
- return CURL_HTTP_VERSION_1_0;
248
- case '1.1':
249
- return CURL_HTTP_VERSION_1_1;
250
- case '2.0':
251
- if (defined('CURL_HTTP_VERSION_2_0')) {
252
- return CURL_HTTP_VERSION_2_0;
253
- }
254
- throw new \UnexpectedValueException('libcurl 7.33 needed for HTTP 2.0 support');
255
- }
256
-
257
- return CURL_HTTP_VERSION_NONE;
258
- }
259
-
260
- /**
261
- * Add request body related cURL options.
262
- *
263
- * @param RequestInterface $request
264
- * @param array $options
265
- *
266
- * @return array
267
- */
268
- private function addRequestBodyOptions(RequestInterface $request, array $options)
269
- {
270
- /*
271
- * Some HTTP methods cannot have payload:
272
- *
273
- * - GET — cURL will automatically change method to PUT or POST if we set CURLOPT_UPLOAD or
274
- * CURLOPT_POSTFIELDS.
275
- * - HEAD — cURL treats HEAD as GET request with a same restrictions.
276
- * - TRACE — According to RFC7231: a client MUST NOT send a message body in a TRACE request.
277
- */
278
- if (!in_array($request->getMethod(), ['GET', 'HEAD', 'TRACE'], true)) {
279
- $body = $request->getBody();
280
- $bodySize = $body->getSize();
281
- if ($bodySize !== 0) {
282
- if ($body->isSeekable()) {
283
- $body->rewind();
284
- }
285
-
286
- // Message has non empty body.
287
- if (null === $bodySize || $bodySize > 1024 * 1024) {
288
- // Avoid full loading large or unknown size body into memory
289
- $options[CURLOPT_UPLOAD] = true;
290
- if (null !== $bodySize) {
291
- $options[CURLOPT_INFILESIZE] = $bodySize;
292
- }
293
- $options[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) {
294
- return $body->read($length);
295
- };
296
- } else {
297
- // Small body can be loaded into memory
298
- $options[CURLOPT_POSTFIELDS] = (string) $body;
299
- }
300
- }
301
- }
302
-
303
- if ($request->getMethod() === 'HEAD') {
304
- // This will set HTTP method to "HEAD".
305
- $options[CURLOPT_NOBODY] = true;
306
- } elseif ($request->getMethod() !== 'GET') {
307
- // GET is a default method. Other methods should be specified explicitly.
308
- $options[CURLOPT_CUSTOMREQUEST] = $request->getMethod();
309
- }
310
-
311
- return $options;
312
- }
313
-
314
- /**
315
- * Create headers array for CURLOPT_HTTPHEADER.
316
- *
317
- * @param RequestInterface $request
318
- * @param array $options cURL options
319
- *
320
- * @return string[]
321
- */
322
- private function createHeaders(RequestInterface $request, array $options)
323
- {
324
- $curlHeaders = [];
325
- $headers = $request->getHeaders();
326
- foreach ($headers as $name => $values) {
327
- $header = strtolower($name);
328
- if ('expect' === $header) {
329
- // curl-client does not support "Expect-Continue", so dropping "expect" headers
330
- continue;
331
- }
332
- if ('content-length' === $header) {
333
- if (array_key_exists(CURLOPT_POSTFIELDS, $options)) {
334
- // Small body content length can be calculated here.
335
- $values = [strlen($options[CURLOPT_POSTFIELDS])];
336
- } elseif (!array_key_exists(CURLOPT_READFUNCTION, $options)) {
337
- // Else if there is no body, forcing "Content-length" to 0
338
- $values = [0];
339
- }
340
- }
341
- foreach ($values as $value) {
342
- $curlHeaders[] = $name.': '.$value;
343
- }
344
- }
345
- /*
346
- * curl-client does not support "Expect-Continue", but cURL adds "Expect" header by default.
347
- * We can not suppress it, but we can set it to empty.
348
- */
349
- $curlHeaders[] = 'Expect:';
350
-
351
- return $curlHeaders;
352
- }
353
-
354
- /**
355
- * Create new ResponseBuilder instance.
356
- *
357
- * @return ResponseBuilder
358
- *
359
- * @throws \RuntimeException If creating the stream from $body fails
360
- */
361
- private function createResponseBuilder()
362
- {
363
- try {
364
- $body = $this->streamFactory->createStream(fopen('php://temp', 'w+b'));
365
- } catch (\InvalidArgumentException $e) {
366
- throw new \RuntimeException('Can not create "php://temp" stream.');
367
- }
368
- $response = $this->messageFactory->createResponse(200, null, [], $body);
369
-
370
- return new ResponseBuilder($response);
371
- }
372
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/php-http/curl-client/src/CurlPromise.php DELETED
@@ -1,109 +0,0 @@
1
- <?php
2
-
3
- namespace Http\Client\Curl;
4
-
5
- use Http\Promise\Promise;
6
-
7
- /**
8
- * Promise represents a response that may not be available yet, but will be resolved at some point
9
- * in future. It acts like a proxy to the actual response.
10
- *
11
- * This interface is an extension of the promises/a+ specification https://promisesaplus.com/
12
- * Value is replaced by an object where its class implement a Psr\Http\Message\RequestInterface.
13
- * Reason is replaced by an object where its class implement a Http\Client\Exception.
14
- *
15
- * @license http://opensource.org/licenses/MIT MIT
16
- * @author Михаил Красильников <m.krasilnikov@yandex.ru>
17
- */
18
- class CurlPromise implements Promise
19
- {
20
- /**
21
- * Shared promise core.
22
- *
23
- * @var PromiseCore
24
- */
25
- private $core;
26
-
27
- /**
28
- * Requests runner.
29
- *
30
- * @var MultiRunner
31
- */
32
- private $runner;
33
-
34
- /**
35
- * Create new promise.
36
- *
37
- * @param PromiseCore $core Shared promise core
38
- * @param MultiRunner $runner Simultaneous requests runner
39
- */
40
- public function __construct(PromiseCore $core, MultiRunner $runner)
41
- {
42
- $this->core = $core;
43
- $this->runner = $runner;
44
- }
45
-
46
- /**
47
- * Add behavior for when the promise is resolved or rejected.
48
- *
49
- * If you do not care about one of the cases, you can set the corresponding callable to null
50
- * The callback will be called when the response or exception arrived and never more than once.
51
- *
52
- * @param callable $onFulfilled Called when a response will be available
53
- * @param callable $onRejected Called when an error happens.
54
- *
55
- * You must always return the Response in the interface or throw an Exception
56
- *
57
- * @return Promise Always returns a new promise which is resolved with value of the executed
58
- * callback (onFulfilled / onRejected)
59
- */
60
- public function then(callable $onFulfilled = null, callable $onRejected = null)
61
- {
62
- if ($onFulfilled) {
63
- $this->core->addOnFulfilled($onFulfilled);
64
- }
65
- if ($onRejected) {
66
- $this->core->addOnRejected($onRejected);
67
- }
68
-
69
- return new self($this->core, $this->runner);
70
- }
71
-
72
- /**
73
- * Get the state of the promise, one of PENDING, FULFILLED or REJECTED.
74
- *
75
- * @return string
76
- */
77
- public function getState()
78
- {
79
- return $this->core->getState();
80
- }
81
-
82
- /**
83
- * Wait for the promise to be fulfilled or rejected.
84
- *
85
- * When this method returns, the request has been resolved and the appropriate callable has terminated.
86
- *
87
- * When called with the unwrap option
88
- *
89
- * @param bool $unwrap Whether to return resolved value / throw reason or not
90
- *
91
- * @return \Psr\Http\Message\ResponseInterface|null Resolved value, null if $unwrap is set to false
92
- *
93
- * @throws \Http\Client\Exception The rejection reason
94
- */
95
- public function wait($unwrap = true)
96
- {
97
- $this->runner->wait($this->core);
98
-
99
- if ($unwrap) {
100
- if ($this->core->getState() === self::REJECTED) {
101
- throw $this->core->getException();
102
- }
103
-
104
- return $this->core->getResponse();
105
- }
106
-
107
- return null;
108
- }
109
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/php-http/curl-client/src/MultiRunner.php DELETED
@@ -1,129 +0,0 @@
1
- <?php
2
-
3
- namespace Http\Client\Curl;
4
-
5
- use Http\Client\Exception\RequestException;
6
-
7
- /**
8
- * Simultaneous requests runner.
9
- *
10
- * @license http://opensource.org/licenses/MIT MIT
11
- * @author Михаил Красильников <m.krasilnikov@yandex.ru>
12
- */
13
- class MultiRunner
14
- {
15
- /**
16
- * cURL multi handle.
17
- *
18
- * @var resource|null
19
- */
20
- private $multiHandle = null;
21
-
22
- /**
23
- * Awaiting cores.
24
- *
25
- * @var PromiseCore[]
26
- */
27
- private $cores = [];
28
-
29
- /**
30
- * Release resources if still active.
31
- */
32
- public function __destruct()
33
- {
34
- if (is_resource($this->multiHandle)) {
35
- curl_multi_close($this->multiHandle);
36
- }
37
- }
38
-
39
- /**
40
- * Add promise to runner.
41
- *
42
- * @param PromiseCore $core
43
- */
44
- public function add(PromiseCore $core)
45
- {
46
- foreach ($this->cores as $existed) {
47
- if ($existed === $core) {
48
- return;
49
- }
50
- }
51
-
52
- $this->cores[] = $core;
53
-
54
- if (null === $this->multiHandle) {
55
- $this->multiHandle = curl_multi_init();
56
- }
57
- curl_multi_add_handle($this->multiHandle, $core->getHandle());
58
- }
59
-
60
- /**
61
- * Remove promise from runner.
62
- *
63
- * @param PromiseCore $core
64
- */
65
- public function remove(PromiseCore $core)
66
- {
67
- foreach ($this->cores as $index => $existed) {
68
- if ($existed === $core) {
69
- curl_multi_remove_handle($this->multiHandle, $core->getHandle());
70
- unset($this->cores[$index]);
71
-
72
- return;
73
- }
74
- }
75
- }
76
-
77
- /**
78
- * Wait for request(s) to be completed.
79
- *
80
- * @param PromiseCore|null $targetCore
81
- */
82
- public function wait(PromiseCore $targetCore = null)
83
- {
84
- do {
85
- $status = curl_multi_exec($this->multiHandle, $active);
86
- $info = curl_multi_info_read($this->multiHandle);
87
- if (false !== $info) {
88
- $core = $this->findCoreByHandle($info['handle']);
89
-
90
- if (null === $core) {
91
- // We have no promise for this handle. Drop it.
92
- curl_multi_remove_handle($this->multiHandle, $info['handle']);
93
- continue;
94
- }
95
-
96
- if (CURLE_OK === $info['result']) {
97
- $core->fulfill();
98
- } else {
99
- $error = curl_error($core->getHandle());
100
- $core->reject(new RequestException($error, $core->getRequest()));
101
- }
102
- $this->remove($core);
103
-
104
- // This is a promise we are waited for. So exiting wait().
105
- if ($core === $targetCore) {
106
- return;
107
- }
108
- }
109
- } while ($status === CURLM_CALL_MULTI_PERFORM || $active);
110
- }
111
-
112
- /**
113
- * Find core by handle.
114
- *
115
- * @param resource $handle
116
- *
117
- * @return PromiseCore|null
118
- */
119
- private function findCoreByHandle($handle)
120
- {
121
- foreach ($this->cores as $core) {
122
- if ($core->getHandle() === $handle) {
123
- return $core;
124
- }
125
- }
126
-
127
- return null;
128
- }
129
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/php-http/curl-client/src/PromiseCore.php DELETED
@@ -1,241 +0,0 @@
1
- <?php
2
-
3
- namespace Http\Client\Curl;
4
-
5
- use Http\Client\Exception;
6
- use Http\Promise\Promise;
7
- use Psr\Http\Message\RequestInterface;
8
- use Psr\Http\Message\ResponseInterface;
9
-
10
- /**
11
- * Shared promises core.
12
- *
13
- * @license http://opensource.org/licenses/MIT MIT
14
- * @author Михаил Красильников <m.krasilnikov@yandex.ru>
15
- */
16
- class PromiseCore
17
- {
18
- /**
19
- * HTTP request.
20
- *
21
- * @var RequestInterface
22
- */
23
- private $request;
24
-
25
- /**
26
- * cURL handle.
27
- *
28
- * @var resource
29
- */
30
- private $handle;
31
-
32
- /**
33
- * Response builder.
34
- *
35
- * @var ResponseBuilder
36
- */
37
- private $responseBuilder;
38
-
39
- /**
40
- * Promise state.
41
- *
42
- * @var string
43
- */
44
- private $state;
45
-
46
- /**
47
- * Exception.
48
- *
49
- * @var Exception|null
50
- */
51
- private $exception = null;
52
-
53
- /**
54
- * Functions to call when a response will be available.
55
- *
56
- * @var callable[]
57
- */
58
- private $onFulfilled = [];
59
-
60
- /**
61
- * Functions to call when an error happens.
62
- *
63
- * @var callable[]
64
- */
65
- private $onRejected = [];
66
-
67
- /**
68
- * Create shared core.
69
- *
70
- * @param RequestInterface $request HTTP request.
71
- * @param resource $handle cURL handle.
72
- * @param ResponseBuilder $responseBuilder Response builder.
73
- *
74
- * @throws \InvalidArgumentException If $handle is not a cURL resource.
75
- */
76
- public function __construct(
77
- RequestInterface $request,
78
- $handle,
79
- ResponseBuilder $responseBuilder
80
- ) {
81
- if (!is_resource($handle)) {
82
- throw new \InvalidArgumentException(
83
- sprintf(
84
- 'Parameter $handle expected to be a cURL resource, %s given',
85
- gettype($handle)
86
- )
87
- );
88
- }
89
-
90
- if (get_resource_type($handle) !== 'curl') {
91
- throw new \InvalidArgumentException(
92
- sprintf(
93
- 'Parameter $handle expected to be a cURL resource, %s resource given',
94
- get_resource_type($handle)
95
- )
96
- );
97
- }
98
-
99
- $this->request = $request;
100
- $this->handle = $handle;
101
- $this->responseBuilder = $responseBuilder;
102
- $this->state = Promise::PENDING;
103
- }
104
-
105
- /**
106
- * Add on fulfilled callback.
107
- *
108
- * @param callable $callback
109
- */
110
- public function addOnFulfilled(callable $callback)
111
- {
112
- if ($this->getState() === Promise::PENDING) {
113
- $this->onFulfilled[] = $callback;
114
- } elseif ($this->getState() === Promise::FULFILLED) {
115
- $response = call_user_func($callback, $this->responseBuilder->getResponse());
116
- if ($response instanceof ResponseInterface) {
117
- $this->responseBuilder->setResponse($response);
118
- }
119
- }
120
- }
121
-
122
- /**
123
- * Add on rejected callback.
124
- *
125
- * @param callable $callback
126
- */
127
- public function addOnRejected(callable $callback)
128
- {
129
- if ($this->getState() === Promise::PENDING) {
130
- $this->onRejected[] = $callback;
131
- } elseif ($this->getState() === Promise::REJECTED) {
132
- $this->exception = call_user_func($callback, $this->exception);
133
- }
134
- }
135
-
136
- /**
137
- * Return cURL handle.
138
- *
139
- * @return resource
140
- */
141
- public function getHandle()
142
- {
143
- return $this->handle;
144
- }
145
-
146
- /**
147
- * Get the state of the promise, one of PENDING, FULFILLED or REJECTED.
148
- *
149
- * @return string
150
- */
151
- public function getState()
152
- {
153
- return $this->state;
154
- }
155
-
156
- /**
157
- * Return request.
158
- *
159
- * @return RequestInterface
160
- */
161
- public function getRequest()
162
- {
163
- return $this->request;
164
- }
165
-
166
- /**
167
- * Return the value of the promise (fulfilled).
168
- *
169
- * @return ResponseInterface Response Object only when the Promise is fulfilled
170
- */
171
- public function getResponse()
172
- {
173
- return $this->responseBuilder->getResponse();
174
- }
175
-
176
- /**
177
- * Get the reason why the promise was rejected.
178
- *
179
- * If the exception is an instance of Http\Client\Exception\HttpException it will contain
180
- * the response object with the status code and the http reason.
181
- *
182
- * @return Exception Exception Object only when the Promise is rejected
183
- *
184
- * @throws \LogicException When the promise is not rejected
185
- */
186
- public function getException()
187
- {
188
- if (null === $this->exception) {
189
- throw new \LogicException('Promise is not rejected');
190
- }
191
-
192
- return $this->exception;
193
- }
194
-
195
- /**
196
- * Fulfill promise.
197
- */
198
- public function fulfill()
199
- {
200
- $this->state = Promise::FULFILLED;
201
- $response = $this->responseBuilder->getResponse();
202
- try {
203
- $response->getBody()->seek(0);
204
- } catch (\RuntimeException $e) {
205
- $exception = new Exception\TransferException($e->getMessage(), $e->getCode(), $e);
206
- $this->reject($exception);
207
-
208
- return;
209
- }
210
-
211
- while (count($this->onFulfilled) > 0) {
212
- $callback = array_shift($this->onFulfilled);
213
- $response = call_user_func($callback, $response);
214
- }
215
-
216
- if ($response instanceof ResponseInterface) {
217
- $this->responseBuilder->setResponse($response);
218
- }
219
- }
220
-
221
- /**
222
- * Reject promise.
223
- *
224
- * @param Exception $exception Reject reason
225
- */
226
- public function reject(Exception $exception)
227
- {
228
- $this->exception = $exception;
229
- $this->state = Promise::REJECTED;
230
-
231
- while (count($this->onRejected) > 0) {
232
- $callback = array_shift($this->onRejected);
233
- try {
234
- $exception = call_user_func($callback, $this->exception);
235
- $this->exception = $exception;
236
- } catch (Exception $exception) {
237
- $this->exception = $exception;
238
- }
239
- }
240
- }
241
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/php-http/curl-client/src/ResponseBuilder.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
-
3
- namespace Http\Client\Curl;
4
-
5
- use Http\Message\Builder\ResponseBuilder as OriginalResponseBuilder;
6
- use Psr\Http\Message\ResponseInterface;
7
-
8
- /**
9
- * Extended response builder.
10
- */
11
- class ResponseBuilder extends OriginalResponseBuilder
12
- {
13
- /**
14
- * Replace response with a new instance.
15
- *
16
- * @param ResponseInterface $response
17
- */
18
- public function setResponse(ResponseInterface $response)
19
- {
20
- $this->response = $response;
21
- }
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/php-http/discovery/.php-cs-fixer.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $finder = PhpCsFixer\Finder::create()
4
+ ->in(__DIR__.'/src')
5
+ ->name('*.php')
6
+ ;
7
+
8
+ $config = (new PhpCsFixer\Config())
9
+ ->setRiskyAllowed(true)
10
+ ->setRules([
11
+ '@Symfony' => true,
12
+ ])
13
+ ->setFinder($finder)
14
+ ;
15
+
16
+ return $config;
vendor/php-http/discovery/CHANGELOG.md CHANGED
@@ -1,5 +1,92 @@
1
  # Change Log
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ## 1.6.1 - 2019-02-23
4
 
5
  ### Fixed
@@ -16,13 +103,13 @@
16
  ## 1.5.2 - 2018-12-31
17
 
18
  Corrected mistakes in 1.5.1. The different between 1.5.2 and 1.5.0 is that
19
- we removed some PHP 7 code.
20
 
21
  https://github.com/php-http/discovery/compare/1.5.0...1.5.2
22
 
23
  ## 1.5.1 - 2018-12-31
24
 
25
- This version added new features by mistake. These are reverted in 1.5.2.
26
 
27
  Do not use 1.5.1.
28
 
@@ -34,15 +121,15 @@ Do not use 1.5.1.
34
 
35
  ### Added
36
 
37
- - Support for `nyholm/psr7` version 1.0.
38
- - `ClassDiscovery::safeClassExists` which will help Magento users.
39
  - Support for HTTPlug 2.0
40
  - Support for Buzz 1.0
41
  - Better error message when nothing found by introducing a new exception: `NoCandidateFoundException`.
42
 
43
  ### Fixed
44
 
45
- - Fixed condition evaluation, it should stop after first invalid condition.
46
 
47
  ## 1.4.0 - 2018-02-06
48
 
@@ -62,7 +149,7 @@ Do not use 1.5.1.
62
 
63
  ### Fixed
64
 
65
- - Fixed minor issue with `MockClientStrategy`, also added more tests.
66
 
67
  ## 1.2.0 - 2017-02-12
68
 
1
  # Change Log
2
 
3
+ ## 1.14.3 - 2022-07-11
4
+
5
+ - [#207](https://github.com/php-http/discovery/pull/207) - Updates Exception to extend Throwable solving static analysis errors for consumers
6
+
7
+ ## 1.14.2 - 2022-05-25
8
+
9
+ - [#202](https://github.com/php-http/discovery/pull/202) - Avoid error when the Symfony PSR-18 client exists but its dependencies are not installed
10
+
11
+ ## 1.14.1 - 2021-09-18
12
+
13
+ - [#199](https://github.com/php-http/discovery/pull/199) - Fixes message factory discovery for `laminas-diactoros ^2.7`
14
+
15
+ ## 1.14.0 - 2021-06-21
16
+
17
+ - Deprecate puli as it has been unmaintained for a long time and is not compatible with composer 2 https://github.com/php-http/discovery/pull/195
18
+
19
+ ## 1.13.0 - 2020-11-27
20
+
21
+ - Support discovering PSR-17 factories of `slim/psr7` package https://github.com/php-http/discovery/pull/192
22
+
23
+ ## 1.12.0 - 2020-09-22
24
+
25
+ - Support discovering HttpClient of `php-http/guzzle7-adapter` https://github.com/php-http/discovery/pull/189
26
+
27
+ ## 1.11.0 - 2020-09-22
28
+
29
+ - Use correct method name to find Uri Factory in PSR17 https://github.com/php-http/discovery/pull/181
30
+
31
+ ## 1.10.0 - 2020-09-04
32
+
33
+ - Discover PSR-18 implementation of phalcon
34
+
35
+ ## 1.9.1 - 2020-07-13
36
+
37
+ ### Fixed
38
+
39
+ - Support PHP 7.4 and 8.0
40
+
41
+ ## 1.9.0 - 2020-07-02
42
+
43
+ ### Added
44
+
45
+ - Support discovering PSR-18 factories of `guzzlehttp/guzzle` 7+
46
+
47
+ ## 1.8.0 - 2020-06-14
48
+
49
+ ### Added
50
+
51
+ - Support discovering PSR-17 factories of `guzzlehttp/psr7` package
52
+ - Support discovering PSR-17 factories of `laminas/laminas-diactoros` package
53
+ - `ClassDiscovery::getStrategies()` to retrieve the list of current strategies.
54
+
55
+ ### Fixed
56
+
57
+ - Ignore exception during discovery when Symfony HttplugClient checks if HTTPlug is available.
58
+
59
+ ## 1.7.4 - 2020-01-03
60
+
61
+ ### Fixed
62
+
63
+ - Improve conditions on Symfony's async HTTPlug client.
64
+
65
+ ## 1.7.3 - 2019-12-27
66
+
67
+ ### Fixed
68
+
69
+ - Enough conditions to only use Symfony HTTP client if all needed components are available.
70
+
71
+ ## 1.7.2 - 2019-12-27
72
+
73
+ ### Fixed
74
+
75
+ - Allow a condition to specify an interface and not just classes.
76
+
77
+ ## 1.7.1 - 2019-12-26
78
+
79
+ ### Fixed
80
+
81
+ - Better conditions to see if Symfony's HTTP clients are available.
82
+
83
+ ## 1.7.0 - 2019-06-30
84
+
85
+ ### Added
86
+
87
+ - Dropped support for PHP < 7.1
88
+ - Support for `symfony/http-client`
89
+
90
  ## 1.6.1 - 2019-02-23
91
 
92
  ### Fixed
103
  ## 1.5.2 - 2018-12-31
104
 
105
  Corrected mistakes in 1.5.1. The different between 1.5.2 and 1.5.0 is that
106
+ we removed some PHP 7 code.
107
 
108
  https://github.com/php-http/discovery/compare/1.5.0...1.5.2
109
 
110
  ## 1.5.1 - 2018-12-31
111
 
112
+ This version added new features by mistake. These are reverted in 1.5.2.
113
 
114
  Do not use 1.5.1.
115
 
121
 
122
  ### Added
123
 
124
+ - Support for `nyholm/psr7` version 1.0.
125
+ - `ClassDiscovery::safeClassExists` which will help Magento users.
126
  - Support for HTTPlug 2.0
127
  - Support for Buzz 1.0
128
  - Better error message when nothing found by introducing a new exception: `NoCandidateFoundException`.
129
 
130
  ### Fixed
131
 
132
+ - Fixed condition evaluation, it should stop after first invalid condition.
133
 
134
  ## 1.4.0 - 2018-02-06
135
 
149
 
150
  ### Fixed
151
 
152
+ - Fixed minor issue with `MockClientStrategy`, also added more tests.
153
 
154
  ## 1.2.0 - 2017-02-12
155
 
vendor/php-http/discovery/src/ClassDiscovery.php CHANGED
@@ -22,9 +22,13 @@ abstract class ClassDiscovery
22
  * @var array
23
  */
24
  private static $strategies = [
25
- Strategy\PuliBetaStrategy::class,
26
  Strategy\CommonClassesStrategy::class,
27
  Strategy\CommonPsr17ClassesStrategy::class,
 
 
 
 
 
28
  ];
29
 
30
  /**
@@ -55,7 +59,9 @@ abstract class ClassDiscovery
55
  try {
56
  $candidates = call_user_func($strategy.'::getCandidates', $type);
57
  } catch (StrategyUnavailableException $e) {
58
- $exceptions[] = $e;
 
 
59
 
60
  continue;
61
  }
@@ -124,6 +130,16 @@ abstract class ClassDiscovery
124
  self::clearCache();
125
  }
126
 
 
 
 
 
 
 
 
 
 
 
127
  /**
128
  * Append a strategy at the end of the strategy queue.
129
  *
@@ -190,7 +206,7 @@ abstract class ClassDiscovery
190
  /**
191
  * Get an instance of the $class.
192
  *
193
- * @param string|\Closure $class A FQCN of a class or a closure that instantiate the class.
194
  *
195
  * @return object
196
  *
@@ -228,7 +244,7 @@ abstract class ClassDiscovery
228
  public static function safeClassExists($class)
229
  {
230
  try {
231
- return class_exists($class);
232
  } catch (\Exception $e) {
233
  return false;
234
  }
22
  * @var array
23
  */
24
  private static $strategies = [
 
25
  Strategy\CommonClassesStrategy::class,
26
  Strategy\CommonPsr17ClassesStrategy::class,
27
+ Strategy\PuliBetaStrategy::class,
28
+ ];
29
+
30
+ private static $deprecatedStrategies = [
31
+ Strategy\PuliBetaStrategy::class => true,
32
  ];
33
 
34
  /**
59
  try {
60
  $candidates = call_user_func($strategy.'::getCandidates', $type);
61
  } catch (StrategyUnavailableException $e) {
62
+ if (!isset(self::$deprecatedStrategies[$strategy])) {
63
+ $exceptions[] = $e;
64
+ }
65
 
66
  continue;
67
  }
130
  self::clearCache();
131
  }
132
 
133
+ /**
134
+ * Returns the currently configured discovery strategies as fully qualified class names.
135
+ *
136
+ * @return string[]
137
+ */
138
+ public static function getStrategies(): iterable
139
+ {
140
+ return self::$strategies;
141
+ }
142
+
143
  /**
144
  * Append a strategy at the end of the strategy queue.
145
  *
206
  /**
207
  * Get an instance of the $class.
208
  *
209
+ * @param string|\Closure $class a FQCN of a class or a closure that instantiate the class
210
  *
211
  * @return object
212
  *
244
  public static function safeClassExists($class)
245
  {
246
  try {
247
+ return class_exists($class) || interface_exists($class);
248
  } catch (\Exception $e) {
249
  return false;
250
  }
vendor/php-http/discovery/src/Exception.php CHANGED
@@ -2,11 +2,13 @@
2
 
3
  namespace Http\Discovery;
4
 
 
 
5
  /**
6
  * An interface implemented by all discovery related exceptions.
7
  *
8
  * @author Tobias Nyholm <tobias.nyholm@gmail.com>
9
  */
10
- interface Exception
11
  {
12
  }
2
 
3
  namespace Http\Discovery;
4
 
5
+ use Throwable;
6
+
7
  /**
8
  * An interface implemented by all discovery related exceptions.
9
  *
10
  * @author Tobias Nyholm <tobias.nyholm@gmail.com>
11
  */
12
+ interface Exception extends Throwable
13
  {
14
  }
vendor/php-http/discovery/src/Exception/NoCandidateFoundException.php CHANGED
@@ -13,7 +13,6 @@ final class NoCandidateFoundException extends \Exception implements Exception
13
  {
14
  /**
15
  * @param string $strategy
16
- * @param array $candidates
17
  */
18
  public function __construct($strategy, array $candidates)
19
  {
13
  {
14
  /**
15
  * @param string $strategy
 
16
  */
17
  public function __construct($strategy, array $candidates)
18
  {
vendor/php-http/discovery/src/Exception/NotFoundException.php CHANGED
@@ -11,6 +11,6 @@ use Http\Discovery\Exception;
11
  *
12
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
  */
14
- /*final */class NotFoundException extends \RuntimeException implements Exception
15
  {
16
  }
11
  *
12
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
  */
14
+ /* final */ class NotFoundException extends \RuntimeException implements Exception
15
  {
16
  }
vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php CHANGED
@@ -24,11 +24,7 @@ final class HttpAsyncClientDiscovery extends ClassDiscovery
24
  try {
25
  $asyncClient = static::findOneByType(HttpAsyncClient::class);
26
  } catch (DiscoveryFailedException $e) {
27
- throw new NotFoundException(
28
- 'No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".',
29
- 0,
30
- $e
31
- );
32
  }
33
 
34
  return static::instantiateClass($asyncClient);
24
  try {
25
  $asyncClient = static::findOneByType(HttpAsyncClient::class);
26
  } catch (DiscoveryFailedException $e) {
27
+ throw new NotFoundException('No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e);
 
 
 
 
28
  }
29
 
30
  return static::instantiateClass($asyncClient);
vendor/php-http/discovery/src/HttpClientDiscovery.php CHANGED
@@ -24,11 +24,7 @@ final class HttpClientDiscovery extends ClassDiscovery
24
  try {
25
  $client = static::findOneByType(HttpClient::class);
26
  } catch (DiscoveryFailedException $e) {
27
- throw new NotFoundException(
28
- 'No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation". Example: "php-http/guzzle6-adapter".',
29
- 0,
30
- $e
31
- );
32
  }
33
 
34
  return static::instantiateClass($client);
24
  try {
25
  $client = static::findOneByType(HttpClient::class);
26
  } catch (DiscoveryFailedException $e) {
27
+ throw new NotFoundException('No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e);
 
 
 
 
28
  }
29
 
30
  return static::instantiateClass($client);
vendor/php-http/discovery/src/MessageFactoryDiscovery.php CHANGED
@@ -26,11 +26,7 @@ final class MessageFactoryDiscovery extends ClassDiscovery
26
  try {
27
  $messageFactory = static::findOneByType(MessageFactory::class);
28
  } catch (DiscoveryFailedException $e) {
29
- throw new NotFoundException(
30
- 'No message factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.',
31
- 0,
32
- $e
33
- );
34
  }
35
 
36
  return static::instantiateClass($messageFactory);
26
  try {
27
  $messageFactory = static::findOneByType(MessageFactory::class);
28
  } catch (DiscoveryFailedException $e) {
29
+ throw new NotFoundException('No message factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e);
 
 
 
 
30
  }
31
 
32
  return static::instantiateClass($messageFactory);
vendor/php-http/discovery/src/Psr17FactoryDiscovery.php CHANGED
@@ -111,7 +111,7 @@ final class Psr17FactoryDiscovery extends ClassDiscovery
111
  *
112
  * @throws Exception\NotFoundException
113
  */
114
- public static function findUrlFactory()
115
  {
116
  try {
117
  $messageFactory = static::findOneByType(UriFactoryInterface::class);
@@ -121,4 +121,16 @@ final class Psr17FactoryDiscovery extends ClassDiscovery
121
 
122
  return static::instantiateClass($messageFactory);
123
  }
 
 
 
 
 
 
 
 
 
 
 
 
124
  }
111
  *
112
  * @throws Exception\NotFoundException
113
  */
114
+ public static function findUriFactory()
115
  {
116
  try {
117
  $messageFactory = static::findOneByType(UriFactoryInterface::class);
121
 
122
  return static::instantiateClass($messageFactory);
123
  }
124
+
125
+ /**
126
+ * @return UriFactoryInterface
127
+ *
128
+ * @throws Exception\NotFoundException
129
+ *
130
+ * @deprecated This will be removed in 2.0. Consider using the findUriFactory() method.
131
+ */
132
+ public static function findUrlFactory()
133
+ {
134
+ return static::findUriFactory();
135
+ }
136
  }
vendor/php-http/discovery/src/Psr18ClientDiscovery.php CHANGED
@@ -24,11 +24,7 @@ final class Psr18ClientDiscovery extends ClassDiscovery
24
  try {
25
  $client = static::findOneByType(ClientInterface::class);
26
  } catch (DiscoveryFailedException $e) {
27
- throw new \Http\Discovery\Exception\NotFoundException(
28
- 'No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle6-adapter".',
29
- 0,
30
- $e
31
- );
32
  }
33
 
34
  return static::instantiateClass($client);
24
  try {
25
  $client = static::findOneByType(ClientInterface::class);
26
  } catch (DiscoveryFailedException $e) {
27
+ throw new \Http\Discovery\Exception\NotFoundException('No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle7-adapter".', 0, $e);
 
 
 
 
28
  }
29
 
30
  return static::instantiateClass($client);
vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php CHANGED
@@ -2,35 +2,46 @@
2
 
3
  namespace Http\Discovery\Strategy;
4
 
 
 
5
  use GuzzleHttp\Psr7\Request as GuzzleRequest;
 
 
 
 
 
 
 
 
 
6
  use Http\Client\HttpAsyncClient;
7
  use Http\Client\HttpClient;
 
 
 
8
  use Http\Discovery\MessageFactoryDiscovery;
 
9
  use Http\Message\MessageFactory;
 
10
  use Http\Message\MessageFactory\GuzzleMessageFactory;
 
 
11
  use Http\Message\StreamFactory;
 
12
  use Http\Message\StreamFactory\GuzzleStreamFactory;
 
13
  use Http\Message\UriFactory;
14
- use Http\Message\UriFactory\GuzzleUriFactory;
15
- use Http\Message\MessageFactory\DiactorosMessageFactory;
16
- use Http\Message\StreamFactory\DiactorosStreamFactory;
17
  use Http\Message\UriFactory\DiactorosUriFactory;
18
- use Psr\Http\Client\ClientInterface as Psr18Client;
19
- use Zend\Diactoros\Request as DiactorosRequest;
20
- use Http\Message\MessageFactory\SlimMessageFactory;
21
- use Http\Message\StreamFactory\SlimStreamFactory;
22
  use Http\Message\UriFactory\SlimUriFactory;
23
- use Slim\Http\Request as SlimRequest;
24
- use Http\Adapter\Guzzle6\Client as Guzzle6;
25
- use Http\Adapter\Guzzle5\Client as Guzzle5;
26
- use Http\Client\Curl\Client as Curl;
27
- use Http\Client\Socket\Client as Socket;
28
- use Http\Adapter\React\Client as React;
29
- use Http\Adapter\Buzz\Client as Buzz;
30
- use Http\Adapter\Cake\Client as Cake;
31
- use Http\Adapter\Zend\Client as Zend;
32
- use Http\Adapter\Artax\Client as Artax;
33
  use Nyholm\Psr7\Factory\HttplugFactory as NyholmHttplugFactory;
 
 
 
 
 
 
34
 
35
  /**
36
  * @internal
@@ -46,27 +57,34 @@ final class CommonClassesStrategy implements DiscoveryStrategy
46
  MessageFactory::class => [
47
  ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]],
48
  ['class' => GuzzleMessageFactory::class, 'condition' => [GuzzleRequest::class, GuzzleMessageFactory::class]],
 
49
  ['class' => DiactorosMessageFactory::class, 'condition' => [DiactorosRequest::class, DiactorosMessageFactory::class]],
50
  ['class' => SlimMessageFactory::class, 'condition' => [SlimRequest::class, SlimMessageFactory::class]],
51
  ],
52
  StreamFactory::class => [
53
  ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]],
54
  ['class' => GuzzleStreamFactory::class, 'condition' => [GuzzleRequest::class, GuzzleStreamFactory::class]],
 
55
  ['class' => DiactorosStreamFactory::class, 'condition' => [DiactorosRequest::class, DiactorosStreamFactory::class]],
56
  ['class' => SlimStreamFactory::class, 'condition' => [SlimRequest::class, SlimStreamFactory::class]],
57
  ],
58
  UriFactory::class => [
59
  ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]],
60
  ['class' => GuzzleUriFactory::class, 'condition' => [GuzzleRequest::class, GuzzleUriFactory::class]],
 
61
  ['class' => DiactorosUriFactory::class, 'condition' => [DiactorosRequest::class, DiactorosUriFactory::class]],
62
  ['class' => SlimUriFactory::class, 'condition' => [SlimRequest::class, SlimUriFactory::class]],
63
  ],
64
  HttpAsyncClient::class => [
 
 
65
  ['class' => Guzzle6::class, 'condition' => Guzzle6::class],
66
  ['class' => Curl::class, 'condition' => Curl::class],
67
  ['class' => React::class, 'condition' => React::class],
68
  ],
69
  HttpClient::class => [
 
 
70
  ['class' => Guzzle6::class, 'condition' => Guzzle6::class],
71
  ['class' => Guzzle5::class, 'condition' => Guzzle5::class],
72
  ['class' => Curl::class, 'condition' => Curl::class],
@@ -82,6 +100,14 @@ final class CommonClassesStrategy implements DiscoveryStrategy
82
  ],
83
  ],
84
  Psr18Client::class => [
 
 
 
 
 
 
 
 
85
  [
86
  'class' => [self::class, 'buzzInstantiate'],
87
  'condition' => [\Buzz\Client\FileGetContents::class, \Buzz\Message\ResponseBuilder::class],
@@ -95,27 +121,69 @@ final class CommonClassesStrategy implements DiscoveryStrategy
95
  public static function getCandidates($type)
96
  {
97
  if (Psr18Client::class === $type) {
98
- $candidates = self::$classes[PSR18Client::class];
 
 
 
 
99
 
100
- // HTTPlug 2.0 clients implements PSR18Client too.
101
- foreach (self::$classes[HttpClient::class] as $c) {
102
- if (is_subclass_of($c['class'], Psr18Client::class)) {
 
 
 
 
 
 
 
 
 
 
 
 
103
  $candidates[] = $c;
104
  }
 
 
105
  }
106
-
107
- return $candidates;
108
- }
109
-
110
- if (isset(self::$classes[$type])) {
111
- return self::$classes[$type];
112
  }
113
 
114
- return [];
115
  }
116
 
117
  public static function buzzInstantiate()
118
  {
119
  return new \Buzz\Client\FileGetContents(MessageFactoryDiscovery::find());
120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
2
 
3
  namespace Http\Discovery\Strategy;
4
 
5
+ use GuzzleHttp\Client as GuzzleHttp;
6
+ use GuzzleHttp\Promise\Promise;
7
  use GuzzleHttp\Psr7\Request as GuzzleRequest;
8
+ use Http\Adapter\Artax\Client as Artax;
9
+ use Http\Adapter\Buzz\Client as Buzz;
10
+ use Http\Adapter\Cake\Client as Cake;
11
+ use Http\Adapter\Guzzle5\Client as Guzzle5;
12
+ use Http\Adapter\Guzzle6\Client as Guzzle6;
13
+ use Http\Adapter\Guzzle7\Client as Guzzle7;
14
+ use Http\Adapter\React\Client as React;
15
+ use Http\Adapter\Zend\Client as Zend;
16
+ use Http\Client\Curl\Client as Curl;
17
  use Http\Client\HttpAsyncClient;
18
  use Http\Client\HttpClient;
19
+ use Http\Client\Socket\Client as Socket;
20
+ use Http\Discovery\ClassDiscovery;
21
+ use Http\Discovery\Exception\NotFoundException;
22
  use Http\Discovery\MessageFactoryDiscovery;
23
+ use Http\Discovery\Psr17FactoryDiscovery;
24
  use Http\Message\MessageFactory;
25
+ use Http\Message\MessageFactory\DiactorosMessageFactory;
26
  use Http\Message\MessageFactory\GuzzleMessageFactory;
27
+ use Http\Message\MessageFactory\SlimMessageFactory;
28
+ use Http\Message\RequestFactory;
29
  use Http\Message\StreamFactory;
30
+ use Http\Message\StreamFactory\DiactorosStreamFactory;
31
  use Http\Message\StreamFactory\GuzzleStreamFactory;
32
+ use Http\Message\StreamFactory\SlimStreamFactory;
33
  use Http\Message\UriFactory;
 
 
 
34
  use Http\Message\UriFactory\DiactorosUriFactory;
35
+ use Http\Message\UriFactory\GuzzleUriFactory;
 
 
 
36
  use Http\Message\UriFactory\SlimUriFactory;
37
+ use Laminas\Diactoros\Request as DiactorosRequest;
 
 
 
 
 
 
 
 
 
38
  use Nyholm\Psr7\Factory\HttplugFactory as NyholmHttplugFactory;
39
+ use Psr\Http\Client\ClientInterface as Psr18Client;
40
+ use Psr\Http\Message\RequestFactoryInterface as Psr17RequestFactory;
41
+ use Slim\Http\Request as SlimRequest;
42
+ use Symfony\Component\HttpClient\HttplugClient as SymfonyHttplug;
43
+ use Symfony\Component\HttpClient\Psr18Client as SymfonyPsr18;
44
+ use Zend\Diactoros\Request as ZendDiactorosRequest;
45
 
46
  /**
47
  * @internal
57
  MessageFactory::class => [
58
  ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]],
59
  ['class' => GuzzleMessageFactory::class, 'condition' => [GuzzleRequest::class, GuzzleMessageFactory::class]],
60
+ ['class' => DiactorosMessageFactory::class, 'condition' => [ZendDiactorosRequest::class, DiactorosMessageFactory::class]],
61
  ['class' => DiactorosMessageFactory::class, 'condition' => [DiactorosRequest::class, DiactorosMessageFactory::class]],
62
  ['class' => SlimMessageFactory::class, 'condition' => [SlimRequest::class, SlimMessageFactory::class]],
63
  ],
64
  StreamFactory::class => [
65
  ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]],
66
  ['class' => GuzzleStreamFactory::class, 'condition' => [GuzzleRequest::class, GuzzleStreamFactory::class]],
67
+ ['class' => DiactorosStreamFactory::class, 'condition' => [ZendDiactorosRequest::class, DiactorosStreamFactory::class]],
68
  ['class' => DiactorosStreamFactory::class, 'condition' => [DiactorosRequest::class, DiactorosStreamFactory::class]],
69
  ['class' => SlimStreamFactory::class, 'condition' => [SlimRequest::class, SlimStreamFactory::class]],
70
  ],
71
  UriFactory::class => [
72
  ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]],
73
  ['class' => GuzzleUriFactory::class, 'condition' => [GuzzleRequest::class, GuzzleUriFactory::class]],
74
+ ['class' => DiactorosUriFactory::class, 'condition' => [ZendDiactorosRequest::class, DiactorosUriFactory::class]],
75
  ['class' => DiactorosUriFactory::class, 'condition' => [DiactorosRequest::class, DiactorosUriFactory::class]],
76
  ['class' => SlimUriFactory::class, 'condition' => [SlimRequest::class, SlimUriFactory::class]],
77
  ],
78
  HttpAsyncClient::class => [
79
+ ['class' => SymfonyHttplug::class, 'condition' => [SymfonyHttplug::class, Promise::class, RequestFactory::class, [self::class, 'isPsr17FactoryInstalled']]],
80
+ ['class' => Guzzle7::class, 'condition' => Guzzle7::class],
81
  ['class' => Guzzle6::class, 'condition' => Guzzle6::class],
82
  ['class' => Curl::class, 'condition' => Curl::class],
83
  ['class' => React::class, 'condition' => React::class],
84
  ],
85
  HttpClient::class => [
86
+ ['class' => SymfonyHttplug::class, 'condition' => [SymfonyHttplug::class, RequestFactory::class, [self::class, 'isPsr17FactoryInstalled']]],
87
+ ['class' => Guzzle7::class, 'condition' => Guzzle7::class],
88
  ['class' => Guzzle6::class, 'condition' => Guzzle6::class],
89
  ['class' => Guzzle5::class, 'condition' => Guzzle5::class],
90
  ['class' => Curl::class, 'condition' => Curl::class],
100
  ],
101
  ],
102
  Psr18Client::class => [
103
+ [
104
+ 'class' => [self::class, 'symfonyPsr18Instantiate'],
105
+ 'condition' => [SymfonyPsr18::class, Psr17RequestFactory::class],
106
+ ],
107
+ [
108
+ 'class' => GuzzleHttp::class,
109
+ 'condition' => [self::class, 'isGuzzleImplementingPsr18'],
110
+ ],
111
  [
112
  'class' => [self::class, 'buzzInstantiate'],
113
  'condition' => [\Buzz\Client\FileGetContents::class, \Buzz\Message\ResponseBuilder::class],
121
  public static function getCandidates($type)
122
  {
123
  if (Psr18Client::class === $type) {
124
+ return self::getPsr18Candidates();
125
+ }
126
+
127
+ return self::$classes[$type] ?? [];
128
+ }
129
 
130
+ /**
131
+ * @return array The return value is always an array with zero or more elements. Each
132
+ * element is an array with two keys ['class' => string, 'condition' => mixed].
133
+ */
134
+ private static function getPsr18Candidates()
135
+ {
136
+ $candidates = self::$classes[Psr18Client::class];
137
+
138
+ // HTTPlug 2.0 clients implements PSR18Client too.
139
+ foreach (self::$classes[HttpClient::class] as $c) {
140
+ if (!is_string($c['class'])) {
141
+ continue;
142
+ }
143
+ try {
144
+ if (ClassDiscovery::safeClassExists($c['class']) && is_subclass_of($c['class'], Psr18Client::class)) {
145
  $candidates[] = $c;
146
  }
147
+ } catch (\Throwable $e) {
148
+ trigger_error(sprintf('Got exception "%s (%s)" while checking if a PSR-18 Client is available', get_class($e), $e->getMessage()), E_USER_WARNING);
149
  }
 
 
 
 
 
 
150
  }
151
 
152
+ return $candidates;
153
  }
154
 
155
  public static function buzzInstantiate()
156
  {
157
  return new \Buzz\Client\FileGetContents(MessageFactoryDiscovery::find());
158
  }
159
+
160
+ public static function symfonyPsr18Instantiate()
161
+ {
162
+ return new SymfonyPsr18(null, Psr17FactoryDiscovery::findResponseFactory(), Psr17FactoryDiscovery::findStreamFactory());
163
+ }
164
+
165
+ public static function isGuzzleImplementingPsr18()
166
+ {
167
+ return defined('GuzzleHttp\ClientInterface::MAJOR_VERSION');
168
+ }
169
+
170
+ /**
171
+ * Can be used as a condition.
172
+ *
173
+ * @return bool
174
+ */
175
+ public static function isPsr17FactoryInstalled()
176
+ {
177
+ try {
178
+ Psr17FactoryDiscovery::findResponseFactory();
179
+ } catch (NotFoundException $e) {
180
+ return false;
181
+ } catch (\Throwable $e) {
182
+ trigger_error(sprintf('Got exception "%s (%s)" while checking if a PSR-17 ResponseFactory is available', get_class($e), $e->getMessage()), E_USER_WARNING);
183
+
184
+ return false;
185
+ }
186
+
187
+ return true;
188
+ }
189
  }
vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php CHANGED
@@ -21,46 +21,70 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy
21
  */
22
  private static $classes = [
23
  RequestFactoryInterface::class => [
 
24
  'Nyholm\Psr7\Factory\Psr17Factory',
25
  'Zend\Diactoros\RequestFactory',
 
26
  'Http\Factory\Diactoros\RequestFactory',
27
  'Http\Factory\Guzzle\RequestFactory',
28
  'Http\Factory\Slim\RequestFactory',
 
 
29
  ],
30
  ResponseFactoryInterface::class => [
 
31
  'Nyholm\Psr7\Factory\Psr17Factory',
32
  'Zend\Diactoros\ResponseFactory',
 
33
  'Http\Factory\Diactoros\ResponseFactory',
34
  'Http\Factory\Guzzle\ResponseFactory',
35
  'Http\Factory\Slim\ResponseFactory',
 
 
36
  ],
37
  ServerRequestFactoryInterface::class => [
 
38
  'Nyholm\Psr7\Factory\Psr17Factory',
39
  'Zend\Diactoros\ServerRequestFactory',
 
40
  'Http\Factory\Diactoros\ServerRequestFactory',
41
  'Http\Factory\Guzzle\ServerRequestFactory',
42
  'Http\Factory\Slim\ServerRequestFactory',
 
 
43
  ],
44
  StreamFactoryInterface::class => [
 
45
  'Nyholm\Psr7\Factory\Psr17Factory',
46
  'Zend\Diactoros\StreamFactory',
 
47
  'Http\Factory\Diactoros\StreamFactory',
48
  'Http\Factory\Guzzle\StreamFactory',
49
  'Http\Factory\Slim\StreamFactory',
 
 
50
  ],
51
  UploadedFileFactoryInterface::class => [
 
52
  'Nyholm\Psr7\Factory\Psr17Factory',
53
  'Zend\Diactoros\UploadedFileFactory',
 
54
  'Http\Factory\Diactoros\UploadedFileFactory',
55
  'Http\Factory\Guzzle\UploadedFileFactory',
56
  'Http\Factory\Slim\UploadedFileFactory',
 
 
57
  ],
58
  UriFactoryInterface::class => [
 
59
  'Nyholm\Psr7\Factory\Psr17Factory',
60
  'Zend\Diactoros\UriFactory',
 
61
  'Http\Factory\Diactoros\UriFactory',
62
  'Http\Factory\Guzzle\UriFactory',
63
  'Http\Factory\Slim\UriFactory',
 
 
64
  ],
65
  ];
66
 
21
  */
22
  private static $classes = [
23
  RequestFactoryInterface::class => [
24
+ 'Phalcon\Http\Message\RequestFactory',
25
  'Nyholm\Psr7\Factory\Psr17Factory',
26
  'Zend\Diactoros\RequestFactory',
27
+ 'GuzzleHttp\Psr7\HttpFactory',
28
  'Http\Factory\Diactoros\RequestFactory',
29
  'Http\Factory\Guzzle\RequestFactory',
30
  'Http\Factory\Slim\RequestFactory',
31
+ 'Laminas\Diactoros\RequestFactory',
32
+ 'Slim\Psr7\Factory\RequestFactory',
33
  ],
34
  ResponseFactoryInterface::class => [
35
+ 'Phalcon\Http\Message\ResponseFactory',
36
  'Nyholm\Psr7\Factory\Psr17Factory',
37
  'Zend\Diactoros\ResponseFactory',
38
+ 'GuzzleHttp\Psr7\HttpFactory',
39
  'Http\Factory\Diactoros\ResponseFactory',
40
  'Http\Factory\Guzzle\ResponseFactory',
41
  'Http\Factory\Slim\ResponseFactory',
42
+ 'Laminas\Diactoros\ResponseFactory',
43
+ 'Slim\Psr7\Factory\ResponseFactory',
44
  ],
45
  ServerRequestFactoryInterface::class => [
46
+ 'Phalcon\Http\Message\ServerRequestFactory',
47
  'Nyholm\Psr7\Factory\Psr17Factory',
48
  'Zend\Diactoros\ServerRequestFactory',
49
+ 'GuzzleHttp\Psr7\HttpFactory',
50
  'Http\Factory\Diactoros\ServerRequestFactory',
51
  'Http\Factory\Guzzle\ServerRequestFactory',
52
  'Http\Factory\Slim\ServerRequestFactory',
53
+ 'Laminas\Diactoros\ServerRequestFactory',
54
+ 'Slim\Psr7\Factory\ServerRequestFactory',
55
  ],
56
  StreamFactoryInterface::class => [
57
+ 'Phalcon\Http\Message\StreamFactory',
58
  'Nyholm\Psr7\Factory\Psr17Factory',
59
  'Zend\Diactoros\StreamFactory',
60
+ 'GuzzleHttp\Psr7\HttpFactory',
61
  'Http\Factory\Diactoros\StreamFactory',
62
  'Http\Factory\Guzzle\StreamFactory',
63
  'Http\Factory\Slim\StreamFactory',
64
+ 'Laminas\Diactoros\StreamFactory',
65
+ 'Slim\Psr7\Factory\StreamFactory',
66
  ],
67
  UploadedFileFactoryInterface::class => [
68
+ 'Phalcon\Http\Message\UploadedFileFactory',
69
  'Nyholm\Psr7\Factory\Psr17Factory',
70
  'Zend\Diactoros\UploadedFileFactory',
71
+ 'GuzzleHttp\Psr7\HttpFactory',
72
  'Http\Factory\Diactoros\UploadedFileFactory',
73
  'Http\Factory\Guzzle\UploadedFileFactory',
74
  'Http\Factory\Slim\UploadedFileFactory',
75
+ 'Laminas\Diactoros\UploadedFileFactory',
76
+ 'Slim\Psr7\Factory\UploadedFileFactory',
77
  ],
78
  UriFactoryInterface::class => [
79
+ 'Phalcon\Http\Message\UriFactory',
80
  'Nyholm\Psr7\Factory\Psr17Factory',
81
  'Zend\Diactoros\UriFactory',
82
+ 'GuzzleHttp\Psr7\HttpFactory',
83
  'Http\Factory\Diactoros\UriFactory',
84
  'Http\Factory\Guzzle\UriFactory',
85
  'Http\Factory\Slim\UriFactory',
86
+ 'Laminas\Diactoros\UriFactory',
87
+ 'Slim\Psr7\Factory\UriFactory',
88
  ],
89
  ];
90
 
vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php CHANGED
@@ -17,7 +17,7 @@ interface DiscoveryStrategy
17
  * @return array The return value is always an array with zero or more elements. Each
18
  * element is an array with two keys ['class' => string, 'condition' => mixed].
19
  *
20
- * @throws StrategyUnavailableException if we cannot use this strategy.
21
  */
22
  public static function getCandidates($type);
23
  }
17
  * @return array The return value is always an array with zero or more elements. Each
18
  * element is an array with two keys ['class' => string, 'condition' => mixed].
19
  *
20
+ * @throws StrategyUnavailableException if we cannot use this strategy
21
  */
22
  public static function getCandidates($type);
23
  }
vendor/php-http/discovery/src/Strategy/MockClientStrategy.php CHANGED
@@ -18,12 +18,10 @@ final class MockClientStrategy implements DiscoveryStrategy
18
  */
19
  public static function getCandidates($type)
20
  {
21
- switch ($type) {
22
- case HttpClient::class:
23
- case HttpAsyncClient::class:
24
- return [['class' => Mock::class, 'condition' => Mock::class]];
25
- default:
26
- return [];
27
- }
28
  }
29
  }
18
  */
19
  public static function getCandidates($type)
20
  {
21
+ if (is_a(HttpClient::class, $type, true) || is_a(HttpAsyncClient::class, $type, true)) {
22
+ return [['class' => Mock::class, 'condition' => Mock::class]];
23
+ }
24
+
25
+ return [];
 
 
26
  }
27
  }
vendor/php-http/discovery/src/StreamFactoryDiscovery.php CHANGED
@@ -26,11 +26,7 @@ final class StreamFactoryDiscovery extends ClassDiscovery
26
  try {
27
  $streamFactory = static::findOneByType(StreamFactory::class);
28
  } catch (DiscoveryFailedException $e) {
29
- throw new NotFoundException(
30
- 'No stream factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.',
31
- 0,
32
- $e
33
- );
34
  }
35
 
36
  return static::instantiateClass($streamFactory);
26
  try {
27
  $streamFactory = static::findOneByType(StreamFactory::class);
28
  } catch (DiscoveryFailedException $e) {
29
+ throw new NotFoundException('No stream factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e);
 
 
 
 
30
  }
31
 
32
  return static::instantiateClass($streamFactory);
vendor/php-http/discovery/src/UriFactoryDiscovery.php CHANGED
@@ -26,11 +26,7 @@ final class UriFactoryDiscovery extends ClassDiscovery
26
  try {
27
  $uriFactory = static::findOneByType(UriFactory::class);
28
  } catch (DiscoveryFailedException $e) {
29
- throw new NotFoundException(
30
- 'No uri factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.',
31
- 0,
32
- $e
33
- );
34
  }
35
 
36
  return static::instantiateClass($uriFactory);
26
  try {
27
  $uriFactory = static::findOneByType(UriFactory::class);
28
  } catch (DiscoveryFailedException $e) {
29
+ throw new NotFoundException('No uri factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e);
 
 
 
 
30
  }
31
 
32
  return static::instantiateClass($uriFactory);
vendor/php-http/httplug/.php-cs-fixer.dist.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $finder = PhpCsFixer\Finder::create()
4
+ ->in(__DIR__.'/src')
5
+ ->name('*.php')
6
+ ;
7
+
8
+ $config = (new PhpCsFixer\Config())
9
+ ->setRiskyAllowed(true)
10
+ ->setRules([
11
+ '@Symfony' => true,
12
+ ])
13
+ ->setFinder($finder)
14
+ ;
15
+
16
+ return $config;
vendor/php-http/httplug/CHANGELOG.md CHANGED
@@ -1,17 +1,70 @@
1
  # Change Log
2
 
3
- ## 1.1.0 - 2016-08-31
4
 
5
- - Added HttpFulfilledPromise and HttpRejectedPromise which respect the HttpAsyncClient interface
6
 
7
- ## 1.0.0 - 2016-01-26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  ### Removed
10
 
11
  - Stability configuration from composer
12
 
13
 
14
- ## 1.0.0-RC1 - 2016-01-12
15
 
16
  ### Changed
17
 
@@ -19,7 +72,7 @@
19
  - Updated promise dependency to RC1
20
 
21
 
22
- ## 1.0.0-beta - 2015-12-17
23
 
24
  ### Added
25
 
@@ -30,7 +83,7 @@
30
  - Exception concept
31
 
32
 
33
- ## 1.0.0-alpha3 - 2015-12-13
34
 
35
  ### Changed
36
 
@@ -41,14 +94,14 @@
41
  - Promise interface moved to its own repository: [php-http/promise](https://github.com/php-http/promise)
42
 
43
 
44
- ## 1.0.0-alpha2 - 2015-11-16
45
 
46
  ### Added
47
 
48
  - Async client and Promise interface
49
 
50
 
51
- ## 1.0.0-alpha - 2015-10-26
52
 
53
  ### Added
54
 
@@ -70,3 +123,14 @@
70
  ### Added
71
 
72
  - Initial release
 
 
 
 
 
 
 
 
 
 
 
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
+ ## [2.3.0] - 2022-02-21
13
+
14
+ ### Changed
15
+
16
+ - Enabled the `$onRejected` callback of `HttpRejectedPromise` to return a promise for implementing a retry
17
+ mechanism [#168](https://github.com/php-http/httplug/pull/168)
18
+
19
+ ## [2.2.0] - 2020-07-13
20
+
21
+ ### Changed
22
+
23
+ - Support PHP 7.1-8.0
24
+
25
+ ## [2.1.0] - 2019-12-27
26
+
27
+ ### Changed
28
+
29
+ - `Http\Client\Exception\NetworkException` no longer extends `Http\Client\Exception\RequestException`,
30
+ in accordance with [PSR-18](https://www.php-fig.org/psr/psr-18/)
31
+
32
+ ## [2.0.0] - 2018-10-31
33
+
34
+ This version is no BC break for consumers using HTTPlug. However, HTTP clients that
35
+ implement HTTPlug need to adjust because we add return type declarations.
36
+
37
+ ### Added
38
+
39
+ - Support for PSR-18 (HTTP client).
40
+
41
+ ### Changed
42
+
43
+ - **BC Break:** `HttpClient::sendRequest(RequestInterface $request)` has a return type annotation. The new
44
+ signature is `HttpClient::sendRequest(RequestInterface $request): ResponseInterface`.
45
+ - **BC Break:** `RequestException::getRequest()` has a return type annotation. The new
46
+ signature is `RequestException::getRequest(): RequestInterface`.
47
+
48
+ ### Removed
49
+
50
+ - PHP 5 support
51
+
52
+
53
+ ## [1.1.0] - 2016-08-31
54
+
55
+ ### Added
56
+
57
+ - HttpFulfilledPromise and HttpRejectedPromise which respect the HttpAsyncClient interface
58
+
59
+
60
+ ## [1.0.0] - 2016-01-26
61
 
62
  ### Removed
63
 
64
  - Stability configuration from composer
65
 
66
 
67
+ ## [1.0.0-RC1] - 2016-01-12
68
 
69
  ### Changed
70
 
72
  - Updated promise dependency to RC1
73
 
74
 
75
+ ## [1.0.0-beta] - 2015-12-17
76
 
77
  ### Added
78
 
83
  - Exception concept
84
 
85
 
86
+ ## [1.0.0-alpha3] - 2015-12-13
87
 
88
  ### Changed
89
 
94
  - Promise interface moved to its own repository: [php-http/promise](https://github.com/php-http/promise)
95
 
96
 
97
+ ## [1.0.0-alpha2] - 2015-11-16
98
 
99
  ### Added
100
 
101
  - Async client and Promise interface
102
 
103
 
104
+ ## [1.0.0-alpha] - 2015-10-26
105
 
106
  ### Added
107
 
123
  ### Added
124
 
125
  - Initial release
126
+
127
+
128
+ [Unreleased]: https://github.com/php-http/httplug/compare/v2.0.0...HEAD
129
+ [2.0.0]: https://github.com/php-http/httplug/compare/v1.1.0...HEAD
130
+ [1.1.0]: https://github.com/php-http/httplug/compare/v1.0.0...v1.1.0
131
+ [1.0.0]: https://github.com/php-http/httplug/compare/v1.0.0-RC1...v1.0.0
132
+ [1.0.0-RC1]: https://github.com/php-http/httplug/compare/v1.0.0-beta...v1.0.0-RC1
133
+ [1.0.0-beta]: https://github.com/php-http/httplug/compare/v1.0.0-alpha3...v1.0.0-beta
134
+ [1.0.0-alpha3]: https://github.com/php-http/httplug/compare/v1.0.0-alpha2...v1.0.0-alpha3
135
+ [1.0.0-alpha2]: https://github.com/php-http/httplug/compare/v1.0.0-alpha...v1.0.0-alpha2
136
+ [1.0.0-alpha]: https://github.com/php-http/httplug/compare/v0.1.0...v1.0.0-alpha
vendor/php-http/httplug/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
- Copyright (c) 2014-2015 Eric GELOEN <geloen.eric@gmail.com>
2
- Copyright (c) 2015-2016 PHP HTTP Team <team@php-http.org>
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
1
+ Copyright (c) 2014 Eric GELOEN <geloen.eric@gmail.com>
2
+ Copyright (c) 2015 PHP HTTP Team <team@php-http.org>
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
vendor/php-http/httplug/README.md CHANGED
@@ -2,17 +2,40 @@
2
 
3
  [![Latest Version](https://img.shields.io/github/release/php-http/httplug.svg?style=flat-square)](https://github.com/php-http/httplug/releases)
4
  [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5
- [![Build Status](https://img.shields.io/travis/php-http/httplug.svg?style=flat-square)](https://travis-ci.org/php-http/httplug)
6
  [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/httplug.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/httplug)
7
  [![Quality Score](https://img.shields.io/scrutinizer/g/php-http/httplug.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/httplug)
8
  [![Total Downloads](https://img.shields.io/packagist/dt/php-http/httplug.svg?style=flat-square)](https://packagist.org/packages/php-http/httplug)
9
 
10
- [![Slack Status](http://slack.httplug.io/badge.svg)](http://slack.httplug.io)
11
  [![Email](https://img.shields.io/badge/email-team@httplug.io-blue.svg?style=flat-square)](mailto:team@httplug.io)
12
 
13
  **HTTPlug, the HTTP client abstraction for PHP.**
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  ## Install
17
 
18
  Via Composer
@@ -22,14 +45,6 @@ $ composer require php-http/httplug
22
  ```
23
 
24
 
25
- ## Intro
26
-
27
- This is the contract package for HTTP Client.
28
- Use it to create HTTP Clients which are interoperable and compatible with [PSR-7](http://www.php-fig.org/psr/psr-7/).
29
-
30
- This library is the official successor of the [ivory http adapter](https://github.com/egeloen/ivory-http-adapter).
31
-
32
-
33
  ## Documentation
34
 
35
  Please see the [official documentation](http://docs.php-http.org).
@@ -42,16 +57,6 @@ $ composer test
42
  ```
43
 
44
 
45
- ## Contributing
46
-
47
- Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).
48
-
49
-
50
- ## Security
51
-
52
- If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
53
-
54
-
55
  ## License
56
 
57
  The MIT License (MIT). Please see [License File](LICENSE) for more information.
2
 
3
  [![Latest Version](https://img.shields.io/github/release/php-http/httplug.svg?style=flat-square)](https://github.com/php-http/httplug/releases)
4
  [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5
+ [![Build Status](https://github.com/php-http/httplug/actions/workflows/ci.yml/badge.svg)](https://github.com/php-http/httplug/actions/workflows/ci.yml)
6
  [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/httplug.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/httplug)
7
  [![Quality Score](https://img.shields.io/scrutinizer/g/php-http/httplug.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/httplug)
8
  [![Total Downloads](https://img.shields.io/packagist/dt/php-http/httplug.svg?style=flat-square)](https://packagist.org/packages/php-http/httplug)
9
 
 
10
  [![Email](https://img.shields.io/badge/email-team@httplug.io-blue.svg?style=flat-square)](mailto:team@httplug.io)
11
 
12
  **HTTPlug, the HTTP client abstraction for PHP.**
13
 
14
 
15
+ ## Intro
16
+
17
+ HTTP client standard built on [PSR-7](http://www.php-fig.org/psr/psr-7/) HTTP
18
+ messages. The HTTPlug client interface is compatible with the official standard
19
+ for the HTTP client interface, [PSR-18](http://www.php-fig.org/psr/psr-18/).
20
+ HTTPlug adds an interface for asynchronous HTTP requests, which PSR-18 does not
21
+ cover.
22
+
23
+ Since HTTPlug has already been widely adopted and a whole ecosystem has been
24
+ built around it, we will keep maintaining this package for the time being.
25
+ HTTPlug 2.0 and newer extend the PSR-18 interface to allow for a convenient
26
+ migration path.
27
+
28
+ New client implementations and consumers should use the PSR-18 interfaces
29
+ directly. In the long term, we expect PSR-18 to completely replace the need
30
+ for HTTPlug.
31
+
32
+
33
+ ## History
34
+
35
+ HTTPlug is the official successor of the [ivory http adapter](https://github.com/egeloen/ivory-http-adapter).
36
+ HTTPlug is a predecessor of [PSR-18](http://www.php-fig.org/psr/psr-18/)
37
+
38
+
39
  ## Install
40
 
41
  Via Composer
45
  ```
46
 
47
 
 
 
 
 
 
 
 
 
48
  ## Documentation
49
 
50
  Please see the [official documentation](http://docs.php-http.org).
57
  ```
58
 
59
 
 
 
 
 
 
 
 
 
 
 
60
  ## License
61
 
62
  The MIT License (MIT). Please see [License File](LICENSE) for more information.
vendor/php-http/httplug/src/Exception.php CHANGED
@@ -2,11 +2,13 @@
2
 
3
  namespace Http\Client;
4
 
 
 
5
  /**
6
  * Every HTTP Client related Exception must implement this interface.
7
  *
8
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
9
  */
10
- interface Exception
11
  {
12
  }
2
 
3
  namespace Http\Client;
4
 
5
+ use Psr\Http\Client\ClientExceptionInterface as PsrClientException;
6
+
7
  /**
8
  * Every HTTP Client related Exception must implement this interface.
9
  *
10
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
  */
12
+ interface Exception extends PsrClientException
13
  {
14
  }
vendor/php-http/httplug/src/Exception/HttpException.php CHANGED
@@ -20,10 +20,7 @@ class HttpException extends RequestException
20
  protected $response;
21
 
22
  /**
23
- * @param string $message
24
- * @param RequestInterface $request
25
- * @param ResponseInterface $response
26
- * @param \Exception|null $previous
27
  */
28
  public function __construct(
29
  $message,
@@ -49,12 +46,6 @@ class HttpException extends RequestException
49
 
50
  /**
51
  * Factory method to create a new exception with a normalized error message.
52
- *
53
- * @param RequestInterface $request
54
- * @param ResponseInterface $response
55
- * @param \Exception|null $previous
56
- *
57
- * @return HttpException
58
  */
59
  public static function create(
60
  RequestInterface $request,
@@ -69,6 +60,6 @@ class HttpException extends RequestException
69
  $response->getReasonPhrase()
70
  );
71
 
72
- return new self($message, $request, $response, $previous);
73
  }
74
  }
20
  protected $response;
21
 
22
  /**
23
+ * @param string $message
 
 
 
24
  */
25
  public function __construct(
26
  $message,
46
 
47
  /**
48
  * Factory method to create a new exception with a normalized error message.
 
 
 
 
 
 
49
  */
50
  public static function create(
51
  RequestInterface $request,
60
  $response->getReasonPhrase()
61
  );
62
 
63
+ return new static($message, $request, $response, $previous);
64
  }
65
  }
vendor/php-http/httplug/src/Exception/NetworkException.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace Http\Client\Exception;
4
 
 
 
 
5
  /**
6
  * Thrown when the request cannot be completed because of network issues.
7
  *
@@ -9,6 +12,17 @@ namespace Http\Client\Exception;
9
  *
10
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
  */
12
- class NetworkException extends RequestException
13
  {
 
 
 
 
 
 
 
 
 
 
 
14
  }
2
 
3
  namespace Http\Client\Exception;
4
 
5
+ use Psr\Http\Client\NetworkExceptionInterface as PsrNetworkException;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
  /**
9
  * Thrown when the request cannot be completed because of network issues.
10
  *
12
  *
13
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
  */
15
+ class NetworkException extends TransferException implements PsrNetworkException
16
  {
17
+ use RequestAwareTrait;
18
+
19
+ /**
20
+ * @param string $message
21
+ */
22
+ public function __construct($message, RequestInterface $request, \Exception $previous = null)
23
+ {
24
+ $this->setRequest($request);
25
+
26
+ parent::__construct($message, 0, $previous);
27
+ }
28
  }
vendor/php-http/httplug/src/Exception/RequestAwareTrait.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Exception;
4
+
5
+ use Psr\Http\Message\RequestInterface;
6
+
7
+ trait RequestAwareTrait
8
+ {
9
+ /**
10
+ * @var RequestInterface
11
+ */
12
+ private $request;
13
+
14
+ private function setRequest(RequestInterface $request)
15
+ {
16
+ $this->request = $request;
17
+ }
18
+
19
+ /**
20
+ * {@inheritdoc}
21
+ */
22
+ public function getRequest(): RequestInterface
23
+ {
24
+ return $this->request;
25
+ }
26
+ }
vendor/php-http/httplug/src/Exception/RequestException.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace Http\Client\Exception;
4
 
 
5
  use Psr\Http\Message\RequestInterface;
6
 
7
  /**
@@ -12,32 +13,17 @@ use Psr\Http\Message\RequestInterface;
12
  *
13
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
  */
15
- class RequestException extends TransferException
16
  {
17
- /**
18
- * @var RequestInterface
19
- */
20
- private $request;
21
 
22
  /**
23
- * @param string $message
24
- * @param RequestInterface $request
25
- * @param \Exception|null $previous
26
  */
27
  public function __construct($message, RequestInterface $request, \Exception $previous = null)
28
  {
29
- $this->request = $request;
30
 
31
  parent::__construct($message, 0, $previous);
32
  }
33
-
34
- /**
35
- * Returns the request.
36
- *
37
- * @return RequestInterface
38
- */
39
- public function getRequest()
40
- {
41
- return $this->request;
42
- }
43
  }
2
 
3
  namespace Http\Client\Exception;
4
 
5
+ use Psr\Http\Client\RequestExceptionInterface as PsrRequestException;
6
  use Psr\Http\Message\RequestInterface;
7
 
8
  /**
13
  *
14
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
15
  */
16
+ class RequestException extends TransferException implements PsrRequestException
17
  {
18
+ use RequestAwareTrait;
 
 
 
19
 
20
  /**
21
+ * @param string $message
 
 
22
  */
23
  public function __construct($message, RequestInterface $request, \Exception $previous = null)
24
  {
25
+ $this->setRequest($request);
26
 
27
  parent::__construct($message, 0, $previous);
28
  }
 
 
 
 
 
 
 
 
 
 
29
  }
vendor/php-http/httplug/src/HttpAsyncClient.php CHANGED
@@ -17,9 +17,7 @@ interface HttpAsyncClient
17
  *
18
  * Exceptions related to processing the request are available from the returned Promise.
19
  *
20
- * @param RequestInterface $request
21
- *
22
- * @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception.
23
  *
24
  * @throws \Exception If processing the request is impossible (eg. bad configuration).
25
  */
17
  *
18
  * Exceptions related to processing the request are available from the returned Promise.
19
  *
20
+ * @return Promise resolves a PSR-7 Response or fails with an Http\Client\Exception
 
 
21
  *
22
  * @throws \Exception If processing the request is impossible (eg. bad configuration).
23
  */
vendor/php-http/httplug/src/HttpClient.php CHANGED
@@ -2,27 +2,14 @@
2
 
3
  namespace Http\Client;
4
 
5
- use Psr\Http\Message\RequestInterface;
6
- use Psr\Http\Message\ResponseInterface;
7
 
8
  /**
9
- * Sends a PSR-7 Request and returns a PSR-7 response.
10
  *
11
- * @author GeLo <geloen.eric@gmail.com>
12
- * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
- * @author David Buchmann <mail@davidbu.ch>
14
  */
15
- interface HttpClient
16
  {
17
- /**
18
- * Sends a PSR-7 request.
19
- *
20
- * @param RequestInterface $request
21
- *
22
- * @return ResponseInterface
23
- *
24
- * @throws \Http\Client\Exception If an error happens during processing the request.
25
- * @throws \Exception If processing the request is impossible (eg. bad configuration).
26
- */
27
- public function sendRequest(RequestInterface $request);
28
  }
2
 
3
  namespace Http\Client;
4
 
5
+ use Psr\Http\Client\ClientInterface;
 
6
 
7
  /**
8
+ * {@inheritdoc}
9
  *
10
+ * Provide the Httplug HttpClient interface for BC.
11
+ * You should typehint Psr\Http\Client\ClientInterface in new code
 
12
  */
13
+ interface HttpClient extends ClientInterface
14
  {
 
 
 
 
 
 
 
 
 
 
 
15
  }
vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php CHANGED
@@ -13,9 +13,6 @@ final class HttpFulfilledPromise implements Promise
13
  */
14
  private $response;
15
 
16
- /**
17
- * @param ResponseInterface $response
18
- */
19
  public function __construct(ResponseInterface $response)
20
  {
21
  $this->response = $response;
13
  */
14
  private $response;
15
 
 
 
 
16
  public function __construct(ResponseInterface $response)
17
  {
18
  $this->response = $response;
vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php CHANGED
@@ -12,9 +12,6 @@ final class HttpRejectedPromise implements Promise
12
  */
13
  private $exception;
14
 
15
- /**
16
- * @param Exception $exception
17
- */
18
  public function __construct(Exception $exception)
19
  {
20
  $this->exception = $exception;
@@ -30,7 +27,12 @@ final class HttpRejectedPromise implements Promise
30
  }
31
 
32
  try {
33
- return new HttpFulfilledPromise($onRejected($this->exception));
 
 
 
 
 
34
  } catch (Exception $e) {
35
  return new self($e);
36
  }
12
  */
13
  private $exception;
14
 
 
 
 
15
  public function __construct(Exception $exception)
16
  {
17
  $this->exception = $exception;
27
  }
28
 
29
  try {
30
+ $result = $onRejected($this->exception);
31
+ if ($result instanceof Promise) {
32
+ return $result;
33
+ }
34
+
35
+ return new HttpFulfilledPromise($result);
36
  } catch (Exception $e) {
37
  return new self($e);
38
  }
vendor/php-http/message/CHANGELOG.md CHANGED
@@ -6,8 +6,63 @@ All notable changes to this project will be documented in this file.
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.2] - 2018-10-30
13
 
@@ -177,7 +232,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
177
  - Message factory (Guzzle, Diactoros)
178
 
179
 
180
- [Unreleased]: https://github.com/php-http/message/compare/v1.7.1...HEAD
 
 
 
 
 
181
  [1.7.1]: https://github.com/php-http/message/compare/1.7.0...v1.7.1
182
  [1.7.0]: https://github.com/php-http/message/compare/1.6.0...1.7.0
183
  [1.6.0]: https://github.com/php-http/message/compare/1.5.0...1.6.0
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
+ ## [1.13.0] - 2022-02-11
10
 
11
+ - Added `Formatter::formatResponseForRequest()` to allow the formatter to get context from the request to decide what of the response to output.
12
+ - Deprecated `Formatter::formatResponse()` in favor of the new `formatResponseForRequest` method.
13
+
14
+ ## [1.12.0] - 2021-08-29
15
+
16
+ - Added support for adjusting binary detection regex in FullHttpMessageFormatter.
17
+
18
+ ## [1.11.2] - 2021-08-03
19
+
20
+ - Support GuzzleHttp/Psr7 version 2.0 in the (deprecated) GuzzleStreamFactory.
21
+
22
+ ## [1.11.1] - 2021-05-24
23
+
24
+ - Support GuzzleHttp/Psr7 version 2.0 in the (deprecated) GuzzleUriFactory.
25
+
26
+ ## [1.11.0] - 2020-02-01
27
+
28
+ - Migrated from `zendframework/zend-diactoros` to `laminas/laminas-diactoros`.
29
+ Users are encouraged to update their dependencies by simply replacing the Zend package with the Laminas package.
30
+ Due to the [laminas-zendframework-brige](https://github.com/laminas/laminas-zendframework-bridge), BC changes
31
+ are not expected and legacy code does not need to be refactored (though it is
32
+ [recommended and simple](https://docs.laminas.dev/migration/)).
33
+ - The diactoros factories of `php-http/message` will return objects from the `Laminas\Diactoros\` namespace, if
34
+ the respective classes are available via autoloading, but continue to return objects from `Zend\Diactoros\`
35
+ namespace otherwise.
36
+
37
+ - Allow to specify the hashing algorithm for WSSE authentication.
38
+
39
+ ## [1.10.0] - 2020-11-11
40
+
41
+ - Added support for PHP 8.0.
42
+
43
+ ## [1.9.1] - 2020-10-13
44
+
45
+ - Improved detection of binary stream to not consider newlines, carriage return or tabs as binary.
46
+
47
+ ## [1.9.0] - 2020-08-17
48
+
49
+ - Omitted binary body in FullHttpMessageFormatter and CurlCommandFormatter.
50
+ `[binary stream omitted]` will be shown instead.
51
+
52
+ ### Added
53
+
54
+ - New Header authentication method for arbitrary header authentication.
55
+
56
+ ## [1.8.0] - 2019-08-05
57
+
58
+ ### Changed
59
+
60
+ - Raised minimum PHP version to 7.1
61
+
62
+ ### Fixed
63
+
64
+ - Fatal error on `CurlCommandFormatter` when body is larger than `escapeshellarg` allowed length.
65
+ - Do not read stream in message formatter if stream is not seekable.
66
 
67
  ## [1.7.2] - 2018-10-30
68
 
232
  - Message factory (Guzzle, Diactoros)
233
 
234
 
235
+ [Unreleased]: https://github.com/php-http/message/compare/1.10.0...HEAD
236
+ [1.10.0]: https://github.com/php-http/message/compare/1.9.1...1.10.0
237
+ [1.9.1]: https://github.com/php-http/message/compare/1.9.0...1.9.1
238
+ [1.9.0]: https://github.com/php-http/message/compare/1.8.0...1.9.0
239
+ [1.8.0]: https://github.com/php-http/message/compare/1.7.2...1.8.0
240
+ [1.7.2]: https://github.com/php-http/message/compare/v1.7.1...1.7.2
241
  [1.7.1]: https://github.com/php-http/message/compare/1.7.0...v1.7.1
242
  [1.7.0]: https://github.com/php-http/message/compare/1.6.0...1.7.0
243
  [1.6.0]: https://github.com/php-http/message/compare/1.5.0...1.6.0
vendor/php-http/message/README.md CHANGED
@@ -2,9 +2,7 @@
2
 
3
  [![Latest Version](https://img.shields.io/github/release/php-http/message.svg?style=flat-square)](https://github.com/php-http/message/releases)
4
  [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5
- [![Build Status](https://img.shields.io/travis/php-http/message.svg?style=flat-square)](https://travis-ci.org/php-http/message)
6
- [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/message.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/message)
7
- [![Quality Score](https://img.shields.io/scrutinizer/g/php-http/message.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/message)
8
  [![Total Downloads](https://img.shields.io/packagist/dt/php-http/message.svg?style=flat-square)](https://packagist.org/packages/php-http/message)
9
 
10
  **HTTP Message related tools.**
@@ -43,18 +41,10 @@ $ composer test
43
  ```
44
 
45
 
46
- ## Contributing
47
-
48
- Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).
49
-
50
  ## Credits
51
 
52
  Thanks to [Cuzzle](https://github.com/namshi/cuzzle) for inpiration for the `CurlCommandFormatter`.
53
 
54
- ## Security
55
-
56
- If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
57
-
58
 
59
  ## License
60
 
2
 
3
  [![Latest Version](https://img.shields.io/github/release/php-http/message.svg?style=flat-square)](https://github.com/php-http/message/releases)
4
  [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5
+ [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/php-http/message/CI?style=flat-square)](https://github.com/php-http/message/actions?query=workflow%3ACI+branch%3Amaster)
 
 
6
  [![Total Downloads](https://img.shields.io/packagist/dt/php-http/message.svg?style=flat-square)](https://packagist.org/packages/php-http/message)
7
 
8
  **HTTP Message related tools.**
41
  ```
42
 
43
 
 
 
 
 
44
  ## Credits
45
 
46
  Thanks to [Cuzzle](https://github.com/namshi/cuzzle) for inpiration for the `CurlCommandFormatter`.
47
 
 
 
 
 
48
 
49
  ## License
50
 
vendor/php-http/message/src/Authentication.php CHANGED
@@ -5,18 +5,21 @@ namespace Http\Message;
5
  use Psr\Http\Message\RequestInterface;
6
 
7
  /**
8
- * Authenticate a PSR-7 Request.
9
  *
10
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
  */
12
  interface Authentication
13
  {
14
  /**
15
- * Authenticates a request.
16
  *
17
- * @param RequestInterface $request
 
18
  *
19
- * @return RequestInterface
 
 
20
  */
21
  public function authenticate(RequestInterface $request);
22
  }
5
  use Psr\Http\Message\RequestInterface;
6
 
7
  /**
8
+ * Add authentication information to a PSR-7 Request.
9
  *
10
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
  */
12
  interface Authentication
13
  {
14
  /**
15
+ * Alter the request to add the authentication credentials.
16
  *
17
+ * To do that, the implementation might use pre-stored credentials or do
18
+ * separate HTTP requests to obtain a valid token.
19
  *
20
+ * @param RequestInterface $request The request without authentication information
21
+ *
22
+ * @return RequestInterface The request with added authentication information
23
  */
24
  public function authenticate(RequestInterface $request);
25
  }
vendor/php-http/message/src/Authentication/Header.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Authentication;
4
+
5
+ use Http\Message\Authentication;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ class Header implements Authentication
9
+ {
10
+ /**
11
+ * @var string
12
+ */
13
+ private $name;
14
+
15
+ /**
16
+ * @var string|string[]
17
+ */
18
+ private $value;
19
+
20
+ /**
21
+ * @param string|string[] $value
22
+ */
23
+ public function __construct(string $name, $value)
24
+ {
25
+ $this->name = $name;
26
+ $this->value = $value;
27
+ }
28
+
29
+ /**
30
+ * {@inheritdoc}
31
+ */
32
+ public function authenticate(RequestInterface $request)
33
+ {
34
+ return $request->withHeader($this->name, $this->value);
35
+ }
36
+ }
vendor/php-http/message/src/Authentication/Matching.php CHANGED
@@ -27,10 +27,6 @@ final class Matching implements Authentication
27
  */
28
  private $matcher;
29
 
30
- /**
31
- * @param Authentication $authentication
32
- * @param callable|null $matcher
33
- */
34
  public function __construct(Authentication $authentication, callable $matcher = null)
35
  {
36
  if (is_null($matcher)) {
@@ -58,8 +54,7 @@ final class Matching implements Authentication
58
  /**
59
  * Creates a matching authentication for an URL.
60
  *
61
- * @param Authentication $authentication
62
- * @param string $url
63
  *
64
  * @return self
65
  */
27
  */
28
  private $matcher;
29
 
 
 
 
 
30
  public function __construct(Authentication $authentication, callable $matcher = null)
31
  {
32
  if (is_null($matcher)) {
54
  /**
55
  * Creates a matching authentication for an URL.
56
  *
57
+ * @param string $url
 
58
  *
59
  * @return self
60
  */
vendor/php-http/message/src/Authentication/QueryParam.php CHANGED
@@ -20,9 +20,6 @@ final class QueryParam implements Authentication
20
  */
21
  private $params = [];
22
 
23
- /**
24
- * @param array $params
25
- */
26
  public function __construct(array $params)
27
  {
28
  $this->params = $params;
@@ -41,7 +38,7 @@ final class QueryParam implements Authentication
41
 
42
  $params = array_merge($params, $this->params);
43
 
44
- $query = http_build_query($params, null, '&');
45
 
46
  $uri = $uri->withQuery($query);
47
 
20
  */
21
  private $params = [];
22
 
 
 
 
23
  public function __construct(array $params)
24
  {
25
  $this->params = $params;
38
 
39
  $params = array_merge($params, $this->params);
40
 
41
+ $query = http_build_query($params, '', '&');
42
 
43
  $uri = $uri->withQuery($query);
44
 
vendor/php-http/message/src/Authentication/RequestConditional.php CHANGED
@@ -23,10 +23,6 @@ final class RequestConditional implements Authentication
23
  */
24
  private $authentication;
25
 
26
- /**
27
- * @param RequestMatcher $requestMatcher
28
- * @param Authentication $authentication
29
- */
30
  public function __construct(RequestMatcher $requestMatcher, Authentication $authentication)
31
  {
32
  $this->requestMatcher = $requestMatcher;
23
  */
24
  private $authentication;
25
 
 
 
 
 
26
  public function __construct(RequestMatcher $requestMatcher, Authentication $authentication)
27
  {
28
  $this->requestMatcher = $requestMatcher;
vendor/php-http/message/src/Authentication/Wsse.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace Http\Message\Authentication;
4
 
5
  use Http\Message\Authentication;
 
6
  use Psr\Http\Message\RequestInterface;
7
 
8
  /**
@@ -22,14 +23,24 @@ final class Wsse implements Authentication
22
  */
23
  private $password;
24
 
 
 
 
 
 
25
  /**
26
  * @param string $username
27
  * @param string $password
 
28
  */
29
- public function __construct($username, $password)
30
  {
31
  $this->username = $username;
32
  $this->password = $password;
 
 
 
 
33
  }
34
 
35
  /**
@@ -37,10 +48,9 @@ final class Wsse implements Authentication
37
  */
38
  public function authenticate(RequestInterface $request)
39
  {
40
- // TODO: generate better nonce?
41
  $nonce = substr(md5(uniqid(uniqid().'_', true)), 0, 16);
42
  $created = date('c');
43
- $digest = base64_encode(sha1(base64_decode($nonce).$created.$this->password, true));
44
 
45
  $wsse = sprintf(
46
  'UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"',
3
  namespace Http\Message\Authentication;
4
 
5
  use Http\Message\Authentication;
6
+ use InvalidArgumentException;
7
  use Psr\Http\Message\RequestInterface;
8
 
9
  /**
23
  */
24
  private $password;
25
 
26
+ /**
27
+ * @var string
28
+ */
29
+ private $hashAlgorithm;
30
+
31
  /**
32
  * @param string $username
33
  * @param string $password
34
+ * @param string $hashAlgorithm To use a better hashing algorithm than the weak sha1, pass the algorithm to use, e.g. "sha512"
35
  */
36
+ public function __construct($username, $password, $hashAlgorithm = 'sha1')
37
  {
38
  $this->username = $username;
39
  $this->password = $password;
40
+ if (false === in_array($hashAlgorithm, hash_algos())) {
41
+ throw new InvalidArgumentException(sprintf('Unaccepted hashing algorithm: %s', $hashAlgorithm));
42
+ }
43
+ $this->hashAlgorithm = $hashAlgorithm;
44
  }
45
 
46
  /**
48
  */
49
  public function authenticate(RequestInterface $request)
50
  {
 
51
  $nonce = substr(md5(uniqid(uniqid().'_', true)), 0, 16);
52
  $created = date('c');
53
+ $digest = base64_encode(hash($this->hashAlgorithm, base64_decode($nonce).$created.$this->password, true));
54
 
55
  $wsse = sprintf(
56
  'UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"',
vendor/php-http/message/src/Builder/ResponseBuilder.php CHANGED
@@ -18,8 +18,6 @@ class ResponseBuilder
18
 
19
  /**
20
  * Create builder for the given response.
21
- *
22
- * @param ResponseInterface $response
23
  */
24
  public function __construct(ResponseInterface $response)
25
  {
@@ -39,12 +37,12 @@ class ResponseBuilder
39
  /**
40
  * Add headers represented by an array of header lines.
41
  *
42
- * @param string[] $headers Response headers as array of header lines.
43
  *
44
  * @return $this
45
  *
46
- * @throws \UnexpectedValueException For invalid header values.
47
- * @throws \InvalidArgumentException For invalid status code arguments.
48
  */
49
  public function setHeadersFromArray(array $headers)
50
  {
@@ -66,12 +64,12 @@ class ResponseBuilder
66
  /**
67
  * Add headers represented by a single string.
68
  *
69
- * @param string $headers Response headers as single string.
70
  *
71
  * @return $this
72
  *
73
  * @throws \InvalidArgumentException if $headers is not a string on object with __toString()
74
- * @throws \UnexpectedValueException For invalid header values.
75
  */
76
  public function setHeadersFromString($headers)
77
  {
@@ -95,11 +93,11 @@ class ResponseBuilder
95
  /**
96
  * Set response status from a status string.
97
  *
98
- * @param string $statusLine Response status as a string.
99
  *
100
  * @return $this
101
  *
102
- * @throws \InvalidArgumentException For invalid status line.
103
  */
104
  public function setStatus($statusLine)
105
  {
@@ -121,11 +119,11 @@ class ResponseBuilder
121
  /**
122
  * Add header represented by a string.
123
  *
124
- * @param string $headerLine Response header as a string.
125
  *
126
  * @return $this
127
  *
128
- * @throws \InvalidArgumentException For invalid header names or values.
129
  */
130
  public function addHeader($headerLine)
131
  {
18
 
19
  /**
20
  * Create builder for the given response.
 
 
21
  */
22
  public function __construct(ResponseInterface $response)
23
  {
37
  /**
38
  * Add headers represented by an array of header lines.
39
  *
40
+ * @param string[] $headers response headers as array of header lines
41
  *
42
  * @return $this
43
  *
44
+ * @throws \UnexpectedValueException for invalid header values
45
+ * @throws \InvalidArgumentException for invalid status code arguments
46
  */
47
  public function setHeadersFromArray(array $headers)
48
  {
64
  /**
65
  * Add headers represented by a single string.
66
  *
67
+ * @param string $headers response headers as single string
68
  *
69
  * @return $this
70
  *
71
  * @throws \InvalidArgumentException if $headers is not a string on object with __toString()
72
+ * @throws \UnexpectedValueException for invalid header values
73
  */
74
  public function setHeadersFromString($headers)
75
  {
93
  /**
94
  * Set response status from a status string.
95
  *
96
+ * @param string $statusLine response status as a string
97
  *
98
  * @return $this
99
  *
100
+ * @throws \InvalidArgumentException for invalid status line
101
  */
102
  public function setStatus($statusLine)
103
  {
119
  /**
120
  * Add header represented by a string.
121
  *
122
+ * @param string $headerLine response header as a string
123
  *
124
  * @return $this
125
  *
126
+ * @throws \InvalidArgumentException for invalid header names or values
127
  */
128
  public function addHeader($headerLine)
129
  {
vendor/php-http/message/src/Cookie.php CHANGED
@@ -63,7 +63,7 @@ final class Cookie
63
  * @param bool $httpOnly
64
  * @param \DateTime|null $expires Expires attribute is HTTP 1.0 only and should be avoided.
65
  *
66
- * @throws \InvalidArgumentException If name, value or max age is not valid.
67
  */
68
  public function __construct(
69
  $name,
@@ -226,8 +226,6 @@ final class Cookie
226
  /**
227
  * Sets the expires.
228
  *
229
- * @param \DateTime|null $expires
230
- *
231
  * @return Cookie
232
  */
233
  public function withExpires(\DateTime $expires = null)
@@ -435,7 +433,7 @@ final class Cookie
435
  *
436
  * @param string $name
437
  *
438
- * @throws \InvalidArgumentException If the name is empty or contains invalid characters.
439
  */
440
  private function validateName($name)
441
  {
@@ -456,7 +454,7 @@ final class Cookie
456
  *
457
  * @param string|null $value
458
  *
459
- * @throws \InvalidArgumentException If the value contains invalid characters.
460
  */
461
  private function validateValue($value)
462
  {
@@ -472,7 +470,7 @@ final class Cookie
472
  *
473
  * @param int|null $maxAge
474
  *
475
- * @throws \InvalidArgumentException If the Max-Age is not an empty or integer value.
476
  */
477
  private function validateMaxAge($maxAge)
478
  {
63
  * @param bool $httpOnly
64
  * @param \DateTime|null $expires Expires attribute is HTTP 1.0 only and should be avoided.
65
  *
66
+ * @throws \InvalidArgumentException if name, value or max age is not valid
67
  */
68
  public function __construct(
69
  $name,
226
  /**
227
  * Sets the expires.
228
  *
 
 
229
  * @return Cookie
230
  */
231
  public function withExpires(\DateTime $expires = null)
433
  *
434
  * @param string $name
435
  *
436
+ * @throws \InvalidArgumentException if the name is empty or contains invalid characters
437
  */
438
  private function validateName($name)
439
  {
454
  *
455
  * @param string|null $value
456
  *
457
+ * @throws \InvalidArgumentException if the value contains invalid characters
458
  */
459
  private function validateValue($value)
460
  {
470
  *
471
  * @param int|null $maxAge
472
  *
473
+ * @throws \InvalidArgumentException if the Max-Age is not an empty or integer value
474
  */
475
  private function validateMaxAge($maxAge)
476
  {
vendor/php-http/message/src/CookieJar.php CHANGED
@@ -10,9 +10,9 @@ namespace Http\Message;
10
  final class CookieJar implements \Countable, \IteratorAggregate
11
  {
12
  /**
13
- * @var \SplObjectStorage
14
  */
15
- protected $cookies;
16
 
17
  public function __construct()
18
  {
@@ -22,8 +22,6 @@ final class CookieJar implements \Countable, \IteratorAggregate
22
  /**
23
  * Checks if there is a cookie.
24
  *
25
- * @param Cookie $cookie
26
- *
27
  * @return bool
28
  */
29
  public function hasCookie(Cookie $cookie)
@@ -33,8 +31,6 @@ final class CookieJar implements \Countable, \IteratorAggregate
33
 
34
  /**
35
  * Adds a cookie.
36
- *
37
- * @param Cookie $cookie
38
  */
39
  public function addCookie(Cookie $cookie)
40
  {
@@ -57,8 +53,6 @@ final class CookieJar implements \Countable, \IteratorAggregate
57
 
58
  /**
59
  * Removes a cookie.
60
- *
61
- * @param Cookie $cookie
62
  */
63
  public function removeCookie(Cookie $cookie)
64
  {
@@ -82,8 +76,6 @@ final class CookieJar implements \Countable, \IteratorAggregate
82
  /**
83
  * Returns all matching cookies.
84
  *
85
- * @param Cookie $cookie
86
- *
87
  * @return Cookie[]
88
  */
89
  public function getMatchingCookies(Cookie $cookie)
@@ -98,11 +90,9 @@ final class CookieJar implements \Countable, \IteratorAggregate
98
  /**
99
  * Finds matching cookies based on a callable.
100
  *
101
- * @param callable $match
102
- *
103
  * @return Cookie[]
104
  */
105
- protected function findMatchingCookies(callable $match)
106
  {
107
  $cookies = [];
108
 
@@ -205,6 +195,7 @@ final class CookieJar implements \Countable, \IteratorAggregate
205
  /**
206
  * {@inheritdoc}
207
  */
 
208
  public function count()
209
  {
210
  return $this->cookies->count();
@@ -213,6 +204,7 @@ final class CookieJar implements \Countable, \IteratorAggregate
213
  /**
214
  * {@inheritdoc}
215
  */
 
216
  public function getIterator()
217
  {
218
  return clone $this->cookies;
10
  final class CookieJar implements \Countable, \IteratorAggregate
11
  {
12
  /**
13
+ * @var \SplObjectStorage<object, mixed>
14
  */
15
+ private $cookies;
16
 
17
  public function __construct()
18
  {
22
  /**
23
  * Checks if there is a cookie.
24
  *
 
 
25
  * @return bool
26
  */
27
  public function hasCookie(Cookie $cookie)
31
 
32
  /**
33
  * Adds a cookie.
 
 
34
  */
35
  public function addCookie(Cookie $cookie)
36
  {
53
 
54
  /**
55
  * Removes a cookie.
 
 
56
  */
57
  public function removeCookie(Cookie $cookie)
58
  {
76
  /**
77
  * Returns all matching cookies.
78
  *
 
 
79
  * @return Cookie[]
80
  */
81
  public function getMatchingCookies(Cookie $cookie)
90
  /**
91
  * Finds matching cookies based on a callable.
92
  *
 
 
93
  * @return Cookie[]
94
  */
95
+ private function findMatchingCookies(callable $match)
96
  {
97
  $cookies = [];
98
 
195
  /**
196
  * {@inheritdoc}
197
  */
198
+ #[\ReturnTypeWillChange]
199
  public function count()
200
  {
201
  return $this->cookies->count();
204
  /**
205
  * {@inheritdoc}
206
  */
207
+ #[\ReturnTypeWillChange]
208
  public function getIterator()
209
  {
210
  return clone $this->cookies;
vendor/php-http/message/src/CookieUtil.php CHANGED
@@ -30,7 +30,7 @@ final class CookieUtil
30
  *
31
  * @return \DateTime
32
  *
33
- * @throws UnexpectedValueException if we cannot parse the cookie date string.
34
  */
35
  public static function parseDate($dateValue)
36
  {
30
  *
31
  * @return \DateTime
32
  *
33
+ * @throws UnexpectedValueException if we cannot parse the cookie date string
34
  */
35
  public static function parseDate($dateValue)
36
  {
vendor/php-http/message/src/Decorator/RequestDecorator.php CHANGED
@@ -17,8 +17,6 @@ trait RequestDecorator
17
  /**
18
  * Exchanges the underlying request with another.
19
  *
20
- * @param RequestInterface $request
21
- *
22
  * @return self
23
  */
24
  public function withRequest(RequestInterface $request)
17
  /**
18
  * Exchanges the underlying request with another.
19
  *
 
 
20
  * @return self
21
  */
22
  public function withRequest(RequestInterface $request)
vendor/php-http/message/src/Decorator/ResponseDecorator.php CHANGED
@@ -16,8 +16,6 @@ trait ResponseDecorator
16
  /**
17
  * Exchanges the underlying response with another.
18
  *
19
- * @param ResponseInterface $response
20
- *
21
  * @return self
22
  */
23
  public function withResponse(ResponseInterface $response)
16
  /**
17
  * Exchanges the underlying response with another.
18
  *
 
 
19
  * @return self
20
  */
21
  public function withResponse(ResponseInterface $response)
vendor/php-http/message/src/Encoding/CompressStream.php CHANGED
@@ -13,8 +13,7 @@ use Psr\Http\Message\StreamInterface;
13
  class CompressStream extends FilteredStream
14
  {
15
  /**
16
- * @param StreamInterface $stream
17
- * @param int $level
18
  */
19
  public function __construct(StreamInterface $stream, $level = -1)
20
  {
13
  class CompressStream extends FilteredStream
14
  {
15
  /**
16
+ * @param int $level
 
17
  */
18
  public function __construct(StreamInterface $stream, $level = -1)
19
  {
vendor/php-http/message/src/Encoding/DecompressStream.php CHANGED
@@ -13,8 +13,7 @@ use Psr\Http\Message\StreamInterface;
13
  class DecompressStream extends FilteredStream
14
  {
15
  /**
16
- * @param StreamInterface $stream
17
- * @param int $level
18
  */
19
  public function __construct(StreamInterface $stream, $level = -1)
20
  {
13
  class DecompressStream extends FilteredStream
14
  {
15
  /**
16
+ * @param int $level
 
17
  */
18
  public function __construct(StreamInterface $stream, $level = -1)
19
  {
vendor/php-http/message/src/Encoding/DeflateStream.php CHANGED
@@ -13,8 +13,7 @@ use Psr\Http\Message\StreamInterface;
13
  class DeflateStream extends FilteredStream
14
  {
15
  /**
16
- * @param StreamInterface $stream
17
- * @param int $level
18
  */
19
  public function __construct(StreamInterface $stream, $level = -1)
20
  {
13
  class DeflateStream extends FilteredStream
14
  {
15
  /**
16
+ * @param int $level
 
17
  */
18
  public function __construct(StreamInterface $stream, $level = -1)
19
  {
vendor/php-http/message/src/Encoding/Filter/Chunk.php CHANGED
@@ -12,6 +12,7 @@ class Chunk extends \php_user_filter
12
  /**
13
  * {@inheritdoc}
14
  */
 
15
  public function filter($in, $out, &$consumed, $closing)
16
  {
17
  while ($bucket = stream_bucket_make_writeable($in)) {
12
  /**
13
  * {@inheritdoc}
14
  */
15
+ #[\ReturnTypeWillChange]
16
  public function filter($in, $out, &$consumed, $closing)
17
  {
18
  while ($bucket = stream_bucket_make_writeable($in)) {
vendor/php-http/message/src/Encoding/FilteredStream.php CHANGED
@@ -13,12 +13,11 @@ use Psr\Http\Message\StreamInterface;
13
  */
14
  abstract class FilteredStream implements StreamInterface
15
  {
16
- const BUFFER_SIZE = 8192;
17
-
18
  use StreamDecorator {
19
  rewind as private doRewind;
20
  seek as private doSeek;
21
  }
 
22
 
23
  /**
24
  * @var callable
@@ -54,9 +53,8 @@ abstract class FilteredStream implements StreamInterface
54
  protected $buffer = '';
55
 
56
  /**
57
- * @param StreamInterface $stream
58
- * @param mixed|null $readFilterOptions
59
- * @param mixed|null $writeFilterOptions deprecated since 1.5, will be removed in 2.0
60
  */
61
  public function __construct(StreamInterface $stream, $readFilterOptions = null, $writeFilterOptions = null)
62
  {
13
  */
14
  abstract class FilteredStream implements StreamInterface
15
  {
 
 
16
  use StreamDecorator {
17
  rewind as private doRewind;
18
  seek as private doSeek;
19
  }
20
+ const BUFFER_SIZE = 8192;
21
 
22
  /**
23
  * @var callable
53
  protected $buffer = '';
54
 
55
  /**
56
+ * @param mixed|null $readFilterOptions
57
+ * @param mixed|null $writeFilterOptions deprecated since 1.5, will be removed in 2.0
 
58
  */
59
  public function __construct(StreamInterface $stream, $readFilterOptions = null, $writeFilterOptions = null)
60
  {
vendor/php-http/message/src/Encoding/GzipDecodeStream.php CHANGED
@@ -13,8 +13,7 @@ use Psr\Http\Message\StreamInterface;
13
  class GzipDecodeStream extends FilteredStream
14
  {
15
  /**
16
- * @param StreamInterface $stream
17
- * @param int $level
18
  */
19
  public function __construct(StreamInterface $stream, $level = -1)
20
  {
13
  class GzipDecodeStream extends FilteredStream
14
  {
15
  /**
16
+ * @param int $level
 
17
  */
18
  public function __construct(StreamInterface $stream, $level = -1)
19
  {
vendor/php-http/message/src/Encoding/GzipEncodeStream.php CHANGED
@@ -13,8 +13,7 @@ use Psr\Http\Message\StreamInterface;
13
  class GzipEncodeStream extends FilteredStream
14
  {
15
  /**
16
- * @param StreamInterface $stream
17
- * @param int $level
18
  */
19
  public function __construct(StreamInterface $stream, $level = -1)
20
  {
13
  class GzipEncodeStream extends FilteredStream
14
  {
15
  /**
16
+ * @param int $level
 
17
  */
18
  public function __construct(StreamInterface $stream, $level = -1)
19
  {
vendor/php-http/message/src/Encoding/InflateStream.php CHANGED
@@ -13,8 +13,7 @@ use Psr\Http\Message\StreamInterface;
13
  class InflateStream extends FilteredStream
14
  {
15
  /**
16
- * @param StreamInterface $stream
17
- * @param int $level
18
  */
19
  public function __construct(StreamInterface $stream, $level = -1)
20
  {
13
  class InflateStream extends FilteredStream
14
  {
15
  /**
16
+ * @param int $level
 
17
  */
18
  public function __construct(StreamInterface $stream, $level = -1)
19
  {
vendor/php-http/message/src/Formatter.php CHANGED
@@ -9,22 +9,25 @@ use Psr\Http\Message\ResponseInterface;
9
  * Formats a request and/or a response as a string.
10
  *
11
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
 
 
 
 
 
12
  */
13
  interface Formatter
14
  {
15
  /**
16
  * Formats a request.
17
  *
18
- * @param RequestInterface $request
19
- *
20
  * @return string
21
  */
22
  public function formatRequest(RequestInterface $request);
23
 
24
  /**
25
- * Formats a response.
26
  *
27
- * @param ResponseInterface $response
28
  *
29
  * @return string
30
  */
9
  * Formats a request and/or a response as a string.
10
  *
11
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ *
13
+ * The formatResponseForRequest method will be added to this interface in the next major version, replacing the formatRequest method.
14
+ * Meanwhile, callers SHOULD check the formatter for the existence of formatResponseForRequest and call that if available.
15
+ *
16
+ * @method string formatResponseForRequest(ResponseInterface $response, RequestInterface $request) Formats a response in context of its request.
17
  */
18
  interface Formatter
19
  {
20
  /**
21
  * Formats a request.
22
  *
 
 
23
  * @return string
24
  */
25
  public function formatRequest(RequestInterface $request);
26
 
27
  /**
28
+ * @deprecated since 1.13, use formatResponseForRequest() instead
29
  *
30
+ * Formats a response.
31
  *
32
  * @return string
33
  */
vendor/php-http/message/src/Formatter/CurlCommandFormatter.php CHANGED
@@ -36,10 +36,14 @@ class CurlCommandFormatter implements Formatter
36
 
37
  $body = $request->getBody();
38
  if ($body->getSize() > 0) {
39
- if ($body->isSeekable()) {
 
 
 
40
  $data = $body->__toString();
41
  $body->rewind();
42
- if (preg_match('/[\x00-\x1F\x7F]/', $data)) {
 
43
  $data = '[binary stream omitted]';
44
  }
45
  } else {
@@ -65,10 +69,18 @@ class CurlCommandFormatter implements Formatter
65
  }
66
 
67
  /**
68
- * @param RequestInterface $request
69
  *
70
  * @return string
71
  */
 
 
 
 
 
 
 
 
72
  private function getHeadersAsCommandOptions(RequestInterface $request)
73
  {
74
  $command = '';
36
 
37
  $body = $request->getBody();
38
  if ($body->getSize() > 0) {
39
+ // escapeshellarg argument max length on Windows, but longer body in curl command would be impractical anyways
40
+ if ($body->getSize() > 8192) {
41
+ $data = '[too long stream omitted]';
42
+ } elseif ($body->isSeekable()) {
43
  $data = $body->__toString();
44
  $body->rewind();
45
+ // all non-printable ASCII characters and <DEL> except for \t, \r, \n
46
+ if (preg_match('/([\x00-\x09\x0C\x0E-\x1F\x7F])/', $data)) {
47
  $data = '[binary stream omitted]';
48
  }
49
  } else {
69
  }
70
 
71
  /**
72
+ * Formats a response in context of its request.
73
  *
74
  * @return string
75
  */
76
+ public function formatResponseForRequest(ResponseInterface $response, RequestInterface $request)
77
+ {
78
+ return $this->formatResponse($response);
79
+ }
80
+
81
+ /**
82
+ * @return string
83
+ */
84
  private function getHeadersAsCommandOptions(RequestInterface $request)
85
  {
86
  $command = '';
vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php CHANGED
@@ -17,16 +17,23 @@ class FullHttpMessageFormatter implements Formatter
17
  /**
18
  * The maximum length of the body.
19
  *
20
- * @var int
21
  */
22
  private $maxBodyLength;
23
 
24
  /**
25
- * @param int $maxBodyLength
26
  */
27
- public function __construct($maxBodyLength = 1000)
 
 
 
 
 
 
28
  {
29
  $this->maxBodyLength = $maxBodyLength;
 
30
  }
31
 
32
  /**
@@ -67,25 +74,43 @@ class FullHttpMessageFormatter implements Formatter
67
  return $this->addBody($response, $message);
68
  }
69
 
 
 
 
 
 
 
 
 
 
 
70
  /**
71
  * Add the message body if the stream is seekable.
72
  *
73
- * @param MessageInterface $request
74
- * @param string $message
75
  *
76
  * @return string
77
  */
78
  private function addBody(MessageInterface $request, $message)
79
  {
 
80
  $stream = $request->getBody();
81
  if (!$stream->isSeekable() || 0 === $this->maxBodyLength) {
82
  // Do not read the stream
83
- $message .= "\n";
84
- } else {
85
- $message .= "\n".mb_substr($stream->__toString(), 0, $this->maxBodyLength);
86
- $stream->rewind();
 
 
 
 
 
 
 
 
87
  }
88
 
89
- return $message;
90
  }
91
  }
17
  /**
18
  * The maximum length of the body.
19
  *
20
+ * @var int|null
21
  */
22
  private $maxBodyLength;
23
 
24
  /**
25
+ * @var string
26
  */
27
+ private $binaryDetectionRegex;
28
+
29
+ /**
30
+ * @param int|null $maxBodyLength
31
+ * @param string $binaryDetectionRegex By default, this is all non-printable ASCII characters and <DEL> except for \t, \r, \n
32
+ */
33
+ public function __construct($maxBodyLength = 1000, string $binaryDetectionRegex = '/([\x00-\x09\x0C\x0E-\x1F\x7F])/')
34
  {
35
  $this->maxBodyLength = $maxBodyLength;
36
+ $this->binaryDetectionRegex = $binaryDetectionRegex;
37
  }
38
 
39
  /**
74
  return $this->addBody($response, $message);
75
  }
76
 
77
+ /**
78
+ * Formats a response in context of its request.
79
+ *
80
+ * @return string
81
+ */
82
+ public function formatResponseForRequest(ResponseInterface $response, RequestInterface $request)
83
+ {
84
+ return $this->formatResponse($response);
85
+ }
86
+
87
  /**
88
  * Add the message body if the stream is seekable.
89
  *
90
+ * @param string $message
 
91
  *
92
  * @return string
93
  */
94
  private function addBody(MessageInterface $request, $message)
95
  {
96
+ $message .= "\n";
97
  $stream = $request->getBody();
98
  if (!$stream->isSeekable() || 0 === $this->maxBodyLength) {
99
  // Do not read the stream
100
+ return $message;
101
+ }
102
+
103
+ $data = $stream->__toString();
104
+ $stream->rewind();
105
+
106
+ if (preg_match($this->binaryDetectionRegex, $data)) {
107
+ return $message.'[binary stream omitted]';
108
+ }
109
+
110
+ if (null === $this->maxBodyLength) {
111
+ return $message.$data;
112
  }
113
 
114
+ return $message.mb_substr($data, 0, $this->maxBodyLength);
115
  }
116
  }
vendor/php-http/message/src/Formatter/SimpleFormatter.php CHANGED
@@ -39,4 +39,14 @@ class SimpleFormatter implements Formatter
39
  $response->getProtocolVersion()
40
  );
41
  }
 
 
 
 
 
 
 
 
 
 
42
  }
39
  $response->getProtocolVersion()
40
  );
41
  }
42
+
43
+ /**
44
+ * Formats a response in context of its request.
45
+ *
46
+ * @return string
47
+ */
48
+ public function formatResponseForRequest(ResponseInterface $response, RequestInterface $request)
49
+ {
50
+ return $this->formatResponse($response);
51
+ }
52
  }
vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php CHANGED
@@ -2,15 +2,19 @@
2
 
3
  namespace Http\Message\MessageFactory;
4
 
5
- use Http\Message\StreamFactory\DiactorosStreamFactory;
6
  use Http\Message\MessageFactory;
7
- use Zend\Diactoros\Request;
8
- use Zend\Diactoros\Response;
 
 
 
9
 
10
  /**
11
  * Creates Diactoros messages.
12
  *
13
  * @author GeLo <geloen.eric@gmail.com>
 
 
14
  */
15
  final class DiactorosMessageFactory implements MessageFactory
16
  {
@@ -34,7 +38,16 @@ final class DiactorosMessageFactory implements MessageFactory
34
  $body = null,
35
  $protocolVersion = '1.1'
36
  ) {
37
- return (new Request(
 
 
 
 
 
 
 
 
 
38
  $uri,
39
  $method,
40
  $this->streamFactory->createStream($body),
@@ -52,7 +65,15 @@ final class DiactorosMessageFactory implements MessageFactory
52
  $body = null,
53
  $protocolVersion = '1.1'
54
  ) {
55
- return (new Response(
 
 
 
 
 
 
 
 
56
  $this->streamFactory->createStream($body),
57
  $statusCode,
58
  $headers
2
 
3
  namespace Http\Message\MessageFactory;
4
 
 
5
  use Http\Message\MessageFactory;
6
+ use Http\Message\StreamFactory\DiactorosStreamFactory;
7
+ use Laminas\Diactoros\Request as LaminasRequest;
8
+ use Laminas\Diactoros\Response as LaminasResponse;
9
+ use Zend\Diactoros\Request as ZendRequest;
10
+ use Zend\Diactoros\Response as ZendResponse;
11
 
12
  /**
13
  * Creates Diactoros messages.
14
  *
15
  * @author GeLo <geloen.eric@gmail.com>
16
+ *
17
+ * @deprecated This will be removed in php-http/message2.0. Consider using the official Diactoros PSR-17 factory
18
  */
19
  final class DiactorosMessageFactory implements MessageFactory
20
  {
38
  $body = null,
39
  $protocolVersion = '1.1'
40
  ) {
41
+ if (class_exists(LaminasRequest::class)) {
42
+ return (new LaminasRequest(
43
+ $uri,
44
+ $method,
45
+ $this->streamFactory->createStream($body),
46
+ $headers
47
+ ))->withProtocolVersion($protocolVersion);
48
+ }
49
+
50
+ return (new ZendRequest(
51
  $uri,
52
  $method,
53
  $this->streamFactory->createStream($body),
65
  $body = null,
66
  $protocolVersion = '1.1'
67
  ) {
68
+ if (class_exists(LaminasResponse::class)) {
69
+ return (new LaminasResponse(
70
+ $this->streamFactory->createStream($body),
71
+ $statusCode,
72
+ $headers
73
+ ))->withProtocolVersion($protocolVersion);
74
+ }
75
+
76
+ return (new ZendResponse(
77
  $this->streamFactory->createStream($body),
78
  $statusCode,
79
  $headers
vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php CHANGED
@@ -10,6 +10,8 @@ use Http\Message\MessageFactory;
10
  * Creates Guzzle messages.
11
  *
12
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
 
 
13
  */
14
  final class GuzzleMessageFactory implements MessageFactory
15
  {
10
  * Creates Guzzle messages.
11
  *
12
  * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
+ *
14
+ * @deprecated This will be removed in php-http/message2.0. Consider using the official Guzzle PSR-17 factory
15
  */
16
  final class GuzzleMessageFactory implements MessageFactory
17
  {
vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php CHANGED
@@ -2,17 +2,19 @@
2
 
3
  namespace Http\Message\MessageFactory;
4
 
 
5
  use Http\Message\StreamFactory\SlimStreamFactory;
6
  use Http\Message\UriFactory\SlimUriFactory;
7
- use Http\Message\MessageFactory;
8
  use Slim\Http\Request;
9
  use Slim\Http\Response;
10
- use Slim\Http\Headers;
11
 
12
  /**
13
  * Creates Slim 3 messages.
14
  *
15
  * @author Mika Tuupola <tuupola@appelsiini.net>
 
 
16
  */
17
  final class SlimMessageFactory implements MessageFactory
18
  {
2
 
3
  namespace Http\Message\MessageFactory;
4
 
5
+ use Http\Message\MessageFactory;
6
  use Http\Message\StreamFactory\SlimStreamFactory;
7
  use Http\Message\UriFactory\SlimUriFactory;
8
+ use Slim\Http\Headers;
9
  use Slim\Http\Request;
10
  use Slim\Http\Response;
 
11
 
12
  /**
13
  * Creates Slim 3 messages.
14
  *
15
  * @author Mika Tuupola <tuupola@appelsiini.net>
16
+ *
17
+ * @deprecated This will be removed in php-http/message2.0. Consider using the official Slim PSR-17 factory
18
  */
19
  final class SlimMessageFactory implements MessageFactory
20
  {
vendor/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php CHANGED
@@ -17,9 +17,6 @@ final class CallbackRequestMatcher implements RequestMatcher
17
  */
18
  private $callback;
19
 
20
- /**
21
- * @param callable $callback
22
- */
23
  public function __construct(callable $callback)
24
  {
25
  $this->callback = $callback;
17
  */
18
  private $callback;
19
 
 
 
 
20
  public function __construct(callable $callback)
21
  {
22
  $this->callback = $callback;
vendor/php-http/message/src/Stream/BufferedStream.php CHANGED
@@ -203,6 +203,9 @@ class BufferedStream implements StreamInterface
203
  if (null === $this->resource) {
204
  throw new \RuntimeException('Cannot read on a detached stream');
205
  }
 
 
 
206
 
207
  $read = '';
208
 
203
  if (null === $this->resource) {
204
  throw new \RuntimeException('Cannot read on a detached stream');
205
  }
206
+ if ($length < 0) {
207
+ throw new \InvalidArgumentException('Can not read a negative amount of bytes');
208
+ }
209
 
210
  $read = '';
211
 
vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php CHANGED
@@ -3,13 +3,16 @@
3
  namespace Http\Message\StreamFactory;
4
 
5
  use Http\Message\StreamFactory;
 
6
  use Psr\Http\Message\StreamInterface;
7
- use Zend\Diactoros\Stream;
8
 
9
  /**
10
  * Creates Diactoros streams.
11
  *
12
  * @author Михаил Красильников <m.krasilnikov@yandex.ru>
 
 
13
  */
14
  final class DiactorosStreamFactory implements StreamFactory
15
  {
@@ -23,10 +26,19 @@ final class DiactorosStreamFactory implements StreamFactory
23
  }
24
 
25
  if (is_resource($body)) {
26
- return new Stream($body);
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
- $stream = new Stream('php://memory', 'rw');
30
  if (null !== $body && '' !== $body) {
31
  $stream->write((string) $body);
32
  }
3
  namespace Http\Message\StreamFactory;
4
 
5
  use Http\Message\StreamFactory;
6
+ use Laminas\Diactoros\Stream as LaminasStream;
7
  use Psr\Http\Message\StreamInterface;
8
+ use Zend\Diactoros\Stream as ZendStream;
9
 
10
  /**
11
  * Creates Diactoros streams.
12
  *
13
  * @author Михаил Красильников <m.krasilnikov@yandex.ru>
14
+ *
15
+ * @deprecated This will be removed in php-http/message2.0. Consider using the official Diactoros PSR-17 factory
16
  */
17
  final class DiactorosStreamFactory implements StreamFactory
18
  {
26
  }
27
 
28
  if (is_resource($body)) {
29
+ if (class_exists(LaminasStream::class)) {
30
+ return new LaminasStream($body);
31
+ }
32
+
33
+ return new ZendStream($body);
34
+ }
35
+
36
+ if (class_exists(LaminasStream::class)) {
37
+ $stream = new LaminasStream('php://memory', 'rw');
38
+ } else {
39
+ $stream = new ZendStream('php://memory', 'rw');
40
  }
41
 
 
42
  if (null !== $body && '' !== $body) {
43
  $stream->write((string) $body);
44
  }
vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php CHANGED
@@ -2,12 +2,15 @@
2
 
3
  namespace Http\Message\StreamFactory;
4
 
 
5
  use Http\Message\StreamFactory;
6
 
7
  /**
8
  * Creates Guzzle streams.
9
  *
10
  * @author Михаил Красильников <m.krasilnikov@yandex.ru>
 
 
11
  */
12
  final class GuzzleStreamFactory implements StreamFactory
13
  {
@@ -16,6 +19,10 @@ final class GuzzleStreamFactory implements StreamFactory
16
  */
17
  public function createStream($body = null)
18
  {
 
 
 
 
19
  return \GuzzleHttp\Psr7\stream_for($body);
20
  }
21
  }
2
 
3
  namespace Http\Message\StreamFactory;
4
 
5
+ use GuzzleHttp\Psr7\Utils;
6
  use Http\Message\StreamFactory;
7
 
8
  /**
9
  * Creates Guzzle streams.
10
  *
11
  * @author Михаил Красильников <m.krasilnikov@yandex.ru>
12
+ *
13
+ * @deprecated This will be removed in php-http/message2.0. Consider using the official Guzzle PSR-17 factory
14
  */
15
  final class GuzzleStreamFactory implements StreamFactory
16
  {
19
  */
20
  public function createStream($body = null)
21
  {
22
+ if (class_exists(Utils::class)) {
23
+ return Utils::streamFor($body);
24
+ }
25
+
26
  return \GuzzleHttp\Psr7\stream_for($body);
27
  }
28
  }
vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php CHANGED
@@ -10,6 +10,8 @@ use Slim\Http\Stream;
10
  * Creates Slim 3 streams.
11
  *
12
  * @author Mika Tuupola <tuupola@appelsiini.net>
 
 
13
  */
14
  final class SlimStreamFactory implements StreamFactory
15
  {
10
  * Creates Slim 3 streams.
11
  *
12
  * @author Mika Tuupola <tuupola@appelsiini.net>
13
+ *
14
+ * @deprecated This will be removed in php-http/message2.0. Consider using the official Slim PSR-17 factory
15
  */
16
  final class SlimStreamFactory implements StreamFactory
17
  {
vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php CHANGED
@@ -3,13 +3,16 @@
3
  namespace Http\Message\UriFactory;
4
 
5
  use Http\Message\UriFactory;
 
6
  use Psr\Http\Message\UriInterface;
7
- use Zend\Diactoros\Uri;
8
 
9
  /**
10
  * Creates Diactoros URI.
11
  *
12
  * @author David de Boer <david@ddeboer.nl>
 
 
13
  */
14
  final class DiactorosUriFactory implements UriFactory
15
  {
@@ -21,7 +24,11 @@ final class DiactorosUriFactory implements UriFactory
21
  if ($uri instanceof UriInterface) {
22
  return $uri;
23
  } elseif (is_string($uri)) {
24
- return new Uri($uri);
 
 
 
 
25
  }
26
 
27
  throw new \InvalidArgumentException('URI must be a string or UriInterface');
3
  namespace Http\Message\UriFactory;
4
 
5
  use Http\Message\UriFactory;
6
+ use Laminas\Diactoros\Uri as LaminasUri;
7
  use Psr\Http\Message\UriInterface;
8
+ use Zend\Diactoros\Uri as ZendUri;
9
 
10
  /**
11
  * Creates Diactoros URI.
12
  *
13
  * @author David de Boer <david@ddeboer.nl>
14
+ *
15
+ * @deprecated This will be removed in php-http/message2.0. Consider using the official Diactoros PSR-17 factory
16
  */
17
  final class DiactorosUriFactory implements UriFactory
18
  {
24
  if ($uri instanceof UriInterface) {
25
  return $uri;
26
  } elseif (is_string($uri)) {
27
+ if (class_exists(LaminasUri::class)) {
28
+ return new LaminasUri($uri);
29
+ }
30
+
31
+ return new ZendUri($uri);
32
  }
33
 
34
  throw new \InvalidArgumentException('URI must be a string or UriInterface');
vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php CHANGED
@@ -2,13 +2,16 @@
2
 
3
  namespace Http\Message\UriFactory;
4
 
5
- use GuzzleHttp\Psr7;
 
6
  use Http\Message\UriFactory;
7
 
8
  /**
9
  * Creates Guzzle URI.
10
  *
11
  * @author David de Boer <david@ddeboer.nl>
 
 
12
  */
13
  final class GuzzleUriFactory implements UriFactory
14
  {
@@ -17,6 +20,10 @@ final class GuzzleUriFactory implements UriFactory
17
  */
18
  public function createUri($uri)
19
  {
20
- return Psr7\uri_for($uri);
 
 
 
 
21
  }
22
  }
2
 
3
  namespace Http\Message\UriFactory;
4
 
5
+ use function GuzzleHttp\Psr7\uri_for;
6
+ use GuzzleHttp\Psr7\Utils;
7
  use Http\Message\UriFactory;
8
 
9
  /**
10
  * Creates Guzzle URI.
11
  *
12
  * @author David de Boer <david@ddeboer.nl>
13
+ *
14
+ * @deprecated This will be removed in php-http/message2.0. Consider using the official Guzzle PSR-17 factory
15
  */
16
  final class GuzzleUriFactory implements UriFactory
17
  {
20
  */
21
  public function createUri($uri)
22
  {
23
+ if (class_exists(Utils::class)) {
24
+ return Utils::uriFor($uri);
25
+ }
26
+
27
+ return uri_for($uri);
28
  }
29
  }
vendor/php-http/message/src/UriFactory/SlimUriFactory.php CHANGED
@@ -10,6 +10,8 @@ use Slim\Http\Uri;
10
  * Creates Slim 3 URI.
11
  *
12
  * @author Mika Tuupola <tuupola@appelsiini.net>
 
 
13
  */
14
  final class SlimUriFactory implements UriFactory
15
  {
10
  * Creates Slim 3 URI.
11
  *
12
  * @author Mika Tuupola <tuupola@appelsiini.net>
13
+ *
14
+ * @deprecated This will be removed in php-http/message2.0. Consider using the official Slim PSR-17 factory
15
  */
16
  final class SlimUriFactory implements UriFactory
17
  {
vendor/php-http/promise/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
  # Change Log
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  ## 1.0.0 - 2016-01-26
5
 
1
  # Change Log
2
 
3
+ ## 1.1.0 - 2020-07-07
4
+
5
+ ### Added
6
+
7
+ - Test with PHP 7.1, 7.2, 7.3, 7.4 and 8.0
8
+
9
+ ### Removed
10
+
11
+ - PHP 5 and 7.0 support
12
+
13
+ ### Fixed
14
+
15
+ - Fixed PHPDoc for `Promise::then`
16
 
17
  ## 1.0.0 - 2016-01-26
18
 
vendor/php-http/promise/README.md CHANGED
@@ -23,7 +23,7 @@ $ composer require php-http/promise
23
 
24
  ## Documentation
25
 
26
- Please see the [official documentation](http://docs.php-http.org).
27
 
28
 
29
  ## Testing
@@ -40,8 +40,7 @@ Please see our [contributing guide](http://docs.php-http.org/en/latest/developme
40
 
41
  ## Security
42
 
43
- If you discover any security related issues, please contact us at [security@httplug.io](mailto:security@httplug.io)
44
- or [security@php-http.org](mailto:security@php-http.org).
45
 
46
 
47
  ## License
23
 
24
  ## Documentation
25
 
26
+ Please see the [official documentation](http://docs.php-http.org/en/latest/components/promise.html).
27
 
28
 
29
  ## Testing
40
 
41
  ## Security
42
 
43
+ If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
 
44
 
45
 
46
  ## License
vendor/php-http/promise/src/Promise.php CHANGED
@@ -36,10 +36,10 @@ interface Promise
36
  * If you do not care about one of the cases, you can set the corresponding callable to null
37
  * The callback will be called when the value arrived and never more than once.
38
  *
39
- * @param callable $onFulfilled Called when a response will be available.
40
- * @param callable $onRejected Called when an exception occurs.
41
  *
42
- * @return Promise A new resolved promise with value of the executed callback (onFulfilled / onRejected).
43
  */
44
  public function then(callable $onFulfilled = null, callable $onRejected = null);
45
 
@@ -63,7 +63,7 @@ interface Promise
63
  *
64
  * @return mixed Resolved value, null if $unwrap is set to false
65
  *
66
- * @throws \Exception The rejection reason if $unwrap is set to true and the request failed.
67
  */
68
  public function wait($unwrap = true);
69
  }
36
  * If you do not care about one of the cases, you can set the corresponding callable to null
37
  * The callback will be called when the value arrived and never more than once.
38
  *
39
+ * @param callable|null $onFulfilled called when a response will be available
40
+ * @param callable|null $onRejected called when an exception occurs
41
  *
42
+ * @return Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected)
43
  */
44
  public function then(callable $onFulfilled = null, callable $onRejected = null);
45
 
63
  *
64
  * @return mixed Resolved value, null if $unwrap is set to false
65
  *
66
+ * @throws \Exception the rejection reason if $unwrap is set to true and the request failed
67
  */
68
  public function wait($unwrap = true);
69
  }
vendor/psr/http-client/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/{guzzlehttp/psr7 → psr/http-client}/LICENSE RENAMED
@@ -1,20 +1,13 @@
1
- The MIT License (MIT)
2
 
3
- Copyright (c) 2015 Michael Dowling <mtdowling@gmail.com>
4
- Copyright (c) 2015 Márk Sági-Kazár <mark.sagikazar@gmail.com>
5
- Copyright (c) 2015 Graham Campbell <hello@gjcampbell.co.uk>
6
- Copyright (c) 2016 Tobias Schultze <webmaster@tubo-world.de>
7
- Copyright (c) 2016 George Mponos <gmponos@gmail.com>
8
- Copyright (c) 2018 Tobias Nyholm <tobias.nyholm@gmail.com>
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
  of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
  furnished to do so, subject to the following conditions:
16
 
17
- The above copyright notice and this permission notice shall be included in
18
  all copies or substantial portions of the Software.
19
 
20
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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
vendor/psr/http-client/README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
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/src/ClientExceptionInterface.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-factory/.pullapprove.yml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ extends: default
2
+ reviewers:
3
+ -
4
+ name: contributors
5
+ required: 1
6
+ teams:
7
+ - http-factory-contributors
vendor/psr/http-factory/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2018 PHP-FIG
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/psr/http-factory/README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ HTTP Factories
2
+ ==============
3
+
4
+ This repository holds all interfaces related to [PSR-17 (HTTP Message Factories)][psr-17].
5
+ Please refer to the specification for a description.
6
+
7
+ You can find implementations of the specification by looking for packages providing the
8
+ [psr/http-factory-implementation](https://packagist.org/providers/psr/http-factory-implementation) virtual package.
9
+
10
+ [psr-17]: https://www.php-fig.org/psr/psr-17/
vendor/psr/http-factory/src/RequestFactoryInterface.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ interface RequestFactoryInterface
6
+ {
7
+ /**
8
+ * Create a new request.
9
+ *
10
+ * @param string $method The HTTP method associated with the request.
11
+ * @param UriInterface|string $uri The URI associated with the request. If
12
+ * the value is a string, the factory MUST create a UriInterface
13
+ * instance based on it.
14
+ *
15
+ * @return RequestInterface
16
+ */
17
+ public function createRequest(string $method, $uri): RequestInterface;
18
+ }
vendor/psr/http-factory/src/ResponseFactoryInterface.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ interface ResponseFactoryInterface
6
+ {
7
+ /**
8
+ * Create a new response.
9
+ *
10
+ * @param int $code HTTP status code; defaults to 200
11
+ * @param string $reasonPhrase Reason phrase to associate with status code
12
+ * in generated response; if none is provided implementations MAY use
13
+ * the defaults as suggested in the HTTP specification.
14
+ *
15
+ * @return ResponseInterface
16
+ */
17
+ public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface;
18
+ }
vendor/psr/http-factory/src/ServerRequestFactoryInterface.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ interface ServerRequestFactoryInterface
6
+ {
7
+ /**
8
+ * Create a new server request.
9
+ *
10
+ * Note that server-params are taken precisely as given - no parsing/processing
11
+ * of the given values is performed, and, in particular, no attempt is made to
12
+ * determine the HTTP method or URI, which must be provided explicitly.
13
+ *
14
+ * @param string $method The HTTP method associated with the request.
15
+ * @param UriInterface|string $uri The URI associated with the request. If
16
+ * the value is a string, the factory MUST create a UriInterface
17
+ * instance based on it.
18
+ * @param array $serverParams Array of SAPI parameters with which to seed
19
+ * the generated request instance.
20
+ *
21
+ * @return ServerRequestInterface
22
+ */
23
+ public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface;
24
+ }
vendor/psr/http-factory/src/StreamFactoryInterface.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ interface StreamFactoryInterface
6
+ {
7
+ /**
8
+ * Create a new stream from a string.
9
+ *
10
+ * The stream SHOULD be created with a temporary resource.
11
+ *
12
+ * @param string $content String content with which to populate the stream.
13
+ *
14
+ * @return StreamInterface
15
+ */
16
+ public function createStream(string $content = ''): StreamInterface;
17
+
18
+ /**
19
+ * Create a stream from an existing file.
20
+ *
21
+ * The file MUST be opened using the given mode, which may be any mode
22
+ * supported by the `fopen` function.
23
+ *
24
+ * The `$filename` MAY be any string supported by `fopen()`.
25
+ *
26
+ * @param string $filename Filename or stream URI to use as basis of stream.
27
+ * @param string $mode Mode with which to open the underlying filename/stream.
28
+ *
29
+ * @return StreamInterface
30
+ * @throws \RuntimeException If the file cannot be opened.
31
+ * @throws \InvalidArgumentException If the mode is invalid.
32
+ */
33
+ public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface;
34
+
35
+ /**
36
+ * Create a new stream from an existing resource.
37
+ *
38
+ * The stream MUST be readable and may be writable.
39
+ *
40
+ * @param resource $resource PHP resource to use as basis of stream.
41
+ *
42
+ * @return StreamInterface
43
+ */
44
+ public function createStreamFromResource($resource): StreamInterface;
45
+ }
vendor/psr/http-factory/src/UploadedFileFactoryInterface.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ interface UploadedFileFactoryInterface
6
+ {
7
+ /**
8
+ * Create a new uploaded file.
9
+ *
10
+ * If a size is not provided it will be determined by checking the size of
11
+ * the file.
12
+ *
13
+ * @see http://php.net/manual/features.file-upload.post-method.php
14
+ * @see http://php.net/manual/features.file-upload.errors.php
15
+ *
16
+ * @param StreamInterface $stream Underlying stream representing the
17
+ * uploaded file content.
18
+ * @param int $size in bytes
19
+ * @param int $error PHP file upload error
20
+ * @param string $clientFilename Filename as provided by the client, if any.
21
+ * @param string $clientMediaType Media type as provided by the client, if any.
22
+ *
23
+ * @return UploadedFileInterface
24
+ *
25
+ * @throws \InvalidArgumentException If the file resource is not readable.
26
+ */
27
+ public function createUploadedFile(
28
+ StreamInterface $stream,
29
+ int $size = null,
30
+ int $error = \UPLOAD_ERR_OK,
31
+ string $clientFilename = null,
32
+ string $clientMediaType = null
33
+ ): UploadedFileInterface;
34
+ }
vendor/psr/http-factory/src/UriFactoryInterface.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ interface UriFactoryInterface
6
+ {
7
+ /**
8
+ * Create a new URI.
9
+ *
10
+ * @param string $uri
11
+ *
12
+ * @return UriInterface
13
+ *
14
+ * @throws \InvalidArgumentException If the given URI cannot be parsed.
15
+ */
16
+ public function createUri(string $uri = ''): UriInterface;
17
+ }
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/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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/deprecation-contracts/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ CHANGELOG
2
+ =========
3
+
4
+ The changelog is maintained for all Symfony contracts at the following URL:
5
+ https://github.com/symfony/contracts/blob/main/CHANGELOG.md
vendor/{php-http/curl-client → symfony/deprecation-contracts}/LICENSE RENAMED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 PHP HTTP Team <team@php-http.org>
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
1
+ Copyright (c) 2020-2022 Fabien Potencier
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
vendor/symfony/deprecation-contracts/README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Symfony Deprecation Contracts
2
+ =============================
3
+
4
+ A generic function and convention to trigger deprecation notices.
5
+
6
+ This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices.
7
+
8
+ By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component,
9
+ the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments.
10
+
11
+ The function requires at least 3 arguments:
12
+ - the name of the Composer package that is triggering the deprecation
13
+ - the version of the package that introduced the deprecation
14
+ - the message of the deprecation
15
+ - more arguments can be provided: they will be inserted in the message using `printf()` formatting
16
+
17
+ Example:
18
+ ```php
19
+ trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin');
20
+ ```
21
+
22
+ This will generate the following message:
23
+ `Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.`
24
+
25
+ While not necessarily recommended, the deprecation notices can be completely ignored by declaring an empty
26
+ `function trigger_deprecation() {}` in your application.
vendor/symfony/deprecation-contracts/function.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ if (!function_exists('trigger_deprecation')) {
13
+ /**
14
+ * Triggers a silenced deprecation notice.
15
+ *
16
+ * @param string $package The name of the Composer package that is triggering the deprecation
17
+ * @param string $version The version of the package that introduced the deprecation
18
+ * @param string $message The message of the deprecation
19
+ * @param mixed ...$args Values to insert in the message using printf() formatting
20
+ *
21
+ * @author Nicolas Grekas <p@tchwork.com>
22
+ */
23
+ function trigger_deprecation(string $package, string $version, string $message, mixed ...$args): void
24
+ {
25
+ @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED);
26
+ }
27
+ }
vendor/symfony/options-resolver/CHANGELOG.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CHANGELOG
2
+ =========
3
+
4
+ 6.0
5
+ ---
6
+
7
+ * Remove `OptionsResolverIntrospector::getDeprecationMessage()`
8
+
9
+ 5.3
10
+ ---
11
+
12
+ * Add prototype definition for nested options
13
+
14
+ 5.1.0
15
+ -----
16
+
17
+ * added fluent configuration of options using `OptionResolver::define()`
18
+ * added `setInfo()` and `getInfo()` methods
19
+ * updated the signature of method `OptionsResolver::setDeprecated()` to `OptionsResolver::setDeprecation(string $option, string $package, string $version, $message)`
20
+ * deprecated `OptionsResolverIntrospector::getDeprecationMessage()`, use `OptionsResolverIntrospector::getDeprecation()` instead
21
+
22
+ 5.0.0
23
+ -----
24
+
25
+ * added argument `$triggerDeprecation` to `OptionsResolver::offsetGet()`
26
+
27
+ 4.3.0
28
+ -----
29
+
30
+ * added `OptionsResolver::addNormalizer` method
31
+
32
+ 4.2.0
33
+ -----
34
+
35
+ * added support for nested options definition
36
+ * added `setDeprecated` and `isDeprecated` methods
37
+
38
+ 3.4.0
39
+ -----
40
+
41
+ * added `OptionsResolverIntrospector` to inspect options definitions inside an `OptionsResolver` instance
42
+ * added array of types support in allowed types (e.g int[])
43
+
44
+ 2.6.0
45
+ -----
46
+
47
+ * deprecated OptionsResolverInterface
48
+ * [BC BREAK] removed "array" type hint from OptionsResolverInterface methods
49
+ setRequired(), setAllowedValues(), addAllowedValues(), setAllowedTypes() and
50
+ addAllowedTypes()
51
+ * added OptionsResolver::setDefault()
52
+ * added OptionsResolver::hasDefault()
53
+ * added OptionsResolver::setNormalizer()
54
+ * added OptionsResolver::isRequired()
55
+ * added OptionsResolver::getRequiredOptions()
56
+ * added OptionsResolver::isMissing()
57
+ * added OptionsResolver::getMissingOptions()
58
+ * added OptionsResolver::setDefined()
59
+ * added OptionsResolver::isDefined()
60
+ * added OptionsResolver::getDefinedOptions()
61
+ * added OptionsResolver::remove()
62
+ * added OptionsResolver::clear()
63
+ * deprecated OptionsResolver::replaceDefaults()
64
+ * deprecated OptionsResolver::setOptional() in favor of setDefined()
65
+ * deprecated OptionsResolver::isKnown() in favor of isDefined()
66
+ * [BC BREAK] OptionsResolver::isRequired() returns true now if a required
67
+ option has a default value set
68
+ * [BC BREAK] merged Options into OptionsResolver and turned Options into an
69
+ interface
70
+ * deprecated Options::overload() (now in OptionsResolver)
71
+ * deprecated Options::set() (now in OptionsResolver)
72
+ * deprecated Options::get() (now in OptionsResolver)
73
+ * deprecated Options::has() (now in OptionsResolver)
74
+ * deprecated Options::replace() (now in OptionsResolver)
75
+ * [BC BREAK] Options::get() (now in OptionsResolver) can only be used within
76
+ lazy option/normalizer closures now
77
+ * [BC BREAK] removed Traversable interface from Options since using within
78
+ lazy option/normalizer closures resulted in exceptions
79
+ * [BC BREAK] removed Options::all() since using within lazy option/normalizer
80
+ closures resulted in exceptions
81
+ * [BC BREAK] OptionDefinitionException now extends LogicException instead of
82
+ RuntimeException
83
+ * [BC BREAK] normalizers are not executed anymore for unset options
84
+ * normalizers are executed after validating the options now
85
+ * [BC BREAK] an UndefinedOptionsException is now thrown instead of an
86
+ InvalidOptionsException when non-existing options are passed
vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Debug;
13
+
14
+ use Symfony\Component\OptionsResolver\Exception\NoConfigurationException;
15
+ use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException;
16
+ use Symfony\Component\OptionsResolver\OptionsResolver;
17
+
18
+ /**
19
+ * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
20
+ *
21
+ * @final
22
+ */
23
+ class OptionsResolverIntrospector
24
+ {
25
+ private $get;
26
+
27
+ public function __construct(OptionsResolver $optionsResolver)
28
+ {
29
+ $this->get = \Closure::bind(function ($property, $option, $message) {
30
+ /** @var OptionsResolver $this */
31
+ if (!$this->isDefined($option)) {
32
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist.', $option));
33
+ }
34
+
35
+ if (!\array_key_exists($option, $this->{$property})) {
36
+ throw new NoConfigurationException($message);
37
+ }
38
+
39
+ return $this->{$property}[$option];
40
+ }, $optionsResolver, $optionsResolver);
41
+ }
42
+
43
+ /**
44
+ * @throws NoConfigurationException on no configured value
45
+ */
46
+ public function getDefault(string $option): mixed
47
+ {
48
+ return ($this->get)('defaults', $option, sprintf('No default value was set for the "%s" option.', $option));
49
+ }
50
+
51
+ /**
52
+ * @return \Closure[]
53
+ *
54
+ * @throws NoConfigurationException on no configured closures
55
+ */
56
+ public function getLazyClosures(string $option): array
57
+ {
58
+ return ($this->get)('lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option));
59
+ }
60
+
61
+ /**
62
+ * @return string[]
63
+ *
64
+ * @throws NoConfigurationException on no configured types
65
+ */
66
+ public function getAllowedTypes(string $option): array
67
+ {
68
+ return ($this->get)('allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option));
69
+ }
70
+
71
+ /**
72
+ * @return mixed[]
73
+ *
74
+ * @throws NoConfigurationException on no configured values
75
+ */
76
+ public function getAllowedValues(string $option): array
77
+ {
78
+ return ($this->get)('allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option));
79
+ }
80
+
81
+ /**
82
+ * @throws NoConfigurationException on no configured normalizer
83
+ */
84
+ public function getNormalizer(string $option): \Closure
85
+ {
86
+ return current($this->getNormalizers($option));
87
+ }
88
+
89
+ /**
90
+ * @throws NoConfigurationException when no normalizer is configured
91
+ */
92
+ public function getNormalizers(string $option): array
93
+ {
94
+ return ($this->get)('normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option));
95
+ }
96
+
97
+ /**
98
+ * @throws NoConfigurationException on no configured deprecation
99
+ */
100
+ public function getDeprecation(string $option): array
101
+ {
102
+ return ($this->get)('deprecated', $option, sprintf('No deprecation was set for the "%s" option.', $option));
103
+ }
104
+ }
vendor/symfony/options-resolver/Exception/AccessException.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Exception;
13
+
14
+ /**
15
+ * Thrown when trying to read an option outside of or write it inside of
16
+ * {@link \Symfony\Component\OptionsResolver\Options::resolve()}.
17
+ *
18
+ * @author Bernhard Schussek <bschussek@gmail.com>
19
+ */
20
+ class AccessException extends \LogicException implements ExceptionInterface
21
+ {
22
+ }
vendor/symfony/options-resolver/Exception/ExceptionInterface.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Exception;
13
+
14
+ /**
15
+ * Marker interface for all exceptions thrown by the OptionsResolver component.
16
+ *
17
+ * @author Bernhard Schussek <bschussek@gmail.com>
18
+ */
19
+ interface ExceptionInterface extends \Throwable
20
+ {
21
+ }
vendor/symfony/options-resolver/Exception/InvalidArgumentException.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Exception;
13
+
14
+ /**
15
+ * Thrown when an argument is invalid.
16
+ *
17
+ * @author Bernhard Schussek <bschussek@gmail.com>
18
+ */
19
+ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
20
+ {
21
+ }
vendor/symfony/options-resolver/Exception/InvalidOptionsException.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Exception;
13
+
14
+ /**
15
+ * Thrown when the value of an option does not match its validation rules.
16
+ *
17
+ * You should make sure a valid value is passed to the option.
18
+ *
19
+ * @author Bernhard Schussek <bschussek@gmail.com>
20
+ */
21
+ class InvalidOptionsException extends InvalidArgumentException
22
+ {
23
+ }
vendor/symfony/options-resolver/Exception/MissingOptionsException.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Exception;
13
+
14
+ /**
15
+ * Exception thrown when a required option is missing.
16
+ *
17
+ * Add the option to the passed options array.
18
+ *
19
+ * @author Bernhard Schussek <bschussek@gmail.com>
20
+ */
21
+ class MissingOptionsException extends InvalidArgumentException
22
+ {
23
+ }
vendor/symfony/options-resolver/Exception/NoConfigurationException.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Exception;
13
+
14
+ use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector;
15
+
16
+ /**
17
+ * Thrown when trying to introspect an option definition property
18
+ * for which no value was configured inside the OptionsResolver instance.
19
+ *
20
+ * @see OptionsResolverIntrospector
21
+ *
22
+ * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
23
+ */
24
+ class NoConfigurationException extends \RuntimeException implements ExceptionInterface
25
+ {
26
+ }
vendor/symfony/options-resolver/Exception/NoSuchOptionException.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Exception;
13
+
14
+ /**
15
+ * Thrown when trying to read an option that has no value set.
16
+ *
17
+ * When accessing optional options from within a lazy option or normalizer you should first
18
+ * check whether the optional option is set. You can do this with `isset($options['optional'])`.
19
+ * In contrast to the {@link UndefinedOptionsException}, this is a runtime exception that can
20
+ * occur when evaluating lazy options.
21
+ *
22
+ * @author Tobias Schultze <http://tobion.de>
23
+ */
24
+ class NoSuchOptionException extends \OutOfBoundsException implements ExceptionInterface
25
+ {
26
+ }
vendor/symfony/options-resolver/Exception/OptionDefinitionException.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Exception;
13
+
14
+ /**
15
+ * Thrown when two lazy options have a cyclic dependency.
16
+ *
17
+ * @author Bernhard Schussek <bschussek@gmail.com>
18
+ */
19
+ class OptionDefinitionException extends \LogicException implements ExceptionInterface
20
+ {
21
+ }
vendor/symfony/options-resolver/Exception/UndefinedOptionsException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver\Exception;
13
+
14
+ /**
15
+ * Exception thrown when an undefined option is passed.
16
+ *
17
+ * You should remove the options in question from your code or define them
18
+ * beforehand.
19
+ *
20
+ * @author Bernhard Schussek <bschussek@gmail.com>
21
+ */
22
+ class UndefinedOptionsException extends InvalidArgumentException
23
+ {
24
+ }
vendor/symfony/options-resolver/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2004-2022 Fabien Potencier
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 furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ 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/symfony/options-resolver/OptionConfigurator.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver;
13
+
14
+ use Symfony\Component\OptionsResolver\Exception\AccessException;
15
+
16
+ final class OptionConfigurator
17
+ {
18
+ private $name;
19
+ private $resolver;
20
+
21
+ public function __construct(string $name, OptionsResolver $resolver)
22
+ {
23
+ $this->name = $name;
24
+ $this->resolver = $resolver;
25
+ $this->resolver->setDefined($name);
26
+ }
27
+
28
+ /**
29
+ * Adds allowed types for this option.
30
+ *
31
+ * @return $this
32
+ *
33
+ * @throws AccessException If called from a lazy option or normalizer
34
+ */
35
+ public function allowedTypes(string ...$types): static
36
+ {
37
+ $this->resolver->setAllowedTypes($this->name, $types);
38
+
39
+ return $this;
40
+ }
41
+
42
+ /**
43
+ * Sets allowed values for this option.
44
+ *
45
+ * @param mixed ...$values One or more acceptable values/closures
46
+ *
47
+ * @return $this
48
+ *
49
+ * @throws AccessException If called from a lazy option or normalizer
50
+ */
51
+ public function allowedValues(mixed ...$values): static
52
+ {
53
+ $this->resolver->setAllowedValues($this->name, $values);
54
+
55
+ return $this;
56
+ }
57
+
58
+ /**
59
+ * Sets the default value for this option.
60
+ *
61
+ * @return $this
62
+ *
63
+ * @throws AccessException If called from a lazy option or normalizer
64
+ */
65
+ public function default(mixed $value): static
66
+ {
67
+ $this->resolver->setDefault($this->name, $value);
68
+
69
+ return $this;
70
+ }
71
+
72
+ /**
73
+ * Defines an option configurator with the given name.
74
+ */
75
+ public function define(string $option): self
76
+ {
77
+ return $this->resolver->define($option);
78
+ }
79
+
80
+ /**
81
+ * Marks this option as deprecated.
82
+ *
83
+ * @param string $package The name of the composer package that is triggering the deprecation
84
+ * @param string $version The version of the package that introduced the deprecation
85
+ * @param string|\Closure $message The deprecation message to use
86
+ *
87
+ * @return $this
88
+ */
89
+ public function deprecated(string $package, string $version, string|\Closure $message = 'The option "%name%" is deprecated.'): static
90
+ {
91
+ $this->resolver->setDeprecated($this->name, $package, $version, $message);
92
+
93
+ return $this;
94
+ }
95
+
96
+ /**
97
+ * Sets the normalizer for this option.
98
+ *
99
+ * @return $this
100
+ *
101
+ * @throws AccessException If called from a lazy option or normalizer
102
+ */
103
+ public function normalize(\Closure $normalizer): static
104
+ {
105
+ $this->resolver->setNormalizer($this->name, $normalizer);
106
+
107
+ return $this;
108
+ }
109
+
110
+ /**
111
+ * Marks this option as required.
112
+ *
113
+ * @return $this
114
+ *
115
+ * @throws AccessException If called from a lazy option or normalizer
116
+ */
117
+ public function required(): static
118
+ {
119
+ $this->resolver->setRequired($this->name);
120
+
121
+ return $this;
122
+ }
123
+
124
+ /**
125
+ * Sets an info message for an option.
126
+ *
127
+ * @return $this
128
+ *
129
+ * @throws AccessException If called from a lazy option or normalizer
130
+ */
131
+ public function info(string $info): static
132
+ {
133
+ $this->resolver->setInfo($this->name, $info);
134
+
135
+ return $this;
136
+ }
137
+ }
vendor/symfony/options-resolver/Options.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver;
13
+
14
+ /**
15
+ * Contains resolved option values.
16
+ *
17
+ * @author Bernhard Schussek <bschussek@gmail.com>
18
+ * @author Tobias Schultze <http://tobion.de>
19
+ */
20
+ interface Options extends \ArrayAccess, \Countable
21
+ {
22
+ }
vendor/symfony/options-resolver/OptionsResolver.php ADDED
@@ -0,0 +1,1300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Component\OptionsResolver;
13
+
14
+ use Symfony\Component\OptionsResolver\Exception\AccessException;
15
+ use Symfony\Component\OptionsResolver\Exception\InvalidArgumentException;
16
+ use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
17
+ use Symfony\Component\OptionsResolver\Exception\MissingOptionsException;
18
+ use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException;
19
+ use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException;
20
+ use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException;
21
+
22
+ /**
23
+ * Validates options and merges them with default values.
24
+ *
25
+ * @author Bernhard Schussek <bschussek@gmail.com>
26
+ * @author Tobias Schultze <http://tobion.de>
27
+ */
28
+ class OptionsResolver implements Options
29
+ {
30
+ private const VALIDATION_FUNCTIONS = [
31
+ 'bool' => 'is_bool',
32
+ 'boolean' => 'is_bool',
33
+ 'int' => 'is_int',
34
+ 'integer' => 'is_int',
35
+ 'long' => 'is_int',
36
+ 'float' => 'is_float',
37
+ 'double' => 'is_float',
38
+ 'real' => 'is_float',
39
+ 'numeric' => 'is_numeric',
40
+ 'string' => 'is_string',
41
+ 'scalar' => 'is_scalar',
42
+ 'array' => 'is_array',
43
+ 'iterable' => 'is_iterable',
44
+ 'countable' => 'is_countable',
45
+ 'callable' => 'is_callable',
46
+ 'object' => 'is_object',
47
+ 'resource' => 'is_resource',
48
+ ];
49
+
50
+ /**
51
+ * The names of all defined options.
52
+ */
53
+ private $defined = [];
54
+
55
+ /**
56
+ * The default option values.
57
+ */
58
+ private $defaults = [];
59
+
60
+ /**
61
+ * A list of closure for nested options.
62
+ *
63
+ * @var \Closure[][]
64
+ */
65
+ private $nested = [];
66
+
67
+ /**
68
+ * The names of required options.
69
+ */
70
+ private $required = [];
71
+
72
+ /**
73
+ * The resolved option values.
74
+ */
75
+ private $resolved = [];
76
+
77
+ /**
78
+ * A list of normalizer closures.
79
+ *
80
+ * @var \Closure[][]
81
+ */
82
+ private $normalizers = [];
83
+
84
+ /**
85
+ * A list of accepted values for each option.
86
+ */
87
+ private $allowedValues = [];
88
+
89
+ /**
90
+ * A list of accepted types for each option.
91
+ */
92
+ private $allowedTypes = [];
93
+
94
+ /**
95
+ * A list of info messages for each option.
96
+ */
97
+ private $info = [];
98
+
99
+ /**
100
+ * A list of closures for evaluating lazy options.
101
+ */
102
+ private $lazy = [];
103
+
104
+ /**
105
+ * A list of lazy options whose closure is currently being called.
106
+ *
107
+ * This list helps detecting circular dependencies between lazy options.
108
+ */
109
+ private $calling = [];
110
+
111
+ /**
112
+ * A list of deprecated options.
113
+ */
114
+ private $deprecated = [];
115
+
116
+ /**
117
+ * The list of options provided by the user.
118
+ */
119
+ private $given = [];
120
+
121
+ /**
122
+ * Whether the instance is locked for reading.
123
+ *
124
+ * Once locked, the options cannot be changed anymore. This is
125
+ * necessary in order to avoid inconsistencies during the resolving
126
+ * process. If any option is changed after being read, all evaluated
127
+ * lazy options that depend on this option would become invalid.
128
+ */
129
+ private $locked = false;
130
+
131
+ private $parentsOptions = [];
132
+
133
+ /**
134
+ * Whether the whole options definition is marked as array prototype.
135
+ */
136
+ private $prototype;
137
+
138
+ /**
139
+ * The prototype array's index that is being read.
140
+ */
141
+ private $prototypeIndex;
142
+
143
+ /**
144
+ * Sets the default value of a given option.
145
+ *
146
+ * If the default value should be set based on other options, you can pass
147
+ * a closure with the following signature:
148
+ *
149
+ * function (Options $options) {
150
+ * // ...
151
+ * }
152
+ *
153
+ * The closure will be evaluated when {@link resolve()} is called. The
154
+ * closure has access to the resolved values of other options through the
155
+ * passed {@link Options} instance:
156
+ *
157
+ * function (Options $options) {
158
+ * if (isset($options['port'])) {
159
+ * // ...
160
+ * }
161
+ * }
162
+ *
163
+ * If you want to access the previously set default value, add a second
164
+ * argument to the closure's signature:
165
+ *
166
+ * $options->setDefault('name', 'Default Name');
167
+ *
168
+ * $options->setDefault('name', function (Options $options, $previousValue) {
169
+ * // 'Default Name' === $previousValue
170
+ * });
171
+ *
172
+ * This is mostly useful if the configuration of the {@link Options} object
173
+ * is spread across different locations of your code, such as base and
174
+ * sub-classes.
175
+ *
176
+ * If you want to define nested options, you can pass a closure with the
177
+ * following signature:
178
+ *
179
+ * $options->setDefault('database', function (OptionsResolver $resolver) {
180
+ * $resolver->setDefined(['dbname', 'host', 'port', 'user', 'pass']);
181
+ * }
182
+ *
183
+ * To get access to the parent options, add a second argument to the closure's
184
+ * signature:
185
+ *
186
+ * function (OptionsResolver $resolver, Options $parent) {
187
+ * // 'default' === $parent['connection']
188
+ * }
189
+ *
190
+ * @return $this
191
+ *
192
+ * @throws AccessException If called from a lazy option or normalizer
193
+ */
194
+ public function setDefault(string $option, mixed $value): static
195
+ {
196
+ // Setting is not possible once resolving starts, because then lazy
197
+ // options could manipulate the state of the object, leading to
198
+ // inconsistent results.
199
+ if ($this->locked) {
200
+ throw new AccessException('Default values cannot be set from a lazy option or normalizer.');
201
+ }
202
+
203
+ // If an option is a closure that should be evaluated lazily, store it
204
+ // in the "lazy" property.
205
+ if ($value instanceof \Closure) {
206
+ $reflClosure = new \ReflectionFunction($value);
207
+ $params = $reflClosure->getParameters();
208
+
209
+ if (isset($params[0]) && Options::class === $this->getParameterClassName($params[0])) {
210
+ // Initialize the option if no previous value exists
211
+ if (!isset($this->defaults[$option])) {
212
+ $this->defaults[$option] = null;
213
+ }
214
+
215
+ // Ignore previous lazy options if the closure has no second parameter
216
+ if (!isset($this->lazy[$option]) || !isset($params[1])) {
217
+ $this->lazy[$option] = [];
218
+ }
219
+
220
+ // Store closure for later evaluation
221
+ $this->lazy[$option][] = $value;
222
+ $this->defined[$option] = true;
223
+
224
+ // Make sure the option is processed and is not nested anymore
225
+ unset($this->resolved[$option], $this->nested[$option]);
226
+
227
+ return $this;
228
+ }
229
+
230
+ if (isset($params[0]) && null !== ($type = $params[0]->getType()) && self::class === $type->getName() && (!isset($params[1]) || (($type = $params[1]->getType()) instanceof \ReflectionNamedType && Options::class === $type->getName()))) {
231
+ // Store closure for later evaluation
232
+ $this->nested[$option][] = $value;
233
+ $this->defaults[$option] = [];
234
+ $this->defined[$option] = true;
235
+
236
+ // Make sure the option is processed and is not lazy anymore
237
+ unset($this->resolved[$option], $this->lazy[$option]);
238
+
239
+ return $this;
240
+ }
241
+ }
242
+
243
+ // This option is not lazy nor nested anymore
244
+ unset($this->lazy[$option], $this->nested[$option]);
245
+
246
+ // Yet undefined options can be marked as resolved, because we only need
247
+ // to resolve options with lazy closures, normalizers or validation
248
+ // rules, none of which can exist for undefined options
249
+ // If the option was resolved before, update the resolved value
250
+ if (!isset($this->defined[$option]) || \array_key_exists($option, $this->resolved)) {
251
+ $this->resolved[$option] = $value;
252
+ }
253
+
254
+ $this->defaults[$option] = $value;
255
+ $this->defined[$option] = true;
256
+
257
+ return $this;
258
+ }
259
+
260
+ /**
261
+ * @return $this
262
+ *
263
+ * @throws AccessException If called from a lazy option or normalizer
264
+ */
265
+ public function setDefaults(array $defaults): static
266
+ {
267
+ foreach ($defaults as $option => $value) {
268
+ $this->setDefault($option, $value);
269
+ }
270
+
271
+ return $this;
272
+ }
273
+
274
+ /**
275
+ * Returns whether a default value is set for an option.
276
+ *
277
+ * Returns true if {@link setDefault()} was called for this option.
278
+ * An option is also considered set if it was set to null.
279
+ */
280
+ public function hasDefault(string $option): bool
281
+ {
282
+ return \array_key_exists($option, $this->defaults);
283
+ }
284
+
285
+ /**
286
+ * Marks one or more options as required.
287
+ *
288
+ * @param string|string[] $optionNames One or more option names
289
+ *
290
+ * @return $this
291
+ *
292
+ * @throws AccessException If called from a lazy option or normalizer
293
+ */
294
+ public function setRequired(string|array $optionNames): static
295
+ {
296
+ if ($this->locked) {
297
+ throw new AccessException('Options cannot be made required from a lazy option or normalizer.');
298
+ }
299
+
300
+ foreach ((array) $optionNames as $option) {
301
+ $this->defined[$option] = true;
302
+ $this->required[$option] = true;
303
+ }
304
+
305
+ return $this;
306
+ }
307
+
308
+ /**
309
+ * Returns whether an option is required.
310
+ *
311
+ * An option is required if it was passed to {@link setRequired()}.
312
+ */
313
+ public function isRequired(string $option): bool
314
+ {
315
+ return isset($this->required[$option]);
316
+ }
317
+
318
+ /**
319
+ * Returns the names of all required options.
320
+ *
321
+ * @return string[]
322
+ *
323
+ * @see isRequired()
324
+ */
325
+ public function getRequiredOptions(): array
326
+ {
327
+ return array_keys($this->required);
328
+ }
329
+
330
+ /**
331
+ * Returns whether an option is missing a default value.
332
+ *
333
+ * An option is missing if it was passed to {@link setRequired()}, but not
334
+ * to {@link setDefault()}. This option must be passed explicitly to
335
+ * {@link resolve()}, otherwise an exception will be thrown.
336
+ */
337
+ public function isMissing(string $option): bool
338
+ {
339
+ return isset($this->required[$option]) && !\array_key_exists($option, $this->defaults);
340
+ }
341
+
342
+ /**
343
+ * Returns the names of all options missing a default value.
344
+ *
345
+ * @return string[]
346
+ */
347
+ public function getMissingOptions(): array
348
+ {
349
+ return array_keys(array_diff_key($this->required, $this->defaults));
350
+ }
351
+
352
+ /**
353
+ * Defines a valid option name.
354
+ *
355
+ * Defines an option name without setting a default value. The option will
356
+ * be accepted when passed to {@link resolve()}. When not passed, the
357
+ * option will not be included in the resolved options.
358
+ *
359
+ * @param string|string[] $optionNames One or more option names
360
+ *
361
+ * @return $this
362
+ *
363
+ * @throws AccessException If called from a lazy option or normalizer
364
+ */
365
+ public function setDefined(string|array $optionNames): static
366
+ {
367
+ if ($this->locked) {
368
+ throw new AccessException('Options cannot be defined from a lazy option or normalizer.');
369
+ }
370
+
371
+ foreach ((array) $optionNames as $option) {
372
+ $this->defined[$option] = true;
373
+ }
374
+
375
+ return $this;
376
+ }
377
+
378
+ /**
379
+ * Returns whether an option is defined.
380
+ *
381
+ * Returns true for any option passed to {@link setDefault()},
382
+ * {@link setRequired()} or {@link setDefined()}.
383
+ */
384
+ public function isDefined(string $option): bool
385
+ {
386
+ return isset($this->defined[$option]);
387
+ }
388
+
389
+ /**
390
+ * Returns the names of all defined options.
391
+ *
392
+ * @return string[]
393
+ *
394
+ * @see isDefined()
395
+ */
396
+ public function getDefinedOptions(): array
397
+ {
398
+ return array_keys($this->defined);
399
+ }
400
+
401
+ public function isNested(string $option): bool
402
+ {
403
+ return isset($this->nested[$option]);
404
+ }
405
+
406
+ /**
407
+ * Deprecates an option, allowed types or values.
408
+ *
409
+ * Instead of passing the message, you may also pass a closure with the
410
+ * following signature:
411
+ *
412
+ * function (Options $options, $value): string {
413
+ * // ...
414
+ * }
415
+ *
416
+ * The closure receives the value as argument and should return a string.
417
+ * Return an empty string to ignore the option deprecation.
418
+ *
419
+ * The closure is invoked when {@link resolve()} is called. The parameter
420
+ * passed to the closure is the value of the option after validating it
421
+ * and before normalizing it.
422
+ *
423
+ * @param string $package The name of the composer package that is triggering the deprecation
424
+ * @param string $version The version of the package that introduced the deprecation
425
+ * @param string|\Closure $message The deprecation message to use
426
+ *
427
+ * @return $this
428
+ */
429
+ public function setDeprecated(string $option, string $package, string $version, string|\Closure $message = 'The option "%name%" is deprecated.'): static
430
+ {
431
+ if ($this->locked) {
432
+ throw new AccessException('Options cannot be deprecated from a lazy option or normalizer.');
433
+ }
434
+
435
+ if (!isset($this->defined[$option])) {
436
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist, defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
437
+ }
438
+
439
+ if (!\is_string($message) && !$message instanceof \Closure) {
440
+ throw new InvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', get_debug_type($message)));
441
+ }
442
+
443
+ // ignore if empty string
444
+ if ('' === $message) {
445
+ return $this;
446
+ }
447
+
448
+ $this->deprecated[$option] = [
449
+ 'package' => $package,
450
+ 'version' => $version,
451
+ 'message' => $message,
452
+ ];
453
+
454
+ // Make sure the option is processed
455
+ unset($this->resolved[$option]);
456
+
457
+ return $this;
458
+ }
459
+
460
+ public function isDeprecated(string $option): bool
461
+ {
462
+ return isset($this->deprecated[$option]);
463
+ }
464
+
465
+ /**
466
+ * Sets the normalizer for an option.
467
+ *
468
+ * The normalizer should be a closure with the following signature:
469
+ *
470
+ * function (Options $options, $value) {
471
+ * // ...
472
+ * }
473
+ *
474
+ * The closure is invoked when {@link resolve()} is called. The closure
475
+ * has access to the resolved values of other options through the passed
476
+ * {@link Options} instance.
477
+ *
478
+ * The second parameter passed to the closure is the value of
479
+ * the option.
480
+ *
481
+ * The resolved option value is set to the return value of the closure.
482
+ *
483
+ * @return $this
484
+ *
485
+ * @throws UndefinedOptionsException If the option is undefined
486
+ * @throws AccessException If called from a lazy option or normalizer
487
+ */
488
+ public function setNormalizer(string $option, \Closure $normalizer)
489
+ {
490
+ if ($this->locked) {
491
+ throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.');
492
+ }
493
+
494
+ if (!isset($this->defined[$option])) {
495
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
496
+ }
497
+
498
+ $this->normalizers[$option] = [$normalizer];
499
+
500
+ // Make sure the option is processed
501
+ unset($this->resolved[$option]);
502
+
503
+ return $this;
504
+ }
505
+
506
+ /**
507
+ * Adds a normalizer for an option.
508
+ *
509
+ * The normalizer should be a closure with the following signature:
510
+ *
511
+ * function (Options $options, $value): mixed {
512
+ * // ...
513
+ * }
514
+ *
515
+ * The closure is invoked when {@link resolve()} is called. The closure
516
+ * has access to the resolved values of other options through the passed
517
+ * {@link Options} instance.
518
+ *
519
+ * The second parameter passed to the closure is the value of
520
+ * the option.
521
+ *
522
+ * The resolved option value is set to the return value of the closure.
523
+ *
524
+ * @return $this
525
+ *
526
+ * @throws UndefinedOptionsException If the option is undefined
527
+ * @throws AccessException If called from a lazy option or normalizer
528
+ */
529
+ public function addNormalizer(string $option, \Closure $normalizer, bool $forcePrepend = false): static
530
+ {
531
+ if ($this->locked) {
532
+ throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.');
533
+ }
534
+
535
+ if (!isset($this->defined[$option])) {
536
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
537
+ }
538
+
539
+ if ($forcePrepend) {
540
+ $this->normalizers[$option] = $this->normalizers[$option] ?? [];
541
+ array_unshift($this->normalizers[$option], $normalizer);
542
+ } else {
543
+ $this->normalizers[$option][] = $normalizer;
544
+ }
545
+
546
+ // Make sure the option is processed
547
+ unset($this->resolved[$option]);
548
+
549
+ return $this;
550
+ }
551
+
552
+ /**
553
+ * Sets allowed values for an option.
554
+ *
555
+ * Instead of passing values, you may also pass a closures with the
556
+ * following signature:
557
+ *
558
+ * function ($value) {
559
+ * // return true or false
560
+ * }
561
+ *
562
+ * The closure receives the value as argument and should return true to
563
+ * accept the value and false to reject the value.
564
+ *
565
+ * @param mixed $allowedValues One or more acceptable values/closures
566
+ *
567
+ * @return $this
568
+ *
569
+ * @throws UndefinedOptionsException If the option is undefined
570
+ * @throws AccessException If called from a lazy option or normalizer
571
+ */
572
+ public function setAllowedValues(string $option, mixed $allowedValues)
573
+ {
574
+ if ($this->locked) {
575
+ throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
576
+ }
577
+
578
+ if (!isset($this->defined[$option])) {
579
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
580
+ }
581
+
582
+ $this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : [$allowedValues];
583
+
584
+ // Make sure the option is processed
585
+ unset($this->resolved[$option]);
586
+
587
+ return $this;
588
+ }
589
+
590
+ /**
591
+ * Adds allowed values for an option.
592
+ *
593
+ * The values are merged with the allowed values defined previously.
594
+ *
595
+ * Instead of passing values, you may also pass a closures with the
596
+ * following signature:
597
+ *
598
+ * function ($value) {
599
+ * // return true or false
600
+ * }
601
+ *
602
+ * The closure receives the value as argument and should return true to
603
+ * accept the value and false to reject the value.
604
+ *
605
+ * @param mixed $allowedValues One or more acceptable values/closures
606
+ *
607
+ * @return $this
608
+ *
609
+ * @throws UndefinedOptionsException If the option is undefined
610
+ * @throws AccessException If called from a lazy option or normalizer
611
+ */
612
+ public function addAllowedValues(string $option, mixed $allowedValues)
613
+ {
614
+ if ($this->locked) {
615
+ throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
616
+ }
617
+
618
+ if (!isset($this->defined[$option])) {
619
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
620
+ }
621
+
622
+ if (!\is_array($allowedValues)) {
623
+ $allowedValues = [$allowedValues];
624
+ }
625
+
626
+ if (!isset($this->allowedValues[$option])) {
627
+ $this->allowedValues[$option] = $allowedValues;
628
+ } else {
629
+ $this->allowedValues[$option] = array_merge($this->allowedValues[$option], $allowedValues);
630
+ }
631
+
632
+ // Make sure the option is processed
633
+ unset($this->resolved[$option]);
634
+
635
+ return $this;
636
+ }
637
+
638
+ /**
639
+ * Sets allowed types for an option.
640
+ *
641
+ * Any type for which a corresponding is_<type>() function exists is
642
+ * acceptable. Additionally, fully-qualified class or interface names may
643
+ * be passed.
644
+ *
645
+ * @param string|string[] $allowedTypes One or more accepted types
646
+ *
647
+ * @return $this
648
+ *
649
+ * @throws UndefinedOptionsException If the option is undefined
650
+ * @throws AccessException If called from a lazy option or normalizer
651
+ */
652
+ public function setAllowedTypes(string $option, string|array $allowedTypes)
653
+ {
654
+ if ($this->locked) {
655
+ throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.');
656
+ }
657
+
658
+ if (!isset($this->defined[$option])) {
659
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
660
+ }
661
+
662
+ $this->allowedTypes[$option] = (array) $allowedTypes;
663
+
664
+ // Make sure the option is processed
665
+ unset($this->resolved[$option]);
666
+
667
+ return $this;
668
+ }
669
+
670
+ /**
671
+ * Adds allowed types for an option.
672
+ *
673
+ * The types are merged with the allowed types defined previously.
674
+ *
675
+ * Any type for which a corresponding is_<type>() function exists is
676
+ * acceptable. Additionally, fully-qualified class or interface names may
677
+ * be passed.
678
+ *
679
+ * @param string|string[] $allowedTypes One or more accepted types
680
+ *
681
+ * @return $this
682
+ *
683
+ * @throws UndefinedOptionsException If the option is undefined
684
+ * @throws AccessException If called from a lazy option or normalizer
685
+ */
686
+ public function addAllowedTypes(string $option, string|array $allowedTypes)
687
+ {
688
+ if ($this->locked) {
689
+ throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.');
690
+ }
691
+
692
+ if (!isset($this->defined[$option])) {
693
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
694
+ }
695
+
696
+ if (!isset($this->allowedTypes[$option])) {
697
+ $this->allowedTypes[$option] = (array) $allowedTypes;
698
+ } else {
699
+ $this->allowedTypes[$option] = array_merge($this->allowedTypes[$option], (array) $allowedTypes);
700
+ }
701
+
702
+ // Make sure the option is processed
703
+ unset($this->resolved[$option]);
704
+
705
+ return $this;
706
+ }
707
+
708
+ /**
709
+ * Defines an option configurator with the given name.
710
+ */
711
+ public function define(string $option): OptionConfigurator
712
+ {
713
+ if (isset($this->defined[$option])) {
714
+ throw new OptionDefinitionException(sprintf('The option "%s" is already defined.', $option));
715
+ }
716
+
717
+ return new OptionConfigurator($option, $this);
718
+ }
719
+
720
+ /**
721
+ * Sets an info message for an option.
722
+ *
723
+ * @return $this
724
+ *
725
+ * @throws UndefinedOptionsException If the option is undefined
726
+ * @throws AccessException If called from a lazy option or normalizer
727
+ */
728
+ public function setInfo(string $option, string $info): static
729
+ {
730
+ if ($this->locked) {
731
+ throw new AccessException('The Info message cannot be set from a lazy option or normalizer.');
732
+ }
733
+
734
+ if (!isset($this->defined[$option])) {
735
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
736
+ }
737
+
738
+ $this->info[$option] = $info;
739
+
740
+ return $this;
741
+ }
742
+
743
+ /**
744
+ * Gets the info message for an option.
745
+ */
746
+ public function getInfo(string $option): ?string
747
+ {
748
+ if (!isset($this->defined[$option])) {
749
+ throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
750
+ }
751
+
752
+ return $this->info[$option] ?? null;
753
+ }
754
+
755
+ /**
756
+ * Marks the whole options definition as array prototype.
757
+ *
758
+ * @return $this
759
+ *
760
+ * @throws AccessException If called from a lazy option, a normalizer or a root definition
761
+ */
762
+ public function setPrototype(bool $prototype): static
763
+ {
764
+ if ($this->locked) {
765
+ throw new AccessException('The prototype property cannot be set from a lazy option or normalizer.');
766
+ }
767
+
768
+ if (null === $this->prototype && $prototype) {
769
+ throw new AccessException('The prototype property cannot be set from a root definition.');
770
+ }
771
+
772
+ $this->prototype = $prototype;
773
+
774
+ return $this;
775
+ }
776
+
777
+ public function isPrototype(): bool
778
+ {
779
+ return $this->prototype ?? false;
780
+ }
781
+
782
+ /**
783
+ * Removes the option with the given name.
784
+ *
785
+ * Undefined options are ignored.
786
+ *
787
+ * @param string|string[] $optionNames One or more option names
788
+ *
789
+ * @return $this
790
+ *
791
+ * @throws AccessException If called from a lazy option or normalizer
792
+ */
793
+ public function remove(string|array $optionNames): static
794
+ {
795
+ if ($this->locked) {
796
+ throw new AccessException('Options cannot be removed from a lazy option or normalizer.');
797
+ }
798
+
799
+ foreach ((array) $optionNames as $option) {
800
+ unset($this->defined[$option], $this->defaults[$option], $this->required[$option], $this->resolved[$option]);
801
+ unset($this->lazy[$option], $this->normalizers[$option], $this->allowedTypes[$option], $this->allowedValues[$option], $this->info[$option]);
802
+ }
803
+
804
+ return $this;
805
+ }
806
+
807
+ /**
808
+ * Removes all options.
809
+ *
810
+ * @return $this
811
+ *
812
+ * @throws AccessException If called from a lazy option or normalizer
813
+ */
814
+ public function clear(): static
815
+ {
816
+ if ($this->locked) {
817
+ throw new AccessException('Options cannot be cleared from a lazy option or normalizer.');
818
+ }
819
+
820
+ $this->defined = [];
821
+ $this->defaults = [];
822
+ $this->nested = [];
823
+ $this->required = [];
824
+ $this->resolved = [];
825
+ $this->lazy = [];
826
+ $this->normalizers = [];
827
+ $this->allowedTypes = [];
828
+ $this->allowedValues = [];
829
+ $this->deprecated = [];
830
+ $this->info = [];
831
+
832
+ return $this;
833
+ }
834
+
835
+ /**
836
+ * Merges options with the default values stored in the container and
837
+ * validates them.
838
+ *
839
+ * Exceptions are thrown if:
840
+ *
841
+ * - Undefined options are passed;
842
+ * - Required options are missing;
843
+ * - Options have invalid types;
844
+ * - Options have invalid values.
845
+ *
846
+ * @throws UndefinedOptionsException If an option name is undefined
847
+ * @throws InvalidOptionsException If an option doesn't fulfill the
848
+ * specified validation rules
849
+ * @throws MissingOptionsException If a required option is missing
850
+ * @throws OptionDefinitionException If there is a cyclic dependency between
851
+ * lazy options and/or normalizers
852
+ * @throws NoSuchOptionException If a lazy option reads an unavailable option
853
+ * @throws AccessException If called from a lazy option or normalizer
854
+ */
855
+ public function resolve(array $options = []): array
856
+ {
857
+ if ($this->locked) {
858
+ throw new AccessException('Options cannot be resolved from a lazy option or normalizer.');
859
+ }
860
+
861
+ // Allow this method to be called multiple times
862
+ $clone = clone $this;
863
+
864
+ // Make sure that no unknown options are passed
865
+ $diff = array_diff_key($options, $clone->defined);
866
+
867
+ if (\count($diff) > 0) {
868
+ ksort($clone->defined);
869
+ ksort($diff);
870
+
871
+ throw new UndefinedOptionsException(sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', $this->formatOptions(array_keys($diff)), implode('", "', array_keys($clone->defined))));
872
+ }
873
+
874
+ // Override options set by the user
875
+ foreach ($options as $option => $value) {
876
+ $clone->given[$option] = true;
877
+ $clone->defaults[$option] = $value;
878
+ unset($clone->resolved[$option], $clone->lazy[$option]);
879
+ }
880
+
881
+ // Check whether any required option is missing
882
+ $diff = array_diff_key($clone->required, $clone->defaults);
883
+
884
+ if (\count($diff) > 0) {
885
+ ksort($diff);
886
+
887
+ throw new MissingOptionsException(sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', $this->formatOptions(array_keys($diff))));
888
+ }
889
+
890
+ // Lock the container
891
+ $clone->locked = true;
892
+
893
+ // Now process the individual options. Use offsetGet(), which resolves
894
+ // the option itself and any options that the option depends on
895
+ foreach ($clone->defaults as $option => $_) {
896
+ $clone->offsetGet($option);
897
+ }
898
+
899
+ return $clone->resolved;
900
+ }
901
+
902
+ /**
903
+ * Returns the resolved value of an option.
904
+ *
905
+ * @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default)
906
+ *
907
+ * @throws AccessException If accessing this method outside of
908
+ * {@link resolve()}
909
+ * @throws NoSuchOptionException If the option is not set
910
+ * @throws InvalidOptionsException If the option doesn't fulfill the
911
+ * specified validation rules
912
+ * @throws OptionDefinitionException If there is a cyclic dependency between
913
+ * lazy options and/or normalizers
914
+ */
915
+ public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
916
+ {
917
+ if (!$this->locked) {
918
+ throw new AccessException('Array access is only supported within closures of lazy options and normalizers.');
919
+ }
920
+
921
+ // Shortcut for resolved options
922
+ if (isset($this->resolved[$option]) || \array_key_exists($option, $this->resolved)) {
923
+ if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || $this->calling) && \is_string($this->deprecated[$option]['message'])) {
924
+ trigger_deprecation($this->deprecated[$option]['package'], $this->deprecated[$option]['version'], strtr($this->deprecated[$option]['message'], ['%name%' => $option]));
925
+ }
926
+
927
+ return $this->resolved[$option];
928
+ }
929
+
930
+ // Check whether the option is set at all
931
+ if (!isset($this->defaults[$option]) && !\array_key_exists($option, $this->defaults)) {
932
+ if (!isset($this->defined[$option])) {
933
+ throw new NoSuchOptionException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
934
+ }
935
+
936
+ throw new NoSuchOptionException(sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $this->formatOptions([$option])));
937
+ }
938
+
939
+ $value = $this->defaults[$option];
940
+
941
+ // Resolve the option if it is a nested definition
942
+ if (isset($this->nested[$option])) {
943
+ // If the closure is already being called, we have a cyclic dependency
944
+ if (isset($this->calling[$option])) {
945
+ throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
946
+ }
947
+
948
+ if (!\is_array($value)) {
949
+ throw new InvalidOptionsException(sprintf('The nested option "%s" with value %s is expected to be of type array, but is of type "%s".', $this->formatOptions([$option]), $this->formatValue($value), get_debug_type($value)));
950
+ }
951
+
952
+ // The following section must be protected from cyclic calls.
953
+ $this->calling[$option] = true;
954
+ try {
955
+ $resolver = new self();
956
+ $resolver->prototype = false;
957
+ $resolver->parentsOptions = $this->parentsOptions;
958
+ $resolver->parentsOptions[] = $option;
959
+ foreach ($this->nested[$option] as $closure) {
960
+ $closure($resolver, $this);
961
+ }
962
+
963
+ if ($resolver->prototype) {
964
+ $values = [];
965
+ foreach ($value as $index => $prototypeValue) {
966
+ if (!\is_array($prototypeValue)) {
967
+ throw new InvalidOptionsException(sprintf('The value of the option "%s" is expected to be of type array of array, but is of type array of "%s".', $this->formatOptions([$option]), get_debug_type($prototypeValue)));
968
+ }
969
+
970
+ $resolver->prototypeIndex = $index;
971
+ $values[$index] = $resolver->resolve($prototypeValue);
972
+ }
973
+ $value = $values;
974
+ } else {
975
+ $value = $resolver->resolve($value);
976
+ }
977
+ } finally {
978
+ $resolver->prototypeIndex = null;
979
+ unset($this->calling[$option]);
980
+ }
981
+ }
982
+
983
+ // Resolve the option if the default value is lazily evaluated
984
+ if (isset($this->lazy[$option])) {
985
+ // If the closure is already being called, we have a cyclic
986
+ // dependency
987
+ if (isset($this->calling[$option])) {
988
+ throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
989
+ }
990
+
991
+ // The following section must be protected from cyclic
992
+ // calls. Set $calling for the current $option to detect a cyclic
993
+ // dependency
994
+ // BEGIN
995
+ $this->calling[$option] = true;
996
+ try {
997
+ foreach ($this->lazy[$option] as $closure) {
998
+ $value = $closure($this, $value);
999
+ }
1000
+ } finally {
1001
+ unset($this->calling[$option]);
1002
+ }
1003
+ // END
1004
+ }
1005
+
1006
+ // Validate the type of the resolved option
1007
+ if (isset($this->allowedTypes[$option])) {
1008
+ $valid = true;
1009
+ $invalidTypes = [];
1010
+
1011
+ foreach ($this->allowedTypes[$option] as $type) {
1012
+ if ($valid = $this->verifyTypes($type, $value, $invalidTypes)) {
1013
+ break;
1014
+ }
1015
+ }
1016
+
1017
+ if (!$valid) {
1018
+ $fmtActualValue = $this->formatValue($value);
1019
+ $fmtAllowedTypes = implode('" or "', $this->allowedTypes[$option]);
1020
+ $fmtProvidedTypes = implode('|', array_keys($invalidTypes));
1021
+ $allowedContainsArrayType = \count(array_filter($this->allowedTypes[$option], static function ($item) {
1022
+ return str_ends_with($item, '[]');
1023
+ })) > 0;
1024
+
1025
+ if (\is_array($value) && $allowedContainsArrayType) {
1026
+ throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes));
1027
+ }
1028
+
1029
+ throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes));
1030
+ }
1031
+ }
1032
+
1033
+ // Validate the value of the resolved option
1034
+ if (isset($this->allowedValues[$option])) {
1035
+ $success = false;
1036
+ $printableAllowedValues = [];
1037
+
1038
+ foreach ($this->allowedValues[$option] as $allowedValue) {
1039
+ if ($allowedValue instanceof \Closure) {
1040
+ if ($allowedValue($value)) {
1041
+ $success = true;
1042
+ break;
1043
+ }
1044
+
1045
+ // Don't include closures in the exception message
1046
+ continue;
1047
+ }
1048
+
1049
+ if ($value === $allowedValue) {
1050
+ $success = true;
1051
+ break;
1052
+ }
1053
+
1054
+ $printableAllowedValues[] = $allowedValue;
1055
+ }
1056
+
1057
+ if (!$success) {
1058
+ $message = sprintf(
1059
+ 'The option "%s" with value %s is invalid.',
1060
+ $option,
1061
+ $this->formatValue($value)
1062
+ );
1063
+
1064
+ if (\count($printableAllowedValues) > 0) {
1065
+ $message .= sprintf(
1066
+ ' Accepted values are: %s.',
1067
+ $this->formatValues($printableAllowedValues)
1068
+ );
1069
+ }
1070
+
1071
+ if (isset($this->info[$option])) {
1072
+ $message .= sprintf(' Info: %s.', $this->info[$option]);
1073
+ }
1074
+
1075
+ throw new InvalidOptionsException($message);
1076
+ }
1077
+ }
1078
+
1079
+ // Check whether the option is deprecated
1080
+ // and it is provided by the user or is being called from a lazy evaluation
1081
+ if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || ($this->calling && \is_string($this->deprecated[$option]['message'])))) {
1082
+ $deprecation = $this->deprecated[$option];
1083
+ $message = $this->deprecated[$option]['message'];
1084
+
1085
+ if ($message instanceof \Closure) {
1086
+ // If the closure is already being called, we have a cyclic dependency
1087
+ if (isset($this->calling[$option])) {
1088
+ throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
1089
+ }
1090
+
1091
+ $this->calling[$option] = true;
1092
+ try {
1093
+ if (!\is_string($message = $message($this, $value))) {
1094
+ throw new InvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", return an empty string to ignore.', get_debug_type($message)));
1095
+ }
1096
+ } finally {
1097
+ unset($this->calling[$option]);
1098
+ }
1099
+ }
1100
+
1101
+ if ('' !== $message) {
1102
+ trigger_deprecation($deprecation['package'], $deprecation['version'], strtr($message, ['%name%' => $option]));
1103
+ }
1104
+ }
1105
+
1106
+ // Normalize the validated option
1107
+ if (isset($this->normalizers[$option])) {
1108
+ // If the closure is already being called, we have a cyclic
1109
+ // dependency
1110
+ if (isset($this->calling[$option])) {
1111
+ throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
1112
+ }
1113
+
1114
+ // The following section must be protected from cyclic
1115
+ // calls. Set $calling for the current $option to detect a cyclic
1116
+ // dependency
1117
+ // BEGIN
1118
+ $this->calling[$option] = true;
1119
+ try {
1120
+ foreach ($this->normalizers[$option] as $normalizer) {
1121
+ $value = $normalizer($this, $value);
1122
+ }
1123
+ } finally {
1124
+ unset($this->calling[$option]);
1125
+ }
1126
+ // END
1127
+ }
1128
+
1129
+ // Mark as resolved
1130
+ $this->resolved[$option] = $value;
1131
+
1132
+ return $value;
1133
+ }
1134
+
1135
+ private function verifyTypes(string $type, mixed $value, array &$invalidTypes, int $level = 0): bool
1136
+ {
1137
+ if (\is_array($value) && str_ends_with($type, '[]')) {
1138
+ $type = substr($type, 0, -2);
1139
+ $valid = true;
1140
+
1141
+ foreach ($value as $val) {
1142
+ if (!$this->verifyTypes($type, $val, $invalidTypes, $level + 1)) {
1143
+ $valid = false;
1144
+ }
1145
+ }
1146
+
1147
+ return $valid;
1148
+ }
1149
+
1150
+ if (('null' === $type && null === $value) || (isset(self::VALIDATION_FUNCTIONS[$type]) ? self::VALIDATION_FUNCTIONS[$type]($value) : $value instanceof $type)) {
1151
+ return true;
1152
+ }
1153
+
1154
+ if (!$invalidTypes || $level > 0) {
1155
+ $invalidTypes[get_debug_type($value)] = true;
1156
+ }
1157
+
1158
+ return false;
1159
+ }
1160
+
1161
+ /**
1162
+ * Returns whether a resolved option with the given name exists.
1163
+ *
1164
+ * @throws AccessException If accessing this method outside of {@link resolve()}
1165
+ *
1166
+ * @see \ArrayAccess::offsetExists()
1167
+ */
1168
+ public function offsetExists(mixed $option): bool
1169
+ {
1170
+ if (!$this->locked) {
1171
+ throw new AccessException('Array access is only supported within closures of lazy options and normalizers.');
1172
+ }
1173
+
1174
+ return \array_key_exists($option, $this->defaults);
1175
+ }
1176
+
1177
+ /**
1178
+ * Not supported.
1179
+ *
1180
+ * @throws AccessException
1181
+ */
1182
+ public function offsetSet(mixed $option, mixed $value): void
1183
+ {
1184
+ throw new AccessException('Setting options via array access is not supported. Use setDefault() instead.');
1185
+ }
1186
+
1187
+ /**
1188
+ * Not supported.
1189
+ *
1190
+ * @throws AccessException
1191
+ */
1192
+ public function offsetUnset(mixed $option): void
1193
+ {
1194
+ throw new AccessException('Removing options via array access is not supported. Use remove() instead.');
1195
+ }
1196
+
1197
+ /**
1198
+ * Returns the number of set options.
1199
+ *
1200
+ * This may be only a subset of the defined options.
1201
+ *
1202
+ * @throws AccessException If accessing this method outside of {@link resolve()}
1203
+ *
1204
+ * @see \Countable::count()
1205
+ */
1206
+ public function count(): int
1207
+ {
1208
+ if (!$this->locked) {
1209
+ throw new AccessException('Counting is only supported within closures of lazy options and normalizers.');
1210
+ }
1211
+
1212
+ return \count($this->defaults);
1213
+ }
1214
+
1215
+ /**
1216
+ * Returns a string representation of the value.
1217
+ *
1218
+ * This method returns the equivalent PHP tokens for most scalar types
1219
+ * (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped
1220
+ * in double quotes (").
1221
+ */
1222
+ private function formatValue(mixed $value): string
1223
+ {
1224
+ if (\is_object($value)) {
1225
+ return \get_class($value);
1226
+ }
1227
+
1228
+ if (\is_array($value)) {
1229
+ return 'array';
1230
+ }
1231
+
1232
+ if (\is_string($value)) {
1233
+ return '"'.$value.'"';
1234
+ }
1235
+
1236
+ if (\is_resource($value)) {
1237
+ return 'resource';
1238
+ }
1239
+
1240
+ if (null === $value) {
1241
+ return 'null';
1242
+ }
1243
+
1244
+ if (false === $value) {
1245
+ return 'false';
1246
+ }
1247
+
1248
+ if (true === $value) {
1249
+ return 'true';
1250
+ }
1251
+
1252
+ return (string) $value;
1253
+ }
1254
+
1255
+ /**
1256
+ * Returns a string representation of a list of values.
1257
+ *
1258
+ * Each of the values is converted to a string using
1259
+ * {@link formatValue()}. The values are then concatenated with commas.
1260
+ *
1261
+ * @see formatValue()
1262
+ */
1263
+ private function formatValues(array $values): string
1264
+ {
1265
+ foreach ($values as $key => $value) {
1266
+ $values[$key] = $this->formatValue($value);
1267
+ }
1268
+
1269
+ return implode(', ', $values);
1270
+ }
1271
+
1272
+ private function formatOptions(array $options): string
1273
+ {
1274
+ if ($this->parentsOptions) {
1275
+ $prefix = array_shift($this->parentsOptions);
1276
+ if ($this->parentsOptions) {
1277
+ $prefix .= sprintf('[%s]', implode('][', $this->parentsOptions));
1278
+ }
1279
+
1280
+ if ($this->prototype && null !== $this->prototypeIndex) {
1281
+ $prefix .= sprintf('[%s]', $this->prototypeIndex);
1282
+ }
1283
+
1284
+ $options = array_map(static function (string $option) use ($prefix): string {
1285
+ return sprintf('%s[%s]', $prefix, $option);
1286
+ }, $options);
1287
+ }
1288
+
1289
+ return implode('", "', $options);
1290
+ }
1291
+
1292
+ private function getParameterClassName(\ReflectionParameter $parameter): ?string
1293
+ {
1294
+ if (!($type = $parameter->getType()) instanceof \ReflectionNamedType || $type->isBuiltin()) {
1295
+ return null;
1296
+ }
1297
+
1298
+ return $type->getName();
1299
+ }
1300
+ }
vendor/symfony/options-resolver/README.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ OptionsResolver Component
2
+ =========================
3
+
4
+ The OptionsResolver component is `array_replace` on steroids. It allows you to
5
+ create an options system with required options, defaults, validation (type,
6
+ value), normalization and more.
7
+
8
+ Resources
9
+ ---------
10
+
11
+ * [Documentation](https://symfony.com/doc/current/components/options_resolver.html)
12
+ * [Contributing](https://symfony.com/doc/current/contributing/index.html)
13
+ * [Report issues](https://github.com/symfony/symfony/issues) and
14
+ [send Pull Requests](https://github.com/symfony/symfony/pulls)
15
+ in the [main Symfony repository](https://github.com/symfony/symfony)
vendor/symfony/polyfill-php80/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2020 Fabien Potencier
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 furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ 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/symfony/polyfill-php80/Php80.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Polyfill\Php80;
13
+
14
+ /**
15
+ * @author Ion Bazan <ion.bazan@gmail.com>
16
+ * @author Nico Oelgart <nicoswd@gmail.com>
17
+ * @author Nicolas Grekas <p@tchwork.com>
18
+ *
19
+ * @internal
20
+ */
21
+ final class Php80
22
+ {
23
+ public static function fdiv(float $dividend, float $divisor): float
24
+ {
25
+ return @($dividend / $divisor);
26
+ }
27
+
28
+ public static function get_debug_type($value): string
29
+ {
30
+ switch (true) {
31
+ case null === $value: return 'null';
32
+ case \is_bool($value): return 'bool';
33
+ case \is_string($value): return 'string';
34
+ case \is_array($value): return 'array';
35
+ case \is_int($value): return 'int';
36
+ case \is_float($value): return 'float';
37
+ case \is_object($value): break;
38
+ case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
39
+ default:
40
+ if (null === $type = @get_resource_type($value)) {
41
+ return 'unknown';
42
+ }
43
+
44
+ if ('Unknown' === $type) {
45
+ $type = 'closed';
46
+ }
47
+
48
+ return "resource ($type)";
49
+ }
50
+
51
+ $class = \get_class($value);
52
+
53
+ if (false === strpos($class, '@')) {
54
+ return $class;
55
+ }
56
+
57
+ return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
58
+ }
59
+
60
+ public static function get_resource_id($res): int
61
+ {
62
+ if (!\is_resource($res) && null === @get_resource_type($res)) {
63
+ throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
64
+ }
65
+
66
+ return (int) $res;
67
+ }
68
+
69
+ public static function preg_last_error_msg(): string
70
+ {
71
+ switch (preg_last_error()) {
72
+ case \PREG_INTERNAL_ERROR:
73
+ return 'Internal error';
74
+ case \PREG_BAD_UTF8_ERROR:
75
+ return 'Malformed UTF-8 characters, possibly incorrectly encoded';
76
+ case \PREG_BAD_UTF8_OFFSET_ERROR:
77
+ return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
78
+ case \PREG_BACKTRACK_LIMIT_ERROR:
79
+ return 'Backtrack limit exhausted';
80
+ case \PREG_RECURSION_LIMIT_ERROR:
81
+ return 'Recursion limit exhausted';
82
+ case \PREG_JIT_STACKLIMIT_ERROR:
83
+ return 'JIT stack limit exhausted';
84
+ case \PREG_NO_ERROR:
85
+ return 'No error';
86
+ default:
87
+ return 'Unknown error';
88
+ }
89
+ }
90
+
91
+ public static function str_contains(string $haystack, string $needle): bool
92
+ {
93
+ return '' === $needle || false !== strpos($haystack, $needle);
94
+ }
95
+
96
+ public static function str_starts_with(string $haystack, string $needle): bool
97
+ {
98
+ return 0 === strncmp($haystack, $needle, \strlen($needle));
99
+ }
100
+
101
+ public static function str_ends_with(string $haystack, string $needle): bool
102
+ {
103
+ if ('' === $needle || $needle === $haystack) {
104
+ return true;
105
+ }
106
+
107
+ if ('' === $haystack) {
108
+ return false;
109
+ }
110
+
111
+ $needleLength = \strlen($needle);
112
+
113
+ return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
114
+ }
115
+ }
vendor/symfony/polyfill-php80/PhpToken.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony\Polyfill\Php80;
13
+
14
+ /**
15
+ * @author Fedonyuk Anton <info@ensostudio.ru>
16
+ *
17
+ * @internal
18
+ */
19
+ class PhpToken implements \Stringable
20
+ {
21
+ /**
22
+ * @var int
23
+ */
24
+ public $id;
25
+
26
+ /**
27
+ * @var string
28
+ */
29
+ public $text;
30
+
31
+ /**
32
+ * @var int
33
+ */
34
+ public $line;
35
+
36
+ /**
37
+ * @var int
38
+ */
39
+ public $pos;
40
+
41
+ public function __construct(int $id, string $text, int $line = -1, int $position = -1)
42
+ {
43
+ $this->id = $id;
44
+ $this->text = $text;
45
+ $this->line = $line;
46
+ $this->pos = $position;
47
+ }
48
+
49
+ public function getTokenName(): ?string
50
+ {
51
+ if ('UNKNOWN' === $name = token_name($this->id)) {
52
+ $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text;
53
+ }
54
+
55
+ return $name;
56
+ }
57
+
58
+ /**
59
+ * @param int|string|array $kind
60
+ */
61
+ public function is($kind): bool
62
+ {
63
+ foreach ((array) $kind as $value) {
64
+ if (\in_array($value, [$this->id, $this->text], true)) {
65
+ return true;
66
+ }
67
+ }
68
+
69
+ return false;
70
+ }
71
+
72
+ public function isIgnorable(): bool
73
+ {
74
+ return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true);
75
+ }
76
+
77
+ public function __toString(): string
78
+ {
79
+ return (string) $this->text;
80
+ }
81
+
82
+ /**
83
+ * @return static[]
84
+ */
85
+ public static function tokenize(string $code, int $flags = 0): array
86
+ {
87
+ $line = 1;
88
+ $position = 0;
89
+ $tokens = token_get_all($code, $flags);
90
+ foreach ($tokens as $index => $token) {
91
+ if (\is_string($token)) {
92
+ $id = \ord($token);
93
+ $text = $token;
94
+ } else {
95
+ [$id, $text, $line] = $token;
96
+ }
97
+ $tokens[$index] = new static($id, $text, $line, $position);
98
+ $position += \strlen($text);
99
+ }
100
+
101
+ return $tokens;
102
+ }
103
+ }
vendor/symfony/polyfill-php80/README.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Symfony Polyfill / Php80
2
+ ========================
3
+
4
+ This component provides features added to PHP 8.0 core:
5
+
6
+ - [`Stringable`](https://php.net/stringable) interface
7
+ - [`fdiv`](https://php.net/fdiv)
8
+ - [`ValueError`](https://php.net/valueerror) class
9
+ - [`UnhandledMatchError`](https://php.net/unhandledmatcherror) class
10
+ - `FILTER_VALIDATE_BOOL` constant
11
+ - [`get_debug_type`](https://php.net/get_debug_type)
12
+ - [`PhpToken`](https://php.net/phptoken) class
13
+ - [`preg_last_error_msg`](https://php.net/preg_last_error_msg)
14
+ - [`str_contains`](https://php.net/str_contains)
15
+ - [`str_starts_with`](https://php.net/str_starts_with)
16
+ - [`str_ends_with`](https://php.net/str_ends_with)
17
+ - [`get_resource_id`](https://php.net/get_resource_id)
18
+
19
+ More information can be found in the
20
+ [main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
21
+
22
+ License
23
+ =======
24
+
25
+ This library is released under the [MIT license](LICENSE).
vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ #[Attribute(Attribute::TARGET_CLASS)]
4
+ final class Attribute
5
+ {
6
+ public const TARGET_CLASS = 1;
7
+ public const TARGET_FUNCTION = 2;
8
+ public const TARGET_METHOD = 4;
9
+ public const TARGET_PROPERTY = 8;
10
+ public const TARGET_CLASS_CONSTANT = 16;
11
+ public const TARGET_PARAMETER = 32;
12
+ public const TARGET_ALL = 63;
13
+ public const IS_REPEATABLE = 64;
14
+
15
+ /** @var int */
16
+ public $flags;
17
+
18
+ public function __construct(int $flags = self::TARGET_ALL)
19
+ {
20
+ $this->flags = $flags;
21
+ }
22
+ }
vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (\PHP_VERSION_ID < 80000 && \extension_loaded('tokenizer')) {
4
+ class PhpToken extends Symfony\Polyfill\Php80\PhpToken
5
+ {
6
+ }
7
+ }
vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (\PHP_VERSION_ID < 80000) {
4
+ interface Stringable
5
+ {
6
+ /**
7
+ * @return string
8
+ */
9
+ public function __toString();
10
+ }
11
+ }
vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (\PHP_VERSION_ID < 80000) {
4
+ class UnhandledMatchError extends Error
5
+ {
6
+ }
7
+ }
vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (\PHP_VERSION_ID < 80000) {
4
+ class ValueError extends Error
5
+ {
6
+ }
7
+ }
vendor/symfony/polyfill-php80/bootstrap.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ use Symfony\Polyfill\Php80 as p;
13
+
14
+ if (\PHP_VERSION_ID >= 80000) {
15
+ return;
16
+ }
17
+
18
+ if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
19
+ define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
20
+ }
21
+
22
+ if (!function_exists('fdiv')) {
23
+ function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
24
+ }
25
+ if (!function_exists('preg_last_error_msg')) {
26
+ function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
27
+ }
28
+ if (!function_exists('str_contains')) {
29
+ function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
30
+ }
31
+ if (!function_exists('str_starts_with')) {
32
+ function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
33
+ }
34
+ if (!function_exists('str_ends_with')) {
35
+ function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
36
+ }
37
+ if (!function_exists('get_debug_type')) {
38
+ function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
39
+ }
40
+ if (!function_exists('get_resource_id')) {
41
+ function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
42
+ }