Post SMTP Mailer/Email Log - Version 1.8

Version Description

  • 2017-12-24
  • New: Mailgun API integration
  • New: New filter controls
  • New: WPML conflict fix
  • Fix: Minor old bugs
Download this release

Release Info

Developer yehudah
Plugin Icon 128x128 Post SMTP Mailer/Email Log
Version 1.8
Comparing to
See all releases

Code changes from version 1.7.10 to 1.8

Files changed (362) hide show
  1. Postman/Postman-Configuration/PostmanConfigurationController.php +7 -1
  2. Postman/Postman-Controller/PostmanWelcomeController.php +219 -0
  3. Postman/Postman-Email-Log/PostmanEmailLogController.php +17 -5
  4. Postman/Postman-Email-Log/PostmanEmailLogService.php +6 -4
  5. Postman/Postman-Email-Log/PostmanEmailLogView.php +15 -3
  6. Postman/Postman-Mail/PostmanMailgunMailEngine.php +260 -0
  7. Postman/Postman-Mail/PostmanMailgunTransport.php +248 -0
  8. Postman/Postman-Mail/PostmanMessage.php +2 -2
  9. Postman/Postman-Mail/PostmanTransportRegistry.php +97 -94
  10. Postman/Postman-Mail/mailgun/composer.json +7 -0
  11. Postman/Postman-Mail/mailgun/composer.lock +801 -0
  12. Postman/Postman-Mail/mailgun/mailgun.php +2 -0
  13. Postman/Postman-Mail/mailgun/vendor/autoload.php +7 -0
  14. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/.gitignore +2 -0
  15. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/.travis.yml +26 -0
  16. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/CHANGELOG.md +54 -0
  17. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/LICENSE +21 -0
  18. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/README.md +297 -0
  19. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/composer.json +23 -0
  20. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/examples/base64_decode.php +29 -0
  21. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/examples/base64_encode.php +21 -0
  22. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/examples/uppercase.php +9 -0
  23. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/phpunit.xml.dist +19 -0
  24. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/src/CallbackFilter.php +120 -0
  25. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/src/functions.php +146 -0
  26. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/tests/FilterTest.php +386 -0
  27. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/tests/FunTest.php +44 -0
  28. Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/tests/FunZlibTest.php +79 -0
  29. Postman/Postman-Mail/mailgun/vendor/composer/ClassLoader.php +413 -0
  30. Postman/Postman-Mail/mailgun/vendor/composer/LICENSE +433 -0
  31. Postman/Postman-Mail/mailgun/vendor/composer/autoload_classmap.php +9 -0
  32. Postman/Postman-Mail/mailgun/vendor/composer/autoload_files.php +12 -0
  33. Postman/Postman-Mail/mailgun/vendor/composer/autoload_namespaces.php +10 -0
  34. Postman/Postman-Mail/mailgun/vendor/composer/autoload_psr4.php +21 -0
  35. Postman/Postman-Mail/mailgun/vendor/composer/autoload_real.php +59 -0
  36. Postman/Postman-Mail/mailgun/vendor/composer/installed.json +812 -0
  37. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/CHANGELOG.md +110 -0
  38. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/LICENSE +19 -0
  39. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/README.md +739 -0
  40. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/composer.json +39 -0
  41. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/AppendStream.php +233 -0
  42. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/BufferStream.php +137 -0
  43. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/CachingStream.php +138 -0
  44. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/DroppingStream.php +42 -0
  45. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/FnStream.php +149 -0
  46. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/InflateStream.php +52 -0
  47. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/LazyOpenStream.php +39 -0
  48. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/LimitStream.php +155 -0
  49. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/MessageTrait.php +183 -0
  50. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/MultipartStream.php +153 -0
  51. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/NoSeekStream.php +22 -0
  52. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/PumpStream.php +165 -0
  53. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/Request.php +142 -0
  54. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/Response.php +132 -0
  55. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/ServerRequest.php +358 -0
  56. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/Stream.php +257 -0
  57. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php +149 -0
  58. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/StreamWrapper.php +121 -0
  59. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/UploadedFile.php +316 -0
  60. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/Uri.php +702 -0
  61. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/UriNormalizer.php +216 -0
  62. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/UriResolver.php +219 -0
  63. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/functions.php +828 -0
  64. Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/functions_include.php +6 -0
  65. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/CHANGELOG.md +174 -0
  66. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/LICENSE +17 -0
  67. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/README.md +197 -0
  68. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/composer.json +41 -0
  69. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/attachments.md +47 -0
  70. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/index.md +330 -0
  71. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/pagination.md +17 -0
  72. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Domain.php +266 -0
  73. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Event.php +38 -0
  74. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/HttpApi.php +235 -0
  75. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Message.php +170 -0
  76. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Pagination.php +83 -0
  77. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Route.php +157 -0
  78. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Stats.php +52 -0
  79. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Suppression.php +76 -0
  80. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Suppression/Bounce.php +113 -0
  81. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Suppression/Complaint.php +116 -0
  82. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Suppression/Unsubscribe.php +113 -0
  83. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Tag.php +128 -0
  84. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Webhook.php +160 -0
  85. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Assert.php +25 -0
  86. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/GenericHTTPError.php +39 -0
  87. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/InvalidCredentials.php +19 -0
  88. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/MissingEndpoint.php +19 -0
  89. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/MissingRequiredParameters.php +19 -0
  90. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/NoDomainsConfigured.php +19 -0
  91. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php +379 -0
  92. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Constants/Api.php +24 -0
  93. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Constants/ExceptionMessages.php +29 -0
  94. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception.php +19 -0
  95. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/HttpClientException.php +85 -0
  96. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/HttpServerException.php +33 -0
  97. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/HydrationException.php +16 -0
  98. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/InvalidArgumentException.php +19 -0
  99. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/UnknownErrorException.php +19 -0
  100. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/HttpClient/Plugin/History.php +45 -0
  101. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/HttpClient/Plugin/ReplaceUriPlugin.php +45 -0
  102. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/HttpClientConfigurator.php +185 -0
  103. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Hydrator/ArrayHydrator.php +42 -0
  104. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Hydrator/Hydrator.php +29 -0
  105. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Hydrator/ModelHydrator.php +50 -0
  106. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Hydrator/NoopHydrator.php +31 -0
  107. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Lists/OptInHandler.php +60 -0
  108. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Lists/README.md +116 -0
  109. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Mailgun.php +381 -0
  110. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/BatchMessage.php +154 -0
  111. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/Exceptions/InvalidParameter.php +16 -0
  112. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/Exceptions/InvalidParameterType.php +16 -0
  113. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/Exceptions/MissingRequiredMIMEParameters.php +16 -0
  114. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/Exceptions/TooManyParameters.php +16 -0
  115. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/MessageBuilder.php +529 -0
  116. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/README.md +138 -0
  117. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/ApiResponse.php +25 -0
  118. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/ConnectionResponse.php +72 -0
  119. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/CreateCredentialResponse.php +49 -0
  120. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/CreateResponse.php +119 -0
  121. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/CredentialResponse.php +77 -0
  122. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/CredentialResponseItem.php +97 -0
  123. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/DeleteCredentialResponse.php +83 -0
  124. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/DeleteResponse.php +67 -0
  125. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/DnsRecord.php +123 -0
  126. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/Domain.php +147 -0
  127. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/IndexResponse.php +78 -0
  128. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/ShowResponse.php +99 -0
  129. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/UpdateConnectionResponse.php +83 -0
  130. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/UpdateCredentialResponse.php +49 -0
  131. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Event/Event.php +505 -0
  132. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Event/EventResponse.php +57 -0
  133. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Message/SendResponse.php +74 -0
  134. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Message/ShowResponse.php +402 -0
  135. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/PaginationResponse.php +69 -0
  136. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/PagingProvider.php +44 -0
  137. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Action.php +57 -0
  138. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/CreateResponse.php +68 -0
  139. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/DeleteResponse.php +67 -0
  140. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/IndexResponse.php +77 -0
  141. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/ShowResponse.php +54 -0
  142. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/UpdateResponse.php +68 -0
  143. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Route.php +133 -0
  144. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Stats/AllResponse.php +77 -0
  145. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Stats/AllResponseItem.php +113 -0
  146. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Stats/TotalResponse.php +105 -0
  147. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Stats/TotalResponseItem.php +97 -0
  148. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/BaseResponse.php +69 -0
  149. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/Bounce.php +123 -0
  150. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/CreateResponse.php +19 -0
  151. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/DeleteResponse.php +19 -0
  152. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/IndexResponse.php +62 -0
  153. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/ShowResponse.php +19 -0
  154. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/Complaint.php +75 -0
  155. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/CreateResponse.php +19 -0
  156. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/DeleteResponse.php +19 -0
  157. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/IndexResponse.php +62 -0
  158. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/ShowResponse.php +19 -0
  159. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/CreateResponse.php +19 -0
  160. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/DeleteResponse.php +19 -0
  161. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/IndexResponse.php +62 -0
  162. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/ShowResponse.php +19 -0
  163. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/Unsubscribe.php +99 -0
  164. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/DeleteResponse.php +49 -0
  165. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/IndexResponse.php +60 -0
  166. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/ShowResponse.php +19 -0
  167. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/StatisticsResponse.php +131 -0
  168. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/Tag.php +73 -0
  169. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/UpdateResponse.php +49 -0
  170. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/BaseResponse.php +78 -0
  171. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/CreateResponse.php +17 -0
  172. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/DeleteResponse.php +17 -0
  173. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/IndexResponse.php +219 -0
  174. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/ShowResponse.php +56 -0
  175. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/UpdateResponse.php +17 -0
  176. Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/RequestBuilder.php +121 -0
  177. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/CHANGELOG.md +137 -0
  178. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/LICENSE +19 -0
  179. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/README.md +55 -0
  180. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/composer.json +43 -0
  181. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/BatchClient.php +73 -0
  182. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/BatchResult.php +181 -0
  183. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php +27 -0
  184. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/EmulatedHttpClient.php +27 -0
  185. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/BatchException.php +39 -0
  186. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/CircularRedirectionException.php +14 -0
  187. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/ClientErrorException.php +14 -0
  188. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php +14 -0
  189. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/LoopException.php +14 -0
  190. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php +14 -0
  191. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/ServerErrorException.php +14 -0
  192. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/FlexibleHttpClient.php +39 -0
  193. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpAsyncClientDecorator.php +29 -0
  194. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpAsyncClientEmulator.php +36 -0
  195. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientDecorator.php +29 -0
  196. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientEmulator.php +32 -0
  197. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPool.php +59 -0
  198. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php +45 -0
  199. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php +31 -0
  200. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php +41 -0
  201. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPoolItem.php +178 -0
  202. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientRouter.php +74 -0
  203. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpMethodsClient.php +205 -0
  204. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin.php +32 -0
  205. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php +77 -0
  206. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php +48 -0
  207. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php +38 -0
  208. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php +54 -0
  209. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php +36 -0
  210. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php +123 -0
  211. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/CookiePlugin.php +180 -0
  212. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php +140 -0
  213. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php +55 -0
  214. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php +45 -0
  215. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php +43 -0
  216. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php +41 -0
  217. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php +41 -0
  218. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HistoryPlugin.php +49 -0
  219. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/Journal.php +31 -0
  220. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php +54 -0
  221. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php +270 -0
  222. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php +47 -0
  223. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/RetryPlugin.php +122 -0
  224. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/PluginClient.php +179 -0
  225. Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/PluginClientFactory.php +62 -0
  226. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/.php_cs +9 -0
  227. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/.styleci.yml +4 -0
  228. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/CHANGELOG.md +163 -0
  229. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/LICENSE +19 -0
  230. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/README.md +44 -0
  231. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/composer.json +50 -0
  232. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/puli.json +242 -0
  233. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/Client.php +371 -0
  234. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/CurlPromise.php +108 -0
  235. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/MultiRunner.php +127 -0
  236. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/PromiseCore.php +224 -0
  237. Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/ResponseBuilder.php +21 -0
  238. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/CHANGELOG.md +186 -0
  239. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/LICENSE +19 -0
  240. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/README.md +46 -0
  241. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/composer.json +48 -0
  242. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/ClassDiscovery.php +207 -0
  243. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception.php +12 -0
  244. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/ClassInstantiationFailedException.php +14 -0
  245. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php +51 -0
  246. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/NotFoundException.php +16 -0
  247. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php +12 -0
  248. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/StrategyUnavailableException.php +15 -0
  249. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php +36 -0
  250. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/HttpClientDiscovery.php +36 -0
  251. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/MessageFactoryDiscovery.php +36 -0
  252. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/NotFoundException.php +14 -0
  253. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php +82 -0
  254. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php +23 -0
  255. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php +24 -0
  256. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php +91 -0
  257. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/StreamFactoryDiscovery.php +36 -0
  258. Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/UriFactoryDiscovery.php +36 -0
  259. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/CHANGELOG.md +72 -0
  260. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/LICENSE +20 -0
  261. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/README.md +57 -0
  262. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/composer.json +40 -0
  263. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/puli.json +12 -0
  264. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception.php +12 -0
  265. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception/HttpException.php +74 -0
  266. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception/NetworkException.php +14 -0
  267. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception/RequestException.php +43 -0
  268. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception/TransferException.php +14 -0
  269. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/HttpAsyncClient.php +27 -0
  270. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/HttpClient.php +28 -0
  271. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php +57 -0
  272. Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php +56 -0
  273. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/CHANGELOG.md +65 -0
  274. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/LICENSE +19 -0
  275. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/README.md +36 -0
  276. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/composer.json +27 -0
  277. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/puli.json +43 -0
  278. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/MessageFactory.php +12 -0
  279. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/RequestFactory.php +34 -0
  280. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/ResponseFactory.php +35 -0
  281. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/StreamFactory.php +25 -0
  282. Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/UriFactory.php +24 -0
  283. Postman/Postman-Mail/mailgun/vendor/php-http/message/CHANGELOG.md +139 -0
  284. Postman/Postman-Mail/mailgun/vendor/php-http/message/LICENSE +19 -0
  285. Postman/Postman-Mail/mailgun/vendor/php-http/message/README.md +61 -0
  286. Postman/Postman-Mail/mailgun/vendor/php-http/message/apigen.neon +6 -0
  287. Postman/Postman-Mail/mailgun/vendor/php-http/message/composer.json +60 -0
  288. Postman/Postman-Mail/mailgun/vendor/php-http/message/puli.json +111 -0
  289. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication.php +22 -0
  290. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/AutoBasicAuth.php +48 -0
  291. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/BasicAuth.php +44 -0
  292. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/Bearer.php +37 -0
  293. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/Chain.php +47 -0
  294. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/Matching.php +74 -0
  295. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/QueryParam.php +50 -0
  296. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/RequestConditional.php +47 -0
  297. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/Wsse.php +58 -0
  298. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Builder/ResponseBuilder.php +148 -0
  299. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Cookie.php +526 -0
  300. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/CookieJar.php +220 -0
  301. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/CookieUtil.php +53 -0
  302. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Decorator/MessageDecorator.php +133 -0
  303. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Decorator/RequestDecorator.php +88 -0
  304. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Decorator/ResponseDecorator.php +57 -0
  305. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Decorator/StreamDecorator.php +138 -0
  306. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/ChunkStream.php +39 -0
  307. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/CompressStream.php +42 -0
  308. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/DechunkStream.php +29 -0
  309. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/DecompressStream.php +42 -0
  310. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/DeflateStream.php +38 -0
  311. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/Filter/Chunk.php +30 -0
  312. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/FilteredStream.php +198 -0
  313. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/GzipDecodeStream.php +42 -0
  314. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/GzipEncodeStream.php +42 -0
  315. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/InflateStream.php +42 -0
  316. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Exception.php +10 -0
  317. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Exception/UnexpectedValueException.php +9 -0
  318. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Formatter.php +32 -0
  319. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Formatter/CurlCommandFormatter.php +80 -0
  320. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php +91 -0
  321. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Formatter/SimpleFormatter.php +42 -0
  322. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php +61 -0
  323. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php +53 -0
  324. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php +72 -0
  325. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/RequestMatcher.php +26 -0
  326. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php +35 -0
  327. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/RequestMatcher/RegexRequestMatcher.php +41 -0
  328. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/RequestMatcher/RequestMatcher.php +78 -0
  329. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Stream/BufferedStream.php +270 -0
  330. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php +36 -0
  331. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php +21 -0
  332. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php +37 -0
  333. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php +29 -0
  334. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php +22 -0
  335. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/UriFactory/SlimUriFactory.php +31 -0
  336. Postman/Postman-Mail/mailgun/vendor/php-http/message/src/filters.php +6 -0
  337. Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/CHANGELOG.md +60 -0
  338. Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/LICENSE +19 -0
  339. Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/README.md +37 -0
  340. Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/appveyor.yml +39 -0
  341. Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/composer.json +43 -0
  342. Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/src/ApacheMimetypeHelper.php +142 -0
  343. Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/src/CustomMimetypeHelper.php +51 -0
  344. Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/src/MimetypeHelper.php +27 -0
  345. Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/src/MultipartStreamBuilder.php +278 -0
  346. Postman/Postman-Mail/mailgun/vendor/php-http/promise/CHANGELOG.md +35 -0
  347. Postman/Postman-Mail/mailgun/vendor/php-http/promise/LICENSE +19 -0
  348. Postman/Postman-Mail/mailgun/vendor/php-http/promise/README.md +49 -0
  349. Postman/Postman-Mail/mailgun/vendor/php-http/promise/composer.json +35 -0
  350. Postman/Postman-Mail/mailgun/vendor/php-http/promise/src/FulfilledPromise.php +58 -0
  351. Postman/Postman-Mail/mailgun/vendor/php-http/promise/src/Promise.php +69 -0
  352. Postman/Postman-Mail/mailgun/vendor/php-http/promise/src/RejectedPromise.php +58 -0
  353. Postman/Postman-Mail/mailgun/vendor/psr/http-message/CHANGELOG.md +36 -0
  354. Postman/Postman-Mail/mailgun/vendor/psr/http-message/LICENSE +19 -0
  355. Postman/Postman-Mail/mailgun/vendor/psr/http-message/README.md +13 -0
  356. Postman/Postman-Mail/mailgun/vendor/psr/http-message/composer.json +26 -0
  357. Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/MessageInterface.php +187 -0
  358. Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/RequestInterface.php +129 -0
  359. Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/ResponseInterface.php +68 -0
  360. Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/ServerRequestInterface.php +261 -0
  361. Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/StreamInterface.php +158 -0
  362. Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/UploadedFileInterface.php +16 -0
Postman/Postman-Configuration/PostmanConfigurationController.php CHANGED
@@ -73,11 +73,15 @@ class PostmanConfigurationController {
73
  }
74
  // register the stylesheet and javascript external resources
75
  $pluginData = apply_filters( 'postman_get_plugin_metadata', null );
 
76
  wp_register_script( 'postman_manual_config_script', plugins_url( 'Postman/Postman-Configuration/postman_manual_config.js', $this->rootPluginFilenameAndPath ), array(
77
  PostmanViewController::JQUERY_SCRIPT,
 
 
78
  'jquery_validation',
79
  PostmanViewController::POSTMAN_SCRIPT,
80
  ), $pluginData ['version'] );
 
81
  wp_register_script( 'postman_wizard_script', plugins_url( 'Postman/Postman-Configuration/postman_wizard.js', $this->rootPluginFilenameAndPath ), array(
82
  PostmanViewController::JQUERY_SCRIPT,
83
  'jquery_validation',
@@ -145,7 +149,6 @@ class PostmanConfigurationController {
145
  wp_enqueue_style( PostmanViewController::POSTMAN_STYLE );
146
  wp_enqueue_style( 'jquery_ui_style' );
147
  wp_enqueue_script( 'postman_manual_config_script' );
148
- wp_enqueue_script( 'jquery-ui-tabs' );
149
  }
150
 
151
  /**
@@ -222,6 +225,9 @@ class PostmanConfigurationController {
222
  print '<div id="sendgrid_settings" class="authentication_setting non-basic non-oauth2">';
223
  do_settings_sections( PostmanSendGridTransport::SENDGRID_AUTH_OPTIONS );
224
  print '</div>';
 
 
 
225
  print '</section>';
226
  print '<section id="message_config">';
227
  do_settings_sections( PostmanAdminController::MESSAGE_SENDER_OPTIONS );
73
  }
74
  // register the stylesheet and javascript external resources
75
  $pluginData = apply_filters( 'postman_get_plugin_metadata', null );
76
+
77
  wp_register_script( 'postman_manual_config_script', plugins_url( 'Postman/Postman-Configuration/postman_manual_config.js', $this->rootPluginFilenameAndPath ), array(
78
  PostmanViewController::JQUERY_SCRIPT,
79
+ 'jquery-ui-core',
80
+ 'jquery-ui-tabs',
81
  'jquery_validation',
82
  PostmanViewController::POSTMAN_SCRIPT,
83
  ), $pluginData ['version'] );
84
+
85
  wp_register_script( 'postman_wizard_script', plugins_url( 'Postman/Postman-Configuration/postman_wizard.js', $this->rootPluginFilenameAndPath ), array(
86
  PostmanViewController::JQUERY_SCRIPT,
87
  'jquery_validation',
149
  wp_enqueue_style( PostmanViewController::POSTMAN_STYLE );
150
  wp_enqueue_style( 'jquery_ui_style' );
151
  wp_enqueue_script( 'postman_manual_config_script' );
 
152
  }
153
 
154
  /**
225
  print '<div id="sendgrid_settings" class="authentication_setting non-basic non-oauth2">';
226
  do_settings_sections( PostmanSendGridTransport::SENDGRID_AUTH_OPTIONS );
227
  print '</div>';
228
+ print '<div id="mailgun_settings" class="authentication_setting non-basic non-oauth2">';
229
+ do_settings_sections( PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS );
230
+ print '</div>';
231
  print '</section>';
232
  print '<section id="message_config">';
233
  do_settings_sections( PostmanAdminController::MESSAGE_SENDER_OPTIONS );
Postman/Postman-Controller/PostmanWelcomeController.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PostmanWelcomeController {
4
+
5
+ private $rootPluginFilenameAndPath, $pluginUrl, $version;
6
+
7
+ public function __construct( $rootPluginFilenameAndPath ) {
8
+ $this->rootPluginFilenameAndPath = $rootPluginFilenameAndPath;
9
+ $this->pluginUrl = plugins_url( 'style', $rootPluginFilenameAndPath );
10
+ $this->version = PostmanState::getInstance()->getVersion();
11
+
12
+ add_action( 'admin_menu', array( $this, 'add_menus' ) );
13
+ add_action( 'admin_head', array( $this, 'admin_head' ) );
14
+ }
15
+
16
+ public function add_menus() {
17
+
18
+ if ( current_user_can( 'manage_options' ) ) {
19
+
20
+ // About
21
+ add_dashboard_page(
22
+ __( 'Welcome', Postman::TEXT_DOMAIN ),
23
+ __( 'Welcome', Postman::TEXT_DOMAIN ),
24
+ 'manage_options',
25
+ 'post-about',
26
+ array( $this, 'about_screen' )
27
+ );
28
+
29
+ // Credits
30
+ add_dashboard_page(
31
+ __( 'Credits', Postman::TEXT_DOMAIN ),
32
+ __( 'Credits', Postman::TEXT_DOMAIN ),
33
+ 'manage_options',
34
+ 'post-credits',
35
+ array( $this, 'credits_screen' )
36
+ );
37
+
38
+ // add_action( 'admin_print_styles-' . $page, array( $this, 'postman_about_enqueue_resources' ) );
39
+ }
40
+ }
41
+
42
+ public function admin_head() {
43
+ remove_submenu_page( 'index.php', 'post-about' );
44
+ remove_submenu_page( 'index.php', 'post-credits' );
45
+ }
46
+
47
+ public function postman_about_enqueue_resources() {
48
+ // wp_enqueue_style( 'font-awsome', '' );
49
+ }
50
+
51
+
52
+ public function about_screen() {
53
+ ?>
54
+ <style type="text/css">
55
+ .post-badge {
56
+ position: absolute;
57
+ top: 0;
58
+ right: 0;
59
+ padding-top: 142px;
60
+ height: 50px;
61
+ width: 140px;
62
+ color: #000;
63
+ font-weight: bold;
64
+ font-size: 14px;
65
+ text-align: center;
66
+ margin: 0 -5px;
67
+ background: url( <?php echo $this->pluginUrl; ?>/images/badge.png) no-repeat;
68
+ }
69
+
70
+ .about-wrap [class$="-col"] {
71
+ flex-wrap: nowrap !important;
72
+ }
73
+ </style>
74
+ <div class="wrap about-wrap">
75
+ <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', Postman::TEXT_DOMAIN ), $this->version ); ?></h1>
76
+ <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! Post SMTP %s is bundled up and ready to take your SMTP needs to the next level!', Postman::TEXT_DOMAIN ), $this->version ); ?><br>
77
+ <?php printf( '<strong>%s</strong>','Post SMTP support every SMTP service: Gmail/G-suite, SendGrid, Mandrill, Office365, and more...' ); ?>
78
+ </div>
79
+ <div class="post-badge"><?php printf( esc_html__( 'Version %s', Postman::TEXT_DOMAIN ), $this->version ); ?></div>
80
+
81
+ <h2 class="nav-tab-wrapper">
82
+ <a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>">
83
+ <?php esc_html_e( 'What&#8217;s New', Postman::TEXT_DOMAIN ); ?>
84
+ </a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>">
85
+ <?php esc_html_e( 'Credits', Postman::TEXT_DOMAIN ); ?>
86
+ </a>
87
+ </h2>
88
+
89
+ <div class="changelog">
90
+ <h3><?php esc_html_e( 'Email Log', Postman::TEXT_DOMAIN ); ?></h3>
91
+
92
+ <div class="feature-section col two-col">
93
+ <div class="last-feature">
94
+ <h4><?php esc_html_e( 'Email log filter', Postman::TEXT_DOMAIN ); ?></h4>
95
+ <p>
96
+ <?php esc_html_e( 'You can easily filter by dates and search in your log.', Postman::TEXT_DOMAIN ); ?>
97
+ <img src="<?php echo $this->pluginUrl; ?>/images/filter-preview.gif">
98
+ </p>
99
+ </div>
100
+
101
+ <div>
102
+ <h4><?php esc_html_e( 'Multiple emails resend', Postman::TEXT_DOMAIN ); ?></h4>
103
+ <p>
104
+ <?php esc_html_e( 'Resend any email to the original recipient or any other emails you choose.', Postman::TEXT_DOMAIN ); ?>
105
+ <img src="<?php echo $this->pluginUrl; ?>/images/resend-preview.gif">
106
+ </p>
107
+ </div>
108
+ </div>
109
+ </div>
110
+
111
+ <div class="changelog">
112
+ <h3><?php esc_html_e( 'The best delivery experience', Postman::TEXT_DOMAIN ); ?></h3>
113
+
114
+ <div class="feature-section col one-col">
115
+ <div class="last-feature">
116
+ <p><?php esc_html_e( 'Easy-to-use, powerful Setup Wizard for perfect configuration,
117
+ Commercial-grade Connectivity Tester to diagnose server issues,
118
+ Log and resend all emails; see the exact cause of failed emails,
119
+ Supports International alphabets, HTML Mail and MultiPart/Alternative,
120
+ Supports forced recipients (cc, bcc, to) and custom email headers,
121
+ SASL Support: Plain/Login/CRAM-MD5/XOAUTH2 authentication,
122
+ Security Support: SMTPS and STARTTLS (SSL/TLS),
123
+ Copy configuration to other instances of Post.', Postman::TEXT_DOMAIN ); ?></p>
124
+ </div>
125
+ </div>
126
+
127
+ <div class="feature-section col three-col">
128
+ <div>
129
+ <h4><?php esc_html_e( 'Email log HTML preview', Postman::TEXT_DOMAIN ); ?></h4>
130
+ <p><?php esc_html_e( 'You can now see sent emails as HTML.', Postman::TEXT_DOMAIN ); ?></p>
131
+ </div>
132
+
133
+ <div>
134
+ <h4><?php esc_html_e( 'Continues email delivery', Postman::TEXT_DOMAIN ); ?></h4>
135
+ <p><?php esc_html_e( 'if email fail to sent you will get notified using the local mail system.', Postman::TEXT_DOMAIN ); ?></p>
136
+ </div>
137
+
138
+ <div class="last-feature">
139
+ <h4><?php esc_html_e( 'The best debugging tools.', Postman::TEXT_DOMAIN ); ?></h4>
140
+ <p><?php esc_html_e( 'Full Transcripts, Connectivity Test, Diagnostic Test.', Postman::TEXT_DOMAIN ); ?></p>
141
+ </div>
142
+ </div>
143
+ </div>
144
+
145
+ <div class="return-to-dashboard">
146
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', Postman::TEXT_DOMAIN ); ?></a>
147
+ </div>
148
+
149
+ </div>
150
+
151
+ <?php
152
+ }
153
+
154
+ public function credits_screen() {
155
+ ?>
156
+ <style type="text/css">
157
+ .post-badge {
158
+ position: absolute;
159
+ top: 0;
160
+ right: 0;
161
+ padding-top: 142px;
162
+ height: 50px;
163
+ width: 140px;
164
+ color: #000;
165
+ font-weight: bold;
166
+ font-size: 14px;
167
+ text-align: center;
168
+ margin: 0 -5px;
169
+ background: url( <?php echo $this->pluginUrl; ?>/images/badge.png) no-repeat;
170
+ }
171
+ </style>
172
+ <div class="wrap about-wrap">
173
+ <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', Postman::TEXT_DOMAIN ), $this->version ); ?></h1>
174
+ <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! bbPress %s is waxed, polished, and ready for you to take it for a lap or two around the block!', Postman::TEXT_DOMAIN ), $this->version ); ?></div>
175
+ <div class="post-badge"><?php printf( esc_html__( 'Version %s', Postman::TEXT_DOMAIN ), $this->version ); ?></div>
176
+
177
+ <h2 class="nav-tab-wrapper">
178
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>" class="nav-tab">
179
+ <?php esc_html_e( 'What&#8217;s New', Postman::TEXT_DOMAIN ); ?>
180
+ </a><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active">
181
+ <?php esc_html_e( 'Credits', Postman::TEXT_DOMAIN ); ?>
182
+ </a>
183
+ </h2>
184
+
185
+ <p class="about-description"><?php esc_html_e( 'Post SMTP started by Jason Hendriks, Jason left the project and Yehuda Hassine (me) continue his work.', Postman::TEXT_DOMAIN ); ?></p>
186
+
187
+ <h4 class="wp-people-group"><?php esc_html_e( 'Project Leaders', Postman::TEXT_DOMAIN ); ?></h4>
188
+ <ul class="wp-people-group " id="wp-people-group-project-leaders">
189
+ <li class="wp-person" id="wp-person-jasonhendriks">
190
+ <a href="https://profiles.wordpress.org/jasonhendriks"><img src="https://secure.gravatar.com/avatar/8692c7b6084517a592f6cad107f7bcb0?s=60&d=mm&r=g" class="gravatar" alt="Jason Hendriks " /></a>
191
+ <a class="web" href="http://profiles.wordpress.org/matt">Jason Hendriks</a>
192
+ <span class="title"><?php esc_html_e( 'Founding Developer (abandoned)', Postman::TEXT_DOMAIN ); ?></span>
193
+ </li>
194
+ <li class="wp-person" id="wp-person-yehudah">
195
+ <a href="http://profiles.wordpress.org/yehudah"><img src="https://secure.gravatar.com/avatar/c561638d04ea8fef351f974dbb9ece39?s=60&d=mm&r=g" class="gravatar" alt="Yehuda Hassine" /></a>
196
+ <a class="web" href="http://profiles.wordpress.org/yehudah">Yehuda Hassine</a>
197
+ <span class="title"><?php esc_html_e( 'Lead Developer', Postman::TEXT_DOMAIN ); ?></span>
198
+ </li>
199
+ </ul>
200
+
201
+ <h4 class="wp-people-group"><?php esc_html_e( 'Top Community Members', Postman::TEXT_DOMAIN ); ?></h4>
202
+ <h5><?php esc_html_e( 'Here I will list top users that help Post SMTP grow (bugs, features, etc...)', Postman::TEXT_DOMAIN ); ?>
203
+ <p class="wp-credits-list">
204
+ <a href="http://profiles.wordpress.org/diegocanal">diegocanal</a>,
205
+ <a href="http://profiles.wordpress.org/jyourstone">Johan Yourstone</a>,
206
+ <a href="http://profiles.wordpress.org/bodhirayo">bodhirayo</a>,
207
+ <a href="http://profiles.wordpress.org/buzztone">Neil Murray </a>,
208
+ <a href="#">A place waiting for you? :-) </a>
209
+ </p>
210
+
211
+ <div class="return-to-dashboard">
212
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', Postman::TEXT_DOMAIN ); ?></a>
213
+ </div>
214
+
215
+ </div>
216
+
217
+ <?php
218
+ }
219
+ }
Postman/Postman-Email-Log/PostmanEmailLogController.php CHANGED
@@ -360,10 +360,12 @@ class PostmanEmailLogController {
360
  $from_date = isset( $_POST['from_date'] ) ? sanitize_text_field( $_POST['from_date'] ) : '';
361
  $to_date = isset( $_POST['to_date'] ) ? sanitize_text_field( $_POST['to_date'] ) : '';
362
  $search = isset( $_POST['search'] ) ? sanitize_text_field( $_POST['search'] ) : '';
 
 
363
  ?>
364
 
365
  <form id="postman-email-log-filter" method="post">
366
- <div id="email-log-filter">
367
  <div class="form-control">
368
  <label for="from_date"><?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?></label>
369
  <input id="from_date" class="email-log-date" value="<?php echo $from_date; ?>" type="text" name="from_date" placeholder="<?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?>">
@@ -377,12 +379,22 @@ class PostmanEmailLogController {
377
  <input id="search" type="text" name="search" value="<?php echo $search; ?>" placeholder="<?php _e( 'Search', Postman::TEXT_DOMAIN ); ?>">
378
  </div>
379
  <div class="form-control">
 
 
 
 
 
 
 
 
 
 
 
380
  <button type="submit" name="filter" class="button button-primary"><?php _e( 'Filter', Postman::TEXT_DOMAIN ); ?></button>
381
- </div>
382
-
383
  <div class="form-control">
384
- <!-- <button type="submit" name="export_email_logs" class="button button-primary">Export To CSV</button> -->
385
- </div>
386
  </div>
387
  <div class="error">Please notice: when you select a date for example 11/20/2017, behind the scene the query select <b>11/20/2017 00:00:00</b>.<br>So if you searching for an email arrived that day at any hour you need to select 11/20/2017 as the <b>From Date</b> and 11/21/2017 as the <b>To Date</b>.</div>
388
  </form>
360
  $from_date = isset( $_POST['from_date'] ) ? sanitize_text_field( $_POST['from_date'] ) : '';
361
  $to_date = isset( $_POST['to_date'] ) ? sanitize_text_field( $_POST['to_date'] ) : '';
362
  $search = isset( $_POST['search'] ) ? sanitize_text_field( $_POST['search'] ) : '';
363
+ $page_records = apply_filters( 'postman_log_per_page', array( 10, 15, 25, 50, 75, 100 ) );
364
+ $postman_page_records = isset( $_POST['postman_page_records'] ) ? absint( $_POST['postman_page_records'] ) : '';
365
  ?>
366
 
367
  <form id="postman-email-log-filter" method="post">
368
+ <div id="email-log-filter" class="postman-log-row">
369
  <div class="form-control">
370
  <label for="from_date"><?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?></label>
371
  <input id="from_date" class="email-log-date" value="<?php echo $from_date; ?>" type="text" name="from_date" placeholder="<?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?>">
379
  <input id="search" type="text" name="search" value="<?php echo $search; ?>" placeholder="<?php _e( 'Search', Postman::TEXT_DOMAIN ); ?>">
380
  </div>
381
  <div class="form-control">
382
+ <label id="postman_page_records"><?php _e( 'Records per page', Postman::TEXT_DOMAIN ); ?></label>
383
+ <select id="postman_page_records" name="postman_page_records">
384
+ <?php
385
+ foreach ( $page_records as $value ) {
386
+ $selected = selected( $postman_page_records, $value, false );
387
+ echo '<option value="' . $value . '"' . $selected . '>' . $value . '</option>';
388
+ }
389
+ ?>
390
+ </select>
391
+ </div>
392
+ <div class="form-control" style="padding: 0 5px 0 5px;">
393
  <button type="submit" name="filter" class="button button-primary"><?php _e( 'Filter', Postman::TEXT_DOMAIN ); ?></button>
394
+ </div>
 
395
  <div class="form-control">
396
+ <button type="submit" id="postman_trash_all" name="postman_trash_all" class="button button-primary"><?php _e( 'Trash All', Postman::TEXT_DOMAIN ); ?></button>
397
+ </div>
398
  </div>
399
  <div class="error">Please notice: when you select a date for example 11/20/2017, behind the scene the query select <b>11/20/2017 00:00:00</b>.<br>So if you searching for an email arrived that day at any hour you need to select 11/20/2017 as the <b>From Date</b> and 11/21/2017 as the <b>To Date</b>.</div>
400
  </form>
Postman/Postman-Email-Log/PostmanEmailLogService.php CHANGED
@@ -234,10 +234,10 @@ if ( ! class_exists( 'PostmanEmailLogPurger' ) ) {
234
  *
235
  * @return unknown
236
  */
237
- function __construct() {
238
  $this->logger = new PostmanLogger( get_class( $this ) );
239
- $args = array(
240
- 'posts_per_page' => 1000,
241
  'offset' => 0,
242
  'category' => '',
243
  'category_name' => '',
@@ -253,7 +253,9 @@ if ( ! class_exists( 'PostmanEmailLogPurger' ) ) {
253
  'post_status' => 'private',
254
  'suppress_filters' => true,
255
  );
256
- $this->posts = get_posts( $args );
 
 
257
  }
258
 
259
  /**
234
  *
235
  * @return unknown
236
  */
237
+ function __construct( $args = array() ) {
238
  $this->logger = new PostmanLogger( get_class( $this ) );
239
+ $defaults = array(
240
+ 'posts_per_page' => -1,
241
  'offset' => 0,
242
  'category' => '',
243
  'category_name' => '',
253
  'post_status' => 'private',
254
  'suppress_filters' => true,
255
  );
256
+ $args = wp_parse_args( $args, $defaults );
257
+ $query = new WP_Query( $args );
258
+ $this->posts = $query->posts;
259
  }
260
 
261
  /**
Postman/Postman-Email-Log/PostmanEmailLogView.php CHANGED
@@ -260,7 +260,7 @@ class PostmanEmailLogView extends WP_List_Table {
260
  /**
261
  * First, lets decide how many records per page to show
262
  */
263
- $per_page = 10;
264
 
265
  /**
266
  * REQUIRED.
@@ -305,9 +305,9 @@ class PostmanEmailLogView extends WP_List_Table {
305
  * be able to use your precisely-queried data immediately.
306
  */
307
  $data = array();
 
308
  $args = array(
309
- 'posts_per_page' => 1000,
310
- 'offset' => 0,
311
  'orderby' => 'date',
312
  'order' => 'DESC',
313
  'post_type' => PostmanEmailLogPostType::POSTMAN_CUSTOM_POST_TYPE_SLUG,
@@ -339,7 +339,19 @@ class PostmanEmailLogView extends WP_List_Table {
339
  $args['s'] = sanitize_text_field( $_POST['search'] );
340
  }
341
 
 
 
 
342
  $posts = new WP_query( $args );
 
 
 
 
 
 
 
 
 
343
  $date_format = get_option( 'date_format' );
344
  $time_format = get_option( 'time_format' );
345
 
260
  /**
261
  * First, lets decide how many records per page to show
262
  */
263
+ $per_page = isset( $_POST['postman_page_records'] ) ? absint( $_POST['postman_page_records'] ) : 10;
264
 
265
  /**
266
  * REQUIRED.
305
  * be able to use your precisely-queried data immediately.
306
  */
307
  $data = array();
308
+
309
  $args = array(
310
+ 'posts_per_page' => -1,
 
311
  'orderby' => 'date',
312
  'order' => 'DESC',
313
  'post_type' => PostmanEmailLogPostType::POSTMAN_CUSTOM_POST_TYPE_SLUG,
339
  $args['s'] = sanitize_text_field( $_POST['search'] );
340
  }
341
 
342
+ if ( isset( $_POST['postman_trash_all'] ) ) {
343
+ $args['posts_per_page'] = -1;
344
+ }
345
  $posts = new WP_query( $args );
346
+
347
+ if ( isset( $_POST['postman_trash_all'] ) ) {
348
+ foreach ( $posts->posts as $post ) {
349
+ wp_delete_post( $post->ID, true );
350
+ }
351
+
352
+ $posts->posts = array();
353
+ }
354
+
355
  $date_format = get_option( 'date_format' );
356
  $time_format = get_option( 'time_format' );
357
 
Postman/Postman-Mail/PostmanMailgunMailEngine.php ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'mailgun/mailgun.php';
3
+ use Mailgun\Mailgun;
4
+
5
+ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) {
6
+
7
+ /**
8
+ * Sends mail with the SendGrid API
9
+ * https://sendgrid.com/docs/API_Reference/Web_API/mail.html
10
+ *
11
+ * @author jasonhendriks
12
+ */
13
+ class PostmanMailgunMailEngine implements PostmanMailEngine {
14
+
15
+ // logger for all concrete classes - populate with setLogger($logger)
16
+ protected $logger;
17
+
18
+ // the result
19
+ private $transcript;
20
+
21
+ private $apiKey;
22
+ private $domainName;
23
+ private $mandrillMessage;
24
+
25
+ /**
26
+ *
27
+ * @param unknown $senderEmail
28
+ * @param unknown $accessToken
29
+ */
30
+ function __construct( $apiKey, $domainName ) {
31
+ assert( ! empty( $apiKey ) );
32
+ $this->apiKey = $apiKey;
33
+ $this->domainName = $domainName;
34
+
35
+ // create the logger
36
+ $this->logger = new PostmanLogger( get_class( $this ) );
37
+ $this->mailgunMessage = array(
38
+ 'from' => '',
39
+ 'to' => '',
40
+ 'subject' => '',
41
+ );
42
+ }
43
+
44
+ /**
45
+ * (non-PHPdoc)
46
+ *
47
+ * @see PostmanSmtpEngine::send()
48
+ */
49
+ public function send( PostmanMessage $message ) {
50
+ $options = PostmanOptions::getInstance();
51
+
52
+ // add the Postman signature - append it to whatever the user may have set
53
+ if ( ! $options->isStealthModeEnabled() ) {
54
+ $pluginData = apply_filters( 'postman_get_plugin_metadata', null );
55
+ $this->addHeader( 'X-Mailer', sprintf( 'Postman SMTP %s for WordPress (%s)', $pluginData ['version'], 'https://wordpress.org/plugins/post-smtp/' ) );
56
+ }
57
+
58
+ // add the headers - see http://framework.zend.com/manual/1.12/en/zend.mail.additional-headers.html
59
+ foreach ( ( array ) $message->getHeaders() as $header ) {
60
+ $this->logger->debug( sprintf( 'Adding user header %s=%s', $header ['name'], $header ['content'] ) );
61
+ $this->addHeader( $header ['name'], $header ['content'], true );
62
+ }
63
+
64
+ // if the caller set a Content-Type header, use it
65
+ $contentType = $message->getContentType();
66
+ if ( ! empty( $contentType ) ) {
67
+ $this->logger->debug( 'Adding content-type ' . $contentType );
68
+ $this->addHeader( 'Content-Type', $contentType );
69
+ }
70
+
71
+ // add the From Header
72
+ $sender = $message->getFromAddress();
73
+ {
74
+ $senderEmail = PostmanOptions::getInstance()->getMessageSenderEmail();
75
+ $senderName = $sender->getName();
76
+ assert( ! empty( $senderEmail ) );
77
+
78
+ $senderText = ! empty( $senderName ) ? $senderName : $senderEmail;
79
+ $this->mailgunMessage ['from'] = "{$senderText} <{$senderEmail}>";
80
+ // now log it
81
+ $sender->log( $this->logger, 'From' );
82
+ }
83
+
84
+ // add the Sender Header, overriding what the user may have set
85
+ $this->addHeader( 'Sender', $options->getEnvelopeSender() );
86
+
87
+ // add the to recipients
88
+ $recipients = array();
89
+ foreach ( ( array ) $message->getToRecipients() as $recipient ) {
90
+ $recipient->log( $this->logger, 'To' );
91
+ $recipients[] = $recipient->getEmail();
92
+ }
93
+ $this->mailgunMessage['to'] = $recipients;
94
+
95
+ // add the cc recipients
96
+ $recipients = array();
97
+ foreach ( ( array ) $message->getCcRecipients() as $recipient ) {
98
+ $recipient->log( $this->logger, 'Cc' );
99
+ $recipients[] = $recipient->getEmail();
100
+ }
101
+ $this->mailgunMessage['cc'] = implode( ',', $recipients );
102
+
103
+ // add the bcc recipients
104
+ $recipients = array();
105
+ foreach ( ( array ) $message->getBccRecipients() as $recipient ) {
106
+ $recipient->log( $this->logger, 'Bcc' );
107
+ $recipients[] = $recipient->getEmail();
108
+ }
109
+ $this->mailgunMessage['bcc'] = implode( ',', $recipients );
110
+
111
+ // add the reply-to
112
+ $replyTo = $message->getReplyTo();
113
+ // $replyTo is null or a PostmanEmailAddress object
114
+ if ( isset( $replyTo ) ) {
115
+ $this->addHeader( 'reply-to', $replyTo->format() );
116
+ }
117
+
118
+ // add the date
119
+ $date = $message->getDate();
120
+ if ( ! empty( $date ) ) {
121
+ $this->addHeader( 'date', $message->getDate() );
122
+ }
123
+
124
+ // add the messageId
125
+ $messageId = $message->getMessageId();
126
+ if ( ! empty( $messageId ) ) {
127
+ $this->addHeader( 'message-id', $messageId );
128
+ }
129
+
130
+ // add the subject
131
+ if ( null !== $message->getSubject() ) {
132
+ $this->mailgunMessage ['subject'] = $message->getSubject();
133
+ }
134
+
135
+ // add the message content
136
+ {
137
+ $textPart = $message->getBodyTextPart();
138
+ if ( ! empty( $textPart ) ) {
139
+ $this->logger->debug( 'Adding body as text' );
140
+ $this->mailgunMessage ['text'] = $textPart;
141
+ }
142
+ $htmlPart = $message->getBodyHtmlPart();
143
+ if ( ! empty( $htmlPart ) ) {
144
+ $this->logger->debug( 'Adding body as html' );
145
+ $this->mailgunMessage ['html'] = $htmlPart;
146
+ }
147
+ }
148
+
149
+ // add attachments
150
+ $this->logger->debug( 'Adding attachments' );
151
+ $this->addAttachmentsToMail( $message );
152
+
153
+ $result = array();
154
+ try {
155
+ if ( $this->logger->isDebug() ) {
156
+ $this->logger->debug( 'Creating Mandrill service with apiKey=' . $this->apiKey );
157
+ }
158
+
159
+ // send the message
160
+ if ( $this->logger->isDebug() ) {
161
+ $this->logger->debug( 'Sending mail' );
162
+ }
163
+
164
+ $mg = Mailgun::create( $this->apiKey );
165
+
166
+ // Make the call to the client.
167
+ $result = $this->processSend( $mg );
168
+
169
+ if ( $this->logger->isInfo() ) {
170
+ $this->logger->info( sprintf( 'Message %d accepted for delivery', PostmanState::getInstance()->getSuccessfulDeliveries() + 1 ) );
171
+ }
172
+
173
+ $this->transcript = print_r( $result, true );
174
+ $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
175
+ $this->transcript .= print_r( $this->mailgunMessage, true );
176
+ } catch ( Exception $e ) {
177
+ $this->transcript = $e->getMessage();
178
+ $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
179
+ $this->transcript .= print_r( $this->mailgunMessage, true );
180
+ throw $e;
181
+ }
182
+ }
183
+
184
+
185
+ private function processSend( $mg ) {
186
+
187
+ if ( count( $this->mailgunMessage['to'] ) == 1 ) {
188
+
189
+ return $mg->messages()->send( $this->domainName, array_filter( $this->mailgunMessage ) );
190
+ } else {
191
+ $chunks = array_chunk( $this->mailgunMessage['to'], 1000, true );
192
+
193
+ $result = array();
194
+ foreach ( $chunks as $key => $emails ) {
195
+ $this->mailgunMessage['to'] = $emails;
196
+ $recipient_variables = $this->getRecipientVariables( $emails );
197
+ $this->mailgunMessage['recipient-variables'] = $recipient_variables;
198
+
199
+ $result[] = $mg->messages()->send( $this->domainName, array_filter( $this->mailgunMessage ) );
200
+
201
+ // Don't have a reason just wait a bit before sending the next chunk
202
+ sleep(2);
203
+ }
204
+
205
+ return $result;
206
+ }
207
+ }
208
+
209
+ private function getRecipientVariables( $emails ) {
210
+ $recipient_variables = array();
211
+ foreach ( $emails as $key => $email ) {
212
+ $recipient_variables[$email] = array( 'id' => $key );
213
+ }
214
+
215
+ return json_encode( $recipient_variables );
216
+ }
217
+
218
+ private function addHeader( $name, $value, $deprecated = '' ) {
219
+ if ( $value && ! empty( $value ) ) {
220
+ $this->mailgunMessage['h:' . $name] = $value;
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Add attachments to the message
226
+ *
227
+ * @param Postman_Zend_Mail $mail
228
+ */
229
+ private function addAttachmentsToMail( PostmanMessage $message ) {
230
+ $attachments = $message->getAttachments();
231
+ if ( ! is_array( $attachments ) ) {
232
+ // WordPress may a single filename or a newline-delimited string list of multiple filenames
233
+ $attArray[] = explode( PHP_EOL, $attachments );
234
+ } else {
235
+ $attArray = $attachments;
236
+ }
237
+
238
+ $attachments = array();
239
+ foreach ( $attArray as $file ) {
240
+ if ( ! empty( $file ) ) {
241
+ $this->logger->debug( 'Adding attachment: ' . $file );
242
+ $attachments[] = array( 'filePath' => $file );
243
+ }
244
+ }
245
+
246
+ if ( ! empty( $attachments ) ) {
247
+ if ( $this->logger->isTrace() ) {
248
+ $this->logger->trace( $attachments );
249
+ }
250
+ $this->mailgunMessage['attachment'] = $attachments;
251
+ }
252
+ }
253
+
254
+ // return the SMTP session transcript
255
+ public function getTranscript() {
256
+ return $this->transcript;
257
+ }
258
+ }
259
+ }
260
+
Postman/Postman-Mail/PostmanMailgunTransport.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'PostmanModuleTransport.php';
3
+ /**
4
+ * Postman Mailgun module
5
+ *
6
+ * @author jasonhendriks
7
+ */
8
+ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements PostmanModuleTransport {
9
+ const SLUG = 'mailgun_api';
10
+ const PORT = 443;
11
+ const HOST = 'api.mailgun.net';
12
+ const PRIORITY = 8000;
13
+ const MAILGUN_AUTH_OPTIONS = 'postman_mailgun_auth_options';
14
+ const MAILGUN_AUTH_SECTION = 'postman_mailgun_auth_section';
15
+
16
+ /**
17
+ *
18
+ * @param unknown $rootPluginFilenameAndPath
19
+ */
20
+ public function __construct( $rootPluginFilenameAndPath ) {
21
+ parent::__construct( $rootPluginFilenameAndPath );
22
+
23
+ // add a hook on the plugins_loaded event
24
+ add_action( 'admin_init', array(
25
+ $this,
26
+ 'on_admin_init',
27
+ ) );
28
+ }
29
+ public function getProtocol() {
30
+ return 'https';
31
+ }
32
+
33
+ // this should be standard across all transports
34
+ public function getSlug() {
35
+ return self::SLUG;
36
+ }
37
+ public function getName() {
38
+ return __( 'Mailgun API', Postman::TEXT_DOMAIN );
39
+ }
40
+ /**
41
+ * v0.2.1
42
+ *
43
+ * @return string
44
+ */
45
+ public function getHostname() {
46
+ return self::HOST;
47
+ }
48
+ /**
49
+ * v0.2.1
50
+ *
51
+ * @return string
52
+ */
53
+ public function getPort() {
54
+ return self::PORT;
55
+ }
56
+ /**
57
+ * v1.7.0
58
+ *
59
+ * @return string
60
+ */
61
+ public function getTransportType() {
62
+ return 'Mailgun_api';
63
+ }
64
+
65
+ /**
66
+ * (non-PHPdoc)
67
+ *
68
+ * @see PostmanModuleTransport::createMailEngine()
69
+ */
70
+ public function createMailEngine() {
71
+ $apiKey = $this->options->getMailgunApiKey();
72
+ $domainName = $this->options->getMailgunDomainName();
73
+
74
+ require_once 'PostmanMailgunMailEngine.php';
75
+ $engine = new PostmanMailgunMailEngine( $apiKey, $domainName );
76
+ return $engine;
77
+ }
78
+ public function getDeliveryDetails() {
79
+ /* translators: where (1) is the secure icon and (2) is the transport name */
80
+ return sprintf( __( 'Post SMTP will send mail via the <b>%1$s %2$s</b>.', Postman::TEXT_DOMAIN ), '🔐', $this->getName() );
81
+ }
82
+
83
+ /**
84
+ *
85
+ * @param unknown $data
86
+ */
87
+ public function prepareOptionsForExport( $data ) {
88
+ $data = parent::prepareOptionsForExport( $data );
89
+ $data [ PostmanOptions::MAILGUN_API_KEY ] = PostmanOptions::getInstance()->getMailgunApiKey();
90
+ return $data;
91
+ }
92
+
93
+ /**
94
+ * (non-PHPdoc)
95
+ *
96
+ * @see PostmanTransport::getMisconfigurationMessage()
97
+ */
98
+ protected function validateTransportConfiguration() {
99
+ $messages = parent::validateTransportConfiguration();
100
+ $apiKey = $this->options->getMailgunApiKey();
101
+ $domainName = $this->options->getMailgunDomainName();
102
+
103
+ if ( empty( $apiKey ) ) {
104
+ array_push( $messages, __( 'API Key can not be empty', Postman::TEXT_DOMAIN ) . '.' );
105
+ $this->setNotConfiguredAndReady();
106
+ }
107
+
108
+ if ( empty( $domainName ) ) {
109
+ array_push( $messages, __( 'Domain Name can not be empty', Postman::TEXT_DOMAIN ) . '.' );
110
+ $this->setNotConfiguredAndReady();
111
+ }
112
+
113
+ if ( ! $this->isSenderConfigured() ) {
114
+ array_push( $messages, __( 'Message From Address can not be empty', Postman::TEXT_DOMAIN ) . '.' );
115
+ $this->setNotConfiguredAndReady();
116
+ }
117
+ return $messages;
118
+ }
119
+
120
+ /**
121
+ * (non-PHPdoc)
122
+ *
123
+ * @see PostmanModuleTransport::getConfigurationBid()
124
+ */
125
+ public function getConfigurationBid( PostmanWizardSocket $hostData, $userAuthOverride, $originalSmtpServer ) {
126
+ $recommendation = array();
127
+ $recommendation ['priority'] = 0;
128
+ $recommendation ['transport'] = self::SLUG;
129
+ $recommendation ['hostname'] = null; // scribe looks this
130
+ $recommendation ['label'] = $this->getName();
131
+ if ( $hostData->hostname == self::HOST && $hostData->port == self::PORT ) {
132
+ $recommendation ['priority'] = self::PRIORITY;
133
+ /* translators: where variables are (1) transport name (2) host and (3) port */
134
+ $recommendation ['message'] = sprintf( __( ('Postman recommends the %1$s to host %2$s on port %3$d.') ), $this->getName(), self::HOST, self::PORT );
135
+ }
136
+ return $recommendation;
137
+ }
138
+
139
+ /**
140
+ *
141
+ * @param unknown $hostname
142
+ * @param unknown $response
143
+ */
144
+ public function populateConfiguration( $hostname ) {
145
+ $response = parent::populateConfiguration( $hostname );
146
+ return $response;
147
+ }
148
+
149
+ /**
150
+ */
151
+ public function createOverrideMenu( PostmanWizardSocket $socket, $winningRecommendation, $userSocketOverride, $userAuthOverride ) {
152
+ $overrideItem = parent::createOverrideMenu( $socket, $winningRecommendation, $userSocketOverride, $userAuthOverride );
153
+ // push the authentication options into the $overrideItem structure
154
+ $overrideItem ['auth_items'] = array(
155
+ array(
156
+ 'selected' => true,
157
+ 'name' => __( 'API Key', Postman::TEXT_DOMAIN ),
158
+ 'value' => 'api_key',
159
+ ),
160
+ );
161
+ return $overrideItem;
162
+ }
163
+
164
+ /**
165
+ * Functions to execute on the admin_init event
166
+ *
167
+ * "Runs at the beginning of every admin page before the page is rendered."
168
+ * ref: http://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_an_Admin_Page_Request
169
+ */
170
+ public function on_admin_init() {
171
+ // only administrators should be able to trigger this
172
+ if ( PostmanUtils::isAdmin() ) {
173
+ $this->addSettings();
174
+ $this->registerStylesAndScripts();
175
+ }
176
+ }
177
+
178
+ /*
179
+ * What follows in the code responsible for creating the Admin Settings page
180
+ */
181
+
182
+ /**
183
+ */
184
+ public function addSettings() {
185
+ // the Mailgun Auth section
186
+ add_settings_section( PostmanMailgunTransport::MAILGUN_AUTH_SECTION, __( 'Authentication', Postman::TEXT_DOMAIN ), array(
187
+ $this,
188
+ 'printMailgunAuthSectionInfo',
189
+ ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS );
190
+
191
+ add_settings_field( PostmanOptions::MAILGUN_API_KEY, __( 'API Key', Postman::TEXT_DOMAIN ), array(
192
+ $this,
193
+ 'mailgun_api_key_callback',
194
+ ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS, PostmanMailgunTransport::MAILGUN_AUTH_SECTION );
195
+
196
+ add_settings_field( PostmanOptions::MAILGUN_DOMAIN_NAME, __( 'Domain Name', Postman::TEXT_DOMAIN ), array(
197
+ $this,
198
+ 'mailgun_domain_name_callback',
199
+ ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS, PostmanMailgunTransport::MAILGUN_AUTH_SECTION );
200
+ }
201
+ public function printMailgunAuthSectionInfo() {
202
+ /* Translators: Where (1) is the service URL and (2) is the service name and (3) is a api key URL */
203
+ printf( '<p id="wizard_mailgun_auth_help">%s</p>', sprintf( __( 'Create an account at <a href="%1$s" target="_blank">%2$s</a> and enter <a href="%3$s" target="_blank">an API key</a> below.', Postman::TEXT_DOMAIN ), 'https://mailgun.com', 'mailgun.com', 'https://app.mailgun.com/app/domains/' ) );
204
+ }
205
+
206
+ /**
207
+ */
208
+ public function mailgun_api_key_callback() {
209
+ printf( '<input type="password" autocomplete="off" id="mailgun_api_key" name="postman_options[mailgun_api_key]" value="%s" size="60" class="required" placeholder="%s"/>', null !== $this->options->getMailgunApiKey() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getMailgunApiKey() ) ) : '', __( 'Required', Postman::TEXT_DOMAIN ) );
210
+ print '<input type="button" id="toggleMailgunApiKey" value="Show Password" class="button button-secondary" style="visibility:hidden" />';
211
+ }
212
+
213
+ function mailgun_domain_name_callback() {
214
+ printf( '<input type="text" autocomplete="off" id="mailgun_domain_name" name="postman_options[mailgun_domain_name]" value="%s" size="60" class="required" placeholder="%s"/>', null !== $this->options->getMailgunDomainName() ? esc_attr( $this->options->getMailgunDomainName() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) );
215
+ }
216
+
217
+ /**
218
+ */
219
+ public function registerStylesAndScripts() {
220
+ // register the stylesheet and javascript external resources
221
+ $pluginData = apply_filters( 'postman_get_plugin_metadata', null );
222
+ wp_register_script( 'postman_mailgun_script', plugins_url( 'Postman/Postman-Mail/postman_mailgun.js', $this->rootPluginFilenameAndPath ), array(
223
+ PostmanViewController::JQUERY_SCRIPT,
224
+ 'jquery_validation',
225
+ PostmanViewController::POSTMAN_SCRIPT,
226
+ ), $pluginData ['version'] );
227
+ }
228
+
229
+ /**
230
+ */
231
+ public function enqueueScript() {
232
+ wp_enqueue_script( 'postman_mailgun_script' );
233
+ }
234
+
235
+ /**
236
+ */
237
+ public function printWizardAuthenticationStep() {
238
+ print '<section class="wizard_mailgun">';
239
+ $this->printMailgunAuthSectionInfo();
240
+ printf( '<label for="api_key">%s</label>', __( 'API Key', Postman::TEXT_DOMAIN ) );
241
+ print '<br />';
242
+ print $this->mailgun_api_key_callback();
243
+ printf( '<label for="domain_name">%s</label>', __( 'Domain Name', Postman::TEXT_DOMAIN ) );
244
+ print '<br />';
245
+ print $this->mailgun_domain_name_callback();
246
+ print '</section>';
247
+ }
248
+ }
Postman/Postman-Mail/PostmanMessage.php CHANGED
@@ -35,7 +35,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) {
35
 
36
  // determined by the send() method
37
  private $isTextHtml;
38
- private $contentType;
39
  private $charset;
40
 
41
  private $boundary;
@@ -81,7 +81,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) {
81
  $this->contentType = sprintf( "%s;\r\n\t boundary=\"%s\"", $this->contentType, $this->getBoundary() );
82
  }
83
 
84
- $body = $this->getBody();
85
  $contentType = $this->getContentType();
86
  // add the message content as either text or html
87
  if ( empty( $contentType ) || substr( $contentType, 0, 10 ) === 'text/plain' ) {
35
 
36
  // determined by the send() method
37
  private $isTextHtml;
38
+ private $contentType = 'text/plain';
39
  private $charset;
40
 
41
  private $boundary;
81
  $this->contentType = sprintf( "%s;\r\n\t boundary=\"%s\"", $this->contentType, $this->getBoundary() );
82
  }
83
 
84
+ $body = $this->getBody();
85
  $contentType = $this->getContentType();
86
  // add the message content as either text or html
87
  if ( empty( $contentType ) || substr( $contentType, 0, 10 ) === 'text/plain' ) {
Postman/Postman-Mail/PostmanTransportRegistry.php CHANGED
@@ -5,34 +5,33 @@ require_once 'PostmanZendMailTransportConfigurationFactory.php';
5
  /**
6
  *
7
  * @author jasonhendriks
8
- *
9
  */
10
  class PostmanTransportRegistry {
11
  private $transports;
12
  private $logger;
13
-
14
  /**
15
  */
16
  private function __construct() {
17
- $this->logger = new PostmanLogger ( get_class ( $this ) );
18
  }
19
-
20
  // singleton instance
21
  public static function getInstance() {
22
  static $inst = null;
23
- if ($inst === null) {
24
- $inst = new PostmanTransportRegistry ();
25
  }
26
  return $inst;
27
  }
28
- public function registerTransport(PostmanModuleTransport $instance) {
29
- $this->transports [$instance->getSlug ()] = $instance;
30
  $instance->init();
31
  }
32
  public function getTransports() {
33
  return $this->transports;
34
  }
35
-
36
  /**
37
  * Retrieve a Transport by slug
38
  * Look up a specific Transport use:
@@ -40,85 +39,84 @@ class PostmanTransportRegistry {
40
  * B) when querying what a theoretical scenario involving this transport is like
41
  * (ie.for ajax in config screen)
42
  *
43
- * @param unknown $slug
44
  */
45
- public function getTransport($slug) {
46
- $transports = $this->getTransports ();
47
- if (isset ( $transports [$slug] )) {
48
- return $transports [$slug];
49
  }
50
  }
51
-
52
  /**
53
  * A short-hand way of showing the complete delivery method
54
  *
55
- * @param PostmanModuleTransport $transport
56
  * @return string
57
  */
58
- public function getPublicTransportUri(PostmanModuleTransport $transport) {
59
- return $transport->getPublicTransportUri ();
60
  }
61
-
62
  /**
63
  * Determine if a specific transport is registered in the directory.
64
  *
65
- * @param unknown $slug
66
  */
67
- public function isRegistered($slug) {
68
- $transports = $this->getTransports ();
69
- return isset ( $transports [$slug] );
70
  }
71
-
72
  /**
73
  * Retrieve the transport Postman is currently configured with.
74
  *
75
  * @return PostmanDummyTransport|PostmanModuleTransport
76
  * @deprecated
77
- *
78
  */
79
  public function getCurrentTransport() {
80
- $selectedTransport = PostmanOptions::getInstance ()->getTransportType ();
81
- $transports = $this->getTransports ();
82
- if (! isset ( $transports [$selectedTransport] )) {
83
  return $transports ['default'];
84
  } else {
85
- return $transports [$selectedTransport];
86
  }
87
  }
88
-
89
  /**
90
  *
91
- * @param PostmanOptions $options
92
- * @param PostmanOAuthToken $token
93
  * @return boolean
94
  */
95
  public function getActiveTransport() {
96
- $selectedTransport = PostmanOptions::getInstance ()->getTransportType ();
97
- $transports = $this->getTransports ();
98
- if (isset ( $transports [$selectedTransport] )) {
99
- $transport = $transports [$selectedTransport];
100
- if ($transport->getSlug () == $selectedTransport && $transport->isConfiguredAndReady ()) {
101
  return $transport;
102
  }
103
  }
104
  return $transports ['default'];
105
  }
106
-
107
  /**
108
  * Retrieve the transport Postman is currently configured with.
109
  *
110
  * @return PostmanDummyTransport|PostmanModuleTransport
111
  */
112
  public function getSelectedTransport() {
113
- $selectedTransport = PostmanOptions::getInstance ()->getTransportType ();
114
- $transports = $this->getTransports ();
115
- if (isset ( $transports [$selectedTransport] )) {
116
- return $transports [$selectedTransport];
117
  } else {
118
  return $transports ['default'];
119
  }
120
  }
121
-
122
  /**
123
  * Determine whether to show the Request Permission link on the main menu
124
  *
@@ -127,47 +125,52 @@ class PostmanTransportRegistry {
127
  * 2. the transport is properly configured
128
  * 3. we have a valid Client ID and Client Secret without an Auth Token
129
  *
130
- * @param PostmanOptions $options
131
  * @return boolean
132
  */
133
- public function isRequestOAuthPermissionAllowed(PostmanOptions $options, PostmanOAuthToken $authToken) {
134
  // does the current transport use OAuth 2.0
135
- $oauthUsed = self::getSelectedTransport ()->isOAuthUsed ( $options->getAuthenticationType () );
136
-
137
  // is the transport configured
138
- if ($oauthUsed) {
139
- $configured = self::getSelectedTransport ()->isConfiguredAndReady ();
140
  }
141
-
142
  return $oauthUsed && $configured;
143
  }
144
-
145
  /**
146
  * Polls all the installed transports to get a complete list of sockets to probe for connectivity
147
  *
148
- * @param unknown $hostname
149
- * @param unknown $isGmail
150
  * @return multitype:
151
  */
152
- public function getSocketsForSetupWizardToProbe($hostname = 'localhost', $smtpServerGuess = null) {
153
- $hosts = array ();
154
- if ($this->logger->isDebug ()) {
155
- $this->logger->debug ( sprintf ( 'Getting sockets for Port Test given hostname %s and smtpServerGuess %s', $hostname, $smtpServerGuess ) );
 
 
 
 
 
156
  }
157
- foreach ( $this->getTransports () as $transport ) {
158
- $socketsToTest = $transport->getSocketsForSetupWizardToProbe ( $hostname, $smtpServerGuess );
159
- if ($this->logger->isTrace ()) {
160
- $this->logger->trace ( 'sockets to test:' );
161
- $this->logger->trace ( $socketsToTest );
162
  }
163
- $hosts = array_merge ( $hosts, $socketsToTest );
164
- if ($this->logger->isDebug ()) {
165
- $this->logger->debug ( sprintf ( 'Transport %s returns %d sockets ', $transport->getName (), sizeof ( $socketsToTest ) ) );
166
  }
167
  }
168
  return $hosts;
169
  }
170
-
171
  /**
172
  * If the host port is a possible configuration option, recommend it
173
  *
@@ -175,63 +178,63 @@ class PostmanTransportRegistry {
175
  *
176
  * response should include ['success'], ['message'], ['priority']
177
  *
178
- * @param unknown $hostData
179
  */
180
- public function getRecommendation(PostmanWizardSocket $hostData, $userAuthOverride, $originalSmtpServer) {
181
- $scrubbedUserAuthOverride = $this->scrubUserOverride ( $hostData, $userAuthOverride );
182
- $transport = $this->getTransport ( $hostData->transport );
183
- $recommendation = $transport->getConfigurationBid ( $hostData, $scrubbedUserAuthOverride, $originalSmtpServer );
184
- if ($this->logger->isDebug ()) {
185
- $this->logger->debug ( sprintf ( 'Transport %s bid %s', $transport->getName (), $recommendation ['priority'] ) );
186
  }
187
  return $recommendation;
188
  }
189
-
190
  /**
191
  *
192
- * @param PostmanWizardSocket $hostData
193
- * @param unknown $userAuthOverride
194
  * @return NULL
195
  */
196
- private function scrubUserOverride(PostmanWizardSocket $hostData, $userAuthOverride) {
197
- $this->logger->trace ( 'before scrubbing userAuthOverride: ' . $userAuthOverride );
198
-
199
  // validate userAuthOverride
200
- if (! ($userAuthOverride == 'oauth2' || $userAuthOverride == 'password' || $userAuthOverride == 'none')) {
201
  $userAuthOverride = null;
202
  }
203
-
204
  // validate the userAuthOverride
205
- if (! $hostData->auth_xoauth) {
206
- if ($userAuthOverride == 'oauth2') {
207
  $userAuthOverride = null;
208
  }
209
  }
210
- if (! $hostData->auth_crammd5 && ! $hostData->authPlain && ! $hostData->auth_login) {
211
- if ($userAuthOverride == 'password') {
212
  $userAuthOverride = null;
213
  }
214
  }
215
- if (! $hostData->auth_none) {
216
- if ($userAuthOverride == 'none') {
217
  $userAuthOverride = null;
218
  }
219
  }
220
- $this->logger->trace ( 'after scrubbing userAuthOverride: ' . $userAuthOverride );
221
  return $userAuthOverride;
222
  }
223
-
224
  /**
225
  */
226
  public function getReadyMessage() {
227
- if ($this->getCurrentTransport ()->isConfiguredAndReady ()) {
228
- if (PostmanOptions::getInstance ()->getRunMode () != PostmanOptions::RUN_MODE_PRODUCTION) {
229
- return __ ( 'Postman is in <em>non-Production</em> mode and is dumping all emails.', Postman::TEXT_DOMAIN );
230
  } else {
231
- return __ ( 'Postman is configured.', Postman::TEXT_DOMAIN );
232
  }
233
  } else {
234
- return __ ( 'Postman is <em>not</em> configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN );
235
  }
236
  }
237
  }
5
  /**
6
  *
7
  * @author jasonhendriks
 
8
  */
9
  class PostmanTransportRegistry {
10
  private $transports;
11
  private $logger;
12
+
13
  /**
14
  */
15
  private function __construct() {
16
+ $this->logger = new PostmanLogger( get_class( $this ) );
17
  }
18
+
19
  // singleton instance
20
  public static function getInstance() {
21
  static $inst = null;
22
+ if ( $inst === null ) {
23
+ $inst = new PostmanTransportRegistry();
24
  }
25
  return $inst;
26
  }
27
+ public function registerTransport( PostmanModuleTransport $instance ) {
28
+ $this->transports [ $instance->getSlug() ] = $instance;
29
  $instance->init();
30
  }
31
  public function getTransports() {
32
  return $this->transports;
33
  }
34
+
35
  /**
36
  * Retrieve a Transport by slug
37
  * Look up a specific Transport use:
39
  * B) when querying what a theoretical scenario involving this transport is like
40
  * (ie.for ajax in config screen)
41
  *
42
+ * @param unknown $slug
43
  */
44
+ public function getTransport( $slug ) {
45
+ $transports = $this->getTransports();
46
+ if ( isset( $transports [ $slug ] ) ) {
47
+ return $transports [ $slug ];
48
  }
49
  }
50
+
51
  /**
52
  * A short-hand way of showing the complete delivery method
53
  *
54
+ * @param PostmanModuleTransport $transport
55
  * @return string
56
  */
57
+ public function getPublicTransportUri( PostmanModuleTransport $transport ) {
58
+ return $transport->getPublicTransportUri();
59
  }
60
+
61
  /**
62
  * Determine if a specific transport is registered in the directory.
63
  *
64
+ * @param unknown $slug
65
  */
66
+ public function isRegistered( $slug ) {
67
+ $transports = $this->getTransports();
68
+ return isset( $transports [ $slug ] );
69
  }
70
+
71
  /**
72
  * Retrieve the transport Postman is currently configured with.
73
  *
74
  * @return PostmanDummyTransport|PostmanModuleTransport
75
  * @deprecated
 
76
  */
77
  public function getCurrentTransport() {
78
+ $selectedTransport = PostmanOptions::getInstance()->getTransportType();
79
+ $transports = $this->getTransports();
80
+ if ( ! isset( $transports [ $selectedTransport ] ) ) {
81
  return $transports ['default'];
82
  } else {
83
+ return $transports [ $selectedTransport ];
84
  }
85
  }
86
+
87
  /**
88
  *
89
+ * @param PostmanOptions $options
90
+ * @param PostmanOAuthToken $token
91
  * @return boolean
92
  */
93
  public function getActiveTransport() {
94
+ $selectedTransport = PostmanOptions::getInstance()->getTransportType();
95
+ $transports = $this->getTransports();
96
+ if ( isset( $transports [ $selectedTransport ] ) ) {
97
+ $transport = $transports [ $selectedTransport ];
98
+ if ( $transport->getSlug() == $selectedTransport && $transport->isConfiguredAndReady() ) {
99
  return $transport;
100
  }
101
  }
102
  return $transports ['default'];
103
  }
104
+
105
  /**
106
  * Retrieve the transport Postman is currently configured with.
107
  *
108
  * @return PostmanDummyTransport|PostmanModuleTransport
109
  */
110
  public function getSelectedTransport() {
111
+ $selectedTransport = PostmanOptions::getInstance()->getTransportType();
112
+ $transports = $this->getTransports();
113
+ if ( isset( $transports [ $selectedTransport ] ) ) {
114
+ return $transports [ $selectedTransport ];
115
  } else {
116
  return $transports ['default'];
117
  }
118
  }
119
+
120
  /**
121
  * Determine whether to show the Request Permission link on the main menu
122
  *
125
  * 2. the transport is properly configured
126
  * 3. we have a valid Client ID and Client Secret without an Auth Token
127
  *
128
+ * @param PostmanOptions $options
129
  * @return boolean
130
  */
131
+ public function isRequestOAuthPermissionAllowed( PostmanOptions $options, PostmanOAuthToken $authToken ) {
132
  // does the current transport use OAuth 2.0
133
+ $oauthUsed = self::getSelectedTransport()->isOAuthUsed( $options->getAuthenticationType() );
134
+
135
  // is the transport configured
136
+ if ( $oauthUsed ) {
137
+ $configured = self::getSelectedTransport()->isConfiguredAndReady();
138
  }
139
+
140
  return $oauthUsed && $configured;
141
  }
142
+
143
  /**
144
  * Polls all the installed transports to get a complete list of sockets to probe for connectivity
145
  *
146
+ * @param unknown $hostname
147
+ * @param unknown $isGmail
148
  * @return multitype:
149
  */
150
+ public function getSocketsForSetupWizardToProbe( $hostname = 'localhost', $smtpServerGuess = null ) {
151
+ $hosts = array();
152
+ if ( $this->logger->isDebug() ) {
153
+ $this->logger->debug( sprintf( 'Getting sockets for Port Test given hostname %s and smtpServerGuess %s', $hostname, $smtpServerGuess ) );
154
+ }
155
+
156
+ $transports = $this->getTransports();
157
+ if ( $hostname !== 'smtp.gmail.com' ) {
158
+ unset( $transports['gmail_api'] );
159
  }
160
+ foreach ( $transports as $transport ) {
161
+ $socketsToTest = $transport->getSocketsForSetupWizardToProbe( $hostname, $smtpServerGuess );
162
+ if ( $this->logger->isTrace() ) {
163
+ $this->logger->trace( 'sockets to test:' );
164
+ $this->logger->trace( $socketsToTest );
165
  }
166
+ $hosts = array_merge( $hosts, $socketsToTest );
167
+ if ( $this->logger->isDebug() ) {
168
+ $this->logger->debug( sprintf( 'Transport %s returns %d sockets ', $transport->getName(), sizeof( $socketsToTest ) ) );
169
  }
170
  }
171
  return $hosts;
172
  }
173
+
174
  /**
175
  * If the host port is a possible configuration option, recommend it
176
  *
178
  *
179
  * response should include ['success'], ['message'], ['priority']
180
  *
181
+ * @param unknown $hostData
182
  */
183
+ public function getRecommendation( PostmanWizardSocket $hostData, $userAuthOverride, $originalSmtpServer ) {
184
+ $scrubbedUserAuthOverride = $this->scrubUserOverride( $hostData, $userAuthOverride );
185
+ $transport = $this->getTransport( $hostData->transport );
186
+ $recommendation = $transport->getConfigurationBid( $hostData, $scrubbedUserAuthOverride, $originalSmtpServer );
187
+ if ( $this->logger->isDebug() ) {
188
+ $this->logger->debug( sprintf( 'Transport %s bid %s', $transport->getName(), $recommendation ['priority'] ) );
189
  }
190
  return $recommendation;
191
  }
192
+
193
  /**
194
  *
195
+ * @param PostmanWizardSocket $hostData
196
+ * @param unknown $userAuthOverride
197
  * @return NULL
198
  */
199
+ private function scrubUserOverride( PostmanWizardSocket $hostData, $userAuthOverride ) {
200
+ $this->logger->trace( 'before scrubbing userAuthOverride: ' . $userAuthOverride );
201
+
202
  // validate userAuthOverride
203
+ if ( ! ($userAuthOverride == 'oauth2' || $userAuthOverride == 'password' || $userAuthOverride == 'none') ) {
204
  $userAuthOverride = null;
205
  }
206
+
207
  // validate the userAuthOverride
208
+ if ( ! $hostData->auth_xoauth ) {
209
+ if ( $userAuthOverride == 'oauth2' ) {
210
  $userAuthOverride = null;
211
  }
212
  }
213
+ if ( ! $hostData->auth_crammd5 && ! $hostData->authPlain && ! $hostData->auth_login ) {
214
+ if ( $userAuthOverride == 'password' ) {
215
  $userAuthOverride = null;
216
  }
217
  }
218
+ if ( ! $hostData->auth_none ) {
219
+ if ( $userAuthOverride == 'none' ) {
220
  $userAuthOverride = null;
221
  }
222
  }
223
+ $this->logger->trace( 'after scrubbing userAuthOverride: ' . $userAuthOverride );
224
  return $userAuthOverride;
225
  }
226
+
227
  /**
228
  */
229
  public function getReadyMessage() {
230
+ if ( $this->getCurrentTransport()->isConfiguredAndReady() ) {
231
+ if ( PostmanOptions::getInstance()->getRunMode() != PostmanOptions::RUN_MODE_PRODUCTION ) {
232
+ return __( 'Postman is in <em>non-Production</em> mode and is dumping all emails.', Postman::TEXT_DOMAIN );
233
  } else {
234
+ return __( 'Postman is configured.', Postman::TEXT_DOMAIN );
235
  }
236
  } else {
237
+ return __( 'Postman is <em>not</em> configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN );
238
  }
239
  }
240
  }
Postman/Postman-Mail/mailgun/composer.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ {
2
+ "require": {
3
+ "mailgun/mailgun-php": "^2.3",
4
+ "php-http/curl-client": "^1.7",
5
+ "guzzlehttp/psr7": "^1.4"
6
+ }
7
+ }
Postman/Postman-Mail/mailgun/composer.lock ADDED
@@ -0,0 +1,801 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "hash": "313ef327f6509ec8ad576598f4256808",
8
+ "content-hash": "262cbcab9c136c29b36e81b0562c427a",
9
+ "packages": [
10
+ {
11
+ "name": "clue/stream-filter",
12
+ "version": "v1.4.0",
13
+ "source": {
14
+ "type": "git",
15
+ "url": "https://github.com/clue/php-stream-filter.git",
16
+ "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0"
17
+ },
18
+ "dist": {
19
+ "type": "zip",
20
+ "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0",
21
+ "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0",
22
+ "shasum": ""
23
+ },
24
+ "require": {
25
+ "php": ">=5.3"
26
+ },
27
+ "require-dev": {
28
+ "phpunit/phpunit": "^5.0 || ^4.8"
29
+ },
30
+ "type": "library",
31
+ "autoload": {
32
+ "psr-4": {
33
+ "Clue\\StreamFilter\\": "src/"
34
+ },
35
+ "files": [
36
+ "src/functions.php"
37
+ ]
38
+ },
39
+ "notification-url": "https://packagist.org/downloads/",
40
+ "license": [
41
+ "MIT"
42
+ ],
43
+ "authors": [
44
+ {
45
+ "name": "Christian Lück",
46
+ "email": "christian@lueck.tv"
47
+ }
48
+ ],
49
+ "description": "A simple and modern approach to stream filtering in PHP",
50
+ "homepage": "https://github.com/clue/php-stream-filter",
51
+ "keywords": [
52
+ "bucket brigade",
53
+ "callback",
54
+ "filter",
55
+ "php_user_filter",
56
+ "stream",
57
+ "stream_filter_append",
58
+ "stream_filter_register"
59
+ ],
60
+ "time": "2017-08-18 09:54:01"
61
+ },
62
+ {
63
+ "name": "guzzlehttp/psr7",
64
+ "version": "1.4.2",
65
+ "source": {
66
+ "type": "git",
67
+ "url": "https://github.com/guzzle/psr7.git",
68
+ "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
69
+ },
70
+ "dist": {
71
+ "type": "zip",
72
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
73
+ "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
74
+ "shasum": ""
75
+ },
76
+ "require": {
77
+ "php": ">=5.4.0",
78
+ "psr/http-message": "~1.0"
79
+ },
80
+ "provide": {
81
+ "psr/http-message-implementation": "1.0"
82
+ },
83
+ "require-dev": {
84
+ "phpunit/phpunit": "~4.0"
85
+ },
86
+ "type": "library",
87
+ "extra": {
88
+ "branch-alias": {
89
+ "dev-master": "1.4-dev"
90
+ }
91
+ },
92
+ "autoload": {
93
+ "psr-4": {
94
+ "GuzzleHttp\\Psr7\\": "src/"
95
+ },
96
+ "files": [
97
+ "src/functions_include.php"
98
+ ]
99
+ },
100
+ "notification-url": "https://packagist.org/downloads/",
101
+ "license": [
102
+ "MIT"
103
+ ],
104
+ "authors": [
105
+ {
106
+ "name": "Michael Dowling",
107
+ "email": "mtdowling@gmail.com",
108
+ "homepage": "https://github.com/mtdowling"
109
+ },
110
+ {
111
+ "name": "Tobias Schultze",
112
+ "homepage": "https://github.com/Tobion"
113
+ }
114
+ ],
115
+ "description": "PSR-7 message implementation that also provides common utility methods",
116
+ "keywords": [
117
+ "http",
118
+ "message",
119
+ "request",
120
+ "response",
121
+ "stream",
122
+ "uri",
123
+ "url"
124
+ ],
125
+ "time": "2017-03-20 17:10:46"
126
+ },
127
+ {
128
+ "name": "mailgun/mailgun-php",
129
+ "version": "2.3.4",
130
+ "source": {
131
+ "type": "git",
132
+ "url": "https://github.com/mailgun/mailgun-php.git",
133
+ "reference": "f58c5914aefa16fa6ed2b5cf9ee84d40cbda1b3a"
134
+ },
135
+ "dist": {
136
+ "type": "zip",
137
+ "url": "https://api.github.com/repos/mailgun/mailgun-php/zipball/f58c5914aefa16fa6ed2b5cf9ee84d40cbda1b3a",
138
+ "reference": "f58c5914aefa16fa6ed2b5cf9ee84d40cbda1b3a",
139
+ "shasum": ""
140
+ },
141
+ "require": {
142
+ "php": "^5.5|^7.0",
143
+ "php-http/client-common": "^1.1",
144
+ "php-http/discovery": "^1.0",
145
+ "php-http/httplug": "^1.0",
146
+ "php-http/message": "^1.0",
147
+ "php-http/multipart-stream-builder": "^1.0",
148
+ "webmozart/assert": "^1.2"
149
+ },
150
+ "require-dev": {
151
+ "guzzlehttp/psr7": "^1.4",
152
+ "php-http/guzzle6-adapter": "^1.0",
153
+ "phpunit/phpunit": "~4.8"
154
+ },
155
+ "type": "library",
156
+ "autoload": {
157
+ "psr-0": {
158
+ "Mailgun": "src/"
159
+ }
160
+ },
161
+ "notification-url": "https://packagist.org/downloads/",
162
+ "license": [
163
+ "MIT"
164
+ ],
165
+ "authors": [
166
+ {
167
+ "name": "Travis Swientek",
168
+ "email": "travis@mailgunhq.com"
169
+ }
170
+ ],
171
+ "description": "The Mailgun SDK provides methods for all API functions.",
172
+ "time": "2017-06-20 19:56:09"
173
+ },
174
+ {
175
+ "name": "php-http/client-common",
176
+ "version": "1.7.0",
177
+ "source": {
178
+ "type": "git",
179
+ "url": "https://github.com/php-http/client-common.git",
180
+ "reference": "9accb4a082eb06403747c0ffd444112eda41a0fd"
181
+ },
182
+ "dist": {
183
+ "type": "zip",
184
+ "url": "https://api.github.com/repos/php-http/client-common/zipball/9accb4a082eb06403747c0ffd444112eda41a0fd",
185
+ "reference": "9accb4a082eb06403747c0ffd444112eda41a0fd",
186
+ "shasum": ""
187
+ },
188
+ "require": {
189
+ "php": "^5.4 || ^7.0",
190
+ "php-http/httplug": "^1.1",
191
+ "php-http/message": "^1.6",
192
+ "php-http/message-factory": "^1.0",
193
+ "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0"
194
+ },
195
+ "require-dev": {
196
+ "guzzlehttp/psr7": "^1.4",
197
+ "phpspec/phpspec": "^2.5 || ^3.4 || ^4.2"
198
+ },
199
+ "suggest": {
200
+ "php-http/cache-plugin": "PSR-6 Cache plugin",
201
+ "php-http/logger-plugin": "PSR-3 Logger plugin",
202
+ "php-http/stopwatch-plugin": "Symfony Stopwatch plugin"
203
+ },
204
+ "type": "library",
205
+ "extra": {
206
+ "branch-alias": {
207
+ "dev-master": "1.7-dev"
208
+ }
209
+ },
210
+ "autoload": {
211
+ "psr-4": {
212
+ "Http\\Client\\Common\\": "src/"
213
+ }
214
+ },
215
+ "notification-url": "https://packagist.org/downloads/",
216
+ "license": [
217
+ "MIT"
218
+ ],
219
+ "authors": [
220
+ {
221
+ "name": "Márk Sági-Kazár",
222
+ "email": "mark.sagikazar@gmail.com"
223
+ }
224
+ ],
225
+ "description": "Common HTTP Client implementations and tools for HTTPlug",
226
+ "homepage": "http://httplug.io",
227
+ "keywords": [
228
+ "client",
229
+ "common",
230
+ "http",
231
+ "httplug"
232
+ ],
233
+ "time": "2017-11-30 11:06:59"
234
+ },
235
+ {
236
+ "name": "php-http/curl-client",
237
+ "version": "v1.7.0",
238
+ "source": {
239
+ "type": "git",
240
+ "url": "https://github.com/php-http/curl-client.git",
241
+ "reference": "0972ad0d7d37032a52077a5cbe27cf370f2007d8"
242
+ },
243
+ "dist": {
244
+ "type": "zip",
245
+ "url": "https://api.github.com/repos/php-http/curl-client/zipball/0972ad0d7d37032a52077a5cbe27cf370f2007d8",
246
+ "reference": "0972ad0d7d37032a52077a5cbe27cf370f2007d8",
247
+ "shasum": ""
248
+ },
249
+ "require": {
250
+ "ext-curl": "*",
251
+ "php": "^5.5 || ^7.0",
252
+ "php-http/discovery": "^1.0",
253
+ "php-http/httplug": "^1.0",
254
+ "php-http/message": "^1.2",
255
+ "php-http/message-factory": "^1.0.2"
256
+ },
257
+ "provide": {
258
+ "php-http/async-client-implementation": "1.0",
259
+ "php-http/client-implementation": "1.0"
260
+ },
261
+ "require-dev": {
262
+ "guzzlehttp/psr7": "^1.0",
263
+ "php-http/client-integration-tests": "^0.5.1",
264
+ "phpunit/phpunit": "^4.8.27",
265
+ "zendframework/zend-diactoros": "^1.0"
266
+ },
267
+ "type": "library",
268
+ "autoload": {
269
+ "psr-4": {
270
+ "Http\\Client\\Curl\\": "src/"
271
+ }
272
+ },
273
+ "notification-url": "https://packagist.org/downloads/",
274
+ "license": [
275
+ "MIT"
276
+ ],
277
+ "authors": [
278
+ {
279
+ "name": "Михаил Красильников",
280
+ "email": "m.krasilnikov@yandex.ru"
281
+ }
282
+ ],
283
+ "description": "cURL client for PHP-HTTP",
284
+ "homepage": "http://php-http.org",
285
+ "keywords": [
286
+ "curl",
287
+ "http"
288
+ ],
289
+ "time": "2017-02-09 15:18:33"
290
+ },
291
+ {
292
+ "name": "php-http/discovery",
293
+ "version": "1.3.0",
294
+ "source": {
295
+ "type": "git",
296
+ "url": "https://github.com/php-http/discovery.git",
297
+ "reference": "7b50ab4d6c9fdaa1ed53ae310c955900af6e3372"
298
+ },
299
+ "dist": {
300
+ "type": "zip",
301
+ "url": "https://api.github.com/repos/php-http/discovery/zipball/7b50ab4d6c9fdaa1ed53ae310c955900af6e3372",
302
+ "reference": "7b50ab4d6c9fdaa1ed53ae310c955900af6e3372",
303
+ "shasum": ""
304
+ },
305
+ "require": {
306
+ "php": "^5.5 || ^7.0"
307
+ },
308
+ "require-dev": {
309
+ "henrikbjorn/phpspec-code-coverage": "^2.0.2",
310
+ "php-http/httplug": "^1.0",
311
+ "php-http/message-factory": "^1.0",
312
+ "phpspec/phpspec": "^2.4",
313
+ "puli/composer-plugin": "1.0.0-beta10"
314
+ },
315
+ "suggest": {
316
+ "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories",
317
+ "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."
318
+ },
319
+ "type": "library",
320
+ "extra": {
321
+ "branch-alias": {
322
+ "dev-master": "1.3-dev"
323
+ }
324
+ },
325
+ "autoload": {
326
+ "psr-4": {
327
+ "Http\\Discovery\\": "src/"
328
+ }
329
+ },
330
+ "notification-url": "https://packagist.org/downloads/",
331
+ "license": [
332
+ "MIT"
333
+ ],
334
+ "authors": [
335
+ {
336
+ "name": "Márk Sági-Kazár",
337
+ "email": "mark.sagikazar@gmail.com"
338
+ }
339
+ ],
340
+ "description": "Finds installed HTTPlug implementations and PSR-7 message factories",
341
+ "homepage": "http://php-http.org",
342
+ "keywords": [
343
+ "adapter",
344
+ "client",
345
+ "discovery",
346
+ "factory",
347
+ "http",
348
+ "message",
349
+ "psr7"
350
+ ],
351
+ "time": "2017-08-03 10:12:53"
352
+ },
353
+ {
354
+ "name": "php-http/httplug",
355
+ "version": "v1.1.0",
356
+ "source": {
357
+ "type": "git",
358
+ "url": "https://github.com/php-http/httplug.git",
359
+ "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018"
360
+ },
361
+ "dist": {
362
+ "type": "zip",
363
+ "url": "https://api.github.com/repos/php-http/httplug/zipball/1c6381726c18579c4ca2ef1ec1498fdae8bdf018",
364
+ "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018",
365
+ "shasum": ""
366
+ },
367
+ "require": {
368
+ "php": ">=5.4",
369
+ "php-http/promise": "^1.0",
370
+ "psr/http-message": "^1.0"
371
+ },
372
+ "require-dev": {
373
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
374
+ "phpspec/phpspec": "^2.4"
375
+ },
376
+ "type": "library",
377
+ "extra": {
378
+ "branch-alias": {
379
+ "dev-master": "1.1-dev"
380
+ }
381
+ },
382
+ "autoload": {
383
+ "psr-4": {
384
+ "Http\\Client\\": "src/"
385
+ }
386
+ },
387
+ "notification-url": "https://packagist.org/downloads/",
388
+ "license": [
389
+ "MIT"
390
+ ],
391
+ "authors": [
392
+ {
393
+ "name": "Eric GELOEN",
394
+ "email": "geloen.eric@gmail.com"
395
+ },
396
+ {
397
+ "name": "Márk Sági-Kazár",
398
+ "email": "mark.sagikazar@gmail.com"
399
+ }
400
+ ],
401
+ "description": "HTTPlug, the HTTP client abstraction for PHP",
402
+ "homepage": "http://httplug.io",
403
+ "keywords": [
404
+ "client",
405
+ "http"
406
+ ],
407
+ "time": "2016-08-31 08:30:17"
408
+ },
409
+ {
410
+ "name": "php-http/message",
411
+ "version": "1.6.0",
412
+ "source": {
413
+ "type": "git",
414
+ "url": "https://github.com/php-http/message.git",
415
+ "reference": "2edd63bae5f52f79363c5f18904b05ce3a4b7253"
416
+ },
417
+ "dist": {
418
+ "type": "zip",
419
+ "url": "https://api.github.com/repos/php-http/message/zipball/2edd63bae5f52f79363c5f18904b05ce3a4b7253",
420
+ "reference": "2edd63bae5f52f79363c5f18904b05ce3a4b7253",
421
+ "shasum": ""
422
+ },
423
+ "require": {
424
+ "clue/stream-filter": "^1.3",
425
+ "php": ">=5.4",
426
+ "php-http/message-factory": "^1.0.2",
427
+ "psr/http-message": "^1.0"
428
+ },
429
+ "provide": {
430
+ "php-http/message-factory-implementation": "1.0"
431
+ },
432
+ "require-dev": {
433
+ "akeneo/phpspec-skip-example-extension": "^1.0",
434
+ "coduo/phpspec-data-provider-extension": "^1.0",
435
+ "ext-zlib": "*",
436
+ "guzzlehttp/psr7": "^1.0",
437
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
438
+ "phpspec/phpspec": "^2.4",
439
+ "slim/slim": "^3.0",
440
+ "zendframework/zend-diactoros": "^1.0"
441
+ },
442
+ "suggest": {
443
+ "ext-zlib": "Used with compressor/decompressor streams",
444
+ "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
445
+ "slim/slim": "Used with Slim Framework PSR-7 implementation",
446
+ "zendframework/zend-diactoros": "Used with Diactoros Factories"
447
+ },
448
+ "type": "library",
449
+ "extra": {
450
+ "branch-alias": {
451
+ "dev-master": "1.6-dev"
452
+ }
453
+ },
454
+ "autoload": {
455
+ "psr-4": {
456
+ "Http\\Message\\": "src/"
457
+ },
458
+ "files": [
459
+ "src/filters.php"
460
+ ]
461
+ },
462
+ "notification-url": "https://packagist.org/downloads/",
463
+ "license": [
464
+ "MIT"
465
+ ],
466
+ "authors": [
467
+ {
468
+ "name": "Márk Sági-Kazár",
469
+ "email": "mark.sagikazar@gmail.com"
470
+ }
471
+ ],
472
+ "description": "HTTP Message related tools",
473
+ "homepage": "http://php-http.org",
474
+ "keywords": [
475
+ "http",
476
+ "message",
477
+ "psr-7"
478
+ ],
479
+ "time": "2017-07-05 06:40:53"
480
+ },
481
+ {
482
+ "name": "php-http/message-factory",
483
+ "version": "v1.0.2",
484
+ "source": {
485
+ "type": "git",
486
+ "url": "https://github.com/php-http/message-factory.git",
487
+ "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
488
+ },
489
+ "dist": {
490
+ "type": "zip",
491
+ "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
492
+ "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
493
+ "shasum": ""
494
+ },
495
+ "require": {
496
+ "php": ">=5.4",
497
+ "psr/http-message": "^1.0"
498
+ },
499
+ "type": "library",
500
+ "extra": {
501
+ "branch-alias": {
502
+ "dev-master": "1.0-dev"
503
+ }
504
+ },
505
+ "autoload": {
506
+ "psr-4": {
507
+ "Http\\Message\\": "src/"
508
+ }
509
+ },
510
+ "notification-url": "https://packagist.org/downloads/",
511
+ "license": [
512
+ "MIT"
513
+ ],
514
+ "authors": [
515
+ {
516
+ "name": "Márk Sági-Kazár",
517
+ "email": "mark.sagikazar@gmail.com"
518
+ }
519
+ ],
520
+ "description": "Factory interfaces for PSR-7 HTTP Message",
521
+ "homepage": "http://php-http.org",
522
+ "keywords": [
523
+ "factory",
524
+ "http",
525
+ "message",
526
+ "stream",
527
+ "uri"
528
+ ],
529
+ "time": "2015-12-19 14:08:53"
530
+ },
531
+ {
532
+ "name": "php-http/multipart-stream-builder",
533
+ "version": "1.0.0",
534
+ "source": {
535
+ "type": "git",
536
+ "url": "https://github.com/php-http/multipart-stream-builder.git",
537
+ "reference": "1fa3c623fc813a43b39494b2a1612174e36e0fb0"
538
+ },
539
+ "dist": {
540
+ "type": "zip",
541
+ "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/1fa3c623fc813a43b39494b2a1612174e36e0fb0",
542
+ "reference": "1fa3c623fc813a43b39494b2a1612174e36e0fb0",
543
+ "shasum": ""
544
+ },
545
+ "require": {
546
+ "php": "^5.5 || ^7.0",
547
+ "php-http/discovery": "^1.0",
548
+ "php-http/message-factory": "^1.0.2",
549
+ "psr/http-message": "^1.0"
550
+ },
551
+ "require-dev": {
552
+ "php-http/message": "^1.5",
553
+ "phpunit/phpunit": "^4.8 || ^5.4",
554
+ "zendframework/zend-diactoros": "^1.3.5"
555
+ },
556
+ "type": "library",
557
+ "extra": {
558
+ "branch-alias": {
559
+ "dev-master": "0.3-dev"
560
+ }
561
+ },
562
+ "autoload": {
563
+ "psr-4": {
564
+ "Http\\Message\\MultipartStream\\": "src/"
565
+ }
566
+ },
567
+ "notification-url": "https://packagist.org/downloads/",
568
+ "license": [
569
+ "MIT"
570
+ ],
571
+ "authors": [
572
+ {
573
+ "name": "Tobias Nyholm",
574
+ "email": "tobias.nyholm@gmail.com"
575
+ }
576
+ ],
577
+ "description": "A builder class that help you create a multipart stream",
578
+ "homepage": "http://php-http.org",
579
+ "keywords": [
580
+ "factory",
581
+ "http",
582
+ "message",
583
+ "multipart stream",
584
+ "stream"
585
+ ],
586
+ "time": "2017-05-21 17:45:25"
587
+ },
588
+ {
589
+ "name": "php-http/promise",
590
+ "version": "v1.0.0",
591
+ "source": {
592
+ "type": "git",
593
+ "url": "https://github.com/php-http/promise.git",
594
+ "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980"
595
+ },
596
+ "dist": {
597
+ "type": "zip",
598
+ "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980",
599
+ "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980",
600
+ "shasum": ""
601
+ },
602
+ "require-dev": {
603
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
604
+ "phpspec/phpspec": "^2.4"
605
+ },
606
+ "type": "library",
607
+ "extra": {
608
+ "branch-alias": {
609
+ "dev-master": "1.1-dev"
610
+ }
611
+ },
612
+ "autoload": {
613
+ "psr-4": {
614
+ "Http\\Promise\\": "src/"
615
+ }
616
+ },
617
+ "notification-url": "https://packagist.org/downloads/",
618
+ "license": [
619
+ "MIT"
620
+ ],
621
+ "authors": [
622
+ {
623
+ "name": "Márk Sági-Kazár",
624
+ "email": "mark.sagikazar@gmail.com"
625
+ },
626
+ {
627
+ "name": "Joel Wurtz",
628
+ "email": "joel.wurtz@gmail.com"
629
+ }
630
+ ],
631
+ "description": "Promise used for asynchronous HTTP requests",
632
+ "homepage": "http://httplug.io",
633
+ "keywords": [
634
+ "promise"
635
+ ],
636
+ "time": "2016-01-26 13:27:02"
637
+ },
638
+ {
639
+ "name": "psr/http-message",
640
+ "version": "1.0.1",
641
+ "source": {
642
+ "type": "git",
643
+ "url": "https://github.com/php-fig/http-message.git",
644
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
645
+ },
646
+ "dist": {
647
+ "type": "zip",
648
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
649
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
650
+ "shasum": ""
651
+ },
652
+ "require": {
653
+ "php": ">=5.3.0"
654
+ },
655
+ "type": "library",
656
+ "extra": {
657
+ "branch-alias": {
658
+ "dev-master": "1.0.x-dev"
659
+ }
660
+ },
661
+ "autoload": {
662
+ "psr-4": {
663
+ "Psr\\Http\\Message\\": "src/"
664
+ }
665
+ },
666
+ "notification-url": "https://packagist.org/downloads/",
667
+ "license": [
668
+ "MIT"
669
+ ],
670
+ "authors": [
671
+ {
672
+ "name": "PHP-FIG",
673
+ "homepage": "http://www.php-fig.org/"
674
+ }
675
+ ],
676
+ "description": "Common interface for HTTP messages",
677
+ "homepage": "https://github.com/php-fig/http-message",
678
+ "keywords": [
679
+ "http",
680
+ "http-message",
681
+ "psr",
682
+ "psr-7",
683
+ "request",
684
+ "response"
685
+ ],
686
+ "time": "2016-08-06 14:39:51"
687
+ },
688
+ {
689
+ "name": "symfony/options-resolver",
690
+ "version": "v3.4.1",
691
+ "source": {
692
+ "type": "git",
693
+ "url": "https://github.com/symfony/options-resolver.git",
694
+ "reference": "08748edfe6982f4d878cc42b8325b19a276fb1cf"
695
+ },
696
+ "dist": {
697
+ "type": "zip",
698
+ "url": "https://api.github.com/repos/symfony/options-resolver/zipball/08748edfe6982f4d878cc42b8325b19a276fb1cf",
699
+ "reference": "08748edfe6982f4d878cc42b8325b19a276fb1cf",
700
+ "shasum": ""
701
+ },
702
+ "require": {
703
+ "php": "^5.5.9|>=7.0.8"
704
+ },
705
+ "type": "library",
706
+ "extra": {
707
+ "branch-alias": {
708
+ "dev-master": "3.4-dev"
709
+ }
710
+ },
711
+ "autoload": {
712
+ "psr-4": {
713
+ "Symfony\\Component\\OptionsResolver\\": ""
714
+ },
715
+ "exclude-from-classmap": [
716
+ "/Tests/"
717
+ ]
718
+ },
719
+ "notification-url": "https://packagist.org/downloads/",
720
+ "license": [
721
+ "MIT"
722
+ ],
723
+ "authors": [
724
+ {
725
+ "name": "Fabien Potencier",
726
+ "email": "fabien@symfony.com"
727
+ },
728
+ {
729
+ "name": "Symfony Community",
730
+ "homepage": "https://symfony.com/contributors"
731
+ }
732
+ ],
733
+ "description": "Symfony OptionsResolver Component",
734
+ "homepage": "https://symfony.com",
735
+ "keywords": [
736
+ "config",
737
+ "configuration",
738
+ "options"
739
+ ],
740
+ "time": "2017-11-05 16:10:10"
741
+ },
742
+ {
743
+ "name": "webmozart/assert",
744
+ "version": "1.2.0",
745
+ "source": {
746
+ "type": "git",
747
+ "url": "https://github.com/webmozart/assert.git",
748
+ "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f"
749
+ },
750
+ "dist": {
751
+ "type": "zip",
752
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f",
753
+ "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
754
+ "shasum": ""
755
+ },
756
+ "require": {
757
+ "php": "^5.3.3 || ^7.0"
758
+ },
759
+ "require-dev": {
760
+ "phpunit/phpunit": "^4.6",
761
+ "sebastian/version": "^1.0.1"
762
+ },
763
+ "type": "library",
764
+ "extra": {
765
+ "branch-alias": {
766
+ "dev-master": "1.3-dev"
767
+ }
768
+ },
769
+ "autoload": {
770
+ "psr-4": {
771
+ "Webmozart\\Assert\\": "src/"
772
+ }
773
+ },
774
+ "notification-url": "https://packagist.org/downloads/",
775
+ "license": [
776
+ "MIT"
777
+ ],
778
+ "authors": [
779
+ {
780
+ "name": "Bernhard Schussek",
781
+ "email": "bschussek@gmail.com"
782
+ }
783
+ ],
784
+ "description": "Assertions to validate method input/output with nice error messages.",
785
+ "keywords": [
786
+ "assert",
787
+ "check",
788
+ "validate"
789
+ ],
790
+ "time": "2016-11-23 20:04:58"
791
+ }
792
+ ],
793
+ "packages-dev": [],
794
+ "aliases": [],
795
+ "minimum-stability": "stable",
796
+ "stability-flags": [],
797
+ "prefer-stable": false,
798
+ "prefer-lowest": false,
799
+ "platform": [],
800
+ "platform-dev": []
801
+ }
Postman/Postman-Mail/mailgun/mailgun.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ require 'vendor/autoload.php';
Postman/Postman-Mail/mailgun/vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer' . '/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit2e493976577e1ff95afbbd5ca63b2ef1::getLoader();
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /vendor
2
+ /composer.lock
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/.travis.yml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ php:
4
+ # - 5.3 # requires old distro, see below
5
+ - 5.4
6
+ - 5.5
7
+ - 5.6
8
+ - 7.0
9
+ - 7.1
10
+ - hhvm # ignore errors, see below
11
+
12
+ # lock distro so new future defaults will not break the build
13
+ dist: trusty
14
+
15
+ matrix:
16
+ include:
17
+ - php: 5.3
18
+ dist: precise
19
+ allow_failures:
20
+ - php: hhvm
21
+
22
+ install:
23
+ - composer install --no-interaction
24
+
25
+ script:
26
+ - vendor/bin/phpunit --coverage-text
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/CHANGELOG.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ ## 1.4.0 (2017-08-18)
4
+
5
+ * Feature / Fix: The `fun()` function does not pass filter parameter `null`
6
+ to underlying `stream_filter_append()` by default
7
+ (#15 by @Nyholm)
8
+
9
+ Certain filters (such as `convert.quoted-printable-encode`) do not accept
10
+ a filter parameter at all. If no explicit filter parameter is given, we no
11
+ longer pass a default `null` value.
12
+
13
+ ```php
14
+ $encode = Filter\fun('convert.quoted-printable-encode');
15
+ assert('t=C3=A4st' === $encode('täst'));
16
+ ```
17
+
18
+ * Add examples and improve documentation
19
+ (#13 and #20 by @clue and #18 by @Nyholm)
20
+
21
+ * Improve test suite by adding PHPUnit to require-dev,
22
+ fix HHVM build for now again and ignore future HHVM build errors,
23
+ lock Travis distro so new future defaults will not break the build
24
+ and test on PHP 7.1
25
+ (#12, #14 and #19 by @clue and #16 by @Nyholm)
26
+
27
+ ## 1.3.0 (2015-11-08)
28
+
29
+ * Feature: Support accessing built-in filters as callbacks
30
+ (#5 by @clue)
31
+
32
+ ```php
33
+ $fun = Filter\fun('zlib.deflate');
34
+
35
+ $ret = $fun('hello') . $fun('world') . $fun();
36
+ assert('helloworld' === gzinflate($ret));
37
+ ```
38
+
39
+ ## 1.2.0 (2015-10-23)
40
+
41
+ * Feature: Invoke close event when closing filter (flush buffer)
42
+ (#9 by @clue)
43
+
44
+ ## 1.1.0 (2015-10-22)
45
+
46
+ * Feature: Abort filter operation when catching an Exception
47
+ (#10 by @clue)
48
+
49
+ * Feature: Additional safeguards to prevent filter state corruption
50
+ (#7 by @clue)
51
+
52
+ ## 1.0.0 (2015-10-18)
53
+
54
+ * First tagged release
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Christian Lück
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 furnished
10
+ 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
21
+ THE SOFTWARE.
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/README.md ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # clue/stream-filter [![Build Status](https://travis-ci.org/clue/php-stream-filter.svg?branch=master)](https://travis-ci.org/clue/php-stream-filter)
2
+
3
+ A simple and modern approach to stream filtering in PHP
4
+
5
+ **Table of contents**
6
+
7
+ * [Why?](#why)
8
+ * [Usage](#usage)
9
+ * [append()](#append)
10
+ * [prepend()](#prepend)
11
+ * [fun()](#fun)
12
+ * [remove()](#remove)
13
+ * [Install](#install)
14
+ * [Tests](#tests)
15
+ * [License](#license)
16
+
17
+ ## Why?
18
+
19
+ PHP's stream filtering system is great!
20
+
21
+ It offers very powerful stream filtering options and comes with a useful set of built-in filters.
22
+ These filters can be used to easily and efficiently perform various transformations on-the-fly, such as:
23
+
24
+ * read from a gzip'ed input file,
25
+ * transcode from ISO-8859-1 (Latin1) to UTF-8,
26
+ * write to a bzip output file
27
+ * and much more.
28
+
29
+ But let's face it:
30
+ Its API is [*difficult to work with*](http://php.net/manual/en/php-user-filter.filter.php)
31
+ and its documentation is [*subpar*](http://stackoverflow.com/questions/27103269/what-is-a-bucket-brigade).
32
+ This combined means its powerful features are often neglected.
33
+
34
+ This project aims to make these features more accessible to a broader audience.
35
+ * **Lightweight, SOLID design** -
36
+ Provides a thin abstraction that is [*just good enough*](http://en.wikipedia.org/wiki/Principle_of_good_enough)
37
+ and does not get in your way.
38
+ Custom filters require trivial effort.
39
+ * **Good test coverage** -
40
+ Comes with an automated tests suite and is regularly tested in the *real world*
41
+
42
+ ## Usage
43
+
44
+ This lightweight library consists only of a few simple functions.
45
+ All functions reside under the `Clue\StreamFilter` namespace.
46
+
47
+ The below examples assume you use an import statement similar to this:
48
+
49
+ ```php
50
+ use Clue\StreamFilter as Filter;
51
+
52
+ Filter\append(…);
53
+ ```
54
+
55
+ Alternatively, you can also refer to them with their fully-qualified name:
56
+
57
+ ```php
58
+ \Clue\StreamFilter\append(…);
59
+ ```
60
+
61
+ ### append()
62
+
63
+ The `append($stream, $callback, $read_write = STREAM_FILTER_ALL)` function can be used to
64
+ append a filter callback to the given stream.
65
+
66
+ Each stream can have a list of filters attached.
67
+ This function appends a filter to the end of this list.
68
+
69
+ This function returns a filter resource which can be passed to [`remove()`](#remove).
70
+ If the given filter can not be added, it throws an `Exception`.
71
+
72
+ The `$stream` can be any valid stream resource, such as:
73
+
74
+ ```php
75
+ $stream = fopen('demo.txt', 'w+');
76
+ ```
77
+
78
+ The `$callback` should be a valid callable function which accepts an individual chunk of data
79
+ and should return the updated chunk:
80
+
81
+ ```php
82
+ $filter = Filter\append($stream, function ($chunk) {
83
+ // will be called each time you read or write a $chunk to/from the stream
84
+ return $chunk;
85
+ });
86
+ ```
87
+
88
+ As such, you can also use native PHP functions or any other `callable`:
89
+
90
+ ```php
91
+ Filter\append($stream, 'strtoupper');
92
+
93
+ // will write "HELLO" to the underlying stream
94
+ fwrite($stream, 'hello');
95
+ ```
96
+
97
+ If the `$callback` accepts invocation without parameters, then this signature
98
+ will be invoked once ending (flushing) the filter:
99
+
100
+ ```php
101
+ Filter\append($stream, function ($chunk = null) {
102
+ if ($chunk === null) {
103
+ // will be called once ending the filter
104
+ return 'end';
105
+ }
106
+ // will be called each time you read or write a $chunk to/from the stream
107
+ return $chunk;
108
+ });
109
+
110
+ fclose($stream);
111
+ ```
112
+
113
+ > Note: Legacy PHP versions (PHP < 5.4) do not support passing additional data
114
+ from the end signal handler if the stream is being closed.
115
+
116
+ If your callback throws an `Exception`, then the filter process will be aborted.
117
+ In order to play nice with PHP's stream handling, the `Exception` will be
118
+ transformed to a PHP warning instead:
119
+
120
+ ```php
121
+ Filter\append($stream, function ($chunk) {
122
+ throw new \RuntimeException('Unexpected chunk');
123
+ });
124
+
125
+ // raises an E_USER_WARNING with "Error invoking filter: Unexpected chunk"
126
+ fwrite($stream, 'hello');
127
+ ```
128
+
129
+ The optional `$read_write` parameter can be used to only invoke the `$callback` when either writing to the stream or only when reading from the stream:
130
+
131
+ ```php
132
+ Filter\append($stream, function ($chunk) {
133
+ // will be called each time you write to the stream
134
+ return $chunk;
135
+ }, STREAM_FILTER_WRITE);
136
+
137
+ Filter\append($stream, function ($chunk) {
138
+ // will be called each time you read from the stream
139
+ return $chunk;
140
+ }, STREAM_FILTER_READ);
141
+ ```
142
+
143
+ > Note that once a filter has been added to stream, the stream can no longer be passed to
144
+ > [`stream_select()`](http://php.net/manual/en/function.stream-select.php)
145
+ > (and family).
146
+ >
147
+ > > Warning: stream_select(): cannot cast a filtered stream on this system in {file} on line {line}
148
+ >
149
+ > This is due to limitations of PHP's stream filter support, as it can no longer reliably
150
+ > tell when the underlying stream resource is actually ready.
151
+ > As an alternative, consider calling `stream_select()` on the unfiltered stream and
152
+ > then pass the unfiltered data through the [`fun()`](#fun) function.
153
+
154
+ ### prepend()
155
+
156
+ The `prepend($stream, $callback, $read_write = STREAM_FILTER_ALL)` function can be used to
157
+ prepend a filter callback to the given stream.
158
+
159
+ Each stream can have a list of filters attached.
160
+ This function prepends a filter to the start of this list.
161
+
162
+ This function returns a filter resource which can be passed to [`remove()`](#remove).
163
+ If the given filter can not be added, it throws an `Exception`.
164
+
165
+ ```php
166
+ $filter = Filter\prepend($stream, function ($chunk) {
167
+ // will be called each time you read or write a $chunk to/from the stream
168
+ return $chunk;
169
+ });
170
+ ```
171
+
172
+ Except for the position in the list of filters, this function behaves exactly
173
+ like the [`append()`](#append) function.
174
+ For more details about its behavior, see also the [`append()`](#append) function.
175
+
176
+ ### fun()
177
+
178
+ The `fun($filter, $parameters = null)` function can be used to
179
+ create a filter function which uses the given built-in `$filter`.
180
+
181
+ PHP comes with a useful set of [built-in filters](http://php.net/manual/en/filters.php).
182
+ Using `fun()` makes accessing these as easy as passing an input string to filter
183
+ and getting the filtered output string.
184
+
185
+ ```php
186
+ $fun = Filter\fun('string.rot13');
187
+
188
+ assert('grfg' === $fun('test'));
189
+ assert('test' === $fun($fun('test'));
190
+ ```
191
+
192
+ Please note that not all filter functions may be available depending on installed
193
+ PHP extensions and the PHP version in use.
194
+ In particular, [HHVM](http://hhvm.com/) may not offer the same filter functions
195
+ or parameters as Zend PHP.
196
+ Accessing an unknown filter function will result in a `RuntimeException`:
197
+
198
+ ```php
199
+ Filter\fun('unknown'); // throws RuntimeException
200
+ ```
201
+
202
+ Some filters may accept or require additional filter parameters – most
203
+ filters do not require filter parameters.
204
+ If given, the optional `$parameters` argument will be passed to the
205
+ underlying filter handler as-is.
206
+ In particular, note how *not passing* this parameter at all differs from
207
+ explicitly passing a `null` value (which many filters do not accept).
208
+ Please refer to the individual filter definition for more details.
209
+ For example, the `string.strip_tags` filter can be invoked like this:
210
+
211
+ ```php
212
+ $fun = Filter\fun('string.strip_tags', '<a><b>');
213
+
214
+ $ret = $fun('<b>h<br>i</b>');
215
+ assert('<b>hi</b>' === $ret);
216
+ ```
217
+
218
+ Under the hood, this function allocates a temporary memory stream, so it's
219
+ recommended to clean up the filter function after use.
220
+ Also, some filter functions (in particular the
221
+ [zlib compression filters](http://php.net/manual/en/filters.compression.php))
222
+ may use internal buffers and may emit a final data chunk on close.
223
+ The filter function can be closed by invoking without any arguments:
224
+
225
+ ```php
226
+ $fun = Filter\fun('zlib.deflate');
227
+
228
+ $ret = $fun('hello') . $fun('world') . $fun();
229
+ assert('helloworld' === gzinflate($ret));
230
+ ```
231
+
232
+ The filter function must not be used anymore after it has been closed.
233
+ Doing so will result in a `RuntimeException`:
234
+
235
+ ```php
236
+ $fun = Filter\fun('string.rot13');
237
+ $fun();
238
+
239
+ $fun('test'); // throws RuntimeException
240
+ ```
241
+
242
+ > Note: If you're using the zlib compression filters, then you should be wary
243
+ about engine inconsistencies between different PHP versions and HHVM.
244
+ These inconsistencies exist in the underlying PHP engines and there's little we
245
+ can do about this in this library.
246
+ [Our test suite](tests/) contains several test cases that exhibit these issues.
247
+ If you feel some test case is missing or outdated, we're happy to accept PRs! :)
248
+
249
+ ### remove()
250
+
251
+ The `remove($filter)` function can be used to
252
+ remove a filter previously added via [`append()`](#append) or [`prepend()`](#prepend).
253
+
254
+ ```php
255
+ $filter = Filter\append($stream, function () {
256
+ // …
257
+ });
258
+ Filter\remove($filter);
259
+ ```
260
+
261
+ ## Install
262
+
263
+ The recommended way to install this library is [through Composer](https://getcomposer.org).
264
+ [New to Composer?](https://getcomposer.org/doc/00-intro.md)
265
+
266
+ This will install the latest supported version:
267
+
268
+ ```bash
269
+ $ composer require clue/stream-filter:^1.4
270
+ ```
271
+
272
+ See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
273
+
274
+ This project aims to run on any platform and thus does not require any PHP
275
+ extensions and supports running on legacy PHP 5.3 through current PHP 7+ and
276
+ HHVM.
277
+ It's *highly recommended to use PHP 7+* for this project.
278
+ Older PHP versions may suffer from a number of inconsistencies documented above.
279
+
280
+ ## Tests
281
+
282
+ To run the test suite, you first need to clone this repo and then install all
283
+ dependencies [through Composer](http://getcomposer.org):
284
+
285
+ ```bash
286
+ $ composer install
287
+ ```
288
+
289
+ To run the test suite, go to the project root and run:
290
+
291
+ ```bash
292
+ $ php vendor/bin/phpunit
293
+ ```
294
+
295
+ ## License
296
+
297
+ MIT
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/composer.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "clue/stream-filter",
3
+ "description": "A simple and modern approach to stream filtering in PHP",
4
+ "keywords": ["stream", "callback", "filter", "php_user_filter", "stream_filter_append", "stream_filter_register", "bucket brigade"],
5
+ "homepage": "https://github.com/clue/php-stream-filter",
6
+ "license": "MIT",
7
+ "authors": [
8
+ {
9
+ "name": "Christian Lück",
10
+ "email": "christian@lueck.tv"
11
+ }
12
+ ],
13
+ "require": {
14
+ "php": ">=5.3"
15
+ },
16
+ "require-dev": {
17
+ "phpunit/phpunit": "^5.0 || ^4.8"
18
+ },
19
+ "autoload": {
20
+ "psr-4": { "Clue\\StreamFilter\\": "src/" },
21
+ "files": [ "src/functions.php" ]
22
+ }
23
+ }
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/examples/base64_decode.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // $ echo test | php examples/base64_encode.php | php examples/base64_decode.php
4
+
5
+ require __DIR__ . '/../vendor/autoload.php';
6
+
7
+ // decoding requires buffering in chunks of 4 bytes each
8
+ $buffer = '';
9
+ Clue\StreamFilter\append(STDIN, function ($chunk = null) use (&$buffer) {
10
+ if ($chunk === null) {
11
+ if (strlen($buffer) % 4 !== 0) {
12
+ throw new \UnexpectedValueException('Invalid length');
13
+ }
14
+ $chunk = $buffer;
15
+ } else {
16
+ $buffer .= $chunk;
17
+ $len = strlen($buffer) - (strlen($buffer) % 4);
18
+ $chunk = (string)substr($buffer, 0, $len);
19
+ $buffer = (string)substr($buffer, $len);
20
+ }
21
+
22
+ $ret = base64_decode($chunk, true);
23
+ if ($ret === false) {
24
+ throw new \UnexpectedValueException('Not a valid base64 encoded chunk');
25
+ }
26
+ return $ret;
27
+ }, STREAM_FILTER_READ);
28
+
29
+ fpassthru(STDIN);
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/examples/base64_encode.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // $ echo test | php examples/base64_encode.php | base64 --decode
4
+
5
+ require __DIR__ . '/../vendor/autoload.php';
6
+
7
+ // encoding requires buffering in chunks of 3 bytes each
8
+ $buffer = '';
9
+ Clue\StreamFilter\append(STDIN, function ($chunk = null) use (&$buffer) {
10
+ if ($chunk === null) {
11
+ return base64_encode($buffer);
12
+ }
13
+ $buffer .= $chunk;
14
+ $len = strlen($buffer) - (strlen($buffer) % 3);
15
+ $chunk = substr($buffer, 0, $len);
16
+ $buffer = substr($buffer, $len);
17
+
18
+ return base64_encode($chunk);
19
+ }, STREAM_FILTER_READ);
20
+
21
+ fpassthru(STDIN);
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/examples/uppercase.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // $ echo test | php examples/uppercase.php
4
+
5
+ require __DIR__ . '/../vendor/autoload.php';
6
+
7
+ Clue\StreamFilter\append(STDIN, 'strtoupper');
8
+
9
+ fpassthru(STDIN);
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/phpunit.xml.dist ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit bootstrap="vendor/autoload.php"
4
+ colors="true"
5
+ convertErrorsToExceptions="true"
6
+ convertNoticesToExceptions="true"
7
+ convertWarningsToExceptions="true"
8
+ >
9
+ <testsuites>
10
+ <testsuite>
11
+ <directory>./tests/</directory>
12
+ </testsuite>
13
+ </testsuites>
14
+ <filter>
15
+ <whitelist>
16
+ <directory>./src/</directory>
17
+ </whitelist>
18
+ </filter>
19
+ </phpunit>
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/src/CallbackFilter.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Clue\StreamFilter;
4
+
5
+ use php_user_filter;
6
+ use InvalidArgumentException;
7
+ use ReflectionFunction;
8
+ use Exception;
9
+
10
+ /**
11
+ *
12
+ * @internal
13
+ * @see append()
14
+ * @see prepend()
15
+ */
16
+ class CallbackFilter extends php_user_filter
17
+ {
18
+ private $callback;
19
+ private $closed = true;
20
+ private $supportsClose = false;
21
+
22
+ public function onCreate()
23
+ {
24
+ $this->closed = false;
25
+
26
+ if (!is_callable($this->params)) {
27
+ throw new InvalidArgumentException('No valid callback parameter given to stream_filter_(append|prepend)');
28
+ }
29
+ $this->callback = $this->params;
30
+
31
+ // callback supports end event if it accepts invocation without arguments
32
+ $ref = new ReflectionFunction($this->callback);
33
+ $this->supportsClose = ($ref->getNumberOfRequiredParameters() === 0);
34
+
35
+ return true;
36
+ }
37
+
38
+ public function onClose()
39
+ {
40
+ $this->closed = true;
41
+
42
+ // callback supports closing and is not already closed
43
+ if ($this->supportsClose) {
44
+ $this->supportsClose = false;
45
+ // invoke without argument to signal end and discard resulting buffer
46
+ try {
47
+ call_user_func($this->callback);
48
+ } catch (Exception $ignored) {
49
+ // this might be called during engine shutdown, so it's not safe
50
+ // to raise any errors or exceptions here
51
+ // trigger_error('Error closing filter: ' . $ignored->getMessage(), E_USER_WARNING);
52
+ }
53
+ }
54
+
55
+ $this->callback = null;
56
+ }
57
+
58
+ public function filter($in, $out, &$consumed, $closing)
59
+ {
60
+ // concatenate whole buffer from input brigade
61
+ $data = '';
62
+ while ($bucket = stream_bucket_make_writeable($in)) {
63
+ $consumed += $bucket->datalen;
64
+ $data .= $bucket->data;
65
+ }
66
+
67
+ // skip processing callback that already ended
68
+ if ($this->closed) {
69
+ return PSFS_FEED_ME;
70
+ }
71
+
72
+ // only invoke filter function if buffer is not empty
73
+ // this may skip flushing a closing filter
74
+ if ($data !== '') {
75
+ try {
76
+ $data = call_user_func($this->callback, $data);
77
+ } catch (Exception $e) {
78
+ // exception should mark filter as closed
79
+ $this->onClose();
80
+ trigger_error('Error invoking filter: ' . $e->getMessage(), E_USER_WARNING);
81
+
82
+ return PSFS_ERR_FATAL;
83
+ }
84
+ }
85
+
86
+ // mark filter as closed after processing closing chunk
87
+ if ($closing) {
88
+ $this->closed = true;
89
+
90
+ // callback supports closing and is not already closed
91
+ if ($this->supportsClose) {
92
+ $this->supportsClose = false;
93
+
94
+ // invoke without argument to signal end and append resulting buffer
95
+ try {
96
+ $data .= call_user_func($this->callback);
97
+ } catch (Exception $e) {
98
+ trigger_error('Error ending filter: ' . $e->getMessage(), E_USER_WARNING);
99
+
100
+ return PSFS_ERR_FATAL;
101
+ }
102
+ }
103
+ }
104
+
105
+ if ($data !== '') {
106
+ // create a new bucket for writing the resulting buffer to the output brigade
107
+ // reusing an existing bucket turned out to be bugged in some environments (ancient PHP versions and HHVM)
108
+ $bucket = @stream_bucket_new($this->stream, $data);
109
+
110
+ // legacy PHP versions (PHP < 5.4) do not support passing data from the event signal handler
111
+ // because closing the stream invalidates the stream and its stream bucket brigade before
112
+ // invoking the filter close handler.
113
+ if ($bucket !== false) {
114
+ stream_bucket_append($out, $bucket);
115
+ }
116
+ }
117
+
118
+ return PSFS_PASS_ON;
119
+ }
120
+ }
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/src/functions.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Clue\StreamFilter;
4
+
5
+ use RuntimeException;
6
+
7
+ /**
8
+ * append a callback filter to the given stream
9
+ *
10
+ * @param resource $stream
11
+ * @param callable $callback
12
+ * @param int $read_write
13
+ * @return resource filter resource which can be used for `remove()`
14
+ * @throws Exception on error
15
+ * @uses stream_filter_append()
16
+ */
17
+ function append($stream, $callback, $read_write = STREAM_FILTER_ALL)
18
+ {
19
+ $ret = @stream_filter_append($stream, register(), $read_write, $callback);
20
+
21
+ if ($ret === false) {
22
+ $error = error_get_last() + array('message' => '');
23
+ throw new RuntimeException('Unable to append filter: ' . $error['message']);
24
+ }
25
+
26
+ return $ret;
27
+ }
28
+
29
+ /**
30
+ * prepend a callback filter to the given stream
31
+ *
32
+ * @param resource $stream
33
+ * @param callable $callback
34
+ * @param int $read_write
35
+ * @return resource filter resource which can be used for `remove()`
36
+ * @throws Exception on error
37
+ * @uses stream_filter_prepend()
38
+ */
39
+ function prepend($stream, $callback, $read_write = STREAM_FILTER_ALL)
40
+ {
41
+ $ret = @stream_filter_prepend($stream, register(), $read_write, $callback);
42
+
43
+ if ($ret === false) {
44
+ $error = error_get_last() + array('message' => '');
45
+ throw new RuntimeException('Unable to prepend filter: ' . $error['message']);
46
+ }
47
+
48
+ return $ret;
49
+ }
50
+
51
+ /**
52
+ * Creates filter fun (function) which uses the given built-in $filter
53
+ *
54
+ * Some filters may accept or require additional filter parameters – most
55
+ * filters do not require filter parameters.
56
+ * If given, the optional `$parameters` argument will be passed to the
57
+ * underlying filter handler as-is.
58
+ * In particular, note how *not passing* this parameter at all differs from
59
+ * explicitly passing a `null` value (which many filters do not accept).
60
+ * Please refer to the individual filter definition for more details.
61
+ *
62
+ * @param string $filter built-in filter name. See stream_get_filters() or http://php.net/manual/en/filters.php
63
+ * @param mixed $parameters (optional) parameters to pass to the built-in filter as-is
64
+ * @return callable a filter callback which can be append()'ed or prepend()'ed
65
+ * @throws RuntimeException on error
66
+ * @link http://php.net/manual/en/filters.php
67
+ * @see stream_get_filters()
68
+ * @see append()
69
+ */
70
+ function fun($filter, $parameters = null)
71
+ {
72
+ $fp = fopen('php://memory', 'w');
73
+ if (func_num_args() === 1) {
74
+ $filter = @stream_filter_append($fp, $filter, STREAM_FILTER_WRITE);
75
+ } else {
76
+ $filter = @stream_filter_append($fp, $filter, STREAM_FILTER_WRITE, $parameters);
77
+ }
78
+
79
+ if ($filter === false) {
80
+ fclose($fp);
81
+ $error = error_get_last() + array('message' => '');
82
+ throw new RuntimeException('Unable to access built-in filter: ' . $error['message']);
83
+ }
84
+
85
+ // append filter function which buffers internally
86
+ $buffer = '';
87
+ append($fp, function ($chunk) use (&$buffer) {
88
+ $buffer .= $chunk;
89
+
90
+ // always return empty string in order to skip actually writing to stream resource
91
+ return '';
92
+ }, STREAM_FILTER_WRITE);
93
+
94
+ $closed = false;
95
+
96
+ return function ($chunk = null) use ($fp, $filter, &$buffer, &$closed) {
97
+ if ($closed) {
98
+ throw new \RuntimeException('Unable to perform operation on closed stream');
99
+ }
100
+ if ($chunk === null) {
101
+ $closed = true;
102
+ $buffer = '';
103
+ fclose($fp);
104
+ return $buffer;
105
+ }
106
+ // initialize buffer and invoke filters by attempting to write to stream
107
+ $buffer = '';
108
+ fwrite($fp, $chunk);
109
+
110
+ // buffer now contains everything the filter function returned
111
+ return $buffer;
112
+ };
113
+ }
114
+
115
+ /**
116
+ * remove a callback filter from the given stream
117
+ *
118
+ * @param resource $filter
119
+ * @return boolean true on success or false on error
120
+ * @throws Exception on error
121
+ * @uses stream_filter_remove()
122
+ */
123
+ function remove($filter)
124
+ {
125
+ if (@stream_filter_remove($filter) === false) {
126
+ throw new RuntimeException('Unable to remove given filter');
127
+ }
128
+ }
129
+
130
+ /**
131
+ * registers the callback filter and returns the resulting filter name
132
+ *
133
+ * There should be little reason to call this function manually.
134
+ *
135
+ * @return string filter name
136
+ * @uses CallbackFilter
137
+ */
138
+ function register()
139
+ {
140
+ static $registered = null;
141
+ if ($registered === null) {
142
+ $registered = 'stream-callback';
143
+ stream_filter_register($registered, __NAMESPACE__ . '\CallbackFilter');
144
+ }
145
+ return $registered;
146
+ }
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/tests/FilterTest.php ADDED
@@ -0,0 +1,386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use Clue\StreamFilter;
4
+
5
+ class FilterTest extends PHPUnit_Framework_TestCase
6
+ {
7
+ public function testAppendSimpleCallback()
8
+ {
9
+ $stream = $this->createStream();
10
+
11
+ StreamFilter\append($stream, function ($chunk) {
12
+ return strtoupper($chunk);
13
+ });
14
+
15
+ fwrite($stream, 'hello');
16
+ fwrite($stream, 'world');
17
+ rewind($stream);
18
+
19
+ $this->assertEquals('HELLOWORLD', stream_get_contents($stream));
20
+
21
+ fclose($stream);
22
+ }
23
+
24
+ public function testAppendNativePhpFunction()
25
+ {
26
+ $stream = $this->createStream();
27
+
28
+ StreamFilter\append($stream, 'strtoupper');
29
+
30
+ fwrite($stream, 'hello');
31
+ fwrite($stream, 'world');
32
+ rewind($stream);
33
+
34
+ $this->assertEquals('HELLOWORLD', stream_get_contents($stream));
35
+
36
+ fclose($stream);
37
+ }
38
+
39
+ public function testAppendChangingChunkSize()
40
+ {
41
+ $stream = $this->createStream();
42
+
43
+ StreamFilter\append($stream, function ($chunk) {
44
+ return str_replace(array('a','e','i','o','u'), '', $chunk);
45
+ });
46
+
47
+ fwrite($stream, 'hello');
48
+ fwrite($stream, 'world');
49
+ rewind($stream);
50
+
51
+ $this->assertEquals('hllwrld', stream_get_contents($stream));
52
+
53
+ fclose($stream);
54
+ }
55
+
56
+ public function testAppendReturningEmptyStringWillNotPassThrough()
57
+ {
58
+ $stream = $this->createStream();
59
+
60
+ StreamFilter\append($stream, function ($chunk) {
61
+ return '';
62
+ });
63
+
64
+ fwrite($stream, 'hello');
65
+ fwrite($stream, 'world');
66
+ rewind($stream);
67
+
68
+ $this->assertEquals('', stream_get_contents($stream));
69
+
70
+ fclose($stream);
71
+ }
72
+
73
+ public function testAppendEndEventCanBeBufferedOnClose()
74
+ {
75
+ if (PHP_VERSION < 5.4) $this->markTestSkipped('Not supported on legacy PHP');
76
+
77
+ $stream = $this->createStream();
78
+
79
+ StreamFilter\append($stream, function ($chunk = null) {
80
+ if ($chunk === null) {
81
+ // this signals the end event
82
+ return '!';
83
+ }
84
+ return $chunk . ' ';
85
+ }, STREAM_FILTER_WRITE);
86
+
87
+ $buffered = '';
88
+ StreamFilter\append($stream, function ($chunk) use (&$buffered) {
89
+ $buffered .= $chunk;
90
+ return '';
91
+ });
92
+
93
+ fwrite($stream, 'hello');
94
+ fwrite($stream, 'world');
95
+
96
+ fclose($stream);
97
+
98
+ $this->assertEquals('hello world !', $buffered);
99
+ }
100
+
101
+ public function testAppendEndEventWillBeCalledOnRemove()
102
+ {
103
+ $stream = $this->createStream();
104
+
105
+ $ended = false;
106
+ $filter = StreamFilter\append($stream, function ($chunk = null) use (&$ended) {
107
+ if ($chunk === null) {
108
+ $ended = true;
109
+ }
110
+ return $chunk;
111
+ }, STREAM_FILTER_WRITE);
112
+
113
+ $this->assertEquals(0, $ended);
114
+ StreamFilter\remove($filter);
115
+ $this->assertEquals(1, $ended);
116
+ }
117
+
118
+ public function testAppendEndEventWillBeCalledOnClose()
119
+ {
120
+ $stream = $this->createStream();
121
+
122
+ $ended = false;
123
+ StreamFilter\append($stream, function ($chunk = null) use (&$ended) {
124
+ if ($chunk === null) {
125
+ $ended = true;
126
+ }
127
+ return $chunk;
128
+ }, STREAM_FILTER_WRITE);
129
+
130
+ $this->assertEquals(0, $ended);
131
+ fclose($stream);
132
+ $this->assertEquals(1, $ended);
133
+ }
134
+
135
+ public function testAppendWriteOnly()
136
+ {
137
+ $stream = $this->createStream();
138
+
139
+ $invoked = 0;
140
+
141
+ StreamFilter\append($stream, function ($chunk) use (&$invoked) {
142
+ ++$invoked;
143
+
144
+ return $chunk;
145
+ }, STREAM_FILTER_WRITE);
146
+
147
+ fwrite($stream, 'a');
148
+ fwrite($stream, 'b');
149
+ fwrite($stream, 'c');
150
+ rewind($stream);
151
+
152
+ $this->assertEquals(3, $invoked);
153
+ $this->assertEquals('abc', stream_get_contents($stream));
154
+
155
+ fclose($stream);
156
+ }
157
+
158
+ public function testAppendReadOnly()
159
+ {
160
+ $stream = $this->createStream();
161
+
162
+ $invoked = 0;
163
+
164
+ StreamFilter\append($stream, function ($chunk) use (&$invoked) {
165
+ ++$invoked;
166
+
167
+ return $chunk;
168
+ }, STREAM_FILTER_READ);
169
+
170
+ fwrite($stream, 'a');
171
+ fwrite($stream, 'b');
172
+ fwrite($stream, 'c');
173
+ rewind($stream);
174
+
175
+ $this->assertEquals(0, $invoked);
176
+ $this->assertEquals('abc', stream_get_contents($stream));
177
+ $this->assertEquals(1, $invoked);
178
+
179
+ fclose($stream);
180
+ }
181
+
182
+ public function testOrderCallingAppendAfterPrepend()
183
+ {
184
+ $stream = $this->createStream();
185
+
186
+ StreamFilter\append($stream, function ($chunk) {
187
+ return '[' . $chunk . ']';
188
+ }, STREAM_FILTER_WRITE);
189
+
190
+ StreamFilter\prepend($stream, function ($chunk) {
191
+ return '(' . $chunk . ')';
192
+ }, STREAM_FILTER_WRITE);
193
+
194
+ fwrite($stream, 'hello');
195
+ rewind($stream);
196
+
197
+ $this->assertEquals('[(hello)]', stream_get_contents($stream));
198
+
199
+ fclose($stream);
200
+ }
201
+
202
+ public function testRemoveFilter()
203
+ {
204
+ $stream = $this->createStream();
205
+
206
+ $first = StreamFilter\append($stream, function ($chunk) {
207
+ return $chunk . '?';
208
+ }, STREAM_FILTER_WRITE);
209
+
210
+ StreamFilter\append($stream, function ($chunk) {
211
+ return $chunk . '!';
212
+ }, STREAM_FILTER_WRITE);
213
+
214
+ StreamFilter\remove($first);
215
+
216
+ fwrite($stream, 'hello');
217
+ rewind($stream);
218
+
219
+ $this->assertEquals('hello!', stream_get_contents($stream));
220
+
221
+ fclose($stream);
222
+ }
223
+
224
+ public function testAppendFunDechunk()
225
+ {
226
+ if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (dechunk filter does not exist)');
227
+
228
+ $stream = $this->createStream();
229
+
230
+ StreamFilter\append($stream, StreamFilter\fun('dechunk'), STREAM_FILTER_WRITE);
231
+
232
+ fwrite($stream, "2\r\nhe\r\n");
233
+ fwrite($stream, "3\r\nllo\r\n");
234
+ fwrite($stream, "0\r\n\r\n");
235
+ rewind($stream);
236
+
237
+ $this->assertEquals('hello', stream_get_contents($stream));
238
+
239
+ fclose($stream);
240
+ }
241
+
242
+ public function testAppendThrows()
243
+ {
244
+ $this->createErrorHandler($errors);
245
+
246
+ $stream = $this->createStream();
247
+ $this->createErrorHandler($errors);
248
+
249
+ StreamFilter\append($stream, function ($chunk) {
250
+ throw new \DomainException($chunk);
251
+ });
252
+
253
+ fwrite($stream, 'test');
254
+
255
+ $this->removeErrorHandler();
256
+ $this->assertCount(1, $errors);
257
+ $this->assertContains('test', $errors[0]);
258
+ }
259
+
260
+ public function testAppendThrowsDuringEnd()
261
+ {
262
+ $stream = $this->createStream();
263
+ $this->createErrorHandler($errors);
264
+
265
+ StreamFilter\append($stream, function ($chunk = null) {
266
+ if ($chunk === null) {
267
+ throw new \DomainException('end');
268
+ }
269
+ return $chunk;
270
+ });
271
+
272
+ fclose($stream);
273
+
274
+ $this->removeErrorHandler();
275
+
276
+ // We can only assert we're not seeing an exception here…
277
+ // * php 5.3-5.6 sees one error here
278
+ // * php 7 does not see any error here
279
+ // * hhvm sees the same error twice
280
+ //
281
+ // If you're curious:
282
+ //
283
+ // var_dump($errors);
284
+ // $this->assertCount(1, $errors);
285
+ // $this->assertContains('end', $errors[0]);
286
+ }
287
+
288
+ public function testAppendThrowsShouldTriggerEnd()
289
+ {
290
+ $stream = $this->createStream();
291
+ $this->createErrorHandler($errors);
292
+
293
+ $ended = false;
294
+ StreamFilter\append($stream, function ($chunk = null) use (&$ended) {
295
+ if ($chunk === null) {
296
+ $ended = true;
297
+ return '';
298
+ }
299
+ throw new \DomainException($chunk);
300
+ });
301
+
302
+ $this->assertEquals(false, $ended);
303
+ fwrite($stream, 'test');
304
+ $this->assertEquals(true, $ended);
305
+
306
+ $this->removeErrorHandler();
307
+ $this->assertCount(1, $errors);
308
+ $this->assertContains('test', $errors[0]);
309
+ }
310
+
311
+ public function testAppendThrowsShouldTriggerEndButIgnoreExceptionDuringEnd()
312
+ {
313
+ //$this->markTestIncomplete();
314
+ $stream = $this->createStream();
315
+ $this->createErrorHandler($errors);
316
+
317
+ StreamFilter\append($stream, function ($chunk = null) {
318
+ if ($chunk === null) {
319
+ $chunk = 'end';
320
+ //return '';
321
+ }
322
+ throw new \DomainException($chunk);
323
+ });
324
+
325
+ fwrite($stream, 'test');
326
+
327
+ $this->removeErrorHandler();
328
+ $this->assertCount(1, $errors);
329
+ $this->assertContains('test', $errors[0]);
330
+ }
331
+
332
+ /**
333
+ * @expectedException RuntimeException
334
+ */
335
+ public function testAppendInvalidStreamIsRuntimeError()
336
+ {
337
+ if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (does not reject invalid stream)');
338
+ StreamFilter\append(false, function () { });
339
+ }
340
+
341
+ /**
342
+ * @expectedException RuntimeException
343
+ */
344
+ public function testPrependInvalidStreamIsRuntimeError()
345
+ {
346
+ if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (does not reject invalid stream)');
347
+ StreamFilter\prepend(false, function () { });
348
+ }
349
+
350
+ /**
351
+ * @expectedException RuntimeException
352
+ */
353
+ public function testRemoveInvalidFilterIsRuntimeError()
354
+ {
355
+ if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (does not reject invalid filters)');
356
+ StreamFilter\remove(false);
357
+ }
358
+
359
+ /**
360
+ * @expectedException InvalidArgumentException
361
+ */
362
+ public function testInvalidCallbackIsInvalidArgument()
363
+ {
364
+ $stream = $this->createStream();
365
+
366
+ StreamFilter\append($stream, 'a-b-c');
367
+ }
368
+
369
+ private function createStream()
370
+ {
371
+ return fopen('php://memory', 'r+');
372
+ }
373
+
374
+ private function createErrorHandler(&$errors)
375
+ {
376
+ $errors = array();
377
+ set_error_handler(function ($_, $message) use (&$errors) {
378
+ $errors []= $message;
379
+ });
380
+ }
381
+
382
+ private function removeErrorHandler()
383
+ {
384
+ restore_error_handler();
385
+ }
386
+ }
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/tests/FunTest.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use Clue\StreamFilter as Filter;
4
+
5
+ class FunTest extends PHPUnit_Framework_TestCase
6
+ {
7
+ public function testFunInRot13()
8
+ {
9
+ $rot = Filter\fun('string.rot13');
10
+
11
+ $this->assertEquals('grfg', $rot('test'));
12
+ $this->assertEquals('test', $rot($rot('test')));
13
+ $this->assertEquals(null, $rot());
14
+ }
15
+
16
+ public function testFunInQuotedPrintable()
17
+ {
18
+ $encode = Filter\fun('convert.quoted-printable-encode');
19
+ $decode = Filter\fun('convert.quoted-printable-decode');
20
+
21
+ $this->assertEquals('t=C3=A4st', $encode('täst'));
22
+ $this->assertEquals('täst', $decode($encode('täst')));
23
+ $this->assertEquals(null, $encode());
24
+ }
25
+
26
+ /**
27
+ * @expectedException RuntimeException
28
+ */
29
+ public function testFunWriteAfterCloseRot13()
30
+ {
31
+ $rot = Filter\fun('string.rot13');
32
+
33
+ $this->assertEquals(null, $rot());
34
+ $rot('test');
35
+ }
36
+
37
+ /**
38
+ * @expectedException RuntimeException
39
+ */
40
+ public function testFunInvalid()
41
+ {
42
+ Filter\fun('unknown');
43
+ }
44
+ }
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/tests/FunZlibTest.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use Clue\StreamFilter;
4
+
5
+ class BuiltInZlibTest extends PHPUnit_Framework_TestCase
6
+ {
7
+ public function testFunZlibDeflateHelloWorld()
8
+ {
9
+ $deflate = StreamFilter\fun('zlib.deflate');
10
+
11
+ $data = $deflate('hello') . $deflate(' ') . $deflate('world') . $deflate();
12
+
13
+ $this->assertEquals(gzdeflate('hello world'), $data);
14
+ }
15
+
16
+ public function testFunZlibDeflateEmpty()
17
+ {
18
+ if (PHP_VERSION >= 7) $this->markTestSkipped('Not supported on PHP7 (empty string does not invoke filter)');
19
+
20
+ $deflate = StreamFilter\fun('zlib.deflate');
21
+
22
+ //$data = gzdeflate('');
23
+ $data = $deflate();
24
+
25
+ $this->assertEquals("\x03\x00", $data);
26
+ }
27
+
28
+ public function testFunZlibDeflateBig()
29
+ {
30
+ $deflate = StreamFilter\fun('zlib.deflate');
31
+
32
+ $n = 1000;
33
+ $expected = str_repeat('hello', $n);
34
+
35
+ $bytes = '';
36
+ for ($i = 0; $i < $n; ++$i) {
37
+ $bytes .= $deflate('hello');
38
+ }
39
+ $bytes .= $deflate();
40
+
41
+ $this->assertEquals($expected, gzinflate($bytes));
42
+ }
43
+
44
+ public function testFunZlibInflateHelloWorld()
45
+ {
46
+ $inflate = StreamFilter\fun('zlib.inflate');
47
+
48
+ $data = $inflate(gzdeflate('hello world')) . $inflate();
49
+
50
+ $this->assertEquals('hello world', $data);
51
+ }
52
+
53
+ public function testFunZlibInflateEmpty()
54
+ {
55
+ $inflate = StreamFilter\fun('zlib.inflate');
56
+
57
+ $data = $inflate("\x03\x00") . $inflate();
58
+
59
+ $this->assertEquals('', $data);
60
+ }
61
+
62
+ public function testFunZlibInflateBig()
63
+ {
64
+ if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (final chunk will not be emitted)');
65
+
66
+ $inflate = StreamFilter\fun('zlib.inflate');
67
+
68
+ $expected = str_repeat('hello', 10);
69
+ $bytes = gzdeflate($expected);
70
+
71
+ $ret = '';
72
+ foreach (str_split($bytes, 2) as $chunk) {
73
+ $ret .= $inflate($chunk);
74
+ }
75
+ $ret .= $inflate();
76
+
77
+ $this->assertEquals($expected, $ret);
78
+ }
79
+ }
Postman/Postman-Mail/mailgun/vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+
57
+ private $classMapAuthoritative = false;
58
+
59
+ public function getPrefixes()
60
+ {
61
+ if (!empty($this->prefixesPsr0)) {
62
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
63
+ }
64
+
65
+ return array();
66
+ }
67
+
68
+ public function getPrefixesPsr4()
69
+ {
70
+ return $this->prefixDirsPsr4;
71
+ }
72
+
73
+ public function getFallbackDirs()
74
+ {
75
+ return $this->fallbackDirsPsr0;
76
+ }
77
+
78
+ public function getFallbackDirsPsr4()
79
+ {
80
+ return $this->fallbackDirsPsr4;
81
+ }
82
+
83
+ public function getClassMap()
84
+ {
85
+ return $this->classMap;
86
+ }
87
+
88
+ /**
89
+ * @param array $classMap Class to filename map
90
+ */
91
+ public function addClassMap(array $classMap)
92
+ {
93
+ if ($this->classMap) {
94
+ $this->classMap = array_merge($this->classMap, $classMap);
95
+ } else {
96
+ $this->classMap = $classMap;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Registers a set of PSR-0 directories for a given prefix, either
102
+ * appending or prepending to the ones previously set for this prefix.
103
+ *
104
+ * @param string $prefix The prefix
105
+ * @param array|string $paths The PSR-0 root directories
106
+ * @param bool $prepend Whether to prepend the directories
107
+ */
108
+ public function add($prefix, $paths, $prepend = false)
109
+ {
110
+ if (!$prefix) {
111
+ if ($prepend) {
112
+ $this->fallbackDirsPsr0 = array_merge(
113
+ (array) $paths,
114
+ $this->fallbackDirsPsr0
115
+ );
116
+ } else {
117
+ $this->fallbackDirsPsr0 = array_merge(
118
+ $this->fallbackDirsPsr0,
119
+ (array) $paths
120
+ );
121
+ }
122
+
123
+ return;
124
+ }
125
+
126
+ $first = $prefix[0];
127
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
+
130
+ return;
131
+ }
132
+ if ($prepend) {
133
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
134
+ (array) $paths,
135
+ $this->prefixesPsr0[$first][$prefix]
136
+ );
137
+ } else {
138
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
139
+ $this->prefixesPsr0[$first][$prefix],
140
+ (array) $paths
141
+ );
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Registers a set of PSR-4 directories for a given namespace, either
147
+ * appending or prepending to the ones previously set for this namespace.
148
+ *
149
+ * @param string $prefix The prefix/namespace, with trailing '\\'
150
+ * @param array|string $paths The PSR-4 base directories
151
+ * @param bool $prepend Whether to prepend the directories
152
+ *
153
+ * @throws \InvalidArgumentException
154
+ */
155
+ public function addPsr4($prefix, $paths, $prepend = false)
156
+ {
157
+ if (!$prefix) {
158
+ // Register directories for the root namespace.
159
+ if ($prepend) {
160
+ $this->fallbackDirsPsr4 = array_merge(
161
+ (array) $paths,
162
+ $this->fallbackDirsPsr4
163
+ );
164
+ } else {
165
+ $this->fallbackDirsPsr4 = array_merge(
166
+ $this->fallbackDirsPsr4,
167
+ (array) $paths
168
+ );
169
+ }
170
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+ // Register directories for a new namespace.
172
+ $length = strlen($prefix);
173
+ if ('\\' !== $prefix[$length - 1]) {
174
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
175
+ }
176
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
177
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
+ } elseif ($prepend) {
179
+ // Prepend directories for an already registered namespace.
180
+ $this->prefixDirsPsr4[$prefix] = array_merge(
181
+ (array) $paths,
182
+ $this->prefixDirsPsr4[$prefix]
183
+ );
184
+ } else {
185
+ // Append directories for an already registered namespace.
186
+ $this->prefixDirsPsr4[$prefix] = array_merge(
187
+ $this->prefixDirsPsr4[$prefix],
188
+ (array) $paths
189
+ );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Registers a set of PSR-0 directories for a given prefix,
195
+ * replacing any others previously set for this prefix.
196
+ *
197
+ * @param string $prefix The prefix
198
+ * @param array|string $paths The PSR-0 base directories
199
+ */
200
+ public function set($prefix, $paths)
201
+ {
202
+ if (!$prefix) {
203
+ $this->fallbackDirsPsr0 = (array) $paths;
204
+ } else {
205
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Registers a set of PSR-4 directories for a given namespace,
211
+ * replacing any others previously set for this namespace.
212
+ *
213
+ * @param string $prefix The prefix/namespace, with trailing '\\'
214
+ * @param array|string $paths The PSR-4 base directories
215
+ *
216
+ * @throws \InvalidArgumentException
217
+ */
218
+ public function setPsr4($prefix, $paths)
219
+ {
220
+ if (!$prefix) {
221
+ $this->fallbackDirsPsr4 = (array) $paths;
222
+ } else {
223
+ $length = strlen($prefix);
224
+ if ('\\' !== $prefix[$length - 1]) {
225
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226
+ }
227
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Turns on searching the include path for class files.
234
+ *
235
+ * @param bool $useIncludePath
236
+ */
237
+ public function setUseIncludePath($useIncludePath)
238
+ {
239
+ $this->useIncludePath = $useIncludePath;
240
+ }
241
+
242
+ /**
243
+ * Can be used to check if the autoloader uses the include path to check
244
+ * for classes.
245
+ *
246
+ * @return bool
247
+ */
248
+ public function getUseIncludePath()
249
+ {
250
+ return $this->useIncludePath;
251
+ }
252
+
253
+ /**
254
+ * Turns off searching the prefix and fallback directories for classes
255
+ * that have not been registered with the class map.
256
+ *
257
+ * @param bool $classMapAuthoritative
258
+ */
259
+ public function setClassMapAuthoritative($classMapAuthoritative)
260
+ {
261
+ $this->classMapAuthoritative = $classMapAuthoritative;
262
+ }
263
+
264
+ /**
265
+ * Should class lookup fail if not found in the current class map?
266
+ *
267
+ * @return bool
268
+ */
269
+ public function isClassMapAuthoritative()
270
+ {
271
+ return $this->classMapAuthoritative;
272
+ }
273
+
274
+ /**
275
+ * Registers this instance as an autoloader.
276
+ *
277
+ * @param bool $prepend Whether to prepend the autoloader or not
278
+ */
279
+ public function register($prepend = false)
280
+ {
281
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
282
+ }
283
+
284
+ /**
285
+ * Unregisters this instance as an autoloader.
286
+ */
287
+ public function unregister()
288
+ {
289
+ spl_autoload_unregister(array($this, 'loadClass'));
290
+ }
291
+
292
+ /**
293
+ * Loads the given class or interface.
294
+ *
295
+ * @param string $class The name of the class
296
+ * @return bool|null True if loaded, null otherwise
297
+ */
298
+ public function loadClass($class)
299
+ {
300
+ if ($file = $this->findFile($class)) {
301
+ includeFile($file);
302
+
303
+ return true;
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Finds the path to the file where the class is defined.
309
+ *
310
+ * @param string $class The name of the class
311
+ *
312
+ * @return string|false The path if found, false otherwise
313
+ */
314
+ public function findFile($class)
315
+ {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
+ // class map lookup
322
+ if (isset($this->classMap[$class])) {
323
+ return $this->classMap[$class];
324
+ }
325
+ if ($this->classMapAuthoritative) {
326
+ return false;
327
+ }
328
+
329
+ $file = $this->findFileWithExtension($class, '.php');
330
+
331
+ // Search for Hack files if we are running on HHVM
332
+ if ($file === null && defined('HHVM_VERSION')) {
333
+ $file = $this->findFileWithExtension($class, '.hh');
334
+ }
335
+
336
+ if ($file === null) {
337
+ // Remember that this class does not exist.
338
+ return $this->classMap[$class] = false;
339
+ }
340
+
341
+ return $file;
342
+ }
343
+
344
+ private function findFileWithExtension($class, $ext)
345
+ {
346
+ // PSR-4 lookup
347
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
348
+
349
+ $first = $class[0];
350
+ if (isset($this->prefixLengthsPsr4[$first])) {
351
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
+ if (0 === strpos($class, $prefix)) {
353
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
355
+ return $file;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ // PSR-4 fallback dirs
363
+ foreach ($this->fallbackDirsPsr4 as $dir) {
364
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
365
+ return $file;
366
+ }
367
+ }
368
+
369
+ // PSR-0 lookup
370
+ if (false !== $pos = strrpos($class, '\\')) {
371
+ // namespaced class name
372
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
373
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
374
+ } else {
375
+ // PEAR-like class name
376
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
377
+ }
378
+
379
+ if (isset($this->prefixesPsr0[$first])) {
380
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
381
+ if (0 === strpos($class, $prefix)) {
382
+ foreach ($dirs as $dir) {
383
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
384
+ return $file;
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ // PSR-0 fallback dirs
392
+ foreach ($this->fallbackDirsPsr0 as $dir) {
393
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
394
+ return $file;
395
+ }
396
+ }
397
+
398
+ // PSR-0 include paths.
399
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
+ return $file;
401
+ }
402
+ }
403
+ }
404
+
405
+ /**
406
+ * Scope isolated include.
407
+ *
408
+ * Prevents access to $this/self from included files.
409
+ */
410
+ function includeFile($file)
411
+ {
412
+ include $file;
413
+ }
Postman/Postman-Mail/mailgun/vendor/composer/LICENSE ADDED
@@ -0,0 +1,433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2
+ Upstream-Name: Composer
3
+ Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be>
4
+ Source: https://github.com/composer/composer
5
+
6
+ Files: *
7
+ Copyright: 2016, Nils Adermann <naderman@naderman.de>
8
+ 2016, Jordi Boggiano <j.boggiano@seld.be>
9
+ License: Expat
10
+
11
+ Files: res/cacert.pem
12
+ Copyright: 2015, Mozilla Foundation
13
+ License: MPL-2.0
14
+
15
+ Files: src/Composer/Util/RemoteFilesystem.php
16
+ src/Composer/Util/TlsHelper.php
17
+ Copyright: 2016, Nils Adermann <naderman@naderman.de>
18
+ 2016, Jordi Boggiano <j.boggiano@seld.be>
19
+ 2013, Evan Coury <me@evancoury.com>
20
+ License: Expat and BSD-2-Clause
21
+
22
+ License: BSD-2-Clause
23
+ Redistribution and use in source and binary forms, with or without modification,
24
+ are permitted provided that the following conditions are met:
25
+ .
26
+ * Redistributions of source code must retain the above copyright notice,
27
+ this list of conditions and the following disclaimer.
28
+ .
29
+ * Redistributions in binary form must reproduce the above copyright notice,
30
+ this list of conditions and the following disclaimer in the documentation
31
+ and/or other materials provided with the distribution.
32
+ .
33
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
34
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
37
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
39
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
40
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
+
44
+ License: Expat
45
+ Permission is hereby granted, free of charge, to any person obtaining a copy
46
+ of this software and associated documentation files (the "Software"), to deal
47
+ in the Software without restriction, including without limitation the rights
48
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
49
+ copies of the Software, and to permit persons to whom the Software is furnished
50
+ to do so, subject to the following conditions:
51
+ .
52
+ The above copyright notice and this permission notice shall be included in all
53
+ copies or substantial portions of the Software.
54
+ .
55
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
58
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
59
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
60
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
61
+ THE SOFTWARE.
62
+
63
+ License: MPL-2.0
64
+ 1. Definitions
65
+ --------------
66
+ .
67
+ 1.1. "Contributor"
68
+ means each individual or legal entity that creates, contributes to
69
+ the creation of, or owns Covered Software.
70
+ .
71
+ 1.2. "Contributor Version"
72
+ means the combination of the Contributions of others (if any) used
73
+ by a Contributor and that particular Contributor's Contribution.
74
+ .
75
+ 1.3. "Contribution"
76
+ means Covered Software of a particular Contributor.
77
+ .
78
+ 1.4. "Covered Software"
79
+ means Source Code Form to which the initial Contributor has attached
80
+ the notice in Exhibit A, the Executable Form of such Source Code
81
+ Form, and Modifications of such Source Code Form, in each case
82
+ including portions thereof.
83
+ .
84
+ 1.5. "Incompatible With Secondary Licenses"
85
+ means
86
+ .
87
+ (a) that the initial Contributor has attached the notice described
88
+ in Exhibit B to the Covered Software; or
89
+ .
90
+ (b) that the Covered Software was made available under the terms of
91
+ version 1.1 or earlier of the License, but not also under the
92
+ terms of a Secondary License.
93
+ .
94
+ 1.6. "Executable Form"
95
+ means any form of the work other than Source Code Form.
96
+ .
97
+ 1.7. "Larger Work"
98
+ means a work that combines Covered Software with other material, in
99
+ a separate file or files, that is not Covered Software.
100
+ .
101
+ 1.8. "License"
102
+ means this document.
103
+ .
104
+ 1.9. "Licensable"
105
+ means having the right to grant, to the maximum extent possible,
106
+ whether at the time of the initial grant or subsequently, any and
107
+ all of the rights conveyed by this License.
108
+ .
109
+ 1.10. "Modifications"
110
+ means any of the following:
111
+ .
112
+ (a) any file in Source Code Form that results from an addition to,
113
+ deletion from, or modification of the contents of Covered
114
+ Software; or
115
+ .
116
+ (b) any new file in Source Code Form that contains any Covered
117
+ Software.
118
+ .
119
+ 1.11. "Patent Claims" of a Contributor
120
+ means any patent claim(s), including without limitation, method,
121
+ process, and apparatus claims, in any patent Licensable by such
122
+ Contributor that would be infringed, but for the grant of the
123
+ License, by the making, using, selling, offering for sale, having
124
+ made, import, or transfer of either its Contributions or its
125
+ Contributor Version.
126
+ .
127
+ 1.12. "Secondary License"
128
+ means either the GNU General Public License, Version 2.0, the GNU
129
+ Lesser General Public License, Version 2.1, the GNU Affero General
130
+ Public License, Version 3.0, or any later versions of those
131
+ licenses.
132
+ .
133
+ 1.13. "Source Code Form"
134
+ means the form of the work preferred for making modifications.
135
+ .
136
+ 1.14. "You" (or "Your")
137
+ means an individual or a legal entity exercising rights under this
138
+ License. For legal entities, "You" includes any entity that
139
+ controls, is controlled by, or is under common control with You. For
140
+ purposes of this definition, "control" means (a) the power, direct
141
+ or indirect, to cause the direction or management of such entity,
142
+ whether by contract or otherwise, or (b) ownership of more than
143
+ fifty percent (50%) of the outstanding shares or beneficial
144
+ ownership of such entity.
145
+ .
146
+ 2. License Grants and Conditions
147
+ --------------------------------
148
+ .
149
+ 2.1. Grants
150
+ .
151
+ Each Contributor hereby grants You a world-wide, royalty-free,
152
+ non-exclusive license:
153
+ .
154
+ (a) under intellectual property rights (other than patent or trademark)
155
+ Licensable by such Contributor to use, reproduce, make available,
156
+ modify, display, perform, distribute, and otherwise exploit its
157
+ Contributions, either on an unmodified basis, with Modifications, or
158
+ as part of a Larger Work; and
159
+ .
160
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
161
+ for sale, have made, import, and otherwise transfer either its
162
+ Contributions or its Contributor Version.
163
+ .
164
+ 2.2. Effective Date
165
+ .
166
+ The licenses granted in Section 2.1 with respect to any Contribution
167
+ become effective for each Contribution on the date the Contributor first
168
+ distributes such Contribution.
169
+ .
170
+ 2.3. Limitations on Grant Scope
171
+ .
172
+ The licenses granted in this Section 2 are the only rights granted under
173
+ this License. No additional rights or licenses will be implied from the
174
+ distribution or licensing of Covered Software under this License.
175
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
176
+ Contributor:
177
+ .
178
+ (a) for any code that a Contributor has removed from Covered Software;
179
+ or
180
+ .
181
+ (b) for infringements caused by: (i) Your and any other third party's
182
+ modifications of Covered Software, or (ii) the combination of its
183
+ Contributions with other software (except as part of its Contributor
184
+ Version); or
185
+ .
186
+ (c) under Patent Claims infringed by Covered Software in the absence of
187
+ its Contributions.
188
+ .
189
+ This License does not grant any rights in the trademarks, service marks,
190
+ or logos of any Contributor (except as may be necessary to comply with
191
+ the notice requirements in Section 3.4).
192
+ .
193
+ 2.4. Subsequent Licenses
194
+ .
195
+ No Contributor makes additional grants as a result of Your choice to
196
+ distribute the Covered Software under a subsequent version of this
197
+ License (see Section 10.2) or under the terms of a Secondary License (if
198
+ permitted under the terms of Section 3.3).
199
+ .
200
+ 2.5. Representation
201
+ .
202
+ Each Contributor represents that the Contributor believes its
203
+ Contributions are its original creation(s) or it has sufficient rights
204
+ to grant the rights to its Contributions conveyed by this License.
205
+ .
206
+ 2.6. Fair Use
207
+ .
208
+ This License is not intended to limit any rights You have under
209
+ applicable copyright doctrines of fair use, fair dealing, or other
210
+ equivalents.
211
+ .
212
+ 2.7. Conditions
213
+ .
214
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
215
+ in Section 2.1.
216
+ .
217
+ 3. Responsibilities
218
+ -------------------
219
+ .
220
+ 3.1. Distribution of Source Form
221
+ .
222
+ All distribution of Covered Software in Source Code Form, including any
223
+ Modifications that You create or to which You contribute, must be under
224
+ the terms of this License. You must inform recipients that the Source
225
+ Code Form of the Covered Software is governed by the terms of this
226
+ License, and how they can obtain a copy of this License. You may not
227
+ attempt to alter or restrict the recipients' rights in the Source Code
228
+ Form.
229
+ .
230
+ 3.2. Distribution of Executable Form
231
+ .
232
+ If You distribute Covered Software in Executable Form then:
233
+ .
234
+ (a) such Covered Software must also be made available in Source Code
235
+ Form, as described in Section 3.1, and You must inform recipients of
236
+ the Executable Form how they can obtain a copy of such Source Code
237
+ Form by reasonable means in a timely manner, at a charge no more
238
+ than the cost of distribution to the recipient; and
239
+ .
240
+ (b) You may distribute such Executable Form under the terms of this
241
+ License, or sublicense it under different terms, provided that the
242
+ license for the Executable Form does not attempt to limit or alter
243
+ the recipients' rights in the Source Code Form under this License.
244
+ .
245
+ 3.3. Distribution of a Larger Work
246
+ .
247
+ You may create and distribute a Larger Work under terms of Your choice,
248
+ provided that You also comply with the requirements of this License for
249
+ the Covered Software. If the Larger Work is a combination of Covered
250
+ Software with a work governed by one or more Secondary Licenses, and the
251
+ Covered Software is not Incompatible With Secondary Licenses, this
252
+ License permits You to additionally distribute such Covered Software
253
+ under the terms of such Secondary License(s), so that the recipient of
254
+ the Larger Work may, at their option, further distribute the Covered
255
+ Software under the terms of either this License or such Secondary
256
+ License(s).
257
+ .
258
+ 3.4. Notices
259
+ .
260
+ You may not remove or alter the substance of any license notices
261
+ (including copyright notices, patent notices, disclaimers of warranty,
262
+ or limitations of liability) contained within the Source Code Form of
263
+ the Covered Software, except that You may alter any license notices to
264
+ the extent required to remedy known factual inaccuracies.
265
+ .
266
+ 3.5. Application of Additional Terms
267
+ .
268
+ You may choose to offer, and to charge a fee for, warranty, support,
269
+ indemnity or liability obligations to one or more recipients of Covered
270
+ Software. However, You may do so only on Your own behalf, and not on
271
+ behalf of any Contributor. You must make it absolutely clear that any
272
+ such warranty, support, indemnity, or liability obligation is offered by
273
+ You alone, and You hereby agree to indemnify every Contributor for any
274
+ liability incurred by such Contributor as a result of warranty, support,
275
+ indemnity or liability terms You offer. You may include additional
276
+ disclaimers of warranty and limitations of liability specific to any
277
+ jurisdiction.
278
+ .
279
+ 4. Inability to Comply Due to Statute or Regulation
280
+ ---------------------------------------------------
281
+ .
282
+ If it is impossible for You to comply with any of the terms of this
283
+ License with respect to some or all of the Covered Software due to
284
+ statute, judicial order, or regulation then You must: (a) comply with
285
+ the terms of this License to the maximum extent possible; and (b)
286
+ describe the limitations and the code they affect. Such description must
287
+ be placed in a text file included with all distributions of the Covered
288
+ Software under this License. Except to the extent prohibited by statute
289
+ or regulation, such description must be sufficiently detailed for a
290
+ recipient of ordinary skill to be able to understand it.
291
+ .
292
+ 5. Termination
293
+ --------------
294
+ .
295
+ 5.1. The rights granted under this License will terminate automatically
296
+ if You fail to comply with any of its terms. However, if You become
297
+ compliant, then the rights granted under this License from a particular
298
+ Contributor are reinstated (a) provisionally, unless and until such
299
+ Contributor explicitly and finally terminates Your grants, and (b) on an
300
+ ongoing basis, if such Contributor fails to notify You of the
301
+ non-compliance by some reasonable means prior to 60 days after You have
302
+ come back into compliance. Moreover, Your grants from a particular
303
+ Contributor are reinstated on an ongoing basis if such Contributor
304
+ notifies You of the non-compliance by some reasonable means, this is the
305
+ first time You have received notice of non-compliance with this License
306
+ from such Contributor, and You become compliant prior to 30 days after
307
+ Your receipt of the notice.
308
+ .
309
+ 5.2. If You initiate litigation against any entity by asserting a patent
310
+ infringement claim (excluding declaratory judgment actions,
311
+ counter-claims, and cross-claims) alleging that a Contributor Version
312
+ directly or indirectly infringes any patent, then the rights granted to
313
+ You by any and all Contributors for the Covered Software under Section
314
+ 2.1 of this License shall terminate.
315
+ .
316
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
317
+ end user license agreements (excluding distributors and resellers) which
318
+ have been validly granted by You or Your distributors under this License
319
+ prior to termination shall survive termination.
320
+ .
321
+ ************************************************************************
322
+ * *
323
+ * 6. Disclaimer of Warranty *
324
+ * ------------------------- *
325
+ * *
326
+ * Covered Software is provided under this License on an "as is" *
327
+ * basis, without warranty of any kind, either expressed, implied, or *
328
+ * statutory, including, without limitation, warranties that the *
329
+ * Covered Software is free of defects, merchantable, fit for a *
330
+ * particular purpose or non-infringing. The entire risk as to the *
331
+ * quality and performance of the Covered Software is with You. *
332
+ * Should any Covered Software prove defective in any respect, You *
333
+ * (not any Contributor) assume the cost of any necessary servicing, *
334
+ * repair, or correction. This disclaimer of warranty constitutes an *
335
+ * essential part of this License. No use of any Covered Software is *
336
+ * authorized under this License except under this disclaimer. *
337
+ * *
338
+ ************************************************************************
339
+ .
340
+ ************************************************************************
341
+ * *
342
+ * 7. Limitation of Liability *
343
+ * -------------------------- *
344
+ * *
345
+ * Under no circumstances and under no legal theory, whether tort *
346
+ * (including negligence), contract, or otherwise, shall any *
347
+ * Contributor, or anyone who distributes Covered Software as *
348
+ * permitted above, be liable to You for any direct, indirect, *
349
+ * special, incidental, or consequential damages of any character *
350
+ * including, without limitation, damages for lost profits, loss of *
351
+ * goodwill, work stoppage, computer failure or malfunction, or any *
352
+ * and all other commercial damages or losses, even if such party *
353
+ * shall have been informed of the possibility of such damages. This *
354
+ * limitation of liability shall not apply to liability for death or *
355
+ * personal injury resulting from such party's negligence to the *
356
+ * extent applicable law prohibits such limitation. Some *
357
+ * jurisdictions do not allow the exclusion or limitation of *
358
+ * incidental or consequential damages, so this exclusion and *
359
+ * limitation may not apply to You. *
360
+ * *
361
+ ************************************************************************
362
+ .
363
+ 8. Litigation
364
+ -------------
365
+ .
366
+ Any litigation relating to this License may be brought only in the
367
+ courts of a jurisdiction where the defendant maintains its principal
368
+ place of business and such litigation shall be governed by laws of that
369
+ jurisdiction, without reference to its conflict-of-law provisions.
370
+ Nothing in this Section shall prevent a party's ability to bring
371
+ cross-claims or counter-claims.
372
+ .
373
+ 9. Miscellaneous
374
+ ----------------
375
+ .
376
+ This License represents the complete agreement concerning the subject
377
+ matter hereof. If any provision of this License is held to be
378
+ unenforceable, such provision shall be reformed only to the extent
379
+ necessary to make it enforceable. Any law or regulation which provides
380
+ that the language of a contract shall be construed against the drafter
381
+ shall not be used to construe this License against a Contributor.
382
+ .
383
+ 10. Versions of the License
384
+ ---------------------------
385
+ .
386
+ 10.1. New Versions
387
+ .
388
+ Mozilla Foundation is the license steward. Except as provided in Section
389
+ 10.3, no one other than the license steward has the right to modify or
390
+ publish new versions of this License. Each version will be given a
391
+ distinguishing version number.
392
+ .
393
+ 10.2. Effect of New Versions
394
+ .
395
+ You may distribute the Covered Software under the terms of the version
396
+ of the License under which You originally received the Covered Software,
397
+ or under the terms of any subsequent version published by the license
398
+ steward.
399
+ .
400
+ 10.3. Modified Versions
401
+ .
402
+ If you create software not governed by this License, and you want to
403
+ create a new license for such software, you may create and use a
404
+ modified version of this License if you rename the license and remove
405
+ any references to the name of the license steward (except to note that
406
+ such modified license differs from this License).
407
+ .
408
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
409
+ Licenses
410
+ .
411
+ If You choose to distribute Source Code Form that is Incompatible With
412
+ Secondary Licenses under the terms of this version of the License, the
413
+ notice described in Exhibit B of this License must be attached.
414
+ .
415
+ Exhibit A - Source Code Form License Notice
416
+ -------------------------------------------
417
+ .
418
+ This Source Code Form is subject to the terms of the Mozilla Public
419
+ License, v. 2.0. If a copy of the MPL was not distributed with this
420
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
421
+ .
422
+ If it is not possible or desirable to put the notice in a particular
423
+ file, then You may include the notice in a location (such as a LICENSE
424
+ file in a relevant directory) where a recipient would be likely to look
425
+ for such a notice.
426
+ .
427
+ You may add additional accurate notices of copyright ownership.
428
+ .
429
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
430
+ ---------------------------------------------------------
431
+ .
432
+ This Source Code Form is "Incompatible With Secondary Licenses", as
433
+ defined by the Mozilla Public License, v. 2.0.
Postman/Postman-Mail/mailgun/vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
Postman/Postman-Mail/mailgun/vendor/composer/autoload_files.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_files.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
10
+ 'ddc0a4d7e61c0286f0f8593b1903e894' => $vendorDir . '/clue/stream-filter/src/functions.php',
11
+ '8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php',
12
+ );
Postman/Postman-Mail/mailgun/vendor/composer/autoload_namespaces.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'Mailgun' => array($vendorDir . '/mailgun/mailgun-php/src'),
10
+ );
Postman/Postman-Mail/mailgun/vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
10
+ 'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
11
+ 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
12
+ 'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'),
13
+ 'Http\\Message\\MultipartStream\\' => array($vendorDir . '/php-http/multipart-stream-builder/src'),
14
+ 'Http\\Message\\' => array($vendorDir . '/php-http/message-factory/src', $vendorDir . '/php-http/message/src'),
15
+ 'Http\\Discovery\\' => array($vendorDir . '/php-http/discovery/src'),
16
+ 'Http\\Client\\Curl\\' => array($vendorDir . '/php-http/curl-client/src'),
17
+ 'Http\\Client\\Common\\' => array($vendorDir . '/php-http/client-common/src'),
18
+ 'Http\\Client\\' => array($vendorDir . '/php-http/httplug/src'),
19
+ 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
20
+ 'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'),
21
+ );
Postman/Postman-Mail/mailgun/vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit2e493976577e1ff95afbbd5ca63b2ef1
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit2e493976577e1ff95afbbd5ca63b2ef1', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit2e493976577e1ff95afbbd5ca63b2ef1', 'loadClassLoader'));
25
+
26
+ $map = require __DIR__ . '/autoload_namespaces.php';
27
+ foreach ($map as $namespace => $path) {
28
+ $loader->set($namespace, $path);
29
+ }
30
+
31
+ $map = require __DIR__ . '/autoload_psr4.php';
32
+ foreach ($map as $namespace => $path) {
33
+ $loader->setPsr4($namespace, $path);
34
+ }
35
+
36
+ $classMap = require __DIR__ . '/autoload_classmap.php';
37
+ if ($classMap) {
38
+ $loader->addClassMap($classMap);
39
+ }
40
+
41
+ $loader->register(true);
42
+
43
+ $includeFiles = require __DIR__ . '/autoload_files.php';
44
+ foreach ($includeFiles as $fileIdentifier => $file) {
45
+ composerRequire2e493976577e1ff95afbbd5ca63b2ef1($fileIdentifier, $file);
46
+ }
47
+
48
+ return $loader;
49
+ }
50
+ }
51
+
52
+ function composerRequire2e493976577e1ff95afbbd5ca63b2ef1($fileIdentifier, $file)
53
+ {
54
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
+ require $file;
56
+
57
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
58
+ }
59
+ }
Postman/Postman-Mail/mailgun/vendor/composer/installed.json ADDED
@@ -0,0 +1,812 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "php-http/discovery",
4
+ "version": "1.3.0",
5
+ "version_normalized": "1.3.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/php-http/discovery.git",
9
+ "reference": "7b50ab4d6c9fdaa1ed53ae310c955900af6e3372"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/php-http/discovery/zipball/7b50ab4d6c9fdaa1ed53ae310c955900af6e3372",
14
+ "reference": "7b50ab4d6c9fdaa1ed53ae310c955900af6e3372",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "php": "^5.5 || ^7.0"
19
+ },
20
+ "require-dev": {
21
+ "henrikbjorn/phpspec-code-coverage": "^2.0.2",
22
+ "php-http/httplug": "^1.0",
23
+ "php-http/message-factory": "^1.0",
24
+ "phpspec/phpspec": "^2.4",
25
+ "puli/composer-plugin": "1.0.0-beta10"
26
+ },
27
+ "suggest": {
28
+ "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories",
29
+ "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."
30
+ },
31
+ "time": "2017-08-03 10:12:53",
32
+ "type": "library",
33
+ "extra": {
34
+ "branch-alias": {
35
+ "dev-master": "1.3-dev"
36
+ }
37
+ },
38
+ "installation-source": "dist",
39
+ "autoload": {
40
+ "psr-4": {
41
+ "Http\\Discovery\\": "src/"
42
+ }
43
+ },
44
+ "notification-url": "https://packagist.org/downloads/",
45
+ "license": [
46
+ "MIT"
47
+ ],
48
+ "authors": [
49
+ {
50
+ "name": "Márk Sági-Kazár",
51
+ "email": "mark.sagikazar@gmail.com"
52
+ }
53
+ ],
54
+ "description": "Finds installed HTTPlug implementations and PSR-7 message factories",
55
+ "homepage": "http://php-http.org",
56
+ "keywords": [
57
+ "adapter",
58
+ "client",
59
+ "discovery",
60
+ "factory",
61
+ "http",
62
+ "message",
63
+ "psr7"
64
+ ]
65
+ },
66
+ {
67
+ "name": "clue/stream-filter",
68
+ "version": "v1.4.0",
69
+ "version_normalized": "1.4.0.0",
70
+ "source": {
71
+ "type": "git",
72
+ "url": "https://github.com/clue/php-stream-filter.git",
73
+ "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0"
74
+ },
75
+ "dist": {
76
+ "type": "zip",
77
+ "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0",
78
+ "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0",
79
+ "shasum": ""
80
+ },
81
+ "require": {
82
+ "php": ">=5.3"
83
+ },
84
+ "require-dev": {
85
+ "phpunit/phpunit": "^5.0 || ^4.8"
86
+ },
87
+ "time": "2017-08-18 09:54:01",
88
+ "type": "library",
89
+ "installation-source": "dist",
90
+ "autoload": {
91
+ "psr-4": {
92
+ "Clue\\StreamFilter\\": "src/"
93
+ },
94
+ "files": [
95
+ "src/functions.php"
96
+ ]
97
+ },
98
+ "notification-url": "https://packagist.org/downloads/",
99
+ "license": [
100
+ "MIT"
101
+ ],
102
+ "authors": [
103
+ {
104
+ "name": "Christian Lück",
105
+ "email": "christian@lueck.tv"
106
+ }
107
+ ],
108
+ "description": "A simple and modern approach to stream filtering in PHP",
109
+ "homepage": "https://github.com/clue/php-stream-filter",
110
+ "keywords": [
111
+ "bucket brigade",
112
+ "callback",
113
+ "filter",
114
+ "php_user_filter",
115
+ "stream",
116
+ "stream_filter_append",
117
+ "stream_filter_register"
118
+ ]
119
+ },
120
+ {
121
+ "name": "psr/http-message",
122
+ "version": "1.0.1",
123
+ "version_normalized": "1.0.1.0",
124
+ "source": {
125
+ "type": "git",
126
+ "url": "https://github.com/php-fig/http-message.git",
127
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
128
+ },
129
+ "dist": {
130
+ "type": "zip",
131
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
132
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
133
+ "shasum": ""
134
+ },
135
+ "require": {
136
+ "php": ">=5.3.0"
137
+ },
138
+ "time": "2016-08-06 14:39:51",
139
+ "type": "library",
140
+ "extra": {
141
+ "branch-alias": {
142
+ "dev-master": "1.0.x-dev"
143
+ }
144
+ },
145
+ "installation-source": "dist",
146
+ "autoload": {
147
+ "psr-4": {
148
+ "Psr\\Http\\Message\\": "src/"
149
+ }
150
+ },
151
+ "notification-url": "https://packagist.org/downloads/",
152
+ "license": [
153
+ "MIT"
154
+ ],
155
+ "authors": [
156
+ {
157
+ "name": "PHP-FIG",
158
+ "homepage": "http://www.php-fig.org/"
159
+ }
160
+ ],
161
+ "description": "Common interface for HTTP messages",
162
+ "homepage": "https://github.com/php-fig/http-message",
163
+ "keywords": [
164
+ "http",
165
+ "http-message",
166
+ "psr",
167
+ "psr-7",
168
+ "request",
169
+ "response"
170
+ ]
171
+ },
172
+ {
173
+ "name": "php-http/message-factory",
174
+ "version": "v1.0.2",
175
+ "version_normalized": "1.0.2.0",
176
+ "source": {
177
+ "type": "git",
178
+ "url": "https://github.com/php-http/message-factory.git",
179
+ "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
180
+ },
181
+ "dist": {
182
+ "type": "zip",
183
+ "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
184
+ "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
185
+ "shasum": ""
186
+ },
187
+ "require": {
188
+ "php": ">=5.4",
189
+ "psr/http-message": "^1.0"
190
+ },
191
+ "time": "2015-12-19 14:08:53",
192
+ "type": "library",
193
+ "extra": {
194
+ "branch-alias": {
195
+ "dev-master": "1.0-dev"
196
+ }
197
+ },
198
+ "installation-source": "dist",
199
+ "autoload": {
200
+ "psr-4": {
201
+ "Http\\Message\\": "src/"
202
+ }
203
+ },
204
+ "notification-url": "https://packagist.org/downloads/",
205
+ "license": [
206
+ "MIT"
207
+ ],
208
+ "authors": [
209
+ {
210
+ "name": "Márk Sági-Kazár",
211
+ "email": "mark.sagikazar@gmail.com"
212
+ }
213
+ ],
214
+ "description": "Factory interfaces for PSR-7 HTTP Message",
215
+ "homepage": "http://php-http.org",
216
+ "keywords": [
217
+ "factory",
218
+ "http",
219
+ "message",
220
+ "stream",
221
+ "uri"
222
+ ]
223
+ },
224
+ {
225
+ "name": "php-http/message",
226
+ "version": "1.6.0",
227
+ "version_normalized": "1.6.0.0",
228
+ "source": {
229
+ "type": "git",
230
+ "url": "https://github.com/php-http/message.git",
231
+ "reference": "2edd63bae5f52f79363c5f18904b05ce3a4b7253"
232
+ },
233
+ "dist": {
234
+ "type": "zip",
235
+ "url": "https://api.github.com/repos/php-http/message/zipball/2edd63bae5f52f79363c5f18904b05ce3a4b7253",
236
+ "reference": "2edd63bae5f52f79363c5f18904b05ce3a4b7253",
237
+ "shasum": ""
238
+ },
239
+ "require": {
240
+ "clue/stream-filter": "^1.3",
241
+ "php": ">=5.4",
242
+ "php-http/message-factory": "^1.0.2",
243
+ "psr/http-message": "^1.0"
244
+ },
245
+ "provide": {
246
+ "php-http/message-factory-implementation": "1.0"
247
+ },
248
+ "require-dev": {
249
+ "akeneo/phpspec-skip-example-extension": "^1.0",
250
+ "coduo/phpspec-data-provider-extension": "^1.0",
251
+ "ext-zlib": "*",
252
+ "guzzlehttp/psr7": "^1.0",
253
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
254
+ "phpspec/phpspec": "^2.4",
255
+ "slim/slim": "^3.0",
256
+ "zendframework/zend-diactoros": "^1.0"
257
+ },
258
+ "suggest": {
259
+ "ext-zlib": "Used with compressor/decompressor streams",
260
+ "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
261
+ "slim/slim": "Used with Slim Framework PSR-7 implementation",
262
+ "zendframework/zend-diactoros": "Used with Diactoros Factories"
263
+ },
264
+ "time": "2017-07-05 06:40:53",
265
+ "type": "library",
266
+ "extra": {
267
+ "branch-alias": {
268
+ "dev-master": "1.6-dev"
269
+ }
270
+ },
271
+ "installation-source": "dist",
272
+ "autoload": {
273
+ "psr-4": {
274
+ "Http\\Message\\": "src/"
275
+ },
276
+ "files": [
277
+ "src/filters.php"
278
+ ]
279
+ },
280
+ "notification-url": "https://packagist.org/downloads/",
281
+ "license": [
282
+ "MIT"
283
+ ],
284
+ "authors": [
285
+ {
286
+ "name": "Márk Sági-Kazár",
287
+ "email": "mark.sagikazar@gmail.com"
288
+ }
289
+ ],
290
+ "description": "HTTP Message related tools",
291
+ "homepage": "http://php-http.org",
292
+ "keywords": [
293
+ "http",
294
+ "message",
295
+ "psr-7"
296
+ ]
297
+ },
298
+ {
299
+ "name": "php-http/promise",
300
+ "version": "v1.0.0",
301
+ "version_normalized": "1.0.0.0",
302
+ "source": {
303
+ "type": "git",
304
+ "url": "https://github.com/php-http/promise.git",
305
+ "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980"
306
+ },
307
+ "dist": {
308
+ "type": "zip",
309
+ "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980",
310
+ "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980",
311
+ "shasum": ""
312
+ },
313
+ "require-dev": {
314
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
315
+ "phpspec/phpspec": "^2.4"
316
+ },
317
+ "time": "2016-01-26 13:27:02",
318
+ "type": "library",
319
+ "extra": {
320
+ "branch-alias": {
321
+ "dev-master": "1.1-dev"
322
+ }
323
+ },
324
+ "installation-source": "dist",
325
+ "autoload": {
326
+ "psr-4": {
327
+ "Http\\Promise\\": "src/"
328
+ }
329
+ },
330
+ "notification-url": "https://packagist.org/downloads/",
331
+ "license": [
332
+ "MIT"
333
+ ],
334
+ "authors": [
335
+ {
336
+ "name": "Márk Sági-Kazár",
337
+ "email": "mark.sagikazar@gmail.com"
338
+ },
339
+ {
340
+ "name": "Joel Wurtz",
341
+ "email": "joel.wurtz@gmail.com"
342
+ }
343
+ ],
344
+ "description": "Promise used for asynchronous HTTP requests",
345
+ "homepage": "http://httplug.io",
346
+ "keywords": [
347
+ "promise"
348
+ ]
349
+ },
350
+ {
351
+ "name": "php-http/httplug",
352
+ "version": "v1.1.0",
353
+ "version_normalized": "1.1.0.0",
354
+ "source": {
355
+ "type": "git",
356
+ "url": "https://github.com/php-http/httplug.git",
357
+ "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018"
358
+ },
359
+ "dist": {
360
+ "type": "zip",
361
+ "url": "https://api.github.com/repos/php-http/httplug/zipball/1c6381726c18579c4ca2ef1ec1498fdae8bdf018",
362
+ "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018",
363
+ "shasum": ""
364
+ },
365
+ "require": {
366
+ "php": ">=5.4",
367
+ "php-http/promise": "^1.0",
368
+ "psr/http-message": "^1.0"
369
+ },
370
+ "require-dev": {
371
+ "henrikbjorn/phpspec-code-coverage": "^1.0",
372
+ "phpspec/phpspec": "^2.4"
373
+ },
374
+ "time": "2016-08-31 08:30:17",
375
+ "type": "library",
376
+ "extra": {
377
+ "branch-alias": {
378
+ "dev-master": "1.1-dev"
379
+ }
380
+ },
381
+ "installation-source": "dist",
382
+ "autoload": {
383
+ "psr-4": {
384
+ "Http\\Client\\": "src/"
385
+ }
386
+ },
387
+ "notification-url": "https://packagist.org/downloads/",
388
+ "license": [
389
+ "MIT"
390
+ ],
391
+ "authors": [
392
+ {
393
+ "name": "Eric GELOEN",
394
+ "email": "geloen.eric@gmail.com"
395
+ },
396
+ {
397
+ "name": "Márk Sági-Kazár",
398
+ "email": "mark.sagikazar@gmail.com"
399
+ }
400
+ ],
401
+ "description": "HTTPlug, the HTTP client abstraction for PHP",
402
+ "homepage": "http://httplug.io",
403
+ "keywords": [
404
+ "client",
405
+ "http"
406
+ ]
407
+ },
408
+ {
409
+ "name": "php-http/curl-client",
410
+ "version": "v1.7.0",
411
+ "version_normalized": "1.7.0.0",
412
+ "source": {
413
+ "type": "git",
414
+ "url": "https://github.com/php-http/curl-client.git",
415
+ "reference": "0972ad0d7d37032a52077a5cbe27cf370f2007d8"
416
+ },
417
+ "dist": {
418
+ "type": "zip",
419
+ "url": "https://api.github.com/repos/php-http/curl-client/zipball/0972ad0d7d37032a52077a5cbe27cf370f2007d8",
420
+ "reference": "0972ad0d7d37032a52077a5cbe27cf370f2007d8",
421
+ "shasum": ""
422
+ },
423
+ "require": {
424
+ "ext-curl": "*",
425
+ "php": "^5.5 || ^7.0",
426
+ "php-http/discovery": "^1.0",
427
+ "php-http/httplug": "^1.0",
428
+ "php-http/message": "^1.2",
429
+ "php-http/message-factory": "^1.0.2"
430
+ },
431
+ "provide": {
432
+ "php-http/async-client-implementation": "1.0",
433
+ "php-http/client-implementation": "1.0"
434
+ },
435
+ "require-dev": {
436
+ "guzzlehttp/psr7": "^1.0",
437
+ "php-http/client-integration-tests": "^0.5.1",
438
+ "phpunit/phpunit": "^4.8.27",
439
+ "zendframework/zend-diactoros": "^1.0"
440
+ },
441
+ "time": "2017-02-09 15:18:33",
442
+ "type": "library",
443
+ "installation-source": "dist",
444
+ "autoload": {
445
+ "psr-4": {
446
+ "Http\\Client\\Curl\\": "src/"
447
+ }
448
+ },
449
+ "notification-url": "https://packagist.org/downloads/",
450
+ "license": [
451
+ "MIT"
452
+ ],
453
+ "authors": [
454
+ {
455
+ "name": "Михаил Красильников",
456
+ "email": "m.krasilnikov@yandex.ru"
457
+ }
458
+ ],
459
+ "description": "cURL client for PHP-HTTP",
460
+ "homepage": "http://php-http.org",
461
+ "keywords": [
462
+ "curl",
463
+ "http"
464
+ ]
465
+ },
466
+ {
467
+ "name": "webmozart/assert",
468
+ "version": "1.2.0",
469
+ "version_normalized": "1.2.0.0",
470
+ "source": {
471
+ "type": "git",
472
+ "url": "https://github.com/webmozart/assert.git",
473
+ "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f"
474
+ },
475
+ "dist": {
476
+ "type": "zip",
477
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f",
478
+ "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
479
+ "shasum": ""
480
+ },
481
+ "require": {
482
+ "php": "^5.3.3 || ^7.0"
483
+ },
484
+ "require-dev": {
485
+ "phpunit/phpunit": "^4.6",
486
+ "sebastian/version": "^1.0.1"
487
+ },
488
+ "time": "2016-11-23 20:04:58",
489
+ "type": "library",
490
+ "extra": {
491
+ "branch-alias": {
492
+ "dev-master": "1.3-dev"
493
+ }
494
+ },
495
+ "installation-source": "dist",
496
+ "autoload": {
497
+ "psr-4": {
498
+ "Webmozart\\Assert\\": "src/"
499
+ }
500
+ },
501
+ "notification-url": "https://packagist.org/downloads/",
502
+ "license": [
503
+ "MIT"
504
+ ],
505
+ "authors": [
506
+ {
507
+ "name": "Bernhard Schussek",
508
+ "email": "bschussek@gmail.com"
509
+ }
510
+ ],
511
+ "description": "Assertions to validate method input/output with nice error messages.",
512
+ "keywords": [
513
+ "assert",
514
+ "check",
515
+ "validate"
516
+ ]
517
+ },
518
+ {
519
+ "name": "symfony/options-resolver",
520
+ "version": "v3.4.1",
521
+ "version_normalized": "3.4.1.0",
522
+ "source": {
523
+ "type": "git",
524
+ "url": "https://github.com/symfony/options-resolver.git",
525
+ "reference": "08748edfe6982f4d878cc42b8325b19a276fb1cf"
526
+ },
527
+ "dist": {
528
+ "type": "zip",
529
+ "url": "https://api.github.com/repos/symfony/options-resolver/zipball/08748edfe6982f4d878cc42b8325b19a276fb1cf",
530
+ "reference": "08748edfe6982f4d878cc42b8325b19a276fb1cf",
531
+ "shasum": ""
532
+ },
533
+ "require": {
534
+ "php": "^5.5.9|>=7.0.8"
535
+ },
536
+ "time": "2017-11-05 16:10:10",
537
+ "type": "library",
538
+ "extra": {
539
+ "branch-alias": {
540
+ "dev-master": "3.4-dev"
541
+ }
542
+ },
543
+ "installation-source": "dist",
544
+ "autoload": {
545
+ "psr-4": {
546
+ "Symfony\\Component\\OptionsResolver\\": ""
547
+ },
548
+ "exclude-from-classmap": [
549
+ "/Tests/"
550
+ ]
551
+ },
552
+ "notification-url": "https://packagist.org/downloads/",
553
+ "license": [
554
+ "MIT"
555
+ ],
556
+ "authors": [
557
+ {
558
+ "name": "Fabien Potencier",
559
+ "email": "fabien@symfony.com"
560
+ },
561
+ {
562
+ "name": "Symfony Community",
563
+ "homepage": "https://symfony.com/contributors"
564
+ }
565
+ ],
566
+ "description": "Symfony OptionsResolver Component",
567
+ "homepage": "https://symfony.com",
568
+ "keywords": [
569
+ "config",
570
+ "configuration",
571
+ "options"
572
+ ]
573
+ },
574
+ {
575
+ "name": "php-http/client-common",
576
+ "version": "1.7.0",
577
+ "version_normalized": "1.7.0.0",
578
+ "source": {
579
+ "type": "git",
580
+ "url": "https://github.com/php-http/client-common.git",
581
+ "reference": "9accb4a082eb06403747c0ffd444112eda41a0fd"
582
+ },
583
+ "dist": {
584
+ "type": "zip",
585
+ "url": "https://api.github.com/repos/php-http/client-common/zipball/9accb4a082eb06403747c0ffd444112eda41a0fd",
586
+ "reference": "9accb4a082eb06403747c0ffd444112eda41a0fd",
587
+ "shasum": ""
588
+ },
589
+ "require": {
590
+ "php": "^5.4 || ^7.0",
591
+ "php-http/httplug": "^1.1",
592
+ "php-http/message": "^1.6",
593
+ "php-http/message-factory": "^1.0",
594
+ "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0"
595
+ },
596
+ "require-dev": {
597
+ "guzzlehttp/psr7": "^1.4",
598
+ "phpspec/phpspec": "^2.5 || ^3.4 || ^4.2"
599
+ },
600
+ "suggest": {
601
+ "php-http/cache-plugin": "PSR-6 Cache plugin",
602
+ "php-http/logger-plugin": "PSR-3 Logger plugin",
603
+ "php-http/stopwatch-plugin": "Symfony Stopwatch plugin"
604
+ },
605
+ "time": "2017-11-30 11:06:59",
606
+ "type": "library",
607
+ "extra": {
608
+ "branch-alias": {
609
+ "dev-master": "1.7-dev"
610
+ }
611
+ },
612
+ "installation-source": "dist",
613
+ "autoload": {
614
+ "psr-4": {
615
+ "Http\\Client\\Common\\": "src/"
616
+ }
617
+ },
618
+ "notification-url": "https://packagist.org/downloads/",
619
+ "license": [
620
+ "MIT"
621
+ ],
622
+ "authors": [
623
+ {
624
+ "name": "Márk Sági-Kazár",
625
+ "email": "mark.sagikazar@gmail.com"
626
+ }
627
+ ],
628
+ "description": "Common HTTP Client implementations and tools for HTTPlug",
629
+ "homepage": "http://httplug.io",
630
+ "keywords": [
631
+ "client",
632
+ "common",
633
+ "http",
634
+ "httplug"
635
+ ]
636
+ },
637
+ {
638
+ "name": "php-http/multipart-stream-builder",
639
+ "version": "1.0.0",
640
+ "version_normalized": "1.0.0.0",
641
+ "source": {
642
+ "type": "git",
643
+ "url": "https://github.com/php-http/multipart-stream-builder.git",
644
+ "reference": "1fa3c623fc813a43b39494b2a1612174e36e0fb0"
645
+ },
646
+ "dist": {
647
+ "type": "zip",
648
+ "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/1fa3c623fc813a43b39494b2a1612174e36e0fb0",
649
+ "reference": "1fa3c623fc813a43b39494b2a1612174e36e0fb0",
650
+ "shasum": ""
651
+ },
652
+ "require": {
653
+ "php": "^5.5 || ^7.0",
654
+ "php-http/discovery": "^1.0",
655
+ "php-http/message-factory": "^1.0.2",
656
+ "psr/http-message": "^1.0"
657
+ },
658
+ "require-dev": {
659
+ "php-http/message": "^1.5",
660
+ "phpunit/phpunit": "^4.8 || ^5.4",
661
+ "zendframework/zend-diactoros": "^1.3.5"
662
+ },
663
+ "time": "2017-05-21 17:45:25",
664
+ "type": "library",
665
+ "extra": {
666
+ "branch-alias": {
667
+ "dev-master": "0.3-dev"
668
+ }
669
+ },
670
+ "installation-source": "dist",
671
+ "autoload": {
672
+ "psr-4": {
673
+ "Http\\Message\\MultipartStream\\": "src/"
674
+ }
675
+ },
676
+ "notification-url": "https://packagist.org/downloads/",
677
+ "license": [
678
+ "MIT"
679
+ ],
680
+ "authors": [
681
+ {
682
+ "name": "Tobias Nyholm",
683
+ "email": "tobias.nyholm@gmail.com"
684
+ }
685
+ ],
686
+ "description": "A builder class that help you create a multipart stream",
687
+ "homepage": "http://php-http.org",
688
+ "keywords": [
689
+ "factory",
690
+ "http",
691
+ "message",
692
+ "multipart stream",
693
+ "stream"
694
+ ]
695
+ },
696
+ {
697
+ "name": "mailgun/mailgun-php",
698
+ "version": "2.3.4",
699
+ "version_normalized": "2.3.4.0",
700
+ "source": {
701
+ "type": "git",
702
+ "url": "https://github.com/mailgun/mailgun-php.git",
703
+ "reference": "f58c5914aefa16fa6ed2b5cf9ee84d40cbda1b3a"
704
+ },
705
+ "dist": {
706
+ "type": "zip",
707
+ "url": "https://api.github.com/repos/mailgun/mailgun-php/zipball/f58c5914aefa16fa6ed2b5cf9ee84d40cbda1b3a",
708
+ "reference": "f58c5914aefa16fa6ed2b5cf9ee84d40cbda1b3a",
709
+ "shasum": ""
710
+ },
711
+ "require": {
712
+ "php": "^5.5|^7.0",
713
+ "php-http/client-common": "^1.1",
714
+ "php-http/discovery": "^1.0",
715
+ "php-http/httplug": "^1.0",
716
+ "php-http/message": "^1.0",
717
+ "php-http/multipart-stream-builder": "^1.0",
718
+ "webmozart/assert": "^1.2"
719
+ },
720
+ "require-dev": {
721
+ "guzzlehttp/psr7": "^1.4",
722
+ "php-http/guzzle6-adapter": "^1.0",
723
+ "phpunit/phpunit": "~4.8"
724
+ },
725
+ "time": "2017-06-20 19:56:09",
726
+ "type": "library",
727
+ "installation-source": "dist",
728
+ "autoload": {
729
+ "psr-0": {
730
+ "Mailgun": "src/"
731
+ }
732
+ },
733
+ "notification-url": "https://packagist.org/downloads/",
734
+ "license": [
735
+ "MIT"
736
+ ],
737
+ "authors": [
738
+ {
739
+ "name": "Travis Swientek",
740
+ "email": "travis@mailgunhq.com"
741
+ }
742
+ ],
743
+ "description": "The Mailgun SDK provides methods for all API functions."
744
+ },
745
+ {
746
+ "name": "guzzlehttp/psr7",
747
+ "version": "1.4.2",
748
+ "version_normalized": "1.4.2.0",
749
+ "source": {
750
+ "type": "git",
751
+ "url": "https://github.com/guzzle/psr7.git",
752
+ "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
753
+ },
754
+ "dist": {
755
+ "type": "zip",
756
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
757
+ "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
758
+ "shasum": ""
759
+ },
760
+ "require": {
761
+ "php": ">=5.4.0",
762
+ "psr/http-message": "~1.0"
763
+ },
764
+ "provide": {
765
+ "psr/http-message-implementation": "1.0"
766
+ },
767
+ "require-dev": {
768
+ "phpunit/phpunit": "~4.0"
769
+ },
770
+ "time": "2017-03-20 17:10:46",
771
+ "type": "library",
772
+ "extra": {
773
+ "branch-alias": {
774
+ "dev-master": "1.4-dev"
775
+ }
776
+ },
777
+ "installation-source": "dist",
778
+ "autoload": {
779
+ "psr-4": {
780
+ "GuzzleHttp\\Psr7\\": "src/"
781
+ },
782
+ "files": [
783
+ "src/functions_include.php"
784
+ ]
785
+ },
786
+ "notification-url": "https://packagist.org/downloads/",
787
+ "license": [
788
+ "MIT"
789
+ ],
790
+ "authors": [
791
+ {
792
+ "name": "Michael Dowling",
793
+ "email": "mtdowling@gmail.com",
794
+ "homepage": "https://github.com/mtdowling"
795
+ },
796
+ {
797
+ "name": "Tobias Schultze",
798
+ "homepage": "https://github.com/Tobion"
799
+ }
800
+ ],
801
+ "description": "PSR-7 message implementation that also provides common utility methods",
802
+ "keywords": [
803
+ "http",
804
+ "message",
805
+ "request",
806
+ "response",
807
+ "stream",
808
+ "uri",
809
+ "url"
810
+ ]
811
+ }
812
+ ]
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/CHANGELOG.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CHANGELOG
2
+
3
+ ## 1.4.2 - 2017-03-20
4
+
5
+ * Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
6
+ calls to `trigger_error` when deprecated methods are invoked.
7
+
8
+ ## 1.4.1 - 2017-02-27
9
+
10
+ * Reverted BC break by reintroducing behavior to automagically fix a URI with a
11
+ relative path and an authority by adding a leading slash to the path. It's only
12
+ deprecated now.
13
+ * Added triggering of silenced deprecation warnings.
14
+
15
+ ## 1.4.0 - 2017-02-21
16
+
17
+ * Fix `Stream::read` when length parameter <= 0.
18
+ * `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
19
+ * Fix `ServerRequest::getUriFromGlobals` when `Host` header contains port.
20
+ * Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
21
+ * Allow `parse_response` to parse a response without delimiting space and reason.
22
+ * Ensure each URI modification results in a valid URI according to PSR-7 discussions.
23
+ Invalid modifications will throw an exception instead of returning a wrong URI or
24
+ doing some magic.
25
+ - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
26
+ because the path of a URI with an authority must start with a slash "/" or be empty
27
+ - `(new Uri())->withScheme('http')` will return `'http://localhost'`
28
+ * Fix compatibility of URIs with `file` scheme and empty host.
29
+ * Added common URI utility methods based on RFC 3986 (see documentation in the readme):
30
+ - `Uri::isDefaultPort`
31
+ - `Uri::isAbsolute`
32
+ - `Uri::isNetworkPathReference`
33
+ - `Uri::isAbsolutePathReference`
34
+ - `Uri::isRelativePathReference`
35
+ - `Uri::isSameDocumentReference`
36
+ - `Uri::composeComponents`
37
+ - `UriNormalizer::normalize`
38
+ - `UriNormalizer::isEquivalent`
39
+ - `UriResolver::relativize`
40
+ * Deprecated `Uri::resolve` in favor of `UriResolver::resolve`
41
+ * Deprecated `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
42
+
43
+ ## 1.3.1 - 2016-06-25
44
+
45
+ * Fix `Uri::__toString` for network path references, e.g. `//example.org`.
46
+ * Fix missing lowercase normalization for host.
47
+ * Fix handling of URI components in case they are `'0'` in a lot of places,
48
+ e.g. as a user info password.
49
+ * Fix `Uri::withAddedHeader` to correctly merge headers with different case.
50
+ * Fix trimming of header values in `Uri::withAddedHeader`. Header values may
51
+ be surrounded by whitespace which should be ignored according to RFC 7230
52
+ Section 3.2.4. This does not apply to header names.
53
+ * Fix `Uri::withAddedHeader` with an array of header values.
54
+ * Fix `Uri::resolve` when base path has no slash and handling of fragment.
55
+ * Fix handling of encoding in `Uri::with(out)QueryValue` so one can pass the
56
+ key/value both in encoded as well as decoded form to those methods. This is
57
+ consistent with withPath, withQuery etc.
58
+ * Fix `ServerRequest::withoutAttribute` when attribute value is null.
59
+
60
+ ## 1.3.0 - 2016-04-13
61
+
62
+ * Added remaining interfaces needed for full PSR7 compatibility
63
+ (ServerRequestInterface, UploadedFileInterface, etc.).
64
+ * Added support for stream_for from scalars.
65
+ * Can now extend Uri.
66
+ * Fixed a bug in validating request methods by making it more permissive.
67
+
68
+ ## 1.2.3 - 2016-02-18
69
+
70
+ * Fixed support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
71
+ streams, which can sometimes return fewer bytes than requested with `fread`.
72
+ * Fixed handling of gzipped responses with FNAME headers.
73
+
74
+ ## 1.2.2 - 2016-01-22
75
+
76
+ * Added support for URIs without any authority.
77
+ * Added support for HTTP 451 'Unavailable For Legal Reasons.'
78
+ * Added support for using '0' as a filename.
79
+ * Added support for including non-standard ports in Host headers.
80
+
81
+ ## 1.2.1 - 2015-11-02
82
+
83
+ * Now supporting negative offsets when seeking to SEEK_END.
84
+
85
+ ## 1.2.0 - 2015-08-15
86
+
87
+ * Body as `"0"` is now properly added to a response.
88
+ * Now allowing forward seeking in CachingStream.
89
+ * Now properly parsing HTTP requests that contain proxy targets in
90
+ `parse_request`.
91
+ * functions.php is now conditionally required.
92
+ * user-info is no longer dropped when resolving URIs.
93
+
94
+ ## 1.1.0 - 2015-06-24
95
+
96
+ * URIs can now be relative.
97
+ * `multipart/form-data` headers are now overridden case-insensitively.
98
+ * URI paths no longer encode the following characters because they are allowed
99
+ in URIs: "(", ")", "*", "!", "'"
100
+ * A port is no longer added to a URI when the scheme is missing and no port is
101
+ present.
102
+
103
+ ## 1.0.0 - 2015-05-19
104
+
105
+ Initial release.
106
+
107
+ Currently unsupported:
108
+
109
+ - `Psr\Http\Message\ServerRequestInterface`
110
+ - `Psr\Http\Message\UploadedFileInterface`
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2015 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/README.md ADDED
@@ -0,0 +1,739 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PSR-7 Message Implementation
2
+
3
+ This repository contains a full [PSR-7](http://www.php-fig.org/psr/psr-7/)
4
+ message implementation, several stream decorators, and some helpful
5
+ functionality like query string parsing.
6
+
7
+
8
+ [![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7)
9
+
10
+
11
+ # Stream implementation
12
+
13
+ This package comes with a number of stream implementations and stream
14
+ decorators.
15
+
16
+
17
+ ## AppendStream
18
+
19
+ `GuzzleHttp\Psr7\AppendStream`
20
+
21
+ Reads from multiple streams, one after the other.
22
+
23
+ ```php
24
+ use GuzzleHttp\Psr7;
25
+
26
+ $a = Psr7\stream_for('abc, ');
27
+ $b = Psr7\stream_for('123.');
28
+ $composed = new Psr7\AppendStream([$a, $b]);
29
+
30
+ $composed->addStream(Psr7\stream_for(' 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\stream_for(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\stream_for();
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\stream_for('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\stream_for(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\stream_for('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\stream_for('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\stream_for('hello!');
301
+ $resource = StreamWrapper::getResource($stream);
302
+ echo fread($resource, 6); // outputs hello!
303
+ ```
304
+
305
+
306
+ # Function API
307
+
308
+ There are various functions available under the `GuzzleHttp\Psr7` namespace.
309
+
310
+
311
+ ## `function str`
312
+
313
+ `function str(MessageInterface $message)`
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\str($request);
320
+ ```
321
+
322
+
323
+ ## `function uri_for`
324
+
325
+ `function uri_for($uri)`
326
+
327
+ This function accepts a string or `Psr\Http\Message\UriInterface` and returns a
328
+ UriInterface for the given value. If the value is already a `UriInterface`, it
329
+ is returned as-is.
330
+
331
+ ```php
332
+ $uri = GuzzleHttp\Psr7\uri_for('http://example.com');
333
+ assert($uri === GuzzleHttp\Psr7\uri_for($uri));
334
+ ```
335
+
336
+
337
+ ## `function stream_for`
338
+
339
+ `function stream_for($resource = '', array $options = [])`
340
+
341
+ Create a new stream based on the input type.
342
+
343
+ Options is an associative array that can contain the following keys:
344
+
345
+ * - metadata: Array of custom metadata.
346
+ * - size: Size of the stream.
347
+
348
+ This method accepts the following `$resource` types:
349
+
350
+ - `Psr\Http\Message\StreamInterface`: Returns the value as-is.
351
+ - `string`: Creates a stream object that uses the given string as the contents.
352
+ - `resource`: Creates a stream object that wraps the given PHP stream resource.
353
+ - `Iterator`: If the provided value implements `Iterator`, then a read-only
354
+ stream object will be created that wraps the given iterable. Each time the
355
+ stream is read from, data from the iterator will fill a buffer and will be
356
+ continuously called until the buffer is equal to the requested read size.
357
+ Subsequent read calls will first read from the buffer and then call `next`
358
+ on the underlying iterator until it is exhausted.
359
+ - `object` with `__toString()`: If the object has the `__toString()` method,
360
+ the object will be cast to a string and then a stream will be returned that
361
+ uses the string value.
362
+ - `NULL`: When `null` is passed, an empty stream object is returned.
363
+ - `callable` When a callable is passed, a read-only stream object will be
364
+ created that invokes the given callable. The callable is invoked with the
365
+ number of suggested bytes to read. The callable can return any number of
366
+ bytes, but MUST return `false` when there is no more data to return. The
367
+ stream object that wraps the callable will invoke the callable until the
368
+ number of requested bytes are available. Any additional bytes will be
369
+ buffered and used in subsequent reads.
370
+
371
+ ```php
372
+ $stream = GuzzleHttp\Psr7\stream_for('foo');
373
+ $stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r'));
374
+
375
+ $generator function ($bytes) {
376
+ for ($i = 0; $i < $bytes; $i++) {
377
+ yield ' ';
378
+ }
379
+ }
380
+
381
+ $stream = GuzzleHttp\Psr7\stream_for($generator(100));
382
+ ```
383
+
384
+
385
+ ## `function parse_header`
386
+
387
+ `function parse_header($header)`
388
+
389
+ Parse an array of header values containing ";" separated data into an array of
390
+ associative arrays representing the header key value pair data of the header.
391
+ When a parameter does not contain a value, but just contains a key, this
392
+ function will inject a key with a '' string value.
393
+
394
+
395
+ ## `function normalize_header`
396
+
397
+ `function normalize_header($header)`
398
+
399
+ Converts an array of header values that may contain comma separated headers
400
+ into an array of headers with no comma separated values.
401
+
402
+
403
+ ## `function modify_request`
404
+
405
+ `function modify_request(RequestInterface $request, array $changes)`
406
+
407
+ Clone and modify a request with the given changes. This method is useful for
408
+ reducing the number of clones needed to mutate a message.
409
+
410
+ The changes can be one of:
411
+
412
+ - method: (string) Changes the HTTP method.
413
+ - set_headers: (array) Sets the given headers.
414
+ - remove_headers: (array) Remove the given headers.
415
+ - body: (mixed) Sets the given body.
416
+ - uri: (UriInterface) Set the URI.
417
+ - query: (string) Set the query string value of the URI.
418
+ - version: (string) Set the protocol version.
419
+
420
+
421
+ ## `function rewind_body`
422
+
423
+ `function rewind_body(MessageInterface $message)`
424
+
425
+ Attempts to rewind a message body and throws an exception on failure. The body
426
+ of the message will only be rewound if a call to `tell()` returns a value other
427
+ than `0`.
428
+
429
+
430
+ ## `function try_fopen`
431
+
432
+ `function try_fopen($filename, $mode)`
433
+
434
+ Safely opens a PHP stream resource using a filename.
435
+
436
+ When fopen fails, PHP normally raises a warning. This function adds an error
437
+ handler that checks for errors and throws an exception instead.
438
+
439
+
440
+ ## `function copy_to_string`
441
+
442
+ `function copy_to_string(StreamInterface $stream, $maxLen = -1)`
443
+
444
+ Copy the contents of a stream into a string until the given number of bytes
445
+ have been read.
446
+
447
+
448
+ ## `function copy_to_stream`
449
+
450
+ `function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)`
451
+
452
+ Copy the contents of a stream into another stream until the given number of
453
+ bytes have been read.
454
+
455
+
456
+ ## `function hash`
457
+
458
+ `function hash(StreamInterface $stream, $algo, $rawOutput = false)`
459
+
460
+ Calculate a hash of a Stream. This method reads the entire stream to calculate
461
+ a rolling hash (based on PHP's hash_init functions).
462
+
463
+
464
+ ## `function readline`
465
+
466
+ `function readline(StreamInterface $stream, $maxLength = null)`
467
+
468
+ Read a line from the stream up to the maximum allowed buffer length.
469
+
470
+
471
+ ## `function parse_request`
472
+
473
+ `function parse_request($message)`
474
+
475
+ Parses a request message string into a request object.
476
+
477
+
478
+ ## `function parse_response`
479
+
480
+ `function parse_response($message)`
481
+
482
+ Parses a response message string into a response object.
483
+
484
+
485
+ ## `function parse_query`
486
+
487
+ `function parse_query($str, $urlEncoding = true)`
488
+
489
+ Parse a query string into an associative array.
490
+
491
+ If multiple values are found for the same key, the value of that key value pair
492
+ will become an array. This function does not parse nested PHP style arrays into
493
+ an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed into
494
+ `['foo[a]' => '1', 'foo[b]' => '2']`).
495
+
496
+
497
+ ## `function build_query`
498
+
499
+ `function build_query(array $params, $encoding = PHP_QUERY_RFC3986)`
500
+
501
+ Build a query string from an array of key value pairs.
502
+
503
+ This function can use the return value of parse_query() to build a query string.
504
+ This function does not modify the provided keys when an array is encountered
505
+ (like http_build_query would).
506
+
507
+
508
+ ## `function mimetype_from_filename`
509
+
510
+ `function mimetype_from_filename($filename)`
511
+
512
+ Determines the mimetype of a file by looking at its extension.
513
+
514
+
515
+ ## `function mimetype_from_extension`
516
+
517
+ `function mimetype_from_extension($extension)`
518
+
519
+ Maps a file extensions to a mimetype.
520
+
521
+
522
+ # Additional URI Methods
523
+
524
+ Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class,
525
+ this library also provides additional functionality when working with URIs as static methods.
526
+
527
+ ## URI Types
528
+
529
+ An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference.
530
+ An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI,
531
+ the base URI. Relative references can be divided into several forms according to
532
+ [RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2):
533
+
534
+ - network-path references, e.g. `//example.com/path`
535
+ - absolute-path references, e.g. `/path`
536
+ - relative-path references, e.g. `subpath`
537
+
538
+ The following methods can be used to identify the type of the URI.
539
+
540
+ ### `GuzzleHttp\Psr7\Uri::isAbsolute`
541
+
542
+ `public static function isAbsolute(UriInterface $uri): bool`
543
+
544
+ Whether the URI is absolute, i.e. it has a scheme.
545
+
546
+ ### `GuzzleHttp\Psr7\Uri::isNetworkPathReference`
547
+
548
+ `public static function isNetworkPathReference(UriInterface $uri): bool`
549
+
550
+ Whether the URI is a network-path reference. A relative reference that begins with two slash characters is
551
+ termed an network-path reference.
552
+
553
+ ### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference`
554
+
555
+ `public static function isAbsolutePathReference(UriInterface $uri): bool`
556
+
557
+ Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is
558
+ termed an absolute-path reference.
559
+
560
+ ### `GuzzleHttp\Psr7\Uri::isRelativePathReference`
561
+
562
+ `public static function isRelativePathReference(UriInterface $uri): bool`
563
+
564
+ Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is
565
+ termed a relative-path reference.
566
+
567
+ ### `GuzzleHttp\Psr7\Uri::isSameDocumentReference`
568
+
569
+ `public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool`
570
+
571
+ Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its
572
+ fragment component, identical to the base URI. When no base URI is given, only an empty URI reference
573
+ (apart from its fragment) is considered a same-document reference.
574
+
575
+ ## URI Components
576
+
577
+ Additional methods to work with URI components.
578
+
579
+ ### `GuzzleHttp\Psr7\Uri::isDefaultPort`
580
+
581
+ `public static function isDefaultPort(UriInterface $uri): bool`
582
+
583
+ Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null
584
+ or the standard port. This method can be used independently of the implementation.
585
+
586
+ ### `GuzzleHttp\Psr7\Uri::composeComponents`
587
+
588
+ `public static function composeComponents($scheme, $authority, $path, $query, $fragment): string`
589
+
590
+ Composes a URI reference string from its various components according to
591
+ [RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called
592
+ manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`.
593
+
594
+ ### `GuzzleHttp\Psr7\Uri::fromParts`
595
+
596
+ `public static function fromParts(array $parts): UriInterface`
597
+
598
+ Creates a URI from a hash of [`parse_url`](http://php.net/manual/en/function.parse-url.php) components.
599
+
600
+
601
+ ### `GuzzleHttp\Psr7\Uri::withQueryValue`
602
+
603
+ `public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface`
604
+
605
+ Creates a new URI with a specific query string value. Any existing query string values that exactly match the
606
+ provided key are removed and replaced with the given key value pair. A value of null will set the query string
607
+ key without a value, e.g. "key" instead of "key=value".
608
+
609
+
610
+ ### `GuzzleHttp\Psr7\Uri::withoutQueryValue`
611
+
612
+ `public static function withoutQueryValue(UriInterface $uri, $key): UriInterface`
613
+
614
+ Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the
615
+ provided key are removed.
616
+
617
+ ## Reference Resolution
618
+
619
+ `GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according
620
+ to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers
621
+ do when resolving a link in a website based on the current request URI.
622
+
623
+ ### `GuzzleHttp\Psr7\UriResolver::resolve`
624
+
625
+ `public static function resolve(UriInterface $base, UriInterface $rel): UriInterface`
626
+
627
+ Converts the relative URI into a new URI that is resolved against the base URI.
628
+
629
+ ### `GuzzleHttp\Psr7\UriResolver::removeDotSegments`
630
+
631
+ `public static function removeDotSegments(string $path): string`
632
+
633
+ Removes dot segments from a path and returns the new path according to
634
+ [RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4).
635
+
636
+ ### `GuzzleHttp\Psr7\UriResolver::relativize`
637
+
638
+ `public static function relativize(UriInterface $base, UriInterface $target): UriInterface`
639
+
640
+ Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve():
641
+
642
+ ```php
643
+ (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target))
644
+ ```
645
+
646
+ One use-case is to use the current request URI as base URI and then generate relative links in your documents
647
+ to reduce the document size or offer self-contained downloadable document archives.
648
+
649
+ ```php
650
+ $base = new Uri('http://example.com/a/b/');
651
+ echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'.
652
+ echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'.
653
+ echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'.
654
+ echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'.
655
+ ```
656
+
657
+ ## Normalization and Comparison
658
+
659
+ `GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to
660
+ [RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6).
661
+
662
+ ### `GuzzleHttp\Psr7\UriNormalizer::normalize`
663
+
664
+ `public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface`
665
+
666
+ Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface.
667
+ This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask
668
+ of normalizations to apply. The following normalizations are available:
669
+
670
+ - `UriNormalizer::PRESERVING_NORMALIZATIONS`
671
+
672
+ Default normalizations which only include the ones that preserve semantics.
673
+
674
+ - `UriNormalizer::CAPITALIZE_PERCENT_ENCODING`
675
+
676
+ All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized.
677
+
678
+ Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b`
679
+
680
+ - `UriNormalizer::DECODE_UNRESERVED_CHARACTERS`
681
+
682
+ Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of
683
+ ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should
684
+ not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved
685
+ characters by URI normalizers.
686
+
687
+ Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/`
688
+
689
+ - `UriNormalizer::CONVERT_EMPTY_PATH`
690
+
691
+ Converts the empty path to "/" for http and https URIs.
692
+
693
+ Example: `http://example.org` → `http://example.org/`
694
+
695
+ - `UriNormalizer::REMOVE_DEFAULT_HOST`
696
+
697
+ Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host
698
+ "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to
699
+ RFC 3986.
700
+
701
+ Example: `file://localhost/myfile` → `file:///myfile`
702
+
703
+ - `UriNormalizer::REMOVE_DEFAULT_PORT`
704
+
705
+ Removes the default port of the given URI scheme from the URI.
706
+
707
+ Example: `http://example.org:80/` → `http://example.org/`
708
+
709
+ - `UriNormalizer::REMOVE_DOT_SEGMENTS`
710
+
711
+ Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would
712
+ change the semantics of the URI reference.
713
+
714
+ Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html`
715
+
716
+ - `UriNormalizer::REMOVE_DUPLICATE_SLASHES`
717
+
718
+ Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes
719
+ and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization
720
+ may change the semantics. Encoded slashes (%2F) are not removed.
721
+
722
+ Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html`
723
+
724
+ - `UriNormalizer::SORT_QUERY_PARAMETERS`
725
+
726
+ Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be
727
+ significant (this is not defined by the standard). So this normalization is not safe and may change the semantics
728
+ of the URI.
729
+
730
+ Example: `?lang=en&article=fred` → `?article=fred&lang=en`
731
+
732
+ ### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent`
733
+
734
+ `public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool`
735
+
736
+ Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given
737
+ `$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent.
738
+ This of course assumes they will be resolved against the same base URI. If this is not the case, determination of
739
+ equivalence or difference of relative references does not mean anything.
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/composer.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "guzzlehttp/psr7",
3
+ "type": "library",
4
+ "description": "PSR-7 message implementation that also provides common utility methods",
5
+ "keywords": ["request", "response", "message", "stream", "http", "uri", "url"],
6
+ "license": "MIT",
7
+ "authors": [
8
+ {
9
+ "name": "Michael Dowling",
10
+ "email": "mtdowling@gmail.com",
11
+ "homepage": "https://github.com/mtdowling"
12
+ },
13
+ {
14
+ "name": "Tobias Schultze",
15
+ "homepage": "https://github.com/Tobion"
16
+ }
17
+ ],
18
+ "require": {
19
+ "php": ">=5.4.0",
20
+ "psr/http-message": "~1.0"
21
+ },
22
+ "require-dev": {
23
+ "phpunit/phpunit": "~4.0"
24
+ },
25
+ "provide": {
26
+ "psr/http-message-implementation": "1.0"
27
+ },
28
+ "autoload": {
29
+ "psr-4": {
30
+ "GuzzleHttp\\Psr7\\": "src/"
31
+ },
32
+ "files": ["src/functions_include.php"]
33
+ },
34
+ "extra": {
35
+ "branch-alias": {
36
+ "dev-master": "1.4-dev"
37
+ }
38
+ }
39
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/AppendStream.php ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Reads from multiple streams, one after the other.
8
+ *
9
+ * This is a read-only stream decorator.
10
+ */
11
+ class AppendStream implements StreamInterface
12
+ {
13
+ /** @var StreamInterface[] Streams being decorated */
14
+ private $streams = [];
15
+
16
+ private $seekable = true;
17
+ private $current = 0;
18
+ private $pos = 0;
19
+ private $detached = false;
20
+
21
+ /**
22
+ * @param StreamInterface[] $streams Streams to decorate. Each stream must
23
+ * be readable.
24
+ */
25
+ public function __construct(array $streams = [])
26
+ {
27
+ foreach ($streams as $stream) {
28
+ $this->addStream($stream);
29
+ }
30
+ }
31
+
32
+ public function __toString()
33
+ {
34
+ try {
35
+ $this->rewind();
36
+ return $this->getContents();
37
+ } catch (\Exception $e) {
38
+ return '';
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Add a stream to the AppendStream
44
+ *
45
+ * @param StreamInterface $stream Stream to append. Must be readable.
46
+ *
47
+ * @throws \InvalidArgumentException if the stream is not readable
48
+ */
49
+ public function addStream(StreamInterface $stream)
50
+ {
51
+ if (!$stream->isReadable()) {
52
+ throw new \InvalidArgumentException('Each stream must be readable');
53
+ }
54
+
55
+ // The stream is only seekable if all streams are seekable
56
+ if (!$stream->isSeekable()) {
57
+ $this->seekable = false;
58
+ }
59
+
60
+ $this->streams[] = $stream;
61
+ }
62
+
63
+ public function getContents()
64
+ {
65
+ return copy_to_string($this);
66
+ }
67
+
68
+ /**
69
+ * Closes each attached stream.
70
+ *
71
+ * {@inheritdoc}
72
+ */
73
+ public function close()
74
+ {
75
+ $this->pos = $this->current = 0;
76
+
77
+ foreach ($this->streams as $stream) {
78
+ $stream->close();
79
+ }
80
+
81
+ $this->streams = [];
82
+ }
83
+
84
+ /**
85
+ * Detaches each attached stream
86
+ *
87
+ * {@inheritdoc}
88
+ */
89
+ public function detach()
90
+ {
91
+ $this->close();
92
+ $this->detached = true;
93
+ }
94
+
95
+ public function tell()
96
+ {
97
+ return $this->pos;
98
+ }
99
+
100
+ /**
101
+ * Tries to calculate the size by adding the size of each stream.
102
+ *
103
+ * If any of the streams do not return a valid number, then the size of the
104
+ * append stream cannot be determined and null is returned.
105
+ *
106
+ * {@inheritdoc}
107
+ */
108
+ public function getSize()
109
+ {
110
+ $size = 0;
111
+
112
+ foreach ($this->streams as $stream) {
113
+ $s = $stream->getSize();
114
+ if ($s === null) {
115
+ return null;
116
+ }
117
+ $size += $s;
118
+ }
119
+
120
+ return $size;
121
+ }
122
+
123
+ public function eof()
124
+ {
125
+ return !$this->streams ||
126
+ ($this->current >= count($this->streams) - 1 &&
127
+ $this->streams[$this->current]->eof());
128
+ }
129
+
130
+ public function rewind()
131
+ {
132
+ $this->seek(0);
133
+ }
134
+
135
+ /**
136
+ * Attempts to seek to the given position. Only supports SEEK_SET.
137
+ *
138
+ * {@inheritdoc}
139
+ */
140
+ public function seek($offset, $whence = SEEK_SET)
141
+ {
142
+ if (!$this->seekable) {
143
+ throw new \RuntimeException('This AppendStream is not seekable');
144
+ } elseif ($whence !== SEEK_SET) {
145
+ throw new \RuntimeException('The AppendStream can only seek with SEEK_SET');
146
+ }
147
+
148
+ $this->pos = $this->current = 0;
149
+
150
+ // Rewind each stream
151
+ foreach ($this->streams as $i => $stream) {
152
+ try {
153
+ $stream->rewind();
154
+ } catch (\Exception $e) {
155
+ throw new \RuntimeException('Unable to seek stream '
156
+ . $i . ' of the AppendStream', 0, $e);
157
+ }
158
+ }
159
+
160
+ // Seek to the actual position by reading from each stream
161
+ while ($this->pos < $offset && !$this->eof()) {
162
+ $result = $this->read(min(8096, $offset - $this->pos));
163
+ if ($result === '') {
164
+ break;
165
+ }
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Reads from all of the appended streams until the length is met or EOF.
171
+ *
172
+ * {@inheritdoc}
173
+ */
174
+ public function read($length)
175
+ {
176
+ $buffer = '';
177
+ $total = count($this->streams) - 1;
178
+ $remaining = $length;
179
+ $progressToNext = false;
180
+
181
+ while ($remaining > 0) {
182
+
183
+ // Progress to the next stream if needed.
184
+ if ($progressToNext || $this->streams[$this->current]->eof()) {
185
+ $progressToNext = false;
186
+ if ($this->current === $total) {
187
+ break;
188
+ }
189
+ $this->current++;
190
+ }
191
+
192
+ $result = $this->streams[$this->current]->read($remaining);
193
+
194
+ // Using a loose comparison here to match on '', false, and null
195
+ if ($result == null) {
196
+ $progressToNext = true;
197
+ continue;
198
+ }
199
+
200
+ $buffer .= $result;
201
+ $remaining = $length - strlen($buffer);
202
+ }
203
+
204
+ $this->pos += strlen($buffer);
205
+
206
+ return $buffer;
207
+ }
208
+
209
+ public function isReadable()
210
+ {
211
+ return true;
212
+ }
213
+
214
+ public function isWritable()
215
+ {
216
+ return false;
217
+ }
218
+
219
+ public function isSeekable()
220
+ {
221
+ return $this->seekable;
222
+ }
223
+
224
+ public function write($string)
225
+ {
226
+ throw new \RuntimeException('Cannot write to an AppendStream');
227
+ }
228
+
229
+ public function getMetadata($key = null)
230
+ {
231
+ return $key ? null : [];
232
+ }
233
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/BufferStream.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Provides a buffer stream that can be written to to fill a buffer, and read
8
+ * from to remove bytes from the buffer.
9
+ *
10
+ * This stream returns a "hwm" metadata value that tells upstream consumers
11
+ * what the configured high water mark of the stream is, or the maximum
12
+ * preferred size of the buffer.
13
+ */
14
+ class BufferStream implements StreamInterface
15
+ {
16
+ private $hwm;
17
+ private $buffer = '';
18
+
19
+ /**
20
+ * @param int $hwm High water mark, representing the preferred maximum
21
+ * buffer size. If the size of the buffer exceeds the high
22
+ * water mark, then calls to write will continue to succeed
23
+ * but will return false to inform writers to slow down
24
+ * until the buffer has been drained by reading from it.
25
+ */
26
+ public function __construct($hwm = 16384)
27
+ {
28
+ $this->hwm = $hwm;
29
+ }
30
+
31
+ public function __toString()
32
+ {
33
+ return $this->getContents();
34
+ }
35
+
36
+ public function getContents()
37
+ {
38
+ $buffer = $this->buffer;
39
+ $this->buffer = '';
40
+
41
+ return $buffer;
42
+ }
43
+
44
+ public function close()
45
+ {
46
+ $this->buffer = '';
47
+ }
48
+
49
+ public function detach()
50
+ {
51
+ $this->close();
52
+ }
53
+
54
+ public function getSize()
55
+ {
56
+ return strlen($this->buffer);
57
+ }
58
+
59
+ public function isReadable()
60
+ {
61
+ return true;
62
+ }
63
+
64
+ public function isWritable()
65
+ {
66
+ return true;
67
+ }
68
+
69
+ public function isSeekable()
70
+ {
71
+ return false;
72
+ }
73
+
74
+ public function rewind()
75
+ {
76
+ $this->seek(0);
77
+ }
78
+
79
+ public function seek($offset, $whence = SEEK_SET)
80
+ {
81
+ throw new \RuntimeException('Cannot seek a BufferStream');
82
+ }
83
+
84
+ public function eof()
85
+ {
86
+ return strlen($this->buffer) === 0;
87
+ }
88
+
89
+ public function tell()
90
+ {
91
+ throw new \RuntimeException('Cannot determine the position of a BufferStream');
92
+ }
93
+
94
+ /**
95
+ * Reads data from the buffer.
96
+ */
97
+ public function read($length)
98
+ {
99
+ $currentLength = strlen($this->buffer);
100
+
101
+ if ($length >= $currentLength) {
102
+ // No need to slice the buffer because we don't have enough data.
103
+ $result = $this->buffer;
104
+ $this->buffer = '';
105
+ } else {
106
+ // Slice up the result to provide a subset of the buffer.
107
+ $result = substr($this->buffer, 0, $length);
108
+ $this->buffer = substr($this->buffer, $length);
109
+ }
110
+
111
+ return $result;
112
+ }
113
+
114
+ /**
115
+ * Writes data to the buffer.
116
+ */
117
+ public function write($string)
118
+ {
119
+ $this->buffer .= $string;
120
+
121
+ // TODO: What should happen here?
122
+ if (strlen($this->buffer) >= $this->hwm) {
123
+ return false;
124
+ }
125
+
126
+ return strlen($string);
127
+ }
128
+
129
+ public function getMetadata($key = null)
130
+ {
131
+ if ($key == 'hwm') {
132
+ return $this->hwm;
133
+ }
134
+
135
+ return $key ? null : [];
136
+ }
137
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/CachingStream.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Stream decorator that can cache previously read bytes from a sequentially
8
+ * read stream.
9
+ */
10
+ class CachingStream implements StreamInterface
11
+ {
12
+ use StreamDecoratorTrait;
13
+
14
+ /** @var StreamInterface Stream being wrapped */
15
+ private $remoteStream;
16
+
17
+ /** @var int Number of bytes to skip reading due to a write on the buffer */
18
+ private $skipReadBytes = 0;
19
+
20
+ /**
21
+ * We will treat the buffer object as the body of the stream
22
+ *
23
+ * @param StreamInterface $stream Stream to cache
24
+ * @param StreamInterface $target Optionally specify where data is cached
25
+ */
26
+ public function __construct(
27
+ StreamInterface $stream,
28
+ StreamInterface $target = null
29
+ ) {
30
+ $this->remoteStream = $stream;
31
+ $this->stream = $target ?: new Stream(fopen('php://temp', 'r+'));
32
+ }
33
+
34
+ public function getSize()
35
+ {
36
+ return max($this->stream->getSize(), $this->remoteStream->getSize());
37
+ }
38
+
39
+ public function rewind()
40
+ {
41
+ $this->seek(0);
42
+ }
43
+
44
+ public function seek($offset, $whence = SEEK_SET)
45
+ {
46
+ if ($whence == SEEK_SET) {
47
+ $byte = $offset;
48
+ } elseif ($whence == SEEK_CUR) {
49
+ $byte = $offset + $this->tell();
50
+ } elseif ($whence == SEEK_END) {
51
+ $size = $this->remoteStream->getSize();
52
+ if ($size === null) {
53
+ $size = $this->cacheEntireStream();
54
+ }
55
+ $byte = $size + $offset;
56
+ } else {
57
+ throw new \InvalidArgumentException('Invalid whence');
58
+ }
59
+
60
+ $diff = $byte - $this->stream->getSize();
61
+
62
+ if ($diff > 0) {
63
+ // Read the remoteStream until we have read in at least the amount
64
+ // of bytes requested, or we reach the end of the file.
65
+ while ($diff > 0 && !$this->remoteStream->eof()) {
66
+ $this->read($diff);
67
+ $diff = $byte - $this->stream->getSize();
68
+ }
69
+ } else {
70
+ // We can just do a normal seek since we've already seen this byte.
71
+ $this->stream->seek($byte);
72
+ }
73
+ }
74
+
75
+ public function read($length)
76
+ {
77
+ // Perform a regular read on any previously read data from the buffer
78
+ $data = $this->stream->read($length);
79
+ $remaining = $length - strlen($data);
80
+
81
+ // More data was requested so read from the remote stream
82
+ if ($remaining) {
83
+ // If data was written to the buffer in a position that would have
84
+ // been filled from the remote stream, then we must skip bytes on
85
+ // the remote stream to emulate overwriting bytes from that
86
+ // position. This mimics the behavior of other PHP stream wrappers.
87
+ $remoteData = $this->remoteStream->read(
88
+ $remaining + $this->skipReadBytes
89
+ );
90
+
91
+ if ($this->skipReadBytes) {
92
+ $len = strlen($remoteData);
93
+ $remoteData = substr($remoteData, $this->skipReadBytes);
94
+ $this->skipReadBytes = max(0, $this->skipReadBytes - $len);
95
+ }
96
+
97
+ $data .= $remoteData;
98
+ $this->stream->write($remoteData);
99
+ }
100
+
101
+ return $data;
102
+ }
103
+
104
+ public function write($string)
105
+ {
106
+ // When appending to the end of the currently read stream, you'll want
107
+ // to skip bytes from being read from the remote stream to emulate
108
+ // other stream wrappers. Basically replacing bytes of data of a fixed
109
+ // length.
110
+ $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell();
111
+ if ($overflow > 0) {
112
+ $this->skipReadBytes += $overflow;
113
+ }
114
+
115
+ return $this->stream->write($string);
116
+ }
117
+
118
+ public function eof()
119
+ {
120
+ return $this->stream->eof() && $this->remoteStream->eof();
121
+ }
122
+
123
+ /**
124
+ * Close both the remote stream and buffer stream
125
+ */
126
+ public function close()
127
+ {
128
+ $this->remoteStream->close() && $this->stream->close();
129
+ }
130
+
131
+ private function cacheEntireStream()
132
+ {
133
+ $target = new FnStream(['write' => 'strlen']);
134
+ copy_to_stream($this, $target);
135
+
136
+ return $this->tell();
137
+ }
138
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/DroppingStream.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Stream decorator that begins dropping data once the size of the underlying
8
+ * stream becomes too full.
9
+ */
10
+ class DroppingStream implements StreamInterface
11
+ {
12
+ use StreamDecoratorTrait;
13
+
14
+ private $maxLength;
15
+
16
+ /**
17
+ * @param StreamInterface $stream Underlying stream to decorate.
18
+ * @param int $maxLength Maximum size before dropping data.
19
+ */
20
+ public function __construct(StreamInterface $stream, $maxLength)
21
+ {
22
+ $this->stream = $stream;
23
+ $this->maxLength = $maxLength;
24
+ }
25
+
26
+ public function write($string)
27
+ {
28
+ $diff = $this->maxLength - $this->stream->getSize();
29
+
30
+ // Begin returning 0 when the underlying stream is too large.
31
+ if ($diff <= 0) {
32
+ return 0;
33
+ }
34
+
35
+ // Write the stream or a subset of the stream if needed.
36
+ if (strlen($string) < $diff) {
37
+ return $this->stream->write($string);
38
+ }
39
+
40
+ return $this->stream->write(substr($string, 0, $diff));
41
+ }
42
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/FnStream.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Compose stream implementations based on a hash of functions.
8
+ *
9
+ * Allows for easy testing and extension of a provided stream without needing
10
+ * to create a concrete class for a simple extension point.
11
+ */
12
+ class FnStream implements StreamInterface
13
+ {
14
+ /** @var array */
15
+ private $methods;
16
+
17
+ /** @var array Methods that must be implemented in the given array */
18
+ private static $slots = ['__toString', 'close', 'detach', 'rewind',
19
+ 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write',
20
+ 'isReadable', 'read', 'getContents', 'getMetadata'];
21
+
22
+ /**
23
+ * @param array $methods Hash of method name to a callable.
24
+ */
25
+ public function __construct(array $methods)
26
+ {
27
+ $this->methods = $methods;
28
+
29
+ // Create the functions on the class
30
+ foreach ($methods as $name => $fn) {
31
+ $this->{'_fn_' . $name} = $fn;
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Lazily determine which methods are not implemented.
37
+ * @throws \BadMethodCallException
38
+ */
39
+ public function __get($name)
40
+ {
41
+ throw new \BadMethodCallException(str_replace('_fn_', '', $name)
42
+ . '() is not implemented in the FnStream');
43
+ }
44
+
45
+ /**
46
+ * The close method is called on the underlying stream only if possible.
47
+ */
48
+ public function __destruct()
49
+ {
50
+ if (isset($this->_fn_close)) {
51
+ call_user_func($this->_fn_close);
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Adds custom functionality to an underlying stream by intercepting
57
+ * specific method calls.
58
+ *
59
+ * @param StreamInterface $stream Stream to decorate
60
+ * @param array $methods Hash of method name to a closure
61
+ *
62
+ * @return FnStream
63
+ */
64
+ public static function decorate(StreamInterface $stream, array $methods)
65
+ {
66
+ // If any of the required methods were not provided, then simply
67
+ // proxy to the decorated stream.
68
+ foreach (array_diff(self::$slots, array_keys($methods)) as $diff) {
69
+ $methods[$diff] = [$stream, $diff];
70
+ }
71
+
72
+ return new self($methods);
73
+ }
74
+
75
+ public function __toString()
76
+ {
77
+ return call_user_func($this->_fn___toString);
78
+ }
79
+
80
+ public function close()
81
+ {
82
+ return call_user_func($this->_fn_close);
83
+ }
84
+
85
+ public function detach()
86
+ {
87
+ return call_user_func($this->_fn_detach);
88
+ }
89
+
90
+ public function getSize()
91
+ {
92
+ return call_user_func($this->_fn_getSize);
93
+ }
94
+
95
+ public function tell()
96
+ {
97
+ return call_user_func($this->_fn_tell);
98
+ }
99
+
100
+ public function eof()
101
+ {
102
+ return call_user_func($this->_fn_eof);
103
+ }
104
+
105
+ public function isSeekable()
106
+ {
107
+ return call_user_func($this->_fn_isSeekable);
108
+ }
109
+
110
+ public function rewind()
111
+ {
112
+ call_user_func($this->_fn_rewind);
113
+ }
114
+
115
+ public function seek($offset, $whence = SEEK_SET)
116
+ {
117
+ call_user_func($this->_fn_seek, $offset, $whence);
118
+ }
119
+
120
+ public function isWritable()
121
+ {
122
+ return call_user_func($this->_fn_isWritable);
123
+ }
124
+
125
+ public function write($string)
126
+ {
127
+ return call_user_func($this->_fn_write, $string);
128
+ }
129
+
130
+ public function isReadable()
131
+ {
132
+ return call_user_func($this->_fn_isReadable);
133
+ }
134
+
135
+ public function read($length)
136
+ {
137
+ return call_user_func($this->_fn_read, $length);
138
+ }
139
+
140
+ public function getContents()
141
+ {
142
+ return call_user_func($this->_fn_getContents);
143
+ }
144
+
145
+ public function getMetadata($key = null)
146
+ {
147
+ return call_user_func($this->_fn_getMetadata, $key);
148
+ }
149
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/InflateStream.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Uses PHP's zlib.inflate filter to inflate deflate or gzipped content.
8
+ *
9
+ * This stream decorator skips the first 10 bytes of the given stream to remove
10
+ * the gzip header, converts the provided stream to a PHP stream resource,
11
+ * then appends the zlib.inflate filter. The stream is then converted back
12
+ * to a Guzzle stream resource to be used as a Guzzle stream.
13
+ *
14
+ * @link http://tools.ietf.org/html/rfc1952
15
+ * @link http://php.net/manual/en/filters.compression.php
16
+ */
17
+ class InflateStream implements StreamInterface
18
+ {
19
+ use StreamDecoratorTrait;
20
+
21
+ public function __construct(StreamInterface $stream)
22
+ {
23
+ // read the first 10 bytes, ie. gzip header
24
+ $header = $stream->read(10);
25
+ $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header);
26
+ // Skip the header, that is 10 + length of filename + 1 (nil) bytes
27
+ $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
28
+ $resource = StreamWrapper::getResource($stream);
29
+ stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
30
+ $this->stream = new Stream($resource);
31
+ }
32
+
33
+ /**
34
+ * @param StreamInterface $stream
35
+ * @param $header
36
+ * @return int
37
+ */
38
+ private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header)
39
+ {
40
+ $filename_header_length = 0;
41
+
42
+ if (substr(bin2hex($header), 6, 2) === '08') {
43
+ // we have a filename, read until nil
44
+ $filename_header_length = 1;
45
+ while ($stream->read(1) !== chr(0)) {
46
+ $filename_header_length++;
47
+ }
48
+ }
49
+
50
+ return $filename_header_length;
51
+ }
52
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/LazyOpenStream.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Lazily reads or writes to a file that is opened only after an IO operation
8
+ * take place on the stream.
9
+ */
10
+ class LazyOpenStream implements StreamInterface
11
+ {
12
+ use StreamDecoratorTrait;
13
+
14
+ /** @var string File to open */
15
+ private $filename;
16
+
17
+ /** @var string $mode */
18
+ private $mode;
19
+
20
+ /**
21
+ * @param string $filename File to lazily open
22
+ * @param string $mode fopen mode to use when opening the stream
23
+ */
24
+ public function __construct($filename, $mode)
25
+ {
26
+ $this->filename = $filename;
27
+ $this->mode = $mode;
28
+ }
29
+
30
+ /**
31
+ * Creates the underlying stream lazily when required.
32
+ *
33
+ * @return StreamInterface
34
+ */
35
+ protected function createStream()
36
+ {
37
+ return stream_for(try_fopen($this->filename, $this->mode));
38
+ }
39
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/LimitStream.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+
7
+ /**
8
+ * Decorator used to return only a subset of a stream
9
+ */
10
+ class LimitStream implements StreamInterface
11
+ {
12
+ use StreamDecoratorTrait;
13
+
14
+ /** @var int Offset to start reading from */
15
+ private $offset;
16
+
17
+ /** @var int Limit the number of bytes that can be read */
18
+ private $limit;
19
+
20
+ /**
21
+ * @param StreamInterface $stream Stream to wrap
22
+ * @param int $limit Total number of bytes to allow to be read
23
+ * from the stream. Pass -1 for no limit.
24
+ * @param int $offset Position to seek to before reading (only
25
+ * works on seekable streams).
26
+ */
27
+ public function __construct(
28
+ StreamInterface $stream,
29
+ $limit = -1,
30
+ $offset = 0
31
+ ) {
32
+ $this->stream = $stream;
33
+ $this->setLimit($limit);
34
+ $this->setOffset($offset);
35
+ }
36
+
37
+ public function eof()
38
+ {
39
+ // Always return true if the underlying stream is EOF
40
+ if ($this->stream->eof()) {
41
+ return true;
42
+ }
43
+
44
+ // No limit and the underlying stream is not at EOF
45
+ if ($this->limit == -1) {
46
+ return false;
47
+ }
48
+
49
+ return $this->stream->tell() >= $this->offset + $this->limit;
50
+ }
51
+
52
+ /**
53
+ * Returns the size of the limited subset of data
54
+ * {@inheritdoc}
55
+ */
56
+ public function getSize()
57
+ {
58
+ if (null === ($length = $this->stream->getSize())) {
59
+ return null;
60
+ } elseif ($this->limit == -1) {
61
+ return $length - $this->offset;
62
+ } else {
63
+ return min($this->limit, $length - $this->offset);
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Allow for a bounded seek on the read limited stream
69
+ * {@inheritdoc}
70
+ */
71
+ public function seek($offset, $whence = SEEK_SET)
72
+ {
73
+ if ($whence !== SEEK_SET || $offset < 0) {
74
+ throw new \RuntimeException(sprintf(
75
+ 'Cannot seek to offset % with whence %s',
76
+ $offset,
77
+ $whence
78
+ ));
79
+ }
80
+
81
+ $offset += $this->offset;
82
+
83
+ if ($this->limit !== -1) {
84
+ if ($offset > $this->offset + $this->limit) {
85
+ $offset = $this->offset + $this->limit;
86
+ }
87
+ }
88
+
89
+ $this->stream->seek($offset);
90
+ }
91
+
92
+ /**
93
+ * Give a relative tell()
94
+ * {@inheritdoc}
95
+ */
96
+ public function tell()
97
+ {
98
+ return $this->stream->tell() - $this->offset;
99
+ }
100
+
101
+ /**
102
+ * Set the offset to start limiting from
103
+ *
104
+ * @param int $offset Offset to seek to and begin byte limiting from
105
+ *
106
+ * @throws \RuntimeException if the stream cannot be seeked.
107
+ */
108
+ public function setOffset($offset)
109
+ {
110
+ $current = $this->stream->tell();
111
+
112
+ if ($current !== $offset) {
113
+ // If the stream cannot seek to the offset position, then read to it
114
+ if ($this->stream->isSeekable()) {
115
+ $this->stream->seek($offset);
116
+ } elseif ($current > $offset) {
117
+ throw new \RuntimeException("Could not seek to stream offset $offset");
118
+ } else {
119
+ $this->stream->read($offset - $current);
120
+ }
121
+ }
122
+
123
+ $this->offset = $offset;
124
+ }
125
+
126
+ /**
127
+ * Set the limit of bytes that the decorator allows to be read from the
128
+ * stream.
129
+ *
130
+ * @param int $limit Number of bytes to allow to be read from the stream.
131
+ * Use -1 for no limit.
132
+ */
133
+ public function setLimit($limit)
134
+ {
135
+ $this->limit = $limit;
136
+ }
137
+
138
+ public function read($length)
139
+ {
140
+ if ($this->limit == -1) {
141
+ return $this->stream->read($length);
142
+ }
143
+
144
+ // Check if the current position is less than the total allowed
145
+ // bytes + original offset
146
+ $remaining = ($this->offset + $this->limit) - $this->stream->tell();
147
+ if ($remaining > 0) {
148
+ // Only return the amount of requested data, ensuring that the byte
149
+ // limit is not exceeded
150
+ return $this->stream->read(min($remaining, $length));
151
+ }
152
+
153
+ return '';
154
+ }
155
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/MessageTrait.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Trait implementing functionality common to requests and responses.
8
+ */
9
+ trait MessageTrait
10
+ {
11
+ /** @var array Map of all registered headers, as original name => array of values */
12
+ private $headers = [];
13
+
14
+ /** @var array Map of lowercase header name => original name at registration */
15
+ private $headerNames = [];
16
+
17
+ /** @var string */
18
+ private $protocol = '1.1';
19
+
20
+ /** @var StreamInterface */
21
+ private $stream;
22
+
23
+ public function getProtocolVersion()
24
+ {
25
+ return $this->protocol;
26
+ }
27
+
28
+ public function withProtocolVersion($version)
29
+ {
30
+ if ($this->protocol === $version) {
31
+ return $this;
32
+ }
33
+
34
+ $new = clone $this;
35
+ $new->protocol = $version;
36
+ return $new;
37
+ }
38
+
39
+ public function getHeaders()
40
+ {
41
+ return $this->headers;
42
+ }
43
+
44
+ public function hasHeader($header)
45
+ {
46
+ return isset($this->headerNames[strtolower($header)]);
47
+ }
48
+
49
+ public function getHeader($header)
50
+ {
51
+ $header = strtolower($header);
52
+
53
+ if (!isset($this->headerNames[$header])) {
54
+ return [];
55
+ }
56
+
57
+ $header = $this->headerNames[$header];
58
+
59
+ return $this->headers[$header];
60
+ }
61
+
62
+ public function getHeaderLine($header)
63
+ {
64
+ return implode(', ', $this->getHeader($header));
65
+ }
66
+
67
+ public function withHeader($header, $value)
68
+ {
69
+ if (!is_array($value)) {
70
+ $value = [$value];
71
+ }
72
+
73
+ $value = $this->trimHeaderValues($value);
74
+ $normalized = strtolower($header);
75
+
76
+ $new = clone $this;
77
+ if (isset($new->headerNames[$normalized])) {
78
+ unset($new->headers[$new->headerNames[$normalized]]);
79
+ }
80
+ $new->headerNames[$normalized] = $header;
81
+ $new->headers[$header] = $value;
82
+
83
+ return $new;
84
+ }
85
+
86
+ public function withAddedHeader($header, $value)
87
+ {
88
+ if (!is_array($value)) {
89
+ $value = [$value];
90
+ }
91
+
92
+ $value = $this->trimHeaderValues($value);
93
+ $normalized = strtolower($header);
94
+
95
+ $new = clone $this;
96
+ if (isset($new->headerNames[$normalized])) {
97
+ $header = $this->headerNames[$normalized];
98
+ $new->headers[$header] = array_merge($this->headers[$header], $value);
99
+ } else {
100
+ $new->headerNames[$normalized] = $header;
101
+ $new->headers[$header] = $value;
102
+ }
103
+
104
+ return $new;
105
+ }
106
+
107
+ public function withoutHeader($header)
108
+ {
109
+ $normalized = strtolower($header);
110
+
111
+ if (!isset($this->headerNames[$normalized])) {
112
+ return $this;
113
+ }
114
+
115
+ $header = $this->headerNames[$normalized];
116
+
117
+ $new = clone $this;
118
+ unset($new->headers[$header], $new->headerNames[$normalized]);
119
+
120
+ return $new;
121
+ }
122
+
123
+ public function getBody()
124
+ {
125
+ if (!$this->stream) {
126
+ $this->stream = stream_for('');
127
+ }
128
+
129
+ return $this->stream;
130
+ }
131
+
132
+ public function withBody(StreamInterface $body)
133
+ {
134
+ if ($body === $this->stream) {
135
+ return $this;
136
+ }
137
+
138
+ $new = clone $this;
139
+ $new->stream = $body;
140
+ return $new;
141
+ }
142
+
143
+ private function setHeaders(array $headers)
144
+ {
145
+ $this->headerNames = $this->headers = [];
146
+ foreach ($headers as $header => $value) {
147
+ if (!is_array($value)) {
148
+ $value = [$value];
149
+ }
150
+
151
+ $value = $this->trimHeaderValues($value);
152
+ $normalized = strtolower($header);
153
+ if (isset($this->headerNames[$normalized])) {
154
+ $header = $this->headerNames[$normalized];
155
+ $this->headers[$header] = array_merge($this->headers[$header], $value);
156
+ } else {
157
+ $this->headerNames[$normalized] = $header;
158
+ $this->headers[$header] = $value;
159
+ }
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Trims whitespace from the header values.
165
+ *
166
+ * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field.
167
+ *
168
+ * header-field = field-name ":" OWS field-value OWS
169
+ * OWS = *( SP / HTAB )
170
+ *
171
+ * @param string[] $values Header values
172
+ *
173
+ * @return string[] Trimmed header values
174
+ *
175
+ * @see https://tools.ietf.org/html/rfc7230#section-3.2.4
176
+ */
177
+ private function trimHeaderValues(array $values)
178
+ {
179
+ return array_map(function ($value) {
180
+ return trim($value, " \t");
181
+ }, $values);
182
+ }
183
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/MultipartStream.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Stream that when read returns bytes for a streaming multipart or
8
+ * multipart/form-data stream.
9
+ */
10
+ class MultipartStream implements StreamInterface
11
+ {
12
+ use StreamDecoratorTrait;
13
+
14
+ private $boundary;
15
+
16
+ /**
17
+ * @param array $elements Array of associative arrays, each containing a
18
+ * required "name" key mapping to the form field,
19
+ * name, a required "contents" key mapping to a
20
+ * StreamInterface/resource/string, an optional
21
+ * "headers" associative array of custom headers,
22
+ * and an optional "filename" key mapping to a
23
+ * string to send as the filename in the part.
24
+ * @param string $boundary You can optionally provide a specific boundary
25
+ *
26
+ * @throws \InvalidArgumentException
27
+ */
28
+ public function __construct(array $elements = [], $boundary = null)
29
+ {
30
+ $this->boundary = $boundary ?: sha1(uniqid('', true));
31
+ $this->stream = $this->createStream($elements);
32
+ }
33
+
34
+ /**
35
+ * Get the boundary
36
+ *
37
+ * @return string
38
+ */
39
+ public function getBoundary()
40
+ {
41
+ return $this->boundary;
42
+ }
43
+
44
+ public function isWritable()
45
+ {
46
+ return false;
47
+ }
48
+
49
+ /**
50
+ * Get the headers needed before transferring the content of a POST file
51
+ */
52
+ private function getHeaders(array $headers)
53
+ {
54
+ $str = '';
55
+ foreach ($headers as $key => $value) {
56
+ $str .= "{$key}: {$value}\r\n";
57
+ }
58
+
59
+ return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n";
60
+ }
61
+
62
+ /**
63
+ * Create the aggregate stream that will be used to upload the POST data
64
+ */
65
+ protected function createStream(array $elements)
66
+ {
67
+ $stream = new AppendStream();
68
+
69
+ foreach ($elements as $element) {
70
+ $this->addElement($stream, $element);
71
+ }
72
+
73
+ // Add the trailing boundary with CRLF
74
+ $stream->addStream(stream_for("--{$this->boundary}--\r\n"));
75
+
76
+ return $stream;
77
+ }
78
+
79
+ private function addElement(AppendStream $stream, array $element)
80
+ {
81
+ foreach (['contents', 'name'] as $key) {
82
+ if (!array_key_exists($key, $element)) {
83
+ throw new \InvalidArgumentException("A '{$key}' key is required");
84
+ }
85
+ }
86
+
87
+ $element['contents'] = stream_for($element['contents']);
88
+
89
+ if (empty($element['filename'])) {
90
+ $uri = $element['contents']->getMetadata('uri');
91
+ if (substr($uri, 0, 6) !== 'php://') {
92
+ $element['filename'] = $uri;
93
+ }
94
+ }
95
+
96
+ list($body, $headers) = $this->createElement(
97
+ $element['name'],
98
+ $element['contents'],
99
+ isset($element['filename']) ? $element['filename'] : null,
100
+ isset($element['headers']) ? $element['headers'] : []
101
+ );
102
+
103
+ $stream->addStream(stream_for($this->getHeaders($headers)));
104
+ $stream->addStream($body);
105
+ $stream->addStream(stream_for("\r\n"));
106
+ }
107
+
108
+ /**
109
+ * @return array
110
+ */
111
+ private function createElement($name, StreamInterface $stream, $filename, array $headers)
112
+ {
113
+ // Set a default content-disposition header if one was no provided
114
+ $disposition = $this->getHeader($headers, 'content-disposition');
115
+ if (!$disposition) {
116
+ $headers['Content-Disposition'] = ($filename === '0' || $filename)
117
+ ? sprintf('form-data; name="%s"; filename="%s"',
118
+ $name,
119
+ basename($filename))
120
+ : "form-data; name=\"{$name}\"";
121
+ }
122
+
123
+ // Set a default content-length header if one was no provided
124
+ $length = $this->getHeader($headers, 'content-length');
125
+ if (!$length) {
126
+ if ($length = $stream->getSize()) {
127
+ $headers['Content-Length'] = (string) $length;
128
+ }
129
+ }
130
+
131
+ // Set a default Content-Type if one was not supplied
132
+ $type = $this->getHeader($headers, 'content-type');
133
+ if (!$type && ($filename === '0' || $filename)) {
134
+ if ($type = mimetype_from_filename($filename)) {
135
+ $headers['Content-Type'] = $type;
136
+ }
137
+ }
138
+
139
+ return [$stream, $headers];
140
+ }
141
+
142
+ private function getHeader(array $headers, $key)
143
+ {
144
+ $lowercaseHeader = strtolower($key);
145
+ foreach ($headers as $k => $v) {
146
+ if (strtolower($k) === $lowercaseHeader) {
147
+ return $v;
148
+ }
149
+ }
150
+
151
+ return null;
152
+ }
153
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/NoSeekStream.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Stream decorator that prevents a stream from being seeked
8
+ */
9
+ class NoSeekStream implements StreamInterface
10
+ {
11
+ use StreamDecoratorTrait;
12
+
13
+ public function seek($offset, $whence = SEEK_SET)
14
+ {
15
+ throw new \RuntimeException('Cannot seek a NoSeekStream');
16
+ }
17
+
18
+ public function isSeekable()
19
+ {
20
+ return false;
21
+ }
22
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/PumpStream.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Provides a read only stream that pumps data from a PHP callable.
8
+ *
9
+ * When invoking the provided callable, the PumpStream will pass the amount of
10
+ * data requested to read to the callable. The callable can choose to ignore
11
+ * this value and return fewer or more bytes than requested. Any extra data
12
+ * returned by the provided callable is buffered internally until drained using
13
+ * the read() function of the PumpStream. The provided callable MUST return
14
+ * false when there is no more data to read.
15
+ */
16
+ class PumpStream implements StreamInterface
17
+ {
18
+ /** @var callable */
19
+ private $source;
20
+
21
+ /** @var int */
22
+ private $size;
23
+
24
+ /** @var int */
25
+ private $tellPos = 0;
26
+
27
+ /** @var array */
28
+ private $metadata;
29
+
30
+ /** @var BufferStream */
31
+ private $buffer;
32
+
33
+ /**
34
+ * @param callable $source Source of the stream data. The callable MAY
35
+ * accept an integer argument used to control the
36
+ * amount of data to return. The callable MUST
37
+ * return a string when called, or false on error
38
+ * or EOF.
39
+ * @param array $options Stream options:
40
+ * - metadata: Hash of metadata to use with stream.
41
+ * - size: Size of the stream, if known.
42
+ */
43
+ public function __construct(callable $source, array $options = [])
44
+ {
45
+ $this->source = $source;
46
+ $this->size = isset($options['size']) ? $options['size'] : null;
47
+ $this->metadata = isset($options['metadata']) ? $options['metadata'] : [];
48
+ $this->buffer = new BufferStream();
49
+ }
50
+
51
+ public function __toString()
52
+ {
53
+ try {
54
+ return copy_to_string($this);
55
+ } catch (\Exception $e) {
56
+ return '';
57
+ }
58
+ }
59
+
60
+ public function close()
61
+ {
62
+ $this->detach();
63
+ }
64
+
65
+ public function detach()
66
+ {
67
+ $this->tellPos = false;
68
+ $this->source = null;
69
+ }
70
+
71
+ public function getSize()
72
+ {
73
+ return $this->size;
74
+ }
75
+
76
+ public function tell()
77
+ {
78
+ return $this->tellPos;
79
+ }
80
+
81
+ public function eof()
82
+ {
83
+ return !$this->source;
84
+ }
85
+
86
+ public function isSeekable()
87
+ {
88
+ return false;
89
+ }
90
+
91
+ public function rewind()
92
+ {
93
+ $this->seek(0);
94
+ }
95
+
96
+ public function seek($offset, $whence = SEEK_SET)
97
+ {
98
+ throw new \RuntimeException('Cannot seek a PumpStream');
99
+ }
100
+
101
+ public function isWritable()
102
+ {
103
+ return false;
104
+ }
105
+
106
+ public function write($string)
107
+ {
108
+ throw new \RuntimeException('Cannot write to a PumpStream');
109
+ }
110
+
111
+ public function isReadable()
112
+ {
113
+ return true;
114
+ }
115
+
116
+ public function read($length)
117
+ {
118
+ $data = $this->buffer->read($length);
119
+ $readLen = strlen($data);
120
+ $this->tellPos += $readLen;
121
+ $remaining = $length - $readLen;
122
+
123
+ if ($remaining) {
124
+ $this->pump($remaining);
125
+ $data .= $this->buffer->read($remaining);
126
+ $this->tellPos += strlen($data) - $readLen;
127
+ }
128
+
129
+ return $data;
130
+ }
131
+
132
+ public function getContents()
133
+ {
134
+ $result = '';
135
+ while (!$this->eof()) {
136
+ $result .= $this->read(1000000);
137
+ }
138
+
139
+ return $result;
140
+ }
141
+
142
+ public function getMetadata($key = null)
143
+ {
144
+ if (!$key) {
145
+ return $this->metadata;
146
+ }
147
+
148
+ return isset($this->metadata[$key]) ? $this->metadata[$key] : null;
149
+ }
150
+
151
+ private function pump($length)
152
+ {
153
+ if ($this->source) {
154
+ do {
155
+ $data = call_user_func($this->source, $length);
156
+ if ($data === false || $data === null) {
157
+ $this->source = null;
158
+ return;
159
+ }
160
+ $this->buffer->write($data);
161
+ $length -= strlen($data);
162
+ } while ($length > 0);
163
+ }
164
+ }
165
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/Request.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use InvalidArgumentException;
5
+ use Psr\Http\Message\RequestInterface;
6
+ use Psr\Http\Message\StreamInterface;
7
+ use Psr\Http\Message\UriInterface;
8
+
9
+ /**
10
+ * PSR-7 request implementation.
11
+ */
12
+ class Request implements RequestInterface
13
+ {
14
+ use MessageTrait;
15
+
16
+ /** @var string */
17
+ private $method;
18
+
19
+ /** @var null|string */
20
+ private $requestTarget;
21
+
22
+ /** @var UriInterface */
23
+ private $uri;
24
+
25
+ /**
26
+ * @param string $method HTTP method
27
+ * @param string|UriInterface $uri URI
28
+ * @param array $headers Request headers
29
+ * @param string|null|resource|StreamInterface $body Request body
30
+ * @param string $version Protocol version
31
+ */
32
+ public function __construct(
33
+ $method,
34
+ $uri,
35
+ array $headers = [],
36
+ $body = null,
37
+ $version = '1.1'
38
+ ) {
39
+ if (!($uri instanceof UriInterface)) {
40
+ $uri = new Uri($uri);
41
+ }
42
+
43
+ $this->method = strtoupper($method);
44
+ $this->uri = $uri;
45
+ $this->setHeaders($headers);
46
+ $this->protocol = $version;
47
+
48
+ if (!$this->hasHeader('Host')) {
49
+ $this->updateHostFromUri();
50
+ }
51
+
52
+ if ($body !== '' && $body !== null) {
53
+ $this->stream = stream_for($body);
54
+ }
55
+ }
56
+
57
+ public function getRequestTarget()
58
+ {
59
+ if ($this->requestTarget !== null) {
60
+ return $this->requestTarget;
61
+ }
62
+
63
+ $target = $this->uri->getPath();
64
+ if ($target == '') {
65
+ $target = '/';
66
+ }
67
+ if ($this->uri->getQuery() != '') {
68
+ $target .= '?' . $this->uri->getQuery();
69
+ }
70
+
71
+ return $target;
72
+ }
73
+
74
+ public function withRequestTarget($requestTarget)
75
+ {
76
+ if (preg_match('#\s#', $requestTarget)) {
77
+ throw new InvalidArgumentException(
78
+ 'Invalid request target provided; cannot contain whitespace'
79
+ );
80
+ }
81
+
82
+ $new = clone $this;
83
+ $new->requestTarget = $requestTarget;
84
+ return $new;
85
+ }
86
+
87
+ public function getMethod()
88
+ {
89
+ return $this->method;
90
+ }
91
+
92
+ public function withMethod($method)
93
+ {
94
+ $new = clone $this;
95
+ $new->method = strtoupper($method);
96
+ return $new;
97
+ }
98
+
99
+ public function getUri()
100
+ {
101
+ return $this->uri;
102
+ }
103
+
104
+ public function withUri(UriInterface $uri, $preserveHost = false)
105
+ {
106
+ if ($uri === $this->uri) {
107
+ return $this;
108
+ }
109
+
110
+ $new = clone $this;
111
+ $new->uri = $uri;
112
+
113
+ if (!$preserveHost) {
114
+ $new->updateHostFromUri();
115
+ }
116
+
117
+ return $new;
118
+ }
119
+
120
+ private function updateHostFromUri()
121
+ {
122
+ $host = $this->uri->getHost();
123
+
124
+ if ($host == '') {
125
+ return;
126
+ }
127
+
128
+ if (($port = $this->uri->getPort()) !== null) {
129
+ $host .= ':' . $port;
130
+ }
131
+
132
+ if (isset($this->headerNames['host'])) {
133
+ $header = $this->headerNames['host'];
134
+ } else {
135
+ $header = 'Host';
136
+ $this->headerNames['host'] = 'Host';
137
+ }
138
+ // Ensure Host is the first header.
139
+ // See: http://tools.ietf.org/html/rfc7230#section-5.4
140
+ $this->headers = [$header => [$host]] + $this->headers;
141
+ }
142
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/Response.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\ResponseInterface;
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * PSR-7 response implementation.
9
+ */
10
+ class Response implements ResponseInterface
11
+ {
12
+ use MessageTrait;
13
+
14
+ /** @var array Map of standard HTTP status code/reason phrases */
15
+ private static $phrases = [
16
+ 100 => 'Continue',
17
+ 101 => 'Switching Protocols',
18
+ 102 => 'Processing',
19
+ 200 => 'OK',
20
+ 201 => 'Created',
21
+ 202 => 'Accepted',
22
+ 203 => 'Non-Authoritative Information',
23
+ 204 => 'No Content',
24
+ 205 => 'Reset Content',
25
+ 206 => 'Partial Content',
26
+ 207 => 'Multi-status',
27
+ 208 => 'Already Reported',
28
+ 300 => 'Multiple Choices',
29
+ 301 => 'Moved Permanently',
30
+ 302 => 'Found',
31
+ 303 => 'See Other',
32
+ 304 => 'Not Modified',
33
+ 305 => 'Use Proxy',
34
+ 306 => 'Switch Proxy',
35
+ 307 => 'Temporary Redirect',
36
+ 400 => 'Bad Request',
37
+ 401 => 'Unauthorized',
38
+ 402 => 'Payment Required',
39
+ 403 => 'Forbidden',
40
+ 404 => 'Not Found',
41
+ 405 => 'Method Not Allowed',
42
+ 406 => 'Not Acceptable',
43
+ 407 => 'Proxy Authentication Required',
44
+ 408 => 'Request Time-out',
45
+ 409 => 'Conflict',
46
+ 410 => 'Gone',
47
+ 411 => 'Length Required',
48
+ 412 => 'Precondition Failed',
49
+ 413 => 'Request Entity Too Large',
50
+ 414 => 'Request-URI Too Large',
51
+ 415 => 'Unsupported Media Type',
52
+ 416 => 'Requested range not satisfiable',
53
+ 417 => 'Expectation Failed',
54
+ 418 => 'I\'m a teapot',
55
+ 422 => 'Unprocessable Entity',
56
+ 423 => 'Locked',
57
+ 424 => 'Failed Dependency',
58
+ 425 => 'Unordered Collection',
59
+ 426 => 'Upgrade Required',
60
+ 428 => 'Precondition Required',
61
+ 429 => 'Too Many Requests',
62
+ 431 => 'Request Header Fields Too Large',
63
+ 451 => 'Unavailable For Legal Reasons',
64
+ 500 => 'Internal Server Error',
65
+ 501 => 'Not Implemented',
66
+ 502 => 'Bad Gateway',
67
+ 503 => 'Service Unavailable',
68
+ 504 => 'Gateway Time-out',
69
+ 505 => 'HTTP Version not supported',
70
+ 506 => 'Variant Also Negotiates',
71
+ 507 => 'Insufficient Storage',
72
+ 508 => 'Loop Detected',
73
+ 511 => 'Network Authentication Required',
74
+ ];
75
+
76
+ /** @var string */
77
+ private $reasonPhrase = '';
78
+
79
+ /** @var int */
80
+ private $statusCode = 200;
81
+
82
+ /**
83
+ * @param int $status Status code
84
+ * @param array $headers Response headers
85
+ * @param string|null|resource|StreamInterface $body Response body
86
+ * @param string $version Protocol version
87
+ * @param string|null $reason Reason phrase (when empty a default will be used based on the status code)
88
+ */
89
+ public function __construct(
90
+ $status = 200,
91
+ array $headers = [],
92
+ $body = null,
93
+ $version = '1.1',
94
+ $reason = null
95
+ ) {
96
+ $this->statusCode = (int) $status;
97
+
98
+ if ($body !== '' && $body !== null) {
99
+ $this->stream = stream_for($body);
100
+ }
101
+
102
+ $this->setHeaders($headers);
103
+ if ($reason == '' && isset(self::$phrases[$this->statusCode])) {
104
+ $this->reasonPhrase = self::$phrases[$this->statusCode];
105
+ } else {
106
+ $this->reasonPhrase = (string) $reason;
107
+ }
108
+
109
+ $this->protocol = $version;
110
+ }
111
+
112
+ public function getStatusCode()
113
+ {
114
+ return $this->statusCode;
115
+ }
116
+
117
+ public function getReasonPhrase()
118
+ {
119
+ return $this->reasonPhrase;
120
+ }
121
+
122
+ public function withStatus($code, $reasonPhrase = '')
123
+ {
124
+ $new = clone $this;
125
+ $new->statusCode = (int) $code;
126
+ if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) {
127
+ $reasonPhrase = self::$phrases[$new->statusCode];
128
+ }
129
+ $new->reasonPhrase = $reasonPhrase;
130
+ return $new;
131
+ }
132
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/ServerRequest.php ADDED
@@ -0,0 +1,358 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace GuzzleHttp\Psr7;
4
+
5
+ use InvalidArgumentException;
6
+ use Psr\Http\Message\ServerRequestInterface;
7
+ use Psr\Http\Message\UriInterface;
8
+ use Psr\Http\Message\StreamInterface;
9
+ use Psr\Http\Message\UploadedFileInterface;
10
+
11
+ /**
12
+ * Server-side HTTP request
13
+ *
14
+ * Extends the Request definition to add methods for accessing incoming data,
15
+ * specifically server parameters, cookies, matched path parameters, query
16
+ * string arguments, body parameters, and upload file information.
17
+ *
18
+ * "Attributes" are discovered via decomposing the request (and usually
19
+ * specifically the URI path), and typically will be injected by the application.
20
+ *
21
+ * Requests are considered immutable; all methods that might change state are
22
+ * implemented such that they retain the internal state of the current
23
+ * message and return a new instance that contains the changed state.
24
+ */
25
+ class ServerRequest extends Request implements ServerRequestInterface
26
+ {
27
+ /**
28
+ * @var array
29
+ */
30
+ private $attributes = [];
31
+
32
+ /**
33
+ * @var array
34
+ */
35
+ private $cookieParams = [];
36
+
37
+ /**
38
+ * @var null|array|object
39
+ */
40
+ private $parsedBody;
41
+
42
+ /**
43
+ * @var array
44
+ */
45
+ private $queryParams = [];
46
+
47
+ /**
48
+ * @var array
49
+ */
50
+ private $serverParams;
51
+
52
+ /**
53
+ * @var array
54
+ */
55
+ private $uploadedFiles = [];
56
+
57
+ /**
58
+ * @param string $method HTTP method
59
+ * @param string|UriInterface $uri URI
60
+ * @param array $headers Request headers
61
+ * @param string|null|resource|StreamInterface $body Request body
62
+ * @param string $version Protocol version
63
+ * @param array $serverParams Typically the $_SERVER superglobal
64
+ */
65
+ public function __construct(
66
+ $method,
67
+ $uri,
68
+ array $headers = [],
69
+ $body = null,
70
+ $version = '1.1',
71
+ array $serverParams = []
72
+ ) {
73
+ $this->serverParams = $serverParams;
74
+
75
+ parent::__construct($method, $uri, $headers, $body, $version);
76
+ }
77
+
78
+ /**
79
+ * Return an UploadedFile instance array.
80
+ *
81
+ * @param array $files A array which respect $_FILES structure
82
+ * @throws InvalidArgumentException for unrecognized values
83
+ * @return array
84
+ */
85
+ public static function normalizeFiles(array $files)
86
+ {
87
+ $normalized = [];
88
+
89
+ foreach ($files as $key => $value) {
90
+ if ($value instanceof UploadedFileInterface) {
91
+ $normalized[$key] = $value;
92
+ } elseif (is_array($value) && isset($value['tmp_name'])) {
93
+ $normalized[$key] = self::createUploadedFileFromSpec($value);
94
+ } elseif (is_array($value)) {
95
+ $normalized[$key] = self::normalizeFiles($value);
96
+ continue;
97
+ } else {
98
+ throw new InvalidArgumentException('Invalid value in files specification');
99
+ }
100
+ }
101
+
102
+ return $normalized;
103
+ }
104
+
105
+ /**
106
+ * Create and return an UploadedFile instance from a $_FILES specification.
107
+ *
108
+ * If the specification represents an array of values, this method will
109
+ * delegate to normalizeNestedFileSpec() and return that return value.
110
+ *
111
+ * @param array $value $_FILES struct
112
+ * @return array|UploadedFileInterface
113
+ */
114
+ private static function createUploadedFileFromSpec(array $value)
115
+ {
116
+ if (is_array($value['tmp_name'])) {
117
+ return self::normalizeNestedFileSpec($value);
118
+ }
119
+
120
+ return new UploadedFile(
121
+ $value['tmp_name'],
122
+ (int) $value['size'],
123
+ (int) $value['error'],
124
+ $value['name'],
125
+ $value['type']
126
+ );
127
+ }
128
+
129
+ /**
130
+ * Normalize an array of file specifications.
131
+ *
132
+ * Loops through all nested files and returns a normalized array of
133
+ * UploadedFileInterface instances.
134
+ *
135
+ * @param array $files
136
+ * @return UploadedFileInterface[]
137
+ */
138
+ private static function normalizeNestedFileSpec(array $files = [])
139
+ {
140
+ $normalizedFiles = [];
141
+
142
+ foreach (array_keys($files['tmp_name']) as $key) {
143
+ $spec = [
144
+ 'tmp_name' => $files['tmp_name'][$key],
145
+ 'size' => $files['size'][$key],
146
+ 'error' => $files['error'][$key],
147
+ 'name' => $files['name'][$key],
148
+ 'type' => $files['type'][$key],
149
+ ];
150
+ $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec);
151
+ }
152
+
153
+ return $normalizedFiles;
154
+ }
155
+
156
+ /**
157
+ * Return a ServerRequest populated with superglobals:
158
+ * $_GET
159
+ * $_POST
160
+ * $_COOKIE
161
+ * $_FILES
162
+ * $_SERVER
163
+ *
164
+ * @return ServerRequestInterface
165
+ */
166
+ public static function fromGlobals()
167
+ {
168
+ $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
169
+ $headers = function_exists('getallheaders') ? getallheaders() : [];
170
+ $uri = self::getUriFromGlobals();
171
+ $body = new LazyOpenStream('php://input', 'r+');
172
+ $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';
173
+
174
+ $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER);
175
+
176
+ return $serverRequest
177
+ ->withCookieParams($_COOKIE)
178
+ ->withQueryParams($_GET)
179
+ ->withParsedBody($_POST)
180
+ ->withUploadedFiles(self::normalizeFiles($_FILES));
181
+ }
182
+
183
+ /**
184
+ * Get a Uri populated with values from $_SERVER.
185
+ *
186
+ * @return UriInterface
187
+ */
188
+ public static function getUriFromGlobals() {
189
+ $uri = new Uri('');
190
+
191
+ $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
192
+
193
+ $hasPort = false;
194
+ if (isset($_SERVER['HTTP_HOST'])) {
195
+ $hostHeaderParts = explode(':', $_SERVER['HTTP_HOST']);
196
+ $uri = $uri->withHost($hostHeaderParts[0]);
197
+ if (isset($hostHeaderParts[1])) {
198
+ $hasPort = true;
199
+ $uri = $uri->withPort($hostHeaderParts[1]);
200
+ }
201
+ } elseif (isset($_SERVER['SERVER_NAME'])) {
202
+ $uri = $uri->withHost($_SERVER['SERVER_NAME']);
203
+ } elseif (isset($_SERVER['SERVER_ADDR'])) {
204
+ $uri = $uri->withHost($_SERVER['SERVER_ADDR']);
205
+ }
206
+
207
+ if (!$hasPort && isset($_SERVER['SERVER_PORT'])) {
208
+ $uri = $uri->withPort($_SERVER['SERVER_PORT']);
209
+ }
210
+
211
+ $hasQuery = false;
212
+ if (isset($_SERVER['REQUEST_URI'])) {
213
+ $requestUriParts = explode('?', $_SERVER['REQUEST_URI']);
214
+ $uri = $uri->withPath($requestUriParts[0]);
215
+ if (isset($requestUriParts[1])) {
216
+ $hasQuery = true;
217
+ $uri = $uri->withQuery($requestUriParts[1]);
218
+ }
219
+ }
220
+
221
+ if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) {
222
+ $uri = $uri->withQuery($_SERVER['QUERY_STRING']);
223
+ }
224
+
225
+ return $uri;
226
+ }
227
+
228
+
229
+ /**
230
+ * {@inheritdoc}
231
+ */
232
+ public function getServerParams()
233
+ {
234
+ return $this->serverParams;
235
+ }
236
+
237
+ /**
238
+ * {@inheritdoc}
239
+ */
240
+ public function getUploadedFiles()
241
+ {
242
+ return $this->uploadedFiles;
243
+ }
244
+
245
+ /**
246
+ * {@inheritdoc}
247
+ */
248
+ public function withUploadedFiles(array $uploadedFiles)
249
+ {
250
+ $new = clone $this;
251
+ $new->uploadedFiles = $uploadedFiles;
252
+
253
+ return $new;
254
+ }
255
+
256
+ /**
257
+ * {@inheritdoc}
258
+ */
259
+ public function getCookieParams()
260
+ {
261
+ return $this->cookieParams;
262
+ }
263
+
264
+ /**
265
+ * {@inheritdoc}
266
+ */
267
+ public function withCookieParams(array $cookies)
268
+ {
269
+ $new = clone $this;
270
+ $new->cookieParams = $cookies;
271
+
272
+ return $new;
273
+ }
274
+
275
+ /**
276
+ * {@inheritdoc}
277
+ */
278
+ public function getQueryParams()
279
+ {
280
+ return $this->queryParams;
281
+ }
282
+
283
+ /**
284
+ * {@inheritdoc}
285
+ */
286
+ public function withQueryParams(array $query)
287
+ {
288
+ $new = clone $this;
289
+ $new->queryParams = $query;
290
+
291
+ return $new;
292
+ }
293
+
294
+ /**
295
+ * {@inheritdoc}
296
+ */
297
+ public function getParsedBody()
298
+ {
299
+ return $this->parsedBody;
300
+ }
301
+
302
+ /**
303
+ * {@inheritdoc}
304
+ */
305
+ public function withParsedBody($data)
306
+ {
307
+ $new = clone $this;
308
+ $new->parsedBody = $data;
309
+
310
+ return $new;
311
+ }
312
+
313
+ /**
314
+ * {@inheritdoc}
315
+ */
316
+ public function getAttributes()
317
+ {
318
+ return $this->attributes;
319
+ }
320
+
321
+ /**
322
+ * {@inheritdoc}
323
+ */
324
+ public function getAttribute($attribute, $default = null)
325
+ {
326
+ if (false === array_key_exists($attribute, $this->attributes)) {
327
+ return $default;
328
+ }
329
+
330
+ return $this->attributes[$attribute];
331
+ }
332
+
333
+ /**
334
+ * {@inheritdoc}
335
+ */
336
+ public function withAttribute($attribute, $value)
337
+ {
338
+ $new = clone $this;
339
+ $new->attributes[$attribute] = $value;
340
+
341
+ return $new;
342
+ }
343
+
344
+ /**
345
+ * {@inheritdoc}
346
+ */
347
+ public function withoutAttribute($attribute)
348
+ {
349
+ if (false === array_key_exists($attribute, $this->attributes)) {
350
+ return $this;
351
+ }
352
+
353
+ $new = clone $this;
354
+ unset($new->attributes[$attribute]);
355
+
356
+ return $new;
357
+ }
358
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/Stream.php ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * PHP stream implementation.
8
+ *
9
+ * @var $stream
10
+ */
11
+ class Stream implements StreamInterface
12
+ {
13
+ private $stream;
14
+ private $size;
15
+ private $seekable;
16
+ private $readable;
17
+ private $writable;
18
+ private $uri;
19
+ private $customMetadata;
20
+
21
+ /** @var array Hash of readable and writable stream types */
22
+ private static $readWriteHash = [
23
+ 'read' => [
24
+ 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
25
+ 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
26
+ 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true,
27
+ 'x+t' => true, 'c+t' => true, 'a+' => true
28
+ ],
29
+ 'write' => [
30
+ 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true,
31
+ 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true,
32
+ 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true,
33
+ 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true
34
+ ]
35
+ ];
36
+
37
+ /**
38
+ * This constructor accepts an associative array of options.
39
+ *
40
+ * - size: (int) If a read stream would otherwise have an indeterminate
41
+ * size, but the size is known due to foreknowledge, then you can
42
+ * provide that size, in bytes.
43
+ * - metadata: (array) Any additional metadata to return when the metadata
44
+ * of the stream is accessed.
45
+ *
46
+ * @param resource $stream Stream resource to wrap.
47
+ * @param array $options Associative array of options.
48
+ *
49
+ * @throws \InvalidArgumentException if the stream is not a stream resource
50
+ */
51
+ public function __construct($stream, $options = [])
52
+ {
53
+ if (!is_resource($stream)) {
54
+ throw new \InvalidArgumentException('Stream must be a resource');
55
+ }
56
+
57
+ if (isset($options['size'])) {
58
+ $this->size = $options['size'];
59
+ }
60
+
61
+ $this->customMetadata = isset($options['metadata'])
62
+ ? $options['metadata']
63
+ : [];
64
+
65
+ $this->stream = $stream;
66
+ $meta = stream_get_meta_data($this->stream);
67
+ $this->seekable = $meta['seekable'];
68
+ $this->readable = isset(self::$readWriteHash['read'][$meta['mode']]);
69
+ $this->writable = isset(self::$readWriteHash['write'][$meta['mode']]);
70
+ $this->uri = $this->getMetadata('uri');
71
+ }
72
+
73
+ public function __get($name)
74
+ {
75
+ if ($name == 'stream') {
76
+ throw new \RuntimeException('The stream is detached');
77
+ }
78
+
79
+ throw new \BadMethodCallException('No value for ' . $name);
80
+ }
81
+
82
+ /**
83
+ * Closes the stream when the destructed
84
+ */
85
+ public function __destruct()
86
+ {
87
+ $this->close();
88
+ }
89
+
90
+ public function __toString()
91
+ {
92
+ try {
93
+ $this->seek(0);
94
+ return (string) stream_get_contents($this->stream);
95
+ } catch (\Exception $e) {
96
+ return '';
97
+ }
98
+ }
99
+
100
+ public function getContents()
101
+ {
102
+ $contents = stream_get_contents($this->stream);
103
+
104
+ if ($contents === false) {
105
+ throw new \RuntimeException('Unable to read stream contents');
106
+ }
107
+
108
+ return $contents;
109
+ }
110
+
111
+ public function close()
112
+ {
113
+ if (isset($this->stream)) {
114
+ if (is_resource($this->stream)) {
115
+ fclose($this->stream);
116
+ }
117
+ $this->detach();
118
+ }
119
+ }
120
+
121
+ public function detach()
122
+ {
123
+ if (!isset($this->stream)) {
124
+ return null;
125
+ }
126
+
127
+ $result = $this->stream;
128
+ unset($this->stream);
129
+ $this->size = $this->uri = null;
130
+ $this->readable = $this->writable = $this->seekable = false;
131
+
132
+ return $result;
133
+ }
134
+
135
+ public function getSize()
136
+ {
137
+ if ($this->size !== null) {
138
+ return $this->size;
139
+ }
140
+
141
+ if (!isset($this->stream)) {
142
+ return null;
143
+ }
144
+
145
+ // Clear the stat cache if the stream has a URI
146
+ if ($this->uri) {
147
+ clearstatcache(true, $this->uri);
148
+ }
149
+
150
+ $stats = fstat($this->stream);
151
+ if (isset($stats['size'])) {
152
+ $this->size = $stats['size'];
153
+ return $this->size;
154
+ }
155
+
156
+ return null;
157
+ }
158
+
159
+ public function isReadable()
160
+ {
161
+ return $this->readable;
162
+ }
163
+
164
+ public function isWritable()
165
+ {
166
+ return $this->writable;
167
+ }
168
+
169
+ public function isSeekable()
170
+ {
171
+ return $this->seekable;
172
+ }
173
+
174
+ public function eof()
175
+ {
176
+ return !$this->stream || feof($this->stream);
177
+ }
178
+
179
+ public function tell()
180
+ {
181
+ $result = ftell($this->stream);
182
+
183
+ if ($result === false) {
184
+ throw new \RuntimeException('Unable to determine stream position');
185
+ }
186
+
187
+ return $result;
188
+ }
189
+
190
+ public function rewind()
191
+ {
192
+ $this->seek(0);
193
+ }
194
+
195
+ public function seek($offset, $whence = SEEK_SET)
196
+ {
197
+ if (!$this->seekable) {
198
+ throw new \RuntimeException('Stream is not seekable');
199
+ } elseif (fseek($this->stream, $offset, $whence) === -1) {
200
+ throw new \RuntimeException('Unable to seek to stream position '
201
+ . $offset . ' with whence ' . var_export($whence, true));
202
+ }
203
+ }
204
+
205
+ public function read($length)
206
+ {
207
+ if (!$this->readable) {
208
+ throw new \RuntimeException('Cannot read from non-readable stream');
209
+ }
210
+ if ($length < 0) {
211
+ throw new \RuntimeException('Length parameter cannot be negative');
212
+ }
213
+
214
+ if (0 === $length) {
215
+ return '';
216
+ }
217
+
218
+ $string = fread($this->stream, $length);
219
+ if (false === $string) {
220
+ throw new \RuntimeException('Unable to read from stream');
221
+ }
222
+
223
+ return $string;
224
+ }
225
+
226
+ public function write($string)
227
+ {
228
+ if (!$this->writable) {
229
+ throw new \RuntimeException('Cannot write to a non-writable stream');
230
+ }
231
+
232
+ // We can't know the size after writing anything
233
+ $this->size = null;
234
+ $result = fwrite($this->stream, $string);
235
+
236
+ if ($result === false) {
237
+ throw new \RuntimeException('Unable to write to stream');
238
+ }
239
+
240
+ return $result;
241
+ }
242
+
243
+ public function getMetadata($key = null)
244
+ {
245
+ if (!isset($this->stream)) {
246
+ return $key ? null : [];
247
+ } elseif (!$key) {
248
+ return $this->customMetadata + stream_get_meta_data($this->stream);
249
+ } elseif (isset($this->customMetadata[$key])) {
250
+ return $this->customMetadata[$key];
251
+ }
252
+
253
+ $meta = stream_get_meta_data($this->stream);
254
+
255
+ return isset($meta[$key]) ? $meta[$key] : null;
256
+ }
257
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Stream decorator trait
8
+ * @property StreamInterface stream
9
+ */
10
+ trait StreamDecoratorTrait
11
+ {
12
+ /**
13
+ * @param StreamInterface $stream Stream to decorate
14
+ */
15
+ public function __construct(StreamInterface $stream)
16
+ {
17
+ $this->stream = $stream;
18
+ }
19
+
20
+ /**
21
+ * Magic method used to create a new stream if streams are not added in
22
+ * the constructor of a decorator (e.g., LazyOpenStream).
23
+ *
24
+ * @param string $name Name of the property (allows "stream" only).
25
+ *
26
+ * @return StreamInterface
27
+ */
28
+ public function __get($name)
29
+ {
30
+ if ($name == 'stream') {
31
+ $this->stream = $this->createStream();
32
+ return $this->stream;
33
+ }
34
+
35
+ throw new \UnexpectedValueException("$name not found on class");
36
+ }
37
+
38
+ public function __toString()
39
+ {
40
+ try {
41
+ if ($this->isSeekable()) {
42
+ $this->seek(0);
43
+ }
44
+ return $this->getContents();
45
+ } catch (\Exception $e) {
46
+ // Really, PHP? https://bugs.php.net/bug.php?id=53648
47
+ trigger_error('StreamDecorator::__toString exception: '
48
+ . (string) $e, E_USER_ERROR);
49
+ return '';
50
+ }
51
+ }
52
+
53
+ public function getContents()
54
+ {
55
+ return copy_to_string($this);
56
+ }
57
+
58
+ /**
59
+ * Allow decorators to implement custom methods
60
+ *
61
+ * @param string $method Missing method name
62
+ * @param array $args Method arguments
63
+ *
64
+ * @return mixed
65
+ */
66
+ public function __call($method, array $args)
67
+ {
68
+ $result = call_user_func_array([$this->stream, $method], $args);
69
+
70
+ // Always return the wrapped object if the result is a return $this
71
+ return $result === $this->stream ? $this : $result;
72
+ }
73
+
74
+ public function close()
75
+ {
76
+ $this->stream->close();
77
+ }
78
+
79
+ public function getMetadata($key = null)
80
+ {
81
+ return $this->stream->getMetadata($key);
82
+ }
83
+
84
+ public function detach()
85
+ {
86
+ return $this->stream->detach();
87
+ }
88
+
89
+ public function getSize()
90
+ {
91
+ return $this->stream->getSize();
92
+ }
93
+
94
+ public function eof()
95
+ {
96
+ return $this->stream->eof();
97
+ }
98
+
99
+ public function tell()
100
+ {
101
+ return $this->stream->tell();
102
+ }
103
+
104
+ public function isReadable()
105
+ {
106
+ return $this->stream->isReadable();
107
+ }
108
+
109
+ public function isWritable()
110
+ {
111
+ return $this->stream->isWritable();
112
+ }
113
+
114
+ public function isSeekable()
115
+ {
116
+ return $this->stream->isSeekable();
117
+ }
118
+
119
+ public function rewind()
120
+ {
121
+ $this->seek(0);
122
+ }
123
+
124
+ public function seek($offset, $whence = SEEK_SET)
125
+ {
126
+ $this->stream->seek($offset, $whence);
127
+ }
128
+
129
+ public function read($length)
130
+ {
131
+ return $this->stream->read($length);
132
+ }
133
+
134
+ public function write($string)
135
+ {
136
+ return $this->stream->write($string);
137
+ }
138
+
139
+ /**
140
+ * Implement in subclasses to dynamically create streams when requested.
141
+ *
142
+ * @return StreamInterface
143
+ * @throws \BadMethodCallException
144
+ */
145
+ protected function createStream()
146
+ {
147
+ throw new \BadMethodCallException('Not implemented');
148
+ }
149
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/StreamWrapper.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Converts Guzzle streams into PHP stream resources.
8
+ */
9
+ class StreamWrapper
10
+ {
11
+ /** @var resource */
12
+ public $context;
13
+
14
+ /** @var StreamInterface */
15
+ private $stream;
16
+
17
+ /** @var string r, r+, or w */
18
+ private $mode;
19
+
20
+ /**
21
+ * Returns a resource representing the stream.
22
+ *
23
+ * @param StreamInterface $stream The stream to get a resource for
24
+ *
25
+ * @return resource
26
+ * @throws \InvalidArgumentException if stream is not readable or writable
27
+ */
28
+ public static function getResource(StreamInterface $stream)
29
+ {
30
+ self::register();
31
+
32
+ if ($stream->isReadable()) {
33
+ $mode = $stream->isWritable() ? 'r+' : 'r';
34
+ } elseif ($stream->isWritable()) {
35
+ $mode = 'w';
36
+ } else {
37
+ throw new \InvalidArgumentException('The stream must be readable, '
38
+ . 'writable, or both.');
39
+ }
40
+
41
+ return fopen('guzzle://stream', $mode, null, stream_context_create([
42
+ 'guzzle' => ['stream' => $stream]
43
+ ]));
44
+ }
45
+
46
+ /**
47
+ * Registers the stream wrapper if needed
48
+ */
49
+ public static function register()
50
+ {
51
+ if (!in_array('guzzle', stream_get_wrappers())) {
52
+ stream_wrapper_register('guzzle', __CLASS__);
53
+ }
54
+ }
55
+
56
+ public function stream_open($path, $mode, $options, &$opened_path)
57
+ {
58
+ $options = stream_context_get_options($this->context);
59
+
60
+ if (!isset($options['guzzle']['stream'])) {
61
+ return false;
62
+ }
63
+
64
+ $this->mode = $mode;
65
+ $this->stream = $options['guzzle']['stream'];
66
+
67
+ return true;
68
+ }
69
+
70
+ public function stream_read($count)
71
+ {
72
+ return $this->stream->read($count);
73
+ }
74
+
75
+ public function stream_write($data)
76
+ {
77
+ return (int) $this->stream->write($data);
78
+ }
79
+
80
+ public function stream_tell()
81
+ {
82
+ return $this->stream->tell();
83
+ }
84
+
85
+ public function stream_eof()
86
+ {
87
+ return $this->stream->eof();
88
+ }
89
+
90
+ public function stream_seek($offset, $whence)
91
+ {
92
+ $this->stream->seek($offset, $whence);
93
+
94
+ return true;
95
+ }
96
+
97
+ public function stream_stat()
98
+ {
99
+ static $modeMap = [
100
+ 'r' => 33060,
101
+ 'r+' => 33206,
102
+ 'w' => 33188
103
+ ];
104
+
105
+ return [
106
+ 'dev' => 0,
107
+ 'ino' => 0,
108
+ 'mode' => $modeMap[$this->mode],
109
+ 'nlink' => 0,
110
+ 'uid' => 0,
111
+ 'gid' => 0,
112
+ 'rdev' => 0,
113
+ 'size' => $this->stream->getSize() ?: 0,
114
+ 'atime' => 0,
115
+ 'mtime' => 0,
116
+ 'ctime' => 0,
117
+ 'blksize' => 0,
118
+ 'blocks' => 0
119
+ ];
120
+ }
121
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/UploadedFile.php ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use InvalidArgumentException;
5
+ use Psr\Http\Message\StreamInterface;
6
+ use Psr\Http\Message\UploadedFileInterface;
7
+ use RuntimeException;
8
+
9
+ class UploadedFile implements UploadedFileInterface
10
+ {
11
+ /**
12
+ * @var int[]
13
+ */
14
+ private static $errors = [
15
+ UPLOAD_ERR_OK,
16
+ UPLOAD_ERR_INI_SIZE,
17
+ UPLOAD_ERR_FORM_SIZE,
18
+ UPLOAD_ERR_PARTIAL,
19
+ UPLOAD_ERR_NO_FILE,
20
+ UPLOAD_ERR_NO_TMP_DIR,
21
+ UPLOAD_ERR_CANT_WRITE,
22
+ UPLOAD_ERR_EXTENSION,
23
+ ];
24
+
25
+ /**
26
+ * @var string
27
+ */
28
+ private $clientFilename;
29
+
30
+ /**
31
+ * @var string
32
+ */
33
+ private $clientMediaType;
34
+
35
+ /**
36
+ * @var int
37
+ */
38
+ private $error;
39
+
40
+ /**
41
+ * @var null|string
42
+ */
43
+ private $file;
44
+
45
+ /**
46
+ * @var bool
47
+ */
48
+ private $moved = false;
49
+
50
+ /**
51
+ * @var int
52
+ */
53
+ private $size;
54
+
55
+ /**
56
+ * @var StreamInterface|null
57
+ */
58
+ private $stream;
59
+
60
+ /**
61
+ * @param StreamInterface|string|resource $streamOrFile
62
+ * @param int $size
63
+ * @param int $errorStatus
64
+ * @param string|null $clientFilename
65
+ * @param string|null $clientMediaType
66
+ */
67
+ public function __construct(
68
+ $streamOrFile,
69
+ $size,
70
+ $errorStatus,
71
+ $clientFilename = null,
72
+ $clientMediaType = null
73
+ ) {
74
+ $this->setError($errorStatus);
75
+ $this->setSize($size);
76
+ $this->setClientFilename($clientFilename);
77
+ $this->setClientMediaType($clientMediaType);
78
+
79
+ if ($this->isOk()) {
80
+ $this->setStreamOrFile($streamOrFile);
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Depending on the value set file or stream variable
86
+ *
87
+ * @param mixed $streamOrFile
88
+ * @throws InvalidArgumentException
89
+ */
90
+ private function setStreamOrFile($streamOrFile)
91
+ {
92
+ if (is_string($streamOrFile)) {
93
+ $this->file = $streamOrFile;
94
+ } elseif (is_resource($streamOrFile)) {
95
+ $this->stream = new Stream($streamOrFile);
96
+ } elseif ($streamOrFile instanceof StreamInterface) {
97
+ $this->stream = $streamOrFile;
98
+ } else {
99
+ throw new InvalidArgumentException(
100
+ 'Invalid stream or file provided for UploadedFile'
101
+ );
102
+ }
103
+ }
104
+
105
+ /**
106
+ * @param int $error
107
+ * @throws InvalidArgumentException
108
+ */
109
+ private function setError($error)
110
+ {
111
+ if (false === is_int($error)) {
112
+ throw new InvalidArgumentException(
113
+ 'Upload file error status must be an integer'
114
+ );
115
+ }
116
+
117
+ if (false === in_array($error, UploadedFile::$errors)) {
118
+ throw new InvalidArgumentException(
119
+ 'Invalid error status for UploadedFile'
120
+ );
121
+ }
122
+
123
+ $this->error = $error;
124
+ }
125
+
126
+ /**
127
+ * @param int $size
128
+ * @throws InvalidArgumentException
129
+ */
130
+ private function setSize($size)
131
+ {
132
+ if (false === is_int($size)) {
133
+ throw new InvalidArgumentException(
134
+ 'Upload file size must be an integer'
135
+ );
136
+ }
137
+
138
+ $this->size = $size;
139
+ }
140
+
141
+ /**
142
+ * @param mixed $param
143
+ * @return boolean
144
+ */
145
+ private function isStringOrNull($param)
146
+ {
147
+ return in_array(gettype($param), ['string', 'NULL']);
148
+ }
149
+
150
+ /**
151
+ * @param mixed $param
152
+ * @return boolean
153
+ */
154
+ private function isStringNotEmpty($param)
155
+ {
156
+ return is_string($param) && false === empty($param);
157
+ }
158
+
159
+ /**
160
+ * @param string|null $clientFilename
161
+ * @throws InvalidArgumentException
162
+ */
163
+ private function setClientFilename($clientFilename)
164
+ {
165
+ if (false === $this->isStringOrNull($clientFilename)) {
166
+ throw new InvalidArgumentException(
167
+ 'Upload file client filename must be a string or null'
168
+ );
169
+ }
170
+
171
+ $this->clientFilename = $clientFilename;
172
+ }
173
+
174
+ /**
175
+ * @param string|null $clientMediaType
176
+ * @throws InvalidArgumentException
177
+ */
178
+ private function setClientMediaType($clientMediaType)
179
+ {
180
+ if (false === $this->isStringOrNull($clientMediaType)) {
181
+ throw new InvalidArgumentException(
182
+ 'Upload file client media type must be a string or null'
183
+ );
184
+ }
185
+
186
+ $this->clientMediaType = $clientMediaType;
187
+ }
188
+
189
+ /**
190
+ * Return true if there is no upload error
191
+ *
192
+ * @return boolean
193
+ */
194
+ private function isOk()
195
+ {
196
+ return $this->error === UPLOAD_ERR_OK;
197
+ }
198
+
199
+ /**
200
+ * @return boolean
201
+ */
202
+ public function isMoved()
203
+ {
204
+ return $this->moved;
205
+ }
206
+
207
+ /**
208
+ * @throws RuntimeException if is moved or not ok
209
+ */
210
+ private function validateActive()
211
+ {
212
+ if (false === $this->isOk()) {
213
+ throw new RuntimeException('Cannot retrieve stream due to upload error');
214
+ }
215
+
216
+ if ($this->isMoved()) {
217
+ throw new RuntimeException('Cannot retrieve stream after it has already been moved');
218
+ }
219
+ }
220
+
221
+ /**
222
+ * {@inheritdoc}
223
+ * @throws RuntimeException if the upload was not successful.
224
+ */
225
+ public function getStream()
226
+ {
227
+ $this->validateActive();
228
+
229
+ if ($this->stream instanceof StreamInterface) {
230
+ return $this->stream;
231
+ }
232
+
233
+ return new LazyOpenStream($this->file, 'r+');
234
+ }
235
+
236
+ /**
237
+ * {@inheritdoc}
238
+ *
239
+ * @see http://php.net/is_uploaded_file
240
+ * @see http://php.net/move_uploaded_file
241
+ * @param string $targetPath Path to which to move the uploaded file.
242
+ * @throws RuntimeException if the upload was not successful.
243
+ * @throws InvalidArgumentException if the $path specified is invalid.
244
+ * @throws RuntimeException on any error during the move operation, or on
245
+ * the second or subsequent call to the method.
246
+ */
247
+ public function moveTo($targetPath)
248
+ {
249
+ $this->validateActive();
250
+
251
+ if (false === $this->isStringNotEmpty($targetPath)) {
252
+ throw new InvalidArgumentException(
253
+ 'Invalid path provided for move operation; must be a non-empty string'
254
+ );
255
+ }
256
+
257
+ if ($this->file) {
258
+ $this->moved = php_sapi_name() == 'cli'
259
+ ? rename($this->file, $targetPath)
260
+ : move_uploaded_file($this->file, $targetPath);
261
+ } else {
262
+ copy_to_stream(
263
+ $this->getStream(),
264
+ new LazyOpenStream($targetPath, 'w')
265
+ );
266
+
267
+ $this->moved = true;
268
+ }
269
+
270
+ if (false === $this->moved) {
271
+ throw new RuntimeException(
272
+ sprintf('Uploaded file could not be moved to %s', $targetPath)
273
+ );
274
+ }
275
+ }
276
+
277
+ /**
278
+ * {@inheritdoc}
279
+ *
280
+ * @return int|null The file size in bytes or null if unknown.
281
+ */
282
+ public function getSize()
283
+ {
284
+ return $this->size;
285
+ }
286
+
287
+ /**
288
+ * {@inheritdoc}
289
+ *
290
+ * @see http://php.net/manual/en/features.file-upload.errors.php
291
+ * @return int One of PHP's UPLOAD_ERR_XXX constants.
292
+ */
293
+ public function getError()
294
+ {
295
+ return $this->error;
296
+ }
297
+
298
+ /**
299
+ * {@inheritdoc}
300
+ *
301
+ * @return string|null The filename sent by the client or null if none
302
+ * was provided.
303
+ */
304
+ public function getClientFilename()
305
+ {
306
+ return $this->clientFilename;
307
+ }
308
+
309
+ /**
310
+ * {@inheritdoc}
311
+ */
312
+ public function getClientMediaType()
313
+ {
314
+ return $this->clientMediaType;
315
+ }
316
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/Uri.php ADDED
@@ -0,0 +1,702 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\UriInterface;
5
+
6
+ /**
7
+ * PSR-7 URI implementation.
8
+ *
9
+ * @author Michael Dowling
10
+ * @author Tobias Schultze
11
+ * @author Matthew Weier O'Phinney
12
+ */
13
+ class Uri implements UriInterface
14
+ {
15
+ /**
16
+ * Absolute http and https URIs require a host per RFC 7230 Section 2.7
17
+ * but in generic URIs the host can be empty. So for http(s) URIs
18
+ * we apply this default host when no host is given yet to form a
19
+ * valid URI.
20
+ */
21
+ const HTTP_DEFAULT_HOST = 'localhost';
22
+
23
+ private static $defaultPorts = [
24
+ 'http' => 80,
25
+ 'https' => 443,
26
+ 'ftp' => 21,
27
+ 'gopher' => 70,
28
+ 'nntp' => 119,
29
+ 'news' => 119,
30
+ 'telnet' => 23,
31
+ 'tn3270' => 23,
32
+ 'imap' => 143,
33
+ 'pop' => 110,
34
+ 'ldap' => 389,
35
+ ];
36
+
37
+ private static $charUnreserved = 'a-zA-Z0-9_\-\.~';
38
+ private static $charSubDelims = '!\$&\'\(\)\*\+,;=';
39
+ private static $replaceQuery = ['=' => '%3D', '&' => '%26'];
40
+
41
+ /** @var string Uri scheme. */
42
+ private $scheme = '';
43
+
44
+ /** @var string Uri user info. */
45
+ private $userInfo = '';
46
+
47
+ /** @var string Uri host. */
48
+ private $host = '';
49
+
50
+ /** @var int|null Uri port. */
51
+ private $port;
52
+
53
+ /** @var string Uri path. */
54
+ private $path = '';
55
+
56
+ /** @var string Uri query string. */
57
+ private $query = '';
58
+
59
+ /** @var string Uri fragment. */
60
+ private $fragment = '';
61
+
62
+ /**
63
+ * @param string $uri URI to parse
64
+ */
65
+ public function __construct($uri = '')
66
+ {
67
+ // weak type check to also accept null until we can add scalar type hints
68
+ if ($uri != '') {
69
+ $parts = parse_url($uri);
70
+ if ($parts === false) {
71
+ throw new \InvalidArgumentException("Unable to parse URI: $uri");
72
+ }
73
+ $this->applyParts($parts);
74
+ }
75
+ }
76
+
77
+ public function __toString()
78
+ {
79
+ return self::composeComponents(
80
+ $this->scheme,
81
+ $this->getAuthority(),
82
+ $this->path,
83
+ $this->query,
84
+ $this->fragment
85
+ );
86
+ }
87
+
88
+ /**
89
+ * Composes a URI reference string from its various components.
90
+ *
91
+ * Usually this method does not need to be called manually but instead is used indirectly via
92
+ * `Psr\Http\Message\UriInterface::__toString`.
93
+ *
94
+ * PSR-7 UriInterface treats an empty component the same as a missing component as
95
+ * getQuery(), getFragment() etc. always return a string. This explains the slight
96
+ * difference to RFC 3986 Section 5.3.
97
+ *
98
+ * Another adjustment is that the authority separator is added even when the authority is missing/empty
99
+ * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with
100
+ * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But
101
+ * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to
102
+ * that format).
103
+ *
104
+ * @param string $scheme
105
+ * @param string $authority
106
+ * @param string $path
107
+ * @param string $query
108
+ * @param string $fragment
109
+ *
110
+ * @return string
111
+ *
112
+ * @link https://tools.ietf.org/html/rfc3986#section-5.3
113
+ */
114
+ public static function composeComponents($scheme, $authority, $path, $query, $fragment)
115
+ {
116
+ $uri = '';
117
+
118
+ // weak type checks to also accept null until we can add scalar type hints
119
+ if ($scheme != '') {
120
+ $uri .= $scheme . ':';
121
+ }
122
+
123
+ if ($authority != ''|| $scheme === 'file') {
124
+ $uri .= '//' . $authority;
125
+ }
126
+
127
+ $uri .= $path;
128
+
129
+ if ($query != '') {
130
+ $uri .= '?' . $query;
131
+ }
132
+
133
+ if ($fragment != '') {
134
+ $uri .= '#' . $fragment;
135
+ }
136
+
137
+ return $uri;
138
+ }
139
+
140
+ /**
141
+ * Whether the URI has the default port of the current scheme.
142
+ *
143
+ * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used
144
+ * independently of the implementation.
145
+ *
146
+ * @param UriInterface $uri
147
+ *
148
+ * @return bool
149
+ */
150
+ public static function isDefaultPort(UriInterface $uri)
151
+ {
152
+ return $uri->getPort() === null
153
+ || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]);
154
+ }
155
+
156
+ /**
157
+ * Whether the URI is absolute, i.e. it has a scheme.
158
+ *
159
+ * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true
160
+ * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative
161
+ * to another URI, the base URI. Relative references can be divided into several forms:
162
+ * - network-path references, e.g. '//example.com/path'
163
+ * - absolute-path references, e.g. '/path'
164
+ * - relative-path references, e.g. 'subpath'
165
+ *
166
+ * @param UriInterface $uri
167
+ *
168
+ * @return bool
169
+ * @see Uri::isNetworkPathReference
170
+ * @see Uri::isAbsolutePathReference
171
+ * @see Uri::isRelativePathReference
172
+ * @link https://tools.ietf.org/html/rfc3986#section-4
173
+ */
174
+ public static function isAbsolute(UriInterface $uri)
175
+ {
176
+ return $uri->getScheme() !== '';
177
+ }
178
+
179
+ /**
180
+ * Whether the URI is a network-path reference.
181
+ *
182
+ * A relative reference that begins with two slash characters is termed an network-path reference.
183
+ *
184
+ * @param UriInterface $uri
185
+ *
186
+ * @return bool
187
+ * @link https://tools.ietf.org/html/rfc3986#section-4.2
188
+ */
189
+ public static function isNetworkPathReference(UriInterface $uri)
190
+ {
191
+ return $uri->getScheme() === '' && $uri->getAuthority() !== '';
192
+ }
193
+
194
+ /**
195
+ * Whether the URI is a absolute-path reference.
196
+ *
197
+ * A relative reference that begins with a single slash character is termed an absolute-path reference.
198
+ *
199
+ * @param UriInterface $uri
200
+ *
201
+ * @return bool
202
+ * @link https://tools.ietf.org/html/rfc3986#section-4.2
203
+ */
204
+ public static function isAbsolutePathReference(UriInterface $uri)
205
+ {
206
+ return $uri->getScheme() === ''
207
+ && $uri->getAuthority() === ''
208
+ && isset($uri->getPath()[0])
209
+ && $uri->getPath()[0] === '/';
210
+ }
211
+
212
+ /**
213
+ * Whether the URI is a relative-path reference.
214
+ *
215
+ * A relative reference that does not begin with a slash character is termed a relative-path reference.
216
+ *
217
+ * @param UriInterface $uri
218
+ *
219
+ * @return bool
220
+ * @link https://tools.ietf.org/html/rfc3986#section-4.2
221
+ */
222
+ public static function isRelativePathReference(UriInterface $uri)
223
+ {
224
+ return $uri->getScheme() === ''
225
+ && $uri->getAuthority() === ''
226
+ && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/');
227
+ }
228
+
229
+ /**
230
+ * Whether the URI is a same-document reference.
231
+ *
232
+ * A same-document reference refers to a URI that is, aside from its fragment
233
+ * component, identical to the base URI. When no base URI is given, only an empty
234
+ * URI reference (apart from its fragment) is considered a same-document reference.
235
+ *
236
+ * @param UriInterface $uri The URI to check
237
+ * @param UriInterface|null $base An optional base URI to compare against
238
+ *
239
+ * @return bool
240
+ * @link https://tools.ietf.org/html/rfc3986#section-4.4
241
+ */
242
+ public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null)
243
+ {
244
+ if ($base !== null) {
245
+ $uri = UriResolver::resolve($base, $uri);
246
+
247
+ return ($uri->getScheme() === $base->getScheme())
248
+ && ($uri->getAuthority() === $base->getAuthority())
249
+ && ($uri->getPath() === $base->getPath())
250
+ && ($uri->getQuery() === $base->getQuery());
251
+ }
252
+
253
+ return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === '';
254
+ }
255
+
256
+ /**
257
+ * Removes dot segments from a path and returns the new path.
258
+ *
259
+ * @param string $path
260
+ *
261
+ * @return string
262
+ *
263
+ * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead.
264
+ * @see UriResolver::removeDotSegments
265
+ */
266
+ public static function removeDotSegments($path)
267
+ {
268
+ return UriResolver::removeDotSegments($path);
269
+ }
270
+
271
+ /**
272
+ * Converts the relative URI into a new URI that is resolved against the base URI.
273
+ *
274
+ * @param UriInterface $base Base URI
275
+ * @param string|UriInterface $rel Relative URI
276
+ *
277
+ * @return UriInterface
278
+ *
279
+ * @deprecated since version 1.4. Use UriResolver::resolve instead.
280
+ * @see UriResolver::resolve
281
+ */
282
+ public static function resolve(UriInterface $base, $rel)
283
+ {
284
+ if (!($rel instanceof UriInterface)) {
285
+ $rel = new self($rel);
286
+ }
287
+
288
+ return UriResolver::resolve($base, $rel);
289
+ }
290
+
291
+ /**
292
+ * Creates a new URI with a specific query string value removed.
293
+ *
294
+ * Any existing query string values that exactly match the provided key are
295
+ * removed.
296
+ *
297
+ * @param UriInterface $uri URI to use as a base.
298
+ * @param string $key Query string key to remove.
299
+ *
300
+ * @return UriInterface
301
+ */
302
+ public static function withoutQueryValue(UriInterface $uri, $key)
303
+ {
304
+ $current = $uri->getQuery();
305
+ if ($current === '') {
306
+ return $uri;
307
+ }
308
+
309
+ $decodedKey = rawurldecode($key);
310
+ $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
311
+ return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
312
+ });
313
+
314
+ return $uri->withQuery(implode('&', $result));
315
+ }
316
+
317
+ /**
318
+ * Creates a new URI with a specific query string value.
319
+ *
320
+ * Any existing query string values that exactly match the provided key are
321
+ * removed and replaced with the given key value pair.
322
+ *
323
+ * A value of null will set the query string key without a value, e.g. "key"
324
+ * instead of "key=value".
325
+ *
326
+ * @param UriInterface $uri URI to use as a base.
327
+ * @param string $key Key to set.
328
+ * @param string|null $value Value to set
329
+ *
330
+ * @return UriInterface
331
+ */
332
+ public static function withQueryValue(UriInterface $uri, $key, $value)
333
+ {
334
+ $current = $uri->getQuery();
335
+
336
+ if ($current === '') {
337
+ $result = [];
338
+ } else {
339
+ $decodedKey = rawurldecode($key);
340
+ $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
341
+ return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
342
+ });
343
+ }
344
+
345
+ // Query string separators ("=", "&") within the key or value need to be encoded
346
+ // (while preventing double-encoding) before setting the query string. All other
347
+ // chars that need percent-encoding will be encoded by withQuery().
348
+ $key = strtr($key, self::$replaceQuery);
349
+
350
+ if ($value !== null) {
351
+ $result[] = $key . '=' . strtr($value, self::$replaceQuery);
352
+ } else {
353
+ $result[] = $key;
354
+ }
355
+
356
+ return $uri->withQuery(implode('&', $result));
357
+ }
358
+
359
+ /**
360
+ * Creates a URI from a hash of `parse_url` components.
361
+ *
362
+ * @param array $parts
363
+ *
364
+ * @return UriInterface
365
+ * @link http://php.net/manual/en/function.parse-url.php
366
+ *
367
+ * @throws \InvalidArgumentException If the components do not form a valid URI.
368
+ */
369
+ public static function fromParts(array $parts)
370
+ {
371
+ $uri = new self();
372
+ $uri->applyParts($parts);
373
+ $uri->validateState();
374
+
375
+ return $uri;
376
+ }
377
+
378
+ public function getScheme()
379
+ {
380
+ return $this->scheme;
381
+ }
382
+
383
+ public function getAuthority()
384
+ {
385
+ $authority = $this->host;
386
+ if ($this->userInfo !== '') {
387
+ $authority = $this->userInfo . '@' . $authority;
388
+ }
389
+
390
+ if ($this->port !== null) {
391
+ $authority .= ':' . $this->port;
392
+ }
393
+
394
+ return $authority;
395
+ }
396
+
397
+ public function getUserInfo()
398
+ {
399
+ return $this->userInfo;
400
+ }
401
+
402
+ public function getHost()
403
+ {
404
+ return $this->host;
405
+ }
406
+
407
+ public function getPort()
408
+ {
409
+ return $this->port;
410
+ }
411
+
412
+ public function getPath()
413
+ {
414
+ return $this->path;
415
+ }
416
+
417
+ public function getQuery()
418
+ {
419
+ return $this->query;
420
+ }
421
+
422
+ public function getFragment()
423
+ {
424
+ return $this->fragment;
425
+ }
426
+
427
+ public function withScheme($scheme)
428
+ {
429
+ $scheme = $this->filterScheme($scheme);
430
+
431
+ if ($this->scheme === $scheme) {
432
+ return $this;
433
+ }
434
+
435
+ $new = clone $this;
436
+ $new->scheme = $scheme;
437
+ $new->removeDefaultPort();
438
+ $new->validateState();
439
+
440
+ return $new;
441
+ }
442
+
443
+ public function withUserInfo($user, $password = null)
444
+ {
445
+ $info = $user;
446
+ if ($password != '') {
447
+ $info .= ':' . $password;
448
+ }
449
+
450
+ if ($this->userInfo === $info) {
451
+ return $this;
452
+ }
453
+
454
+ $new = clone $this;
455
+ $new->userInfo = $info;
456
+ $new->validateState();
457
+
458
+ return $new;
459
+ }
460
+
461
+ public function withHost($host)
462
+ {
463
+ $host = $this->filterHost($host);
464
+
465
+ if ($this->host === $host) {
466
+ return $this;
467
+ }
468
+
469
+ $new = clone $this;
470
+ $new->host = $host;
471
+ $new->validateState();
472
+
473
+ return $new;
474
+ }
475
+
476
+ public function withPort($port)
477
+ {
478
+ $port = $this->filterPort($port);
479
+
480
+ if ($this->port === $port) {
481
+ return $this;
482
+ }
483
+
484
+ $new = clone $this;
485
+ $new->port = $port;
486
+ $new->removeDefaultPort();
487
+ $new->validateState();
488
+
489
+ return $new;
490
+ }
491
+
492
+ public function withPath($path)
493
+ {
494
+ $path = $this->filterPath($path);
495
+
496
+ if ($this->path === $path) {
497
+ return $this;
498
+ }
499
+
500
+ $new = clone $this;
501
+ $new->path = $path;
502
+ $new->validateState();
503
+
504
+ return $new;
505
+ }
506
+
507
+ public function withQuery($query)
508
+ {
509
+ $query = $this->filterQueryAndFragment($query);
510
+
511
+ if ($this->query === $query) {
512
+ return $this;
513
+ }
514
+
515
+ $new = clone $this;
516
+ $new->query = $query;
517
+
518
+ return $new;
519
+ }
520
+
521
+ public function withFragment($fragment)
522
+ {
523
+ $fragment = $this->filterQueryAndFragment($fragment);
524
+
525
+ if ($this->fragment === $fragment) {
526
+ return $this;
527
+ }
528
+
529
+ $new = clone $this;
530
+ $new->fragment = $fragment;
531
+
532
+ return $new;
533
+ }
534
+
535
+ /**
536
+ * Apply parse_url parts to a URI.
537
+ *
538
+ * @param array $parts Array of parse_url parts to apply.
539
+ */
540
+ private function applyParts(array $parts)
541
+ {
542
+ $this->scheme = isset($parts['scheme'])
543
+ ? $this->filterScheme($parts['scheme'])
544
+ : '';
545
+ $this->userInfo = isset($parts['user']) ? $parts['user'] : '';
546
+ $this->host = isset($parts['host'])
547
+ ? $this->filterHost($parts['host'])
548
+ : '';
549
+ $this->port = isset($parts['port'])
550
+ ? $this->filterPort($parts['port'])
551
+ : null;
552
+ $this->path = isset($parts['path'])
553
+ ? $this->filterPath($parts['path'])
554
+ : '';
555
+ $this->query = isset($parts['query'])
556
+ ? $this->filterQueryAndFragment($parts['query'])
557
+ : '';
558
+ $this->fragment = isset($parts['fragment'])
559
+ ? $this->filterQueryAndFragment($parts['fragment'])
560
+ : '';
561
+ if (isset($parts['pass'])) {
562
+ $this->userInfo .= ':' . $parts['pass'];
563
+ }
564
+
565
+ $this->removeDefaultPort();
566
+ }
567
+
568
+ /**
569
+ * @param string $scheme
570
+ *
571
+ * @return string
572
+ *
573
+ * @throws \InvalidArgumentException If the scheme is invalid.
574
+ */
575
+ private function filterScheme($scheme)
576
+ {
577
+ if (!is_string($scheme)) {
578
+ throw new \InvalidArgumentException('Scheme must be a string');
579
+ }
580
+
581
+ return strtolower($scheme);
582
+ }
583
+
584
+ /**
585
+ * @param string $host
586
+ *
587
+ * @return string
588
+ *
589
+ * @throws \InvalidArgumentException If the host is invalid.
590
+ */
591
+ private function filterHost($host)
592
+ {
593
+ if (!is_string($host)) {
594
+ throw new \InvalidArgumentException('Host must be a string');
595
+ }
596
+
597
+ return strtolower($host);
598
+ }
599
+
600
+ /**
601
+ * @param int|null $port
602
+ *
603
+ * @return int|null
604
+ *
605
+ * @throws \InvalidArgumentException If the port is invalid.
606
+ */
607
+ private function filterPort($port)
608
+ {
609
+ if ($port === null) {
610
+ return null;
611
+ }
612
+
613
+ $port = (int) $port;
614
+ if (1 > $port || 0xffff < $port) {
615
+ throw new \InvalidArgumentException(
616
+ sprintf('Invalid port: %d. Must be between 1 and 65535', $port)
617
+ );
618
+ }
619
+
620
+ return $port;
621
+ }
622
+
623
+ private function removeDefaultPort()
624
+ {
625
+ if ($this->port !== null && self::isDefaultPort($this)) {
626
+ $this->port = null;
627
+ }
628
+ }
629
+
630
+ /**
631
+ * Filters the path of a URI
632
+ *
633
+ * @param string $path
634
+ *
635
+ * @return string
636
+ *
637
+ * @throws \InvalidArgumentException If the path is invalid.
638
+ */
639
+ private function filterPath($path)
640
+ {
641
+ if (!is_string($path)) {
642
+ throw new \InvalidArgumentException('Path must be a string');
643
+ }
644
+
645
+ return preg_replace_callback(
646
+ '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
647
+ [$this, 'rawurlencodeMatchZero'],
648
+ $path
649
+ );
650
+ }
651
+
652
+ /**
653
+ * Filters the query string or fragment of a URI.
654
+ *
655
+ * @param string $str
656
+ *
657
+ * @return string
658
+ *
659
+ * @throws \InvalidArgumentException If the query or fragment is invalid.
660
+ */
661
+ private function filterQueryAndFragment($str)
662
+ {
663
+ if (!is_string($str)) {
664
+ throw new \InvalidArgumentException('Query and fragment must be a string');
665
+ }
666
+
667
+ return preg_replace_callback(
668
+ '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
669
+ [$this, 'rawurlencodeMatchZero'],
670
+ $str
671
+ );
672
+ }
673
+
674
+ private function rawurlencodeMatchZero(array $match)
675
+ {
676
+ return rawurlencode($match[0]);
677
+ }
678
+
679
+ private function validateState()
680
+ {
681
+ if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) {
682
+ $this->host = self::HTTP_DEFAULT_HOST;
683
+ }
684
+
685
+ if ($this->getAuthority() === '') {
686
+ if (0 === strpos($this->path, '//')) {
687
+ throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"');
688
+ }
689
+ if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) {
690
+ throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon');
691
+ }
692
+ } elseif (isset($this->path[0]) && $this->path[0] !== '/') {
693
+ @trigger_error(
694
+ 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' .
695
+ 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.',
696
+ E_USER_DEPRECATED
697
+ );
698
+ $this->path = '/'. $this->path;
699
+ //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty');
700
+ }
701
+ }
702
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/UriNormalizer.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\UriInterface;
5
+
6
+ /**
7
+ * Provides methods to normalize and compare URIs.
8
+ *
9
+ * @author Tobias Schultze
10
+ *
11
+ * @link https://tools.ietf.org/html/rfc3986#section-6
12
+ */
13
+ final class UriNormalizer
14
+ {
15
+ /**
16
+ * Default normalizations which only include the ones that preserve semantics.
17
+ *
18
+ * self::CAPITALIZE_PERCENT_ENCODING | self::DECODE_UNRESERVED_CHARACTERS | self::CONVERT_EMPTY_PATH |
19
+ * self::REMOVE_DEFAULT_HOST | self::REMOVE_DEFAULT_PORT | self::REMOVE_DOT_SEGMENTS
20
+ */
21
+ const PRESERVING_NORMALIZATIONS = 63;
22
+
23
+ /**
24
+ * All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized.
25
+ *
26
+ * Example: http://example.org/a%c2%b1b → http://example.org/a%C2%B1b
27
+ */
28
+ const CAPITALIZE_PERCENT_ENCODING = 1;
29
+
30
+ /**
31
+ * Decodes percent-encoded octets of unreserved characters.
32
+ *
33
+ * For consistency, percent-encoded octets in the ranges of ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39),
34
+ * hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers and,
35
+ * when found in a URI, should be decoded to their corresponding unreserved characters by URI normalizers.
36
+ *
37
+ * Example: http://example.org/%7Eusern%61me/ → http://example.org/~username/
38
+ */
39
+ const DECODE_UNRESERVED_CHARACTERS = 2;
40
+
41
+ /**
42
+ * Converts the empty path to "/" for http and https URIs.
43
+ *
44
+ * Example: http://example.org → http://example.org/
45
+ */
46
+ const CONVERT_EMPTY_PATH = 4;
47
+
48
+ /**
49
+ * Removes the default host of the given URI scheme from the URI.
50
+ *
51
+ * Only the "file" scheme defines the default host "localhost".
52
+ * All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile`
53
+ * are equivalent according to RFC 3986. The first format is not accepted
54
+ * by PHPs stream functions and thus already normalized implicitly to the
55
+ * second format in the Uri class. See `GuzzleHttp\Psr7\Uri::composeComponents`.
56
+ *
57
+ * Example: file://localhost/myfile → file:///myfile
58
+ */
59
+ const REMOVE_DEFAULT_HOST = 8;
60
+
61
+ /**
62
+ * Removes the default port of the given URI scheme from the URI.
63
+ *
64
+ * Example: http://example.org:80/ → http://example.org/
65
+ */
66
+ const REMOVE_DEFAULT_PORT = 16;
67
+
68
+ /**
69
+ * Removes unnecessary dot-segments.
70
+ *
71
+ * Dot-segments in relative-path references are not removed as it would
72
+ * change the semantics of the URI reference.
73
+ *
74
+ * Example: http://example.org/../a/b/../c/./d.html → http://example.org/a/c/d.html
75
+ */
76
+ const REMOVE_DOT_SEGMENTS = 32;
77
+
78
+ /**
79
+ * Paths which include two or more adjacent slashes are converted to one.
80
+ *
81
+ * Webservers usually ignore duplicate slashes and treat those URIs equivalent.
82
+ * But in theory those URIs do not need to be equivalent. So this normalization
83
+ * may change the semantics. Encoded slashes (%2F) are not removed.
84
+ *
85
+ * Example: http://example.org//foo///bar.html → http://example.org/foo/bar.html
86
+ */
87
+ const REMOVE_DUPLICATE_SLASHES = 64;
88
+
89
+ /**
90
+ * Sort query parameters with their values in alphabetical order.
91
+ *
92
+ * However, the order of parameters in a URI may be significant (this is not defined by the standard).
93
+ * So this normalization is not safe and may change the semantics of the URI.
94
+ *
95
+ * Example: ?lang=en&article=fred → ?article=fred&lang=en
96
+ *
97
+ * Note: The sorting is neither locale nor Unicode aware (the URI query does not get decoded at all) as the
98
+ * purpose is to be able to compare URIs in a reproducible way, not to have the params sorted perfectly.
99
+ */
100
+ const SORT_QUERY_PARAMETERS = 128;
101
+
102
+ /**
103
+ * Returns a normalized URI.
104
+ *
105
+ * The scheme and host component are already normalized to lowercase per PSR-7 UriInterface.
106
+ * This methods adds additional normalizations that can be configured with the $flags parameter.
107
+ *
108
+ * PSR-7 UriInterface cannot distinguish between an empty component and a missing component as
109
+ * getQuery(), getFragment() etc. always return a string. This means the URIs "/?#" and "/" are
110
+ * treated equivalent which is not necessarily true according to RFC 3986. But that difference
111
+ * is highly uncommon in reality. So this potential normalization is implied in PSR-7 as well.
112
+ *
113
+ * @param UriInterface $uri The URI to normalize
114
+ * @param int $flags A bitmask of normalizations to apply, see constants
115
+ *
116
+ * @return UriInterface The normalized URI
117
+ * @link https://tools.ietf.org/html/rfc3986#section-6.2
118
+ */
119
+ public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS)
120
+ {
121
+ if ($flags & self::CAPITALIZE_PERCENT_ENCODING) {
122
+ $uri = self::capitalizePercentEncoding($uri);
123
+ }
124
+
125
+ if ($flags & self::DECODE_UNRESERVED_CHARACTERS) {
126
+ $uri = self::decodeUnreservedCharacters($uri);
127
+ }
128
+
129
+ if ($flags & self::CONVERT_EMPTY_PATH && $uri->getPath() === '' &&
130
+ ($uri->getScheme() === 'http' || $uri->getScheme() === 'https')
131
+ ) {
132
+ $uri = $uri->withPath('/');
133
+ }
134
+
135
+ if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') {
136
+ $uri = $uri->withHost('');
137
+ }
138
+
139
+ if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) {
140
+ $uri = $uri->withPort(null);
141
+ }
142
+
143
+ if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) {
144
+ $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath()));
145
+ }
146
+
147
+ if ($flags & self::REMOVE_DUPLICATE_SLASHES) {
148
+ $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath()));
149
+ }
150
+
151
+ if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') {
152
+ $queryKeyValues = explode('&', $uri->getQuery());
153
+ sort($queryKeyValues);
154
+ $uri = $uri->withQuery(implode('&', $queryKeyValues));
155
+ }
156
+
157
+ return $uri;
158
+ }
159
+
160
+ /**
161
+ * Whether two URIs can be considered equivalent.
162
+ *
163
+ * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also
164
+ * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be
165
+ * resolved against the same base URI. If this is not the case, determination of equivalence or difference of
166
+ * relative references does not mean anything.
167
+ *
168
+ * @param UriInterface $uri1 An URI to compare
169
+ * @param UriInterface $uri2 An URI to compare
170
+ * @param int $normalizations A bitmask of normalizations to apply, see constants
171
+ *
172
+ * @return bool
173
+ * @link https://tools.ietf.org/html/rfc3986#section-6.1
174
+ */
175
+ public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS)
176
+ {
177
+ return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations);
178
+ }
179
+
180
+ private static function capitalizePercentEncoding(UriInterface $uri)
181
+ {
182
+ $regex = '/(?:%[A-Fa-f0-9]{2})++/';
183
+
184
+ $callback = function (array $match) {
185
+ return strtoupper($match[0]);
186
+ };
187
+
188
+ return
189
+ $uri->withPath(
190
+ preg_replace_callback($regex, $callback, $uri->getPath())
191
+ )->withQuery(
192
+ preg_replace_callback($regex, $callback, $uri->getQuery())
193
+ );
194
+ }
195
+
196
+ private static function decodeUnreservedCharacters(UriInterface $uri)
197
+ {
198
+ $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i';
199
+
200
+ $callback = function (array $match) {
201
+ return rawurldecode($match[0]);
202
+ };
203
+
204
+ return
205
+ $uri->withPath(
206
+ preg_replace_callback($regex, $callback, $uri->getPath())
207
+ )->withQuery(
208
+ preg_replace_callback($regex, $callback, $uri->getQuery())
209
+ );
210
+ }
211
+
212
+ private function __construct()
213
+ {
214
+ // cannot be instantiated
215
+ }
216
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/UriResolver.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\UriInterface;
5
+
6
+ /**
7
+ * Resolves a URI reference in the context of a base URI and the opposite way.
8
+ *
9
+ * @author Tobias Schultze
10
+ *
11
+ * @link https://tools.ietf.org/html/rfc3986#section-5
12
+ */
13
+ final class UriResolver
14
+ {
15
+ /**
16
+ * Removes dot segments from a path and returns the new path.
17
+ *
18
+ * @param string $path
19
+ *
20
+ * @return string
21
+ * @link http://tools.ietf.org/html/rfc3986#section-5.2.4
22
+ */
23
+ public static function removeDotSegments($path)
24
+ {
25
+ if ($path === '' || $path === '/') {
26
+ return $path;
27
+ }
28
+
29
+ $results = [];
30
+ $segments = explode('/', $path);
31
+ foreach ($segments as $segment) {
32
+ if ($segment === '..') {
33
+ array_pop($results);
34
+ } elseif ($segment !== '.') {
35
+ $results[] = $segment;
36
+ }
37
+ }
38
+
39
+ $newPath = implode('/', $results);
40
+
41
+ if ($path[0] === '/' && (!isset($newPath[0]) || $newPath[0] !== '/')) {
42
+ // Re-add the leading slash if necessary for cases like "/.."
43
+ $newPath = '/' . $newPath;
44
+ } elseif ($newPath !== '' && ($segment === '.' || $segment === '..')) {
45
+ // Add the trailing slash if necessary
46
+ // If newPath is not empty, then $segment must be set and is the last segment from the foreach
47
+ $newPath .= '/';
48
+ }
49
+
50
+ return $newPath;
51
+ }
52
+
53
+ /**
54
+ * Converts the relative URI into a new URI that is resolved against the base URI.
55
+ *
56
+ * @param UriInterface $base Base URI
57
+ * @param UriInterface $rel Relative URI
58
+ *
59
+ * @return UriInterface
60
+ * @link http://tools.ietf.org/html/rfc3986#section-5.2
61
+ */
62
+ public static function resolve(UriInterface $base, UriInterface $rel)
63
+ {
64
+ if ((string) $rel === '') {
65
+ // we can simply return the same base URI instance for this same-document reference
66
+ return $base;
67
+ }
68
+
69
+ if ($rel->getScheme() != '') {
70
+ return $rel->withPath(self::removeDotSegments($rel->getPath()));
71
+ }
72
+
73
+ if ($rel->getAuthority() != '') {
74
+ $targetAuthority = $rel->getAuthority();
75
+ $targetPath = self::removeDotSegments($rel->getPath());
76
+ $targetQuery = $rel->getQuery();
77
+ } else {
78
+ $targetAuthority = $base->getAuthority();
79
+ if ($rel->getPath() === '') {
80
+ $targetPath = $base->getPath();
81
+ $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery();
82
+ } else {
83
+ if ($rel->getPath()[0] === '/') {
84
+ $targetPath = $rel->getPath();
85
+ } else {
86
+ if ($targetAuthority != '' && $base->getPath() === '') {
87
+ $targetPath = '/' . $rel->getPath();
88
+ } else {
89
+ $lastSlashPos = strrpos($base->getPath(), '/');
90
+ if ($lastSlashPos === false) {
91
+ $targetPath = $rel->getPath();
92
+ } else {
93
+ $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath();
94
+ }
95
+ }
96
+ }
97
+ $targetPath = self::removeDotSegments($targetPath);
98
+ $targetQuery = $rel->getQuery();
99
+ }
100
+ }
101
+
102
+ return new Uri(Uri::composeComponents(
103
+ $base->getScheme(),
104
+ $targetAuthority,
105
+ $targetPath,
106
+ $targetQuery,
107
+ $rel->getFragment()
108
+ ));
109
+ }
110
+
111
+ /**
112
+ * Returns the target URI as a relative reference from the base URI.
113
+ *
114
+ * This method is the counterpart to resolve():
115
+ *
116
+ * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target))
117
+ *
118
+ * One use-case is to use the current request URI as base URI and then generate relative links in your documents
119
+ * to reduce the document size or offer self-contained downloadable document archives.
120
+ *
121
+ * $base = new Uri('http://example.com/a/b/');
122
+ * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'.
123
+ * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'.
124
+ * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'.
125
+ * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'.
126
+ *
127
+ * This method also accepts a target that is already relative and will try to relativize it further. Only a
128
+ * relative-path reference will be returned as-is.
129
+ *
130
+ * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well
131
+ *
132
+ * @param UriInterface $base Base URI
133
+ * @param UriInterface $target Target URI
134
+ *
135
+ * @return UriInterface The relative URI reference
136
+ */
137
+ public static function relativize(UriInterface $base, UriInterface $target)
138
+ {
139
+ if ($target->getScheme() !== '' &&
140
+ ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')
141
+ ) {
142
+ return $target;
143
+ }
144
+
145
+ if (Uri::isRelativePathReference($target)) {
146
+ // As the target is already highly relative we return it as-is. It would be possible to resolve
147
+ // the target with `$target = self::resolve($base, $target);` and then try make it more relative
148
+ // by removing a duplicate query. But let's not do that automatically.
149
+ return $target;
150
+ }
151
+
152
+ if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) {
153
+ return $target->withScheme('');
154
+ }
155
+
156
+ // We must remove the path before removing the authority because if the path starts with two slashes, the URI
157
+ // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also
158
+ // invalid.
159
+ $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost('');
160
+
161
+ if ($base->getPath() !== $target->getPath()) {
162
+ return $emptyPathUri->withPath(self::getRelativePath($base, $target));
163
+ }
164
+
165
+ if ($base->getQuery() === $target->getQuery()) {
166
+ // Only the target fragment is left. And it must be returned even if base and target fragment are the same.
167
+ return $emptyPathUri->withQuery('');
168
+ }
169
+
170
+ // If the base URI has a query but the target has none, we cannot return an empty path reference as it would
171
+ // inherit the base query component when resolving.
172
+ if ($target->getQuery() === '') {
173
+ $segments = explode('/', $target->getPath());
174
+ $lastSegment = end($segments);
175
+
176
+ return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment);
177
+ }
178
+
179
+ return $emptyPathUri;
180
+ }
181
+
182
+ private static function getRelativePath(UriInterface $base, UriInterface $target)
183
+ {
184
+ $sourceSegments = explode('/', $base->getPath());
185
+ $targetSegments = explode('/', $target->getPath());
186
+ array_pop($sourceSegments);
187
+ $targetLastSegment = array_pop($targetSegments);
188
+ foreach ($sourceSegments as $i => $segment) {
189
+ if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) {
190
+ unset($sourceSegments[$i], $targetSegments[$i]);
191
+ } else {
192
+ break;
193
+ }
194
+ }
195
+ $targetSegments[] = $targetLastSegment;
196
+ $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments);
197
+
198
+ // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./".
199
+ // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used
200
+ // as the first segment of a relative-path reference, as it would be mistaken for a scheme name.
201
+ if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) {
202
+ $relativePath = "./$relativePath";
203
+ } elseif ('/' === $relativePath[0]) {
204
+ if ($base->getAuthority() != '' && $base->getPath() === '') {
205
+ // In this case an extra slash is added by resolve() automatically. So we must not add one here.
206
+ $relativePath = ".$relativePath";
207
+ } else {
208
+ $relativePath = "./$relativePath";
209
+ }
210
+ }
211
+
212
+ return $relativePath;
213
+ }
214
+
215
+ private function __construct()
216
+ {
217
+ // cannot be instantiated
218
+ }
219
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/functions.php ADDED
@@ -0,0 +1,828 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\MessageInterface;
5
+ use Psr\Http\Message\RequestInterface;
6
+ use Psr\Http\Message\ResponseInterface;
7
+ use Psr\Http\Message\ServerRequestInterface;
8
+ use Psr\Http\Message\StreamInterface;
9
+ use Psr\Http\Message\UriInterface;
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
+ function str(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
+ $msg .= "\r\n{$name}: " . implode(', ', $values);
37
+ }
38
+
39
+ return "{$msg}\r\n\r\n" . $message->getBody();
40
+ }
41
+
42
+ /**
43
+ * Returns a UriInterface for the given value.
44
+ *
45
+ * This function accepts a string or {@see Psr\Http\Message\UriInterface} and
46
+ * returns a UriInterface for the given value. If the value is already a
47
+ * `UriInterface`, it is returned as-is.
48
+ *
49
+ * @param string|UriInterface $uri
50
+ *
51
+ * @return UriInterface
52
+ * @throws \InvalidArgumentException
53
+ */
54
+ function uri_for($uri)
55
+ {
56
+ if ($uri instanceof UriInterface) {
57
+ return $uri;
58
+ } elseif (is_string($uri)) {
59
+ return new Uri($uri);
60
+ }
61
+
62
+ throw new \InvalidArgumentException('URI must be a string or UriInterface');
63
+ }
64
+
65
+ /**
66
+ * Create a new stream based on the input type.
67
+ *
68
+ * Options is an associative array that can contain the following keys:
69
+ * - metadata: Array of custom metadata.
70
+ * - size: Size of the stream.
71
+ *
72
+ * @param resource|string|null|int|float|bool|StreamInterface|callable $resource Entity body data
73
+ * @param array $options Additional options
74
+ *
75
+ * @return Stream
76
+ * @throws \InvalidArgumentException if the $resource arg is not valid.
77
+ */
78
+ function stream_for($resource = '', array $options = [])
79
+ {
80
+ if (is_scalar($resource)) {
81
+ $stream = fopen('php://temp', 'r+');
82
+ if ($resource !== '') {
83
+ fwrite($stream, $resource);
84
+ fseek($stream, 0);
85
+ }
86
+ return new Stream($stream, $options);
87
+ }
88
+
89
+ switch (gettype($resource)) {
90
+ case 'resource':
91
+ return new Stream($resource, $options);
92
+ case 'object':
93
+ if ($resource instanceof StreamInterface) {
94
+ return $resource;
95
+ } elseif ($resource instanceof \Iterator) {
96
+ return new PumpStream(function () use ($resource) {
97
+ if (!$resource->valid()) {
98
+ return false;
99
+ }
100
+ $result = $resource->current();
101
+ $resource->next();
102
+ return $result;
103
+ }, $options);
104
+ } elseif (method_exists($resource, '__toString')) {
105
+ return stream_for((string) $resource, $options);
106
+ }
107
+ break;
108
+ case 'NULL':
109
+ return new Stream(fopen('php://temp', 'r+'), $options);
110
+ }
111
+
112
+ if (is_callable($resource)) {
113
+ return new PumpStream($resource, $options);
114
+ }
115
+
116
+ throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource));
117
+ }
118
+
119
+ /**
120
+ * Parse an array of header values containing ";" separated data into an
121
+ * array of associative arrays representing the header key value pair
122
+ * data of the header. When a parameter does not contain a value, but just
123
+ * contains a key, this function will inject a key with a '' string value.
124
+ *
125
+ * @param string|array $header Header to parse into components.
126
+ *
127
+ * @return array Returns the parsed header values.
128
+ */
129
+ function parse_header($header)
130
+ {
131
+ static $trimmed = "\"' \n\t\r";
132
+ $params = $matches = [];
133
+
134
+ foreach (normalize_header($header) as $val) {
135
+ $part = [];
136
+ foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) {
137
+ if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) {
138
+ $m = $matches[0];
139
+ if (isset($m[1])) {
140
+ $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed);
141
+ } else {
142
+ $part[] = trim($m[0], $trimmed);
143
+ }
144
+ }
145
+ }
146
+ if ($part) {
147
+ $params[] = $part;
148
+ }
149
+ }
150
+
151
+ return $params;
152
+ }
153
+
154
+ /**
155
+ * Converts an array of header values that may contain comma separated
156
+ * headers into an array of headers with no comma separated values.
157
+ *
158
+ * @param string|array $header Header to normalize.
159
+ *
160
+ * @return array Returns the normalized header field values.
161
+ */
162
+ function normalize_header($header)
163
+ {
164
+ if (!is_array($header)) {
165
+ return array_map('trim', explode(',', $header));
166
+ }
167
+
168
+ $result = [];
169
+ foreach ($header as $value) {
170
+ foreach ((array) $value as $v) {
171
+ if (strpos($v, ',') === false) {
172
+ $result[] = $v;
173
+ continue;
174
+ }
175
+ foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) {
176
+ $result[] = trim($vv);
177
+ }
178
+ }
179
+ }
180
+
181
+ return $result;
182
+ }
183
+
184
+ /**
185
+ * Clone and modify a request with the given changes.
186
+ *
187
+ * The changes can be one of:
188
+ * - method: (string) Changes the HTTP method.
189
+ * - set_headers: (array) Sets the given headers.
190
+ * - remove_headers: (array) Remove the given headers.
191
+ * - body: (mixed) Sets the given body.
192
+ * - uri: (UriInterface) Set the URI.
193
+ * - query: (string) Set the query string value of the URI.
194
+ * - version: (string) Set the protocol version.
195
+ *
196
+ * @param RequestInterface $request Request to clone and modify.
197
+ * @param array $changes Changes to apply.
198
+ *
199
+ * @return RequestInterface
200
+ */
201
+ function modify_request(RequestInterface $request, array $changes)
202
+ {
203
+ if (!$changes) {
204
+ return $request;
205
+ }
206
+
207
+ $headers = $request->getHeaders();
208
+
209
+ if (!isset($changes['uri'])) {
210
+ $uri = $request->getUri();
211
+ } else {
212
+ // Remove the host header if one is on the URI
213
+ if ($host = $changes['uri']->getHost()) {
214
+ $changes['set_headers']['Host'] = $host;
215
+
216
+ if ($port = $changes['uri']->getPort()) {
217
+ $standardPorts = ['http' => 80, 'https' => 443];
218
+ $scheme = $changes['uri']->getScheme();
219
+ if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) {
220
+ $changes['set_headers']['Host'] .= ':'.$port;
221
+ }
222
+ }
223
+ }
224
+ $uri = $changes['uri'];
225
+ }
226
+
227
+ if (!empty($changes['remove_headers'])) {
228
+ $headers = _caseless_remove($changes['remove_headers'], $headers);
229
+ }
230
+
231
+ if (!empty($changes['set_headers'])) {
232
+ $headers = _caseless_remove(array_keys($changes['set_headers']), $headers);
233
+ $headers = $changes['set_headers'] + $headers;
234
+ }
235
+
236
+ if (isset($changes['query'])) {
237
+ $uri = $uri->withQuery($changes['query']);
238
+ }
239
+
240
+ if ($request instanceof ServerRequestInterface) {
241
+ return new ServerRequest(
242
+ isset($changes['method']) ? $changes['method'] : $request->getMethod(),
243
+ $uri,
244
+ $headers,
245
+ isset($changes['body']) ? $changes['body'] : $request->getBody(),
246
+ isset($changes['version'])
247
+ ? $changes['version']
248
+ : $request->getProtocolVersion(),
249
+ $request->getServerParams()
250
+ );
251
+ }
252
+
253
+ return new Request(
254
+ isset($changes['method']) ? $changes['method'] : $request->getMethod(),
255
+ $uri,
256
+ $headers,
257
+ isset($changes['body']) ? $changes['body'] : $request->getBody(),
258
+ isset($changes['version'])
259
+ ? $changes['version']
260
+ : $request->getProtocolVersion()
261
+ );
262
+ }
263
+
264
+ /**
265
+ * Attempts to rewind a message body and throws an exception on failure.
266
+ *
267
+ * The body of the message will only be rewound if a call to `tell()` returns a
268
+ * value other than `0`.
269
+ *
270
+ * @param MessageInterface $message Message to rewind
271
+ *
272
+ * @throws \RuntimeException
273
+ */
274
+ function rewind_body(MessageInterface $message)
275
+ {
276
+ $body = $message->getBody();
277
+
278
+ if ($body->tell()) {
279
+ $body->rewind();
280
+ }
281
+ }
282
+
283
+ /**
284
+ * Safely opens a PHP stream resource using a filename.
285
+ *
286
+ * When fopen fails, PHP normally raises a warning. This function adds an
287
+ * error handler that checks for errors and throws an exception instead.
288
+ *
289
+ * @param string $filename File to open
290
+ * @param string $mode Mode used to open the file
291
+ *
292
+ * @return resource
293
+ * @throws \RuntimeException if the file cannot be opened
294
+ */
295
+ function try_fopen($filename, $mode)
296
+ {
297
+ $ex = null;
298
+ set_error_handler(function () use ($filename, $mode, &$ex) {
299
+ $ex = new \RuntimeException(sprintf(
300
+ 'Unable to open %s using mode %s: %s',
301
+ $filename,
302
+ $mode,
303
+ func_get_args()[1]
304
+ ));
305
+ });
306
+
307
+ $handle = fopen($filename, $mode);
308
+ restore_error_handler();
309
+
310
+ if ($ex) {
311
+ /** @var $ex \RuntimeException */
312
+ throw $ex;
313
+ }
314
+
315
+ return $handle;
316
+ }
317
+
318
+ /**
319
+ * Copy the contents of a stream into a string until the given number of
320
+ * bytes have been read.
321
+ *
322
+ * @param StreamInterface $stream Stream to read
323
+ * @param int $maxLen Maximum number of bytes to read. Pass -1
324
+ * to read the entire stream.
325
+ * @return string
326
+ * @throws \RuntimeException on error.
327
+ */
328
+ function copy_to_string(StreamInterface $stream, $maxLen = -1)
329
+ {
330
+ $buffer = '';
331
+
332
+ if ($maxLen === -1) {
333
+ while (!$stream->eof()) {
334
+ $buf = $stream->read(1048576);
335
+ // Using a loose equality here to match on '' and false.
336
+ if ($buf == null) {
337
+ break;
338
+ }
339
+ $buffer .= $buf;
340
+ }
341
+ return $buffer;
342
+ }
343
+
344
+ $len = 0;
345
+ while (!$stream->eof() && $len < $maxLen) {
346
+ $buf = $stream->read($maxLen - $len);
347
+ // Using a loose equality here to match on '' and false.
348
+ if ($buf == null) {
349
+ break;
350
+ }
351
+ $buffer .= $buf;
352
+ $len = strlen($buffer);
353
+ }
354
+
355
+ return $buffer;
356
+ }
357
+
358
+ /**
359
+ * Copy the contents of a stream into another stream until the given number
360
+ * of bytes have been read.
361
+ *
362
+ * @param StreamInterface $source Stream to read from
363
+ * @param StreamInterface $dest Stream to write to
364
+ * @param int $maxLen Maximum number of bytes to read. Pass -1
365
+ * to read the entire stream.
366
+ *
367
+ * @throws \RuntimeException on error.
368
+ */
369
+ function copy_to_stream(
370
+ StreamInterface $source,
371
+ StreamInterface $dest,
372
+ $maxLen = -1
373
+ ) {
374
+ $bufferSize = 8192;
375
+
376
+ if ($maxLen === -1) {
377
+ while (!$source->eof()) {
378
+ if (!$dest->write($source->read($bufferSize))) {
379
+ break;
380
+ }
381
+ }
382
+ } else {
383
+ $remaining = $maxLen;
384
+ while ($remaining > 0 && !$source->eof()) {
385
+ $buf = $source->read(min($bufferSize, $remaining));
386
+ $len = strlen($buf);
387
+ if (!$len) {
388
+ break;
389
+ }
390
+ $remaining -= $len;
391
+ $dest->write($buf);
392
+ }
393
+ }
394
+ }
395
+
396
+ /**
397
+ * Calculate a hash of a Stream
398
+ *
399
+ * @param StreamInterface $stream Stream to calculate the hash for
400
+ * @param string $algo Hash algorithm (e.g. md5, crc32, etc)
401
+ * @param bool $rawOutput Whether or not to use raw output
402
+ *
403
+ * @return string Returns the hash of the stream
404
+ * @throws \RuntimeException on error.
405
+ */
406
+ function hash(
407
+ StreamInterface $stream,
408
+ $algo,
409
+ $rawOutput = false
410
+ ) {
411
+ $pos = $stream->tell();
412
+
413
+ if ($pos > 0) {
414
+ $stream->rewind();
415
+ }
416
+
417
+ $ctx = hash_init($algo);
418
+ while (!$stream->eof()) {
419
+ hash_update($ctx, $stream->read(1048576));
420
+ }
421
+
422
+ $out = hash_final($ctx, (bool) $rawOutput);
423
+ $stream->seek($pos);
424
+
425
+ return $out;
426
+ }
427
+
428
+ /**
429
+ * Read a line from the stream up to the maximum allowed buffer length
430
+ *
431
+ * @param StreamInterface $stream Stream to read from
432
+ * @param int $maxLength Maximum buffer length
433
+ *
434
+ * @return string|bool
435
+ */
436
+ function readline(StreamInterface $stream, $maxLength = null)
437
+ {
438
+ $buffer = '';
439
+ $size = 0;
440
+
441
+ while (!$stream->eof()) {
442
+ // Using a loose equality here to match on '' and false.
443
+ if (null == ($byte = $stream->read(1))) {
444
+ return $buffer;
445
+ }
446
+ $buffer .= $byte;
447
+ // Break when a new line is found or the max length - 1 is reached
448
+ if ($byte === "\n" || ++$size === $maxLength - 1) {
449
+ break;
450
+ }
451
+ }
452
+
453
+ return $buffer;
454
+ }
455
+
456
+ /**
457
+ * Parses a request message string into a request object.
458
+ *
459
+ * @param string $message Request message string.
460
+ *
461
+ * @return Request
462
+ */
463
+ function parse_request($message)
464
+ {
465
+ $data = _parse_message($message);
466
+ $matches = [];
467
+ if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) {
468
+ throw new \InvalidArgumentException('Invalid request string');
469
+ }
470
+ $parts = explode(' ', $data['start-line'], 3);
471
+ $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1';
472
+
473
+ $request = new Request(
474
+ $parts[0],
475
+ $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1],
476
+ $data['headers'],
477
+ $data['body'],
478
+ $version
479
+ );
480
+
481
+ return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]);
482
+ }
483
+
484
+ /**
485
+ * Parses a response message string into a response object.
486
+ *
487
+ * @param string $message Response message string.
488
+ *
489
+ * @return Response
490
+ */
491
+ function parse_response($message)
492
+ {
493
+ $data = _parse_message($message);
494
+ // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space
495
+ // between status-code and reason-phrase is required. But browsers accept
496
+ // responses without space and reason as well.
497
+ if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
498
+ throw new \InvalidArgumentException('Invalid response string');
499
+ }
500
+ $parts = explode(' ', $data['start-line'], 3);
501
+
502
+ return new Response(
503
+ $parts[1],
504
+ $data['headers'],
505
+ $data['body'],
506
+ explode('/', $parts[0])[1],
507
+ isset($parts[2]) ? $parts[2] : null
508
+ );
509
+ }
510
+
511
+ /**
512
+ * Parse a query string into an associative array.
513
+ *
514
+ * If multiple values are found for the same key, the value of that key
515
+ * value pair will become an array. This function does not parse nested
516
+ * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will
517
+ * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
518
+ *
519
+ * @param string $str Query string to parse
520
+ * @param bool|string $urlEncoding How the query string is encoded
521
+ *
522
+ * @return array
523
+ */
524
+ function parse_query($str, $urlEncoding = true)
525
+ {
526
+ $result = [];
527
+
528
+ if ($str === '') {
529
+ return $result;
530
+ }
531
+
532
+ if ($urlEncoding === true) {
533
+ $decoder = function ($value) {
534
+ return rawurldecode(str_replace('+', ' ', $value));
535
+ };
536
+ } elseif ($urlEncoding == PHP_QUERY_RFC3986) {
537
+ $decoder = 'rawurldecode';
538
+ } elseif ($urlEncoding == PHP_QUERY_RFC1738) {
539
+ $decoder = 'urldecode';
540
+ } else {
541
+ $decoder = function ($str) { return $str; };
542
+ }
543
+
544
+ foreach (explode('&', $str) as $kvp) {
545
+ $parts = explode('=', $kvp, 2);
546
+ $key = $decoder($parts[0]);
547
+ $value = isset($parts[1]) ? $decoder($parts[1]) : null;
548
+ if (!isset($result[$key])) {
549
+ $result[$key] = $value;
550
+ } else {
551
+ if (!is_array($result[$key])) {
552
+ $result[$key] = [$result[$key]];
553
+ }
554
+ $result[$key][] = $value;
555
+ }
556
+ }
557
+
558
+ return $result;
559
+ }
560
+
561
+ /**
562
+ * Build a query string from an array of key value pairs.
563
+ *
564
+ * This function can use the return value of parse_query() to build a query
565
+ * string. This function does not modify the provided keys when an array is
566
+ * encountered (like http_build_query would).
567
+ *
568
+ * @param array $params Query string parameters.
569
+ * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
570
+ * to encode using RFC3986, or PHP_QUERY_RFC1738
571
+ * to encode using RFC1738.
572
+ * @return string
573
+ */
574
+ function build_query(array $params, $encoding = PHP_QUERY_RFC3986)
575
+ {
576
+ if (!$params) {
577
+ return '';
578
+ }
579
+
580
+ if ($encoding === false) {
581
+ $encoder = function ($str) { return $str; };
582
+ } elseif ($encoding === PHP_QUERY_RFC3986) {
583
+ $encoder = 'rawurlencode';
584
+ } elseif ($encoding === PHP_QUERY_RFC1738) {
585
+ $encoder = 'urlencode';
586
+ } else {
587
+ throw new \InvalidArgumentException('Invalid type');
588
+ }
589
+
590
+ $qs = '';
591
+ foreach ($params as $k => $v) {
592
+ $k = $encoder($k);
593
+ if (!is_array($v)) {
594
+ $qs .= $k;
595
+ if ($v !== null) {
596
+ $qs .= '=' . $encoder($v);
597
+ }
598
+ $qs .= '&';
599
+ } else {
600
+ foreach ($v as $vv) {
601
+ $qs .= $k;
602
+ if ($vv !== null) {
603
+ $qs .= '=' . $encoder($vv);
604
+ }
605
+ $qs .= '&';
606
+ }
607
+ }
608
+ }
609
+
610
+ return $qs ? (string) substr($qs, 0, -1) : '';
611
+ }
612
+
613
+ /**
614
+ * Determines the mimetype of a file by looking at its extension.
615
+ *
616
+ * @param $filename
617
+ *
618
+ * @return null|string
619
+ */
620
+ function mimetype_from_filename($filename)
621
+ {
622
+ return mimetype_from_extension(pathinfo($filename, PATHINFO_EXTENSION));
623
+ }
624
+
625
+ /**
626
+ * Maps a file extensions to a mimetype.
627
+ *
628
+ * @param $extension string The file extension.
629
+ *
630
+ * @return string|null
631
+ * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
632
+ */
633
+ function mimetype_from_extension($extension)
634
+ {
635
+ static $mimetypes = [
636
+ '7z' => 'application/x-7z-compressed',
637
+ 'aac' => 'audio/x-aac',
638
+ 'ai' => 'application/postscript',
639
+ 'aif' => 'audio/x-aiff',
640
+ 'asc' => 'text/plain',
641
+ 'asf' => 'video/x-ms-asf',
642
+ 'atom' => 'application/atom+xml',
643
+ 'avi' => 'video/x-msvideo',
644
+ 'bmp' => 'image/bmp',
645
+ 'bz2' => 'application/x-bzip2',
646
+ 'cer' => 'application/pkix-cert',
647
+ 'crl' => 'application/pkix-crl',
648
+ 'crt' => 'application/x-x509-ca-cert',
649
+ 'css' => 'text/css',
650
+ 'csv' => 'text/csv',
651
+ 'cu' => 'application/cu-seeme',
652
+ 'deb' => 'application/x-debian-package',
653
+ 'doc' => 'application/msword',
654
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
655
+ 'dvi' => 'application/x-dvi',
656
+ 'eot' => 'application/vnd.ms-fontobject',
657
+ 'eps' => 'application/postscript',
658
+ 'epub' => 'application/epub+zip',
659
+ 'etx' => 'text/x-setext',
660
+ 'flac' => 'audio/flac',
661
+ 'flv' => 'video/x-flv',
662
+ 'gif' => 'image/gif',
663
+ 'gz' => 'application/gzip',
664
+ 'htm' => 'text/html',
665
+ 'html' => 'text/html',
666
+ 'ico' => 'image/x-icon',
667
+ 'ics' => 'text/calendar',
668
+ 'ini' => 'text/plain',
669
+ 'iso' => 'application/x-iso9660-image',
670
+ 'jar' => 'application/java-archive',
671
+ 'jpe' => 'image/jpeg',
672
+ 'jpeg' => 'image/jpeg',
673
+ 'jpg' => 'image/jpeg',
674
+ 'js' => 'text/javascript',
675
+ 'json' => 'application/json',
676
+ 'latex' => 'application/x-latex',
677
+ 'log' => 'text/plain',
678
+ 'm4a' => 'audio/mp4',
679
+ 'm4v' => 'video/mp4',
680
+ 'mid' => 'audio/midi',
681
+ 'midi' => 'audio/midi',
682
+ 'mov' => 'video/quicktime',
683
+ 'mp3' => 'audio/mpeg',
684
+ 'mp4' => 'video/mp4',
685
+ 'mp4a' => 'audio/mp4',
686
+ 'mp4v' => 'video/mp4',
687
+ 'mpe' => 'video/mpeg',
688
+ 'mpeg' => 'video/mpeg',
689
+ 'mpg' => 'video/mpeg',
690
+ 'mpg4' => 'video/mp4',
691
+ 'oga' => 'audio/ogg',
692
+ 'ogg' => 'audio/ogg',
693
+ 'ogv' => 'video/ogg',
694
+ 'ogx' => 'application/ogg',
695
+ 'pbm' => 'image/x-portable-bitmap',
696
+ 'pdf' => 'application/pdf',
697
+ 'pgm' => 'image/x-portable-graymap',
698
+ 'png' => 'image/png',
699
+ 'pnm' => 'image/x-portable-anymap',
700
+ 'ppm' => 'image/x-portable-pixmap',
701
+ 'ppt' => 'application/vnd.ms-powerpoint',
702
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
703
+ 'ps' => 'application/postscript',
704
+ 'qt' => 'video/quicktime',
705
+ 'rar' => 'application/x-rar-compressed',
706
+ 'ras' => 'image/x-cmu-raster',
707
+ 'rss' => 'application/rss+xml',
708
+ 'rtf' => 'application/rtf',
709
+ 'sgm' => 'text/sgml',
710
+ 'sgml' => 'text/sgml',
711
+ 'svg' => 'image/svg+xml',
712
+ 'swf' => 'application/x-shockwave-flash',
713
+ 'tar' => 'application/x-tar',
714
+ 'tif' => 'image/tiff',
715
+ 'tiff' => 'image/tiff',
716
+ 'torrent' => 'application/x-bittorrent',
717
+ 'ttf' => 'application/x-font-ttf',
718
+ 'txt' => 'text/plain',
719
+ 'wav' => 'audio/x-wav',
720
+ 'webm' => 'video/webm',
721
+ 'wma' => 'audio/x-ms-wma',
722
+ 'wmv' => 'video/x-ms-wmv',
723
+ 'woff' => 'application/x-font-woff',
724
+ 'wsdl' => 'application/wsdl+xml',
725
+ 'xbm' => 'image/x-xbitmap',
726
+ 'xls' => 'application/vnd.ms-excel',
727
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
728
+ 'xml' => 'application/xml',
729
+ 'xpm' => 'image/x-xpixmap',
730
+ 'xwd' => 'image/x-xwindowdump',
731
+ 'yaml' => 'text/yaml',
732
+ 'yml' => 'text/yaml',
733
+ 'zip' => 'application/zip',
734
+ ];
735
+
736
+ $extension = strtolower($extension);
737
+
738
+ return isset($mimetypes[$extension])
739
+ ? $mimetypes[$extension]
740
+ : null;
741
+ }
742
+
743
+ /**
744
+ * Parses an HTTP message into an associative array.
745
+ *
746
+ * The array contains the "start-line" key containing the start line of
747
+ * the message, "headers" key containing an associative array of header
748
+ * array values, and a "body" key containing the body of the message.
749
+ *
750
+ * @param string $message HTTP request or response to parse.
751
+ *
752
+ * @return array
753
+ * @internal
754
+ */
755
+ function _parse_message($message)
756
+ {
757
+ if (!$message) {
758
+ throw new \InvalidArgumentException('Invalid message');
759
+ }
760
+
761
+ // Iterate over each line in the message, accounting for line endings
762
+ $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
763
+ $result = ['start-line' => array_shift($lines), 'headers' => [], 'body' => ''];
764
+ array_shift($lines);
765
+
766
+ for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) {
767
+ $line = $lines[$i];
768
+ // If two line breaks were encountered, then this is the end of body
769
+ if (empty($line)) {
770
+ if ($i < $totalLines - 1) {
771
+ $result['body'] = implode('', array_slice($lines, $i + 2));
772
+ }
773
+ break;
774
+ }
775
+ if (strpos($line, ':')) {
776
+ $parts = explode(':', $line, 2);
777
+ $key = trim($parts[0]);
778
+ $value = isset($parts[1]) ? trim($parts[1]) : '';
779
+ $result['headers'][$key][] = $value;
780
+ }
781
+ }
782
+
783
+ return $result;
784
+ }
785
+
786
+ /**
787
+ * Constructs a URI for an HTTP request message.
788
+ *
789
+ * @param string $path Path from the start-line
790
+ * @param array $headers Array of headers (each value an array).
791
+ *
792
+ * @return string
793
+ * @internal
794
+ */
795
+ function _parse_request_uri($path, array $headers)
796
+ {
797
+ $hostKey = array_filter(array_keys($headers), function ($k) {
798
+ return strtolower($k) === 'host';
799
+ });
800
+
801
+ // If no host is found, then a full URI cannot be constructed.
802
+ if (!$hostKey) {
803
+ return $path;
804
+ }
805
+
806
+ $host = $headers[reset($hostKey)][0];
807
+ $scheme = substr($host, -4) === ':443' ? 'https' : 'http';
808
+
809
+ return $scheme . '://' . $host . '/' . ltrim($path, '/');
810
+ }
811
+
812
+ /** @internal */
813
+ function _caseless_remove($keys, array $data)
814
+ {
815
+ $result = [];
816
+
817
+ foreach ($keys as &$key) {
818
+ $key = strtolower($key);
819
+ }
820
+
821
+ foreach ($data as $k => $v) {
822
+ if (!in_array(strtolower($k), $keys)) {
823
+ $result[$k] = $v;
824
+ }
825
+ }
826
+
827
+ return $result;
828
+ }
Postman/Postman-Mail/mailgun/vendor/guzzlehttp/psr7/src/functions_include.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
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
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/CHANGELOG.md ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
4
+
5
+ ## 2.3.3
6
+
7
+ ### Changed
8
+
9
+ - Using stable version of `php-http/multipart-stream-builder`
10
+ - Improved tests
11
+
12
+ ## 2.3.2
13
+
14
+ ### Fixed
15
+
16
+ - When parsing an address in `MessageBuilder` we surround the recipient name with double quotes instead of single quotes.
17
+
18
+ ## 2.3.1
19
+
20
+ ### Fixed
21
+
22
+ - Make sure to reset the `MultipartStreamBuilder` after a stream is built.
23
+
24
+ ## 2.3.0
25
+
26
+ ### Added
27
+
28
+ - Support for sending messages with Mime. `$mailgun->messages()->sendMime()`
29
+
30
+ ## 2.2.0
31
+
32
+ This version contains a new way of using the API. Each endpoint return a domain object and the
33
+ endpoints are grouped like the API documentation.
34
+
35
+ ### Added
36
+
37
+ - Api classes in Mailgun\Api\*
38
+ - Api models/responses in Mailgun\Model\*
39
+ - Added Hydrators to hydrate PSR-7 responses to arrays or domain objects.
40
+ - All exceptions extend `Mailgun\Exception`.
41
+ - New exceptions in `Mailgun\Exception` namespace.
42
+ - Added `HttpClientConfigurator` to configure the HTTP client.
43
+ - Added HttpClient plugins `History` and `ReplaceUriPlugin`
44
+ - Assertions with Webmozart\Assert
45
+ - `Mailgun\Mailgun::getLastResponse()`
46
+ - `Mailgun\Connection\RestClient::getAttachment($url)`
47
+ - Clear license information
48
+
49
+ ### Fixed
50
+
51
+ - Fix disordered POST parameters. We do not use array syntax.
52
+ - Code styles
53
+
54
+ ### Deprecated
55
+
56
+ The following classes will be removed in version 3.0.
57
+
58
+ - `Mailgun\Connection\Exceptions\GenericHTTPError`
59
+ - `Mailgun\Connection\Exceptions\InvalidCredentials`
60
+ - `Mailgun\Connection\Exceptions\MissingEndpoint`
61
+ - `Mailgun\Connection\Exceptions\MissingRequiredParameters`
62
+ - `Mailgun\Connection\Exceptions\NoDomainsConfigured`
63
+ - `Mailgun\Connection\RestClient`
64
+ - `Mailgun\Constants\Api`
65
+ - `Mailgun\Constants\ExceptionMessages`
66
+ - `Mailgun\Mailgun::$resetClient`
67
+ - `Mailgun\Mailgun::sendMessage()`
68
+ - `Mailgun\Mailgun::verifyWebhookSignature()`
69
+ - `Mailgun\Mailgun::post()`
70
+ - `Mailgun\Mailgun::get()`
71
+ - `Mailgun\Mailgun::delete()`
72
+ - `Mailgun\Mailgun::put()`
73
+ - `Mailgun\Mailgun::setApiVersion()`
74
+ - `Mailgun\Mailgun::setSslEnabled()`
75
+ - `Mailgun\Mailgun::MessageBuilder()`
76
+ - `Mailgun\Mailgun::OptInHandler()`
77
+ - `Mailgun\Mailgun::BatchMessage()`
78
+
79
+ ## 2.1.2
80
+
81
+ - Bug fixes with multiple recipients, inline images and attachments.
82
+ - Added more tests
83
+ - Using PSR-2 code style
84
+
85
+ ## 2.1.1
86
+
87
+ - Require php-http/message (#142)
88
+ - Declare BatchMessage::endpointUrl (#112)
89
+
90
+ ## 2.1.0
91
+
92
+ - Strict comparison of hash (#117)
93
+ - No dependency on Guzzle/PSR7 (#139)
94
+ - Build URL string form an array (#138)
95
+ - Docblock update (#134)
96
+ - Minor fixes (#90, #121, #98)
97
+
98
+ ## 2.0
99
+
100
+ - Migrated to PHP-HTTP (#94)
101
+ - Dropped support for PHP 5.4.
102
+
103
+ ## 1.8.0
104
+
105
+ - Updated to Guzzle5 (#79)
106
+ - Updated default API version from v2 to v3 (#75)
107
+ - Show response message on 400, 401 and 404. (#72)
108
+ - PHP DocBlocks, Constants Changes, and Minor Refactors (#66)
109
+ - Added PHP 7.0 support for Travis-CI, removed PHP 5.3 support (#79)
110
+
111
+ ## 1.7.2
112
+
113
+ - Added webhook signature verification - (#50)
114
+ - Test PHP 5.6 and HHVM - (#51)
115
+ - Improved error handling - (#48)
116
+ - Fixed attachment handling in Message Builder - (#56)
117
+ - Allow any data type in custom data - (#57)
118
+ - Return non-JSON response data - (#60)
119
+ - Removed legacy closing braces - (#64)
120
+
121
+ ## 1.7.1
122
+
123
+ - Improved security of OptInHandler - (#31)
124
+ - Fixed typo for including an Exception - (#41)
125
+ - Fixed Mocks, removed unnecessary code, applied styling - (#44 & #42)
126
+ - Less restrictive Guzzle requirement - (#45)
127
+
128
+ ## 1.7 (2014-1-30)
129
+
130
+ Bugfixes:
131
+ - patched bug for attachments related to duplicate aggregator bug in Guzzle (#32 @travelton)
132
+
133
+ ## 1.6 (2014-1-13)
134
+
135
+ Enhancement:
136
+ - adjust file attachment/inline name (#21 @travelton)
137
+
138
+ Bugfixes:
139
+ - fixed issue with unordered route actions (#23 @travelton)
140
+
141
+ ## 1.5 (2013-12-13)
142
+
143
+ Enhancement:
144
+ - added ability to define non-https endpoint for debugging purposes (#23 @travelton)
145
+
146
+ ## 1.4 (2013-10-16)
147
+
148
+ Bugfixes:
149
+ - template IDs were missing from recipient-variables (#15 @travelton)
150
+ - batch jobs trigger on to, cc, and bcc (#18 @travelton)
151
+ - batch jobs include recipient-variables for to, cc, and bcc (#18 @travelton)
152
+ - added method to return message-ids, for easier access (#19 @travelton)
153
+
154
+ ## 1.3 (2013-09-12)
155
+
156
+ Bugfixes:
157
+
158
+ - relaxed Guzzle requirement (#7 @travelton)
159
+ - fixed reply-to bug (#9 @travelton)
160
+
161
+ ## 1.2 (2013-09-05)
162
+
163
+ Bugfixes:
164
+
165
+ - fixed exception handling constants (@travelton)
166
+ - fixed MessageBuilder $baseAddress return (#1 @yoye)
167
+ - adjusted scope of recipient-variables (#3 @yoye)
168
+ - fixed misspellings of Exceptions (#2 @dboggus)
169
+ - undefined DEFAULT_TIME_ZONE (#4 @yoye)
170
+ - added message IDs to return for BatchMessage (@travelton)
171
+
172
+ ## 1.1 (2013-08-21)
173
+
174
+ Initial Release!
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/LICENSE ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ of this software and associated documentation files (the "Software"), to deal
3
+ in the Software without restriction, including without limitation the rights
4
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
+ copies of the Software, and to permit persons to whom the Software is
6
+ furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in
9
+ all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17
+ THE SOFTWARE.
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/README.md ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Mailgun PHP client
2
+
3
+ This is the Mailgun PHP SDK. This SDK contains methods for easily interacting
4
+ with the Mailgun API.
5
+ Below are examples to get you started. For additional examples, please see our
6
+ official documentation
7
+ at http://documentation.mailgun.com
8
+
9
+ [![Latest Version](https://img.shields.io/github/release/mailgun/mailgun-php.svg?style=flat-square)](https://github.com/mailgun/mailgun-php/releases)
10
+ [![Build Status](https://img.shields.io/travis/mailgun/mailgun-php/master.svg?style=flat-square)](https://travis-ci.org/mailgun/mailgun-php)
11
+ [![StyleCI](https://styleci.io/repos/11654443/shield?branch=master)](https://styleci.io/repos/11654443)
12
+ [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/mailgun/mailgun-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/mailgun/mailgun-php)
13
+ [![Quality Score](https://img.shields.io/scrutinizer/g/mailgun/mailgun-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/mailgun/mailgun-php)
14
+ [![Total Downloads](https://img.shields.io/packagist/dt/mailgun/mailgun-php.svg?style=flat-square)](https://packagist.org/packages/mailgun/mailgun-php)
15
+ [![Join the chat at https://gitter.im/mailgun/mailgun-php](https://badges.gitter.im/mailgun/mailgun-php.svg)](https://gitter.im/mailgun/mailgun-php?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
16
+
17
+ **This is the documentation for dev-master. You find documentation for the latest stable
18
+ release [here](https://github.com/mailgun/mailgun-php/tree/v2.1.2).**
19
+
20
+ ## Installation
21
+
22
+ To install the SDK, you will need to be using [Composer](http://getcomposer.org/)
23
+ in your project.
24
+ If you aren't using Composer yet, it's really simple! Here's how to install
25
+ composer:
26
+
27
+ ```bash
28
+ curl -sS https://getcomposer.org/installer | php
29
+ ```
30
+
31
+ The Mailgun api client is not hard coupled to Guzzle or any other library that sends HTTP messages. It uses an abstraction
32
+ called HTTPlug. This will give you the flexibilty to choose what PSR-7 implementation and HTTP client to use.
33
+
34
+ If you just want to get started quickly you should run the following command:
35
+
36
+ ```bash
37
+ php composer.phar require mailgun/mailgun-php php-http/curl-client guzzlehttp/psr7
38
+ ```
39
+
40
+ ### Why requiring so many packages?
41
+
42
+ Mailgun has a dependency on the virtual package
43
+ [php-http/client-implementation](https://packagist.org/providers/php-http/client-implementation) which requires to you install **an** adapter, but we do not care which one. That is an implementation detail in your application. We also need **a** PSR-7 implementation and **a** message factory.
44
+
45
+ You do not have to use the `php-http/curl-client` if you do not want to. You may use the `php-http/guzzle6-adapter`. Read more about the virtual packages, why this is a good idea and about the flexibility it brings at the [HTTPlug docs](http://docs.php-http.org/en/latest/httplug/users.html).
46
+
47
+ ## Usage
48
+
49
+ You should always use Composer's autoloader in your application to automatically load the your dependencies. All examples below assumes you've already included this in your file:
50
+
51
+ ```php
52
+ require 'vendor/autoload.php';
53
+ use Mailgun\Mailgun;
54
+ ```
55
+
56
+ Here's how to send a message using the SDK:
57
+
58
+ ```php
59
+ # First, instantiate the SDK with your API credentials
60
+ $mg = Mailgun::create('key-example');
61
+
62
+ # Now, compose and send your message.
63
+ $mg->messages()->send('example.com', [
64
+ 'from' => 'bob@example.com',
65
+ 'to' => 'sally@example.com',
66
+ 'subject' => 'The PHP SDK is awesome!',
67
+ 'text' => 'It is so simple to send a message.'
68
+ ]);
69
+ ```
70
+
71
+ ### All usage examples
72
+
73
+ You find more detailed documentation at in [/doc](doc/index.md) and on
74
+ [https://documentation.mailgun.com](https://documentation.mailgun.com/api_reference.html).
75
+
76
+ ### Response
77
+
78
+ The results of a API call is, by default, a domain object. This will make it easy
79
+ to understand the response without reading the documentation. One can just read the
80
+ doc blocks on the response classes. This provide an excellent IDE integration.
81
+
82
+ ```php
83
+ $mg = Mailgun::create('key-example');
84
+ $dns = $mg->domains()->show('example.com')->getInboundDNSRecords();
85
+
86
+ foreach ($dns as $record) {
87
+ echo $record->getType();
88
+ }
89
+ ```
90
+
91
+ If you rather be working with array then object you can inject the `ArrayHydrator`
92
+ to the Mailgun class.
93
+
94
+ ```php
95
+ use Mailgun\Hydrator\ArrayHydrator;
96
+
97
+ $configurator = new HttpClientConfigurator();
98
+ $configurator->setApiKey('key-example');
99
+
100
+ $mg = Mailgun::configure($configurator, new ArrayHydrator());
101
+ $data = $mg->domains()->show('example.com');
102
+
103
+ foreach ($data['receiving_dns_records'] as $record) {
104
+ echo isset($record['record_type']) ? $record['record_type'] : null;
105
+ }
106
+ ```
107
+
108
+ You could also use the `NoopHydrator` to get a PSR7 Response returned from
109
+ the API calls.
110
+
111
+ **Warning: When using `NoopHydrator` there will be no exceptions on a non-200 response.**
112
+
113
+ ### Debugging
114
+
115
+ Debugging the PHP SDK can be really helpful when things aren't working quite right.
116
+ To debug the SDK, here are some suggestions:
117
+
118
+ Set the endpoint to Mailgun's Postbin. A Postbin is a web service that allows you to
119
+ post data, which is then displayed through a browser. This allows you to quickly determine
120
+ what is actually being transmitted to Mailgun's API.
121
+
122
+ **Step 1 - Create a new Postbin.**
123
+ Go to http://bin.mailgun.net. The Postbin will generate a special URL. Save that URL.
124
+
125
+ **Step 2 - Instantiate the Mailgun client using Postbin.**
126
+
127
+ *Tip: The bin id will be the URL part after bin.mailgun.net. It will be random generated letters and numbers.
128
+ For example, the bin id in this URL, http://bin.mailgun.net/aecf68de, is "aecf68de".*
129
+
130
+ ```php
131
+ $configurator = new HttpClientConfigurator();
132
+ $configurator->setEndpoint('http://bin.mailgun.net/aecf68de');
133
+ $configurator->setDebug(true);
134
+ $mg = Mailgun::configure($configurator);
135
+
136
+ # Now, compose and send your message.
137
+ $mg->messages()->send('example.com', [
138
+ 'from' => 'bob@example.com',
139
+ 'to' => 'sally@example.com',
140
+ 'subject' => 'The PHP SDK is awesome!',
141
+ 'text' => 'It is so simple to send a message.'
142
+ ]);
143
+ ```
144
+ ### Additional Info
145
+
146
+ For usage examples on each API endpoint, head over to our official documentation
147
+ pages.
148
+
149
+ This SDK includes a [Message Builder](src/Mailgun/Messages/README.md),
150
+ [Batch Message](src/Mailgun/Messages/README.md) and [Opt-In Handler](src/Mailgun/Lists/README.md) component.
151
+
152
+ Message Builder allows you to quickly create the array of parameters, required
153
+ to send a message, by calling a methods for each parameter.
154
+ Batch Message is an extension of Message Builder, and allows you to easily send
155
+ a batch message job within a few seconds. The complexity of
156
+ batch messaging is eliminated!
157
+
158
+ ## Framework integration
159
+
160
+ If you are using a framework you might consider these composer packages to make the framework integration easier.
161
+
162
+ * [tehplague/swiftmailer-mailgun-bundle](https://github.com/tehplague/swiftmailer-mailgun-bundle) for Symfony
163
+ * [Bogardo/Mailgun](https://github.com/Bogardo/Mailgun) for Laravel
164
+ * [katanyoo/yii2-mailgun-mailer](https://github.com/katanyoo/yii2-mailgun-mailer) for Yii2
165
+
166
+ ## Contribute
167
+
168
+ We are currently building a new object oriented API client. Feel free to contribute in any way. As an example you may:
169
+ * Trying out dev-master the code
170
+ * Create issues if you find problems
171
+ * Reply to other people's issues
172
+ * Review PRs
173
+ * Write PR. You find our current milestone [here](https://github.com/mailgun/mailgun-php/milestone/1)
174
+
175
+ ### Running the test code
176
+
177
+ If you want to run the tests you should run the following commands:
178
+
179
+ ```terminal
180
+ git clone git@github.com:mailgun/mailgun-php.git
181
+ cd mailgun-php
182
+ composer update
183
+ composer test
184
+ ```
185
+
186
+ ## Support and Feedback
187
+
188
+ Be sure to visit the Mailgun official
189
+ [documentation website](http://documentation.mailgun.com/) for additional
190
+ information about our API.
191
+
192
+ If you find a bug, please submit the issue in Github directly.
193
+ [Mailgun-PHP Issues](https://github.com/mailgun/mailgun-php/issues)
194
+
195
+ As always, if you need additional assistance, drop us a note through your Control Panel at
196
+ [https://mailgun.com/cp/support](https://mailgun.com/cp/support).
197
+
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/composer.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "mailgun/mailgun-php",
3
+ "description": "The Mailgun SDK provides methods for all API functions.",
4
+ "require": {
5
+ "php": "^5.5|^7.0",
6
+ "php-http/httplug": "^1.0",
7
+ "php-http/multipart-stream-builder": "^1.0",
8
+ "php-http/message": "^1.0",
9
+ "php-http/client-common": "^1.1",
10
+ "php-http/discovery": "^1.0",
11
+ "webmozart/assert": "^1.2"
12
+ },
13
+ "require-dev": {
14
+ "phpunit/phpunit": "~4.8",
15
+ "php-http/guzzle6-adapter": "^1.0",
16
+ "guzzlehttp/psr7": "^1.4"
17
+ },
18
+ "autoload": {
19
+ "psr-0": {
20
+ "Mailgun": "src/"
21
+ }
22
+ },
23
+ "autoload-dev": {
24
+ "psr-4": {
25
+ "Mailgun\\Tests\\": "tests/"
26
+ }
27
+ },
28
+ "license": "MIT",
29
+ "authors": [
30
+ {
31
+ "name": "Travis Swientek",
32
+ "email": "travis@mailgunhq.com"
33
+ }
34
+ ],
35
+ "scripts": {
36
+ "test": "vendor/bin/phpunit --testsuite unit && vendor/bin/phpunit --testsuite functional",
37
+ "test-all": "vendor/bin/phpunit --testsuite all",
38
+ "test-integration": "vendor/bin/phpunit --testsuite integration",
39
+ "test-coverage": "vendor/bin/phpunit --testsuite all --coverage-text --coverage-clover=build/coverage.xml"
40
+ }
41
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/attachments.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Attachments
2
+
3
+ You may attach a file from memory or by a file path.
4
+
5
+ ## From file path
6
+
7
+ ```php
8
+ $mg->message()->send('example.com', [
9
+ 'from' => 'bob@example.com',
10
+ 'to' => 'sally@example.com',
11
+ 'subject' => 'Test file path attachments',
12
+ 'text' => 'Test',
13
+ 'attachment' => [
14
+ ['filePath'=>'/tmp/foo.jpg', 'filename'=>'test.jpg']
15
+ ]
16
+ ]);
17
+ ```
18
+ ## From memory
19
+
20
+ ```php
21
+ // Some how load the file to memory
22
+ $binaryFile = '[Binary data]';
23
+
24
+ $mg->message()->send('example.com', [
25
+ 'from' => 'bob@example.com',
26
+ 'to' => 'sally@example.com',
27
+ 'subject' => 'Test memory attachments',
28
+ 'text' => 'Test',
29
+ 'attachment' => [
30
+ ['fileContent'=>$binaryFile, 'filename'=>'test.jpg']
31
+ ]
32
+ ]);
33
+ ```
34
+
35
+ ## Inline attachments
36
+
37
+ ```php
38
+ $mg->message()->send('example.com', [
39
+ 'from' => 'bob@example.com',
40
+ 'to' => 'sally@example.com',
41
+ 'subject' => 'Test inline attachments',
42
+ 'text' => 'Test',
43
+ 'inline' => [
44
+ ['filePath'=>'/tmp/foo.jpg', 'filename'=>'test.jpg']
45
+ ]
46
+ ]);
47
+ ```
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/index.md ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # API documentation
2
+
3
+ This page will document the API classes and ways to properly use the API. These resources will eventually move to
4
+ the official documentation at [https://documentation.mailgun.com](https://documentation.mailgun.com/api_reference.html).
5
+
6
+ Other relevant documentation pages might be:
7
+
8
+ * [Attachments](attachments.md)
9
+ * [Pagination](pagination.md)
10
+ * [Message Builder](src/Mailgun/Messages/README.md) (Legacy code)
11
+ * [Batch Message](src/Mailgun/Messages/README.md) (Legacy code)
12
+ * [Opt-In Handler](src/Mailgun/Lists/README.md) (Legacy code)
13
+
14
+ ## Domain API
15
+
16
+ #### Get a list of all domains
17
+
18
+ ```php
19
+ $mailgun->domains()->index();
20
+ ```
21
+
22
+ #### Show a single domains
23
+
24
+ ```php
25
+ $mailgun->domains()->show('example.com');
26
+ ```
27
+
28
+ #### Create a new domain
29
+
30
+ ```php
31
+ $mailgun->domains()->create('new.example.com', 'password', 'disable', '*');
32
+ ```
33
+
34
+ #### Delete a domain
35
+
36
+ ```php
37
+ $mailgun->domains()->delete('example.com');
38
+ ```
39
+
40
+ #### Get credentials for a domain
41
+
42
+ ```php
43
+ $mailgun->domains()->credentials('example.com');
44
+ ```
45
+
46
+ #### Create credentials for a domain
47
+
48
+ ```php
49
+ $mailgun->domains()->createCredential('example.com', 'login', 'password');
50
+ ```
51
+
52
+ #### Update credentials for a domain
53
+
54
+ ```php
55
+ $mailgun->domains()->updateCredential('example.com', 'login', 'password');
56
+ ```
57
+
58
+ #### Delete credentials for a domain
59
+
60
+ ```php
61
+ $mailgun->domains()->deleteCredential('example.com', 'login');
62
+ ```
63
+
64
+ #### Get connection for a domain
65
+
66
+ ```php
67
+ $mailgun->domains()->connection('example.com');
68
+ ```
69
+
70
+ #### Update connection for a domain
71
+
72
+ ```php
73
+ $mailgun->domains()->updateConnection('example.com', true, false);
74
+ ```
75
+
76
+ ## Event API
77
+
78
+ #### Get all events for a domain
79
+ ```php
80
+ $mailgun->events()->get('example.com');
81
+ ```
82
+
83
+ ## Message API
84
+
85
+ #### Send a message
86
+ ```php
87
+ $parameters = [
88
+ 'from' => 'bob@example.com',
89
+ 'to' => 'sally@example.com',
90
+ 'subject' => 'The PHP SDK is awesome!',
91
+ 'text' => 'It is so simple to send a message.'
92
+ ];
93
+ $mailgun->messages()->send('example.com', $parameters);
94
+ ```
95
+ #### Send a message with Mime
96
+
97
+ Below in an example how to create a Mime message with SwiftMailer.
98
+
99
+ ```php
100
+ $message = \Swift_Message::newInstance('Mail Subject');
101
+ $message->setFrom(['from@exemple.com' => 'Example Inc']);
102
+ $message->setTo(['user0gmail.com' => 'User 0', 'user1@hotmail.com' => 'User 1']);
103
+ // $message->setBcc('admin@example.com'); Do not do this, BCC will be visible for all receipients if you do.
104
+ $message->setCc('invoice@example.com');
105
+
106
+ $messageBody = 'Look at the <b>fancy</b> HTML body.';
107
+ $message->setBody($messageBody, 'text/html');
108
+
109
+ // We need all "tos". Incluce the BCC here.
110
+ $to = ['admin@example.com', 'user0gmail.com', 'user1@hotmail.com', 'invoice@example.com']
111
+
112
+ // Send the message
113
+ $mailgun->messages()->sendMime('example.com', $to, $message->toString());
114
+ ```
115
+
116
+ #### Show a stored message
117
+
118
+ If you got an URL to a stored message you may get the details by:
119
+
120
+ ```php
121
+ $url = // ...
122
+ $mailgun->messages()->show($url);
123
+ ```
124
+
125
+ ## Route API
126
+
127
+ #### Show all routes
128
+
129
+ ```php
130
+ $mailgun->routes()->index();
131
+ ```
132
+
133
+ #### Show a routes
134
+
135
+ Get a route by its ID
136
+
137
+ ```php
138
+ $mailgun->routes()->show(4711);
139
+ ```
140
+ #### Create a route
141
+
142
+ ```php
143
+ $expression = "match_recipient('.*@gmail.com')";
144
+ $actions = ["forward('alice@example.com')"];
145
+ $description = 'Test route';
146
+
147
+ $mailgun->routes()->create($expression, $actions, $description);
148
+ ```
149
+
150
+ #### Update a route
151
+
152
+ ```php
153
+ $expression = "match_recipient('.*@gmail.com')";
154
+ $actions = ["forward('alice@example.com')"];
155
+ $description = 'Test route';
156
+
157
+ $mailgun->routes()->update(4711, $expression, $actions, $description);
158
+ ```
159
+
160
+ #### Delete a route
161
+ ```php
162
+ $mailgun->routes()->delete(4711);
163
+ ```
164
+
165
+ ## Stats API
166
+
167
+ #### Get total stats for a domain
168
+ ```php
169
+ $mailgun->stats()->total('example.com');
170
+ ```
171
+
172
+ #### Get all stats for a domain
173
+ ```php
174
+ $mailgun->stats()->all('example.com');
175
+ ```
176
+
177
+ ## Suppression API
178
+
179
+ The suppression API consists of 3 parts; `Bounce`, `Complaint` and `Unsubscribe`.
180
+
181
+ ### Bounce API
182
+ #### Get all bounces
183
+ ```php
184
+ $mailgun->suppressions()->bounces()->index('example.com');
185
+ ```
186
+
187
+ #### Show bounces for a specific address
188
+ ```php
189
+ $mailgun->suppressions()->bounces()->show('example.com', 'alice@gmail.com');
190
+ ```
191
+
192
+ #### Create a bounce
193
+ ```php
194
+ $mailgun->suppressions()->bounces()->create('example.com', 'alice@gmail.com');
195
+ ```
196
+
197
+ #### Delete a bounce
198
+ ```php
199
+ $mailgun->suppressions()->bounces()->delete('example.com', 'alice@gmail.com');
200
+ ```
201
+
202
+ #### Delete all bounces
203
+ ```php
204
+ $mailgun->suppressions()->bounces()->deleteAll('example.com');
205
+ ```
206
+
207
+ ### Complaint API
208
+ #### Get all complaints
209
+ ```php
210
+ $mailgun->suppressions()->complaints->index('example.com');
211
+ ```
212
+
213
+ #### Show complaints for a specific address
214
+ ```php
215
+ $mailgun->suppressions()->complaints()->show('example.com', 'alice@gmail.com');
216
+ ```
217
+
218
+ #### Create a complaint
219
+ ```php
220
+ $mailgun->suppressions()->complaints()->create('example.com', 'alice@gmail.com');
221
+ ```
222
+
223
+ #### Delete a complaint
224
+ ```php
225
+ $mailgun->suppressions()->complaints()->delete('example.com', 'alice@gmail.com');
226
+ ```
227
+
228
+ #### Delete all complaints
229
+ ```php
230
+ $mailgun->suppressions()->complaints()->deleteAll('example.com');
231
+ ```
232
+
233
+ ## Unsubscribe API
234
+
235
+ #### Get all unsubscriptions
236
+ ```php
237
+ $mailgun->suppressions()->unsubscribes()->index('example.com');
238
+ ```
239
+
240
+ #### Show unsubscriptions for a specific address
241
+ ```php
242
+ $mailgun->suppressions()->unsubscribes()->show('example.com', 'alice@gmail.com');
243
+ ```
244
+
245
+ #### Create an unsubscription
246
+ ```php
247
+ $mailgun->suppressions()->unsubscribes()->create('example.com', 'alice@gmail.com');
248
+ ```
249
+
250
+ #### Delete an unsubscription
251
+ ```php
252
+ $mailgun->suppressions()->unsubscribes()->delete('example.com', 'alice@gmail.com');
253
+ ```
254
+
255
+ #### Delete all unsubscriptions
256
+ ```php
257
+ $mailgun->suppressions()->unsubscribes()->deleteAll('example.com');
258
+ ```
259
+
260
+ ## Tag API
261
+
262
+ #### Show all tags
263
+ ```php
264
+ $mailgun->tags()->index('example.com');
265
+ ```
266
+
267
+ #### Show a single tag
268
+ ```php
269
+ $mailgun->tags()->show('example.com', 'foo');
270
+ ```
271
+
272
+ #### Update a tag
273
+ ```php
274
+ $mailgun->tags()->update('example.com', 'foo', 'description');
275
+ ```
276
+
277
+ #### Show stats for a tag
278
+ ```php
279
+ $mailgun->tags()->stats('example.com', 'foo');
280
+ ```
281
+
282
+ #### Delete a tag
283
+ ```php
284
+ $mailgun->tags()->delete('example.com', 'foo');
285
+ ```
286
+
287
+ ## Webhook API
288
+ #### Verify webhook signature
289
+ ```php
290
+
291
+ $timestamp = $_POST['timestamp'];
292
+ $token = $_POST['token'];
293
+ $signature = $_POST['signature'];
294
+
295
+ $mailgun = Maingun::create('my_api_key');
296
+ $valid = $mailgun->webhooks()->verifyWebhookSignature($timestamp, $token, $signature);
297
+
298
+ if (!$valid) {
299
+ // Create a 403 response
300
+
301
+ exit();
302
+ }
303
+
304
+ // The signature is valid
305
+ ```
306
+
307
+ #### Show all webhooks
308
+ ```php
309
+ $mailgun->webhooks()->index('example.com');
310
+ ```
311
+
312
+ #### Show a single webhooks
313
+ ```php
314
+ $mailgun->webhooks()->show('example.com', 'accept');
315
+ ```
316
+
317
+ #### Create a webhooks
318
+ ```php
319
+ $mailgun->webhooks()->create('example.com', 'accept', 'https://www.exmple.com/webhook');
320
+ ```
321
+
322
+ #### Update a webhooks
323
+ ```php
324
+ $mailgun->webhooks()->update('example.com', 4711, 'https://www.exmple.com/webhook');
325
+ ```
326
+
327
+ #### Delete a webhooks
328
+ ```php
329
+ $mailgun->webhooks()->delete('example.com', 4711);
330
+ ```
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/pagination.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pagination
2
+
3
+ Some API endpoints do support pagination.
4
+
5
+ ```php
6
+
7
+ /** @var Mailgun\Model\Tag\IndexReponse $response */
8
+ $reponse = $mailgun->tags()->index('example.com');
9
+
10
+ // Parse through the first response
11
+ // ...
12
+
13
+ $nextResponse = $mailgun->tags()->nextPage($response);
14
+ $previousResponse = $mailgun->tags()->previousPage($response);
15
+ $firstResponse = $mailgun->tags()->firstPage($response);
16
+ $lastResponse = $mailgun->tags()->lastPage($response);
17
+ ```
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Domain.php ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Mailgun\Assert;
13
+ use Mailgun\Model\Domain\ConnectionResponse;
14
+ use Mailgun\Model\Domain\CreateCredentialResponse;
15
+ use Mailgun\Model\Domain\CreateResponse;
16
+ use Mailgun\Model\Domain\CredentialResponse;
17
+ use Mailgun\Model\Domain\DeleteCredentialResponse;
18
+ use Mailgun\Model\Domain\DeleteResponse;
19
+ use Mailgun\Model\Domain\IndexResponse;
20
+ use Mailgun\Model\Domain\ShowResponse;
21
+ use Mailgun\Model\Domain\UpdateConnectionResponse;
22
+ use Mailgun\Model\Domain\UpdateCredentialResponse;
23
+ use Psr\Http\Message\ResponseInterface;
24
+
25
+ /**
26
+ * {@link https://documentation.mailgun.com/api-domains.html}.
27
+ *
28
+ * @author Sean Johnson <sean@mailgun.com>
29
+ */
30
+ class Domain extends HttpApi
31
+ {
32
+ /**
33
+ * Returns a list of domains on the account.
34
+ *
35
+ * @param int $limit
36
+ * @param int $skip
37
+ *
38
+ * @return IndexResponse
39
+ */
40
+ public function index($limit = 100, $skip = 0)
41
+ {
42
+ Assert::integer($limit);
43
+ Assert::integer($skip);
44
+
45
+ $params = [
46
+ 'limit' => $limit,
47
+ 'skip' => $skip,
48
+ ];
49
+
50
+ $response = $this->httpGet('/v3/domains', $params);
51
+
52
+ return $this->hydrateResponse($response, IndexResponse::class);
53
+ }
54
+
55
+ /**
56
+ * Returns a single domain.
57
+ *
58
+ * @param string $domain Name of the domain.
59
+ *
60
+ * @return ShowResponse|array|ResponseInterface
61
+ */
62
+ public function show($domain)
63
+ {
64
+ Assert::stringNotEmpty($domain);
65
+
66
+ $response = $this->httpGet(sprintf('/v3/domains/%s', $domain));
67
+
68
+ return $this->hydrateResponse($response, ShowResponse::class);
69
+ }
70
+
71
+ /**
72
+ * Creates a new domain for the account.
73
+ * See below for spam filtering parameter information.
74
+ * {@link https://documentation.mailgun.com/user_manual.html#um-spam-filter}.
75
+ *
76
+ * @param string $domain Name of the domain.
77
+ * @param string $smtpPass Password for SMTP authentication.
78
+ * @param string $spamAction `disable` or `tag` - inbound spam filtering.
79
+ * @param bool $wildcard Domain will accept email for subdomains.
80
+ *
81
+ * @return CreateResponse|array|ResponseInterface
82
+ */
83
+ public function create($domain, $smtpPass, $spamAction, $wildcard)
84
+ {
85
+ Assert::stringNotEmpty($domain);
86
+ Assert::stringNotEmpty($smtpPass);
87
+ // TODO(sean.johnson): Extended spam filter input validation.
88
+ Assert::stringNotEmpty($spamAction);
89
+ Assert::boolean($wildcard);
90
+
91
+ $params = [
92
+ 'name' => $domain,
93
+ 'smtp_password' => $smtpPass,
94
+ 'spam_action' => $spamAction,
95
+ 'wildcard' => $wildcard,
96
+ ];
97
+
98
+ $response = $this->httpPost('/v3/domains', $params);
99
+
100
+ return $this->hydrateResponse($response, CreateResponse::class);
101
+ }
102
+
103
+ /**
104
+ * Removes a domain from the account.
105
+ * WARNING: This action is irreversible! Be cautious!
106
+ *
107
+ * @param string $domain Name of the domain.
108
+ *
109
+ * @return DeleteResponse|array|ResponseInterface
110
+ */
111
+ public function delete($domain)
112
+ {
113
+ Assert::stringNotEmpty($domain);
114
+
115
+ $response = $this->httpDelete(sprintf('/v3/domains/%s', $domain));
116
+
117
+ return $this->hydrateResponse($response, DeleteResponse::class);
118
+ }
119
+
120
+ /**
121
+ * Returns a list of SMTP credentials for the specified domain.
122
+ *
123
+ * @param string $domain Name of the domain.
124
+ * @param int $limit Number of credentials to return
125
+ * @param int $skip Number of credentials to omit from the list
126
+ *
127
+ * @return CredentialResponse
128
+ */
129
+ public function credentials($domain, $limit = 100, $skip = 0)
130
+ {
131
+ Assert::stringNotEmpty($domain);
132
+ Assert::integer($limit);
133
+ Assert::integer($skip);
134
+
135
+ $params = [
136
+ 'limit' => $limit,
137
+ 'skip' => $skip,
138
+ ];
139
+
140
+ $response = $this->httpGet(sprintf('/v3/domains/%s/credentials', $domain), $params);
141
+
142
+ return $this->hydrateResponse($response, CredentialResponse::class);
143
+ }
144
+
145
+ /**
146
+ * Create a new SMTP credential pair for the specified domain.
147
+ *
148
+ * @param string $domain Name of the domain.
149
+ * @param string $login SMTP Username.
150
+ * @param string $password SMTP Password. Length min 5, max 32.
151
+ *
152
+ * @return CreateCredentialResponse|array|ResponseInterface
153
+ */
154
+ public function createCredential($domain, $login, $password)
155
+ {
156
+ Assert::stringNotEmpty($domain);
157
+ Assert::stringNotEmpty($login);
158
+ Assert::stringNotEmpty($password);
159
+ Assert::lengthBetween($password, 5, 32, 'SMTP password must be between 5 and 32 characters.');
160
+
161
+ $params = [
162
+ 'login' => $login,
163
+ 'password' => $password,
164
+ ];
165
+
166
+ $response = $this->httpPost(sprintf('/v3/domains/%s/credentials', $domain), $params);
167
+
168
+ return $this->hydrateResponse($response, CreateCredentialResponse::class);
169
+ }
170
+
171
+ /**
172
+ * Update a set of SMTP credentials for the specified domain.
173
+ *
174
+ * @param string $domain Name of the domain.
175
+ * @param string $login SMTP Username.
176
+ * @param string $pass New SMTP Password. Length min 5, max 32.
177
+ *
178
+ * @return UpdateCredentialResponse|array|ResponseInterface
179
+ */
180
+ public function updateCredential($domain, $login, $pass)
181
+ {
182
+ Assert::stringNotEmpty($domain);
183
+ Assert::stringNotEmpty($login);
184
+ Assert::stringNotEmpty($pass);
185
+ Assert::lengthBetween($pass, 5, 32, 'SMTP password must be between 5 and 32 characters.');
186
+
187
+ $params = [
188
+ 'password' => $pass,
189
+ ];
190
+
191
+ $response = $this->httpPut(sprintf('/v3/domains/%s/credentials/%s', $domain, $login), $params);
192
+
193
+ return $this->hydrateResponse($response, UpdateCredentialResponse::class);
194
+ }
195
+
196
+ /**
197
+ * Remove a set of SMTP credentials from the specified domain.
198
+ *
199
+ * @param string $domain Name of the domain.
200
+ * @param string $login SMTP Username.
201
+ *
202
+ * @return DeleteCredentialResponse|array|ResponseInterface
203
+ */
204
+ public function deleteCredential($domain, $login)
205
+ {
206
+ Assert::stringNotEmpty($domain);
207
+ Assert::stringNotEmpty($login);
208
+
209
+ $response = $this->httpDelete(
210
+ sprintf(
211
+ '/v3/domains/%s/credentials/%s',
212
+ $domain,
213
+ $login
214
+ )
215
+ );
216
+
217
+ return $this->hydrateResponse($response, DeleteCredentialResponse::class);
218
+ }
219
+
220
+ /**
221
+ * Returns delivery connection settings for the specified domain.
222
+ *
223
+ * @param string $domain Name of the domain.
224
+ *
225
+ * @return ConnectionResponse|ResponseInterface
226
+ */
227
+ public function connection($domain)
228
+ {
229
+ Assert::stringNotEmpty($domain);
230
+
231
+ $response = $this->httpGet(sprintf('/v3/domains/%s/connection', $domain));
232
+
233
+ return $this->hydrateResponse($response, ConnectionResponse::class);
234
+ }
235
+
236
+ /**
237
+ * Updates the specified delivery connection settings for the specified domain.
238
+ * If a parameter is passed in as null, it will not be updated.
239
+ *
240
+ * @param string $domain Name of the domain.
241
+ * @param bool|null $requireTLS Enforces that messages are sent only over a TLS connection.
242
+ * @param bool|null $noVerify Disables TLS certificate and hostname verification.
243
+ *
244
+ * @return UpdateConnectionResponse|array|ResponseInterface
245
+ */
246
+ public function updateConnection($domain, $requireTLS, $noVerify)
247
+ {
248
+ Assert::stringNotEmpty($domain);
249
+ Assert::nullOrBoolean($requireTLS);
250
+ Assert::nullOrBoolean($noVerify);
251
+
252
+ $params = [];
253
+
254
+ if (null !== $requireTLS) {
255
+ $params['require_tls'] = $requireTLS ? 'true' : 'false';
256
+ }
257
+
258
+ if (null !== $noVerify) {
259
+ $params['skip_verification'] = $noVerify ? 'true' : 'false';
260
+ }
261
+
262
+ $response = $this->httpPut(sprintf('/v3/domains/%s/connection', $domain), $params);
263
+
264
+ return $this->hydrateResponse($response, UpdateConnectionResponse::class);
265
+ }
266
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Event.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Mailgun\Assert;
13
+ use Mailgun\Model\Event\EventResponse;
14
+
15
+ /**
16
+ * {@link https://documentation.mailgun.com/api-events.html}.
17
+ *
18
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
19
+ */
20
+ class Event extends HttpApi
21
+ {
22
+ use Pagination;
23
+
24
+ /**
25
+ * @param string $domain
26
+ * @param array $params
27
+ *
28
+ * @return EventResponse
29
+ */
30
+ public function get($domain, array $params = [])
31
+ {
32
+ Assert::stringNotEmpty($domain);
33
+
34
+ $response = $this->httpGet(sprintf('/v3/%s/events', $domain), $params);
35
+
36
+ return $this->hydrateResponse($response, EventResponse::class);
37
+ }
38
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/HttpApi.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Http\Client\Exception as HttplugException;
13
+ use Http\Client\HttpClient;
14
+ use Mailgun\Exception\UnknownErrorException;
15
+ use Mailgun\Hydrator\Hydrator;
16
+ use Mailgun\Hydrator\NoopHydrator;
17
+ use Mailgun\Exception\HttpClientException;
18
+ use Mailgun\Exception\HttpServerException;
19
+ use Mailgun\RequestBuilder;
20
+ use Psr\Http\Message\ResponseInterface;
21
+
22
+ /**
23
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
24
+ */
25
+ abstract class HttpApi
26
+ {
27
+ /**
28
+ * The HTTP client.
29
+ *
30
+ * @var HttpClient
31
+ */
32
+ private $httpClient;
33
+
34
+ /**
35
+ * @var Hydrator
36
+ */
37
+ protected $hydrator;
38
+
39
+ /**
40
+ * @var RequestBuilder
41
+ */
42
+ protected $requestBuilder;
43
+
44
+ /**
45
+ * @param HttpClient $httpClient
46
+ * @param RequestBuilder $requestBuilder
47
+ * @param Hydrator $hydrator
48
+ */
49
+ public function __construct(HttpClient $httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator)
50
+ {
51
+ $this->httpClient = $httpClient;
52
+ $this->requestBuilder = $requestBuilder;
53
+ if (!$hydrator instanceof NoopHydrator) {
54
+ $this->hydrator = $hydrator;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * @param ResponseInterface $response
60
+ * @param string $class
61
+ *
62
+ * @return mixed|ResponseInterface
63
+ *
64
+ * @throws \Exception
65
+ */
66
+ protected function hydrateResponse(ResponseInterface $response, $class)
67
+ {
68
+ if (!$this->hydrator) {
69
+ return $response;
70
+ }
71
+
72
+ if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
73
+ $this->handleErrors($response);
74
+ }
75
+
76
+ return $this->hydrator->hydrate($response, $class);
77
+ }
78
+
79
+ /**
80
+ * Throw the correct exception for this error.
81
+ *
82
+ * @param ResponseInterface $response
83
+ *
84
+ * @throws \Exception
85
+ */
86
+ protected function handleErrors(ResponseInterface $response)
87
+ {
88
+ $statusCode = $response->getStatusCode();
89
+ switch ($statusCode) {
90
+ case 400:
91
+ throw HttpClientException::badRequest($response);
92
+ case 401:
93
+ throw HttpClientException::unauthorized($response);
94
+ case 402:
95
+ throw HttpClientException::requestFailed($response);
96
+ case 404:
97
+ throw HttpClientException::notFound($response);
98
+ case 500 <= $statusCode:
99
+ throw HttpServerException::serverError($statusCode);
100
+ default:
101
+ throw new UnknownErrorException();
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Send a GET request with query parameters.
107
+ *
108
+ * @param string $path Request path
109
+ * @param array $parameters GET parameters
110
+ * @param array $requestHeaders Request Headers
111
+ *
112
+ * @return ResponseInterface
113
+ */
114
+ protected function httpGet($path, array $parameters = [], array $requestHeaders = [])
115
+ {
116
+ if (count($parameters) > 0) {
117
+ $path .= '?'.http_build_query($parameters);
118
+ }
119
+
120
+ try {
121
+ $response = $this->httpClient->sendRequest(
122
+ $this->requestBuilder->create('GET', $path, $requestHeaders)
123
+ );
124
+ } catch (HttplugException\NetworkException $e) {
125
+ throw HttpServerException::networkError($e);
126
+ }
127
+
128
+ return $response;
129
+ }
130
+
131
+ /**
132
+ * Send a POST request with parameters.
133
+ *
134
+ * @param string $path Request path
135
+ * @param array $parameters POST parameters
136
+ * @param array $requestHeaders Request headers
137
+ *
138
+ * @return ResponseInterface
139
+ */
140
+ protected function httpPost($path, array $parameters = [], array $requestHeaders = [])
141
+ {
142
+ return $this->httpPostRaw($path, $this->createRequestBody($parameters), $requestHeaders);
143
+ }
144
+
145
+ /**
146
+ * Send a POST request with raw data.
147
+ *
148
+ * @param string $path Request path
149
+ * @param array|string $body Request body
150
+ * @param array $requestHeaders Request headers
151
+ *
152
+ * @return ResponseInterface
153
+ */
154
+ protected function httpPostRaw($path, $body, array $requestHeaders = [])
155
+ {
156
+ try {
157
+ $response = $this->httpClient->sendRequest(
158
+ $this->requestBuilder->create('POST', $path, $requestHeaders, $body)
159
+ );
160
+ } catch (HttplugException\NetworkException $e) {
161
+ throw HttpServerException::networkError($e);
162
+ }
163
+
164
+ return $response;
165
+ }
166
+
167
+ /**
168
+ * Send a PUT request.
169
+ *
170
+ * @param string $path Request path
171
+ * @param array $parameters PUT parameters
172
+ * @param array $requestHeaders Request headers
173
+ *
174
+ * @return ResponseInterface
175
+ */
176
+ protected function httpPut($path, array $parameters = [], array $requestHeaders = [])
177
+ {
178
+ try {
179
+ $response = $this->httpClient->sendRequest(
180
+ $this->requestBuilder->create('PUT', $path, $requestHeaders, $this->createRequestBody($parameters))
181
+ );
182
+ } catch (HttplugException\NetworkException $e) {
183
+ throw HttpServerException::networkError($e);
184
+ }
185
+
186
+ return $response;
187
+ }
188
+
189
+ /**
190
+ * Send a DELETE request.
191
+ *
192
+ * @param string $path Request path
193
+ * @param array $parameters DELETE parameters
194
+ * @param array $requestHeaders Request headers
195
+ *
196
+ * @return ResponseInterface
197
+ */
198
+ protected function httpDelete($path, array $parameters = [], array $requestHeaders = [])
199
+ {
200
+ try {
201
+ $response = $this->httpClient->sendRequest(
202
+ $this->requestBuilder->create('DELETE', $path, $requestHeaders, $this->createRequestBody($parameters))
203
+ );
204
+ } catch (HttplugException\NetworkException $e) {
205
+ throw HttpServerException::networkError($e);
206
+ }
207
+
208
+ return $response;
209
+ }
210
+
211
+ /**
212
+ * Prepare a set of key-value-pairs to be encoded as multipart/form-data.
213
+ *
214
+ * @param array $parameters Request parameters
215
+ *
216
+ * @return array
217
+ */
218
+ protected function createRequestBody(array $parameters)
219
+ {
220
+ $resources = [];
221
+ foreach ($parameters as $key => $values) {
222
+ if (!is_array($values)) {
223
+ $values = [$values];
224
+ }
225
+ foreach ($values as $value) {
226
+ $resources[] = [
227
+ 'name' => $key,
228
+ 'content' => $value,
229
+ ];
230
+ }
231
+ }
232
+
233
+ return $resources;
234
+ }
235
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Message.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Mailgun\Assert;
13
+ use Mailgun\Exception\InvalidArgumentException;
14
+ use Mailgun\Model\Message\SendResponse;
15
+ use Mailgun\Model\Message\ShowResponse;
16
+
17
+ /**
18
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
19
+ */
20
+ class Message extends HttpApi
21
+ {
22
+ /**
23
+ * @param string $domain
24
+ * @param array $params
25
+ *
26
+ * @return SendResponse
27
+ */
28
+ public function send($domain, array $params)
29
+ {
30
+ Assert::string($domain);
31
+ Assert::notEmpty($domain);
32
+ Assert::notEmpty($params);
33
+
34
+ $postDataMultipart = [];
35
+ $fields = ['attachment', 'inline'];
36
+ foreach ($fields as $fieldName) {
37
+ if (!isset($params[$fieldName])) {
38
+ continue;
39
+ }
40
+
41
+ Assert::isArray($params[$fieldName]);
42
+ foreach ($params[$fieldName] as $file) {
43
+ $postDataMultipart[] = $this->prepareFile($fieldName, $file);
44
+ }
45
+
46
+ unset($params[$fieldName]);
47
+ }
48
+
49
+ $postDataMultipart = array_merge($this->prepareMultipartParameters($params), $postDataMultipart);
50
+ $response = $this->httpPostRaw(sprintf('/v3/%s/messages', $domain), $postDataMultipart);
51
+
52
+ return $this->hydrateResponse($response, SendResponse::class);
53
+ }
54
+
55
+ /**
56
+ * @param string $domain
57
+ * @param array $recipients with all you send emails to. Including bcc and cc
58
+ * @param string $message Message filepath or content
59
+ * @param array $params
60
+ */
61
+ public function sendMime($domain, array $recipients, $message, array $params)
62
+ {
63
+ Assert::string($domain);
64
+ Assert::notEmpty($domain);
65
+ Assert::notEmpty($recipients);
66
+ Assert::notEmpty($message);
67
+ Assert::nullOrIsArray($params);
68
+
69
+ $params['to'] = $recipients;
70
+ $postDataMultipart = $this->prepareMultipartParameters($params);
71
+
72
+ if (is_file($message)) {
73
+ $fileData = ['filePath' => $message];
74
+ } else {
75
+ $fileData = [
76
+ 'fileContent' => $message,
77
+ 'filename' => 'message',
78
+ ];
79
+ }
80
+ $postDataMultipart[] = $this->prepareFile('message', $fileData);
81
+ $response = $this->httpPostRaw(sprintf('/v3/%s/messages.mime', $domain), $postDataMultipart);
82
+
83
+ return $this->hydrateResponse($response, SendResponse::class);
84
+ }
85
+
86
+ /**
87
+ * Get stored message.
88
+ *
89
+ * @param string $url
90
+ * @param bool $rawMessage if true we will use "Accept: message/rfc2822" header
91
+ *
92
+ * @return ShowResponse
93
+ */
94
+ public function show($url, $rawMessage = false)
95
+ {
96
+ Assert::notEmpty($url);
97
+
98
+ $headers = [];
99
+ if ($rawMessage) {
100
+ $headers['Accept'] = 'message/rfc2822';
101
+ }
102
+
103
+ $response = $this->httpGet($url, [], $headers);
104
+
105
+ return $this->hydrateResponse($response, ShowResponse::class);
106
+ }
107
+
108
+ /**
109
+ * Prepare a file.
110
+ *
111
+ * @param string $fieldName
112
+ * @param array $filePath array('fileContent' => 'content') or array('filePath' => '/foo/bar')
113
+ *
114
+ * @return array
115
+ *
116
+ * @throws InvalidArgumentException
117
+ */
118
+ private function prepareFile($fieldName, array $filePath)
119
+ {
120
+ $filename = isset($filePath['filename']) ? $filePath['filename'] : null;
121
+
122
+ if (isset($filePath['fileContent'])) {
123
+ // File from memory
124
+ $resource = fopen('php://temp', 'r+');
125
+ fwrite($resource, $filePath['fileContent']);
126
+ rewind($resource);
127
+ } elseif (isset($filePath['filePath'])) {
128
+ // File form path
129
+ $path = $filePath['filePath'];
130
+
131
+ // Remove leading @ symbol
132
+ if (strpos($path, '@') === 0) {
133
+ $path = substr($path, 1);
134
+ }
135
+
136
+ $resource = fopen($path, 'r');
137
+ } else {
138
+ throw new InvalidArgumentException('When using a file you need to specify parameter "fileContent" or "filePath"');
139
+ }
140
+
141
+ return [
142
+ 'name' => $fieldName,
143
+ 'content' => $resource,
144
+ 'filename' => $filename,
145
+ ];
146
+ }
147
+
148
+ /**
149
+ * Prepare multipart parameters. Make sure each POST parameter is splitted into an array with 'name' and 'content' keys.
150
+ *
151
+ * @param array $params
152
+ *
153
+ * @return array
154
+ */
155
+ private function prepareMultipartParameters(array $params)
156
+ {
157
+ $postDataMultipart = [];
158
+ foreach ($params as $key => $value) {
159
+ // If $value is not an array we cast it to an array
160
+ foreach ((array) $value as $subValue) {
161
+ $postDataMultipart[] = [
162
+ 'name' => $key,
163
+ 'content' => $subValue,
164
+ ];
165
+ }
166
+ }
167
+
168
+ return $postDataMultipart;
169
+ }
170
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Pagination.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Mailgun\Assert;
13
+ use Mailgun\Model\PagingProvider;
14
+ use Psr\Http\Message\ResponseInterface;
15
+
16
+ /**
17
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
18
+ */
19
+ trait Pagination
20
+ {
21
+ abstract protected function httpGet($path, array $parameters = [], array $requestHeaders = []);
22
+
23
+ abstract protected function hydrateResponse(ResponseInterface $response, $className);
24
+
25
+ /**
26
+ * @param PagingProvider $response
27
+ *
28
+ * @return PagingProvider|null
29
+ */
30
+ public function nextPage(PagingProvider $response)
31
+ {
32
+ return $this->getPaginationUrl($response->getNextUrl(), get_class($response));
33
+ }
34
+
35
+ /**
36
+ * @param PagingProvider $response
37
+ *
38
+ * @return PagingProvider|null
39
+ */
40
+ public function previousPage(PagingProvider $response)
41
+ {
42
+ return $this->getPaginationUrl($response->getPreviousUrl(), get_class($response));
43
+ }
44
+
45
+ /**
46
+ * @param PagingProvider $response
47
+ *
48
+ * @return PagingProvider|null
49
+ */
50
+ public function firstPage(PagingProvider $response)
51
+ {
52
+ return $this->getPaginationUrl($response->getFirstUrl(), get_class($response));
53
+ }
54
+
55
+ /**
56
+ * @param PagingProvider $response
57
+ *
58
+ * @return PagingProvider|null
59
+ */
60
+ public function lastPage(PagingProvider $response)
61
+ {
62
+ return $this->getPaginationUrl($response->getLastUrl(), get_class($response));
63
+ }
64
+
65
+ /**
66
+ * @param string $url
67
+ * @param string $class
68
+ *
69
+ * @return PagingProvider|null
70
+ */
71
+ private function getPaginationUrl($url, $class)
72
+ {
73
+ Assert::stringNotEmpty($class);
74
+
75
+ if (empty($url)) {
76
+ return;
77
+ }
78
+
79
+ $response = $this->httpGet($url);
80
+
81
+ return $this->hydrateResponse($response, $class);
82
+ }
83
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Route.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Mailgun\Assert;
13
+ use Mailgun\Model\Route\Response\CreateResponse;
14
+ use Mailgun\Model\Route\Response\DeleteResponse;
15
+ use Mailgun\Model\Route\Response\IndexResponse;
16
+ use Mailgun\Model\Route\Response\ShowResponse;
17
+ use Mailgun\Model\Route\Response\UpdateResponse;
18
+
19
+ /**
20
+ * {@link https://documentation.mailgun.com/api-routes.html}.
21
+ *
22
+ * @author David Garcia <me@davidgarcia.cat>
23
+ */
24
+ class Route extends HttpApi
25
+ {
26
+ /**
27
+ * Fetches the list of Routes.
28
+ *
29
+ * @param int $limit Maximum number of records to return. (100 by default)
30
+ * @param int $skip Number of records to skip. (0 by default)
31
+ *
32
+ * @return IndexResponse
33
+ */
34
+ public function index($limit = 100, $skip = 0)
35
+ {
36
+ Assert::integer($limit);
37
+ Assert::integer($skip);
38
+ Assert::greaterThan($limit, 0);
39
+ Assert::greaterThanEq($skip, 0);
40
+
41
+ $params = [
42
+ 'limit' => $limit,
43
+ 'skip' => $skip,
44
+ ];
45
+
46
+ $response = $this->httpGet('/v3/routes', $params);
47
+
48
+ return $this->hydrateResponse($response, IndexResponse::class);
49
+ }
50
+
51
+ /**
52
+ * Returns a single Route object based on its ID.
53
+ *
54
+ * @param string $routeId Route ID returned by the Routes::index() method
55
+ *
56
+ * @return ShowResponse
57
+ */
58
+ public function show($routeId)
59
+ {
60
+ Assert::stringNotEmpty($routeId);
61
+
62
+ $response = $this->httpGet(sprintf('/v3/routes/%s', $routeId));
63
+
64
+ return $this->hydrateResponse($response, ShowResponse::class);
65
+ }
66
+
67
+ /**
68
+ * Creates a new Route.
69
+ *
70
+ * @param string $expression A filter expression like "match_recipient('.*@gmail.com')"
71
+ * @param array $actions Route action. This action is executed when the expression evaluates to True. Example: "forward('alice@example.com')"
72
+ * @param string $description An arbitrary string
73
+ * @param int $priority Integer: smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0.
74
+ *
75
+ * @return CreateResponse
76
+ */
77
+ public function create($expression, array $actions, $description, $priority = 0)
78
+ {
79
+ Assert::string($expression);
80
+ Assert::isArray($actions);
81
+ Assert::string($description);
82
+ Assert::integer($priority);
83
+
84
+ $params = [
85
+ 'priority' => $priority,
86
+ 'expression' => $expression,
87
+ 'action' => $actions,
88
+ 'description' => $description,
89
+ ];
90
+
91
+ $response = $this->httpPost('/v3/routes', $params);
92
+
93
+ return $this->hydrateResponse($response, CreateResponse::class);
94
+ }
95
+
96
+ /**
97
+ * Updates a given Route by ID. All parameters are optional.
98
+ * This API call only updates the specified fields leaving others unchanged.
99
+ *
100
+ * @param string $routeId Route ID returned by the Routes::index() method
101
+ * @param string|null $expression A filter expression like "match_recipient('.*@gmail.com')"
102
+ * @param array|null $actions Route action. This action is executed when the expression evaluates to True. Example: "forward('alice@example.com')"
103
+ * @param string|null $description An arbitrary string
104
+ * @param int|null $priority Integer: smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0.
105
+ *
106
+ * @return UpdateResponse
107
+ */
108
+ public function update($routeId, $expression = null, array $actions = [], $description = null, $priority = null)
109
+ {
110
+ Assert::stringNotEmpty($routeId);
111
+ Assert::nullOrString($expression);
112
+ Assert::isArray($actions);
113
+ Assert::nullOrString($description);
114
+ Assert::nullOrInteger($priority);
115
+
116
+ $params = [];
117
+
118
+ if (!empty($expression)) {
119
+ $params['expression'] = trim($expression);
120
+ }
121
+
122
+ foreach ($actions as $action) {
123
+ Assert::stringNotEmpty($action);
124
+
125
+ $params['action'] = isset($params['action']) ? $params['action'] : [];
126
+ $params['action'][] = $action;
127
+ }
128
+
129
+ if (!empty($description)) {
130
+ $params['description'] = trim($description);
131
+ }
132
+
133
+ if (!empty($priority)) {
134
+ $params['priority'] = $priority;
135
+ }
136
+
137
+ $response = $this->httpPut(sprintf('/v3/routes/%s', $routeId), $params);
138
+
139
+ return $this->hydrateResponse($response, UpdateResponse::class);
140
+ }
141
+
142
+ /**
143
+ * Deletes a Route based on the ID.
144
+ *
145
+ * @param string $routeId Route ID returned by the Routes::index() method
146
+ *
147
+ * @return DeleteResponse
148
+ */
149
+ public function delete($routeId)
150
+ {
151
+ Assert::stringNotEmpty($routeId);
152
+
153
+ $response = $this->httpDelete(sprintf('/v3/routes/%s', $routeId));
154
+
155
+ return $this->hydrateResponse($response, DeleteResponse::class);
156
+ }
157
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Stats.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Mailgun\Assert;
13
+ use Mailgun\Model\Stats\AllResponse;
14
+ use Mailgun\Model\Stats\TotalResponse;
15
+
16
+ /**
17
+ * {@link https://documentation.mailgun.com/api-stats.html}.
18
+ *
19
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
20
+ */
21
+ class Stats extends HttpApi
22
+ {
23
+ /**
24
+ * @param string $domain
25
+ * @param array $params
26
+ *
27
+ * @return TotalResponse|array
28
+ */
29
+ public function total($domain, array $params = [])
30
+ {
31
+ Assert::stringNotEmpty($domain);
32
+
33
+ $response = $this->httpGet(sprintf('/v3/%s/stats/total', rawurlencode($domain)), $params);
34
+
35
+ return $this->hydrateResponse($response, TotalResponse::class);
36
+ }
37
+
38
+ /**
39
+ * @param $domain
40
+ * @param array $params
41
+ *
42
+ * @return AllResponse|array
43
+ */
44
+ public function all($domain, array $params = [])
45
+ {
46
+ Assert::stringNotEmpty($domain);
47
+
48
+ $response = $this->httpGet(sprintf('/v3/%s/stats', rawurlencode($domain)), $params);
49
+
50
+ return $this->hydrateResponse($response, AllResponse::class);
51
+ }
52
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Suppression.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Http\Client\HttpClient;
13
+ use Mailgun\Api\Suppression\Bounce;
14
+ use Mailgun\Api\Suppression\Complaint;
15
+ use Mailgun\Api\Suppression\Unsubscribe;
16
+ use Mailgun\Hydrator\Hydrator;
17
+ use Mailgun\RequestBuilder;
18
+
19
+ /**
20
+ * @see https://documentation.mailgun.com/api-suppressions.html
21
+ *
22
+ * @author Sean Johnson <sean@mailgun.com>
23
+ */
24
+ class Suppression
25
+ {
26
+ /**
27
+ * @var HttpClient
28
+ */
29
+ private $httpClient;
30
+
31
+ /**
32
+ * @var RequestBuilder
33
+ */
34
+ private $requestBuilder;
35
+
36
+ /**
37
+ * @var Hydrator
38
+ */
39
+ private $hydrator;
40
+
41
+ /**
42
+ * @param HttpClient $httpClient
43
+ * @param RequestBuilder $requestBuilder
44
+ * @param Hydrator $hydrator
45
+ */
46
+ public function __construct(HttpClient $httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator)
47
+ {
48
+ $this->httpClient = $httpClient;
49
+ $this->requestBuilder = $requestBuilder;
50
+ $this->hydrator = $hydrator;
51
+ }
52
+
53
+ /**
54
+ * @return Bounce
55
+ */
56
+ public function bounces()
57
+ {
58
+ return new Bounce($this->httpClient, $this->requestBuilder, $this->hydrator);
59
+ }
60
+
61
+ /**
62
+ * @return Complaint
63
+ */
64
+ public function complaints()
65
+ {
66
+ return new Complaint($this->httpClient, $this->requestBuilder, $this->hydrator);
67
+ }
68
+
69
+ /**
70
+ * @return Unsubscribe
71
+ */
72
+ public function unsubscribes()
73
+ {
74
+ return new Unsubscribe($this->httpClient, $this->requestBuilder, $this->hydrator);
75
+ }
76
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Suppression/Bounce.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api\Suppression;
11
+
12
+ use Mailgun\Api\HttpApi;
13
+ use Mailgun\Api\Pagination;
14
+ use Mailgun\Assert;
15
+ use Mailgun\Model\Suppression\Bounce\CreateResponse;
16
+ use Mailgun\Model\Suppression\Bounce\DeleteResponse;
17
+ use Mailgun\Model\Suppression\Bounce\IndexResponse;
18
+ use Mailgun\Model\Suppression\Bounce\ShowResponse;
19
+
20
+ /**
21
+ * @see https://documentation.mailgun.com/api-suppressions.html#bounces
22
+ *
23
+ * @author Sean Johnson <sean@mailgun.com>
24
+ */
25
+ class Bounce extends HttpApi
26
+ {
27
+ use Pagination;
28
+
29
+ /**
30
+ * @param string $domain Domain to list bounces for
31
+ * @param int $limit optional
32
+ *
33
+ * @return IndexResponse
34
+ */
35
+ public function index($domain, $limit = 100)
36
+ {
37
+ Assert::stringNotEmpty($domain);
38
+ Assert::range($limit, 1, 10000, '"Limit" parameter must be between 1 and 10000');
39
+
40
+ $params = [
41
+ 'limit' => $limit,
42
+ ];
43
+
44
+ $response = $this->httpGet(sprintf('/v3/%s/bounces', $domain), $params);
45
+
46
+ return $this->hydrateResponse($response, IndexResponse::class);
47
+ }
48
+
49
+ /**
50
+ * @param string $domain Domain to show bounce from
51
+ * @param string $address Bounce address to show
52
+ *
53
+ * @return ShowResponse
54
+ */
55
+ public function show($domain, $address)
56
+ {
57
+ Assert::stringNotEmpty($domain);
58
+ Assert::stringNotEmpty($address);
59
+
60
+ $response = $this->httpGet(sprintf('/v3/%s/bounces/%s', $domain, $address));
61
+
62
+ return $this->hydrateResponse($response, ShowResponse::class);
63
+ }
64
+
65
+ /**
66
+ * @param string $domain Domain to create a bounce for
67
+ * @param string $address Address to create a bounce for
68
+ * @param array $params optional
69
+ *
70
+ * @return CreateResponse
71
+ */
72
+ public function create($domain, $address, array $params = [])
73
+ {
74
+ Assert::stringNotEmpty($domain);
75
+ Assert::stringNotEmpty($address);
76
+
77
+ $params['address'] = $address;
78
+
79
+ $response = $this->httpPost(sprintf('/v3/%s/bounces', $domain), $params);
80
+
81
+ return $this->hydrateResponse($response, CreateResponse::class);
82
+ }
83
+
84
+ /**
85
+ * @param string $domain Domain to delete a bounce for
86
+ * @param string $address Bounce address to delete
87
+ *
88
+ * @return DeleteResponse
89
+ */
90
+ public function delete($domain, $address)
91
+ {
92
+ Assert::stringNotEmpty($domain);
93
+ Assert::stringNotEmpty($address);
94
+
95
+ $response = $this->httpDelete(sprintf('/v3/%s/bounces/%s', $domain, $address));
96
+
97
+ return $this->hydrateResponse($response, DeleteResponse::class);
98
+ }
99
+
100
+ /**
101
+ * @param string $domain Domain to delete all bounces for
102
+ *
103
+ * @return DeleteResponse
104
+ */
105
+ public function deleteAll($domain)
106
+ {
107
+ Assert::stringNotEmpty($domain);
108
+
109
+ $response = $this->httpDelete(sprintf('/v3/%s/bounces', $domain));
110
+
111
+ return $this->hydrateResponse($response, DeleteResponse::class);
112
+ }
113
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Suppression/Complaint.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api\Suppression;
11
+
12
+ use Mailgun\Api\HttpApi;
13
+ use Mailgun\Api\Pagination;
14
+ use Mailgun\Assert;
15
+ use Mailgun\Model\Suppression\Complaint\CreateResponse;
16
+ use Mailgun\Model\Suppression\Complaint\DeleteResponse;
17
+ use Mailgun\Model\Suppression\Complaint\IndexResponse;
18
+ use Mailgun\Model\Suppression\Complaint\ShowResponse;
19
+
20
+ /**
21
+ * @see https://documentation.mailgun.com/api-suppressions.html#complaints
22
+ *
23
+ * @author Sean Johnson <sean@mailgun.com>
24
+ */
25
+ class Complaint extends HttpApi
26
+ {
27
+ use Pagination;
28
+
29
+ /**
30
+ * @param string $domain Domain to get complaints for
31
+ * @param int $limit optional
32
+ *
33
+ * @return IndexResponse
34
+ */
35
+ public function index($domain, $limit = 100)
36
+ {
37
+ Assert::stringNotEmpty($domain);
38
+ Assert::range($limit, 1, 10000, 'Limit parameter must be between 1 and 10000');
39
+
40
+ $params = [
41
+ 'limit' => $limit,
42
+ ];
43
+
44
+ $response = $this->httpGet(sprintf('/v3/%s/complaints', $domain), $params);
45
+
46
+ return $this->hydrateResponse($response, IndexResponse::class);
47
+ }
48
+
49
+ /**
50
+ * @param string $domain Domain to show complaint for
51
+ * @param string $address Complaint address
52
+ *
53
+ * @return ShowResponse
54
+ */
55
+ public function show($domain, $address)
56
+ {
57
+ Assert::stringNotEmpty($domain);
58
+ Assert::stringNotEmpty($address);
59
+ $response = $this->httpGet(sprintf('/v3/%s/complaints/%s', $domain, $address));
60
+
61
+ return $this->hydrateResponse($response, ShowResponse::class);
62
+ }
63
+
64
+ /**
65
+ * @param string $domain Domain to create complaint for
66
+ * @param string $address Complaint address
67
+ * @param string $createdAt (optional) rfc2822 compliant format. (new \DateTime())->format('r')
68
+ *
69
+ * @return CreateResponse
70
+ */
71
+ public function create($domain, $address, $createdAt = null)
72
+ {
73
+ Assert::stringNotEmpty($domain);
74
+ Assert::stringNotEmpty($address);
75
+ Assert::stringNotEmpty($createdAt);
76
+
77
+ $params['address'] = $address;
78
+ if (null !== $createdAt) {
79
+ $params['created_at'] = $createdAt;
80
+ }
81
+
82
+ $response = $this->httpPost(sprintf('/v3/%s/complaints', $domain), $params);
83
+
84
+ return $this->hydrateResponse($response, CreateResponse::class);
85
+ }
86
+
87
+ /**
88
+ * @param string $domain Domain to delete complaint for
89
+ * @param string $address Complaint address
90
+ *
91
+ * @return DeleteResponse
92
+ */
93
+ public function delete($domain, $address)
94
+ {
95
+ Assert::stringNotEmpty($domain);
96
+ Assert::stringNotEmpty($address);
97
+
98
+ $response = $this->httpDelete(sprintf('/v3/%s/complaints/%s', $domain, $address));
99
+
100
+ return $this->hydrateResponse($response, DeleteResponse::class);
101
+ }
102
+
103
+ /**
104
+ * @param string $domain Domain to delete all bounces for
105
+ *
106
+ * @return DeleteResponse
107
+ */
108
+ public function deleteAll($domain)
109
+ {
110
+ Assert::stringNotEmpty($domain);
111
+
112
+ $response = $this->httpDelete(sprintf('/v3/%s/complaints', $domain));
113
+
114
+ return $this->hydrateResponse($response, DeleteResponse::class);
115
+ }
116
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Suppression/Unsubscribe.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api\Suppression;
11
+
12
+ use Mailgun\Api\HttpApi;
13
+ use Mailgun\Api\Pagination;
14
+ use Mailgun\Assert;
15
+ use Mailgun\Model\Suppression\Unsubscribe\CreateResponse;
16
+ use Mailgun\Model\Suppression\Unsubscribe\DeleteResponse;
17
+ use Mailgun\Model\Suppression\Unsubscribe\IndexResponse;
18
+ use Mailgun\Model\Suppression\Unsubscribe\ShowResponse;
19
+
20
+ /**
21
+ * @see https://documentation.mailgun.com/api-suppressions.html#unsubscribes
22
+ *
23
+ * @author Sean Johnson <sean@mailgun.com>
24
+ */
25
+ class Unsubscribe extends HttpApi
26
+ {
27
+ use Pagination;
28
+
29
+ /**
30
+ * @param string $domain Domain to get unsubscribes for
31
+ * @param int $limit optional
32
+ *
33
+ * @return IndexResponse
34
+ */
35
+ public function index($domain, $limit = 100)
36
+ {
37
+ Assert::stringNotEmpty($domain);
38
+ Assert::range($limit, 1, 10000, 'Limit parameter must be between 1 and 10000');
39
+
40
+ $params = [
41
+ 'limit' => $limit,
42
+ ];
43
+
44
+ $response = $this->httpGet(sprintf('/v3/%s/unsubscribes', $domain), $params);
45
+
46
+ return $this->hydrateResponse($response, IndexResponse::class);
47
+ }
48
+
49
+ /**
50
+ * @param string $domain Domain to show unsubscribe for
51
+ * @param string $address Unsubscribe address
52
+ *
53
+ * @return ShowResponse
54
+ */
55
+ public function show($domain, $address)
56
+ {
57
+ Assert::stringNotEmpty($domain);
58
+ Assert::stringNotEmpty($address);
59
+
60
+ $response = $this->httpGet(sprintf('/v3/%s/unsubscribes/%s', $domain, $address));
61
+
62
+ return $this->hydrateResponse($response, ShowResponse::class);
63
+ }
64
+
65
+ /**
66
+ * @param string $domain Domain to create unsubscribe for
67
+ * @param string $address Unsubscribe address
68
+ * @param array $params optional
69
+ *
70
+ * @return CreateResponse
71
+ */
72
+ public function create($domain, $address, array $params = [])
73
+ {
74
+ Assert::stringNotEmpty($domain);
75
+ Assert::stringNotEmpty($address);
76
+
77
+ $params['address'] = $address;
78
+
79
+ $response = $this->httpPost(sprintf('/v3/%s/unsubscribes', $domain), $params);
80
+
81
+ return $this->hydrateResponse($response, CreateResponse::class);
82
+ }
83
+
84
+ /**
85
+ * @param string $domain Domain to delete unsubscribe for
86
+ * @param string $address Unsubscribe address
87
+ *
88
+ * @return DeleteResponse
89
+ */
90
+ public function delete($domain, $address)
91
+ {
92
+ Assert::stringNotEmpty($domain);
93
+ Assert::stringNotEmpty($address);
94
+
95
+ $response = $this->httpDelete(sprintf('/v3/%s/unsubscribes/%s', $domain, $address));
96
+
97
+ return $this->hydrateResponse($response, DeleteResponse::class);
98
+ }
99
+
100
+ /**
101
+ * @param string $domain Domain to delete all unsubscribes for
102
+ *
103
+ * @return DeleteResponse
104
+ */
105
+ public function deleteAll($domain)
106
+ {
107
+ Assert::stringNotEmpty($domain);
108
+
109
+ $response = $this->httpDelete(sprintf('/v3/%s/unsubscribes', $domain));
110
+
111
+ return $this->hydrateResponse($response, DeleteResponse::class);
112
+ }
113
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Tag.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Mailgun\Assert;
13
+ use Mailgun\Model\Tag\DeleteResponse;
14
+ use Mailgun\Model\Tag\IndexResponse;
15
+ use Mailgun\Model\Tag\ShowResponse;
16
+ use Mailgun\Model\Tag\StatisticsResponse;
17
+ use Mailgun\Model\Tag\UpdateResponse;
18
+ use Psr\Http\Message\ResponseInterface;
19
+
20
+ /**
21
+ * {@link https://documentation.mailgun.com/api-tags.html#tags}.
22
+ *
23
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
24
+ */
25
+ class Tag extends HttpApi
26
+ {
27
+ /**
28
+ * Returns a list of tags.
29
+ *
30
+ * @param string $domain
31
+ * @param int $limit
32
+ *
33
+ * @return IndexResponse|ResponseInterface
34
+ */
35
+ public function index($domain, $limit = 100)
36
+ {
37
+ Assert::stringNotEmpty($domain);
38
+ Assert::integer($limit);
39
+
40
+ $params = [
41
+ 'limit' => $limit,
42
+ ];
43
+
44
+ $response = $this->httpGet(sprintf('/v3/%s/tags', $domain), $params);
45
+
46
+ return $this->hydrateResponse($response, IndexResponse::class);
47
+ }
48
+
49
+ /**
50
+ * Returns a single tag.
51
+ *
52
+ * @param string $domain Name of the domain
53
+ * @param string $tag
54
+ *
55
+ * @return ShowResponse|ResponseInterface
56
+ */
57
+ public function show($domain, $tag)
58
+ {
59
+ Assert::stringNotEmpty($domain);
60
+ Assert::stringNotEmpty($tag);
61
+
62
+ $response = $this->httpGet(sprintf('/v3/%s/tags/%s', $domain, $tag));
63
+
64
+ return $this->hydrateResponse($response, ShowResponse::class);
65
+ }
66
+
67
+ /**
68
+ * Update a tag.
69
+ *
70
+ * @param string $domain
71
+ * @param string $tag
72
+ * @param string $description
73
+ *
74
+ * @return UpdateResponse|ResponseInterface
75
+ */
76
+ public function update($domain, $tag, $description)
77
+ {
78
+ Assert::stringNotEmpty($domain);
79
+ Assert::stringNotEmpty($tag);
80
+ Assert::string($description);
81
+
82
+ $params = [
83
+ 'description' => $description,
84
+ ];
85
+
86
+ $response = $this->httpPut(sprintf('/v3/%s/tags/%s', $domain, $tag), $params);
87
+
88
+ return $this->hydrateResponse($response, UpdateResponse::class);
89
+ }
90
+
91
+ /**
92
+ * Returns statistics for a single tag.
93
+ *
94
+ * @param string $domain Name of the domain
95
+ * @param string $tag
96
+ * @param array $params
97
+ *
98
+ * @return StatisticsResponse|ResponseInterface
99
+ */
100
+ public function stats($domain, $tag, array $params)
101
+ {
102
+ Assert::stringNotEmpty($domain);
103
+ Assert::stringNotEmpty($tag);
104
+ Assert::isArray($params);
105
+
106
+ $response = $this->httpGet(sprintf('/v3/%s/tags/%s/stats', $domain, $tag), $params);
107
+
108
+ return $this->hydrateResponse($response, StatisticsResponse::class);
109
+ }
110
+
111
+ /**
112
+ * Removes a tag from the account.
113
+ *
114
+ * @param string $domain Name of the domain
115
+ * @param string $tag
116
+ *
117
+ * @return DeleteResponse|ResponseInterface
118
+ */
119
+ public function delete($domain, $tag)
120
+ {
121
+ Assert::stringNotEmpty($domain);
122
+ Assert::stringNotEmpty($tag);
123
+
124
+ $response = $this->httpDelete(sprintf('/v3/%s/tags/%s', $domain, $tag));
125
+
126
+ return $this->hydrateResponse($response, DeleteResponse::class);
127
+ }
128
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Api/Webhook.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Api;
11
+
12
+ use Http\Client\HttpClient;
13
+ use Mailgun\Assert;
14
+ use Mailgun\Hydrator\Hydrator;
15
+ use Mailgun\Model\Webhook\CreateResponse;
16
+ use Mailgun\Model\Webhook\DeleteResponse;
17
+ use Mailgun\Model\Webhook\IndexResponse;
18
+ use Mailgun\Model\Webhook\ShowResponse;
19
+ use Mailgun\Model\Webhook\UpdateResponse;
20
+ use Mailgun\RequestBuilder;
21
+
22
+ /**
23
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
24
+ */
25
+ class Webhook extends HttpApi
26
+ {
27
+ /**
28
+ * @var string
29
+ */
30
+ private $apiKey;
31
+
32
+ /**
33
+ * @param HttpClient $httpClient
34
+ * @param RequestBuilder $requestBuilder
35
+ * @param Hydrator $hydrator
36
+ * @param string $apiKey
37
+ */
38
+ public function __construct(HttpClient $httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator, $apiKey)
39
+ {
40
+ parent::__construct($httpClient, $requestBuilder, $hydrator);
41
+ $this->apiKey = $apiKey;
42
+ }
43
+
44
+ /**
45
+ * This function verifies the webhook signature with your API key to to see if it is authentic.
46
+ *
47
+ * If this function returns FALSE, you must not process the request.
48
+ * You should reject the request with status code 403 Forbidden.
49
+ *
50
+ * @param int $timestamp
51
+ * @param string $token
52
+ * @param string $signature
53
+ *
54
+ * @return bool
55
+ */
56
+ public function verifyWebhookSignature($timestamp, $token, $signature)
57
+ {
58
+ if (empty($timestamp) || empty($token) || empty($signature)) {
59
+ return false;
60
+ }
61
+
62
+ $hmac = hash_hmac('sha256', $timestamp.$token, $this->apiKey);
63
+
64
+ if (function_exists('hash_equals')) {
65
+ // hash_equals is constant time, but will not be introduced until PHP 5.6
66
+ return hash_equals($hmac, $signature);
67
+ } else {
68
+ return $hmac === $signature;
69
+ }
70
+ }
71
+
72
+ /**
73
+ * @param string $domain
74
+ *
75
+ * @return IndexResponse
76
+ */
77
+ public function index($domain)
78
+ {
79
+ Assert::notEmpty($domain);
80
+ $response = $this->httpGet(sprintf('/v3/domains/%s/webhooks', $domain));
81
+
82
+ return $this->hydrateResponse($response, IndexResponse::class);
83
+ }
84
+
85
+ /**
86
+ * @param string $domain
87
+ * @param string $webhook
88
+ *
89
+ * @return ShowResponse
90
+ */
91
+ public function show($domain, $webhook)
92
+ {
93
+ Assert::notEmpty($domain);
94
+ Assert::notEmpty($webhook);
95
+ $response = $this->httpGet(sprintf('/v3/domains/%s/webhooks/%s', $domain, $webhook));
96
+
97
+ return $this->hydrateResponse($response, ShowResponse::class);
98
+ }
99
+
100
+ /**
101
+ * @param string $domain
102
+ * @param string $id
103
+ * @param string $url
104
+ *
105
+ * @return CreateResponse
106
+ */
107
+ public function create($domain, $id, $url)
108
+ {
109
+ Assert::notEmpty($domain);
110
+ Assert::notEmpty($id);
111
+ Assert::notEmpty($url);
112
+
113
+ $params = [
114
+ 'id' => $id,
115
+ 'url' => $url,
116
+ ];
117
+
118
+ $response = $this->httpPost(sprintf('/v3/domains/%s/webhooks', $domain), $params);
119
+
120
+ return $this->hydrateResponse($response, CreateResponse::class);
121
+ }
122
+
123
+ /**
124
+ * @param string $domain
125
+ * @param string $id
126
+ * @param string $url
127
+ *
128
+ * @return UpdateResponse
129
+ */
130
+ public function update($domain, $id, $url)
131
+ {
132
+ Assert::notEmpty($domain);
133
+ Assert::notEmpty($id);
134
+ Assert::notEmpty($url);
135
+
136
+ $params = [
137
+ 'url' => $url,
138
+ ];
139
+
140
+ $response = $this->httpPut(sprintf('/v3/domains/%s/webhooks/%s', $domain, $id), $params);
141
+
142
+ return $this->hydrateResponse($response, UpdateResponse::class);
143
+ }
144
+
145
+ /**
146
+ * @param string $domain
147
+ * @param string $id
148
+ *
149
+ * @return DeleteResponse
150
+ */
151
+ public function delete($domain, $id)
152
+ {
153
+ Assert::notEmpty($domain);
154
+ Assert::notEmpty($id);
155
+
156
+ $response = $this->httpDelete(sprintf('/v3/domains/%s/webhooks/%s', $domain, $id));
157
+
158
+ return $this->hydrateResponse($response, DeleteResponse::class);
159
+ }
160
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Assert.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun;
11
+
12
+ use Mailgun\Exception\InvalidArgumentException;
13
+
14
+ /**
15
+ * We need to override Webmozart\Assert because we want to throw our own Exception.
16
+ *
17
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
18
+ */
19
+ final class Assert extends \Webmozart\Assert\Assert
20
+ {
21
+ protected static function reportInvalidArgument($message)
22
+ {
23
+ throw new InvalidArgumentException($message);
24
+ }
25
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/GenericHTTPError.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Connection\Exceptions;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ /**
15
+ * @deprecated Will be removed in 3.0
16
+ */
17
+ class GenericHTTPError extends \Exception implements Exception
18
+ {
19
+ protected $httpResponseCode;
20
+ protected $httpResponseBody;
21
+
22
+ public function __construct($message = null, $response_code = null, $response_body = null, $code = 0, \Exception $previous = null)
23
+ {
24
+ parent::__construct($message, $code, $previous);
25
+
26
+ $this->httpResponseCode = $response_code;
27
+ $this->httpResponseBody = $response_body;
28
+ }
29
+
30
+ public function getHttpResponseCode()
31
+ {
32
+ return $this->httpResponseCode;
33
+ }
34
+
35
+ public function getHttpResponseBody()
36
+ {
37
+ return $this->httpResponseBody;
38
+ }
39
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/InvalidCredentials.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Connection\Exceptions;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ /**
15
+ * @deprecated Will be removed in 3.0
16
+ */
17
+ class InvalidCredentials extends \Exception implements Exception
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/MissingEndpoint.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Connection\Exceptions;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ /**
15
+ * @deprecated Will be removed in 3.0
16
+ */
17
+ class MissingEndpoint extends \Exception implements Exception
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/MissingRequiredParameters.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Connection\Exceptions;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ /**
15
+ * @deprecated Will be removed in 3.0
16
+ */
17
+ class MissingRequiredParameters extends \Exception implements Exception
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/Exceptions/NoDomainsConfigured.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Connection\Exceptions;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ /**
15
+ * @deprecated Will be removed in 3.0
16
+ */
17
+ class NoDomainsConfigured extends \Exception implements Exception
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Connection;
11
+
12
+ use Http\Client\HttpClient;
13
+ use Http\Discovery\HttpClientDiscovery;
14
+ use Http\Discovery\MessageFactoryDiscovery;
15
+ use Http\Message\MultipartStream\MultipartStreamBuilder;
16
+ use Mailgun\Connection\Exceptions\GenericHTTPError;
17
+ use Mailgun\Connection\Exceptions\InvalidCredentials;
18
+ use Mailgun\Connection\Exceptions\MissingEndpoint;
19
+ use Mailgun\Connection\Exceptions\MissingRequiredParameters;
20
+ use Mailgun\Constants\Api;
21
+ use Mailgun\Constants\ExceptionMessages;
22
+ use Psr\Http\Message\ResponseInterface;
23
+
24
+ /**
25
+ * This class is a wrapper for the HTTP client.
26
+ *
27
+ * @deprecated Will be removed in 3.0
28
+ */
29
+ class RestClient
30
+ {
31
+ /**
32
+ * Your API key.
33
+ *
34
+ * @var string
35
+ */
36
+ private $apiKey;
37
+
38
+ /**
39
+ * @var HttpClient
40
+ */
41
+ protected $httpClient;
42
+
43
+ /**
44
+ * @var string
45
+ */
46
+ protected $apiHost;
47
+
48
+ /**
49
+ * The version of the API to use.
50
+ *
51
+ * @var string
52
+ */
53
+ protected $apiVersion = 'v2';
54
+
55
+ /**
56
+ * If we should use SSL or not.
57
+ *
58
+ * @var bool
59
+ *
60
+ * @deprecated To be removed in 3.0
61
+ */
62
+ protected $sslEnabled = true;
63
+
64
+ /**
65
+ * @param string $apiKey
66
+ * @param string $apiHost
67
+ * @param HttpClient $httpClient
68
+ */
69
+ public function __construct($apiKey, $apiHost, HttpClient $httpClient = null)
70
+ {
71
+ $this->apiKey = $apiKey;
72
+ $this->apiHost = $apiHost;
73
+ $this->httpClient = $httpClient;
74
+ }
75
+
76
+ /**
77
+ * @param string $method
78
+ * @param string $uri
79
+ * @param mixed $body
80
+ * @param array $files
81
+ * @param array $headers
82
+ *
83
+ * @throws GenericHTTPError
84
+ * @throws InvalidCredentials
85
+ * @throws MissingEndpoint
86
+ * @throws MissingRequiredParameters
87
+ *
88
+ * @return \stdClass
89
+ */
90
+ protected function send($method, $uri, $body = null, $files = [], array $headers = [])
91
+ {
92
+ $headers['User-Agent'] = Api::SDK_USER_AGENT.'/'.Api::SDK_VERSION;
93
+ $headers['Authorization'] = 'Basic '.base64_encode(sprintf('%s:%s', Api::API_USER, $this->apiKey));
94
+
95
+ if (!empty($files)) {
96
+ $builder = new MultipartStreamBuilder();
97
+ foreach ($files as $file) {
98
+ $builder->addResource($file['name'], $file['contents'], $file);
99
+ }
100
+ $body = $builder->build();
101
+ $headers['Content-Type'] = 'multipart/form-data; boundary="'.$builder->getBoundary().'"';
102
+ } elseif (is_array($body)) {
103
+ $body = http_build_query($body);
104
+ $headers['Content-Type'] = 'application/x-www-form-urlencoded';
105
+ }
106
+
107
+ $request = MessageFactoryDiscovery::find()->createRequest($method, $this->getApiUrl($uri), $headers, $body);
108
+ $response = $this->getHttpClient()->sendRequest($request);
109
+
110
+ return $this->responseHandler($response);
111
+ }
112
+
113
+ /**
114
+ * @param string $url
115
+ *
116
+ * @throws GenericHTTPError
117
+ * @throws InvalidCredentials
118
+ * @throws MissingEndpoint
119
+ * @throws MissingRequiredParameters
120
+ *
121
+ * @return \stdClass
122
+ */
123
+ public function getAttachment($url)
124
+ {
125
+ $headers['User-Agent'] = Api::SDK_USER_AGENT.'/'.Api::SDK_VERSION;
126
+ $headers['Authorization'] = 'Basic '.base64_encode(sprintf('%s:%s', Api::API_USER, $this->apiKey));
127
+ $request = MessageFactoryDiscovery::find()->createRequest('get', $url, $headers);
128
+ $response = HttpClientDiscovery::find()->sendRequest($request);
129
+
130
+ return $this->responseHandler($response);
131
+ }
132
+
133
+ /**
134
+ * @param string $endpointUrl
135
+ * @param array $postData
136
+ * @param array $files
137
+ *
138
+ * @throws GenericHTTPError
139
+ * @throws InvalidCredentials
140
+ * @throws MissingEndpoint
141
+ * @throws MissingRequiredParameters
142
+ *
143
+ * @return \stdClass
144
+ */
145
+ public function post($endpointUrl, array $postData = [], $files = [])
146
+ {
147
+ $postFiles = [];
148
+
149
+ $fields = ['message', 'attachment', 'inline'];
150
+ foreach ($fields as $fieldName) {
151
+ if (isset($files[$fieldName])) {
152
+ if (is_array($files[$fieldName])) {
153
+ foreach ($files[$fieldName] as $file) {
154
+ $postFiles[] = $this->prepareFile($fieldName, $file);
155
+ }
156
+ } else {
157
+ $postFiles[] = $this->prepareFile($fieldName, $files[$fieldName]);
158
+ }
159
+ }
160
+ }
161
+
162
+ $postDataMultipart = [];
163
+ foreach ($postData as $key => $value) {
164
+ if (is_array($value)) {
165
+ foreach ($value as $subValue) {
166
+ $postDataMultipart[] = [
167
+ 'name' => $key,
168
+ 'contents' => $subValue,
169
+ ];
170
+ }
171
+ } else {
172
+ $postDataMultipart[] = [
173
+ 'name' => $key,
174
+ 'contents' => $value,
175
+ ];
176
+ }
177
+ }
178
+
179
+ return $this->send('POST', $endpointUrl, [], array_merge($postDataMultipart, $postFiles));
180
+ }
181
+
182
+ /**
183
+ * @param string $endpointUrl
184
+ * @param array $queryString
185
+ *
186
+ * @throws GenericHTTPError
187
+ * @throws InvalidCredentials
188
+ * @throws MissingEndpoint
189
+ * @throws MissingRequiredParameters
190
+ *
191
+ * @return \stdClass
192
+ */
193
+ public function get($endpointUrl, $queryString = [])
194
+ {
195
+ return $this->send('GET', $endpointUrl.'?'.http_build_query($queryString));
196
+ }
197
+
198
+ /**
199
+ * @param string $endpointUrl
200
+ *
201
+ * @throws GenericHTTPError
202
+ * @throws InvalidCredentials
203
+ * @throws MissingEndpoint
204
+ * @throws MissingRequiredParameters
205
+ *
206
+ * @return \stdClass
207
+ */
208
+ public function delete($endpointUrl)
209
+ {
210
+ return $this->send('DELETE', $endpointUrl);
211
+ }
212
+
213
+ /**
214
+ * @param string $endpointUrl
215
+ * @param mixed $putData
216
+ *
217
+ * @throws GenericHTTPError
218
+ * @throws InvalidCredentials
219
+ * @throws MissingEndpoint
220
+ * @throws MissingRequiredParameters
221
+ *
222
+ * @return \stdClass
223
+ */
224
+ public function put($endpointUrl, $putData)
225
+ {
226
+ return $this->send('PUT', $endpointUrl, $putData);
227
+ }
228
+
229
+ /**
230
+ * @param ResponseInterface $responseObj
231
+ *
232
+ * @throws GenericHTTPError
233
+ * @throws InvalidCredentials
234
+ * @throws MissingEndpoint
235
+ * @throws MissingRequiredParameters
236
+ *
237
+ * @return \stdClass
238
+ */
239
+ public function responseHandler(ResponseInterface $responseObj)
240
+ {
241
+ $httpResponseCode = (int) $responseObj->getStatusCode();
242
+
243
+ switch ($httpResponseCode) {
244
+ case 200:
245
+ $data = (string) $responseObj->getBody();
246
+ $jsonResponseData = json_decode($data, false);
247
+ $result = new \stdClass();
248
+ // return response data as json if possible, raw if not
249
+ $result->http_response_body = $data && $jsonResponseData === null ? $data : $jsonResponseData;
250
+ $result->http_response_code = $httpResponseCode;
251
+
252
+ return $result;
253
+ case 400:
254
+ throw new MissingRequiredParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_PARAMETERS.$this->getResponseExceptionMessage($responseObj));
255
+ case 401:
256
+ throw new InvalidCredentials(ExceptionMessages::EXCEPTION_INVALID_CREDENTIALS);
257
+ case 404:
258
+ throw new MissingEndpoint(ExceptionMessages::EXCEPTION_MISSING_ENDPOINT.$this->getResponseExceptionMessage($responseObj));
259
+ default:
260
+ throw new GenericHTTPError(ExceptionMessages::EXCEPTION_GENERIC_HTTP_ERROR, $httpResponseCode, $responseObj->getBody());
261
+ }
262
+ }
263
+
264
+ /**
265
+ * @param ResponseInterface $responseObj
266
+ *
267
+ * @return string
268
+ */
269
+ protected function getResponseExceptionMessage(ResponseInterface $responseObj)
270
+ {
271
+ $body = (string) $responseObj->getBody();
272
+ $response = json_decode($body);
273
+ if (json_last_error() == JSON_ERROR_NONE && isset($response->message)) {
274
+ return ' '.$response->message;
275
+ }
276
+
277
+ return '';
278
+ }
279
+
280
+ /**
281
+ * Prepare a file for the postBody.
282
+ *
283
+ * @param string $fieldName
284
+ * @param string|array $filePath
285
+ *
286
+ * @return array
287
+ */
288
+ protected function prepareFile($fieldName, $filePath)
289
+ {
290
+ $filename = null;
291
+
292
+ if (is_array($filePath) && isset($filePath['fileContent'])) {
293
+ // File from memory
294
+ $filename = $filePath['filename'];
295
+ $resource = fopen('php://temp', 'r+');
296
+ fwrite($resource, $filePath['fileContent']);
297
+ rewind($resource);
298
+ } else {
299
+ // Backward compatibility code
300
+ if (is_array($filePath) && isset($filePath['filePath'])) {
301
+ $filename = $filePath['remoteName'];
302
+ $filePath = $filePath['filePath'];
303
+ }
304
+
305
+ // Remove leading @ symbol
306
+ if (strpos($filePath, '@') === 0) {
307
+ $filePath = substr($filePath, 1);
308
+ }
309
+
310
+ $resource = fopen($filePath, 'r');
311
+ }
312
+
313
+ return [
314
+ 'name' => $fieldName,
315
+ 'contents' => $resource,
316
+ 'filename' => $filename,
317
+ ];
318
+ }
319
+
320
+ /**
321
+ * @return HttpClient
322
+ */
323
+ protected function getHttpClient()
324
+ {
325
+ if ($this->httpClient === null) {
326
+ $this->httpClient = HttpClientDiscovery::find();
327
+ }
328
+
329
+ return $this->httpClient;
330
+ }
331
+
332
+ /**
333
+ * @param string $uri
334
+ *
335
+ * @return string
336
+ */
337
+ private function getApiUrl($uri)
338
+ {
339
+ return $this->generateEndpoint($this->apiHost, $this->apiVersion, $this->sslEnabled).$uri;
340
+ }
341
+
342
+ /**
343
+ * @param string $apiEndpoint
344
+ * @param string $apiVersion
345
+ * @param bool $ssl
346
+ *
347
+ * @return string
348
+ */
349
+ private function generateEndpoint($apiEndpoint, $apiVersion, $ssl)
350
+ {
351
+ return ($ssl ? 'https://' : 'http://').$apiEndpoint.'/'.$apiVersion.'/';
352
+ }
353
+
354
+ /**
355
+ * @param string $apiVersion
356
+ *
357
+ * @return RestClient
358
+ */
359
+ public function setApiVersion($apiVersion)
360
+ {
361
+ $this->apiVersion = $apiVersion;
362
+
363
+ return $this;
364
+ }
365
+
366
+ /**
367
+ * @param bool $sslEnabled
368
+ *
369
+ * @return RestClient
370
+ *
371
+ * @deprecated To be removed in 3.0
372
+ */
373
+ public function setSslEnabled($sslEnabled)
374
+ {
375
+ $this->sslEnabled = $sslEnabled;
376
+
377
+ return $this;
378
+ }
379
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Constants/Api.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Constants;
11
+
12
+ /**
13
+ * @deprecated Will be removed in 3.0
14
+ */
15
+ class Api
16
+ {
17
+ const API_USER = 'api';
18
+ const SDK_VERSION = '1.7';
19
+ const SDK_USER_AGENT = 'mailgun-sdk-php';
20
+ const RECIPIENT_COUNT_LIMIT = 1000;
21
+ const CAMPAIGN_ID_LIMIT = 3;
22
+ const TAG_LIMIT = 3;
23
+ const DEFAULT_TIME_ZONE = 'UTC';
24
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Constants/ExceptionMessages.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Constants;
11
+
12
+ /**
13
+ * @deprecated Will be removed in 3.0
14
+ */
15
+ class ExceptionMessages
16
+ {
17
+ const EXCEPTION_INVALID_CREDENTIALS = 'Your credentials are incorrect.';
18
+ const EXCEPTION_GENERIC_HTTP_ERROR = 'An HTTP Error has occurred! Check your network connection and try again.';
19
+ const EXCEPTION_MISSING_REQUIRED_PARAMETERS = 'The parameters passed to the API were invalid. Check your inputs!';
20
+ const EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS = 'The parameters passed to the API were invalid. Check your inputs!';
21
+ const EXCEPTION_MISSING_ENDPOINT = "The endpoint you've tried to access does not exist. Check your URL.";
22
+ const TOO_MANY_RECIPIENTS = "You've exceeded the maximum recipient count (1,000) on the to field with autosend disabled.";
23
+ const INVALID_PARAMETER_NON_ARRAY = "The parameter you've passed in position 2 must be an array.";
24
+ const INVALID_PARAMETER_ATTACHMENT = 'Attachments must be passed with an "@" preceding the file path. Web resources not supported.';
25
+ const INVALID_PARAMETER_INLINE = 'Inline images must be passed with an "@" preceding the file path. Web resources not supported.';
26
+ const TOO_MANY_PARAMETERS_CAMPAIGNS = "You've exceeded the maximum (3) campaigns for a single message.";
27
+ const TOO_MANY_PARAMETERS_TAGS = "You've exceeded the maximum (3) tags for a single message.";
28
+ const TOO_MANY_PARAMETERS_RECIPIENT = "You've exceeded the maximum recipient count (1,000) on the to field with autosend disabled.";
29
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun;
11
+
12
+ /**
13
+ * All Mailgun exception implements this exception.
14
+ *
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ interface Exception
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/HttpClientException.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Exception;
11
+
12
+ use Mailgun\Exception;
13
+ use Psr\Http\Message\ResponseInterface;
14
+
15
+ /**
16
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
17
+ */
18
+ final class HttpClientException extends \RuntimeException implements Exception
19
+ {
20
+ /**
21
+ * @var ResponseInterface|null
22
+ */
23
+ private $response;
24
+
25
+ /**
26
+ * @var array
27
+ */
28
+ private $responseBody;
29
+
30
+ /**
31
+ * @param string $message
32
+ * @param int $code
33
+ * @param ResponseInterface|null $response
34
+ */
35
+ public function __construct($message, $code, ResponseInterface $response = null)
36
+ {
37
+ parent::__construct($message, $code);
38
+
39
+ if ($response) {
40
+ $this->response = $response;
41
+ $body = $response->getBody()->__toString();
42
+ if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
43
+ $this->responseBody['message'] = $body;
44
+ } else {
45
+ $this->responseBody = json_decode($body, true);
46
+ }
47
+ }
48
+ }
49
+
50
+ public static function badRequest(ResponseInterface $response = null)
51
+ {
52
+ return new self('The parameters passed to the API were invalid. Check your inputs!', 400, $response);
53
+ }
54
+
55
+ public static function unauthorized(ResponseInterface $response = null)
56
+ {
57
+ return new self('Your credentials are incorrect.', 401, $response);
58
+ }
59
+
60
+ public static function requestFailed(ResponseInterface $response = null)
61
+ {
62
+ return new self('Parameters were valid but request failed. Try again.', 402, $response);
63
+ }
64
+
65
+ public static function notFound(ResponseInterface $response = null)
66
+ {
67
+ return new self('The endpoint you tried to access does not exist. Check your URL.', 404, $response);
68
+ }
69
+
70
+ /**
71
+ * @return ResponseInterface
72
+ */
73
+ public function getResponse()
74
+ {
75
+ return $this->response;
76
+ }
77
+
78
+ /**
79
+ * @return array
80
+ */
81
+ public function getResponseBody()
82
+ {
83
+ return $this->responseBody;
84
+ }
85
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/HttpServerException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Exception;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class HttpServerException extends \RuntimeException implements Exception
18
+ {
19
+ public static function serverError($httpStatus = 500)
20
+ {
21
+ return new self('An unexpected error occurred at Mailgun\'s servers. Try again later and contact support of the error sill exists.', $httpStatus);
22
+ }
23
+
24
+ public static function networkError(\Exception $previous)
25
+ {
26
+ return new self('Mailgun\'s servers was unreachable.', 0, $previous);
27
+ }
28
+
29
+ public static function unknownHttpResponseCode($code)
30
+ {
31
+ return new self(sprintf('Unknown HTTP response code ("%d") received from the API server', $code));
32
+ }
33
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/HydrationException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Exception;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ final class HydrationException extends \RuntimeException implements Exception
15
+ {
16
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/InvalidArgumentException.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Exception;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class InvalidArgumentException extends \InvalidArgumentException implements Exception
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Exception/UnknownErrorException.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Exception;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class UnknownErrorException extends \Exception implements Exception
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/HttpClient/Plugin/History.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\HttpClient\Plugin;
11
+
12
+ use Http\Client\Common\Plugin\Journal;
13
+ use Http\Client\Exception;
14
+ use Psr\Http\Message\RequestInterface;
15
+ use Psr\Http\Message\ResponseInterface;
16
+
17
+ /**
18
+ * A plugin to remember the last response.
19
+ *
20
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
21
+ */
22
+ final class History implements Journal
23
+ {
24
+ /**
25
+ * @var ResponseInterface
26
+ */
27
+ private $lastResponse;
28
+
29
+ /**
30
+ * @return ResponseInterface|null
31
+ */
32
+ public function getLastResponse()
33
+ {
34
+ return $this->lastResponse;
35
+ }
36
+
37
+ public function addSuccess(RequestInterface $request, ResponseInterface $response)
38
+ {
39
+ $this->lastResponse = $response;
40
+ }
41
+
42
+ public function addFailure(RequestInterface $request, Exception $exception)
43
+ {
44
+ }
45
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/HttpClient/Plugin/ReplaceUriPlugin.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\HttpClient\Plugin;
11
+
12
+ use Http\Client\Common\Plugin;
13
+ use Psr\Http\Message\RequestInterface;
14
+ use Psr\Http\Message\UriInterface;
15
+
16
+ /**
17
+ * Replaces a URI with a new one. Good for debugging.
18
+ *
19
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
20
+ */
21
+ final class ReplaceUriPlugin implements Plugin
22
+ {
23
+ /**
24
+ * @var UriInterface
25
+ */
26
+ private $uri;
27
+
28
+ /**
29
+ * @param UriInterface $uri
30
+ */
31
+ public function __construct(UriInterface $uri)
32
+ {
33
+ $this->uri = $uri;
34
+ }
35
+
36
+ /**
37
+ * {@inheritdoc}
38
+ */
39
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
40
+ {
41
+ $request = $request->withUri($this->uri);
42
+
43
+ return $next($request);
44
+ }
45
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/HttpClientConfigurator.php ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun;
11
+
12
+ use Http\Client\HttpClient;
13
+ use Http\Client\Common\PluginClient;
14
+ use Http\Discovery\HttpClientDiscovery;
15
+ use Http\Discovery\UriFactoryDiscovery;
16
+ use Http\Message\UriFactory;
17
+ use Http\Client\Common\Plugin;
18
+ use Mailgun\HttpClient\Plugin\History;
19
+ use Mailgun\HttpClient\Plugin\ReplaceUriPlugin;
20
+
21
+ /**
22
+ * Configure a HTTP client.
23
+ *
24
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
25
+ */
26
+ final class HttpClientConfigurator
27
+ {
28
+ /**
29
+ * @var string
30
+ */
31
+ private $endpoint = 'https://api.mailgun.net';
32
+
33
+ /**
34
+ * If debug is true we will send all the request to the endpoint without appending any path.
35
+ *
36
+ * @var bool
37
+ */
38
+ private $debug = false;
39
+
40
+ /**
41
+ * @var string
42
+ */
43
+ private $apiKey;
44
+
45
+ /**
46
+ * @var UriFactory
47
+ */
48
+ private $uriFactory;
49
+
50
+ /**
51
+ * @var HttpClient
52
+ */
53
+ private $httpClient;
54
+
55
+ /**
56
+ * @var History
57
+ */
58
+ private $responseHistory;
59
+
60
+ public function __construct()
61
+ {
62
+ $this->responseHistory = new History();
63
+ }
64
+
65
+ /**
66
+ * @return PluginClient
67
+ */
68
+ public function createConfiguredClient()
69
+ {
70
+ $plugins = [
71
+ new Plugin\AddHostPlugin($this->getUriFactory()->createUri($this->endpoint)),
72
+ new Plugin\HeaderDefaultsPlugin([
73
+ 'User-Agent' => 'mailgun-sdk-php/v2 (https://github.com/mailgun/mailgun-php)',
74
+ 'Authorization' => 'Basic '.base64_encode(sprintf('api:%s', $this->getApiKey())),
75
+ ]),
76
+ new Plugin\HistoryPlugin($this->responseHistory),
77
+ ];
78
+
79
+ if ($this->debug) {
80
+ $plugins[] = new ReplaceUriPlugin($this->getUriFactory()->createUri($this->endpoint));
81
+ }
82
+
83
+ return new PluginClient($this->getHttpClient(), $plugins);
84
+ }
85
+
86
+ /**
87
+ * @param bool $debug
88
+ *
89
+ * @return HttpClientConfigurator
90
+ */
91
+ public function setDebug($debug)
92
+ {
93
+ $this->debug = $debug;
94
+
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * @param string $endpoint
100
+ *
101
+ * @return HttpClientConfigurator
102
+ */
103
+ public function setEndpoint($endpoint)
104
+ {
105
+ $this->endpoint = $endpoint;
106
+
107
+ return $this;
108
+ }
109
+
110
+ /**
111
+ * @return string
112
+ */
113
+ public function getApiKey()
114
+ {
115
+ return $this->apiKey;
116
+ }
117
+
118
+ /**
119
+ * @param string $apiKey
120
+ *
121
+ * @return HttpClientConfigurator
122
+ */
123
+ public function setApiKey($apiKey)
124
+ {
125
+ $this->apiKey = $apiKey;
126
+
127
+ return $this;
128
+ }
129
+
130
+ /**
131
+ * @return UriFactory
132
+ */
133
+ private function getUriFactory()
134
+ {
135
+ if ($this->uriFactory === null) {
136
+ $this->uriFactory = UriFactoryDiscovery::find();
137
+ }
138
+
139
+ return $this->uriFactory;
140
+ }
141
+
142
+ /**
143
+ * @param UriFactory $uriFactory
144
+ *
145
+ * @return HttpClientConfigurator
146
+ */
147
+ public function setUriFactory(UriFactory $uriFactory)
148
+ {
149
+ $this->uriFactory = $uriFactory;
150
+
151
+ return $this;
152
+ }
153
+
154
+ /**
155
+ * @return HttpClient
156
+ */
157
+ private function getHttpClient()
158
+ {
159
+ if ($this->httpClient === null) {
160
+ $this->httpClient = HttpClientDiscovery::find();
161
+ }
162
+
163
+ return $this->httpClient;
164
+ }
165
+
166
+ /**
167
+ * @param HttpClient $httpClient
168
+ *
169
+ * @return HttpClientConfigurator
170
+ */
171
+ public function setHttpClient(HttpClient $httpClient)
172
+ {
173
+ $this->httpClient = $httpClient;
174
+
175
+ return $this;
176
+ }
177
+
178
+ /**
179
+ * @return History
180
+ */
181
+ public function getResponseHistory()
182
+ {
183
+ return $this->responseHistory;
184
+ }
185
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Hydrator/ArrayHydrator.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Hydrator;
11
+
12
+ use Mailgun\Exception\HydrationException;
13
+ use Psr\Http\Message\ResponseInterface;
14
+
15
+ /**
16
+ * Serialize an HTTP response to array.
17
+ *
18
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
19
+ */
20
+ final class ArrayHydrator implements Hydrator
21
+ {
22
+ /**
23
+ * @param ResponseInterface $response
24
+ * @param string $class
25
+ *
26
+ * @return array
27
+ */
28
+ public function hydrate(ResponseInterface $response, $class)
29
+ {
30
+ $body = $response->getBody()->__toString();
31
+ if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
32
+ throw new HydrationException('The ArrayHydrator cannot hydrate response with Content-Type:'.$response->getHeaderLine('Content-Type'));
33
+ }
34
+
35
+ $content = json_decode($body, true);
36
+ if (JSON_ERROR_NONE !== json_last_error()) {
37
+ throw new HydrationException(sprintf('Error (%d) when trying to json_decode response', json_last_error()));
38
+ }
39
+
40
+ return $content;
41
+ }
42
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Hydrator/Hydrator.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Hydrator;
11
+
12
+ use Mailgun\Exception\HydrationException;
13
+ use Psr\Http\Message\ResponseInterface;
14
+
15
+ /**
16
+ * Deserialize a PSR-7 response to something else.
17
+ */
18
+ interface Hydrator
19
+ {
20
+ /**
21
+ * @param ResponseInterface $response
22
+ * @param string $class
23
+ *
24
+ * @return mixed
25
+ *
26
+ * @throws HydrationException
27
+ */
28
+ public function hydrate(ResponseInterface $response, $class);
29
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Hydrator/ModelHydrator.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Hydrator;
11
+
12
+ use Mailgun\Exception\HydrationException;
13
+ use Mailgun\Model\ApiResponse;
14
+ use Psr\Http\Message\ResponseInterface;
15
+
16
+ /**
17
+ * Serialize an HTTP response to domain object.
18
+ *
19
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
20
+ */
21
+ final class ModelHydrator implements Hydrator
22
+ {
23
+ /**
24
+ * @param ResponseInterface $response
25
+ * @param string $class
26
+ *
27
+ * @return ResponseInterface
28
+ */
29
+ public function hydrate(ResponseInterface $response, $class)
30
+ {
31
+ $body = $response->getBody()->__toString();
32
+ $contentType = $response->getHeaderLine('Content-Type');
33
+ if (strpos($contentType, 'application/json') !== 0 && strpos($contentType, 'application/octet-stream') !== 0) {
34
+ throw new HydrationException('The ModelHydrator cannot hydrate response with Content-Type: '.$contentType);
35
+ }
36
+
37
+ $data = json_decode($body, true);
38
+ if (JSON_ERROR_NONE !== json_last_error()) {
39
+ throw new HydrationException(sprintf('Error (%d) when trying to json_decode response', json_last_error()));
40
+ }
41
+
42
+ if (is_subclass_of($class, ApiResponse::class)) {
43
+ $object = call_user_func($class.'::create', $data);
44
+ } else {
45
+ $object = new $class($data);
46
+ }
47
+
48
+ return $object;
49
+ }
50
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Hydrator/NoopHydrator.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Hydrator;
11
+
12
+ use Psr\Http\Message\ResponseInterface;
13
+
14
+ /**
15
+ * Do not serialize at all. Just return a PSR-7 response.
16
+ *
17
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
18
+ */
19
+ final class NoopHydrator implements Hydrator
20
+ {
21
+ /**
22
+ * @param ResponseInterface $response
23
+ * @param string $class
24
+ *
25
+ * @throws \LogicException
26
+ */
27
+ public function hydrate(ResponseInterface $response, $class)
28
+ {
29
+ throw new \LogicException('The NoopHydrator should never be called');
30
+ }
31
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Lists/OptInHandler.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Lists;
11
+
12
+ /**
13
+ * This class is used for creating a unique hash for
14
+ * mailing list subscription double-opt in requests.
15
+ *
16
+ * @see https://github.com/mailgun/mailgun-php/blob/master/src/Mailgun/Lists/README.md
17
+ */
18
+ class OptInHandler
19
+ {
20
+ /**
21
+ * @param string $mailingList
22
+ * @param string $secretAppId
23
+ * @param string $recipientAddress
24
+ *
25
+ * @return string
26
+ */
27
+ public function generateHash($mailingList, $secretAppId, $recipientAddress)
28
+ {
29
+ $innerPayload = ['r' => $recipientAddress, 'l' => $mailingList];
30
+ $encodedInnerPayload = base64_encode(json_encode($innerPayload));
31
+
32
+ $innerHash = hash_hmac('sha1', $encodedInnerPayload, $secretAppId);
33
+ $outerPayload = ['h' => $innerHash, 'p' => $encodedInnerPayload];
34
+
35
+ return urlencode(base64_encode(json_encode($outerPayload)));
36
+ }
37
+
38
+ /**
39
+ * @param string $secretAppId
40
+ * @param string $uniqueHash
41
+ *
42
+ * @return array|bool
43
+ */
44
+ public function validateHash($secretAppId, $uniqueHash)
45
+ {
46
+ $decodedOuterPayload = json_decode(base64_decode(urldecode($uniqueHash)), true);
47
+
48
+ $decodedHash = $decodedOuterPayload['h'];
49
+ $innerPayload = $decodedOuterPayload['p'];
50
+
51
+ $decodedInnerPayload = json_decode(base64_decode($innerPayload), true);
52
+ $computedInnerHash = hash_hmac('sha1', $innerPayload, $secretAppId);
53
+
54
+ if ($computedInnerHash == $decodedHash) {
55
+ return ['recipientAddress' => $decodedInnerPayload['r'], 'mailingList' => $decodedInnerPayload['l']];
56
+ }
57
+
58
+ return false;
59
+ }
60
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Lists/README.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Mailgun - Lists
2
+ ====================
3
+
4
+ This is the Mailgun PHP *Lists* utilities.
5
+
6
+ The below assumes you've already installed the Mailgun PHP SDK in to your project.
7
+ If not, go back to the master README for instructions.
8
+
9
+ There is currently one utility provided.
10
+
11
+ OptInHandler: Provides methods for authenticating an OptInRequest.
12
+
13
+ The typical flow for using this utility would be as follows:
14
+ **Recipient Requests Subscribe** -> [Validate Recipient Address] -> [Generate Opt In Link] -> [Email Recipient Opt In Link]
15
+ **Recipient Clicks Opt In Link** -> [Validate Opt In Link] -> [Subscribe User] -> [Send final confirmation]
16
+
17
+ The above flow is modeled below.
18
+
19
+ Usage - Opt-In Handler (Recipient Requests Subscribe)
20
+ -----------------------------------------------------
21
+ Here's how to use Opt-In Handler to validate Opt-In requests.
22
+
23
+ ```php
24
+ # First, instantiate the SDK with your API credentials, domain, and required parameters for example.
25
+ $mg = new Mailgun('key-example');
26
+ $mgValidate = new Mailgun('pub-key-example');
27
+
28
+ $domain = 'example.com';
29
+ $mailingList = 'youlist@example.com';
30
+ $secretPassphrase = 'a_secret_passphrase';
31
+ $recipientAddress = 'recipient@example.com';
32
+
33
+ # Let's validate the customer's email address, using Mailgun's validation endpoint.
34
+ $result = $mgValidate->get('address/validate', array('address' => $recipientAddress));
35
+
36
+ if($result->http_response_body->is_valid == true){
37
+ # Next, instantiate an OptInHandler object from the SDK.
38
+ $optInHandler = $mg->OptInHandler();
39
+
40
+ # Next, generate a hash.
41
+ $generatedHash = $optInHandler->generateHash($mailingList, $secretPassphrase, $recipientAddress);
42
+
43
+ # Now, let's send a confirmation to the recipient with our link.
44
+ $mg->sendMessage($domain, array('from' => 'bob@example.com',
45
+ 'to' => $recipientAddress,
46
+ 'subject' => 'Please Confirm!',
47
+ 'html' => "<html><body>Hello,<br><br>You have requested to be subscribed
48
+ to the mailing list $mailingList. Please <a
49
+ href=\"http://yourdomain.com/subscribe.php?hash=$generatedHash\">
50
+ confirm</a> your subscription.<br><br>Thank you!</body></html>"));
51
+
52
+ # Finally, let's add the subscriber to a Mailing List, as unsubscribed, so we can track non-conversions.
53
+ $mg->post("lists/$mailingList/members", array('address' => $recipientAddress,
54
+ 'subscribed' => 'no',
55
+ 'upsert' => 'yes'));
56
+ }
57
+ ```
58
+
59
+ Usage - Opt-In Handler (Recipient Clicks Opt In Link)
60
+ -----------------------------------------------------
61
+ Here's how to use Opt-In Handler to validate an Opt-In Hash.
62
+
63
+ ```php
64
+ # First, instantiate the SDK with your API credentials and domain.
65
+ $mg = new Mailgun('key-example');
66
+ $domain = 'example.com';
67
+
68
+ # Next, instantiate an OptInHandler object from the SDK.
69
+ $optInHandler = $mg->OptInHandler();
70
+
71
+ # Next, grab the hash.
72
+ $inboundHash = $_GET['hash'];
73
+ $secretPassphrase = 'a_secret_passphrase';
74
+
75
+ # Now, validate the captured hash.
76
+ $hashValidation = $optInHandler->validateHash($secretPassphrase, $inboundHash);
77
+
78
+ # Lastly, check to see if we have results, parse, subscribe, and send confirmation.
79
+ if($hashValidation){
80
+ $validatedList = $hashValidation['mailingList'];
81
+ $validatedRecipient = $hashValidation['recipientAddress'];
82
+
83
+ $mg->put("lists/$validatedList/members/$validatedRecipient",
84
+ array('address' => $validatedRecipient,
85
+ 'subscribed' => 'yes'));
86
+
87
+ $mg->sendMessage($domain, array('from' => 'bob@example.com',
88
+ 'to' => $validatedRecipient,
89
+ 'subject' => 'Confirmation Received!',
90
+ 'html' => "<html><body>Hello,<br><br>We've successfully subscribed
91
+ you to the list, $validatedList!<br><br>Thank you!
92
+ </body></html>"));
93
+ }
94
+ ```
95
+
96
+ A few notes:
97
+ 1. 'a_secret_passphrase' can be anything. It's used as the *key* in hashing,
98
+ since your email address will vary.
99
+ 2. validateHash() will return an array containing the recipient address and list
100
+ address.
101
+ 3. You should *always* send an email confirmation before and after the
102
+ subscription request.
103
+ 4. WARNING: On $_GET['hash'], you need to sanitize this value to prevent
104
+ malicious attempts to inject code.
105
+
106
+ Available Functions
107
+ -----------------------------------------------------
108
+
109
+ `string generateHash(string $mailingList, string $secretAppId, string $recipientAddress)`
110
+
111
+ `array validateHash(string $secretAppId, string $uniqueHash)`
112
+
113
+ More Documentation
114
+ ------------------
115
+ See the official [Mailgun Docs](http://documentation.mailgun.com/api-sending.html)
116
+ for more information.
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Mailgun.php ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun;
11
+
12
+ use Http\Client\Common\HttpMethodsClient;
13
+ use Http\Client\HttpClient;
14
+ use Mailgun\Connection\RestClient;
15
+ use Mailgun\Constants\ExceptionMessages;
16
+ use Mailgun\HttpClient\Plugin\History;
17
+ use Mailgun\Lists\OptInHandler;
18
+ use Mailgun\Messages\BatchMessage;
19
+ use Mailgun\Messages\Exceptions;
20
+ use Mailgun\Messages\MessageBuilder;
21
+ use Mailgun\Hydrator\ModelHydrator;
22
+ use Mailgun\Hydrator\Hydrator;
23
+ use Psr\Http\Message\ResponseInterface;
24
+
25
+ /**
26
+ * This class is the base class for the Mailgun SDK.
27
+ */
28
+ class Mailgun
29
+ {
30
+ /**
31
+ * @var RestClient
32
+ *
33
+ * @depracated Will be removed in 3.0
34
+ */
35
+ protected $restClient;
36
+
37
+ /**
38
+ * @var null|string
39
+ */
40
+ protected $apiKey;
41
+
42
+ /**
43
+ * @var HttpMethodsClient
44
+ */
45
+ private $httpClient;
46
+
47
+ /**
48
+ * @var Hydrator
49
+ */
50
+ private $hydrator;
51
+
52
+ /**
53
+ * @var RequestBuilder
54
+ */
55
+ private $requestBuilder;
56
+
57
+ /**
58
+ * This is a object that holds the last response from the API.
59
+ *
60
+ * @var History
61
+ */
62
+ private $responseHistory = null;
63
+
64
+ /**
65
+ * @param string|null $apiKey
66
+ * @param HttpClient|null $httpClient
67
+ * @param string $apiEndpoint
68
+ * @param Hydrator|null $hydrator
69
+ * @param RequestBuilder|null $requestBuilder
70
+ *
71
+ * @internal Use Mailgun::configure or Mailgun::create instead.
72
+ */
73
+ public function __construct(
74
+ $apiKey = null, /* Deprecated, will be removed in 3.0 */
75
+ HttpClient $httpClient = null,
76
+ $apiEndpoint = 'api.mailgun.net', /* Deprecated, will be removed in 3.0 */
77
+ Hydrator $hydrator = null,
78
+ RequestBuilder $requestBuilder = null
79
+ ) {
80
+ $this->apiKey = $apiKey;
81
+ $this->restClient = new RestClient($apiKey, $apiEndpoint, $httpClient);
82
+
83
+ $this->httpClient = $httpClient;
84
+ $this->requestBuilder = $requestBuilder ?: new RequestBuilder();
85
+ $this->hydrator = $hydrator ?: new ModelHydrator();
86
+ }
87
+
88
+ /**
89
+ * @param HttpClientConfigurator $configurator
90
+ * @param Hydrator|null $hydrator
91
+ * @param RequestBuilder|null $requestBuilder
92
+ *
93
+ * @return Mailgun
94
+ */
95
+ public static function configure(
96
+ HttpClientConfigurator $configurator,
97
+ Hydrator $hydrator = null,
98
+ RequestBuilder $requestBuilder = null
99
+ ) {
100
+ $httpClient = $configurator->createConfiguredClient();
101
+
102
+ return new self($configurator->getApiKey(), $httpClient, 'api.mailgun.net', $hydrator, $requestBuilder);
103
+ }
104
+
105
+ /**
106
+ * @param string $apiKey
107
+ *
108
+ * @return Mailgun
109
+ */
110
+ public static function create($apiKey)
111
+ {
112
+ $httpClientConfigurator = (new HttpClientConfigurator())->setApiKey($apiKey);
113
+
114
+ return self::configure($httpClientConfigurator);
115
+ }
116
+
117
+ /**
118
+ * This function allows the sending of a fully formed message OR a custom
119
+ * MIME string. If sending MIME, the string must be passed in to the 3rd
120
+ * position of the function call.
121
+ *
122
+ * @param string $workingDomain
123
+ * @param array $postData
124
+ * @param array $postFiles
125
+ *
126
+ * @throws Exceptions\MissingRequiredMIMEParameters
127
+ *
128
+ * @return \stdClass
129
+ *
130
+ * @deprecated Use Mailgun->message() instead. Will be removed in 3.0
131
+ */
132
+ public function sendMessage($workingDomain, $postData, $postFiles = [])
133
+ {
134
+ if (is_array($postFiles)) {
135
+ return $this->post("$workingDomain/messages", $postData, $postFiles);
136
+ } elseif (is_string($postFiles)) {
137
+ $tempFile = tempnam(sys_get_temp_dir(), 'MG_TMP_MIME');
138
+ $fileHandle = fopen($tempFile, 'w');
139
+ fwrite($fileHandle, $postFiles);
140
+
141
+ $result = $this->post("$workingDomain/messages.mime", $postData, ['message' => $tempFile]);
142
+ fclose($fileHandle);
143
+ unlink($tempFile);
144
+
145
+ return $result;
146
+ } else {
147
+ throw new Exceptions\MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
148
+ }
149
+ }
150
+
151
+ /**
152
+ * This function checks the signature in a POST request to see if it is
153
+ * authentic.
154
+ *
155
+ * Pass an array of parameters. If you pass nothing, $_POST will be
156
+ * used instead.
157
+ *
158
+ * If this function returns FALSE, you must not process the request.
159
+ * You should reject the request with status code 403 Forbidden.
160
+ *
161
+ * @param array|null $postData
162
+ *
163
+ * @return bool
164
+ *
165
+ * @deprecated Use Mailgun->webhook() instead. Will be removed in 3.0
166
+ */
167
+ public function verifyWebhookSignature($postData = null)
168
+ {
169
+ if ($postData === null) {
170
+ $postData = $_POST;
171
+ }
172
+ if (!isset($postData['timestamp']) || !isset($postData['token']) || !isset($postData['signature'])) {
173
+ return false;
174
+ }
175
+ $hmac = hash_hmac('sha256', "{$postData['timestamp']}{$postData['token']}", $this->apiKey);
176
+ $sig = $postData['signature'];
177
+ if (function_exists('hash_equals')) {
178
+ // hash_equals is constant time, but will not be introduced until PHP 5.6
179
+ return hash_equals($hmac, $sig);
180
+ } else {
181
+ return $hmac === $sig;
182
+ }
183
+ }
184
+
185
+ /**
186
+ * @return ResponseInterface|null
187
+ */
188
+ public function getLastResponse()
189
+ {
190
+ return $this->responseHistory->getLastResponse();
191
+ }
192
+
193
+ /**
194
+ * @param string $endpointUrl
195
+ * @param array $postData
196
+ * @param array $files
197
+ *
198
+ * @return \stdClass
199
+ *
200
+ * @deprecated Will be removed in 3.0
201
+ */
202
+ public function post($endpointUrl, $postData = [], $files = [])
203
+ {
204
+ return $this->restClient->post($endpointUrl, $postData, $files);
205
+ }
206
+
207
+ /**
208
+ * @param string $endpointUrl
209
+ * @param array $queryString
210
+ *
211
+ * @return \stdClass
212
+ *
213
+ * @deprecated Will be removed in 3.0
214
+ */
215
+ public function get($endpointUrl, $queryString = [])
216
+ {
217
+ return $this->restClient->get($endpointUrl, $queryString);
218
+ }
219
+
220
+ /**
221
+ * @param string $url
222
+ *
223
+ * @return \stdClass
224
+ *
225
+ * @deprecated Will be removed in 3.0
226
+ */
227
+ public function getAttachment($url)
228
+ {
229
+ return $this->restClient->getAttachment($url);
230
+ }
231
+
232
+ /**
233
+ * @param string $endpointUrl
234
+ *
235
+ * @return \stdClass
236
+ *
237
+ * @deprecated Will be removed in 3.0
238
+ */
239
+ public function delete($endpointUrl)
240
+ {
241
+ return $this->restClient->delete($endpointUrl);
242
+ }
243
+
244
+ /**
245
+ * @param string $endpointUrl
246
+ * @param array $putData
247
+ *
248
+ * @return \stdClass
249
+ *
250
+ * @deprecated Will be removed in 3.0
251
+ */
252
+ public function put($endpointUrl, $putData)
253
+ {
254
+ return $this->restClient->put($endpointUrl, $putData);
255
+ }
256
+
257
+ /**
258
+ * @param string $apiVersion
259
+ *
260
+ * @return Mailgun
261
+ *
262
+ * @deprecated Will be removed in 3.0
263
+ */
264
+ public function setApiVersion($apiVersion)
265
+ {
266
+ $this->restClient->setApiVersion($apiVersion);
267
+
268
+ return $this;
269
+ }
270
+
271
+ /**
272
+ * @param bool $sslEnabled
273
+ *
274
+ * @return Mailgun
275
+ *
276
+ * @deprecated This will be removed in 3.0. Mailgun does not support non-secure connections to their API.
277
+ */
278
+ public function setSslEnabled($sslEnabled)
279
+ {
280
+ $this->restClient->setSslEnabled($sslEnabled);
281
+
282
+ return $this;
283
+ }
284
+
285
+ /**
286
+ * @return MessageBuilder
287
+ *
288
+ * @deprecated Will be removed in 3.0
289
+ */
290
+ public function MessageBuilder()
291
+ {
292
+ return new MessageBuilder();
293
+ }
294
+
295
+ /**
296
+ * @return OptInHandler
297
+ *
298
+ * @deprecated Will be removed in 3.0
299
+ */
300
+ public function OptInHandler()
301
+ {
302
+ return new OptInHandler();
303
+ }
304
+
305
+ /**
306
+ * @param string $workingDomain
307
+ * @param bool $autoSend
308
+ *
309
+ * @return BatchMessage
310
+ *
311
+ * @deprecated Will be removed in 3.0
312
+ */
313
+ public function BatchMessage($workingDomain, $autoSend = true)
314
+ {
315
+ return new BatchMessage($this->restClient, $workingDomain, $autoSend);
316
+ }
317
+
318
+ /**
319
+ * @return Api\Stats
320
+ */
321
+ public function stats()
322
+ {
323
+ return new Api\Stats($this->httpClient, $this->requestBuilder, $this->hydrator);
324
+ }
325
+
326
+ /**
327
+ * @return Api\Domain
328
+ */
329
+ public function domains()
330
+ {
331
+ return new Api\Domain($this->httpClient, $this->requestBuilder, $this->hydrator);
332
+ }
333
+
334
+ /**
335
+ * @return Api\Tag
336
+ */
337
+ public function tags()
338
+ {
339
+ return new Api\Tag($this->httpClient, $this->requestBuilder, $this->hydrator);
340
+ }
341
+
342
+ /**
343
+ * @return Api\Event
344
+ */
345
+ public function events()
346
+ {
347
+ return new Api\Event($this->httpClient, $this->requestBuilder, $this->hydrator);
348
+ }
349
+
350
+ /**
351
+ * @return Api\Route
352
+ */
353
+ public function routes()
354
+ {
355
+ return new Api\Route($this->httpClient, $this->requestBuilder, $this->hydrator);
356
+ }
357
+
358
+ /**
359
+ * @return Api\Webhook
360
+ */
361
+ public function webhooks()
362
+ {
363
+ return new Api\Webhook($this->httpClient, $this->requestBuilder, $this->hydrator, $this->apiKey);
364
+ }
365
+
366
+ /**
367
+ * @return Api\Message
368
+ */
369
+ public function messages()
370
+ {
371
+ return new Api\Message($this->httpClient, $this->requestBuilder, $this->hydrator);
372
+ }
373
+
374
+ /**
375
+ * @return Api\Suppression
376
+ */
377
+ public function suppressions()
378
+ {
379
+ return new Api\Suppression($this->httpClient, $this->requestBuilder, $this->hydrator);
380
+ }
381
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/BatchMessage.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Messages;
11
+
12
+ use Mailgun\Constants\Api;
13
+ use Mailgun\Constants\ExceptionMessages;
14
+ use Mailgun\Messages\Exceptions\MissingRequiredMIMEParameters;
15
+ use Mailgun\Messages\Exceptions\TooManyParameters;
16
+
17
+ /**
18
+ * This class is used for batch sending. See the official documentation (link below)
19
+ * for usage instructions.
20
+ *
21
+ * @see https://github.com/mailgun/mailgun-php/blob/master/src/Mailgun/Messages/README.md
22
+ */
23
+ class BatchMessage extends MessageBuilder
24
+ {
25
+ /**
26
+ * @var array
27
+ */
28
+ private $batchRecipientAttributes;
29
+
30
+ /**
31
+ * @var bool
32
+ */
33
+ private $autoSend;
34
+
35
+ /**
36
+ * @var \Mailgun\Connection\RestClient
37
+ */
38
+ private $restClient;
39
+
40
+ /**
41
+ * @var string
42
+ */
43
+ private $workingDomain;
44
+
45
+ /**
46
+ * @var array
47
+ */
48
+ private $messageIds = [];
49
+
50
+ /**
51
+ * @var string
52
+ */
53
+ private $endpointUrl;
54
+
55
+ /**
56
+ * @param \Mailgun\Connection\RestClient $restClient
57
+ * @param string $workingDomain
58
+ * @param bool $autoSend
59
+ */
60
+ public function __construct($restClient, $workingDomain, $autoSend)
61
+ {
62
+ $this->batchRecipientAttributes = [];
63
+ $this->autoSend = $autoSend;
64
+ $this->restClient = $restClient;
65
+ $this->workingDomain = $workingDomain;
66
+ $this->endpointUrl = $workingDomain.'/messages';
67
+ }
68
+
69
+ /**
70
+ * @param string $headerName
71
+ * @param string $address
72
+ * @param array $variables
73
+ *
74
+ * @throws MissingRequiredMIMEParameters
75
+ * @throws TooManyParameters
76
+ */
77
+ protected function addRecipient($headerName, $address, $variables)
78
+ {
79
+ if (array_key_exists($headerName, $this->counters['recipients'])) {
80
+ if ($this->counters['recipients'][$headerName] == Api::RECIPIENT_COUNT_LIMIT) {
81
+ if (false === $this->autoSend) {
82
+ throw new TooManyParameters(ExceptionMessages::TOO_MANY_RECIPIENTS);
83
+ }
84
+ $this->sendMessage();
85
+ }
86
+ }
87
+
88
+ $compiledAddress = $this->parseAddress($address, $variables);
89
+
90
+ if (isset($this->message[$headerName])) {
91
+ array_push($this->message[$headerName], $compiledAddress);
92
+ } elseif ($headerName == 'h:reply-to') {
93
+ $this->message[$headerName] = $compiledAddress;
94
+ } else {
95
+ $this->message[$headerName] = [$compiledAddress];
96
+ }
97
+
98
+ if (array_key_exists($headerName, $this->counters['recipients'])) {
99
+ $this->counters['recipients'][$headerName] += 1;
100
+ if (is_array($variables) && !array_key_exists('id', $variables)) {
101
+ $variables['id'] = $this->counters['recipients'][$headerName];
102
+ }
103
+ }
104
+ $this->batchRecipientAttributes["$address"] = $variables;
105
+ }
106
+
107
+ /**
108
+ * @param array $message
109
+ * @param array $files
110
+ *
111
+ * @throws MissingRequiredMIMEParameters
112
+ */
113
+ public function sendMessage($message = [], $files = [])
114
+ {
115
+ if (count($message) < 1) {
116
+ $message = $this->message;
117
+ $files = $this->files;
118
+ }
119
+ if (!array_key_exists('from', $message)) {
120
+ throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
121
+ } elseif (!array_key_exists('to', $message)) {
122
+ throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
123
+ } elseif (!array_key_exists('subject', $message)) {
124
+ throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
125
+ } elseif ((!array_key_exists('text', $message) && !array_key_exists('html', $message))) {
126
+ throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
127
+ } else {
128
+ $message['recipient-variables'] = json_encode($this->batchRecipientAttributes);
129
+ $response = $this->restClient->post($this->endpointUrl, $message, $files);
130
+ $this->batchRecipientAttributes = [];
131
+ $this->counters['recipients']['to'] = 0;
132
+ $this->counters['recipients']['cc'] = 0;
133
+ $this->counters['recipients']['bcc'] = 0;
134
+ unset($this->message['to']);
135
+ array_push($this->messageIds, $response->http_response_body->id);
136
+ }
137
+ }
138
+
139
+ /**
140
+ * @throws MissingRequiredMIMEParameters
141
+ */
142
+ public function finalize()
143
+ {
144
+ $this->sendMessage();
145
+ }
146
+
147
+ /**
148
+ * @return string[]
149
+ */
150
+ public function getMessageIds()
151
+ {
152
+ return $this->messageIds;
153
+ }
154
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/Exceptions/InvalidParameter.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Messages\Exceptions;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ class InvalidParameter extends \Exception implements Exception
15
+ {
16
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/Exceptions/InvalidParameterType.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Messages\Exceptions;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ class InvalidParameterType extends \Exception implements Exception
15
+ {
16
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/Exceptions/MissingRequiredMIMEParameters.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Messages\Exceptions;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ class MissingRequiredMIMEParameters extends \Exception implements Exception
15
+ {
16
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/Exceptions/TooManyParameters.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Messages\Exceptions;
11
+
12
+ use Mailgun\Exception;
13
+
14
+ class TooManyParameters extends \Exception implements Exception
15
+ {
16
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/MessageBuilder.php ADDED
@@ -0,0 +1,529 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Messages;
11
+
12
+ use Mailgun\Constants\Api;
13
+ use Mailgun\Constants\ExceptionMessages;
14
+ use Mailgun\Messages\Exceptions\InvalidParameter;
15
+ use Mailgun\Messages\Exceptions\TooManyParameters;
16
+
17
+ /**
18
+ * This class is used for composing a properly formed
19
+ * message object. Dealing with arrays can be cumbersome,
20
+ * this class makes the process easier. See the official
21
+ * documentation (link below) for usage instructions.
22
+ *
23
+ * @see https://github.com/mailgun/mailgun-php/blob/master/src/Mailgun/Messages/README.md
24
+ */
25
+ class MessageBuilder
26
+ {
27
+ /**
28
+ * @var array
29
+ */
30
+ protected $message = [];
31
+
32
+ /**
33
+ * @var array
34
+ */
35
+ protected $variables = [];
36
+
37
+ /**
38
+ * @var array
39
+ */
40
+ protected $files = [];
41
+
42
+ /**
43
+ * @var array
44
+ */
45
+ protected $counters = [
46
+ 'recipients' => [
47
+ 'to' => 0,
48
+ 'cc' => 0,
49
+ 'bcc' => 0,
50
+ ],
51
+ 'attributes' => [
52
+ 'attachment' => 0,
53
+ 'campaign_id' => 0,
54
+ 'custom_option' => 0,
55
+ 'tag' => 0,
56
+ ],
57
+ ];
58
+
59
+ /**
60
+ * @param array $params
61
+ * @param string $key
62
+ * @param mixed $default
63
+ *
64
+ * @return mixed
65
+ */
66
+ protected function safeGet($params, $key, $default)
67
+ {
68
+ if (array_key_exists($key, $params)) {
69
+ return $params[$key];
70
+ }
71
+
72
+ return $default;
73
+ }
74
+
75
+ /**
76
+ * @param array $params
77
+ *
78
+ * @return mixed|string
79
+ */
80
+ protected function getFullName($params)
81
+ {
82
+ if (array_key_exists('first', $params)) {
83
+ $first = $this->safeGet($params, 'first', '');
84
+ $last = $this->safeGet($params, 'last', '');
85
+
86
+ return trim("$first $last");
87
+ }
88
+
89
+ return $this->safeGet($params, 'full_name', '');
90
+ }
91
+
92
+ /**
93
+ * @param string $address
94
+ * @param array $variables
95
+ *
96
+ * @return string
97
+ */
98
+ protected function parseAddress($address, $variables)
99
+ {
100
+ if (!is_array($variables)) {
101
+ return $address;
102
+ }
103
+ $fullName = $this->getFullName($variables);
104
+ if ($fullName != null) {
105
+ return sprintf('"%s" <%s>', $fullName, $address);
106
+ }
107
+
108
+ return $address;
109
+ }
110
+
111
+ /**
112
+ * @param string $headerName
113
+ * @param string $address
114
+ * @param array $variables
115
+ */
116
+ protected function addRecipient($headerName, $address, $variables)
117
+ {
118
+ $compiledAddress = $this->parseAddress($address, $variables);
119
+
120
+ if ($headerName === 'h:reply-to') {
121
+ $this->message[$headerName] = $compiledAddress;
122
+ } elseif (isset($this->message[$headerName])) {
123
+ array_push($this->message[$headerName], $compiledAddress);
124
+ } else {
125
+ $this->message[$headerName] = [$compiledAddress];
126
+ }
127
+ if (array_key_exists($headerName, $this->counters['recipients'])) {
128
+ $this->counters['recipients'][$headerName] += 1;
129
+ }
130
+ }
131
+
132
+ /**
133
+ * @param string $address
134
+ * @param array|null $variables
135
+ *
136
+ * @throws TooManyParameters
137
+ *
138
+ * @return mixed
139
+ */
140
+ public function addToRecipient($address, $variables = null)
141
+ {
142
+ if ($this->counters['recipients']['to'] > Api::RECIPIENT_COUNT_LIMIT) {
143
+ throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_RECIPIENT);
144
+ }
145
+
146
+ $variables = is_array($variables) ? $variables : [];
147
+
148
+ $this->addRecipient('to', $address, $variables);
149
+
150
+ return end($this->message['to']);
151
+ }
152
+
153
+ /**
154
+ * @param string $address
155
+ * @param array|null $variables
156
+ *
157
+ * @throws TooManyParameters
158
+ *
159
+ * @return mixed
160
+ */
161
+ public function addCcRecipient($address, $variables = null)
162
+ {
163
+ if ($this->counters['recipients']['cc'] > Api::RECIPIENT_COUNT_LIMIT) {
164
+ throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_RECIPIENT);
165
+ }
166
+
167
+ $variables = is_array($variables) ? $variables : [];
168
+
169
+ $this->addRecipient('cc', $address, $variables);
170
+
171
+ return end($this->message['cc']);
172
+ }
173
+
174
+ /**
175
+ * @param string $address
176
+ * @param array|null $variables
177
+ *
178
+ * @throws TooManyParameters
179
+ *
180
+ * @return mixed
181
+ */
182
+ public function addBccRecipient($address, $variables = null)
183
+ {
184
+ if ($this->counters['recipients']['bcc'] > Api::RECIPIENT_COUNT_LIMIT) {
185
+ throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_RECIPIENT);
186
+ }
187
+
188
+ $variables = is_array($variables) ? $variables : [];
189
+
190
+ $this->addRecipient('bcc', $address, $variables);
191
+
192
+ return end($this->message['bcc']);
193
+ }
194
+
195
+ /**
196
+ * @param string $address
197
+ * @param array|null $variables
198
+ *
199
+ * @return mixed
200
+ */
201
+ public function setFromAddress($address, $variables = null)
202
+ {
203
+ $variables = is_array($variables) ? $variables : [];
204
+
205
+ $this->addRecipient('from', $address, $variables);
206
+
207
+ return $this->message['from'];
208
+ }
209
+
210
+ /**
211
+ * @param string $address
212
+ * @param array|null $variables
213
+ *
214
+ * @return mixed
215
+ */
216
+ public function setReplyToAddress($address, $variables = null)
217
+ {
218
+ $variables = is_array($variables) ? $variables : [];
219
+
220
+ $this->addRecipient('h:reply-to', $address, $variables);
221
+
222
+ return $this->message['h:reply-to'];
223
+ }
224
+
225
+ /**
226
+ * @param string $subject
227
+ *
228
+ * @return mixed
229
+ */
230
+ public function setSubject($subject = '')
231
+ {
232
+ if ($subject == null || $subject == '') {
233
+ $subject = ' ';
234
+ }
235
+ $this->message['subject'] = $subject;
236
+
237
+ return $this->message['subject'];
238
+ }
239
+
240
+ /**
241
+ * @param string $headerName
242
+ * @param mixed $headerData
243
+ *
244
+ * @return mixed
245
+ */
246
+ public function addCustomHeader($headerName, $headerData)
247
+ {
248
+ if (!preg_match('/^h:/i', $headerName)) {
249
+ $headerName = 'h:'.$headerName;
250
+ }
251
+
252
+ if (array_key_exists($headerName, $this->message)) {
253
+ if (is_array($this->message[$headerName])) {
254
+ $this->message[$headerName][] = $headerData;
255
+ } else {
256
+ $this->message[$headerName] = [$this->message[$headerName], $headerData];
257
+ }
258
+ } else {
259
+ $this->message[$headerName] = $headerData;
260
+ }
261
+
262
+ return $this->message[$headerName];
263
+ }
264
+
265
+ /**
266
+ * @param string $textBody
267
+ *
268
+ * @return string
269
+ */
270
+ public function setTextBody($textBody)
271
+ {
272
+ if ($textBody == null || $textBody == '') {
273
+ $textBody = ' ';
274
+ }
275
+ $this->message['text'] = $textBody;
276
+
277
+ return $this->message['text'];
278
+ }
279
+
280
+ /**
281
+ * @param string $htmlBody
282
+ *
283
+ * @return string
284
+ */
285
+ public function setHtmlBody($htmlBody)
286
+ {
287
+ if ($htmlBody == null || $htmlBody == '') {
288
+ $htmlBody = ' ';
289
+ }
290
+ $this->message['html'] = $htmlBody;
291
+
292
+ return $this->message['html'];
293
+ }
294
+
295
+ /**
296
+ * @param string $attachmentPath
297
+ * @param string|null $attachmentName
298
+ *
299
+ * @return bool
300
+ */
301
+ public function addAttachment($attachmentPath, $attachmentName = null)
302
+ {
303
+ if (isset($this->files['attachment'])) {
304
+ $attachment = [
305
+ 'filePath' => $attachmentPath,
306
+ 'remoteName' => $attachmentName,
307
+ ];
308
+ array_push($this->files['attachment'], $attachment);
309
+ } else {
310
+ $this->files['attachment'] = [
311
+ [
312
+ 'filePath' => $attachmentPath,
313
+ 'remoteName' => $attachmentName,
314
+ ],
315
+ ];
316
+ }
317
+
318
+ return true;
319
+ }
320
+
321
+ /**
322
+ * @param string $inlineImagePath
323
+ * @param string|null $inlineImageName
324
+ *
325
+ * @throws InvalidParameter
326
+ *
327
+ * @return bool
328
+ */
329
+ public function addInlineImage($inlineImagePath, $inlineImageName = null)
330
+ {
331
+ if (strpos($inlineImagePath, '@') !== 0) {
332
+ throw new InvalidParameter(ExceptionMessages::INVALID_PARAMETER_INLINE);
333
+ }
334
+
335
+ $this->files['inline'][] = [
336
+ 'filePath' => $inlineImagePath,
337
+ 'remoteName' => $inlineImageName,
338
+ ];
339
+
340
+ return true;
341
+ }
342
+
343
+ /**
344
+ * @param bool $testMode
345
+ *
346
+ * @return string
347
+ */
348
+ public function setTestMode($testMode)
349
+ {
350
+ if (filter_var($testMode, FILTER_VALIDATE_BOOLEAN)) {
351
+ $testMode = 'yes';
352
+ } else {
353
+ $testMode = 'no';
354
+ }
355
+ $this->message['o:testmode'] = $testMode;
356
+
357
+ return $this->message['o:testmode'];
358
+ }
359
+
360
+ /**
361
+ * @param string|int $campaignId
362
+ *
363
+ * @throws TooManyParameters
364
+ *
365
+ * @return string|int
366
+ */
367
+ public function addCampaignId($campaignId)
368
+ {
369
+ if ($this->counters['attributes']['campaign_id'] < Api::CAMPAIGN_ID_LIMIT) {
370
+ if (isset($this->message['o:campaign'])) {
371
+ array_push($this->message['o:campaign'], $campaignId);
372
+ } else {
373
+ $this->message['o:campaign'] = [$campaignId];
374
+ }
375
+ $this->counters['attributes']['campaign_id'] += 1;
376
+
377
+ return $this->message['o:campaign'];
378
+ } else {
379
+ throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_CAMPAIGNS);
380
+ }
381
+ }
382
+
383
+ /**
384
+ * @param string $tag
385
+ *
386
+ * @throws TooManyParameters
387
+ */
388
+ public function addTag($tag)
389
+ {
390
+ if ($this->counters['attributes']['tag'] < Api::TAG_LIMIT) {
391
+ if (isset($this->message['o:tag'])) {
392
+ array_push($this->message['o:tag'], $tag);
393
+ } else {
394
+ $this->message['o:tag'] = [$tag];
395
+ }
396
+ $this->counters['attributes']['tag'] += 1;
397
+
398
+ return $this->message['o:tag'];
399
+ } else {
400
+ throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_TAGS);
401
+ }
402
+ }
403
+
404
+ /**
405
+ * @param bool $enabled
406
+ *
407
+ * @return mixed
408
+ */
409
+ public function setDkim($enabled)
410
+ {
411
+ if (filter_var($enabled, FILTER_VALIDATE_BOOLEAN)) {
412
+ $enabled = 'yes';
413
+ } else {
414
+ $enabled = 'no';
415
+ }
416
+ $this->message['o:dkim'] = $enabled;
417
+
418
+ return $this->message['o:dkim'];
419
+ }
420
+
421
+ /**
422
+ * @param bool $enabled
423
+ *
424
+ * @return string
425
+ */
426
+ public function setOpenTracking($enabled)
427
+ {
428
+ if (filter_var($enabled, FILTER_VALIDATE_BOOLEAN)) {
429
+ $enabled = 'yes';
430
+ } else {
431
+ $enabled = 'no';
432
+ }
433
+ $this->message['o:tracking-opens'] = $enabled;
434
+
435
+ return $this->message['o:tracking-opens'];
436
+ }
437
+
438
+ /**
439
+ * @param bool $enabled
440
+ *
441
+ * @return string
442
+ */
443
+ public function setClickTracking($enabled)
444
+ {
445
+ if (filter_var($enabled, FILTER_VALIDATE_BOOLEAN)) {
446
+ $enabled = 'yes';
447
+ } elseif ($enabled == 'html') {
448
+ $enabled = 'html';
449
+ } else {
450
+ $enabled = 'no';
451
+ }
452
+ $this->message['o:tracking-clicks'] = $enabled;
453
+
454
+ return $this->message['o:tracking-clicks'];
455
+ }
456
+
457
+ /**
458
+ * @param string $timeDate
459
+ * @param string|null $timeZone
460
+ *
461
+ * @return string
462
+ */
463
+ public function setDeliveryTime($timeDate, $timeZone = null)
464
+ {
465
+ if (isset($timeZone)) {
466
+ $timeZoneObj = new \DateTimeZone("$timeZone");
467
+ } else {
468
+ $timeZoneObj = new \DateTimeZone(Api::DEFAULT_TIME_ZONE);
469
+ }
470
+
471
+ $dateTimeObj = new \DateTime($timeDate, $timeZoneObj);
472
+ $formattedTimeDate = $dateTimeObj->format(\DateTime::RFC2822);
473
+ $this->message['o:deliverytime'] = $formattedTimeDate;
474
+
475
+ return $this->message['o:deliverytime'];
476
+ }
477
+
478
+ /**
479
+ * @param string $customName
480
+ * @param mixed $data
481
+ */
482
+ public function addCustomData($customName, $data)
483
+ {
484
+ $this->message['v:'.$customName] = json_encode($data);
485
+ }
486
+
487
+ /**
488
+ * @param string $parameterName
489
+ * @param mixed $data
490
+ *
491
+ * @return mixed
492
+ */
493
+ public function addCustomParameter($parameterName, $data)
494
+ {
495
+ if (isset($this->message[$parameterName])) {
496
+ array_push($this->message[$parameterName], $data);
497
+
498
+ return $this->message[$parameterName];
499
+ } else {
500
+ $this->message[$parameterName] = [$data];
501
+
502
+ return $this->message[$parameterName];
503
+ }
504
+ }
505
+
506
+ /**
507
+ * @param array $message
508
+ */
509
+ public function setMessage($message)
510
+ {
511
+ $this->message = $message;
512
+ }
513
+
514
+ /**
515
+ * @return array
516
+ */
517
+ public function getMessage()
518
+ {
519
+ return $this->message;
520
+ }
521
+
522
+ /**
523
+ * @return array
524
+ */
525
+ public function getFiles()
526
+ {
527
+ return $this->files;
528
+ }
529
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Messages/README.md ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Mailgun - Messages
2
+ ====================
3
+
4
+ This is the Mailgun PHP *Message* utilities.
5
+
6
+ The below assumes you've already installed the Mailgun PHP SDK in to your
7
+ project. If not, go back to the master README for instructions.
8
+
9
+ There are two utilities included, Message Builder and Batch Message.
10
+
11
+ Message Builder: Allows you to build a message object by calling methods for
12
+ each MIME attribute.
13
+ Batch Message: Inherits Message Builder and allows you to iterate through
14
+ recipients from a list. Messages will fire after the 1,000th recipient has been
15
+ added.
16
+
17
+ Usage - Message Builder
18
+ -----------------------
19
+ Here's how to use Message Builder to build your Message.
20
+
21
+ ```php
22
+ # First, instantiate the SDK with your API credentials and define your domain.
23
+ $mg = new Mailgun("key-example");
24
+ $domain = "example.com";
25
+
26
+ # Next, instantiate a Message Builder object from the SDK.
27
+ $messageBldr = $mg->MessageBuilder();
28
+
29
+ # Define the from address.
30
+ $messageBldr->setFromAddress("me@example.com", array("first"=>"PHP", "last" => "SDK"));
31
+ # Define a to recipient.
32
+ $messageBldr->addToRecipient("john.doe@example.com", array("first" => "John", "last" => "Doe"));
33
+ # Define a cc recipient.
34
+ $messageBldr->addCcRecipient("sally.doe@example.com", array("first" => "Sally", "last" => "Doe"));
35
+ # Define the subject.
36
+ $messageBldr->setSubject("A message from the PHP SDK using Message Builder!");
37
+ # Define the body of the message.
38
+ $messageBldr->setTextBody("This is the text body of the message!");
39
+
40
+ # Other Optional Parameters.
41
+ $messageBldr->addCampaignId("My-Awesome-Campaign");
42
+ $messageBldr->addCustomHeader("Customer-Id", "12345");
43
+ $messageBldr->addAttachment("@/tron.jpg");
44
+ $messageBldr->setDeliveryTime("tomorrow 8:00AM", "PST");
45
+ $messageBldr->setClickTracking(true);
46
+
47
+ # Finally, send the message.
48
+ $mg->post("{$domain}/messages", $messageBldr->getMessage(), $messageBldr->getFiles());
49
+ ```
50
+
51
+ Available Functions
52
+ -----------------------------------------------------
53
+
54
+ `string addToRecipient(string $address, array $attributes)`
55
+
56
+ `string addCcRecipient(string $address, array $attributes)`
57
+
58
+ `string addBccRecipient(string $address, array $attributes)`
59
+
60
+ `string setFromAddress(string $address, array $attributes)`
61
+
62
+ `string setSubject(string $subject)`
63
+
64
+ `string setTextBody(string $textBody)`
65
+
66
+ `string setHtmlBody(string $htmlBody)`
67
+
68
+ `bool addAttachment(string $attachmentPath, $attachmentName = null)`
69
+
70
+ `bool addInlineImage(string $inlineImagePath)`
71
+
72
+ `string setTestMode(bool $testMode)`
73
+
74
+ `string addCampaignId(string $campaignId)`
75
+
76
+ `string setDkim(bool $enabled)`
77
+
78
+ `string setOpenTracking($enabled)`
79
+
80
+ `string setClickTracking($enabled)`
81
+
82
+ `string setDeliveryTime(string $timeDate, string $timeZone)`
83
+
84
+ `string addCustomData(string $optionName, string $data)`
85
+
86
+ `string addCustomParameter(string $parameterName, string $data)`
87
+
88
+ `array getMessage()`
89
+
90
+ `array getFiles()`
91
+
92
+
93
+ Usage - Batch Message
94
+ ---------------------
95
+ Here's how to use Batch Message to easily handle batch sending jobs.
96
+
97
+ ```php
98
+ # First, instantiate the SDK with your API credentials and define your domain.
99
+ $mg = new Mailgun("key-example");
100
+ $domain = "example.com";
101
+
102
+ # Next, instantiate a Message Builder object from the SDK, pass in your sending
103
+ domain.
104
+ $batchMsg = $mg->BatchMessage($domain);
105
+
106
+ # Define the from address.
107
+ $batchMsg->setFromAddress("me@example.com", array("first"=>"PHP", "last" => "SDK"));
108
+ # Define the subject.
109
+ $batchMsg->setSubject("A Batch Message from the PHP SDK!");
110
+ # Define the body of the message.
111
+ $batchMsg->setTextBody("This is the text body of the message!");
112
+
113
+ # Next, let's add a few recipients to the batch job.
114
+ $batchMsg->addToRecipient("john.doe@example.com", array("first" => "John", "last" => "Doe"));
115
+ $batchMsg->addToRecipient("sally.doe@example.com", array("first" => "Sally", "last" => "Doe"));
116
+ $batchMsg->addToRecipient("mike.jones@example.com", array("first" => "Mike", "last" => "Jones"));
117
+ ...
118
+ // After 1,000 recipients, Batch Message will automatically post your message to
119
+ the messages endpoint.
120
+
121
+ // Call finalize() to send any remaining recipients still in the buffer.
122
+ $batchMsg->finalize();
123
+
124
+ ```
125
+
126
+ Available Functions (Inherits all Batch Message and Messages Functions)
127
+ -----------------------------------------------------------------------
128
+
129
+ `addToRecipient(string $address, string $attributes)`
130
+
131
+ `sendMessage(array $message, array $files)`
132
+
133
+ `array finalize()`
134
+
135
+ More Documentation
136
+ ------------------
137
+ See the official [Mailgun Docs](http://documentation.mailgun.com/api-sending.html)
138
+ for more information.
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/ApiResponse.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model;
11
+
12
+ /**
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ interface ApiResponse
16
+ {
17
+ /**
18
+ * Create an API response object from the HTTP response from the API server.
19
+ *
20
+ * @param array $data
21
+ *
22
+ * @return self
23
+ */
24
+ public static function create(array $data);
25
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/ConnectionResponse.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class ConnectionResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var bool
21
+ */
22
+ private $noVerify;
23
+
24
+ /**
25
+ * @var bool
26
+ */
27
+ private $requireTLS;
28
+
29
+ /**
30
+ * @param array $data
31
+ *
32
+ * @return self
33
+ */
34
+ public static function create(array $data)
35
+ {
36
+ if (!isset($data['connection'])) {
37
+ return;
38
+ }
39
+ $connSettings = $data['connection'];
40
+
41
+ return new self(
42
+ isset($connSettings['skip_verification']) ? $connSettings['skip_verification'] : null,
43
+ isset($connSettings['require_tls']) ? $connSettings['require_tls'] : null
44
+ );
45
+ }
46
+
47
+ /**
48
+ * @param bool $noVerify Disable remote TLS certificate verification
49
+ * @param bool $requireTLS Requires TLS for all outbound communication
50
+ */
51
+ private function __construct($noVerify, $requireTLS)
52
+ {
53
+ $this->noVerify = $noVerify;
54
+ $this->requireTLS = $requireTLS;
55
+ }
56
+
57
+ /**
58
+ * @return bool
59
+ */
60
+ public function getSkipVerification()
61
+ {
62
+ return $this->noVerify;
63
+ }
64
+
65
+ /**
66
+ * @return bool
67
+ */
68
+ public function getRequireTLS()
69
+ {
70
+ return $this->requireTLS;
71
+ }
72
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/CreateCredentialResponse.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class CreateCredentialResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $message;
23
+
24
+ /**
25
+ * @param string $message
26
+ */
27
+ private function __construct($message)
28
+ {
29
+ $this->message = $message;
30
+ }
31
+
32
+ /**
33
+ * @param array $data
34
+ *
35
+ * @return self
36
+ */
37
+ public static function create(array $data)
38
+ {
39
+ return new self(isset($data['message']) ? $data['message'] : null);
40
+ }
41
+
42
+ /**
43
+ * @return string
44
+ */
45
+ public function getMessage()
46
+ {
47
+ return $this->message;
48
+ }
49
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/CreateResponse.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class CreateResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $message;
23
+
24
+ /**
25
+ * @var Domain
26
+ */
27
+ private $domain;
28
+
29
+ /**
30
+ * @var DnsRecord[]
31
+ */
32
+ private $inboundDnsRecords;
33
+
34
+ /**
35
+ * @var DnsRecord[]
36
+ */
37
+ private $outboundDnsRecords;
38
+
39
+ /**
40
+ * @param array $data
41
+ *
42
+ * @return self
43
+ */
44
+ public static function create(array $data)
45
+ {
46
+ $rx = [];
47
+ $tx = [];
48
+ $domain = null;
49
+ $message = null;
50
+
51
+ if (isset($data['domain'])) {
52
+ $domain = Domain::create($data['domain']);
53
+ }
54
+
55
+ if (isset($data['message'])) {
56
+ $message = $data['message'];
57
+ }
58
+
59
+ if (isset($data['receiving_dns_records'])) {
60
+ foreach ($data['receiving_dns_records'] as $item) {
61
+ $rx[] = DnsRecord::create($item);
62
+ }
63
+ }
64
+
65
+ if (isset($data['sending_dns_records'])) {
66
+ foreach ($data['sending_dns_records'] as $item) {
67
+ $tx[] = DnsRecord::create($item);
68
+ }
69
+ }
70
+
71
+ return new self($domain, $rx, $tx, $message);
72
+ }
73
+
74
+ /**
75
+ * @param Domain $domainInfo
76
+ * @param DnsRecord[] $rxRecords
77
+ * @param DnsRecord[] $txRecords
78
+ * @param string $message
79
+ */
80
+ private function __construct(Domain $domainInfo, array $rxRecords, array $txRecords, $message)
81
+ {
82
+ $this->domain = $domainInfo;
83
+ $this->inboundDnsRecords = $rxRecords;
84
+ $this->outboundDnsRecords = $txRecords;
85
+ $this->message = $message;
86
+ }
87
+
88
+ /**
89
+ * @return Domain
90
+ */
91
+ public function getDomain()
92
+ {
93
+ return $this->domain;
94
+ }
95
+
96
+ /**
97
+ * @return DnsRecord[]
98
+ */
99
+ public function getInboundDNSRecords()
100
+ {
101
+ return $this->inboundDnsRecords;
102
+ }
103
+
104
+ /**
105
+ * @return DnsRecord[]
106
+ */
107
+ public function getOutboundDNSRecords()
108
+ {
109
+ return $this->outboundDnsRecords;
110
+ }
111
+
112
+ /**
113
+ * @return string
114
+ */
115
+ public function getMessage()
116
+ {
117
+ return $this->message;
118
+ }
119
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/CredentialResponse.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class CredentialResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var int
21
+ */
22
+ private $totalCount;
23
+
24
+ /**
25
+ * @var CredentialResponseItem[]
26
+ */
27
+ private $items;
28
+
29
+ /**
30
+ * @param array $data
31
+ *
32
+ * @return self
33
+ */
34
+ public static function create(array $data)
35
+ {
36
+ $items = [];
37
+ if (isset($data['items'])) {
38
+ foreach ($data['items'] as $item) {
39
+ $items[] = CredentialResponseItem::create($item);
40
+ }
41
+ }
42
+
43
+ if (isset($data['total_count'])) {
44
+ $count = $data['total_count'];
45
+ } else {
46
+ $count = count($items);
47
+ }
48
+
49
+ return new self($count, $items);
50
+ }
51
+
52
+ /**
53
+ * @param int $totalCount
54
+ * @param CredentialResponseItem[] $items
55
+ */
56
+ private function __construct($totalCount, array $items)
57
+ {
58
+ $this->totalCount = $totalCount;
59
+ $this->items = $items;
60
+ }
61
+
62
+ /**
63
+ * @return int
64
+ */
65
+ public function getTotalCount()
66
+ {
67
+ return $this->totalCount;
68
+ }
69
+
70
+ /**
71
+ * @return CredentialResponseItem[]
72
+ */
73
+ public function getCredentials()
74
+ {
75
+ return $this->items;
76
+ }
77
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/CredentialResponseItem.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ /**
13
+ * @author Sean Johnson <sean@mailgun.com>
14
+ */
15
+ final class CredentialResponseItem
16
+ {
17
+ /**
18
+ * @var int|null
19
+ */
20
+ private $sizeBytes;
21
+
22
+ /**
23
+ * @var \DateTime
24
+ */
25
+ private $createdAt;
26
+
27
+ /**
28
+ * @var string
29
+ */
30
+ private $mailbox;
31
+
32
+ /**
33
+ * @var string
34
+ */
35
+ private $login;
36
+
37
+ /**
38
+ * @param array $data
39
+ *
40
+ * @return self
41
+ */
42
+ public static function create(array $data)
43
+ {
44
+ $sizeBytes = isset($data['size_bytes']) ? $data['size_bytes'] : null;
45
+ $mailbox = isset($data['mailbox']) ? $data['mailbox'] : null;
46
+ $login = isset($data['login']) ? $data['login'] : null;
47
+ $createdAt = isset($data['created_at']) ? new \DateTime($data['created_at']) : null;
48
+
49
+ return new self($sizeBytes, $createdAt, $mailbox, $login);
50
+ }
51
+
52
+ /**
53
+ * @param int $sizeBytes
54
+ * @param \DateTime $createdAt
55
+ * @param string $mailbox
56
+ * @param string $login
57
+ */
58
+ private function __construct($sizeBytes, \DateTime $createdAt, $mailbox, $login)
59
+ {
60
+ $this->sizeBytes = $sizeBytes;
61
+ $this->createdAt = $createdAt;
62
+ $this->mailbox = $mailbox;
63
+ $this->login = $login;
64
+ }
65
+
66
+ /**
67
+ * @return int|null
68
+ */
69
+ public function getSizeBytes()
70
+ {
71
+ return $this->sizeBytes;
72
+ }
73
+
74
+ /**
75
+ * @return \DateTime
76
+ */
77
+ public function getCreatedAt()
78
+ {
79
+ return $this->createdAt;
80
+ }
81
+
82
+ /**
83
+ * @return string
84
+ */
85
+ public function getMailbox()
86
+ {
87
+ return $this->mailbox;
88
+ }
89
+
90
+ /**
91
+ * @return string
92
+ */
93
+ public function getLogin()
94
+ {
95
+ return $this->login;
96
+ }
97
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/DeleteCredentialResponse.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class DeleteCredentialResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $message;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ private $error;
28
+
29
+ /**
30
+ * @var string
31
+ */
32
+ private $spec;
33
+
34
+ /**
35
+ * @param string $message
36
+ * @param string $error
37
+ * @param string $spec
38
+ */
39
+ private function __construct($message, $error, $spec)
40
+ {
41
+ $this->message = $message;
42
+ $this->error = $error;
43
+ $this->spec = $spec;
44
+ }
45
+
46
+ /**
47
+ * @param array $data
48
+ *
49
+ * @return self
50
+ */
51
+ public static function create(array $data)
52
+ {
53
+ return new self(
54
+ isset($data['message']) ? $data['message'] : null,
55
+ isset($data['error']) ? $data['error'] : null,
56
+ isset($data['spec']) ? $data['spec'] : null
57
+ );
58
+ }
59
+
60
+ /**
61
+ * @return string
62
+ */
63
+ public function getMessage()
64
+ {
65
+ return $this->message;
66
+ }
67
+
68
+ /**
69
+ * @return string
70
+ */
71
+ public function getError()
72
+ {
73
+ return $this->error;
74
+ }
75
+
76
+ /**
77
+ * @return string
78
+ */
79
+ public function getSpec()
80
+ {
81
+ return $this->spec;
82
+ }
83
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/DeleteResponse.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class DeleteResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $message;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ private $error;
28
+
29
+ /**
30
+ * @param string $message
31
+ * @param string $error
32
+ */
33
+ private function __construct($message, $error)
34
+ {
35
+ $this->message = $message;
36
+ $this->error = $error;
37
+ }
38
+
39
+ /**
40
+ * @param array $data
41
+ *
42
+ * @return self
43
+ */
44
+ public static function create(array $data)
45
+ {
46
+ return new self(
47
+ isset($data['message']) ? $data['message'] : null,
48
+ isset($data['error']) ? $data['error'] : null
49
+ );
50
+ }
51
+
52
+ /**
53
+ * @return string
54
+ */
55
+ public function getMessage()
56
+ {
57
+ return $this->message;
58
+ }
59
+
60
+ /**
61
+ * @return string
62
+ */
63
+ public function getError()
64
+ {
65
+ return $this->error;
66
+ }
67
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/DnsRecord.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ /**
13
+ * Represents a single DNS record for a domain.
14
+ *
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class DnsRecord
18
+ {
19
+ /**
20
+ * @var string|null
21
+ */
22
+ private $name;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ private $type;
28
+
29
+ /**
30
+ * @var string
31
+ */
32
+ private $value;
33
+
34
+ /**
35
+ * @var string|null
36
+ */
37
+ private $priority;
38
+
39
+ /**
40
+ * @var string
41
+ */
42
+ private $valid;
43
+
44
+ /**
45
+ * @param array $data
46
+ *
47
+ * @return self
48
+ */
49
+ public static function create(array $data)
50
+ {
51
+ $name = isset($data['name']) ? $data['name'] : null;
52
+ $priority = isset($data['priority']) ? $data['priority'] : null;
53
+ $recordType = isset($data['record_type']) ? $data['record_type'] : null;
54
+ $value = isset($data['value']) ? $data['value'] : null;
55
+ $valid = isset($data['valid']) ? $data['valid'] : null;
56
+
57
+ return new self($name, $recordType, $value, $priority, $valid);
58
+ }
59
+
60
+ /**
61
+ * @param string|null $name Name of the record, as used in CNAME, etc.
62
+ * @param string $type DNS record type
63
+ * @param string $value DNS record value
64
+ * @param string|null $priority Record priority, used for MX
65
+ * @param string $valid DNS record has been added to domain DNS?
66
+ */
67
+ private function __construct($name, $type, $value, $priority, $valid)
68
+ {
69
+ $this->name = $name;
70
+ $this->type = $type;
71
+ $this->value = $value;
72
+ $this->priority = $priority;
73
+ $this->valid = $valid;
74
+ }
75
+
76
+ /**
77
+ * @return string|null
78
+ */
79
+ public function getName()
80
+ {
81
+ return $this->name;
82
+ }
83
+
84
+ /**
85
+ * @return string
86
+ */
87
+ public function getType()
88
+ {
89
+ return $this->type;
90
+ }
91
+
92
+ /**
93
+ * @return string
94
+ */
95
+ public function getValue()
96
+ {
97
+ return $this->value;
98
+ }
99
+
100
+ /**
101
+ * @return string|null
102
+ */
103
+ public function getPriority()
104
+ {
105
+ return $this->priority;
106
+ }
107
+
108
+ /**
109
+ * @return bool
110
+ */
111
+ public function isValid()
112
+ {
113
+ return 'valid' === $this->valid;
114
+ }
115
+
116
+ /**
117
+ * @return string
118
+ */
119
+ public function getValidity()
120
+ {
121
+ return $this->valid;
122
+ }
123
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/Domain.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ /**
13
+ * Represents domain information in its simplest form.
14
+ *
15
+ * @author Sean Johnson <sean@ramcloud.io>
16
+ */
17
+ final class Domain
18
+ {
19
+ /**
20
+ * @var \DateTime
21
+ */
22
+ private $createdAt;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ private $smtpLogin;
28
+
29
+ /**
30
+ * @var string
31
+ */
32
+ private $name;
33
+
34
+ /**
35
+ * @var string
36
+ */
37
+ private $smtpPassword;
38
+
39
+ /**
40
+ * @var bool
41
+ */
42
+ private $wildcard;
43
+
44
+ /**
45
+ * @var string
46
+ */
47
+ private $spamAction;
48
+
49
+ /**
50
+ * @var string
51
+ */
52
+ private $state;
53
+
54
+ /**
55
+ * @param array $data
56
+ *
57
+ * @return self
58
+ */
59
+ public static function create(array $data)
60
+ {
61
+ return new self(
62
+ isset($data['name']) ? $data['name'] : null,
63
+ isset($data['smtp_login']) ? $data['smtp_login'] : null,
64
+ isset($data['smtp_password']) ? $data['smtp_password'] : null,
65
+ isset($data['wildcard']) ? $data['wildcard'] : null,
66
+ isset($data['spam_action']) ? $data['spam_action'] : null,
67
+ isset($data['state']) ? $data['state'] : null,
68
+ isset($data['created_at']) ? new \DateTime($data['created_at']) : null
69
+ );
70
+ }
71
+
72
+ /**
73
+ * @param string $name
74
+ * @param string $smtpLogin
75
+ * @param string $smtpPassword
76
+ * @param bool $wildcard
77
+ * @param string $spamAction
78
+ * @param string $state
79
+ * @param \DateTime $createdAt
80
+ */
81
+ private function __construct($name, $smtpLogin, $smtpPassword, $wildcard, $spamAction, $state, \DateTime $createdAt)
82
+ {
83
+ $this->name = $name;
84
+ $this->smtpLogin = $smtpLogin;
85
+ $this->smtpPassword = $smtpPassword;
86
+ $this->wildcard = $wildcard;
87
+ $this->spamAction = $spamAction;
88
+ $this->state = $state;
89
+ $this->createdAt = $createdAt;
90
+ }
91
+
92
+ /**
93
+ * @return string
94
+ */
95
+ public function getName()
96
+ {
97
+ return $this->name;
98
+ }
99
+
100
+ /**
101
+ * @return string
102
+ */
103
+ public function getSmtpUsername()
104
+ {
105
+ return $this->smtpLogin;
106
+ }
107
+
108
+ /**
109
+ * @return string
110
+ */
111
+ public function getSmtpPassword()
112
+ {
113
+ return $this->smtpPassword;
114
+ }
115
+
116
+ /**
117
+ * @return bool
118
+ */
119
+ public function isWildcard()
120
+ {
121
+ return $this->wildcard;
122
+ }
123
+
124
+ /**
125
+ * @return string
126
+ */
127
+ public function getSpamAction()
128
+ {
129
+ return $this->spamAction;
130
+ }
131
+
132
+ /**
133
+ * @return string
134
+ */
135
+ public function getState()
136
+ {
137
+ return $this->state;
138
+ }
139
+
140
+ /**
141
+ * @return \DateTime
142
+ */
143
+ public function getCreatedAt()
144
+ {
145
+ return $this->createdAt;
146
+ }
147
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/IndexResponse.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class IndexResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var int
21
+ */
22
+ private $totalCount;
23
+
24
+ /**
25
+ * @var Domain[]
26
+ */
27
+ private $items;
28
+
29
+ /**
30
+ * @param array $data
31
+ *
32
+ * @return self
33
+ */
34
+ public static function create(array $data)
35
+ {
36
+ $items = [];
37
+
38
+ if (isset($data['items'])) {
39
+ foreach ($data['items'] as $item) {
40
+ $items[] = Domain::create($item);
41
+ }
42
+ }
43
+
44
+ if (isset($data['total_count'])) {
45
+ $count = $data['total_count'];
46
+ } else {
47
+ $count = count($items);
48
+ }
49
+
50
+ return new self($count, $items);
51
+ }
52
+
53
+ /**
54
+ * @param int $totalCount
55
+ * @param Domain[] $items
56
+ */
57
+ private function __construct($totalCount, array $items)
58
+ {
59
+ $this->totalCount = $totalCount;
60
+ $this->items = $items;
61
+ }
62
+
63
+ /**
64
+ * @return int
65
+ */
66
+ public function getTotalCount()
67
+ {
68
+ return $this->totalCount;
69
+ }
70
+
71
+ /**
72
+ * @return Domain[]
73
+ */
74
+ public function getDomains()
75
+ {
76
+ return $this->items;
77
+ }
78
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/ShowResponse.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class ShowResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var Domain
21
+ */
22
+ private $domain;
23
+
24
+ /**
25
+ * @var DnsRecord[]
26
+ */
27
+ private $inboundDnsRecords;
28
+
29
+ /**
30
+ * @var DnsRecord[]
31
+ */
32
+ private $outboundDnsRecords;
33
+
34
+ /**
35
+ * @param array $data
36
+ *
37
+ * @return self
38
+ */
39
+ public static function create(array $data)
40
+ {
41
+ $rx = [];
42
+ $tx = [];
43
+ $domain = null;
44
+
45
+ if (isset($data['domain'])) {
46
+ $domain = Domain::create($data['domain']);
47
+ }
48
+
49
+ if (isset($data['receiving_dns_records'])) {
50
+ foreach ($data['receiving_dns_records'] as $item) {
51
+ $rx[] = DnsRecord::create($item);
52
+ }
53
+ }
54
+
55
+ if (isset($data['sending_dns_records'])) {
56
+ foreach ($data['sending_dns_records'] as $item) {
57
+ $tx[] = DnsRecord::create($item);
58
+ }
59
+ }
60
+
61
+ return new self($domain, $rx, $tx);
62
+ }
63
+
64
+ /**
65
+ * @param Domain $domainInfo
66
+ * @param DnsRecord[] $rxRecords
67
+ * @param DnsRecord[] $txRecords
68
+ */
69
+ private function __construct(Domain $domainInfo, array $rxRecords, array $txRecords)
70
+ {
71
+ $this->domain = $domainInfo;
72
+ $this->inboundDnsRecords = $rxRecords;
73
+ $this->outboundDnsRecords = $txRecords;
74
+ }
75
+
76
+ /**
77
+ * @return Domain
78
+ */
79
+ public function getDomain()
80
+ {
81
+ return $this->domain;
82
+ }
83
+
84
+ /**
85
+ * @return DnsRecord[]
86
+ */
87
+ public function getInboundDNSRecords()
88
+ {
89
+ return $this->inboundDnsRecords;
90
+ }
91
+
92
+ /**
93
+ * @return DnsRecord[]
94
+ */
95
+ public function getOutboundDNSRecords()
96
+ {
97
+ return $this->outboundDnsRecords;
98
+ }
99
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/UpdateConnectionResponse.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class UpdateConnectionResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $message;
23
+
24
+ /**
25
+ * @var bool
26
+ */
27
+ private $noVerify;
28
+
29
+ /**
30
+ * @var bool
31
+ */
32
+ private $requireTLS;
33
+
34
+ /**
35
+ * @param array $data
36
+ *
37
+ * @return self
38
+ */
39
+ public static function create(array $data)
40
+ {
41
+ $message = isset($data['message']) ? $data['message'] : null;
42
+ $noVerify = isset($data['skip_verification']) ? $data['skip_verification'] : null;
43
+ $requireTLS = isset($data['require_tls']) ? $data['require_tls'] : null;
44
+
45
+ return new self($message, $noVerify, $requireTLS);
46
+ }
47
+
48
+ /**
49
+ * @param string $message
50
+ * @param bool $noVerify
51
+ * @param bool $requireTLS
52
+ */
53
+ private function __construct($message, $noVerify, $requireTLS)
54
+ {
55
+ $this->message = $message;
56
+ $this->noVerify = $noVerify;
57
+ $this->requireTLS = $requireTLS;
58
+ }
59
+
60
+ /**
61
+ * @return string
62
+ */
63
+ public function getMessage()
64
+ {
65
+ return $this->message;
66
+ }
67
+
68
+ /**
69
+ * @return bool
70
+ */
71
+ public function getSkipVerification()
72
+ {
73
+ return $this->noVerify;
74
+ }
75
+
76
+ /**
77
+ * @return bool
78
+ */
79
+ public function getRequireTLS()
80
+ {
81
+ return $this->requireTLS;
82
+ }
83
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Domain/UpdateCredentialResponse.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Domain;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class UpdateCredentialResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $message;
23
+
24
+ /**
25
+ * @param string $message
26
+ */
27
+ private function __construct($message)
28
+ {
29
+ $this->message = $message;
30
+ }
31
+
32
+ /**
33
+ * @param array $data
34
+ *
35
+ * @return self
36
+ */
37
+ public static function create(array $data)
38
+ {
39
+ return new self(isset($data['message']) ? $data['message'] : null);
40
+ }
41
+
42
+ /**
43
+ * @return string
44
+ */
45
+ public function getMessage()
46
+ {
47
+ return $this->message;
48
+ }
49
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Event/Event.php ADDED
@@ -0,0 +1,505 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Event;
11
+
12
+ /**
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ class Event
16
+ {
17
+ /**
18
+ * @var string status
19
+ */
20
+ private $event;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ private $id;
26
+
27
+ /**
28
+ * @var float
29
+ */
30
+ private $timestamp;
31
+
32
+ /**
33
+ * A \DateTime representation of $timestamp.
34
+ *
35
+ * @var \DateTime
36
+ */
37
+ private $eventDate;
38
+
39
+ /**
40
+ * @var array|string[]
41
+ */
42
+ private $tags = [];
43
+
44
+ /**
45
+ * @var string
46
+ */
47
+ private $url;
48
+
49
+ /**
50
+ * @var string
51
+ */
52
+ private $severity;
53
+
54
+ /**
55
+ * @var array
56
+ */
57
+ private $envelope = [];
58
+
59
+ /**
60
+ * @var array
61
+ */
62
+ private $deliveryStatus;
63
+
64
+ /**
65
+ * @var array|string[]
66
+ */
67
+ private $campaigns = [];
68
+
69
+ /**
70
+ * @var string
71
+ */
72
+ private $ip;
73
+
74
+ /**
75
+ * @var array
76
+ */
77
+ private $clientInfo = [];
78
+
79
+ /**
80
+ * @var string
81
+ */
82
+ private $reason;
83
+
84
+ /**
85
+ * @var array
86
+ */
87
+ private $userVariables = [];
88
+
89
+ /**
90
+ * @var array key=>bool
91
+ */
92
+ private $flags = [];
93
+
94
+ /**
95
+ * @var array multi dimensions
96
+ */
97
+ private $routes = [];
98
+
99
+ /**
100
+ * @var array multi dimensions
101
+ */
102
+ private $message = [];
103
+
104
+ /**
105
+ * @var string
106
+ */
107
+ private $recipient;
108
+
109
+ /**
110
+ * @var array
111
+ */
112
+ private $geolocation = [];
113
+
114
+ /**
115
+ * @var array
116
+ */
117
+ private $storage = [];
118
+
119
+ /**
120
+ * @var string
121
+ */
122
+ private $method;
123
+
124
+ /**
125
+ * @param string $event
126
+ * @param string $id
127
+ * @param float $timestamp
128
+ */
129
+ public function __construct($event, $id, $timestamp)
130
+ {
131
+ $this->event = $event;
132
+ $this->id = $id;
133
+ $this->timestamp = $timestamp;
134
+ $this->eventDate = new \DateTime();
135
+ $this->eventDate->setTimestamp((int) $timestamp);
136
+ }
137
+
138
+ /**
139
+ * @param array $data
140
+ *
141
+ * @return Event
142
+ */
143
+ public static function create(array $data)
144
+ {
145
+ $event = new self($data['event'], $data['id'], $data['timestamp']);
146
+
147
+ if (isset($data['tags'])) {
148
+ $event->setTags($data['tags']);
149
+ }
150
+ if (isset($data['envelope'])) {
151
+ $event->setEnvelope($data['envelope']);
152
+ }
153
+ if (isset($data['campaigns'])) {
154
+ $event->setCampaigns($data['campaigns']);
155
+ }
156
+ if (isset($data['user-variables'])) {
157
+ $event->setUserVariables($data['user-variables']);
158
+ }
159
+ if (isset($data['flags'])) {
160
+ $event->setFlags($data['flags']);
161
+ }
162
+ if (isset($data['routes'])) {
163
+ $event->setRoutes($data['routes']);
164
+ }
165
+ if (isset($data['message'])) {
166
+ $event->setMessage($data['message']);
167
+ }
168
+ if (isset($data['recipient'])) {
169
+ $event->setRecipient($data['recipient']);
170
+ }
171
+ if (isset($data['method'])) {
172
+ $event->setMethod($data['method']);
173
+ }
174
+ if (isset($data['delivery-status'])) {
175
+ $event->setDeliveryStatus($data['delivery-status']);
176
+ }
177
+ if (isset($data['severity'])) {
178
+ $event->setSeverity($data['severity']);
179
+ }
180
+ if (isset($data['reason'])) {
181
+ $event->setReason($data['reason']);
182
+ }
183
+ if (isset($data['geolocation'])) {
184
+ $event->setGeolocation($data['geolocation']);
185
+ }
186
+ if (isset($data['ip'])) {
187
+ $event->setIp($data['ip']);
188
+ }
189
+ if (isset($data['client-info'])) {
190
+ $event->setClientInfo($data['client-info']);
191
+ }
192
+ if (isset($data['url'])) {
193
+ $event->setUrl($data['url']);
194
+ }
195
+ if (isset($data['storage'])) {
196
+ $event->setStorage($data['storage']);
197
+ }
198
+
199
+ return $event;
200
+ }
201
+
202
+ /**
203
+ * @return string
204
+ */
205
+ public function getEvent()
206
+ {
207
+ return $this->event;
208
+ }
209
+
210
+ /**
211
+ * @return string
212
+ */
213
+ public function getId()
214
+ {
215
+ return $this->id;
216
+ }
217
+
218
+ /**
219
+ * @return float
220
+ */
221
+ public function getTimestamp()
222
+ {
223
+ return $this->timestamp;
224
+ }
225
+
226
+ /**
227
+ * @return \DateTime
228
+ */
229
+ public function getEventDate()
230
+ {
231
+ return $this->eventDate;
232
+ }
233
+
234
+ /**
235
+ * @return array|\string[]
236
+ */
237
+ public function getTags()
238
+ {
239
+ return $this->tags;
240
+ }
241
+
242
+ /**
243
+ * @param array|\string[] $tags
244
+ */
245
+ private function setTags($tags)
246
+ {
247
+ $this->tags = $tags;
248
+ }
249
+
250
+ /**
251
+ * @return string
252
+ */
253
+ public function getUrl()
254
+ {
255
+ return $this->url;
256
+ }
257
+
258
+ /**
259
+ * @param string $url
260
+ */
261
+ private function setUrl($url)
262
+ {
263
+ $this->url = $url;
264
+ }
265
+
266
+ /**
267
+ * @return array
268
+ */
269
+ public function getEnvelope()
270
+ {
271
+ return $this->envelope;
272
+ }
273
+
274
+ /**
275
+ * @param array $envelope
276
+ */
277
+ private function setEnvelope($envelope)
278
+ {
279
+ $this->envelope = $envelope;
280
+ }
281
+
282
+ /**
283
+ * @return array
284
+ */
285
+ public function getDeliveryStatus()
286
+ {
287
+ return $this->deliveryStatus;
288
+ }
289
+
290
+ /**
291
+ * @param array $deliveryStatus
292
+ */
293
+ private function setDeliveryStatus($deliveryStatus)
294
+ {
295
+ $this->deliveryStatus = $deliveryStatus;
296
+ }
297
+
298
+ /**
299
+ * @return array|\string[]
300
+ */
301
+ public function getCampaigns()
302
+ {
303
+ return $this->campaigns;
304
+ }
305
+
306
+ /**
307
+ * @param array|\string[] $campaigns
308
+ */
309
+ private function setCampaigns($campaigns)
310
+ {
311
+ $this->campaigns = $campaigns;
312
+ }
313
+
314
+ /**
315
+ * @return string
316
+ */
317
+ public function getIp()
318
+ {
319
+ return $this->ip;
320
+ }
321
+
322
+ /**
323
+ * @param string $ip
324
+ */
325
+ private function setIp($ip)
326
+ {
327
+ $this->ip = $ip;
328
+ }
329
+
330
+ /**
331
+ * @return array
332
+ */
333
+ public function getClientInfo()
334
+ {
335
+ return $this->clientInfo;
336
+ }
337
+
338
+ /**
339
+ * @param array $clientInfo
340
+ */
341
+ private function setClientInfo($clientInfo)
342
+ {
343
+ $this->clientInfo = $clientInfo;
344
+ }
345
+
346
+ /**
347
+ * @return string
348
+ */
349
+ public function getReason()
350
+ {
351
+ return $this->reason;
352
+ }
353
+
354
+ /**
355
+ * @param string $reason
356
+ */
357
+ private function setReason($reason)
358
+ {
359
+ $this->reason = $reason;
360
+ }
361
+
362
+ /**
363
+ * @return array
364
+ */
365
+ public function getUserVariables()
366
+ {
367
+ return $this->userVariables;
368
+ }
369
+
370
+ /**
371
+ * @param array $userVariables
372
+ */
373
+ private function setUserVariables($userVariables)
374
+ {
375
+ $this->userVariables = $userVariables;
376
+ }
377
+
378
+ /**
379
+ * @return array
380
+ */
381
+ public function getFlags()
382
+ {
383
+ return $this->flags;
384
+ }
385
+
386
+ /**
387
+ * @param array $flags
388
+ */
389
+ private function setFlags($flags)
390
+ {
391
+ $this->flags = $flags;
392
+ }
393
+
394
+ /**
395
+ * @return array
396
+ */
397
+ public function getRoutes()
398
+ {
399
+ return $this->routes;
400
+ }
401
+
402
+ /**
403
+ * @param array $routes
404
+ */
405
+ private function setRoutes($routes)
406
+ {
407
+ $this->routes = $routes;
408
+ }
409
+
410
+ /**
411
+ * @return array
412
+ */
413
+ public function getMessage()
414
+ {
415
+ return $this->message;
416
+ }
417
+
418
+ /**
419
+ * @param array $message
420
+ */
421
+ private function setMessage($message)
422
+ {
423
+ $this->message = $message;
424
+ }
425
+
426
+ /**
427
+ * @return string
428
+ */
429
+ public function getRecipient()
430
+ {
431
+ return $this->recipient;
432
+ }
433
+
434
+ /**
435
+ * @param string $recipient
436
+ */
437
+ private function setRecipient($recipient)
438
+ {
439
+ $this->recipient = $recipient;
440
+ }
441
+
442
+ /**
443
+ * @return array
444
+ */
445
+ public function getGeolocation()
446
+ {
447
+ return $this->geolocation;
448
+ }
449
+
450
+ /**
451
+ * @param array $geolocation
452
+ */
453
+ private function setGeolocation($geolocation)
454
+ {
455
+ $this->geolocation = $geolocation;
456
+ }
457
+
458
+ /**
459
+ * @return array
460
+ */
461
+ public function getStorage()
462
+ {
463
+ return $this->storage;
464
+ }
465
+
466
+ /**
467
+ * @param array $storage
468
+ */
469
+ private function setStorage($storage)
470
+ {
471
+ $this->storage = $storage;
472
+ }
473
+
474
+ /**
475
+ * @return string
476
+ */
477
+ public function getMethod()
478
+ {
479
+ return $this->method;
480
+ }
481
+
482
+ /**
483
+ * @param string $method
484
+ */
485
+ private function setMethod($method)
486
+ {
487
+ $this->method = $method;
488
+ }
489
+
490
+ /**
491
+ * @return string
492
+ */
493
+ public function getSeverity()
494
+ {
495
+ return $this->severity;
496
+ }
497
+
498
+ /**
499
+ * @param string $severity
500
+ */
501
+ private function setSeverity($severity)
502
+ {
503
+ $this->severity = $severity;
504
+ }
505
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Event/EventResponse.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Event;
11
+
12
+ use Mailgun\Model\PagingProvider;
13
+ use Mailgun\Model\PaginationResponse;
14
+ use Mailgun\Model\ApiResponse;
15
+
16
+ /**
17
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
18
+ */
19
+ class EventResponse implements ApiResponse, PagingProvider
20
+ {
21
+ use PaginationResponse;
22
+
23
+ /**
24
+ * @var Event[]
25
+ */
26
+ private $items;
27
+
28
+ /**
29
+ * @param Event[] $items
30
+ * @param array $paging
31
+ */
32
+ public function __construct(array $items, array $paging)
33
+ {
34
+ $this->items = $items;
35
+ $this->paging = $paging;
36
+ }
37
+
38
+ public static function create(array $data)
39
+ {
40
+ $events = [];
41
+ if (isset($data['items'])) {
42
+ foreach ($data['items'] as $item) {
43
+ $events[] = Event::create($item);
44
+ }
45
+ }
46
+
47
+ return new self($events, $data['paging']);
48
+ }
49
+
50
+ /**
51
+ * @return Event[]
52
+ */
53
+ public function getItems()
54
+ {
55
+ return $this->items;
56
+ }
57
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Message/SendResponse.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Message;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ class SendResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $id;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ private $message;
28
+
29
+ /**
30
+ * @param string $id
31
+ * @param string $message
32
+ */
33
+ private function __construct($id, $message)
34
+ {
35
+ $this->id = $id;
36
+ $this->message = $message;
37
+ }
38
+
39
+ /**
40
+ * @param array $data
41
+ *
42
+ * @return SendResponse
43
+ */
44
+ public static function create(array $data)
45
+ {
46
+ $id = '';
47
+ $message = '';
48
+
49
+ if (isset($data['id'])) {
50
+ $id = $data['id'];
51
+ }
52
+ if (isset($data['message'])) {
53
+ $message = $data['message'];
54
+ }
55
+
56
+ return new self($id, $message);
57
+ }
58
+
59
+ /**
60
+ * @return string
61
+ */
62
+ public function getId()
63
+ {
64
+ return $this->id;
65
+ }
66
+
67
+ /**
68
+ * @return string
69
+ */
70
+ public function getMessage()
71
+ {
72
+ return $this->message;
73
+ }
74
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Message/ShowResponse.php ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Message;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ class ShowResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * Only available with message/rfc2822.
21
+ *
22
+ * @var string
23
+ */
24
+ private $recipient;
25
+
26
+ /**
27
+ * Only available with message/rfc2822.
28
+ *
29
+ * @var string
30
+ */
31
+ private $bodyMime;
32
+
33
+ /**
34
+ * @var string
35
+ */
36
+ private $recipients;
37
+
38
+ /**
39
+ * @var string
40
+ */
41
+ private $sender;
42
+
43
+ /**
44
+ * @var string
45
+ */
46
+ private $from;
47
+
48
+ /**
49
+ * @var string
50
+ */
51
+ private $subject;
52
+
53
+ /**
54
+ * @var string
55
+ */
56
+ private $bodyPlain;
57
+
58
+ /**
59
+ * @var string
60
+ */
61
+ private $strippedText;
62
+
63
+ /**
64
+ * @var string
65
+ */
66
+ private $strippedSignature;
67
+
68
+ /**
69
+ * @var string
70
+ */
71
+ private $bodyHtml;
72
+
73
+ /**
74
+ * @var string
75
+ */
76
+ private $strippedHtml;
77
+
78
+ /**
79
+ * @var array
80
+ */
81
+ private $attachments;
82
+
83
+ /**
84
+ * @var string
85
+ */
86
+ private $messageUrl;
87
+
88
+ /**
89
+ * @var string
90
+ */
91
+ private $contentIdMap;
92
+
93
+ /**
94
+ * @var array
95
+ */
96
+ private $messageHeaders;
97
+
98
+ /**
99
+ * Do not let this object be creted without the ::create.
100
+ */
101
+ private function __construct()
102
+ {
103
+ }
104
+
105
+ /**
106
+ * @param array $data
107
+ *
108
+ * @return SendResponse
109
+ */
110
+ public static function create(array $data)
111
+ {
112
+ $response = new self();
113
+
114
+ if (isset($data['recipients'])) {
115
+ $response->setRecipients($data['recipients']);
116
+ }
117
+ if (isset($data['sender'])) {
118
+ $response->setSender($data['sender']);
119
+ }
120
+ if (isset($data['from'])) {
121
+ $response->setFrom($data['from']);
122
+ }
123
+ if (isset($data['subject'])) {
124
+ $response->setSubject($data['subject']);
125
+ }
126
+ if (isset($data['body-plain'])) {
127
+ $response->setBodyPlain($data['body-plain']);
128
+ }
129
+ if (isset($data['stripped-text'])) {
130
+ $response->setStrippedText($data['stripped-text']);
131
+ }
132
+ if (isset($data['stripped-signature'])) {
133
+ $response->setStrippedSignature($data['stripped-signature']);
134
+ }
135
+ if (isset($data['body-html'])) {
136
+ $response->setBodyHtml($data['body-html']);
137
+ }
138
+ if (isset($data['stripped-html'])) {
139
+ $response->setStrippedHtml($data['stripped-html']);
140
+ }
141
+ if (isset($data['message-url'])) {
142
+ $response->setMessageUrl($data['message-url']);
143
+ }
144
+ if (isset($data['message-headers'])) {
145
+ $response->setMessageHeaders($data['message-headers']);
146
+ }
147
+ if (isset($data['recipient'])) {
148
+ $response->setRecipient($data['recipient']);
149
+ }
150
+ if (isset($data['body-mime'])) {
151
+ $response->setBodyMime($data['body-mime']);
152
+ }
153
+ if (isset($data['attachments'])) {
154
+ $response->setAttachments($data['attachments']);
155
+ }
156
+ if (isset($data['content-id-map'])) {
157
+ $response->setContentIdMap($data['content-id-map']);
158
+ }
159
+
160
+ return $response;
161
+ }
162
+
163
+ /**
164
+ * @return string
165
+ */
166
+ public function getRecipient()
167
+ {
168
+ return $this->recipient;
169
+ }
170
+
171
+ /**
172
+ * @param string $recipient
173
+ */
174
+ private function setRecipient($recipient)
175
+ {
176
+ $this->recipient = $recipient;
177
+ }
178
+
179
+ /**
180
+ * @return string
181
+ */
182
+ public function getBodyMime()
183
+ {
184
+ return $this->bodyMime;
185
+ }
186
+
187
+ /**
188
+ * @param string $bodyMime
189
+ */
190
+ private function setBodyMime($bodyMime)
191
+ {
192
+ $this->bodyMime = $bodyMime;
193
+ }
194
+
195
+ /**
196
+ * @return string
197
+ */
198
+ public function getRecipients()
199
+ {
200
+ return $this->recipients;
201
+ }
202
+
203
+ /**
204
+ * @param string $recipients
205
+ */
206
+ private function setRecipients($recipients)
207
+ {
208
+ $this->recipients = $recipients;
209
+ }
210
+
211
+ /**
212
+ * @return string
213
+ */
214
+ public function getSender()
215
+ {
216
+ return $this->sender;
217
+ }
218
+
219
+ /**
220
+ * @param string $sender
221
+ */
222
+ private function setSender($sender)
223
+ {
224
+ $this->sender = $sender;
225
+ }
226
+
227
+ /**
228
+ * @return string
229
+ */
230
+ public function getFrom()
231
+ {
232
+ return $this->from;
233
+ }
234
+
235
+ /**
236
+ * @param string $from
237
+ */
238
+ private function setFrom($from)
239
+ {
240
+ $this->from = $from;
241
+ }
242
+
243
+ /**
244
+ * @return string
245
+ */
246
+ public function getSubject()
247
+ {
248
+ return $this->subject;
249
+ }
250
+
251
+ /**
252
+ * @param string $subject
253
+ */
254
+ private function setSubject($subject)
255
+ {
256
+ $this->subject = $subject;
257
+ }
258
+
259
+ /**
260
+ * @return string
261
+ */
262
+ public function getBodyPlain()
263
+ {
264
+ return $this->bodyPlain;
265
+ }
266
+
267
+ /**
268
+ * @param string $bodyPlain
269
+ */
270
+ private function setBodyPlain($bodyPlain)
271
+ {
272
+ $this->bodyPlain = $bodyPlain;
273
+ }
274
+
275
+ /**
276
+ * @return string
277
+ */
278
+ public function getStrippedText()
279
+ {
280
+ return $this->strippedText;
281
+ }
282
+
283
+ /**
284
+ * @param string $strippedText
285
+ */
286
+ private function setStrippedText($strippedText)
287
+ {
288
+ $this->strippedText = $strippedText;
289
+ }
290
+
291
+ /**
292
+ * @return string
293
+ */
294
+ public function getStrippedSignature()
295
+ {
296
+ return $this->strippedSignature;
297
+ }
298
+
299
+ /**
300
+ * @param string $strippedSignature
301
+ */
302
+ private function setStrippedSignature($strippedSignature)
303
+ {
304
+ $this->strippedSignature = $strippedSignature;
305
+ }
306
+
307
+ /**
308
+ * @return string
309
+ */
310
+ public function getBodyHtml()
311
+ {
312
+ return $this->bodyHtml;
313
+ }
314
+
315
+ /**
316
+ * @param string $bodyHtml
317
+ */
318
+ private function setBodyHtml($bodyHtml)
319
+ {
320
+ $this->bodyHtml = $bodyHtml;
321
+ }
322
+
323
+ /**
324
+ * @return string
325
+ */
326
+ public function getStrippedHtml()
327
+ {
328
+ return $this->strippedHtml;
329
+ }
330
+
331
+ /**
332
+ * @param string $strippedHtml
333
+ */
334
+ private function setStrippedHtml($strippedHtml)
335
+ {
336
+ $this->strippedHtml = $strippedHtml;
337
+ }
338
+
339
+ /**
340
+ * @return array
341
+ */
342
+ public function getAttachments()
343
+ {
344
+ return $this->attachments;
345
+ }
346
+
347
+ /**
348
+ * @param array $attachments
349
+ */
350
+ private function setAttachments($attachments)
351
+ {
352
+ $this->attachments = $attachments;
353
+ }
354
+
355
+ /**
356
+ * @return string
357
+ */
358
+ public function getMessageUrl()
359
+ {
360
+ return $this->messageUrl;
361
+ }
362
+
363
+ /**
364
+ * @param string $messageUrl
365
+ */
366
+ private function setMessageUrl($messageUrl)
367
+ {
368
+ $this->messageUrl = $messageUrl;
369
+ }
370
+
371
+ /**
372
+ * @return string
373
+ */
374
+ public function getContentIdMap()
375
+ {
376
+ return $this->contentIdMap;
377
+ }
378
+
379
+ /**
380
+ * @param string $contentIdMap
381
+ */
382
+ public function setContentIdMap($contentIdMap)
383
+ {
384
+ $this->contentIdMap = $contentIdMap;
385
+ }
386
+
387
+ /**
388
+ * @return array
389
+ */
390
+ public function getMessageHeaders()
391
+ {
392
+ return $this->messageHeaders;
393
+ }
394
+
395
+ /**
396
+ * @param array $messageHeaders
397
+ */
398
+ private function setMessageHeaders(array $messageHeaders)
399
+ {
400
+ $this->messageHeaders = $messageHeaders;
401
+ }
402
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/PaginationResponse.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model;
11
+
12
+ /**
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ trait PaginationResponse
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $paging;
21
+
22
+ /**
23
+ * @return string
24
+ */
25
+ public function getNextUrl()
26
+ {
27
+ if (!isset($this->paging['next'])) {
28
+ return;
29
+ }
30
+
31
+ return $this->paging['next'];
32
+ }
33
+
34
+ /**
35
+ * @return string
36
+ */
37
+ public function getPreviousUrl()
38
+ {
39
+ if (!isset($this->paging['previous'])) {
40
+ return;
41
+ }
42
+
43
+ return $this->paging['previous'];
44
+ }
45
+
46
+ /**
47
+ * @return string
48
+ */
49
+ public function getFirstUrl()
50
+ {
51
+ if (!isset($this->paging['first'])) {
52
+ return;
53
+ }
54
+
55
+ return $this->paging['first'];
56
+ }
57
+
58
+ /**
59
+ * @return string
60
+ */
61
+ public function getLastUrl()
62
+ {
63
+ if (!isset($this->paging['last'])) {
64
+ return;
65
+ }
66
+
67
+ return $this->paging['last'];
68
+ }
69
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/PagingProvider.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model;
11
+
12
+ /**
13
+ * @author Sean Johnson <sean@mailgun.com>
14
+ */
15
+ interface PagingProvider
16
+ {
17
+ /**
18
+ * Returns the `$paging->next` URL.
19
+ *
20
+ * @return string
21
+ */
22
+ public function getNextUrl();
23
+
24
+ /**
25
+ * Returns the `$paging->prev` URL.
26
+ *
27
+ * @return string
28
+ */
29
+ public function getPreviousUrl();
30
+
31
+ /**
32
+ * Returns the `$paging->first` URL.
33
+ *
34
+ * @return string
35
+ */
36
+ public function getFirstUrl();
37
+
38
+ /**
39
+ * Returns the `$paging->last` URL.
40
+ *
41
+ * @return string
42
+ */
43
+ public function getLastUrl();
44
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Action.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Route;
11
+
12
+ /**
13
+ * @author David Garcia <me@davidgarcia.cat>
14
+ */
15
+ final class Action
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ private $action;
21
+
22
+ /**
23
+ * Action Named Constructor to build several Action DTOs provided by an Array.
24
+ *
25
+ * @param array $data
26
+ *
27
+ * @return Action[]
28
+ */
29
+ public static function createMultiple(array $data)
30
+ {
31
+ $items = [];
32
+
33
+ foreach ($data as $action) {
34
+ $items[] = new self($action);
35
+ }
36
+
37
+ return $items;
38
+ }
39
+
40
+ /**
41
+ * Action Private Constructor.
42
+ *
43
+ * @param $action
44
+ */
45
+ private function __construct($action)
46
+ {
47
+ $this->action = $action;
48
+ }
49
+
50
+ /**
51
+ * @return string
52
+ */
53
+ public function getAction()
54
+ {
55
+ return $this->action;
56
+ }
57
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/CreateResponse.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Route\Response;
11
+
12
+ use Mailgun\Model\Route\Route;
13
+ use Mailgun\Model\ApiResponse;
14
+
15
+ /**
16
+ * @author David Garcia <me@davidgarcia.cat>
17
+ */
18
+ final class CreateResponse implements ApiResponse
19
+ {
20
+ /**
21
+ * @var string
22
+ */
23
+ private $message;
24
+
25
+ /**
26
+ * @var Route
27
+ */
28
+ private $route;
29
+
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ public static function create(array $data)
34
+ {
35
+ $message = isset($data['message']) ? $data['message'] : null;
36
+ $route = isset($data['route']) ? Route::create($data['route']) : null;
37
+
38
+ return new self($message, $route);
39
+ }
40
+
41
+ /**
42
+ * CreateResponse Private Constructor.
43
+ *
44
+ * @param string|null $message
45
+ * @param Route|null $route
46
+ */
47
+ private function __construct($message = null, Route $route = null)
48
+ {
49
+ $this->message = $message;
50
+ $this->route = $route;
51
+ }
52
+
53
+ /**
54
+ * @return string
55
+ */
56
+ public function getMessage()
57
+ {
58
+ return $this->message;
59
+ }
60
+
61
+ /**
62
+ * @return Route
63
+ */
64
+ public function getRoute()
65
+ {
66
+ return $this->route;
67
+ }
68
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/DeleteResponse.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Route\Response;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author David Garcia <me@davidgarcia.cat>
16
+ */
17
+ final class DeleteResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $message;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ private $error;
28
+
29
+ /**
30
+ * @param array $data
31
+ *
32
+ * @return self
33
+ */
34
+ public static function create(array $data)
35
+ {
36
+ return new self(
37
+ isset($data['message']) ? $data['message'] : null,
38
+ isset($data['error']) ? $data['error'] : null
39
+ );
40
+ }
41
+
42
+ /**
43
+ * @param string $message
44
+ * @param string $error
45
+ */
46
+ private function __construct($message, $error)
47
+ {
48
+ $this->message = $message;
49
+ $this->error = $error;
50
+ }
51
+
52
+ /**
53
+ * @return string
54
+ */
55
+ public function getMessage()
56
+ {
57
+ return $this->message;
58
+ }
59
+
60
+ /**
61
+ * @return string
62
+ */
63
+ public function getError()
64
+ {
65
+ return $this->error;
66
+ }
67
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/IndexResponse.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Route\Response;
11
+
12
+ use Mailgun\Model\Route\Route;
13
+ use Mailgun\Model\ApiResponse;
14
+
15
+ /**
16
+ * @author David Garcia <me@davidgarcia.cat>
17
+ */
18
+ final class IndexResponse implements ApiResponse
19
+ {
20
+ /**
21
+ * @var int
22
+ */
23
+ private $totalCount;
24
+
25
+ /**
26
+ * @var Route[]
27
+ */
28
+ private $items;
29
+
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ public static function create(array $data)
34
+ {
35
+ $items = [];
36
+
37
+ if (isset($data['items'])) {
38
+ foreach ($data['items'] as $item) {
39
+ $items[] = Route::create($item);
40
+ }
41
+ }
42
+
43
+ if (isset($data['total_count'])) {
44
+ $count = $data['total_count'];
45
+ } else {
46
+ $count = count($items);
47
+ }
48
+
49
+ return new self($count, $items);
50
+ }
51
+
52
+ /**
53
+ * @param int $totalCount
54
+ * @param Route[] $items
55
+ */
56
+ private function __construct($totalCount, array $items)
57
+ {
58
+ $this->totalCount = $totalCount;
59
+ $this->items = $items;
60
+ }
61
+
62
+ /**
63
+ * @return int
64
+ */
65
+ public function getTotalCount()
66
+ {
67
+ return $this->totalCount;
68
+ }
69
+
70
+ /**
71
+ * @return Route[]
72
+ */
73
+ public function getRoutes()
74
+ {
75
+ return $this->items;
76
+ }
77
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/ShowResponse.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Route\Response;
11
+
12
+ use Mailgun\Model\Route\Route;
13
+ use Mailgun\Model\ApiResponse;
14
+
15
+ /**
16
+ * @author David Garcia <me@davidgarcia.cat>
17
+ */
18
+ final class ShowResponse implements ApiResponse
19
+ {
20
+ /**
21
+ * @var Route|null
22
+ */
23
+ private $route;
24
+
25
+ /**
26
+ * {@inheritdoc}
27
+ */
28
+ public static function create(array $data)
29
+ {
30
+ if (isset($data['route'])) {
31
+ return new self(Route::create($data['route']));
32
+ }
33
+
34
+ return new self();
35
+ }
36
+
37
+ /**
38
+ * ShowResponse constructor.
39
+ *
40
+ * @param Route|null $route
41
+ */
42
+ private function __construct(Route $route = null)
43
+ {
44
+ $this->route = $route;
45
+ }
46
+
47
+ /**
48
+ * @return Route|null
49
+ */
50
+ public function getRoute()
51
+ {
52
+ return $this->route;
53
+ }
54
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Response/UpdateResponse.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Route\Response;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+ use Mailgun\Model\Route\Route;
14
+
15
+ /**
16
+ * @author David Garcia <me@davidgarcia.cat>
17
+ */
18
+ final class UpdateResponse implements ApiResponse
19
+ {
20
+ /**
21
+ * @var string|null
22
+ */
23
+ private $message;
24
+
25
+ /**
26
+ * @var Route|null
27
+ */
28
+ private $route;
29
+
30
+ /**
31
+ * @param array $data
32
+ *
33
+ * @return self
34
+ */
35
+ public static function create(array $data)
36
+ {
37
+ $message = isset($data['message']) ? $data['message'] : null;
38
+ $route = isset($data['id']) ? Route::create($data) : null;
39
+
40
+ return new self($message, $route);
41
+ }
42
+
43
+ /**
44
+ * @param string|null $message
45
+ * @param Route|null $route
46
+ */
47
+ private function __construct($message = null, Route $route = null)
48
+ {
49
+ $this->message = $message;
50
+ $this->route = $route;
51
+ }
52
+
53
+ /**
54
+ * @return string|null
55
+ */
56
+ public function getMessage()
57
+ {
58
+ return $this->message;
59
+ }
60
+
61
+ /**
62
+ * @return Route|null
63
+ */
64
+ public function getRoute()
65
+ {
66
+ return $this->route;
67
+ }
68
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Route/Route.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Route;
11
+
12
+ /**
13
+ * @author David Garcia <me@davidgarcia.cat>
14
+ */
15
+ final class Route
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ private $id;
21
+
22
+ /**
23
+ * @var int
24
+ */
25
+ private $priority;
26
+
27
+ /**
28
+ * @var string
29
+ */
30
+ private $filter;
31
+
32
+ /**
33
+ * @var Action[]
34
+ */
35
+ private $actions;
36
+
37
+ /**
38
+ * @var string
39
+ */
40
+ private $description;
41
+
42
+ /**
43
+ * @var \DateTime
44
+ */
45
+ private $createdAt;
46
+
47
+ /**
48
+ * Route Named Constructor.
49
+ *
50
+ * @param array $data
51
+ *
52
+ * @return Route
53
+ */
54
+ public static function create(array $data)
55
+ {
56
+ return new self(
57
+ isset($data['id']) ? $data['id'] : null,
58
+ isset($data['priority']) ? $data['priority'] : null,
59
+ isset($data['expression']) ? $data['expression'] : null,
60
+ isset($data['actions']) ? $data['actions'] : [],
61
+ isset($data['description']) ? $data['description'] : null,
62
+ isset($data['created_at']) ? new \DateTime($data['created_at']) : null
63
+ );
64
+ }
65
+
66
+ /**
67
+ * Route Private Constructor.
68
+ *
69
+ * @param string $id
70
+ * @param int $priority
71
+ * @param string $expression
72
+ * @param array $actions
73
+ * @param string $description
74
+ * @param \DateTime $createdAt
75
+ */
76
+ private function __construct($id, $priority, $expression, $actions, $description, \DateTime $createdAt = null)
77
+ {
78
+ $this->id = $id;
79
+ $this->priority = $priority;
80
+ $this->filter = $expression;
81
+ $this->actions = Action::createMultiple($actions);
82
+ $this->description = $description;
83
+ $this->createdAt = $createdAt;
84
+ }
85
+
86
+ /**
87
+ * @return string
88
+ */
89
+ public function getId()
90
+ {
91
+ return $this->id;
92
+ }
93
+
94
+ /**
95
+ * @return Action[]
96
+ */
97
+ public function getActions()
98
+ {
99
+ return $this->actions;
100
+ }
101
+
102
+ /**
103
+ * @return string
104
+ */
105
+ public function getDescription()
106
+ {
107
+ return $this->description;
108
+ }
109
+
110
+ /**
111
+ * @return string
112
+ */
113
+ public function getFilter()
114
+ {
115
+ return $this->filter;
116
+ }
117
+
118
+ /**
119
+ * @return int
120
+ */
121
+ public function getPriority()
122
+ {
123
+ return $this->priority;
124
+ }
125
+
126
+ /**
127
+ * @return \DateTime
128
+ */
129
+ public function getCreatedAt()
130
+ {
131
+ return $this->createdAt;
132
+ }
133
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Stats/AllResponse.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Stats;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class AllResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var int
21
+ */
22
+ private $totalCount;
23
+
24
+ /**
25
+ * @var AllResponseItem[]
26
+ */
27
+ private $items;
28
+
29
+ /**
30
+ * @param int $totalCount
31
+ * @param AllResponseItem[] $items
32
+ */
33
+ private function __construct($totalCount, array $items)
34
+ {
35
+ $this->totalCount = $totalCount;
36
+ $this->items = $items;
37
+ }
38
+
39
+ /**
40
+ * @param array $data
41
+ *
42
+ * @return self
43
+ */
44
+ public static function create(array $data)
45
+ {
46
+ $items = [];
47
+ if (isset($data['items'])) {
48
+ foreach ($data['items'] as $i) {
49
+ $items[] = AllResponseItem::create($i);
50
+ }
51
+ }
52
+
53
+ if (isset($data['total_count'])) {
54
+ $count = $data['total_count'];
55
+ } else {
56
+ $count = count($items);
57
+ }
58
+
59
+ return new self($count, $items);
60
+ }
61
+
62
+ /**
63
+ * @return int
64
+ */
65
+ public function getTotalCount()
66
+ {
67
+ return $this->totalCount;
68
+ }
69
+
70
+ /**
71
+ * @return AllResponseItem[]
72
+ */
73
+ public function getItems()
74
+ {
75
+ return $this->items;
76
+ }
77
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Stats/AllResponseItem.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Stats;
11
+
12
+ /**
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ final class AllResponseItem
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ private $id;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ private $event;
26
+
27
+ /**
28
+ * @var string
29
+ */
30
+ private $totalCount;
31
+
32
+ /**
33
+ * @var string[]
34
+ */
35
+ private $tags;
36
+
37
+ /**
38
+ * @var \DateTime
39
+ */
40
+ private $createdAt;
41
+
42
+ /**
43
+ * @param array $data
44
+ *
45
+ * @return self
46
+ */
47
+ public static function create(array $data)
48
+ {
49
+ return new self(
50
+ isset($data['id']) ? $data['id'] : null,
51
+ isset($data['event']) ? $data['event'] : null,
52
+ isset($data['total_count']) ? $data['total_count'] : null,
53
+ isset($data['tags']) ? $data['tags'] : null,
54
+ isset($data['created_at']) ? new \DateTime($data['created_at']) : null
55
+ );
56
+ }
57
+
58
+ /**
59
+ * @param string $id
60
+ * @param string $event
61
+ * @param string $totalCount
62
+ * @param \string[] $tags
63
+ * @param \DateTime $createdAt
64
+ */
65
+ private function __construct($id, $event, $totalCount, array $tags, \DateTime $createdAt)
66
+ {
67
+ $this->id = $id;
68
+ $this->event = $event;
69
+ $this->totalCount = $totalCount;
70
+ $this->tags = $tags;
71
+ $this->createdAt = $createdAt;
72
+ }
73
+
74
+ /**
75
+ * @return string
76
+ */
77
+ public function getId()
78
+ {
79
+ return $this->id;
80
+ }
81
+
82
+ /**
83
+ * @return string
84
+ */
85
+ public function getEvent()
86
+ {
87
+ return $this->event;
88
+ }
89
+
90
+ /**
91
+ * @return string
92
+ */
93
+ public function getTotalCount()
94
+ {
95
+ return $this->totalCount;
96
+ }
97
+
98
+ /**
99
+ * @return string[]
100
+ */
101
+ public function getTags()
102
+ {
103
+ return $this->tags;
104
+ }
105
+
106
+ /**
107
+ * @return \DateTime
108
+ */
109
+ public function getCreatedAt()
110
+ {
111
+ return $this->createdAt;
112
+ }
113
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Stats/TotalResponse.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Stats;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class TotalResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var \DateTime
21
+ */
22
+ private $start;
23
+
24
+ /**
25
+ * @var \DateTime
26
+ */
27
+ private $end;
28
+
29
+ /**
30
+ * @var string
31
+ */
32
+ private $resolution;
33
+
34
+ /**
35
+ * @var TotalResponseItem[]
36
+ */
37
+ private $stats;
38
+
39
+ /**
40
+ * @param \DateTime $start
41
+ * @param \DateTime $end
42
+ * @param string $resolution
43
+ * @param TotalResponseItem[] $stats
44
+ */
45
+ private function __construct(\DateTime $start, \DateTime $end, $resolution, array $stats)
46
+ {
47
+ $this->start = $start;
48
+ $this->end = $end;
49
+ $this->resolution = $resolution;
50
+ $this->stats = $stats;
51
+ }
52
+
53
+ /**
54
+ * @param array $data
55
+ *
56
+ * @return self
57
+ */
58
+ public static function create(array $data)
59
+ {
60
+ $stats = [];
61
+ if (isset($data['status'])) {
62
+ foreach ($data['stats'] as $s) {
63
+ $stats[] = TotalResponseItem::create($s);
64
+ }
65
+ }
66
+
67
+ $start = isset($data['start']) ? new \DateTime($data['start']) : null;
68
+ $end = isset($data['end']) ? new \DateTime($data['end']) : null;
69
+ $resolution = isset($data['resolution']) ? $data['resolution'] : null;
70
+
71
+ return new self($start, $end, $resolution, $stats);
72
+ }
73
+
74
+ /**
75
+ * @return \DateTime
76
+ */
77
+ public function getStart()
78
+ {
79
+ return $this->start;
80
+ }
81
+
82
+ /**
83
+ * @return \DateTime
84
+ */
85
+ public function getEnd()
86
+ {
87
+ return $this->end;
88
+ }
89
+
90
+ /**
91
+ * @return string
92
+ */
93
+ public function getResolution()
94
+ {
95
+ return $this->resolution;
96
+ }
97
+
98
+ /**
99
+ * @return TotalResponseItem[]
100
+ */
101
+ public function getStats()
102
+ {
103
+ return $this->stats;
104
+ }
105
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Stats/TotalResponseItem.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Stats;
11
+
12
+ /**
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ class TotalResponseItem
16
+ {
17
+ /**
18
+ * @var \DateTime
19
+ */
20
+ private $time;
21
+
22
+ /**
23
+ * @var array
24
+ */
25
+ private $accepted;
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ private $delivered;
31
+
32
+ /**
33
+ * @var array
34
+ */
35
+ private $failed;
36
+
37
+ /**
38
+ * @param array $data
39
+ *
40
+ * @return self
41
+ */
42
+ public static function create(array $data)
43
+ {
44
+ return new self(
45
+ isset($data['time']) ? new \DateTime($data['time']) : null,
46
+ isset($data['accepted']) ? $data['accepted'] : null,
47
+ isset($data['delivered']) ? $data['delivered'] : null,
48
+ isset($data['failed']) ? $data['failed'] : null
49
+ );
50
+ }
51
+
52
+ /**
53
+ * @param \DateTime $time
54
+ * @param array $accepted
55
+ * @param array $delivered
56
+ * @param array $failed
57
+ */
58
+ private function __construct(\DateTime $time, array $accepted, array $delivered, array $failed)
59
+ {
60
+ $this->time = $time;
61
+ $this->accepted = $accepted;
62
+ $this->delivered = $delivered;
63
+ $this->failed = $failed;
64
+ }
65
+
66
+ /**
67
+ * @return \DateTime
68
+ */
69
+ public function getTime()
70
+ {
71
+ return $this->time;
72
+ }
73
+
74
+ /**
75
+ * @return array
76
+ */
77
+ public function getAccepted()
78
+ {
79
+ return $this->accepted;
80
+ }
81
+
82
+ /**
83
+ * @return array
84
+ */
85
+ public function getDelivered()
86
+ {
87
+ return $this->delivered;
88
+ }
89
+
90
+ /**
91
+ * @return array
92
+ */
93
+ public function getFailed()
94
+ {
95
+ return $this->failed;
96
+ }
97
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/BaseResponse.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * Serves only as an abstract base for Suppression API code.
16
+ *
17
+ * @author Sean Johnson <sean@mailgun.com>
18
+ */
19
+ abstract class BaseResponse implements ApiResponse
20
+ {
21
+ /**
22
+ * @var string
23
+ */
24
+ private $address;
25
+
26
+ /**
27
+ * @var string
28
+ */
29
+ private $message;
30
+
31
+ /**
32
+ * @param string $address
33
+ * @param string $message
34
+ */
35
+ private function __construct($address, $message)
36
+ {
37
+ $this->address = $address;
38
+ $this->message = $message;
39
+ }
40
+
41
+ /**
42
+ * @param array $data
43
+ *
44
+ * @return BaseResponse
45
+ */
46
+ public static function create(array $data)
47
+ {
48
+ $address = isset($data['address']) ? $data['address'] : '';
49
+ $message = isset($data['message']) ? $data['message'] : '';
50
+
51
+ return new static($address, $message);
52
+ }
53
+
54
+ /**
55
+ * @return string
56
+ */
57
+ public function getAddress()
58
+ {
59
+ return $this->address;
60
+ }
61
+
62
+ /**
63
+ * @return string
64
+ */
65
+ public function getMessage()
66
+ {
67
+ return $this->message;
68
+ }
69
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/Bounce.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Bounce;
11
+
12
+ /**
13
+ * @author Sean Johnson <sean@mailgun.com>
14
+ */
15
+ class Bounce
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ private $address;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ private $code;
26
+
27
+ /**
28
+ * @var string
29
+ */
30
+ private $error;
31
+
32
+ /**
33
+ * @var \DateTime
34
+ */
35
+ private $createdAt;
36
+
37
+ /**
38
+ * @param string $address
39
+ */
40
+ private function __construct($address)
41
+ {
42
+ $this->address = $address;
43
+ $this->createdAt = new \DateTime();
44
+ }
45
+
46
+ /**
47
+ * @param array $data
48
+ *
49
+ * @return Bounce
50
+ */
51
+ public static function create(array $data)
52
+ {
53
+ $bounce = new self($data['address']);
54
+
55
+ if (isset($data['code'])) {
56
+ $bounce->setCode($data['code']);
57
+ }
58
+ if (isset($data['error'])) {
59
+ $bounce->setError($data['error']);
60
+ }
61
+ if (isset($data['created_at'])) {
62
+ $bounce->setCreatedAt(new \DateTime($data['created_at']));
63
+ }
64
+
65
+ return $bounce;
66
+ }
67
+
68
+ /**
69
+ * @return string
70
+ */
71
+ public function getAddress()
72
+ {
73
+ return $this->address;
74
+ }
75
+
76
+ /**
77
+ * @return string
78
+ */
79
+ public function getCode()
80
+ {
81
+ return $this->code;
82
+ }
83
+
84
+ /**
85
+ * @param string $code
86
+ */
87
+ private function setCode($code)
88
+ {
89
+ $this->code = $code;
90
+ }
91
+
92
+ /**
93
+ * @return string
94
+ */
95
+ public function getError()
96
+ {
97
+ return $this->error;
98
+ }
99
+
100
+ /**
101
+ * @param string $error
102
+ */
103
+ private function setError($error)
104
+ {
105
+ $this->error = $error;
106
+ }
107
+
108
+ /**
109
+ * @return \DateTime
110
+ */
111
+ public function getCreatedAt()
112
+ {
113
+ return $this->createdAt;
114
+ }
115
+
116
+ /**
117
+ * @param \DateTime $createdAt
118
+ */
119
+ private function setCreatedAt(\DateTime $createdAt)
120
+ {
121
+ $this->createdAt = $createdAt;
122
+ }
123
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/CreateResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Bounce;
11
+
12
+ use Mailgun\Model\Suppression\BaseResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class CreateResponse extends BaseResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/DeleteResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Bounce;
11
+
12
+ use Mailgun\Model\Suppression\BaseResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class DeleteResponse extends BaseResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/IndexResponse.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Bounce;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+ use Mailgun\Model\PaginationResponse;
14
+ use Mailgun\Model\PagingProvider;
15
+
16
+ /**
17
+ * @author Sean Johnson <sean@mailgun.com>
18
+ */
19
+ final class IndexResponse implements ApiResponse, PagingProvider
20
+ {
21
+ use PaginationResponse;
22
+
23
+ /**
24
+ * @var Bounce[]
25
+ */
26
+ private $items;
27
+
28
+ /**
29
+ * @param Bounce[] $items
30
+ * @param array $paging
31
+ */
32
+ private function __construct(array $items, array $paging)
33
+ {
34
+ $this->items = $items;
35
+ $this->paging = $paging;
36
+ }
37
+
38
+ /**
39
+ * @param array $data
40
+ *
41
+ * @return IndexResponse
42
+ */
43
+ public static function create(array $data)
44
+ {
45
+ $bounces = [];
46
+ if (isset($data['items'])) {
47
+ foreach ($data['items'] as $item) {
48
+ $bounces[] = Bounce::create($item);
49
+ }
50
+ }
51
+
52
+ return new self($bounces, $data['paging']);
53
+ }
54
+
55
+ /**
56
+ * @return Bounce[]
57
+ */
58
+ public function getItems()
59
+ {
60
+ return $this->items;
61
+ }
62
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Bounce/ShowResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Bounce;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class ShowResponse extends Bounce implements ApiResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/Complaint.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Complaint;
11
+
12
+ /**
13
+ * @author Sean Johnson <sean@mailgun.com>
14
+ */
15
+ class Complaint
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ private $address;
21
+
22
+ /**
23
+ * @var \DateTime
24
+ */
25
+ private $createdAt;
26
+
27
+ /**
28
+ * @param string $address
29
+ */
30
+ private function __construct($address)
31
+ {
32
+ $this->address = $address;
33
+ $this->createdAt = new \DateTime();
34
+ }
35
+
36
+ /**
37
+ * @param array $data
38
+ *
39
+ * @return Complaint
40
+ */
41
+ public static function create(array $data)
42
+ {
43
+ $complaint = new self($data['address']);
44
+
45
+ if (isset($data['created_at'])) {
46
+ $complaint->setCreatedAt(new \DateTime($data['created_at']));
47
+ }
48
+
49
+ return $complaint;
50
+ }
51
+
52
+ /**
53
+ * @return string
54
+ */
55
+ public function getAddress()
56
+ {
57
+ return $this->address;
58
+ }
59
+
60
+ /**
61
+ * @return \DateTime
62
+ */
63
+ public function getCreatedAt()
64
+ {
65
+ return $this->createdAt;
66
+ }
67
+
68
+ /**
69
+ * @param \DateTime $createdAt
70
+ */
71
+ private function setCreatedAt(\DateTime $createdAt)
72
+ {
73
+ $this->createdAt = $createdAt;
74
+ }
75
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/CreateResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Complaint;
11
+
12
+ use Mailgun\Model\Suppression\BaseResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class CreateResponse extends BaseResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/DeleteResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Complaint;
11
+
12
+ use Mailgun\Model\Suppression\BaseResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class DeleteResponse extends BaseResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/IndexResponse.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Complaint;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+ use Mailgun\Model\PaginationResponse;
14
+ use Mailgun\Model\PagingProvider;
15
+
16
+ /**
17
+ * @author Sean Johnson <sean@mailgun.com>
18
+ */
19
+ final class IndexResponse implements ApiResponse, PagingProvider
20
+ {
21
+ use PaginationResponse;
22
+
23
+ /**
24
+ * @var Complaint[]
25
+ */
26
+ private $items;
27
+
28
+ /**
29
+ * @param Complaint[] $items
30
+ * @param array $paging
31
+ */
32
+ private function __construct(array $items, array $paging)
33
+ {
34
+ $this->items = $items;
35
+ $this->paging = $paging;
36
+ }
37
+
38
+ /**
39
+ * @param array $data
40
+ *
41
+ * @return IndexResponse
42
+ */
43
+ public static function create(array $data)
44
+ {
45
+ $complaints = [];
46
+ if (isset($data['items'])) {
47
+ foreach ($data['items'] as $item) {
48
+ $complaints[] = Complaint::create($item);
49
+ }
50
+ }
51
+
52
+ return new self($complaints, $data['paging']);
53
+ }
54
+
55
+ /**
56
+ * @return Complaint[]
57
+ */
58
+ public function getItems()
59
+ {
60
+ return $this->items;
61
+ }
62
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Complaint/ShowResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Complaint;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class ShowResponse extends Complaint implements ApiResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/CreateResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Unsubscribe;
11
+
12
+ use Mailgun\Model\Suppression\BaseResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class CreateResponse extends BaseResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/DeleteResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Unsubscribe;
11
+
12
+ use Mailgun\Model\Suppression\BaseResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class DeleteResponse extends BaseResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/IndexResponse.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Unsubscribe;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+ use Mailgun\Model\PaginationResponse;
14
+ use Mailgun\Model\PagingProvider;
15
+
16
+ /**
17
+ * @author Sean Johnson <sean@mailgun.com>
18
+ */
19
+ final class IndexResponse implements ApiResponse, PagingProvider
20
+ {
21
+ use PaginationResponse;
22
+
23
+ /**
24
+ * @var Unsubscribe[]
25
+ */
26
+ private $items;
27
+
28
+ /**
29
+ * @param Unsubscribe[] $items
30
+ * @param array $paging
31
+ */
32
+ private function __construct(array $items, array $paging)
33
+ {
34
+ $this->items = $items;
35
+ $this->paging = $paging;
36
+ }
37
+
38
+ /**
39
+ * @param array $data
40
+ *
41
+ * @return IndexResponse
42
+ */
43
+ public static function create(array $data)
44
+ {
45
+ $unsubscribes = [];
46
+ if (isset($data['items'])) {
47
+ foreach ($data['items'] as $item) {
48
+ $unsubscribes[] = Unsubscribe::create($item);
49
+ }
50
+ }
51
+
52
+ return new self($unsubscribes, $data['paging']);
53
+ }
54
+
55
+ /**
56
+ * @return Unsubscribe[]
57
+ */
58
+ public function getItems()
59
+ {
60
+ return $this->items;
61
+ }
62
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/ShowResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Unsubscribe;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Sean Johnson <sean@mailgun.com>
16
+ */
17
+ final class ShowResponse extends Unsubscribe implements ApiResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Suppression/Unsubscribe/Unsubscribe.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Suppression\Unsubscribe;
11
+
12
+ /**
13
+ * @author Sean Johnson <sean@mailgun.com>
14
+ */
15
+ class Unsubscribe
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ private $address;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ private $tag;
26
+
27
+ /**
28
+ * @var \DateTime
29
+ */
30
+ private $createdAt;
31
+
32
+ /**
33
+ * @param string $address
34
+ */
35
+ private function __construct($address)
36
+ {
37
+ $this->address = $address;
38
+ $this->createdAt = new \DateTime();
39
+ }
40
+
41
+ /**
42
+ * @param array $data
43
+ *
44
+ * @return Unsubscribe
45
+ */
46
+ public static function create(array $data)
47
+ {
48
+ $unsubscribe = new self($data['address']);
49
+
50
+ if (isset($data['tag'])) {
51
+ $unsubscribe->setTag($data['tag']);
52
+ }
53
+ if (isset($data['created_at'])) {
54
+ $unsubscribe->setCreatedAt(new \DateTime($data['created_at']));
55
+ }
56
+
57
+ return $unsubscribe;
58
+ }
59
+
60
+ /**
61
+ * @return string
62
+ */
63
+ public function getAddress()
64
+ {
65
+ return $this->address;
66
+ }
67
+
68
+ /**
69
+ * @return string
70
+ */
71
+ public function getTag()
72
+ {
73
+ return $this->tag;
74
+ }
75
+
76
+ /**
77
+ * @param string $tag
78
+ */
79
+ private function setTag($tag)
80
+ {
81
+ $this->tag = $tag;
82
+ }
83
+
84
+ /**
85
+ * @return \DateTime
86
+ */
87
+ public function getCreatedAt()
88
+ {
89
+ return $this->createdAt;
90
+ }
91
+
92
+ /**
93
+ * @param \DateTime $createdAt
94
+ */
95
+ private function setCreatedAt(\DateTime $createdAt)
96
+ {
97
+ $this->createdAt = $createdAt;
98
+ }
99
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/DeleteResponse.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Tag;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class DeleteResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $message;
23
+
24
+ /**
25
+ * @param string $message
26
+ */
27
+ private function __construct($message)
28
+ {
29
+ $this->message = $message;
30
+ }
31
+
32
+ /**
33
+ * @param array $data
34
+ *
35
+ * @return DeleteResponse
36
+ */
37
+ public static function create(array $data)
38
+ {
39
+ return new self($data['message']);
40
+ }
41
+
42
+ /**
43
+ * @return string
44
+ */
45
+ public function getMessage()
46
+ {
47
+ return $this->message;
48
+ }
49
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/IndexResponse.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Tag;
11
+
12
+ use Mailgun\Model\PaginationResponse;
13
+ use Mailgun\Model\PagingProvider;
14
+ use Mailgun\Model\ApiResponse;
15
+
16
+ /**
17
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
18
+ */
19
+ final class IndexResponse implements ApiResponse, PagingProvider
20
+ {
21
+ use PaginationResponse;
22
+
23
+ /**
24
+ * @var Tag[]
25
+ */
26
+ private $items;
27
+
28
+ /**
29
+ * @param Tag[] $items
30
+ * @param array $paging
31
+ */
32
+ public function __construct(array $items, array $paging)
33
+ {
34
+ $this->items = $items;
35
+ $this->paging = $paging;
36
+ }
37
+
38
+ /**
39
+ * @param array $data
40
+ *
41
+ * @return IndexResponse
42
+ */
43
+ public static function create(array $data)
44
+ {
45
+ $items = [];
46
+ foreach ($data['items'] as $item) {
47
+ $items[] = Tag::create($item);
48
+ }
49
+
50
+ return new self($items, $data['paging']);
51
+ }
52
+
53
+ /**
54
+ * @return Tag[]
55
+ */
56
+ public function getItems()
57
+ {
58
+ return $this->items;
59
+ }
60
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/ShowResponse.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Tag;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class ShowResponse extends Tag implements ApiResponse
18
+ {
19
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/StatisticsResponse.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Tag;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class StatisticsResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $tag;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ private $description;
28
+
29
+ /**
30
+ * @var string
31
+ */
32
+ private $resolution;
33
+
34
+ /**
35
+ * @var \DateTime
36
+ */
37
+ private $start;
38
+
39
+ /**
40
+ * @var \DateTime
41
+ */
42
+ private $end;
43
+
44
+ /**
45
+ * @var array
46
+ */
47
+ private $stats;
48
+
49
+ /**
50
+ * @param string $tag
51
+ * @param string $description
52
+ * @param \DateTime $start
53
+ * @param \DateTime $end
54
+ * @param string $resolution
55
+ * @param array $stats
56
+ */
57
+ private function __construct($tag, $description, \DateTime $start, \DateTime $end, $resolution, array $stats)
58
+ {
59
+ $this->tag = $tag;
60
+ $this->description = $description;
61
+ $this->resolution = $resolution;
62
+ $this->start = $start;
63
+ $this->end = $end;
64
+ $this->stats = $stats;
65
+ }
66
+
67
+ /**
68
+ * @param array $data
69
+ *
70
+ * @return StatisticsResponse
71
+ */
72
+ public static function create(array $data)
73
+ {
74
+ return new self(
75
+ $data['tag'],
76
+ $data['description'],
77
+ new \DateTime($data['start']),
78
+ new \DateTime($data['end']),
79
+ $data['resolution'],
80
+ $data['stats']
81
+ );
82
+ }
83
+
84
+ /**
85
+ * @return string
86
+ */
87
+ public function getTag()
88
+ {
89
+ return $this->tag;
90
+ }
91
+
92
+ /**
93
+ * @return string
94
+ */
95
+ public function getDescription()
96
+ {
97
+ return $this->description;
98
+ }
99
+
100
+ /**
101
+ * @return string
102
+ */
103
+ public function getResolution()
104
+ {
105
+ return $this->resolution;
106
+ }
107
+
108
+ /**
109
+ * @return \DateTime
110
+ */
111
+ public function getStart()
112
+ {
113
+ return $this->start;
114
+ }
115
+
116
+ /**
117
+ * @return \DateTime
118
+ */
119
+ public function getEnd()
120
+ {
121
+ return $this->end;
122
+ }
123
+
124
+ /**
125
+ * @return array
126
+ */
127
+ public function getStats()
128
+ {
129
+ return $this->stats;
130
+ }
131
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/Tag.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Tag;
11
+
12
+ class Tag
13
+ {
14
+ /**
15
+ * @var string
16
+ */
17
+ private $tag;
18
+
19
+ /**
20
+ * @var string
21
+ */
22
+ private $description;
23
+
24
+ /**
25
+ * @var \DateTime
26
+ */
27
+ private $firstSeen;
28
+
29
+ /**
30
+ * @var \DateTime
31
+ */
32
+ private $lastSeen;
33
+
34
+ /**
35
+ * @param string $tag
36
+ * @param string $description
37
+ * @param \DateTime $firstSeen
38
+ * @param \DateTime $lastSeen
39
+ */
40
+ public function __construct($tag, $description, \DateTime $firstSeen, \DateTime $lastSeen)
41
+ {
42
+ $this->tag = $tag;
43
+ $this->description = $description;
44
+ $this->firstSeen = $firstSeen;
45
+ $this->lastSeen = $lastSeen;
46
+ }
47
+
48
+ /**
49
+ * @param array $data
50
+ *
51
+ * @return Tag
52
+ */
53
+ public static function create(array $data)
54
+ {
55
+ return new self($data['tag'], $data['description'], $data['first-seen'], $data['last-seen']);
56
+ }
57
+
58
+ /**
59
+ * @return string
60
+ */
61
+ public function getTag()
62
+ {
63
+ return $this->tag;
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getDescription()
70
+ {
71
+ return $this->description;
72
+ }
73
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Tag/UpdateResponse.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Tag;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ final class UpdateResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ private $message;
23
+
24
+ /**
25
+ * @param string $message
26
+ */
27
+ private function __construct($message)
28
+ {
29
+ $this->message = $message;
30
+ }
31
+
32
+ /**
33
+ * @param array $data
34
+ *
35
+ * @return UpdateResponse
36
+ */
37
+ public static function create(array $data)
38
+ {
39
+ return new self($data['message']);
40
+ }
41
+
42
+ /**
43
+ * @return string
44
+ */
45
+ public function getMessage()
46
+ {
47
+ return $this->message;
48
+ }
49
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/BaseResponse.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Webhook;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * This is only mean to be the base response for Webhook API.
16
+ *
17
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
18
+ */
19
+ abstract class BaseResponse implements ApiResponse
20
+ {
21
+ /**
22
+ * @var array
23
+ */
24
+ private $webhook = [];
25
+
26
+ /**
27
+ * @var string
28
+ */
29
+ private $message;
30
+
31
+ /**
32
+ * @param array $webhook
33
+ * @param string $message
34
+ */
35
+ public function __construct(array $webhook, $message)
36
+ {
37
+ $this->webhook = $webhook;
38
+ $this->message = $message;
39
+ }
40
+
41
+ /**
42
+ * @param array $data
43
+ *
44
+ * @return static
45
+ */
46
+ public static function create(array $data)
47
+ {
48
+ $webhook = [];
49
+ $message = '';
50
+ if (isset($data['webhook'])) {
51
+ $webhook = $data['webhook'];
52
+ }
53
+
54
+ if (isset($data['message'])) {
55
+ $message = $data['message'];
56
+ }
57
+
58
+ return new static($webhook, $message);
59
+ }
60
+
61
+ /**
62
+ * @return string|null
63
+ */
64
+ public function getWebhookUrl()
65
+ {
66
+ if (isset($this->webhook['url'])) {
67
+ return $this->webhook['url'];
68
+ }
69
+ }
70
+
71
+ /**
72
+ * @return string
73
+ */
74
+ public function getMessage()
75
+ {
76
+ return $this->message;
77
+ }
78
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/CreateResponse.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Webhook;
11
+
12
+ /**
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ class CreateResponse extends BaseResponse
16
+ {
17
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/DeleteResponse.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Webhook;
11
+
12
+ /**
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ class DeleteResponse extends BaseResponse
16
+ {
17
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/IndexResponse.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Webhook;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ class IndexResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var array
21
+ */
22
+ private $bounce = [];
23
+
24
+ /**
25
+ * @var array
26
+ */
27
+ private $deliver = [];
28
+
29
+ /**
30
+ * @var array
31
+ */
32
+ private $drop = [];
33
+
34
+ /**
35
+ * @var array
36
+ */
37
+ private $spam = [];
38
+
39
+ /**
40
+ * @var array
41
+ */
42
+ private $unsubscribe = [];
43
+
44
+ /**
45
+ * @var array
46
+ */
47
+ private $click = [];
48
+
49
+ /**
50
+ * @var array
51
+ */
52
+ private $open = [];
53
+
54
+ /**
55
+ * Do not let this object be creted without the ::create.
56
+ */
57
+ private function __construct()
58
+ {
59
+ }
60
+
61
+ /**
62
+ * @param array $data
63
+ *
64
+ * @return IndexResponse
65
+ */
66
+ public static function create(array $data)
67
+ {
68
+ $self = new self();
69
+ if (isset($data['bounce'])) {
70
+ $self->setBounce($data['bounce']);
71
+ }
72
+ if (isset($data['deliver'])) {
73
+ $self->setDeliver($data['deliver']);
74
+ }
75
+ if (isset($data['drop'])) {
76
+ $self->setDrop($data['drop']);
77
+ }
78
+ if (isset($data['spam'])) {
79
+ $self->setSpam($data['spam']);
80
+ }
81
+ if (isset($data['unsubscribe'])) {
82
+ $self->setUnsubscribe($data['unsubscribe']);
83
+ }
84
+ if (isset($data['click'])) {
85
+ $self->setClick($data['click']);
86
+ }
87
+ if (isset($data['open'])) {
88
+ $self->setOpen($data['open']);
89
+ }
90
+
91
+ return $self;
92
+ }
93
+
94
+ /**
95
+ * @return string|null
96
+ */
97
+ public function getBounceUrl()
98
+ {
99
+ if (isset($this->bounce['url'])) {
100
+ return $this->bounce['url'];
101
+ }
102
+ }
103
+
104
+ /**
105
+ * @param array $bounce
106
+ */
107
+ private function setBounce($bounce)
108
+ {
109
+ $this->bounce = $bounce;
110
+ }
111
+
112
+ /**
113
+ * @return string|null
114
+ */
115
+ public function getDeliverUrl()
116
+ {
117
+ if (isset($this->deliver['url'])) {
118
+ return $this->deliver['url'];
119
+ }
120
+ }
121
+
122
+ /**
123
+ * @param array $deliver
124
+ */
125
+ private function setDeliver($deliver)
126
+ {
127
+ $this->deliver = $deliver;
128
+ }
129
+
130
+ /**
131
+ * @return string|null
132
+ */
133
+ public function getDropUrl()
134
+ {
135
+ if (isset($this->drop['url'])) {
136
+ return $this->drop['url'];
137
+ }
138
+ }
139
+
140
+ /**
141
+ * @param array $drop
142
+ */
143
+ private function setDrop($drop)
144
+ {
145
+ $this->drop = $drop;
146
+ }
147
+
148
+ /**
149
+ * @return string|null
150
+ */
151
+ public function getSpamUrl()
152
+ {
153
+ if (isset($this->spam['url'])) {
154
+ return $this->spam['url'];
155
+ }
156
+ }
157
+
158
+ /**
159
+ * @param array $spam
160
+ */
161
+ private function setSpam($spam)
162
+ {
163
+ $this->spam = $spam;
164
+ }
165
+
166
+ /**
167
+ * @return string|null
168
+ */
169
+ public function getUnsubscribeUrl()
170
+ {
171
+ if (isset($this->unsubscribe['url'])) {
172
+ return $this->unsubscribe['url'];
173
+ }
174
+ }
175
+
176
+ /**
177
+ * @param array $unsubscribe
178
+ */
179
+ private function setUnsubscribe($unsubscribe)
180
+ {
181
+ $this->unsubscribe = $unsubscribe;
182
+ }
183
+
184
+ /**
185
+ * @return string|null
186
+ */
187
+ public function getClickUrl()
188
+ {
189
+ if (isset($this->click['url'])) {
190
+ return $this->click['url'];
191
+ }
192
+ }
193
+
194
+ /**
195
+ * @param array $click
196
+ */
197
+ private function setClick($click)
198
+ {
199
+ $this->click = $click;
200
+ }
201
+
202
+ /**
203
+ * @return string|null
204
+ */
205
+ public function getOpenUrl()
206
+ {
207
+ if (isset($this->open['url'])) {
208
+ return $this->open['url'];
209
+ }
210
+ }
211
+
212
+ /**
213
+ * @param array $open
214
+ */
215
+ private function setOpen($open)
216
+ {
217
+ $this->open = $open;
218
+ }
219
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/ShowResponse.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Webhook;
11
+
12
+ use Mailgun\Model\ApiResponse;
13
+
14
+ /**
15
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
16
+ */
17
+ class ShowResponse implements ApiResponse
18
+ {
19
+ /**
20
+ * @var array
21
+ */
22
+ private $webhook = [];
23
+
24
+ /**
25
+ * @param array $webhook
26
+ */
27
+ public function __construct(array $webhook)
28
+ {
29
+ $this->webhook = $webhook;
30
+ }
31
+
32
+ /**
33
+ * @param array $data
34
+ *
35
+ * @return ShowResponse
36
+ */
37
+ public static function create(array $data)
38
+ {
39
+ $webhook = [];
40
+ if (isset($data['webhook'])) {
41
+ $webhook = $data['webhook'];
42
+ }
43
+
44
+ return new self($webhook);
45
+ }
46
+
47
+ /**
48
+ * @return string|null
49
+ */
50
+ public function getWebhookUrl()
51
+ {
52
+ if (isset($this->webhook['url'])) {
53
+ return $this->webhook['url'];
54
+ }
55
+ }
56
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/Model/Webhook/UpdateResponse.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun\Model\Webhook;
11
+
12
+ /**
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ class UpdateResponse extends BaseResponse
16
+ {
17
+ }
Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/src/Mailgun/RequestBuilder.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Copyright (C) 2013-2016 Mailgun
5
+ *
6
+ * This software may be modified and distributed under the terms
7
+ * of the MIT license. See the LICENSE file for details.
8
+ */
9
+
10
+ namespace Mailgun;
11
+
12
+ use Http\Discovery\MessageFactoryDiscovery;
13
+ use Http\Message\MultipartStream\MultipartStreamBuilder;
14
+ use Http\Message\RequestFactory;
15
+ use Psr\Http\Message\RequestInterface;
16
+
17
+ /**
18
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
19
+ */
20
+ class RequestBuilder
21
+ {
22
+ /**
23
+ * @var RequestFactory
24
+ */
25
+ private $requestFactory;
26
+
27
+ /**
28
+ * @var MultipartStreamBuilder
29
+ */
30
+ private $multipartStreamBuilder;
31
+
32
+ /**
33
+ * Creates a new PSR-7 request.
34
+ *
35
+ * @param string $method
36
+ * @param string $uri
37
+ * @param array $headers
38
+ * @param array|string|null $body Request body. If body is an array we will send a as multipart stream request.
39
+ * If array, each array *item* MUST look like:
40
+ * array (
41
+ * 'content' => string|resource|StreamInterface,
42
+ * 'name' => string,
43
+ * 'filename'=> string (optional)
44
+ * 'headers' => array (optinal) ['header-name' => 'header-value']
45
+ * )
46
+ *
47
+ * @return RequestInterface
48
+ */
49
+ public function create($method, $uri, array $headers = [], $body = null)
50
+ {
51
+ if (!is_array($body)) {
52
+ return $this->getRequestFactory()->createRequest($method, $uri, $headers, $body);
53
+ }
54
+
55
+ $builder = $this->getMultipartStreamBuilder();
56
+ foreach ($body as $item) {
57
+ $name = $item['name'];
58
+ $content = $item['content'];
59
+ unset($item['name']);
60
+ unset($item['content']);
61
+
62
+ $builder->addResource($name, $content, $item);
63
+ }
64
+
65
+ $multipartStream = $builder->build();
66
+ $boundary = $builder->getBoundary();
67
+ $builder->reset();
68
+
69
+ $headers['Content-Type'] = 'multipart/form-data; boundary="'.$boundary.'"';
70
+
71
+ return $this->getRequestFactory()->createRequest($method, $uri, $headers, $multipartStream);
72
+ }
73
+
74
+ /**
75
+ * @return RequestFactory
76
+ */
77
+ private function getRequestFactory()
78
+ {
79
+ if ($this->requestFactory === null) {
80
+ $this->requestFactory = MessageFactoryDiscovery::find();
81
+ }
82
+
83
+ return $this->requestFactory;
84
+ }
85
+
86
+ /**
87
+ * @param RequestFactory $requestFactory
88
+ *
89
+ * @return RequestBuilder
90
+ */
91
+ public function setRequestFactory($requestFactory)
92
+ {
93
+ $this->requestFactory = $requestFactory;
94
+
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * @return MultipartStreamBuilder
100
+ */
101
+ private function getMultipartStreamBuilder()
102
+ {
103
+ if ($this->multipartStreamBuilder === null) {
104
+ $this->multipartStreamBuilder = new MultipartStreamBuilder();
105
+ }
106
+
107
+ return $this->multipartStreamBuilder;
108
+ }
109
+
110
+ /**
111
+ * @param MultipartStreamBuilder $multipartStreamBuilder
112
+ *
113
+ * @return RequestBuilder
114
+ */
115
+ public function setMultipartStreamBuilder($multipartStreamBuilder)
116
+ {
117
+ $this->multipartStreamBuilder = $multipartStreamBuilder;
118
+
119
+ return $this;
120
+ }
121
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/CHANGELOG.md ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+ ## 1.7.0 - 2017-11-30
4
+
5
+ ### Added
6
+
7
+ - Symfony 4 support
8
+
9
+ ### Changed
10
+
11
+ - Strict comparison in DecoderPlugin
12
+
13
+ ## 1.6.0 - 2017-10-16
14
+
15
+ ### Added
16
+
17
+ - 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.
18
+ - `PluginClientFactory` to create `PluginClient` instances.
19
+ - Added new option 'delay' for `RetryPlugin`.
20
+ - Added new option 'decider' for `RetryPlugin`.
21
+ - Supports more cookie date formats in the Cookie Plugin
22
+
23
+ ### Changed
24
+
25
+ - The `RetryPlugin` does now wait between retries. To disable/change this feature you must write something like:
26
+
27
+ ```php
28
+ $plugin = new RetryPlugin(['delay' => function(RequestInterface $request, Exception $e, $retries) {
29
+ return 0;
30
+ });
31
+ ```
32
+
33
+ ### Deprecated
34
+
35
+ - 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).
36
+
37
+ ## 1.5.0 - 2017-03-30
38
+
39
+ ### Added
40
+
41
+ - `QueryDefaultsPlugin` to add default query parameters.
42
+
43
+ ## 1.4.2 - 2017-03-18
44
+
45
+ ### Deprecated
46
+
47
+ - `DecoderPlugin` does not longer claim to support `compress` content encoding
48
+
49
+ ### Fixed
50
+
51
+ - `CookiePlugin` allows main domain cookies to be sent/stored for subdomains
52
+ - `DecoderPlugin` uses the right `FilteredStream` to handle `deflate` content encoding
53
+
54
+
55
+ ## 1.4.1 - 2017-02-20
56
+
57
+ ### Fixed
58
+
59
+ - Cast return value of `StreamInterface::getSize` to string in `ContentLengthPlugin`
60
+
61
+
62
+ ## 1.4.0 - 2016-11-04
63
+
64
+ ### Added
65
+
66
+ - Add Path plugin
67
+ - Base URI plugin that combines Add Host and Add Path plugins
68
+
69
+
70
+ ## 1.3.0 - 2016-10-16
71
+
72
+ ### Changed
73
+
74
+ - Fix Emulated Trait to use Http based promise which respect the HttpAsyncClient interface
75
+ - Require Httplug 1.1 where we use HTTP specific promises.
76
+ - RedirectPlugin: use the full URL instead of the URI to properly keep track of redirects
77
+ - Add AddPathPlugin for API URLs with base path
78
+ - Add BaseUriPlugin that combines AddHostPlugin and AddPathPlugin
79
+
80
+
81
+ ## 1.2.1 - 2016-07-26
82
+
83
+ ### Changed
84
+
85
+ - AddHostPlugin also sets the port if specified
86
+
87
+
88
+ ## 1.2.0 - 2016-07-14
89
+
90
+ ### Added
91
+
92
+ - Suggest separate plugins in composer.json
93
+ - Introduced `debug_plugins` option for `PluginClient`
94
+
95
+
96
+ ## 1.1.0 - 2016-05-04
97
+
98
+ ### Added
99
+
100
+ - Add a flexible http client providing both contract, and only emulating what's necessary
101
+ - HTTP Client Router: route requests to underlying clients
102
+ - Plugin client and core plugins moved here from `php-http/plugins`
103
+
104
+ ### Deprecated
105
+
106
+ - Extending client classes, they will be made final in version 2.0
107
+
108
+
109
+ ## 1.0.0 - 2016-01-27
110
+
111
+ ### Changed
112
+
113
+ - Remove useless interface in BatchException
114
+
115
+
116
+ ## 0.2.0 - 2016-01-12
117
+
118
+ ### Changed
119
+
120
+ - Updated package files
121
+ - Updated HTTPlug to RC1
122
+
123
+
124
+ ## 0.1.1 - 2015-12-26
125
+
126
+ ### Added
127
+
128
+ - Emulated clients
129
+
130
+
131
+ ## 0.1.0 - 2015-12-25
132
+
133
+ ### Added
134
+
135
+ - Batch client from utils
136
+ - Methods client from utils
137
+ - Emulators and decorators from client-tools
Postman/Postman-Mail/mailgun/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.
Postman/Postman-Mail/mailgun/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.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.
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/composer.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "php-http/client-common",
3
+ "description": "Common HTTP Client implementations and tools for HTTPlug",
4
+ "license": "MIT",
5
+ "keywords": ["http", "client", "httplug", "common"],
6
+ "homepage": "http://httplug.io",
7
+ "authors": [
8
+ {
9
+ "name": "Márk Sági-Kazár",
10
+ "email": "mark.sagikazar@gmail.com"
11
+ }
12
+ ],
13
+ "require": {
14
+ "php": "^5.4 || ^7.0",
15
+ "php-http/httplug": "^1.1",
16
+ "php-http/message-factory": "^1.0",
17
+ "php-http/message": "^1.6",
18
+ "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0"
19
+ },
20
+ "require-dev": {
21
+ "phpspec/phpspec": "^2.5 || ^3.4 || ^4.2",
22
+ "guzzlehttp/psr7": "^1.4"
23
+ },
24
+ "suggest": {
25
+ "php-http/logger-plugin": "PSR-3 Logger plugin",
26
+ "php-http/cache-plugin": "PSR-6 Cache plugin",
27
+ "php-http/stopwatch-plugin": "Symfony Stopwatch plugin"
28
+ },
29
+ "autoload": {
30
+ "psr-4": {
31
+ "Http\\Client\\Common\\": "src/"
32
+ }
33
+ },
34
+ "scripts": {
35
+ "test": "vendor/bin/phpspec run",
36
+ "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml"
37
+ },
38
+ "extra": {
39
+ "branch-alias": {
40
+ "dev-master": "1.7-dev"
41
+ }
42
+ }
43
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/BatchClient.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\Exception;
6
+ use Http\Client\HttpClient;
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
+ class BatchClient implements HttpClient
18
+ {
19
+ /**
20
+ * @var HttpClient
21
+ */
22
+ private $client;
23
+
24
+ /**
25
+ * @param HttpClient $client
26
+ */
27
+ public function __construct(HttpClient $client)
28
+ {
29
+ $this->client = $client;
30
+ }
31
+
32
+ /**
33
+ * {@inheritdoc}
34
+ */
35
+ public function sendRequest(RequestInterface $request)
36
+ {
37
+ return $this->client->sendRequest($request);
38
+ }
39
+
40
+ /**
41
+ * Send several requests.
42
+ *
43
+ * You may not assume that the requests are executed in a particular order. If the order matters
44
+ * for your application, use sendRequest sequentially.
45
+ *
46
+ * @param RequestInterface[] The requests to send
47
+ *
48
+ * @return BatchResult Containing one result per request
49
+ *
50
+ * @throws BatchException If one or more requests fails. The exception gives access to the
51
+ * BatchResult with a map of request to result for success, request to
52
+ * exception for failures
53
+ */
54
+ public function sendRequests(array $requests)
55
+ {
56
+ $batchResult = new BatchResult();
57
+
58
+ foreach ($requests as $request) {
59
+ try {
60
+ $response = $this->sendRequest($request);
61
+ $batchResult = $batchResult->addResponse($request, $response);
62
+ } catch (Exception $e) {
63
+ $batchResult = $batchResult->addException($request, $e);
64
+ }
65
+ }
66
+
67
+ if ($batchResult->hasExceptions()) {
68
+ throw new BatchException($batchResult);
69
+ }
70
+
71
+ return $batchResult;
72
+ }
73
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/BatchResult.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\Exception;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\ResponseInterface;
8
+
9
+ /**
10
+ * Responses and exceptions returned from parallel request execution.
11
+ *
12
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
+ */
14
+ final class BatchResult
15
+ {
16
+ /**
17
+ * @var \SplObjectStorage
18
+ */
19
+ private $responses;
20
+
21
+ /**
22
+ * @var \SplObjectStorage
23
+ */
24
+ private $exceptions;
25
+
26
+ public function __construct()
27
+ {
28
+ $this->responses = new \SplObjectStorage();
29
+ $this->exceptions = new \SplObjectStorage();
30
+ }
31
+
32
+ /**
33
+ * Checks if there are any successful responses at all.
34
+ *
35
+ * @return bool
36
+ */
37
+ public function hasResponses()
38
+ {
39
+ return $this->responses->count() > 0;
40
+ }
41
+
42
+ /**
43
+ * Returns all successful responses.
44
+ *
45
+ * @return ResponseInterface[]
46
+ */
47
+ public function getResponses()
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
+ * @param RequestInterface $request
62
+ *
63
+ * @return bool
64
+ */
65
+ public function isSuccessful(RequestInterface $request)
66
+ {
67
+ return $this->responses->contains($request);
68
+ }
69
+
70
+ /**
71
+ * Returns the response for a successful request.
72
+ *
73
+ * @param RequestInterface $request
74
+ *
75
+ * @return ResponseInterface
76
+ *
77
+ * @throws \UnexpectedValueException If request was not part of the batch or failed
78
+ */
79
+ public function getResponseFor(RequestInterface $request)
80
+ {
81
+ try {
82
+ return $this->responses[$request];
83
+ } catch (\UnexpectedValueException $e) {
84
+ throw new \UnexpectedValueException('Request not found', $e->getCode(), $e);
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Adds a response in an immutable way.
90
+ *
91
+ * @param RequestInterface $request
92
+ * @param ResponseInterface $response
93
+ *
94
+ * @return BatchResult the new BatchResult with this request-response pair added to it
95
+ */
96
+ public function addResponse(RequestInterface $request, ResponseInterface $response)
97
+ {
98
+ $new = clone $this;
99
+ $new->responses->attach($request, $response);
100
+
101
+ return $new;
102
+ }
103
+
104
+ /**
105
+ * Checks if there are any unsuccessful requests at all.
106
+ *
107
+ * @return bool
108
+ */
109
+ public function hasExceptions()
110
+ {
111
+ return $this->exceptions->count() > 0;
112
+ }
113
+
114
+ /**
115
+ * Returns all exceptions for the unsuccessful requests.
116
+ *
117
+ * @return Exception[]
118
+ */
119
+ public function getExceptions()
120
+ {
121
+ $exceptions = [];
122
+
123
+ foreach ($this->exceptions as $request) {
124
+ $exceptions[] = $this->exceptions[$request];
125
+ }
126
+
127
+ return $exceptions;
128
+ }
129
+
130
+ /**
131
+ * Checks if there is an exception for a request, meaning the request failed.
132
+ *
133
+ * @param RequestInterface $request
134
+ *
135
+ * @return bool
136
+ */
137
+ public function isFailed(RequestInterface $request)
138
+ {
139
+ return $this->exceptions->contains($request);
140
+ }
141
+
142
+ /**
143
+ * Returns the exception for a failed request.
144
+ *
145
+ * @param RequestInterface $request
146
+ *
147
+ * @return Exception
148
+ *
149
+ * @throws \UnexpectedValueException If request was not part of the batch or was successful
150
+ */
151
+ public function getExceptionFor(RequestInterface $request)
152
+ {
153
+ try {
154
+ return $this->exceptions[$request];
155
+ } catch (\UnexpectedValueException $e) {
156
+ throw new \UnexpectedValueException('Request not found', $e->getCode(), $e);
157
+ }
158
+ }
159
+
160
+ /**
161
+ * Adds an exception in an immutable way.
162
+ *
163
+ * @param RequestInterface $request
164
+ * @param Exception $exception
165
+ *
166
+ * @return BatchResult the new BatchResult with this request-exception pair added to it
167
+ */
168
+ public function addException(RequestInterface $request, Exception $exception)
169
+ {
170
+ $new = clone $this;
171
+ $new->exceptions->attach($request, $exception);
172
+
173
+ return $new;
174
+ }
175
+
176
+ public function __clone()
177
+ {
178
+ $this->responses = clone $this->responses;
179
+ $this->exceptions = clone $this->exceptions;
180
+ }
181
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\HttpAsyncClient;
6
+ use Http\Client\HttpClient;
7
+
8
+ /**
9
+ * Emulates an async HTTP client.
10
+ *
11
+ * This should be replaced by an anonymous class in PHP 7.
12
+ *
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ class EmulatedHttpAsyncClient implements HttpClient, HttpAsyncClient
16
+ {
17
+ use HttpAsyncClientEmulator;
18
+ use HttpClientDecorator;
19
+
20
+ /**
21
+ * @param HttpClient $httpClient
22
+ */
23
+ public function __construct(HttpClient $httpClient)
24
+ {
25
+ $this->httpClient = $httpClient;
26
+ }
27
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/EmulatedHttpClient.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\HttpAsyncClient;
6
+ use Http\Client\HttpClient;
7
+
8
+ /**
9
+ * Emulates an HTTP client.
10
+ *
11
+ * This should be replaced by an anonymous class in PHP 7.
12
+ *
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ class EmulatedHttpClient implements HttpClient, HttpAsyncClient
16
+ {
17
+ use HttpAsyncClientDecorator;
18
+ use HttpClientEmulator;
19
+
20
+ /**
21
+ * @param HttpAsyncClient $httpAsyncClient
22
+ */
23
+ public function __construct(HttpAsyncClient $httpAsyncClient)
24
+ {
25
+ $this->httpAsyncClient = $httpAsyncClient;
26
+ }
27
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/BatchException.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Exception;
4
+
5
+ use Http\Client\Exception\TransferException;
6
+ use Http\Client\Common\BatchResult;
7
+
8
+ /**
9
+ * This exception is thrown when HttpClient::sendRequests led to at least one failure.
10
+ *
11
+ * It gives access to a BatchResult with the request-exception and request-response pairs.
12
+ *
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ final class BatchException extends TransferException
16
+ {
17
+ /**
18
+ * @var BatchResult
19
+ */
20
+ private $result;
21
+
22
+ /**
23
+ * @param BatchResult $result
24
+ */
25
+ public function __construct(BatchResult $result)
26
+ {
27
+ $this->result = $result;
28
+ }
29
+
30
+ /**
31
+ * Returns the BatchResult that contains all responses and exceptions.
32
+ *
33
+ * @return BatchResult
34
+ */
35
+ public function getResult()
36
+ {
37
+ return $this->result;
38
+ }
39
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/CircularRedirectionException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Exception;
4
+
5
+ use Http\Client\Exception\HttpException;
6
+
7
+ /**
8
+ * Thrown when circular redirection is detected.
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class CircularRedirectionException extends HttpException
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/ClientErrorException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Exception;
4
+
5
+ use Http\Client\Exception\HttpException;
6
+
7
+ /**
8
+ * Thrown when there is a client error (4xx).
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class ClientErrorException extends HttpException
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Exception;
4
+
5
+ use Http\Client\Exception\TransferException;
6
+
7
+ /**
8
+ * Thrown when a http client cannot be chosen in a pool.
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class HttpClientNotFoundException extends TransferException
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/LoopException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Exception;
4
+
5
+ use Http\Client\Exception\RequestException;
6
+
7
+ /**
8
+ * Thrown when the Plugin Client detects an endless loop.
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class LoopException extends RequestException
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Exception;
4
+
5
+ use Http\Client\Exception\HttpException;
6
+
7
+ /**
8
+ * Redirect location cannot be chosen.
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class MultipleRedirectionException extends HttpException
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Exception/ServerErrorException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Exception;
4
+
5
+ use Http\Client\Exception\HttpException;
6
+
7
+ /**
8
+ * Thrown when there is a server error (5xx).
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class ServerErrorException extends HttpException
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/FlexibleHttpClient.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\HttpAsyncClient;
6
+ use Http\Client\HttpClient;
7
+
8
+ /**
9
+ * A flexible http client, which implements both interface and will emulate
10
+ * one contract, the other, or none at all depending on the injected client contract.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class FlexibleHttpClient implements HttpClient, HttpAsyncClient
15
+ {
16
+ use HttpClientDecorator;
17
+ use HttpAsyncClientDecorator;
18
+
19
+ /**
20
+ * @param HttpClient|HttpAsyncClient $client
21
+ */
22
+ public function __construct($client)
23
+ {
24
+ if (!($client instanceof HttpClient) && !($client instanceof HttpAsyncClient)) {
25
+ throw new \LogicException('Client must be an instance of Http\\Client\\HttpClient or Http\\Client\\HttpAsyncClient');
26
+ }
27
+
28
+ $this->httpClient = $client;
29
+ $this->httpAsyncClient = $client;
30
+
31
+ if (!($this->httpClient instanceof HttpClient)) {
32
+ $this->httpClient = new EmulatedHttpClient($this->httpClient);
33
+ }
34
+
35
+ if (!($this->httpAsyncClient instanceof HttpAsyncClient)) {
36
+ $this->httpAsyncClient = new EmulatedHttpAsyncClient($this->httpAsyncClient);
37
+ }
38
+ }
39
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpAsyncClientDecorator.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\HttpAsyncClient;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Decorates an HTTP Async Client.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ trait HttpAsyncClientDecorator
14
+ {
15
+ /**
16
+ * @var HttpAsyncClient
17
+ */
18
+ protected $httpAsyncClient;
19
+
20
+ /**
21
+ * {@inheritdoc}
22
+ *
23
+ * @see HttpAsyncClient::sendAsyncRequest
24
+ */
25
+ public function sendAsyncRequest(RequestInterface $request)
26
+ {
27
+ return $this->httpAsyncClient->sendAsyncRequest($request);
28
+ }
29
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpAsyncClientEmulator.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\Exception;
6
+ use Http\Client\Promise;
7
+ use Psr\Http\Message\RequestInterface;
8
+
9
+ /**
10
+ * Emulates an HTTP Async Client in an HTTP Client.
11
+ *
12
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
+ */
14
+ trait HttpAsyncClientEmulator
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ *
19
+ * @see HttpClient::sendRequest
20
+ */
21
+ abstract public function sendRequest(RequestInterface $request);
22
+
23
+ /**
24
+ * {@inheritdoc}
25
+ *
26
+ * @see HttpAsyncClient::sendAsyncRequest
27
+ */
28
+ public function sendAsyncRequest(RequestInterface $request)
29
+ {
30
+ try {
31
+ return new Promise\HttpFulfilledPromise($this->sendRequest($request));
32
+ } catch (Exception $e) {
33
+ return new Promise\HttpRejectedPromise($e);
34
+ }
35
+ }
36
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientDecorator.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\HttpClient;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Decorates an HTTP Client.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ trait HttpClientDecorator
14
+ {
15
+ /**
16
+ * @var HttpClient
17
+ */
18
+ protected $httpClient;
19
+
20
+ /**
21
+ * {@inheritdoc}
22
+ *
23
+ * @see HttpClient::sendRequest
24
+ */
25
+ public function sendRequest(RequestInterface $request)
26
+ {
27
+ return $this->httpClient->sendRequest($request);
28
+ }
29
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientEmulator.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Psr\Http\Message\RequestInterface;
6
+
7
+ /**
8
+ * Emulates an HTTP Client in an HTTP Async Client.
9
+ *
10
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
+ */
12
+ trait HttpClientEmulator
13
+ {
14
+ /**
15
+ * {@inheritdoc}
16
+ *
17
+ * @see HttpClient::sendRequest
18
+ */
19
+ public function sendRequest(RequestInterface $request)
20
+ {
21
+ $promise = $this->sendAsyncRequest($request);
22
+
23
+ return $promise->wait();
24
+ }
25
+
26
+ /**
27
+ * {@inheritdoc}
28
+ *
29
+ * @see HttpAsyncClient::sendAsyncRequest
30
+ */
31
+ abstract public function sendAsyncRequest(RequestInterface $request);
32
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPool.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\Common\Exception\HttpClientNotFoundException;
6
+ use Http\Client\HttpAsyncClient;
7
+ use Http\Client\HttpClient;
8
+ use Psr\Http\Message\RequestInterface;
9
+
10
+ /**
11
+ * A http client pool allows to send requests on a pool of different http client using a specific strategy (least used,
12
+ * round robin, ...).
13
+ */
14
+ abstract class HttpClientPool implements HttpAsyncClient, HttpClient
15
+ {
16
+ /**
17
+ * @var HttpClientPoolItem[]
18
+ */
19
+ protected $clientPool = [];
20
+
21
+ /**
22
+ * Add a client to the pool.
23
+ *
24
+ * @param HttpClient|HttpAsyncClient|HttpClientPoolItem $client
25
+ */
26
+ public function addHttpClient($client)
27
+ {
28
+ if (!$client instanceof HttpClientPoolItem) {
29
+ $client = new HttpClientPoolItem($client);
30
+ }
31
+
32
+ $this->clientPool[] = $client;
33
+ }
34
+
35
+ /**
36
+ * Return an http client given a specific strategy.
37
+ *
38
+ * @throws HttpClientNotFoundException When no http client has been found into the pool
39
+ *
40
+ * @return HttpClientPoolItem Return a http client that can do both sync or async
41
+ */
42
+ abstract protected function chooseHttpClient();
43
+
44
+ /**
45
+ * {@inheritdoc}
46
+ */
47
+ public function sendAsyncRequest(RequestInterface $request)
48
+ {
49
+ return $this->chooseHttpClient()->sendAsyncRequest($request);
50
+ }
51
+
52
+ /**
53
+ * {@inheritdoc}
54
+ */
55
+ public function sendRequest(RequestInterface $request)
56
+ {
57
+ return $this->chooseHttpClient()->sendRequest($request);
58
+ }
59
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\HttpClientPool;
4
+
5
+ use Http\Client\Common\Exception\HttpClientNotFoundException;
6
+ use Http\Client\Common\HttpClientPool;
7
+ use Http\Client\Common\HttpClientPoolItem;
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()
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\HttpClientPool;
4
+
5
+ use Http\Client\Common\Exception\HttpClientNotFoundException;
6
+ use Http\Client\Common\HttpClientPool;
7
+ use Http\Client\Common\HttpClientPoolItem;
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()
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\HttpClientPool;
4
+
5
+ use Http\Client\Common\Exception\HttpClientNotFoundException;
6
+ use Http\Client\Common\HttpClientPool;
7
+
8
+ /**
9
+ * RoundRobinClientPool will choose the next client in the pool.
10
+ *
11
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
12
+ */
13
+ final class RoundRobinClientPool extends HttpClientPool
14
+ {
15
+ /**
16
+ * {@inheritdoc}
17
+ */
18
+ protected function chooseHttpClient()
19
+ {
20
+ $last = current($this->clientPool);
21
+
22
+ do {
23
+ $client = next($this->clientPool);
24
+
25
+ if (false === $client) {
26
+ $client = reset($this->clientPool);
27
+
28
+ if (false === $client) {
29
+ throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool');
30
+ }
31
+ }
32
+
33
+ // Case when there is only one and the last one has been disabled
34
+ if ($last === $client && $client->isDisabled()) {
35
+ throw new HttpClientNotFoundException('Cannot choose a http client as there is no one enabled in the pool');
36
+ }
37
+ } while ($client->isDisabled());
38
+
39
+ return $client;
40
+ }
41
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientPoolItem.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\HttpAsyncClient;
6
+ use Http\Client\HttpClient;
7
+ use Psr\Http\Message\RequestInterface;
8
+ use Http\Client\Exception;
9
+
10
+ /**
11
+ * A HttpClientPoolItem represent a HttpClient inside a Pool.
12
+ *
13
+ * It is disabled when a request failed and can be reenable after a certain number of seconds
14
+ * It also keep tracks of the current number of request the client is currently sending (only usable for async method)
15
+ *
16
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
17
+ */
18
+ class HttpClientPoolItem implements HttpClient, HttpAsyncClient
19
+ {
20
+ /**
21
+ * @var int Number of request this client is currently sending
22
+ */
23
+ private $sendingRequestCount = 0;
24
+
25
+ /**
26
+ * @var \DateTime|null Time when this client has been disabled or null if enable
27
+ */
28
+ private $disabledAt;
29
+
30
+ /**
31
+ * @var int|null Number of seconds after this client is reenable, by default null: never reenable this client
32
+ */
33
+ private $reenableAfter;
34
+
35
+ /**
36
+ * @var FlexibleHttpClient A http client responding to async and sync request
37
+ */
38
+ private $client;
39
+
40
+ /**
41
+ * @param HttpClient|HttpAsyncClient $client
42
+ * @param null|int $reenableAfter Number of seconds after this client is reenable
43
+ */
44
+ public function __construct($client, $reenableAfter = null)
45
+ {
46
+ $this->client = new FlexibleHttpClient($client);
47
+ $this->reenableAfter = $reenableAfter;
48
+ }
49
+
50
+ /**
51
+ * {@inheritdoc}
52
+ */
53
+ public function sendRequest(RequestInterface $request)
54
+ {
55
+ if ($this->isDisabled()) {
56
+ throw new Exception\RequestException('Cannot send the request as this client has been disabled', $request);
57
+ }
58
+
59
+ try {
60
+ $this->incrementRequestCount();
61
+ $response = $this->client->sendRequest($request);
62
+ $this->decrementRequestCount();
63
+ } catch (Exception $e) {
64
+ $this->disable();
65
+ $this->decrementRequestCount();
66
+
67
+ throw $e;
68
+ }
69
+
70
+ return $response;
71
+ }
72
+
73
+ /**
74
+ * {@inheritdoc}
75
+ */
76
+ public function sendAsyncRequest(RequestInterface $request)
77
+ {
78
+ if ($this->isDisabled()) {
79
+ throw new Exception\RequestException('Cannot send the request as this client has been disabled', $request);
80
+ }
81
+
82
+ $this->incrementRequestCount();
83
+
84
+ return $this->client->sendAsyncRequest($request)->then(function ($response) {
85
+ $this->decrementRequestCount();
86
+
87
+ return $response;
88
+ }, function ($exception) {
89
+ $this->disable();
90
+ $this->decrementRequestCount();
91
+
92
+ throw $exception;
93
+ });
94
+ }
95
+
96
+ /**
97
+ * Whether this client is disabled or not.
98
+ *
99
+ * Will also reactivate this client if possible
100
+ *
101
+ * @internal
102
+ *
103
+ * @return bool
104
+ */
105
+ public function isDisabled()
106
+ {
107
+ $disabledAt = $this->getDisabledAt();
108
+
109
+ if (null !== $this->reenableAfter && null !== $disabledAt) {
110
+ // Reenable after a certain time
111
+ $now = new \DateTime();
112
+
113
+ if (($now->getTimestamp() - $disabledAt->getTimestamp()) >= $this->reenableAfter) {
114
+ $this->enable();
115
+
116
+ return false;
117
+ }
118
+
119
+ return true;
120
+ }
121
+
122
+ return null !== $disabledAt;
123
+ }
124
+
125
+ /**
126
+ * Get current number of request that is send by the underlying http client.
127
+ *
128
+ * @internal
129
+ *
130
+ * @return int
131
+ */
132
+ public function getSendingRequestCount()
133
+ {
134
+ return $this->sendingRequestCount;
135
+ }
136
+
137
+ /**
138
+ * Return when this client has been disabled or null if it's enabled.
139
+ *
140
+ * @return \DateTime|null
141
+ */
142
+ private function getDisabledAt()
143
+ {
144
+ return $this->disabledAt;
145
+ }
146
+
147
+ /**
148
+ * Increment the request count.
149
+ */
150
+ private function incrementRequestCount()
151
+ {
152
+ ++$this->sendingRequestCount;
153
+ }
154
+
155
+ /**
156
+ * Decrement the request count.
157
+ */
158
+ private function decrementRequestCount()
159
+ {
160
+ --$this->sendingRequestCount;
161
+ }
162
+
163
+ /**
164
+ * Enable the current client.
165
+ */
166
+ private function enable()
167
+ {
168
+ $this->disabledAt = null;
169
+ }
170
+
171
+ /**
172
+ * Disable the current client.
173
+ */
174
+ private function disable()
175
+ {
176
+ $this->disabledAt = new \DateTime('now');
177
+ }
178
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpClientRouter.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\Exception\RequestException;
6
+ use Http\Client\HttpAsyncClient;
7
+ use Http\Client\HttpClient;
8
+ use Http\Message\RequestMatcher;
9
+ use Psr\Http\Message\RequestInterface;
10
+
11
+ /**
12
+ * Route a request to a specific client in the stack based using a RequestMatcher.
13
+ *
14
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
15
+ */
16
+ final class HttpClientRouter implements HttpClient, HttpAsyncClient
17
+ {
18
+ /**
19
+ * @var array
20
+ */
21
+ private $clients = [];
22
+
23
+ /**
24
+ * {@inheritdoc}
25
+ */
26
+ public function sendRequest(RequestInterface $request)
27
+ {
28
+ $client = $this->chooseHttpClient($request);
29
+
30
+ return $client->sendRequest($request);
31
+ }
32
+
33
+ /**
34
+ * {@inheritdoc}
35
+ */
36
+ public function sendAsyncRequest(RequestInterface $request)
37
+ {
38
+ $client = $this->chooseHttpClient($request);
39
+
40
+ return $client->sendAsyncRequest($request);
41
+ }
42
+
43
+ /**
44
+ * Add a client to the router.
45
+ *
46
+ * @param HttpClient|HttpAsyncClient $client
47
+ * @param RequestMatcher $requestMatcher
48
+ */
49
+ public function addClient($client, RequestMatcher $requestMatcher)
50
+ {
51
+ $this->clients[] = [
52
+ 'matcher' => $requestMatcher,
53
+ 'client' => new FlexibleHttpClient($client),
54
+ ];
55
+ }
56
+
57
+ /**
58
+ * Choose an HTTP client given a specific request.
59
+ *
60
+ * @param RequestInterface $request
61
+ *
62
+ * @return HttpClient|HttpAsyncClient
63
+ */
64
+ protected function chooseHttpClient(RequestInterface $request)
65
+ {
66
+ foreach ($this->clients as $client) {
67
+ if ($client['matcher']->matches($request)) {
68
+ return $client['client'];
69
+ }
70
+ }
71
+
72
+ throw new RequestException('No client found for the specified request', $request);
73
+ }
74
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/HttpMethodsClient.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\Exception;
6
+ use Http\Client\HttpClient;
7
+ use Http\Message\RequestFactory;
8
+ use Psr\Http\Message\RequestInterface;
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
+ class HttpMethodsClient implements HttpClient
28
+ {
29
+ /**
30
+ * @var HttpClient
31
+ */
32
+ private $httpClient;
33
+
34
+ /**
35
+ * @var RequestFactory
36
+ */
37
+ private $requestFactory;
38
+
39
+ /**
40
+ * @param HttpClient $httpClient The client to send requests with
41
+ * @param RequestFactory $requestFactory The message factory to create requests
42
+ */
43
+ public function __construct(HttpClient $httpClient, RequestFactory $requestFactory)
44
+ {
45
+ $this->httpClient = $httpClient;
46
+ $this->requestFactory = $requestFactory;
47
+ }
48
+
49
+ /**
50
+ * Sends a GET request.
51
+ *
52
+ * @param string|UriInterface $uri
53
+ * @param array $headers
54
+ *
55
+ * @throws Exception
56
+ *
57
+ * @return ResponseInterface
58
+ */
59
+ public function get($uri, array $headers = [])
60
+ {
61
+ return $this->send('GET', $uri, $headers, null);
62
+ }
63
+
64
+ /**
65
+ * Sends an HEAD request.
66
+ *
67
+ * @param string|UriInterface $uri
68
+ * @param array $headers
69
+ *
70
+ * @throws Exception
71
+ *
72
+ * @return ResponseInterface
73
+ */
74
+ public function head($uri, array $headers = [])
75
+ {
76
+ return $this->send('HEAD', $uri, $headers, null);
77
+ }
78
+
79
+ /**
80
+ * Sends a TRACE request.
81
+ *
82
+ * @param string|UriInterface $uri
83
+ * @param array $headers
84
+ *
85
+ * @throws Exception
86
+ *
87
+ * @return ResponseInterface
88
+ */
89
+ public function trace($uri, array $headers = [])
90
+ {
91
+ return $this->send('TRACE', $uri, $headers, null);
92
+ }
93
+
94
+ /**
95
+ * Sends a POST request.
96
+ *
97
+ * @param string|UriInterface $uri
98
+ * @param array $headers
99
+ * @param string|StreamInterface|null $body
100
+ *
101
+ * @throws Exception
102
+ *
103
+ * @return ResponseInterface
104
+ */
105
+ public function post($uri, array $headers = [], $body = null)
106
+ {
107
+ return $this->send('POST', $uri, $headers, $body);
108
+ }
109
+
110
+ /**
111
+ * Sends a PUT request.
112
+ *
113
+ * @param string|UriInterface $uri
114
+ * @param array $headers
115
+ * @param string|StreamInterface|null $body
116
+ *
117
+ * @throws Exception
118
+ *
119
+ * @return ResponseInterface
120
+ */
121
+ public function put($uri, array $headers = [], $body = null)
122
+ {
123
+ return $this->send('PUT', $uri, $headers, $body);
124
+ }
125
+
126
+ /**
127
+ * Sends a PATCH request.
128
+ *
129
+ * @param string|UriInterface $uri
130
+ * @param array $headers
131
+ * @param string|StreamInterface|null $body
132
+ *
133
+ * @throws Exception
134
+ *
135
+ * @return ResponseInterface
136
+ */
137
+ public function patch($uri, array $headers = [], $body = null)
138
+ {
139
+ return $this->send('PATCH', $uri, $headers, $body);
140
+ }
141
+
142
+ /**
143
+ * Sends a DELETE request.
144
+ *
145
+ * @param string|UriInterface $uri
146
+ * @param array $headers
147
+ * @param string|StreamInterface|null $body
148
+ *
149
+ * @throws Exception
150
+ *
151
+ * @return ResponseInterface
152
+ */
153
+ public function delete($uri, array $headers = [], $body = null)
154
+ {
155
+ return $this->send('DELETE', $uri, $headers, $body);
156
+ }
157
+
158
+ /**
159
+ * Sends an OPTIONS request.
160
+ *
161
+ * @param string|UriInterface $uri
162
+ * @param array $headers
163
+ * @param string|StreamInterface|null $body
164
+ *
165
+ * @throws Exception
166
+ *
167
+ * @return ResponseInterface
168
+ */
169
+ public function options($uri, array $headers = [], $body = null)
170
+ {
171
+ return $this->send('OPTIONS', $uri, $headers, $body);
172
+ }
173
+
174
+ /**
175
+ * Sends a request with any HTTP method.
176
+ *
177
+ * @param string $method HTTP method to use
178
+ * @param string|UriInterface $uri
179
+ * @param array $headers
180
+ * @param string|StreamInterface|null $body
181
+ *
182
+ * @throws Exception
183
+ *
184
+ * @return ResponseInterface
185
+ */
186
+ public function send($method, $uri, array $headers = [], $body = null)
187
+ {
188
+ return $this->sendRequest($this->requestFactory->createRequest(
189
+ $method,
190
+ $uri,
191
+ $headers,
192
+ $body
193
+ ));
194
+ }
195
+
196
+ /**
197
+ * Forward to the underlying HttpClient.
198
+ *
199
+ * {@inheritdoc}
200
+ */
201
+ public function sendRequest(RequestInterface $request)
202
+ {
203
+ return $this->httpClient->sendRequest($request);
204
+ }
205
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Promise\Promise;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * A plugin is a middleware to transform the request and/or the response.
10
+ *
11
+ * The plugin can:
12
+ * - break the chain and return a response
13
+ * - dispatch the request to the next middleware
14
+ * - restart the request
15
+ *
16
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
17
+ */
18
+ interface Plugin
19
+ {
20
+ /**
21
+ * Handle the request and return the response coming from the next callable.
22
+ *
23
+ * @see http://docs.php-http.org/en/latest/plugins/build-your-own.html
24
+ *
25
+ * @param RequestInterface $request
26
+ * @param callable $next Next middleware in the chain, the request is passed as the first argument
27
+ * @param callable $first First middleware in the chain, used to to restart a request
28
+ *
29
+ * @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient).
30
+ */
31
+ public function handleRequest(RequestInterface $request, callable $next, callable $first);
32
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\UriInterface;
8
+ use Symfony\Component\OptionsResolver\OptionsResolver;
9
+
10
+ /**
11
+ * Add schema, host and port to a request. Can be set to overwrite the schema and host if desired.
12
+ *
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ final class AddHostPlugin implements Plugin
16
+ {
17
+ /**
18
+ * @var UriInterface
19
+ */
20
+ private $host;
21
+
22
+ /**
23
+ * @var bool
24
+ */
25
+ private $replace;
26
+
27
+ /**
28
+ * @param UriInterface $host
29
+ * @param array $config {
30
+ *
31
+ * @var bool $replace True will replace all hosts, false will only add host when none is specified.
32
+ * }
33
+ */
34
+ public function __construct(UriInterface $host, array $config = [])
35
+ {
36
+ if ('' === $host->getHost()) {
37
+ throw new \LogicException('Host can not be empty');
38
+ }
39
+
40
+ $this->host = $host;
41
+
42
+ $resolver = new OptionsResolver();
43
+ $this->configureOptions($resolver);
44
+ $options = $resolver->resolve($config);
45
+
46
+ $this->replace = $options['replace'];
47
+ }
48
+
49
+ /**
50
+ * {@inheritdoc}
51
+ */
52
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
53
+ {
54
+ if ($this->replace || '' === $request->getUri()->getHost()) {
55
+ $uri = $request->getUri()
56
+ ->withHost($this->host->getHost())
57
+ ->withScheme($this->host->getScheme())
58
+ ->withPort($this->host->getPort())
59
+ ;
60
+
61
+ $request = $request->withUri($uri);
62
+ }
63
+
64
+ return $next($request);
65
+ }
66
+
67
+ /**
68
+ * @param OptionsResolver $resolver
69
+ */
70
+ private function configureOptions(OptionsResolver $resolver)
71
+ {
72
+ $resolver->setDefaults([
73
+ 'replace' => false,
74
+ ]);
75
+ $resolver->setAllowedTypes('replace', 'bool');
76
+ }
77
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\UriInterface;
8
+
9
+ /**
10
+ * Prepend a base path to the request URI. Useful for base API URLs like http://domain.com/api.
11
+ *
12
+ * @author Sullivan Senechal <soullivaneuh@gmail.com>
13
+ */
14
+ final class AddPathPlugin implements Plugin
15
+ {
16
+ /**
17
+ * @var UriInterface
18
+ */
19
+ private $uri;
20
+
21
+ /**
22
+ * @param UriInterface $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
+ throw new \LogicException('URI path cannot end with a slash.');
32
+ }
33
+
34
+ $this->uri = $uri;
35
+ }
36
+
37
+ /**
38
+ * {@inheritdoc}
39
+ */
40
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
41
+ {
42
+ $request = $request->withUri($request->getUri()
43
+ ->withPath($this->uri->getPath().$request->getUri()->getPath())
44
+ );
45
+
46
+ return $next($request);
47
+ }
48
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Http\Message\Authentication;
7
+ use Psr\Http\Message\RequestInterface;
8
+
9
+ /**
10
+ * Send an authenticated request.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class AuthenticationPlugin implements Plugin
15
+ {
16
+ /**
17
+ * @var Authentication An authentication system
18
+ */
19
+ private $authentication;
20
+
21
+ /**
22
+ * @param Authentication $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)
33
+ {
34
+ $request = $this->authentication->authenticate($request);
35
+
36
+ return $next($request);
37
+ }
38
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\UriInterface;
8
+
9
+ /**
10
+ * Combines the AddHostPlugin and AddPathPlugin.
11
+ *
12
+ * @author Sullivan Senechal <soullivaneuh@gmail.com>
13
+ */
14
+ final class BaseUriPlugin implements Plugin
15
+ {
16
+ /**
17
+ * @var AddHostPlugin
18
+ */
19
+ private $addHostPlugin;
20
+
21
+ /**
22
+ * @var AddPathPlugin|null
23
+ */
24
+ private $addPathPlugin = null;
25
+
26
+ /**
27
+ * @param UriInterface $uri Has to contain a host name and cans have a path.
28
+ * @param array $hostConfig Config for AddHostPlugin. @see AddHostPlugin::configureOptions
29
+ */
30
+ public function __construct(UriInterface $uri, array $hostConfig = [])
31
+ {
32
+ $this->addHostPlugin = new AddHostPlugin($uri, $hostConfig);
33
+
34
+ if (rtrim($uri->getPath(), '/')) {
35
+ $this->addPathPlugin = new AddPathPlugin($uri);
36
+ }
37
+ }
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
43
+ {
44
+ $addHostNext = function (RequestInterface $request) use ($next, $first) {
45
+ return $this->addHostPlugin->handleRequest($request, $next, $first);
46
+ };
47
+
48
+ if ($this->addPathPlugin) {
49
+ return $this->addPathPlugin->handleRequest($request, $addHostNext, $first);
50
+ }
51
+
52
+ return $addHostNext($request);
53
+ }
54
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Http\Message\Encoding\ChunkStream;
7
+ use Psr\Http\Message\RequestInterface;
8
+
9
+ /**
10
+ * Allow to set the correct content length header on the request or to transfer it as a chunk if not possible.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class ContentLengthPlugin implements Plugin
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
20
+ {
21
+ if (!$request->hasHeader('Content-Length')) {
22
+ $stream = $request->getBody();
23
+
24
+ // Cannot determine the size so we use a chunk stream
25
+ if (null === $stream->getSize()) {
26
+ $stream = new ChunkStream($stream);
27
+ $request = $request->withBody($stream);
28
+ $request = $request->withAddedHeader('Transfer-Encoding', 'chunked');
29
+ } else {
30
+ $request = $request->withHeader('Content-Length', (string) $stream->getSize());
31
+ }
32
+ }
33
+
34
+ return $next($request);
35
+ }
36
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\StreamInterface;
8
+ use Symfony\Component\OptionsResolver\OptionsResolver;
9
+
10
+ /**
11
+ * Allow to set the correct content type header on the request automatically only if it is not set.
12
+ *
13
+ * @author Karim Pinchon <karim.pinchon@gmail.com>
14
+ */
15
+ final class ContentTypePlugin implements Plugin
16
+ {
17
+ /**
18
+ * Allow to disable the content type detection when stream is too large (as it can consume a lot of resource).
19
+ *
20
+ * @var bool
21
+ *
22
+ * true skip the content type detection
23
+ * false detect the content type (default value)
24
+ */
25
+ protected $skipDetection;
26
+
27
+ /**
28
+ * Determine the size stream limit for which the detection as to be skipped (default to 16Mb).
29
+ *
30
+ * @var int
31
+ */
32
+ protected $sizeLimit;
33
+
34
+ /**
35
+ * @param array $config {
36
+ *
37
+ * @var bool $skip_detection True skip detection if stream size is bigger than $size_limit.
38
+ * @var int $size_limit size stream limit for which the detection as to be skipped.
39
+ * }
40
+ */
41
+ public function __construct(array $config = [])
42
+ {
43
+ $resolver = new OptionsResolver();
44
+ $resolver->setDefaults([
45
+ 'skip_detection' => false,
46
+ 'size_limit' => 16000000,
47
+ ]);
48
+ $resolver->setAllowedTypes('skip_detection', 'bool');
49
+ $resolver->setAllowedTypes('size_limit', 'int');
50
+
51
+ $options = $resolver->resolve($config);
52
+
53
+ $this->skipDetection = $options['skip_detection'];
54
+ $this->sizeLimit = $options['size_limit'];
55
+ }
56
+
57
+ /**
58
+ * {@inheritdoc}
59
+ */
60
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
61
+ {
62
+ if (!$request->hasHeader('Content-Type')) {
63
+ $stream = $request->getBody();
64
+ $streamSize = $stream->getSize();
65
+
66
+ if (!$stream->isSeekable()) {
67
+ return $next($request);
68
+ }
69
+
70
+ if (0 === $streamSize) {
71
+ return $next($request);
72
+ }
73
+
74
+ if ($this->skipDetection && (null === $streamSize || $streamSize >= $this->sizeLimit)) {
75
+ return $next($request);
76
+ }
77
+
78
+ if ($this->isJson($stream)) {
79
+ $request = $request->withHeader('Content-Type', 'application/json');
80
+
81
+ return $next($request);
82
+ }
83
+
84
+ if ($this->isXml($stream)) {
85
+ $request = $request->withHeader('Content-Type', 'application/xml');
86
+
87
+ return $next($request);
88
+ }
89
+ }
90
+
91
+ return $next($request);
92
+ }
93
+
94
+ /**
95
+ * @param $stream StreamInterface
96
+ *
97
+ * @return bool
98
+ */
99
+ private function isJson($stream)
100
+ {
101
+ $stream->rewind();
102
+
103
+ json_decode($stream->getContents());
104
+
105
+ return JSON_ERROR_NONE === json_last_error();
106
+ }
107
+
108
+ /**
109
+ * @param $stream StreamInterface
110
+ *
111
+ * @return \SimpleXMLElement|false
112
+ */
113
+ private function isXml($stream)
114
+ {
115
+ $stream->rewind();
116
+
117
+ $previousValue = libxml_use_internal_errors(true);
118
+ $isXml = simplexml_load_string($stream->getContents());
119
+ libxml_use_internal_errors($previousValue);
120
+
121
+ return $isXml;
122
+ }
123
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/CookiePlugin.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Http\Client\Exception\TransferException;
7
+ use Http\Message\Cookie;
8
+ use Http\Message\CookieJar;
9
+ use Http\Message\CookieUtil;
10
+ use Http\Message\Exception\UnexpectedValueException;
11
+ use Psr\Http\Message\RequestInterface;
12
+ use Psr\Http\Message\ResponseInterface;
13
+
14
+ /**
15
+ * Handle request cookies.
16
+ *
17
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
18
+ */
19
+ final class CookiePlugin implements Plugin
20
+ {
21
+ /**
22
+ * Cookie storage.
23
+ *
24
+ * @var CookieJar
25
+ */
26
+ private $cookieJar;
27
+
28
+ /**
29
+ * @param CookieJar $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)
40
+ {
41
+ foreach ($this->cookieJar->getCookies() as $cookie) {
42
+ if ($cookie->isExpired()) {
43
+ continue;
44
+ }
45
+
46
+ if (!$cookie->matchDomain($request->getUri()->getHost())) {
47
+ continue;
48
+ }
49
+
50
+ if (!$cookie->matchPath($request->getUri()->getPath())) {
51
+ continue;
52
+ }
53
+
54
+ if ($cookie->isSecure() && ('https' !== $request->getUri()->getScheme())) {
55
+ continue;
56
+ }
57
+
58
+ $request = $request->withAddedHeader('Cookie', sprintf('%s=%s', $cookie->getName(), $cookie->getValue()));
59
+ }
60
+
61
+ return $next($request)->then(function (ResponseInterface $response) use ($request) {
62
+ if ($response->hasHeader('Set-Cookie')) {
63
+ $setCookies = $response->getHeader('Set-Cookie');
64
+
65
+ foreach ($setCookies as $setCookie) {
66
+ $cookie = $this->createCookie($request, $setCookie);
67
+
68
+ // Cookie invalid do not use it
69
+ if (null === $cookie) {
70
+ continue;
71
+ }
72
+
73
+ // Restrict setting cookie from another domain
74
+ if (!preg_match("/\.{$cookie->getDomain()}$/", '.'.$request->getUri()->getHost())) {
75
+ continue;
76
+ }
77
+
78
+ $this->cookieJar->addCookie($cookie);
79
+ }
80
+ }
81
+
82
+ return $response;
83
+ });
84
+ }
85
+
86
+ /**
87
+ * Creates a cookie from a string.
88
+ *
89
+ * @param RequestInterface $request
90
+ * @param $setCookie
91
+ *
92
+ * @return Cookie|null
93
+ *
94
+ * @throws TransferException
95
+ */
96
+ private function createCookie(RequestInterface $request, $setCookie)
97
+ {
98
+ $parts = array_map('trim', explode(';', $setCookie));
99
+
100
+ if (empty($parts) || !strpos($parts[0], '=')) {
101
+ return;
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($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
+ null,
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 $part
169
+ *
170
+ * @return array
171
+ */
172
+ private function createValueKey($part)
173
+ {
174
+ $parts = explode('=', $part, 2);
175
+ $key = trim($parts[0]);
176
+ $value = isset($parts[1]) ? trim($parts[1]) : true;
177
+
178
+ return [$key, $value];
179
+ }
180
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Http\Message\Encoding;
7
+ use Psr\Http\Message\RequestInterface;
8
+ use Psr\Http\Message\ResponseInterface;
9
+ use Psr\Http\Message\StreamInterface;
10
+ use Symfony\Component\OptionsResolver\OptionsResolver;
11
+
12
+ /**
13
+ * Allow to decode response body with a chunk, deflate, compress or gzip encoding.
14
+ *
15
+ * If zlib is not installed, only chunked encoding can be handled.
16
+ *
17
+ * If Content-Encoding is not disabled, the plugin will add an Accept-Encoding header for the encoding methods it supports.
18
+ *
19
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
20
+ */
21
+ final class DecoderPlugin implements Plugin
22
+ {
23
+ /**
24
+ * @var bool Whether this plugin decode stream with value in the Content-Encoding header (default to true).
25
+ *
26
+ * If set to false only the Transfer-Encoding header will be used
27
+ */
28
+ private $useContentEncoding;
29
+
30
+ /**
31
+ * @param array $config {
32
+ *
33
+ * @var bool $use_content_encoding Whether this plugin should look at the Content-Encoding header first or only at the Transfer-Encoding (defaults to true).
34
+ * }
35
+ */
36
+ public function __construct(array $config = [])
37
+ {
38
+ $resolver = new OptionsResolver();
39
+ $resolver->setDefaults([
40
+ 'use_content_encoding' => true,
41
+ ]);
42
+ $resolver->setAllowedTypes('use_content_encoding', 'bool');
43
+ $options = $resolver->resolve($config);
44
+
45
+ $this->useContentEncoding = $options['use_content_encoding'];
46
+ }
47
+
48
+ /**
49
+ * {@inheritdoc}
50
+ */
51
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
52
+ {
53
+ $encodings = extension_loaded('zlib') ? ['gzip', 'deflate'] : ['identity'];
54
+
55
+ if ($this->useContentEncoding) {
56
+ $request = $request->withHeader('Accept-Encoding', $encodings);
57
+ }
58
+ $encodings[] = 'chunked';
59
+ $request = $request->withHeader('TE', $encodings);
60
+
61
+ return $next($request)->then(function (ResponseInterface $response) {
62
+ return $this->decodeResponse($response);
63
+ });
64
+ }
65
+
66
+ /**
67
+ * Decode a response body given its Transfer-Encoding or Content-Encoding value.
68
+ *
69
+ * @param ResponseInterface $response Response to decode
70
+ *
71
+ * @return ResponseInterface New response decoded
72
+ */
73
+ private function decodeResponse(ResponseInterface $response)
74
+ {
75
+ $response = $this->decodeOnEncodingHeader('Transfer-Encoding', $response);
76
+
77
+ if ($this->useContentEncoding) {
78
+ $response = $this->decodeOnEncodingHeader('Content-Encoding', $response);
79
+ }
80
+
81
+ return $response;
82
+ }
83
+
84
+ /**
85
+ * Decode a response on a specific header (content encoding or transfer encoding mainly).
86
+ *
87
+ * @param string $headerName Name of the header
88
+ * @param ResponseInterface $response Response
89
+ *
90
+ * @return ResponseInterface A new instance of the response decoded
91
+ */
92
+ private function decodeOnEncodingHeader($headerName, ResponseInterface $response)
93
+ {
94
+ if ($response->hasHeader($headerName)) {
95
+ $encodings = $response->getHeader($headerName);
96
+ $newEncodings = [];
97
+
98
+ while ($encoding = array_pop($encodings)) {
99
+ $stream = $this->decorateStream($encoding, $response->getBody());
100
+
101
+ if (false === $stream) {
102
+ array_unshift($newEncodings, $encoding);
103
+
104
+ continue;
105
+ }
106
+
107
+ $response = $response->withBody($stream);
108
+ }
109
+
110
+ $response = $response->withHeader($headerName, $newEncodings);
111
+ }
112
+
113
+ return $response;
114
+ }
115
+
116
+ /**
117
+ * Decorate a stream given an encoding.
118
+ *
119
+ * @param string $encoding
120
+ * @param StreamInterface $stream
121
+ *
122
+ * @return StreamInterface|false A new stream interface or false if encoding is not supported
123
+ */
124
+ private function decorateStream($encoding, StreamInterface $stream)
125
+ {
126
+ if ('chunked' === strtolower($encoding)) {
127
+ return new Encoding\DechunkStream($stream);
128
+ }
129
+
130
+ if ('deflate' === strtolower($encoding)) {
131
+ return new Encoding\DecompressStream($stream);
132
+ }
133
+
134
+ if ('gzip' === strtolower($encoding)) {
135
+ return new Encoding\GzipDecodeStream($stream);
136
+ }
137
+
138
+ return false;
139
+ }
140
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Exception\ClientErrorException;
6
+ use Http\Client\Common\Exception\ServerErrorException;
7
+ use Http\Client\Common\Plugin;
8
+ use Psr\Http\Message\RequestInterface;
9
+ use Psr\Http\Message\ResponseInterface;
10
+
11
+ /**
12
+ * Throw exception when the response of a request is not acceptable.
13
+ *
14
+ * Status codes 400-499 lead to a ClientErrorException, status 500-599 to a ServerErrorException.
15
+ *
16
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
17
+ */
18
+ final class ErrorPlugin implements Plugin
19
+ {
20
+ /**
21
+ * {@inheritdoc}
22
+ */
23
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
24
+ {
25
+ $promise = $next($request);
26
+
27
+ return $promise->then(function (ResponseInterface $response) use ($request) {
28
+ return $this->transformResponseToException($request, $response);
29
+ });
30
+ }
31
+
32
+ /**
33
+ * Transform response to an error if possible.
34
+ *
35
+ * @param RequestInterface $request Request of the call
36
+ * @param ResponseInterface $response Response of the call
37
+ *
38
+ * @throws ClientErrorException If response status code is a 4xx
39
+ * @throws ServerErrorException If response status code is a 5xx
40
+ *
41
+ * @return ResponseInterface If status code is not in 4xx or 5xx return response
42
+ */
43
+ protected function transformResponseToException(RequestInterface $request, ResponseInterface $response)
44
+ {
45
+ if ($response->getStatusCode() >= 400 && $response->getStatusCode() < 500) {
46
+ throw new ClientErrorException($response->getReasonPhrase(), $request, $response);
47
+ }
48
+
49
+ if ($response->getStatusCode() >= 500 && $response->getStatusCode() < 600) {
50
+ throw new ServerErrorException($response->getReasonPhrase(), $request, $response);
51
+ }
52
+
53
+ return $response;
54
+ }
55
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Append headers to the request.
10
+ *
11
+ * If the header already exists the value will be appended to the current value.
12
+ *
13
+ * This only makes sense for headers that can have multiple values like 'Forwarded'
14
+ *
15
+ * @see https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
16
+ *
17
+ * @author Soufiane Ghzal <sghzal@gmail.com>
18
+ */
19
+ final class HeaderAppendPlugin implements Plugin
20
+ {
21
+ /**
22
+ * @var array
23
+ */
24
+ private $headers = [];
25
+
26
+ /**
27
+ * @param array $headers Hashmap of header name to header value
28
+ */
29
+ public function __construct(array $headers)
30
+ {
31
+ $this->headers = $headers;
32
+ }
33
+
34
+ /**
35
+ * {@inheritdoc}
36
+ */
37
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
38
+ {
39
+ foreach ($this->headers as $header => $headerValue) {
40
+ $request = $request->withAddedHeader($header, $headerValue);
41
+ }
42
+
43
+ return $next($request);
44
+ }
45
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Set header to default value if it does not exist.
10
+ *
11
+ * If a given header already exists the value wont be replaced and the request wont be changed.
12
+ *
13
+ * @author Soufiane Ghzal <sghzal@gmail.com>
14
+ */
15
+ final class HeaderDefaultsPlugin implements Plugin
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ private $headers = [];
21
+
22
+ /**
23
+ * @param array $headers Hashmap of header name to header value
24
+ */
25
+ public function __construct(array $headers)
26
+ {
27
+ $this->headers = $headers;
28
+ }
29
+
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
34
+ {
35
+ foreach ($this->headers as $header => $headerValue) {
36
+ if (!$request->hasHeader($header)) {
37
+ $request = $request->withHeader($header, $headerValue);
38
+ }
39
+ }
40
+
41
+ return $next($request);
42
+ }
43
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Removes headers from the request.
10
+ *
11
+ * @author Soufiane Ghzal <sghzal@gmail.com>
12
+ */
13
+ final class HeaderRemovePlugin implements Plugin
14
+ {
15
+ /**
16
+ * @var array
17
+ */
18
+ private $headers = [];
19
+
20
+ /**
21
+ * @param array $headers List of header names to remove from the request
22
+ */
23
+ public function __construct(array $headers)
24
+ {
25
+ $this->headers = $headers;
26
+ }
27
+
28
+ /**
29
+ * {@inheritdoc}
30
+ */
31
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
32
+ {
33
+ foreach ($this->headers as $header) {
34
+ if ($request->hasHeader($header)) {
35
+ $request = $request->withoutHeader($header);
36
+ }
37
+ }
38
+
39
+ return $next($request);
40
+ }
41
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Set headers on the request.
10
+ *
11
+ * If the header does not exist it wil be set, if the header already exists it will be replaced.
12
+ *
13
+ * @author Soufiane Ghzal <sghzal@gmail.com>
14
+ */
15
+ final class HeaderSetPlugin implements Plugin
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ private $headers = [];
21
+
22
+ /**
23
+ * @param array $headers Hashmap of header name to header value
24
+ */
25
+ public function __construct(array $headers)
26
+ {
27
+ $this->headers = $headers;
28
+ }
29
+
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
34
+ {
35
+ foreach ($this->headers as $header => $headerValue) {
36
+ $request = $request->withHeader($header, $headerValue);
37
+ }
38
+
39
+ return $next($request);
40
+ }
41
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/HistoryPlugin.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Http\Client\Exception;
7
+ use Psr\Http\Message\RequestInterface;
8
+ use Psr\Http\Message\ResponseInterface;
9
+
10
+ /**
11
+ * Record HTTP calls.
12
+ *
13
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
14
+ */
15
+ final class HistoryPlugin implements Plugin
16
+ {
17
+ /**
18
+ * Journal use to store request / responses / exception.
19
+ *
20
+ * @var Journal
21
+ */
22
+ private $journal;
23
+
24
+ /**
25
+ * @param Journal $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)
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 (Exception $exception) use ($request, $journal) {
44
+ $journal->addFailure($request, $exception);
45
+
46
+ throw $exception;
47
+ });
48
+ }
49
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/Journal.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Exception;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\ResponseInterface;
8
+
9
+ /**
10
+ * Records history of HTTP calls.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ interface Journal
15
+ {
16
+ /**
17
+ * Record a successful call.
18
+ *
19
+ * @param RequestInterface $request Request use to make the call
20
+ * @param ResponseInterface $response Response returned by the call
21
+ */
22
+ public function addSuccess(RequestInterface $request, ResponseInterface $response);
23
+
24
+ /**
25
+ * Record a failed call.
26
+ *
27
+ * @param RequestInterface $request Request use to make the call
28
+ * @param Exception $exception Exception returned by the call
29
+ */
30
+ public function addFailure(RequestInterface $request, Exception $exception);
31
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Set query to default value if it does not exist.
10
+ *
11
+ * If a given query parameter already exists the value wont be replaced and the request wont be changed.
12
+ *
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ final class QueryDefaultsPlugin implements Plugin
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ private $queryParams = [];
21
+
22
+ /**
23
+ * @param array $queryParams Hashmap of query name to query value. Names and values must not be url encoded as
24
+ * this plugin will encode them
25
+ */
26
+ public function __construct(array $queryParams)
27
+ {
28
+ $this->queryParams = $queryParams;
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
35
+ {
36
+ foreach ($this->queryParams as $name => $value) {
37
+ $uri = $request->getUri();
38
+ $array = [];
39
+ parse_str($uri->getQuery(), $array);
40
+
41
+ // If query value is not found
42
+ if (!isset($array[$name])) {
43
+ $array[$name] = $value;
44
+
45
+ // Create a new request with the new URI with the added query param
46
+ $request = $request->withUri(
47
+ $uri->withQuery(http_build_query($array))
48
+ );
49
+ }
50
+ }
51
+
52
+ return $next($request);
53
+ }
54
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Exception\CircularRedirectionException;
6
+ use Http\Client\Common\Exception\MultipleRedirectionException;
7
+ use Http\Client\Common\Plugin;
8
+ use Http\Client\Exception\HttpException;
9
+ use Psr\Http\Message\MessageInterface;
10
+ use Psr\Http\Message\RequestInterface;
11
+ use Psr\Http\Message\ResponseInterface;
12
+ use Psr\Http\Message\UriInterface;
13
+ use Symfony\Component\OptionsResolver\OptionsResolver;
14
+
15
+ /**
16
+ * Follow redirections.
17
+ *
18
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
19
+ */
20
+ class RedirectPlugin implements Plugin
21
+ {
22
+ /**
23
+ * Rule on how to redirect, change method for the new request.
24
+ *
25
+ * @var array
26
+ */
27
+ protected $redirectCodes = [
28
+ 300 => [
29
+ 'switch' => [
30
+ 'unless' => ['GET', 'HEAD'],
31
+ 'to' => 'GET',
32
+ ],
33
+ 'multiple' => true,
34
+ 'permanent' => false,
35
+ ],
36
+ 301 => [
37
+ 'switch' => [
38
+ 'unless' => ['GET', 'HEAD'],
39
+ 'to' => 'GET',
40
+ ],
41
+ 'multiple' => false,
42
+ 'permanent' => true,
43
+ ],
44
+ 302 => [
45
+ 'switch' => [
46
+ 'unless' => ['GET', 'HEAD'],
47
+ 'to' => 'GET',
48
+ ],
49
+ 'multiple' => false,
50
+ 'permanent' => false,
51
+ ],
52
+ 303 => [
53
+ 'switch' => [
54
+ 'unless' => ['GET', 'HEAD'],
55
+ 'to' => 'GET',
56
+ ],
57
+ 'multiple' => false,
58
+ 'permanent' => false,
59
+ ],
60
+ 307 => [
61
+ 'switch' => false,
62
+ 'multiple' => false,
63
+ 'permanent' => false,
64
+ ],
65
+ 308 => [
66
+ 'switch' => false,
67
+ 'multiple' => false,
68
+ 'permanent' => true,
69
+ ],
70
+ ];
71
+
72
+ /**
73
+ * Determine how header should be preserved from old request.
74
+ *
75
+ * @var bool|array
76
+ *
77
+ * true will keep all previous headers (default value)
78
+ * false will ditch all previous headers
79
+ * string[] will keep only headers with the specified names
80
+ */
81
+ protected $preserveHeader;
82
+
83
+ /**
84
+ * Store all previous redirect from 301 / 308 status code.
85
+ *
86
+ * @var array
87
+ */
88
+ protected $redirectStorage = [];
89
+
90
+ /**
91
+ * Whether the location header must be directly used for a multiple redirection status code (300).
92
+ *
93
+ * @var bool
94
+ */
95
+ protected $useDefaultForMultiple;
96
+
97
+ /**
98
+ * @var array
99
+ */
100
+ protected $circularDetection = [];
101
+
102
+ /**
103
+ * @param array $config {
104
+ *
105
+ * @var bool|string[] $preserve_header True keeps all headers, false remove all of them, an array is interpreted as a list of header names to keep
106
+ * @var bool $use_default_for_multiple Whether the location header must be directly used for a multiple redirection status code (300).
107
+ * }
108
+ */
109
+ public function __construct(array $config = [])
110
+ {
111
+ $resolver = new OptionsResolver();
112
+ $resolver->setDefaults([
113
+ 'preserve_header' => true,
114
+ 'use_default_for_multiple' => true,
115
+ ]);
116
+ $resolver->setAllowedTypes('preserve_header', ['bool', 'array']);
117
+ $resolver->setAllowedTypes('use_default_for_multiple', 'bool');
118
+ $resolver->setNormalizer('preserve_header', function (OptionsResolver $resolver, $value) {
119
+ if (is_bool($value) && false === $value) {
120
+ return [];
121
+ }
122
+
123
+ return $value;
124
+ });
125
+ $options = $resolver->resolve($config);
126
+
127
+ $this->preserveHeader = $options['preserve_header'];
128
+ $this->useDefaultForMultiple = $options['use_default_for_multiple'];
129
+ }
130
+
131
+ /**
132
+ * {@inheritdoc}
133
+ */
134
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
135
+ {
136
+ // Check in storage
137
+ if (array_key_exists((string) $request->getUri(), $this->redirectStorage)) {
138
+ $uri = $this->redirectStorage[(string) $request->getUri()]['uri'];
139
+ $statusCode = $this->redirectStorage[(string) $request->getUri()]['status'];
140
+ $redirectRequest = $this->buildRedirectRequest($request, $uri, $statusCode);
141
+
142
+ return $first($redirectRequest);
143
+ }
144
+
145
+ return $next($request)->then(function (ResponseInterface $response) use ($request, $first) {
146
+ $statusCode = $response->getStatusCode();
147
+
148
+ if (!array_key_exists($statusCode, $this->redirectCodes)) {
149
+ return $response;
150
+ }
151
+
152
+ $uri = $this->createUri($response, $request);
153
+ $redirectRequest = $this->buildRedirectRequest($request, $uri, $statusCode);
154
+ $chainIdentifier = spl_object_hash((object) $first);
155
+
156
+ if (!array_key_exists($chainIdentifier, $this->circularDetection)) {
157
+ $this->circularDetection[$chainIdentifier] = [];
158
+ }
159
+
160
+ $this->circularDetection[$chainIdentifier][] = (string) $request->getUri();
161
+
162
+ if (in_array((string) $redirectRequest->getUri(), $this->circularDetection[$chainIdentifier])) {
163
+ throw new CircularRedirectionException('Circular redirection detected', $request, $response);
164
+ }
165
+
166
+ if ($this->redirectCodes[$statusCode]['permanent']) {
167
+ $this->redirectStorage[(string) $request->getUri()] = [
168
+ 'uri' => $uri,
169
+ 'status' => $statusCode,
170
+ ];
171
+ }
172
+
173
+ // Call redirect request in synchrone
174
+ $redirectPromise = $first($redirectRequest);
175
+
176
+ return $redirectPromise->wait();
177
+ });
178
+ }
179
+
180
+ /**
181
+ * Builds the redirect request.
182
+ *
183
+ * @param RequestInterface $request Original request
184
+ * @param UriInterface $uri New uri
185
+ * @param int $statusCode Status code from the redirect response
186
+ *
187
+ * @return MessageInterface|RequestInterface
188
+ */
189
+ protected function buildRedirectRequest(RequestInterface $request, UriInterface $uri, $statusCode)
190
+ {
191
+ $request = $request->withUri($uri);
192
+
193
+ if (false !== $this->redirectCodes[$statusCode]['switch'] && !in_array($request->getMethod(), $this->redirectCodes[$statusCode]['switch']['unless'])) {
194
+ $request = $request->withMethod($this->redirectCodes[$statusCode]['switch']['to']);
195
+ }
196
+
197
+ if (is_array($this->preserveHeader)) {
198
+ $headers = array_keys($request->getHeaders());
199
+
200
+ foreach ($headers as $name) {
201
+ if (!in_array($name, $this->preserveHeader)) {
202
+ $request = $request->withoutHeader($name);
203
+ }
204
+ }
205
+ }
206
+
207
+ return $request;
208
+ }
209
+
210
+ /**
211
+ * Creates a new Uri from the old request and the location header.
212
+ *
213
+ * @param ResponseInterface $response The redirect response
214
+ * @param RequestInterface $request The original request
215
+ *
216
+ * @throws HttpException If location header is not usable (missing or incorrect)
217
+ * @throws MultipleRedirectionException If a 300 status code is received and default location cannot be resolved (doesn't use the location header or not present)
218
+ *
219
+ * @return UriInterface
220
+ */
221
+ private function createUri(ResponseInterface $response, RequestInterface $request)
222
+ {
223
+ if ($this->redirectCodes[$response->getStatusCode()]['multiple'] && (!$this->useDefaultForMultiple || !$response->hasHeader('Location'))) {
224
+ throw new MultipleRedirectionException('Cannot choose a redirection', $request, $response);
225
+ }
226
+
227
+ if (!$response->hasHeader('Location')) {
228
+ throw new HttpException('Redirect status code, but no location header present in the response', $request, $response);
229
+ }
230
+
231
+ $location = $response->getHeaderLine('Location');
232
+ $parsedLocation = parse_url($location);
233
+
234
+ if (false === $parsedLocation) {
235
+ throw new HttpException(sprintf('Location %s could not be parsed', $location), $request, $response);
236
+ }
237
+
238
+ $uri = $request->getUri();
239
+
240
+ if (array_key_exists('scheme', $parsedLocation)) {
241
+ $uri = $uri->withScheme($parsedLocation['scheme']);
242
+ }
243
+
244
+ if (array_key_exists('host', $parsedLocation)) {
245
+ $uri = $uri->withHost($parsedLocation['host']);
246
+ }
247
+
248
+ if (array_key_exists('port', $parsedLocation)) {
249
+ $uri = $uri->withPort($parsedLocation['port']);
250
+ }
251
+
252
+ if (array_key_exists('path', $parsedLocation)) {
253
+ $uri = $uri->withPath($parsedLocation['path']);
254
+ }
255
+
256
+ if (array_key_exists('query', $parsedLocation)) {
257
+ $uri = $uri->withQuery($parsedLocation['query']);
258
+ } else {
259
+ $uri = $uri->withQuery('');
260
+ }
261
+
262
+ if (array_key_exists('fragment', $parsedLocation)) {
263
+ $uri = $uri->withFragment($parsedLocation['fragment']);
264
+ } else {
265
+ $uri = $uri->withFragment('');
266
+ }
267
+
268
+ return $uri;
269
+ }
270
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Http\Message\RequestMatcher;
7
+ use Psr\Http\Message\RequestInterface;
8
+
9
+ /**
10
+ * Apply a delegated plugin based on a request match.
11
+ *
12
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
+ */
14
+ final class RequestMatcherPlugin implements Plugin
15
+ {
16
+ /**
17
+ * @var RequestMatcher
18
+ */
19
+ private $requestMatcher;
20
+
21
+ /**
22
+ * @var Plugin
23
+ */
24
+ private $delegatedPlugin;
25
+
26
+ /**
27
+ * @param RequestMatcher $requestMatcher
28
+ * @param Plugin $delegatedPlugin
29
+ */
30
+ public function __construct(RequestMatcher $requestMatcher, Plugin $delegatedPlugin)
31
+ {
32
+ $this->requestMatcher = $requestMatcher;
33
+ $this->delegatedPlugin = $delegatedPlugin;
34
+ }
35
+
36
+ /**
37
+ * {@inheritdoc}
38
+ */
39
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
40
+ {
41
+ if ($this->requestMatcher->matches($request)) {
42
+ return $this->delegatedPlugin->handleRequest($request, $next, $first);
43
+ }
44
+
45
+ return $next($request);
46
+ }
47
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/Plugin/RetryPlugin.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common\Plugin;
4
+
5
+ use Http\Client\Common\Plugin;
6
+ use Http\Client\Exception;
7
+ use Psr\Http\Message\RequestInterface;
8
+ use Psr\Http\Message\ResponseInterface;
9
+ use Symfony\Component\OptionsResolver\OptionsResolver;
10
+
11
+ /**
12
+ * Retry the request if an exception is thrown.
13
+ *
14
+ * By default will retry only one time.
15
+ *
16
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
17
+ */
18
+ final class RetryPlugin implements Plugin
19
+ {
20
+ /**
21
+ * Number of retry before sending an exception.
22
+ *
23
+ * @var int
24
+ */
25
+ private $retry;
26
+
27
+ /**
28
+ * @var callable
29
+ */
30
+ private $delay;
31
+
32
+ /**
33
+ * @var callable
34
+ */
35
+ private $decider;
36
+
37
+ /**
38
+ * Store the retry counter for each request.
39
+ *
40
+ * @var array
41
+ */
42
+ private $retryStorage = [];
43
+
44
+ /**
45
+ * @param array $config {
46
+ *
47
+ * @var int $retries Number of retries to attempt if an exception occurs before letting the exception bubble up.
48
+ * @var callable $decider A callback that gets a request and an exception to decide after a failure whether the request should be retried.
49
+ * @var callable $delay A callback that gets a request, an exception and the number of retries and returns how many microseconds we should wait before trying again.
50
+ * }
51
+ */
52
+ public function __construct(array $config = [])
53
+ {
54
+ $resolver = new OptionsResolver();
55
+ $resolver->setDefaults([
56
+ 'retries' => 1,
57
+ 'decider' => function (RequestInterface $request, Exception $e) {
58
+ return true;
59
+ },
60
+ 'delay' => __CLASS__.'::defaultDelay',
61
+ ]);
62
+ $resolver->setAllowedTypes('retries', 'int');
63
+ $resolver->setAllowedTypes('decider', 'callable');
64
+ $resolver->setAllowedTypes('delay', 'callable');
65
+ $options = $resolver->resolve($config);
66
+
67
+ $this->retry = $options['retries'];
68
+ $this->decider = $options['decider'];
69
+ $this->delay = $options['delay'];
70
+ }
71
+
72
+ /**
73
+ * {@inheritdoc}
74
+ */
75
+ public function handleRequest(RequestInterface $request, callable $next, callable $first)
76
+ {
77
+ $chainIdentifier = spl_object_hash((object) $first);
78
+
79
+ return $next($request)->then(function (ResponseInterface $response) use ($request, $chainIdentifier) {
80
+ if (array_key_exists($chainIdentifier, $this->retryStorage)) {
81
+ unset($this->retryStorage[$chainIdentifier]);
82
+ }
83
+
84
+ return $response;
85
+ }, function (Exception $exception) use ($request, $next, $first, $chainIdentifier) {
86
+ if (!array_key_exists($chainIdentifier, $this->retryStorage)) {
87
+ $this->retryStorage[$chainIdentifier] = 0;
88
+ }
89
+
90
+ if ($this->retryStorage[$chainIdentifier] >= $this->retry) {
91
+ unset($this->retryStorage[$chainIdentifier]);
92
+
93
+ throw $exception;
94
+ }
95
+
96
+ if (!call_user_func($this->decider, $request, $exception)) {
97
+ throw $exception;
98
+ }
99
+
100
+ $time = call_user_func($this->delay, $request, $exception, $this->retryStorage[$chainIdentifier]);
101
+ usleep($time);
102
+
103
+ // Retry in synchrone
104
+ ++$this->retryStorage[$chainIdentifier];
105
+ $promise = $this->handleRequest($request, $next, $first);
106
+
107
+ return $promise->wait();
108
+ });
109
+ }
110
+
111
+ /**
112
+ * @param RequestInterface $request
113
+ * @param Exception $e
114
+ * @param int $retries The number of retries we made before. First time this get called it will be 0.
115
+ *
116
+ * @return int
117
+ */
118
+ public static function defaultDelay(RequestInterface $request, Exception $e, $retries)
119
+ {
120
+ return pow(2, $retries) * 500000;
121
+ }
122
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/PluginClient.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\Common\Exception\LoopException;
6
+ use Http\Client\Exception as HttplugException;
7
+ use Http\Client\HttpAsyncClient;
8
+ use Http\Client\HttpClient;
9
+ use Http\Client\Promise\HttpFulfilledPromise;
10
+ use Http\Client\Promise\HttpRejectedPromise;
11
+ use Psr\Http\Message\RequestInterface;
12
+ use Symfony\Component\OptionsResolver\OptionsResolver;
13
+
14
+ /**
15
+ * The client managing plugins and providing a decorator around HTTP Clients.
16
+ *
17
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
18
+ */
19
+ final class PluginClient implements HttpClient, HttpAsyncClient
20
+ {
21
+ /**
22
+ * An HTTP async client.
23
+ *
24
+ * @var HttpAsyncClient
25
+ */
26
+ private $client;
27
+
28
+ /**
29
+ * The plugin chain.
30
+ *
31
+ * @var Plugin[]
32
+ */
33
+ private $plugins;
34
+
35
+ /**
36
+ * A list of options.
37
+ *
38
+ * @var array
39
+ */
40
+ private $options;
41
+
42
+ /**
43
+ * @param HttpClient|HttpAsyncClient $client
44
+ * @param Plugin[] $plugins
45
+ * @param array $options {
46
+ *
47
+ * @var int $max_restarts
48
+ * @var Plugin[] $debug_plugins an array of plugins that are injected between each normal plugin
49
+ * }
50
+ *
51
+ * @throws \RuntimeException if client is not an instance of HttpClient or HttpAsyncClient
52
+ */
53
+ public function __construct($client, array $plugins = [], array $options = [])
54
+ {
55
+ if ($client instanceof HttpAsyncClient) {
56
+ $this->client = $client;
57
+ } elseif ($client instanceof HttpClient) {
58
+ $this->client = new EmulatedHttpAsyncClient($client);
59
+ } else {
60
+ throw new \RuntimeException('Client must be an instance of Http\\Client\\HttpClient or Http\\Client\\HttpAsyncClient');
61
+ }
62
+
63
+ $this->plugins = $plugins;
64
+ $this->options = $this->configure($options);
65
+ }
66
+
67
+ /**
68
+ * {@inheritdoc}
69
+ */
70
+ public function sendRequest(RequestInterface $request)
71
+ {
72
+ // If we don't have an http client, use the async call
73
+ if (!($this->client instanceof HttpClient)) {
74
+ return $this->sendAsyncRequest($request)->wait();
75
+ }
76
+
77
+ // Else we want to use the synchronous call of the underlying client, and not the async one in the case
78
+ // 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
+ * @param array $options
106
+ *
107
+ * @return array
108
+ */
109
+ private function configure(array $options = [])
110
+ {
111
+ if (isset($options['debug_plugins'])) {
112
+ @trigger_error('The "debug_plugins" option is deprecated since 1.5 and will be removed in 2.0.', E_USER_DEPRECATED);
113
+ }
114
+
115
+ $resolver = new OptionsResolver();
116
+ $resolver->setDefaults([
117
+ 'max_restarts' => 10,
118
+ 'debug_plugins' => [],
119
+ ]);
120
+
121
+ $resolver
122
+ ->setAllowedTypes('debug_plugins', 'array')
123
+ ->setAllowedValues('debug_plugins', function (array $plugins) {
124
+ foreach ($plugins as $plugin) {
125
+ // Make sure each object passed with the `debug_plugins` is an instance of Plugin.
126
+ if (!$plugin instanceof Plugin) {
127
+ return false;
128
+ }
129
+ }
130
+
131
+ return true;
132
+ });
133
+
134
+ return $resolver->resolve($options);
135
+ }
136
+
137
+ /**
138
+ * Create the plugin chain.
139
+ *
140
+ * @param Plugin[] $pluginList A list of plugins
141
+ * @param callable $clientCallable Callable making the HTTP call
142
+ *
143
+ * @return callable
144
+ */
145
+ private function createPluginChain($pluginList, callable $clientCallable)
146
+ {
147
+ $firstCallable = $lastCallable = $clientCallable;
148
+
149
+ /*
150
+ * Inject debug plugins between each plugin.
151
+ */
152
+ $pluginListWithDebug = $this->options['debug_plugins'];
153
+ foreach ($pluginList as $plugin) {
154
+ $pluginListWithDebug[] = $plugin;
155
+ $pluginListWithDebug = array_merge($pluginListWithDebug, $this->options['debug_plugins']);
156
+ }
157
+
158
+ while ($plugin = array_pop($pluginListWithDebug)) {
159
+ $lastCallable = function (RequestInterface $request) use ($plugin, $lastCallable, &$firstCallable) {
160
+ return $plugin->handleRequest($request, $lastCallable, $firstCallable);
161
+ };
162
+
163
+ $firstCallable = $lastCallable;
164
+ }
165
+
166
+ $firstCalls = 0;
167
+ $firstCallable = function (RequestInterface $request) use ($lastCallable, &$firstCalls) {
168
+ if ($firstCalls > $this->options['max_restarts']) {
169
+ throw new LoopException('Too many restarts in plugin client', $request);
170
+ }
171
+
172
+ ++$firstCalls;
173
+
174
+ return $lastCallable($request);
175
+ };
176
+
177
+ return $firstCallable;
178
+ }
179
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/client-common/src/PluginClientFactory.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Common;
4
+
5
+ use Http\Client\HttpAsyncClient;
6
+ use Http\Client\HttpClient;
7
+
8
+ /**
9
+ * Factory to create PluginClient instances. Using this factory instead of calling PluginClient constructor will enable
10
+ * the Symfony profiling without any configuration.
11
+ *
12
+ * @author Fabien Bourigault <bourigaultfabien@gmail.com>
13
+ */
14
+ final class PluginClientFactory
15
+ {
16
+ /**
17
+ * @var callable
18
+ */
19
+ private static $factory;
20
+
21
+ /**
22
+ * Set the factory to use.
23
+ * The callable to provide must have the same arguments and return type as PluginClientFactory::createClient.
24
+ * This is used by the HTTPlugBundle to provide a better Symfony integration.
25
+ * Unlike the createClient method, this one is static to allow zero configuration profiling by hooking into early
26
+ * application execution.
27
+ *
28
+ * @internal
29
+ *
30
+ * @param callable $factory
31
+ */
32
+ public static function setFactory(callable $factory)
33
+ {
34
+ static::$factory = $factory;
35
+ }
36
+
37
+ /**
38
+ * @param HttpClient|HttpAsyncClient $client
39
+ * @param Plugin[] $plugins
40
+ * @param array $options {
41
+ *
42
+ * @var string $client_name to give client a name which may be used when displaying client information like in
43
+ * the HTTPlugBundle profiler.
44
+ * }
45
+ *
46
+ * @see PluginClient constructor for PluginClient specific $options.
47
+ *
48
+ * @return PluginClient
49
+ */
50
+ public function createClient($client, array $plugins = [], array $options = [])
51
+ {
52
+ if (static::$factory) {
53
+ $factory = static::$factory;
54
+
55
+ return $factory($client, $plugins, $options);
56
+ }
57
+
58
+ unset($options['client_name']);
59
+
60
+ return new PluginClient($client, $plugins, $options);
61
+ }
62
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/.php_cs ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
+ ;
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/.styleci.yml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ preset: psr2
2
+ finder:
3
+ path:
4
+ - "src"
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/CHANGELOG.md ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+ ## 1.7 - 2017-02-09
4
+
5
+ ### Changed
6
+
7
+ - #30: Make sure we rewind streams
8
+
9
+ ## 1.6.2 - 2017-01-02
10
+
11
+ ### Fixed
12
+
13
+ - #29: Request not using CURLOPT_POSTFIELDS have content-length set to
14
+
15
+ ### Changed
16
+
17
+ - Use binary mode to create response body stream.
18
+
19
+
20
+ ## 1.6.1 - 2016-11-11
21
+
22
+ ### Fixed
23
+
24
+ - #27: ErrorPlugin and sendAsyncRequest() incompatibility
25
+
26
+
27
+ ## 1.6 - 2016-09-12
28
+
29
+ ### Changed
30
+
31
+ - `Client::sendRequest` now throws `Http\Client\Exception\NetworkException` on network errors.
32
+ - `\UnexpectedValueException` replaced with `Http\Client\Exception\RequestException` in
33
+ `Client::sendRequest` and `Client::sendAsyncRequest`
34
+
35
+
36
+ ## 1.5.1 - 2016-08-29
37
+
38
+ ### Fixed
39
+
40
+ - #26: Combining CurlClient with StopwatchPlugin causes Promise onRejected handler to never be
41
+ invoked.
42
+
43
+
44
+ ## 1.5 - 2016-08-03
45
+
46
+ ### Changed
47
+
48
+ - Request body can be send with any method except GET, HEAD and TRACE.
49
+ - #25: Make discovery a hard dependency.
50
+
51
+
52
+ ## 1.4.2 - 2016-06-14
53
+
54
+ ### Added
55
+
56
+ - #23: "php-http/async-client-implementation" added to "provide" section.
57
+
58
+
59
+ ## 1.4.1 - 2016-05-30
60
+
61
+ ### Fixed
62
+
63
+ - #22: Cannot create the client using `HttpClientDiscovery`.
64
+
65
+
66
+ ## 1.4 - 2016-03-30
67
+
68
+ ### Changed
69
+
70
+ - #20: Minimize memory usage when reading large response body.
71
+
72
+
73
+ ## 1.3 - 2016-03-14
74
+
75
+ ### Fixed
76
+
77
+ - #18: Invalid "Expect" header.
78
+
79
+ ### Removed
80
+
81
+ - #13: Remove HeaderParser.
82
+
83
+
84
+ ## 1.2 - 2016-03-09
85
+
86
+ ### Added
87
+
88
+ - #16: Make sure discovery can find the curl client
89
+
90
+ ### Fixed
91
+
92
+ - #15: "Out of memory" sending large files.
93
+
94
+
95
+ ## 1.1.0 - 2016-01-29
96
+
97
+ ### Changed
98
+
99
+ - Switch to php-http/message 1.0.
100
+
101
+
102
+ ## 1.0.0 - 2016-01-28
103
+
104
+ First stable release.
105
+
106
+
107
+ ## 0.7.0 - 2016-01-26
108
+
109
+ ### Changed
110
+
111
+ - Migrate from `php-http/discovery` and `php-http/utils` to `php-http/message`.
112
+
113
+ ## 0.6.0 - 2016-01-12
114
+
115
+ ### Changed
116
+
117
+ - Root namespace changed from `Http\Curl` to `Http\Client\Curl`.
118
+ - Main client class name renamed from `CurlHttpClient` to `Client`.
119
+ - Minimum required [php-http/discovery](https://packagist.org/packages/php-http/discovery)
120
+ version changed to 0.5.
121
+
122
+
123
+ ## 0.5.0 - 2015-12-18
124
+
125
+ ### Changed
126
+
127
+ - Compatibility with php-http/httplug 1.0 beta
128
+ - Switch to php-http/discovery 0.4
129
+
130
+
131
+ ## 0.4.0 - 2015-12-16
132
+
133
+ ### Changed
134
+
135
+ - Switch to php-http/message-factory 1.0
136
+
137
+
138
+ ## 0.3.1 - 2015-12-14
139
+
140
+ ### Changed
141
+
142
+ - Requirements fixed.
143
+
144
+
145
+ ## 0.3.0 - 2015-11-24
146
+
147
+ ### Changed
148
+
149
+ - Use cURL constants as options keys.
150
+
151
+
152
+ ## 0.2.0 - 2015-11-17
153
+
154
+ ### Added
155
+
156
+ - HttpAsyncClient support.
157
+
158
+
159
+ ## 0.1.0 - 2015-11-11
160
+
161
+ ### Added
162
+
163
+ - Initial release
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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.
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/README.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/composer.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "php-http/curl-client",
3
+ "description": "cURL client for PHP-HTTP",
4
+ "license": "MIT",
5
+ "keywords": ["http", "curl"],
6
+ "homepage": "http://php-http.org",
7
+ "authors": [
8
+ {
9
+ "name": "Михаил Красильников",
10
+ "email": "m.krasilnikov@yandex.ru"
11
+ }
12
+ ],
13
+ "prefer-stable": true,
14
+ "minimum-stability": "beta",
15
+ "config": {
16
+ "bin-dir": "vendor/bin"
17
+ },
18
+ "require": {
19
+ "php": "^5.5 || ^7.0",
20
+ "ext-curl": "*",
21
+ "php-http/httplug": "^1.0",
22
+ "php-http/message-factory": "^1.0.2",
23
+ "php-http/message": "^1.2",
24
+ "php-http/discovery": "^1.0"
25
+ },
26
+ "require-dev": {
27
+ "guzzlehttp/psr7": "^1.0",
28
+ "php-http/client-integration-tests": "^0.5.1",
29
+ "phpunit/phpunit": "^4.8.27",
30
+ "zendframework/zend-diactoros": "^1.0"
31
+ },
32
+ "autoload": {
33
+ "psr-4": {
34
+ "Http\\Client\\Curl\\": "src/"
35
+ }
36
+ },
37
+ "autoload-dev": {
38
+ "psr-4": {
39
+ "Http\\Client\\Curl\\Tests\\": "tests/"
40
+ }
41
+ },
42
+ "provide": {
43
+ "php-http/client-implementation": "1.0",
44
+ "php-http/async-client-implementation": "1.0"
45
+ },
46
+ "scripts": {
47
+ "test": "vendor/bin/phpunit",
48
+ "test-ci": "vendor/bin/phpunit --coverage-clover build/coverage.xml"
49
+ }
50
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/puli.json ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/Client.php ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Http\Client\Curl;
3
+
4
+ use Http\Client\Exception;
5
+ use Http\Client\HttpAsyncClient;
6
+ use Http\Client\HttpClient;
7
+ use Http\Discovery\MessageFactoryDiscovery;
8
+ use Http\Discovery\StreamFactoryDiscovery;
9
+ use Http\Message\MessageFactory;
10
+ use Http\Message\StreamFactory;
11
+ use Http\Promise\Promise;
12
+ use Psr\Http\Message\RequestInterface;
13
+ use Psr\Http\Message\ResponseInterface;
14
+
15
+ /**
16
+ * PSR-7 compatible cURL based HTTP client
17
+ *
18
+ * @license http://opensource.org/licenses/MIT MIT
19
+ *
20
+ * @author Михаил Красильников <m.krasilnikov@yandex.ru>
21
+ * @author Blake Williams <github@shabbyrobe.org>
22
+ *
23
+ * @api
24
+ * @since 1.0
25
+ */
26
+ class Client implements HttpClient, HttpAsyncClient
27
+ {
28
+ /**
29
+ * cURL options
30
+ *
31
+ * @var array
32
+ */
33
+ private $options;
34
+
35
+ /**
36
+ * PSR-7 message factory
37
+ *
38
+ * @var MessageFactory
39
+ */
40
+ private $messageFactory;
41
+
42
+ /**
43
+ * PSR-7 stream factory
44
+ *
45
+ * @var StreamFactory
46
+ */
47
+ private $streamFactory;
48
+
49
+ /**
50
+ * cURL synchronous requests handle
51
+ *
52
+ * @var resource|null
53
+ */
54
+ private $handle = null;
55
+
56
+ /**
57
+ * Simultaneous requests runner
58
+ *
59
+ * @var MultiRunner|null
60
+ */
61
+ private $multiRunner = null;
62
+
63
+ /**
64
+ * Create new client
65
+ *
66
+ * @param MessageFactory|null $messageFactory HTTP Message factory
67
+ * @param StreamFactory|null $streamFactory HTTP Stream factory
68
+ * @param array $options cURL options (see http://php.net/curl_setopt)
69
+ *
70
+ * @throws \Http\Discovery\Exception\NotFoundException If factory discovery failed.
71
+ *
72
+ * @since 1.0
73
+ */
74
+ public function __construct(
75
+ MessageFactory $messageFactory = null,
76
+ StreamFactory $streamFactory = null,
77
+ array $options = []
78
+ ) {
79
+ $this->messageFactory = $messageFactory ?: MessageFactoryDiscovery::find();
80
+ $this->streamFactory = $streamFactory ?: StreamFactoryDiscovery::find();
81
+ $this->options = $options;
82
+ }
83
+
84
+ /**
85
+ * Release resources if still active
86
+ */
87
+ public function __destruct()
88
+ {
89
+ if (is_resource($this->handle)) {
90
+ curl_close($this->handle);
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Sends a PSR-7 request.
96
+ *
97
+ * @param RequestInterface $request
98
+ *
99
+ * @return ResponseInterface
100
+ *
101
+ * @throws \Http\Client\Exception\NetworkException In case of network problems.
102
+ * @throws \Http\Client\Exception\RequestException On invalid request.
103
+ * @throws \InvalidArgumentException For invalid header names or values.
104
+ * @throws \RuntimeException If creating the body stream fails.
105
+ *
106
+ * @since 1.6 \UnexpectedValueException replaced with RequestException.
107
+ * @since 1.6 Throw NetworkException on network errors.
108
+ * @since 1.0
109
+ */
110
+ public function sendRequest(RequestInterface $request)
111
+ {
112
+ $responseBuilder = $this->createResponseBuilder();
113
+ $options = $this->createCurlOptions($request, $responseBuilder);
114
+
115
+ if (is_resource($this->handle)) {
116
+ curl_reset($this->handle);
117
+ } else {
118
+ $this->handle = curl_init();
119
+ }
120
+
121
+ curl_setopt_array($this->handle, $options);
122
+ curl_exec($this->handle);
123
+
124
+ $errno = curl_errno($this->handle);
125
+ switch ($errno) {
126
+ case CURLE_OK:
127
+ // All OK, no actions needed.
128
+ break;
129
+ case CURLE_COULDNT_RESOLVE_PROXY:
130
+ case CURLE_COULDNT_RESOLVE_HOST:
131
+ case CURLE_COULDNT_CONNECT:
132
+ case CURLE_OPERATION_TIMEOUTED:
133
+ case CURLE_SSL_CONNECT_ERROR:
134
+ throw new Exception\NetworkException(curl_error($this->handle), $request);
135
+ default:
136
+ throw new Exception\RequestException(curl_error($this->handle), $request);
137
+ }
138
+
139
+ $response = $responseBuilder->getResponse();
140
+ $response->getBody()->seek(0);
141
+
142
+ return $response;
143
+ }
144
+
145
+ /**
146
+ * Sends a PSR-7 request in an asynchronous way.
147
+ *
148
+ * @param RequestInterface $request
149
+ *
150
+ * @return Promise
151
+ *
152
+ * @throws \Http\Client\Exception\RequestException On invalid request.
153
+ * @throws \InvalidArgumentException For invalid header names or values.
154
+ * @throws \RuntimeException If creating the body stream fails.
155
+ *
156
+ * @since 1.6 \UnexpectedValueException replaced with RequestException.
157
+ * @since 1.0
158
+ */
159
+ public function sendAsyncRequest(RequestInterface $request)
160
+ {
161
+ if (!$this->multiRunner instanceof MultiRunner) {
162
+ $this->multiRunner = new MultiRunner();
163
+ }
164
+
165
+ $handle = curl_init();
166
+ $responseBuilder = $this->createResponseBuilder();
167
+ $options = $this->createCurlOptions($request, $responseBuilder);
168
+ curl_setopt_array($handle, $options);
169
+
170
+ $core = new PromiseCore($request, $handle, $responseBuilder);
171
+ $promise = new CurlPromise($core, $this->multiRunner);
172
+ $this->multiRunner->add($core);
173
+
174
+ return $promise;
175
+ }
176
+
177
+ /**
178
+ * Generates cURL options
179
+ *
180
+ * @param RequestInterface $request
181
+ * @param ResponseBuilder $responseBuilder
182
+ *
183
+ * @throws \Http\Client\Exception\RequestException On invalid request.
184
+ * @throws \InvalidArgumentException For invalid header names or values.
185
+ * @throws \RuntimeException if can not read body
186
+ *
187
+ * @return array
188
+ */
189
+ private function createCurlOptions(RequestInterface $request, ResponseBuilder $responseBuilder)
190
+ {
191
+ $options = $this->options;
192
+
193
+ $options[CURLOPT_HEADER] = false;
194
+ $options[CURLOPT_RETURNTRANSFER] = false;
195
+ $options[CURLOPT_FOLLOWLOCATION] = false;
196
+
197
+ try {
198
+ $options[CURLOPT_HTTP_VERSION]
199
+ = $this->getProtocolVersion($request->getProtocolVersion());
200
+ } catch (\UnexpectedValueException $e) {
201
+ throw new Exception\RequestException($e->getMessage(), $request);
202
+ }
203
+ $options[CURLOPT_URL] = (string) $request->getUri();
204
+
205
+ $options = $this->addRequestBodyOptions($request, $options);
206
+
207
+ $options[CURLOPT_HTTPHEADER] = $this->createHeaders($request, $options);
208
+
209
+ if ($request->getUri()->getUserInfo()) {
210
+ $options[CURLOPT_USERPWD] = $request->getUri()->getUserInfo();
211
+ }
212
+
213
+ $options[CURLOPT_HEADERFUNCTION] = function ($ch, $data) use ($responseBuilder) {
214
+ $str = trim($data);
215
+ if ('' !== $str) {
216
+ if (strpos(strtolower($str), 'http/') === 0) {
217
+ $responseBuilder->setStatus($str)->getResponse();
218
+ } else {
219
+ $responseBuilder->addHeader($str);
220
+ }
221
+ }
222
+
223
+ return strlen($data);
224
+ };
225
+
226
+ $options[CURLOPT_WRITEFUNCTION] = function ($ch, $data) use ($responseBuilder) {
227
+ return $responseBuilder->getResponse()->getBody()->write($data);
228
+ };
229
+
230
+ return $options;
231
+ }
232
+
233
+ /**
234
+ * Return cURL constant for specified HTTP version
235
+ *
236
+ * @param string $requestVersion
237
+ *
238
+ * @throws \UnexpectedValueException if unsupported version requested
239
+ *
240
+ * @return int
241
+ */
242
+ private function getProtocolVersion($requestVersion)
243
+ {
244
+ switch ($requestVersion) {
245
+ case '1.0':
246
+ return CURL_HTTP_VERSION_1_0;
247
+ case '1.1':
248
+ return CURL_HTTP_VERSION_1_1;
249
+ case '2.0':
250
+ if (defined('CURL_HTTP_VERSION_2_0')) {
251
+ return CURL_HTTP_VERSION_2_0;
252
+ }
253
+ throw new \UnexpectedValueException('libcurl 7.33 needed for HTTP 2.0 support');
254
+ }
255
+
256
+ return CURL_HTTP_VERSION_NONE;
257
+ }
258
+
259
+ /**
260
+ * Add request body related cURL options.
261
+ *
262
+ * @param RequestInterface $request
263
+ * @param array $options
264
+ *
265
+ * @return array
266
+ */
267
+ private function addRequestBodyOptions(RequestInterface $request, array $options)
268
+ {
269
+ /*
270
+ * Some HTTP methods cannot have payload:
271
+ *
272
+ * - GET — cURL will automatically change method to PUT or POST if we set CURLOPT_UPLOAD or
273
+ * CURLOPT_POSTFIELDS.
274
+ * - HEAD — cURL treats HEAD as GET request with a same restrictions.
275
+ * - TRACE — According to RFC7231: a client MUST NOT send a message body in a TRACE request.
276
+ */
277
+ if (!in_array($request->getMethod(), ['GET', 'HEAD', 'TRACE'], true)) {
278
+ $body = $request->getBody();
279
+ $bodySize = $body->getSize();
280
+ if ($bodySize !== 0) {
281
+ if ($body->isSeekable()) {
282
+ $body->rewind();
283
+ }
284
+
285
+ // Message has non empty body.
286
+ if (null === $bodySize || $bodySize > 1024 * 1024) {
287
+ // Avoid full loading large or unknown size body into memory
288
+ $options[CURLOPT_UPLOAD] = true;
289
+ if (null !== $bodySize) {
290
+ $options[CURLOPT_INFILESIZE] = $bodySize;
291
+ }
292
+ $options[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) {
293
+ return $body->read($length);
294
+ };
295
+ } else {
296
+ // Small body can be loaded into memory
297
+ $options[CURLOPT_POSTFIELDS] = (string) $body;
298
+ }
299
+ }
300
+ }
301
+
302
+ if ($request->getMethod() === 'HEAD') {
303
+ // This will set HTTP method to "HEAD".
304
+ $options[CURLOPT_NOBODY] = true;
305
+ } elseif ($request->getMethod() !== 'GET') {
306
+ // GET is a default method. Other methods should be specified explicitly.
307
+ $options[CURLOPT_CUSTOMREQUEST] = $request->getMethod();
308
+ }
309
+
310
+ return $options;
311
+ }
312
+
313
+ /**
314
+ * Create headers array for CURLOPT_HTTPHEADER
315
+ *
316
+ * @param RequestInterface $request
317
+ * @param array $options cURL options
318
+ *
319
+ * @return string[]
320
+ */
321
+ private function createHeaders(RequestInterface $request, array $options)
322
+ {
323
+ $curlHeaders = [];
324
+ $headers = $request->getHeaders();
325
+ foreach ($headers as $name => $values) {
326
+ $header = strtolower($name);
327
+ if ('expect' === $header) {
328
+ // curl-client does not support "Expect-Continue", so dropping "expect" headers
329
+ continue;
330
+ }
331
+ if ('content-length' === $header) {
332
+ if (array_key_exists(CURLOPT_POSTFIELDS, $options)) {
333
+ // Small body content length can be calculated here.
334
+ $values = [strlen($options[CURLOPT_POSTFIELDS])];
335
+ } elseif (!array_key_exists(CURLOPT_READFUNCTION, $options)) {
336
+ // Else if there is no body, forcing "Content-length" to 0
337
+ $values = [0];
338
+ }
339
+ }
340
+ foreach ($values as $value) {
341
+ $curlHeaders[] = $name . ': ' . $value;
342
+ }
343
+ }
344
+ /*
345
+ * curl-client does not support "Expect-Continue", but cURL adds "Expect" header by default.
346
+ * We can not suppress it, but we can set it to empty.
347
+ */
348
+ $curlHeaders[] = 'Expect:';
349
+
350
+ return $curlHeaders;
351
+ }
352
+
353
+ /**
354
+ * Create new ResponseBuilder instance
355
+ *
356
+ * @return ResponseBuilder
357
+ *
358
+ * @throws \RuntimeException If creating the stream from $body fails.
359
+ */
360
+ private function createResponseBuilder()
361
+ {
362
+ try {
363
+ $body = $this->streamFactory->createStream(fopen('php://temp', 'w+b'));
364
+ } catch (\InvalidArgumentException $e) {
365
+ throw new \RuntimeException('Can not create "php://temp" stream.');
366
+ }
367
+ $response = $this->messageFactory->createResponse(200, null, [], $body);
368
+
369
+ return new ResponseBuilder($response);
370
+ }
371
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/CurlPromise.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Http\Client\Curl;
3
+
4
+ use Http\Promise\Promise;
5
+
6
+ /**
7
+ * Promise represents a response that may not be available yet, but will be resolved at some point
8
+ * in future. It acts like a proxy to the actual response.
9
+ *
10
+ * This interface is an extension of the promises/a+ specification https://promisesaplus.com/
11
+ * Value is replaced by an object where its class implement a Psr\Http\Message\RequestInterface.
12
+ * Reason is replaced by an object where its class implement a Http\Client\Exception.
13
+ *
14
+ * @license http://opensource.org/licenses/MIT MIT
15
+ *
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
+ return null;
107
+ }
108
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/MultiRunner.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Http\Client\Curl;
3
+
4
+ use Http\Client\Exception\RequestException;
5
+
6
+ /**
7
+ * Simultaneous requests runner
8
+ *
9
+ * @license http://opensource.org/licenses/MIT MIT
10
+ *
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
+ return;
72
+ }
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Wait for request(s) to be completed.
78
+ *
79
+ * @param PromiseCore|null $targetCore
80
+ */
81
+ public function wait(PromiseCore $targetCore = null)
82
+ {
83
+ do {
84
+ $status = curl_multi_exec($this->multiHandle, $active);
85
+ $info = curl_multi_info_read($this->multiHandle);
86
+ if (false !== $info) {
87
+ $core = $this->findCoreByHandle($info['handle']);
88
+
89
+ if (null === $core) {
90
+ // We have no promise for this handle. Drop it.
91
+ curl_multi_remove_handle($this->multiHandle, $info['handle']);
92
+ continue;
93
+ }
94
+
95
+ if (CURLE_OK === $info['result']) {
96
+ $core->fulfill();
97
+ } else {
98
+ $error = curl_error($core->getHandle());
99
+ $core->reject(new RequestException($error, $core->getRequest()));
100
+ }
101
+ $this->remove($core);
102
+
103
+ // This is a promise we are waited for. So exiting wait().
104
+ if ($core === $targetCore) {
105
+ return;
106
+ }
107
+ }
108
+ } while ($status === CURLM_CALL_MULTI_PERFORM || $active);
109
+ }
110
+
111
+ /**
112
+ * Find core by handle.
113
+ *
114
+ * @param resource $handle
115
+ *
116
+ * @return PromiseCore|null
117
+ */
118
+ private function findCoreByHandle($handle)
119
+ {
120
+ foreach ($this->cores as $core) {
121
+ if ($core->getHandle() === $handle) {
122
+ return $core;
123
+ }
124
+ }
125
+ return null;
126
+ }
127
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/PromiseCore.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Http\Client\Curl;
3
+
4
+ use Http\Client\Exception;
5
+ use Http\Promise\Promise;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\ResponseInterface;
8
+
9
+ /**
10
+ * Shared promises core.
11
+ *
12
+ * @license http://opensource.org/licenses/MIT MIT
13
+ *
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
73
+ */
74
+ public function __construct(
75
+ RequestInterface $request,
76
+ $handle,
77
+ ResponseBuilder $responseBuilder
78
+ ) {
79
+ assert('is_resource($handle)');
80
+ assert('get_resource_type($handle) === "curl"');
81
+
82
+ $this->request = $request;
83
+ $this->handle = $handle;
84
+ $this->responseBuilder = $responseBuilder;
85
+ $this->state = Promise::PENDING;
86
+ }
87
+
88
+ /**
89
+ * Add on fulfilled callback.
90
+ *
91
+ * @param callable $callback
92
+ */
93
+ public function addOnFulfilled(callable $callback)
94
+ {
95
+ if ($this->getState() === Promise::PENDING) {
96
+ $this->onFulfilled[] = $callback;
97
+ } elseif ($this->getState() === Promise::FULFILLED) {
98
+ $response = call_user_func($callback, $this->responseBuilder->getResponse());
99
+ if ($response instanceof ResponseInterface) {
100
+ $this->responseBuilder->setResponse($response);
101
+ }
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Add on rejected callback.
107
+ *
108
+ * @param callable $callback
109
+ */
110
+ public function addOnRejected(callable $callback)
111
+ {
112
+ if ($this->getState() === Promise::PENDING) {
113
+ $this->onRejected[] = $callback;
114
+ } elseif ($this->getState() === Promise::REJECTED) {
115
+ $this->exception = call_user_func($callback, $this->exception);
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Return cURL handle
121
+ *
122
+ * @return resource
123
+ */
124
+ public function getHandle()
125
+ {
126
+ return $this->handle;
127
+ }
128
+
129
+ /**
130
+ * Get the state of the promise, one of PENDING, FULFILLED or REJECTED.
131
+ *
132
+ * @return string
133
+ */
134
+ public function getState()
135
+ {
136
+ return $this->state;
137
+ }
138
+
139
+ /**
140
+ * Return request
141
+ *
142
+ * @return RequestInterface
143
+ */
144
+ public function getRequest()
145
+ {
146
+ return $this->request;
147
+ }
148
+
149
+ /**
150
+ * Return the value of the promise (fulfilled).
151
+ *
152
+ * @return ResponseInterface Response Object only when the Promise is fulfilled.
153
+ */
154
+ public function getResponse()
155
+ {
156
+ return $this->responseBuilder->getResponse();
157
+ }
158
+
159
+ /**
160
+ * Get the reason why the promise was rejected.
161
+ *
162
+ * If the exception is an instance of Http\Client\Exception\HttpException it will contain
163
+ * the response object with the status code and the http reason.
164
+ *
165
+ * @return Exception Exception Object only when the Promise is rejected.
166
+ *
167
+ * @throws \LogicException When the promise is not rejected.
168
+ */
169
+ public function getException()
170
+ {
171
+ if (null === $this->exception) {
172
+ throw new \LogicException('Promise is not rejected');
173
+ }
174
+
175
+ return $this->exception;
176
+ }
177
+
178
+ /**
179
+ * Fulfill promise.
180
+ */
181
+ public function fulfill()
182
+ {
183
+ $this->state = Promise::FULFILLED;
184
+ $response = $this->responseBuilder->getResponse();
185
+ try {
186
+ $response->getBody()->seek(0);
187
+ } catch (\RuntimeException $e) {
188
+ $exception = new Exception\TransferException($e->getMessage(), $e->getCode(), $e);
189
+ $this->reject($exception);
190
+
191
+ return;
192
+ }
193
+
194
+ while (count($this->onFulfilled) > 0) {
195
+ $callback = array_shift($this->onFulfilled);
196
+ $response = call_user_func($callback, $response);
197
+ }
198
+
199
+ if ($response instanceof ResponseInterface) {
200
+ $this->responseBuilder->setResponse($response);
201
+ }
202
+ }
203
+
204
+ /**
205
+ * Reject promise.
206
+ *
207
+ * @param Exception $exception Reject reason.
208
+ */
209
+ public function reject(Exception $exception)
210
+ {
211
+ $this->exception = $exception;
212
+ $this->state = Promise::REJECTED;
213
+
214
+ while (count($this->onRejected) > 0) {
215
+ $callback = array_shift($this->onRejected);
216
+ try {
217
+ $exception = call_user_func($callback, $this->exception);
218
+ $this->exception = $exception;
219
+ } catch (Exception $exception) {
220
+ $this->exception = $exception;
221
+ }
222
+ }
223
+ }
224
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/curl-client/src/ResponseBuilder.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Http\Client\Curl;
3
+
4
+ use Http\Message\Builder\ResponseBuilder as OriginalResponseBuilder;
5
+ use Psr\Http\Message\ResponseInterface;
6
+
7
+ /**
8
+ * Extended response builder
9
+ */
10
+ class ResponseBuilder extends OriginalResponseBuilder
11
+ {
12
+ /**
13
+ * Replace response with a new instance
14
+ *
15
+ * @param ResponseInterface $response
16
+ */
17
+ public function setResponse(ResponseInterface $response)
18
+ {
19
+ $this->response = $response;
20
+ }
21
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/CHANGELOG.md ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+ ## 1.3.0 - 2017-08-03
4
+
5
+ ### Added
6
+
7
+ - Discovery support for CakePHP adapter
8
+ - Discovery support for Zend adapter
9
+ - Discovery support for Artax adapter
10
+
11
+ ## 1.2.1 - 2017-03-02
12
+
13
+ ### Fixed
14
+
15
+ - Fixed minor issue with `MockClientStrategy`, also added more tests.
16
+
17
+ ## 1.2.0 - 2017-02-12
18
+
19
+ ### Added
20
+
21
+ - MockClientStrategy class.
22
+
23
+ ## 1.1.1 - 2016-11-27
24
+
25
+ ### Changed
26
+
27
+ - Made exception messages clearer. `StrategyUnavailableException` is no longer the previous exception to `DiscoveryFailedException`.
28
+ - `CommonClassesStrategy` is using `self` instead of `static`. Using `static` makes no sense when `CommonClassesStrategy` is final.
29
+
30
+ ## 1.1.0 - 2016-10-20
31
+
32
+ ### Added
33
+
34
+ - Discovery support for Slim Framework factories
35
+
36
+ ## 1.0.0 - 2016-07-18
37
+
38
+ ### Added
39
+
40
+ - Added back `Http\Discovery\NotFoundException` to preserve BC with 0.8 version. You may upgrade from 0.8.x and 0.9.x to 1.0.0 without any BC breaks.
41
+ - Added interface `Http\Discovery\Exception` which is implemented by all our exceptions
42
+
43
+ ### Changed
44
+
45
+ - Puli strategy renamed to Puli Beta strategy to prevent incompatibility with a future Puli stable
46
+
47
+ ### Deprecated
48
+
49
+ - For BC reasons, the old `Http\Discovery\NotFoundException` (extending the new exception) will be thrown until version 2.0
50
+
51
+
52
+ ## 0.9.1 - 2016-06-28
53
+
54
+ ### Changed
55
+
56
+ - Dropping PHP 5.4 support because we use the ::class constant.
57
+
58
+
59
+ ## 0.9.0 - 2016-06-25
60
+
61
+ ### Added
62
+
63
+ - Discovery strategies to find classes
64
+
65
+ ### Changed
66
+
67
+ - [Puli](http://puli.io) made optional
68
+ - Improved exceptions
69
+ - **[BC] `NotFoundException` moved to `Http\Discovery\Exception\NotFoundException`**
70
+
71
+
72
+ ## 0.8.0 - 2016-02-11
73
+
74
+ ### Changed
75
+
76
+ - Puli composer plugin must be installed separately
77
+
78
+
79
+ ## 0.7.0 - 2016-01-15
80
+
81
+ ### Added
82
+
83
+ - Temporary puli.phar (Beta 10) executable
84
+
85
+ ### Changed
86
+
87
+ - Updated HTTPlug dependencies
88
+ - Updated Puli dependencies
89
+ - Local configuration to make tests passing
90
+
91
+ ### Removed
92
+
93
+ - Puli CLI dependency
94
+
95
+
96
+ ## 0.6.4 - 2016-01-07
97
+
98
+ ### Fixed
99
+
100
+ - Puli [not working](https://twitter.com/PuliPHP/status/685132540588507137) with the latest json-schema
101
+
102
+
103
+ ## 0.6.3 - 2016-01-04
104
+
105
+ ### Changed
106
+
107
+ - Adjust Puli dependencies
108
+
109
+
110
+ ## 0.6.2 - 2016-01-04
111
+
112
+ ### Changed
113
+
114
+ - Make Puli CLI a requirement
115
+
116
+
117
+ ## 0.6.1 - 2016-01-03
118
+
119
+ ### Changed
120
+
121
+ - More flexible Puli requirement
122
+
123
+
124
+ ## 0.6.0 - 2015-12-30
125
+
126
+ ### Changed
127
+
128
+ - Use [Puli](http://puli.io) for discovery
129
+ - Improved exception messages
130
+
131
+
132
+ ## 0.5.0 - 2015-12-25
133
+
134
+ ### Changed
135
+
136
+ - Updated message factory dependency (php-http/message)
137
+
138
+
139
+ ## 0.4.0 - 2015-12-17
140
+
141
+ ### Added
142
+
143
+ - Array condition evaluation in the Class Discovery
144
+
145
+ ### Removed
146
+
147
+ - Message factories (moved to php-http/utils)
148
+
149
+
150
+ ## 0.3.0 - 2015-11-18
151
+
152
+ ### Added
153
+
154
+ - HTTP Async Client Discovery
155
+ - Stream factories
156
+
157
+ ### Changed
158
+
159
+ - Discoveries and Factories are final
160
+ - Message and Uri factories have the type in their names
161
+ - Diactoros Message factory uses Stream factory internally
162
+
163
+ ### Fixed
164
+
165
+ - Improved docblocks for API documentation generation
166
+
167
+
168
+ ## 0.2.0 - 2015-10-31
169
+
170
+ ### Changed
171
+
172
+ - Renamed AdapterDiscovery to ClientDiscovery
173
+
174
+
175
+ ## 0.1.1 - 2015-06-13
176
+
177
+ ### Fixed
178
+
179
+ - Bad HTTP Adapter class name for Guzzle 5
180
+
181
+
182
+ ## 0.1.0 - 2015-06-12
183
+
184
+ ### Added
185
+
186
+ - Initial release
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/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.
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HTTPlug Discovery
2
+
3
+ [![Latest Version](https://img.shields.io/github/release/php-http/discovery.svg?style=flat-square)](https://github.com/php-http/discovery/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/discovery.svg?style=flat-square)](https://travis-ci.org/php-http/discovery)
6
+ [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/discovery.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/discovery)
7
+ [![Quality Score](https://img.shields.io/scrutinizer/g/php-http/discovery.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/discovery)
8
+ [![Total Downloads](https://img.shields.io/packagist/dt/php-http/discovery.svg?style=flat-square)](https://packagist.org/packages/php-http/discovery)
9
+
10
+ **Finds installed HTTPlug implementations and PSR-7 message factories.**
11
+
12
+
13
+ ## Install
14
+
15
+ Via Composer
16
+
17
+ ``` bash
18
+ $ composer require php-http/discovery
19
+ ```
20
+
21
+
22
+ ## Documentation
23
+
24
+ Please see the [official documentation](http://php-http.readthedocs.org/en/latest/discovery.html).
25
+
26
+
27
+ ## Testing
28
+
29
+ ``` bash
30
+ $ composer test
31
+ ```
32
+
33
+
34
+ ## Contributing
35
+
36
+ Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).
37
+
38
+
39
+ ## Security
40
+
41
+ If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
42
+
43
+
44
+ ## License
45
+
46
+ The MIT License (MIT). Please see [License File](LICENSE) for more information.
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/composer.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "php-http/discovery",
3
+ "description": "Finds installed HTTPlug implementations and PSR-7 message factories",
4
+ "license": "MIT",
5
+ "keywords": ["http", "discovery", "client", "adapter", "message", "factory", "psr7"],
6
+ "homepage": "http://php-http.org",
7
+ "authors": [
8
+ {
9
+ "name": "Márk Sági-Kazár",
10
+ "email": "mark.sagikazar@gmail.com"
11
+ }
12
+ ],
13
+ "require": {
14
+ "php": "^5.5 || ^7.0"
15
+ },
16
+ "require-dev": {
17
+ "php-http/httplug": "^1.0",
18
+ "php-http/message-factory": "^1.0",
19
+ "puli/composer-plugin": "1.0.0-beta10",
20
+ "phpspec/phpspec": "^2.4",
21
+ "henrikbjorn/phpspec-code-coverage" : "^2.0.2"
22
+ },
23
+ "suggest": {
24
+ "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.",
25
+ "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories"
26
+ },
27
+ "autoload": {
28
+ "psr-4": {
29
+ "Http\\Discovery\\": "src/"
30
+ }
31
+ },
32
+ "autoload-dev": {
33
+ "psr-4": {
34
+ "spec\\Http\\Discovery\\": "spec/"
35
+ }
36
+ },
37
+ "scripts": {
38
+ "test": "vendor/bin/phpspec run",
39
+ "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml"
40
+ },
41
+ "extra": {
42
+ "branch-alias": {
43
+ "dev-master": "1.3-dev"
44
+ }
45
+ },
46
+ "prefer-stable": true,
47
+ "minimum-stability": "beta"
48
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/ClassDiscovery.php ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery;
4
+
5
+ use Http\Discovery\Exception\ClassInstantiationFailedException;
6
+ use Http\Discovery\Exception\DiscoveryFailedException;
7
+ use Http\Discovery\Exception\StrategyUnavailableException;
8
+
9
+ /**
10
+ * Registry that based find results on class existence.
11
+ *
12
+ * @author David de Boer <david@ddeboer.nl>
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
15
+ */
16
+ abstract class ClassDiscovery
17
+ {
18
+ /**
19
+ * A list of strategies to find classes.
20
+ *
21
+ * @var array
22
+ */
23
+ private static $strategies = [
24
+ Strategy\PuliBetaStrategy::class,
25
+ Strategy\CommonClassesStrategy::class,
26
+ ];
27
+
28
+ /**
29
+ * Discovery cache to make the second time we use discovery faster.
30
+ *
31
+ * @var array
32
+ */
33
+ private static $cache = [];
34
+
35
+ /**
36
+ * Finds a class.
37
+ *
38
+ * @param string $type
39
+ *
40
+ * @return string|\Closure
41
+ *
42
+ * @throws DiscoveryFailedException
43
+ */
44
+ protected static function findOneByType($type)
45
+ {
46
+ // Look in the cache
47
+ if (null !== ($class = self::getFromCache($type))) {
48
+ return $class;
49
+ }
50
+
51
+ $exceptions = [];
52
+ foreach (self::$strategies as $strategy) {
53
+ try {
54
+ $candidates = call_user_func($strategy.'::getCandidates', $type);
55
+ } catch (StrategyUnavailableException $e) {
56
+ $exceptions[] = $e;
57
+ continue;
58
+ }
59
+
60
+ foreach ($candidates as $candidate) {
61
+ if (isset($candidate['condition'])) {
62
+ if (!self::evaluateCondition($candidate['condition'])) {
63
+ continue;
64
+ }
65
+ }
66
+
67
+ // save the result for later use
68
+ self::storeInCache($type, $candidate);
69
+
70
+ return $candidate['class'];
71
+ }
72
+ }
73
+
74
+ throw DiscoveryFailedException::create($exceptions);
75
+ }
76
+
77
+ /**
78
+ * Get a value from cache.
79
+ *
80
+ * @param string $type
81
+ *
82
+ * @return string|null
83
+ */
84
+ private static function getFromCache($type)
85
+ {
86
+ if (!isset(self::$cache[$type])) {
87
+ return;
88
+ }
89
+
90
+ $candidate = self::$cache[$type];
91
+ if (isset($candidate['condition'])) {
92
+ if (!self::evaluateCondition($candidate['condition'])) {
93
+ return;
94
+ }
95
+ }
96
+
97
+ return $candidate['class'];
98
+ }
99
+
100
+ /**
101
+ * Store a value in cache.
102
+ *
103
+ * @param string $type
104
+ * @param string $class
105
+ */
106
+ private static function storeInCache($type, $class)
107
+ {
108
+ self::$cache[$type] = $class;
109
+ }
110
+
111
+ /**
112
+ * Set new strategies and clear the cache.
113
+ *
114
+ * @param array $strategies string array of fully qualified class name to a DiscoveryStrategy
115
+ */
116
+ public static function setStrategies(array $strategies)
117
+ {
118
+ self::$strategies = $strategies;
119
+ self::clearCache();
120
+ }
121
+
122
+ /**
123
+ * Append a strategy at the end of the strategy queue.
124
+ *
125
+ * @param string $strategy Fully qualified class name to a DiscoveryStrategy
126
+ */
127
+ public static function appendStrategy($strategy)
128
+ {
129
+ self::$strategies[] = $strategy;
130
+ self::clearCache();
131
+ }
132
+
133
+ /**
134
+ * Prepend a strategy at the beginning of the strategy queue.
135
+ *
136
+ * @param string $strategy Fully qualified class name to a DiscoveryStrategy
137
+ */
138
+ public static function prependStrategy($strategy)
139
+ {
140
+ array_unshift(self::$strategies, $strategy);
141
+ self::clearCache();
142
+ }
143
+
144
+ /**
145
+ * Clear the cache.
146
+ */
147
+ public static function clearCache()
148
+ {
149
+ self::$cache = [];
150
+ }
151
+
152
+ /**
153
+ * Evaluates conditions to boolean.
154
+ *
155
+ * @param mixed $condition
156
+ *
157
+ * @return bool
158
+ */
159
+ protected static function evaluateCondition($condition)
160
+ {
161
+ if (is_string($condition)) {
162
+ // Should be extended for functions, extensions???
163
+ return class_exists($condition);
164
+ } elseif (is_callable($condition)) {
165
+ return $condition();
166
+ } elseif (is_bool($condition)) {
167
+ return $condition;
168
+ } elseif (is_array($condition)) {
169
+ $evaluatedCondition = true;
170
+
171
+ // Immediately stop execution if the condition is false
172
+ for ($i = 0; $i < count($condition) && false !== $evaluatedCondition; ++$i) {
173
+ $evaluatedCondition &= static::evaluateCondition($condition[$i]);
174
+ }
175
+
176
+ return $evaluatedCondition;
177
+ }
178
+
179
+ return false;
180
+ }
181
+
182
+ /**
183
+ * Get an instance of the $class.
184
+ *
185
+ * @param string|\Closure $class A FQCN of a class or a closure that instantiate the class.
186
+ *
187
+ * @return object
188
+ *
189
+ * @throws ClassInstantiationFailedException
190
+ */
191
+ protected static function instantiateClass($class)
192
+ {
193
+ try {
194
+ if (is_string($class)) {
195
+ return new $class();
196
+ }
197
+
198
+ if (is_callable($class)) {
199
+ return $class();
200
+ }
201
+ } catch (\Exception $e) {
202
+ throw new ClassInstantiationFailedException('Unexpected exception when instantiating class.', 0, $e);
203
+ }
204
+
205
+ throw new ClassInstantiationFailedException('Could not instantiate class because parameter is neither a callable nor a string');
206
+ }
207
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/ClassInstantiationFailedException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery\Exception;
4
+
5
+ use Http\Discovery\Exception;
6
+
7
+ /**
8
+ * Thrown when a class fails to instantiate.
9
+ *
10
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
11
+ */
12
+ final class ClassInstantiationFailedException extends \RuntimeException implements Exception
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery\Exception;
4
+
5
+ use Http\Discovery\Exception;
6
+
7
+ /**
8
+ * Thrown when all discovery strategies fails to find a resource.
9
+ *
10
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
11
+ */
12
+ final class DiscoveryFailedException extends \Exception implements Exception
13
+ {
14
+ /**
15
+ * @var \Exception[]
16
+ */
17
+ private $exceptions;
18
+
19
+ /**
20
+ * @param string $message
21
+ * @param \Exception[] $exceptions
22
+ */
23
+ public function __construct($message, array $exceptions = [])
24
+ {
25
+ $this->exceptions = $exceptions;
26
+
27
+ parent::__construct($message);
28
+ }
29
+
30
+ /**
31
+ * @param \Exception[] $exceptions
32
+ */
33
+ public static function create($exceptions)
34
+ {
35
+ $message = 'Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors';
36
+ foreach ($exceptions as $e) {
37
+ $message .= "\n - ".$e->getMessage();
38
+ }
39
+ $message .= "\n\n";
40
+
41
+ return new self($message, $exceptions);
42
+ }
43
+
44
+ /**
45
+ * @return \Exception[]
46
+ */
47
+ public function getExceptions()
48
+ {
49
+ return $this->exceptions;
50
+ }
51
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/NotFoundException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery\Exception;
4
+
5
+ use Http\Discovery\Exception;
6
+
7
+ /**
8
+ * Thrown when a discovery does not find any matches.
9
+ *
10
+ * @final do NOT extend this class, not final for BC reasons
11
+ *
12
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
+ */
14
+ /*final */class NotFoundException extends \RuntimeException implements Exception
15
+ {
16
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery\Exception;
4
+
5
+ /**
6
+ * Thrown when we can't use Puli for discovery.
7
+ *
8
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
9
+ */
10
+ final class PuliUnavailableException extends StrategyUnavailableException
11
+ {
12
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Exception/StrategyUnavailableException.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery\Exception;
4
+
5
+ use Http\Discovery\Exception;
6
+
7
+ /**
8
+ * This exception is thrown when we cannot use a discovery strategy. This is *not* thrown when
9
+ * the discovery fails to find a class.
10
+ *
11
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
12
+ */
13
+ class StrategyUnavailableException extends \RuntimeException implements Exception
14
+ {
15
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery;
4
+
5
+ use Http\Client\HttpAsyncClient;
6
+ use Http\Discovery\Exception\DiscoveryFailedException;
7
+
8
+ /**
9
+ * Finds an HTTP Asynchronous Client.
10
+ *
11
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
12
+ */
13
+ final class HttpAsyncClientDiscovery extends ClassDiscovery
14
+ {
15
+ /**
16
+ * Finds an HTTP Async Client.
17
+ *
18
+ * @return HttpAsyncClient
19
+ *
20
+ * @throws Exception\NotFoundException
21
+ */
22
+ public static function find()
23
+ {
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);
35
+ }
36
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/HttpClientDiscovery.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery;
4
+
5
+ use Http\Client\HttpClient;
6
+ use Http\Discovery\Exception\DiscoveryFailedException;
7
+
8
+ /**
9
+ * Finds an HTTP Client.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ final class HttpClientDiscovery extends ClassDiscovery
14
+ {
15
+ /**
16
+ * Finds an HTTP Client.
17
+ *
18
+ * @return HttpClient
19
+ *
20
+ * @throws Exception\NotFoundException
21
+ */
22
+ public static function find()
23
+ {
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);
35
+ }
36
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/MessageFactoryDiscovery.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery;
4
+
5
+ use Http\Discovery\Exception\DiscoveryFailedException;
6
+ use Http\Message\MessageFactory;
7
+
8
+ /**
9
+ * Finds a Message Factory.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ final class MessageFactoryDiscovery extends ClassDiscovery
14
+ {
15
+ /**
16
+ * Finds a Message Factory.
17
+ *
18
+ * @return MessageFactory
19
+ *
20
+ * @throws Exception\NotFoundException
21
+ */
22
+ public static function find()
23
+ {
24
+ try {
25
+ $messageFactory = static::findOneByType(MessageFactory::class);
26
+ } catch (DiscoveryFailedException $e) {
27
+ throw new NotFoundException(
28
+ 'No message factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.',
29
+ 0,
30
+ $e
31
+ );
32
+ }
33
+
34
+ return static::instantiateClass($messageFactory);
35
+ }
36
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/NotFoundException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery;
4
+
5
+ /**
6
+ * Thrown when a discovery does not find any matches.
7
+ *
8
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
9
+ *
10
+ * @deprecated since since version 1.0, and will be removed in 2.0. Use {@link \Http\Discovery\Exception\NotFoundException} instead.
11
+ */
12
+ final class NotFoundException extends \Http\Discovery\Exception\NotFoundException
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery\Strategy;
4
+
5
+ use GuzzleHttp\Psr7\Request as GuzzleRequest;
6
+ use Http\Message\MessageFactory\GuzzleMessageFactory;
7
+ use Http\Message\StreamFactory\GuzzleStreamFactory;
8
+ use Http\Message\UriFactory\GuzzleUriFactory;
9
+ use Http\Message\MessageFactory\DiactorosMessageFactory;
10
+ use Http\Message\StreamFactory\DiactorosStreamFactory;
11
+ use Http\Message\UriFactory\DiactorosUriFactory;
12
+ use Zend\Diactoros\Request as DiactorosRequest;
13
+ use Http\Message\MessageFactory\SlimMessageFactory;
14
+ use Http\Message\StreamFactory\SlimStreamFactory;
15
+ use Http\Message\UriFactory\SlimUriFactory;
16
+ use Slim\Http\Request as SlimRequest;
17
+ use Http\Adapter\Guzzle6\Client as Guzzle6;
18
+ use Http\Adapter\Guzzle5\Client as Guzzle5;
19
+ use Http\Client\Curl\Client as Curl;
20
+ use Http\Client\Socket\Client as Socket;
21
+ use Http\Adapter\React\Client as React;
22
+ use Http\Adapter\Buzz\Client as Buzz;
23
+ use Http\Adapter\Cake\Client as Cake;
24
+ use Http\Adapter\Zend\Client as Zend;
25
+ use Http\Adapter\Artax\Client as Artax;
26
+
27
+ /**
28
+ * @internal
29
+ *
30
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
31
+ */
32
+ final class CommonClassesStrategy implements DiscoveryStrategy
33
+ {
34
+ /**
35
+ * @var array
36
+ */
37
+ private static $classes = [
38
+ 'Http\Message\MessageFactory' => [
39
+ ['class' => GuzzleMessageFactory::class, 'condition' => [GuzzleRequest::class, GuzzleMessageFactory::class]],
40
+ ['class' => DiactorosMessageFactory::class, 'condition' => [DiactorosRequest::class, DiactorosMessageFactory::class]],
41
+ ['class' => SlimMessageFactory::class, 'condition' => [SlimRequest::class, SlimMessageFactory::class]],
42
+ ],
43
+ 'Http\Message\StreamFactory' => [
44
+ ['class' => GuzzleStreamFactory::class, 'condition' => [GuzzleRequest::class, GuzzleStreamFactory::class]],
45
+ ['class' => DiactorosStreamFactory::class, 'condition' => [DiactorosRequest::class, DiactorosStreamFactory::class]],
46
+ ['class' => SlimStreamFactory::class, 'condition' => [SlimRequest::class, SlimStreamFactory::class]],
47
+ ],
48
+ 'Http\Message\UriFactory' => [
49
+ ['class' => GuzzleUriFactory::class, 'condition' => [GuzzleRequest::class, GuzzleUriFactory::class]],
50
+ ['class' => DiactorosUriFactory::class, 'condition' => [DiactorosRequest::class, DiactorosUriFactory::class]],
51
+ ['class' => SlimUriFactory::class, 'condition' => [SlimRequest::class, SlimUriFactory::class]],
52
+ ],
53
+ 'Http\Client\HttpAsyncClient' => [
54
+ ['class' => Guzzle6::class, 'condition' => Guzzle6::class],
55
+ ['class' => Curl::class, 'condition' => Curl::class],
56
+ ['class' => React::class, 'condition' => React::class],
57
+ ],
58
+ 'Http\Client\HttpClient' => [
59
+ ['class' => Guzzle6::class, 'condition' => Guzzle6::class],
60
+ ['class' => Guzzle5::class, 'condition' => Guzzle5::class],
61
+ ['class' => Curl::class, 'condition' => Curl::class],
62
+ ['class' => Socket::class, 'condition' => Socket::class],
63
+ ['class' => Buzz::class, 'condition' => Buzz::class],
64
+ ['class' => React::class, 'condition' => React::class],
65
+ ['class' => Cake::class, 'condition' => Cake::class],
66
+ ['class' => Zend::class, 'condition' => Zend::class],
67
+ ['class' => Artax::class, 'condition' => Artax::class],
68
+ ],
69
+ ];
70
+
71
+ /**
72
+ * {@inheritdoc}
73
+ */
74
+ public static function getCandidates($type)
75
+ {
76
+ if (isset(self::$classes[$type])) {
77
+ return self::$classes[$type];
78
+ }
79
+
80
+ return [];
81
+ }
82
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery\Strategy;
4
+
5
+ use Http\Discovery\Exception\StrategyUnavailableException;
6
+
7
+ /**
8
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
9
+ */
10
+ interface DiscoveryStrategy
11
+ {
12
+ /**
13
+ * Find a resource of a specific type.
14
+ *
15
+ * @param string $type
16
+ *
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery\Strategy;
4
+
5
+ use Http\Client\HttpClient;
6
+ use Http\Mock\Client as Mock;
7
+
8
+ /**
9
+ * Find the Mock client.
10
+ *
11
+ * @author Sam Rapaport <me@samrapdev.com>
12
+ */
13
+ final class MockClientStrategy implements DiscoveryStrategy
14
+ {
15
+ /**
16
+ * {@inheritdoc}
17
+ */
18
+ public static function getCandidates($type)
19
+ {
20
+ return ($type === HttpClient::class)
21
+ ? [['class' => Mock::class, 'condition' => Mock::class]]
22
+ : [];
23
+ }
24
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery\Strategy;
4
+
5
+ use Http\Discovery\Exception\PuliUnavailableException;
6
+ use Puli\Discovery\Api\Discovery;
7
+ use Puli\GeneratedPuliFactory;
8
+
9
+ /**
10
+ * Find candidates using Puli.
11
+ *
12
+ * @internal
13
+ * @final
14
+ *
15
+ * @author David de Boer <david@ddeboer.nl>
16
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
17
+ */
18
+ class PuliBetaStrategy implements DiscoveryStrategy
19
+ {
20
+ /**
21
+ * @var GeneratedPuliFactory
22
+ */
23
+ protected static $puliFactory;
24
+
25
+ /**
26
+ * @var Discovery
27
+ */
28
+ protected static $puliDiscovery;
29
+
30
+ /**
31
+ * @return GeneratedPuliFactory
32
+ *
33
+ * @throws PuliUnavailableException
34
+ */
35
+ private static function getPuliFactory()
36
+ {
37
+ if (null === self::$puliFactory) {
38
+ if (!defined('PULI_FACTORY_CLASS')) {
39
+ throw new PuliUnavailableException('Puli Factory is not available');
40
+ }
41
+
42
+ $puliFactoryClass = PULI_FACTORY_CLASS;
43
+
44
+ if (!class_exists($puliFactoryClass)) {
45
+ throw new PuliUnavailableException('Puli Factory class does not exist');
46
+ }
47
+
48
+ self::$puliFactory = new $puliFactoryClass();
49
+ }
50
+
51
+ return self::$puliFactory;
52
+ }
53
+
54
+ /**
55
+ * Returns the Puli discovery layer.
56
+ *
57
+ * @return Discovery
58
+ *
59
+ * @throws PuliUnavailableException
60
+ */
61
+ private static function getPuliDiscovery()
62
+ {
63
+ if (!isset(self::$puliDiscovery)) {
64
+ $factory = self::getPuliFactory();
65
+ $repository = $factory->createRepository();
66
+
67
+ self::$puliDiscovery = $factory->createDiscovery($repository);
68
+ }
69
+
70
+ return self::$puliDiscovery;
71
+ }
72
+
73
+ /**
74
+ * {@inheritdoc}
75
+ */
76
+ public static function getCandidates($type)
77
+ {
78
+ $returnData = [];
79
+ $bindings = self::getPuliDiscovery()->findBindings($type);
80
+
81
+ foreach ($bindings as $binding) {
82
+ $condition = true;
83
+ if ($binding->hasParameterValue('depends')) {
84
+ $condition = $binding->getParameterValue('depends');
85
+ }
86
+ $returnData[] = ['class' => $binding->getClassName(), 'condition' => $condition];
87
+ }
88
+
89
+ return $returnData;
90
+ }
91
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/StreamFactoryDiscovery.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery;
4
+
5
+ use Http\Discovery\Exception\DiscoveryFailedException;
6
+ use Http\Message\StreamFactory;
7
+
8
+ /**
9
+ * Finds a Stream Factory.
10
+ *
11
+ * @author Михаил Красильников <m.krasilnikov@yandex.ru>
12
+ */
13
+ final class StreamFactoryDiscovery extends ClassDiscovery
14
+ {
15
+ /**
16
+ * Finds a Stream Factory.
17
+ *
18
+ * @return StreamFactory
19
+ *
20
+ * @throws Exception\NotFoundException
21
+ */
22
+ public static function find()
23
+ {
24
+ try {
25
+ $streamFactory = static::findOneByType(StreamFactory::class);
26
+ } catch (DiscoveryFailedException $e) {
27
+ throw new NotFoundException(
28
+ 'No stream factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.',
29
+ 0,
30
+ $e
31
+ );
32
+ }
33
+
34
+ return static::instantiateClass($streamFactory);
35
+ }
36
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/discovery/src/UriFactoryDiscovery.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Discovery;
4
+
5
+ use Http\Discovery\Exception\DiscoveryFailedException;
6
+ use Http\Message\UriFactory;
7
+
8
+ /**
9
+ * Finds a URI Factory.
10
+ *
11
+ * @author David de Boer <david@ddeboer.nl>
12
+ */
13
+ final class UriFactoryDiscovery extends ClassDiscovery
14
+ {
15
+ /**
16
+ * Finds a URI Factory.
17
+ *
18
+ * @return UriFactory
19
+ *
20
+ * @throws Exception\NotFoundException
21
+ */
22
+ public static function find()
23
+ {
24
+ try {
25
+ $uriFactory = static::findOneByType(UriFactory::class);
26
+ } catch (DiscoveryFailedException $e) {
27
+ throw new NotFoundException(
28
+ 'No uri factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.',
29
+ 0,
30
+ $e
31
+ );
32
+ }
33
+
34
+ return static::instantiateClass($uriFactory);
35
+ }
36
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/CHANGELOG.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
18
+ - Updated package files
19
+ - Updated promise dependency to RC1
20
+
21
+
22
+ ## 1.0.0-beta - 2015-12-17
23
+
24
+ ### Added
25
+
26
+ - Puli configuration and binding types
27
+
28
+ ### Changed
29
+
30
+ - Exception concept
31
+
32
+
33
+ ## 1.0.0-alpha3 - 2015-12-13
34
+
35
+ ### Changed
36
+
37
+ - Async client does not throw exceptions
38
+
39
+ ### Removed
40
+
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
+
55
+ - Better domain exceptions.
56
+
57
+ ### Changed
58
+
59
+ - Purpose of the library: general HTTP CLient abstraction.
60
+
61
+ ### Removed
62
+
63
+ - Request options: they should be configured at construction time.
64
+ - Multiple request sending: should be done asynchronously using Async Client.
65
+ - `getName` method
66
+
67
+
68
+ ## 0.1.0 - 2015-06-03
69
+
70
+ ### Added
71
+
72
+ - Initial release
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/README.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HTTPlug
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
19
+
20
+ ``` bash
21
+ $ 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).
36
+
37
+
38
+ ## Testing
39
+
40
+ ``` bash
41
+ $ 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.
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/composer.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "php-http/httplug",
3
+ "description": "HTTPlug, the HTTP client abstraction for PHP",
4
+ "license": "MIT",
5
+ "keywords": ["http", "client"],
6
+ "homepage": "http://httplug.io",
7
+ "authors": [
8
+ {
9
+ "name": "Eric GELOEN",
10
+ "email": "geloen.eric@gmail.com"
11
+ },
12
+ {
13
+ "name": "Márk Sági-Kazár",
14
+ "email": "mark.sagikazar@gmail.com"
15
+ }
16
+ ],
17
+ "require": {
18
+ "php": ">=5.4",
19
+ "psr/http-message": "^1.0",
20
+ "php-http/promise": "^1.0"
21
+ },
22
+ "require-dev": {
23
+ "phpspec/phpspec": "^2.4",
24
+ "henrikbjorn/phpspec-code-coverage" : "^1.0"
25
+ },
26
+ "autoload": {
27
+ "psr-4": {
28
+ "Http\\Client\\": "src/"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "test": "vendor/bin/phpspec run",
33
+ "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml"
34
+ },
35
+ "extra": {
36
+ "branch-alias": {
37
+ "dev-master": "1.1-dev"
38
+ }
39
+ }
40
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/puli.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0",
3
+ "name": "php-http/httplug",
4
+ "binding-types": {
5
+ "Http\\Client\\HttpAsyncClient": {
6
+ "description": "Async HTTP Client"
7
+ },
8
+ "Http\\Client\\HttpClient": {
9
+ "description": "HTTP Client"
10
+ }
11
+ }
12
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception/HttpException.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Exception;
4
+
5
+ use Psr\Http\Message\RequestInterface;
6
+ use Psr\Http\Message\ResponseInterface;
7
+
8
+ /**
9
+ * Thrown when a response was received but the request itself failed.
10
+ *
11
+ * In addition to the request, this exception always provides access to the response object.
12
+ *
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ class HttpException extends RequestException
16
+ {
17
+ /**
18
+ * @var ResponseInterface
19
+ */
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,
30
+ RequestInterface $request,
31
+ ResponseInterface $response,
32
+ \Exception $previous = null
33
+ ) {
34
+ parent::__construct($message, $request, $previous);
35
+
36
+ $this->response = $response;
37
+ $this->code = $response->getStatusCode();
38
+ }
39
+
40
+ /**
41
+ * Returns the response.
42
+ *
43
+ * @return ResponseInterface
44
+ */
45
+ public function getResponse()
46
+ {
47
+ return $this->response;
48
+ }
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,
61
+ ResponseInterface $response,
62
+ \Exception $previous = null
63
+ ) {
64
+ $message = sprintf(
65
+ '[url] %s [http method] %s [status code] %s [reason phrase] %s',
66
+ $request->getRequestTarget(),
67
+ $request->getMethod(),
68
+ $response->getStatusCode(),
69
+ $response->getReasonPhrase()
70
+ );
71
+
72
+ return new self($message, $request, $response, $previous);
73
+ }
74
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception/NetworkException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Exception;
4
+
5
+ /**
6
+ * Thrown when the request cannot be completed because of network issues.
7
+ *
8
+ * There is no response object as this exception is thrown when no response has been received.
9
+ *
10
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
+ */
12
+ class NetworkException extends RequestException
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception/RequestException.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Exception;
4
+
5
+ use Psr\Http\Message\RequestInterface;
6
+
7
+ /**
8
+ * Exception for when a request failed, providing access to the failed request.
9
+ *
10
+ * This could be due to an invalid request, or one of the extending exceptions
11
+ * for network errors or HTTP error responses.
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Exception/TransferException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Exception;
4
+
5
+ use Http\Client\Exception;
6
+
7
+ /**
8
+ * Base exception for transfer related exceptions.
9
+ *
10
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
+ */
12
+ class TransferException extends \RuntimeException implements Exception
13
+ {
14
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/HttpAsyncClient.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client;
4
+
5
+ use Http\Promise\Promise;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Sends a PSR-7 Request in an asynchronous way by returning a Promise.
10
+ *
11
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
12
+ */
13
+ interface HttpAsyncClient
14
+ {
15
+ /**
16
+ * Sends a PSR-7 request in an asynchronous way.
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
+ */
26
+ public function sendAsyncRequest(RequestInterface $request);
27
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/HttpClient.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Promise;
4
+
5
+ use Http\Client\Exception;
6
+ use Http\Promise\Promise;
7
+ use Psr\Http\Message\ResponseInterface;
8
+
9
+ final class HttpFulfilledPromise implements Promise
10
+ {
11
+ /**
12
+ * @var ResponseInterface
13
+ */
14
+ private $response;
15
+
16
+ /**
17
+ * @param ResponseInterface $response
18
+ */
19
+ public function __construct(ResponseInterface $response)
20
+ {
21
+ $this->response = $response;
22
+ }
23
+
24
+ /**
25
+ * {@inheritdoc}
26
+ */
27
+ public function then(callable $onFulfilled = null, callable $onRejected = null)
28
+ {
29
+ if (null === $onFulfilled) {
30
+ return $this;
31
+ }
32
+
33
+ try {
34
+ return new self($onFulfilled($this->response));
35
+ } catch (Exception $e) {
36
+ return new HttpRejectedPromise($e);
37
+ }
38
+ }
39
+
40
+ /**
41
+ * {@inheritdoc}
42
+ */
43
+ public function getState()
44
+ {
45
+ return Promise::FULFILLED;
46
+ }
47
+
48
+ /**
49
+ * {@inheritdoc}
50
+ */
51
+ public function wait($unwrap = true)
52
+ {
53
+ if ($unwrap) {
54
+ return $this->response;
55
+ }
56
+ }
57
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Client\Promise;
4
+
5
+ use Http\Client\Exception;
6
+ use Http\Promise\Promise;
7
+
8
+ final class HttpRejectedPromise implements Promise
9
+ {
10
+ /**
11
+ * @var Exception
12
+ */
13
+ private $exception;
14
+
15
+ /**
16
+ * @param Exception $exception
17
+ */
18
+ public function __construct(Exception $exception)
19
+ {
20
+ $this->exception = $exception;
21
+ }
22
+
23
+ /**
24
+ * {@inheritdoc}
25
+ */
26
+ public function then(callable $onFulfilled = null, callable $onRejected = null)
27
+ {
28
+ if (null === $onRejected) {
29
+ return $this;
30
+ }
31
+
32
+ try {
33
+ return new HttpFulfilledPromise($onRejected($this->exception));
34
+ } catch (Exception $e) {
35
+ return new self($e);
36
+ }
37
+ }
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public function getState()
43
+ {
44
+ return Promise::REJECTED;
45
+ }
46
+
47
+ /**
48
+ * {@inheritdoc}
49
+ */
50
+ public function wait($unwrap = true)
51
+ {
52
+ if ($unwrap) {
53
+ throw $this->exception;
54
+ }
55
+ }
56
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/CHANGELOG.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+
4
+ ## 1.0.2 - 2015-12-19
5
+
6
+ ### Added
7
+
8
+ - Request and Response factory binding types to Puli
9
+
10
+
11
+ ## 1.0.1 - 2015-12-17
12
+
13
+ ### Added
14
+
15
+ - Puli configuration and binding types
16
+
17
+
18
+ ## 1.0.0 - 2015-12-15
19
+
20
+ ### Added
21
+
22
+ - Response Factory in order to be reused in Message and Server Message factories
23
+ - Request Factory
24
+
25
+ ### Changed
26
+
27
+ - Message Factory extends Request and Response factories
28
+
29
+
30
+ ## 1.0.0-RC1 - 2015-12-14
31
+
32
+ ### Added
33
+
34
+ - CS check
35
+
36
+ ### Changed
37
+
38
+ - RuntimeException is thrown when the StreamFactory cannot write to the underlying stream
39
+
40
+
41
+ ## 0.3.0 - 2015-11-16
42
+
43
+ ### Removed
44
+
45
+ - Client Context Factory
46
+ - Factory Awares and Templates
47
+
48
+
49
+ ## 0.2.0 - 2015-11-16
50
+
51
+ ### Changed
52
+
53
+ - Reordered the parameters when creating a message to have the protocol last,
54
+ as its the least likely to need to be changed.
55
+
56
+
57
+ ## 0.1.0 - 2015-06-01
58
+
59
+ ### Added
60
+
61
+ - Initial release
62
+
63
+ ### Changed
64
+
65
+ - Helpers are renamed to templates
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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.
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PSR-7 Message Factory
2
+
3
+ [![Latest Version](https://img.shields.io/github/release/php-http/message-factory.svg?style=flat-square)](https://github.com/php-http/message-factory/releases)
4
+ [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5
+ [![Total Downloads](https://img.shields.io/packagist/dt/php-http/message-factory.svg?style=flat-square)](https://packagist.org/packages/php-http/message-factory)
6
+
7
+ **Factory interfaces for PSR-7 HTTP Message.**
8
+
9
+
10
+ ## Install
11
+
12
+ Via Composer
13
+
14
+ ``` bash
15
+ $ composer require php-http/message-factory
16
+ ```
17
+
18
+
19
+ ## Documentation
20
+
21
+ Please see the [official documentation](http://php-http.readthedocs.org/en/latest/message-factory/).
22
+
23
+
24
+ ## Contributing
25
+
26
+ Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.
27
+
28
+
29
+ ## Security
30
+
31
+ If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
32
+
33
+
34
+ ## License
35
+
36
+ The MIT License (MIT). Please see [License File](LICENSE) for more information.
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/composer.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "php-http/message-factory",
3
+ "description": "Factory interfaces for PSR-7 HTTP Message",
4
+ "license": "MIT",
5
+ "keywords": ["http", "factory", "message", "stream", "uri"],
6
+ "homepage": "http://php-http.org",
7
+ "authors": [
8
+ {
9
+ "name": "Márk Sági-Kazár",
10
+ "email": "mark.sagikazar@gmail.com"
11
+ }
12
+ ],
13
+ "require": {
14
+ "php": ">=5.4",
15
+ "psr/http-message": "^1.0"
16
+ },
17
+ "autoload": {
18
+ "psr-4": {
19
+ "Http\\Message\\": "src/"
20
+ }
21
+ },
22
+ "extra": {
23
+ "branch-alias": {
24
+ "dev-master": "1.0-dev"
25
+ }
26
+ }
27
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/puli.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0",
3
+ "binding-types": {
4
+ "Http\\Message\\MessageFactory": {
5
+ "description": "PSR-7 Message Factory",
6
+ "parameters": {
7
+ "depends": {
8
+ "description": "Optional class dependency which can be checked by consumers"
9
+ }
10
+ }
11
+ },
12
+ "Http\\Message\\RequestFactory": {
13
+ "parameters": {
14
+ "depends": {
15
+ "description": "Optional class dependency which can be checked by consumers"
16
+ }
17
+ }
18
+ },
19
+ "Http\\Message\\ResponseFactory": {
20
+ "parameters": {
21
+ "depends": {
22
+ "description": "Optional class dependency which can be checked by consumers"
23
+ }
24
+ }
25
+ },
26
+ "Http\\Message\\StreamFactory": {
27
+ "description": "PSR-7 Stream Factory",
28
+ "parameters": {
29
+ "depends": {
30
+ "description": "Optional class dependency which can be checked by consumers"
31
+ }
32
+ }
33
+ },
34
+ "Http\\Message\\UriFactory": {
35
+ "description": "PSR-7 URI Factory",
36
+ "parameters": {
37
+ "depends": {
38
+ "description": "Optional class dependency which can be checked by consumers"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/MessageFactory.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ /**
6
+ * Factory for PSR-7 Request and Response.
7
+ *
8
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
9
+ */
10
+ interface MessageFactory extends RequestFactory, ResponseFactory
11
+ {
12
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/RequestFactory.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ use Psr\Http\Message\UriInterface;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\StreamInterface;
8
+
9
+ /**
10
+ * Factory for PSR-7 Request.
11
+ *
12
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
+ */
14
+ interface RequestFactory
15
+ {
16
+ /**
17
+ * Creates a new PSR-7 request.
18
+ *
19
+ * @param string $method
20
+ * @param string|UriInterface $uri
21
+ * @param array $headers
22
+ * @param resource|string|StreamInterface|null $body
23
+ * @param string $protocolVersion
24
+ *
25
+ * @return RequestInterface
26
+ */
27
+ public function createRequest(
28
+ $method,
29
+ $uri,
30
+ array $headers = [],
31
+ $body = null,
32
+ $protocolVersion = '1.1'
33
+ );
34
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/ResponseFactory.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ use Psr\Http\Message\ResponseInterface;
6
+ use Psr\Http\Message\StreamInterface;
7
+
8
+ /**
9
+ * Factory for PSR-7 Response.
10
+ *
11
+ * This factory contract can be reused in Message and Server Message factories.
12
+ *
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ interface ResponseFactory
16
+ {
17
+ /**
18
+ * Creates a new PSR-7 response.
19
+ *
20
+ * @param int $statusCode
21
+ * @param string|null $reasonPhrase
22
+ * @param array $headers
23
+ * @param resource|string|StreamInterface|null $body
24
+ * @param string $protocolVersion
25
+ *
26
+ * @return ResponseInterface
27
+ */
28
+ public function createResponse(
29
+ $statusCode = 200,
30
+ $reasonPhrase = null,
31
+ array $headers = [],
32
+ $body = null,
33
+ $protocolVersion = '1.1'
34
+ );
35
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/StreamFactory.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * Factory for PSR-7 Stream.
9
+ *
10
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
+ */
12
+ interface StreamFactory
13
+ {
14
+ /**
15
+ * Creates a new PSR-7 stream.
16
+ *
17
+ * @param string|resource|StreamInterface|null $body
18
+ *
19
+ * @return StreamInterface
20
+ *
21
+ * @throws \InvalidArgumentException If the stream body is invalid.
22
+ * @throws \RuntimeException If creating the stream from $body fails.
23
+ */
24
+ public function createStream($body = null);
25
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message-factory/src/UriFactory.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ use Psr\Http\Message\UriInterface;
6
+
7
+ /**
8
+ * Factory for PSR-7 URI.
9
+ *
10
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
+ */
12
+ interface UriFactory
13
+ {
14
+ /**
15
+ * Creates an PSR-7 URI.
16
+ *
17
+ * @param string|UriInterface $uri
18
+ *
19
+ * @return UriInterface
20
+ *
21
+ * @throws \InvalidArgumentException If the $uri argument can not be converted into a valid URI.
22
+ */
23
+ public function createUri($uri);
24
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/CHANGELOG.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+
4
+ ## 1.6.0 - 2017-07-05
5
+
6
+ ### Added
7
+
8
+ - CookieUtil::parseDate to create a date from cookie date string
9
+
10
+ ### Fixed
11
+
12
+ - Fix curl command of CurlFormatter when there is an user-agent header
13
+
14
+ ## 1.5.0 - 2017-02-14
15
+
16
+ ### Added
17
+
18
+ - Check for empty string in Stream factories
19
+ - Cookie::createWithoutValidation Static constructor to create a cookie. Will not perform any attribute validation during instantiation.
20
+ - Cookie::isValid Method to check if cookie attributes are valid.
21
+
22
+ ### Fixed
23
+
24
+ - FilteredStream::getSize returns null because the contents size is unknown.
25
+ - Stream factories does not rewinds streams. The previous behavior was not coherent between factories and inputs.
26
+
27
+ ### Deprecated
28
+
29
+ - FilteredStream::getReadFilter The read filter is internal and should never be used by consuming code.
30
+ - FilteredStream::getWriteFilter We did not implement writing to the streams at all. And if we do, the filter is an internal information and should not be used by consuming code.
31
+
32
+
33
+ ## 1.4.1 - 2016-12-16
34
+
35
+ ### Fixed
36
+
37
+ - Cookie::matchPath Cookie with root path (`/`) will not match sub path (e.g. `/cookie`).
38
+
39
+
40
+ ## 1.4.0 - 2016-10-20
41
+
42
+ ### Added
43
+
44
+ - Message, stream and URI factories for [Slim Framework](https://github.com/slimphp/Slim)
45
+ - BufferedStream that allow you to decorate a non-seekable stream with a seekable one.
46
+ - cUrlFormatter to be able to redo the request with a cURL command
47
+
48
+
49
+ ## 1.3.1 - 2016-07-15
50
+
51
+ ### Fixed
52
+
53
+ - FullHttpMessageFormatter will not read from streams that you cannot rewind (non-seekable)
54
+ - FullHttpMessageFormatter will not read from the stream if $maxBodyLength is zero
55
+ - FullHttpMessageFormatter rewinds streams after they are read
56
+
57
+
58
+ ## 1.3.0 - 2016-07-14
59
+
60
+ ### Added
61
+
62
+ - FullHttpMessageFormatter to include headers and body in the formatted message
63
+
64
+ ### Fixed
65
+
66
+ - #41: Response builder broke header value
67
+
68
+
69
+ ## 1.2.0 - 2016-03-29
70
+
71
+ ### Added
72
+
73
+ - The RequestMatcher is built after the Symfony RequestMatcher and separates
74
+ scheme, host and path expressions and provides an option to filter on the
75
+ method
76
+ - New RequestConditional authentication method using request matchers
77
+ - Add automatic basic auth info detection based on the URL
78
+
79
+ ### Changed
80
+
81
+ - Improved ResponseBuilder
82
+
83
+ ### Deprecated
84
+
85
+ - RegexRequestMatcher, use RequestMatcher instead
86
+ - Matching authenitcation method, use RequestConditional instead
87
+
88
+
89
+ ## 1.1.0 - 2016-02-25
90
+
91
+ ### Added
92
+
93
+ - Add a request matcher interface and regex implementation
94
+ - Add a callback request matcher implementation
95
+ - Add a ResponseBuilder, to create PSR7 Response from a string
96
+
97
+ ### Fixed
98
+
99
+ - Fix casting string on a FilteredStream not filtering the output
100
+
101
+
102
+ ## 1.0.0 - 2016-01-27
103
+
104
+
105
+ ## 0.2.0 - 2015-12-29
106
+
107
+ ### Added
108
+
109
+ - Autoregistration of stream filters using Composer autoload
110
+ - Cookie
111
+ - [Apigen](http://www.apigen.org/) configuration
112
+
113
+
114
+ ## 0.1.2 - 2015-12-26
115
+
116
+ ### Added
117
+
118
+ - Request and response factory bindings
119
+
120
+ ### Fixed
121
+
122
+ - Chunk filter namespace in Dechunk stream
123
+
124
+
125
+ ## 0.1.1 - 2015-12-25
126
+
127
+ ### Added
128
+
129
+ - Formatter
130
+
131
+
132
+ ## 0.1.0 - 2015-12-24
133
+
134
+ ### Added
135
+
136
+ - Authentication
137
+ - Encoding
138
+ - Message decorator
139
+ - Message factory (Guzzle, Diactoros)
Postman/Postman-Mail/mailgun/vendor/php-http/message/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.
Postman/Postman-Mail/mailgun/vendor/php-http/message/README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HTTP Message
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.**
11
+
12
+
13
+ ## Install
14
+
15
+ Via Composer
16
+
17
+ ``` bash
18
+ $ composer require php-http/message
19
+ ```
20
+
21
+
22
+ ## Intro
23
+
24
+ This package contains various PSR-7 tools which might be useful in an HTTP workflow:
25
+
26
+ - Authentication method implementations
27
+ - Various Stream encoding tools
28
+ - Message decorators
29
+ - Message factory implementations for Guzzle PSR-7 and Diactoros
30
+ - Cookie implementation
31
+ - Request matchers
32
+
33
+
34
+ ## Documentation
35
+
36
+ Please see the [official documentation](http://docs.php-http.org/en/latest/message.html).
37
+
38
+
39
+ ## Testing
40
+
41
+ ``` bash
42
+ $ 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
+ ## Cretids
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
+
61
+ The MIT License (MIT). Please see [License File](LICENSE) for more information.
Postman/Postman-Mail/mailgun/vendor/php-http/message/apigen.neon ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ source:
2
+ - src/
3
+
4
+ destination: build/api/
5
+
6
+ templateTheme: bootstrap
Postman/Postman-Mail/mailgun/vendor/php-http/message/composer.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "php-http/message",
3
+ "description": "HTTP Message related tools",
4
+ "license": "MIT",
5
+ "keywords": ["message", "http", "psr-7"],
6
+ "homepage": "http://php-http.org",
7
+ "authors": [
8
+ {
9
+ "name": "Márk Sági-Kazár",
10
+ "email": "mark.sagikazar@gmail.com"
11
+ }
12
+ ],
13
+ "require": {
14
+ "php": ">=5.4",
15
+ "psr/http-message": "^1.0",
16
+ "php-http/message-factory": "^1.0.2",
17
+ "clue/stream-filter": "^1.3"
18
+ },
19
+ "provide": {
20
+ "php-http/message-factory-implementation": "1.0"
21
+ },
22
+ "require-dev": {
23
+ "zendframework/zend-diactoros": "^1.0",
24
+ "guzzlehttp/psr7": "^1.0",
25
+ "ext-zlib": "*",
26
+ "phpspec/phpspec": "^2.4",
27
+ "henrikbjorn/phpspec-code-coverage" : "^1.0",
28
+ "coduo/phpspec-data-provider-extension": "^1.0",
29
+ "akeneo/phpspec-skip-example-extension": "^1.0",
30
+ "slim/slim": "^3.0"
31
+ },
32
+ "suggest": {
33
+ "zendframework/zend-diactoros": "Used with Diactoros Factories",
34
+ "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
35
+ "slim/slim": "Used with Slim Framework PSR-7 implementation",
36
+ "ext-zlib": "Used with compressor/decompressor streams"
37
+ },
38
+ "autoload": {
39
+ "psr-4": {
40
+ "Http\\Message\\": "src/"
41
+ },
42
+ "files": [
43
+ "src/filters.php"
44
+ ]
45
+ },
46
+ "autoload-dev": {
47
+ "psr-4": {
48
+ "spec\\Http\\Message\\": "spec/"
49
+ }
50
+ },
51
+ "scripts": {
52
+ "test": "vendor/bin/phpspec run",
53
+ "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml"
54
+ },
55
+ "extra": {
56
+ "branch-alias": {
57
+ "dev-master": "1.6-dev"
58
+ }
59
+ }
60
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/puli.json ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0",
3
+ "name": "php-http/message",
4
+ "bindings": {
5
+ "064d003d-78a1-48c4-8f3b-1f92ff25da69": {
6
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
7
+ "class": "Http\\Message\\MessageFactory\\DiactorosMessageFactory",
8
+ "type": "Http\\Message\\MessageFactory",
9
+ "parameters": {
10
+ "depends": "Zend\\Diactoros\\Request"
11
+ }
12
+ },
13
+ "0836751e-6558-4d1b-8993-4a52012947c3": {
14
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
15
+ "class": "Http\\Message\\MessageFactory\\SlimMessageFactory",
16
+ "type": "Http\\Message\\ResponseFactory"
17
+ },
18
+ "1d127622-dc61-4bfa-b9da-d221548d72c3": {
19
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
20
+ "class": "Http\\Message\\MessageFactory\\SlimMessageFactory",
21
+ "type": "Http\\Message\\RequestFactory"
22
+ },
23
+ "2438c2d0-0658-441f-8855-ddaf0f87d54d": {
24
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
25
+ "class": "Http\\Message\\MessageFactory\\GuzzleMessageFactory",
26
+ "type": "Http\\Message\\MessageFactory",
27
+ "parameters": {
28
+ "depends": "GuzzleHttp\\Psr7\\Request"
29
+ }
30
+ },
31
+ "253aa08c-d705-46e7-b1d2-e28c97eef792": {
32
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
33
+ "class": "Http\\Message\\MessageFactory\\GuzzleMessageFactory",
34
+ "type": "Http\\Message\\RequestFactory",
35
+ "parameters": {
36
+ "depends": "GuzzleHttp\\Psr7\\Request"
37
+ }
38
+ },
39
+ "273a34f9-62f4-4ba1-9801-b1284d49ff89": {
40
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
41
+ "class": "Http\\Message\\StreamFactory\\GuzzleStreamFactory",
42
+ "type": "Http\\Message\\StreamFactory",
43
+ "parameters": {
44
+ "depends": "GuzzleHttp\\Psr7\\Stream"
45
+ }
46
+ },
47
+ "304b83db-b594-4d83-ae75-1f633adf92f7": {
48
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
49
+ "class": "Http\\Message\\UriFactory\\GuzzleUriFactory",
50
+ "type": "Http\\Message\\UriFactory",
51
+ "parameters": {
52
+ "depends": "GuzzleHttp\\Psr7\\Uri"
53
+ }
54
+ },
55
+ "3f4bc1cd-aa95-4702-9fa7-65408e471691": {
56
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
57
+ "class": "Http\\Message\\UriFactory\\DiactorosUriFactory",
58
+ "type": "Http\\Message\\UriFactory",
59
+ "parameters": {
60
+ "depends": "Zend\\Diactoros\\Uri"
61
+ }
62
+ },
63
+ "4672a6ee-ad9e-4109-a5d1-b7d46f26c7a1": {
64
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
65
+ "class": "Http\\Message\\MessageFactory\\SlimMessageFactory",
66
+ "type": "Http\\Message\\MessageFactory"
67
+ },
68
+ "6234e947-d3bd-43eb-97d5-7f9e22e6bb1b": {
69
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
70
+ "class": "Http\\Message\\MessageFactory\\DiactorosMessageFactory",
71
+ "type": "Http\\Message\\ResponseFactory",
72
+ "parameters": {
73
+ "depends": "Zend\\Diactoros\\Response"
74
+ }
75
+ },
76
+ "6a9ad6ce-d82c-470f-8e30-60f21d9d95bf": {
77
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
78
+ "class": "Http\\Message\\UriFactory\\SlimUriFactory",
79
+ "type": "Http\\Message\\UriFactory"
80
+ },
81
+ "72c2afa0-ea56-4d03-adb6-a9f241a8a734": {
82
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
83
+ "class": "Http\\Message\\StreamFactory\\SlimStreamFactory",
84
+ "type": "Http\\Message\\StreamFactory"
85
+ },
86
+ "95c1be8f-39fe-4abd-8351-92cb14379a75": {
87
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
88
+ "class": "Http\\Message\\StreamFactory\\DiactorosStreamFactory",
89
+ "type": "Http\\Message\\StreamFactory",
90
+ "parameters": {
91
+ "depends": "Zend\\Diactoros\\Stream"
92
+ }
93
+ },
94
+ "a018af27-7590-4dcf-83a1-497f95604cd6": {
95
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
96
+ "class": "Http\\Message\\MessageFactory\\GuzzleMessageFactory",
97
+ "type": "Http\\Message\\ResponseFactory",
98
+ "parameters": {
99
+ "depends": "GuzzleHttp\\Psr7\\Response"
100
+ }
101
+ },
102
+ "c07955b1-de46-43db-923b-d07fae9382cb": {
103
+ "_class": "Puli\\Discovery\\Binding\\ClassBinding",
104
+ "class": "Http\\Message\\MessageFactory\\DiactorosMessageFactory",
105
+ "type": "Http\\Message\\RequestFactory",
106
+ "parameters": {
107
+ "depends": "Zend\\Diactoros\\Request"
108
+ }
109
+ }
110
+ }
111
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/AutoBasicAuth.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Authentication;
4
+
5
+ use Http\Message\Authentication;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Authenticate a PSR-7 Request using Basic Auth based on credentials in the URI.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ final class AutoBasicAuth implements Authentication
14
+ {
15
+ /**
16
+ * Whether user info should be removed from the URI.
17
+ *
18
+ * @var bool
19
+ */
20
+ private $shouldRemoveUserInfo;
21
+
22
+ /**
23
+ * @param bool|true $shouldRremoveUserInfo
24
+ */
25
+ public function __construct($shouldRremoveUserInfo = true)
26
+ {
27
+ $this->shouldRemoveUserInfo = (bool) $shouldRremoveUserInfo;
28
+ }
29
+
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ public function authenticate(RequestInterface $request)
34
+ {
35
+ $uri = $request->getUri();
36
+ $userInfo = $uri->getUserInfo();
37
+
38
+ if (!empty($userInfo)) {
39
+ if ($this->shouldRemoveUserInfo) {
40
+ $request = $request->withUri($uri->withUserInfo(''));
41
+ }
42
+
43
+ $request = $request->withHeader('Authorization', sprintf('Basic %s', base64_encode($userInfo)));
44
+ }
45
+
46
+ return $request;
47
+ }
48
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/BasicAuth.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Authentication;
4
+
5
+ use Http\Message\Authentication;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Authenticate a PSR-7 Request using Basic Auth.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ final class BasicAuth implements Authentication
14
+ {
15
+ /**
16
+ * @var string
17
+ */
18
+ private $username;
19
+
20
+ /**
21
+ * @var string
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
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ public function authenticate(RequestInterface $request)
39
+ {
40
+ $header = sprintf('Basic %s', base64_encode(sprintf('%s:%s', $this->username, $this->password)));
41
+
42
+ return $request->withHeader('Authorization', $header);
43
+ }
44
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/Bearer.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Authentication;
4
+
5
+ use Http\Message\Authentication;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Authenticate a PSR-7 Request using a token.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ final class Bearer implements Authentication
14
+ {
15
+ /**
16
+ * @var string
17
+ */
18
+ private $token;
19
+
20
+ /**
21
+ * @param string $token
22
+ */
23
+ public function __construct($token)
24
+ {
25
+ $this->token = $token;
26
+ }
27
+
28
+ /**
29
+ * {@inheritdoc}
30
+ */
31
+ public function authenticate(RequestInterface $request)
32
+ {
33
+ $header = sprintf('Bearer %s', $this->token);
34
+
35
+ return $request->withHeader('Authorization', $header);
36
+ }
37
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/Chain.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Authentication;
4
+
5
+ use Http\Message\Authentication;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Authenticate a PSR-7 Request with a multiple authentication methods.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ final class Chain implements Authentication
14
+ {
15
+ /**
16
+ * @var Authentication[]
17
+ */
18
+ private $authenticationChain = [];
19
+
20
+ /**
21
+ * @param Authentication[] $authenticationChain
22
+ */
23
+ public function __construct(array $authenticationChain = [])
24
+ {
25
+ foreach ($authenticationChain as $authentication) {
26
+ if (!$authentication instanceof Authentication) {
27
+ throw new \InvalidArgumentException(
28
+ 'Members of the authentication chain must be of type Http\Message\Authentication'
29
+ );
30
+ }
31
+ }
32
+
33
+ $this->authenticationChain = $authenticationChain;
34
+ }
35
+
36
+ /**
37
+ * {@inheritdoc}
38
+ */
39
+ public function authenticate(RequestInterface $request)
40
+ {
41
+ foreach ($this->authenticationChain as $authentication) {
42
+ $request = $authentication->authenticate($request);
43
+ }
44
+
45
+ return $request;
46
+ }
47
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/Matching.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Authentication;
4
+
5
+ use Http\Message\Authentication;
6
+ use Http\Message\RequestMatcher\CallbackRequestMatcher;
7
+ use Psr\Http\Message\RequestInterface;
8
+
9
+ @trigger_error('The '.__NAMESPACE__.'\Matching class is deprecated since version 1.2 and will be removed in 2.0. Use Http\Message\Authentication\RequestConditional instead.', E_USER_DEPRECATED);
10
+
11
+ /**
12
+ * Authenticate a PSR-7 Request if the request is matching.
13
+ *
14
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
15
+ *
16
+ * @deprecated since since version 1.2, and will be removed in 2.0. Use {@link RequestConditional} instead.
17
+ */
18
+ final class Matching implements Authentication
19
+ {
20
+ /**
21
+ * @var Authentication
22
+ */
23
+ private $authentication;
24
+
25
+ /**
26
+ * @var CallbackRequestMatcher
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)) {
37
+ $matcher = function () {
38
+ return true;
39
+ };
40
+ }
41
+
42
+ $this->authentication = $authentication;
43
+ $this->matcher = new CallbackRequestMatcher($matcher);
44
+ }
45
+
46
+ /**
47
+ * {@inheritdoc}
48
+ */
49
+ public function authenticate(RequestInterface $request)
50
+ {
51
+ if ($this->matcher->matches($request)) {
52
+ return $this->authentication->authenticate($request);
53
+ }
54
+
55
+ return $request;
56
+ }
57
+
58
+ /**
59
+ * Creates a matching authentication for an URL.
60
+ *
61
+ * @param Authentication $authentication
62
+ * @param string $url
63
+ *
64
+ * @return self
65
+ */
66
+ public static function createUrlMatcher(Authentication $authentication, $url)
67
+ {
68
+ $matcher = function (RequestInterface $request) use ($url) {
69
+ return preg_match($url, $request->getRequestTarget());
70
+ };
71
+
72
+ return new static($authentication, $matcher);
73
+ }
74
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/QueryParam.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Authentication;
4
+
5
+ use Http\Message\Authentication;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Authenticate a PSR-7 Request by adding parameters to its query.
10
+ *
11
+ * Note: Although in some cases it can be useful, we do not recommend using query parameters for authentication.
12
+ * Credentials in the URL is generally unsafe as they are not encrypted, anyone can see them.
13
+ *
14
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
15
+ */
16
+ final class QueryParam implements Authentication
17
+ {
18
+ /**
19
+ * @var array
20
+ */
21
+ private $params = [];
22
+
23
+ /**
24
+ * @param array $params
25
+ */
26
+ public function __construct(array $params)
27
+ {
28
+ $this->params = $params;
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public function authenticate(RequestInterface $request)
35
+ {
36
+ $uri = $request->getUri();
37
+ $query = $uri->getQuery();
38
+ $params = [];
39
+
40
+ parse_str($query, $params);
41
+
42
+ $params = array_merge($params, $this->params);
43
+
44
+ $query = http_build_query($params);
45
+
46
+ $uri = $uri->withQuery($query);
47
+
48
+ return $request->withUri($uri);
49
+ }
50
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/RequestConditional.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Authentication;
4
+
5
+ use Http\Message\Authentication;
6
+ use Http\Message\RequestMatcher;
7
+ use Psr\Http\Message\RequestInterface;
8
+
9
+ /**
10
+ * Authenticate a PSR-7 Request if the request is matching the given request matcher.
11
+ *
12
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
+ */
14
+ final class RequestConditional implements Authentication
15
+ {
16
+ /**
17
+ * @var RequestMatcher
18
+ */
19
+ private $requestMatcher;
20
+
21
+ /**
22
+ * @var 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;
33
+ $this->authentication = $authentication;
34
+ }
35
+
36
+ /**
37
+ * {@inheritdoc}
38
+ */
39
+ public function authenticate(RequestInterface $request)
40
+ {
41
+ if ($this->requestMatcher->matches($request)) {
42
+ return $this->authentication->authenticate($request);
43
+ }
44
+
45
+ return $request;
46
+ }
47
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Authentication/Wsse.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Authentication;
4
+
5
+ use Http\Message\Authentication;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Authenticate a PSR-7 Request using WSSE.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ final class Wsse implements Authentication
14
+ {
15
+ /**
16
+ * @var string
17
+ */
18
+ private $username;
19
+
20
+ /**
21
+ * @var string
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
+ /**
36
+ * {@inheritdoc}
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"',
47
+ $this->username,
48
+ $digest,
49
+ $nonce,
50
+ $created
51
+ );
52
+
53
+ return $request
54
+ ->withHeader('Authorization', 'WSSE profile="UsernameToken"')
55
+ ->withHeader('X-WSSE', $wsse)
56
+ ;
57
+ }
58
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Builder/ResponseBuilder.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Builder;
4
+
5
+ use Psr\Http\Message\ResponseInterface;
6
+
7
+ /**
8
+ * Fills response object with values.
9
+ */
10
+ class ResponseBuilder
11
+ {
12
+ /**
13
+ * The response to be built.
14
+ *
15
+ * @var ResponseInterface
16
+ */
17
+ protected $response;
18
+
19
+ /**
20
+ * Create builder for the given response.
21
+ *
22
+ * @param ResponseInterface $response
23
+ */
24
+ public function __construct(ResponseInterface $response)
25
+ {
26
+ $this->response = $response;
27
+ }
28
+
29
+ /**
30
+ * Return response.
31
+ *
32
+ * @return ResponseInterface
33
+ */
34
+ public function getResponse()
35
+ {
36
+ return $this->response;
37
+ }
38
+
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
+ {
51
+ $status = array_shift($headers);
52
+ $this->setStatus($status);
53
+
54
+ foreach ($headers as $headerLine) {
55
+ $headerLine = trim($headerLine);
56
+ if ('' === $headerLine) {
57
+ continue;
58
+ }
59
+
60
+ $this->addHeader($headerLine);
61
+ }
62
+
63
+ return $this;
64
+ }
65
+
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
+ {
78
+ if (!(is_string($headers)
79
+ || (is_object($headers) && method_exists($headers, '__toString')))
80
+ ) {
81
+ throw new \InvalidArgumentException(
82
+ sprintf(
83
+ '%s expects parameter 1 to be a string, %s given',
84
+ __METHOD__,
85
+ is_object($headers) ? get_class($headers) : gettype($headers)
86
+ )
87
+ );
88
+ }
89
+
90
+ $this->setHeadersFromArray(explode("\r\n", $headers));
91
+
92
+ return $this;
93
+ }
94
+
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
+ {
106
+ $parts = explode(' ', $statusLine, 3);
107
+ if (count($parts) < 2 || strpos(strtolower($parts[0]), 'http/') !== 0) {
108
+ throw new \InvalidArgumentException(
109
+ sprintf('"%s" is not a valid HTTP status line', $statusLine)
110
+ );
111
+ }
112
+
113
+ $reasonPhrase = count($parts) > 2 ? $parts[2] : '';
114
+ $this->response = $this->response
115
+ ->withStatus((int) $parts[1], $reasonPhrase)
116
+ ->withProtocolVersion(substr($parts[0], 5));
117
+
118
+ return $this;
119
+ }
120
+
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
+ {
132
+ $parts = explode(':', $headerLine, 2);
133
+ if (count($parts) !== 2) {
134
+ throw new \InvalidArgumentException(
135
+ sprintf('"%s" is not a valid HTTP header line', $headerLine)
136
+ );
137
+ }
138
+ $name = trim($parts[0]);
139
+ $value = trim($parts[1]);
140
+ if ($this->response->hasHeader($name)) {
141
+ $this->response = $this->response->withAddedHeader($name, $value);
142
+ } else {
143
+ $this->response = $this->response->withHeader($name, $value);
144
+ }
145
+
146
+ return $this;
147
+ }
148
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Cookie.php ADDED
@@ -0,0 +1,526 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ /**
6
+ * Cookie Value Object.
7
+ *
8
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
9
+ *
10
+ * @see http://tools.ietf.org/search/rfc6265
11
+ */
12
+ final class Cookie
13
+ {
14
+ /**
15
+ * @var string
16
+ */
17
+ private $name;
18
+
19
+ /**
20
+ * @var string|null
21
+ */
22
+ private $value;
23
+
24
+ /**
25
+ * @var int|null
26
+ */
27
+ private $maxAge;
28
+
29
+ /**
30
+ * @var string|null
31
+ */
32
+ private $domain;
33
+
34
+ /**
35
+ * @var string
36
+ */
37
+ private $path;
38
+
39
+ /**
40
+ * @var bool
41
+ */
42
+ private $secure;
43
+
44
+ /**
45
+ * @var bool
46
+ */
47
+ private $httpOnly;
48
+
49
+ /**
50
+ * Expires attribute is HTTP 1.0 only and should be avoided.
51
+ *
52
+ * @var \DateTime|null
53
+ */
54
+ private $expires;
55
+
56
+ /**
57
+ * @param string $name
58
+ * @param string|null $value
59
+ * @param int $maxAge
60
+ * @param string|null $domain
61
+ * @param string|null $path
62
+ * @param bool $secure
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,
70
+ $value = null,
71
+ $maxAge = null,
72
+ $domain = null,
73
+ $path = null,
74
+ $secure = false,
75
+ $httpOnly = false,
76
+ \DateTime $expires = null
77
+ ) {
78
+ $this->validateName($name);
79
+ $this->validateValue($value);
80
+ $this->validateMaxAge($maxAge);
81
+
82
+ $this->name = $name;
83
+ $this->value = $value;
84
+ $this->maxAge = $maxAge;
85
+ $this->expires = $expires;
86
+ $this->domain = $this->normalizeDomain($domain);
87
+ $this->path = $this->normalizePath($path);
88
+ $this->secure = (bool) $secure;
89
+ $this->httpOnly = (bool) $httpOnly;
90
+ }
91
+
92
+ /**
93
+ * Creates a new cookie without any attribute validation.
94
+ *
95
+ * @param string $name
96
+ * @param string|null $value
97
+ * @param int $maxAge
98
+ * @param string|null $domain
99
+ * @param string|null $path
100
+ * @param bool $secure
101
+ * @param bool $httpOnly
102
+ * @param \DateTime|null $expires Expires attribute is HTTP 1.0 only and should be avoided.
103
+ */
104
+ public static function createWithoutValidation(
105
+ $name,
106
+ $value = null,
107
+ $maxAge = null,
108
+ $domain = null,
109
+ $path = null,
110
+ $secure = false,
111
+ $httpOnly = false,
112
+ \DateTime $expires = null
113
+ ) {
114
+ $cookie = new self('name', null, null, $domain, $path, $secure, $httpOnly, $expires);
115
+ $cookie->name = $name;
116
+ $cookie->value = $value;
117
+ $cookie->maxAge = $maxAge;
118
+
119
+ return $cookie;
120
+ }
121
+
122
+ /**
123
+ * Returns the name.
124
+ *
125
+ * @return string
126
+ */
127
+ public function getName()
128
+ {
129
+ return $this->name;
130
+ }
131
+
132
+ /**
133
+ * Returns the value.
134
+ *
135
+ * @return string|null
136
+ */
137
+ public function getValue()
138
+ {
139
+ return $this->value;
140
+ }
141
+
142
+ /**
143
+ * Checks if there is a value.
144
+ *
145
+ * @return bool
146
+ */
147
+ public function hasValue()
148
+ {
149
+ return isset($this->value);
150
+ }
151
+
152
+ /**
153
+ * Sets the value.
154
+ *
155
+ * @param string|null $value
156
+ *
157
+ * @return Cookie
158
+ */
159
+ public function withValue($value)
160
+ {
161
+ $this->validateValue($value);
162
+
163
+ $new = clone $this;
164
+ $new->value = $value;
165
+
166
+ return $new;
167
+ }
168
+
169
+ /**
170
+ * Returns the max age.
171
+ *
172
+ * @return int|null
173
+ */
174
+ public function getMaxAge()
175
+ {
176
+ return $this->maxAge;
177
+ }
178
+
179
+ /**
180
+ * Checks if there is a max age.
181
+ *
182
+ * @return bool
183
+ */
184
+ public function hasMaxAge()
185
+ {
186
+ return isset($this->maxAge);
187
+ }
188
+
189
+ /**
190
+ * Sets the max age.
191
+ *
192
+ * @param int|null $maxAge
193
+ *
194
+ * @return Cookie
195
+ */
196
+ public function withMaxAge($maxAge)
197
+ {
198
+ $this->validateMaxAge($maxAge);
199
+
200
+ $new = clone $this;
201
+ $new->maxAge = $maxAge;
202
+
203
+ return $new;
204
+ }
205
+
206
+ /**
207
+ * Returns the expiration time.
208
+ *
209
+ * @return \DateTime|null
210
+ */
211
+ public function getExpires()
212
+ {
213
+ return $this->expires;
214
+ }
215
+
216
+ /**
217
+ * Checks if there is an expiration time.
218
+ *
219
+ * @return bool
220
+ */
221
+ public function hasExpires()
222
+ {
223
+ return isset($this->expires);
224
+ }
225
+
226
+ /**
227
+ * Sets the expires.
228
+ *
229
+ * @param \DateTime|null $expires
230
+ *
231
+ * @return Cookie
232
+ */
233
+ public function withExpires(\DateTime $expires = null)
234
+ {
235
+ $new = clone $this;
236
+ $new->expires = $expires;
237
+
238
+ return $new;
239
+ }
240
+
241
+ /**
242
+ * Checks if the cookie is expired.
243
+ *
244
+ * @return bool
245
+ */
246
+ public function isExpired()
247
+ {
248
+ return isset($this->expires) and $this->expires < new \DateTime();
249
+ }
250
+
251
+ /**
252
+ * Returns the domain.
253
+ *
254
+ * @return string|null
255
+ */
256
+ public function getDomain()
257
+ {
258
+ return $this->domain;
259
+ }
260
+
261
+ /**
262
+ * Checks if there is a domain.
263
+ *
264
+ * @return bool
265
+ */
266
+ public function hasDomain()
267
+ {
268
+ return isset($this->domain);
269
+ }
270
+
271
+ /**
272
+ * Sets the domain.
273
+ *
274
+ * @param string|null $domain
275
+ *
276
+ * @return Cookie
277
+ */
278
+ public function withDomain($domain)
279
+ {
280
+ $new = clone $this;
281
+ $new->domain = $this->normalizeDomain($domain);
282
+
283
+ return $new;
284
+ }
285
+
286
+ /**
287
+ * Checks whether this cookie is meant for this domain.
288
+ *
289
+ * @see http://tools.ietf.org/html/rfc6265#section-5.1.3
290
+ *
291
+ * @param string $domain
292
+ *
293
+ * @return bool
294
+ */
295
+ public function matchDomain($domain)
296
+ {
297
+ // Domain is not set or exact match
298
+ if (!$this->hasDomain() || strcasecmp($domain, $this->domain) === 0) {
299
+ return true;
300
+ }
301
+
302
+ // Domain is not an IP address
303
+ if (filter_var($domain, FILTER_VALIDATE_IP)) {
304
+ return false;
305
+ }
306
+
307
+ return (bool) preg_match(sprintf('/\b%s$/i', preg_quote($this->domain)), $domain);
308
+ }
309
+
310
+ /**
311
+ * Returns the path.
312
+ *
313
+ * @return string
314
+ */
315
+ public function getPath()
316
+ {
317
+ return $this->path;
318
+ }
319
+
320
+ /**
321
+ * Sets the path.
322
+ *
323
+ * @param string|null $path
324
+ *
325
+ * @return Cookie
326
+ */
327
+ public function withPath($path)
328
+ {
329
+ $new = clone $this;
330
+ $new->path = $this->normalizePath($path);
331
+
332
+ return $new;
333
+ }
334
+
335
+ /**
336
+ * Checks whether this cookie is meant for this path.
337
+ *
338
+ * @see http://tools.ietf.org/html/rfc6265#section-5.1.4
339
+ *
340
+ * @param string $path
341
+ *
342
+ * @return bool
343
+ */
344
+ public function matchPath($path)
345
+ {
346
+ return $this->path === $path || (strpos($path, rtrim($this->path, '/').'/') === 0);
347
+ }
348
+
349
+ /**
350
+ * Checks whether this cookie may only be sent over HTTPS.
351
+ *
352
+ * @return bool
353
+ */
354
+ public function isSecure()
355
+ {
356
+ return $this->secure;
357
+ }
358
+
359
+ /**
360
+ * Sets whether this cookie should only be sent over HTTPS.
361
+ *
362
+ * @param bool $secure
363
+ *
364
+ * @return Cookie
365
+ */
366
+ public function withSecure($secure)
367
+ {
368
+ $new = clone $this;
369
+ $new->secure = (bool) $secure;
370
+
371
+ return $new;
372
+ }
373
+
374
+ /**
375
+ * Check whether this cookie may not be accessed through Javascript.
376
+ *
377
+ * @return bool
378
+ */
379
+ public function isHttpOnly()
380
+ {
381
+ return $this->httpOnly;
382
+ }
383
+
384
+ /**
385
+ * Sets whether this cookie may not be accessed through Javascript.
386
+ *
387
+ * @param bool $httpOnly
388
+ *
389
+ * @return Cookie
390
+ */
391
+ public function withHttpOnly($httpOnly)
392
+ {
393
+ $new = clone $this;
394
+ $new->httpOnly = (bool) $httpOnly;
395
+
396
+ return $new;
397
+ }
398
+
399
+ /**
400
+ * Checks if this cookie represents the same cookie as $cookie.
401
+ *
402
+ * This does not compare the values, only name, domain and path.
403
+ *
404
+ * @param Cookie $cookie
405
+ *
406
+ * @return bool
407
+ */
408
+ public function match(Cookie $cookie)
409
+ {
410
+ return $this->name === $cookie->name && $this->domain === $cookie->domain and $this->path === $cookie->path;
411
+ }
412
+
413
+ /**
414
+ * Validates cookie attributes.
415
+ *
416
+ * @return bool
417
+ */
418
+ public function isValid()
419
+ {
420
+ try {
421
+ $this->validateName($this->name);
422
+ $this->validateValue($this->value);
423
+ $this->validateMaxAge($this->maxAge);
424
+ } catch (\InvalidArgumentException $e) {
425
+ return false;
426
+ }
427
+
428
+ return true;
429
+ }
430
+
431
+ /**
432
+ * Validates the name attribute.
433
+ *
434
+ * @see http://tools.ietf.org/search/rfc2616#section-2.2
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
+ {
442
+ if (strlen($name) < 1) {
443
+ throw new \InvalidArgumentException('The name cannot be empty');
444
+ }
445
+
446
+ // Name attribute is a token as per spec in RFC 2616
447
+ if (preg_match('/[\x00-\x20\x22\x28-\x29\x2C\x2F\x3A-\x40\x5B-\x5D\x7B\x7D\x7F]/', $name)) {
448
+ throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name));
449
+ }
450
+ }
451
+
452
+ /**
453
+ * Validates a value.
454
+ *
455
+ * @see http://tools.ietf.org/html/rfc6265#section-4.1.1
456
+ *
457
+ * @param string|null $value
458
+ *
459
+ * @throws \InvalidArgumentException If the value contains invalid characters.
460
+ */
461
+ private function validateValue($value)
462
+ {
463
+ if (isset($value)) {
464
+ if (preg_match('/[^\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]/', $value)) {
465
+ throw new \InvalidArgumentException(sprintf('The cookie value "%s" contains invalid characters.', $value));
466
+ }
467
+ }
468
+ }
469
+
470
+ /**
471
+ * Validates a Max-Age attribute.
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
+ {
479
+ if (isset($maxAge)) {
480
+ if (!is_int($maxAge)) {
481
+ throw new \InvalidArgumentException('Max-Age must be integer');
482
+ }
483
+ }
484
+ }
485
+
486
+ /**
487
+ * Remove the leading '.' and lowercase the domain as per spec in RFC 6265.
488
+ *
489
+ * @see http://tools.ietf.org/html/rfc6265#section-4.1.2.3
490
+ * @see http://tools.ietf.org/html/rfc6265#section-5.1.3
491
+ * @see http://tools.ietf.org/html/rfc6265#section-5.2.3
492
+ *
493
+ * @param string|null $domain
494
+ *
495
+ * @return string
496
+ */
497
+ private function normalizeDomain($domain)
498
+ {
499
+ if (isset($domain)) {
500
+ $domain = ltrim(strtolower($domain), '.');
501
+ }
502
+
503
+ return $domain;
504
+ }
505
+
506
+ /**
507
+ * Processes path as per spec in RFC 6265.
508
+ *
509
+ * @see http://tools.ietf.org/html/rfc6265#section-5.1.4
510
+ * @see http://tools.ietf.org/html/rfc6265#section-5.2.4
511
+ *
512
+ * @param string|null $path
513
+ *
514
+ * @return string
515
+ */
516
+ private function normalizePath($path)
517
+ {
518
+ $path = rtrim($path, '/');
519
+
520
+ if (empty($path) or substr($path, 0, 1) !== '/') {
521
+ $path = '/';
522
+ }
523
+
524
+ return $path;
525
+ }
526
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/CookieJar.php ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ /**
6
+ * Cookie Jar holds a set of Cookies.
7
+ *
8
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
9
+ */
10
+ final class CookieJar implements \Countable, \IteratorAggregate
11
+ {
12
+ /**
13
+ * @var \SplObjectStorage
14
+ */
15
+ protected $cookies;
16
+
17
+ public function __construct()
18
+ {
19
+ $this->cookies = new \SplObjectStorage();
20
+ }
21
+
22
+ /**
23
+ * Checks if there is a cookie.
24
+ *
25
+ * @param Cookie $cookie
26
+ *
27
+ * @return bool
28
+ */
29
+ public function hasCookie(Cookie $cookie)
30
+ {
31
+ return $this->cookies->contains($cookie);
32
+ }
33
+
34
+ /**
35
+ * Adds a cookie.
36
+ *
37
+ * @param Cookie $cookie
38
+ */
39
+ public function addCookie(Cookie $cookie)
40
+ {
41
+ if (!$this->hasCookie($cookie)) {
42
+ $cookies = $this->getMatchingCookies($cookie);
43
+
44
+ foreach ($cookies as $matchingCookie) {
45
+ if ($cookie->getValue() !== $matchingCookie->getValue() || $cookie->getMaxAge() > $matchingCookie->getMaxAge()) {
46
+ $this->removeCookie($matchingCookie);
47
+
48
+ continue;
49
+ }
50
+ }
51
+
52
+ if ($cookie->hasValue()) {
53
+ $this->cookies->attach($cookie);
54
+ }
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Removes a cookie.
60
+ *
61
+ * @param Cookie $cookie
62
+ */
63
+ public function removeCookie(Cookie $cookie)
64
+ {
65
+ $this->cookies->detach($cookie);
66
+ }
67
+
68
+ /**
69
+ * Returns the cookies.
70
+ *
71
+ * @return Cookie[]
72
+ */
73
+ public function getCookies()
74
+ {
75
+ $match = function ($matchCookie) {
76
+ return true;
77
+ };
78
+
79
+ return $this->findMatchingCookies($match);
80
+ }
81
+
82
+ /**
83
+ * Returns all matching cookies.
84
+ *
85
+ * @param Cookie $cookie
86
+ *
87
+ * @return Cookie[]
88
+ */
89
+ public function getMatchingCookies(Cookie $cookie)
90
+ {
91
+ $match = function ($matchCookie) use ($cookie) {
92
+ return $matchCookie->match($cookie);
93
+ };
94
+
95
+ return $this->findMatchingCookies($match);
96
+ }
97
+
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
+
109
+ foreach ($this->cookies as $cookie) {
110
+ if ($match($cookie)) {
111
+ $cookies[] = $cookie;
112
+ }
113
+ }
114
+
115
+ return $cookies;
116
+ }
117
+
118
+ /**
119
+ * Checks if there are cookies.
120
+ *
121
+ * @return bool
122
+ */
123
+ public function hasCookies()
124
+ {
125
+ return $this->cookies->count() > 0;
126
+ }
127
+
128
+ /**
129
+ * Sets the cookies and removes any previous one.
130
+ *
131
+ * @param Cookie[] $cookies
132
+ */
133
+ public function setCookies(array $cookies)
134
+ {
135
+ $this->clear();
136
+ $this->addCookies($cookies);
137
+ }
138
+
139
+ /**
140
+ * Adds some cookies.
141
+ *
142
+ * @param Cookie[] $cookies
143
+ */
144
+ public function addCookies(array $cookies)
145
+ {
146
+ foreach ($cookies as $cookie) {
147
+ $this->addCookie($cookie);
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Removes some cookies.
153
+ *
154
+ * @param Cookie[] $cookies
155
+ */
156
+ public function removeCookies(array $cookies)
157
+ {
158
+ foreach ($cookies as $cookie) {
159
+ $this->removeCookie($cookie);
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Removes cookies which match the given parameters.
165
+ *
166
+ * Null means that parameter should not be matched
167
+ *
168
+ * @param string|null $name
169
+ * @param string|null $domain
170
+ * @param string|null $path
171
+ */
172
+ public function removeMatchingCookies($name = null, $domain = null, $path = null)
173
+ {
174
+ $match = function ($cookie) use ($name, $domain, $path) {
175
+ $match = true;
176
+
177
+ if (isset($name)) {
178
+ $match = $match && ($cookie->getName() === $name);
179
+ }
180
+
181
+ if (isset($domain)) {
182
+ $match = $match && $cookie->matchDomain($domain);
183
+ }
184
+
185
+ if (isset($path)) {
186
+ $match = $match && $cookie->matchPath($path);
187
+ }
188
+
189
+ return $match;
190
+ };
191
+
192
+ $cookies = $this->findMatchingCookies($match);
193
+
194
+ $this->removeCookies($cookies);
195
+ }
196
+
197
+ /**
198
+ * Removes all cookies.
199
+ */
200
+ public function clear()
201
+ {
202
+ $this->cookies = new \SplObjectStorage();
203
+ }
204
+
205
+ /**
206
+ * {@inheritdoc}
207
+ */
208
+ public function count()
209
+ {
210
+ return $this->cookies->count();
211
+ }
212
+
213
+ /**
214
+ * {@inheritdoc}
215
+ */
216
+ public function getIterator()
217
+ {
218
+ return clone $this->cookies;
219
+ }
220
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/CookieUtil.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ use Http\Message\Exception\UnexpectedValueException;
6
+
7
+ final class CookieUtil
8
+ {
9
+ /**
10
+ * Handles dates as defined by RFC 2616 section 3.3.1, and also some other
11
+ * non-standard, but common formats.
12
+ *
13
+ * @var array
14
+ */
15
+ private static $dateFormats = [
16
+ 'D, d M y H:i:s T',
17
+ 'D, d M Y H:i:s T',
18
+ 'D, d-M-y H:i:s T',
19
+ 'D, d-M-Y H:i:s T',
20
+ 'D, d-m-y H:i:s T',
21
+ 'D, d-m-Y H:i:s T',
22
+ 'D M j G:i:s Y',
23
+ 'D M d H:i:s Y T',
24
+ ];
25
+
26
+ /**
27
+ * @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/BrowserKit/Cookie.php
28
+ *
29
+ * @param string $dateValue
30
+ *
31
+ * @return \DateTime
32
+ *
33
+ * @throws UnexpectedValueException if we cannot parse the cookie date string.
34
+ */
35
+ public static function parseDate($dateValue)
36
+ {
37
+ foreach (self::$dateFormats as $dateFormat) {
38
+ if (false !== $date = \DateTime::createFromFormat($dateFormat, $dateValue, new \DateTimeZone('GMT'))) {
39
+ return $date;
40
+ }
41
+ }
42
+
43
+ // attempt a fallback for unusual formatting
44
+ if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) {
45
+ return $date;
46
+ }
47
+
48
+ throw new UnexpectedValueException(sprintf(
49
+ 'Unparseable cookie date string "%s"',
50
+ $dateValue
51
+ ));
52
+ }
53
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Decorator/MessageDecorator.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Decorator;
4
+
5
+ use Psr\Http\Message\MessageInterface;
6
+ use Psr\Http\Message\StreamInterface;
7
+
8
+ /**
9
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
10
+ */
11
+ trait MessageDecorator
12
+ {
13
+ /**
14
+ * @var MessageInterface
15
+ */
16
+ private $message;
17
+
18
+ /**
19
+ * Returns the decorated message.
20
+ *
21
+ * Since the underlying Message is immutable as well
22
+ * exposing it is not an issue, because it's state cannot be altered
23
+ *
24
+ * @return MessageInterface
25
+ */
26
+ public function getMessage()
27
+ {
28
+ return $this->message;
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public function getProtocolVersion()
35
+ {
36
+ return $this->message->getProtocolVersion();
37
+ }
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public function withProtocolVersion($version)
43
+ {
44
+ $new = clone $this;
45
+ $new->message = $this->message->withProtocolVersion($version);
46
+
47
+ return $new;
48
+ }
49
+
50
+ /**
51
+ * {@inheritdoc}
52
+ */
53
+ public function getHeaders()
54
+ {
55
+ return $this->message->getHeaders();
56
+ }
57
+
58
+ /**
59
+ * {@inheritdoc}
60
+ */
61
+ public function hasHeader($header)
62
+ {
63
+ return $this->message->hasHeader($header);
64
+ }
65
+
66
+ /**
67
+ * {@inheritdoc}
68
+ */
69
+ public function getHeader($header)
70
+ {
71
+ return $this->message->getHeader($header);
72
+ }
73
+
74
+ /**
75
+ * {@inheritdoc}
76
+ */
77
+ public function getHeaderLine($header)
78
+ {
79
+ return $this->message->getHeaderLine($header);
80
+ }
81
+
82
+ /**
83
+ * {@inheritdoc}
84
+ */
85
+ public function withHeader($header, $value)
86
+ {
87
+ $new = clone $this;
88
+ $new->message = $this->message->withHeader($header, $value);
89
+
90
+ return $new;
91
+ }
92
+
93
+ /**
94
+ * {@inheritdoc}
95
+ */
96
+ public function withAddedHeader($header, $value)
97
+ {
98
+ $new = clone $this;
99
+ $new->message = $this->message->withAddedHeader($header, $value);
100
+
101
+ return $new;
102
+ }
103
+
104
+ /**
105
+ * {@inheritdoc}
106
+ */
107
+ public function withoutHeader($header)
108
+ {
109
+ $new = clone $this;
110
+ $new->message = $this->message->withoutHeader($header);
111
+
112
+ return $new;
113
+ }
114
+
115
+ /**
116
+ * {@inheritdoc}
117
+ */
118
+ public function getBody()
119
+ {
120
+ return $this->message->getBody();
121
+ }
122
+
123
+ /**
124
+ * {@inheritdoc}
125
+ */
126
+ public function withBody(StreamInterface $body)
127
+ {
128
+ $new = clone $this;
129
+ $new->message = $this->message->withBody($body);
130
+
131
+ return $new;
132
+ }
133
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Decorator/RequestDecorator.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Decorator;
4
+
5
+ use Psr\Http\Message\RequestInterface;
6
+ use Psr\Http\Message\UriInterface;
7
+
8
+ /**
9
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
10
+ */
11
+ trait RequestDecorator
12
+ {
13
+ use MessageDecorator {
14
+ getMessage as getRequest;
15
+ }
16
+
17
+ /**
18
+ * Exchanges the underlying request with another.
19
+ *
20
+ * @param RequestInterface $request
21
+ *
22
+ * @return self
23
+ */
24
+ public function withRequest(RequestInterface $request)
25
+ {
26
+ $new = clone $this;
27
+ $new->message = $request;
28
+
29
+ return $new;
30
+ }
31
+
32
+ /**
33
+ * {@inheritdoc}
34
+ */
35
+ public function getRequestTarget()
36
+ {
37
+ return $this->message->getRequestTarget();
38
+ }
39
+
40
+ /**
41
+ * {@inheritdoc}
42
+ */
43
+ public function withRequestTarget($requestTarget)
44
+ {
45
+ $new = clone $this;
46
+ $new->message = $this->message->withRequestTarget($requestTarget);
47
+
48
+ return $new;
49
+ }
50
+
51
+ /**
52
+ * {@inheritdoc}
53
+ */
54
+ public function getMethod()
55
+ {
56
+ return $this->message->getMethod();
57
+ }
58
+
59
+ /**
60
+ * {@inheritdoc}
61
+ */
62
+ public function withMethod($method)
63
+ {
64
+ $new = clone $this;
65
+ $new->message = $this->message->withMethod($method);
66
+
67
+ return $new;
68
+ }
69
+
70
+ /**
71
+ * {@inheritdoc}
72
+ */
73
+ public function getUri()
74
+ {
75
+ return $this->message->getUri();
76
+ }
77
+
78
+ /**
79
+ * {@inheritdoc}
80
+ */
81
+ public function withUri(UriInterface $uri, $preserveHost = false)
82
+ {
83
+ $new = clone $this;
84
+ $new->message = $this->message->withUri($uri, $preserveHost);
85
+
86
+ return $new;
87
+ }
88
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Decorator/ResponseDecorator.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Decorator;
4
+
5
+ use Psr\Http\Message\ResponseInterface;
6
+
7
+ /**
8
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
9
+ */
10
+ trait ResponseDecorator
11
+ {
12
+ use MessageDecorator {
13
+ getMessage as getResponse;
14
+ }
15
+
16
+ /**
17
+ * Exchanges the underlying response with another.
18
+ *
19
+ * @param ResponseInterface $response
20
+ *
21
+ * @return self
22
+ */
23
+ public function withResponse(ResponseInterface $response)
24
+ {
25
+ $new = clone $this;
26
+ $new->message = $response;
27
+
28
+ return $new;
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public function getStatusCode()
35
+ {
36
+ return $this->message->getStatusCode();
37
+ }
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public function withStatus($code, $reasonPhrase = '')
43
+ {
44
+ $new = clone $this;
45
+ $new->message = $this->message->withStatus($code, $reasonPhrase);
46
+
47
+ return $new;
48
+ }
49
+
50
+ /**
51
+ * {@inheritdoc}
52
+ */
53
+ public function getReasonPhrase()
54
+ {
55
+ return $this->message->getReasonPhrase();
56
+ }
57
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Decorator/StreamDecorator.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Decorator;
4
+
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * Decorates a stream.
9
+ *
10
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
+ */
12
+ trait StreamDecorator
13
+ {
14
+ /**
15
+ * @var StreamInterface
16
+ */
17
+ protected $stream;
18
+
19
+ /**
20
+ * {@inheritdoc}
21
+ */
22
+ public function __toString()
23
+ {
24
+ return $this->stream->__toString();
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ public function close()
31
+ {
32
+ $this->stream->close();
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ public function detach()
39
+ {
40
+ return $this->stream->detach();
41
+ }
42
+
43
+ /**
44
+ * {@inheritdoc}
45
+ */
46
+ public function getSize()
47
+ {
48
+ return $this->stream->getSize();
49
+ }
50
+
51
+ /**
52
+ * {@inheritdoc}
53
+ */
54
+ public function tell()
55
+ {
56
+ return $this->stream->tell();
57
+ }
58
+
59
+ /**
60
+ * {@inheritdoc}
61
+ */
62
+ public function eof()
63
+ {
64
+ return $this->stream->eof();
65
+ }
66
+
67
+ /**
68
+ * {@inheritdoc}
69
+ */
70
+ public function isSeekable()
71
+ {
72
+ return $this->stream->isSeekable();
73
+ }
74
+
75
+ /**
76
+ * {@inheritdoc}
77
+ */
78
+ public function seek($offset, $whence = SEEK_SET)
79
+ {
80
+ $this->stream->seek($offset, $whence);
81
+ }
82
+
83
+ /**
84
+ * {@inheritdoc}
85
+ */
86
+ public function rewind()
87
+ {
88
+ $this->stream->rewind();
89
+ }
90
+
91
+ /**
92
+ * {@inheritdoc}
93
+ */
94
+ public function isWritable()
95
+ {
96
+ return $this->stream->isWritable();
97
+ }
98
+
99
+ /**
100
+ * {@inheritdoc}
101
+ */
102
+ public function write($string)
103
+ {
104
+ return $this->stream->write($string);
105
+ }
106
+
107
+ /**
108
+ * {@inheritdoc}
109
+ */
110
+ public function isReadable()
111
+ {
112
+ return $this->stream->isReadable();
113
+ }
114
+
115
+ /**
116
+ * {@inheritdoc}
117
+ */
118
+ public function read($length)
119
+ {
120
+ return $this->stream->read($length);
121
+ }
122
+
123
+ /**
124
+ * {@inheritdoc}
125
+ */
126
+ public function getContents()
127
+ {
128
+ return $this->stream->getContents();
129
+ }
130
+
131
+ /**
132
+ * {@inheritdoc}
133
+ */
134
+ public function getMetadata($key = null)
135
+ {
136
+ return $this->stream->getMetadata($key);
137
+ }
138
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/ChunkStream.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding;
4
+
5
+ /**
6
+ * Transform a regular stream into a chunked one.
7
+ *
8
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
9
+ */
10
+ class ChunkStream extends FilteredStream
11
+ {
12
+ /**
13
+ * {@inheritdoc}
14
+ */
15
+ protected function readFilter()
16
+ {
17
+ return 'chunk';
18
+ }
19
+
20
+ /**
21
+ * {@inheritdoc}
22
+ */
23
+ protected function writeFilter()
24
+ {
25
+ return 'dechunk';
26
+ }
27
+
28
+ /**
29
+ * {@inheritdoc}
30
+ */
31
+ protected function fill()
32
+ {
33
+ parent::fill();
34
+
35
+ if ($this->stream->eof()) {
36
+ $this->buffer .= "0\r\n\r\n";
37
+ }
38
+ }
39
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/CompressStream.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding;
4
+
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * Stream compress (RFC 1950).
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class CompressStream extends FilteredStream
13
+ {
14
+ /**
15
+ * @param StreamInterface $stream
16
+ * @param int $level
17
+ */
18
+ public function __construct(StreamInterface $stream, $level = -1)
19
+ {
20
+ if (!extension_loaded('zlib')) {
21
+ throw new \RuntimeException('The zlib extension must be enabled to use this stream');
22
+ }
23
+
24
+ parent::__construct($stream, ['window' => 15, 'level' => $level], ['window' => 15]);
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ protected function readFilter()
31
+ {
32
+ return 'zlib.deflate';
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ protected function writeFilter()
39
+ {
40
+ return 'zlib.inflate';
41
+ }
42
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/DechunkStream.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding;
4
+
5
+ /**
6
+ * Decorate a stream which is chunked.
7
+ *
8
+ * Allow to decode a chunked stream
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class DechunkStream extends FilteredStream
13
+ {
14
+ /**
15
+ * {@inheritdoc}
16
+ */
17
+ protected function readFilter()
18
+ {
19
+ return 'dechunk';
20
+ }
21
+
22
+ /**
23
+ * {@inheritdoc}
24
+ */
25
+ protected function writeFilter()
26
+ {
27
+ return 'chunk';
28
+ }
29
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/DecompressStream.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding;
4
+
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * Stream decompress (RFC 1950).
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class DecompressStream extends FilteredStream
13
+ {
14
+ /**
15
+ * @param StreamInterface $stream
16
+ * @param int $level
17
+ */
18
+ public function __construct(StreamInterface $stream, $level = -1)
19
+ {
20
+ if (!extension_loaded('zlib')) {
21
+ throw new \RuntimeException('The zlib extension must be enabled to use this stream');
22
+ }
23
+
24
+ parent::__construct($stream, ['window' => 15], ['window' => 15, 'level' => $level]);
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ protected function readFilter()
31
+ {
32
+ return 'zlib.inflate';
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ protected function writeFilter()
39
+ {
40
+ return 'zlib.deflate';
41
+ }
42
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/DeflateStream.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding;
4
+
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * Stream deflate (RFC 1951).
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class DeflateStream extends FilteredStream
13
+ {
14
+ /**
15
+ * @param StreamInterface $stream
16
+ * @param int $level
17
+ */
18
+ public function __construct(StreamInterface $stream, $level = -1)
19
+ {
20
+ parent::__construct($stream, ['window' => -15, 'level' => $level], ['window' => -15]);
21
+ }
22
+
23
+ /**
24
+ * {@inheritdoc}
25
+ */
26
+ protected function readFilter()
27
+ {
28
+ return 'zlib.deflate';
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ protected function writeFilter()
35
+ {
36
+ return 'zlib.inflate';
37
+ }
38
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/Filter/Chunk.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding\Filter;
4
+
5
+ /**
6
+ * Userland implementation of the chunk stream filter.
7
+ *
8
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
9
+ */
10
+ class Chunk extends \php_user_filter
11
+ {
12
+ /**
13
+ * {@inheritdoc}
14
+ */
15
+ public function filter($in, $out, &$consumed, $closing)
16
+ {
17
+ while ($bucket = stream_bucket_make_writeable($in)) {
18
+ $lenbucket = stream_bucket_new($this->stream, dechex($bucket->datalen)."\r\n");
19
+ stream_bucket_append($out, $lenbucket);
20
+
21
+ $consumed += $bucket->datalen;
22
+ stream_bucket_append($out, $bucket);
23
+
24
+ $lenbucket = stream_bucket_new($this->stream, "\r\n");
25
+ stream_bucket_append($out, $lenbucket);
26
+ }
27
+
28
+ return PSFS_PASS_ON;
29
+ }
30
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/FilteredStream.php ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding;
4
+
5
+ use Clue\StreamFilter as Filter;
6
+ use Http\Message\Decorator\StreamDecorator;
7
+ use Psr\Http\Message\StreamInterface;
8
+
9
+ /**
10
+ * A filtered stream has a filter for filtering output and a filter for filtering input made to a underlying stream.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ abstract class FilteredStream implements StreamInterface
15
+ {
16
+ const BUFFER_SIZE = 8192;
17
+
18
+ use StreamDecorator;
19
+
20
+ /**
21
+ * @var callable
22
+ */
23
+ protected $readFilterCallback;
24
+
25
+ /**
26
+ * @var resource
27
+ *
28
+ * @deprecated since version 1.5, will be removed in 2.0
29
+ */
30
+ protected $readFilter;
31
+
32
+ /**
33
+ * @var callable
34
+ *
35
+ * @deprecated since version 1.5, will be removed in 2.0
36
+ */
37
+ protected $writeFilterCallback;
38
+
39
+ /**
40
+ * @var resource
41
+ *
42
+ * @deprecated since version 1.5, will be removed in 2.0
43
+ */
44
+ protected $writeFilter;
45
+
46
+ /**
47
+ * Internal buffer.
48
+ *
49
+ * @var string
50
+ */
51
+ protected $buffer = '';
52
+
53
+ /**
54
+ * @param StreamInterface $stream
55
+ * @param mixed|null $readFilterOptions
56
+ * @param mixed|null $writeFilterOptions deprecated since 1.5, will be removed in 2.0
57
+ */
58
+ public function __construct(StreamInterface $stream, $readFilterOptions = null, $writeFilterOptions = null)
59
+ {
60
+ $this->readFilterCallback = Filter\fun($this->readFilter(), $readFilterOptions);
61
+ $this->writeFilterCallback = Filter\fun($this->writeFilter(), $writeFilterOptions);
62
+
63
+ if (null !== $writeFilterOptions) {
64
+ @trigger_error('The $writeFilterOptions argument is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED);
65
+ }
66
+
67
+ $this->stream = $stream;
68
+ }
69
+
70
+ /**
71
+ * {@inheritdoc}
72
+ */
73
+ public function read($length)
74
+ {
75
+ if (strlen($this->buffer) >= $length) {
76
+ $read = substr($this->buffer, 0, $length);
77
+ $this->buffer = substr($this->buffer, $length);
78
+
79
+ return $read;
80
+ }
81
+
82
+ if ($this->stream->eof()) {
83
+ $buffer = $this->buffer;
84
+ $this->buffer = '';
85
+
86
+ return $buffer;
87
+ }
88
+
89
+ $read = $this->buffer;
90
+ $this->buffer = '';
91
+ $this->fill();
92
+
93
+ return $read.$this->read($length - strlen($read));
94
+ }
95
+
96
+ /**
97
+ * {@inheritdoc}
98
+ */
99
+ public function eof()
100
+ {
101
+ return $this->stream->eof() && $this->buffer === '';
102
+ }
103
+
104
+ /**
105
+ * Buffer is filled by reading underlying stream.
106
+ *
107
+ * Callback is reading once more even if the stream is ended.
108
+ * This allow to get last data in the PHP buffer otherwise this
109
+ * bug is present : https://bugs.php.net/bug.php?id=48725
110
+ */
111
+ protected function fill()
112
+ {
113
+ $readFilterCallback = $this->readFilterCallback;
114
+ $this->buffer .= $readFilterCallback($this->stream->read(self::BUFFER_SIZE));
115
+
116
+ if ($this->stream->eof()) {
117
+ $this->buffer .= $readFilterCallback();
118
+ }
119
+ }
120
+
121
+ /**
122
+ * {@inheritdoc}
123
+ */
124
+ public function getContents()
125
+ {
126
+ $buffer = '';
127
+
128
+ while (!$this->eof()) {
129
+ $buf = $this->read(self::BUFFER_SIZE);
130
+ // Using a loose equality here to match on '' and false.
131
+ if ($buf == null) {
132
+ break;
133
+ }
134
+
135
+ $buffer .= $buf;
136
+ }
137
+
138
+ return $buffer;
139
+ }
140
+
141
+ /**
142
+ * {@inheritdoc}
143
+ */
144
+ public function getSize()
145
+ {
146
+ return;
147
+ }
148
+
149
+ /**
150
+ * {@inheritdoc}
151
+ */
152
+ public function __toString()
153
+ {
154
+ return $this->getContents();
155
+ }
156
+
157
+ /**
158
+ * Returns the read filter name.
159
+ *
160
+ * @return string
161
+ *
162
+ * @deprecated since version 1.5, will be removed in 2.0
163
+ */
164
+ public function getReadFilter()
165
+ {
166
+ @trigger_error('The '.__CLASS__.'::'.__METHOD__.' method is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED);
167
+
168
+ return $this->readFilter();
169
+ }
170
+
171
+ /**
172
+ * Returns the write filter name.
173
+ *
174
+ * @return string
175
+ */
176
+ abstract protected function readFilter();
177
+
178
+ /**
179
+ * Returns the write filter name.
180
+ *
181
+ * @return string
182
+ *
183
+ * @deprecated since version 1.5, will be removed in 2.0
184
+ */
185
+ public function getWriteFilter()
186
+ {
187
+ @trigger_error('The '.__CLASS__.'::'.__METHOD__.' method is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED);
188
+
189
+ return $this->writeFilter();
190
+ }
191
+
192
+ /**
193
+ * Returns the write filter name.
194
+ *
195
+ * @return string
196
+ */
197
+ abstract protected function writeFilter();
198
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/GzipDecodeStream.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding;
4
+
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * Stream for decoding from gzip format (RFC 1952).
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class GzipDecodeStream extends FilteredStream
13
+ {
14
+ /**
15
+ * @param StreamInterface $stream
16
+ * @param int $level
17
+ */
18
+ public function __construct(StreamInterface $stream, $level = -1)
19
+ {
20
+ if (!extension_loaded('zlib')) {
21
+ throw new \RuntimeException('The zlib extension must be enabled to use this stream');
22
+ }
23
+
24
+ parent::__construct($stream, ['window' => 31], ['window' => 31, 'level' => $level]);
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ protected function readFilter()
31
+ {
32
+ return 'zlib.inflate';
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ protected function writeFilter()
39
+ {
40
+ return 'zlib.deflate';
41
+ }
42
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/GzipEncodeStream.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding;
4
+
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * Stream for encoding to gzip format (RFC 1952).
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class GzipEncodeStream extends FilteredStream
13
+ {
14
+ /**
15
+ * @param StreamInterface $stream
16
+ * @param int $level
17
+ */
18
+ public function __construct(StreamInterface $stream, $level = -1)
19
+ {
20
+ if (!extension_loaded('zlib')) {
21
+ throw new \RuntimeException('The zlib extension must be enabled to use this stream');
22
+ }
23
+
24
+ parent::__construct($stream, ['window' => 31, 'level' => $level], ['window' => 31]);
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ protected function readFilter()
31
+ {
32
+ return 'zlib.deflate';
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ protected function writeFilter()
39
+ {
40
+ return 'zlib.inflate';
41
+ }
42
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Encoding/InflateStream.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Encoding;
4
+
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * Stream inflate (RFC 1951).
9
+ *
10
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
11
+ */
12
+ class InflateStream extends FilteredStream
13
+ {
14
+ /**
15
+ * @param StreamInterface $stream
16
+ * @param int $level
17
+ */
18
+ public function __construct(StreamInterface $stream, $level = -1)
19
+ {
20
+ if (!extension_loaded('zlib')) {
21
+ throw new \RuntimeException('The zlib extension must be enabled to use this stream');
22
+ }
23
+
24
+ parent::__construct($stream, ['window' => -15], ['window' => -15, 'level' => $level]);
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ protected function readFilter()
31
+ {
32
+ return 'zlib.inflate';
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ protected function writeFilter()
39
+ {
40
+ return 'zlib.deflate';
41
+ }
42
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Exception.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ /**
6
+ * An interface implemented by all HTTP message related exceptions.
7
+ */
8
+ interface Exception
9
+ {
10
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Exception/UnexpectedValueException.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Exception;
4
+
5
+ use Http\Message\Exception;
6
+
7
+ final class UnexpectedValueException extends \UnexpectedValueException implements Exception
8
+ {
9
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Formatter.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ use Psr\Http\Message\RequestInterface;
6
+ use Psr\Http\Message\ResponseInterface;
7
+
8
+ /**
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
+ */
31
+ public function formatResponse(ResponseInterface $response);
32
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Formatter/CurlCommandFormatter.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Formatter;
4
+
5
+ use Http\Message\Formatter;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\ResponseInterface;
8
+
9
+ /**
10
+ * A formatter that prints a cURL command for HTTP requests.
11
+ *
12
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
13
+ */
14
+ class CurlCommandFormatter implements Formatter
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function formatRequest(RequestInterface $request)
20
+ {
21
+ $command = sprintf('curl %s', escapeshellarg((string) $request->getUri()->withFragment('')));
22
+ if ($request->getProtocolVersion() === '1.0') {
23
+ $command .= ' --http1.0';
24
+ } elseif ($request->getProtocolVersion() === '2.0') {
25
+ $command .= ' --http2';
26
+ }
27
+
28
+ $method = strtoupper($request->getMethod());
29
+ if ('HEAD' === $method) {
30
+ $command .= ' --head';
31
+ } elseif ('GET' !== $method) {
32
+ $command .= ' --request '.$method;
33
+ }
34
+
35
+ $command .= $this->getHeadersAsCommandOptions($request);
36
+
37
+ $body = $request->getBody();
38
+ if ($body->getSize() > 0) {
39
+ if (!$body->isSeekable()) {
40
+ return 'Cant format Request as cUrl command if body stream is not seekable.';
41
+ }
42
+ $command .= sprintf(' --data %s', escapeshellarg($body->__toString()));
43
+ $body->rewind();
44
+ }
45
+
46
+ return $command;
47
+ }
48
+
49
+ /**
50
+ * {@inheritdoc}
51
+ */
52
+ public function formatResponse(ResponseInterface $response)
53
+ {
54
+ return '';
55
+ }
56
+
57
+ /**
58
+ * @param RequestInterface $request
59
+ *
60
+ * @return string
61
+ */
62
+ private function getHeadersAsCommandOptions(RequestInterface $request)
63
+ {
64
+ $command = '';
65
+ foreach ($request->getHeaders() as $name => $values) {
66
+ if ('host' === strtolower($name) && $values[0] === $request->getUri()->getHost()) {
67
+ continue;
68
+ }
69
+
70
+ if ('user-agent' === strtolower($name)) {
71
+ $command .= sprintf(' -A %s', escapeshellarg($values[0]));
72
+ continue;
73
+ }
74
+
75
+ $command .= sprintf(' -H %s', escapeshellarg($name.': '.$request->getHeaderLine($name)));
76
+ }
77
+
78
+ return $command;
79
+ }
80
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Formatter;
4
+
5
+ use Http\Message\Formatter;
6
+ use Psr\Http\Message\MessageInterface;
7
+ use Psr\Http\Message\RequestInterface;
8
+ use Psr\Http\Message\ResponseInterface;
9
+
10
+ /**
11
+ * A formatter that prints the complete HTTP message.
12
+ *
13
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
14
+ */
15
+ class FullHttpMessageFormatter implements Formatter
16
+ {
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
+ /**
33
+ * {@inheritdoc}
34
+ */
35
+ public function formatRequest(RequestInterface $request)
36
+ {
37
+ $message = sprintf(
38
+ "%s %s HTTP/%s\n",
39
+ $request->getMethod(),
40
+ $request->getRequestTarget(),
41
+ $request->getProtocolVersion()
42
+ );
43
+
44
+ foreach ($request->getHeaders() as $name => $values) {
45
+ $message .= $name.': '.implode(', ', $values)."\n";
46
+ }
47
+
48
+ return $this->addBody($request, $message);
49
+ }
50
+
51
+ /**
52
+ * {@inheritdoc}
53
+ */
54
+ public function formatResponse(ResponseInterface $response)
55
+ {
56
+ $message = sprintf(
57
+ "HTTP/%s %s %s\n",
58
+ $response->getProtocolVersion(),
59
+ $response->getStatusCode(),
60
+ $response->getReasonPhrase()
61
+ );
62
+
63
+ foreach ($response->getHeaders() as $name => $values) {
64
+ $message .= $name.': '.implode(', ', $values)."\n";
65
+ }
66
+
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() || $this->maxBodyLength === 0) {
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Formatter/SimpleFormatter.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Formatter;
4
+
5
+ use Http\Message\Formatter;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\ResponseInterface;
8
+
9
+ /**
10
+ * Normalize a request or a response into a string or an array.
11
+ *
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ class SimpleFormatter implements Formatter
16
+ {
17
+ /**
18
+ * {@inheritdoc}
19
+ */
20
+ public function formatRequest(RequestInterface $request)
21
+ {
22
+ return sprintf(
23
+ '%s %s %s',
24
+ $request->getMethod(),
25
+ $request->getUri()->__toString(),
26
+ $request->getProtocolVersion()
27
+ );
28
+ }
29
+
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ public function formatResponse(ResponseInterface $response)
34
+ {
35
+ return sprintf(
36
+ '%s %s %s',
37
+ $response->getStatusCode(),
38
+ $response->getReasonPhrase(),
39
+ $response->getProtocolVersion()
40
+ );
41
+ }
42
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
+ {
17
+ /**
18
+ * @var DiactorosStreamFactory
19
+ */
20
+ private $streamFactory;
21
+
22
+ public function __construct()
23
+ {
24
+ $this->streamFactory = new DiactorosStreamFactory();
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ public function createRequest(
31
+ $method,
32
+ $uri,
33
+ array $headers = [],
34
+ $body = null,
35
+ $protocolVersion = '1.1'
36
+ ) {
37
+ return (new Request(
38
+ $uri,
39
+ $method,
40
+ $this->streamFactory->createStream($body),
41
+ $headers
42
+ ))->withProtocolVersion($protocolVersion);
43
+ }
44
+
45
+ /**
46
+ * {@inheritdoc}
47
+ */
48
+ public function createResponse(
49
+ $statusCode = 200,
50
+ $reasonPhrase = null,
51
+ array $headers = [],
52
+ $body = null,
53
+ $protocolVersion = '1.1'
54
+ ) {
55
+ return (new Response(
56
+ $this->streamFactory->createStream($body),
57
+ $statusCode,
58
+ $headers
59
+ ))->withProtocolVersion($protocolVersion);
60
+ }
61
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\MessageFactory;
4
+
5
+ use GuzzleHttp\Psr7\Request;
6
+ use GuzzleHttp\Psr7\Response;
7
+ use Http\Message\MessageFactory;
8
+
9
+ /**
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
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function createRequest(
20
+ $method,
21
+ $uri,
22
+ array $headers = [],
23
+ $body = null,
24
+ $protocolVersion = '1.1'
25
+ ) {
26
+ return new Request(
27
+ $method,
28
+ $uri,
29
+ $headers,
30
+ $body,
31
+ $protocolVersion
32
+ );
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ public function createResponse(
39
+ $statusCode = 200,
40
+ $reasonPhrase = null,
41
+ array $headers = [],
42
+ $body = null,
43
+ $protocolVersion = '1.1'
44
+ ) {
45
+ return new Response(
46
+ $statusCode,
47
+ $headers,
48
+ $body,
49
+ $protocolVersion,
50
+ $reasonPhrase
51
+ );
52
+ }
53
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
+ {
19
+ /**
20
+ * @var SlimStreamFactory
21
+ */
22
+ private $streamFactory;
23
+
24
+ /**
25
+ * @var SlimUriFactory
26
+ */
27
+ private $uriFactory;
28
+
29
+ public function __construct()
30
+ {
31
+ $this->streamFactory = new SlimStreamFactory();
32
+ $this->uriFactory = new SlimUriFactory();
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ public function createRequest(
39
+ $method,
40
+ $uri,
41
+ array $headers = [],
42
+ $body = null,
43
+ $protocolVersion = '1.1'
44
+ ) {
45
+ return (new Request(
46
+ $method,
47
+ $this->uriFactory->createUri($uri),
48
+ new Headers($headers),
49
+ [],
50
+ [],
51
+ $this->streamFactory->createStream($body),
52
+ []
53
+ ))->withProtocolVersion($protocolVersion);
54
+ }
55
+
56
+ /**
57
+ * {@inheritdoc}
58
+ */
59
+ public function createResponse(
60
+ $statusCode = 200,
61
+ $reasonPhrase = null,
62
+ array $headers = [],
63
+ $body = null,
64
+ $protocolVersion = '1.1'
65
+ ) {
66
+ return (new Response(
67
+ $statusCode,
68
+ new Headers($headers),
69
+ $this->streamFactory->createStream($body)
70
+ ))->withProtocolVersion($protocolVersion);
71
+ }
72
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/RequestMatcher.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message;
4
+
5
+ use Psr\Http\Message\RequestInterface;
6
+
7
+ /**
8
+ * Match a request.
9
+ *
10
+ * PSR-7 equivalent of Symfony's RequestMatcher
11
+ *
12
+ * @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php
13
+ *
14
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
15
+ */
16
+ interface RequestMatcher
17
+ {
18
+ /**
19
+ * Decides whether the rule(s) implemented by the strategy matches the supplied request.
20
+ *
21
+ * @param RequestInterface $request The PSR7 request to check for a match
22
+ *
23
+ * @return bool true if the request matches, false otherwise
24
+ */
25
+ public function matches(RequestInterface $request);
26
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\RequestMatcher;
4
+
5
+ use Http\Message\RequestMatcher;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Match a request with a callback.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ final class CallbackRequestMatcher implements RequestMatcher
14
+ {
15
+ /**
16
+ * @var callable
17
+ */
18
+ private $callback;
19
+
20
+ /**
21
+ * @param callable $callback
22
+ */
23
+ public function __construct(callable $callback)
24
+ {
25
+ $this->callback = $callback;
26
+ }
27
+
28
+ /**
29
+ * {@inheritdoc}
30
+ */
31
+ public function matches(RequestInterface $request)
32
+ {
33
+ return (bool) call_user_func($this->callback, $request);
34
+ }
35
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/RequestMatcher/RegexRequestMatcher.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\RequestMatcher;
4
+
5
+ use Http\Message\RequestMatcher;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ @trigger_error('The '.__NAMESPACE__.'\RegexRequestMatcher class is deprecated since version 1.2 and will be removed in 2.0. Use Http\Message\RequestMatcher\RequestMatcher instead.', E_USER_DEPRECATED);
9
+
10
+ /**
11
+ * Match a request with a regex on the uri.
12
+ *
13
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
14
+ *
15
+ * @deprecated since version 1.2 and will be removed in 2.0. Use {@link RequestMatcher} instead.
16
+ */
17
+ final class RegexRequestMatcher implements RequestMatcher
18
+ {
19
+ /**
20
+ * Matching regex.
21
+ *
22
+ * @var string
23
+ */
24
+ private $regex;
25
+
26
+ /**
27
+ * @param string $regex
28
+ */
29
+ public function __construct($regex)
30
+ {
31
+ $this->regex = $regex;
32
+ }
33
+
34
+ /**
35
+ * {@inheritdoc}
36
+ */
37
+ public function matches(RequestInterface $request)
38
+ {
39
+ return (bool) preg_match($this->regex, (string) $request->getUri());
40
+ }
41
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/RequestMatcher/RequestMatcher.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\RequestMatcher;
4
+
5
+ use Http\Message\RequestMatcher as RequestMatcherInterface;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * A port of the Symfony RequestMatcher for PSR-7.
10
+ *
11
+ * @author Fabien Potencier <fabien@symfony.com>
12
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
13
+ */
14
+ final class RequestMatcher implements RequestMatcherInterface
15
+ {
16
+ /**
17
+ * @var string
18
+ */
19
+ private $path;
20
+
21
+ /**
22
+ * @var string
23
+ */
24
+ private $host;
25
+
26
+ /**
27
+ * @var array
28
+ */
29
+ private $methods = [];
30
+
31
+ /**
32
+ * @var string[]
33
+ */
34
+ private $schemes = [];
35
+
36
+ /**
37
+ * The regular expressions used for path or host must be specified without delimiter.
38
+ * You do not need to escape the forward slash / to match it.
39
+ *
40
+ * @param string|null $path Regular expression for the path
41
+ * @param string|null $host Regular expression for the hostname
42
+ * @param string|string[]|null $methods Method or list of methods to match
43
+ * @param string|string[]|null $schemes Scheme or list of schemes to match (e.g. http or https)
44
+ */
45
+ public function __construct($path = null, $host = null, $methods = [], $schemes = [])
46
+ {
47
+ $this->path = $path;
48
+ $this->host = $host;
49
+ $this->methods = array_map('strtoupper', (array) $methods);
50
+ $this->schemes = array_map('strtolower', (array) $schemes);
51
+ }
52
+
53
+ /**
54
+ * {@inheritdoc}
55
+ *
56
+ * @api
57
+ */
58
+ public function matches(RequestInterface $request)
59
+ {
60
+ if ($this->schemes && !in_array($request->getUri()->getScheme(), $this->schemes)) {
61
+ return false;
62
+ }
63
+
64
+ if ($this->methods && !in_array($request->getMethod(), $this->methods)) {
65
+ return false;
66
+ }
67
+
68
+ if (null !== $this->path && !preg_match('{'.$this->path.'}', rawurldecode($request->getUri()->getPath()))) {
69
+ return false;
70
+ }
71
+
72
+ if (null !== $this->host && !preg_match('{'.$this->host.'}i', $request->getUri()->getHost())) {
73
+ return false;
74
+ }
75
+
76
+ return true;
77
+ }
78
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/Stream/BufferedStream.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\Stream;
4
+
5
+ use Psr\Http\Message\StreamInterface;
6
+
7
+ /**
8
+ * Decorator to make any stream seekable.
9
+ *
10
+ * Internally it buffers an existing StreamInterface into a php://temp resource (or memory). By default it will use
11
+ * 2 megabytes of memory before writing to a temporary disk file.
12
+ *
13
+ * Due to this, very large stream can suffer performance issue (i/o slowdown).
14
+ */
15
+ class BufferedStream implements StreamInterface
16
+ {
17
+ /** @var resource The buffered resource used to seek previous data */
18
+ private $resource;
19
+
20
+ /** @var int size of the stream if available */
21
+ private $size;
22
+
23
+ /** @var StreamInterface The underlying stream decorated by this class */
24
+ private $stream;
25
+
26
+ /** @var int How many bytes were written */
27
+ private $written = 0;
28
+
29
+ /**
30
+ * @param StreamInterface $stream Decorated stream
31
+ * @param bool $useFileBuffer Whether to use a file buffer (write to a file, if data exceed a certain size)
32
+ * by default, set this to false to only use memory
33
+ * @param int $memoryBuffer In conjunction with using file buffer, limit (in bytes) from which it begins to buffer
34
+ * the data in a file
35
+ */
36
+ public function __construct(StreamInterface $stream, $useFileBuffer = true, $memoryBuffer = 2097152)
37
+ {
38
+ $this->stream = $stream;
39
+ $this->size = $stream->getSize();
40
+
41
+ if ($useFileBuffer) {
42
+ $this->resource = fopen('php://temp/maxmemory:'.$memoryBuffer, 'rw+');
43
+ } else {
44
+ $this->resource = fopen('php://memory', 'rw+');
45
+ }
46
+
47
+ if (false === $this->resource) {
48
+ throw new \RuntimeException('Cannot create a resource over temp or memory implementation');
49
+ }
50
+ }
51
+
52
+ /**
53
+ * {@inheritdoc}
54
+ */
55
+ public function __toString()
56
+ {
57
+ try {
58
+ $this->rewind();
59
+
60
+ return $this->getContents();
61
+ } catch (\Throwable $throwable) {
62
+ return '';
63
+ } catch (\Exception $exception) { // Layer to be BC with PHP 5, remove this when we only support PHP 7+
64
+ return '';
65
+ }
66
+ }
67
+
68
+ /**
69
+ * {@inheritdoc}
70
+ */
71
+ public function close()
72
+ {
73
+ if (null === $this->resource) {
74
+ throw new \RuntimeException('Cannot close on a detached stream');
75
+ }
76
+
77
+ $this->stream->close();
78
+ fclose($this->resource);
79
+ }
80
+
81
+ /**
82
+ * {@inheritdoc}
83
+ */
84
+ public function detach()
85
+ {
86
+ if (null === $this->resource) {
87
+ return;
88
+ }
89
+
90
+ // Force reading the remaining data of the stream
91
+ $this->getContents();
92
+
93
+ $resource = $this->resource;
94
+ $this->stream->close();
95
+ $this->stream = null;
96
+ $this->resource = null;
97
+
98
+ return $resource;
99
+ }
100
+
101
+ /**
102
+ * {@inheritdoc}
103
+ */
104
+ public function getSize()
105
+ {
106
+ if (null === $this->resource) {
107
+ return;
108
+ }
109
+
110
+ if (null === $this->size && $this->stream->eof()) {
111
+ return $this->written;
112
+ }
113
+
114
+ return $this->size;
115
+ }
116
+
117
+ /**
118
+ * {@inheritdoc}
119
+ */
120
+ public function tell()
121
+ {
122
+ if (null === $this->resource) {
123
+ throw new \RuntimeException('Cannot tell on a detached stream');
124
+ }
125
+
126
+ return ftell($this->resource);
127
+ }
128
+
129
+ /**
130
+ * {@inheritdoc}
131
+ */
132
+ public function eof()
133
+ {
134
+ if (null === $this->resource) {
135
+ throw new \RuntimeException('Cannot call eof on a detached stream');
136
+ }
137
+
138
+ // We are at the end only when both our resource and underlying stream are at eof
139
+ return $this->stream->eof() && (ftell($this->resource) === $this->written);
140
+ }
141
+
142
+ /**
143
+ * {@inheritdoc}
144
+ */
145
+ public function isSeekable()
146
+ {
147
+ return null !== $this->resource;
148
+ }
149
+
150
+ /**
151
+ * {@inheritdoc}
152
+ */
153
+ public function seek($offset, $whence = SEEK_SET)
154
+ {
155
+ if (null === $this->resource) {
156
+ throw new \RuntimeException('Cannot seek on a detached stream');
157
+ }
158
+
159
+ fseek($this->resource, $offset, $whence);
160
+ }
161
+
162
+ /**
163
+ * {@inheritdoc}
164
+ */
165
+ public function rewind()
166
+ {
167
+ if (null === $this->resource) {
168
+ throw new \RuntimeException('Cannot rewind on a detached stream');
169
+ }
170
+
171
+ rewind($this->resource);
172
+ }
173
+
174
+ /**
175
+ * {@inheritdoc}
176
+ */
177
+ public function isWritable()
178
+ {
179
+ return false;
180
+ }
181
+
182
+ /**
183
+ * {@inheritdoc}
184
+ */
185
+ public function write($string)
186
+ {
187
+ throw new \RuntimeException('Cannot write on this stream');
188
+ }
189
+
190
+ /**
191
+ * {@inheritdoc}
192
+ */
193
+ public function isReadable()
194
+ {
195
+ return null !== $this->resource;
196
+ }
197
+
198
+ /**
199
+ * {@inheritdoc}
200
+ */
201
+ public function read($length)
202
+ {
203
+ if (null === $this->resource) {
204
+ throw new \RuntimeException('Cannot read on a detached stream');
205
+ }
206
+
207
+ $read = '';
208
+
209
+ // First read from the resource
210
+ if (ftell($this->resource) !== $this->written) {
211
+ $read = fread($this->resource, $length);
212
+ }
213
+
214
+ $bytesRead = strlen($read);
215
+
216
+ if ($bytesRead < $length) {
217
+ $streamRead = $this->stream->read($length - $bytesRead);
218
+
219
+ // Write on the underlying stream what we read
220
+ $this->written += fwrite($this->resource, $streamRead);
221
+ $read .= $streamRead;
222
+ }
223
+
224
+ return $read;
225
+ }
226
+
227
+ /**
228
+ * {@inheritdoc}
229
+ */
230
+ public function getContents()
231
+ {
232
+ if (null === $this->resource) {
233
+ throw new \RuntimeException('Cannot read on a detached stream');
234
+ }
235
+
236
+ $read = '';
237
+
238
+ while (!$this->eof()) {
239
+ $read .= $this->read(8192);
240
+ }
241
+
242
+ return $read;
243
+ }
244
+
245
+ /**
246
+ * {@inheritdoc}
247
+ */
248
+ public function getMetadata($key = null)
249
+ {
250
+ if (null === $this->resource) {
251
+ if (null === $key) {
252
+ return [];
253
+ }
254
+
255
+ return;
256
+ }
257
+
258
+ $metadata = stream_get_meta_data($this->resource);
259
+
260
+ if (null === $key) {
261
+ return $metadata;
262
+ }
263
+
264
+ if (!array_key_exists($key, $metadata)) {
265
+ return;
266
+ }
267
+
268
+ return $metadata[$key];
269
+ }
270
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
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
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function createStream($body = null)
20
+ {
21
+ if ($body instanceof StreamInterface) {
22
+ return $body;
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
+ }
33
+
34
+ return $stream;
35
+ }
36
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
+ {
14
+ /**
15
+ * {@inheritdoc}
16
+ */
17
+ public function createStream($body = null)
18
+ {
19
+ return \GuzzleHttp\Psr7\stream_for($body);
20
+ }
21
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\StreamFactory;
4
+
5
+ use Http\Message\StreamFactory;
6
+ use Psr\Http\Message\StreamInterface;
7
+ use Slim\Http\Stream;
8
+
9
+ /**
10
+ * Creates Slim 3 streams.
11
+ *
12
+ * @author Mika Tuupola <tuupola@appelsiini.net>
13
+ */
14
+ final class SlimStreamFactory implements StreamFactory
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function createStream($body = null)
20
+ {
21
+ if ($body instanceof StreamInterface) {
22
+ return $body;
23
+ }
24
+
25
+ if (is_resource($body)) {
26
+ return new Stream($body);
27
+ }
28
+
29
+ $resource = fopen('php://memory', 'r+');
30
+ $stream = new Stream($resource);
31
+ if (null !== $body && '' !== $body) {
32
+ $stream->write((string) $body);
33
+ }
34
+
35
+ return $stream;
36
+ }
37
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
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
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function createUri($uri)
20
+ {
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');
28
+ }
29
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
+ {
15
+ /**
16
+ * {@inheritdoc}
17
+ */
18
+ public function createUri($uri)
19
+ {
20
+ return Psr7\uri_for($uri);
21
+ }
22
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/UriFactory/SlimUriFactory.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\UriFactory;
4
+
5
+ use Http\Message\UriFactory;
6
+ use Psr\Http\Message\UriInterface;
7
+ use Slim\Http\Uri;
8
+
9
+ /**
10
+ * Creates Slim 3 URI.
11
+ *
12
+ * @author Mika Tuupola <tuupola@appelsiini.net>
13
+ */
14
+ final class SlimUriFactory implements UriFactory
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function createUri($uri)
20
+ {
21
+ if ($uri instanceof UriInterface) {
22
+ return $uri;
23
+ }
24
+
25
+ if (is_string($uri)) {
26
+ return Uri::createFromString($uri);
27
+ }
28
+
29
+ throw new \InvalidArgumentException('URI must be a string or UriInterface');
30
+ }
31
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/message/src/filters.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Register chunk filter if not found
4
+ if (!array_key_exists('chunk', stream_get_filters())) {
5
+ stream_filter_register('chunk', 'Http\Message\Encoding\Filter\Chunk');
6
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/CHANGELOG.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+ ## 1.0.0 - 2017-05-21
4
+
5
+ No changes from 0.2.0.
6
+
7
+ ## 0.2.0 - 2017-02-20
8
+
9
+ You may do a BC update to version 0.2.0 if you are sure that you are not adding
10
+ multiple resources with the same name to the Builder.
11
+
12
+ ### Fixed
13
+
14
+ - Make sure one can add resources with same name without overwrite.
15
+
16
+ ## 0.1.6 - 2017-02-16
17
+
18
+ ### Fixed
19
+
20
+ - Performance improvements by avoid using `uniqid()`.
21
+
22
+ ## 0.1.5 - 2017-02-14
23
+
24
+ ### Fixed
25
+
26
+ - Support for non-readable streams. This fix was needed because flaws in Guzzle, Zend and Slims implementations of PSR-7.
27
+
28
+ ## 0.1.4 - 2016-12-31
29
+
30
+ ### Added
31
+
32
+ - Added support for resetting the builder
33
+
34
+ ## 0.1.3 - 2016-12-22
35
+
36
+ ### Added
37
+
38
+ - Added `CustomMimetypeHelper` to allow you to configure custom mimetypes.
39
+
40
+ ### Changed
41
+
42
+ - Using regular expression instead of `basename($filename)` because basename is depending on locale.
43
+
44
+ ## 0.1.2 - 2016-08-31
45
+
46
+ ### Added
47
+
48
+ - Support for Outlook msg files.
49
+
50
+ ## 0.1.1 - 2016-08-10
51
+
52
+ ### Added
53
+
54
+ - Support for Apple passbook.
55
+
56
+ ## 0.1.0 - 2016-07-19
57
+
58
+ ### Added
59
+
60
+ - Initial release
Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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.
Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PSR-7 Multipart Stream Builder
2
+
3
+ [![Latest Version](https://img.shields.io/github/release/php-http/multipart-stream-builder.svg?style=flat-square)](https://github.com/php-http/multipart-stream-builder/releases)
4
+ [![Build Status](https://img.shields.io/travis/php-http/multipart-stream-builder.svg?style=flat-square)](https://travis-ci.org/php-http/multipart-stream-builder)
5
+ [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/multipart-stream-builder.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/multipart-stream-builder)
6
+ [![Quality Score](https://img.shields.io/scrutinizer/g/php-http/multipart-stream-builder.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/multipart-stream-builder)
7
+ [![Total Downloads](https://img.shields.io/packagist/dt/php-http/multipart-stream-builder.svg?style=flat-square)](https://packagist.org/packages/php-http/multipart-stream-builder)
8
+
9
+ **A builder for Multipart PSR-7 Streams. The builder create streams independenly form any PSR-7 implementation.**
10
+
11
+
12
+ ## Install
13
+
14
+ Via Composer
15
+
16
+ ``` bash
17
+ $ composer require php-http/multipart-stream-builder
18
+ ```
19
+
20
+ ## Documentation
21
+
22
+ Please see the [official documentation](http://php-http.readthedocs.org/en/latest/components/multipart-stream-builder.html).
23
+
24
+
25
+ ## Contributing
26
+
27
+ Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.
28
+
29
+
30
+ ## Security
31
+
32
+ If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
33
+
34
+
35
+ ## License
36
+
37
+ The MIT License (MIT). Please see [License File](LICENSE) for more information.
Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/appveyor.yml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ build: false
2
+ platform:
3
+ - x86
4
+ - x64
5
+
6
+ clone_folder: c:\projects\php-http\multipart-stream-builder
7
+
8
+ cache:
9
+ - c:\tools\php -> appveyor.yml
10
+
11
+ init:
12
+ - SET PATH=c:\php;%PATH%
13
+ - SET COMPOSER_NO_INTERACTION=1
14
+ - SET PHP=1
15
+
16
+
17
+ install:
18
+ - IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
19
+ - cd c:\php
20
+ - IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-7.0.0-nts-Win32-VC14-x86.zip
21
+ - IF %PHP%==1 7z x php-7.0.0-nts-Win32-VC14-x86.zip -y >nul
22
+ - IF %PHP%==1 del /Q *.zip
23
+ - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
24
+ - IF %PHP%==1 copy /Y php.ini-development php.ini
25
+ - IF %PHP%==1 echo max_execution_time=1200 >> php.ini
26
+ - IF %PHP%==1 echo date.timezone="UTC" >> php.ini
27
+ - IF %PHP%==1 echo extension_dir=ext >> php.ini
28
+ - IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
29
+ - IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
30
+ - IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
31
+ - appveyor DownloadFile https://getcomposer.org/composer.phar
32
+ - cd c:\projects\php-http\multipart-stream-builder
33
+ - mkdir %APPDATA%\Composer
34
+ - composer update --prefer-dist --no-progress --ansi
35
+
36
+ test_script:
37
+ - cd c:\projects\php-http\multipart-stream-builder
38
+ - vendor\bin\phpunit.bat --verbose
39
+
Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/composer.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "php-http/multipart-stream-builder",
3
+ "description": "A builder class that help you create a multipart stream",
4
+ "license": "MIT",
5
+ "keywords": ["http", "factory", "message", "stream", "multipart stream"],
6
+ "homepage": "http://php-http.org",
7
+ "authors": [
8
+ {
9
+ "name": "Tobias Nyholm",
10
+ "email": "tobias.nyholm@gmail.com"
11
+ }
12
+ ],
13
+ "require": {
14
+ "php": "^5.5 || ^7.0",
15
+ "psr/http-message": "^1.0",
16
+ "php-http/message-factory": "^1.0.2",
17
+ "php-http/discovery": "^1.0"
18
+ },
19
+ "require-dev": {
20
+ "phpunit/phpunit": "^4.8 || ^5.4",
21
+ "php-http/message": "^1.5",
22
+ "zendframework/zend-diactoros": "^1.3.5"
23
+ },
24
+ "autoload": {
25
+ "psr-4": {
26
+ "Http\\Message\\MultipartStream\\": "src/"
27
+ }
28
+ },
29
+ "autoload-dev": {
30
+ "psr-4": {
31
+ "tests\\Http\\Message\\MultipartStream\\": "tests/"
32
+ }
33
+ },
34
+ "scripts": {
35
+ "test": "vendor/bin/phpunit",
36
+ "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
37
+ },
38
+ "extra": {
39
+ "branch-alias": {
40
+ "dev-master": "0.3-dev"
41
+ }
42
+ }
43
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/src/ApacheMimetypeHelper.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\MultipartStream;
4
+
5
+ /**
6
+ * This class helps to find the proper mime types. The source of this file is taken
7
+ * from Guzzle.
8
+ *
9
+ * @author Michael Dowling and contributors to guzzlehttp/psr7
10
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
11
+ */
12
+ class ApacheMimetypeHelper implements MimetypeHelper
13
+ {
14
+ /**
15
+ * {@inheritdoc}
16
+ *
17
+ * @see http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
18
+ */
19
+ public function getMimetypeFromFilename($filename)
20
+ {
21
+ return $this->getMimetypeFromExtension(pathinfo($filename, PATHINFO_EXTENSION));
22
+ }
23
+
24
+ /**
25
+ * {@inheritdoc}
26
+ *
27
+ * @see http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
28
+ */
29
+ public function getMimetypeFromExtension($extension)
30
+ {
31
+ static $mimetypes = [
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
+ 'mp3' => 'audio/mpeg',
80
+ 'mp4' => 'video/mp4',
81
+ 'mp4a' => 'audio/mp4',
82
+ 'mp4v' => 'video/mp4',
83
+ 'mpe' => 'video/mpeg',
84
+ 'mpeg' => 'video/mpeg',
85
+ 'mpg' => 'video/mpeg',
86
+ 'mpg4' => 'video/mp4',
87
+ 'oga' => 'audio/ogg',
88
+ 'ogg' => 'audio/ogg',
89
+ 'ogv' => 'video/ogg',
90
+ 'ogx' => 'application/ogg',
91
+ 'pbm' => 'image/x-portable-bitmap',
92
+ 'pdf' => 'application/pdf',
93
+ 'pgm' => 'image/x-portable-graymap',
94
+ 'png' => 'image/png',
95
+ 'pnm' => 'image/x-portable-anymap',
96
+ 'ppm' => 'image/x-portable-pixmap',
97
+ 'ppt' => 'application/vnd.ms-powerpoint',
98
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
99
+ 'ps' => 'application/postscript',
100
+ 'qt' => 'video/quicktime',
101
+ 'rar' => 'application/x-rar-compressed',
102
+ 'ras' => 'image/x-cmu-raster',
103
+ 'rss' => 'application/rss+xml',
104
+ 'rtf' => 'application/rtf',
105
+ 'sgm' => 'text/sgml',
106
+ 'sgml' => 'text/sgml',
107
+ 'svg' => 'image/svg+xml',
108
+ 'swf' => 'application/x-shockwave-flash',
109
+ 'tar' => 'application/x-tar',
110
+ 'tif' => 'image/tiff',
111
+ 'tiff' => 'image/tiff',
112
+ 'torrent' => 'application/x-bittorrent',
113
+ 'ttf' => 'application/x-font-ttf',
114
+ 'txt' => 'text/plain',
115
+ 'wav' => 'audio/x-wav',
116
+ 'webm' => 'video/webm',
117
+ 'wma' => 'audio/x-ms-wma',
118
+ 'wmv' => 'video/x-ms-wmv',
119
+ 'woff' => 'application/x-font-woff',
120
+ 'wsdl' => 'application/wsdl+xml',
121
+ 'xbm' => 'image/x-xbitmap',
122
+ 'xls' => 'application/vnd.ms-excel',
123
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
124
+ 'xml' => 'application/xml',
125
+ 'xpm' => 'image/x-xpixmap',
126
+ 'xwd' => 'image/x-xwindowdump',
127
+ 'yaml' => 'text/yaml',
128
+ 'yml' => 'text/yaml',
129
+ 'zip' => 'application/zip',
130
+
131
+ // Non-Apache standard
132
+ 'pkpass' => 'application/vnd.apple.pkpass',
133
+ 'msg' => 'application/vnd.ms-outlook',
134
+ ];
135
+
136
+ $extension = strtolower($extension);
137
+
138
+ return isset($mimetypes[$extension])
139
+ ? $mimetypes[$extension]
140
+ : null;
141
+ }
142
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/src/CustomMimetypeHelper.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\MultipartStream;
4
+
5
+ /**
6
+ * Let you add your own mimetypes. The mimetype lookup will fallback on the ApacheMimeTypeHelper.
7
+ *
8
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
9
+ */
10
+ class CustomMimetypeHelper extends ApacheMimetypeHelper
11
+ {
12
+ /**
13
+ * @var array
14
+ */
15
+ private $mimetypes = [];
16
+
17
+ /**
18
+ * @param array $mimetypes should be of type extension => mimetype
19
+ */
20
+ public function __construct(array $mimetypes = [])
21
+ {
22
+ $this->mimetypes = $mimetypes;
23
+ }
24
+
25
+ /**
26
+ * @param string $extension
27
+ * @param string $mimetype
28
+ *
29
+ * @return $this
30
+ */
31
+ public function addMimetype($extension, $mimetype)
32
+ {
33
+ $this->mimetypes[$extension] = $mimetype;
34
+
35
+ return $this;
36
+ }
37
+
38
+ /**
39
+ * {@inheritdoc}
40
+ *
41
+ * Check if we have any defined mimetypes and of not fallback to ApacheMimetypeHelper
42
+ */
43
+ public function getMimetypeFromExtension($extension)
44
+ {
45
+ $extension = strtolower($extension);
46
+
47
+ return isset($this->mimetypes[$extension])
48
+ ? $this->mimetypes[$extension]
49
+ : parent::getMimetypeFromExtension($extension);
50
+ }
51
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/src/MimetypeHelper.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\MultipartStream;
4
+
5
+ /**
6
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
7
+ */
8
+ interface MimetypeHelper
9
+ {
10
+ /**
11
+ * Determines the mimetype of a file by looking at its extension.
12
+ *
13
+ * @param string $filename
14
+ *
15
+ * @return null|string
16
+ */
17
+ public function getMimetypeFromFilename($filename);
18
+
19
+ /**
20
+ * Maps a file extensions to a mimetype.
21
+ *
22
+ * @param string $extension The file extension
23
+ *
24
+ * @return string|null
25
+ */
26
+ public function getMimetypeFromExtension($extension);
27
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/multipart-stream-builder/src/MultipartStreamBuilder.php ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Message\MultipartStream;
4
+
5
+ use Http\Discovery\StreamFactoryDiscovery;
6
+ use Http\Message\StreamFactory;
7
+ use Psr\Http\Message\StreamInterface;
8
+
9
+ /**
10
+ * Build your own Multipart stream. A Multipart stream is a collection of streams separated with a $bounary. This
11
+ * class helps you to create a Multipart stream with stream implementations from any PSR7 library.
12
+ *
13
+ * @author Michael Dowling and contributors to guzzlehttp/psr7
14
+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
15
+ */
16
+ class MultipartStreamBuilder
17
+ {
18
+ /**
19
+ * @var StreamFactory
20
+ */
21
+ private $streamFactory;
22
+
23
+ /**
24
+ * @var MimetypeHelper
25
+ */
26
+ private $mimetypeHelper;
27
+
28
+ /**
29
+ * @var string
30
+ */
31
+ private $boundary;
32
+
33
+ /**
34
+ * @var array Element where each Element is an array with keys ['contents', 'headers', 'filename']
35
+ */
36
+ private $data = [];
37
+
38
+ /**
39
+ * @param StreamFactory|null $streamFactory
40
+ */
41
+ public function __construct(StreamFactory $streamFactory = null)
42
+ {
43
+ $this->streamFactory = $streamFactory ?: StreamFactoryDiscovery::find();
44
+ }
45
+
46
+ /**
47
+ * Add a resource to the Multipart Stream.
48
+ *
49
+ * @param string $name the formpost name
50
+ * @param string|resource|StreamInterface $resource
51
+ * @param array $options {
52
+ *
53
+ * @var array $headers additional headers ['header-name' => 'header-value']
54
+ * @var string $filename
55
+ * }
56
+ *
57
+ * @return MultipartStreamBuilder
58
+ */
59
+ public function addResource($name, $resource, array $options = [])
60
+ {
61
+ $stream = $this->streamFactory->createStream($resource);
62
+
63
+ // validate options['headers'] exists
64
+ if (!isset($options['headers'])) {
65
+ $options['headers'] = [];
66
+ }
67
+
68
+ // Try to add filename if it is missing
69
+ if (empty($options['filename'])) {
70
+ $options['filename'] = null;
71
+ $uri = $stream->getMetadata('uri');
72
+ if (substr($uri, 0, 6) !== 'php://') {
73
+ $options['filename'] = $uri;
74
+ }
75
+ }
76
+
77
+ $this->prepareHeaders($name, $stream, $options['filename'], $options['headers']);
78
+ $this->data[] = ['contents' => $stream, 'headers' => $options['headers'], 'filename' => $options['filename']];
79
+
80
+ return $this;
81
+ }
82
+
83
+ /**
84
+ * Build the stream.
85
+ *
86
+ * @return StreamInterface
87
+ */
88
+ public function build()
89
+ {
90
+ $streams = '';
91
+ foreach ($this->data as $data) {
92
+ // Add start and headers
93
+ $streams .= "--{$this->getBoundary()}\r\n".
94
+ $this->getHeaders($data['headers'])."\r\n";
95
+
96
+ // Convert the stream to string
97
+ /* @var $contentStream StreamInterface */
98
+ $contentStream = $data['contents'];
99
+ if ($contentStream->isSeekable()) {
100
+ $streams .= $contentStream->__toString();
101
+ } else {
102
+ $streams .= $contentStream->getContents();
103
+ }
104
+
105
+ $streams .= "\r\n";
106
+ }
107
+
108
+ // Append end
109
+ $streams .= "--{$this->getBoundary()}--\r\n";
110
+
111
+ return $this->streamFactory->createStream($streams);
112
+ }
113
+
114
+ /**
115
+ * Add extra headers if they are missing.
116
+ *
117
+ * @param string $name
118
+ * @param StreamInterface $stream
119
+ * @param string $filename
120
+ * @param array &$headers
121
+ */
122
+ private function prepareHeaders($name, StreamInterface $stream, $filename, array &$headers)
123
+ {
124
+ $hasFilename = $filename === '0' || $filename;
125
+
126
+ // Set a default content-disposition header if one was not provided
127
+ if (!$this->hasHeader($headers, 'content-disposition')) {
128
+ $headers['Content-Disposition'] = sprintf('form-data; name="%s"', $name);
129
+ if ($hasFilename) {
130
+ $headers['Content-Disposition'] .= sprintf('; filename="%s"', $this->basename($filename));
131
+ }
132
+ }
133
+
134
+ // Set a default content-length header if one was not provided
135
+ if (!$this->hasHeader($headers, 'content-length')) {
136
+ if ($length = $stream->getSize()) {
137
+ $headers['Content-Length'] = (string) $length;
138
+ }
139
+ }
140
+
141
+ // Set a default Content-Type if one was not provided
142
+ if (!$this->hasHeader($headers, 'content-type') && $hasFilename) {
143
+ if ($type = $this->getMimetypeHelper()->getMimetypeFromFilename($filename)) {
144
+ $headers['Content-Type'] = $type;
145
+ }
146
+ }
147
+ }
148
+
149
+ /**
150
+ * Get the headers formatted for the HTTP message.
151
+ *
152
+ * @param array $headers
153
+ *
154
+ * @return string
155
+ */
156
+ private function getHeaders(array $headers)
157
+ {
158
+ $str = '';
159
+ foreach ($headers as $key => $value) {
160
+ $str .= sprintf("%s: %s\r\n", $key, $value);
161
+ }
162
+
163
+ return $str;
164
+ }
165
+
166
+ /**
167
+ * Check if header exist.
168
+ *
169
+ * @param array $headers
170
+ * @param string $key case insensitive
171
+ *
172
+ * @return bool
173
+ */
174
+ private function hasHeader(array $headers, $key)
175
+ {
176
+ $lowercaseHeader = strtolower($key);
177
+ foreach ($headers as $k => $v) {
178
+ if (strtolower($k) === $lowercaseHeader) {
179
+ return true;
180
+ }
181
+ }
182
+
183
+ return false;
184
+ }
185
+
186
+ /**
187
+ * Get the boundary that separates the streams.
188
+ *
189
+ * @return string
190
+ */
191
+ public function getBoundary()
192
+ {
193
+ if ($this->boundary === null) {
194
+ $this->boundary = uniqid('', true);
195
+ }
196
+
197
+ return $this->boundary;
198
+ }
199
+
200
+ /**
201
+ * @param string $boundary
202
+ *
203
+ * @return MultipartStreamBuilder
204
+ */
205
+ public function setBoundary($boundary)
206
+ {
207
+ $this->boundary = $boundary;
208
+
209
+ return $this;
210
+ }
211
+
212
+ /**
213
+ * @return MimetypeHelper
214
+ */
215
+ private function getMimetypeHelper()
216
+ {
217
+ if ($this->mimetypeHelper === null) {
218
+ $this->mimetypeHelper = new ApacheMimetypeHelper();
219
+ }
220
+
221
+ return $this->mimetypeHelper;
222
+ }
223
+
224
+ /**
225
+ * If you have custom file extension you may overwrite the default MimetypeHelper with your own.
226
+ *
227
+ * @param MimetypeHelper $mimetypeHelper
228
+ *
229
+ * @return MultipartStreamBuilder
230
+ */
231
+ public function setMimetypeHelper(MimetypeHelper $mimetypeHelper)
232
+ {
233
+ $this->mimetypeHelper = $mimetypeHelper;
234
+
235
+ return $this;
236
+ }
237
+
238
+ /**
239
+ * Reset and clear all stored data. This allows you to use builder for a subsequent request.
240
+ *
241
+ * @return MultipartStreamBuilder
242
+ */
243
+ public function reset()
244
+ {
245
+ $this->data = [];
246
+ $this->boundary = null;
247
+
248
+ return $this;
249
+ }
250
+
251
+ /**
252
+ * Gets the filename from a given path.
253
+ *
254
+ * PHP's basename() does not properly support streams or filenames beginning with a non-US-ASCII character.
255
+ *
256
+ * @author Drupal 8.2
257
+ *
258
+ * @param string $path
259
+ *
260
+ * @return string
261
+ */
262
+ private function basename($path)
263
+ {
264
+ $separators = '/';
265
+ if (DIRECTORY_SEPARATOR != '/') {
266
+ // For Windows OS add special separator.
267
+ $separators .= DIRECTORY_SEPARATOR;
268
+ }
269
+
270
+ // Remove right-most slashes when $path points to directory.
271
+ $path = rtrim($path, $separators);
272
+
273
+ // Returns the trailing part of the $path starting after one of the directory separators.
274
+ $filename = preg_match('@[^'.preg_quote($separators, '@').']+$@', $path, $matches) ? $matches[0] : '';
275
+
276
+ return $filename;
277
+ }
278
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/promise/CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+
4
+ ## 1.0.0 - 2016-01-26
5
+
6
+ ### Removed
7
+
8
+ - PSR-7 dependency
9
+
10
+
11
+ ## 1.0.0-RC1 - 2016-01-12
12
+
13
+ ### Added
14
+
15
+ - Tests for full coverage
16
+
17
+ ## Changed
18
+
19
+ - Updated package files
20
+ - Clarified wait method behavior
21
+ - Contributing guide moved to the documentation
22
+
23
+
24
+ ## 0.1.1 - 2015-12-24
25
+
26
+ ## Added
27
+
28
+ - Fulfilled and Rejected promise implementations
29
+
30
+
31
+ ## 0.1.0 - 2015-12-13
32
+
33
+ ## Added
34
+
35
+ - Promise interface
Postman/Postman-Mail/mailgun/vendor/php-http/promise/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.
Postman/Postman-Mail/mailgun/vendor/php-http/promise/README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Promise
2
+
3
+ [![Latest Version](https://img.shields.io/github/release/php-http/promise.svg?style=flat-square)](https://github.com/php-http/promise/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/promise.svg?style=flat-square)](https://travis-ci.org/php-http/promise)
6
+ [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/promise.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/promise)
7
+ [![Quality Score](https://img.shields.io/scrutinizer/g/php-http/promise.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/promise)
8
+ [![Total Downloads](https://img.shields.io/packagist/dt/php-http/promise.svg?style=flat-square)](https://packagist.org/packages/php-http/promise)
9
+
10
+ **Promise used for asynchronous HTTP requests.**
11
+
12
+ **Note:** This will eventually be removed/deprecated and replaced with the upcoming Promise PSR.
13
+
14
+
15
+ ## Install
16
+
17
+ Via Composer
18
+
19
+ ``` bash
20
+ $ composer require php-http/promise
21
+ ```
22
+
23
+
24
+ ## Documentation
25
+
26
+ Please see the [official documentation](http://docs.php-http.org).
27
+
28
+
29
+ ## Testing
30
+
31
+ ``` bash
32
+ $ composer test
33
+ ```
34
+
35
+
36
+ ## Contributing
37
+
38
+ Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).
39
+
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
48
+
49
+ The MIT License (MIT). Please see [License File](LICENSE) for more information.
Postman/Postman-Mail/mailgun/vendor/php-http/promise/composer.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "php-http/promise",
3
+ "description": "Promise used for asynchronous HTTP requests",
4
+ "license": "MIT",
5
+ "keywords": ["promise"],
6
+ "homepage": "http://httplug.io",
7
+ "authors": [
8
+ {
9
+ "name": "Joel Wurtz",
10
+ "email": "joel.wurtz@gmail.com"
11
+ },
12
+ {
13
+ "name": "Márk Sági-Kazár",
14
+ "email": "mark.sagikazar@gmail.com"
15
+ }
16
+ ],
17
+ "require-dev": {
18
+ "phpspec/phpspec": "^2.4",
19
+ "henrikbjorn/phpspec-code-coverage" : "^1.0"
20
+ },
21
+ "autoload": {
22
+ "psr-4": {
23
+ "Http\\Promise\\": "src/"
24
+ }
25
+ },
26
+ "scripts": {
27
+ "test": "vendor/bin/phpspec run",
28
+ "test-ci": "vendor/bin/phpspec run -c phpspec.yml.ci"
29
+ },
30
+ "extra": {
31
+ "branch-alias": {
32
+ "dev-master": "1.1-dev"
33
+ }
34
+ }
35
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/promise/src/FulfilledPromise.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Promise;
4
+
5
+ /**
6
+ * A promise already fulfilled.
7
+ *
8
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
9
+ */
10
+ final class FulfilledPromise implements Promise
11
+ {
12
+ /**
13
+ * @var mixed
14
+ */
15
+ private $result;
16
+
17
+ /**
18
+ * @param $result
19
+ */
20
+ public function __construct($result)
21
+ {
22
+ $this->result = $result;
23
+ }
24
+
25
+ /**
26
+ * {@inheritdoc}
27
+ */
28
+ public function then(callable $onFulfilled = null, callable $onRejected = null)
29
+ {
30
+ if (null === $onFulfilled) {
31
+ return $this;
32
+ }
33
+
34
+ try {
35
+ return new self($onFulfilled($this->result));
36
+ } catch (\Exception $e) {
37
+ return new RejectedPromise($e);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * {@inheritdoc}
43
+ */
44
+ public function getState()
45
+ {
46
+ return Promise::FULFILLED;
47
+ }
48
+
49
+ /**
50
+ * {@inheritdoc}
51
+ */
52
+ public function wait($unwrap = true)
53
+ {
54
+ if ($unwrap) {
55
+ return $this->result;
56
+ }
57
+ }
58
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/promise/src/Promise.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Promise;
4
+
5
+ /**
6
+ * Promise represents a value that may not be available yet, but will be resolved at some point in future.
7
+ * It acts like a proxy to the actual value.
8
+ *
9
+ * This interface is an extension of the promises/a+ specification.
10
+ *
11
+ * @see https://promisesaplus.com/
12
+ *
13
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
14
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
15
+ */
16
+ interface Promise
17
+ {
18
+ /**
19
+ * Promise has not been fulfilled or rejected.
20
+ */
21
+ const PENDING = 'pending';
22
+
23
+ /**
24
+ * Promise has been fulfilled.
25
+ */
26
+ const FULFILLED = 'fulfilled';
27
+
28
+ /**
29
+ * Promise has been rejected.
30
+ */
31
+ const REJECTED = 'rejected';
32
+
33
+ /**
34
+ * Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
35
+ *
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
+
46
+ /**
47
+ * Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
48
+ *
49
+ * @return string
50
+ */
51
+ public function getState();
52
+
53
+ /**
54
+ * Wait for the promise to be fulfilled or rejected.
55
+ *
56
+ * When this method returns, the request has been resolved and if callables have been
57
+ * specified, the appropriate one has terminated.
58
+ *
59
+ * When $unwrap is true (the default), the response is returned, or the exception thrown
60
+ * on failure. Otherwise, nothing is returned or thrown.
61
+ *
62
+ * @param bool $unwrap Whether to return resolved value / throw reason or not
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
+ }
Postman/Postman-Mail/mailgun/vendor/php-http/promise/src/RejectedPromise.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Http\Promise;
4
+
5
+ /**
6
+ * A rejected promise.
7
+ *
8
+ * @author Joel Wurtz <joel.wurtz@gmail.com>
9
+ */
10
+ final class RejectedPromise implements Promise
11
+ {
12
+ /**
13
+ * @var \Exception
14
+ */
15
+ private $exception;
16
+
17
+ /**
18
+ * @param \Exception $exception
19
+ */
20
+ public function __construct(\Exception $exception)
21
+ {
22
+ $this->exception = $exception;
23
+ }
24
+
25
+ /**
26
+ * {@inheritdoc}
27
+ */
28
+ public function then(callable $onFulfilled = null, callable $onRejected = null)
29
+ {
30
+ if (null === $onRejected) {
31
+ return $this;
32
+ }
33
+
34
+ try {
35
+ return new FulfilledPromise($onRejected($this->exception));
36
+ } catch (\Exception $e) {
37
+ return new self($e);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * {@inheritdoc}
43
+ */
44
+ public function getState()
45
+ {
46
+ return Promise::REJECTED;
47
+ }
48
+
49
+ /**
50
+ * {@inheritdoc}
51
+ */
52
+ public function wait($unwrap = true)
53
+ {
54
+ if ($unwrap) {
55
+ throw $this->exception;
56
+ }
57
+ }
58
+ }
Postman/Postman-Mail/mailgun/vendor/psr/http-message/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file, in reverse chronological order by release.
4
+
5
+ ## 1.0.1 - 2016-08-06
6
+
7
+ ### Added
8
+
9
+ - Nothing.
10
+
11
+ ### Deprecated
12
+
13
+ - Nothing.
14
+
15
+ ### Removed
16
+
17
+ - Nothing.
18
+
19
+ ### Fixed
20
+
21
+ - Updated all `@return self` annotation references in interfaces to use
22
+ `@return static`, which more closelly follows the semantics of the
23
+ specification.
24
+ - Updated the `MessageInterface::getHeaders()` return annotation to use the
25
+ value `string[][]`, indicating the format is a nested array of strings.
26
+ - Updated the `@link` annotation for `RequestInterface::withRequestTarget()`
27
+ to point to the correct section of RFC 7230.
28
+ - Updated the `ServerRequestInterface::withUploadedFiles()` parameter annotation
29
+ to add the parameter name (`$uploadedFiles`).
30
+ - Updated a `@throws` annotation for the `UploadedFileInterface::moveTo()`
31
+ method to correctly reference the method parameter (it was referencing an
32
+ incorrect parameter name previously).
33
+
34
+ ## 1.0.0 - 2016-05-18
35
+
36
+ Initial stable release; reflects accepted PSR-7 specification.
Postman/Postman-Mail/mailgun/vendor/psr/http-message/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2014 PHP Framework Interoperability Group
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
Postman/Postman-Mail/mailgun/vendor/psr/http-message/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PSR Http Message
2
+ ================
3
+
4
+ This repository holds all interfaces/classes/traits related to
5
+ [PSR-7](http://www.php-fig.org/psr/psr-7/).
6
+
7
+ Note that this is not a HTTP message implementation of its own. It is merely an
8
+ interface that describes a HTTP message. See the specification for more details.
9
+
10
+ Usage
11
+ -----
12
+
13
+ We'll certainly need some stuff in here.
Postman/Postman-Mail/mailgun/vendor/psr/http-message/composer.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "psr/http-message",
3
+ "description": "Common interface for HTTP messages",
4
+ "keywords": ["psr", "psr-7", "http", "http-message", "request", "response"],
5
+ "homepage": "https://github.com/php-fig/http-message",
6
+ "license": "MIT",
7
+ "authors": [
8
+ {
9
+ "name": "PHP-FIG",
10
+ "homepage": "http://www.php-fig.org/"
11
+ }
12
+ ],
13
+ "require": {
14
+ "php": ">=5.3.0"
15
+ },
16
+ "autoload": {
17
+ "psr-4": {
18
+ "Psr\\Http\\Message\\": "src/"
19
+ }
20
+ },
21
+ "extra": {
22
+ "branch-alias": {
23
+ "dev-master": "1.0.x-dev"
24
+ }
25
+ }
26
+ }
Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/MessageInterface.php ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ /**
6
+ * HTTP messages consist of requests from a client to a server and responses
7
+ * from a server to a client. This interface defines the methods common to
8
+ * each.
9
+ *
10
+ * Messages are considered immutable; all methods that might change state MUST
11
+ * be implemented such that they retain the internal state of the current
12
+ * message and return an instance that contains the changed state.
13
+ *
14
+ * @link http://www.ietf.org/rfc/rfc7230.txt
15
+ * @link http://www.ietf.org/rfc/rfc7231.txt
16
+ */
17
+ interface MessageInterface
18
+ {
19
+ /**
20
+ * Retrieves the HTTP protocol version as a string.
21
+ *
22
+ * The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").
23
+ *
24
+ * @return string HTTP protocol version.
25
+ */
26
+ public function getProtocolVersion();
27
+
28
+ /**
29
+ * Return an instance with the specified HTTP protocol version.
30
+ *
31
+ * The version string MUST contain only the HTTP version number (e.g.,
32
+ * "1.1", "1.0").
33
+ *
34
+ * This method MUST be implemented in such a way as to retain the
35
+ * immutability of the message, and MUST return an instance that has the
36
+ * new protocol version.
37
+ *
38
+ * @param string $version HTTP protocol version
39
+ * @return static
40
+ */
41
+ public function withProtocolVersion($version);
42
+
43
+ /**
44
+ * Retrieves all message header values.
45
+ *
46
+ * The keys represent the header name as it will be sent over the wire, and
47
+ * each value is an array of strings associated with the header.
48
+ *
49
+ * // Represent the headers as a string
50
+ * foreach ($message->getHeaders() as $name => $values) {
51
+ * echo $name . ": " . implode(", ", $values);
52
+ * }
53
+ *
54
+ * // Emit headers iteratively:
55
+ * foreach ($message->getHeaders() as $name => $values) {
56
+ * foreach ($values as $value) {
57
+ * header(sprintf('%s: %s', $name, $value), false);
58
+ * }
59
+ * }
60
+ *
61
+ * While header names are not case-sensitive, getHeaders() will preserve the
62
+ * exact case in which headers were originally specified.
63
+ *
64
+ * @return string[][] Returns an associative array of the message's headers. Each
65
+ * key MUST be a header name, and each value MUST be an array of strings
66
+ * for that header.
67
+ */
68
+ public function getHeaders();
69
+
70
+ /**
71
+ * Checks if a header exists by the given case-insensitive name.
72
+ *
73
+ * @param string $name Case-insensitive header field name.
74
+ * @return bool Returns true if any header names match the given header
75
+ * name using a case-insensitive string comparison. Returns false if
76
+ * no matching header name is found in the message.
77
+ */
78
+ public function hasHeader($name);
79
+
80
+ /**
81
+ * Retrieves a message header value by the given case-insensitive name.
82
+ *
83
+ * This method returns an array of all the header values of the given
84
+ * case-insensitive header name.
85
+ *
86
+ * If the header does not appear in the message, this method MUST return an
87
+ * empty array.
88
+ *
89
+ * @param string $name Case-insensitive header field name.
90
+ * @return string[] An array of string values as provided for the given
91
+ * header. If the header does not appear in the message, this method MUST
92
+ * return an empty array.
93
+ */
94
+ public function getHeader($name);
95
+
96
+ /**
97
+ * Retrieves a comma-separated string of the values for a single header.
98
+ *
99
+ * This method returns all of the header values of the given
100
+ * case-insensitive header name as a string concatenated together using
101
+ * a comma.
102
+ *
103
+ * NOTE: Not all header values may be appropriately represented using
104
+ * comma concatenation. For such headers, use getHeader() instead
105
+ * and supply your own delimiter when concatenating.
106
+ *
107
+ * If the header does not appear in the message, this method MUST return
108
+ * an empty string.
109
+ *
110
+ * @param string $name Case-insensitive header field name.
111
+ * @return string A string of values as provided for the given header
112
+ * concatenated together using a comma. If the header does not appear in
113
+ * the message, this method MUST return an empty string.
114
+ */
115
+ public function getHeaderLine($name);
116
+
117
+ /**
118
+ * Return an instance with the provided value replacing the specified header.
119
+ *
120
+ * While header names are case-insensitive, the casing of the header will
121
+ * be preserved by this function, and returned from getHeaders().
122
+ *
123
+ * This method MUST be implemented in such a way as to retain the
124
+ * immutability of the message, and MUST return an instance that has the
125
+ * new and/or updated header and value.
126
+ *
127
+ * @param string $name Case-insensitive header field name.
128
+ * @param string|string[] $value Header value(s).
129
+ * @return static
130
+ * @throws \InvalidArgumentException for invalid header names or values.
131
+ */
132
+ public function withHeader($name, $value);
133
+
134
+ /**
135
+ * Return an instance with the specified header appended with the given value.
136
+ *
137
+ * Existing values for the specified header will be maintained. The new
138
+ * value(s) will be appended to the existing list. If the header did not
139
+ * exist previously, it will be added.
140
+ *
141
+ * This method MUST be implemented in such a way as to retain the
142
+ * immutability of the message, and MUST return an instance that has the
143
+ * new header and/or value.
144
+ *
145
+ * @param string $name Case-insensitive header field name to add.
146
+ * @param string|string[] $value Header value(s).
147
+ * @return static
148
+ * @throws \InvalidArgumentException for invalid header names or values.
149
+ */
150
+ public function withAddedHeader($name, $value);
151
+
152
+ /**
153
+ * Return an instance without the specified header.
154
+ *
155
+ * Header resolution MUST be done without case-sensitivity.
156
+ *
157
+ * This method MUST be implemented in such a way as to retain the
158
+ * immutability of the message, and MUST return an instance that removes
159
+ * the named header.
160
+ *
161
+ * @param string $name Case-insensitive header field name to remove.
162
+ * @return static
163
+ */
164
+ public function withoutHeader($name);
165
+
166
+ /**
167
+ * Gets the body of the message.
168
+ *
169
+ * @return StreamInterface Returns the body as a stream.
170
+ */
171
+ public function getBody();
172
+
173
+ /**
174
+ * Return an instance with the specified message body.
175
+ *
176
+ * The body MUST be a StreamInterface object.
177
+ *
178
+ * This method MUST be implemented in such a way as to retain the
179
+ * immutability of the message, and MUST return a new instance that has the
180
+ * new body stream.
181
+ *
182
+ * @param StreamInterface $body Body.
183
+ * @return static
184
+ * @throws \InvalidArgumentException When the body is not valid.
185
+ */
186
+ public function withBody(StreamInterface $body);
187
+ }
Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/RequestInterface.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ /**
6
+ * Representation of an outgoing, client-side request.
7
+ *
8
+ * Per the HTTP specification, this interface includes properties for
9
+ * each of the following:
10
+ *
11
+ * - Protocol version
12
+ * - HTTP method
13
+ * - URI
14
+ * - Headers
15
+ * - Message body
16
+ *
17
+ * During construction, implementations MUST attempt to set the Host header from
18
+ * a provided URI if no Host header is provided.
19
+ *
20
+ * Requests are considered immutable; all methods that might change state MUST
21
+ * be implemented such that they retain the internal state of the current
22
+ * message and return an instance that contains the changed state.
23
+ */
24
+ interface RequestInterface extends MessageInterface
25
+ {
26
+ /**
27
+ * Retrieves the message's request target.
28
+ *
29
+ * Retrieves the message's request-target either as it will appear (for
30
+ * clients), as it appeared at request (for servers), or as it was
31
+ * specified for the instance (see withRequestTarget()).
32
+ *
33
+ * In most cases, this will be the origin-form of the composed URI,
34
+ * unless a value was provided to the concrete implementation (see
35
+ * withRequestTarget() below).
36
+ *
37
+ * If no URI is available, and no request-target has been specifically
38
+ * provided, this method MUST return the string "/".
39
+ *
40
+ * @return string
41
+ */
42
+ public function getRequestTarget();
43
+
44
+ /**
45
+ * Return an instance with the specific request-target.
46
+ *
47
+ * If the request needs a non-origin-form request-target — e.g., for
48
+ * specifying an absolute-form, authority-form, or asterisk-form —
49
+ * this method may be used to create an instance with the specified
50
+ * request-target, verbatim.
51
+ *
52
+ * This method MUST be implemented in such a way as to retain the
53
+ * immutability of the message, and MUST return an instance that has the
54
+ * changed request target.
55
+ *
56
+ * @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
57
+ * request-target forms allowed in request messages)
58
+ * @param mixed $requestTarget
59
+ * @return static
60
+ */
61
+ public function withRequestTarget($requestTarget);
62
+
63
+ /**
64
+ * Retrieves the HTTP method of the request.
65
+ *
66
+ * @return string Returns the request method.
67
+ */
68
+ public function getMethod();
69
+
70
+ /**
71
+ * Return an instance with the provided HTTP method.
72
+ *
73
+ * While HTTP method names are typically all uppercase characters, HTTP
74
+ * method names are case-sensitive and thus implementations SHOULD NOT
75
+ * modify the given string.
76
+ *
77
+ * This method MUST be implemented in such a way as to retain the
78
+ * immutability of the message, and MUST return an instance that has the
79
+ * changed request method.
80
+ *
81
+ * @param string $method Case-sensitive method.
82
+ * @return static
83
+ * @throws \InvalidArgumentException for invalid HTTP methods.
84
+ */
85
+ public function withMethod($method);
86
+
87
+ /**
88
+ * Retrieves the URI instance.
89
+ *
90
+ * This method MUST return a UriInterface instance.
91
+ *
92
+ * @link http://tools.ietf.org/html/rfc3986#section-4.3
93
+ * @return UriInterface Returns a UriInterface instance
94
+ * representing the URI of the request.
95
+ */
96
+ public function getUri();
97
+
98
+ /**
99
+ * Returns an instance with the provided URI.
100
+ *
101
+ * This method MUST update the Host header of the returned request by
102
+ * default if the URI contains a host component. If the URI does not
103
+ * contain a host component, any pre-existing Host header MUST be carried
104
+ * over to the returned request.
105
+ *
106
+ * You can opt-in to preserving the original state of the Host header by
107
+ * setting `$preserveHost` to `true`. When `$preserveHost` is set to
108
+ * `true`, this method interacts with the Host header in the following ways:
109
+ *
110
+ * - If the Host header is missing or empty, and the new URI contains
111
+ * a host component, this method MUST update the Host header in the returned
112
+ * request.
113
+ * - If the Host header is missing or empty, and the new URI does not contain a
114
+ * host component, this method MUST NOT update the Host header in the returned
115
+ * request.
116
+ * - If a Host header is present and non-empty, this method MUST NOT update
117
+ * the Host header in the returned request.
118
+ *
119
+ * This method MUST be implemented in such a way as to retain the
120
+ * immutability of the message, and MUST return an instance that has the
121
+ * new UriInterface instance.
122
+ *
123
+ * @link http://tools.ietf.org/html/rfc3986#section-4.3
124
+ * @param UriInterface $uri New request URI to use.
125
+ * @param bool $preserveHost Preserve the original state of the Host header.
126
+ * @return static
127
+ */
128
+ public function withUri(UriInterface $uri, $preserveHost = false);
129
+ }
Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/ResponseInterface.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ /**
6
+ * Representation of an outgoing, server-side response.
7
+ *
8
+ * Per the HTTP specification, this interface includes properties for
9
+ * each of the following:
10
+ *
11
+ * - Protocol version
12
+ * - Status code and reason phrase
13
+ * - Headers
14
+ * - Message body
15
+ *
16
+ * Responses are considered immutable; all methods that might change state MUST
17
+ * be implemented such that they retain the internal state of the current
18
+ * message and return an instance that contains the changed state.
19
+ */
20
+ interface ResponseInterface extends MessageInterface
21
+ {
22
+ /**
23
+ * Gets the response status code.
24
+ *
25
+ * The status code is a 3-digit integer result code of the server's attempt
26
+ * to understand and satisfy the request.
27
+ *
28
+ * @return int Status code.
29
+ */
30
+ public function getStatusCode();
31
+
32
+ /**
33
+ * Return an instance with the specified status code and, optionally, reason phrase.
34
+ *
35
+ * If no reason phrase is specified, implementations MAY choose to default
36
+ * to the RFC 7231 or IANA recommended reason phrase for the response's
37
+ * status code.
38
+ *
39
+ * This method MUST be implemented in such a way as to retain the
40
+ * immutability of the message, and MUST return an instance that has the
41
+ * updated status and reason phrase.
42
+ *
43
+ * @link http://tools.ietf.org/html/rfc7231#section-6
44
+ * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
45
+ * @param int $code The 3-digit integer result code to set.
46
+ * @param string $reasonPhrase The reason phrase to use with the
47
+ * provided status code; if none is provided, implementations MAY
48
+ * use the defaults as suggested in the HTTP specification.
49
+ * @return static
50
+ * @throws \InvalidArgumentException For invalid status code arguments.
51
+ */
52
+ public function withStatus($code, $reasonPhrase = '');
53
+
54
+ /**
55
+ * Gets the response reason phrase associated with the status code.
56
+ *
57
+ * Because a reason phrase is not a required element in a response
58
+ * status line, the reason phrase value MAY be null. Implementations MAY
59
+ * choose to return the default RFC 7231 recommended reason phrase (or those
60
+ * listed in the IANA HTTP Status Code Registry) for the response's
61
+ * status code.
62
+ *
63
+ * @link http://tools.ietf.org/html/rfc7231#section-6
64
+ * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
65
+ * @return string Reason phrase; must return an empty string if none present.
66
+ */
67
+ public function getReasonPhrase();
68
+ }
Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/ServerRequestInterface.php ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ /**
6
+ * Representation of an incoming, server-side HTTP request.
7
+ *
8
+ * Per the HTTP specification, this interface includes properties for
9
+ * each of the following:
10
+ *
11
+ * - Protocol version
12
+ * - HTTP method
13
+ * - URI
14
+ * - Headers
15
+ * - Message body
16
+ *
17
+ * Additionally, it encapsulates all data as it has arrived to the
18
+ * application from the CGI and/or PHP environment, including:
19
+ *
20
+ * - The values represented in $_SERVER.
21
+ * - Any cookies provided (generally via $_COOKIE)
22
+ * - Query string arguments (generally via $_GET, or as parsed via parse_str())
23
+ * - Upload files, if any (as represented by $_FILES)
24
+ * - Deserialized body parameters (generally from $_POST)
25
+ *
26
+ * $_SERVER values MUST be treated as immutable, as they represent application
27
+ * state at the time of request; as such, no methods are provided to allow
28
+ * modification of those values. The other values provide such methods, as they
29
+ * can be restored from $_SERVER or the request body, and may need treatment
30
+ * during the application (e.g., body parameters may be deserialized based on
31
+ * content type).
32
+ *
33
+ * Additionally, this interface recognizes the utility of introspecting a
34
+ * request to derive and match additional parameters (e.g., via URI path
35
+ * matching, decrypting cookie values, deserializing non-form-encoded body
36
+ * content, matching authorization headers to users, etc). These parameters
37
+ * are stored in an "attributes" property.
38
+ *
39
+ * Requests are considered immutable; all methods that might change state MUST
40
+ * be implemented such that they retain the internal state of the current
41
+ * message and return an instance that contains the changed state.
42
+ */
43
+ interface ServerRequestInterface extends RequestInterface
44
+ {
45
+ /**
46
+ * Retrieve server parameters.
47
+ *
48
+ * Retrieves data related to the incoming request environment,
49
+ * typically derived from PHP's $_SERVER superglobal. The data IS NOT
50
+ * REQUIRED to originate from $_SERVER.
51
+ *
52
+ * @return array
53
+ */
54
+ public function getServerParams();
55
+
56
+ /**
57
+ * Retrieve cookies.
58
+ *
59
+ * Retrieves cookies sent by the client to the server.
60
+ *
61
+ * The data MUST be compatible with the structure of the $_COOKIE
62
+ * superglobal.
63
+ *
64
+ * @return array
65
+ */
66
+ public function getCookieParams();
67
+
68
+ /**
69
+ * Return an instance with the specified cookies.
70
+ *
71
+ * The data IS NOT REQUIRED to come from the $_COOKIE superglobal, but MUST
72
+ * be compatible with the structure of $_COOKIE. Typically, this data will
73
+ * be injected at instantiation.
74
+ *
75
+ * This method MUST NOT update the related Cookie header of the request
76
+ * instance, nor related values in the server params.
77
+ *
78
+ * This method MUST be implemented in such a way as to retain the
79
+ * immutability of the message, and MUST return an instance that has the
80
+ * updated cookie values.
81
+ *
82
+ * @param array $cookies Array of key/value pairs representing cookies.
83
+ * @return static
84
+ */
85
+ public function withCookieParams(array $cookies);
86
+
87
+ /**
88
+ * Retrieve query string arguments.
89
+ *
90
+ * Retrieves the deserialized query string arguments, if any.
91
+ *
92
+ * Note: the query params might not be in sync with the URI or server
93
+ * params. If you need to ensure you are only getting the original
94
+ * values, you may need to parse the query string from `getUri()->getQuery()`
95
+ * or from the `QUERY_STRING` server param.
96
+ *
97
+ * @return array
98
+ */
99
+ public function getQueryParams();
100
+
101
+ /**
102
+ * Return an instance with the specified query string arguments.
103
+ *
104
+ * These values SHOULD remain immutable over the course of the incoming
105
+ * request. They MAY be injected during instantiation, such as from PHP's
106
+ * $_GET superglobal, or MAY be derived from some other value such as the
107
+ * URI. In cases where the arguments are parsed from the URI, the data
108
+ * MUST be compatible with what PHP's parse_str() would return for
109
+ * purposes of how duplicate query parameters are handled, and how nested
110
+ * sets are handled.
111
+ *
112
+ * Setting query string arguments MUST NOT change the URI stored by the
113
+ * request, nor the values in the server params.
114
+ *
115
+ * This method MUST be implemented in such a way as to retain the
116
+ * immutability of the message, and MUST return an instance that has the
117
+ * updated query string arguments.
118
+ *
119
+ * @param array $query Array of query string arguments, typically from
120
+ * $_GET.
121
+ * @return static
122
+ */
123
+ public function withQueryParams(array $query);
124
+
125
+ /**
126
+ * Retrieve normalized file upload data.
127
+ *
128
+ * This method returns upload metadata in a normalized tree, with each leaf
129
+ * an instance of Psr\Http\Message\UploadedFileInterface.
130
+ *
131
+ * These values MAY be prepared from $_FILES or the message body during
132
+ * instantiation, or MAY be injected via withUploadedFiles().
133
+ *
134
+ * @return array An array tree of UploadedFileInterface instances; an empty
135
+ * array MUST be returned if no data is present.
136
+ */
137
+ public function getUploadedFiles();
138
+
139
+ /**
140
+ * Create a new instance with the specified uploaded files.
141
+ *
142
+ * This method MUST be implemented in such a way as to retain the
143
+ * immutability of the message, and MUST return an instance that has the
144
+ * updated body parameters.
145
+ *
146
+ * @param array $uploadedFiles An array tree of UploadedFileInterface instances.
147
+ * @return static
148
+ * @throws \InvalidArgumentException if an invalid structure is provided.
149
+ */
150
+ public function withUploadedFiles(array $uploadedFiles);
151
+
152
+ /**
153
+ * Retrieve any parameters provided in the request body.
154
+ *
155
+ * If the request Content-Type is either application/x-www-form-urlencoded
156
+ * or multipart/form-data, and the request method is POST, this method MUST
157
+ * return the contents of $_POST.
158
+ *
159
+ * Otherwise, this method may return any results of deserializing
160
+ * the request body content; as parsing returns structured content, the
161
+ * potential types MUST be arrays or objects only. A null value indicates
162
+ * the absence of body content.
163
+ *
164
+ * @return null|array|object The deserialized body parameters, if any.
165
+ * These will typically be an array or object.
166
+ */
167
+ public function getParsedBody();
168
+
169
+ /**
170
+ * Return an instance with the specified body parameters.
171
+ *
172
+ * These MAY be injected during instantiation.
173
+ *
174
+ * If the request Content-Type is either application/x-www-form-urlencoded
175
+ * or multipart/form-data, and the request method is POST, use this method
176
+ * ONLY to inject the contents of $_POST.
177
+ *
178
+ * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of
179
+ * deserializing the request body content. Deserialization/parsing returns
180
+ * structured data, and, as such, this method ONLY accepts arrays or objects,
181
+ * or a null value if nothing was available to parse.
182
+ *
183
+ * As an example, if content negotiation determines that the request data
184
+ * is a JSON payload, this method could be used to create a request
185
+ * instance with the deserialized parameters.
186
+ *
187
+ * This method MUST be implemented in such a way as to retain the
188
+ * immutability of the message, and MUST return an instance that has the
189
+ * updated body parameters.
190
+ *
191
+ * @param null|array|object $data The deserialized body data. This will
192
+ * typically be in an array or object.
193
+ * @return static
194
+ * @throws \InvalidArgumentException if an unsupported argument type is
195
+ * provided.
196
+ */
197
+ public function withParsedBody($data);
198
+
199
+ /**
200
+ * Retrieve attributes derived from the request.
201
+ *
202
+ * The request "attributes" may be used to allow injection of any
203
+ * parameters derived from the request: e.g., the results of path
204
+ * match operations; the results of decrypting cookies; the results of
205
+ * deserializing non-form-encoded message bodies; etc. Attributes
206
+ * will be application and request specific, and CAN be mutable.
207
+ *
208
+ * @return array Attributes derived from the request.
209
+ */
210
+ public function getAttributes();
211
+
212
+ /**
213
+ * Retrieve a single derived request attribute.
214
+ *
215
+ * Retrieves a single derived request attribute as described in
216
+ * getAttributes(). If the attribute has not been previously set, returns
217
+ * the default value as provided.
218
+ *
219
+ * This method obviates the need for a hasAttribute() method, as it allows
220
+ * specifying a default value to return if the attribute is not found.
221
+ *
222
+ * @see getAttributes()
223
+ * @param string $name The attribute name.
224
+ * @param mixed $default Default value to return if the attribute does not exist.
225
+ * @return mixed
226
+ */
227
+ public function getAttribute($name, $default = null);
228
+
229
+ /**
230
+ * Return an instance with the specified derived request attribute.
231
+ *
232
+ * This method allows setting a single derived request attribute as
233
+ * described in getAttributes().
234
+ *
235
+ * This method MUST be implemented in such a way as to retain the
236
+ * immutability of the message, and MUST return an instance that has the
237
+ * updated attribute.
238
+ *
239
+ * @see getAttributes()
240
+ * @param string $name The attribute name.
241
+ * @param mixed $value The value of the attribute.
242
+ * @return static
243
+ */
244
+ public function withAttribute($name, $value);
245
+
246
+ /**
247
+ * Return an instance that removes the specified derived request attribute.
248
+ *
249
+ * This method allows removing a single derived request attribute as
250
+ * described in getAttributes().
251
+ *
252
+ * This method MUST be implemented in such a way as to retain the
253
+ * immutability of the message, and MUST return an instance that removes
254
+ * the attribute.
255
+ *
256
+ * @see getAttributes()
257
+ * @param string $name The attribute name.
258
+ * @return static
259
+ */
260
+ public function withoutAttribute($name);
261
+ }
Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/StreamInterface.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ /**
6
+ * Describes a data stream.
7
+ *
8
+ * Typically, an instance will wrap a PHP stream; this interface provides
9
+ * a wrapper around the most common operations, including serialization of
10
+ * the entire stream to a string.
11
+ */
12
+ interface StreamInterface
13
+ {
14
+ /**
15
+ * Reads all data from the stream into a string, from the beginning to end.
16
+ *
17
+ * This method MUST attempt to seek to the beginning of the stream before
18
+ * reading data and read the stream until the end is reached.
19
+ *
20
+ * Warning: This could attempt to load a large amount of data into memory.
21
+ *
22
+ * This method MUST NOT raise an exception in order to conform with PHP's
23
+ * string casting operations.
24
+ *
25
+ * @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
26
+ * @return string
27
+ */
28
+ public function __toString();
29
+
30
+ /**
31
+ * Closes the stream and any underlying resources.
32
+ *
33
+ * @return void
34
+ */
35
+ public function close();
36
+
37
+ /**
38
+ * Separates any underlying resources from the stream.
39
+ *
40
+ * After the stream has been detached, the stream is in an unusable state.
41
+ *
42
+ * @return resource|null Underlying PHP stream, if any
43
+ */
44
+ public function detach();
45
+
46
+ /**
47
+ * Get the size of the stream if known.
48
+ *
49
+ * @return int|null Returns the size in bytes if known, or null if unknown.
50
+ */
51
+ public function getSize();
52
+
53
+ /**
54
+ * Returns the current position of the file read/write pointer
55
+ *
56
+ * @return int Position of the file pointer
57
+ * @throws \RuntimeException on error.
58
+ */
59
+ public function tell();
60
+
61
+ /**
62
+ * Returns true if the stream is at the end of the stream.
63
+ *
64
+ * @return bool
65
+ */
66
+ public function eof();
67
+
68
+ /**
69
+ * Returns whether or not the stream is seekable.
70
+ *
71
+ * @return bool
72
+ */
73
+ public function isSeekable();
74
+
75
+ /**
76
+ * Seek to a position in the stream.
77
+ *
78
+ * @link http://www.php.net/manual/en/function.fseek.php
79
+ * @param int $offset Stream offset
80
+ * @param int $whence Specifies how the cursor position will be calculated
81
+ * based on the seek offset. Valid values are identical to the built-in
82
+ * PHP $whence values for `fseek()`. SEEK_SET: Set position equal to
83
+ * offset bytes SEEK_CUR: Set position to current location plus offset
84
+ * SEEK_END: Set position to end-of-stream plus offset.
85
+ * @throws \RuntimeException on failure.
86
+ */
87
+ public function seek($offset, $whence = SEEK_SET);
88
+
89
+ /**
90
+ * Seek to the beginning of the stream.
91
+ *
92
+ * If the stream is not seekable, this method will raise an exception;
93
+ * otherwise, it will perform a seek(0).
94
+ *
95
+ * @see seek()
96
+ * @link http://www.php.net/manual/en/function.fseek.php
97
+ * @throws \RuntimeException on failure.
98
+ */
99
+ public function rewind();
100
+
101
+ /**
102
+ * Returns whether or not the stream is writable.
103
+ *
104
+ * @return bool
105
+ */
106
+ public function isWritable();
107
+
108
+ /**
109
+ * Write data to the stream.
110
+ *
111
+ * @param string $string The string that is to be written.
112
+ * @return int Returns the number of bytes written to the stream.
113
+ * @throws \RuntimeException on failure.
114
+ */
115
+ public function write($string);
116
+
117
+ /**
118
+ * Returns whether or not the stream is readable.
119
+ *
120
+ * @return bool
121
+ */
122
+ public function isReadable();
123
+
124
+ /**
125
+ * Read data from the stream.
126
+ *
127
+ * @param int $length Read up to $length bytes from the object and return
128
+ * them. Fewer than $length bytes may be returned if underlying stream
129
+ * call returns fewer bytes.
130
+ * @return string Returns the data read from the stream, or an empty string
131
+ * if no bytes are available.
132
+ * @throws \RuntimeException if an error occurs.
133
+ */
134
+ public function read($length);
135
+
136
+ /**
137
+ * Returns the remaining contents in a string
138
+ *
139
+ * @return string
140
+ * @throws \RuntimeException if unable to read or an error occurs while
141
+ * reading.
142
+ */
143
+ public function getContents();
144
+
145
+ /**
146
+ * Get stream metadata as an associative array or retrieve a specific key.
147
+ *
148
+ * The keys returned are identical to the keys returned from PHP's
149
+ * stream_get_meta_data() function.
150
+ *
151
+ * @link http://php.net/manual/en/function.stream-get-meta-data.php
152
+ * @param string $key Specific metadata to retrieve.
153
+ * @return array|mixed|null Returns an associative array if no key is
154
+ * provided. Returns a specific key value if a key is provided and the
155
+ * value is found, or null if the key is not found.
156
+ */
157
+ public function getMetadata($key = null);
158
+ }
Postman/Postman-Mail/mailgun/vendor/psr/http-message/src/UploadedFileInterface.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Http\Message;
4
+
5
+ /**
6
+ * Value object representing a file uploaded through an HTTP request.
7
+ *
8
+ * Instances of this interface are considered immutable; all methods that
9
+ * might change state MUST be implemented such that they retain the internal
10
+ * state of the current instance and return an instance that contains the
11
+ * changed state.
12
+ */
13
+ interface UploadedFileInterface
14
+ {
15
+ /**
16
+ * Retrieve a stre