NthMobile_EasyWebShopSMS - Version 1.0.2

Version Notes

First release

Download this release

Release Info

Developer NTH
Extension NthMobile_EasyWebShopSMS
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

Files changed (250) hide show
  1. app/code/community/NthMobile/EasyWebShopSMS/Block/Adminhtml/Easywebshopsmsabandonedcarts.php +1 -1
  2. app/code/community/NthMobile/EasyWebShopSMS/Block/Adminhtml/System/Config/Backend/Cron.php +38 -0
  3. app/code/community/NthMobile/EasyWebShopSMS/Helper/Data.php +23 -22
  4. app/code/community/NthMobile/EasyWebShopSMS/Model/Config.php +24 -0
  5. app/code/community/NthMobile/EasyWebShopSMS/Model/Notifier.php +32 -3
  6. app/code/community/NthMobile/EasyWebShopSMS/Model/Observer.php +21 -0
  7. app/code/community/NthMobile/EasyWebShopSMS/etc/config.xml +33 -0
  8. app/code/community/NthMobile/EasyWebShopSMS/etc/system.xml +59 -3
  9. app/code/community/NthMobile/EasyWebShopSMS/lib/composer.json +28 -0
  10. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/autoload.php +7 -0
  11. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/ClassLoader.php +415 -0
  12. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/LICENSE +21 -0
  13. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_classmap.php +9 -0
  14. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_files.php +16 -0
  15. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_namespaces.php +10 -0
  16. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_psr4.php +20 -0
  17. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_real.php +70 -0
  18. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_static.php +114 -0
  19. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/installed.json +716 -0
  20. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/.travis.yml +21 -0
  21. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/LICENSE +19 -0
  22. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/README.md +6 -0
  23. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/composer.json +29 -0
  24. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php +482 -0
  25. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/phpunit.xml.dist +31 -0
  26. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php +309 -0
  27. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php +10 -0
  28. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/tests/Doctrine/Tests/TestInit.php +27 -0
  29. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/.travis.yml +41 -0
  30. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/CHANGELOG.md +1239 -0
  31. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/LICENSE +19 -0
  32. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/README.md +90 -0
  33. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/UPGRADING.md +1203 -0
  34. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/composer.json +41 -0
  35. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Client.php +408 -0
  36. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/ClientInterface.php +84 -0
  37. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php +265 -0
  38. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +84 -0
  39. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php +90 -0
  40. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +71 -0
  41. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +404 -0
  42. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php +7 -0
  43. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php +7 -0
  44. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php +37 -0
  45. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php +4 -0
  46. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php +210 -0
  47. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php +27 -0
  48. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php +7 -0
  49. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php +4 -0
  50. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php +4 -0
  51. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +536 -0
  52. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php +27 -0
  53. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php +45 -0
  54. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +197 -0
  55. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php +92 -0
  56. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php +176 -0
  57. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php +55 -0
  58. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +490 -0
  59. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/HandlerStack.php +273 -0
  60. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/MessageFormatter.php +182 -0
  61. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Middleware.php +254 -0
  62. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Pool.php +123 -0
  63. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php +112 -0
  64. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php +231 -0
  65. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/RequestOptions.php +244 -0
  66. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php +112 -0
  67. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/TransferStats.php +126 -0
  68. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/UriTemplate.php +241 -0
  69. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/functions.php +329 -0
  70. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/functions_include.php +6 -0
  71. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/.travis.yml +20 -0
  72. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/CHANGELOG.md +36 -0
  73. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/LICENSE +19 -0
  74. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/Makefile +13 -0
  75. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/README.md +504 -0
  76. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/composer.json +31 -0
  77. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/phpunit.xml.dist +17 -0
  78. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/AggregateException.php +16 -0
  79. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/CancellationException.php +9 -0
  80. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/Coroutine.php +151 -0
  81. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/EachPromise.php +229 -0
  82. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/FulfilledPromise.php +82 -0
  83. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/Promise.php +273 -0
  84. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/PromiseInterface.php +93 -0
  85. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/PromisorInterface.php +15 -0
  86. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/RejectedPromise.php +87 -0
  87. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/RejectionException.php +47 -0
  88. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/TaskQueue.php +66 -0
  89. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/TaskQueueInterface.php +25 -0
  90. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/functions.php +457 -0
  91. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/functions_include.php +6 -0
  92. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/AggregateExceptionTest.php +14 -0
  93. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/CoroutineTest.php +65 -0
  94. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/EachPromiseTest.php +336 -0
  95. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php +108 -0
  96. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/NotPromiseInstance.php +50 -0
  97. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/PromiseTest.php +591 -0
  98. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/RejectedPromiseTest.php +143 -0
  99. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/RejectionExceptionTest.php +47 -0
  100. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/TaskQueueTest.php +31 -0
  101. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/Thennable.php +24 -0
  102. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/bootstrap.php +4 -0
  103. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/functionsTest.php +694 -0
  104. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/.travis.yml +20 -0
  105. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/CHANGELOG.md +70 -0
  106. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/LICENSE +19 -0
  107. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/Makefile +29 -0
  108. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/README.md +569 -0
  109. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/composer.json +35 -0
  110. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/phpunit.xml.dist +17 -0
  111. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/AppendStream.php +233 -0
  112. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/BufferStream.php +137 -0
  113. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/CachingStream.php +138 -0
  114. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/DroppingStream.php +42 -0
  115. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/FnStream.php +149 -0
  116. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/InflateStream.php +52 -0
  117. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/LazyOpenStream.php +39 -0
  118. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/LimitStream.php +155 -0
  119. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/MessageTrait.php +183 -0
  120. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/MultipartStream.php +153 -0
  121. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/NoSeekStream.php +22 -0
  122. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/PumpStream.php +165 -0
  123. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/Request.php +142 -0
  124. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/Response.php +131 -0
  125. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/ServerRequest.php +346 -0
  126. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/Stream.php +245 -0
  127. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php +149 -0
  128. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/StreamWrapper.php +121 -0
  129. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/UploadedFile.php +316 -0
  130. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/Uri.php +602 -0
  131. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/functions.php +826 -0
  132. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/functions_include.php +6 -0
  133. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/AppendStreamTest.php +186 -0
  134. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/BufferStreamTest.php +63 -0
  135. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php +193 -0
  136. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/DroppingStreamTest.php +26 -0
  137. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/FnStreamTest.php +90 -0
  138. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/FunctionsTest.php +619 -0
  139. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php +39 -0
  140. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/LazyOpenStreamTest.php +64 -0
  141. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/LimitStreamTest.php +166 -0
  142. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/MultipartStreamTest.php +242 -0
  143. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/NoSeekStreamTest.php +40 -0
  144. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/PumpStreamTest.php +72 -0
  145. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/RequestTest.php +195 -0
  146. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/ResponseTest.php +252 -0
  147. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/ServerRequestTest.php +532 -0
  148. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php +137 -0
  149. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/StreamTest.php +161 -0
  150. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/StreamWrapperTest.php +102 -0
  151. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/UploadedFileTest.php +280 -0
  152. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/UriTest.php +573 -0
  153. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/bootstrap.php +11 -0
  154. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Access/Authorizable.php +15 -0
  155. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Access/Gate.php +104 -0
  156. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Authenticatable.php +49 -0
  157. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/CanResetPassword.php +21 -0
  158. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Factory.php +22 -0
  159. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Guard.php +50 -0
  160. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/PasswordBroker.php +76 -0
  161. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/PasswordBrokerFactory.php +14 -0
  162. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/StatefulGuard.php +64 -0
  163. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/SupportsBasicAuth.php +24 -0
  164. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/UserProvider.php +49 -0
  165. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Broadcasting/Broadcaster.php +33 -0
  166. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Broadcasting/Factory.php +14 -0
  167. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Broadcasting/ShouldBroadcast.php +13 -0
  168. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Broadcasting/ShouldBroadcastNow.php +8 -0
  169. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Bus/Dispatcher.php +31 -0
  170. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Bus/QueueingDispatcher.php +14 -0
  171. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cache/Factory.php +14 -0
  172. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cache/Repository.php +117 -0
  173. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cache/Store.php +92 -0
  174. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Config/Repository.php +57 -0
  175. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Console/Application.php +22 -0
  176. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Console/Kernel.php +47 -0
  177. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Container/BindingResolutionException.php +10 -0
  178. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Container/Container.php +144 -0
  179. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Container/ContextualBindingBuilder.php +22 -0
  180. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cookie/Factory.php +43 -0
  181. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cookie/QueueingFactory.php +27 -0
  182. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Database/ModelIdentifier.php +35 -0
  183. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Debug/ExceptionHandler.php +34 -0
  184. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Encryption/DecryptException.php +10 -0
  185. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Encryption/EncryptException.php +10 -0
  186. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Encryption/Encrypter.php +22 -0
  187. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Events/Dispatcher.php +90 -0
  188. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Filesystem/Cloud.php +14 -0
  189. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Filesystem/Factory.php +14 -0
  190. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Filesystem/FileNotFoundException.php +10 -0
  191. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Filesystem/Filesystem.php +175 -0
  192. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Foundation/Application.php +99 -0
  193. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Hashing/Hasher.php +34 -0
  194. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Http/Kernel.php +37 -0
  195. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Logging/Log.php +98 -0
  196. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Mail/MailQueue.php +29 -0
  197. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Mail/Mailable.php +33 -0
  198. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Mail/Mailer.php +32 -0
  199. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Notifications/Dispatcher.php +24 -0
  200. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Notifications/Factory.php +32 -0
  201. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Pagination/LengthAwarePaginator.php +20 -0
  202. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Pagination/Paginator.php +109 -0
  203. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Pipeline/Hub.php +15 -0
  204. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Pipeline/Pipeline.php +40 -0
  205. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/EntityNotFoundException.php +22 -0
  206. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/EntityResolver.php +15 -0
  207. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/Factory.php +14 -0
  208. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/Job.php +85 -0
  209. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/Monitor.php +30 -0
  210. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/Queue.php +74 -0
  211. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/QueueableCollection.php +20 -0
  212. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/QueueableEntity.php +13 -0
  213. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/ShouldQueue.php +8 -0
  214. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Redis/Database.php +15 -0
  215. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Routing/Registrar.php +107 -0
  216. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Routing/ResponseFactory.php +126 -0
  217. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Routing/UrlGenerator.php +71 -0
  218. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Routing/UrlRoutable.php +20 -0
  219. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/Arrayable.php +13 -0
  220. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/Htmlable.php +13 -0
  221. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/Jsonable.php +14 -0
  222. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/MessageBag.php +100 -0
  223. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/MessageProvider.php +13 -0
  224. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/Renderable.php +13 -0
  225. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Validation/Factory.php +46 -0
  226. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Validation/ValidatesWhenResolved.php +13 -0
  227. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Validation/Validator.php +40 -0
  228. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/View/Factory.php +71 -0
  229. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/View/View.php +24 -0
  230. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/composer.json +30 -0
  231. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/AggregateServiceProvider.php +52 -0
  232. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Arr.php +519 -0
  233. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/ClassLoader.php +104 -0
  234. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Collection.php +1352 -0
  235. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Composer.php +102 -0
  236. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Debug/Dumper.php +26 -0
  237. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Debug/HtmlDumper.php +29 -0
  238. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/App.php +19 -0
  239. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Artisan.php +19 -0
  240. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Auth.php +32 -0
  241. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Blade.php +19 -0
  242. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Broadcast.php +19 -0
  243. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Bus.php +31 -0
  244. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Cache.php +20 -0
  245. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Config.php +19 -0
  246. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Cookie.php +42 -0
  247. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Crypt.php +19 -0
  248. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/DB.php +20 -0
  249. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Event.php +31 -0
  250. app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Facade.php +154 -0
app/code/community/NthMobile/EasyWebShopSMS/Block/Adminhtml/Easywebshopsmsabandonedcarts.php CHANGED
@@ -12,7 +12,7 @@ class NthMobile_EasyWebShopSMS_Block_Adminhtml_Easywebshopsmsabandonedcarts exte
12
  {
13
  $this->_controller = 'adminhtml_easywebshopsmsabandonedcarts';
14
  $this->_blockGroup = 'easywebshopsms';
15
- $this->_headerText = Mage::helper('easywebshopsms')->__('Abandoned Carts (Applied delay: %s days)', Mage::getStoreConfig('abandonedcartsconfig/options/notify_delay'));
16
  parent::__construct();
17
  $this->_removeButton('add');
18
  $this->_addButton('notify', array(
12
  {
13
  $this->_controller = 'adminhtml_easywebshopsmsabandonedcarts';
14
  $this->_blockGroup = 'easywebshopsms';
15
+ $this->_headerText = Mage::helper('easywebshopsms')->__('Abandoned Carts (Applied delay: %s days)', Mage::getStoreConfig('easywebshopsms/abandoned_notifications/notify_delay'));
16
  parent::__construct();
17
  $this->_removeButton('add');
18
  $this->_addButton('notify', array(
app/code/community/NthMobile/EasyWebShopSMS/Block/Adminhtml/System/Config/Backend/Cron.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Created by PhpStorm.
5
+ * User: Nikola Bakos
6
+ * Date: 5.12.2016.
7
+ * Time: 16:00
8
+ */
9
+ class NthMobile_EasyWebShopSMS_Block_Adminhtml_System_Config_Backend_Cron extends Mage_Core_Model_Config_Data
10
+ {
11
+ const CRON_STRING_PATH_easywebshopsms_abandonedcarts_send = 'crontab/jobs/easywebshopsms_abandonedcarts_send/schedule/cron_expr';
12
+ const CRON_STRING_PATH_easywebshopsms_abandonedcarts_sendsale = 'crontab/jobs/easywebshopsms_abandonedcarts_sendsale/schedule/cron_expr';
13
+
14
+
15
+ protected function _afterSave()
16
+ {
17
+ $expr = $this->getValue();
18
+
19
+ try {
20
+ Mage::getModel('core/config_data')
21
+ ->load(self::CRON_STRING_PATH_easywebshopsms_abandonedcarts_send, 'path')
22
+ ->setValue($expr)
23
+ ->setPath(self::CRON_STRING_PATH_easywebshopsms_abandonedcarts_send)
24
+ ->save();
25
+ Mage::getModel('core/config_data')
26
+ ->load(self::CRON_STRING_PATH_easywebshopsms_abandonedcarts_sendsale, 'path')
27
+ ->setValue($expr)
28
+ ->setPath(self::CRON_STRING_PATH_easywebshopsms_abandonedcarts_sendsale)
29
+ ->save();
30
+ }
31
+ catch (Exception $e) {
32
+ throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'));
33
+
34
+ }
35
+ }
36
+
37
+
38
+ }
app/code/community/NthMobile/EasyWebShopSMS/Helper/Data.php CHANGED
@@ -68,28 +68,29 @@ class NthMobile_EasyWebShopSMS_Helper_Data extends Mage_Core_Helper_Abstract
68
  if ($response->isOk()) {
69
 
70
  $textMessage = $response->resource();
71
-
72
- $inputData = [
73
- 'customer_id' => $customerData->getId(),
74
- 'event_name' => $data['event'],
75
- 'log_time' => Mage::getModel('core/date')->date('Y-m-d H:i:s'),
76
- 'sms_origin' => $origin,
77
- 'mobile_number' => $msisdn,
78
- 'message_text' => $text,
79
- 'sms_status_code'=> $textMessage->smsId()
80
- ];
81
-
82
- /*
83
- *sms_sent = integer (0 || 1)
84
- * sms_status_code = integer(Gatewway status code)
85
- * sms_status_message = string (200)
86
- * */
87
-
88
- Mage::getModel('easywebshopsms/easywebshopsms')
89
- ->setData($inputData)
90
- ->save();
91
-
92
- return true;
 
93
  } else {
94
  $error = $response->error();
95
 
68
  if ($response->isOk()) {
69
 
70
  $textMessage = $response->resource();
71
+ if(!empty($textMessage)) {
72
+ $inputData = [
73
+ 'customer_id' => $customerData->getId(),
74
+ 'event_name' => $data['event'],
75
+ 'log_time' => Mage::getModel('core/date')->date('Y-m-d H:i:s'),
76
+ 'sms_origin' => $origin,
77
+ 'mobile_number' => $msisdn,
78
+ 'message_text' => $text,
79
+ 'sms_status_code'=> $textMessage->smsId()
80
+ ];
81
+
82
+ /*
83
+ *sms_sent = integer (0 || 1)
84
+ * sms_status_code = integer(Gatewway status code)
85
+ * sms_status_message = string (200)
86
+ * */
87
+
88
+ Mage::getModel('easywebshopsms/easywebshopsms')
89
+ ->setData($inputData)
90
+ ->save();
91
+
92
+ return true;
93
+ }
94
  } else {
95
  $error = $response->error();
96
 
app/code/community/NthMobile/EasyWebShopSMS/Model/Config.php CHANGED
@@ -63,6 +63,30 @@ class NthMobile_EasyWebShopSMS_Model_Config
63
  return "";
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  private function _resolveConfigGroup($group)
67
  {
68
  if(empty($group)) {
63
  return "";
64
  }
65
 
66
+ /**
67
+ * checks if EasyWebShopSMS auto notify Enabled
68
+ * @return boolean
69
+ */
70
+ public function isAutoNotifyEnabled()
71
+ {
72
+ return (Mage::getStoreConfig('easywebshopsms/abandoned_notifications/auto_notify_enable')==0) ? false : true;
73
+ }
74
+
75
+ public function isAutoNotifyAbandoned()
76
+ {
77
+ return (Mage::getStoreConfig('easywebshopsms/abandoned_notifications/auto_notify_all_abandoned')==0) ? false : true;
78
+ }
79
+
80
+ public function isAutoNotifySale()
81
+ {
82
+ return (Mage::getStoreConfig('easywebshopsms/abandoned_notifications/auto_notify_all_sale')==0) ? false : true;
83
+ }
84
+
85
+ public function getAutoNotifySendStatusEmail()
86
+ {
87
+ return Mage::getStoreConfig('easywebshopsms/abandoned_notifications/auto_notify_send_status_email');
88
+ }
89
+
90
  private function _resolveConfigGroup($group)
91
  {
92
  if(empty($group)) {
app/code/community/NthMobile/EasyWebShopSMS/Model/Notifier.php CHANGED
@@ -284,7 +284,7 @@ class NthMobile_EasyWebShopSMS_Model_Notifier extends Mage_Core_Model_Abstract
284
  if(!$this->getConfig()->getDryRun()) {
285
  $quote->setEasywebshopsmsAbandonedSaleNotified(1);
286
 
287
- $quote->getResource()->saveAttribute($quote,array('easywebshopsms_abandoned_sale_notified'));
288
  }
289
  }
290
 
@@ -328,9 +328,9 @@ class NthMobile_EasyWebShopSMS_Model_Notifier extends Mage_Core_Model_Abstract
328
  if($helper->registerEvent($helper->prepareEventData("AbandonedCartEvent", $eventData), $text)){
329
  // We change the notification attribute
330
  if(!$this->getConfig()->getDryRun()) {
331
- $quote->setEasywebshopsmsAbandonedSaleNotified(1);
332
 
333
- $quote->getResource()->saveAttribute($quote, array('easywebshopsms_abandoned_notified'));
334
  }
335
  }
336
  }
@@ -463,6 +463,35 @@ class NthMobile_EasyWebShopSMS_Model_Notifier extends Mage_Core_Model_Abstract
463
  }
464
  }
465
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  /**
467
  * @return mixed|string
468
  */
284
  if(!$this->getConfig()->getDryRun()) {
285
  $quote->setEasywebshopsmsAbandonedSaleNotified(1);
286
 
287
+ $quote->save();
288
  }
289
  }
290
 
328
  if($helper->registerEvent($helper->prepareEventData("AbandonedCartEvent", $eventData), $text)){
329
  // We change the notification attribute
330
  if(!$this->getConfig()->getDryRun()) {
331
+ $quote->setEasywebshopsmsAbandonedNotified(1);
332
 
333
+ $quote->save();
334
  }
335
  }
336
  }
463
  }
464
  }
465
 
466
+
467
+ /**
468
+ * Send notification cron
469
+ */
470
+ public function sendAbandonedCartsCron(Mage_Cron_Model_Schedule $schedule = null)
471
+ {
472
+ if(!$this->getConfig()->isAutoNotifyEnabled()) {
473
+ return;
474
+ }
475
+ if($this->getConfig()->isAutoNotifyAbandoned()) {
476
+ $this->sendAbandonedCartsSMS();
477
+ }
478
+
479
+ }
480
+
481
+ /**
482
+ * Send notification cron
483
+ */
484
+ public function sendAbandonedCartsSaleCron(Mage_Cron_Model_Schedule $schedule = null)
485
+ {
486
+ if(!$this->getConfig()->isAutoNotifyEnabled()) {
487
+ return;
488
+ }
489
+ if($this->getConfig()->isAutoNotifySale()) {
490
+ $this->sendAbandonedCartsSaleSMS();
491
+ }
492
+
493
+ }
494
+
495
  /**
496
  * @return mixed|string
497
  */
app/code/community/NthMobile/EasyWebShopSMS/Model/Observer.php CHANGED
@@ -13,6 +13,18 @@ class NthMobile_EasyWebShopSMS_Model_Observer
13
  self::$lastExecutionTime = time();
14
  }
15
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /**
17
  * @return NthMobile_EasyWebShopSMS_Model_Config
18
  */
@@ -108,6 +120,8 @@ class NthMobile_EasyWebShopSMS_Model_Observer
108
 
109
  public function hookToCustomerLogin(Varien_Event_Observer $observer)
110
  {
 
 
111
  $eventConfig = "event_customer_login";
112
 
113
  $event = $observer->getEvent();
@@ -116,11 +130,14 @@ class NthMobile_EasyWebShopSMS_Model_Observer
116
  $text = $this->getConfig()->getEventMessageTemplate($eventConfig);
117
  $helper = $this->getHelper();
118
  $helper->registerEvent($helper->prepareEventData("CustomerLogin",$event->getData()),$text);
 
119
  }
120
  }
121
 
122
  public function hookToCustomerLogout(Varien_Event_Observer $observer)
123
  {
 
 
124
  $eventConfig = "event_customer_logout";
125
  $event = $observer->getEvent();
126
  if($this->getConfig()->isEventActive($eventConfig))
@@ -128,11 +145,14 @@ class NthMobile_EasyWebShopSMS_Model_Observer
128
  $text = $this->getConfig()->getEventMessageTemplate($eventConfig);
129
  $helper = $this->getHelper();
130
  $helper->registerEvent($helper->prepareEventData("CustomerLogout",$event->getData()),$text);
 
131
  }
132
  }
133
 
134
  public function hookToCustomerRegisterSuccess(Varien_Event_Observer $observer)
135
  {
 
 
136
  $eventConfig = "event_customer_register";
137
 
138
  $event = $observer->getEvent()->getData();
@@ -143,6 +163,7 @@ class NthMobile_EasyWebShopSMS_Model_Observer
143
  $helper = $this->getHelper();
144
 
145
  $helper->registerEvent($helper->prepareEventData("CustomerRegisterSuccess", $event),$text);
 
146
  }
147
  }
148
 
13
  self::$lastExecutionTime = time();
14
  }
15
 
16
+ public function autoload()
17
+ {
18
+
19
+ if(class_exists('\Samurai\BulkSms\Client', false)) {
20
+ return;
21
+ }
22
+ if(file_exists(__DIR__ . '/../lib/vendor/autoload.php')) {
23
+
24
+ require_once(__DIR__ . '/../lib/vendor/autoload.php');
25
+ }
26
+ }
27
+
28
  /**
29
  * @return NthMobile_EasyWebShopSMS_Model_Config
30
  */
120
 
121
  public function hookToCustomerLogin(Varien_Event_Observer $observer)
122
  {
123
+ if (time()-self::$lastExecutionTime<=$this->skipMultipleSendSmsPeriod)
124
+ return;
125
  $eventConfig = "event_customer_login";
126
 
127
  $event = $observer->getEvent();
130
  $text = $this->getConfig()->getEventMessageTemplate($eventConfig);
131
  $helper = $this->getHelper();
132
  $helper->registerEvent($helper->prepareEventData("CustomerLogin",$event->getData()),$text);
133
+ self::$lastExecutionTime = time();
134
  }
135
  }
136
 
137
  public function hookToCustomerLogout(Varien_Event_Observer $observer)
138
  {
139
+ if (time()-self::$lastExecutionTime<=$this->skipMultipleSendSmsPeriod)
140
+ return;
141
  $eventConfig = "event_customer_logout";
142
  $event = $observer->getEvent();
143
  if($this->getConfig()->isEventActive($eventConfig))
145
  $text = $this->getConfig()->getEventMessageTemplate($eventConfig);
146
  $helper = $this->getHelper();
147
  $helper->registerEvent($helper->prepareEventData("CustomerLogout",$event->getData()),$text);
148
+ self::$lastExecutionTime = time();
149
  }
150
  }
151
 
152
  public function hookToCustomerRegisterSuccess(Varien_Event_Observer $observer)
153
  {
154
+ if (time()-self::$lastExecutionTime<=$this->skipMultipleSendSmsPeriod)
155
+ return;
156
  $eventConfig = "event_customer_register";
157
 
158
  $event = $observer->getEvent()->getData();
163
  $helper = $this->getHelper();
164
 
165
  $helper->registerEvent($helper->prepareEventData("CustomerRegisterSuccess", $event),$text);
166
+ self::$lastExecutionTime = time();
167
  }
168
  }
169
 
app/code/community/NthMobile/EasyWebShopSMS/etc/config.xml CHANGED
@@ -127,6 +127,7 @@
127
  </NthMobile_EasyWebShopSMS_read>
128
  </resources>
129
  </global>
 
130
  <admin>
131
  <routers>
132
  <easywebshopsms>
@@ -194,4 +195,36 @@
194
  </resources>
195
  </acl>
196
  </adminhtml>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  </config>
127
  </NthMobile_EasyWebShopSMS_read>
128
  </resources>
129
  </global>
130
+
131
  <admin>
132
  <routers>
133
  <easywebshopsms>
195
  </resources>
196
  </acl>
197
  </adminhtml>
198
+
199
+ <default>
200
+ <easywebshopsms>
201
+ <api_connection>
202
+ <active>0</active>
203
+ <debug_mode>0</debug_mode>
204
+ <dry_run>0</dry_run>
205
+ </api_connection>
206
+ <abandoned_notifications>
207
+ <notify_delay>20</notify_delay>
208
+ <auto_notify_enable>0</auto_notify_enable>
209
+ <auto_notify_cron_expr>0 9 * * *</auto_notify_cron_expr>
210
+ <auto_notify_all>1</auto_notify_all>
211
+ </abandoned_notifications>
212
+ </easywebshopsms>
213
+ </default>
214
+
215
+ <crontab>
216
+ <jobs>
217
+ <easywebshopsms_abandonedcarts_send>
218
+ <run>
219
+ <model>easywebshopsms/notifier::sendAbandonedCartsCron</model>
220
+ </run>
221
+ </easywebshopsms_abandonedcarts_send>
222
+ <easywebshopsms_abandonedcarts_sendsale>
223
+ <run>
224
+ <model>easywebshopsms/notifier::sendAbandonedCartsSaleCron</model>
225
+ </run>
226
+ </easywebshopsms_abandonedcarts_sendsale>
227
+
228
+ </jobs>
229
+ </crontab>
230
  </config>
app/code/community/NthMobile/EasyWebShopSMS/etc/system.xml CHANGED
@@ -113,10 +113,11 @@
113
  <frontend_type>select</frontend_type>
114
  <sort_order>92</sort_order>
115
  <show_in_default>1</show_in_default>
116
- <show_in_website>0</show_in_website>
117
- <show_in_store>0</show_in_store>
118
  <source_model>adminhtml/system_config_source_yesno</source_model>
119
  </dry_run>
 
120
  </fields>
121
  </api_connection>
122
  <message_configuration translate="label">
@@ -456,7 +457,7 @@
456
  <notify_delay translate="label comment">
457
  <label>Delay / Send Abandoned Cart SMS After</label>
458
  <frontend_type>text</frontend_type>
459
- <validate>validate-not-negative-number</validate>
460
  <sort_order>10</sort_order>
461
  <show_in_default>1</show_in_default>
462
  <show_in_website>1</show_in_website>
@@ -473,6 +474,61 @@
473
  <show_in_store>1</show_in_store>
474
  </customer_groups>
475
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
  </fields>
477
  </abandoned_notifications>
478
 
113
  <frontend_type>select</frontend_type>
114
  <sort_order>92</sort_order>
115
  <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
  <source_model>adminhtml/system_config_source_yesno</source_model>
119
  </dry_run>
120
+
121
  </fields>
122
  </api_connection>
123
  <message_configuration translate="label">
457
  <notify_delay translate="label comment">
458
  <label>Delay / Send Abandoned Cart SMS After</label>
459
  <frontend_type>text</frontend_type>
460
+ <validate>validate-number</validate>
461
  <sort_order>10</sort_order>
462
  <show_in_default>1</show_in_default>
463
  <show_in_website>1</show_in_website>
474
  <show_in_store>1</show_in_store>
475
  </customer_groups>
476
 
477
+ <auto_notify_enable translate="label">
478
+ <label>Auto notify</label>
479
+ <frontend_type>select</frontend_type>
480
+ <sort_order>65</sort_order>
481
+ <show_in_default>1</show_in_default>
482
+ <show_in_website>1</show_in_website>
483
+ <show_in_store>1</show_in_store>
484
+ <source_model>adminhtml/system_config_source_yesno</source_model>
485
+ </auto_notify_enable>
486
+
487
+ <auto_notify_cron_expr translate="label">
488
+ <label>Auto notify Cron Schedule</label>
489
+ <frontend_type>text</frontend_type>
490
+ <backend_model>NthMobile_EasyWebShopSMS_Block_Adminhtml_System_Config_Backend_Cron</backend_model>
491
+ <sort_order>66</sort_order>
492
+ <show_in_default>1</show_in_default>
493
+ <show_in_website>1</show_in_website>
494
+ <show_in_store>1</show_in_store>
495
+ <depends><auto_notify_enable>1</auto_notify_enable></depends>
496
+ </auto_notify_cron_expr>
497
+
498
+ <auto_notify_all_abandoned translate="label">
499
+ <label>Notify all Abandoned</label>
500
+ <comment>Auto notify customers in abandoned cart list</comment>
501
+ <frontend_type>select</frontend_type>
502
+ <sort_order>67</sort_order>
503
+ <show_in_default>1</show_in_default>
504
+ <show_in_website>1</show_in_website>
505
+ <show_in_store>1</show_in_store>
506
+ <source_model>adminhtml/system_config_source_yesno</source_model>
507
+ <depends><auto_notify_enable>1</auto_notify_enable></depends>
508
+ </auto_notify_all_abandoned>
509
+
510
+ <auto_notify_all_sale translate="label">
511
+ <label>Notify all Sale Abandoned</label>
512
+ <comment>Auto notify customers in sale abandoned cart list</comment>
513
+ <frontend_type>select</frontend_type>
514
+ <sort_order>67</sort_order>
515
+ <show_in_default>1</show_in_default>
516
+ <show_in_website>1</show_in_website>
517
+ <show_in_store>1</show_in_store>
518
+ <source_model>adminhtml/system_config_source_yesno</source_model>
519
+ <depends><auto_notify_enable>1</auto_notify_enable></depends>
520
+ </auto_notify_all_sale>
521
+ <!--
522
+ <auto_notify_send_status_email translate="label">
523
+ <label>Send email about status. Enter email address</label>
524
+ <frontend_type>text</frontend_type>
525
+ <sort_order>68</sort_order>
526
+ <show_in_default>1</show_in_default>
527
+ <show_in_website>1</show_in_website>
528
+ <show_in_store>1</show_in_store>
529
+ <depends><auto_notify_enable>1</auto_notify_enable></depends>
530
+ </auto_notify_send_status_email>
531
+ -->
532
  </fields>
533
  </abandoned_notifications>
534
 
app/code/community/NthMobile/EasyWebShopSMS/lib/composer.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "nth-mobile/easywebshop-sms",
3
+ "homepage": "http://www.nth-mobile.com/",
4
+ "description": "Magento integration for EasyWebShop SMS",
5
+ "keywords": ["magento", "mobile", "payment", "sms", "notifications"],
6
+ "type": "magento-module",
7
+ "authors": [
8
+ {
9
+ "name":"NTH Mobile",
10
+ "email":"info@nth.ch"
11
+ }
12
+ ],
13
+ "require" : {
14
+ "php": ">=5.4.0",
15
+ "samurai/bulksms-client" : "dev-develop"
16
+ },
17
+ "repositories": [
18
+ { "type": "composer", "url": "https://packages.firegento.com" },
19
+ { "type": "composer", "url" : "http://packagist.nth.ch" }
20
+ ],
21
+ "config": {
22
+ "preferred-install": "dist",
23
+ "secure-http": false
24
+ },
25
+
26
+ "prefer-stable": true,
27
+ "minimum-stability": "dev"
28
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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 ComposerAutoloaderInit088b21c075234dd3a052b9efa302d556::getLoader();
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
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 || isset($this->missingClasses[$class])) {
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 (false === $file && defined('HHVM_VERSION')) {
333
+ $file = $this->findFileWithExtension($class, '.hh');
334
+ }
335
+
336
+ if (false === $file) {
337
+ // Remember that this class does not exist.
338
+ $this->missingClasses[$class] = true;
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
+ return false;
404
+ }
405
+ }
406
+
407
+ /**
408
+ * Scope isolated include.
409
+ *
410
+ * Prevents access to $this/self from included files.
411
+ */
412
+ function includeFile($file)
413
+ {
414
+ include $file;
415
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Copyright (c) 2016 Nils Adermann, Jordi Boggiano
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.
21
+
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ );
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_files.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
10
+ '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
11
+ 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
12
+ 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
13
+ '72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php',
14
+ '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
15
+ '023ae1e5025abd407207155c2118b379' => $vendorDir . '/samurai/bulksms-client/src/helpers.php',
16
+ );
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ 'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'),
10
+ );
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
10
+ 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
11
+ 'Samurai\\BulkSms\\' => array($vendorDir . '/samurai/bulksms-client/src'),
12
+ 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
13
+ 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
14
+ 'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'),
15
+ 'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
16
+ 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
17
+ 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
18
+ 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
19
+ 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
20
+ );
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit088b21c075234dd3a052b9efa302d556
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('ComposerAutoloaderInit088b21c075234dd3a052b9efa302d556', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit088b21c075234dd3a052b9efa302d556', 'loadClassLoader'));
25
+
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
29
+
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit088b21c075234dd3a052b9efa302d556::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
+
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
+ }
47
+
48
+ $loader->register(true);
49
+
50
+ if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit088b21c075234dd3a052b9efa302d556::$files;
52
+ } else {
53
+ $includeFiles = require __DIR__ . '/autoload_files.php';
54
+ }
55
+ foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire088b21c075234dd3a052b9efa302d556($fileIdentifier, $file);
57
+ }
58
+
59
+ return $loader;
60
+ }
61
+ }
62
+
63
+ function composerRequire088b21c075234dd3a052b9efa302d556($fileIdentifier, $file)
64
+ {
65
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
+ require $file;
67
+
68
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
69
+ }
70
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/autoload_static.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit088b21c075234dd3a052b9efa302d556
8
+ {
9
+ public static $files = array (
10
+ '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
11
+ '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
12
+ 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
13
+ 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
14
+ '72579e7bd17821bb1321b87411366eae' => __DIR__ . '/..' . '/illuminate/support/helpers.php',
15
+ '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
16
+ '023ae1e5025abd407207155c2118b379' => __DIR__ . '/..' . '/samurai/bulksms-client/src/helpers.php',
17
+ );
18
+
19
+ public static $prefixLengthsPsr4 = array (
20
+ 'S' =>
21
+ array (
22
+ 'Symfony\\Polyfill\\Mbstring\\' => 26,
23
+ 'Symfony\\Component\\Translation\\' => 30,
24
+ 'Samurai\\BulkSms\\' => 16,
25
+ ),
26
+ 'P' =>
27
+ array (
28
+ 'Psr\\Log\\' => 8,
29
+ 'Psr\\Http\\Message\\' => 17,
30
+ ),
31
+ 'I' =>
32
+ array (
33
+ 'Illuminate\\Support\\' => 19,
34
+ 'Illuminate\\Contracts\\' => 21,
35
+ ),
36
+ 'G' =>
37
+ array (
38
+ 'GuzzleHttp\\Psr7\\' => 16,
39
+ 'GuzzleHttp\\Promise\\' => 19,
40
+ 'GuzzleHttp\\' => 11,
41
+ ),
42
+ 'C' =>
43
+ array (
44
+ 'Carbon\\' => 7,
45
+ ),
46
+ );
47
+
48
+ public static $prefixDirsPsr4 = array (
49
+ 'Symfony\\Polyfill\\Mbstring\\' =>
50
+ array (
51
+ 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
52
+ ),
53
+ 'Symfony\\Component\\Translation\\' =>
54
+ array (
55
+ 0 => __DIR__ . '/..' . '/symfony/translation',
56
+ ),
57
+ 'Samurai\\BulkSms\\' =>
58
+ array (
59
+ 0 => __DIR__ . '/..' . '/samurai/bulksms-client/src',
60
+ ),
61
+ 'Psr\\Log\\' =>
62
+ array (
63
+ 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
64
+ ),
65
+ 'Psr\\Http\\Message\\' =>
66
+ array (
67
+ 0 => __DIR__ . '/..' . '/psr/http-message/src',
68
+ ),
69
+ 'Illuminate\\Support\\' =>
70
+ array (
71
+ 0 => __DIR__ . '/..' . '/illuminate/support',
72
+ ),
73
+ 'Illuminate\\Contracts\\' =>
74
+ array (
75
+ 0 => __DIR__ . '/..' . '/illuminate/contracts',
76
+ ),
77
+ 'GuzzleHttp\\Psr7\\' =>
78
+ array (
79
+ 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
80
+ ),
81
+ 'GuzzleHttp\\Promise\\' =>
82
+ array (
83
+ 0 => __DIR__ . '/..' . '/guzzlehttp/promises/src',
84
+ ),
85
+ 'GuzzleHttp\\' =>
86
+ array (
87
+ 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
88
+ ),
89
+ 'Carbon\\' =>
90
+ array (
91
+ 0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon',
92
+ ),
93
+ );
94
+
95
+ public static $prefixesPsr0 = array (
96
+ 'D' =>
97
+ array (
98
+ 'Doctrine\\Common\\Inflector\\' =>
99
+ array (
100
+ 0 => __DIR__ . '/..' . '/doctrine/inflector/lib',
101
+ ),
102
+ ),
103
+ );
104
+
105
+ public static function getInitializer(ClassLoader $loader)
106
+ {
107
+ return \Closure::bind(function () use ($loader) {
108
+ $loader->prefixLengthsPsr4 = ComposerStaticInit088b21c075234dd3a052b9efa302d556::$prefixLengthsPsr4;
109
+ $loader->prefixDirsPsr4 = ComposerStaticInit088b21c075234dd3a052b9efa302d556::$prefixDirsPsr4;
110
+ $loader->prefixesPsr0 = ComposerStaticInit088b21c075234dd3a052b9efa302d556::$prefixesPsr0;
111
+
112
+ }, null, ClassLoader::class);
113
+ }
114
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/composer/installed.json ADDED
@@ -0,0 +1,716 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "psr/log",
4
+ "version": "1.0.2",
5
+ "version_normalized": "1.0.2.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/php-fig/log.git",
9
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
14
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "php": ">=5.3.0"
19
+ },
20
+ "time": "2016-10-10 12:19:37",
21
+ "type": "library",
22
+ "extra": {
23
+ "branch-alias": {
24
+ "dev-master": "1.0.x-dev"
25
+ }
26
+ },
27
+ "installation-source": "dist",
28
+ "autoload": {
29
+ "psr-4": {
30
+ "Psr\\Log\\": "Psr/Log/"
31
+ }
32
+ },
33
+ "notification-url": "https://packagist.org/downloads/",
34
+ "license": [
35
+ "MIT"
36
+ ],
37
+ "authors": [
38
+ {
39
+ "name": "PHP-FIG",
40
+ "homepage": "http://www.php-fig.org/"
41
+ }
42
+ ],
43
+ "description": "Common interface for logging libraries",
44
+ "homepage": "https://github.com/php-fig/log",
45
+ "keywords": [
46
+ "log",
47
+ "psr",
48
+ "psr-3"
49
+ ]
50
+ },
51
+ {
52
+ "name": "symfony/polyfill-mbstring",
53
+ "version": "v1.3.0",
54
+ "version_normalized": "1.3.0.0",
55
+ "source": {
56
+ "type": "git",
57
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
58
+ "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
59
+ },
60
+ "dist": {
61
+ "type": "zip",
62
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
63
+ "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
64
+ "shasum": ""
65
+ },
66
+ "require": {
67
+ "php": ">=5.3.3"
68
+ },
69
+ "suggest": {
70
+ "ext-mbstring": "For best performance"
71
+ },
72
+ "time": "2016-11-14 01:06:16",
73
+ "type": "library",
74
+ "extra": {
75
+ "branch-alias": {
76
+ "dev-master": "1.3-dev"
77
+ }
78
+ },
79
+ "installation-source": "dist",
80
+ "autoload": {
81
+ "psr-4": {
82
+ "Symfony\\Polyfill\\Mbstring\\": ""
83
+ },
84
+ "files": [
85
+ "bootstrap.php"
86
+ ]
87
+ },
88
+ "notification-url": "https://packagist.org/downloads/",
89
+ "license": [
90
+ "MIT"
91
+ ],
92
+ "authors": [
93
+ {
94
+ "name": "Nicolas Grekas",
95
+ "email": "p@tchwork.com"
96
+ },
97
+ {
98
+ "name": "Symfony Community",
99
+ "homepage": "https://symfony.com/contributors"
100
+ }
101
+ ],
102
+ "description": "Symfony polyfill for the Mbstring extension",
103
+ "homepage": "https://symfony.com",
104
+ "keywords": [
105
+ "compatibility",
106
+ "mbstring",
107
+ "polyfill",
108
+ "portable",
109
+ "shim"
110
+ ]
111
+ },
112
+ {
113
+ "name": "nesbot/carbon",
114
+ "version": "1.21.0",
115
+ "version_normalized": "1.21.0.0",
116
+ "source": {
117
+ "type": "git",
118
+ "url": "https://github.com/briannesbitt/Carbon.git",
119
+ "reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7"
120
+ },
121
+ "dist": {
122
+ "type": "zip",
123
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7b08ec6f75791e130012f206e3f7b0e76e18e3d7",
124
+ "reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7",
125
+ "shasum": ""
126
+ },
127
+ "require": {
128
+ "php": ">=5.3.0",
129
+ "symfony/translation": "~2.6|~3.0"
130
+ },
131
+ "require-dev": {
132
+ "phpunit/phpunit": "~4.0|~5.0"
133
+ },
134
+ "time": "2015-11-04 20:07:17",
135
+ "type": "library",
136
+ "installation-source": "dist",
137
+ "autoload": {
138
+ "psr-4": {
139
+ "Carbon\\": "src/Carbon/"
140
+ }
141
+ },
142
+ "notification-url": "https://packagist.org/downloads/",
143
+ "license": [
144
+ "MIT"
145
+ ],
146
+ "authors": [
147
+ {
148
+ "name": "Brian Nesbitt",
149
+ "email": "brian@nesbot.com",
150
+ "homepage": "http://nesbot.com"
151
+ }
152
+ ],
153
+ "description": "A simple API extension for DateTime.",
154
+ "homepage": "http://carbon.nesbot.com",
155
+ "keywords": [
156
+ "date",
157
+ "datetime",
158
+ "time"
159
+ ]
160
+ },
161
+ {
162
+ "name": "paragonie/random_compat",
163
+ "version": "v2.0.4",
164
+ "version_normalized": "2.0.4.0",
165
+ "source": {
166
+ "type": "git",
167
+ "url": "https://github.com/paragonie/random_compat.git",
168
+ "reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e"
169
+ },
170
+ "dist": {
171
+ "type": "zip",
172
+ "url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
173
+ "reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
174
+ "shasum": ""
175
+ },
176
+ "require": {
177
+ "php": ">=5.2.0"
178
+ },
179
+ "require-dev": {
180
+ "phpunit/phpunit": "4.*|5.*"
181
+ },
182
+ "suggest": {
183
+ "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
184
+ },
185
+ "time": "2016-11-07 23:38:38",
186
+ "type": "library",
187
+ "installation-source": "dist",
188
+ "autoload": {
189
+ "files": [
190
+ "lib/random.php"
191
+ ]
192
+ },
193
+ "notification-url": "https://packagist.org/downloads/",
194
+ "license": [
195
+ "MIT"
196
+ ],
197
+ "authors": [
198
+ {
199
+ "name": "Paragon Initiative Enterprises",
200
+ "email": "security@paragonie.com",
201
+ "homepage": "https://paragonie.com"
202
+ }
203
+ ],
204
+ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
205
+ "keywords": [
206
+ "csprng",
207
+ "pseudorandom",
208
+ "random"
209
+ ]
210
+ },
211
+ {
212
+ "name": "illuminate/contracts",
213
+ "version": "v5.3.23",
214
+ "version_normalized": "5.3.23.0",
215
+ "source": {
216
+ "type": "git",
217
+ "url": "https://github.com/illuminate/contracts.git",
218
+ "reference": "ce5d73c6015b2054d32f3f8530767847b358ae4e"
219
+ },
220
+ "dist": {
221
+ "type": "zip",
222
+ "url": "https://api.github.com/repos/illuminate/contracts/zipball/ce5d73c6015b2054d32f3f8530767847b358ae4e",
223
+ "reference": "ce5d73c6015b2054d32f3f8530767847b358ae4e",
224
+ "shasum": ""
225
+ },
226
+ "require": {
227
+ "php": ">=5.6.4"
228
+ },
229
+ "time": "2016-09-26 20:36:27",
230
+ "type": "library",
231
+ "extra": {
232
+ "branch-alias": {
233
+ "dev-master": "5.3-dev"
234
+ }
235
+ },
236
+ "installation-source": "dist",
237
+ "autoload": {
238
+ "psr-4": {
239
+ "Illuminate\\Contracts\\": ""
240
+ }
241
+ },
242
+ "notification-url": "https://packagist.org/downloads/",
243
+ "license": [
244
+ "MIT"
245
+ ],
246
+ "authors": [
247
+ {
248
+ "name": "Taylor Otwell",
249
+ "email": "taylor@laravel.com"
250
+ }
251
+ ],
252
+ "description": "The Illuminate Contracts package.",
253
+ "homepage": "https://laravel.com"
254
+ },
255
+ {
256
+ "name": "doctrine/inflector",
257
+ "version": "v1.1.0",
258
+ "version_normalized": "1.1.0.0",
259
+ "source": {
260
+ "type": "git",
261
+ "url": "https://github.com/doctrine/inflector.git",
262
+ "reference": "90b2128806bfde671b6952ab8bea493942c1fdae"
263
+ },
264
+ "dist": {
265
+ "type": "zip",
266
+ "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae",
267
+ "reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
268
+ "shasum": ""
269
+ },
270
+ "require": {
271
+ "php": ">=5.3.2"
272
+ },
273
+ "require-dev": {
274
+ "phpunit/phpunit": "4.*"
275
+ },
276
+ "time": "2015-11-06 14:35:42",
277
+ "type": "library",
278
+ "extra": {
279
+ "branch-alias": {
280
+ "dev-master": "1.1.x-dev"
281
+ }
282
+ },
283
+ "installation-source": "dist",
284
+ "autoload": {
285
+ "psr-0": {
286
+ "Doctrine\\Common\\Inflector\\": "lib/"
287
+ }
288
+ },
289
+ "notification-url": "https://packagist.org/downloads/",
290
+ "license": [
291
+ "MIT"
292
+ ],
293
+ "authors": [
294
+ {
295
+ "name": "Roman Borschel",
296
+ "email": "roman@code-factory.org"
297
+ },
298
+ {
299
+ "name": "Benjamin Eberlei",
300
+ "email": "kontakt@beberlei.de"
301
+ },
302
+ {
303
+ "name": "Guilherme Blanco",
304
+ "email": "guilhermeblanco@gmail.com"
305
+ },
306
+ {
307
+ "name": "Jonathan Wage",
308
+ "email": "jonwage@gmail.com"
309
+ },
310
+ {
311
+ "name": "Johannes Schmitt",
312
+ "email": "schmittjoh@gmail.com"
313
+ }
314
+ ],
315
+ "description": "Common String Manipulations with regard to casing and singular/plural rules.",
316
+ "homepage": "http://www.doctrine-project.org",
317
+ "keywords": [
318
+ "inflection",
319
+ "pluralize",
320
+ "singularize",
321
+ "string"
322
+ ]
323
+ },
324
+ {
325
+ "name": "illuminate/support",
326
+ "version": "v5.3.23",
327
+ "version_normalized": "5.3.23.0",
328
+ "source": {
329
+ "type": "git",
330
+ "url": "https://github.com/illuminate/support.git",
331
+ "reference": "050d0ed3e1c0e1d129d73b2eaa14044e46a66f77"
332
+ },
333
+ "dist": {
334
+ "type": "zip",
335
+ "url": "https://api.github.com/repos/illuminate/support/zipball/050d0ed3e1c0e1d129d73b2eaa14044e46a66f77",
336
+ "reference": "050d0ed3e1c0e1d129d73b2eaa14044e46a66f77",
337
+ "shasum": ""
338
+ },
339
+ "require": {
340
+ "doctrine/inflector": "~1.0",
341
+ "ext-mbstring": "*",
342
+ "illuminate/contracts": "5.3.*",
343
+ "paragonie/random_compat": "~1.4|~2.0",
344
+ "php": ">=5.6.4"
345
+ },
346
+ "replace": {
347
+ "tightenco/collect": "self.version"
348
+ },
349
+ "suggest": {
350
+ "illuminate/filesystem": "Required to use the composer class (5.2.*).",
351
+ "symfony/process": "Required to use the composer class (3.1.*).",
352
+ "symfony/var-dumper": "Required to use the dd function (3.1.*)."
353
+ },
354
+ "time": "2016-11-03 15:25:28",
355
+ "type": "library",
356
+ "extra": {
357
+ "branch-alias": {
358
+ "dev-master": "5.3-dev"
359
+ }
360
+ },
361
+ "installation-source": "dist",
362
+ "autoload": {
363
+ "psr-4": {
364
+ "Illuminate\\Support\\": ""
365
+ },
366
+ "files": [
367
+ "helpers.php"
368
+ ]
369
+ },
370
+ "notification-url": "https://packagist.org/downloads/",
371
+ "license": [
372
+ "MIT"
373
+ ],
374
+ "authors": [
375
+ {
376
+ "name": "Taylor Otwell",
377
+ "email": "taylor@laravel.com"
378
+ }
379
+ ],
380
+ "description": "The Illuminate Support package.",
381
+ "homepage": "https://laravel.com"
382
+ },
383
+ {
384
+ "name": "guzzlehttp/promises",
385
+ "version": "1.3.0",
386
+ "version_normalized": "1.3.0.0",
387
+ "source": {
388
+ "type": "git",
389
+ "url": "https://github.com/guzzle/promises.git",
390
+ "reference": "2693c101803ca78b27972d84081d027fca790a1e"
391
+ },
392
+ "dist": {
393
+ "type": "zip",
394
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/2693c101803ca78b27972d84081d027fca790a1e",
395
+ "reference": "2693c101803ca78b27972d84081d027fca790a1e",
396
+ "shasum": ""
397
+ },
398
+ "require": {
399
+ "php": ">=5.5.0"
400
+ },
401
+ "require-dev": {
402
+ "phpunit/phpunit": "~4.0"
403
+ },
404
+ "time": "2016-11-18 17:47:58",
405
+ "type": "library",
406
+ "extra": {
407
+ "branch-alias": {
408
+ "dev-master": "1.0-dev"
409
+ }
410
+ },
411
+ "installation-source": "dist",
412
+ "autoload": {
413
+ "psr-4": {
414
+ "GuzzleHttp\\Promise\\": "src/"
415
+ },
416
+ "files": [
417
+ "src/functions_include.php"
418
+ ]
419
+ },
420
+ "notification-url": "https://packagist.org/downloads/",
421
+ "license": [
422
+ "MIT"
423
+ ],
424
+ "authors": [
425
+ {
426
+ "name": "Michael Dowling",
427
+ "email": "mtdowling@gmail.com",
428
+ "homepage": "https://github.com/mtdowling"
429
+ }
430
+ ],
431
+ "description": "Guzzle promises library",
432
+ "keywords": [
433
+ "promise"
434
+ ]
435
+ },
436
+ {
437
+ "name": "psr/http-message",
438
+ "version": "1.0.1",
439
+ "version_normalized": "1.0.1.0",
440
+ "source": {
441
+ "type": "git",
442
+ "url": "https://github.com/php-fig/http-message.git",
443
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
444
+ },
445
+ "dist": {
446
+ "type": "zip",
447
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
448
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
449
+ "shasum": ""
450
+ },
451
+ "require": {
452
+ "php": ">=5.3.0"
453
+ },
454
+ "time": "2016-08-06 14:39:51",
455
+ "type": "library",
456
+ "extra": {
457
+ "branch-alias": {
458
+ "dev-master": "1.0.x-dev"
459
+ }
460
+ },
461
+ "installation-source": "dist",
462
+ "autoload": {
463
+ "psr-4": {
464
+ "Psr\\Http\\Message\\": "src/"
465
+ }
466
+ },
467
+ "notification-url": "https://packagist.org/downloads/",
468
+ "license": [
469
+ "MIT"
470
+ ],
471
+ "authors": [
472
+ {
473
+ "name": "PHP-FIG",
474
+ "homepage": "http://www.php-fig.org/"
475
+ }
476
+ ],
477
+ "description": "Common interface for HTTP messages",
478
+ "homepage": "https://github.com/php-fig/http-message",
479
+ "keywords": [
480
+ "http",
481
+ "http-message",
482
+ "psr",
483
+ "psr-7",
484
+ "request",
485
+ "response"
486
+ ]
487
+ },
488
+ {
489
+ "name": "guzzlehttp/psr7",
490
+ "version": "1.3.1",
491
+ "version_normalized": "1.3.1.0",
492
+ "source": {
493
+ "type": "git",
494
+ "url": "https://github.com/guzzle/psr7.git",
495
+ "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b"
496
+ },
497
+ "dist": {
498
+ "type": "zip",
499
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
500
+ "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
501
+ "shasum": ""
502
+ },
503
+ "require": {
504
+ "php": ">=5.4.0",
505
+ "psr/http-message": "~1.0"
506
+ },
507
+ "provide": {
508
+ "psr/http-message-implementation": "1.0"
509
+ },
510
+ "require-dev": {
511
+ "phpunit/phpunit": "~4.0"
512
+ },
513
+ "time": "2016-06-24 23:00:38",
514
+ "type": "library",
515
+ "extra": {
516
+ "branch-alias": {
517
+ "dev-master": "1.4-dev"
518
+ }
519
+ },
520
+ "installation-source": "dist",
521
+ "autoload": {
522
+ "psr-4": {
523
+ "GuzzleHttp\\Psr7\\": "src/"
524
+ },
525
+ "files": [
526
+ "src/functions_include.php"
527
+ ]
528
+ },
529
+ "notification-url": "https://packagist.org/downloads/",
530
+ "license": [
531
+ "MIT"
532
+ ],
533
+ "authors": [
534
+ {
535
+ "name": "Michael Dowling",
536
+ "email": "mtdowling@gmail.com",
537
+ "homepage": "https://github.com/mtdowling"
538
+ }
539
+ ],
540
+ "description": "PSR-7 message implementation",
541
+ "keywords": [
542
+ "http",
543
+ "message",
544
+ "stream",
545
+ "uri"
546
+ ]
547
+ },
548
+ {
549
+ "name": "guzzlehttp/guzzle",
550
+ "version": "6.2.2",
551
+ "version_normalized": "6.2.2.0",
552
+ "source": {
553
+ "type": "git",
554
+ "url": "https://github.com/guzzle/guzzle.git",
555
+ "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60"
556
+ },
557
+ "dist": {
558
+ "type": "zip",
559
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
560
+ "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
561
+ "shasum": ""
562
+ },
563
+ "require": {
564
+ "guzzlehttp/promises": "^1.0",
565
+ "guzzlehttp/psr7": "^1.3.1",
566
+ "php": ">=5.5"
567
+ },
568
+ "require-dev": {
569
+ "ext-curl": "*",
570
+ "phpunit/phpunit": "^4.0",
571
+ "psr/log": "^1.0"
572
+ },
573
+ "time": "2016-10-08 15:01:37",
574
+ "type": "library",
575
+ "extra": {
576
+ "branch-alias": {
577
+ "dev-master": "6.2-dev"
578
+ }
579
+ },
580
+ "installation-source": "dist",
581
+ "autoload": {
582
+ "files": [
583
+ "src/functions_include.php"
584
+ ],
585
+ "psr-4": {
586
+ "GuzzleHttp\\": "src/"
587
+ }
588
+ },
589
+ "notification-url": "https://packagist.org/downloads/",
590
+ "license": [
591
+ "MIT"
592
+ ],
593
+ "authors": [
594
+ {
595
+ "name": "Michael Dowling",
596
+ "email": "mtdowling@gmail.com",
597
+ "homepage": "https://github.com/mtdowling"
598
+ }
599
+ ],
600
+ "description": "Guzzle is a PHP HTTP client library",
601
+ "homepage": "http://guzzlephp.org/",
602
+ "keywords": [
603
+ "client",
604
+ "curl",
605
+ "framework",
606
+ "http",
607
+ "http client",
608
+ "rest",
609
+ "web service"
610
+ ]
611
+ },
612
+ {
613
+ "name": "symfony/translation",
614
+ "version": "v3.2.0",
615
+ "version_normalized": "3.2.0.0",
616
+ "source": {
617
+ "type": "git",
618
+ "url": "https://github.com/symfony/translation.git",
619
+ "reference": "64ab6fc0b42e5386631f408e6adcaaff8eee5ba1"
620
+ },
621
+ "dist": {
622
+ "type": "zip",
623
+ "url": "https://api.github.com/repos/symfony/translation/zipball/64ab6fc0b42e5386631f408e6adcaaff8eee5ba1",
624
+ "reference": "64ab6fc0b42e5386631f408e6adcaaff8eee5ba1",
625
+ "shasum": ""
626
+ },
627
+ "require": {
628
+ "php": ">=5.5.9",
629
+ "symfony/polyfill-mbstring": "~1.0"
630
+ },
631
+ "conflict": {
632
+ "symfony/config": "<2.8"
633
+ },
634
+ "require-dev": {
635
+ "psr/log": "~1.0",
636
+ "symfony/config": "~2.8|~3.0",
637
+ "symfony/intl": "~2.8|~3.0",
638
+ "symfony/yaml": "~2.8|~3.0"
639
+ },
640
+ "suggest": {
641
+ "psr/log": "To use logging capability in translator",
642
+ "symfony/config": "",
643
+ "symfony/yaml": ""
644
+ },
645
+ "time": "2016-11-18 21:17:59",
646
+ "type": "library",
647
+ "extra": {
648
+ "branch-alias": {
649
+ "dev-master": "3.2-dev"
650
+ }
651
+ },
652
+ "installation-source": "dist",
653
+ "autoload": {
654
+ "psr-4": {
655
+ "Symfony\\Component\\Translation\\": ""
656
+ },
657
+ "exclude-from-classmap": [
658
+ "/Tests/"
659
+ ]
660
+ },
661
+ "notification-url": "https://packagist.org/downloads/",
662
+ "license": [
663
+ "MIT"
664
+ ],
665
+ "authors": [
666
+ {
667
+ "name": "Fabien Potencier",
668
+ "email": "fabien@symfony.com"
669
+ },
670
+ {
671
+ "name": "Symfony Community",
672
+ "homepage": "https://symfony.com/contributors"
673
+ }
674
+ ],
675
+ "description": "Symfony Translation Component",
676
+ "homepage": "https://symfony.com"
677
+ },
678
+ {
679
+ "name": "samurai/bulksms-client",
680
+ "version": "dev-develop",
681
+ "version_normalized": "dev-develop",
682
+ "source": {
683
+ "type": "git",
684
+ "url": "http://satis:G6wdkGc6@dev1-git2.loc.ch/php-packages/sd-bulksms-client.git",
685
+ "reference": "2011fc4e70395cb98446acc798ee70301f12f520"
686
+ },
687
+ "require": {
688
+ "guzzlehttp/guzzle": "6.2.*",
689
+ "illuminate/support": "~5.0",
690
+ "nesbot/carbon": "~1.8@stable",
691
+ "psr/log": "~1.0"
692
+ },
693
+ "time": "2016-10-10 14:31:17",
694
+ "type": "library",
695
+ "installation-source": "source",
696
+ "autoload": {
697
+ "psr-4": {
698
+ "Samurai\\BulkSms\\": "src/"
699
+ },
700
+ "files": [
701
+ "src/helpers.php"
702
+ ]
703
+ },
704
+ "authors": [
705
+ {
706
+ "name": "Samurai Digital",
707
+ "email": "info@samurai.hr"
708
+ },
709
+ {
710
+ "name": "Danijel Job",
711
+ "email": "danijel.job@nth.ch"
712
+ }
713
+ ],
714
+ "description": "PHP Bulk SMS client"
715
+ }
716
+ ]
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/.travis.yml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ sudo: false
4
+
5
+ cache:
6
+ directory:
7
+ - $HOME/.composer/cache
8
+
9
+ php:
10
+ - 5.3
11
+ - 5.4
12
+ - 5.5
13
+ - 5.6
14
+ - 7.0
15
+ - hhvm
16
+
17
+ install:
18
+ - composer install -n
19
+
20
+ script:
21
+ - phpunit
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2006-2015 Doctrine Project
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ 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 THE
19
+ SOFTWARE.
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/README.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ # Doctrine Inflector
2
+
3
+ Doctrine Inflector is a small library that can perform string manipulations
4
+ with regard to upper-/lowercase and singular/plural forms of words.
5
+
6
+ [![Build Status](https://travis-ci.org/doctrine/inflector.svg?branch=master)](https://travis-ci.org/doctrine/inflector)
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/composer.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "doctrine/inflector",
3
+ "type": "library",
4
+ "description": "Common String Manipulations with regard to casing and singular/plural rules.",
5
+ "keywords": ["string", "inflection", "singularize", "pluralize"],
6
+ "homepage": "http://www.doctrine-project.org",
7
+ "license": "MIT",
8
+ "authors": [
9
+ {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"},
10
+ {"name": "Roman Borschel", "email": "roman@code-factory.org"},
11
+ {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"},
12
+ {"name": "Jonathan Wage", "email": "jonwage@gmail.com"},
13
+ {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
14
+ ],
15
+ "require": {
16
+ "php": ">=5.3.2"
17
+ },
18
+ "require-dev": {
19
+ "phpunit/phpunit": "4.*"
20
+ },
21
+ "autoload": {
22
+ "psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" }
23
+ },
24
+ "extra": {
25
+ "branch-alias": {
26
+ "dev-master": "1.1.x-dev"
27
+ }
28
+ }
29
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php ADDED
@@ -0,0 +1,482 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ *
15
+ * This software consists of voluntary contributions made by many individuals
16
+ * and is licensed under the MIT license. For more information, see
17
+ * <http://www.doctrine-project.org>.
18
+ */
19
+
20
+ namespace Doctrine\Common\Inflector;
21
+
22
+ /**
23
+ * Doctrine inflector has static methods for inflecting text.
24
+ *
25
+ * The methods in these classes are from several different sources collected
26
+ * across several different php projects and several different authors. The
27
+ * original author names and emails are not known.
28
+ *
29
+ * Pluralize & Singularize implementation are borrowed from CakePHP with some modifications.
30
+ *
31
+ * @link www.doctrine-project.org
32
+ * @since 1.0
33
+ * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
34
+ * @author Jonathan H. Wage <jonwage@gmail.com>
35
+ */
36
+ class Inflector
37
+ {
38
+ /**
39
+ * Plural inflector rules.
40
+ *
41
+ * @var array
42
+ */
43
+ private static $plural = array(
44
+ 'rules' => array(
45
+ '/(s)tatus$/i' => '\1\2tatuses',
46
+ '/(quiz)$/i' => '\1zes',
47
+ '/^(ox)$/i' => '\1\2en',
48
+ '/([m|l])ouse$/i' => '\1ice',
49
+ '/(matr|vert|ind)(ix|ex)$/i' => '\1ices',
50
+ '/(x|ch|ss|sh)$/i' => '\1es',
51
+ '/([^aeiouy]|qu)y$/i' => '\1ies',
52
+ '/(hive)$/i' => '\1s',
53
+ '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
54
+ '/sis$/i' => 'ses',
55
+ '/([ti])um$/i' => '\1a',
56
+ '/(p)erson$/i' => '\1eople',
57
+ '/(m)an$/i' => '\1en',
58
+ '/(c)hild$/i' => '\1hildren',
59
+ '/(f)oot$/i' => '\1eet',
60
+ '/(buffal|her|potat|tomat|volcan)o$/i' => '\1\2oes',
61
+ '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i',
62
+ '/us$/i' => 'uses',
63
+ '/(alias)$/i' => '\1es',
64
+ '/(analys|ax|cris|test|thes)is$/i' => '\1es',
65
+ '/s$/' => 's',
66
+ '/^$/' => '',
67
+ '/$/' => 's',
68
+ ),
69
+ 'uninflected' => array(
70
+ '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people', 'cookie'
71
+ ),
72
+ 'irregular' => array(
73
+ 'atlas' => 'atlases',
74
+ 'axe' => 'axes',
75
+ 'beef' => 'beefs',
76
+ 'brother' => 'brothers',
77
+ 'cafe' => 'cafes',
78
+ 'chateau' => 'chateaux',
79
+ 'child' => 'children',
80
+ 'cookie' => 'cookies',
81
+ 'corpus' => 'corpuses',
82
+ 'cow' => 'cows',
83
+ 'criterion' => 'criteria',
84
+ 'curriculum' => 'curricula',
85
+ 'demo' => 'demos',
86
+ 'domino' => 'dominoes',
87
+ 'echo' => 'echoes',
88
+ 'foot' => 'feet',
89
+ 'fungus' => 'fungi',
90
+ 'ganglion' => 'ganglions',
91
+ 'genie' => 'genies',
92
+ 'genus' => 'genera',
93
+ 'graffito' => 'graffiti',
94
+ 'hippopotamus' => 'hippopotami',
95
+ 'hoof' => 'hoofs',
96
+ 'human' => 'humans',
97
+ 'iris' => 'irises',
98
+ 'leaf' => 'leaves',
99
+ 'loaf' => 'loaves',
100
+ 'man' => 'men',
101
+ 'medium' => 'media',
102
+ 'memorandum' => 'memoranda',
103
+ 'money' => 'monies',
104
+ 'mongoose' => 'mongooses',
105
+ 'motto' => 'mottoes',
106
+ 'move' => 'moves',
107
+ 'mythos' => 'mythoi',
108
+ 'niche' => 'niches',
109
+ 'nucleus' => 'nuclei',
110
+ 'numen' => 'numina',
111
+ 'occiput' => 'occiputs',
112
+ 'octopus' => 'octopuses',
113
+ 'opus' => 'opuses',
114
+ 'ox' => 'oxen',
115
+ 'penis' => 'penises',
116
+ 'person' => 'people',
117
+ 'plateau' => 'plateaux',
118
+ 'runner-up' => 'runners-up',
119
+ 'sex' => 'sexes',
120
+ 'soliloquy' => 'soliloquies',
121
+ 'son-in-law' => 'sons-in-law',
122
+ 'syllabus' => 'syllabi',
123
+ 'testis' => 'testes',
124
+ 'thief' => 'thieves',
125
+ 'tooth' => 'teeth',
126
+ 'tornado' => 'tornadoes',
127
+ 'trilby' => 'trilbys',
128
+ 'turf' => 'turfs',
129
+ 'volcano' => 'volcanoes',
130
+ )
131
+ );
132
+
133
+ /**
134
+ * Singular inflector rules.
135
+ *
136
+ * @var array
137
+ */
138
+ private static $singular = array(
139
+ 'rules' => array(
140
+ '/(s)tatuses$/i' => '\1\2tatus',
141
+ '/^(.*)(menu)s$/i' => '\1\2',
142
+ '/(quiz)zes$/i' => '\\1',
143
+ '/(matr)ices$/i' => '\1ix',
144
+ '/(vert|ind)ices$/i' => '\1ex',
145
+ '/^(ox)en/i' => '\1',
146
+ '/(alias)(es)*$/i' => '\1',
147
+ '/(buffal|her|potat|tomat|volcan)oes$/i' => '\1o',
148
+ '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us',
149
+ '/([ftw]ax)es/i' => '\1',
150
+ '/(analys|ax|cris|test|thes)es$/i' => '\1is',
151
+ '/(shoe|slave)s$/i' => '\1',
152
+ '/(o)es$/i' => '\1',
153
+ '/ouses$/' => 'ouse',
154
+ '/([^a])uses$/' => '\1us',
155
+ '/([m|l])ice$/i' => '\1ouse',
156
+ '/(x|ch|ss|sh)es$/i' => '\1',
157
+ '/(m)ovies$/i' => '\1\2ovie',
158
+ '/(s)eries$/i' => '\1\2eries',
159
+ '/([^aeiouy]|qu)ies$/i' => '\1y',
160
+ '/([lr])ves$/i' => '\1f',
161
+ '/(tive)s$/i' => '\1',
162
+ '/(hive)s$/i' => '\1',
163
+ '/(drive)s$/i' => '\1',
164
+ '/([^fo])ves$/i' => '\1fe',
165
+ '/(^analy)ses$/i' => '\1sis',
166
+ '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
167
+ '/([ti])a$/i' => '\1um',
168
+ '/(p)eople$/i' => '\1\2erson',
169
+ '/(m)en$/i' => '\1an',
170
+ '/(c)hildren$/i' => '\1\2hild',
171
+ '/(f)eet$/i' => '\1oot',
172
+ '/(n)ews$/i' => '\1\2ews',
173
+ '/eaus$/' => 'eau',
174
+ '/^(.*us)$/' => '\\1',
175
+ '/s$/i' => '',
176
+ ),
177
+ 'uninflected' => array(
178
+ '.*[nrlm]ese',
179
+ '.*deer',
180
+ '.*fish',
181
+ '.*measles',
182
+ '.*ois',
183
+ '.*pox',
184
+ '.*sheep',
185
+ '.*ss',
186
+ ),
187
+ 'irregular' => array(
188
+ 'criteria' => 'criterion',
189
+ 'curves' => 'curve',
190
+ 'emphases' => 'emphasis',
191
+ 'foes' => 'foe',
192
+ 'hoaxes' => 'hoax',
193
+ 'media' => 'medium',
194
+ 'neuroses' => 'neurosis',
195
+ 'waves' => 'wave',
196
+ 'oases' => 'oasis',
197
+ )
198
+ );
199
+
200
+ /**
201
+ * Words that should not be inflected.
202
+ *
203
+ * @var array
204
+ */
205
+ private static $uninflected = array(
206
+ 'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus',
207
+ 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps',
208
+ 'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder',
209
+ 'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti',
210
+ 'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings',
211
+ 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', '.*?media',
212
+ 'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese',
213
+ 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese',
214
+ 'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors',
215
+ 'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'staff', 'swine',
216
+ 'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting',
217
+ 'wildebeest', 'Yengeese'
218
+ );
219
+
220
+ /**
221
+ * Method cache array.
222
+ *
223
+ * @var array
224
+ */
225
+ private static $cache = array();
226
+
227
+ /**
228
+ * The initial state of Inflector so reset() works.
229
+ *
230
+ * @var array
231
+ */
232
+ private static $initialState = array();
233
+
234
+ /**
235
+ * Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'.
236
+ *
237
+ * @param string $word The word to tableize.
238
+ *
239
+ * @return string The tableized word.
240
+ */
241
+ public static function tableize($word)
242
+ {
243
+ return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word));
244
+ }
245
+
246
+ /**
247
+ * Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'.
248
+ *
249
+ * @param string $word The word to classify.
250
+ *
251
+ * @return string The classified word.
252
+ */
253
+ public static function classify($word)
254
+ {
255
+ return str_replace(" ", "", ucwords(strtr($word, "_-", " ")));
256
+ }
257
+
258
+ /**
259
+ * Camelizes a word. This uses the classify() method and turns the first character to lowercase.
260
+ *
261
+ * @param string $word The word to camelize.
262
+ *
263
+ * @return string The camelized word.
264
+ */
265
+ public static function camelize($word)
266
+ {
267
+ return lcfirst(self::classify($word));
268
+ }
269
+
270
+ /**
271
+ * Uppercases words with configurable delimeters between words.
272
+ *
273
+ * Takes a string and capitalizes all of the words, like PHP's built-in
274
+ * ucwords function. This extends that behavior, however, by allowing the
275
+ * word delimeters to be configured, rather than only separating on
276
+ * whitespace.
277
+ *
278
+ * Here is an example:
279
+ * <code>
280
+ * <?php
281
+ * $string = 'top-o-the-morning to all_of_you!';
282
+ * echo \Doctrine\Common\Inflector\Inflector::ucwords($string);
283
+ * // Top-O-The-Morning To All_of_you!
284
+ *
285
+ * echo \Doctrine\Common\Inflector\Inflector::ucwords($string, '-_ ');
286
+ * // Top-O-The-Morning To All_Of_You!
287
+ * ?>
288
+ * </code>
289
+ *
290
+ * @param string $string The string to operate on.
291
+ * @param string $delimiters A list of word separators.
292
+ *
293
+ * @return string The string with all delimeter-separated words capitalized.
294
+ */
295
+ public static function ucwords($string, $delimiters = " \n\t\r\0\x0B-")
296
+ {
297
+ return preg_replace_callback(
298
+ '/[^' . preg_quote($delimiters, '/') . ']+/',
299
+ function($matches) {
300
+ return ucfirst($matches[0]);
301
+ },
302
+ $string
303
+ );
304
+ }
305
+
306
+ /**
307
+ * Clears Inflectors inflected value caches, and resets the inflection
308
+ * rules to the initial values.
309
+ *
310
+ * @return void
311
+ */
312
+ public static function reset()
313
+ {
314
+ if (empty(self::$initialState)) {
315
+ self::$initialState = get_class_vars('Inflector');
316
+
317
+ return;
318
+ }
319
+
320
+ foreach (self::$initialState as $key => $val) {
321
+ if ($key != 'initialState') {
322
+ self::${$key} = $val;
323
+ }
324
+ }
325
+ }
326
+
327
+ /**
328
+ * Adds custom inflection $rules, of either 'plural' or 'singular' $type.
329
+ *
330
+ * ### Usage:
331
+ *
332
+ * {{{
333
+ * Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables'));
334
+ * Inflector::rules('plural', array(
335
+ * 'rules' => array('/^(inflect)ors$/i' => '\1ables'),
336
+ * 'uninflected' => array('dontinflectme'),
337
+ * 'irregular' => array('red' => 'redlings')
338
+ * ));
339
+ * }}}
340
+ *
341
+ * @param string $type The type of inflection, either 'plural' or 'singular'
342
+ * @param array $rules An array of rules to be added.
343
+ * @param boolean $reset If true, will unset default inflections for all
344
+ * new rules that are being defined in $rules.
345
+ *
346
+ * @return void
347
+ */
348
+ public static function rules($type, $rules, $reset = false)
349
+ {
350
+ foreach ($rules as $rule => $pattern) {
351
+ if ( ! is_array($pattern)) {
352
+ continue;
353
+ }
354
+
355
+ if ($reset) {
356
+ self::${$type}[$rule] = $pattern;
357
+ } else {
358
+ self::${$type}[$rule] = ($rule === 'uninflected')
359
+ ? array_merge($pattern, self::${$type}[$rule])
360
+ : $pattern + self::${$type}[$rule];
361
+ }
362
+
363
+ unset($rules[$rule], self::${$type}['cache' . ucfirst($rule)]);
364
+
365
+ if (isset(self::${$type}['merged'][$rule])) {
366
+ unset(self::${$type}['merged'][$rule]);
367
+ }
368
+
369
+ if ($type === 'plural') {
370
+ self::$cache['pluralize'] = self::$cache['tableize'] = array();
371
+ } elseif ($type === 'singular') {
372
+ self::$cache['singularize'] = array();
373
+ }
374
+ }
375
+
376
+ self::${$type}['rules'] = $rules + self::${$type}['rules'];
377
+ }
378
+
379
+ /**
380
+ * Returns a word in plural form.
381
+ *
382
+ * @param string $word The word in singular form.
383
+ *
384
+ * @return string The word in plural form.
385
+ */
386
+ public static function pluralize($word)
387
+ {
388
+ if (isset(self::$cache['pluralize'][$word])) {
389
+ return self::$cache['pluralize'][$word];
390
+ }
391
+
392
+ if (!isset(self::$plural['merged']['irregular'])) {
393
+ self::$plural['merged']['irregular'] = self::$plural['irregular'];
394
+ }
395
+
396
+ if (!isset(self::$plural['merged']['uninflected'])) {
397
+ self::$plural['merged']['uninflected'] = array_merge(self::$plural['uninflected'], self::$uninflected);
398
+ }
399
+
400
+ if (!isset(self::$plural['cacheUninflected']) || !isset(self::$plural['cacheIrregular'])) {
401
+ self::$plural['cacheUninflected'] = '(?:' . implode('|', self::$plural['merged']['uninflected']) . ')';
402
+ self::$plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$plural['merged']['irregular'])) . ')';
403
+ }
404
+
405
+ if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) {
406
+ self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1);
407
+
408
+ return self::$cache['pluralize'][$word];
409
+ }
410
+
411
+ if (preg_match('/^(' . self::$plural['cacheUninflected'] . ')$/i', $word, $regs)) {
412
+ self::$cache['pluralize'][$word] = $word;
413
+
414
+ return $word;
415
+ }
416
+
417
+ foreach (self::$plural['rules'] as $rule => $replacement) {
418
+ if (preg_match($rule, $word)) {
419
+ self::$cache['pluralize'][$word] = preg_replace($rule, $replacement, $word);
420
+
421
+ return self::$cache['pluralize'][$word];
422
+ }
423
+ }
424
+ }
425
+
426
+ /**
427
+ * Returns a word in singular form.
428
+ *
429
+ * @param string $word The word in plural form.
430
+ *
431
+ * @return string The word in singular form.
432
+ */
433
+ public static function singularize($word)
434
+ {
435
+ if (isset(self::$cache['singularize'][$word])) {
436
+ return self::$cache['singularize'][$word];
437
+ }
438
+
439
+ if (!isset(self::$singular['merged']['uninflected'])) {
440
+ self::$singular['merged']['uninflected'] = array_merge(
441
+ self::$singular['uninflected'],
442
+ self::$uninflected
443
+ );
444
+ }
445
+
446
+ if (!isset(self::$singular['merged']['irregular'])) {
447
+ self::$singular['merged']['irregular'] = array_merge(
448
+ self::$singular['irregular'],
449
+ array_flip(self::$plural['irregular'])
450
+ );
451
+ }
452
+
453
+ if (!isset(self::$singular['cacheUninflected']) || !isset(self::$singular['cacheIrregular'])) {
454
+ self::$singular['cacheUninflected'] = '(?:' . join('|', self::$singular['merged']['uninflected']) . ')';
455
+ self::$singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$singular['merged']['irregular'])) . ')';
456
+ }
457
+
458
+ if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) {
459
+ self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1);
460
+
461
+ return self::$cache['singularize'][$word];
462
+ }
463
+
464
+ if (preg_match('/^(' . self::$singular['cacheUninflected'] . ')$/i', $word, $regs)) {
465
+ self::$cache['singularize'][$word] = $word;
466
+
467
+ return $word;
468
+ }
469
+
470
+ foreach (self::$singular['rules'] as $rule => $replacement) {
471
+ if (preg_match($rule, $word)) {
472
+ self::$cache['singularize'][$word] = preg_replace($rule, $replacement, $word);
473
+
474
+ return self::$cache['singularize'][$word];
475
+ }
476
+ }
477
+
478
+ self::$cache['singularize'][$word] = $word;
479
+
480
+ return $word;
481
+ }
482
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/phpunit.xml.dist ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit backupGlobals="false"
4
+ backupStaticAttributes="false"
5
+ colors="true"
6
+ convertErrorsToExceptions="true"
7
+ convertNoticesToExceptions="true"
8
+ convertWarningsToExceptions="true"
9
+ processIsolation="false"
10
+ stopOnFailure="false"
11
+ syntaxCheck="false"
12
+ bootstrap="./tests/Doctrine/Tests/TestInit.php"
13
+ >
14
+ <testsuites>
15
+ <testsuite name="Doctrine Inflector Test Suite">
16
+ <directory>./tests/Doctrine/</directory>
17
+ </testsuite>
18
+ </testsuites>
19
+
20
+ <filter>
21
+ <whitelist>
22
+ <directory>./lib/Doctrine/</directory>
23
+ </whitelist>
24
+ </filter>
25
+
26
+ <groups>
27
+ <exclude>
28
+ <group>performance</group>
29
+ </exclude>
30
+ </groups>
31
+ </phpunit>
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Doctrine\Tests\Common\Inflector;
4
+
5
+ use Doctrine\Tests\DoctrineTestCase;
6
+ use Doctrine\Common\Inflector\Inflector;
7
+
8
+ class InflectorTest extends DoctrineTestCase
9
+ {
10
+ /**
11
+ * Singular & Plural test data. Returns an array of sample words.
12
+ *
13
+ * @return array
14
+ */
15
+ public function dataSampleWords()
16
+ {
17
+ Inflector::reset();
18
+
19
+ // In the format array('singular', 'plural')
20
+ return array(
21
+ array('', ''),
22
+ array('Alias', 'Aliases'),
23
+ array('alumnus', 'alumni'),
24
+ array('analysis', 'analyses'),
25
+ array('aquarium', 'aquaria'),
26
+ array('arch', 'arches'),
27
+ array('atlas', 'atlases'),
28
+ array('axe', 'axes'),
29
+ array('baby', 'babies'),
30
+ array('bacillus', 'bacilli'),
31
+ array('bacterium', 'bacteria'),
32
+ array('bureau', 'bureaus'),
33
+ array('bus', 'buses'),
34
+ array('Bus', 'Buses'),
35
+ array('cactus', 'cacti'),
36
+ array('cafe', 'cafes'),
37
+ array('calf', 'calves'),
38
+ array('categoria', 'categorias'),
39
+ array('chateau', 'chateaux'),
40
+ array('cherry', 'cherries'),
41
+ array('child', 'children'),
42
+ array('church', 'churches'),
43
+ array('circus', 'circuses'),
44
+ array('city', 'cities'),
45
+ array('cod', 'cod'),
46
+ array('cookie', 'cookies'),
47
+ array('copy', 'copies'),
48
+ array('crisis', 'crises'),
49
+ array('criterion', 'criteria'),
50
+ array('curriculum', 'curricula'),
51
+ array('curve', 'curves'),
52
+ array('deer', 'deer'),
53
+ array('demo', 'demos'),
54
+ array('dictionary', 'dictionaries'),
55
+ array('domino', 'dominoes'),
56
+ array('dwarf', 'dwarves'),
57
+ array('echo', 'echoes'),
58
+ array('elf', 'elves'),
59
+ array('emphasis', 'emphases'),
60
+ array('family', 'families'),
61
+ array('fax', 'faxes'),
62
+ array('fish', 'fish'),
63
+ array('flush', 'flushes'),
64
+ array('fly', 'flies'),
65
+ array('focus', 'foci'),
66
+ array('foe', 'foes'),
67
+ array('food_menu', 'food_menus'),
68
+ array('FoodMenu', 'FoodMenus'),
69
+ array('foot', 'feet'),
70
+ array('fungus', 'fungi'),
71
+ array('glove', 'gloves'),
72
+ array('half', 'halves'),
73
+ array('hero', 'heroes'),
74
+ array('hippopotamus', 'hippopotami'),
75
+ array('hoax', 'hoaxes'),
76
+ array('house', 'houses'),
77
+ array('human', 'humans'),
78
+ array('identity', 'identities'),
79
+ array('index', 'indices'),
80
+ array('iris', 'irises'),
81
+ array('kiss', 'kisses'),
82
+ array('knife', 'knives'),
83
+ array('leaf', 'leaves'),
84
+ array('life', 'lives'),
85
+ array('loaf', 'loaves'),
86
+ array('man', 'men'),
87
+ array('matrix', 'matrices'),
88
+ array('matrix_row', 'matrix_rows'),
89
+ array('medium', 'media'),
90
+ array('memorandum', 'memoranda'),
91
+ array('menu', 'menus'),
92
+ array('Menu', 'Menus'),
93
+ array('mess', 'messes'),
94
+ array('moose', 'moose'),
95
+ array('motto', 'mottoes'),
96
+ array('mouse', 'mice'),
97
+ array('neurosis', 'neuroses'),
98
+ array('news', 'news'),
99
+ array('NodeMedia', 'NodeMedia'),
100
+ array('nucleus', 'nuclei'),
101
+ array('oasis', 'oases'),
102
+ array('octopus', 'octopuses'),
103
+ array('pass', 'passes'),
104
+ array('person', 'people'),
105
+ array('plateau', 'plateaux'),
106
+ array('potato', 'potatoes'),
107
+ array('powerhouse', 'powerhouses'),
108
+ array('quiz', 'quizzes'),
109
+ array('radius', 'radii'),
110
+ array('reflex', 'reflexes'),
111
+ array('roof', 'roofs'),
112
+ array('runner-up', 'runners-up'),
113
+ array('scarf', 'scarves'),
114
+ array('scratch', 'scratches'),
115
+ array('series', 'series'),
116
+ array('sheep', 'sheep'),
117
+ array('shelf', 'shelves'),
118
+ array('shoe', 'shoes'),
119
+ array('son-in-law', 'sons-in-law'),
120
+ array('species', 'species'),
121
+ array('splash', 'splashes'),
122
+ array('spy', 'spies'),
123
+ array('stimulus', 'stimuli'),
124
+ array('stitch', 'stitches'),
125
+ array('story', 'stories'),
126
+ array('syllabus', 'syllabi'),
127
+ array('tax', 'taxes'),
128
+ array('terminus', 'termini'),
129
+ array('thesis', 'theses'),
130
+ array('thief', 'thieves'),
131
+ array('tomato', 'tomatoes'),
132
+ array('tooth', 'teeth'),
133
+ array('tornado', 'tornadoes'),
134
+ array('try', 'tries'),
135
+ array('vertex', 'vertices'),
136
+ array('virus', 'viri'),
137
+ array('volcano', 'volcanoes'),
138
+ array('wash', 'washes'),
139
+ array('watch', 'watches'),
140
+ array('wave', 'waves'),
141
+ array('wharf', 'wharves'),
142
+ array('wife', 'wives'),
143
+ array('woman', 'women'),
144
+ );
145
+ }
146
+
147
+ /**
148
+ * testInflectingSingulars method
149
+ *
150
+ * @dataProvider dataSampleWords
151
+ * @return void
152
+ */
153
+ public function testInflectingSingulars($singular, $plural)
154
+ {
155
+ $this->assertEquals(
156
+ $singular,
157
+ Inflector::singularize($plural),
158
+ "'$plural' should be singularized to '$singular'"
159
+ );
160
+ }
161
+
162
+ /**
163
+ * testInflectingPlurals method
164
+ *
165
+ * @dataProvider dataSampleWords
166
+ * @return void
167
+ */
168
+ public function testInflectingPlurals($singular, $plural)
169
+ {
170
+ $this->assertEquals(
171
+ $plural,
172
+ Inflector::pluralize($singular),
173
+ "'$singular' should be pluralized to '$plural'"
174
+ );
175
+ }
176
+
177
+ /**
178
+ * testCustomPluralRule method
179
+ *
180
+ * @return void
181
+ */
182
+ public function testCustomPluralRule()
183
+ {
184
+ Inflector::reset();
185
+ Inflector::rules('plural', array('/^(custom)$/i' => '\1izables'));
186
+
187
+ $this->assertEquals(Inflector::pluralize('custom'), 'customizables');
188
+
189
+ Inflector::rules('plural', array('uninflected' => array('uninflectable')));
190
+
191
+ $this->assertEquals(Inflector::pluralize('uninflectable'), 'uninflectable');
192
+
193
+ Inflector::rules('plural', array(
194
+ 'rules' => array('/^(alert)$/i' => '\1ables'),
195
+ 'uninflected' => array('noflect', 'abtuse'),
196
+ 'irregular' => array('amaze' => 'amazable', 'phone' => 'phonezes')
197
+ ));
198
+
199
+ $this->assertEquals(Inflector::pluralize('noflect'), 'noflect');
200
+ $this->assertEquals(Inflector::pluralize('abtuse'), 'abtuse');
201
+ $this->assertEquals(Inflector::pluralize('alert'), 'alertables');
202
+ $this->assertEquals(Inflector::pluralize('amaze'), 'amazable');
203
+ $this->assertEquals(Inflector::pluralize('phone'), 'phonezes');
204
+ }
205
+
206
+ /**
207
+ * testCustomSingularRule method
208
+ *
209
+ * @return void
210
+ */
211
+ public function testCustomSingularRule()
212
+ {
213
+ Inflector::reset();
214
+ Inflector::rules('singular', array('/(eple)r$/i' => '\1', '/(jente)r$/i' => '\1'));
215
+
216
+ $this->assertEquals(Inflector::singularize('epler'), 'eple');
217
+ $this->assertEquals(Inflector::singularize('jenter'), 'jente');
218
+
219
+ Inflector::rules('singular', array(
220
+ 'rules' => array('/^(bil)er$/i' => '\1', '/^(inflec|contribu)tors$/i' => '\1ta'),
221
+ 'uninflected' => array('singulars'),
222
+ 'irregular' => array('spins' => 'spinor')
223
+ ));
224
+
225
+ $this->assertEquals(Inflector::singularize('inflectors'), 'inflecta');
226
+ $this->assertEquals(Inflector::singularize('contributors'), 'contributa');
227
+ $this->assertEquals(Inflector::singularize('spins'), 'spinor');
228
+ $this->assertEquals(Inflector::singularize('singulars'), 'singulars');
229
+ }
230
+
231
+ /**
232
+ * test that setting new rules clears the inflector caches.
233
+ *
234
+ * @return void
235
+ */
236
+ public function testRulesClearsCaches()
237
+ {
238
+ Inflector::reset();
239
+
240
+ $this->assertEquals(Inflector::singularize('Bananas'), 'Banana');
241
+ $this->assertEquals(Inflector::pluralize('Banana'), 'Bananas');
242
+
243
+ Inflector::rules('singular', array(
244
+ 'rules' => array('/(.*)nas$/i' => '\1zzz')
245
+ ));
246
+
247
+ $this->assertEquals('Banazzz', Inflector::singularize('Bananas'), 'Was inflected with old rules.');
248
+
249
+ Inflector::rules('plural', array(
250
+ 'rules' => array('/(.*)na$/i' => '\1zzz'),
251
+ 'irregular' => array('corpus' => 'corpora')
252
+ ));
253
+
254
+ $this->assertEquals(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules.');
255
+ $this->assertEquals(Inflector::pluralize('corpus'), 'corpora', 'Was inflected with old irregular form.');
256
+ }
257
+
258
+ /**
259
+ * Test resetting inflection rules.
260
+ *
261
+ * @return void
262
+ */
263
+ public function testCustomRuleWithReset()
264
+ {
265
+ Inflector::reset();
266
+
267
+ $uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x');
268
+ $pluralIrregular = array('as' => 'ases');
269
+
270
+ Inflector::rules('singular', array(
271
+ 'rules' => array('/^(.*)(a|e|o|u)is$/i' => '\1\2l'),
272
+ 'uninflected' => $uninflected,
273
+ ), true);
274
+
275
+ Inflector::rules('plural', array(
276
+ 'rules' => array(
277
+ '/^(.*)(a|e|o|u)l$/i' => '\1\2is',
278
+ ),
279
+ 'uninflected' => $uninflected,
280
+ 'irregular' => $pluralIrregular
281
+ ), true);
282
+
283
+ $this->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois');
284
+ $this->assertEquals(Inflector::pluralize('Atlas'), 'Atlas');
285
+ $this->assertEquals(Inflector::singularize('Alcoois'), 'Alcool');
286
+ $this->assertEquals(Inflector::singularize('Atlas'), 'Atlas');
287
+ }
288
+
289
+ /**
290
+ * Test basic ucwords functionality.
291
+ *
292
+ * @return void
293
+ */
294
+ public function testUcwords()
295
+ {
296
+ $this->assertSame('Top-O-The-Morning To All_of_you!', Inflector::ucwords( 'top-o-the-morning to all_of_you!'));
297
+ }
298
+
299
+ /**
300
+ * Test ucwords functionality with custom delimeters.
301
+ *
302
+ * @return void
303
+ */
304
+ public function testUcwordsWithCustomDelimeters()
305
+ {
306
+ $this->assertSame('Top-O-The-Morning To All_Of_You!', Inflector::ucwords( 'top-o-the-morning to all_of_you!', '-_ '));
307
+ }
308
+ }
309
+
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Doctrine\Tests;
4
+
5
+ /**
6
+ * Base testcase class for all Doctrine testcases.
7
+ */
8
+ abstract class DoctrineTestCase extends \PHPUnit_Framework_TestCase
9
+ {
10
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/doctrine/inflector/tests/Doctrine/Tests/TestInit.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * This file bootstraps the test environment.
4
+ */
5
+ namespace Doctrine\Tests;
6
+
7
+ error_reporting(E_ALL | E_STRICT);
8
+
9
+ // register silently failing autoloader
10
+ spl_autoload_register(function($class)
11
+ {
12
+ if (0 === strpos($class, 'Doctrine\Tests\\')) {
13
+ $path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php';
14
+ if (is_file($path) && is_readable($path)) {
15
+ require_once $path;
16
+
17
+ return true;
18
+ }
19
+ } else if (0 === strpos($class, 'Doctrine\Common\\')) {
20
+ $path = __DIR__.'/../../../lib/'.($class = strtr($class, '\\', '/')).'.php';
21
+ if (is_file($path) && is_readable($path)) {
22
+ require_once $path;
23
+
24
+ return true;
25
+ }
26
+ }
27
+ });
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/.travis.yml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ sudo: false
4
+
5
+ php:
6
+ - 5.5
7
+ - 5.6
8
+ - 7.0
9
+ - 7.1
10
+ - hhvm
11
+
12
+ before_script:
13
+ - curl --version
14
+ - composer install --no-interaction --prefer-source --dev
15
+ - ~/.nvm/nvm.sh install v0.6.14
16
+ - ~/.nvm/nvm.sh run v0.6.14
17
+ - '[ "$TRAVIS_PHP_VERSION" != "7.0" ] || echo "xdebug.overload_var_dump = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini'
18
+
19
+ script: make test
20
+
21
+ matrix:
22
+ allow_failures:
23
+ - php: hhvm
24
+ fast_finish: true
25
+
26
+ before_deploy:
27
+ - rvm 1.9.3 do gem install mime-types -v 2.6.2
28
+ - make package
29
+
30
+ deploy:
31
+ provider: releases
32
+ api_key:
33
+ secure: UpypqlYgsU68QT/x40YzhHXvzWjFwCNo9d+G8KAdm7U9+blFfcWhV1aMdzugvPMl6woXgvJj7qHq5tAL4v6oswCORhpSBfLgOQVFaica5LiHsvWlAedOhxGmnJqMTwuepjBCxXhs3+I8Kof1n4oUL9gKytXjOVCX/f7XU1HiinU=
34
+ file:
35
+ - build/artifacts/guzzle.phar
36
+ - build/artifacts/guzzle.zip
37
+ on:
38
+ repo: guzzle/guzzle
39
+ tags: true
40
+ all_branches: true
41
+ php: 5.5
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/CHANGELOG.md ADDED
@@ -0,0 +1,1239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CHANGELOG
2
+
3
+ ## 6.2.2 - 2016-10-08
4
+
5
+ * Allow to pass nullable Response to delay callable
6
+ * Only add scheme when host is present
7
+ * Fix drain case where content-length is the literal string zero
8
+ * Obfuscate in-URL credentials in exceptions
9
+
10
+ ## 6.2.1 - 2016-07-18
11
+
12
+ * Address HTTP_PROXY security vulnerability, CVE-2016-5385:
13
+ https://httpoxy.org/
14
+ * Fixing timeout bug with StreamHandler:
15
+ https://github.com/guzzle/guzzle/pull/1488
16
+ * Only read up to `Content-Length` in PHP StreamHandler to avoid timeouts when
17
+ a server does not honor `Connection: close`.
18
+ * Ignore URI fragment when sending requests.
19
+
20
+ ## 6.2.0 - 2016-03-21
21
+
22
+ * Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`.
23
+ https://github.com/guzzle/guzzle/pull/1389
24
+ * Bug fix: Fix sleep calculation when waiting for delayed requests.
25
+ https://github.com/guzzle/guzzle/pull/1324
26
+ * Feature: More flexible history containers.
27
+ https://github.com/guzzle/guzzle/pull/1373
28
+ * Bug fix: defer sink stream opening in StreamHandler.
29
+ https://github.com/guzzle/guzzle/pull/1377
30
+ * Bug fix: do not attempt to escape cookie values.
31
+ https://github.com/guzzle/guzzle/pull/1406
32
+ * Feature: report original content encoding and length on decoded responses.
33
+ https://github.com/guzzle/guzzle/pull/1409
34
+ * Bug fix: rewind seekable request bodies before dispatching to cURL.
35
+ https://github.com/guzzle/guzzle/pull/1422
36
+ * Bug fix: provide an empty string to `http_build_query` for HHVM workaround.
37
+ https://github.com/guzzle/guzzle/pull/1367
38
+
39
+ ## 6.1.1 - 2015-11-22
40
+
41
+ * Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler
42
+ https://github.com/guzzle/guzzle/commit/911bcbc8b434adce64e223a6d1d14e9a8f63e4e4
43
+ * Feature: HandlerStack is now more generic.
44
+ https://github.com/guzzle/guzzle/commit/f2102941331cda544745eedd97fc8fd46e1ee33e
45
+ * Bug fix: setting verify to false in the StreamHandler now disables peer
46
+ verification. https://github.com/guzzle/guzzle/issues/1256
47
+ * Feature: Middleware now uses an exception factory, including more error
48
+ context. https://github.com/guzzle/guzzle/pull/1282
49
+ * Feature: better support for disabled functions.
50
+ https://github.com/guzzle/guzzle/pull/1287
51
+ * Bug fix: fixed regression where MockHandler was not using `sink`.
52
+ https://github.com/guzzle/guzzle/pull/1292
53
+
54
+ ## 6.1.0 - 2015-09-08
55
+
56
+ * Feature: Added the `on_stats` request option to provide access to transfer
57
+ statistics for requests. https://github.com/guzzle/guzzle/pull/1202
58
+ * Feature: Added the ability to persist session cookies in CookieJars.
59
+ https://github.com/guzzle/guzzle/pull/1195
60
+ * Feature: Some compatibility updates for Google APP Engine
61
+ https://github.com/guzzle/guzzle/pull/1216
62
+ * Feature: Added support for NO_PROXY to prevent the use of a proxy based on
63
+ a simple set of rules. https://github.com/guzzle/guzzle/pull/1197
64
+ * Feature: Cookies can now contain square brackets.
65
+ https://github.com/guzzle/guzzle/pull/1237
66
+ * Bug fix: Now correctly parsing `=` inside of quotes in Cookies.
67
+ https://github.com/guzzle/guzzle/pull/1232
68
+ * Bug fix: Cusotm cURL options now correctly override curl options of the
69
+ same name. https://github.com/guzzle/guzzle/pull/1221
70
+ * Bug fix: Content-Type header is now added when using an explicitly provided
71
+ multipart body. https://github.com/guzzle/guzzle/pull/1218
72
+ * Bug fix: Now ignoring Set-Cookie headers that have no name.
73
+ * Bug fix: Reason phrase is no longer cast to an int in some cases in the
74
+ cURL handler. https://github.com/guzzle/guzzle/pull/1187
75
+ * Bug fix: Remove the Authorization header when redirecting if the Host
76
+ header changes. https://github.com/guzzle/guzzle/pull/1207
77
+ * Bug fix: Cookie path matching fixes
78
+ https://github.com/guzzle/guzzle/issues/1129
79
+ * Bug fix: Fixing the cURL `body_as_string` setting
80
+ https://github.com/guzzle/guzzle/pull/1201
81
+ * Bug fix: quotes are no longer stripped when parsing cookies.
82
+ https://github.com/guzzle/guzzle/issues/1172
83
+ * Bug fix: `form_params` and `query` now always uses the `&` separator.
84
+ https://github.com/guzzle/guzzle/pull/1163
85
+ * Bug fix: Adding a Content-Length to PHP stream wrapper requests if not set.
86
+ https://github.com/guzzle/guzzle/pull/1189
87
+
88
+ ## 6.0.2 - 2015-07-04
89
+
90
+ * Fixed a memory leak in the curl handlers in which references to callbacks
91
+ were not being removed by `curl_reset`.
92
+ * Cookies are now extracted properly before redirects.
93
+ * Cookies now allow more character ranges.
94
+ * Decoded Content-Encoding responses are now modified to correctly reflect
95
+ their state if the encoding was automatically removed by a handler. This
96
+ means that the `Content-Encoding` header may be removed an the
97
+ `Content-Length` modified to reflect the message size after removing the
98
+ encoding.
99
+ * Added a more explicit error message when trying to use `form_params` and
100
+ `multipart` in the same request.
101
+ * Several fixes for HHVM support.
102
+ * Functions are now conditionally required using an additional level of
103
+ indirection to help with global Composer installations.
104
+
105
+ ## 6.0.1 - 2015-05-27
106
+
107
+ * Fixed a bug with serializing the `query` request option where the `&`
108
+ separator was missing.
109
+ * Added a better error message for when `body` is provided as an array. Please
110
+ use `form_params` or `multipart` instead.
111
+ * Various doc fixes.
112
+
113
+ ## 6.0.0 - 2015-05-26
114
+
115
+ * See the UPGRADING.md document for more information.
116
+ * Added `multipart` and `form_params` request options.
117
+ * Added `synchronous` request option.
118
+ * Added the `on_headers` request option.
119
+ * Fixed `expect` handling.
120
+ * No longer adding default middlewares in the client ctor. These need to be
121
+ present on the provided handler in order to work.
122
+ * Requests are no longer initiated when sending async requests with the
123
+ CurlMultiHandler. This prevents unexpected recursion from requests completing
124
+ while ticking the cURL loop.
125
+ * Removed the semantics of setting `default` to `true`. This is no longer
126
+ required now that the cURL loop is not ticked for async requests.
127
+ * Added request and response logging middleware.
128
+ * No longer allowing self signed certificates when using the StreamHandler.
129
+ * Ensuring that `sink` is valid if saving to a file.
130
+ * Request exceptions now include a "handler context" which provides handler
131
+ specific contextual information.
132
+ * Added `GuzzleHttp\RequestOptions` to allow request options to be applied
133
+ using constants.
134
+ * `$maxHandles` has been removed from CurlMultiHandler.
135
+ * `MultipartPostBody` is now part of the `guzzlehttp/psr7` package.
136
+
137
+ ## 5.3.0 - 2015-05-19
138
+
139
+ * Mock now supports `save_to`
140
+ * Marked `AbstractRequestEvent::getTransaction()` as public.
141
+ * Fixed a bug in which multiple headers using different casing would overwrite
142
+ previous headers in the associative array.
143
+ * Added `Utils::getDefaultHandler()`
144
+ * Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated.
145
+ * URL scheme is now always lowercased.
146
+
147
+ ## 6.0.0-beta.1
148
+
149
+ * Requires PHP >= 5.5
150
+ * Updated to use PSR-7
151
+ * Requires immutable messages, which basically means an event based system
152
+ owned by a request instance is no longer possible.
153
+ * Utilizing the [Guzzle PSR-7 package](https://github.com/guzzle/psr7).
154
+ * Removed the dependency on `guzzlehttp/streams`. These stream abstractions
155
+ are available in the `guzzlehttp/psr7` package under the `GuzzleHttp\Psr7`
156
+ namespace.
157
+ * Added middleware and handler system
158
+ * Replaced the Guzzle event and subscriber system with a middleware system.
159
+ * No longer depends on RingPHP, but rather places the HTTP handlers directly
160
+ in Guzzle, operating on PSR-7 messages.
161
+ * Retry logic is now encapsulated in `GuzzleHttp\Middleware::retry`, which
162
+ means the `guzzlehttp/retry-subscriber` is now obsolete.
163
+ * Mocking responses is now handled using `GuzzleHttp\Handler\MockHandler`.
164
+ * Asynchronous responses
165
+ * No longer supports the `future` request option to send an async request.
166
+ Instead, use one of the `*Async` methods of a client (e.g., `requestAsync`,
167
+ `getAsync`, etc.).
168
+ * Utilizing `GuzzleHttp\Promise` instead of React's promise library to avoid
169
+ recursion required by chaining and forwarding react promises. See
170
+ https://github.com/guzzle/promises
171
+ * Added `requestAsync` and `sendAsync` to send request asynchronously.
172
+ * Added magic methods for `getAsync()`, `postAsync()`, etc. to send requests
173
+ asynchronously.
174
+ * Request options
175
+ * POST and form updates
176
+ * Added the `form_fields` and `form_files` request options.
177
+ * Removed the `GuzzleHttp\Post` namespace.
178
+ * The `body` request option no longer accepts an array for POST requests.
179
+ * The `exceptions` request option has been deprecated in favor of the
180
+ `http_errors` request options.
181
+ * The `save_to` request option has been deprecated in favor of `sink` request
182
+ option.
183
+ * Clients no longer accept an array of URI template string and variables for
184
+ URI variables. You will need to expand URI templates before passing them
185
+ into a client constructor or request method.
186
+ * Client methods `get()`, `post()`, `put()`, `patch()`, `options()`, etc. are
187
+ now magic methods that will send synchronous requests.
188
+ * Replaced `Utils.php` with plain functions in `functions.php`.
189
+ * Removed `GuzzleHttp\Collection`.
190
+ * Removed `GuzzleHttp\BatchResults`. Batched pool results are now returned as
191
+ an array.
192
+ * Removed `GuzzleHttp\Query`. Query string handling is now handled using an
193
+ associative array passed into the `query` request option. The query string
194
+ is serialized using PHP's `http_build_query`. If you need more control, you
195
+ can pass the query string in as a string.
196
+ * `GuzzleHttp\QueryParser` has been replaced with the
197
+ `GuzzleHttp\Psr7\parse_query`.
198
+
199
+ ## 5.2.0 - 2015-01-27
200
+
201
+ * Added `AppliesHeadersInterface` to make applying headers to a request based
202
+ on the body more generic and not specific to `PostBodyInterface`.
203
+ * Reduced the number of stack frames needed to send requests.
204
+ * Nested futures are now resolved in the client rather than the RequestFsm
205
+ * Finishing state transitions is now handled in the RequestFsm rather than the
206
+ RingBridge.
207
+ * Added a guard in the Pool class to not use recursion for request retries.
208
+
209
+ ## 5.1.0 - 2014-12-19
210
+
211
+ * Pool class no longer uses recursion when a request is intercepted.
212
+ * The size of a Pool can now be dynamically adjusted using a callback.
213
+ See https://github.com/guzzle/guzzle/pull/943.
214
+ * Setting a request option to `null` when creating a request with a client will
215
+ ensure that the option is not set. This allows you to overwrite default
216
+ request options on a per-request basis.
217
+ See https://github.com/guzzle/guzzle/pull/937.
218
+ * Added the ability to limit which protocols are allowed for redirects by
219
+ specifying a `protocols` array in the `allow_redirects` request option.
220
+ * Nested futures due to retries are now resolved when waiting for synchronous
221
+ responses. See https://github.com/guzzle/guzzle/pull/947.
222
+ * `"0"` is now an allowed URI path. See
223
+ https://github.com/guzzle/guzzle/pull/935.
224
+ * `Query` no longer typehints on the `$query` argument in the constructor,
225
+ allowing for strings and arrays.
226
+ * Exceptions thrown in the `end` event are now correctly wrapped with Guzzle
227
+ specific exceptions if necessary.
228
+
229
+ ## 5.0.3 - 2014-11-03
230
+
231
+ This change updates query strings so that they are treated as un-encoded values
232
+ by default where the value represents an un-encoded value to send over the
233
+ wire. A Query object then encodes the value before sending over the wire. This
234
+ means that even value query string values (e.g., ":") are url encoded. This
235
+ makes the Query class match PHP's http_build_query function. However, if you
236
+ want to send requests over the wire using valid query string characters that do
237
+ not need to be encoded, then you can provide a string to Url::setQuery() and
238
+ pass true as the second argument to specify that the query string is a raw
239
+ string that should not be parsed or encoded (unless a call to getQuery() is
240
+ subsequently made, forcing the query-string to be converted into a Query
241
+ object).
242
+
243
+ ## 5.0.2 - 2014-10-30
244
+
245
+ * Added a trailing `\r\n` to multipart/form-data payloads. See
246
+ https://github.com/guzzle/guzzle/pull/871
247
+ * Added a `GuzzleHttp\Pool::send()` convenience method to match the docs.
248
+ * Status codes are now returned as integers. See
249
+ https://github.com/guzzle/guzzle/issues/881
250
+ * No longer overwriting an existing `application/x-www-form-urlencoded` header
251
+ when sending POST requests, allowing for customized headers. See
252
+ https://github.com/guzzle/guzzle/issues/877
253
+ * Improved path URL serialization.
254
+
255
+ * No longer double percent-encoding characters in the path or query string if
256
+ they are already encoded.
257
+ * Now properly encoding the supplied path to a URL object, instead of only
258
+ encoding ' ' and '?'.
259
+ * Note: This has been changed in 5.0.3 to now encode query string values by
260
+ default unless the `rawString` argument is provided when setting the query
261
+ string on a URL: Now allowing many more characters to be present in the
262
+ query string without being percent encoded. See http://tools.ietf.org/html/rfc3986#appendix-A
263
+
264
+ ## 5.0.1 - 2014-10-16
265
+
266
+ Bugfix release.
267
+
268
+ * Fixed an issue where connection errors still returned response object in
269
+ error and end events event though the response is unusable. This has been
270
+ corrected so that a response is not returned in the `getResponse` method of
271
+ these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867
272
+ * Fixed an issue where transfer statistics were not being populated in the
273
+ RingBridge. https://github.com/guzzle/guzzle/issues/866
274
+
275
+ ## 5.0.0 - 2014-10-12
276
+
277
+ Adding support for non-blocking responses and some minor API cleanup.
278
+
279
+ ### New Features
280
+
281
+ * Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`.
282
+ * Added a public API for creating a default HTTP adapter.
283
+ * Updated the redirect plugin to be non-blocking so that redirects are sent
284
+ concurrently. Other plugins like this can now be updated to be non-blocking.
285
+ * Added a "progress" event so that you can get upload and download progress
286
+ events.
287
+ * Added `GuzzleHttp\Pool` which implements FutureInterface and transfers
288
+ requests concurrently using a capped pool size as efficiently as possible.
289
+ * Added `hasListeners()` to EmitterInterface.
290
+ * Removed `GuzzleHttp\ClientInterface::sendAll` and marked
291
+ `GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the
292
+ recommended way).
293
+
294
+ ### Breaking changes
295
+
296
+ The breaking changes in this release are relatively minor. The biggest thing to
297
+ look out for is that request and response objects no longer implement fluent
298
+ interfaces.
299
+
300
+ * Removed the fluent interfaces (i.e., `return $this`) from requests,
301
+ responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`,
302
+ `GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and
303
+ `GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of
304
+ why I did this: http://ocramius.github.io/blog/fluent-interfaces-are-evil/.
305
+ This also makes the Guzzle message interfaces compatible with the current
306
+ PSR-7 message proposal.
307
+ * Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except
308
+ for the HTTP request functions from function.php, these functions are now
309
+ implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode`
310
+ moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to
311
+ `GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to
312
+ `GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be
313
+ `GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php
314
+ caused problems for many users: they aren't PSR-4 compliant, require an
315
+ explicit include, and needed an if-guard to ensure that the functions are not
316
+ declared multiple times.
317
+ * Rewrote adapter layer.
318
+ * Removing all classes from `GuzzleHttp\Adapter`, these are now
319
+ implemented as callables that are stored in `GuzzleHttp\Ring\Client`.
320
+ * Removed the concept of "parallel adapters". Sending requests serially or
321
+ concurrently is now handled using a single adapter.
322
+ * Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The
323
+ Transaction object now exposes the request, response, and client as public
324
+ properties. The getters and setters have been removed.
325
+ * Removed the "headers" event. This event was only useful for changing the
326
+ body a response once the headers of the response were known. You can implement
327
+ a similar behavior in a number of ways. One example might be to use a
328
+ FnStream that has access to the transaction being sent. For example, when the
329
+ first byte is written, you could check if the response headers match your
330
+ expectations, and if so, change the actual stream body that is being
331
+ written to.
332
+ * Removed the `asArray` parameter from
333
+ `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
334
+ value as an array, then use the newly added `getHeaderAsArray()` method of
335
+ `MessageInterface`. This change makes the Guzzle interfaces compatible with
336
+ the PSR-7 interfaces.
337
+ * `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add
338
+ custom request options using double-dispatch (this was an implementation
339
+ detail). Instead, you should now provide an associative array to the
340
+ constructor which is a mapping of the request option name mapping to a
341
+ function that applies the option value to a request.
342
+ * Removed the concept of "throwImmediately" from exceptions and error events.
343
+ This control mechanism was used to stop a transfer of concurrent requests
344
+ from completing. This can now be handled by throwing the exception or by
345
+ cancelling a pool of requests or each outstanding future request individually.
346
+ * Updated to "GuzzleHttp\Streams" 3.0.
347
+ * `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a
348
+ `maxLen` parameter. This update makes the Guzzle streams project
349
+ compatible with the current PSR-7 proposal.
350
+ * `GuzzleHttp\Stream\Stream::__construct`,
351
+ `GuzzleHttp\Stream\Stream::factory`, and
352
+ `GuzzleHttp\Stream\Utils::create` no longer accept a size in the second
353
+ argument. They now accept an associative array of options, including the
354
+ "size" key and "metadata" key which can be used to provide custom metadata.
355
+
356
+ ## 4.2.2 - 2014-09-08
357
+
358
+ * Fixed a memory leak in the CurlAdapter when reusing cURL handles.
359
+ * No longer using `request_fulluri` in stream adapter proxies.
360
+ * Relative redirects are now based on the last response, not the first response.
361
+
362
+ ## 4.2.1 - 2014-08-19
363
+
364
+ * Ensuring that the StreamAdapter does not always add a Content-Type header
365
+ * Adding automated github releases with a phar and zip
366
+
367
+ ## 4.2.0 - 2014-08-17
368
+
369
+ * Now merging in default options using a case-insensitive comparison.
370
+ Closes https://github.com/guzzle/guzzle/issues/767
371
+ * Added the ability to automatically decode `Content-Encoding` response bodies
372
+ using the `decode_content` request option. This is set to `true` by default
373
+ to decode the response body if it comes over the wire with a
374
+ `Content-Encoding`. Set this value to `false` to disable decoding the
375
+ response content, and pass a string to provide a request `Accept-Encoding`
376
+ header and turn on automatic response decoding. This feature now allows you
377
+ to pass an `Accept-Encoding` header in the headers of a request but still
378
+ disable automatic response decoding.
379
+ Closes https://github.com/guzzle/guzzle/issues/764
380
+ * Added the ability to throw an exception immediately when transferring
381
+ requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760
382
+ * Updating guzzlehttp/streams dependency to ~2.1
383
+ * No longer utilizing the now deprecated namespaced methods from the stream
384
+ package.
385
+
386
+ ## 4.1.8 - 2014-08-14
387
+
388
+ * Fixed an issue in the CurlFactory that caused setting the `stream=false`
389
+ request option to throw an exception.
390
+ See: https://github.com/guzzle/guzzle/issues/769
391
+ * TransactionIterator now calls rewind on the inner iterator.
392
+ See: https://github.com/guzzle/guzzle/pull/765
393
+ * You can now set the `Content-Type` header to `multipart/form-data`
394
+ when creating POST requests to force multipart bodies.
395
+ See https://github.com/guzzle/guzzle/issues/768
396
+
397
+ ## 4.1.7 - 2014-08-07
398
+
399
+ * Fixed an error in the HistoryPlugin that caused the same request and response
400
+ to be logged multiple times when an HTTP protocol error occurs.
401
+ * Ensuring that cURL does not add a default Content-Type when no Content-Type
402
+ has been supplied by the user. This prevents the adapter layer from modifying
403
+ the request that is sent over the wire after any listeners may have already
404
+ put the request in a desired state (e.g., signed the request).
405
+ * Throwing an exception when you attempt to send requests that have the
406
+ "stream" set to true in parallel using the MultiAdapter.
407
+ * Only calling curl_multi_select when there are active cURL handles. This was
408
+ previously changed and caused performance problems on some systems due to PHP
409
+ always selecting until the maximum select timeout.
410
+ * Fixed a bug where multipart/form-data POST fields were not correctly
411
+ aggregated (e.g., values with "&").
412
+
413
+ ## 4.1.6 - 2014-08-03
414
+
415
+ * Added helper methods to make it easier to represent messages as strings,
416
+ including getting the start line and getting headers as a string.
417
+
418
+ ## 4.1.5 - 2014-08-02
419
+
420
+ * Automatically retrying cURL "Connection died, retrying a fresh connect"
421
+ errors when possible.
422
+ * cURL implementation cleanup
423
+ * Allowing multiple event subscriber listeners to be registered per event by
424
+ passing an array of arrays of listener configuration.
425
+
426
+ ## 4.1.4 - 2014-07-22
427
+
428
+ * Fixed a bug that caused multi-part POST requests with more than one field to
429
+ serialize incorrectly.
430
+ * Paths can now be set to "0"
431
+ * `ResponseInterface::xml` now accepts a `libxml_options` option and added a
432
+ missing default argument that was required when parsing XML response bodies.
433
+ * A `save_to` stream is now created lazily, which means that files are not
434
+ created on disk unless a request succeeds.
435
+
436
+ ## 4.1.3 - 2014-07-15
437
+
438
+ * Various fixes to multipart/form-data POST uploads
439
+ * Wrapping function.php in an if-statement to ensure Guzzle can be used
440
+ globally and in a Composer install
441
+ * Fixed an issue with generating and merging in events to an event array
442
+ * POST headers are only applied before sending a request to allow you to change
443
+ the query aggregator used before uploading
444
+ * Added much more robust query string parsing
445
+ * Fixed various parsing and normalization issues with URLs
446
+ * Fixing an issue where multi-valued headers were not being utilized correctly
447
+ in the StreamAdapter
448
+
449
+ ## 4.1.2 - 2014-06-18
450
+
451
+ * Added support for sending payloads with GET requests
452
+
453
+ ## 4.1.1 - 2014-06-08
454
+
455
+ * Fixed an issue related to using custom message factory options in subclasses
456
+ * Fixed an issue with nested form fields in a multi-part POST
457
+ * Fixed an issue with using the `json` request option for POST requests
458
+ * Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar`
459
+
460
+ ## 4.1.0 - 2014-05-27
461
+
462
+ * Added a `json` request option to easily serialize JSON payloads.
463
+ * Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON.
464
+ * Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`.
465
+ * Added the ability to provide an emitter to a client in the client constructor.
466
+ * Added the ability to persist a cookie session using $_SESSION.
467
+ * Added a trait that can be used to add event listeners to an iterator.
468
+ * Removed request method constants from RequestInterface.
469
+ * Fixed warning when invalid request start-lines are received.
470
+ * Updated MessageFactory to work with custom request option methods.
471
+ * Updated cacert bundle to latest build.
472
+
473
+ 4.0.2 (2014-04-16)
474
+ ------------------
475
+
476
+ * Proxy requests using the StreamAdapter now properly use request_fulluri (#632)
477
+ * Added the ability to set scalars as POST fields (#628)
478
+
479
+ ## 4.0.1 - 2014-04-04
480
+
481
+ * The HTTP status code of a response is now set as the exception code of
482
+ RequestException objects.
483
+ * 303 redirects will now correctly switch from POST to GET requests.
484
+ * The default parallel adapter of a client now correctly uses the MultiAdapter.
485
+ * HasDataTrait now initializes the internal data array as an empty array so
486
+ that the toArray() method always returns an array.
487
+
488
+ ## 4.0.0 - 2014-03-29
489
+
490
+ * For more information on the 4.0 transition, see:
491
+ http://mtdowling.com/blog/2014/03/15/guzzle-4-rc/
492
+ * For information on changes and upgrading, see:
493
+ https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
494
+ * Added `GuzzleHttp\batch()` as a convenience function for sending requests in
495
+ parallel without needing to write asynchronous code.
496
+ * Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`.
497
+ You can now pass a callable or an array of associative arrays where each
498
+ associative array contains the "fn", "priority", and "once" keys.
499
+
500
+ ## 4.0.0.rc-2 - 2014-03-25
501
+
502
+ * Removed `getConfig()` and `setConfig()` from clients to avoid confusion
503
+ around whether things like base_url, message_factory, etc. should be able to
504
+ be retrieved or modified.
505
+ * Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface
506
+ * functions.php functions were renamed using snake_case to match PHP idioms
507
+ * Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and
508
+ `GUZZLE_CURL_SELECT_TIMEOUT` environment variables
509
+ * Added the ability to specify custom `sendAll()` event priorities
510
+ * Added the ability to specify custom stream context options to the stream
511
+ adapter.
512
+ * Added a functions.php function for `get_path()` and `set_path()`
513
+ * CurlAdapter and MultiAdapter now use a callable to generate curl resources
514
+ * MockAdapter now properly reads a body and emits a `headers` event
515
+ * Updated Url class to check if a scheme and host are set before adding ":"
516
+ and "//". This allows empty Url (e.g., "") to be serialized as "".
517
+ * Parsing invalid XML no longer emits warnings
518
+ * Curl classes now properly throw AdapterExceptions
519
+ * Various performance optimizations
520
+ * Streams are created with the faster `Stream\create()` function
521
+ * Marked deprecation_proxy() as internal
522
+ * Test server is now a collection of static methods on a class
523
+
524
+ ## 4.0.0-rc.1 - 2014-03-15
525
+
526
+ * See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
527
+
528
+ ## 3.8.1 - 2014-01-28
529
+
530
+ * Bug: Always using GET requests when redirecting from a 303 response
531
+ * Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in
532
+ `Guzzle\Http\ClientInterface::setSslVerification()`
533
+ * Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL
534
+ * Bug: The body of a request can now be set to `"0"`
535
+ * Sending PHP stream requests no longer forces `HTTP/1.0`
536
+ * Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of
537
+ each sub-exception
538
+ * Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than
539
+ clobbering everything).
540
+ * Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators)
541
+ * Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`.
542
+ For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`.
543
+ * Now properly escaping the regular expression delimiter when matching Cookie domains.
544
+ * Network access is now disabled when loading XML documents
545
+
546
+ ## 3.8.0 - 2013-12-05
547
+
548
+ * Added the ability to define a POST name for a file
549
+ * JSON response parsing now properly walks additionalProperties
550
+ * cURL error code 18 is now retried automatically in the BackoffPlugin
551
+ * Fixed a cURL error when URLs contain fragments
552
+ * Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were
553
+ CurlExceptions
554
+ * CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e)
555
+ * Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS`
556
+ * Fixed a bug that was encountered when parsing empty header parameters
557
+ * UriTemplate now has a `setRegex()` method to match the docs
558
+ * The `debug` request parameter now checks if it is truthy rather than if it exists
559
+ * Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin
560
+ * Added the ability to combine URLs using strict RFC 3986 compliance
561
+ * Command objects can now return the validation errors encountered by the command
562
+ * Various fixes to cache revalidation (#437 and 29797e5)
563
+ * Various fixes to the AsyncPlugin
564
+ * Cleaned up build scripts
565
+
566
+ ## 3.7.4 - 2013-10-02
567
+
568
+ * Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430)
569
+ * Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp
570
+ (see https://github.com/aws/aws-sdk-php/issues/147)
571
+ * Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots
572
+ * Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420)
573
+ * Updated the bundled cacert.pem (#419)
574
+ * OauthPlugin now supports adding authentication to headers or query string (#425)
575
+
576
+ ## 3.7.3 - 2013-09-08
577
+
578
+ * Added the ability to get the exception associated with a request/command when using `MultiTransferException` and
579
+ `CommandTransferException`.
580
+ * Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description
581
+ * Schemas are only injected into response models when explicitly configured.
582
+ * No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of
583
+ an EntityBody.
584
+ * Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator.
585
+ * Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`.
586
+ * Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody()
587
+ * Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin
588
+ * Bug fix: Visiting XML attributes first before visiting XML children when serializing requests
589
+ * Bug fix: Properly parsing headers that contain commas contained in quotes
590
+ * Bug fix: mimetype guessing based on a filename is now case-insensitive
591
+
592
+ ## 3.7.2 - 2013-08-02
593
+
594
+ * Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander
595
+ See https://github.com/guzzle/guzzle/issues/371
596
+ * Bug fix: Cookie domains are now matched correctly according to RFC 6265
597
+ See https://github.com/guzzle/guzzle/issues/377
598
+ * Bug fix: GET parameters are now used when calculating an OAuth signature
599
+ * Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted
600
+ * `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched
601
+ * `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input.
602
+ See https://github.com/guzzle/guzzle/issues/379
603
+ * Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See
604
+ https://github.com/guzzle/guzzle/pull/380
605
+ * cURL multi cleanup and optimizations
606
+
607
+ ## 3.7.1 - 2013-07-05
608
+
609
+ * Bug fix: Setting default options on a client now works
610
+ * Bug fix: Setting options on HEAD requests now works. See #352
611
+ * Bug fix: Moving stream factory before send event to before building the stream. See #353
612
+ * Bug fix: Cookies no longer match on IP addresses per RFC 6265
613
+ * Bug fix: Correctly parsing header parameters that are in `<>` and quotes
614
+ * Added `cert` and `ssl_key` as request options
615
+ * `Host` header can now diverge from the host part of a URL if the header is set manually
616
+ * `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter
617
+ * OAuth parameters are only added via the plugin if they aren't already set
618
+ * Exceptions are now thrown when a URL cannot be parsed
619
+ * Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails
620
+ * Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin
621
+
622
+ ## 3.7.0 - 2013-06-10
623
+
624
+ * See UPGRADING.md for more information on how to upgrade.
625
+ * Requests now support the ability to specify an array of $options when creating a request to more easily modify a
626
+ request. You can pass a 'request.options' configuration setting to a client to apply default request options to
627
+ every request created by a client (e.g. default query string variables, headers, curl options, etc.).
628
+ * Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`.
629
+ See `Guzzle\Http\StaticClient::mount`.
630
+ * Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests
631
+ created by a command (e.g. custom headers, query string variables, timeout settings, etc.).
632
+ * Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the
633
+ headers of a response
634
+ * Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key
635
+ (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`)
636
+ * ServiceBuilders now support storing and retrieving arbitrary data
637
+ * CachePlugin can now purge all resources for a given URI
638
+ * CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource
639
+ * CachePlugin now uses the Vary header to determine if a resource is a cache hit
640
+ * `Guzzle\Http\Message\Response` now implements `\Serializable`
641
+ * Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters
642
+ * `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable
643
+ * Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()`
644
+ * Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size
645
+ * `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message
646
+ * Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older
647
+ Symfony users can still use the old version of Monolog.
648
+ * Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`.
649
+ Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`.
650
+ * Several performance improvements to `Guzzle\Common\Collection`
651
+ * Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
652
+ createRequest, head, delete, put, patch, post, options, prepareRequest
653
+ * Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
654
+ * Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
655
+ * Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
656
+ `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
657
+ resource, string, or EntityBody into the $options parameter to specify the download location of the response.
658
+ * Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
659
+ default `array()`
660
+ * Added `Guzzle\Stream\StreamInterface::isRepeatable`
661
+ * Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
662
+ $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
663
+ $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`.
664
+ * Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`.
665
+ * Removed `Guzzle\Http\ClientInterface::expandTemplate()`
666
+ * Removed `Guzzle\Http\ClientInterface::setRequestFactory()`
667
+ * Removed `Guzzle\Http\ClientInterface::getCurlMulti()`
668
+ * Removed `Guzzle\Http\Message\RequestInterface::canCache`
669
+ * Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`
670
+ * Removed `Guzzle\Http\Message\RequestInterface::isRedirect`
671
+ * Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
672
+ * You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting
673
+ `Guzzle\Common\Version::$emitWarnings` to true.
674
+ * Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use
675
+ `$request->getResponseBody()->isRepeatable()` instead.
676
+ * Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
677
+ `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
678
+ * Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
679
+ `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
680
+ * Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
681
+ * Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
682
+ * Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
683
+ * Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand.
684
+ These will work through Guzzle 4.0
685
+ * Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params].
686
+ * Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
687
+ * Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`.
688
+ * Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`.
689
+ * Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
690
+ * Marked `Guzzle\Common\Collection::inject()` as deprecated.
691
+ * Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');`
692
+ * CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
693
+ CacheStorageInterface. These two objects and interface will be removed in a future version.
694
+ * Always setting X-cache headers on cached responses
695
+ * Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
696
+ * `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
697
+ $request, Response $response);`
698
+ * `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
699
+ * `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
700
+ * Added `CacheStorageInterface::purge($url)`
701
+ * `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
702
+ $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
703
+ CanCacheStrategyInterface $canCache = null)`
704
+ * Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
705
+
706
+ ## 3.6.0 - 2013-05-29
707
+
708
+ * ServiceDescription now implements ToArrayInterface
709
+ * Added command.hidden_params to blacklist certain headers from being treated as additionalParameters
710
+ * Guzzle can now correctly parse incomplete URLs
711
+ * Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
712
+ * Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
713
+ * Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
714
+ * Specific header implementations can be created for complex headers. When a message creates a header, it uses a
715
+ HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
716
+ CacheControl header implementation.
717
+ * Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
718
+ * Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
719
+ * Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
720
+ Guzzle\Http\Curl\RequestMediator
721
+ * Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
722
+ * Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
723
+ * Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
724
+ * Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
725
+ * Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
726
+ * All response header helper functions return a string rather than mixing Header objects and strings inconsistently
727
+ * Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
728
+ directly via interfaces
729
+ * Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
730
+ but are a no-op until removed.
731
+ * Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
732
+ `Guzzle\Service\Command\ArrayCommandInterface`.
733
+ * Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
734
+ on a request while the request is still being transferred
735
+ * The ability to case-insensitively search for header values
736
+ * Guzzle\Http\Message\Header::hasExactHeader
737
+ * Guzzle\Http\Message\Header::raw. Use getAll()
738
+ * Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
739
+ instead.
740
+ * `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
741
+ * Added the ability to cast Model objects to a string to view debug information.
742
+
743
+ ## 3.5.0 - 2013-05-13
744
+
745
+ * Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times
746
+ * Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove
747
+ itself from the EventDispatcher)
748
+ * Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values
749
+ * Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too
750
+ * Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a
751
+ non-existent key
752
+ * Bug: All __call() method arguments are now required (helps with mocking frameworks)
753
+ * Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference
754
+ to help with refcount based garbage collection of resources created by sending a request
755
+ * Deprecating ZF1 cache and log adapters. These will be removed in the next major version.
756
+ * Deprecating `Response::getPreviousResponse()` (method signature still exists, but it's deprecated). Use the
757
+ HistoryPlugin for a history.
758
+ * Added a `responseBody` alias for the `response_body` location
759
+ * Refactored internals to no longer rely on Response::getRequest()
760
+ * HistoryPlugin can now be cast to a string
761
+ * HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests
762
+ and responses that are sent over the wire
763
+ * Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects
764
+
765
+ ## 3.4.3 - 2013-04-30
766
+
767
+ * Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response
768
+ * Added a check to re-extract the temp cacert bundle from the phar before sending each request
769
+
770
+ ## 3.4.2 - 2013-04-29
771
+
772
+ * Bug fix: Stream objects now work correctly with "a" and "a+" modes
773
+ * Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present
774
+ * Bug fix: AsyncPlugin no longer forces HEAD requests
775
+ * Bug fix: DateTime timezones are now properly handled when using the service description schema formatter
776
+ * Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails
777
+ * Setting a response on a request will write to the custom request body from the response body if one is specified
778
+ * LogPlugin now writes to php://output when STDERR is undefined
779
+ * Added the ability to set multiple POST files for the same key in a single call
780
+ * application/x-www-form-urlencoded POSTs now use the utf-8 charset by default
781
+ * Added the ability to queue CurlExceptions to the MockPlugin
782
+ * Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send)
783
+ * Configuration loading now allows remote files
784
+
785
+ ## 3.4.1 - 2013-04-16
786
+
787
+ * Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti
788
+ handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost.
789
+ * Exceptions are now properly grouped when sending requests in parallel
790
+ * Redirects are now properly aggregated when a multi transaction fails
791
+ * Redirects now set the response on the original object even in the event of a failure
792
+ * Bug fix: Model names are now properly set even when using $refs
793
+ * Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax
794
+ * Added support for oauth_callback in OAuth signatures
795
+ * Added support for oauth_verifier in OAuth signatures
796
+ * Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection
797
+
798
+ ## 3.4.0 - 2013-04-11
799
+
800
+ * Bug fix: URLs are now resolved correctly based on http://tools.ietf.org/html/rfc3986#section-5.2. #289
801
+ * Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289
802
+ * Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263
803
+ * Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264.
804
+ * Bug fix: Added `number` type to service descriptions.
805
+ * Bug fix: empty parameters are removed from an OAuth signature
806
+ * Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header
807
+ * Bug fix: Fixed "array to string" error when validating a union of types in a service description
808
+ * Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream
809
+ * Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin.
810
+ * Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs.
811
+ * The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections.
812
+ * Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if
813
+ the Content-Type can be determined based on the entity body or the path of the request.
814
+ * Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder.
815
+ * Added support for a PSR-3 LogAdapter.
816
+ * Added a `command.after_prepare` event
817
+ * Added `oauth_callback` parameter to the OauthPlugin
818
+ * Added the ability to create a custom stream class when using a stream factory
819
+ * Added a CachingEntityBody decorator
820
+ * Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized.
821
+ * The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar.
822
+ * You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies
823
+ * POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This
824
+ means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use
825
+ POST fields or files (the latter is only used when emulating a form POST in the browser).
826
+ * Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest
827
+
828
+ ## 3.3.1 - 2013-03-10
829
+
830
+ * Added the ability to create PHP streaming responses from HTTP requests
831
+ * Bug fix: Running any filters when parsing response headers with service descriptions
832
+ * Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing
833
+ * Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across
834
+ response location visitors.
835
+ * Bug fix: Removed the possibility of creating configuration files with circular dependencies
836
+ * RequestFactory::create() now uses the key of a POST file when setting the POST file name
837
+ * Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set
838
+
839
+ ## 3.3.0 - 2013-03-03
840
+
841
+ * A large number of performance optimizations have been made
842
+ * Bug fix: Added 'wb' as a valid write mode for streams
843
+ * Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned
844
+ * Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()`
845
+ * BC: Removed `Guzzle\Http\Utils` class
846
+ * BC: Setting a service description on a client will no longer modify the client's command factories.
847
+ * BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using
848
+ the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
849
+ * BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to
850
+ lowercase
851
+ * Operation parameter objects are now lazy loaded internally
852
+ * Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses
853
+ * Added support for instantiating responseType=class responseClass classes. Classes must implement
854
+ `Guzzle\Service\Command\ResponseClassInterface`
855
+ * Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These
856
+ additional properties also support locations and can be used to parse JSON responses where the outermost part of the
857
+ JSON is an array
858
+ * Added support for nested renaming of JSON models (rename sentAs to name)
859
+ * CachePlugin
860
+ * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error
861
+ * Debug headers can now added to cached response in the CachePlugin
862
+
863
+ ## 3.2.0 - 2013-02-14
864
+
865
+ * CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients.
866
+ * URLs with no path no longer contain a "/" by default
867
+ * Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url.
868
+ * BadResponseException no longer includes the full request and response message
869
+ * Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface
870
+ * Adding getResponseBody() to Guzzle\Http\Message\RequestInterface
871
+ * Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription
872
+ * Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list
873
+ * xmlEncoding can now be customized for the XML declaration of a XML service description operation
874
+ * Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value
875
+ aggregation and no longer uses callbacks
876
+ * The URL encoding implementation of Guzzle\Http\QueryString can now be customized
877
+ * Bug fix: Filters were not always invoked for array service description parameters
878
+ * Bug fix: Redirects now use a target response body rather than a temporary response body
879
+ * Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded
880
+ * Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives
881
+
882
+ ## 3.1.2 - 2013-01-27
883
+
884
+ * Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the
885
+ response body. For example, the XmlVisitor now parses the XML response into an array in the before() method.
886
+ * Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent
887
+ * CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444)
888
+ * Fixed a bug where redirect responses were not chained correctly using getPreviousResponse()
889
+ * Setting default headers on a client after setting the user-agent will not erase the user-agent setting
890
+
891
+ ## 3.1.1 - 2013-01-20
892
+
893
+ * Adding wildcard support to Guzzle\Common\Collection::getPath()
894
+ * Adding alias support to ServiceBuilder configs
895
+ * Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface
896
+
897
+ ## 3.1.0 - 2013-01-12
898
+
899
+ * BC: CurlException now extends from RequestException rather than BadResponseException
900
+ * BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse()
901
+ * Added getData to ServiceDescriptionInterface
902
+ * Added context array to RequestInterface::setState()
903
+ * Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http
904
+ * Bug: Adding required content-type when JSON request visitor adds JSON to a command
905
+ * Bug: Fixing the serialization of a service description with custom data
906
+ * Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing
907
+ an array of successful and failed responses
908
+ * Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection
909
+ * Added Guzzle\Http\IoEmittingEntityBody
910
+ * Moved command filtration from validators to location visitors
911
+ * Added `extends` attributes to service description parameters
912
+ * Added getModels to ServiceDescriptionInterface
913
+
914
+ ## 3.0.7 - 2012-12-19
915
+
916
+ * Fixing phar detection when forcing a cacert to system if null or true
917
+ * Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()`
918
+ * Cleaning up `Guzzle\Common\Collection::inject` method
919
+ * Adding a response_body location to service descriptions
920
+
921
+ ## 3.0.6 - 2012-12-09
922
+
923
+ * CurlMulti performance improvements
924
+ * Adding setErrorResponses() to Operation
925
+ * composer.json tweaks
926
+
927
+ ## 3.0.5 - 2012-11-18
928
+
929
+ * Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin
930
+ * Bug: Response body can now be a string containing "0"
931
+ * Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert
932
+ * Bug: QueryString::fromString now properly parses query string parameters that contain equal signs
933
+ * Added support for XML attributes in service description responses
934
+ * DefaultRequestSerializer now supports array URI parameter values for URI template expansion
935
+ * Added better mimetype guessing to requests and post files
936
+
937
+ ## 3.0.4 - 2012-11-11
938
+
939
+ * Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value
940
+ * Bug: Cookies can now be added that have a name, domain, or value set to "0"
941
+ * Bug: Using the system cacert bundle when using the Phar
942
+ * Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures
943
+ * Enhanced cookie jar de-duplication
944
+ * Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added
945
+ * Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies
946
+ * Added the ability to create any sort of hash for a stream rather than just an MD5 hash
947
+
948
+ ## 3.0.3 - 2012-11-04
949
+
950
+ * Implementing redirects in PHP rather than cURL
951
+ * Added PECL URI template extension and using as default parser if available
952
+ * Bug: Fixed Content-Length parsing of Response factory
953
+ * Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams.
954
+ * Adding ToArrayInterface throughout library
955
+ * Fixing OauthPlugin to create unique nonce values per request
956
+
957
+ ## 3.0.2 - 2012-10-25
958
+
959
+ * Magic methods are enabled by default on clients
960
+ * Magic methods return the result of a command
961
+ * Service clients no longer require a base_url option in the factory
962
+ * Bug: Fixed an issue with URI templates where null template variables were being expanded
963
+
964
+ ## 3.0.1 - 2012-10-22
965
+
966
+ * Models can now be used like regular collection objects by calling filter, map, etc.
967
+ * Models no longer require a Parameter structure or initial data in the constructor
968
+ * Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator`
969
+
970
+ ## 3.0.0 - 2012-10-15
971
+
972
+ * Rewrote service description format to be based on Swagger
973
+ * Now based on JSON schema
974
+ * Added nested input structures and nested response models
975
+ * Support for JSON and XML input and output models
976
+ * Renamed `commands` to `operations`
977
+ * Removed dot class notation
978
+ * Removed custom types
979
+ * Broke the project into smaller top-level namespaces to be more component friendly
980
+ * Removed support for XML configs and descriptions. Use arrays or JSON files.
981
+ * Removed the Validation component and Inspector
982
+ * Moved all cookie code to Guzzle\Plugin\Cookie
983
+ * Magic methods on a Guzzle\Service\Client now return the command un-executed.
984
+ * Calling getResult() or getResponse() on a command will lazily execute the command if needed.
985
+ * Now shipping with cURL's CA certs and using it by default
986
+ * Added previousResponse() method to response objects
987
+ * No longer sending Accept and Accept-Encoding headers on every request
988
+ * Only sending an Expect header by default when a payload is greater than 1MB
989
+ * Added/moved client options:
990
+ * curl.blacklist to curl.option.blacklist
991
+ * Added ssl.certificate_authority
992
+ * Added a Guzzle\Iterator component
993
+ * Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin
994
+ * Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin)
995
+ * Added a more robust caching plugin
996
+ * Added setBody to response objects
997
+ * Updating LogPlugin to use a more flexible MessageFormatter
998
+ * Added a completely revamped build process
999
+ * Cleaning up Collection class and removing default values from the get method
1000
+ * Fixed ZF2 cache adapters
1001
+
1002
+ ## 2.8.8 - 2012-10-15
1003
+
1004
+ * Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did
1005
+
1006
+ ## 2.8.7 - 2012-09-30
1007
+
1008
+ * Bug: Fixed config file aliases for JSON includes
1009
+ * Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests
1010
+ * Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload
1011
+ * Bug: Hardening request and response parsing to account for missing parts
1012
+ * Bug: Fixed PEAR packaging
1013
+ * Bug: Fixed Request::getInfo
1014
+ * Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail
1015
+ * Adding the ability for the namespace Iterator factory to look in multiple directories
1016
+ * Added more getters/setters/removers from service descriptions
1017
+ * Added the ability to remove POST fields from OAuth signatures
1018
+ * OAuth plugin now supports 2-legged OAuth
1019
+
1020
+ ## 2.8.6 - 2012-09-05
1021
+
1022
+ * Added the ability to modify and build service descriptions
1023
+ * Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command
1024
+ * Added a `json` parameter location
1025
+ * Now allowing dot notation for classes in the CacheAdapterFactory
1026
+ * Using the union of two arrays rather than an array_merge when extending service builder services and service params
1027
+ * Ensuring that a service is a string before doing strpos() checks on it when substituting services for references
1028
+ in service builder config files.
1029
+ * Services defined in two different config files that include one another will by default replace the previously
1030
+ defined service, but you can now create services that extend themselves and merge their settings over the previous
1031
+ * The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like
1032
+ '_default' with a default JSON configuration file.
1033
+
1034
+ ## 2.8.5 - 2012-08-29
1035
+
1036
+ * Bug: Suppressed empty arrays from URI templates
1037
+ * Bug: Added the missing $options argument from ServiceDescription::factory to enable caching
1038
+ * Added support for HTTP responses that do not contain a reason phrase in the start-line
1039
+ * AbstractCommand commands are now invokable
1040
+ * Added a way to get the data used when signing an Oauth request before a request is sent
1041
+
1042
+ ## 2.8.4 - 2012-08-15
1043
+
1044
+ * Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin
1045
+ * Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable.
1046
+ * Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream
1047
+ * Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream
1048
+ * Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5())
1049
+ * Added additional response status codes
1050
+ * Removed SSL information from the default User-Agent header
1051
+ * DELETE requests can now send an entity body
1052
+ * Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries
1053
+ * Added the ability of the MockPlugin to consume mocked request bodies
1054
+ * LogPlugin now exposes request and response objects in the extras array
1055
+
1056
+ ## 2.8.3 - 2012-07-30
1057
+
1058
+ * Bug: Fixed a case where empty POST requests were sent as GET requests
1059
+ * Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body
1060
+ * Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new
1061
+ * Added multiple inheritance to service description commands
1062
+ * Added an ApiCommandInterface and added `getParamNames()` and `hasParam()`
1063
+ * Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything
1064
+ * Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles
1065
+
1066
+ ## 2.8.2 - 2012-07-24
1067
+
1068
+ * Bug: Query string values set to 0 are no longer dropped from the query string
1069
+ * Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()`
1070
+ * Bug: `+` is now treated as an encoded space when parsing query strings
1071
+ * QueryString and Collection performance improvements
1072
+ * Allowing dot notation for class paths in filters attribute of a service descriptions
1073
+
1074
+ ## 2.8.1 - 2012-07-16
1075
+
1076
+ * Loosening Event Dispatcher dependency
1077
+ * POST redirects can now be customized using CURLOPT_POSTREDIR
1078
+
1079
+ ## 2.8.0 - 2012-07-15
1080
+
1081
+ * BC: Guzzle\Http\Query
1082
+ * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl)
1083
+ * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding()
1084
+ * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool)
1085
+ * Changed the aggregation functions of QueryString to be static methods
1086
+ * Can now use fromString() with querystrings that have a leading ?
1087
+ * cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters
1088
+ * Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body
1089
+ * Cookies are no longer URL decoded by default
1090
+ * Bug: URI template variables set to null are no longer expanded
1091
+
1092
+ ## 2.7.2 - 2012-07-02
1093
+
1094
+ * BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser.
1095
+ * BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty()
1096
+ * CachePlugin now allows for a custom request parameter function to check if a request can be cached
1097
+ * Bug fix: CachePlugin now only caches GET and HEAD requests by default
1098
+ * Bug fix: Using header glue when transferring headers over the wire
1099
+ * Allowing deeply nested arrays for composite variables in URI templates
1100
+ * Batch divisors can now return iterators or arrays
1101
+
1102
+ ## 2.7.1 - 2012-06-26
1103
+
1104
+ * Minor patch to update version number in UA string
1105
+ * Updating build process
1106
+
1107
+ ## 2.7.0 - 2012-06-25
1108
+
1109
+ * BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes.
1110
+ * BC: Removed magic setX methods from commands
1111
+ * BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method
1112
+ * Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable.
1113
+ * Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity)
1114
+ * Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace
1115
+ * Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin
1116
+ * Added the ability to set POST fields and files in a service description
1117
+ * Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method
1118
+ * Adding a command.before_prepare event to clients
1119
+ * Added BatchClosureTransfer and BatchClosureDivisor
1120
+ * BatchTransferException now includes references to the batch divisor and transfer strategies
1121
+ * Fixed some tests so that they pass more reliably
1122
+ * Added Guzzle\Common\Log\ArrayLogAdapter
1123
+
1124
+ ## 2.6.6 - 2012-06-10
1125
+
1126
+ * BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin
1127
+ * BC: Removing Guzzle\Service\Command\CommandSet
1128
+ * Adding generic batching system (replaces the batch queue plugin and command set)
1129
+ * Updating ZF cache and log adapters and now using ZF's composer repository
1130
+ * Bug: Setting the name of each ApiParam when creating through an ApiCommand
1131
+ * Adding result_type, result_doc, deprecated, and doc_url to service descriptions
1132
+ * Bug: Changed the default cookie header casing back to 'Cookie'
1133
+
1134
+ ## 2.6.5 - 2012-06-03
1135
+
1136
+ * BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource()
1137
+ * BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from
1138
+ * BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data
1139
+ * BC: Renaming methods in the CookieJarInterface
1140
+ * Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations
1141
+ * Making the default glue for HTTP headers ';' instead of ','
1142
+ * Adding a removeValue to Guzzle\Http\Message\Header
1143
+ * Adding getCookies() to request interface.
1144
+ * Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber()
1145
+
1146
+ ## 2.6.4 - 2012-05-30
1147
+
1148
+ * BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class.
1149
+ * BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand
1150
+ * Bug: Fixing magic method command calls on clients
1151
+ * Bug: Email constraint only validates strings
1152
+ * Bug: Aggregate POST fields when POST files are present in curl handle
1153
+ * Bug: Fixing default User-Agent header
1154
+ * Bug: Only appending or prepending parameters in commands if they are specified
1155
+ * Bug: Not requiring response reason phrases or status codes to match a predefined list of codes
1156
+ * Allowing the use of dot notation for class namespaces when using instance_of constraint
1157
+ * Added any_match validation constraint
1158
+ * Added an AsyncPlugin
1159
+ * Passing request object to the calculateWait method of the ExponentialBackoffPlugin
1160
+ * Allowing the result of a command object to be changed
1161
+ * Parsing location and type sub values when instantiating a service description rather than over and over at runtime
1162
+
1163
+ ## 2.6.3 - 2012-05-23
1164
+
1165
+ * [BC] Guzzle\Common\FromConfigInterface no longer requires any config options.
1166
+ * [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields.
1167
+ * You can now use an array of data when creating PUT request bodies in the request factory.
1168
+ * Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable.
1169
+ * [Http] Adding support for Content-Type in multipart POST uploads per upload
1170
+ * [Http] Added support for uploading multiple files using the same name (foo[0], foo[1])
1171
+ * Adding more POST data operations for easier manipulation of POST data.
1172
+ * You can now set empty POST fields.
1173
+ * The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files.
1174
+ * Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate.
1175
+ * CS updates
1176
+
1177
+ ## 2.6.2 - 2012-05-19
1178
+
1179
+ * [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method.
1180
+
1181
+ ## 2.6.1 - 2012-05-19
1182
+
1183
+ * [BC] Removing 'path' support in service descriptions. Use 'uri'.
1184
+ * [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache.
1185
+ * [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it.
1186
+ * [BC] Removing Guzzle\Common\XmlElement.
1187
+ * All commands, both dynamic and concrete, have ApiCommand objects.
1188
+ * Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits.
1189
+ * Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored.
1190
+ * Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible.
1191
+
1192
+ ## 2.6.0 - 2012-05-15
1193
+
1194
+ * [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder
1195
+ * [BC] Executing a Command returns the result of the command rather than the command
1196
+ * [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed.
1197
+ * [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args.
1198
+ * [BC] Moving ResourceIterator* to Guzzle\Service\Resource
1199
+ * [BC] Completely refactored ResourceIterators to iterate over a cloned command object
1200
+ * [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate
1201
+ * [BC] Guzzle\Guzzle is now deprecated
1202
+ * Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject
1203
+ * Adding Guzzle\Version class to give version information about Guzzle
1204
+ * Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate()
1205
+ * Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data
1206
+ * ServiceDescription and ServiceBuilder are now cacheable using similar configs
1207
+ * Changing the format of XML and JSON service builder configs. Backwards compatible.
1208
+ * Cleaned up Cookie parsing
1209
+ * Trimming the default Guzzle User-Agent header
1210
+ * Adding a setOnComplete() method to Commands that is called when a command completes
1211
+ * Keeping track of requests that were mocked in the MockPlugin
1212
+ * Fixed a caching bug in the CacheAdapterFactory
1213
+ * Inspector objects can be injected into a Command object
1214
+ * Refactoring a lot of code and tests to be case insensitive when dealing with headers
1215
+ * Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL
1216
+ * Adding the ability to set global option overrides to service builder configs
1217
+ * Adding the ability to include other service builder config files from within XML and JSON files
1218
+ * Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method.
1219
+
1220
+ ## 2.5.0 - 2012-05-08
1221
+
1222
+ * Major performance improvements
1223
+ * [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated.
1224
+ * [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component.
1225
+ * [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}"
1226
+ * Added the ability to passed parameters to all requests created by a client
1227
+ * Added callback functionality to the ExponentialBackoffPlugin
1228
+ * Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies.
1229
+ * Rewinding request stream bodies when retrying requests
1230
+ * Exception is thrown when JSON response body cannot be decoded
1231
+ * Added configurable magic method calls to clients and commands. This is off by default.
1232
+ * Fixed a defect that added a hash to every parsed URL part
1233
+ * Fixed duplicate none generation for OauthPlugin.
1234
+ * Emitting an event each time a client is generated by a ServiceBuilder
1235
+ * Using an ApiParams object instead of a Collection for parameters of an ApiCommand
1236
+ * cache.* request parameters should be renamed to params.cache.*
1237
+ * Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle.
1238
+ * Added the ability to disable type validation of service descriptions
1239
+ * ServiceDescriptions and ServiceBuilders are now Serializable
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2011-2016 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/README.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Guzzle, PHP HTTP client
2
+ =======================
3
+
4
+ [![Build Status](https://travis-ci.org/guzzle/guzzle.svg?branch=master)](https://travis-ci.org/guzzle/guzzle)
5
+
6
+ Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
7
+ trivial to integrate with web services.
8
+
9
+ - Simple interface for building query strings, POST requests, streaming large
10
+ uploads, streaming large downloads, using HTTP cookies, uploading JSON data,
11
+ etc...
12
+ - Can send both synchronous and asynchronous requests using the same interface.
13
+ - Uses PSR-7 interfaces for requests, responses, and streams. This allows you
14
+ to utilize other PSR-7 compatible libraries with Guzzle.
15
+ - Abstracts away the underlying HTTP transport, allowing you to write
16
+ environment and transport agnostic code; i.e., no hard dependency on cURL,
17
+ PHP streams, sockets, or non-blocking event loops.
18
+ - Middleware system allows you to augment and compose client behavior.
19
+
20
+ ```php
21
+ $client = new \GuzzleHttp\Client();
22
+ $res = $client->request('GET', 'https://api.github.com/user', [
23
+ 'auth' => ['user', 'pass']
24
+ ]);
25
+ echo $res->getStatusCode();
26
+ // 200
27
+ echo $res->getHeaderLine('content-type');
28
+ // 'application/json; charset=utf8'
29
+ echo $res->getBody();
30
+ // {"type":"User"...'
31
+
32
+ // Send an asynchronous request.
33
+ $request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
34
+ $promise = $client->sendAsync($request)->then(function ($response) {
35
+ echo 'I completed! ' . $response->getBody();
36
+ });
37
+ $promise->wait();
38
+ ```
39
+
40
+ ## Help and docs
41
+
42
+ - [Documentation](http://guzzlephp.org/)
43
+ - [stackoverflow](http://stackoverflow.com/questions/tagged/guzzle)
44
+ - [Gitter](https://gitter.im/guzzle/guzzle)
45
+
46
+
47
+ ## Installing Guzzle
48
+
49
+ The recommended way to install Guzzle is through
50
+ [Composer](http://getcomposer.org).
51
+
52
+ ```bash
53
+ # Install Composer
54
+ curl -sS https://getcomposer.org/installer | php
55
+ ```
56
+
57
+ Next, run the Composer command to install the latest stable version of Guzzle:
58
+
59
+ ```bash
60
+ php composer.phar require guzzlehttp/guzzle
61
+ ```
62
+
63
+ After installing, you need to require Composer's autoloader:
64
+
65
+ ```php
66
+ require 'vendor/autoload.php';
67
+ ```
68
+
69
+ You can then later update Guzzle using composer:
70
+
71
+ ```bash
72
+ composer.phar update
73
+ ```
74
+
75
+
76
+ ## Version Guidance
77
+
78
+ | Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 |
79
+ |---------|-------------|---------------------|--------------|---------------------|---------------------|-------|
80
+ | 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No |
81
+ | 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | N/A | N/A | No |
82
+ | 5.x | Maintained | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No |
83
+ | 6.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes |
84
+
85
+ [guzzle-3-repo]: https://github.com/guzzle/guzzle3
86
+ [guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3
87
+ [guzzle-6-repo]: https://github.com/guzzle/guzzle
88
+ [guzzle-3-docs]: http://guzzle3.readthedocs.org/en/latest/
89
+ [guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/
90
+ [guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/UPGRADING.md ADDED
@@ -0,0 +1,1203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Guzzle Upgrade Guide
2
+ ====================
3
+
4
+ 5.0 to 6.0
5
+ ----------
6
+
7
+ Guzzle now uses [PSR-7](http://www.php-fig.org/psr/psr-7/) for HTTP messages.
8
+ Due to the fact that these messages are immutable, this prompted a refactoring
9
+ of Guzzle to use a middleware based system rather than an event system. Any
10
+ HTTP message interaction (e.g., `GuzzleHttp\Message\Request`) need to be
11
+ updated to work with the new immutable PSR-7 request and response objects. Any
12
+ event listeners or subscribers need to be updated to become middleware
13
+ functions that wrap handlers (or are injected into a
14
+ `GuzzleHttp\HandlerStack`).
15
+
16
+ - Removed `GuzzleHttp\BatchResults`
17
+ - Removed `GuzzleHttp\Collection`
18
+ - Removed `GuzzleHttp\HasDataTrait`
19
+ - Removed `GuzzleHttp\ToArrayInterface`
20
+ - The `guzzlehttp/streams` dependency has been removed. Stream functionality
21
+ is now present in the `GuzzleHttp\Psr7` namespace provided by the
22
+ `guzzlehttp/psr7` package.
23
+ - Guzzle no longer uses ReactPHP promises and now uses the
24
+ `guzzlehttp/promises` library. We use a custom promise library for three
25
+ significant reasons:
26
+ 1. React promises (at the time of writing this) are recursive. Promise
27
+ chaining and promise resolution will eventually blow the stack. Guzzle
28
+ promises are not recursive as they use a sort of trampolining technique.
29
+ Note: there has been movement in the React project to modify promises to
30
+ no longer utilize recursion.
31
+ 2. Guzzle needs to have the ability to synchronously block on a promise to
32
+ wait for a result. Guzzle promises allows this functionality (and does
33
+ not require the use of recursion).
34
+ 3. Because we need to be able to wait on a result, doing so using React
35
+ promises requires wrapping react promises with RingPHP futures. This
36
+ overhead is no longer needed, reducing stack sizes, reducing complexity,
37
+ and improving performance.
38
+ - `GuzzleHttp\Mimetypes` has been moved to a function in
39
+ `GuzzleHttp\Psr7\mimetype_from_extension` and
40
+ `GuzzleHttp\Psr7\mimetype_from_filename`.
41
+ - `GuzzleHttp\Query` and `GuzzleHttp\QueryParser` have been removed. Query
42
+ strings must now be passed into request objects as strings, or provided to
43
+ the `query` request option when creating requests with clients. The `query`
44
+ option uses PHP's `http_build_query` to convert an array to a string. If you
45
+ need a different serialization technique, you will need to pass the query
46
+ string in as a string. There are a couple helper functions that will make
47
+ working with query strings easier: `GuzzleHttp\Psr7\parse_query` and
48
+ `GuzzleHttp\Psr7\build_query`.
49
+ - Guzzle no longer has a dependency on RingPHP. Due to the use of a middleware
50
+ system based on PSR-7, using RingPHP and it's middleware system as well adds
51
+ more complexity than the benefits it provides. All HTTP handlers that were
52
+ present in RingPHP have been modified to work directly with PSR-7 messages
53
+ and placed in the `GuzzleHttp\Handler` namespace. This significantly reduces
54
+ complexity in Guzzle, removes a dependency, and improves performance. RingPHP
55
+ will be maintained for Guzzle 5 support, but will no longer be a part of
56
+ Guzzle 6.
57
+ - As Guzzle now uses a middleware based systems the event system and RingPHP
58
+ integration has been removed. Note: while the event system has been removed,
59
+ it is possible to add your own type of event system that is powered by the
60
+ middleware system.
61
+ - Removed the `Event` namespace.
62
+ - Removed the `Subscriber` namespace.
63
+ - Removed `Transaction` class
64
+ - Removed `RequestFsm`
65
+ - Removed `RingBridge`
66
+ - `GuzzleHttp\Subscriber\Cookie` is now provided by
67
+ `GuzzleHttp\Middleware::cookies`
68
+ - `GuzzleHttp\Subscriber\HttpError` is now provided by
69
+ `GuzzleHttp\Middleware::httpError`
70
+ - `GuzzleHttp\Subscriber\History` is now provided by
71
+ `GuzzleHttp\Middleware::history`
72
+ - `GuzzleHttp\Subscriber\Mock` is now provided by
73
+ `GuzzleHttp\Handler\MockHandler`
74
+ - `GuzzleHttp\Subscriber\Prepare` is now provided by
75
+ `GuzzleHttp\PrepareBodyMiddleware`
76
+ - `GuzzleHttp\Subscriber\Redirect` is now provided by
77
+ `GuzzleHttp\RedirectMiddleware`
78
+ - Guzzle now uses `Psr\Http\Message\UriInterface` (implements in
79
+ `GuzzleHttp\Psr7\Uri`) for URI support. `GuzzleHttp\Url` is now gone.
80
+ - Static functions in `GuzzleHttp\Utils` have been moved to namespaced
81
+ functions under the `GuzzleHttp` namespace. This requires either a Composer
82
+ based autoloader or you to include functions.php.
83
+ - `GuzzleHttp\ClientInterface::getDefaultOption` has been renamed to
84
+ `GuzzleHttp\ClientInterface::getConfig`.
85
+ - `GuzzleHttp\ClientInterface::setDefaultOption` has been removed.
86
+ - The `json` and `xml` methods of response objects has been removed. With the
87
+ migration to strictly adhering to PSR-7 as the interface for Guzzle messages,
88
+ adding methods to message interfaces would actually require Guzzle messages
89
+ to extend from PSR-7 messages rather then work with them directly.
90
+
91
+ ## Migrating to middleware
92
+
93
+ The change to PSR-7 unfortunately required significant refactoring to Guzzle
94
+ due to the fact that PSR-7 messages are immutable. Guzzle 5 relied on an event
95
+ system from plugins. The event system relied on mutability of HTTP messages and
96
+ side effects in order to work. With immutable messages, you have to change your
97
+ workflow to become more about either returning a value (e.g., functional
98
+ middlewares) or setting a value on an object. Guzzle v6 has chosen the
99
+ functional middleware approach.
100
+
101
+ Instead of using the event system to listen for things like the `before` event,
102
+ you now create a stack based middleware function that intercepts a request on
103
+ the way in and the promise of the response on the way out. This is a much
104
+ simpler and more predictable approach than the event system and works nicely
105
+ with PSR-7 middleware. Due to the use of promises, the middleware system is
106
+ also asynchronous.
107
+
108
+ v5:
109
+
110
+ ```php
111
+ use GuzzleHttp\Event\BeforeEvent;
112
+ $client = new GuzzleHttp\Client();
113
+ // Get the emitter and listen to the before event.
114
+ $client->getEmitter()->on('before', function (BeforeEvent $e) {
115
+ // Guzzle v5 events relied on mutation
116
+ $e->getRequest()->setHeader('X-Foo', 'Bar');
117
+ });
118
+ ```
119
+
120
+ v6:
121
+
122
+ In v6, you can modify the request before it is sent using the `mapRequest`
123
+ middleware. The idiomatic way in v6 to modify the request/response lifecycle is
124
+ to setup a handler middleware stack up front and inject the handler into a
125
+ client.
126
+
127
+ ```php
128
+ use GuzzleHttp\Middleware;
129
+ // Create a handler stack that has all of the default middlewares attached
130
+ $handler = GuzzleHttp\HandlerStack::create();
131
+ // Push the handler onto the handler stack
132
+ $handler->push(Middleware::mapRequest(function (RequestInterface $request) {
133
+ // Notice that we have to return a request object
134
+ return $request->withHeader('X-Foo', 'Bar');
135
+ }));
136
+ // Inject the handler into the client
137
+ $client = new GuzzleHttp\Client(['handler' => $handler]);
138
+ ```
139
+
140
+ ## POST Requests
141
+
142
+ This version added the [`form_params`](http://guzzle.readthedocs.org/en/latest/request-options.html#form_params)
143
+ and `multipart` request options. `form_params` is an associative array of
144
+ strings or array of strings and is used to serialize an
145
+ `application/x-www-form-urlencoded` POST request. The
146
+ [`multipart`](http://guzzle.readthedocs.org/en/latest/request-options.html#multipart)
147
+ option is now used to send a multipart/form-data POST request.
148
+
149
+ `GuzzleHttp\Post\PostFile` has been removed. Use the `multipart` option to add
150
+ POST files to a multipart/form-data request.
151
+
152
+ The `body` option no longer accepts an array to send POST requests. Please use
153
+ `multipart` or `form_params` instead.
154
+
155
+ The `base_url` option has been renamed to `base_uri`.
156
+
157
+ 4.x to 5.0
158
+ ----------
159
+
160
+ ## Rewritten Adapter Layer
161
+
162
+ Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send
163
+ HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor
164
+ is still supported, but it has now been renamed to `handler`. Instead of
165
+ passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP
166
+ `callable` that follows the RingPHP specification.
167
+
168
+ ## Removed Fluent Interfaces
169
+
170
+ [Fluent interfaces were removed](http://ocramius.github.io/blog/fluent-interfaces-are-evil)
171
+ from the following classes:
172
+
173
+ - `GuzzleHttp\Collection`
174
+ - `GuzzleHttp\Url`
175
+ - `GuzzleHttp\Query`
176
+ - `GuzzleHttp\Post\PostBody`
177
+ - `GuzzleHttp\Cookie\SetCookie`
178
+
179
+ ## Removed functions.php
180
+
181
+ Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following
182
+ functions can be used as replacements.
183
+
184
+ - `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode`
185
+ - `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath`
186
+ - `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path`
187
+ - `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however,
188
+ deprecated in favor of using `GuzzleHttp\Pool::batch()`.
189
+
190
+ The "procedural" global client has been removed with no replacement (e.g.,
191
+ `GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client`
192
+ object as a replacement.
193
+
194
+ ## `throwImmediately` has been removed
195
+
196
+ The concept of "throwImmediately" has been removed from exceptions and error
197
+ events. This control mechanism was used to stop a transfer of concurrent
198
+ requests from completing. This can now be handled by throwing the exception or
199
+ by cancelling a pool of requests or each outstanding future request
200
+ individually.
201
+
202
+ ## headers event has been removed
203
+
204
+ Removed the "headers" event. This event was only useful for changing the
205
+ body a response once the headers of the response were known. You can implement
206
+ a similar behavior in a number of ways. One example might be to use a
207
+ FnStream that has access to the transaction being sent. For example, when the
208
+ first byte is written, you could check if the response headers match your
209
+ expectations, and if so, change the actual stream body that is being
210
+ written to.
211
+
212
+ ## Updates to HTTP Messages
213
+
214
+ Removed the `asArray` parameter from
215
+ `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
216
+ value as an array, then use the newly added `getHeaderAsArray()` method of
217
+ `MessageInterface`. This change makes the Guzzle interfaces compatible with
218
+ the PSR-7 interfaces.
219
+
220
+ 3.x to 4.0
221
+ ----------
222
+
223
+ ## Overarching changes:
224
+
225
+ - Now requires PHP 5.4 or greater.
226
+ - No longer requires cURL to send requests.
227
+ - Guzzle no longer wraps every exception it throws. Only exceptions that are
228
+ recoverable are now wrapped by Guzzle.
229
+ - Various namespaces have been removed or renamed.
230
+ - No longer requiring the Symfony EventDispatcher. A custom event dispatcher
231
+ based on the Symfony EventDispatcher is
232
+ now utilized in `GuzzleHttp\Event\EmitterInterface` (resulting in significant
233
+ speed and functionality improvements).
234
+
235
+ Changes per Guzzle 3.x namespace are described below.
236
+
237
+ ## Batch
238
+
239
+ The `Guzzle\Batch` namespace has been removed. This is best left to
240
+ third-parties to implement on top of Guzzle's core HTTP library.
241
+
242
+ ## Cache
243
+
244
+ The `Guzzle\Cache` namespace has been removed. (Todo: No suitable replacement
245
+ has been implemented yet, but hoping to utilize a PSR cache interface).
246
+
247
+ ## Common
248
+
249
+ - Removed all of the wrapped exceptions. It's better to use the standard PHP
250
+ library for unrecoverable exceptions.
251
+ - `FromConfigInterface` has been removed.
252
+ - `Guzzle\Common\Version` has been removed. The VERSION constant can be found
253
+ at `GuzzleHttp\ClientInterface::VERSION`.
254
+
255
+ ### Collection
256
+
257
+ - `getAll` has been removed. Use `toArray` to convert a collection to an array.
258
+ - `inject` has been removed.
259
+ - `keySearch` has been removed.
260
+ - `getPath` no longer supports wildcard expressions. Use something better like
261
+ JMESPath for this.
262
+ - `setPath` now supports appending to an existing array via the `[]` notation.
263
+
264
+ ### Events
265
+
266
+ Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses
267
+ `GuzzleHttp\Event\Emitter`.
268
+
269
+ - `Symfony\Component\EventDispatcher\EventDispatcherInterface` is replaced by
270
+ `GuzzleHttp\Event\EmitterInterface`.
271
+ - `Symfony\Component\EventDispatcher\EventDispatcher` is replaced by
272
+ `GuzzleHttp\Event\Emitter`.
273
+ - `Symfony\Component\EventDispatcher\Event` is replaced by
274
+ `GuzzleHttp\Event\Event`, and Guzzle now has an EventInterface in
275
+ `GuzzleHttp\Event\EventInterface`.
276
+ - `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and
277
+ `HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the
278
+ event emitter of a request, client, etc. now uses the `getEmitter` method
279
+ rather than the `getDispatcher` method.
280
+
281
+ #### Emitter
282
+
283
+ - Use the `once()` method to add a listener that automatically removes itself
284
+ the first time it is invoked.
285
+ - Use the `listeners()` method to retrieve a list of event listeners rather than
286
+ the `getListeners()` method.
287
+ - Use `emit()` instead of `dispatch()` to emit an event from an emitter.
288
+ - Use `attach()` instead of `addSubscriber()` and `detach()` instead of
289
+ `removeSubscriber()`.
290
+
291
+ ```php
292
+ $mock = new Mock();
293
+ // 3.x
294
+ $request->getEventDispatcher()->addSubscriber($mock);
295
+ $request->getEventDispatcher()->removeSubscriber($mock);
296
+ // 4.x
297
+ $request->getEmitter()->attach($mock);
298
+ $request->getEmitter()->detach($mock);
299
+ ```
300
+
301
+ Use the `on()` method to add a listener rather than the `addListener()` method.
302
+
303
+ ```php
304
+ // 3.x
305
+ $request->getEventDispatcher()->addListener('foo', function (Event $event) { /* ... */ } );
306
+ // 4.x
307
+ $request->getEmitter()->on('foo', function (Event $event, $name) { /* ... */ } );
308
+ ```
309
+
310
+ ## Http
311
+
312
+ ### General changes
313
+
314
+ - The cacert.pem certificate has been moved to `src/cacert.pem`.
315
+ - Added the concept of adapters that are used to transfer requests over the
316
+ wire.
317
+ - Simplified the event system.
318
+ - Sending requests in parallel is still possible, but batching is no longer a
319
+ concept of the HTTP layer. Instead, you must use the `complete` and `error`
320
+ events to asynchronously manage parallel request transfers.
321
+ - `Guzzle\Http\Url` has moved to `GuzzleHttp\Url`.
322
+ - `Guzzle\Http\QueryString` has moved to `GuzzleHttp\Query`.
323
+ - QueryAggregators have been rewritten so that they are simply callable
324
+ functions.
325
+ - `GuzzleHttp\StaticClient` has been removed. Use the functions provided in
326
+ `functions.php` for an easy to use static client instance.
327
+ - Exceptions in `GuzzleHttp\Exception` have been updated to all extend from
328
+ `GuzzleHttp\Exception\TransferException`.
329
+
330
+ ### Client
331
+
332
+ Calling methods like `get()`, `post()`, `head()`, etc. no longer create and
333
+ return a request, but rather creates a request, sends the request, and returns
334
+ the response.
335
+
336
+ ```php
337
+ // 3.0
338
+ $request = $client->get('/');
339
+ $response = $request->send();
340
+
341
+ // 4.0
342
+ $response = $client->get('/');
343
+
344
+ // or, to mirror the previous behavior
345
+ $request = $client->createRequest('GET', '/');
346
+ $response = $client->send($request);
347
+ ```
348
+
349
+ `GuzzleHttp\ClientInterface` has changed.
350
+
351
+ - The `send` method no longer accepts more than one request. Use `sendAll` to
352
+ send multiple requests in parallel.
353
+ - `setUserAgent()` has been removed. Use a default request option instead. You
354
+ could, for example, do something like:
355
+ `$client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent())`.
356
+ - `setSslVerification()` has been removed. Use default request options instead,
357
+ like `$client->setConfig('defaults/verify', true)`.
358
+
359
+ `GuzzleHttp\Client` has changed.
360
+
361
+ - The constructor now accepts only an associative array. You can include a
362
+ `base_url` string or array to use a URI template as the base URL of a client.
363
+ You can also specify a `defaults` key that is an associative array of default
364
+ request options. You can pass an `adapter` to use a custom adapter,
365
+ `batch_adapter` to use a custom adapter for sending requests in parallel, or
366
+ a `message_factory` to change the factory used to create HTTP requests and
367
+ responses.
368
+ - The client no longer emits a `client.create_request` event.
369
+ - Creating requests with a client no longer automatically utilize a URI
370
+ template. You must pass an array into a creational method (e.g.,
371
+ `createRequest`, `get`, `put`, etc.) in order to expand a URI template.
372
+
373
+ ### Messages
374
+
375
+ Messages no longer have references to their counterparts (i.e., a request no
376
+ longer has a reference to it's response, and a response no loger has a
377
+ reference to its request). This association is now managed through a
378
+ `GuzzleHttp\Adapter\TransactionInterface` object. You can get references to
379
+ these transaction objects using request events that are emitted over the
380
+ lifecycle of a request.
381
+
382
+ #### Requests with a body
383
+
384
+ - `GuzzleHttp\Message\EntityEnclosingRequest` and
385
+ `GuzzleHttp\Message\EntityEnclosingRequestInterface` have been removed. The
386
+ separation between requests that contain a body and requests that do not
387
+ contain a body has been removed, and now `GuzzleHttp\Message\RequestInterface`
388
+ handles both use cases.
389
+ - Any method that previously accepts a `GuzzleHttp\Response` object now accept a
390
+ `GuzzleHttp\Message\ResponseInterface`.
391
+ - `GuzzleHttp\Message\RequestFactoryInterface` has been renamed to
392
+ `GuzzleHttp\Message\MessageFactoryInterface`. This interface is used to create
393
+ both requests and responses and is implemented in
394
+ `GuzzleHttp\Message\MessageFactory`.
395
+ - POST field and file methods have been removed from the request object. You
396
+ must now use the methods made available to `GuzzleHttp\Post\PostBodyInterface`
397
+ to control the format of a POST body. Requests that are created using a
398
+ standard `GuzzleHttp\Message\MessageFactoryInterface` will automatically use
399
+ a `GuzzleHttp\Post\PostBody` body if the body was passed as an array or if
400
+ the method is POST and no body is provided.
401
+
402
+ ```php
403
+ $request = $client->createRequest('POST', '/');
404
+ $request->getBody()->setField('foo', 'bar');
405
+ $request->getBody()->addFile(new PostFile('file_key', fopen('/path/to/content', 'r')));
406
+ ```
407
+
408
+ #### Headers
409
+
410
+ - `GuzzleHttp\Message\Header` has been removed. Header values are now simply
411
+ represented by an array of values or as a string. Header values are returned
412
+ as a string by default when retrieving a header value from a message. You can
413
+ pass an optional argument of `true` to retrieve a header value as an array
414
+ of strings instead of a single concatenated string.
415
+ - `GuzzleHttp\PostFile` and `GuzzleHttp\PostFileInterface` have been moved to
416
+ `GuzzleHttp\Post`. This interface has been simplified and now allows the
417
+ addition of arbitrary headers.
418
+ - Custom headers like `GuzzleHttp\Message\Header\Link` have been removed. Most
419
+ of the custom headers are now handled separately in specific
420
+ subscribers/plugins, and `GuzzleHttp\Message\HeaderValues::parseParams()` has
421
+ been updated to properly handle headers that contain parameters (like the
422
+ `Link` header).
423
+
424
+ #### Responses
425
+
426
+ - `GuzzleHttp\Message\Response::getInfo()` and
427
+ `GuzzleHttp\Message\Response::setInfo()` have been removed. Use the event
428
+ system to retrieve this type of information.
429
+ - `GuzzleHttp\Message\Response::getRawHeaders()` has been removed.
430
+ - `GuzzleHttp\Message\Response::getMessage()` has been removed.
431
+ - `GuzzleHttp\Message\Response::calculateAge()` and other cache specific
432
+ methods have moved to the CacheSubscriber.
433
+ - Header specific helper functions like `getContentMd5()` have been removed.
434
+ Just use `getHeader('Content-MD5')` instead.
435
+ - `GuzzleHttp\Message\Response::setRequest()` and
436
+ `GuzzleHttp\Message\Response::getRequest()` have been removed. Use the event
437
+ system to work with request and response objects as a transaction.
438
+ - `GuzzleHttp\Message\Response::getRedirectCount()` has been removed. Use the
439
+ Redirect subscriber instead.
440
+ - `GuzzleHttp\Message\Response::isSuccessful()` and other related methods have
441
+ been removed. Use `getStatusCode()` instead.
442
+
443
+ #### Streaming responses
444
+
445
+ Streaming requests can now be created by a client directly, returning a
446
+ `GuzzleHttp\Message\ResponseInterface` object that contains a body stream
447
+ referencing an open PHP HTTP stream.
448
+
449
+ ```php
450
+ // 3.0
451
+ use Guzzle\Stream\PhpStreamRequestFactory;
452
+ $request = $client->get('/');
453
+ $factory = new PhpStreamRequestFactory();
454
+ $stream = $factory->fromRequest($request);
455
+ $data = $stream->read(1024);
456
+
457
+ // 4.0
458
+ $response = $client->get('/', ['stream' => true]);
459
+ // Read some data off of the stream in the response body
460
+ $data = $response->getBody()->read(1024);
461
+ ```
462
+
463
+ #### Redirects
464
+
465
+ The `configureRedirects()` method has been removed in favor of a
466
+ `allow_redirects` request option.
467
+
468
+ ```php
469
+ // Standard redirects with a default of a max of 5 redirects
470
+ $request = $client->createRequest('GET', '/', ['allow_redirects' => true]);
471
+
472
+ // Strict redirects with a custom number of redirects
473
+ $request = $client->createRequest('GET', '/', [
474
+ 'allow_redirects' => ['max' => 5, 'strict' => true]
475
+ ]);
476
+ ```
477
+
478
+ #### EntityBody
479
+
480
+ EntityBody interfaces and classes have been removed or moved to
481
+ `GuzzleHttp\Stream`. All classes and interfaces that once required
482
+ `GuzzleHttp\EntityBodyInterface` now require
483
+ `GuzzleHttp\Stream\StreamInterface`. Creating a new body for a request no
484
+ longer uses `GuzzleHttp\EntityBody::factory` but now uses
485
+ `GuzzleHttp\Stream\Stream::factory` or even better:
486
+ `GuzzleHttp\Stream\create()`.
487
+
488
+ - `Guzzle\Http\EntityBodyInterface` is now `GuzzleHttp\Stream\StreamInterface`
489
+ - `Guzzle\Http\EntityBody` is now `GuzzleHttp\Stream\Stream`
490
+ - `Guzzle\Http\CachingEntityBody` is now `GuzzleHttp\Stream\CachingStream`
491
+ - `Guzzle\Http\ReadLimitEntityBody` is now `GuzzleHttp\Stream\LimitStream`
492
+ - `Guzzle\Http\IoEmittyinEntityBody` has been removed.
493
+
494
+ #### Request lifecycle events
495
+
496
+ Requests previously submitted a large number of requests. The number of events
497
+ emitted over the lifecycle of a request has been significantly reduced to make
498
+ it easier to understand how to extend the behavior of a request. All events
499
+ emitted during the lifecycle of a request now emit a custom
500
+ `GuzzleHttp\Event\EventInterface` object that contains context providing
501
+ methods and a way in which to modify the transaction at that specific point in
502
+ time (e.g., intercept the request and set a response on the transaction).
503
+
504
+ - `request.before_send` has been renamed to `before` and now emits a
505
+ `GuzzleHttp\Event\BeforeEvent`
506
+ - `request.complete` has been renamed to `complete` and now emits a
507
+ `GuzzleHttp\Event\CompleteEvent`.
508
+ - `request.sent` has been removed. Use `complete`.
509
+ - `request.success` has been removed. Use `complete`.
510
+ - `error` is now an event that emits a `GuzzleHttp\Event\ErrorEvent`.
511
+ - `request.exception` has been removed. Use `error`.
512
+ - `request.receive.status_line` has been removed.
513
+ - `curl.callback.progress` has been removed. Use a custom `StreamInterface` to
514
+ maintain a status update.
515
+ - `curl.callback.write` has been removed. Use a custom `StreamInterface` to
516
+ intercept writes.
517
+ - `curl.callback.read` has been removed. Use a custom `StreamInterface` to
518
+ intercept reads.
519
+
520
+ `headers` is a new event that is emitted after the response headers of a
521
+ request have been received before the body of the response is downloaded. This
522
+ event emits a `GuzzleHttp\Event\HeadersEvent`.
523
+
524
+ You can intercept a request and inject a response using the `intercept()` event
525
+ of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and
526
+ `GuzzleHttp\Event\ErrorEvent` event.
527
+
528
+ See: http://docs.guzzlephp.org/en/latest/events.html
529
+
530
+ ## Inflection
531
+
532
+ The `Guzzle\Inflection` namespace has been removed. This is not a core concern
533
+ of Guzzle.
534
+
535
+ ## Iterator
536
+
537
+ The `Guzzle\Iterator` namespace has been removed.
538
+
539
+ - `Guzzle\Iterator\AppendIterator`, `Guzzle\Iterator\ChunkedIterator`, and
540
+ `Guzzle\Iterator\MethodProxyIterator` are nice, but not a core requirement of
541
+ Guzzle itself.
542
+ - `Guzzle\Iterator\FilterIterator` is no longer needed because an equivalent
543
+ class is shipped with PHP 5.4.
544
+ - `Guzzle\Iterator\MapIterator` is not really needed when using PHP 5.5 because
545
+ it's easier to just wrap an iterator in a generator that maps values.
546
+
547
+ For a replacement of these iterators, see https://github.com/nikic/iter
548
+
549
+ ## Log
550
+
551
+ The LogPlugin has moved to https://github.com/guzzle/log-subscriber. The
552
+ `Guzzle\Log` namespace has been removed. Guzzle now relies on
553
+ `Psr\Log\LoggerInterface` for all logging. The MessageFormatter class has been
554
+ moved to `GuzzleHttp\Subscriber\Log\Formatter`.
555
+
556
+ ## Parser
557
+
558
+ The `Guzzle\Parser` namespace has been removed. This was previously used to
559
+ make it possible to plug in custom parsers for cookies, messages, URI
560
+ templates, and URLs; however, this level of complexity is not needed in Guzzle
561
+ so it has been removed.
562
+
563
+ - Cookie: Cookie parsing logic has been moved to
564
+ `GuzzleHttp\Cookie\SetCookie::fromString`.
565
+ - Message: Message parsing logic for both requests and responses has been moved
566
+ to `GuzzleHttp\Message\MessageFactory::fromMessage`. Message parsing is only
567
+ used in debugging or deserializing messages, so it doesn't make sense for
568
+ Guzzle as a library to add this level of complexity to parsing messages.
569
+ - UriTemplate: URI template parsing has been moved to
570
+ `GuzzleHttp\UriTemplate`. The Guzzle library will automatically use the PECL
571
+ URI template library if it is installed.
572
+ - Url: URL parsing is now performed in `GuzzleHttp\Url::fromString` (previously
573
+ it was `Guzzle\Http\Url::factory()`). If custom URL parsing is necessary,
574
+ then developers are free to subclass `GuzzleHttp\Url`.
575
+
576
+ ## Plugin
577
+
578
+ The `Guzzle\Plugin` namespace has been renamed to `GuzzleHttp\Subscriber`.
579
+ Several plugins are shipping with the core Guzzle library under this namespace.
580
+
581
+ - `GuzzleHttp\Subscriber\Cookie`: Replaces the old CookiePlugin. Cookie jar
582
+ code has moved to `GuzzleHttp\Cookie`.
583
+ - `GuzzleHttp\Subscriber\History`: Replaces the old HistoryPlugin.
584
+ - `GuzzleHttp\Subscriber\HttpError`: Throws errors when a bad HTTP response is
585
+ received.
586
+ - `GuzzleHttp\Subscriber\Mock`: Replaces the old MockPlugin.
587
+ - `GuzzleHttp\Subscriber\Prepare`: Prepares the body of a request just before
588
+ sending. This subscriber is attached to all requests by default.
589
+ - `GuzzleHttp\Subscriber\Redirect`: Replaces the RedirectPlugin.
590
+
591
+ The following plugins have been removed (third-parties are free to re-implement
592
+ these if needed):
593
+
594
+ - `GuzzleHttp\Plugin\Async` has been removed.
595
+ - `GuzzleHttp\Plugin\CurlAuth` has been removed.
596
+ - `GuzzleHttp\Plugin\ErrorResponse\ErrorResponsePlugin` has been removed. This
597
+ functionality should instead be implemented with event listeners that occur
598
+ after normal response parsing occurs in the guzzle/command package.
599
+
600
+ The following plugins are not part of the core Guzzle package, but are provided
601
+ in separate repositories:
602
+
603
+ - `Guzzle\Http\Plugin\BackoffPlugin` has been rewritten to be much simpler
604
+ to build custom retry policies using simple functions rather than various
605
+ chained classes. See: https://github.com/guzzle/retry-subscriber
606
+ - `Guzzle\Http\Plugin\Cache\CachePlugin` has moved to
607
+ https://github.com/guzzle/cache-subscriber
608
+ - `Guzzle\Http\Plugin\Log\LogPlugin` has moved to
609
+ https://github.com/guzzle/log-subscriber
610
+ - `Guzzle\Http\Plugin\Md5\Md5Plugin` has moved to
611
+ https://github.com/guzzle/message-integrity-subscriber
612
+ - `Guzzle\Http\Plugin\Mock\MockPlugin` has moved to
613
+ `GuzzleHttp\Subscriber\MockSubscriber`.
614
+ - `Guzzle\Http\Plugin\Oauth\OauthPlugin` has moved to
615
+ https://github.com/guzzle/oauth-subscriber
616
+
617
+ ## Service
618
+
619
+ The service description layer of Guzzle has moved into two separate packages:
620
+
621
+ - http://github.com/guzzle/command Provides a high level abstraction over web
622
+ services by representing web service operations using commands.
623
+ - http://github.com/guzzle/guzzle-services Provides an implementation of
624
+ guzzle/command that provides request serialization and response parsing using
625
+ Guzzle service descriptions.
626
+
627
+ ## Stream
628
+
629
+ Stream have moved to a separate package available at
630
+ https://github.com/guzzle/streams.
631
+
632
+ `Guzzle\Stream\StreamInterface` has been given a large update to cleanly take
633
+ on the responsibilities of `Guzzle\Http\EntityBody` and
634
+ `Guzzle\Http\EntityBodyInterface` now that they have been removed. The number
635
+ of methods implemented by the `StreamInterface` has been drastically reduced to
636
+ allow developers to more easily extend and decorate stream behavior.
637
+
638
+ ## Removed methods from StreamInterface
639
+
640
+ - `getStream` and `setStream` have been removed to better encapsulate streams.
641
+ - `getMetadata` and `setMetadata` have been removed in favor of
642
+ `GuzzleHttp\Stream\MetadataStreamInterface`.
643
+ - `getWrapper`, `getWrapperData`, `getStreamType`, and `getUri` have all been
644
+ removed. This data is accessible when
645
+ using streams that implement `GuzzleHttp\Stream\MetadataStreamInterface`.
646
+ - `rewind` has been removed. Use `seek(0)` for a similar behavior.
647
+
648
+ ## Renamed methods
649
+
650
+ - `detachStream` has been renamed to `detach`.
651
+ - `feof` has been renamed to `eof`.
652
+ - `ftell` has been renamed to `tell`.
653
+ - `readLine` has moved from an instance method to a static class method of
654
+ `GuzzleHttp\Stream\Stream`.
655
+
656
+ ## Metadata streams
657
+
658
+ `GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams
659
+ that contain additional metadata accessible via `getMetadata()`.
660
+ `GuzzleHttp\Stream\StreamInterface::getMetadata` and
661
+ `GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed.
662
+
663
+ ## StreamRequestFactory
664
+
665
+ The entire concept of the StreamRequestFactory has been removed. The way this
666
+ was used in Guzzle 3 broke the actual interface of sending streaming requests
667
+ (instead of getting back a Response, you got a StreamInterface). Streaming
668
+ PHP requests are now implemented through the `GuzzleHttp\Adapter\StreamAdapter`.
669
+
670
+ 3.6 to 3.7
671
+ ----------
672
+
673
+ ### Deprecations
674
+
675
+ - You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.:
676
+
677
+ ```php
678
+ \Guzzle\Common\Version::$emitWarnings = true;
679
+ ```
680
+
681
+ The following APIs and options have been marked as deprecated:
682
+
683
+ - Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use `$request->getResponseBody()->isRepeatable()` instead.
684
+ - Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
685
+ - Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
686
+ - Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
687
+ - Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
688
+ - Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
689
+ - Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
690
+ - Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
691
+ - Marked `Guzzle\Common\Collection::inject()` as deprecated.
692
+ - Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use
693
+ `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` or
694
+ `$client->setDefaultOption('auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));`
695
+
696
+ 3.7 introduces `request.options` as a parameter for a client configuration and as an optional argument to all creational
697
+ request methods. When paired with a client's configuration settings, these options allow you to specify default settings
698
+ for various aspects of a request. Because these options make other previous configuration options redundant, several
699
+ configuration options and methods of a client and AbstractCommand have been deprecated.
700
+
701
+ - Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use `$client->getDefaultOption('headers')`.
702
+ - Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use `$client->setDefaultOption('headers/{header_name}', 'value')`.
703
+ - Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use `$client->setDefaultOption('params/{param_name}', 'value')`
704
+ - Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. These will work through Guzzle 4.0
705
+
706
+ $command = $client->getCommand('foo', array(
707
+ 'command.headers' => array('Test' => '123'),
708
+ 'command.response_body' => '/path/to/file'
709
+ ));
710
+
711
+ // Should be changed to:
712
+
713
+ $command = $client->getCommand('foo', array(
714
+ 'command.request_options' => array(
715
+ 'headers' => array('Test' => '123'),
716
+ 'save_as' => '/path/to/file'
717
+ )
718
+ ));
719
+
720
+ ### Interface changes
721
+
722
+ Additions and changes (you will need to update any implementations or subclasses you may have created):
723
+
724
+ - Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
725
+ createRequest, head, delete, put, patch, post, options, prepareRequest
726
+ - Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
727
+ - Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
728
+ - Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
729
+ `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
730
+ resource, string, or EntityBody into the $options parameter to specify the download location of the response.
731
+ - Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
732
+ default `array()`
733
+ - Added `Guzzle\Stream\StreamInterface::isRepeatable`
734
+ - Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
735
+
736
+ The following methods were removed from interfaces. All of these methods are still available in the concrete classes
737
+ that implement them, but you should update your code to use alternative methods:
738
+
739
+ - Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
740
+ `$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
741
+ `$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))` or
742
+ `$client->setDefaultOption('headers/{header_name}', 'value')`. or
743
+ `$client->setDefaultOption('headers', array('header_name' => 'value'))`.
744
+ - Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use `$client->getConfig()->getPath('request.options/headers')`.
745
+ - Removed `Guzzle\Http\ClientInterface::expandTemplate()`. This is an implementation detail.
746
+ - Removed `Guzzle\Http\ClientInterface::setRequestFactory()`. This is an implementation detail.
747
+ - Removed `Guzzle\Http\ClientInterface::getCurlMulti()`. This is a very specific implementation detail.
748
+ - Removed `Guzzle\Http\Message\RequestInterface::canCache`. Use the CachePlugin.
749
+ - Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`. Use the HistoryPlugin.
750
+ - Removed `Guzzle\Http\Message\RequestInterface::isRedirect`. Use the HistoryPlugin.
751
+
752
+ ### Cache plugin breaking changes
753
+
754
+ - CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
755
+ CacheStorageInterface. These two objects and interface will be removed in a future version.
756
+ - Always setting X-cache headers on cached responses
757
+ - Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
758
+ - `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
759
+ $request, Response $response);`
760
+ - `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
761
+ - `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
762
+ - Added `CacheStorageInterface::purge($url)`
763
+ - `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
764
+ $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
765
+ CanCacheStrategyInterface $canCache = null)`
766
+ - Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
767
+
768
+ 3.5 to 3.6
769
+ ----------
770
+
771
+ * Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
772
+ * Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
773
+ * Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
774
+ For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader().
775
+ Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request.
776
+ * Specific header implementations can be created for complex headers. When a message creates a header, it uses a
777
+ HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
778
+ CacheControl header implementation.
779
+ * Moved getLinks() from Response to just be used on a Link header object.
780
+
781
+ If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the
782
+ HeaderInterface (e.g. toArray(), getAll(), etc.).
783
+
784
+ ### Interface changes
785
+
786
+ * Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
787
+ * Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
788
+ * Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
789
+ Guzzle\Http\Curl\RequestMediator
790
+ * Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
791
+ * Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
792
+ * Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
793
+
794
+ ### Removed deprecated functions
795
+
796
+ * Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
797
+ * Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
798
+
799
+ ### Deprecations
800
+
801
+ * The ability to case-insensitively search for header values
802
+ * Guzzle\Http\Message\Header::hasExactHeader
803
+ * Guzzle\Http\Message\Header::raw. Use getAll()
804
+ * Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
805
+ instead.
806
+
807
+ ### Other changes
808
+
809
+ * All response header helper functions return a string rather than mixing Header objects and strings inconsistently
810
+ * Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
811
+ directly via interfaces
812
+ * Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
813
+ but are a no-op until removed.
814
+ * Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
815
+ `Guzzle\Service\Command\ArrayCommandInterface`.
816
+ * Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
817
+ on a request while the request is still being transferred
818
+ * `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
819
+
820
+ 3.3 to 3.4
821
+ ----------
822
+
823
+ Base URLs of a client now follow the rules of http://tools.ietf.org/html/rfc3986#section-5.2.2 when merging URLs.
824
+
825
+ 3.2 to 3.3
826
+ ----------
827
+
828
+ ### Response::getEtag() quote stripping removed
829
+
830
+ `Guzzle\Http\Message\Response::getEtag()` no longer strips quotes around the ETag response header
831
+
832
+ ### Removed `Guzzle\Http\Utils`
833
+
834
+ The `Guzzle\Http\Utils` class was removed. This class was only used for testing.
835
+
836
+ ### Stream wrapper and type
837
+
838
+ `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase.
839
+
840
+ ### curl.emit_io became emit_io
841
+
842
+ Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using the
843
+ 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
844
+
845
+ 3.1 to 3.2
846
+ ----------
847
+
848
+ ### CurlMulti is no longer reused globally
849
+
850
+ Before 3.2, the same CurlMulti object was reused globally for each client. This can cause issue where plugins added
851
+ to a single client can pollute requests dispatched from other clients.
852
+
853
+ If you still wish to reuse the same CurlMulti object with each client, then you can add a listener to the
854
+ ServiceBuilder's `service_builder.create_client` event to inject a custom CurlMulti object into each client as it is
855
+ created.
856
+
857
+ ```php
858
+ $multi = new Guzzle\Http\Curl\CurlMulti();
859
+ $builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json');
860
+ $builder->addListener('service_builder.create_client', function ($event) use ($multi) {
861
+ $event['client']->setCurlMulti($multi);
862
+ }
863
+ });
864
+ ```
865
+
866
+ ### No default path
867
+
868
+ URLs no longer have a default path value of '/' if no path was specified.
869
+
870
+ Before:
871
+
872
+ ```php
873
+ $request = $client->get('http://www.foo.com');
874
+ echo $request->getUrl();
875
+ // >> http://www.foo.com/
876
+ ```
877
+
878
+ After:
879
+
880
+ ```php
881
+ $request = $client->get('http://www.foo.com');
882
+ echo $request->getUrl();
883
+ // >> http://www.foo.com
884
+ ```
885
+
886
+ ### Less verbose BadResponseException
887
+
888
+ The exception message for `Guzzle\Http\Exception\BadResponseException` no longer contains the full HTTP request and
889
+ response information. You can, however, get access to the request and response object by calling `getRequest()` or
890
+ `getResponse()` on the exception object.
891
+
892
+ ### Query parameter aggregation
893
+
894
+ Multi-valued query parameters are no longer aggregated using a callback function. `Guzzle\Http\Query` now has a
895
+ setAggregator() method that accepts a `Guzzle\Http\QueryAggregator\QueryAggregatorInterface` object. This object is
896
+ responsible for handling the aggregation of multi-valued query string variables into a flattened hash.
897
+
898
+ 2.8 to 3.x
899
+ ----------
900
+
901
+ ### Guzzle\Service\Inspector
902
+
903
+ Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fromConfig`
904
+
905
+ **Before**
906
+
907
+ ```php
908
+ use Guzzle\Service\Inspector;
909
+
910
+ class YourClient extends \Guzzle\Service\Client
911
+ {
912
+ public static function factory($config = array())
913
+ {
914
+ $default = array();
915
+ $required = array('base_url', 'username', 'api_key');
916
+ $config = Inspector::fromConfig($config, $default, $required);
917
+
918
+ $client = new self(
919
+ $config->get('base_url'),
920
+ $config->get('username'),
921
+ $config->get('api_key')
922
+ );
923
+ $client->setConfig($config);
924
+
925
+ $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json'));
926
+
927
+ return $client;
928
+ }
929
+ ```
930
+
931
+ **After**
932
+
933
+ ```php
934
+ use Guzzle\Common\Collection;
935
+
936
+ class YourClient extends \Guzzle\Service\Client
937
+ {
938
+ public static function factory($config = array())
939
+ {
940
+ $default = array();
941
+ $required = array('base_url', 'username', 'api_key');
942
+ $config = Collection::fromConfig($config, $default, $required);
943
+
944
+ $client = new self(
945
+ $config->get('base_url'),
946
+ $config->get('username'),
947
+ $config->get('api_key')
948
+ );
949
+ $client->setConfig($config);
950
+
951
+ $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json'));
952
+
953
+ return $client;
954
+ }
955
+ ```
956
+
957
+ ### Convert XML Service Descriptions to JSON
958
+
959
+ **Before**
960
+
961
+ ```xml
962
+ <?xml version="1.0" encoding="UTF-8"?>
963
+ <client>
964
+ <commands>
965
+ <!-- Groups -->
966
+ <command name="list_groups" method="GET" uri="groups.json">
967
+ <doc>Get a list of groups</doc>
968
+ </command>
969
+ <command name="search_groups" method="GET" uri='search.json?query="{{query}} type:group"'>
970
+ <doc>Uses a search query to get a list of groups</doc>
971
+ <param name="query" type="string" required="true" />
972
+ </command>
973
+ <command name="create_group" method="POST" uri="groups.json">
974
+ <doc>Create a group</doc>
975
+ <param name="data" type="array" location="body" filters="json_encode" doc="Group JSON"/>
976
+ <param name="Content-Type" location="header" static="application/json"/>
977
+ </command>
978
+ <command name="delete_group" method="DELETE" uri="groups/{{id}}.json">
979
+ <doc>Delete a group by ID</doc>
980
+ <param name="id" type="integer" required="true"/>
981
+ </command>
982
+ <command name="get_group" method="GET" uri="groups/{{id}}.json">
983
+ <param name="id" type="integer" required="true"/>
984
+ </command>
985
+ <command name="update_group" method="PUT" uri="groups/{{id}}.json">
986
+ <doc>Update a group</doc>
987
+ <param name="id" type="integer" required="true"/>
988
+ <param name="data" type="array" location="body" filters="json_encode" doc="Group JSON"/>
989
+ <param name="Content-Type" location="header" static="application/json"/>
990
+ </command>
991
+ </commands>
992
+ </client>
993
+ ```
994
+
995
+ **After**
996
+
997
+ ```json
998
+ {
999
+ "name": "Zendesk REST API v2",
1000
+ "apiVersion": "2012-12-31",
1001
+ "description":"Provides access to Zendesk views, groups, tickets, ticket fields, and users",
1002
+ "operations": {
1003
+ "list_groups": {
1004
+ "httpMethod":"GET",
1005
+ "uri": "groups.json",
1006
+ "summary": "Get a list of groups"
1007
+ },
1008
+ "search_groups":{
1009
+ "httpMethod":"GET",
1010
+ "uri": "search.json?query=\"{query} type:group\"",
1011
+ "summary": "Uses a search query to get a list of groups",
1012
+ "parameters":{
1013
+ "query":{
1014
+ "location": "uri",
1015
+ "description":"Zendesk Search Query",
1016
+ "type": "string",
1017
+ "required": true
1018
+ }
1019
+ }
1020
+ },
1021
+ "create_group": {
1022
+ "httpMethod":"POST",
1023
+ "uri": "groups.json",
1024
+ "summary": "Create a group",
1025
+ "parameters":{
1026
+ "data": {
1027
+ "type": "array",
1028
+ "location": "body",
1029
+ "description":"Group JSON",
1030
+ "filters": "json_encode",
1031
+ "required": true
1032
+ },
1033
+ "Content-Type":{
1034
+ "type": "string",
1035
+ "location":"header",
1036
+ "static": "application/json"
1037
+ }
1038
+ }
1039
+ },
1040
+ "delete_group": {
1041
+ "httpMethod":"DELETE",
1042
+ "uri": "groups/{id}.json",
1043
+ "summary": "Delete a group",
1044
+ "parameters":{
1045
+ "id":{
1046
+ "location": "uri",
1047
+ "description":"Group to delete by ID",
1048
+ "type": "integer",
1049
+ "required": true
1050
+ }
1051
+ }
1052
+ },
1053
+ "get_group": {
1054
+ "httpMethod":"GET",
1055
+ "uri": "groups/{id}.json",
1056
+ "summary": "Get a ticket",
1057
+ "parameters":{
1058
+ "id":{
1059
+ "location": "uri",
1060
+ "description":"Group to get by ID",
1061
+ "type": "integer",
1062
+ "required": true
1063
+ }
1064
+ }
1065
+ },
1066
+ "update_group": {
1067
+ "httpMethod":"PUT",
1068
+ "uri": "groups/{id}.json",
1069
+ "summary": "Update a group",
1070
+ "parameters":{
1071
+ "id": {
1072
+ "location": "uri",
1073
+ "description":"Group to update by ID",
1074
+ "type": "integer",
1075
+ "required": true
1076
+ },
1077
+ "data": {
1078
+ "type": "array",
1079
+ "location": "body",
1080
+ "description":"Group JSON",
1081
+ "filters": "json_encode",
1082
+ "required": true
1083
+ },
1084
+ "Content-Type":{
1085
+ "type": "string",
1086
+ "location":"header",
1087
+ "static": "application/json"
1088
+ }
1089
+ }
1090
+ }
1091
+ }
1092
+ ```
1093
+
1094
+ ### Guzzle\Service\Description\ServiceDescription
1095
+
1096
+ Commands are now called Operations
1097
+
1098
+ **Before**
1099
+
1100
+ ```php
1101
+ use Guzzle\Service\Description\ServiceDescription;
1102
+
1103
+ $sd = new ServiceDescription();
1104
+ $sd->getCommands(); // @returns ApiCommandInterface[]
1105
+ $sd->hasCommand($name);
1106
+ $sd->getCommand($name); // @returns ApiCommandInterface|null
1107
+ $sd->addCommand($command); // @param ApiCommandInterface $command
1108
+ ```
1109
+
1110
+ **After**
1111
+
1112
+ ```php
1113
+ use Guzzle\Service\Description\ServiceDescription;
1114
+
1115
+ $sd = new ServiceDescription();
1116
+ $sd->getOperations(); // @returns OperationInterface[]
1117
+ $sd->hasOperation($name);
1118
+ $sd->getOperation($name); // @returns OperationInterface|null
1119
+ $sd->addOperation($operation); // @param OperationInterface $operation
1120
+ ```
1121
+
1122
+ ### Guzzle\Common\Inflection\Inflector
1123
+
1124
+ Namespace is now `Guzzle\Inflection\Inflector`
1125
+
1126
+ ### Guzzle\Http\Plugin
1127
+
1128
+ Namespace is now `Guzzle\Plugin`. Many other changes occur within this namespace and are detailed in their own sections below.
1129
+
1130
+ ### Guzzle\Http\Plugin\LogPlugin and Guzzle\Common\Log
1131
+
1132
+ Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively.
1133
+
1134
+ **Before**
1135
+
1136
+ ```php
1137
+ use Guzzle\Common\Log\ClosureLogAdapter;
1138
+ use Guzzle\Http\Plugin\LogPlugin;
1139
+
1140
+ /** @var \Guzzle\Http\Client */
1141
+ $client;
1142
+
1143
+ // $verbosity is an integer indicating desired message verbosity level
1144
+ $client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $verbosity = LogPlugin::LOG_VERBOSE);
1145
+ ```
1146
+
1147
+ **After**
1148
+
1149
+ ```php
1150
+ use Guzzle\Log\ClosureLogAdapter;
1151
+ use Guzzle\Log\MessageFormatter;
1152
+ use Guzzle\Plugin\Log\LogPlugin;
1153
+
1154
+ /** @var \Guzzle\Http\Client */
1155
+ $client;
1156
+
1157
+ // $format is a string indicating desired message format -- @see MessageFormatter
1158
+ $client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $format = MessageFormatter::DEBUG_FORMAT);
1159
+ ```
1160
+
1161
+ ### Guzzle\Http\Plugin\CurlAuthPlugin
1162
+
1163
+ Now `Guzzle\Plugin\CurlAuth\CurlAuthPlugin`.
1164
+
1165
+ ### Guzzle\Http\Plugin\ExponentialBackoffPlugin
1166
+
1167
+ Now `Guzzle\Plugin\Backoff\BackoffPlugin`, and other changes.
1168
+
1169
+ **Before**
1170
+
1171
+ ```php
1172
+ use Guzzle\Http\Plugin\ExponentialBackoffPlugin;
1173
+
1174
+ $backoffPlugin = new ExponentialBackoffPlugin($maxRetries, array_merge(
1175
+ ExponentialBackoffPlugin::getDefaultFailureCodes(), array(429)
1176
+ ));
1177
+
1178
+ $client->addSubscriber($backoffPlugin);
1179
+ ```
1180
+
1181
+ **After**
1182
+
1183
+ ```php
1184
+ use Guzzle\Plugin\Backoff\BackoffPlugin;
1185
+ use Guzzle\Plugin\Backoff\HttpBackoffStrategy;
1186
+
1187
+ // Use convenient factory method instead -- see implementation for ideas of what
1188
+ // you can do with chaining backoff strategies
1189
+ $backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, array_merge(
1190
+ HttpBackoffStrategy::getDefaultFailureCodes(), array(429)
1191
+ ));
1192
+ $client->addSubscriber($backoffPlugin);
1193
+ ```
1194
+
1195
+ ### Known Issues
1196
+
1197
+ #### [BUG] Accept-Encoding header behavior changed unintentionally.
1198
+
1199
+ (See #217) (Fixed in 09daeb8c666fb44499a0646d655a8ae36456575e)
1200
+
1201
+ In version 2.8 setting the `Accept-Encoding` header would set the CURLOPT_ENCODING option, which permitted cURL to
1202
+ properly handle gzip/deflate compressed responses from the server. In versions affected by this bug this does not happen.
1203
+ See issue #217 for a workaround, or use a version containing the fix.
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/composer.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "guzzlehttp/guzzle",
3
+ "type": "library",
4
+ "description": "Guzzle is a PHP HTTP client library",
5
+ "keywords": ["framework", "http", "rest", "web service", "curl", "client", "HTTP client"],
6
+ "homepage": "http://guzzlephp.org/",
7
+ "license": "MIT",
8
+ "authors": [
9
+ {
10
+ "name": "Michael Dowling",
11
+ "email": "mtdowling@gmail.com",
12
+ "homepage": "https://github.com/mtdowling"
13
+ }
14
+ ],
15
+ "require": {
16
+ "php": ">=5.5",
17
+ "guzzlehttp/psr7": "^1.3.1",
18
+ "guzzlehttp/promises": "^1.0"
19
+ },
20
+ "require-dev": {
21
+ "ext-curl": "*",
22
+ "phpunit/phpunit": "^4.0",
23
+ "psr/log": "^1.0"
24
+ },
25
+ "autoload": {
26
+ "files": ["src/functions_include.php"],
27
+ "psr-4": {
28
+ "GuzzleHttp\\": "src/"
29
+ }
30
+ },
31
+ "autoload-dev": {
32
+ "psr-4": {
33
+ "GuzzleHttp\\Tests\\": "tests/"
34
+ }
35
+ },
36
+ "extra": {
37
+ "branch-alias": {
38
+ "dev-master": "6.2-dev"
39
+ }
40
+ }
41
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Client.php ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use GuzzleHttp\Cookie\CookieJar;
5
+ use GuzzleHttp\Promise;
6
+ use GuzzleHttp\Psr7;
7
+ use Psr\Http\Message\UriInterface;
8
+ use Psr\Http\Message\RequestInterface;
9
+ use Psr\Http\Message\ResponseInterface;
10
+
11
+ /**
12
+ * @method ResponseInterface get(string|UriInterface $uri, array $options = [])
13
+ * @method ResponseInterface head(string|UriInterface $uri, array $options = [])
14
+ * @method ResponseInterface put(string|UriInterface $uri, array $options = [])
15
+ * @method ResponseInterface post(string|UriInterface $uri, array $options = [])
16
+ * @method ResponseInterface patch(string|UriInterface $uri, array $options = [])
17
+ * @method ResponseInterface delete(string|UriInterface $uri, array $options = [])
18
+ * @method Promise\PromiseInterface getAsync(string|UriInterface $uri, array $options = [])
19
+ * @method Promise\PromiseInterface headAsync(string|UriInterface $uri, array $options = [])
20
+ * @method Promise\PromiseInterface putAsync(string|UriInterface $uri, array $options = [])
21
+ * @method Promise\PromiseInterface postAsync(string|UriInterface $uri, array $options = [])
22
+ * @method Promise\PromiseInterface patchAsync(string|UriInterface $uri, array $options = [])
23
+ * @method Promise\PromiseInterface deleteAsync(string|UriInterface $uri, array $options = [])
24
+ */
25
+ class Client implements ClientInterface
26
+ {
27
+ /** @var array Default request options */
28
+ private $config;
29
+
30
+ /**
31
+ * Clients accept an array of constructor parameters.
32
+ *
33
+ * Here's an example of creating a client using a base_uri and an array of
34
+ * default request options to apply to each request:
35
+ *
36
+ * $client = new Client([
37
+ * 'base_uri' => 'http://www.foo.com/1.0/',
38
+ * 'timeout' => 0,
39
+ * 'allow_redirects' => false,
40
+ * 'proxy' => '192.168.16.1:10'
41
+ * ]);
42
+ *
43
+ * Client configuration settings include the following options:
44
+ *
45
+ * - handler: (callable) Function that transfers HTTP requests over the
46
+ * wire. The function is called with a Psr7\Http\Message\RequestInterface
47
+ * and array of transfer options, and must return a
48
+ * GuzzleHttp\Promise\PromiseInterface that is fulfilled with a
49
+ * Psr7\Http\Message\ResponseInterface on success. "handler" is a
50
+ * constructor only option that cannot be overridden in per/request
51
+ * options. If no handler is provided, a default handler will be created
52
+ * that enables all of the request options below by attaching all of the
53
+ * default middleware to the handler.
54
+ * - base_uri: (string|UriInterface) Base URI of the client that is merged
55
+ * into relative URIs. Can be a string or instance of UriInterface.
56
+ * - **: any request option
57
+ *
58
+ * @param array $config Client configuration settings.
59
+ *
60
+ * @see \GuzzleHttp\RequestOptions for a list of available request options.
61
+ */
62
+ public function __construct(array $config = [])
63
+ {
64
+ if (!isset($config['handler'])) {
65
+ $config['handler'] = HandlerStack::create();
66
+ }
67
+
68
+ // Convert the base_uri to a UriInterface
69
+ if (isset($config['base_uri'])) {
70
+ $config['base_uri'] = Psr7\uri_for($config['base_uri']);
71
+ }
72
+
73
+ $this->configureDefaults($config);
74
+ }
75
+
76
+ public function __call($method, $args)
77
+ {
78
+ if (count($args) < 1) {
79
+ throw new \InvalidArgumentException('Magic request methods require a URI and optional options array');
80
+ }
81
+
82
+ $uri = $args[0];
83
+ $opts = isset($args[1]) ? $args[1] : [];
84
+
85
+ return substr($method, -5) === 'Async'
86
+ ? $this->requestAsync(substr($method, 0, -5), $uri, $opts)
87
+ : $this->request($method, $uri, $opts);
88
+ }
89
+
90
+ public function sendAsync(RequestInterface $request, array $options = [])
91
+ {
92
+ // Merge the base URI into the request URI if needed.
93
+ $options = $this->prepareDefaults($options);
94
+
95
+ return $this->transfer(
96
+ $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')),
97
+ $options
98
+ );
99
+ }
100
+
101
+ public function send(RequestInterface $request, array $options = [])
102
+ {
103
+ $options[RequestOptions::SYNCHRONOUS] = true;
104
+ return $this->sendAsync($request, $options)->wait();
105
+ }
106
+
107
+ public function requestAsync($method, $uri = '', array $options = [])
108
+ {
109
+ $options = $this->prepareDefaults($options);
110
+ // Remove request modifying parameter because it can be done up-front.
111
+ $headers = isset($options['headers']) ? $options['headers'] : [];
112
+ $body = isset($options['body']) ? $options['body'] : null;
113
+ $version = isset($options['version']) ? $options['version'] : '1.1';
114
+ // Merge the URI into the base URI.
115
+ $uri = $this->buildUri($uri, $options);
116
+ if (is_array($body)) {
117
+ $this->invalidBody();
118
+ }
119
+ $request = new Psr7\Request($method, $uri, $headers, $body, $version);
120
+ // Remove the option so that they are not doubly-applied.
121
+ unset($options['headers'], $options['body'], $options['version']);
122
+
123
+ return $this->transfer($request, $options);
124
+ }
125
+
126
+ public function request($method, $uri = '', array $options = [])
127
+ {
128
+ $options[RequestOptions::SYNCHRONOUS] = true;
129
+ return $this->requestAsync($method, $uri, $options)->wait();
130
+ }
131
+
132
+ public function getConfig($option = null)
133
+ {
134
+ return $option === null
135
+ ? $this->config
136
+ : (isset($this->config[$option]) ? $this->config[$option] : null);
137
+ }
138
+
139
+ private function buildUri($uri, array $config)
140
+ {
141
+ // for BC we accept null which would otherwise fail in uri_for
142
+ $uri = Psr7\uri_for($uri === null ? '' : $uri);
143
+
144
+ if (isset($config['base_uri'])) {
145
+ $uri = Psr7\Uri::resolve(Psr7\uri_for($config['base_uri']), $uri);
146
+ }
147
+
148
+ return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
149
+ }
150
+
151
+ /**
152
+ * Configures the default options for a client.
153
+ *
154
+ * @param array $config
155
+ */
156
+ private function configureDefaults(array $config)
157
+ {
158
+ $defaults = [
159
+ 'allow_redirects' => RedirectMiddleware::$defaultSettings,
160
+ 'http_errors' => true,
161
+ 'decode_content' => true,
162
+ 'verify' => true,
163
+ 'cookies' => false
164
+ ];
165
+
166
+ // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
167
+
168
+ // We can only trust the HTTP_PROXY environment variable in a CLI
169
+ // process due to the fact that PHP has no reliable mechanism to
170
+ // get environment variables that start with "HTTP_".
171
+ if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) {
172
+ $defaults['proxy']['http'] = getenv('HTTP_PROXY');
173
+ }
174
+
175
+ if ($proxy = getenv('HTTPS_PROXY')) {
176
+ $defaults['proxy']['https'] = $proxy;
177
+ }
178
+
179
+ if ($noProxy = getenv('NO_PROXY')) {
180
+ $cleanedNoProxy = str_replace(' ', '', $noProxy);
181
+ $defaults['proxy']['no'] = explode(',', $cleanedNoProxy);
182
+ }
183
+
184
+ $this->config = $config + $defaults;
185
+
186
+ if (!empty($config['cookies']) && $config['cookies'] === true) {
187
+ $this->config['cookies'] = new CookieJar();
188
+ }
189
+
190
+ // Add the default user-agent header.
191
+ if (!isset($this->config['headers'])) {
192
+ $this->config['headers'] = ['User-Agent' => default_user_agent()];
193
+ } else {
194
+ // Add the User-Agent header if one was not already set.
195
+ foreach (array_keys($this->config['headers']) as $name) {
196
+ if (strtolower($name) === 'user-agent') {
197
+ return;
198
+ }
199
+ }
200
+ $this->config['headers']['User-Agent'] = default_user_agent();
201
+ }
202
+ }
203
+
204
+ /**
205
+ * Merges default options into the array.
206
+ *
207
+ * @param array $options Options to modify by reference
208
+ *
209
+ * @return array
210
+ */
211
+ private function prepareDefaults($options)
212
+ {
213
+ $defaults = $this->config;
214
+
215
+ if (!empty($defaults['headers'])) {
216
+ // Default headers are only added if they are not present.
217
+ $defaults['_conditional'] = $defaults['headers'];
218
+ unset($defaults['headers']);
219
+ }
220
+
221
+ // Special handling for headers is required as they are added as
222
+ // conditional headers and as headers passed to a request ctor.
223
+ if (array_key_exists('headers', $options)) {
224
+ // Allows default headers to be unset.
225
+ if ($options['headers'] === null) {
226
+ $defaults['_conditional'] = null;
227
+ unset($options['headers']);
228
+ } elseif (!is_array($options['headers'])) {
229
+ throw new \InvalidArgumentException('headers must be an array');
230
+ }
231
+ }
232
+
233
+ // Shallow merge defaults underneath options.
234
+ $result = $options + $defaults;
235
+
236
+ // Remove null values.
237
+ foreach ($result as $k => $v) {
238
+ if ($v === null) {
239
+ unset($result[$k]);
240
+ }
241
+ }
242
+
243
+ return $result;
244
+ }
245
+
246
+ /**
247
+ * Transfers the given request and applies request options.
248
+ *
249
+ * The URI of the request is not modified and the request options are used
250
+ * as-is without merging in default options.
251
+ *
252
+ * @param RequestInterface $request
253
+ * @param array $options
254
+ *
255
+ * @return Promise\PromiseInterface
256
+ */
257
+ private function transfer(RequestInterface $request, array $options)
258
+ {
259
+ // save_to -> sink
260
+ if (isset($options['save_to'])) {
261
+ $options['sink'] = $options['save_to'];
262
+ unset($options['save_to']);
263
+ }
264
+
265
+ // exceptions -> http_errors
266
+ if (isset($options['exceptions'])) {
267
+ $options['http_errors'] = $options['exceptions'];
268
+ unset($options['exceptions']);
269
+ }
270
+
271
+ $request = $this->applyOptions($request, $options);
272
+ $handler = $options['handler'];
273
+
274
+ try {
275
+ return Promise\promise_for($handler($request, $options));
276
+ } catch (\Exception $e) {
277
+ return Promise\rejection_for($e);
278
+ }
279
+ }
280
+
281
+ /**
282
+ * Applies the array of request options to a request.
283
+ *
284
+ * @param RequestInterface $request
285
+ * @param array $options
286
+ *
287
+ * @return RequestInterface
288
+ */
289
+ private function applyOptions(RequestInterface $request, array &$options)
290
+ {
291
+ $modify = [];
292
+
293
+ if (isset($options['form_params'])) {
294
+ if (isset($options['multipart'])) {
295
+ throw new \InvalidArgumentException('You cannot use '
296
+ . 'form_params and multipart at the same time. Use the '
297
+ . 'form_params option if you want to send application/'
298
+ . 'x-www-form-urlencoded requests, and the multipart '
299
+ . 'option to send multipart/form-data requests.');
300
+ }
301
+ $options['body'] = http_build_query($options['form_params'], '', '&');
302
+ unset($options['form_params']);
303
+ $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
304
+ }
305
+
306
+ if (isset($options['multipart'])) {
307
+ $options['body'] = new Psr7\MultipartStream($options['multipart']);
308
+ unset($options['multipart']);
309
+ }
310
+
311
+ if (isset($options['json'])) {
312
+ $options['body'] = \GuzzleHttp\json_encode($options['json']);
313
+ unset($options['json']);
314
+ $options['_conditional']['Content-Type'] = 'application/json';
315
+ }
316
+
317
+ if (!empty($options['decode_content'])
318
+ && $options['decode_content'] !== true
319
+ ) {
320
+ $modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
321
+ }
322
+
323
+ if (isset($options['headers'])) {
324
+ if (isset($modify['set_headers'])) {
325
+ $modify['set_headers'] = $options['headers'] + $modify['set_headers'];
326
+ } else {
327
+ $modify['set_headers'] = $options['headers'];
328
+ }
329
+ unset($options['headers']);
330
+ }
331
+
332
+ if (isset($options['body'])) {
333
+ if (is_array($options['body'])) {
334
+ $this->invalidBody();
335
+ }
336
+ $modify['body'] = Psr7\stream_for($options['body']);
337
+ unset($options['body']);
338
+ }
339
+
340
+ if (!empty($options['auth']) && is_array($options['auth'])) {
341
+ $value = $options['auth'];
342
+ $type = isset($value[2]) ? strtolower($value[2]) : 'basic';
343
+ switch ($type) {
344
+ case 'basic':
345
+ $modify['set_headers']['Authorization'] = 'Basic '
346
+ . base64_encode("$value[0]:$value[1]");
347
+ break;
348
+ case 'digest':
349
+ // @todo: Do not rely on curl
350
+ $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST;
351
+ $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]";
352
+ break;
353
+ }
354
+ }
355
+
356
+ if (isset($options['query'])) {
357
+ $value = $options['query'];
358
+ if (is_array($value)) {
359
+ $value = http_build_query($value, null, '&', PHP_QUERY_RFC3986);
360
+ }
361
+ if (!is_string($value)) {
362
+ throw new \InvalidArgumentException('query must be a string or array');
363
+ }
364
+ $modify['query'] = $value;
365
+ unset($options['query']);
366
+ }
367
+
368
+ // Ensure that sink is not an invalid value.
369
+ if (isset($options['sink'])) {
370
+ // TODO: Add more sink validation?
371
+ if (is_bool($options['sink'])) {
372
+ throw new \InvalidArgumentException('sink must not be a boolean');
373
+ }
374
+ }
375
+
376
+ $request = Psr7\modify_request($request, $modify);
377
+ if ($request->getBody() instanceof Psr7\MultipartStream) {
378
+ // Use a multipart/form-data POST if a Content-Type is not set.
379
+ $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
380
+ . $request->getBody()->getBoundary();
381
+ }
382
+
383
+ // Merge in conditional headers if they are not present.
384
+ if (isset($options['_conditional'])) {
385
+ // Build up the changes so it's in a single clone of the message.
386
+ $modify = [];
387
+ foreach ($options['_conditional'] as $k => $v) {
388
+ if (!$request->hasHeader($k)) {
389
+ $modify['set_headers'][$k] = $v;
390
+ }
391
+ }
392
+ $request = Psr7\modify_request($request, $modify);
393
+ // Don't pass this internal value along to middleware/handlers.
394
+ unset($options['_conditional']);
395
+ }
396
+
397
+ return $request;
398
+ }
399
+
400
+ private function invalidBody()
401
+ {
402
+ throw new \InvalidArgumentException('Passing in the "body" request '
403
+ . 'option as an array to send a POST request has been deprecated. '
404
+ . 'Please use the "form_params" request option to send a '
405
+ . 'application/x-www-form-urlencoded request, or a the "multipart" '
406
+ . 'request option to send a multipart/form-data request.');
407
+ }
408
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/ClientInterface.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use GuzzleHttp\Promise\PromiseInterface;
5
+ use GuzzleHttp\Exception\GuzzleException;
6
+ use Psr\Http\Message\RequestInterface;
7
+ use Psr\Http\Message\ResponseInterface;
8
+ use Psr\Http\Message\UriInterface;
9
+
10
+ /**
11
+ * Client interface for sending HTTP requests.
12
+ */
13
+ interface ClientInterface
14
+ {
15
+ const VERSION = '6.2.1';
16
+
17
+ /**
18
+ * Send an HTTP request.
19
+ *
20
+ * @param RequestInterface $request Request to send
21
+ * @param array $options Request options to apply to the given
22
+ * request and to the transfer.
23
+ *
24
+ * @return ResponseInterface
25
+ * @throws GuzzleException
26
+ */
27
+ public function send(RequestInterface $request, array $options = []);
28
+
29
+ /**
30
+ * Asynchronously send an HTTP request.
31
+ *
32
+ * @param RequestInterface $request Request to send
33
+ * @param array $options Request options to apply to the given
34
+ * request and to the transfer.
35
+ *
36
+ * @return PromiseInterface
37
+ */
38
+ public function sendAsync(RequestInterface $request, array $options = []);
39
+
40
+ /**
41
+ * Create and send an HTTP request.
42
+ *
43
+ * Use an absolute path to override the base path of the client, or a
44
+ * relative path to append to the base path of the client. The URL can
45
+ * contain the query string as well.
46
+ *
47
+ * @param string $method HTTP method.
48
+ * @param string|UriInterface $uri URI object or string.
49
+ * @param array $options Request options to apply.
50
+ *
51
+ * @return ResponseInterface
52
+ * @throws GuzzleException
53
+ */
54
+ public function request($method, $uri, array $options = []);
55
+
56
+ /**
57
+ * Create and send an asynchronous HTTP request.
58
+ *
59
+ * Use an absolute path to override the base path of the client, or a
60
+ * relative path to append to the base path of the client. The URL can
61
+ * contain the query string as well. Use an array to provide a URL
62
+ * template and additional variables to use in the URL template expansion.
63
+ *
64
+ * @param string $method HTTP method
65
+ * @param string|UriInterface $uri URI object or string.
66
+ * @param array $options Request options to apply.
67
+ *
68
+ * @return PromiseInterface
69
+ */
70
+ public function requestAsync($method, $uri, array $options = []);
71
+
72
+ /**
73
+ * Get a client configuration option.
74
+ *
75
+ * These options include default request options of the client, a "handler"
76
+ * (if utilized by the concrete client), and a "base_uri" if utilized by
77
+ * the concrete client.
78
+ *
79
+ * @param string|null $option The config option to retrieve.
80
+ *
81
+ * @return mixed
82
+ */
83
+ public function getConfig($option = null);
84
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Cookie;
3
+
4
+ use Psr\Http\Message\RequestInterface;
5
+ use Psr\Http\Message\ResponseInterface;
6
+
7
+ /**
8
+ * Cookie jar that stores cookies as an array
9
+ */
10
+ class CookieJar implements CookieJarInterface
11
+ {
12
+ /** @var SetCookie[] Loaded cookie data */
13
+ private $cookies = [];
14
+
15
+ /** @var bool */
16
+ private $strictMode;
17
+
18
+ /**
19
+ * @param bool $strictMode Set to true to throw exceptions when invalid
20
+ * cookies are added to the cookie jar.
21
+ * @param array $cookieArray Array of SetCookie objects or a hash of
22
+ * arrays that can be used with the SetCookie
23
+ * constructor
24
+ */
25
+ public function __construct($strictMode = false, $cookieArray = [])
26
+ {
27
+ $this->strictMode = $strictMode;
28
+
29
+ foreach ($cookieArray as $cookie) {
30
+ if (!($cookie instanceof SetCookie)) {
31
+ $cookie = new SetCookie($cookie);
32
+ }
33
+ $this->setCookie($cookie);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Create a new Cookie jar from an associative array and domain.
39
+ *
40
+ * @param array $cookies Cookies to create the jar from
41
+ * @param string $domain Domain to set the cookies to
42
+ *
43
+ * @return self
44
+ */
45
+ public static function fromArray(array $cookies, $domain)
46
+ {
47
+ $cookieJar = new self();
48
+ foreach ($cookies as $name => $value) {
49
+ $cookieJar->setCookie(new SetCookie([
50
+ 'Domain' => $domain,
51
+ 'Name' => $name,
52
+ 'Value' => $value,
53
+ 'Discard' => true
54
+ ]));
55
+ }
56
+
57
+ return $cookieJar;
58
+ }
59
+
60
+ /**
61
+ * @deprecated
62
+ */
63
+ public static function getCookieValue($value)
64
+ {
65
+ return $value;
66
+ }
67
+
68
+ /**
69
+ * Evaluate if this cookie should be persisted to storage
70
+ * that survives between requests.
71
+ *
72
+ * @param SetCookie $cookie Being evaluated.
73
+ * @param bool $allowSessionCookies If we should persist session cookies
74
+ * @return bool
75
+ */
76
+ public static function shouldPersist(
77
+ SetCookie $cookie,
78
+ $allowSessionCookies = false
79
+ ) {
80
+ if ($cookie->getExpires() || $allowSessionCookies) {
81
+ if (!$cookie->getDiscard()) {
82
+ return true;
83
+ }
84
+ }
85
+
86
+ return false;
87
+ }
88
+
89
+ public function toArray()
90
+ {
91
+ return array_map(function (SetCookie $cookie) {
92
+ return $cookie->toArray();
93
+ }, $this->getIterator()->getArrayCopy());
94
+ }
95
+
96
+ public function clear($domain = null, $path = null, $name = null)
97
+ {
98
+ if (!$domain) {
99
+ $this->cookies = [];
100
+ return;
101
+ } elseif (!$path) {
102
+ $this->cookies = array_filter(
103
+ $this->cookies,
104
+ function (SetCookie $cookie) use ($path, $domain) {
105
+ return !$cookie->matchesDomain($domain);
106
+ }
107
+ );
108
+ } elseif (!$name) {
109
+ $this->cookies = array_filter(
110
+ $this->cookies,
111
+ function (SetCookie $cookie) use ($path, $domain) {
112
+ return !($cookie->matchesPath($path) &&
113
+ $cookie->matchesDomain($domain));
114
+ }
115
+ );
116
+ } else {
117
+ $this->cookies = array_filter(
118
+ $this->cookies,
119
+ function (SetCookie $cookie) use ($path, $domain, $name) {
120
+ return !($cookie->getName() == $name &&
121
+ $cookie->matchesPath($path) &&
122
+ $cookie->matchesDomain($domain));
123
+ }
124
+ );
125
+ }
126
+ }
127
+
128
+ public function clearSessionCookies()
129
+ {
130
+ $this->cookies = array_filter(
131
+ $this->cookies,
132
+ function (SetCookie $cookie) {
133
+ return !$cookie->getDiscard() && $cookie->getExpires();
134
+ }
135
+ );
136
+ }
137
+
138
+ public function setCookie(SetCookie $cookie)
139
+ {
140
+ // If the name string is empty (but not 0), ignore the set-cookie
141
+ // string entirely.
142
+ $name = $cookie->getName();
143
+ if (!$name && $name !== '0') {
144
+ return false;
145
+ }
146
+
147
+ // Only allow cookies with set and valid domain, name, value
148
+ $result = $cookie->validate();
149
+ if ($result !== true) {
150
+ if ($this->strictMode) {
151
+ throw new \RuntimeException('Invalid cookie: ' . $result);
152
+ } else {
153
+ $this->removeCookieIfEmpty($cookie);
154
+ return false;
155
+ }
156
+ }
157
+
158
+ // Resolve conflicts with previously set cookies
159
+ foreach ($this->cookies as $i => $c) {
160
+
161
+ // Two cookies are identical, when their path, and domain are
162
+ // identical.
163
+ if ($c->getPath() != $cookie->getPath() ||
164
+ $c->getDomain() != $cookie->getDomain() ||
165
+ $c->getName() != $cookie->getName()
166
+ ) {
167
+ continue;
168
+ }
169
+
170
+ // The previously set cookie is a discard cookie and this one is
171
+ // not so allow the new cookie to be set
172
+ if (!$cookie->getDiscard() && $c->getDiscard()) {
173
+ unset($this->cookies[$i]);
174
+ continue;
175
+ }
176
+
177
+ // If the new cookie's expiration is further into the future, then
178
+ // replace the old cookie
179
+ if ($cookie->getExpires() > $c->getExpires()) {
180
+ unset($this->cookies[$i]);
181
+ continue;
182
+ }
183
+
184
+ // If the value has changed, we better change it
185
+ if ($cookie->getValue() !== $c->getValue()) {
186
+ unset($this->cookies[$i]);
187
+ continue;
188
+ }
189
+
190
+ // The cookie exists, so no need to continue
191
+ return false;
192
+ }
193
+
194
+ $this->cookies[] = $cookie;
195
+
196
+ return true;
197
+ }
198
+
199
+ public function count()
200
+ {
201
+ return count($this->cookies);
202
+ }
203
+
204
+ public function getIterator()
205
+ {
206
+ return new \ArrayIterator(array_values($this->cookies));
207
+ }
208
+
209
+ public function extractCookies(
210
+ RequestInterface $request,
211
+ ResponseInterface $response
212
+ ) {
213
+ if ($cookieHeader = $response->getHeader('Set-Cookie')) {
214
+ foreach ($cookieHeader as $cookie) {
215
+ $sc = SetCookie::fromString($cookie);
216
+ if (!$sc->getDomain()) {
217
+ $sc->setDomain($request->getUri()->getHost());
218
+ }
219
+ $this->setCookie($sc);
220
+ }
221
+ }
222
+ }
223
+
224
+ public function withCookieHeader(RequestInterface $request)
225
+ {
226
+ $values = [];
227
+ $uri = $request->getUri();
228
+ $scheme = $uri->getScheme();
229
+ $host = $uri->getHost();
230
+ $path = $uri->getPath() ?: '/';
231
+
232
+ foreach ($this->cookies as $cookie) {
233
+ if ($cookie->matchesPath($path) &&
234
+ $cookie->matchesDomain($host) &&
235
+ !$cookie->isExpired() &&
236
+ (!$cookie->getSecure() || $scheme === 'https')
237
+ ) {
238
+ $values[] = $cookie->getName() . '='
239
+ . $cookie->getValue();
240
+ }
241
+ }
242
+
243
+ return $values
244
+ ? $request->withHeader('Cookie', implode('; ', $values))
245
+ : $request;
246
+ }
247
+
248
+ /**
249
+ * If a cookie already exists and the server asks to set it again with a
250
+ * null value, the cookie must be deleted.
251
+ *
252
+ * @param SetCookie $cookie
253
+ */
254
+ private function removeCookieIfEmpty(SetCookie $cookie)
255
+ {
256
+ $cookieValue = $cookie->getValue();
257
+ if ($cookieValue === null || $cookieValue === '') {
258
+ $this->clear(
259
+ $cookie->getDomain(),
260
+ $cookie->getPath(),
261
+ $cookie->getName()
262
+ );
263
+ }
264
+ }
265
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Cookie;
3
+
4
+ use Psr\Http\Message\RequestInterface;
5
+ use Psr\Http\Message\ResponseInterface;
6
+
7
+ /**
8
+ * Stores HTTP cookies.
9
+ *
10
+ * It extracts cookies from HTTP requests, and returns them in HTTP responses.
11
+ * CookieJarInterface instances automatically expire contained cookies when
12
+ * necessary. Subclasses are also responsible for storing and retrieving
13
+ * cookies from a file, database, etc.
14
+ *
15
+ * @link http://docs.python.org/2/library/cookielib.html Inspiration
16
+ */
17
+ interface CookieJarInterface extends \Countable, \IteratorAggregate
18
+ {
19
+ /**
20
+ * Create a request with added cookie headers.
21
+ *
22
+ * If no matching cookies are found in the cookie jar, then no Cookie
23
+ * header is added to the request and the same request is returned.
24
+ *
25
+ * @param RequestInterface $request Request object to modify.
26
+ *
27
+ * @return RequestInterface returns the modified request.
28
+ */
29
+ public function withCookieHeader(RequestInterface $request);
30
+
31
+ /**
32
+ * Extract cookies from an HTTP response and store them in the CookieJar.
33
+ *
34
+ * @param RequestInterface $request Request that was sent
35
+ * @param ResponseInterface $response Response that was received
36
+ */
37
+ public function extractCookies(
38
+ RequestInterface $request,
39
+ ResponseInterface $response
40
+ );
41
+
42
+ /**
43
+ * Sets a cookie in the cookie jar.
44
+ *
45
+ * @param SetCookie $cookie Cookie to set.
46
+ *
47
+ * @return bool Returns true on success or false on failure
48
+ */
49
+ public function setCookie(SetCookie $cookie);
50
+
51
+ /**
52
+ * Remove cookies currently held in the cookie jar.
53
+ *
54
+ * Invoking this method without arguments will empty the whole cookie jar.
55
+ * If given a $domain argument only cookies belonging to that domain will
56
+ * be removed. If given a $domain and $path argument, cookies belonging to
57
+ * the specified path within that domain are removed. If given all three
58
+ * arguments, then the cookie with the specified name, path and domain is
59
+ * removed.
60
+ *
61
+ * @param string $domain Clears cookies matching a domain
62
+ * @param string $path Clears cookies matching a domain and path
63
+ * @param string $name Clears cookies matching a domain, path, and name
64
+ *
65
+ * @return CookieJarInterface
66
+ */
67
+ public function clear($domain = null, $path = null, $name = null);
68
+
69
+ /**
70
+ * Discard all sessions cookies.
71
+ *
72
+ * Removes cookies that don't have an expire field or a have a discard
73
+ * field set to true. To be called when the user agent shuts down according
74
+ * to RFC 2965.
75
+ */
76
+ public function clearSessionCookies();
77
+
78
+ /**
79
+ * Converts the cookie jar to an array.
80
+ *
81
+ * @return array
82
+ */
83
+ public function toArray();
84
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Cookie;
3
+
4
+ /**
5
+ * Persists non-session cookies using a JSON formatted file
6
+ */
7
+ class FileCookieJar extends CookieJar
8
+ {
9
+ /** @var string filename */
10
+ private $filename;
11
+
12
+ /** @var bool Control whether to persist session cookies or not. */
13
+ private $storeSessionCookies;
14
+
15
+ /**
16
+ * Create a new FileCookieJar object
17
+ *
18
+ * @param string $cookieFile File to store the cookie data
19
+ * @param bool $storeSessionCookies Set to true to store session cookies
20
+ * in the cookie jar.
21
+ *
22
+ * @throws \RuntimeException if the file cannot be found or created
23
+ */
24
+ public function __construct($cookieFile, $storeSessionCookies = false)
25
+ {
26
+ $this->filename = $cookieFile;
27
+ $this->storeSessionCookies = $storeSessionCookies;
28
+
29
+ if (file_exists($cookieFile)) {
30
+ $this->load($cookieFile);
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Saves the file when shutting down
36
+ */
37
+ public function __destruct()
38
+ {
39
+ $this->save($this->filename);
40
+ }
41
+
42
+ /**
43
+ * Saves the cookies to a file.
44
+ *
45
+ * @param string $filename File to save
46
+ * @throws \RuntimeException if the file cannot be found or created
47
+ */
48
+ public function save($filename)
49
+ {
50
+ $json = [];
51
+ foreach ($this as $cookie) {
52
+ /** @var SetCookie $cookie */
53
+ if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
54
+ $json[] = $cookie->toArray();
55
+ }
56
+ }
57
+
58
+ $jsonStr = \GuzzleHttp\json_encode($json);
59
+ if (false === file_put_contents($filename, $jsonStr)) {
60
+ throw new \RuntimeException("Unable to save file {$filename}");
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Load cookies from a JSON formatted file.
66
+ *
67
+ * Old cookies are kept unless overwritten by newly loaded ones.
68
+ *
69
+ * @param string $filename Cookie file to load.
70
+ * @throws \RuntimeException if the file cannot be loaded.
71
+ */
72
+ public function load($filename)
73
+ {
74
+ $json = file_get_contents($filename);
75
+ if (false === $json) {
76
+ throw new \RuntimeException("Unable to load file {$filename}");
77
+ } elseif ($json === '') {
78
+ return;
79
+ }
80
+
81
+ $data = \GuzzleHttp\json_decode($json, true);
82
+ if (is_array($data)) {
83
+ foreach (json_decode($json, true) as $cookie) {
84
+ $this->setCookie(new SetCookie($cookie));
85
+ }
86
+ } elseif (strlen($data)) {
87
+ throw new \RuntimeException("Invalid cookie file: {$filename}");
88
+ }
89
+ }
90
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Cookie;
3
+
4
+ /**
5
+ * Persists cookies in the client session
6
+ */
7
+ class SessionCookieJar extends CookieJar
8
+ {
9
+ /** @var string session key */
10
+ private $sessionKey;
11
+
12
+ /** @var bool Control whether to persist session cookies or not. */
13
+ private $storeSessionCookies;
14
+
15
+ /**
16
+ * Create a new SessionCookieJar object
17
+ *
18
+ * @param string $sessionKey Session key name to store the cookie
19
+ * data in session
20
+ * @param bool $storeSessionCookies Set to true to store session cookies
21
+ * in the cookie jar.
22
+ */
23
+ public function __construct($sessionKey, $storeSessionCookies = false)
24
+ {
25
+ $this->sessionKey = $sessionKey;
26
+ $this->storeSessionCookies = $storeSessionCookies;
27
+ $this->load();
28
+ }
29
+
30
+ /**
31
+ * Saves cookies to session when shutting down
32
+ */
33
+ public function __destruct()
34
+ {
35
+ $this->save();
36
+ }
37
+
38
+ /**
39
+ * Save cookies to the client session
40
+ */
41
+ public function save()
42
+ {
43
+ $json = [];
44
+ foreach ($this as $cookie) {
45
+ /** @var SetCookie $cookie */
46
+ if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
47
+ $json[] = $cookie->toArray();
48
+ }
49
+ }
50
+
51
+ $_SESSION[$this->sessionKey] = json_encode($json);
52
+ }
53
+
54
+ /**
55
+ * Load the contents of the client session into the data array
56
+ */
57
+ protected function load()
58
+ {
59
+ if (!isset($_SESSION[$this->sessionKey])) {
60
+ return;
61
+ }
62
+ $data = json_decode($_SESSION[$this->sessionKey], true);
63
+ if (is_array($data)) {
64
+ foreach ($data as $cookie) {
65
+ $this->setCookie(new SetCookie($cookie));
66
+ }
67
+ } elseif (strlen($data)) {
68
+ throw new \RuntimeException("Invalid cookie data");
69
+ }
70
+ }
71
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Cookie;
3
+
4
+ /**
5
+ * Set-Cookie object
6
+ */
7
+ class SetCookie
8
+ {
9
+ /** @var array */
10
+ private static $defaults = [
11
+ 'Name' => null,
12
+ 'Value' => null,
13
+ 'Domain' => null,
14
+ 'Path' => '/',
15
+ 'Max-Age' => null,
16
+ 'Expires' => null,
17
+ 'Secure' => false,
18
+ 'Discard' => false,
19
+ 'HttpOnly' => false
20
+ ];
21
+
22
+ /** @var array Cookie data */
23
+ private $data;
24
+
25
+ /**
26
+ * Create a new SetCookie object from a string
27
+ *
28
+ * @param string $cookie Set-Cookie header string
29
+ *
30
+ * @return self
31
+ */
32
+ public static function fromString($cookie)
33
+ {
34
+ // Create the default return array
35
+ $data = self::$defaults;
36
+ // Explode the cookie string using a series of semicolons
37
+ $pieces = array_filter(array_map('trim', explode(';', $cookie)));
38
+ // The name of the cookie (first kvp) must include an equal sign.
39
+ if (empty($pieces) || !strpos($pieces[0], '=')) {
40
+ return new self($data);
41
+ }
42
+
43
+ // Add the cookie pieces into the parsed data array
44
+ foreach ($pieces as $part) {
45
+
46
+ $cookieParts = explode('=', $part, 2);
47
+ $key = trim($cookieParts[0]);
48
+ $value = isset($cookieParts[1])
49
+ ? trim($cookieParts[1], " \n\r\t\0\x0B")
50
+ : true;
51
+
52
+ // Only check for non-cookies when cookies have been found
53
+ if (empty($data['Name'])) {
54
+ $data['Name'] = $key;
55
+ $data['Value'] = $value;
56
+ } else {
57
+ foreach (array_keys(self::$defaults) as $search) {
58
+ if (!strcasecmp($search, $key)) {
59
+ $data[$search] = $value;
60
+ continue 2;
61
+ }
62
+ }
63
+ $data[$key] = $value;
64
+ }
65
+ }
66
+
67
+ return new self($data);
68
+ }
69
+
70
+ /**
71
+ * @param array $data Array of cookie data provided by a Cookie parser
72
+ */
73
+ public function __construct(array $data = [])
74
+ {
75
+ $this->data = array_replace(self::$defaults, $data);
76
+ // Extract the Expires value and turn it into a UNIX timestamp if needed
77
+ if (!$this->getExpires() && $this->getMaxAge()) {
78
+ // Calculate the Expires date
79
+ $this->setExpires(time() + $this->getMaxAge());
80
+ } elseif ($this->getExpires() && !is_numeric($this->getExpires())) {
81
+ $this->setExpires($this->getExpires());
82
+ }
83
+ }
84
+
85
+ public function __toString()
86
+ {
87
+ $str = $this->data['Name'] . '=' . $this->data['Value'] . '; ';
88
+ foreach ($this->data as $k => $v) {
89
+ if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) {
90
+ if ($k === 'Expires') {
91
+ $str .= 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $v) . '; ';
92
+ } else {
93
+ $str .= ($v === true ? $k : "{$k}={$v}") . '; ';
94
+ }
95
+ }
96
+ }
97
+
98
+ return rtrim($str, '; ');
99
+ }
100
+
101
+ public function toArray()
102
+ {
103
+ return $this->data;
104
+ }
105
+
106
+ /**
107
+ * Get the cookie name
108
+ *
109
+ * @return string
110
+ */
111
+ public function getName()
112
+ {
113
+ return $this->data['Name'];
114
+ }
115
+
116
+ /**
117
+ * Set the cookie name
118
+ *
119
+ * @param string $name Cookie name
120
+ */
121
+ public function setName($name)
122
+ {
123
+ $this->data['Name'] = $name;
124
+ }
125
+
126
+ /**
127
+ * Get the cookie value
128
+ *
129
+ * @return string
130
+ */
131
+ public function getValue()
132
+ {
133
+ return $this->data['Value'];
134
+ }
135
+
136
+ /**
137
+ * Set the cookie value
138
+ *
139
+ * @param string $value Cookie value
140
+ */
141
+ public function setValue($value)
142
+ {
143
+ $this->data['Value'] = $value;
144
+ }
145
+
146
+ /**
147
+ * Get the domain
148
+ *
149
+ * @return string|null
150
+ */
151
+ public function getDomain()
152
+ {
153
+ return $this->data['Domain'];
154
+ }
155
+
156
+ /**
157
+ * Set the domain of the cookie
158
+ *
159
+ * @param string $domain
160
+ */
161
+ public function setDomain($domain)
162
+ {
163
+ $this->data['Domain'] = $domain;
164
+ }
165
+
166
+ /**
167
+ * Get the path
168
+ *
169
+ * @return string
170
+ */
171
+ public function getPath()
172
+ {
173
+ return $this->data['Path'];
174
+ }
175
+
176
+ /**
177
+ * Set the path of the cookie
178
+ *
179
+ * @param string $path Path of the cookie
180
+ */
181
+ public function setPath($path)
182
+ {
183
+ $this->data['Path'] = $path;
184
+ }
185
+
186
+ /**
187
+ * Maximum lifetime of the cookie in seconds
188
+ *
189
+ * @return int|null
190
+ */
191
+ public function getMaxAge()
192
+ {
193
+ return $this->data['Max-Age'];
194
+ }
195
+
196
+ /**
197
+ * Set the max-age of the cookie
198
+ *
199
+ * @param int $maxAge Max age of the cookie in seconds
200
+ */
201
+ public function setMaxAge($maxAge)
202
+ {
203
+ $this->data['Max-Age'] = $maxAge;
204
+ }
205
+
206
+ /**
207
+ * The UNIX timestamp when the cookie Expires
208
+ *
209
+ * @return mixed
210
+ */
211
+ public function getExpires()
212
+ {
213
+ return $this->data['Expires'];
214
+ }
215
+
216
+ /**
217
+ * Set the unix timestamp for which the cookie will expire
218
+ *
219
+ * @param int $timestamp Unix timestamp
220
+ */
221
+ public function setExpires($timestamp)
222
+ {
223
+ $this->data['Expires'] = is_numeric($timestamp)
224
+ ? (int) $timestamp
225
+ : strtotime($timestamp);
226
+ }
227
+
228
+ /**
229
+ * Get whether or not this is a secure cookie
230
+ *
231
+ * @return null|bool
232
+ */
233
+ public function getSecure()
234
+ {
235
+ return $this->data['Secure'];
236
+ }
237
+
238
+ /**
239
+ * Set whether or not the cookie is secure
240
+ *
241
+ * @param bool $secure Set to true or false if secure
242
+ */
243
+ public function setSecure($secure)
244
+ {
245
+ $this->data['Secure'] = $secure;
246
+ }
247
+
248
+ /**
249
+ * Get whether or not this is a session cookie
250
+ *
251
+ * @return null|bool
252
+ */
253
+ public function getDiscard()
254
+ {
255
+ return $this->data['Discard'];
256
+ }
257
+
258
+ /**
259
+ * Set whether or not this is a session cookie
260
+ *
261
+ * @param bool $discard Set to true or false if this is a session cookie
262
+ */
263
+ public function setDiscard($discard)
264
+ {
265
+ $this->data['Discard'] = $discard;
266
+ }
267
+
268
+ /**
269
+ * Get whether or not this is an HTTP only cookie
270
+ *
271
+ * @return bool
272
+ */
273
+ public function getHttpOnly()
274
+ {
275
+ return $this->data['HttpOnly'];
276
+ }
277
+
278
+ /**
279
+ * Set whether or not this is an HTTP only cookie
280
+ *
281
+ * @param bool $httpOnly Set to true or false if this is HTTP only
282
+ */
283
+ public function setHttpOnly($httpOnly)
284
+ {
285
+ $this->data['HttpOnly'] = $httpOnly;
286
+ }
287
+
288
+ /**
289
+ * Check if the cookie matches a path value.
290
+ *
291
+ * A request-path path-matches a given cookie-path if at least one of
292
+ * the following conditions holds:
293
+ *
294
+ * - The cookie-path and the request-path are identical.
295
+ * - The cookie-path is a prefix of the request-path, and the last
296
+ * character of the cookie-path is %x2F ("/").
297
+ * - The cookie-path is a prefix of the request-path, and the first
298
+ * character of the request-path that is not included in the cookie-
299
+ * path is a %x2F ("/") character.
300
+ *
301
+ * @param string $requestPath Path to check against
302
+ *
303
+ * @return bool
304
+ */
305
+ public function matchesPath($requestPath)
306
+ {
307
+ $cookiePath = $this->getPath();
308
+
309
+ // Match on exact matches or when path is the default empty "/"
310
+ if ($cookiePath === '/' || $cookiePath == $requestPath) {
311
+ return true;
312
+ }
313
+
314
+ // Ensure that the cookie-path is a prefix of the request path.
315
+ if (0 !== strpos($requestPath, $cookiePath)) {
316
+ return false;
317
+ }
318
+
319
+ // Match if the last character of the cookie-path is "/"
320
+ if (substr($cookiePath, -1, 1) === '/') {
321
+ return true;
322
+ }
323
+
324
+ // Match if the first character not included in cookie path is "/"
325
+ return substr($requestPath, strlen($cookiePath), 1) === '/';
326
+ }
327
+
328
+ /**
329
+ * Check if the cookie matches a domain value
330
+ *
331
+ * @param string $domain Domain to check against
332
+ *
333
+ * @return bool
334
+ */
335
+ public function matchesDomain($domain)
336
+ {
337
+ // Remove the leading '.' as per spec in RFC 6265.
338
+ // http://tools.ietf.org/html/rfc6265#section-5.2.3
339
+ $cookieDomain = ltrim($this->getDomain(), '.');
340
+
341
+ // Domain not set or exact match.
342
+ if (!$cookieDomain || !strcasecmp($domain, $cookieDomain)) {
343
+ return true;
344
+ }
345
+
346
+ // Matching the subdomain according to RFC 6265.
347
+ // http://tools.ietf.org/html/rfc6265#section-5.1.3
348
+ if (filter_var($domain, FILTER_VALIDATE_IP)) {
349
+ return false;
350
+ }
351
+
352
+ return (bool) preg_match('/\.' . preg_quote($cookieDomain) . '$/', $domain);
353
+ }
354
+
355
+ /**
356
+ * Check if the cookie is expired
357
+ *
358
+ * @return bool
359
+ */
360
+ public function isExpired()
361
+ {
362
+ return $this->getExpires() && time() > $this->getExpires();
363
+ }
364
+
365
+ /**
366
+ * Check if the cookie is valid according to RFC 6265
367
+ *
368
+ * @return bool|string Returns true if valid or an error message if invalid
369
+ */
370
+ public function validate()
371
+ {
372
+ // Names must not be empty, but can be 0
373
+ $name = $this->getName();
374
+ if (empty($name) && !is_numeric($name)) {
375
+ return 'The cookie name must not be empty';
376
+ }
377
+
378
+ // Check if any of the invalid characters are present in the cookie name
379
+ if (preg_match(
380
+ '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/',
381
+ $name)
382
+ ) {
383
+ return 'Cookie name must not contain invalid characters: ASCII '
384
+ . 'Control characters (0-31;127), space, tab and the '
385
+ . 'following characters: ()<>@,;:\"/?={}';
386
+ }
387
+
388
+ // Value must not be empty, but can be 0
389
+ $value = $this->getValue();
390
+ if (empty($value) && !is_numeric($value)) {
391
+ return 'The cookie value must not be empty';
392
+ }
393
+
394
+ // Domains must not be empty, but can be 0
395
+ // A "0" is not a valid internet domain, but may be used as server name
396
+ // in a private network.
397
+ $domain = $this->getDomain();
398
+ if (empty($domain) && !is_numeric($domain)) {
399
+ return 'The cookie domain must not be empty';
400
+ }
401
+
402
+ return true;
403
+ }
404
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Exception;
3
+
4
+ /**
5
+ * Exception when an HTTP error occurs (4xx or 5xx error)
6
+ */
7
+ class BadResponseException extends RequestException {}
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Exception;
3
+
4
+ /**
5
+ * Exception when a client error is encountered (4xx codes)
6
+ */
7
+ class ClientException extends BadResponseException {}
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Exception;
3
+
4
+ use Psr\Http\Message\RequestInterface;
5
+
6
+ /**
7
+ * Exception thrown when a connection cannot be established.
8
+ *
9
+ * Note that no response is present for a ConnectException
10
+ */
11
+ class ConnectException extends RequestException
12
+ {
13
+ public function __construct(
14
+ $message,
15
+ RequestInterface $request,
16
+ \Exception $previous = null,
17
+ array $handlerContext = []
18
+ ) {
19
+ parent::__construct($message, $request, null, $previous, $handlerContext);
20
+ }
21
+
22
+ /**
23
+ * @return null
24
+ */
25
+ public function getResponse()
26
+ {
27
+ return null;
28
+ }
29
+
30
+ /**
31
+ * @return bool
32
+ */
33
+ public function hasResponse()
34
+ {
35
+ return false;
36
+ }
37
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Exception;
3
+
4
+ interface GuzzleException {}
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Exception;
3
+
4
+ use Psr\Http\Message\RequestInterface;
5
+ use Psr\Http\Message\ResponseInterface;
6
+ use GuzzleHttp\Promise\PromiseInterface;
7
+ use Psr\Http\Message\UriInterface;
8
+
9
+ /**
10
+ * HTTP Request exception
11
+ */
12
+ class RequestException extends TransferException
13
+ {
14
+ /** @var RequestInterface */
15
+ private $request;
16
+
17
+ /** @var ResponseInterface */
18
+ private $response;
19
+
20
+ /** @var array */
21
+ private $handlerContext;
22
+
23
+ public function __construct(
24
+ $message,
25
+ RequestInterface $request,
26
+ ResponseInterface $response = null,
27
+ \Exception $previous = null,
28
+ array $handlerContext = []
29
+ ) {
30
+ // Set the code of the exception if the response is set and not future.
31
+ $code = $response && !($response instanceof PromiseInterface)
32
+ ? $response->getStatusCode()
33
+ : 0;
34
+ parent::__construct($message, $code, $previous);
35
+ $this->request = $request;
36
+ $this->response = $response;
37
+ $this->handlerContext = $handlerContext;
38
+ }
39
+
40
+ /**
41
+ * Wrap non-RequestExceptions with a RequestException
42
+ *
43
+ * @param RequestInterface $request
44
+ * @param \Exception $e
45
+ *
46
+ * @return RequestException
47
+ */
48
+ public static function wrapException(RequestInterface $request, \Exception $e)
49
+ {
50
+ return $e instanceof RequestException
51
+ ? $e
52
+ : new RequestException($e->getMessage(), $request, null, $e);
53
+ }
54
+
55
+ /**
56
+ * Factory method to create a new exception with a normalized error message
57
+ *
58
+ * @param RequestInterface $request Request
59
+ * @param ResponseInterface $response Response received
60
+ * @param \Exception $previous Previous exception
61
+ * @param array $ctx Optional handler context.
62
+ *
63
+ * @return self
64
+ */
65
+ public static function create(
66
+ RequestInterface $request,
67
+ ResponseInterface $response = null,
68
+ \Exception $previous = null,
69
+ array $ctx = []
70
+ ) {
71
+ if (!$response) {
72
+ return new self(
73
+ 'Error completing request',
74
+ $request,
75
+ null,
76
+ $previous,
77
+ $ctx
78
+ );
79
+ }
80
+
81
+ $level = (int) floor($response->getStatusCode() / 100);
82
+ if ($level === 4) {
83
+ $label = 'Client error';
84
+ $className = __NAMESPACE__ . '\\ClientException';
85
+ } elseif ($level === 5) {
86
+ $label = 'Server error';
87
+ $className = __NAMESPACE__ . '\\ServerException';
88
+ } else {
89
+ $label = 'Unsuccessful request';
90
+ $className = __CLASS__;
91
+ }
92
+
93
+ $uri = $request->getUri();
94
+ $uri = static::obfuscateUri($uri);
95
+
96
+ // Server Error: `GET /` resulted in a `404 Not Found` response:
97
+ // <html> ... (truncated)
98
+ $message = sprintf(
99
+ '%s: `%s` resulted in a `%s` response',
100
+ $label,
101
+ $request->getMethod() . ' ' . $uri,
102
+ $response->getStatusCode() . ' ' . $response->getReasonPhrase()
103
+ );
104
+
105
+ $summary = static::getResponseBodySummary($response);
106
+
107
+ if ($summary !== null) {
108
+ $message .= ":\n{$summary}\n";
109
+ }
110
+
111
+ return new $className($message, $request, $response, $previous, $ctx);
112
+ }
113
+
114
+ /**
115
+ * Get a short summary of the response
116
+ *
117
+ * Will return `null` if the response is not printable.
118
+ *
119
+ * @param ResponseInterface $response
120
+ *
121
+ * @return string|null
122
+ */
123
+ public static function getResponseBodySummary(ResponseInterface $response)
124
+ {
125
+ $body = $response->getBody();
126
+
127
+ if (!$body->isSeekable()) {
128
+ return null;
129
+ }
130
+
131
+ $size = $body->getSize();
132
+ $summary = $body->read(120);
133
+ $body->rewind();
134
+
135
+ if ($size > 120) {
136
+ $summary .= ' (truncated...)';
137
+ }
138
+
139
+ // Matches any printable character, including unicode characters:
140
+ // letters, marks, numbers, punctuation, spacing, and separators.
141
+ if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
142
+ return null;
143
+ }
144
+
145
+ return $summary;
146
+ }
147
+
148
+ /**
149
+ * Obfuscates URI if there is an username and a password present
150
+ *
151
+ * @param UriInterface $uri
152
+ *
153
+ * @return UriInterface
154
+ */
155
+ private static function obfuscateUri($uri)
156
+ {
157
+ $userInfo = $uri->getUserInfo();
158
+
159
+ if (false !== ($pos = strpos($userInfo, ':'))) {
160
+ return $uri->withUserInfo(substr($userInfo, 0, $pos), '***');
161
+ }
162
+
163
+ return $uri;
164
+ }
165
+
166
+ /**
167
+ * Get the request that caused the exception
168
+ *
169
+ * @return RequestInterface
170
+ */
171
+ public function getRequest()
172
+ {
173
+ return $this->request;
174
+ }
175
+
176
+ /**
177
+ * Get the associated response
178
+ *
179
+ * @return ResponseInterface|null
180
+ */
181
+ public function getResponse()
182
+ {
183
+ return $this->response;
184
+ }
185
+
186
+ /**
187
+ * Check if a response was received
188
+ *
189
+ * @return bool
190
+ */
191
+ public function hasResponse()
192
+ {
193
+ return $this->response !== null;
194
+ }
195
+
196
+ /**
197
+ * Get contextual information about the error from the underlying handler.
198
+ *
199
+ * The contents of this array will vary depending on which handler you are
200
+ * using. It may also be just an empty array. Relying on this data will
201
+ * couple you to a specific handler, but can give more debug information
202
+ * when needed.
203
+ *
204
+ * @return array
205
+ */
206
+ public function getHandlerContext()
207
+ {
208
+ return $this->handlerContext;
209
+ }
210
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Exception;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+
6
+ /**
7
+ * Exception thrown when a seek fails on a stream.
8
+ */
9
+ class SeekException extends \RuntimeException implements GuzzleException
10
+ {
11
+ private $stream;
12
+
13
+ public function __construct(StreamInterface $stream, $pos = 0, $msg = '')
14
+ {
15
+ $this->stream = $stream;
16
+ $msg = $msg ?: 'Could not seek the stream to position ' . $pos;
17
+ parent::__construct($msg);
18
+ }
19
+
20
+ /**
21
+ * @return StreamInterface
22
+ */
23
+ public function getStream()
24
+ {
25
+ return $this->stream;
26
+ }
27
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Exception;
3
+
4
+ /**
5
+ * Exception when a server error is encountered (5xx codes)
6
+ */
7
+ class ServerException extends BadResponseException {}
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Exception;
3
+
4
+ class TooManyRedirectsException extends RequestException {}
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Exception;
3
+
4
+ class TransferException extends \RuntimeException implements GuzzleException {}
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php ADDED
@@ -0,0 +1,536 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Handler;
3
+
4
+ use GuzzleHttp\Exception\RequestException;
5
+ use GuzzleHttp\Exception\ConnectException;
6
+ use GuzzleHttp\Promise\FulfilledPromise;
7
+ use GuzzleHttp\Promise\RejectedPromise;
8
+ use GuzzleHttp\Psr7;
9
+ use GuzzleHttp\Psr7\LazyOpenStream;
10
+ use GuzzleHttp\TransferStats;
11
+ use Psr\Http\Message\RequestInterface;
12
+
13
+ /**
14
+ * Creates curl resources from a request
15
+ */
16
+ class CurlFactory implements CurlFactoryInterface
17
+ {
18
+ /** @var array */
19
+ private $handles;
20
+
21
+ /** @var int Total number of idle handles to keep in cache */
22
+ private $maxHandles;
23
+
24
+ /**
25
+ * @param int $maxHandles Maximum number of idle handles.
26
+ */
27
+ public function __construct($maxHandles)
28
+ {
29
+ $this->maxHandles = $maxHandles;
30
+ }
31
+
32
+ public function create(RequestInterface $request, array $options)
33
+ {
34
+ if (isset($options['curl']['body_as_string'])) {
35
+ $options['_body_as_string'] = $options['curl']['body_as_string'];
36
+ unset($options['curl']['body_as_string']);
37
+ }
38
+
39
+ $easy = new EasyHandle;
40
+ $easy->request = $request;
41
+ $easy->options = $options;
42
+ $conf = $this->getDefaultConf($easy);
43
+ $this->applyMethod($easy, $conf);
44
+ $this->applyHandlerOptions($easy, $conf);
45
+ $this->applyHeaders($easy, $conf);
46
+ unset($conf['_headers']);
47
+
48
+ // Add handler options from the request configuration options
49
+ if (isset($options['curl'])) {
50
+ $conf = array_replace($conf, $options['curl']);
51
+ }
52
+
53
+ $conf[CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy);
54
+ $easy->handle = $this->handles
55
+ ? array_pop($this->handles)
56
+ : curl_init();
57
+ curl_setopt_array($easy->handle, $conf);
58
+
59
+ return $easy;
60
+ }
61
+
62
+ public function release(EasyHandle $easy)
63
+ {
64
+ $resource = $easy->handle;
65
+ unset($easy->handle);
66
+
67
+ if (count($this->handles) >= $this->maxHandles) {
68
+ curl_close($resource);
69
+ } else {
70
+ // Remove all callback functions as they can hold onto references
71
+ // and are not cleaned up by curl_reset. Using curl_setopt_array
72
+ // does not work for some reason, so removing each one
73
+ // individually.
74
+ curl_setopt($resource, CURLOPT_HEADERFUNCTION, null);
75
+ curl_setopt($resource, CURLOPT_READFUNCTION, null);
76
+ curl_setopt($resource, CURLOPT_WRITEFUNCTION, null);
77
+ curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null);
78
+ curl_reset($resource);
79
+ $this->handles[] = $resource;
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Completes a cURL transaction, either returning a response promise or a
85
+ * rejected promise.
86
+ *
87
+ * @param callable $handler
88
+ * @param EasyHandle $easy
89
+ * @param CurlFactoryInterface $factory Dictates how the handle is released
90
+ *
91
+ * @return \GuzzleHttp\Promise\PromiseInterface
92
+ */
93
+ public static function finish(
94
+ callable $handler,
95
+ EasyHandle $easy,
96
+ CurlFactoryInterface $factory
97
+ ) {
98
+ if (isset($easy->options['on_stats'])) {
99
+ self::invokeStats($easy);
100
+ }
101
+
102
+ if (!$easy->response || $easy->errno) {
103
+ return self::finishError($handler, $easy, $factory);
104
+ }
105
+
106
+ // Return the response if it is present and there is no error.
107
+ $factory->release($easy);
108
+
109
+ // Rewind the body of the response if possible.
110
+ $body = $easy->response->getBody();
111
+ if ($body->isSeekable()) {
112
+ $body->rewind();
113
+ }
114
+
115
+ return new FulfilledPromise($easy->response);
116
+ }
117
+
118
+ private static function invokeStats(EasyHandle $easy)
119
+ {
120
+ $curlStats = curl_getinfo($easy->handle);
121
+ $stats = new TransferStats(
122
+ $easy->request,
123
+ $easy->response,
124
+ $curlStats['total_time'],
125
+ $easy->errno,
126
+ $curlStats
127
+ );
128
+ call_user_func($easy->options['on_stats'], $stats);
129
+ }
130
+
131
+ private static function finishError(
132
+ callable $handler,
133
+ EasyHandle $easy,
134
+ CurlFactoryInterface $factory
135
+ ) {
136
+ // Get error information and release the handle to the factory.
137
+ $ctx = [
138
+ 'errno' => $easy->errno,
139
+ 'error' => curl_error($easy->handle),
140
+ ] + curl_getinfo($easy->handle);
141
+ $factory->release($easy);
142
+
143
+ // Retry when nothing is present or when curl failed to rewind.
144
+ if (empty($easy->options['_err_message'])
145
+ && (!$easy->errno || $easy->errno == 65)
146
+ ) {
147
+ return self::retryFailedRewind($handler, $easy, $ctx);
148
+ }
149
+
150
+ return self::createRejection($easy, $ctx);
151
+ }
152
+
153
+ private static function createRejection(EasyHandle $easy, array $ctx)
154
+ {
155
+ static $connectionErrors = [
156
+ CURLE_OPERATION_TIMEOUTED => true,
157
+ CURLE_COULDNT_RESOLVE_HOST => true,
158
+ CURLE_COULDNT_CONNECT => true,
159
+ CURLE_SSL_CONNECT_ERROR => true,
160
+ CURLE_GOT_NOTHING => true,
161
+ ];
162
+
163
+ // If an exception was encountered during the onHeaders event, then
164
+ // return a rejected promise that wraps that exception.
165
+ if ($easy->onHeadersException) {
166
+ return new RejectedPromise(
167
+ new RequestException(
168
+ 'An error was encountered during the on_headers event',
169
+ $easy->request,
170
+ $easy->response,
171
+ $easy->onHeadersException,
172
+ $ctx
173
+ )
174
+ );
175
+ }
176
+
177
+ $message = sprintf(
178
+ 'cURL error %s: %s (%s)',
179
+ $ctx['errno'],
180
+ $ctx['error'],
181
+ 'see http://curl.haxx.se/libcurl/c/libcurl-errors.html'
182
+ );
183
+
184
+ // Create a connection exception if it was a specific error code.
185
+ $error = isset($connectionErrors[$easy->errno])
186
+ ? new ConnectException($message, $easy->request, null, $ctx)
187
+ : new RequestException($message, $easy->request, $easy->response, null, $ctx);
188
+
189
+ return new RejectedPromise($error);
190
+ }
191
+
192
+ private function getDefaultConf(EasyHandle $easy)
193
+ {
194
+ $conf = [
195
+ '_headers' => $easy->request->getHeaders(),
196
+ CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(),
197
+ CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''),
198
+ CURLOPT_RETURNTRANSFER => false,
199
+ CURLOPT_HEADER => false,
200
+ CURLOPT_CONNECTTIMEOUT => 150,
201
+ ];
202
+
203
+ if (defined('CURLOPT_PROTOCOLS')) {
204
+ $conf[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
205
+ }
206
+
207
+ $version = $easy->request->getProtocolVersion();
208
+ if ($version == 1.1) {
209
+ $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
210
+ } elseif ($version == 2.0) {
211
+ $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
212
+ } else {
213
+ $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
214
+ }
215
+
216
+ return $conf;
217
+ }
218
+
219
+ private function applyMethod(EasyHandle $easy, array &$conf)
220
+ {
221
+ $body = $easy->request->getBody();
222
+ $size = $body->getSize();
223
+
224
+ if ($size === null || $size > 0) {
225
+ $this->applyBody($easy->request, $easy->options, $conf);
226
+ return;
227
+ }
228
+
229
+ $method = $easy->request->getMethod();
230
+ if ($method === 'PUT' || $method === 'POST') {
231
+ // See http://tools.ietf.org/html/rfc7230#section-3.3.2
232
+ if (!$easy->request->hasHeader('Content-Length')) {
233
+ $conf[CURLOPT_HTTPHEADER][] = 'Content-Length: 0';
234
+ }
235
+ } elseif ($method === 'HEAD') {
236
+ $conf[CURLOPT_NOBODY] = true;
237
+ unset(
238
+ $conf[CURLOPT_WRITEFUNCTION],
239
+ $conf[CURLOPT_READFUNCTION],
240
+ $conf[CURLOPT_FILE],
241
+ $conf[CURLOPT_INFILE]
242
+ );
243
+ }
244
+ }
245
+
246
+ private function applyBody(RequestInterface $request, array $options, array &$conf)
247
+ {
248
+ $size = $request->hasHeader('Content-Length')
249
+ ? (int) $request->getHeaderLine('Content-Length')
250
+ : null;
251
+
252
+ // Send the body as a string if the size is less than 1MB OR if the
253
+ // [curl][body_as_string] request value is set.
254
+ if (($size !== null && $size < 1000000) ||
255
+ !empty($options['_body_as_string'])
256
+ ) {
257
+ $conf[CURLOPT_POSTFIELDS] = (string) $request->getBody();
258
+ // Don't duplicate the Content-Length header
259
+ $this->removeHeader('Content-Length', $conf);
260
+ $this->removeHeader('Transfer-Encoding', $conf);
261
+ } else {
262
+ $conf[CURLOPT_UPLOAD] = true;
263
+ if ($size !== null) {
264
+ $conf[CURLOPT_INFILESIZE] = $size;
265
+ $this->removeHeader('Content-Length', $conf);
266
+ }
267
+ $body = $request->getBody();
268
+ if ($body->isSeekable()) {
269
+ $body->rewind();
270
+ }
271
+ $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) {
272
+ return $body->read($length);
273
+ };
274
+ }
275
+
276
+ // If the Expect header is not present, prevent curl from adding it
277
+ if (!$request->hasHeader('Expect')) {
278
+ $conf[CURLOPT_HTTPHEADER][] = 'Expect:';
279
+ }
280
+
281
+ // cURL sometimes adds a content-type by default. Prevent this.
282
+ if (!$request->hasHeader('Content-Type')) {
283
+ $conf[CURLOPT_HTTPHEADER][] = 'Content-Type:';
284
+ }
285
+ }
286
+
287
+ private function applyHeaders(EasyHandle $easy, array &$conf)
288
+ {
289
+ foreach ($conf['_headers'] as $name => $values) {
290
+ foreach ($values as $value) {
291
+ $conf[CURLOPT_HTTPHEADER][] = "$name: $value";
292
+ }
293
+ }
294
+
295
+ // Remove the Accept header if one was not set
296
+ if (!$easy->request->hasHeader('Accept')) {
297
+ $conf[CURLOPT_HTTPHEADER][] = 'Accept:';
298
+ }
299
+ }
300
+
301
+ /**
302
+ * Remove a header from the options array.
303
+ *
304
+ * @param string $name Case-insensitive header to remove
305
+ * @param array $options Array of options to modify
306
+ */
307
+ private function removeHeader($name, array &$options)
308
+ {
309
+ foreach (array_keys($options['_headers']) as $key) {
310
+ if (!strcasecmp($key, $name)) {
311
+ unset($options['_headers'][$key]);
312
+ return;
313
+ }
314
+ }
315
+ }
316
+
317
+ private function applyHandlerOptions(EasyHandle $easy, array &$conf)
318
+ {
319
+ $options = $easy->options;
320
+ if (isset($options['verify'])) {
321
+ if ($options['verify'] === false) {
322
+ unset($conf[CURLOPT_CAINFO]);
323
+ $conf[CURLOPT_SSL_VERIFYHOST] = 0;
324
+ $conf[CURLOPT_SSL_VERIFYPEER] = false;
325
+ } else {
326
+ $conf[CURLOPT_SSL_VERIFYHOST] = 2;
327
+ $conf[CURLOPT_SSL_VERIFYPEER] = true;
328
+ if (is_string($options['verify'])) {
329
+ $conf[CURLOPT_CAINFO] = $options['verify'];
330
+ if (!file_exists($options['verify'])) {
331
+ throw new \InvalidArgumentException(
332
+ "SSL CA bundle not found: {$options['verify']}"
333
+ );
334
+ }
335
+ }
336
+ }
337
+ }
338
+
339
+ if (!empty($options['decode_content'])) {
340
+ $accept = $easy->request->getHeaderLine('Accept-Encoding');
341
+ if ($accept) {
342
+ $conf[CURLOPT_ENCODING] = $accept;
343
+ } else {
344
+ $conf[CURLOPT_ENCODING] = '';
345
+ // Don't let curl send the header over the wire
346
+ $conf[CURLOPT_HTTPHEADER][] = 'Accept-Encoding:';
347
+ }
348
+ }
349
+
350
+ if (isset($options['sink'])) {
351
+ $sink = $options['sink'];
352
+ if (!is_string($sink)) {
353
+ $sink = \GuzzleHttp\Psr7\stream_for($sink);
354
+ } elseif (!is_dir(dirname($sink))) {
355
+ // Ensure that the directory exists before failing in curl.
356
+ throw new \RuntimeException(sprintf(
357
+ 'Directory %s does not exist for sink value of %s',
358
+ dirname($sink),
359
+ $sink
360
+ ));
361
+ } else {
362
+ $sink = new LazyOpenStream($sink, 'w+');
363
+ }
364
+ $easy->sink = $sink;
365
+ $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use ($sink) {
366
+ return $sink->write($write);
367
+ };
368
+ } else {
369
+ // Use a default temp stream if no sink was set.
370
+ $conf[CURLOPT_FILE] = fopen('php://temp', 'w+');
371
+ $easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]);
372
+ }
373
+
374
+ if (isset($options['timeout'])) {
375
+ $conf[CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000;
376
+ }
377
+
378
+ if (isset($options['connect_timeout'])) {
379
+ $conf[CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000;
380
+ }
381
+
382
+ if (isset($options['proxy'])) {
383
+ if (!is_array($options['proxy'])) {
384
+ $conf[CURLOPT_PROXY] = $options['proxy'];
385
+ } else {
386
+ $scheme = $easy->request->getUri()->getScheme();
387
+ if (isset($options['proxy'][$scheme])) {
388
+ $host = $easy->request->getUri()->getHost();
389
+ if (!isset($options['proxy']['no']) ||
390
+ !\GuzzleHttp\is_host_in_noproxy($host, $options['proxy']['no'])
391
+ ) {
392
+ $conf[CURLOPT_PROXY] = $options['proxy'][$scheme];
393
+ }
394
+ }
395
+ }
396
+ }
397
+
398
+ if (isset($options['cert'])) {
399
+ $cert = $options['cert'];
400
+ if (is_array($cert)) {
401
+ $conf[CURLOPT_SSLCERTPASSWD] = $cert[1];
402
+ $cert = $cert[0];
403
+ }
404
+ if (!file_exists($cert)) {
405
+ throw new \InvalidArgumentException(
406
+ "SSL certificate not found: {$cert}"
407
+ );
408
+ }
409
+ $conf[CURLOPT_SSLCERT] = $cert;
410
+ }
411
+
412
+ if (isset($options['ssl_key'])) {
413
+ $sslKey = $options['ssl_key'];
414
+ if (is_array($sslKey)) {
415
+ $conf[CURLOPT_SSLKEYPASSWD] = $sslKey[1];
416
+ $sslKey = $sslKey[0];
417
+ }
418
+ if (!file_exists($sslKey)) {
419
+ throw new \InvalidArgumentException(
420
+ "SSL private key not found: {$sslKey}"
421
+ );
422
+ }
423
+ $conf[CURLOPT_SSLKEY] = $sslKey;
424
+ }
425
+
426
+ if (isset($options['progress'])) {
427
+ $progress = $options['progress'];
428
+ if (!is_callable($progress)) {
429
+ throw new \InvalidArgumentException(
430
+ 'progress client option must be callable'
431
+ );
432
+ }
433
+ $conf[CURLOPT_NOPROGRESS] = false;
434
+ $conf[CURLOPT_PROGRESSFUNCTION] = function () use ($progress) {
435
+ $args = func_get_args();
436
+ // PHP 5.5 pushed the handle onto the start of the args
437
+ if (is_resource($args[0])) {
438
+ array_shift($args);
439
+ }
440
+ call_user_func_array($progress, $args);
441
+ };
442
+ }
443
+
444
+ if (!empty($options['debug'])) {
445
+ $conf[CURLOPT_STDERR] = \GuzzleHttp\debug_resource($options['debug']);
446
+ $conf[CURLOPT_VERBOSE] = true;
447
+ }
448
+ }
449
+
450
+ /**
451
+ * This function ensures that a response was set on a transaction. If one
452
+ * was not set, then the request is retried if possible. This error
453
+ * typically means you are sending a payload, curl encountered a
454
+ * "Connection died, retrying a fresh connect" error, tried to rewind the
455
+ * stream, and then encountered a "necessary data rewind wasn't possible"
456
+ * error, causing the request to be sent through curl_multi_info_read()
457
+ * without an error status.
458
+ */
459
+ private static function retryFailedRewind(
460
+ callable $handler,
461
+ EasyHandle $easy,
462
+ array $ctx
463
+ ) {
464
+ try {
465
+ // Only rewind if the body has been read from.
466
+ $body = $easy->request->getBody();
467
+ if ($body->tell() > 0) {
468
+ $body->rewind();
469
+ }
470
+ } catch (\RuntimeException $e) {
471
+ $ctx['error'] = 'The connection unexpectedly failed without '
472
+ . 'providing an error. The request would have been retried, '
473
+ . 'but attempting to rewind the request body failed. '
474
+ . 'Exception: ' . $e;
475
+ return self::createRejection($easy, $ctx);
476
+ }
477
+
478
+ // Retry no more than 3 times before giving up.
479
+ if (!isset($easy->options['_curl_retries'])) {
480
+ $easy->options['_curl_retries'] = 1;
481
+ } elseif ($easy->options['_curl_retries'] == 2) {
482
+ $ctx['error'] = 'The cURL request was retried 3 times '
483
+ . 'and did not succeed. The most likely reason for the failure '
484
+ . 'is that cURL was unable to rewind the body of the request '
485
+ . 'and subsequent retries resulted in the same error. Turn on '
486
+ . 'the debug option to see what went wrong. See '
487
+ . 'https://bugs.php.net/bug.php?id=47204 for more information.';
488
+ return self::createRejection($easy, $ctx);
489
+ } else {
490
+ $easy->options['_curl_retries']++;
491
+ }
492
+
493
+ return $handler($easy->request, $easy->options);
494
+ }
495
+
496
+ private function createHeaderFn(EasyHandle $easy)
497
+ {
498
+ if (isset($easy->options['on_headers'])) {
499
+ $onHeaders = $easy->options['on_headers'];
500
+
501
+ if (!is_callable($onHeaders)) {
502
+ throw new \InvalidArgumentException('on_headers must be callable');
503
+ }
504
+ } else {
505
+ $onHeaders = null;
506
+ }
507
+
508
+ return function ($ch, $h) use (
509
+ $onHeaders,
510
+ $easy,
511
+ &$startingResponse
512
+ ) {
513
+ $value = trim($h);
514
+ if ($value === '') {
515
+ $startingResponse = true;
516
+ $easy->createResponse();
517
+ if ($onHeaders !== null) {
518
+ try {
519
+ $onHeaders($easy->response);
520
+ } catch (\Exception $e) {
521
+ // Associate the exception with the handle and trigger
522
+ // a curl header write error by returning 0.
523
+ $easy->onHeadersException = $e;
524
+ return -1;
525
+ }
526
+ }
527
+ } elseif ($startingResponse) {
528
+ $startingResponse = false;
529
+ $easy->headers = [$value];
530
+ } else {
531
+ $easy->headers[] = $value;
532
+ }
533
+ return strlen($h);
534
+ };
535
+ }
536
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Handler;
3
+
4
+ use Psr\Http\Message\RequestInterface;
5
+
6
+ interface CurlFactoryInterface
7
+ {
8
+ /**
9
+ * Creates a cURL handle resource.
10
+ *
11
+ * @param RequestInterface $request Request
12
+ * @param array $options Transfer options
13
+ *
14
+ * @return EasyHandle
15
+ * @throws \RuntimeException when an option cannot be applied
16
+ */
17
+ public function create(RequestInterface $request, array $options);
18
+
19
+ /**
20
+ * Release an easy handle, allowing it to be reused or closed.
21
+ *
22
+ * This function must call unset on the easy handle's "handle" property.
23
+ *
24
+ * @param EasyHandle $easy
25
+ */
26
+ public function release(EasyHandle $easy);
27
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Handler;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use Psr\Http\Message\RequestInterface;
6
+
7
+ /**
8
+ * HTTP handler that uses cURL easy handles as a transport layer.
9
+ *
10
+ * When using the CurlHandler, custom curl options can be specified as an
11
+ * associative array of curl option constants mapping to values in the
12
+ * **curl** key of the "client" key of the request.
13
+ */
14
+ class CurlHandler
15
+ {
16
+ /** @var CurlFactoryInterface */
17
+ private $factory;
18
+
19
+ /**
20
+ * Accepts an associative array of options:
21
+ *
22
+ * - factory: Optional curl factory used to create cURL handles.
23
+ *
24
+ * @param array $options Array of options to use with the handler
25
+ */
26
+ public function __construct(array $options = [])
27
+ {
28
+ $this->factory = isset($options['handle_factory'])
29
+ ? $options['handle_factory']
30
+ : new CurlFactory(3);
31
+ }
32
+
33
+ public function __invoke(RequestInterface $request, array $options)
34
+ {
35
+ if (isset($options['delay'])) {
36
+ usleep($options['delay'] * 1000);
37
+ }
38
+
39
+ $easy = $this->factory->create($request, $options);
40
+ curl_exec($easy->handle);
41
+ $easy->errno = curl_errno($easy->handle);
42
+
43
+ return CurlFactory::finish($this, $easy, $this->factory);
44
+ }
45
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Handler;
3
+
4
+ use GuzzleHttp\Promise as P;
5
+ use GuzzleHttp\Promise\Promise;
6
+ use GuzzleHttp\Psr7;
7
+ use Psr\Http\Message\RequestInterface;
8
+
9
+ /**
10
+ * Returns an asynchronous response using curl_multi_* functions.
11
+ *
12
+ * When using the CurlMultiHandler, custom curl options can be specified as an
13
+ * associative array of curl option constants mapping to values in the
14
+ * **curl** key of the provided request options.
15
+ *
16
+ * @property resource $_mh Internal use only. Lazy loaded multi-handle.
17
+ */
18
+ class CurlMultiHandler
19
+ {
20
+ /** @var CurlFactoryInterface */
21
+ private $factory;
22
+ private $selectTimeout;
23
+ private $active;
24
+ private $handles = [];
25
+ private $delays = [];
26
+
27
+ /**
28
+ * This handler accepts the following options:
29
+ *
30
+ * - handle_factory: An optional factory used to create curl handles
31
+ * - select_timeout: Optional timeout (in seconds) to block before timing
32
+ * out while selecting curl handles. Defaults to 1 second.
33
+ *
34
+ * @param array $options
35
+ */
36
+ public function __construct(array $options = [])
37
+ {
38
+ $this->factory = isset($options['handle_factory'])
39
+ ? $options['handle_factory'] : new CurlFactory(50);
40
+ $this->selectTimeout = isset($options['select_timeout'])
41
+ ? $options['select_timeout'] : 1;
42
+ }
43
+
44
+ public function __get($name)
45
+ {
46
+ if ($name === '_mh') {
47
+ return $this->_mh = curl_multi_init();
48
+ }
49
+
50
+ throw new \BadMethodCallException();
51
+ }
52
+
53
+ public function __destruct()
54
+ {
55
+ if (isset($this->_mh)) {
56
+ curl_multi_close($this->_mh);
57
+ unset($this->_mh);
58
+ }
59
+ }
60
+
61
+ public function __invoke(RequestInterface $request, array $options)
62
+ {
63
+ $easy = $this->factory->create($request, $options);
64
+ $id = (int) $easy->handle;
65
+
66
+ $promise = new Promise(
67
+ [$this, 'execute'],
68
+ function () use ($id) { return $this->cancel($id); }
69
+ );
70
+
71
+ $this->addRequest(['easy' => $easy, 'deferred' => $promise]);
72
+
73
+ return $promise;
74
+ }
75
+
76
+ /**
77
+ * Ticks the curl event loop.
78
+ */
79
+ public function tick()
80
+ {
81
+ // Add any delayed handles if needed.
82
+ if ($this->delays) {
83
+ $currentTime = microtime(true);
84
+ foreach ($this->delays as $id => $delay) {
85
+ if ($currentTime >= $delay) {
86
+ unset($this->delays[$id]);
87
+ curl_multi_add_handle(
88
+ $this->_mh,
89
+ $this->handles[$id]['easy']->handle
90
+ );
91
+ }
92
+ }
93
+ }
94
+
95
+ // Step through the task queue which may add additional requests.
96
+ P\queue()->run();
97
+
98
+ if ($this->active &&
99
+ curl_multi_select($this->_mh, $this->selectTimeout) === -1
100
+ ) {
101
+ // Perform a usleep if a select returns -1.
102
+ // See: https://bugs.php.net/bug.php?id=61141
103
+ usleep(250);
104
+ }
105
+
106
+ while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM);
107
+
108
+ $this->processMessages();
109
+ }
110
+
111
+ /**
112
+ * Runs until all outstanding connections have completed.
113
+ */
114
+ public function execute()
115
+ {
116
+ $queue = P\queue();
117
+
118
+ while ($this->handles || !$queue->isEmpty()) {
119
+ // If there are no transfers, then sleep for the next delay
120
+ if (!$this->active && $this->delays) {
121
+ usleep($this->timeToNext());
122
+ }
123
+ $this->tick();
124
+ }
125
+ }
126
+
127
+ private function addRequest(array $entry)
128
+ {
129
+ $easy = $entry['easy'];
130
+ $id = (int) $easy->handle;
131
+ $this->handles[$id] = $entry;
132
+ if (empty($easy->options['delay'])) {
133
+ curl_multi_add_handle($this->_mh, $easy->handle);
134
+ } else {
135
+ $this->delays[$id] = microtime(true) + ($easy->options['delay'] / 1000);
136
+ }
137
+ }
138
+
139
+ /**
140
+ * Cancels a handle from sending and removes references to it.
141
+ *
142
+ * @param int $id Handle ID to cancel and remove.
143
+ *
144
+ * @return bool True on success, false on failure.
145
+ */
146
+ private function cancel($id)
147
+ {
148
+ // Cannot cancel if it has been processed.
149
+ if (!isset($this->handles[$id])) {
150
+ return false;
151
+ }
152
+
153
+ $handle = $this->handles[$id]['easy']->handle;
154
+ unset($this->delays[$id], $this->handles[$id]);
155
+ curl_multi_remove_handle($this->_mh, $handle);
156
+ curl_close($handle);
157
+
158
+ return true;
159
+ }
160
+
161
+ private function processMessages()
162
+ {
163
+ while ($done = curl_multi_info_read($this->_mh)) {
164
+ $id = (int) $done['handle'];
165
+ curl_multi_remove_handle($this->_mh, $done['handle']);
166
+
167
+ if (!isset($this->handles[$id])) {
168
+ // Probably was cancelled.
169
+ continue;
170
+ }
171
+
172
+ $entry = $this->handles[$id];
173
+ unset($this->handles[$id], $this->delays[$id]);
174
+ $entry['easy']->errno = $done['result'];
175
+ $entry['deferred']->resolve(
176
+ CurlFactory::finish(
177
+ $this,
178
+ $entry['easy'],
179
+ $this->factory
180
+ )
181
+ );
182
+ }
183
+ }
184
+
185
+ private function timeToNext()
186
+ {
187
+ $currentTime = microtime(true);
188
+ $nextTime = PHP_INT_MAX;
189
+ foreach ($this->delays as $time) {
190
+ if ($time < $nextTime) {
191
+ $nextTime = $time;
192
+ }
193
+ }
194
+
195
+ return max(0, $nextTime - $currentTime) * 1000000;
196
+ }
197
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Handler;
3
+
4
+ use GuzzleHttp\Psr7\Response;
5
+ use Psr\Http\Message\RequestInterface;
6
+ use Psr\Http\Message\ResponseInterface;
7
+ use Psr\Http\Message\StreamInterface;
8
+
9
+ /**
10
+ * Represents a cURL easy handle and the data it populates.
11
+ *
12
+ * @internal
13
+ */
14
+ final class EasyHandle
15
+ {
16
+ /** @var resource cURL resource */
17
+ public $handle;
18
+
19
+ /** @var StreamInterface Where data is being written */
20
+ public $sink;
21
+
22
+ /** @var array Received HTTP headers so far */
23
+ public $headers = [];
24
+
25
+ /** @var ResponseInterface Received response (if any) */
26
+ public $response;
27
+
28
+ /** @var RequestInterface Request being sent */
29
+ public $request;
30
+
31
+ /** @var array Request options */
32
+ public $options = [];
33
+
34
+ /** @var int cURL error number (if any) */
35
+ public $errno = 0;
36
+
37
+ /** @var \Exception Exception during on_headers (if any) */
38
+ public $onHeadersException;
39
+
40
+ /**
41
+ * Attach a response to the easy handle based on the received headers.
42
+ *
43
+ * @throws \RuntimeException if no headers have been received.
44
+ */
45
+ public function createResponse()
46
+ {
47
+ if (empty($this->headers)) {
48
+ throw new \RuntimeException('No headers have been received');
49
+ }
50
+
51
+ // HTTP-version SP status-code SP reason-phrase
52
+ $startLine = explode(' ', array_shift($this->headers), 3);
53
+ $headers = \GuzzleHttp\headers_from_lines($this->headers);
54
+ $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers);
55
+
56
+ if (!empty($this->options['decode_content'])
57
+ && isset($normalizedKeys['content-encoding'])
58
+ ) {
59
+ $headers['x-encoded-content-encoding']
60
+ = $headers[$normalizedKeys['content-encoding']];
61
+ unset($headers[$normalizedKeys['content-encoding']]);
62
+ if (isset($normalizedKeys['content-length'])) {
63
+ $headers['x-encoded-content-length']
64
+ = $headers[$normalizedKeys['content-length']];
65
+
66
+ $bodyLength = (int) $this->sink->getSize();
67
+ if ($bodyLength) {
68
+ $headers[$normalizedKeys['content-length']] = $bodyLength;
69
+ } else {
70
+ unset($headers[$normalizedKeys['content-length']]);
71
+ }
72
+ }
73
+ }
74
+
75
+ // Attach a response to the easy handle with the parsed headers.
76
+ $this->response = new Response(
77
+ $startLine[1],
78
+ $headers,
79
+ $this->sink,
80
+ substr($startLine[0], 5),
81
+ isset($startLine[2]) ? (string) $startLine[2] : null
82
+ );
83
+ }
84
+
85
+ public function __get($name)
86
+ {
87
+ $msg = $name === 'handle'
88
+ ? 'The EasyHandle has been released'
89
+ : 'Invalid property: ' . $name;
90
+ throw new \BadMethodCallException($msg);
91
+ }
92
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Handler;
3
+
4
+ use GuzzleHttp\HandlerStack;
5
+ use GuzzleHttp\Promise\PromiseInterface;
6
+ use GuzzleHttp\Promise\RejectedPromise;
7
+ use GuzzleHttp\TransferStats;
8
+ use Psr\Http\Message\RequestInterface;
9
+ use Psr\Http\Message\ResponseInterface;
10
+
11
+ /**
12
+ * Handler that returns responses or throw exceptions from a queue.
13
+ */
14
+ class MockHandler implements \Countable
15
+ {
16
+ private $queue;
17
+ private $lastRequest;
18
+ private $lastOptions;
19
+ private $onFulfilled;
20
+ private $onRejected;
21
+
22
+ /**
23
+ * Creates a new MockHandler that uses the default handler stack list of
24
+ * middlewares.
25
+ *
26
+ * @param array $queue Array of responses, callables, or exceptions.
27
+ * @param callable $onFulfilled Callback to invoke when the return value is fulfilled.
28
+ * @param callable $onRejected Callback to invoke when the return value is rejected.
29
+ *
30
+ * @return HandlerStack
31
+ */
32
+ public static function createWithMiddleware(
33
+ array $queue = null,
34
+ callable $onFulfilled = null,
35
+ callable $onRejected = null
36
+ ) {
37
+ return HandlerStack::create(new self($queue, $onFulfilled, $onRejected));
38
+ }
39
+
40
+ /**
41
+ * The passed in value must be an array of
42
+ * {@see Psr7\Http\Message\ResponseInterface} objects, Exceptions,
43
+ * callables, or Promises.
44
+ *
45
+ * @param array $queue
46
+ * @param callable $onFulfilled Callback to invoke when the return value is fulfilled.
47
+ * @param callable $onRejected Callback to invoke when the return value is rejected.
48
+ */
49
+ public function __construct(
50
+ array $queue = null,
51
+ callable $onFulfilled = null,
52
+ callable $onRejected = null
53
+ ) {
54
+ $this->onFulfilled = $onFulfilled;
55
+ $this->onRejected = $onRejected;
56
+
57
+ if ($queue) {
58
+ call_user_func_array([$this, 'append'], $queue);
59
+ }
60
+ }
61
+
62
+ public function __invoke(RequestInterface $request, array $options)
63
+ {
64
+ if (!$this->queue) {
65
+ throw new \OutOfBoundsException('Mock queue is empty');
66
+ }
67
+
68
+ if (isset($options['delay'])) {
69
+ usleep($options['delay'] * 1000);
70
+ }
71
+
72
+ $this->lastRequest = $request;
73
+ $this->lastOptions = $options;
74
+ $response = array_shift($this->queue);
75
+
76
+ if (is_callable($response)) {
77
+ $response = call_user_func($response, $request, $options);
78
+ }
79
+
80
+ $response = $response instanceof \Exception
81
+ ? new RejectedPromise($response)
82
+ : \GuzzleHttp\Promise\promise_for($response);
83
+
84
+ return $response->then(
85
+ function ($value) use ($request, $options) {
86
+ $this->invokeStats($request, $options, $value);
87
+ if ($this->onFulfilled) {
88
+ call_user_func($this->onFulfilled, $value);
89
+ }
90
+ if (isset($options['sink'])) {
91
+ $contents = (string) $value->getBody();
92
+ $sink = $options['sink'];
93
+
94
+ if (is_resource($sink)) {
95
+ fwrite($sink, $contents);
96
+ } elseif (is_string($sink)) {
97
+ file_put_contents($sink, $contents);
98
+ } elseif ($sink instanceof \Psr\Http\Message\StreamInterface) {
99
+ $sink->write($contents);
100
+ }
101
+ }
102
+
103
+ return $value;
104
+ },
105
+ function ($reason) use ($request, $options) {
106
+ $this->invokeStats($request, $options, null, $reason);
107
+ if ($this->onRejected) {
108
+ call_user_func($this->onRejected, $reason);
109
+ }
110
+ return new RejectedPromise($reason);
111
+ }
112
+ );
113
+ }
114
+
115
+ /**
116
+ * Adds one or more variadic requests, exceptions, callables, or promises
117
+ * to the queue.
118
+ */
119
+ public function append()
120
+ {
121
+ foreach (func_get_args() as $value) {
122
+ if ($value instanceof ResponseInterface
123
+ || $value instanceof \Exception
124
+ || $value instanceof PromiseInterface
125
+ || is_callable($value)
126
+ ) {
127
+ $this->queue[] = $value;
128
+ } else {
129
+ throw new \InvalidArgumentException('Expected a response or '
130
+ . 'exception. Found ' . \GuzzleHttp\describe_type($value));
131
+ }
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Get the last received request.
137
+ *
138
+ * @return RequestInterface
139
+ */
140
+ public function getLastRequest()
141
+ {
142
+ return $this->lastRequest;
143
+ }
144
+
145
+ /**
146
+ * Get the last received request options.
147
+ *
148
+ * @return RequestInterface
149
+ */
150
+ public function getLastOptions()
151
+ {
152
+ return $this->lastOptions;
153
+ }
154
+
155
+ /**
156
+ * Returns the number of remaining items in the queue.
157
+ *
158
+ * @return int
159
+ */
160
+ public function count()
161
+ {
162
+ return count($this->queue);
163
+ }
164
+
165
+ private function invokeStats(
166
+ RequestInterface $request,
167
+ array $options,
168
+ ResponseInterface $response = null,
169
+ $reason = null
170
+ ) {
171
+ if (isset($options['on_stats'])) {
172
+ $stats = new TransferStats($request, $response, 0, $reason);
173
+ call_user_func($options['on_stats'], $stats);
174
+ }
175
+ }
176
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Handler;
3
+
4
+ use GuzzleHttp\RequestOptions;
5
+ use Psr\Http\Message\RequestInterface;
6
+
7
+ /**
8
+ * Provides basic proxies for handlers.
9
+ */
10
+ class Proxy
11
+ {
12
+ /**
13
+ * Sends synchronous requests to a specific handler while sending all other
14
+ * requests to another handler.
15
+ *
16
+ * @param callable $default Handler used for normal responses
17
+ * @param callable $sync Handler used for synchronous responses.
18
+ *
19
+ * @return callable Returns the composed handler.
20
+ */
21
+ public static function wrapSync(
22
+ callable $default,
23
+ callable $sync
24
+ ) {
25
+ return function (RequestInterface $request, array $options) use ($default, $sync) {
26
+ return empty($options[RequestOptions::SYNCHRONOUS])
27
+ ? $default($request, $options)
28
+ : $sync($request, $options);
29
+ };
30
+ }
31
+
32
+ /**
33
+ * Sends streaming requests to a streaming compatible handler while sending
34
+ * all other requests to a default handler.
35
+ *
36
+ * This, for example, could be useful for taking advantage of the
37
+ * performance benefits of curl while still supporting true streaming
38
+ * through the StreamHandler.
39
+ *
40
+ * @param callable $default Handler used for non-streaming responses
41
+ * @param callable $streaming Handler used for streaming responses
42
+ *
43
+ * @return callable Returns the composed handler.
44
+ */
45
+ public static function wrapStreaming(
46
+ callable $default,
47
+ callable $streaming
48
+ ) {
49
+ return function (RequestInterface $request, array $options) use ($default, $streaming) {
50
+ return empty($options['stream'])
51
+ ? $default($request, $options)
52
+ : $streaming($request, $options);
53
+ };
54
+ }
55
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php ADDED
@@ -0,0 +1,490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Handler;
3
+
4
+ use GuzzleHttp\Exception\RequestException;
5
+ use GuzzleHttp\Exception\ConnectException;
6
+ use GuzzleHttp\Promise\FulfilledPromise;
7
+ use GuzzleHttp\Promise\RejectedPromise;
8
+ use GuzzleHttp\Promise\PromiseInterface;
9
+ use GuzzleHttp\Psr7;
10
+ use GuzzleHttp\TransferStats;
11
+ use Psr\Http\Message\RequestInterface;
12
+ use Psr\Http\Message\ResponseInterface;
13
+ use Psr\Http\Message\StreamInterface;
14
+
15
+ /**
16
+ * HTTP handler that uses PHP's HTTP stream wrapper.
17
+ */
18
+ class StreamHandler
19
+ {
20
+ private $lastHeaders = [];
21
+
22
+ /**
23
+ * Sends an HTTP request.
24
+ *
25
+ * @param RequestInterface $request Request to send.
26
+ * @param array $options Request transfer options.
27
+ *
28
+ * @return PromiseInterface
29
+ */
30
+ public function __invoke(RequestInterface $request, array $options)
31
+ {
32
+ // Sleep if there is a delay specified.
33
+ if (isset($options['delay'])) {
34
+ usleep($options['delay'] * 1000);
35
+ }
36
+
37
+ $startTime = isset($options['on_stats']) ? microtime(true) : null;
38
+
39
+ try {
40
+ // Does not support the expect header.
41
+ $request = $request->withoutHeader('Expect');
42
+
43
+ // Append a content-length header if body size is zero to match
44
+ // cURL's behavior.
45
+ if (0 === $request->getBody()->getSize()) {
46
+ $request = $request->withHeader('Content-Length', 0);
47
+ }
48
+
49
+ return $this->createResponse(
50
+ $request,
51
+ $options,
52
+ $this->createStream($request, $options),
53
+ $startTime
54
+ );
55
+ } catch (\InvalidArgumentException $e) {
56
+ throw $e;
57
+ } catch (\Exception $e) {
58
+ // Determine if the error was a networking error.
59
+ $message = $e->getMessage();
60
+ // This list can probably get more comprehensive.
61
+ if (strpos($message, 'getaddrinfo') // DNS lookup failed
62
+ || strpos($message, 'Connection refused')
63
+ || strpos($message, "couldn't connect to host") // error on HHVM
64
+ ) {
65
+ $e = new ConnectException($e->getMessage(), $request, $e);
66
+ }
67
+ $e = RequestException::wrapException($request, $e);
68
+ $this->invokeStats($options, $request, $startTime, null, $e);
69
+
70
+ return new RejectedPromise($e);
71
+ }
72
+ }
73
+
74
+ private function invokeStats(
75
+ array $options,
76
+ RequestInterface $request,
77
+ $startTime,
78
+ ResponseInterface $response = null,
79
+ $error = null
80
+ ) {
81
+ if (isset($options['on_stats'])) {
82
+ $stats = new TransferStats(
83
+ $request,
84
+ $response,
85
+ microtime(true) - $startTime,
86
+ $error,
87
+ []
88
+ );
89
+ call_user_func($options['on_stats'], $stats);
90
+ }
91
+ }
92
+
93
+ private function createResponse(
94
+ RequestInterface $request,
95
+ array $options,
96
+ $stream,
97
+ $startTime
98
+ ) {
99
+ $hdrs = $this->lastHeaders;
100
+ $this->lastHeaders = [];
101
+ $parts = explode(' ', array_shift($hdrs), 3);
102
+ $ver = explode('/', $parts[0])[1];
103
+ $status = $parts[1];
104
+ $reason = isset($parts[2]) ? $parts[2] : null;
105
+ $headers = \GuzzleHttp\headers_from_lines($hdrs);
106
+ list ($stream, $headers) = $this->checkDecode($options, $headers, $stream);
107
+ $stream = Psr7\stream_for($stream);
108
+ $sink = $stream;
109
+
110
+ if (strcasecmp('HEAD', $request->getMethod())) {
111
+ $sink = $this->createSink($stream, $options);
112
+ }
113
+
114
+ $response = new Psr7\Response($status, $headers, $sink, $ver, $reason);
115
+
116
+ if (isset($options['on_headers'])) {
117
+ try {
118
+ $options['on_headers']($response);
119
+ } catch (\Exception $e) {
120
+ $msg = 'An error was encountered during the on_headers event';
121
+ $ex = new RequestException($msg, $request, $response, $e);
122
+ return new RejectedPromise($ex);
123
+ }
124
+ }
125
+
126
+ // Do not drain when the request is a HEAD request because they have
127
+ // no body.
128
+ if ($sink !== $stream) {
129
+ $this->drain(
130
+ $stream,
131
+ $sink,
132
+ $response->getHeaderLine('Content-Length')
133
+ );
134
+ }
135
+
136
+ $this->invokeStats($options, $request, $startTime, $response, null);
137
+
138
+ return new FulfilledPromise($response);
139
+ }
140
+
141
+ private function createSink(StreamInterface $stream, array $options)
142
+ {
143
+ if (!empty($options['stream'])) {
144
+ return $stream;
145
+ }
146
+
147
+ $sink = isset($options['sink'])
148
+ ? $options['sink']
149
+ : fopen('php://temp', 'r+');
150
+
151
+ return is_string($sink)
152
+ ? new Psr7\LazyOpenStream($sink, 'w+')
153
+ : Psr7\stream_for($sink);
154
+ }
155
+
156
+ private function checkDecode(array $options, array $headers, $stream)
157
+ {
158
+ // Automatically decode responses when instructed.
159
+ if (!empty($options['decode_content'])) {
160
+ $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers);
161
+ if (isset($normalizedKeys['content-encoding'])) {
162
+ $encoding = $headers[$normalizedKeys['content-encoding']];
163
+ if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') {
164
+ $stream = new Psr7\InflateStream(
165
+ Psr7\stream_for($stream)
166
+ );
167
+ $headers['x-encoded-content-encoding']
168
+ = $headers[$normalizedKeys['content-encoding']];
169
+ // Remove content-encoding header
170
+ unset($headers[$normalizedKeys['content-encoding']]);
171
+ // Fix content-length header
172
+ if (isset($normalizedKeys['content-length'])) {
173
+ $headers['x-encoded-content-length']
174
+ = $headers[$normalizedKeys['content-length']];
175
+
176
+ $length = (int) $stream->getSize();
177
+ if ($length === 0) {
178
+ unset($headers[$normalizedKeys['content-length']]);
179
+ } else {
180
+ $headers[$normalizedKeys['content-length']] = [$length];
181
+ }
182
+ }
183
+ }
184
+ }
185
+ }
186
+
187
+ return [$stream, $headers];
188
+ }
189
+
190
+ /**
191
+ * Drains the source stream into the "sink" client option.
192
+ *
193
+ * @param StreamInterface $source
194
+ * @param StreamInterface $sink
195
+ * @param string $contentLength Header specifying the amount of
196
+ * data to read.
197
+ *
198
+ * @return StreamInterface
199
+ * @throws \RuntimeException when the sink option is invalid.
200
+ */
201
+ private function drain(
202
+ StreamInterface $source,
203
+ StreamInterface $sink,
204
+ $contentLength
205
+ ) {
206
+ // If a content-length header is provided, then stop reading once
207
+ // that number of bytes has been read. This can prevent infinitely
208
+ // reading from a stream when dealing with servers that do not honor
209
+ // Connection: Close headers.
210
+ Psr7\copy_to_stream(
211
+ $source,
212
+ $sink,
213
+ (strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1
214
+ );
215
+
216
+ $sink->seek(0);
217
+ $source->close();
218
+
219
+ return $sink;
220
+ }
221
+
222
+ /**
223
+ * Create a resource and check to ensure it was created successfully
224
+ *
225
+ * @param callable $callback Callable that returns stream resource
226
+ *
227
+ * @return resource
228
+ * @throws \RuntimeException on error
229
+ */
230
+ private function createResource(callable $callback)
231
+ {
232
+ $errors = null;
233
+ set_error_handler(function ($_, $msg, $file, $line) use (&$errors) {
234
+ $errors[] = [
235
+ 'message' => $msg,
236
+ 'file' => $file,
237
+ 'line' => $line
238
+ ];
239
+ return true;
240
+ });
241
+
242
+ $resource = $callback();
243
+ restore_error_handler();
244
+
245
+ if (!$resource) {
246
+ $message = 'Error creating resource: ';
247
+ foreach ($errors as $err) {
248
+ foreach ($err as $key => $value) {
249
+ $message .= "[$key] $value" . PHP_EOL;
250
+ }
251
+ }
252
+ throw new \RuntimeException(trim($message));
253
+ }
254
+
255
+ return $resource;
256
+ }
257
+
258
+ private function createStream(RequestInterface $request, array $options)
259
+ {
260
+ static $methods;
261
+ if (!$methods) {
262
+ $methods = array_flip(get_class_methods(__CLASS__));
263
+ }
264
+
265
+ // HTTP/1.1 streams using the PHP stream wrapper require a
266
+ // Connection: close header
267
+ if ($request->getProtocolVersion() == '1.1'
268
+ && !$request->hasHeader('Connection')
269
+ ) {
270
+ $request = $request->withHeader('Connection', 'close');
271
+ }
272
+
273
+ // Ensure SSL is verified by default
274
+ if (!isset($options['verify'])) {
275
+ $options['verify'] = true;
276
+ }
277
+
278
+ $params = [];
279
+ $context = $this->getDefaultContext($request, $options);
280
+
281
+ if (isset($options['on_headers']) && !is_callable($options['on_headers'])) {
282
+ throw new \InvalidArgumentException('on_headers must be callable');
283
+ }
284
+
285
+ if (!empty($options)) {
286
+ foreach ($options as $key => $value) {
287
+ $method = "add_{$key}";
288
+ if (isset($methods[$method])) {
289
+ $this->{$method}($request, $context, $value, $params);
290
+ }
291
+ }
292
+ }
293
+
294
+ if (isset($options['stream_context'])) {
295
+ if (!is_array($options['stream_context'])) {
296
+ throw new \InvalidArgumentException('stream_context must be an array');
297
+ }
298
+ $context = array_replace_recursive(
299
+ $context,
300
+ $options['stream_context']
301
+ );
302
+ }
303
+
304
+ $context = $this->createResource(
305
+ function () use ($context, $params) {
306
+ return stream_context_create($context, $params);
307
+ }
308
+ );
309
+
310
+ return $this->createResource(
311
+ function () use ($request, &$http_response_header, $context) {
312
+ $resource = fopen((string) $request->getUri()->withFragment(''), 'r', null, $context);
313
+ $this->lastHeaders = $http_response_header;
314
+ return $resource;
315
+ }
316
+ );
317
+ }
318
+
319
+ private function getDefaultContext(RequestInterface $request)
320
+ {
321
+ $headers = '';
322
+ foreach ($request->getHeaders() as $name => $value) {
323
+ foreach ($value as $val) {
324
+ $headers .= "$name: $val\r\n";
325
+ }
326
+ }
327
+
328
+ $context = [
329
+ 'http' => [
330
+ 'method' => $request->getMethod(),
331
+ 'header' => $headers,
332
+ 'protocol_version' => $request->getProtocolVersion(),
333
+ 'ignore_errors' => true,
334
+ 'follow_location' => 0,
335
+ ],
336
+ ];
337
+
338
+ $body = (string) $request->getBody();
339
+
340
+ if (!empty($body)) {
341
+ $context['http']['content'] = $body;
342
+ // Prevent the HTTP handler from adding a Content-Type header.
343
+ if (!$request->hasHeader('Content-Type')) {
344
+ $context['http']['header'] .= "Content-Type:\r\n";
345
+ }
346
+ }
347
+
348
+ $context['http']['header'] = rtrim($context['http']['header']);
349
+
350
+ return $context;
351
+ }
352
+
353
+ private function add_proxy(RequestInterface $request, &$options, $value, &$params)
354
+ {
355
+ if (!is_array($value)) {
356
+ $options['http']['proxy'] = $value;
357
+ } else {
358
+ $scheme = $request->getUri()->getScheme();
359
+ if (isset($value[$scheme])) {
360
+ if (!isset($value['no'])
361
+ || !\GuzzleHttp\is_host_in_noproxy(
362
+ $request->getUri()->getHost(),
363
+ $value['no']
364
+ )
365
+ ) {
366
+ $options['http']['proxy'] = $value[$scheme];
367
+ }
368
+ }
369
+ }
370
+ }
371
+
372
+ private function add_timeout(RequestInterface $request, &$options, $value, &$params)
373
+ {
374
+ if ($value > 0) {
375
+ $options['http']['timeout'] = $value;
376
+ }
377
+ }
378
+
379
+ private function add_verify(RequestInterface $request, &$options, $value, &$params)
380
+ {
381
+ if ($value === true) {
382
+ // PHP 5.6 or greater will find the system cert by default. When
383
+ // < 5.6, use the Guzzle bundled cacert.
384
+ if (PHP_VERSION_ID < 50600) {
385
+ $options['ssl']['cafile'] = \GuzzleHttp\default_ca_bundle();
386
+ }
387
+ } elseif (is_string($value)) {
388
+ $options['ssl']['cafile'] = $value;
389
+ if (!file_exists($value)) {
390
+ throw new \RuntimeException("SSL CA bundle not found: $value");
391
+ }
392
+ } elseif ($value === false) {
393
+ $options['ssl']['verify_peer'] = false;
394
+ $options['ssl']['verify_peer_name'] = false;
395
+ return;
396
+ } else {
397
+ throw new \InvalidArgumentException('Invalid verify request option');
398
+ }
399
+
400
+ $options['ssl']['verify_peer'] = true;
401
+ $options['ssl']['verify_peer_name'] = true;
402
+ $options['ssl']['allow_self_signed'] = false;
403
+ }
404
+
405
+ private function add_cert(RequestInterface $request, &$options, $value, &$params)
406
+ {
407
+ if (is_array($value)) {
408
+ $options['ssl']['passphrase'] = $value[1];
409
+ $value = $value[0];
410
+ }
411
+
412
+ if (!file_exists($value)) {
413
+ throw new \RuntimeException("SSL certificate not found: {$value}");
414
+ }
415
+
416
+ $options['ssl']['local_cert'] = $value;
417
+ }
418
+
419
+ private function add_progress(RequestInterface $request, &$options, $value, &$params)
420
+ {
421
+ $this->addNotification(
422
+ $params,
423
+ function ($code, $a, $b, $c, $transferred, $total) use ($value) {
424
+ if ($code == STREAM_NOTIFY_PROGRESS) {
425
+ $value($total, $transferred, null, null);
426
+ }
427
+ }
428
+ );
429
+ }
430
+
431
+ private function add_debug(RequestInterface $request, &$options, $value, &$params)
432
+ {
433
+ if ($value === false) {
434
+ return;
435
+ }
436
+
437
+ static $map = [
438
+ STREAM_NOTIFY_CONNECT => 'CONNECT',
439
+ STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED',
440
+ STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT',
441
+ STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS',
442
+ STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS',
443
+ STREAM_NOTIFY_REDIRECTED => 'REDIRECTED',
444
+ STREAM_NOTIFY_PROGRESS => 'PROGRESS',
445
+ STREAM_NOTIFY_FAILURE => 'FAILURE',
446
+ STREAM_NOTIFY_COMPLETED => 'COMPLETED',
447
+ STREAM_NOTIFY_RESOLVE => 'RESOLVE',
448
+ ];
449
+ static $args = ['severity', 'message', 'message_code',
450
+ 'bytes_transferred', 'bytes_max'];
451
+
452
+ $value = \GuzzleHttp\debug_resource($value);
453
+ $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment('');
454
+ $this->addNotification(
455
+ $params,
456
+ function () use ($ident, $value, $map, $args) {
457
+ $passed = func_get_args();
458
+ $code = array_shift($passed);
459
+ fprintf($value, '<%s> [%s] ', $ident, $map[$code]);
460
+ foreach (array_filter($passed) as $i => $v) {
461
+ fwrite($value, $args[$i] . ': "' . $v . '" ');
462
+ }
463
+ fwrite($value, "\n");
464
+ }
465
+ );
466
+ }
467
+
468
+ private function addNotification(array &$params, callable $notify)
469
+ {
470
+ // Wrap the existing function if needed.
471
+ if (!isset($params['notification'])) {
472
+ $params['notification'] = $notify;
473
+ } else {
474
+ $params['notification'] = $this->callArray([
475
+ $params['notification'],
476
+ $notify
477
+ ]);
478
+ }
479
+ }
480
+
481
+ private function callArray(array $functions)
482
+ {
483
+ return function () use ($functions) {
484
+ $args = func_get_args();
485
+ foreach ($functions as $fn) {
486
+ call_user_func_array($fn, $args);
487
+ }
488
+ };
489
+ }
490
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/HandlerStack.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use Psr\Http\Message\RequestInterface;
5
+
6
+ /**
7
+ * Creates a composed Guzzle handler function by stacking middlewares on top of
8
+ * an HTTP handler function.
9
+ */
10
+ class HandlerStack
11
+ {
12
+ /** @var callable */
13
+ private $handler;
14
+
15
+ /** @var array */
16
+ private $stack = [];
17
+
18
+ /** @var callable|null */
19
+ private $cached;
20
+
21
+ /**
22
+ * Creates a default handler stack that can be used by clients.
23
+ *
24
+ * The returned handler will wrap the provided handler or use the most
25
+ * appropriate default handler for you system. The returned HandlerStack has
26
+ * support for cookies, redirects, HTTP error exceptions, and preparing a body
27
+ * before sending.
28
+ *
29
+ * The returned handler stack can be passed to a client in the "handler"
30
+ * option.
31
+ *
32
+ * @param callable $handler HTTP handler function to use with the stack. If no
33
+ * handler is provided, the best handler for your
34
+ * system will be utilized.
35
+ *
36
+ * @return HandlerStack
37
+ */
38
+ public static function create(callable $handler = null)
39
+ {
40
+ $stack = new self($handler ?: choose_handler());
41
+ $stack->push(Middleware::httpErrors(), 'http_errors');
42
+ $stack->push(Middleware::redirect(), 'allow_redirects');
43
+ $stack->push(Middleware::cookies(), 'cookies');
44
+ $stack->push(Middleware::prepareBody(), 'prepare_body');
45
+
46
+ return $stack;
47
+ }
48
+
49
+ /**
50
+ * @param callable $handler Underlying HTTP handler.
51
+ */
52
+ public function __construct(callable $handler = null)
53
+ {
54
+ $this->handler = $handler;
55
+ }
56
+
57
+ /**
58
+ * Invokes the handler stack as a composed handler
59
+ *
60
+ * @param RequestInterface $request
61
+ * @param array $options
62
+ */
63
+ public function __invoke(RequestInterface $request, array $options)
64
+ {
65
+ $handler = $this->resolve();
66
+
67
+ return $handler($request, $options);
68
+ }
69
+
70
+ /**
71
+ * Dumps a string representation of the stack.
72
+ *
73
+ * @return string
74
+ */
75
+ public function __toString()
76
+ {
77
+ $depth = 0;
78
+ $stack = [];
79
+ if ($this->handler) {
80
+ $stack[] = "0) Handler: " . $this->debugCallable($this->handler);
81
+ }
82
+
83
+ $result = '';
84
+ foreach (array_reverse($this->stack) as $tuple) {
85
+ $depth++;
86
+ $str = "{$depth}) Name: '{$tuple[1]}', ";
87
+ $str .= "Function: " . $this->debugCallable($tuple[0]);
88
+ $result = "> {$str}\n{$result}";
89
+ $stack[] = $str;
90
+ }
91
+
92
+ foreach (array_keys($stack) as $k) {
93
+ $result .= "< {$stack[$k]}\n";
94
+ }
95
+
96
+ return $result;
97
+ }
98
+
99
+ /**
100
+ * Set the HTTP handler that actually returns a promise.
101
+ *
102
+ * @param callable $handler Accepts a request and array of options and
103
+ * returns a Promise.
104
+ */
105
+ public function setHandler(callable $handler)
106
+ {
107
+ $this->handler = $handler;
108
+ $this->cached = null;
109
+ }
110
+
111
+ /**
112
+ * Returns true if the builder has a handler.
113
+ *
114
+ * @return bool
115
+ */
116
+ public function hasHandler()
117
+ {
118
+ return (bool) $this->handler;
119
+ }
120
+
121
+ /**
122
+ * Unshift a middleware to the bottom of the stack.
123
+ *
124
+ * @param callable $middleware Middleware function
125
+ * @param string $name Name to register for this middleware.
126
+ */
127
+ public function unshift(callable $middleware, $name = null)
128
+ {
129
+ array_unshift($this->stack, [$middleware, $name]);
130
+ $this->cached = null;
131
+ }
132
+
133
+ /**
134
+ * Push a middleware to the top of the stack.
135
+ *
136
+ * @param callable $middleware Middleware function
137
+ * @param string $name Name to register for this middleware.
138
+ */
139
+ public function push(callable $middleware, $name = '')
140
+ {
141
+ $this->stack[] = [$middleware, $name];
142
+ $this->cached = null;
143
+ }
144
+
145
+ /**
146
+ * Add a middleware before another middleware by name.
147
+ *
148
+ * @param string $findName Middleware to find
149
+ * @param callable $middleware Middleware function
150
+ * @param string $withName Name to register for this middleware.
151
+ */
152
+ public function before($findName, callable $middleware, $withName = '')
153
+ {
154
+ $this->splice($findName, $withName, $middleware, true);
155
+ }
156
+
157
+ /**
158
+ * Add a middleware after another middleware by name.
159
+ *
160
+ * @param string $findName Middleware to find
161
+ * @param callable $middleware Middleware function
162
+ * @param string $withName Name to register for this middleware.
163
+ */
164
+ public function after($findName, callable $middleware, $withName = '')
165
+ {
166
+ $this->splice($findName, $withName, $middleware, false);
167
+ }
168
+
169
+ /**
170
+ * Remove a middleware by instance or name from the stack.
171
+ *
172
+ * @param callable|string $remove Middleware to remove by instance or name.
173
+ */
174
+ public function remove($remove)
175
+ {
176
+ $this->cached = null;
177
+ $idx = is_callable($remove) ? 0 : 1;
178
+ $this->stack = array_values(array_filter(
179
+ $this->stack,
180
+ function ($tuple) use ($idx, $remove) {
181
+ return $tuple[$idx] !== $remove;
182
+ }
183
+ ));
184
+ }
185
+
186
+ /**
187
+ * Compose the middleware and handler into a single callable function.
188
+ *
189
+ * @return callable
190
+ */
191
+ public function resolve()
192
+ {
193
+ if (!$this->cached) {
194
+ if (!($prev = $this->handler)) {
195
+ throw new \LogicException('No handler has been specified');
196
+ }
197
+
198
+ foreach (array_reverse($this->stack) as $fn) {
199
+ $prev = $fn[0]($prev);
200
+ }
201
+
202
+ $this->cached = $prev;
203
+ }
204
+
205
+ return $this->cached;
206
+ }
207
+
208
+ /**
209
+ * @param $name
210
+ * @return int
211
+ */
212
+ private function findByName($name)
213
+ {
214
+ foreach ($this->stack as $k => $v) {
215
+ if ($v[1] === $name) {
216
+ return $k;
217
+ }
218
+ }
219
+
220
+ throw new \InvalidArgumentException("Middleware not found: $name");
221
+ }
222
+
223
+ /**
224
+ * Splices a function into the middleware list at a specific position.
225
+ *
226
+ * @param $findName
227
+ * @param $withName
228
+ * @param callable $middleware
229
+ * @param $before
230
+ */
231
+ private function splice($findName, $withName, callable $middleware, $before)
232
+ {
233
+ $this->cached = null;
234
+ $idx = $this->findByName($findName);
235
+ $tuple = [$middleware, $withName];
236
+
237
+ if ($before) {
238
+ if ($idx === 0) {
239
+ array_unshift($this->stack, $tuple);
240
+ } else {
241
+ $replacement = [$tuple, $this->stack[$idx]];
242
+ array_splice($this->stack, $idx, 1, $replacement);
243
+ }
244
+ } elseif ($idx === count($this->stack) - 1) {
245
+ $this->stack[] = $tuple;
246
+ } else {
247
+ $replacement = [$this->stack[$idx], $tuple];
248
+ array_splice($this->stack, $idx, 1, $replacement);
249
+ }
250
+ }
251
+
252
+ /**
253
+ * Provides a debug string for a given callable.
254
+ *
255
+ * @param array|callable $fn Function to write as a string.
256
+ *
257
+ * @return string
258
+ */
259
+ private function debugCallable($fn)
260
+ {
261
+ if (is_string($fn)) {
262
+ return "callable({$fn})";
263
+ }
264
+
265
+ if (is_array($fn)) {
266
+ return is_string($fn[0])
267
+ ? "callable({$fn[0]}::{$fn[1]})"
268
+ : "callable(['" . get_class($fn[0]) . "', '{$fn[1]}'])";
269
+ }
270
+
271
+ return 'callable(' . spl_object_hash($fn) . ')';
272
+ }
273
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/MessageFormatter.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use Psr\Http\Message\MessageInterface;
5
+ use Psr\Http\Message\RequestInterface;
6
+ use Psr\Http\Message\ResponseInterface;
7
+
8
+ /**
9
+ * Formats log messages using variable substitutions for requests, responses,
10
+ * and other transactional data.
11
+ *
12
+ * The following variable substitutions are supported:
13
+ *
14
+ * - {request}: Full HTTP request message
15
+ * - {response}: Full HTTP response message
16
+ * - {ts}: ISO 8601 date in GMT
17
+ * - {date_iso_8601} ISO 8601 date in GMT
18
+ * - {date_common_log} Apache common log date using the configured timezone.
19
+ * - {host}: Host of the request
20
+ * - {method}: Method of the request
21
+ * - {uri}: URI of the request
22
+ * - {host}: Host of the request
23
+ * - {version}: Protocol version
24
+ * - {target}: Request target of the request (path + query + fragment)
25
+ * - {hostname}: Hostname of the machine that sent the request
26
+ * - {code}: Status code of the response (if available)
27
+ * - {phrase}: Reason phrase of the response (if available)
28
+ * - {error}: Any error messages (if available)
29
+ * - {req_header_*}: Replace `*` with the lowercased name of a request header to add to the message
30
+ * - {res_header_*}: Replace `*` with the lowercased name of a response header to add to the message
31
+ * - {req_headers}: Request headers
32
+ * - {res_headers}: Response headers
33
+ * - {req_body}: Request body
34
+ * - {res_body}: Response body
35
+ */
36
+ class MessageFormatter
37
+ {
38
+ /**
39
+ * Apache Common Log Format.
40
+ * @link http://httpd.apache.org/docs/2.4/logs.html#common
41
+ * @var string
42
+ */
43
+ const CLF = "{hostname} {req_header_User-Agent} - [{date_common_log}] \"{method} {target} HTTP/{version}\" {code} {res_header_Content-Length}";
44
+ const DEBUG = ">>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}";
45
+ const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}';
46
+
47
+ /** @var string Template used to format log messages */
48
+ private $template;
49
+
50
+ /**
51
+ * @param string $template Log message template
52
+ */
53
+ public function __construct($template = self::CLF)
54
+ {
55
+ $this->template = $template ?: self::CLF;
56
+ }
57
+
58
+ /**
59
+ * Returns a formatted message string.
60
+ *
61
+ * @param RequestInterface $request Request that was sent
62
+ * @param ResponseInterface $response Response that was received
63
+ * @param \Exception $error Exception that was received
64
+ *
65
+ * @return string
66
+ */
67
+ public function format(
68
+ RequestInterface $request,
69
+ ResponseInterface $response = null,
70
+ \Exception $error = null
71
+ ) {
72
+ $cache = [];
73
+
74
+ return preg_replace_callback(
75
+ '/{\s*([A-Za-z_\-\.0-9]+)\s*}/',
76
+ function (array $matches) use ($request, $response, $error, &$cache) {
77
+
78
+ if (isset($cache[$matches[1]])) {
79
+ return $cache[$matches[1]];
80
+ }
81
+
82
+ $result = '';
83
+ switch ($matches[1]) {
84
+ case 'request':
85
+ $result = Psr7\str($request);
86
+ break;
87
+ case 'response':
88
+ $result = $response ? Psr7\str($response) : '';
89
+ break;
90
+ case 'req_headers':
91
+ $result = trim($request->getMethod()
92
+ . ' ' . $request->getRequestTarget())
93
+ . ' HTTP/' . $request->getProtocolVersion() . "\r\n"
94
+ . $this->headers($request);
95
+ break;
96
+ case 'res_headers':
97
+ $result = $response ?
98
+ sprintf(
99
+ 'HTTP/%s %d %s',
100
+ $response->getProtocolVersion(),
101
+ $response->getStatusCode(),
102
+ $response->getReasonPhrase()
103
+ ) . "\r\n" . $this->headers($response)
104
+ : 'NULL';
105
+ break;
106
+ case 'req_body':
107
+ $result = $request->getBody();
108
+ break;
109
+ case 'res_body':
110
+ $result = $response ? $response->getBody() : 'NULL';
111
+ break;
112
+ case 'ts':
113
+ case 'date_iso_8601':
114
+ $result = gmdate('c');
115
+ break;
116
+ case 'date_common_log':
117
+ $result = date('d/M/Y:H:i:s O');
118
+ break;
119
+ case 'method':
120
+ $result = $request->getMethod();
121
+ break;
122
+ case 'version':
123
+ $result = $request->getProtocolVersion();
124
+ break;
125
+ case 'uri':
126
+ case 'url':
127
+ $result = $request->getUri();
128
+ break;
129
+ case 'target':
130
+ $result = $request->getRequestTarget();
131
+ break;
132
+ case 'req_version':
133
+ $result = $request->getProtocolVersion();
134
+ break;
135
+ case 'res_version':
136
+ $result = $response
137
+ ? $response->getProtocolVersion()
138
+ : 'NULL';
139
+ break;
140
+ case 'host':
141
+ $result = $request->getHeaderLine('Host');
142
+ break;
143
+ case 'hostname':
144
+ $result = gethostname();
145
+ break;
146
+ case 'code':
147
+ $result = $response ? $response->getStatusCode() : 'NULL';
148
+ break;
149
+ case 'phrase':
150
+ $result = $response ? $response->getReasonPhrase() : 'NULL';
151
+ break;
152
+ case 'error':
153
+ $result = $error ? $error->getMessage() : 'NULL';
154
+ break;
155
+ default:
156
+ // handle prefixed dynamic headers
157
+ if (strpos($matches[1], 'req_header_') === 0) {
158
+ $result = $request->getHeaderLine(substr($matches[1], 11));
159
+ } elseif (strpos($matches[1], 'res_header_') === 0) {
160
+ $result = $response
161
+ ? $response->getHeaderLine(substr($matches[1], 11))
162
+ : 'NULL';
163
+ }
164
+ }
165
+
166
+ $cache[$matches[1]] = $result;
167
+ return $result;
168
+ },
169
+ $this->template
170
+ );
171
+ }
172
+
173
+ private function headers(MessageInterface $message)
174
+ {
175
+ $result = '';
176
+ foreach ($message->getHeaders() as $name => $values) {
177
+ $result .= $name . ': ' . implode(', ', $values) . "\r\n";
178
+ }
179
+
180
+ return trim($result);
181
+ }
182
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Middleware.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use GuzzleHttp\Cookie\CookieJarInterface;
5
+ use GuzzleHttp\Exception\RequestException;
6
+ use GuzzleHttp\Promise\RejectedPromise;
7
+ use GuzzleHttp\Psr7;
8
+ use Psr\Http\Message\ResponseInterface;
9
+ use Psr\Log\LoggerInterface;
10
+ use Psr\Log\LogLevel;
11
+
12
+ /**
13
+ * Functions used to create and wrap handlers with handler middleware.
14
+ */
15
+ final class Middleware
16
+ {
17
+ /**
18
+ * Middleware that adds cookies to requests.
19
+ *
20
+ * The options array must be set to a CookieJarInterface in order to use
21
+ * cookies. This is typically handled for you by a client.
22
+ *
23
+ * @return callable Returns a function that accepts the next handler.
24
+ */
25
+ public static function cookies()
26
+ {
27
+ return function (callable $handler) {
28
+ return function ($request, array $options) use ($handler) {
29
+ if (empty($options['cookies'])) {
30
+ return $handler($request, $options);
31
+ } elseif (!($options['cookies'] instanceof CookieJarInterface)) {
32
+ throw new \InvalidArgumentException('cookies must be an instance of GuzzleHttp\Cookie\CookieJarInterface');
33
+ }
34
+ $cookieJar = $options['cookies'];
35
+ $request = $cookieJar->withCookieHeader($request);
36
+ return $handler($request, $options)
37
+ ->then(function ($response) use ($cookieJar, $request) {
38
+ $cookieJar->extractCookies($request, $response);
39
+ return $response;
40
+ }
41
+ );
42
+ };
43
+ };
44
+ }
45
+
46
+ /**
47
+ * Middleware that throws exceptions for 4xx or 5xx responses when the
48
+ * "http_error" request option is set to true.
49
+ *
50
+ * @return callable Returns a function that accepts the next handler.
51
+ */
52
+ public static function httpErrors()
53
+ {
54
+ return function (callable $handler) {
55
+ return function ($request, array $options) use ($handler) {
56
+ if (empty($options['http_errors'])) {
57
+ return $handler($request, $options);
58
+ }
59
+ return $handler($request, $options)->then(
60
+ function (ResponseInterface $response) use ($request, $handler) {
61
+ $code = $response->getStatusCode();
62
+ if ($code < 400) {
63
+ return $response;
64
+ }
65
+ throw RequestException::create($request, $response);
66
+ }
67
+ );
68
+ };
69
+ };
70
+ }
71
+
72
+ /**
73
+ * Middleware that pushes history data to an ArrayAccess container.
74
+ *
75
+ * @param array $container Container to hold the history (by reference).
76
+ *
77
+ * @return callable Returns a function that accepts the next handler.
78
+ * @throws \InvalidArgumentException if container is not an array or ArrayAccess.
79
+ */
80
+ public static function history(&$container)
81
+ {
82
+ if (!is_array($container) && !$container instanceof \ArrayAccess) {
83
+ throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess');
84
+ }
85
+
86
+ return function (callable $handler) use (&$container) {
87
+ return function ($request, array $options) use ($handler, &$container) {
88
+ return $handler($request, $options)->then(
89
+ function ($value) use ($request, &$container, $options) {
90
+ $container[] = [
91
+ 'request' => $request,
92
+ 'response' => $value,
93
+ 'error' => null,
94
+ 'options' => $options
95
+ ];
96
+ return $value;
97
+ },
98
+ function ($reason) use ($request, &$container, $options) {
99
+ $container[] = [
100
+ 'request' => $request,
101
+ 'response' => null,
102
+ 'error' => $reason,
103
+ 'options' => $options
104
+ ];
105
+ return new RejectedPromise($reason);
106
+ }
107
+ );
108
+ };
109
+ };
110
+ }
111
+
112
+ /**
113
+ * Middleware that invokes a callback before and after sending a request.
114
+ *
115
+ * The provided listener cannot modify or alter the response. It simply
116
+ * "taps" into the chain to be notified before returning the promise. The
117
+ * before listener accepts a request and options array, and the after
118
+ * listener accepts a request, options array, and response promise.
119
+ *
120
+ * @param callable $before Function to invoke before forwarding the request.
121
+ * @param callable $after Function invoked after forwarding.
122
+ *
123
+ * @return callable Returns a function that accepts the next handler.
124
+ */
125
+ public static function tap(callable $before = null, callable $after = null)
126
+ {
127
+ return function (callable $handler) use ($before, $after) {
128
+ return function ($request, array $options) use ($handler, $before, $after) {
129
+ if ($before) {
130
+ $before($request, $options);
131
+ }
132
+ $response = $handler($request, $options);
133
+ if ($after) {
134
+ $after($request, $options, $response);
135
+ }
136
+ return $response;
137
+ };
138
+ };
139
+ }
140
+
141
+ /**
142
+ * Middleware that handles request redirects.
143
+ *
144
+ * @return callable Returns a function that accepts the next handler.
145
+ */
146
+ public static function redirect()
147
+ {
148
+ return function (callable $handler) {
149
+ return new RedirectMiddleware($handler);
150
+ };
151
+ }
152
+
153
+ /**
154
+ * Middleware that retries requests based on the boolean result of
155
+ * invoking the provided "decider" function.
156
+ *
157
+ * If no delay function is provided, a simple implementation of exponential
158
+ * backoff will be utilized.
159
+ *
160
+ * @param callable $decider Function that accepts the number of retries,
161
+ * a request, [response], and [exception] and
162
+ * returns true if the request is to be retried.
163
+ * @param callable $delay Function that accepts the number of retries and
164
+ * returns the number of milliseconds to delay.
165
+ *
166
+ * @return callable Returns a function that accepts the next handler.
167
+ */
168
+ public static function retry(callable $decider, callable $delay = null)
169
+ {
170
+ return function (callable $handler) use ($decider, $delay) {
171
+ return new RetryMiddleware($decider, $handler, $delay);
172
+ };
173
+ }
174
+
175
+ /**
176
+ * Middleware that logs requests, responses, and errors using a message
177
+ * formatter.
178
+ *
179
+ * @param LoggerInterface $logger Logs messages.
180
+ * @param MessageFormatter $formatter Formatter used to create message strings.
181
+ * @param string $logLevel Level at which to log requests.
182
+ *
183
+ * @return callable Returns a function that accepts the next handler.
184
+ */
185
+ public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = LogLevel::INFO)
186
+ {
187
+ return function (callable $handler) use ($logger, $formatter, $logLevel) {
188
+ return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) {
189
+ return $handler($request, $options)->then(
190
+ function ($response) use ($logger, $request, $formatter, $logLevel) {
191
+ $message = $formatter->format($request, $response);
192
+ $logger->log($logLevel, $message);
193
+ return $response;
194
+ },
195
+ function ($reason) use ($logger, $request, $formatter) {
196
+ $response = $reason instanceof RequestException
197
+ ? $reason->getResponse()
198
+ : null;
199
+ $message = $formatter->format($request, $response, $reason);
200
+ $logger->notice($message);
201
+ return \GuzzleHttp\Promise\rejection_for($reason);
202
+ }
203
+ );
204
+ };
205
+ };
206
+ }
207
+
208
+ /**
209
+ * This middleware adds a default content-type if possible, a default
210
+ * content-length or transfer-encoding header, and the expect header.
211
+ *
212
+ * @return callable
213
+ */
214
+ public static function prepareBody()
215
+ {
216
+ return function (callable $handler) {
217
+ return new PrepareBodyMiddleware($handler);
218
+ };
219
+ }
220
+
221
+ /**
222
+ * Middleware that applies a map function to the request before passing to
223
+ * the next handler.
224
+ *
225
+ * @param callable $fn Function that accepts a RequestInterface and returns
226
+ * a RequestInterface.
227
+ * @return callable
228
+ */
229
+ public static function mapRequest(callable $fn)
230
+ {
231
+ return function (callable $handler) use ($fn) {
232
+ return function ($request, array $options) use ($handler, $fn) {
233
+ return $handler($fn($request), $options);
234
+ };
235
+ };
236
+ }
237
+
238
+ /**
239
+ * Middleware that applies a map function to the resolved promise's
240
+ * response.
241
+ *
242
+ * @param callable $fn Function that accepts a ResponseInterface and
243
+ * returns a ResponseInterface.
244
+ * @return callable
245
+ */
246
+ public static function mapResponse(callable $fn)
247
+ {
248
+ return function (callable $handler) use ($fn) {
249
+ return function ($request, array $options) use ($handler, $fn) {
250
+ return $handler($request, $options)->then($fn);
251
+ };
252
+ };
253
+ }
254
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/Pool.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use GuzzleHttp\Promise\PromisorInterface;
5
+ use Psr\Http\Message\RequestInterface;
6
+ use GuzzleHttp\Promise\EachPromise;
7
+
8
+ /**
9
+ * Sends and iterator of requests concurrently using a capped pool size.
10
+ *
11
+ * The pool will read from an iterator until it is cancelled or until the
12
+ * iterator is consumed. When a request is yielded, the request is sent after
13
+ * applying the "request_options" request options (if provided in the ctor).
14
+ *
15
+ * When a function is yielded by the iterator, the function is provided the
16
+ * "request_options" array that should be merged on top of any existing
17
+ * options, and the function MUST then return a wait-able promise.
18
+ */
19
+ class Pool implements PromisorInterface
20
+ {
21
+ /** @var EachPromise */
22
+ private $each;
23
+
24
+ /**
25
+ * @param ClientInterface $client Client used to send the requests.
26
+ * @param array|\Iterator $requests Requests or functions that return
27
+ * requests to send concurrently.
28
+ * @param array $config Associative array of options
29
+ * - concurrency: (int) Maximum number of requests to send concurrently
30
+ * - options: Array of request options to apply to each request.
31
+ * - fulfilled: (callable) Function to invoke when a request completes.
32
+ * - rejected: (callable) Function to invoke when a request is rejected.
33
+ */
34
+ public function __construct(
35
+ ClientInterface $client,
36
+ $requests,
37
+ array $config = []
38
+ ) {
39
+ // Backwards compatibility.
40
+ if (isset($config['pool_size'])) {
41
+ $config['concurrency'] = $config['pool_size'];
42
+ } elseif (!isset($config['concurrency'])) {
43
+ $config['concurrency'] = 25;
44
+ }
45
+
46
+ if (isset($config['options'])) {
47
+ $opts = $config['options'];
48
+ unset($config['options']);
49
+ } else {
50
+ $opts = [];
51
+ }
52
+
53
+ $iterable = \GuzzleHttp\Promise\iter_for($requests);
54
+ $requests = function () use ($iterable, $client, $opts) {
55
+ foreach ($iterable as $key => $rfn) {
56
+ if ($rfn instanceof RequestInterface) {
57
+ yield $key => $client->sendAsync($rfn, $opts);
58
+ } elseif (is_callable($rfn)) {
59
+ yield $key => $rfn($opts);
60
+ } else {
61
+ throw new \InvalidArgumentException('Each value yielded by '
62
+ . 'the iterator must be a Psr7\Http\Message\RequestInterface '
63
+ . 'or a callable that returns a promise that fulfills '
64
+ . 'with a Psr7\Message\Http\ResponseInterface object.');
65
+ }
66
+ }
67
+ };
68
+
69
+ $this->each = new EachPromise($requests(), $config);
70
+ }
71
+
72
+ public function promise()
73
+ {
74
+ return $this->each->promise();
75
+ }
76
+
77
+ /**
78
+ * Sends multiple requests concurrently and returns an array of responses
79
+ * and exceptions that uses the same ordering as the provided requests.
80
+ *
81
+ * IMPORTANT: This method keeps every request and response in memory, and
82
+ * as such, is NOT recommended when sending a large number or an
83
+ * indeterminate number of requests concurrently.
84
+ *
85
+ * @param ClientInterface $client Client used to send the requests
86
+ * @param array|\Iterator $requests Requests to send concurrently.
87
+ * @param array $options Passes through the options available in
88
+ * {@see GuzzleHttp\Pool::__construct}
89
+ *
90
+ * @return array Returns an array containing the response or an exception
91
+ * in the same order that the requests were sent.
92
+ * @throws \InvalidArgumentException if the event format is incorrect.
93
+ */
94
+ public static function batch(
95
+ ClientInterface $client,
96
+ $requests,
97
+ array $options = []
98
+ ) {
99
+ $res = [];
100
+ self::cmpCallback($options, 'fulfilled', $res);
101
+ self::cmpCallback($options, 'rejected', $res);
102
+ $pool = new static($client, $requests, $options);
103
+ $pool->promise()->wait();
104
+ ksort($res);
105
+
106
+ return $res;
107
+ }
108
+
109
+ private static function cmpCallback(array &$options, $name, array &$results)
110
+ {
111
+ if (!isset($options[$name])) {
112
+ $options[$name] = function ($v, $k) use (&$results) {
113
+ $results[$k] = $v;
114
+ };
115
+ } else {
116
+ $currentFn = $options[$name];
117
+ $options[$name] = function ($v, $k) use (&$results, $currentFn) {
118
+ $currentFn($v, $k);
119
+ $results[$k] = $v;
120
+ };
121
+ }
122
+ }
123
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use GuzzleHttp\Promise\PromiseInterface;
5
+ use GuzzleHttp\Psr7;
6
+ use Psr\Http\Message\RequestInterface;
7
+
8
+ /**
9
+ * Prepares requests that contain a body, adding the Content-Length,
10
+ * Content-Type, and Expect headers.
11
+ */
12
+ class PrepareBodyMiddleware
13
+ {
14
+ /** @var callable */
15
+ private $nextHandler;
16
+
17
+ /** @var array */
18
+ private static $skipMethods = ['GET' => true, 'HEAD' => true];
19
+
20
+ /**
21
+ * @param callable $nextHandler Next handler to invoke.
22
+ */
23
+ public function __construct(callable $nextHandler)
24
+ {
25
+ $this->nextHandler = $nextHandler;
26
+ }
27
+
28
+ /**
29
+ * @param RequestInterface $request
30
+ * @param array $options
31
+ *
32
+ * @return PromiseInterface
33
+ */
34
+ public function __invoke(RequestInterface $request, array $options)
35
+ {
36
+ $fn = $this->nextHandler;
37
+
38
+ // Don't do anything if the request has no body.
39
+ if (isset(self::$skipMethods[$request->getMethod()])
40
+ || $request->getBody()->getSize() === 0
41
+ ) {
42
+ return $fn($request, $options);
43
+ }
44
+
45
+ $modify = [];
46
+
47
+ // Add a default content-type if possible.
48
+ if (!$request->hasHeader('Content-Type')) {
49
+ if ($uri = $request->getBody()->getMetadata('uri')) {
50
+ if ($type = Psr7\mimetype_from_filename($uri)) {
51
+ $modify['set_headers']['Content-Type'] = $type;
52
+ }
53
+ }
54
+ }
55
+
56
+ // Add a default content-length or transfer-encoding header.
57
+ if (!isset(self::$skipMethods[$request->getMethod()])
58
+ && !$request->hasHeader('Content-Length')
59
+ && !$request->hasHeader('Transfer-Encoding')
60
+ ) {
61
+ $size = $request->getBody()->getSize();
62
+ if ($size !== null) {
63
+ $modify['set_headers']['Content-Length'] = $size;
64
+ } else {
65
+ $modify['set_headers']['Transfer-Encoding'] = 'chunked';
66
+ }
67
+ }
68
+
69
+ // Add the expect header if needed.
70
+ $this->addExpectHeader($request, $options, $modify);
71
+
72
+ return $fn(Psr7\modify_request($request, $modify), $options);
73
+ }
74
+
75
+ private function addExpectHeader(
76
+ RequestInterface $request,
77
+ array $options,
78
+ array &$modify
79
+ ) {
80
+ // Determine if the Expect header should be used
81
+ if ($request->hasHeader('Expect')) {
82
+ return;
83
+ }
84
+
85
+ $expect = isset($options['expect']) ? $options['expect'] : null;
86
+
87
+ // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0
88
+ if ($expect === false || $request->getProtocolVersion() < 1.1) {
89
+ return;
90
+ }
91
+
92
+ // The expect header is unconditionally enabled
93
+ if ($expect === true) {
94
+ $modify['set_headers']['Expect'] = '100-Continue';
95
+ return;
96
+ }
97
+
98
+ // By default, send the expect header when the payload is > 1mb
99
+ if ($expect === null) {
100
+ $expect = 1048576;
101
+ }
102
+
103
+ // Always add if the body cannot be rewound, the size cannot be
104
+ // determined, or the size is greater than the cutoff threshold
105
+ $body = $request->getBody();
106
+ $size = $body->getSize();
107
+
108
+ if ($size === null || $size >= (int) $expect || !$body->isSeekable()) {
109
+ $modify['set_headers']['Expect'] = '100-Continue';
110
+ }
111
+ }
112
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use GuzzleHttp\Exception\BadResponseException;
5
+ use GuzzleHttp\Exception\TooManyRedirectsException;
6
+ use GuzzleHttp\Promise\PromiseInterface;
7
+ use GuzzleHttp\Psr7;
8
+ use Psr\Http\Message\RequestInterface;
9
+ use Psr\Http\Message\ResponseInterface;
10
+ use Psr\Http\Message\UriInterface;
11
+
12
+ /**
13
+ * Request redirect middleware.
14
+ *
15
+ * Apply this middleware like other middleware using
16
+ * {@see GuzzleHttp\Middleware::redirect()}.
17
+ */
18
+ class RedirectMiddleware
19
+ {
20
+ const HISTORY_HEADER = 'X-Guzzle-Redirect-History';
21
+
22
+ public static $defaultSettings = [
23
+ 'max' => 5,
24
+ 'protocols' => ['http', 'https'],
25
+ 'strict' => false,
26
+ 'referer' => false,
27
+ 'track_redirects' => false,
28
+ ];
29
+
30
+ /** @var callable */
31
+ private $nextHandler;
32
+
33
+ /**
34
+ * @param callable $nextHandler Next handler to invoke.
35
+ */
36
+ public function __construct(callable $nextHandler)
37
+ {
38
+ $this->nextHandler = $nextHandler;
39
+ }
40
+
41
+ /**
42
+ * @param RequestInterface $request
43
+ * @param array $options
44
+ *
45
+ * @return PromiseInterface
46
+ */
47
+ public function __invoke(RequestInterface $request, array $options)
48
+ {
49
+ $fn = $this->nextHandler;
50
+
51
+ if (empty($options['allow_redirects'])) {
52
+ return $fn($request, $options);
53
+ }
54
+
55
+ if ($options['allow_redirects'] === true) {
56
+ $options['allow_redirects'] = self::$defaultSettings;
57
+ } elseif (!is_array($options['allow_redirects'])) {
58
+ throw new \InvalidArgumentException('allow_redirects must be true, false, or array');
59
+ } else {
60
+ // Merge the default settings with the provided settings
61
+ $options['allow_redirects'] += self::$defaultSettings;
62
+ }
63
+
64
+ if (empty($options['allow_redirects']['max'])) {
65
+ return $fn($request, $options);
66
+ }
67
+
68
+ return $fn($request, $options)
69
+ ->then(function (ResponseInterface $response) use ($request, $options) {
70
+ return $this->checkRedirect($request, $options, $response);
71
+ });
72
+ }
73
+
74
+ /**
75
+ * @param RequestInterface $request
76
+ * @param array $options
77
+ * @param ResponseInterface|PromiseInterface $response
78
+ *
79
+ * @return ResponseInterface|PromiseInterface
80
+ */
81
+ public function checkRedirect(
82
+ RequestInterface $request,
83
+ array $options,
84
+ ResponseInterface $response
85
+ ) {
86
+ if (substr($response->getStatusCode(), 0, 1) != '3'
87
+ || !$response->hasHeader('Location')
88
+ ) {
89
+ return $response;
90
+ }
91
+
92
+ $this->guardMax($request, $options);
93
+ $nextRequest = $this->modifyRequest($request, $options, $response);
94
+
95
+ if (isset($options['allow_redirects']['on_redirect'])) {
96
+ call_user_func(
97
+ $options['allow_redirects']['on_redirect'],
98
+ $request,
99
+ $response,
100
+ $nextRequest->getUri()
101
+ );
102
+ }
103
+
104
+ /** @var PromiseInterface|ResponseInterface $promise */
105
+ $promise = $this($nextRequest, $options);
106
+
107
+ // Add headers to be able to track history of redirects.
108
+ if (!empty($options['allow_redirects']['track_redirects'])) {
109
+ return $this->withTracking(
110
+ $promise,
111
+ (string) $nextRequest->getUri()
112
+ );
113
+ }
114
+
115
+ return $promise;
116
+ }
117
+
118
+ private function withTracking(PromiseInterface $promise, $uri)
119
+ {
120
+ return $promise->then(
121
+ function (ResponseInterface $response) use ($uri) {
122
+ // Note that we are pushing to the front of the list as this
123
+ // would be an earlier response than what is currently present
124
+ // in the history header.
125
+ $header = $response->getHeader(self::HISTORY_HEADER);
126
+ array_unshift($header, $uri);
127
+ return $response->withHeader(self::HISTORY_HEADER, $header);
128
+ }
129
+ );
130
+ }
131
+
132
+ private function guardMax(RequestInterface $request, array &$options)
133
+ {
134
+ $current = isset($options['__redirect_count'])
135
+ ? $options['__redirect_count']
136
+ : 0;
137
+ $options['__redirect_count'] = $current + 1;
138
+ $max = $options['allow_redirects']['max'];
139
+
140
+ if ($options['__redirect_count'] > $max) {
141
+ throw new TooManyRedirectsException(
142
+ "Will not follow more than {$max} redirects",
143
+ $request
144
+ );
145
+ }
146
+ }
147
+
148
+ /**
149
+ * @param RequestInterface $request
150
+ * @param array $options
151
+ * @param ResponseInterface $response
152
+ *
153
+ * @return RequestInterface
154
+ */
155
+ public function modifyRequest(
156
+ RequestInterface $request,
157
+ array $options,
158
+ ResponseInterface $response
159
+ ) {
160
+ // Request modifications to apply.
161
+ $modify = [];
162
+ $protocols = $options['allow_redirects']['protocols'];
163
+
164
+ // Use a GET request if this is an entity enclosing request and we are
165
+ // not forcing RFC compliance, but rather emulating what all browsers
166
+ // would do.
167
+ $statusCode = $response->getStatusCode();
168
+ if ($statusCode == 303 ||
169
+ ($statusCode <= 302 && $request->getBody() && !$options['allow_redirects']['strict'])
170
+ ) {
171
+ $modify['method'] = 'GET';
172
+ $modify['body'] = '';
173
+ }
174
+
175
+ $modify['uri'] = $this->redirectUri($request, $response, $protocols);
176
+ Psr7\rewind_body($request);
177
+
178
+ // Add the Referer header if it is told to do so and only
179
+ // add the header if we are not redirecting from https to http.
180
+ if ($options['allow_redirects']['referer']
181
+ && $modify['uri']->getScheme() === $request->getUri()->getScheme()
182
+ ) {
183
+ $uri = $request->getUri()->withUserInfo('', '');
184
+ $modify['set_headers']['Referer'] = (string) $uri;
185
+ } else {
186
+ $modify['remove_headers'][] = 'Referer';
187
+ }
188
+
189
+ // Remove Authorization header if host is different.
190
+ if ($request->getUri()->getHost() !== $modify['uri']->getHost()) {
191
+ $modify['remove_headers'][] = 'Authorization';
192
+ }
193
+
194
+ return Psr7\modify_request($request, $modify);
195
+ }
196
+
197
+ /**
198
+ * Set the appropriate URL on the request based on the location header
199
+ *
200
+ * @param RequestInterface $request
201
+ * @param ResponseInterface $response
202
+ * @param array $protocols
203
+ *
204
+ * @return UriInterface
205
+ */
206
+ private function redirectUri(
207
+ RequestInterface $request,
208
+ ResponseInterface $response,
209
+ array $protocols
210
+ ) {
211
+ $location = Psr7\Uri::resolve(
212
+ $request->getUri(),
213
+ $response->getHeaderLine('Location')
214
+ );
215
+
216
+ // Ensure that the redirect URI is allowed based on the protocols.
217
+ if (!in_array($location->getScheme(), $protocols)) {
218
+ throw new BadResponseException(
219
+ sprintf(
220
+ 'Redirect URI, %s, does not use one of the allowed redirect protocols: %s',
221
+ $location,
222
+ implode(', ', $protocols)
223
+ ),
224
+ $request,
225
+ $response
226
+ );
227
+ }
228
+
229
+ return $location;
230
+ }
231
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/RequestOptions.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ /**
5
+ * This class contains a list of built-in Guzzle request options.
6
+ *
7
+ * More documentation for each option can be found at http://guzzlephp.org/.
8
+ *
9
+ * @link http://docs.guzzlephp.org/en/v6/request-options.html
10
+ */
11
+ final class RequestOptions
12
+ {
13
+ /**
14
+ * allow_redirects: (bool|array) Controls redirect behavior. Pass false
15
+ * to disable redirects, pass true to enable redirects, pass an
16
+ * associative to provide custom redirect settings. Defaults to "false".
17
+ * This option only works if your handler has the RedirectMiddleware. When
18
+ * passing an associative array, you can provide the following key value
19
+ * pairs:
20
+ *
21
+ * - max: (int, default=5) maximum number of allowed redirects.
22
+ * - strict: (bool, default=false) Set to true to use strict redirects
23
+ * meaning redirect POST requests with POST requests vs. doing what most
24
+ * browsers do which is redirect POST requests with GET requests
25
+ * - referer: (bool, default=true) Set to false to disable the Referer
26
+ * header.
27
+ * - protocols: (array, default=['http', 'https']) Allowed redirect
28
+ * protocols.
29
+ * - on_redirect: (callable) PHP callable that is invoked when a redirect
30
+ * is encountered. The callable is invoked with the request, the redirect
31
+ * response that was received, and the effective URI. Any return value
32
+ * from the on_redirect function is ignored.
33
+ */
34
+ const ALLOW_REDIRECTS = 'allow_redirects';
35
+
36
+ /**
37
+ * auth: (array) Pass an array of HTTP authentication parameters to use
38
+ * with the request. The array must contain the username in index [0],
39
+ * the password in index [1], and you can optionally provide a built-in
40
+ * authentication type in index [2]. Pass null to disable authentication
41
+ * for a request.
42
+ */
43
+ const AUTH = 'auth';
44
+
45
+ /**
46
+ * body: (string|null|callable|iterator|object) Body to send in the
47
+ * request.
48
+ */
49
+ const BODY = 'body';
50
+
51
+ /**
52
+ * cert: (string|array) Set to a string to specify the path to a file
53
+ * containing a PEM formatted SSL client side certificate. If a password
54
+ * is required, then set cert to an array containing the path to the PEM
55
+ * file in the first array element followed by the certificate password
56
+ * in the second array element.
57
+ */
58
+ const CERT = 'cert';
59
+
60
+ /**
61
+ * cookies: (bool|GuzzleHttp\Cookie\CookieJarInterface, default=false)
62
+ * Specifies whether or not cookies are used in a request or what cookie
63
+ * jar to use or what cookies to send. This option only works if your
64
+ * handler has the `cookie` middleware. Valid values are `false` and
65
+ * an instance of {@see GuzzleHttp\Cookie\CookieJarInterface}.
66
+ */
67
+ const COOKIES = 'cookies';
68
+
69
+ /**
70
+ * connect_timeout: (float, default=0) Float describing the number of
71
+ * seconds to wait while trying to connect to a server. Use 0 to wait
72
+ * indefinitely (the default behavior).
73
+ */
74
+ const CONNECT_TIMEOUT = 'connect_timeout';
75
+
76
+ /**
77
+ * debug: (bool|resource) Set to true or set to a PHP stream returned by
78
+ * fopen() enable debug output with the HTTP handler used to send a
79
+ * request.
80
+ */
81
+ const DEBUG = 'debug';
82
+
83
+ /**
84
+ * decode_content: (bool, default=true) Specify whether or not
85
+ * Content-Encoding responses (gzip, deflate, etc.) are automatically
86
+ * decoded.
87
+ */
88
+ const DECODE_CONTENT = 'decode_content';
89
+
90
+ /**
91
+ * delay: (int) The amount of time to delay before sending in milliseconds.
92
+ */
93
+ const DELAY = 'delay';
94
+
95
+ /**
96
+ * expect: (bool|integer) Controls the behavior of the
97
+ * "Expect: 100-Continue" header.
98
+ *
99
+ * Set to `true` to enable the "Expect: 100-Continue" header for all
100
+ * requests that sends a body. Set to `false` to disable the
101
+ * "Expect: 100-Continue" header for all requests. Set to a number so that
102
+ * the size of the payload must be greater than the number in order to send
103
+ * the Expect header. Setting to a number will send the Expect header for
104
+ * all requests in which the size of the payload cannot be determined or
105
+ * where the body is not rewindable.
106
+ *
107
+ * By default, Guzzle will add the "Expect: 100-Continue" header when the
108
+ * size of the body of a request is greater than 1 MB and a request is
109
+ * using HTTP/1.1.
110
+ */
111
+ const EXPECT = 'expect';
112
+
113
+ /**
114
+ * form_params: (array) Associative array of form field names to values
115
+ * where each value is a string or array of strings. Sets the Content-Type
116
+ * header to application/x-www-form-urlencoded when no Content-Type header
117
+ * is already present.
118
+ */
119
+ const FORM_PARAMS = 'form_params';
120
+
121
+ /**
122
+ * headers: (array) Associative array of HTTP headers. Each value MUST be
123
+ * a string or array of strings.
124
+ */
125
+ const HEADERS = 'headers';
126
+
127
+ /**
128
+ * http_errors: (bool, default=true) Set to false to disable exceptions
129
+ * when a non- successful HTTP response is received. By default,
130
+ * exceptions will be thrown for 4xx and 5xx responses. This option only
131
+ * works if your handler has the `httpErrors` middleware.
132
+ */
133
+ const HTTP_ERRORS = 'http_errors';
134
+
135
+ /**
136
+ * json: (mixed) Adds JSON data to a request. The provided value is JSON
137
+ * encoded and a Content-Type header of application/json will be added to
138
+ * the request if no Content-Type header is already present.
139
+ */
140
+ const JSON = 'json';
141
+
142
+ /**
143
+ * multipart: (array) Array of associative arrays, each containing a
144
+ * required "name" key mapping to the form field, name, a required
145
+ * "contents" key mapping to a StreamInterface|resource|string, an
146
+ * optional "headers" associative array of custom headers, and an
147
+ * optional "filename" key mapping to a string to send as the filename in
148
+ * the part. If no "filename" key is present, then no "filename" attribute
149
+ * will be added to the part.
150
+ */
151
+ const MULTIPART = 'multipart';
152
+
153
+ /**
154
+ * on_headers: (callable) A callable that is invoked when the HTTP headers
155
+ * of the response have been received but the body has not yet begun to
156
+ * download.
157
+ */
158
+ const ON_HEADERS = 'on_headers';
159
+
160
+ /**
161
+ * on_stats: (callable) allows you to get access to transfer statistics of
162
+ * a request and access the lower level transfer details of the handler
163
+ * associated with your client. ``on_stats`` is a callable that is invoked
164
+ * when a handler has finished sending a request. The callback is invoked
165
+ * with transfer statistics about the request, the response received, or
166
+ * the error encountered. Included in the data is the total amount of time
167
+ * taken to send the request.
168
+ */
169
+ const ON_STATS = 'on_stats';
170
+
171
+ /**
172
+ * progress: (callable) Defines a function to invoke when transfer
173
+ * progress is made. The function accepts the following positional
174
+ * arguments: the total number of bytes expected to be downloaded, the
175
+ * number of bytes downloaded so far, the number of bytes expected to be
176
+ * uploaded, the number of bytes uploaded so far.
177
+ */
178
+ const PROGRESS = 'progress';
179
+
180
+ /**
181
+ * proxy: (string|array) Pass a string to specify an HTTP proxy, or an
182
+ * array to specify different proxies for different protocols (where the
183
+ * key is the protocol and the value is a proxy string).
184
+ */
185
+ const PROXY = 'proxy';
186
+
187
+ /**
188
+ * query: (array|string) Associative array of query string values to add
189
+ * to the request. This option uses PHP's http_build_query() to create
190
+ * the string representation. Pass a string value if you need more
191
+ * control than what this method provides
192
+ */
193
+ const QUERY = 'query';
194
+
195
+ /**
196
+ * sink: (resource|string|StreamInterface) Where the data of the
197
+ * response is written to. Defaults to a PHP temp stream. Providing a
198
+ * string will write data to a file by the given name.
199
+ */
200
+ const SINK = 'sink';
201
+
202
+ /**
203
+ * synchronous: (bool) Set to true to inform HTTP handlers that you intend
204
+ * on waiting on the response. This can be useful for optimizations. Note
205
+ * that a promise is still returned if you are using one of the async
206
+ * client methods.
207
+ */
208
+ const SYNCHRONOUS = 'synchronous';
209
+
210
+ /**
211
+ * ssl_key: (array|string) Specify the path to a file containing a private
212
+ * SSL key in PEM format. If a password is required, then set to an array
213
+ * containing the path to the SSL key in the first array element followed
214
+ * by the password required for the certificate in the second element.
215
+ */
216
+ const SSL_KEY = 'ssl_key';
217
+
218
+ /**
219
+ * stream: Set to true to attempt to stream a response rather than
220
+ * download it all up-front.
221
+ */
222
+ const STREAM = 'stream';
223
+
224
+ /**
225
+ * verify: (bool|string, default=true) Describes the SSL certificate
226
+ * verification behavior of a request. Set to true to enable SSL
227
+ * certificate verification using the system CA bundle when available
228
+ * (the default). Set to false to disable certificate verification (this
229
+ * is insecure!). Set to a string to provide the path to a CA bundle on
230
+ * disk to enable verification using a custom certificate.
231
+ */
232
+ const VERIFY = 'verify';
233
+
234
+ /**
235
+ * timeout: (float, default=0) Float describing the timeout of the
236
+ * request in seconds. Use 0 to wait indefinitely (the default behavior).
237
+ */
238
+ const TIMEOUT = 'timeout';
239
+
240
+ /**
241
+ * version: (float) Specifies the HTTP protocol version to attempt to use.
242
+ */
243
+ const VERSION = 'version';
244
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use GuzzleHttp\Promise\PromiseInterface;
5
+ use GuzzleHttp\Promise\RejectedPromise;
6
+ use GuzzleHttp\Psr7;
7
+ use Psr\Http\Message\RequestInterface;
8
+ use Psr\Http\Message\ResponseInterface;
9
+
10
+ /**
11
+ * Middleware that retries requests based on the boolean result of
12
+ * invoking the provided "decider" function.
13
+ */
14
+ class RetryMiddleware
15
+ {
16
+ /** @var callable */
17
+ private $nextHandler;
18
+
19
+ /** @var callable */
20
+ private $decider;
21
+
22
+ /**
23
+ * @param callable $decider Function that accepts the number of retries,
24
+ * a request, [response], and [exception] and
25
+ * returns true if the request is to be
26
+ * retried.
27
+ * @param callable $nextHandler Next handler to invoke.
28
+ * @param callable $delay Function that accepts the number of retries
29
+ * and [response] and returns the number of
30
+ * milliseconds to delay.
31
+ */
32
+ public function __construct(
33
+ callable $decider,
34
+ callable $nextHandler,
35
+ callable $delay = null
36
+ ) {
37
+ $this->decider = $decider;
38
+ $this->nextHandler = $nextHandler;
39
+ $this->delay = $delay ?: __CLASS__ . '::exponentialDelay';
40
+ }
41
+
42
+ /**
43
+ * Default exponential backoff delay function.
44
+ *
45
+ * @param $retries
46
+ *
47
+ * @return int
48
+ */
49
+ public static function exponentialDelay($retries)
50
+ {
51
+ return (int) pow(2, $retries - 1);
52
+ }
53
+
54
+ /**
55
+ * @param RequestInterface $request
56
+ * @param array $options
57
+ *
58
+ * @return PromiseInterface
59
+ */
60
+ public function __invoke(RequestInterface $request, array $options)
61
+ {
62
+ if (!isset($options['retries'])) {
63
+ $options['retries'] = 0;
64
+ }
65
+
66
+ $fn = $this->nextHandler;
67
+ return $fn($request, $options)
68
+ ->then(
69
+ $this->onFulfilled($request, $options),
70
+ $this->onRejected($request, $options)
71
+ );
72
+ }
73
+
74
+ private function onFulfilled(RequestInterface $req, array $options)
75
+ {
76
+ return function ($value) use ($req, $options) {
77
+ if (!call_user_func(
78
+ $this->decider,
79
+ $options['retries'],
80
+ $req,
81
+ $value,
82
+ null
83
+ )) {
84
+ return $value;
85
+ }
86
+ return $this->doRetry($req, $options, $value);
87
+ };
88
+ }
89
+
90
+ private function onRejected(RequestInterface $req, array $options)
91
+ {
92
+ return function ($reason) use ($req, $options) {
93
+ if (!call_user_func(
94
+ $this->decider,
95
+ $options['retries'],
96
+ $req,
97
+ null,
98
+ $reason
99
+ )) {
100
+ return new RejectedPromise($reason);
101
+ }
102
+ return $this->doRetry($req, $options);
103
+ };
104
+ }
105
+
106
+ private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null)
107
+ {
108
+ $options['delay'] = call_user_func($this->delay, ++$options['retries'], $response);
109
+
110
+ return $this($request, $options);
111
+ }
112
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/TransferStats.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use Psr\Http\Message\RequestInterface;
5
+ use Psr\Http\Message\ResponseInterface;
6
+ use Psr\Http\Message\UriInterface;
7
+
8
+ /**
9
+ * Represents data at the point after it was transferred either successfully
10
+ * or after a network error.
11
+ */
12
+ final class TransferStats
13
+ {
14
+ private $request;
15
+ private $response;
16
+ private $transferTime;
17
+ private $handlerStats;
18
+ private $handlerErrorData;
19
+
20
+ /**
21
+ * @param RequestInterface $request Request that was sent.
22
+ * @param ResponseInterface $response Response received (if any)
23
+ * @param null $transferTime Total handler transfer time.
24
+ * @param mixed $handlerErrorData Handler error data.
25
+ * @param array $handlerStats Handler specific stats.
26
+ */
27
+ public function __construct(
28
+ RequestInterface $request,
29
+ ResponseInterface $response = null,
30
+ $transferTime = null,
31
+ $handlerErrorData = null,
32
+ $handlerStats = []
33
+ ) {
34
+ $this->request = $request;
35
+ $this->response = $response;
36
+ $this->transferTime = $transferTime;
37
+ $this->handlerErrorData = $handlerErrorData;
38
+ $this->handlerStats = $handlerStats;
39
+ }
40
+
41
+ /**
42
+ * @return RequestInterface
43
+ */
44
+ public function getRequest()
45
+ {
46
+ return $this->request;
47
+ }
48
+
49
+ /**
50
+ * Returns the response that was received (if any).
51
+ *
52
+ * @return ResponseInterface|null
53
+ */
54
+ public function getResponse()
55
+ {
56
+ return $this->response;
57
+ }
58
+
59
+ /**
60
+ * Returns true if a response was received.
61
+ *
62
+ * @return bool
63
+ */
64
+ public function hasResponse()
65
+ {
66
+ return $this->response !== null;
67
+ }
68
+
69
+ /**
70
+ * Gets handler specific error data.
71
+ *
72
+ * This might be an exception, a integer representing an error code, or
73
+ * anything else. Relying on this value assumes that you know what handler
74
+ * you are using.
75
+ *
76
+ * @return mixed
77
+ */
78
+ public function getHandlerErrorData()
79
+ {
80
+ return $this->handlerErrorData;
81
+ }
82
+
83
+ /**
84
+ * Get the effective URI the request was sent to.
85
+ *
86
+ * @return UriInterface
87
+ */
88
+ public function getEffectiveUri()
89
+ {
90
+ return $this->request->getUri();
91
+ }
92
+
93
+ /**
94
+ * Get the estimated time the request was being transferred by the handler.
95
+ *
96
+ * @return float Time in seconds.
97
+ */
98
+ public function getTransferTime()
99
+ {
100
+ return $this->transferTime;
101
+ }
102
+
103
+ /**
104
+ * Gets an array of all of the handler specific transfer data.
105
+ *
106
+ * @return array
107
+ */
108
+ public function getHandlerStats()
109
+ {
110
+ return $this->handlerStats;
111
+ }
112
+
113
+ /**
114
+ * Get a specific handler statistic from the handler by name.
115
+ *
116
+ * @param string $stat Handler specific transfer stat to retrieve.
117
+ *
118
+ * @return mixed|null
119
+ */
120
+ public function getHandlerStat($stat)
121
+ {
122
+ return isset($this->handlerStats[$stat])
123
+ ? $this->handlerStats[$stat]
124
+ : null;
125
+ }
126
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/UriTemplate.php ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ /**
5
+ * Expands URI templates. Userland implementation of PECL uri_template.
6
+ *
7
+ * @link http://tools.ietf.org/html/rfc6570
8
+ */
9
+ class UriTemplate
10
+ {
11
+ /** @var string URI template */
12
+ private $template;
13
+
14
+ /** @var array Variables to use in the template expansion */
15
+ private $variables;
16
+
17
+ /** @var array Hash for quick operator lookups */
18
+ private static $operatorHash = [
19
+ '' => ['prefix' => '', 'joiner' => ',', 'query' => false],
20
+ '+' => ['prefix' => '', 'joiner' => ',', 'query' => false],
21
+ '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false],
22
+ '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false],
23
+ '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false],
24
+ ';' => ['prefix' => ';', 'joiner' => ';', 'query' => true],
25
+ '?' => ['prefix' => '?', 'joiner' => '&', 'query' => true],
26
+ '&' => ['prefix' => '&', 'joiner' => '&', 'query' => true]
27
+ ];
28
+
29
+ /** @var array Delimiters */
30
+ private static $delims = [':', '/', '?', '#', '[', ']', '@', '!', '$',
31
+ '&', '\'', '(', ')', '*', '+', ',', ';', '='];
32
+
33
+ /** @var array Percent encoded delimiters */
34
+ private static $delimsPct = ['%3A', '%2F', '%3F', '%23', '%5B', '%5D',
35
+ '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C',
36
+ '%3B', '%3D'];
37
+
38
+ public function expand($template, array $variables)
39
+ {
40
+ if (false === strpos($template, '{')) {
41
+ return $template;
42
+ }
43
+
44
+ $this->template = $template;
45
+ $this->variables = $variables;
46
+
47
+ return preg_replace_callback(
48
+ '/\{([^\}]+)\}/',
49
+ [$this, 'expandMatch'],
50
+ $this->template
51
+ );
52
+ }
53
+
54
+ /**
55
+ * Parse an expression into parts
56
+ *
57
+ * @param string $expression Expression to parse
58
+ *
59
+ * @return array Returns an associative array of parts
60
+ */
61
+ private function parseExpression($expression)
62
+ {
63
+ $result = [];
64
+
65
+ if (isset(self::$operatorHash[$expression[0]])) {
66
+ $result['operator'] = $expression[0];
67
+ $expression = substr($expression, 1);
68
+ } else {
69
+ $result['operator'] = '';
70
+ }
71
+
72
+ foreach (explode(',', $expression) as $value) {
73
+ $value = trim($value);
74
+ $varspec = [];
75
+ if ($colonPos = strpos($value, ':')) {
76
+ $varspec['value'] = substr($value, 0, $colonPos);
77
+ $varspec['modifier'] = ':';
78
+ $varspec['position'] = (int) substr($value, $colonPos + 1);
79
+ } elseif (substr($value, -1) === '*') {
80
+ $varspec['modifier'] = '*';
81
+ $varspec['value'] = substr($value, 0, -1);
82
+ } else {
83
+ $varspec['value'] = (string) $value;
84
+ $varspec['modifier'] = '';
85
+ }
86
+ $result['values'][] = $varspec;
87
+ }
88
+
89
+ return $result;
90
+ }
91
+
92
+ /**
93
+ * Process an expansion
94
+ *
95
+ * @param array $matches Matches met in the preg_replace_callback
96
+ *
97
+ * @return string Returns the replacement string
98
+ */
99
+ private function expandMatch(array $matches)
100
+ {
101
+ static $rfc1738to3986 = ['+' => '%20', '%7e' => '~'];
102
+
103
+ $replacements = [];
104
+ $parsed = self::parseExpression($matches[1]);
105
+ $prefix = self::$operatorHash[$parsed['operator']]['prefix'];
106
+ $joiner = self::$operatorHash[$parsed['operator']]['joiner'];
107
+ $useQuery = self::$operatorHash[$parsed['operator']]['query'];
108
+
109
+ foreach ($parsed['values'] as $value) {
110
+
111
+ if (!isset($this->variables[$value['value']])) {
112
+ continue;
113
+ }
114
+
115
+ $variable = $this->variables[$value['value']];
116
+ $actuallyUseQuery = $useQuery;
117
+ $expanded = '';
118
+
119
+ if (is_array($variable)) {
120
+
121
+ $isAssoc = $this->isAssoc($variable);
122
+ $kvp = [];
123
+ foreach ($variable as $key => $var) {
124
+
125
+ if ($isAssoc) {
126
+ $key = rawurlencode($key);
127
+ $isNestedArray = is_array($var);
128
+ } else {
129
+ $isNestedArray = false;
130
+ }
131
+
132
+ if (!$isNestedArray) {
133
+ $var = rawurlencode($var);
134
+ if ($parsed['operator'] === '+' ||
135
+ $parsed['operator'] === '#'
136
+ ) {
137
+ $var = $this->decodeReserved($var);
138
+ }
139
+ }
140
+
141
+ if ($value['modifier'] === '*') {
142
+ if ($isAssoc) {
143
+ if ($isNestedArray) {
144
+ // Nested arrays must allow for deeply nested
145
+ // structures.
146
+ $var = strtr(
147
+ http_build_query([$key => $var]),
148
+ $rfc1738to3986
149
+ );
150
+ } else {
151
+ $var = $key . '=' . $var;
152
+ }
153
+ } elseif ($key > 0 && $actuallyUseQuery) {
154
+ $var = $value['value'] . '=' . $var;
155
+ }
156
+ }
157
+
158
+ $kvp[$key] = $var;
159
+ }
160
+
161
+ if (empty($variable)) {
162
+ $actuallyUseQuery = false;
163
+ } elseif ($value['modifier'] === '*') {
164
+ $expanded = implode($joiner, $kvp);
165
+ if ($isAssoc) {
166
+ // Don't prepend the value name when using the explode
167
+ // modifier with an associative array.
168
+ $actuallyUseQuery = false;
169
+ }
170
+ } else {
171
+ if ($isAssoc) {
172
+ // When an associative array is encountered and the
173
+ // explode modifier is not set, then the result must be
174
+ // a comma separated list of keys followed by their
175
+ // respective values.
176
+ foreach ($kvp as $k => &$v) {
177
+ $v = $k . ',' . $v;
178
+ }
179
+ }
180
+ $expanded = implode(',', $kvp);
181
+ }
182
+
183
+ } else {
184
+ if ($value['modifier'] === ':') {
185
+ $variable = substr($variable, 0, $value['position']);
186
+ }
187
+ $expanded = rawurlencode($variable);
188
+ if ($parsed['operator'] === '+' || $parsed['operator'] === '#') {
189
+ $expanded = $this->decodeReserved($expanded);
190
+ }
191
+ }
192
+
193
+ if ($actuallyUseQuery) {
194
+ if (!$expanded && $joiner !== '&') {
195
+ $expanded = $value['value'];
196
+ } else {
197
+ $expanded = $value['value'] . '=' . $expanded;
198
+ }
199
+ }
200
+
201
+ $replacements[] = $expanded;
202
+ }
203
+
204
+ $ret = implode($joiner, $replacements);
205
+ if ($ret && $prefix) {
206
+ return $prefix . $ret;
207
+ }
208
+
209
+ return $ret;
210
+ }
211
+
212
+ /**
213
+ * Determines if an array is associative.
214
+ *
215
+ * This makes the assumption that input arrays are sequences or hashes.
216
+ * This assumption is a tradeoff for accuracy in favor of speed, but it
217
+ * should work in almost every case where input is supplied for a URI
218
+ * template.
219
+ *
220
+ * @param array $array Array to check
221
+ *
222
+ * @return bool
223
+ */
224
+ private function isAssoc(array $array)
225
+ {
226
+ return $array && array_keys($array)[0] !== 0;
227
+ }
228
+
229
+ /**
230
+ * Removes percent encoding on reserved characters (used with + and #
231
+ * modifiers).
232
+ *
233
+ * @param string $string String to fix
234
+ *
235
+ * @return string
236
+ */
237
+ private function decodeReserved($string)
238
+ {
239
+ return str_replace(self::$delimsPct, self::$delims, $string);
240
+ }
241
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/src/functions.php ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp;
3
+
4
+ use GuzzleHttp\Handler\CurlHandler;
5
+ use GuzzleHttp\Handler\CurlMultiHandler;
6
+ use GuzzleHttp\Handler\Proxy;
7
+ use GuzzleHttp\Handler\StreamHandler;
8
+
9
+ /**
10
+ * Expands a URI template
11
+ *
12
+ * @param string $template URI template
13
+ * @param array $variables Template variables
14
+ *
15
+ * @return string
16
+ */
17
+ function uri_template($template, array $variables)
18
+ {
19
+ if (extension_loaded('uri_template')) {
20
+ // @codeCoverageIgnoreStart
21
+ return \uri_template($template, $variables);
22
+ // @codeCoverageIgnoreEnd
23
+ }
24
+
25
+ static $uriTemplate;
26
+ if (!$uriTemplate) {
27
+ $uriTemplate = new UriTemplate();
28
+ }
29
+
30
+ return $uriTemplate->expand($template, $variables);
31
+ }
32
+
33
+ /**
34
+ * Debug function used to describe the provided value type and class.
35
+ *
36
+ * @param mixed $input
37
+ *
38
+ * @return string Returns a string containing the type of the variable and
39
+ * if a class is provided, the class name.
40
+ */
41
+ function describe_type($input)
42
+ {
43
+ switch (gettype($input)) {
44
+ case 'object':
45
+ return 'object(' . get_class($input) . ')';
46
+ case 'array':
47
+ return 'array(' . count($input) . ')';
48
+ default:
49
+ ob_start();
50
+ var_dump($input);
51
+ // normalize float vs double
52
+ return str_replace('double(', 'float(', rtrim(ob_get_clean()));
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Parses an array of header lines into an associative array of headers.
58
+ *
59
+ * @param array $lines Header lines array of strings in the following
60
+ * format: "Name: Value"
61
+ * @return array
62
+ */
63
+ function headers_from_lines($lines)
64
+ {
65
+ $headers = [];
66
+
67
+ foreach ($lines as $line) {
68
+ $parts = explode(':', $line, 2);
69
+ $headers[trim($parts[0])][] = isset($parts[1])
70
+ ? trim($parts[1])
71
+ : null;
72
+ }
73
+
74
+ return $headers;
75
+ }
76
+
77
+ /**
78
+ * Returns a debug stream based on the provided variable.
79
+ *
80
+ * @param mixed $value Optional value
81
+ *
82
+ * @return resource
83
+ */
84
+ function debug_resource($value = null)
85
+ {
86
+ if (is_resource($value)) {
87
+ return $value;
88
+ } elseif (defined('STDOUT')) {
89
+ return STDOUT;
90
+ }
91
+
92
+ return fopen('php://output', 'w');
93
+ }
94
+
95
+ /**
96
+ * Chooses and creates a default handler to use based on the environment.
97
+ *
98
+ * The returned handler is not wrapped by any default middlewares.
99
+ *
100
+ * @throws \RuntimeException if no viable Handler is available.
101
+ * @return callable Returns the best handler for the given system.
102
+ */
103
+ function choose_handler()
104
+ {
105
+ $handler = null;
106
+ if (function_exists('curl_multi_exec') && function_exists('curl_exec')) {
107
+ $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler());
108
+ } elseif (function_exists('curl_exec')) {
109
+ $handler = new CurlHandler();
110
+ } elseif (function_exists('curl_multi_exec')) {
111
+ $handler = new CurlMultiHandler();
112
+ }
113
+
114
+ if (ini_get('allow_url_fopen')) {
115
+ $handler = $handler
116
+ ? Proxy::wrapStreaming($handler, new StreamHandler())
117
+ : new StreamHandler();
118
+ } elseif (!$handler) {
119
+ throw new \RuntimeException('GuzzleHttp requires cURL, the '
120
+ . 'allow_url_fopen ini setting, or a custom HTTP handler.');
121
+ }
122
+
123
+ return $handler;
124
+ }
125
+
126
+ /**
127
+ * Get the default User-Agent string to use with Guzzle
128
+ *
129
+ * @return string
130
+ */
131
+ function default_user_agent()
132
+ {
133
+ static $defaultAgent = '';
134
+
135
+ if (!$defaultAgent) {
136
+ $defaultAgent = 'GuzzleHttp/' . Client::VERSION;
137
+ if (extension_loaded('curl') && function_exists('curl_version')) {
138
+ $defaultAgent .= ' curl/' . \curl_version()['version'];
139
+ }
140
+ $defaultAgent .= ' PHP/' . PHP_VERSION;
141
+ }
142
+
143
+ return $defaultAgent;
144
+ }
145
+
146
+ /**
147
+ * Returns the default cacert bundle for the current system.
148
+ *
149
+ * First, the openssl.cafile and curl.cainfo php.ini settings are checked.
150
+ * If those settings are not configured, then the common locations for
151
+ * bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X
152
+ * and Windows are checked. If any of these file locations are found on
153
+ * disk, they will be utilized.
154
+ *
155
+ * Note: the result of this function is cached for subsequent calls.
156
+ *
157
+ * @return string
158
+ * @throws \RuntimeException if no bundle can be found.
159
+ */
160
+ function default_ca_bundle()
161
+ {
162
+ static $cached = null;
163
+ static $cafiles = [
164
+ // Red Hat, CentOS, Fedora (provided by the ca-certificates package)
165
+ '/etc/pki/tls/certs/ca-bundle.crt',
166
+ // Ubuntu, Debian (provided by the ca-certificates package)
167
+ '/etc/ssl/certs/ca-certificates.crt',
168
+ // FreeBSD (provided by the ca_root_nss package)
169
+ '/usr/local/share/certs/ca-root-nss.crt',
170
+ // OS X provided by homebrew (using the default path)
171
+ '/usr/local/etc/openssl/cert.pem',
172
+ // Google app engine
173
+ '/etc/ca-certificates.crt',
174
+ // Windows?
175
+ 'C:\\windows\\system32\\curl-ca-bundle.crt',
176
+ 'C:\\windows\\curl-ca-bundle.crt',
177
+ ];
178
+
179
+ if ($cached) {
180
+ return $cached;
181
+ }
182
+
183
+ if ($ca = ini_get('openssl.cafile')) {
184
+ return $cached = $ca;
185
+ }
186
+
187
+ if ($ca = ini_get('curl.cainfo')) {
188
+ return $cached = $ca;
189
+ }
190
+
191
+ foreach ($cafiles as $filename) {
192
+ if (file_exists($filename)) {
193
+ return $cached = $filename;
194
+ }
195
+ }
196
+
197
+ throw new \RuntimeException(<<< EOT
198
+ No system CA bundle could be found in any of the the common system locations.
199
+ PHP versions earlier than 5.6 are not properly configured to use the system's
200
+ CA bundle by default. In order to verify peer certificates, you will need to
201
+ supply the path on disk to a certificate bundle to the 'verify' request
202
+ option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not
203
+ need a specific certificate bundle, then Mozilla provides a commonly used CA
204
+ bundle which can be downloaded here (provided by the maintainer of cURL):
205
+ https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt. Once
206
+ you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP
207
+ ini setting to point to the path to the file, allowing you to omit the 'verify'
208
+ request option. See http://curl.haxx.se/docs/sslcerts.html for more
209
+ information.
210
+ EOT
211
+ );
212
+ }
213
+
214
+ /**
215
+ * Creates an associative array of lowercase header names to the actual
216
+ * header casing.
217
+ *
218
+ * @param array $headers
219
+ *
220
+ * @return array
221
+ */
222
+ function normalize_header_keys(array $headers)
223
+ {
224
+ $result = [];
225
+ foreach (array_keys($headers) as $key) {
226
+ $result[strtolower($key)] = $key;
227
+ }
228
+
229
+ return $result;
230
+ }
231
+
232
+ /**
233
+ * Returns true if the provided host matches any of the no proxy areas.
234
+ *
235
+ * This method will strip a port from the host if it is present. Each pattern
236
+ * can be matched with an exact match (e.g., "foo.com" == "foo.com") or a
237
+ * partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" ==
238
+ * "baz.foo.com", but ".foo.com" != "foo.com").
239
+ *
240
+ * Areas are matched in the following cases:
241
+ * 1. "*" (without quotes) always matches any hosts.
242
+ * 2. An exact match.
243
+ * 3. The area starts with "." and the area is the last part of the host. e.g.
244
+ * '.mit.edu' will match any host that ends with '.mit.edu'.
245
+ *
246
+ * @param string $host Host to check against the patterns.
247
+ * @param array $noProxyArray An array of host patterns.
248
+ *
249
+ * @return bool
250
+ */
251
+ function is_host_in_noproxy($host, array $noProxyArray)
252
+ {
253
+ if (strlen($host) === 0) {
254
+ throw new \InvalidArgumentException('Empty host provided');
255
+ }
256
+
257
+ // Strip port if present.
258
+ if (strpos($host, ':')) {
259
+ $host = explode($host, ':', 2)[0];
260
+ }
261
+
262
+ foreach ($noProxyArray as $area) {
263
+ // Always match on wildcards.
264
+ if ($area === '*') {
265
+ return true;
266
+ } elseif (empty($area)) {
267
+ // Don't match on empty values.
268
+ continue;
269
+ } elseif ($area === $host) {
270
+ // Exact matches.
271
+ return true;
272
+ } else {
273
+ // Special match if the area when prefixed with ".". Remove any
274
+ // existing leading "." and add a new leading ".".
275
+ $area = '.' . ltrim($area, '.');
276
+ if (substr($host, -(strlen($area))) === $area) {
277
+ return true;
278
+ }
279
+ }
280
+ }
281
+
282
+ return false;
283
+ }
284
+
285
+ /**
286
+ * Wrapper for json_decode that throws when an error occurs.
287
+ *
288
+ * @param string $json JSON data to parse
289
+ * @param bool $assoc When true, returned objects will be converted
290
+ * into associative arrays.
291
+ * @param int $depth User specified recursion depth.
292
+ * @param int $options Bitmask of JSON decode options.
293
+ *
294
+ * @return mixed
295
+ * @throws \InvalidArgumentException if the JSON cannot be decoded.
296
+ * @link http://www.php.net/manual/en/function.json-decode.php
297
+ */
298
+ function json_decode($json, $assoc = false, $depth = 512, $options = 0)
299
+ {
300
+ $data = \json_decode($json, $assoc, $depth, $options);
301
+ if (JSON_ERROR_NONE !== json_last_error()) {
302
+ throw new \InvalidArgumentException(
303
+ 'json_decode error: ' . json_last_error_msg());
304
+ }
305
+
306
+ return $data;
307
+ }
308
+
309
+ /**
310
+ * Wrapper for JSON encoding that throws when an error occurs.
311
+ *
312
+ * @param mixed $value The value being encoded
313
+ * @param int $options JSON encode option bitmask
314
+ * @param int $depth Set the maximum depth. Must be greater than zero.
315
+ *
316
+ * @return string
317
+ * @throws \InvalidArgumentException if the JSON cannot be encoded.
318
+ * @link http://www.php.net/manual/en/function.json-encode.php
319
+ */
320
+ function json_encode($value, $options = 0, $depth = 512)
321
+ {
322
+ $json = \json_encode($value, $options, $depth);
323
+ if (JSON_ERROR_NONE !== json_last_error()) {
324
+ throw new \InvalidArgumentException(
325
+ 'json_encode error: ' . json_last_error_msg());
326
+ }
327
+
328
+ return $json;
329
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/guzzle/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\uri_template')) {
5
+ require __DIR__ . '/functions.php';
6
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/.travis.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ php:
4
+ - 5.5
5
+ - 5.6
6
+ - 7.0
7
+ - 7.1
8
+ - hhvm
9
+
10
+ sudo: false
11
+
12
+ install:
13
+ - travis_retry composer install --no-interaction --prefer-source
14
+
15
+ script: make test
16
+
17
+ matrix:
18
+ allow_failures:
19
+ - php: hhvm
20
+ fast_finish: true
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CHANGELOG
2
+
3
+ ## 1.3.0 - 2016-11-18
4
+
5
+ * Adds support for custom task queues.
6
+ * Fixed coroutine promise memory leak.
7
+
8
+ ## 1.2.0 - 2016-05-18
9
+
10
+ * Update to now catch `\Throwable` on PHP 7+
11
+
12
+ ## 1.1.0 - 2016-03-07
13
+
14
+ * Update EachPromise to prevent recurring on a iterator when advancing, as this
15
+ could trigger fatal generator errors.
16
+ * Update Promise to allow recursive waiting without unwrapping exceptions.
17
+
18
+ ## 1.0.3 - 2015-10-15
19
+
20
+ * Update EachPromise to immediately resolve when the underlying promise iterator
21
+ is empty. Previously, such a promise would throw an exception when its `wait`
22
+ function was called.
23
+
24
+ ## 1.0.2 - 2015-05-15
25
+
26
+ * Conditionally require functions.php.
27
+
28
+ ## 1.0.1 - 2015-06-24
29
+
30
+ * Updating EachPromise to call next on the underlying promise iterator as late
31
+ as possible to ensure that generators that generate new requests based on
32
+ callbacks are not iterated until after callbacks are invoked.
33
+
34
+ ## 1.0.0 - 2015-05-12
35
+
36
+ * Initial release
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/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.
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/Makefile ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ all: clean test
2
+
3
+ test:
4
+ vendor/bin/phpunit
5
+
6
+ coverage:
7
+ vendor/bin/phpunit --coverage-html=artifacts/coverage
8
+
9
+ view-coverage:
10
+ open artifacts/coverage/index.html
11
+
12
+ clean:
13
+ rm -rf artifacts/*
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/README.md ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Guzzle Promises
2
+
3
+ [Promises/A+](https://promisesaplus.com/) implementation that handles promise
4
+ chaining and resolution iteratively, allowing for "infinite" promise chaining
5
+ while keeping the stack size constant. Read [this blog post](https://blog.domenic.me/youre-missing-the-point-of-promises/)
6
+ for a general introduction to promises.
7
+
8
+ - [Features](#features)
9
+ - [Quick start](#quick-start)
10
+ - [Synchronous wait](#synchronous-wait)
11
+ - [Cancellation](#cancellation)
12
+ - [API](#api)
13
+ - [Promise](#promise)
14
+ - [FulfilledPromise](#fulfilledpromise)
15
+ - [RejectedPromise](#rejectedpromise)
16
+ - [Promise interop](#promise-interop)
17
+ - [Implementation notes](#implementation-notes)
18
+
19
+
20
+ # Features
21
+
22
+ - [Promises/A+](https://promisesaplus.com/) implementation.
23
+ - Promise resolution and chaining is handled iteratively, allowing for
24
+ "infinite" promise chaining.
25
+ - Promises have a synchronous `wait` method.
26
+ - Promises can be cancelled.
27
+ - Works with any object that has a `then` function.
28
+ - C# style async/await coroutine promises using
29
+ `GuzzleHttp\Promise\coroutine()`.
30
+
31
+
32
+ # Quick start
33
+
34
+ A *promise* represents the eventual result of an asynchronous operation. The
35
+ primary way of interacting with a promise is through its `then` method, which
36
+ registers callbacks to receive either a promise's eventual value or the reason
37
+ why the promise cannot be fulfilled.
38
+
39
+
40
+ ## Callbacks
41
+
42
+ Callbacks are registered with the `then` method by providing an optional
43
+ `$onFulfilled` followed by an optional `$onRejected` function.
44
+
45
+
46
+ ```php
47
+ use GuzzleHttp\Promise\Promise;
48
+
49
+ $promise = new Promise();
50
+ $promise->then(
51
+ // $onFulfilled
52
+ function ($value) {
53
+ echo 'The promise was fulfilled.';
54
+ },
55
+ // $onRejected
56
+ function ($reason) {
57
+ echo 'The promise was rejected.';
58
+ }
59
+ );
60
+ ```
61
+
62
+ *Resolving* a promise means that you either fulfill a promise with a *value* or
63
+ reject a promise with a *reason*. Resolving a promises triggers callbacks
64
+ registered with the promises's `then` method. These callbacks are triggered
65
+ only once and in the order in which they were added.
66
+
67
+
68
+ ## Resolving a promise
69
+
70
+ Promises are fulfilled using the `resolve($value)` method. Resolving a promise
71
+ with any value other than a `GuzzleHttp\Promise\RejectedPromise` will trigger
72
+ all of the onFulfilled callbacks (resolving a promise with a rejected promise
73
+ will reject the promise and trigger the `$onRejected` callbacks).
74
+
75
+ ```php
76
+ use GuzzleHttp\Promise\Promise;
77
+
78
+ $promise = new Promise();
79
+ $promise
80
+ ->then(function ($value) {
81
+ // Return a value and don't break the chain
82
+ return "Hello, " . $value;
83
+ })
84
+ // This then is executed after the first then and receives the value
85
+ // returned from the first then.
86
+ ->then(function ($value) {
87
+ echo $value;
88
+ });
89
+
90
+ // Resolving the promise triggers the $onFulfilled callbacks and outputs
91
+ // "Hello, reader".
92
+ $promise->resolve('reader.');
93
+ ```
94
+
95
+
96
+ ## Promise forwarding
97
+
98
+ Promises can be chained one after the other. Each then in the chain is a new
99
+ promise. The return value of of a promise is what's forwarded to the next
100
+ promise in the chain. Returning a promise in a `then` callback will cause the
101
+ subsequent promises in the chain to only be fulfilled when the returned promise
102
+ has been fulfilled. The next promise in the chain will be invoked with the
103
+ resolved value of the promise.
104
+
105
+ ```php
106
+ use GuzzleHttp\Promise\Promise;
107
+
108
+ $promise = new Promise();
109
+ $nextPromise = new Promise();
110
+
111
+ $promise
112
+ ->then(function ($value) use ($nextPromise) {
113
+ echo $value;
114
+ return $nextPromise;
115
+ })
116
+ ->then(function ($value) {
117
+ echo $value;
118
+ });
119
+
120
+ // Triggers the first callback and outputs "A"
121
+ $promise->resolve('A');
122
+ // Triggers the second callback and outputs "B"
123
+ $nextPromise->resolve('B');
124
+ ```
125
+
126
+ ## Promise rejection
127
+
128
+ When a promise is rejected, the `$onRejected` callbacks are invoked with the
129
+ rejection reason.
130
+
131
+ ```php
132
+ use GuzzleHttp\Promise\Promise;
133
+
134
+ $promise = new Promise();
135
+ $promise->then(null, function ($reason) {
136
+ echo $reason;
137
+ });
138
+
139
+ $promise->reject('Error!');
140
+ // Outputs "Error!"
141
+ ```
142
+
143
+ ## Rejection forwarding
144
+
145
+ If an exception is thrown in an `$onRejected` callback, subsequent
146
+ `$onRejected` callbacks are invoked with the thrown exception as the reason.
147
+
148
+ ```php
149
+ use GuzzleHttp\Promise\Promise;
150
+
151
+ $promise = new Promise();
152
+ $promise->then(null, function ($reason) {
153
+ throw new \Exception($reason);
154
+ })->then(null, function ($reason) {
155
+ assert($reason->getMessage() === 'Error!');
156
+ });
157
+
158
+ $promise->reject('Error!');
159
+ ```
160
+
161
+ You can also forward a rejection down the promise chain by returning a
162
+ `GuzzleHttp\Promise\RejectedPromise` in either an `$onFulfilled` or
163
+ `$onRejected` callback.
164
+
165
+ ```php
166
+ use GuzzleHttp\Promise\Promise;
167
+ use GuzzleHttp\Promise\RejectedPromise;
168
+
169
+ $promise = new Promise();
170
+ $promise->then(null, function ($reason) {
171
+ return new RejectedPromise($reason);
172
+ })->then(null, function ($reason) {
173
+ assert($reason === 'Error!');
174
+ });
175
+
176
+ $promise->reject('Error!');
177
+ ```
178
+
179
+ If an exception is not thrown in a `$onRejected` callback and the callback
180
+ does not return a rejected promise, downstream `$onFulfilled` callbacks are
181
+ invoked using the value returned from the `$onRejected` callback.
182
+
183
+ ```php
184
+ use GuzzleHttp\Promise\Promise;
185
+ use GuzzleHttp\Promise\RejectedPromise;
186
+
187
+ $promise = new Promise();
188
+ $promise
189
+ ->then(null, function ($reason) {
190
+ return "It's ok";
191
+ })
192
+ ->then(function ($value) {
193
+ assert($value === "It's ok");
194
+ });
195
+
196
+ $promise->reject('Error!');
197
+ ```
198
+
199
+ # Synchronous wait
200
+
201
+ You can synchronously force promises to complete using a promise's `wait`
202
+ method. When creating a promise, you can provide a wait function that is used
203
+ to synchronously force a promise to complete. When a wait function is invoked
204
+ it is expected to deliver a value to the promise or reject the promise. If the
205
+ wait function does not deliver a value, then an exception is thrown. The wait
206
+ function provided to a promise constructor is invoked when the `wait` function
207
+ of the promise is called.
208
+
209
+ ```php
210
+ $promise = new Promise(function () use (&$promise) {
211
+ $promise->resolve('foo');
212
+ });
213
+
214
+ // Calling wait will return the value of the promise.
215
+ echo $promise->wait(); // outputs "foo"
216
+ ```
217
+
218
+ If an exception is encountered while invoking the wait function of a promise,
219
+ the promise is rejected with the exception and the exception is thrown.
220
+
221
+ ```php
222
+ $promise = new Promise(function () use (&$promise) {
223
+ throw new \Exception('foo');
224
+ });
225
+
226
+ $promise->wait(); // throws the exception.
227
+ ```
228
+
229
+ Calling `wait` on a promise that has been fulfilled will not trigger the wait
230
+ function. It will simply return the previously resolved value.
231
+
232
+ ```php
233
+ $promise = new Promise(function () { die('this is not called!'); });
234
+ $promise->resolve('foo');
235
+ echo $promise->wait(); // outputs "foo"
236
+ ```
237
+
238
+ Calling `wait` on a promise that has been rejected will throw an exception. If
239
+ the rejection reason is an instance of `\Exception` the reason is thrown.
240
+ Otherwise, a `GuzzleHttp\Promise\RejectionException` is thrown and the reason
241
+ can be obtained by calling the `getReason` method of the exception.
242
+
243
+ ```php
244
+ $promise = new Promise();
245
+ $promise->reject('foo');
246
+ $promise->wait();
247
+ ```
248
+
249
+ > PHP Fatal error: Uncaught exception 'GuzzleHttp\Promise\RejectionException' with message 'The promise was rejected with value: foo'
250
+
251
+
252
+ ## Unwrapping a promise
253
+
254
+ When synchronously waiting on a promise, you are joining the state of the
255
+ promise into the current state of execution (i.e., return the value of the
256
+ promise if it was fulfilled or throw an exception if it was rejected). This is
257
+ called "unwrapping" the promise. Waiting on a promise will by default unwrap
258
+ the promise state.
259
+
260
+ You can force a promise to resolve and *not* unwrap the state of the promise
261
+ by passing `false` to the first argument of the `wait` function:
262
+
263
+ ```php
264
+ $promise = new Promise();
265
+ $promise->reject('foo');
266
+ // This will not throw an exception. It simply ensures the promise has
267
+ // been resolved.
268
+ $promise->wait(false);
269
+ ```
270
+
271
+ When unwrapping a promise, the resolved value of the promise will be waited
272
+ upon until the unwrapped value is not a promise. This means that if you resolve
273
+ promise A with a promise B and unwrap promise A, the value returned by the
274
+ wait function will be the value delivered to promise B.
275
+
276
+ **Note**: when you do not unwrap the promise, no value is returned.
277
+
278
+
279
+ # Cancellation
280
+
281
+ You can cancel a promise that has not yet been fulfilled using the `cancel()`
282
+ method of a promise. When creating a promise you can provide an optional
283
+ cancel function that when invoked cancels the action of computing a resolution
284
+ of the promise.
285
+
286
+
287
+ # API
288
+
289
+
290
+ ## Promise
291
+
292
+ When creating a promise object, you can provide an optional `$waitFn` and
293
+ `$cancelFn`. `$waitFn` is a function that is invoked with no arguments and is
294
+ expected to resolve the promise. `$cancelFn` is a function with no arguments
295
+ that is expected to cancel the computation of a promise. It is invoked when the
296
+ `cancel()` method of a promise is called.
297
+
298
+ ```php
299
+ use GuzzleHttp\Promise\Promise;
300
+
301
+ $promise = new Promise(
302
+ function () use (&$promise) {
303
+ $promise->resolve('waited');
304
+ },
305
+ function () {
306
+ // do something that will cancel the promise computation (e.g., close
307
+ // a socket, cancel a database query, etc...)
308
+ }
309
+ );
310
+
311
+ assert('waited' === $promise->wait());
312
+ ```
313
+
314
+ A promise has the following methods:
315
+
316
+ - `then(callable $onFulfilled, callable $onRejected) : PromiseInterface`
317
+
318
+ Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.
319
+
320
+ - `otherwise(callable $onRejected) : PromiseInterface`
321
+
322
+ Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled.
323
+
324
+ - `wait($unwrap = true) : mixed`
325
+
326
+ Synchronously waits on the promise to complete.
327
+
328
+ `$unwrap` controls whether or not the value of the promise is returned for a
329
+ fulfilled promise or if an exception is thrown if the promise is rejected.
330
+ This is set to `true` by default.
331
+
332
+ - `cancel()`
333
+
334
+ Attempts to cancel the promise if possible. The promise being cancelled and
335
+ the parent most ancestor that has not yet been resolved will also be
336
+ cancelled. Any promises waiting on the cancelled promise to resolve will also
337
+ be cancelled.
338
+
339
+ - `getState() : string`
340
+
341
+ Returns the state of the promise. One of `pending`, `fulfilled`, or
342
+ `rejected`.
343
+
344
+ - `resolve($value)`
345
+
346
+ Fulfills the promise with the given `$value`.
347
+
348
+ - `reject($reason)`
349
+
350
+ Rejects the promise with the given `$reason`.
351
+
352
+
353
+ ## FulfilledPromise
354
+
355
+ A fulfilled promise can be created to represent a promise that has been
356
+ fulfilled.
357
+
358
+ ```php
359
+ use GuzzleHttp\Promise\FulfilledPromise;
360
+
361
+ $promise = new FulfilledPromise('value');
362
+
363
+ // Fulfilled callbacks are immediately invoked.
364
+ $promise->then(function ($value) {
365
+ echo $value;
366
+ });
367
+ ```
368
+
369
+
370
+ ## RejectedPromise
371
+
372
+ A rejected promise can be created to represent a promise that has been
373
+ rejected.
374
+
375
+ ```php
376
+ use GuzzleHttp\Promise\RejectedPromise;
377
+
378
+ $promise = new RejectedPromise('Error');
379
+
380
+ // Rejected callbacks are immediately invoked.
381
+ $promise->then(null, function ($reason) {
382
+ echo $reason;
383
+ });
384
+ ```
385
+
386
+
387
+ # Promise interop
388
+
389
+ This library works with foreign promises that have a `then` method. This means
390
+ you can use Guzzle promises with [React promises](https://github.com/reactphp/promise)
391
+ for example. When a foreign promise is returned inside of a then method
392
+ callback, promise resolution will occur recursively.
393
+
394
+ ```php
395
+ // Create a React promise
396
+ $deferred = new React\Promise\Deferred();
397
+ $reactPromise = $deferred->promise();
398
+
399
+ // Create a Guzzle promise that is fulfilled with a React promise.
400
+ $guzzlePromise = new \GuzzleHttp\Promise\Promise();
401
+ $guzzlePromise->then(function ($value) use ($reactPromise) {
402
+ // Do something something with the value...
403
+ // Return the React promise
404
+ return $reactPromise;
405
+ });
406
+ ```
407
+
408
+ Please note that wait and cancel chaining is no longer possible when forwarding
409
+ a foreign promise. You will need to wrap a third-party promise with a Guzzle
410
+ promise in order to utilize wait and cancel functions with foreign promises.
411
+
412
+
413
+ ## Event Loop Integration
414
+
415
+ In order to keep the stack size constant, Guzzle promises are resolved
416
+ asynchronously using a task queue. When waiting on promises synchronously, the
417
+ task queue will be automatically run to ensure that the blocking promise and
418
+ any forwarded promises are resolved. When using promises asynchronously in an
419
+ event loop, you will need to run the task queue on each tick of the loop. If
420
+ you do not run the task queue, then promises will not be resolved.
421
+
422
+ You can run the task queue using the `run()` method of the global task queue
423
+ instance.
424
+
425
+ ```php
426
+ // Get the global task queue
427
+ $queue = \GuzzleHttp\Promise\queue();
428
+ $queue->run();
429
+ ```
430
+
431
+ For example, you could use Guzzle promises with React using a periodic timer:
432
+
433
+ ```php
434
+ $loop = React\EventLoop\Factory::create();
435
+ $loop->addPeriodicTimer(0, [$queue, 'run']);
436
+ ```
437
+
438
+ *TODO*: Perhaps adding a `futureTick()` on each tick would be faster?
439
+
440
+
441
+ # Implementation notes
442
+
443
+
444
+ ## Promise resolution and chaining is handled iteratively
445
+
446
+ By shuffling pending handlers from one owner to another, promises are
447
+ resolved iteratively, allowing for "infinite" then chaining.
448
+
449
+ ```php
450
+ <?php
451
+ require 'vendor/autoload.php';
452
+
453
+ use GuzzleHttp\Promise\Promise;
454
+
455
+ $parent = new Promise();
456
+ $p = $parent;
457
+
458
+ for ($i = 0; $i < 1000; $i++) {
459
+ $p = $p->then(function ($v) {
460
+ // The stack size remains constant (a good thing)
461
+ echo xdebug_get_stack_depth() . ', ';
462
+ return $v + 1;
463
+ });
464
+ }
465
+
466
+ $parent->resolve(0);
467
+ var_dump($p->wait()); // int(1000)
468
+
469
+ ```
470
+
471
+ When a promise is fulfilled or rejected with a non-promise value, the promise
472
+ then takes ownership of the handlers of each child promise and delivers values
473
+ down the chain without using recursion.
474
+
475
+ When a promise is resolved with another promise, the original promise transfers
476
+ all of its pending handlers to the new promise. When the new promise is
477
+ eventually resolved, all of the pending handlers are delivered the forwarded
478
+ value.
479
+
480
+
481
+ ## A promise is the deferred.
482
+
483
+ Some promise libraries implement promises using a deferred object to represent
484
+ a computation and a promise object to represent the delivery of the result of
485
+ the computation. This is a nice separation of computation and delivery because
486
+ consumers of the promise cannot modify the value that will be eventually
487
+ delivered.
488
+
489
+ One side effect of being able to implement promise resolution and chaining
490
+ iteratively is that you need to be able for one promise to reach into the state
491
+ of another promise to shuffle around ownership of handlers. In order to achieve
492
+ this without making the handlers of a promise publicly mutable, a promise is
493
+ also the deferred value, allowing promises of the same parent class to reach
494
+ into and modify the private properties of promises of the same type. While this
495
+ does allow consumers of the value to modify the resolution or rejection of the
496
+ deferred, it is a small price to pay for keeping the stack size constant.
497
+
498
+ ```php
499
+ $promise = new Promise();
500
+ $promise->then(function ($value) { echo $value; });
501
+ // The promise is the deferred value, so you can deliver a value to it.
502
+ $promise->resolve('foo');
503
+ // prints "foo"
504
+ ```
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/composer.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "guzzlehttp/promises",
3
+ "type": "library",
4
+ "description": "Guzzle promises library",
5
+ "keywords": ["promise"],
6
+ "license": "MIT",
7
+ "authors": [
8
+ {
9
+ "name": "Michael Dowling",
10
+ "email": "mtdowling@gmail.com",
11
+ "homepage": "https://github.com/mtdowling"
12
+ }
13
+ ],
14
+ "require": {
15
+ "php": ">=5.5.0"
16
+ },
17
+ "require-dev": {
18
+ "phpunit/phpunit": "~4.0"
19
+ },
20
+ "autoload": {
21
+ "psr-4": {
22
+ "GuzzleHttp\\Promise\\": "src/"
23
+ },
24
+ "files": ["src/functions_include.php"]
25
+ },
26
+ "extra": {
27
+ "branch-alias": {
28
+ "dev-master": "1.0-dev"
29
+ }
30
+ }
31
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/phpunit.xml.dist ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit bootstrap="./tests/bootstrap.php"
3
+ colors="true">
4
+ <testsuites>
5
+ <testsuite>
6
+ <directory>tests</directory>
7
+ </testsuite>
8
+ </testsuites>
9
+ <filter>
10
+ <whitelist>
11
+ <directory suffix=".php">src</directory>
12
+ <exclude>
13
+ <directory suffix="Interface.php">src/</directory>
14
+ </exclude>
15
+ </whitelist>
16
+ </filter>
17
+ </phpunit>
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/AggregateException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * Exception thrown when too many errors occur in the some() or any() methods.
6
+ */
7
+ class AggregateException extends RejectionException
8
+ {
9
+ public function __construct($msg, array $reasons)
10
+ {
11
+ parent::__construct(
12
+ $reasons,
13
+ sprintf('%s; %d rejected promises', $msg, count($reasons))
14
+ );
15
+ }
16
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/CancellationException.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * Exception that is set as the reason for a promise that has been cancelled.
6
+ */
7
+ class CancellationException extends RejectionException
8
+ {
9
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/Coroutine.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ use Exception;
5
+ use Generator;
6
+ use Throwable;
7
+
8
+ /**
9
+ * Creates a promise that is resolved using a generator that yields values or
10
+ * promises (somewhat similar to C#'s async keyword).
11
+ *
12
+ * When called, the coroutine function will start an instance of the generator
13
+ * and returns a promise that is fulfilled with its final yielded value.
14
+ *
15
+ * Control is returned back to the generator when the yielded promise settles.
16
+ * This can lead to less verbose code when doing lots of sequential async calls
17
+ * with minimal processing in between.
18
+ *
19
+ * use GuzzleHttp\Promise;
20
+ *
21
+ * function createPromise($value) {
22
+ * return new Promise\FulfilledPromise($value);
23
+ * }
24
+ *
25
+ * $promise = Promise\coroutine(function () {
26
+ * $value = (yield createPromise('a'));
27
+ * try {
28
+ * $value = (yield createPromise($value . 'b'));
29
+ * } catch (\Exception $e) {
30
+ * // The promise was rejected.
31
+ * }
32
+ * yield $value . 'c';
33
+ * });
34
+ *
35
+ * // Outputs "abc"
36
+ * $promise->then(function ($v) { echo $v; });
37
+ *
38
+ * @param callable $generatorFn Generator function to wrap into a promise.
39
+ *
40
+ * @return Promise
41
+ * @link https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration
42
+ */
43
+ final class Coroutine implements PromiseInterface
44
+ {
45
+ /**
46
+ * @var PromiseInterface|null
47
+ */
48
+ private $currentPromise;
49
+
50
+ /**
51
+ * @var Generator
52
+ */
53
+ private $generator;
54
+
55
+ /**
56
+ * @var Promise
57
+ */
58
+ private $result;
59
+
60
+ public function __construct(callable $generatorFn)
61
+ {
62
+ $this->generator = $generatorFn();
63
+ $this->result = new Promise(function () {
64
+ while (isset($this->currentPromise)) {
65
+ $this->currentPromise->wait();
66
+ }
67
+ });
68
+ $this->nextCoroutine($this->generator->current());
69
+ }
70
+
71
+ public function then(
72
+ callable $onFulfilled = null,
73
+ callable $onRejected = null
74
+ ) {
75
+ return $this->result->then($onFulfilled, $onRejected);
76
+ }
77
+
78
+ public function otherwise(callable $onRejected)
79
+ {
80
+ return $this->result->otherwise($onRejected);
81
+ }
82
+
83
+ public function wait($unwrap = true)
84
+ {
85
+ return $this->result->wait($unwrap);
86
+ }
87
+
88
+ public function getState()
89
+ {
90
+ return $this->result->getState();
91
+ }
92
+
93
+ public function resolve($value)
94
+ {
95
+ $this->result->resolve($value);
96
+ }
97
+
98
+ public function reject($reason)
99
+ {
100
+ $this->result->reject($reason);
101
+ }
102
+
103
+ public function cancel()
104
+ {
105
+ $this->currentPromise->cancel();
106
+ $this->result->cancel();
107
+ }
108
+
109
+ private function nextCoroutine($yielded)
110
+ {
111
+ $this->currentPromise = promise_for($yielded)
112
+ ->then([$this, '_handleSuccess'], [$this, '_handleFailure']);
113
+ }
114
+
115
+ /**
116
+ * @internal
117
+ */
118
+ public function _handleSuccess($value)
119
+ {
120
+ unset($this->currentPromise);
121
+ try {
122
+ $next = $this->generator->send($value);
123
+ if ($this->generator->valid()) {
124
+ $this->nextCoroutine($next);
125
+ } else {
126
+ $this->result->resolve($value);
127
+ }
128
+ } catch (Exception $exception) {
129
+ $this->result->reject($exception);
130
+ } catch (Throwable $throwable) {
131
+ $this->result->reject($throwable);
132
+ }
133
+ }
134
+
135
+ /**
136
+ * @internal
137
+ */
138
+ public function _handleFailure($reason)
139
+ {
140
+ unset($this->currentPromise);
141
+ try {
142
+ $nextYield = $this->generator->throw(exception_for($reason));
143
+ // The throw was caught, so keep iterating on the coroutine
144
+ $this->nextCoroutine($nextYield);
145
+ } catch (Exception $exception) {
146
+ $this->result->reject($exception);
147
+ } catch (Throwable $throwable) {
148
+ $this->result->reject($throwable);
149
+ }
150
+ }
151
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/EachPromise.php ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * Represents a promise that iterates over many promises and invokes
6
+ * side-effect functions in the process.
7
+ */
8
+ class EachPromise implements PromisorInterface
9
+ {
10
+ private $pending = [];
11
+
12
+ /** @var \Iterator */
13
+ private $iterable;
14
+
15
+ /** @var callable|int */
16
+ private $concurrency;
17
+
18
+ /** @var callable */
19
+ private $onFulfilled;
20
+
21
+ /** @var callable */
22
+ private $onRejected;
23
+
24
+ /** @var Promise */
25
+ private $aggregate;
26
+
27
+ /** @var bool */
28
+ private $mutex;
29
+
30
+ /**
31
+ * Configuration hash can include the following key value pairs:
32
+ *
33
+ * - fulfilled: (callable) Invoked when a promise fulfills. The function
34
+ * is invoked with three arguments: the fulfillment value, the index
35
+ * position from the iterable list of the promise, and the aggregate
36
+ * promise that manages all of the promises. The aggregate promise may
37
+ * be resolved from within the callback to short-circuit the promise.
38
+ * - rejected: (callable) Invoked when a promise is rejected. The
39
+ * function is invoked with three arguments: the rejection reason, the
40
+ * index position from the iterable list of the promise, and the
41
+ * aggregate promise that manages all of the promises. The aggregate
42
+ * promise may be resolved from within the callback to short-circuit
43
+ * the promise.
44
+ * - concurrency: (integer) Pass this configuration option to limit the
45
+ * allowed number of outstanding concurrently executing promises,
46
+ * creating a capped pool of promises. There is no limit by default.
47
+ *
48
+ * @param mixed $iterable Promises or values to iterate.
49
+ * @param array $config Configuration options
50
+ */
51
+ public function __construct($iterable, array $config = [])
52
+ {
53
+ $this->iterable = iter_for($iterable);
54
+
55
+ if (isset($config['concurrency'])) {
56
+ $this->concurrency = $config['concurrency'];
57
+ }
58
+
59
+ if (isset($config['fulfilled'])) {
60
+ $this->onFulfilled = $config['fulfilled'];
61
+ }
62
+
63
+ if (isset($config['rejected'])) {
64
+ $this->onRejected = $config['rejected'];
65
+ }
66
+ }
67
+
68
+ public function promise()
69
+ {
70
+ if ($this->aggregate) {
71
+ return $this->aggregate;
72
+ }
73
+
74
+ try {
75
+ $this->createPromise();
76
+ $this->iterable->rewind();
77
+ $this->refillPending();
78
+ } catch (\Throwable $e) {
79
+ $this->aggregate->reject($e);
80
+ } catch (\Exception $e) {
81
+ $this->aggregate->reject($e);
82
+ }
83
+
84
+ return $this->aggregate;
85
+ }
86
+
87
+ private function createPromise()
88
+ {
89
+ $this->mutex = false;
90
+ $this->aggregate = new Promise(function () {
91
+ reset($this->pending);
92
+ if (empty($this->pending) && !$this->iterable->valid()) {
93
+ $this->aggregate->resolve(null);
94
+ return;
95
+ }
96
+
97
+ // Consume a potentially fluctuating list of promises while
98
+ // ensuring that indexes are maintained (precluding array_shift).
99
+ while ($promise = current($this->pending)) {
100
+ next($this->pending);
101
+ $promise->wait();
102
+ if ($this->aggregate->getState() !== PromiseInterface::PENDING) {
103
+ return;
104
+ }
105
+ }
106
+ });
107
+
108
+ // Clear the references when the promise is resolved.
109
+ $clearFn = function () {
110
+ $this->iterable = $this->concurrency = $this->pending = null;
111
+ $this->onFulfilled = $this->onRejected = null;
112
+ };
113
+
114
+ $this->aggregate->then($clearFn, $clearFn);
115
+ }
116
+
117
+ private function refillPending()
118
+ {
119
+ if (!$this->concurrency) {
120
+ // Add all pending promises.
121
+ while ($this->addPending() && $this->advanceIterator());
122
+ return;
123
+ }
124
+
125
+ // Add only up to N pending promises.
126
+ $concurrency = is_callable($this->concurrency)
127
+ ? call_user_func($this->concurrency, count($this->pending))
128
+ : $this->concurrency;
129
+ $concurrency = max($concurrency - count($this->pending), 0);
130
+ // Concurrency may be set to 0 to disallow new promises.
131
+ if (!$concurrency) {
132
+ return;
133
+ }
134
+ // Add the first pending promise.
135
+ $this->addPending();
136
+ // Note this is special handling for concurrency=1 so that we do
137
+ // not advance the iterator after adding the first promise. This
138
+ // helps work around issues with generators that might not have the
139
+ // next value to yield until promise callbacks are called.
140
+ while (--$concurrency
141
+ && $this->advanceIterator()
142
+ && $this->addPending());
143
+ }
144
+
145
+ private function addPending()
146
+ {
147
+ if (!$this->iterable || !$this->iterable->valid()) {
148
+ return false;
149
+ }
150
+
151
+ $promise = promise_for($this->iterable->current());
152
+ $idx = $this->iterable->key();
153
+
154
+ $this->pending[$idx] = $promise->then(
155
+ function ($value) use ($idx) {
156
+ if ($this->onFulfilled) {
157
+ call_user_func(
158
+ $this->onFulfilled, $value, $idx, $this->aggregate
159
+ );
160
+ }
161
+ $this->step($idx);
162
+ },
163
+ function ($reason) use ($idx) {
164
+ if ($this->onRejected) {
165
+ call_user_func(
166
+ $this->onRejected, $reason, $idx, $this->aggregate
167
+ );
168
+ }
169
+ $this->step($idx);
170
+ }
171
+ );
172
+
173
+ return true;
174
+ }
175
+
176
+ private function advanceIterator()
177
+ {
178
+ // Place a lock on the iterator so that we ensure to not recurse,
179
+ // preventing fatal generator errors.
180
+ if ($this->mutex) {
181
+ return false;
182
+ }
183
+
184
+ $this->mutex = true;
185
+
186
+ try {
187
+ $this->iterable->next();
188
+ $this->mutex = false;
189
+ return true;
190
+ } catch (\Throwable $e) {
191
+ $this->aggregate->reject($e);
192
+ $this->mutex = false;
193
+ return false;
194
+ } catch (\Exception $e) {
195
+ $this->aggregate->reject($e);
196
+ $this->mutex = false;
197
+ return false;
198
+ }
199
+ }
200
+
201
+ private function step($idx)
202
+ {
203
+ // If the promise was already resolved, then ignore this step.
204
+ if ($this->aggregate->getState() !== PromiseInterface::PENDING) {
205
+ return;
206
+ }
207
+
208
+ unset($this->pending[$idx]);
209
+
210
+ // Only refill pending promises if we are not locked, preventing the
211
+ // EachPromise to recursively invoke the provided iterator, which
212
+ // cause a fatal error: "Cannot resume an already running generator"
213
+ if ($this->advanceIterator() && !$this->checkIfFinished()) {
214
+ // Add more pending promises if possible.
215
+ $this->refillPending();
216
+ }
217
+ }
218
+
219
+ private function checkIfFinished()
220
+ {
221
+ if (!$this->pending && !$this->iterable->valid()) {
222
+ // Resolve the promise if there's nothing left to do.
223
+ $this->aggregate->resolve(null);
224
+ return true;
225
+ }
226
+
227
+ return false;
228
+ }
229
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/FulfilledPromise.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * A promise that has been fulfilled.
6
+ *
7
+ * Thenning off of this promise will invoke the onFulfilled callback
8
+ * immediately and ignore other callbacks.
9
+ */
10
+ class FulfilledPromise implements PromiseInterface
11
+ {
12
+ private $value;
13
+
14
+ public function __construct($value)
15
+ {
16
+ if (method_exists($value, 'then')) {
17
+ throw new \InvalidArgumentException(
18
+ 'You cannot create a FulfilledPromise with a promise.');
19
+ }
20
+
21
+ $this->value = $value;
22
+ }
23
+
24
+ public function then(
25
+ callable $onFulfilled = null,
26
+ callable $onRejected = null
27
+ ) {
28
+ // Return itself if there is no onFulfilled function.
29
+ if (!$onFulfilled) {
30
+ return $this;
31
+ }
32
+
33
+ $queue = queue();
34
+ $p = new Promise([$queue, 'run']);
35
+ $value = $this->value;
36
+ $queue->add(static function () use ($p, $value, $onFulfilled) {
37
+ if ($p->getState() === self::PENDING) {
38
+ try {
39
+ $p->resolve($onFulfilled($value));
40
+ } catch (\Throwable $e) {
41
+ $p->reject($e);
42
+ } catch (\Exception $e) {
43
+ $p->reject($e);
44
+ }
45
+ }
46
+ });
47
+
48
+ return $p;
49
+ }
50
+
51
+ public function otherwise(callable $onRejected)
52
+ {
53
+ return $this->then(null, $onRejected);
54
+ }
55
+
56
+ public function wait($unwrap = true, $defaultDelivery = null)
57
+ {
58
+ return $unwrap ? $this->value : null;
59
+ }
60
+
61
+ public function getState()
62
+ {
63
+ return self::FULFILLED;
64
+ }
65
+
66
+ public function resolve($value)
67
+ {
68
+ if ($value !== $this->value) {
69
+ throw new \LogicException("Cannot resolve a fulfilled promise");
70
+ }
71
+ }
72
+
73
+ public function reject($reason)
74
+ {
75
+ throw new \LogicException("Cannot reject a fulfilled promise");
76
+ }
77
+
78
+ public function cancel()
79
+ {
80
+ // pass
81
+ }
82
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/Promise.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * Promises/A+ implementation that avoids recursion when possible.
6
+ *
7
+ * @link https://promisesaplus.com/
8
+ */
9
+ class Promise implements PromiseInterface
10
+ {
11
+ private $state = self::PENDING;
12
+ private $result;
13
+ private $cancelFn;
14
+ private $waitFn;
15
+ private $waitList;
16
+ private $handlers = [];
17
+
18
+ /**
19
+ * @param callable $waitFn Fn that when invoked resolves the promise.
20
+ * @param callable $cancelFn Fn that when invoked cancels the promise.
21
+ */
22
+ public function __construct(
23
+ callable $waitFn = null,
24
+ callable $cancelFn = null
25
+ ) {
26
+ $this->waitFn = $waitFn;
27
+ $this->cancelFn = $cancelFn;
28
+ }
29
+
30
+ public function then(
31
+ callable $onFulfilled = null,
32
+ callable $onRejected = null
33
+ ) {
34
+ if ($this->state === self::PENDING) {
35
+ $p = new Promise(null, [$this, 'cancel']);
36
+ $this->handlers[] = [$p, $onFulfilled, $onRejected];
37
+ $p->waitList = $this->waitList;
38
+ $p->waitList[] = $this;
39
+ return $p;
40
+ }
41
+
42
+ // Return a fulfilled promise and immediately invoke any callbacks.
43
+ if ($this->state === self::FULFILLED) {
44
+ return $onFulfilled
45
+ ? promise_for($this->result)->then($onFulfilled)
46
+ : promise_for($this->result);
47
+ }
48
+
49
+ // It's either cancelled or rejected, so return a rejected promise
50
+ // and immediately invoke any callbacks.
51
+ $rejection = rejection_for($this->result);
52
+ return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
53
+ }
54
+
55
+ public function otherwise(callable $onRejected)
56
+ {
57
+ return $this->then(null, $onRejected);
58
+ }
59
+
60
+ public function wait($unwrap = true)
61
+ {
62
+ $this->waitIfPending();
63
+
64
+ $inner = $this->result instanceof PromiseInterface
65
+ ? $this->result->wait($unwrap)
66
+ : $this->result;
67
+
68
+ if ($unwrap) {
69
+ if ($this->result instanceof PromiseInterface
70
+ || $this->state === self::FULFILLED
71
+ ) {
72
+ return $inner;
73
+ } else {
74
+ // It's rejected so "unwrap" and throw an exception.
75
+ throw exception_for($inner);
76
+ }
77
+ }
78
+ }
79
+
80
+ public function getState()
81
+ {
82
+ return $this->state;
83
+ }
84
+
85
+ public function cancel()
86
+ {
87
+ if ($this->state !== self::PENDING) {
88
+ return;
89
+ }
90
+
91
+ $this->waitFn = $this->waitList = null;
92
+
93
+ if ($this->cancelFn) {
94
+ $fn = $this->cancelFn;
95
+ $this->cancelFn = null;
96
+ try {
97
+ $fn();
98
+ } catch (\Throwable $e) {
99
+ $this->reject($e);
100
+ } catch (\Exception $e) {
101
+ $this->reject($e);
102
+ }
103
+ }
104
+
105
+ // Reject the promise only if it wasn't rejected in a then callback.
106
+ if ($this->state === self::PENDING) {
107
+ $this->reject(new CancellationException('Promise has been cancelled'));
108
+ }
109
+ }
110
+
111
+ public function resolve($value)
112
+ {
113
+ $this->settle(self::FULFILLED, $value);
114
+ }
115
+
116
+ public function reject($reason)
117
+ {
118
+ $this->settle(self::REJECTED, $reason);
119
+ }
120
+
121
+ private function settle($state, $value)
122
+ {
123
+ if ($this->state !== self::PENDING) {
124
+ // Ignore calls with the same resolution.
125
+ if ($state === $this->state && $value === $this->result) {
126
+ return;
127
+ }
128
+ throw $this->state === $state
129
+ ? new \LogicException("The promise is already {$state}.")
130
+ : new \LogicException("Cannot change a {$this->state} promise to {$state}");
131
+ }
132
+
133
+ if ($value === $this) {
134
+ throw new \LogicException('Cannot fulfill or reject a promise with itself');
135
+ }
136
+
137
+ // Clear out the state of the promise but stash the handlers.
138
+ $this->state = $state;
139
+ $this->result = $value;
140
+ $handlers = $this->handlers;
141
+ $this->handlers = null;
142
+ $this->waitList = $this->waitFn = null;
143
+ $this->cancelFn = null;
144
+
145
+ if (!$handlers) {
146
+ return;
147
+ }
148
+
149
+ // If the value was not a settled promise or a thenable, then resolve
150
+ // it in the task queue using the correct ID.
151
+ if (!method_exists($value, 'then')) {
152
+ $id = $state === self::FULFILLED ? 1 : 2;
153
+ // It's a success, so resolve the handlers in the queue.
154
+ queue()->add(static function () use ($id, $value, $handlers) {
155
+ foreach ($handlers as $handler) {
156
+ self::callHandler($id, $value, $handler);
157
+ }
158
+ });
159
+ } elseif ($value instanceof Promise
160
+ && $value->getState() === self::PENDING
161
+ ) {
162
+ // We can just merge our handlers onto the next promise.
163
+ $value->handlers = array_merge($value->handlers, $handlers);
164
+ } else {
165
+ // Resolve the handlers when the forwarded promise is resolved.
166
+ $value->then(
167
+ static function ($value) use ($handlers) {
168
+ foreach ($handlers as $handler) {
169
+ self::callHandler(1, $value, $handler);
170
+ }
171
+ },
172
+ static function ($reason) use ($handlers) {
173
+ foreach ($handlers as $handler) {
174
+ self::callHandler(2, $reason, $handler);
175
+ }
176
+ }
177
+ );
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Call a stack of handlers using a specific callback index and value.
183
+ *
184
+ * @param int $index 1 (resolve) or 2 (reject).
185
+ * @param mixed $value Value to pass to the callback.
186
+ * @param array $handler Array of handler data (promise and callbacks).
187
+ *
188
+ * @return array Returns the next group to resolve.
189
+ */
190
+ private static function callHandler($index, $value, array $handler)
191
+ {
192
+ /** @var PromiseInterface $promise */
193
+ $promise = $handler[0];
194
+
195
+ // The promise may have been cancelled or resolved before placing
196
+ // this thunk in the queue.
197
+ if ($promise->getState() !== self::PENDING) {
198
+ return;
199
+ }
200
+
201
+ try {
202
+ if (isset($handler[$index])) {
203
+ $promise->resolve($handler[$index]($value));
204
+ } elseif ($index === 1) {
205
+ // Forward resolution values as-is.
206
+ $promise->resolve($value);
207
+ } else {
208
+ // Forward rejections down the chain.
209
+ $promise->reject($value);
210
+ }
211
+ } catch (\Throwable $reason) {
212
+ $promise->reject($reason);
213
+ } catch (\Exception $reason) {
214
+ $promise->reject($reason);
215
+ }
216
+ }
217
+
218
+ private function waitIfPending()
219
+ {
220
+ if ($this->state !== self::PENDING) {
221
+ return;
222
+ } elseif ($this->waitFn) {
223
+ $this->invokeWaitFn();
224
+ } elseif ($this->waitList) {
225
+ $this->invokeWaitList();
226
+ } else {
227
+ // If there's not wait function, then reject the promise.
228
+ $this->reject('Cannot wait on a promise that has '
229
+ . 'no internal wait function. You must provide a wait '
230
+ . 'function when constructing the promise to be able to '
231
+ . 'wait on a promise.');
232
+ }
233
+
234
+ queue()->run();
235
+
236
+ if ($this->state === self::PENDING) {
237
+ $this->reject('Invoking the wait callback did not resolve the promise');
238
+ }
239
+ }
240
+
241
+ private function invokeWaitFn()
242
+ {
243
+ try {
244
+ $wfn = $this->waitFn;
245
+ $this->waitFn = null;
246
+ $wfn(true);
247
+ } catch (\Exception $reason) {
248
+ if ($this->state === self::PENDING) {
249
+ // The promise has not been resolved yet, so reject the promise
250
+ // with the exception.
251
+ $this->reject($reason);
252
+ } else {
253
+ // The promise was already resolved, so there's a problem in
254
+ // the application.
255
+ throw $reason;
256
+ }
257
+ }
258
+ }
259
+
260
+ private function invokeWaitList()
261
+ {
262
+ $waitList = $this->waitList;
263
+ $this->waitList = null;
264
+
265
+ foreach ($waitList as $result) {
266
+ $result->waitIfPending();
267
+ while ($result->result instanceof Promise) {
268
+ $result = $result->result;
269
+ $result->waitIfPending();
270
+ }
271
+ }
272
+ }
273
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/PromiseInterface.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * A promise represents the eventual result of an asynchronous operation.
6
+ *
7
+ * The primary way of interacting with a promise is through its then method,
8
+ * which registers callbacks to receive either a promise’s eventual value or
9
+ * the reason why the promise cannot be fulfilled.
10
+ *
11
+ * @link https://promisesaplus.com/
12
+ */
13
+ interface PromiseInterface
14
+ {
15
+ const PENDING = 'pending';
16
+ const FULFILLED = 'fulfilled';
17
+ const REJECTED = 'rejected';
18
+
19
+ /**
20
+ * Appends fulfillment and rejection handlers to the promise, and returns
21
+ * a new promise resolving to the return value of the called handler.
22
+ *
23
+ * @param callable $onFulfilled Invoked when the promise fulfills.
24
+ * @param callable $onRejected Invoked when the promise is rejected.
25
+ *
26
+ * @return PromiseInterface
27
+ */
28
+ public function then(
29
+ callable $onFulfilled = null,
30
+ callable $onRejected = null
31
+ );
32
+
33
+ /**
34
+ * Appends a rejection handler callback to the promise, and returns a new
35
+ * promise resolving to the return value of the callback if it is called,
36
+ * or to its original fulfillment value if the promise is instead
37
+ * fulfilled.
38
+ *
39
+ * @param callable $onRejected Invoked when the promise is rejected.
40
+ *
41
+ * @return PromiseInterface
42
+ */
43
+ public function otherwise(callable $onRejected);
44
+
45
+ /**
46
+ * Get the state of the promise ("pending", "rejected", or "fulfilled").
47
+ *
48
+ * The three states can be checked against the constants defined on
49
+ * PromiseInterface: PENDING, FULFILLED, and REJECTED.
50
+ *
51
+ * @return string
52
+ */
53
+ public function getState();
54
+
55
+ /**
56
+ * Resolve the promise with the given value.
57
+ *
58
+ * @param mixed $value
59
+ * @throws \RuntimeException if the promise is already resolved.
60
+ */
61
+ public function resolve($value);
62
+
63
+ /**
64
+ * Reject the promise with the given reason.
65
+ *
66
+ * @param mixed $reason
67
+ * @throws \RuntimeException if the promise is already resolved.
68
+ */
69
+ public function reject($reason);
70
+
71
+ /**
72
+ * Cancels the promise if possible.
73
+ *
74
+ * @link https://github.com/promises-aplus/cancellation-spec/issues/7
75
+ */
76
+ public function cancel();
77
+
78
+ /**
79
+ * Waits until the promise completes if possible.
80
+ *
81
+ * Pass $unwrap as true to unwrap the result of the promise, either
82
+ * returning the resolved value or throwing the rejected exception.
83
+ *
84
+ * If the promise cannot be waited on, then the promise will be rejected.
85
+ *
86
+ * @param bool $unwrap
87
+ *
88
+ * @return mixed
89
+ * @throws \LogicException if the promise has no wait function or if the
90
+ * promise does not settle after waiting.
91
+ */
92
+ public function wait($unwrap = true);
93
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/PromisorInterface.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * Interface used with classes that return a promise.
6
+ */
7
+ interface PromisorInterface
8
+ {
9
+ /**
10
+ * Returns a promise.
11
+ *
12
+ * @return PromiseInterface
13
+ */
14
+ public function promise();
15
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/RejectedPromise.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * A promise that has been rejected.
6
+ *
7
+ * Thenning off of this promise will invoke the onRejected callback
8
+ * immediately and ignore other callbacks.
9
+ */
10
+ class RejectedPromise implements PromiseInterface
11
+ {
12
+ private $reason;
13
+
14
+ public function __construct($reason)
15
+ {
16
+ if (method_exists($reason, 'then')) {
17
+ throw new \InvalidArgumentException(
18
+ 'You cannot create a RejectedPromise with a promise.');
19
+ }
20
+
21
+ $this->reason = $reason;
22
+ }
23
+
24
+ public function then(
25
+ callable $onFulfilled = null,
26
+ callable $onRejected = null
27
+ ) {
28
+ // If there's no onRejected callback then just return self.
29
+ if (!$onRejected) {
30
+ return $this;
31
+ }
32
+
33
+ $queue = queue();
34
+ $reason = $this->reason;
35
+ $p = new Promise([$queue, 'run']);
36
+ $queue->add(static function () use ($p, $reason, $onRejected) {
37
+ if ($p->getState() === self::PENDING) {
38
+ try {
39
+ // Return a resolved promise if onRejected does not throw.
40
+ $p->resolve($onRejected($reason));
41
+ } catch (\Throwable $e) {
42
+ // onRejected threw, so return a rejected promise.
43
+ $p->reject($e);
44
+ } catch (\Exception $e) {
45
+ // onRejected threw, so return a rejected promise.
46
+ $p->reject($e);
47
+ }
48
+ }
49
+ });
50
+
51
+ return $p;
52
+ }
53
+
54
+ public function otherwise(callable $onRejected)
55
+ {
56
+ return $this->then(null, $onRejected);
57
+ }
58
+
59
+ public function wait($unwrap = true, $defaultDelivery = null)
60
+ {
61
+ if ($unwrap) {
62
+ throw exception_for($this->reason);
63
+ }
64
+ }
65
+
66
+ public function getState()
67
+ {
68
+ return self::REJECTED;
69
+ }
70
+
71
+ public function resolve($value)
72
+ {
73
+ throw new \LogicException("Cannot resolve a rejected promise");
74
+ }
75
+
76
+ public function reject($reason)
77
+ {
78
+ if ($reason !== $this->reason) {
79
+ throw new \LogicException("Cannot reject a rejected promise");
80
+ }
81
+ }
82
+
83
+ public function cancel()
84
+ {
85
+ // pass
86
+ }
87
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/RejectionException.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * A special exception that is thrown when waiting on a rejected promise.
6
+ *
7
+ * The reason value is available via the getReason() method.
8
+ */
9
+ class RejectionException extends \RuntimeException
10
+ {
11
+ /** @var mixed Rejection reason. */
12
+ private $reason;
13
+
14
+ /**
15
+ * @param mixed $reason Rejection reason.
16
+ * @param string $description Optional description
17
+ */
18
+ public function __construct($reason, $description = null)
19
+ {
20
+ $this->reason = $reason;
21
+
22
+ $message = 'The promise was rejected';
23
+
24
+ if ($description) {
25
+ $message .= ' with reason: ' . $description;
26
+ } elseif (is_string($reason)
27
+ || (is_object($reason) && method_exists($reason, '__toString'))
28
+ ) {
29
+ $message .= ' with reason: ' . $this->reason;
30
+ } elseif ($reason instanceof \JsonSerializable) {
31
+ $message .= ' with reason: '
32
+ . json_encode($this->reason, JSON_PRETTY_PRINT);
33
+ }
34
+
35
+ parent::__construct($message);
36
+ }
37
+
38
+ /**
39
+ * Returns the rejection reason.
40
+ *
41
+ * @return mixed
42
+ */
43
+ public function getReason()
44
+ {
45
+ return $this->reason;
46
+ }
47
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/TaskQueue.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * A task queue that executes tasks in a FIFO order.
6
+ *
7
+ * This task queue class is used to settle promises asynchronously and
8
+ * maintains a constant stack size. You can use the task queue asynchronously
9
+ * by calling the `run()` function of the global task queue in an event loop.
10
+ *
11
+ * GuzzleHttp\Promise\queue()->run();
12
+ */
13
+ class TaskQueue implements TaskQueueInterface
14
+ {
15
+ private $enableShutdown = true;
16
+ private $queue = [];
17
+
18
+ public function __construct($withShutdown = true)
19
+ {
20
+ if ($withShutdown) {
21
+ register_shutdown_function(function () {
22
+ if ($this->enableShutdown) {
23
+ // Only run the tasks if an E_ERROR didn't occur.
24
+ $err = error_get_last();
25
+ if (!$err || ($err['type'] ^ E_ERROR)) {
26
+ $this->run();
27
+ }
28
+ }
29
+ });
30
+ }
31
+ }
32
+
33
+ public function isEmpty()
34
+ {
35
+ return !$this->queue;
36
+ }
37
+
38
+ public function add(callable $task)
39
+ {
40
+ $this->queue[] = $task;
41
+ }
42
+
43
+ public function run()
44
+ {
45
+ /** @var callable $task */
46
+ while ($task = array_shift($this->queue)) {
47
+ $task();
48
+ }
49
+ }
50
+
51
+ /**
52
+ * The task queue will be run and exhausted by default when the process
53
+ * exits IFF the exit is not the result of a PHP E_ERROR error.
54
+ *
55
+ * You can disable running the automatic shutdown of the queue by calling
56
+ * this function. If you disable the task queue shutdown process, then you
57
+ * MUST either run the task queue (as a result of running your event loop
58
+ * or manually using the run() method) or wait on each outstanding promise.
59
+ *
60
+ * Note: This shutdown will occur before any destructors are triggered.
61
+ */
62
+ public function disableShutdown()
63
+ {
64
+ $this->enableShutdown = false;
65
+ }
66
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/TaskQueueInterface.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ interface TaskQueueInterface
5
+ {
6
+ /**
7
+ * Returns true if the queue is empty.
8
+ *
9
+ * @return bool
10
+ */
11
+ public function isEmpty();
12
+
13
+ /**
14
+ * Adds a task to the queue that will be executed the next time run is
15
+ * called.
16
+ *
17
+ * @param callable $task
18
+ */
19
+ public function add(callable $task);
20
+
21
+ /**
22
+ * Execute all of the pending task in the queue.
23
+ */
24
+ public function run();
25
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/src/functions.php ADDED
@@ -0,0 +1,457 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise;
3
+
4
+ /**
5
+ * Get the global task queue used for promise resolution.
6
+ *
7
+ * This task queue MUST be run in an event loop in order for promises to be
8
+ * settled asynchronously. It will be automatically run when synchronously
9
+ * waiting on a promise.
10
+ *
11
+ * <code>
12
+ * while ($eventLoop->isRunning()) {
13
+ * GuzzleHttp\Promise\queue()->run();
14
+ * }
15
+ * </code>
16
+ *
17
+ * @param TaskQueueInterface $assign Optionally specify a new queue instance.
18
+ *
19
+ * @return TaskQueueInterface
20
+ */
21
+ function queue(TaskQueueInterface $assign = null)
22
+ {
23
+ static $queue;
24
+
25
+ if ($assign) {
26
+ $queue = $assign;
27
+ } elseif (!$queue) {
28
+ $queue = new TaskQueue();
29
+ }
30
+
31
+ return $queue;
32
+ }
33
+
34
+ /**
35
+ * Adds a function to run in the task queue when it is next `run()` and returns
36
+ * a promise that is fulfilled or rejected with the result.
37
+ *
38
+ * @param callable $task Task function to run.
39
+ *
40
+ * @return PromiseInterface
41
+ */
42
+ function task(callable $task)
43
+ {
44
+ $queue = queue();
45
+ $promise = new Promise([$queue, 'run']);
46
+ $queue->add(function () use ($task, $promise) {
47
+ try {
48
+ $promise->resolve($task());
49
+ } catch (\Throwable $e) {
50
+ $promise->reject($e);
51
+ } catch (\Exception $e) {
52
+ $promise->reject($e);
53
+ }
54
+ });
55
+
56
+ return $promise;
57
+ }
58
+
59
+ /**
60
+ * Creates a promise for a value if the value is not a promise.
61
+ *
62
+ * @param mixed $value Promise or value.
63
+ *
64
+ * @return PromiseInterface
65
+ */
66
+ function promise_for($value)
67
+ {
68
+ if ($value instanceof PromiseInterface) {
69
+ return $value;
70
+ }
71
+
72
+ // Return a Guzzle promise that shadows the given promise.
73
+ if (method_exists($value, 'then')) {
74
+ $wfn = method_exists($value, 'wait') ? [$value, 'wait'] : null;
75
+ $cfn = method_exists($value, 'cancel') ? [$value, 'cancel'] : null;
76
+ $promise = new Promise($wfn, $cfn);
77
+ $value->then([$promise, 'resolve'], [$promise, 'reject']);
78
+ return $promise;
79
+ }
80
+
81
+ return new FulfilledPromise($value);
82
+ }
83
+
84
+ /**
85
+ * Creates a rejected promise for a reason if the reason is not a promise. If
86
+ * the provided reason is a promise, then it is returned as-is.
87
+ *
88
+ * @param mixed $reason Promise or reason.
89
+ *
90
+ * @return PromiseInterface
91
+ */
92
+ function rejection_for($reason)
93
+ {
94
+ if ($reason instanceof PromiseInterface) {
95
+ return $reason;
96
+ }
97
+
98
+ return new RejectedPromise($reason);
99
+ }
100
+
101
+ /**
102
+ * Create an exception for a rejected promise value.
103
+ *
104
+ * @param mixed $reason
105
+ *
106
+ * @return \Exception|\Throwable
107
+ */
108
+ function exception_for($reason)
109
+ {
110
+ return $reason instanceof \Exception || $reason instanceof \Throwable
111
+ ? $reason
112
+ : new RejectionException($reason);
113
+ }
114
+
115
+ /**
116
+ * Returns an iterator for the given value.
117
+ *
118
+ * @param mixed $value
119
+ *
120
+ * @return \Iterator
121
+ */
122
+ function iter_for($value)
123
+ {
124
+ if ($value instanceof \Iterator) {
125
+ return $value;
126
+ } elseif (is_array($value)) {
127
+ return new \ArrayIterator($value);
128
+ } else {
129
+ return new \ArrayIterator([$value]);
130
+ }
131
+ }
132
+
133
+ /**
134
+ * Synchronously waits on a promise to resolve and returns an inspection state
135
+ * array.
136
+ *
137
+ * Returns a state associative array containing a "state" key mapping to a
138
+ * valid promise state. If the state of the promise is "fulfilled", the array
139
+ * will contain a "value" key mapping to the fulfilled value of the promise. If
140
+ * the promise is rejected, the array will contain a "reason" key mapping to
141
+ * the rejection reason of the promise.
142
+ *
143
+ * @param PromiseInterface $promise Promise or value.
144
+ *
145
+ * @return array
146
+ */
147
+ function inspect(PromiseInterface $promise)
148
+ {
149
+ try {
150
+ return [
151
+ 'state' => PromiseInterface::FULFILLED,
152
+ 'value' => $promise->wait()
153
+ ];
154
+ } catch (RejectionException $e) {
155
+ return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()];
156
+ } catch (\Throwable $e) {
157
+ return ['state' => PromiseInterface::REJECTED, 'reason' => $e];
158
+ } catch (\Exception $e) {
159
+ return ['state' => PromiseInterface::REJECTED, 'reason' => $e];
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Waits on all of the provided promises, but does not unwrap rejected promises
165
+ * as thrown exception.
166
+ *
167
+ * Returns an array of inspection state arrays.
168
+ *
169
+ * @param PromiseInterface[] $promises Traversable of promises to wait upon.
170
+ *
171
+ * @return array
172
+ * @see GuzzleHttp\Promise\inspect for the inspection state array format.
173
+ */
174
+ function inspect_all($promises)
175
+ {
176
+ $results = [];
177
+ foreach ($promises as $key => $promise) {
178
+ $results[$key] = inspect($promise);
179
+ }
180
+
181
+ return $results;
182
+ }
183
+
184
+ /**
185
+ * Waits on all of the provided promises and returns the fulfilled values.
186
+ *
187
+ * Returns an array that contains the value of each promise (in the same order
188
+ * the promises were provided). An exception is thrown if any of the promises
189
+ * are rejected.
190
+ *
191
+ * @param mixed $promises Iterable of PromiseInterface objects to wait on.
192
+ *
193
+ * @return array
194
+ * @throws \Exception on error
195
+ * @throws \Throwable on error in PHP >=7
196
+ */
197
+ function unwrap($promises)
198
+ {
199
+ $results = [];
200
+ foreach ($promises as $key => $promise) {
201
+ $results[$key] = $promise->wait();
202
+ }
203
+
204
+ return $results;
205
+ }
206
+
207
+ /**
208
+ * Given an array of promises, return a promise that is fulfilled when all the
209
+ * items in the array are fulfilled.
210
+ *
211
+ * The promise's fulfillment value is an array with fulfillment values at
212
+ * respective positions to the original array. If any promise in the array
213
+ * rejects, the returned promise is rejected with the rejection reason.
214
+ *
215
+ * @param mixed $promises Promises or values.
216
+ *
217
+ * @return PromiseInterface
218
+ */
219
+ function all($promises)
220
+ {
221
+ $results = [];
222
+ return each(
223
+ $promises,
224
+ function ($value, $idx) use (&$results) {
225
+ $results[$idx] = $value;
226
+ },
227
+ function ($reason, $idx, Promise $aggregate) {
228
+ $aggregate->reject($reason);
229
+ }
230
+ )->then(function () use (&$results) {
231
+ ksort($results);
232
+ return $results;
233
+ });
234
+ }
235
+
236
+ /**
237
+ * Initiate a competitive race between multiple promises or values (values will
238
+ * become immediately fulfilled promises).
239
+ *
240
+ * When count amount of promises have been fulfilled, the returned promise is
241
+ * fulfilled with an array that contains the fulfillment values of the winners
242
+ * in order of resolution.
243
+ *
244
+ * This prommise is rejected with a {@see GuzzleHttp\Promise\AggregateException}
245
+ * if the number of fulfilled promises is less than the desired $count.
246
+ *
247
+ * @param int $count Total number of promises.
248
+ * @param mixed $promises Promises or values.
249
+ *
250
+ * @return PromiseInterface
251
+ */
252
+ function some($count, $promises)
253
+ {
254
+ $results = [];
255
+ $rejections = [];
256
+
257
+ return each(
258
+ $promises,
259
+ function ($value, $idx, PromiseInterface $p) use (&$results, $count) {
260
+ if ($p->getState() !== PromiseInterface::PENDING) {
261
+ return;
262
+ }
263
+ $results[$idx] = $value;
264
+ if (count($results) >= $count) {
265
+ $p->resolve(null);
266
+ }
267
+ },
268
+ function ($reason) use (&$rejections) {
269
+ $rejections[] = $reason;
270
+ }
271
+ )->then(
272
+ function () use (&$results, &$rejections, $count) {
273
+ if (count($results) !== $count) {
274
+ throw new AggregateException(
275
+ 'Not enough promises to fulfill count',
276
+ $rejections
277
+ );
278
+ }
279
+ ksort($results);
280
+ return array_values($results);
281
+ }
282
+ );
283
+ }
284
+
285
+ /**
286
+ * Like some(), with 1 as count. However, if the promise fulfills, the
287
+ * fulfillment value is not an array of 1 but the value directly.
288
+ *
289
+ * @param mixed $promises Promises or values.
290
+ *
291
+ * @return PromiseInterface
292
+ */
293
+ function any($promises)
294
+ {
295
+ return some(1, $promises)->then(function ($values) { return $values[0]; });
296
+ }
297
+
298
+ /**
299
+ * Returns a promise that is fulfilled when all of the provided promises have
300
+ * been fulfilled or rejected.
301
+ *
302
+ * The returned promise is fulfilled with an array of inspection state arrays.
303
+ *
304
+ * @param mixed $promises Promises or values.
305
+ *
306
+ * @return PromiseInterface
307
+ * @see GuzzleHttp\Promise\inspect for the inspection state array format.
308
+ */
309
+ function settle($promises)
310
+ {
311
+ $results = [];
312
+
313
+ return each(
314
+ $promises,
315
+ function ($value, $idx) use (&$results) {
316
+ $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value];
317
+ },
318
+ function ($reason, $idx) use (&$results) {
319
+ $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason];
320
+ }
321
+ )->then(function () use (&$results) {
322
+ ksort($results);
323
+ return $results;
324
+ });
325
+ }
326
+
327
+ /**
328
+ * Given an iterator that yields promises or values, returns a promise that is
329
+ * fulfilled with a null value when the iterator has been consumed or the
330
+ * aggregate promise has been fulfilled or rejected.
331
+ *
332
+ * $onFulfilled is a function that accepts the fulfilled value, iterator
333
+ * index, and the aggregate promise. The callback can invoke any necessary side
334
+ * effects and choose to resolve or reject the aggregate promise if needed.
335
+ *
336
+ * $onRejected is a function that accepts the rejection reason, iterator
337
+ * index, and the aggregate promise. The callback can invoke any necessary side
338
+ * effects and choose to resolve or reject the aggregate promise if needed.
339
+ *
340
+ * @param mixed $iterable Iterator or array to iterate over.
341
+ * @param callable $onFulfilled
342
+ * @param callable $onRejected
343
+ *
344
+ * @return PromiseInterface
345
+ */
346
+ function each(
347
+ $iterable,
348
+ callable $onFulfilled = null,
349
+ callable $onRejected = null
350
+ ) {
351
+ return (new EachPromise($iterable, [
352
+ 'fulfilled' => $onFulfilled,
353
+ 'rejected' => $onRejected
354
+ ]))->promise();
355
+ }
356
+
357
+ /**
358
+ * Like each, but only allows a certain number of outstanding promises at any
359
+ * given time.
360
+ *
361
+ * $concurrency may be an integer or a function that accepts the number of
362
+ * pending promises and returns a numeric concurrency limit value to allow for
363
+ * dynamic a concurrency size.
364
+ *
365
+ * @param mixed $iterable
366
+ * @param int|callable $concurrency
367
+ * @param callable $onFulfilled
368
+ * @param callable $onRejected
369
+ *
370
+ * @return PromiseInterface
371
+ */
372
+ function each_limit(
373
+ $iterable,
374
+ $concurrency,
375
+ callable $onFulfilled = null,
376
+ callable $onRejected = null
377
+ ) {
378
+ return (new EachPromise($iterable, [
379
+ 'fulfilled' => $onFulfilled,
380
+ 'rejected' => $onRejected,
381
+ 'concurrency' => $concurrency
382
+ ]))->promise();
383
+ }
384
+
385
+ /**
386
+ * Like each_limit, but ensures that no promise in the given $iterable argument
387
+ * is rejected. If any promise is rejected, then the aggregate promise is
388
+ * rejected with the encountered rejection.
389
+ *
390
+ * @param mixed $iterable
391
+ * @param int|callable $concurrency
392
+ * @param callable $onFulfilled
393
+ *
394
+ * @return PromiseInterface
395
+ */
396
+ function each_limit_all(
397
+ $iterable,
398
+ $concurrency,
399
+ callable $onFulfilled = null
400
+ ) {
401
+ return each_limit(
402
+ $iterable,
403
+ $concurrency,
404
+ $onFulfilled,
405
+ function ($reason, $idx, PromiseInterface $aggregate) {
406
+ $aggregate->reject($reason);
407
+ }
408
+ );
409
+ }
410
+
411
+ /**
412
+ * Returns true if a promise is fulfilled.
413
+ *
414
+ * @param PromiseInterface $promise
415
+ *
416
+ * @return bool
417
+ */
418
+ function is_fulfilled(PromiseInterface $promise)
419
+ {
420
+ return $promise->getState() === PromiseInterface::FULFILLED;
421
+ }
422
+
423
+ /**
424
+ * Returns true if a promise is rejected.
425
+ *
426
+ * @param PromiseInterface $promise
427
+ *
428
+ * @return bool
429
+ */
430
+ function is_rejected(PromiseInterface $promise)
431
+ {
432
+ return $promise->getState() === PromiseInterface::REJECTED;
433
+ }
434
+
435
+ /**
436
+ * Returns true if a promise is fulfilled or rejected.
437
+ *
438
+ * @param PromiseInterface $promise
439
+ *
440
+ * @return bool
441
+ */
442
+ function is_settled(PromiseInterface $promise)
443
+ {
444
+ return $promise->getState() !== PromiseInterface::PENDING;
445
+ }
446
+
447
+ /**
448
+ * @see Coroutine
449
+ *
450
+ * @param callable $generatorFn
451
+ *
452
+ * @return PromiseInterface
453
+ */
454
+ function coroutine(callable $generatorFn)
455
+ {
456
+ return new Coroutine($generatorFn);
457
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/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\Promise\promise_for')) {
5
+ require __DIR__ . '/functions.php';
6
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/AggregateExceptionTest.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Tests;
3
+
4
+ use GuzzleHttp\Promise\AggregateException;
5
+
6
+ class AggregateExceptionTest extends \PHPUnit_Framework_TestCase
7
+ {
8
+ public function testHasReason()
9
+ {
10
+ $e = new AggregateException('foo', ['baz', 'bar']);
11
+ $this->assertContains('foo', $e->getMessage());
12
+ $this->assertEquals(['baz', 'bar'], $e->getReason());
13
+ }
14
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/CoroutineTest.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Tests;
3
+
4
+ use GuzzleHttp\Promise\Coroutine;
5
+ use GuzzleHttp\Promise\PromiseInterface;
6
+ use PHPUnit_Framework_TestCase;
7
+ use ReflectionClass;
8
+
9
+ class CoroutineTest extends PHPUnit_Framework_TestCase
10
+ {
11
+ /**
12
+ * @dataProvider promiseInterfaceMethodProvider
13
+ *
14
+ * @param string $method
15
+ * @param array $args
16
+ */
17
+ public function testShouldProxyPromiseMethodsToResultPromise($method, $args = [])
18
+ {
19
+ $coroutine = new Coroutine(function () { yield 0; });
20
+ $mockPromise = $this->getMockForAbstractClass(PromiseInterface::class);
21
+ call_user_func_array([$mockPromise->expects($this->once())->method($method), 'with'], $args);
22
+
23
+ $resultPromiseProp = (new ReflectionClass(Coroutine::class))->getProperty('result');
24
+ $resultPromiseProp->setAccessible(true);
25
+ $resultPromiseProp->setValue($coroutine, $mockPromise);
26
+
27
+ call_user_func_array([$coroutine, $method], $args);
28
+ }
29
+
30
+ public function promiseInterfaceMethodProvider()
31
+ {
32
+ return [
33
+ ['then', [null, null]],
34
+ ['otherwise', [function () {}]],
35
+ ['wait', [true]],
36
+ ['getState', []],
37
+ ['resolve', [null]],
38
+ ['reject', [null]],
39
+ ];
40
+ }
41
+
42
+ public function testShouldCancelResultPromiseAndOutsideCurrentPromise()
43
+ {
44
+ $coroutine = new Coroutine(function () { yield 0; });
45
+
46
+ $mockPromises = [
47
+ 'result' => $this->getMockForAbstractClass(PromiseInterface::class),
48
+ 'currentPromise' => $this->getMockForAbstractClass(PromiseInterface::class),
49
+ ];
50
+ foreach ($mockPromises as $propName => $mockPromise) {
51
+ /**
52
+ * @var $mockPromise \PHPUnit_Framework_MockObject_MockObject
53
+ */
54
+ $mockPromise->expects($this->once())
55
+ ->method('cancel')
56
+ ->with();
57
+
58
+ $promiseProp = (new ReflectionClass(Coroutine::class))->getProperty($propName);
59
+ $promiseProp->setAccessible(true);
60
+ $promiseProp->setValue($coroutine, $mockPromise);
61
+ }
62
+
63
+ $coroutine->cancel();
64
+ }
65
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/EachPromiseTest.php ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Tests;
3
+
4
+ use GuzzleHttp\Promise\RejectedPromise;
5
+ use GuzzleHttp\Promise\FulfilledPromise;
6
+ use GuzzleHttp\Promise\Promise;
7
+ use GuzzleHttp\Promise\PromiseInterface;
8
+ use GuzzleHttp\Promise\EachPromise;
9
+ use GuzzleHttp\Promise as P;
10
+
11
+ /**
12
+ * @covers GuzzleHttp\Promise\EachPromise
13
+ */
14
+ class EachPromiseTest extends \PHPUnit_Framework_TestCase
15
+ {
16
+ public function testReturnsSameInstance()
17
+ {
18
+ $each = new EachPromise([], ['concurrency' => 100]);
19
+ $this->assertSame($each->promise(), $each->promise());
20
+ }
21
+
22
+ public function testInvokesAllPromises()
23
+ {
24
+ $promises = [new Promise(), new Promise(), new Promise()];
25
+ $called = [];
26
+ $each = new EachPromise($promises, [
27
+ 'fulfilled' => function ($value) use (&$called) {
28
+ $called[] = $value;
29
+ }
30
+ ]);
31
+ $p = $each->promise();
32
+ $promises[0]->resolve('a');
33
+ $promises[1]->resolve('c');
34
+ $promises[2]->resolve('b');
35
+ P\queue()->run();
36
+ $this->assertEquals(['a', 'c', 'b'], $called);
37
+ $this->assertEquals(PromiseInterface::FULFILLED, $p->getState());
38
+ }
39
+
40
+ public function testIsWaitable()
41
+ {
42
+ $a = $this->createSelfResolvingPromise('a');
43
+ $b = $this->createSelfResolvingPromise('b');
44
+ $called = [];
45
+ $each = new EachPromise([$a, $b], [
46
+ 'fulfilled' => function ($value) use (&$called) { $called[] = $value; }
47
+ ]);
48
+ $p = $each->promise();
49
+ $this->assertNull($p->wait());
50
+ $this->assertEquals(PromiseInterface::FULFILLED, $p->getState());
51
+ $this->assertEquals(['a', 'b'], $called);
52
+ }
53
+
54
+ public function testCanResolveBeforeConsumingAll()
55
+ {
56
+ $called = 0;
57
+ $a = $this->createSelfResolvingPromise('a');
58
+ $b = new Promise(function () { $this->fail(); });
59
+ $each = new EachPromise([$a, $b], [
60
+ 'fulfilled' => function ($value, $idx, Promise $aggregate) use (&$called) {
61
+ $this->assertSame($idx, 0);
62
+ $this->assertEquals('a', $value);
63
+ $aggregate->resolve(null);
64
+ $called++;
65
+ },
66
+ 'rejected' => function (\Exception $reason) {
67
+ $this->fail($reason->getMessage());
68
+ }
69
+ ]);
70
+ $p = $each->promise();
71
+ $p->wait();
72
+ $this->assertNull($p->wait());
73
+ $this->assertEquals(1, $called);
74
+ $this->assertEquals(PromiseInterface::FULFILLED, $a->getState());
75
+ $this->assertEquals(PromiseInterface::PENDING, $b->getState());
76
+ // Resolving $b has no effect on the aggregate promise.
77
+ $b->resolve('foo');
78
+ $this->assertEquals(1, $called);
79
+ }
80
+
81
+ public function testLimitsPendingPromises()
82
+ {
83
+ $pending = [new Promise(), new Promise(), new Promise(), new Promise()];
84
+ $promises = new \ArrayIterator($pending);
85
+ $each = new EachPromise($promises, ['concurrency' => 2]);
86
+ $p = $each->promise();
87
+ $this->assertCount(2, $this->readAttribute($each, 'pending'));
88
+ $pending[0]->resolve('a');
89
+ $this->assertCount(2, $this->readAttribute($each, 'pending'));
90
+ $this->assertTrue($promises->valid());
91
+ $pending[1]->resolve('b');
92
+ P\queue()->run();
93
+ $this->assertCount(2, $this->readAttribute($each, 'pending'));
94
+ $this->assertTrue($promises->valid());
95
+ $promises[2]->resolve('c');
96
+ P\queue()->run();
97
+ $this->assertCount(1, $this->readAttribute($each, 'pending'));
98
+ $this->assertEquals(PromiseInterface::PENDING, $p->getState());
99
+ $promises[3]->resolve('d');
100
+ P\queue()->run();
101
+ $this->assertNull($this->readAttribute($each, 'pending'));
102
+ $this->assertEquals(PromiseInterface::FULFILLED, $p->getState());
103
+ $this->assertFalse($promises->valid());
104
+ }
105
+
106
+ public function testDynamicallyLimitsPendingPromises()
107
+ {
108
+ $calls = [];
109
+ $pendingFn = function ($count) use (&$calls) {
110
+ $calls[] = $count;
111
+ return 2;
112
+ };
113
+ $pending = [new Promise(), new Promise(), new Promise(), new Promise()];
114
+ $promises = new \ArrayIterator($pending);
115
+ $each = new EachPromise($promises, ['concurrency' => $pendingFn]);
116
+ $p = $each->promise();
117
+ $this->assertCount(2, $this->readAttribute($each, 'pending'));
118
+ $pending[0]->resolve('a');
119
+ $this->assertCount(2, $this->readAttribute($each, 'pending'));
120
+ $this->assertTrue($promises->valid());
121
+ $pending[1]->resolve('b');
122
+ $this->assertCount(2, $this->readAttribute($each, 'pending'));
123
+ P\queue()->run();
124
+ $this->assertTrue($promises->valid());
125
+ $promises[2]->resolve('c');
126
+ P\queue()->run();
127
+ $this->assertCount(1, $this->readAttribute($each, 'pending'));
128
+ $this->assertEquals(PromiseInterface::PENDING, $p->getState());
129
+ $promises[3]->resolve('d');
130
+ P\queue()->run();
131
+ $this->assertNull($this->readAttribute($each, 'pending'));
132
+ $this->assertEquals(PromiseInterface::FULFILLED, $p->getState());
133
+ $this->assertEquals([0, 1, 1, 1], $calls);
134
+ $this->assertFalse($promises->valid());
135
+ }
136
+
137
+ public function testClearsReferencesWhenResolved()
138
+ {
139
+ $called = false;
140
+ $a = new Promise(function () use (&$a, &$called) {
141
+ $a->resolve('a');
142
+ $called = true;
143
+ });
144
+ $each = new EachPromise([$a], [
145
+ 'concurrency' => function () { return 1; },
146
+ 'fulfilled' => function () {},
147
+ 'rejected' => function () {}
148
+ ]);
149
+ $each->promise()->wait();
150
+ $this->assertNull($this->readAttribute($each, 'onFulfilled'));
151
+ $this->assertNull($this->readAttribute($each, 'onRejected'));
152
+ $this->assertNull($this->readAttribute($each, 'iterable'));
153
+ $this->assertNull($this->readAttribute($each, 'pending'));
154
+ $this->assertNull($this->readAttribute($each, 'concurrency'));
155
+ $this->assertTrue($called);
156
+ }
157
+
158
+ public function testCanBeCancelled()
159
+ {
160
+ $this->markTestIncomplete();
161
+ }
162
+
163
+ public function testFulfillsImmediatelyWhenGivenAnEmptyIterator()
164
+ {
165
+ $each = new EachPromise(new \ArrayIterator([]));
166
+ $result = $each->promise()->wait();
167
+ }
168
+
169
+ public function testDoesNotBlowStackWithFulfilledPromises()
170
+ {
171
+ $pending = [];
172
+ for ($i = 0; $i < 100; $i++) {
173
+ $pending[] = new FulfilledPromise($i);
174
+ }
175
+ $values = [];
176
+ $each = new EachPromise($pending, [
177
+ 'fulfilled' => function ($value) use (&$values) {
178
+ $values[] = $value;
179
+ }
180
+ ]);
181
+ $called = false;
182
+ $each->promise()->then(function () use (&$called) {
183
+ $called = true;
184
+ });
185
+ $this->assertFalse($called);
186
+ P\queue()->run();
187
+ $this->assertTrue($called);
188
+ $this->assertEquals(range(0, 99), $values);
189
+ }
190
+
191
+ public function testDoesNotBlowStackWithRejectedPromises()
192
+ {
193
+ $pending = [];
194
+ for ($i = 0; $i < 100; $i++) {
195
+ $pending[] = new RejectedPromise($i);
196
+ }
197
+ $values = [];
198
+ $each = new EachPromise($pending, [
199
+ 'rejected' => function ($value) use (&$values) {
200
+ $values[] = $value;
201
+ }
202
+ ]);
203
+ $called = false;
204
+ $each->promise()->then(
205
+ function () use (&$called) { $called = true; },
206
+ function () { $this->fail('Should not have rejected.'); }
207
+ );
208
+ $this->assertFalse($called);
209
+ P\queue()->run();
210
+ $this->assertTrue($called);
211
+ $this->assertEquals(range(0, 99), $values);
212
+ }
213
+
214
+ public function testReturnsPromiseForWhatever()
215
+ {
216
+ $called = [];
217
+ $arr = ['a', 'b'];
218
+ $each = new EachPromise($arr, [
219
+ 'fulfilled' => function ($v) use (&$called) { $called[] = $v; }
220
+ ]);
221
+ $p = $each->promise();
222
+ $this->assertNull($p->wait());
223
+ $this->assertEquals(['a', 'b'], $called);
224
+ }
225
+
226
+ public function testRejectsAggregateWhenNextThrows()
227
+ {
228
+ $iter = function () {
229
+ yield 'a';
230
+ throw new \Exception('Failure');
231
+ };
232
+ $each = new EachPromise($iter());
233
+ $p = $each->promise();
234
+ $e = null;
235
+ $received = null;
236
+ $p->then(null, function ($reason) use (&$e) { $e = $reason; });
237
+ P\queue()->run();
238
+ $this->assertInstanceOf('Exception', $e);
239
+ $this->assertEquals('Failure', $e->getMessage());
240
+ }
241
+
242
+ public function testDoesNotCallNextOnIteratorUntilNeededWhenWaiting()
243
+ {
244
+ $results = [];
245
+ $values = [10];
246
+ $remaining = 9;
247
+ $iter = function () use (&$values) {
248
+ while ($value = array_pop($values)) {
249
+ yield $value;
250
+ }
251
+ };
252
+ $each = new EachPromise($iter(), [
253
+ 'concurrency' => 1,
254
+ 'fulfilled' => function ($r) use (&$results, &$values, &$remaining) {
255
+ $results[] = $r;
256
+ if ($remaining > 0) {
257
+ $values[] = $remaining--;
258
+ }
259
+ }
260
+ ]);
261
+ $each->promise()->wait();
262
+ $this->assertEquals(range(10, 1), $results);
263
+ }
264
+
265
+ public function testDoesNotCallNextOnIteratorUntilNeededWhenAsync()
266
+ {
267
+ $firstPromise = new Promise();
268
+ $pending = [$firstPromise];
269
+ $values = [$firstPromise];
270
+ $results = [];
271
+ $remaining = 9;
272
+ $iter = function () use (&$values) {
273
+ while ($value = array_pop($values)) {
274
+ yield $value;
275
+ }
276
+ };
277
+ $each = new EachPromise($iter(), [
278
+ 'concurrency' => 1,
279
+ 'fulfilled' => function ($r) use (&$results, &$values, &$remaining, &$pending) {
280
+ $results[] = $r;
281
+ if ($remaining-- > 0) {
282
+ $pending[] = $values[] = new Promise();
283
+ }
284
+ }
285
+ ]);
286
+ $i = 0;
287
+ $each->promise();
288
+ while ($promise = array_pop($pending)) {
289
+ $promise->resolve($i++);
290
+ P\queue()->run();
291
+ }
292
+ $this->assertEquals(range(0, 9), $results);
293
+ }
294
+
295
+ private function createSelfResolvingPromise($value)
296
+ {
297
+ $p = new Promise(function () use (&$p, $value) {
298
+ $p->resolve($value);
299
+ });
300
+
301
+ return $p;
302
+ }
303
+
304
+ public function testMutexPreventsGeneratorRecursion()
305
+ {
306
+ $results = $promises = [];
307
+ for ($i = 0; $i < 20; $i++) {
308
+ $p = $this->createSelfResolvingPromise($i);
309
+ $pending[] = $p;
310
+ $promises[] = $p;
311
+ }
312
+
313
+ $iter = function () use (&$promises, &$pending) {
314
+ foreach ($promises as $promise) {
315
+ // Resolve a promises, which will trigger the then() function,
316
+ // which would cause the EachPromise to try to add more
317
+ // promises to the queue. Without a lock, this would trigger
318
+ // a "Cannot resume an already running generator" fatal error.
319
+ if ($p = array_pop($pending)) {
320
+ $p->wait();
321
+ }
322
+ yield $promise;
323
+ }
324
+ };
325
+
326
+ $each = new EachPromise($iter(), [
327
+ 'concurrency' => 5,
328
+ 'fulfilled' => function ($r) use (&$results, &$pending) {
329
+ $results[] = $r;
330
+ }
331
+ ]);
332
+
333
+ $each->promise()->wait();
334
+ $this->assertCount(20, $results);
335
+ }
336
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Promise;
3
+
4
+ use GuzzleHttp\Promise\Promise;
5
+ use GuzzleHttp\Promise\FulfilledPromise;
6
+
7
+ /**
8
+ * @covers GuzzleHttp\Promise\FulfilledPromise
9
+ */
10
+ class FulfilledPromiseTest extends \PHPUnit_Framework_TestCase
11
+ {
12
+ public function testReturnsValueWhenWaitedUpon()
13
+ {
14
+ $p = new FulfilledPromise('foo');
15
+ $this->assertEquals('fulfilled', $p->getState());
16
+ $this->assertEquals('foo', $p->wait(true));
17
+ }
18
+
19
+ public function testCannotCancel()
20
+ {
21
+ $p = new FulfilledPromise('foo');
22
+ $this->assertEquals('fulfilled', $p->getState());
23
+ $p->cancel();
24
+ $this->assertEquals('foo', $p->wait());
25
+ }
26
+
27
+ /**
28
+ * @expectedException \LogicException
29
+ * @exepctedExceptionMessage Cannot resolve a fulfilled promise
30
+ */
31
+ public function testCannotResolve()
32
+ {
33
+ $p = new FulfilledPromise('foo');
34
+ $p->resolve('bar');
35
+ }
36
+
37
+ /**
38
+ * @expectedException \LogicException
39
+ * @exepctedExceptionMessage Cannot reject a fulfilled promise
40
+ */
41
+ public function testCannotReject()
42
+ {
43
+ $p = new FulfilledPromise('foo');
44
+ $p->reject('bar');
45
+ }
46
+
47
+ public function testCanResolveWithSameValue()
48
+ {
49
+ $p = new FulfilledPromise('foo');
50
+ $p->resolve('foo');
51
+ }
52
+
53
+ /**
54
+ * @expectedException \InvalidArgumentException
55
+ */
56
+ public function testCannotResolveWithPromise()
57
+ {
58
+ new FulfilledPromise(new Promise());
59
+ }
60
+
61
+ public function testReturnsSelfWhenNoOnFulfilled()
62
+ {
63
+ $p = new FulfilledPromise('a');
64
+ $this->assertSame($p, $p->then());
65
+ }
66
+
67
+ public function testAsynchronouslyInvokesOnFulfilled()
68
+ {
69
+ $p = new FulfilledPromise('a');
70
+ $r = null;
71
+ $f = function ($d) use (&$r) { $r = $d; };
72
+ $p2 = $p->then($f);
73
+ $this->assertNotSame($p, $p2);
74
+ $this->assertNull($r);
75
+ \GuzzleHttp\Promise\queue()->run();
76
+ $this->assertEquals('a', $r);
77
+ }
78
+
79
+ public function testReturnsNewRejectedWhenOnFulfilledFails()
80
+ {
81
+ $p = new FulfilledPromise('a');
82
+ $f = function () { throw new \Exception('b'); };
83
+ $p2 = $p->then($f);
84
+ $this->assertNotSame($p, $p2);
85
+ try {
86
+ $p2->wait();
87
+ $this->fail();
88
+ } catch (\Exception $e) {
89
+ $this->assertEquals('b', $e->getMessage());
90
+ }
91
+ }
92
+
93
+ public function testOtherwiseIsSugarForRejections()
94
+ {
95
+ $c = null;
96
+ $p = new FulfilledPromise('foo');
97
+ $p->otherwise(function ($v) use (&$c) { $c = $v; });
98
+ $this->assertNull($c);
99
+ }
100
+
101
+ public function testDoesNotTryToFulfillTwiceDuringTrampoline()
102
+ {
103
+ $fp = new FulfilledPromise('a');
104
+ $t1 = $fp->then(function ($v) { return $v . ' b'; });
105
+ $t1->resolve('why!');
106
+ $this->assertEquals('why!', $t1->wait());
107
+ }
108
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/NotPromiseInstance.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Tests;
3
+
4
+ use GuzzleHttp\Promise\Promise;
5
+ use GuzzleHttp\Promise\PromiseInterface;
6
+
7
+ class NotPromiseInstance extends Thennable implements PromiseInterface
8
+ {
9
+ private $nextPromise = null;
10
+
11
+ public function __construct()
12
+ {
13
+ $this->nextPromise = new Promise();
14
+ }
15
+
16
+ public function then(callable $res = null, callable $rej = null)
17
+ {
18
+ return $this->nextPromise->then($res, $rej);
19
+ }
20
+
21
+ public function otherwise(callable $onRejected)
22
+ {
23
+ return $this->then($onRejected);
24
+ }
25
+
26
+ public function resolve($value)
27
+ {
28
+ $this->nextPromise->resolve($value);
29
+ }
30
+
31
+ public function reject($reason)
32
+ {
33
+ $this->nextPromise->reject($reason);
34
+ }
35
+
36
+ public function wait($unwrap = true, $defaultResolution = null)
37
+ {
38
+
39
+ }
40
+
41
+ public function cancel()
42
+ {
43
+
44
+ }
45
+
46
+ public function getState()
47
+ {
48
+ return $this->nextPromise->getState();
49
+ }
50
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/PromiseTest.php ADDED
@@ -0,0 +1,591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Tests;
3
+
4
+ use GuzzleHttp\Promise\CancellationException;
5
+ use GuzzleHttp\Promise as P;
6
+ use GuzzleHttp\Promise\Promise;
7
+ use GuzzleHttp\Promise\RejectedPromise;
8
+ use GuzzleHttp\Promise\RejectionException;
9
+
10
+ /**
11
+ * @covers GuzzleHttp\Promise\Promise
12
+ */
13
+ class PromiseTest extends \PHPUnit_Framework_TestCase
14
+ {
15
+ /**
16
+ * @expectedException \LogicException
17
+ * @expectedExceptionMessage The promise is already fulfilled
18
+ */
19
+ public function testCannotResolveNonPendingPromise()
20
+ {
21
+ $p = new Promise();
22
+ $p->resolve('foo');
23
+ $p->resolve('bar');
24
+ $this->assertEquals('foo', $p->wait());
25
+ }
26
+
27
+ public function testCanResolveWithSameValue()
28
+ {
29
+ $p = new Promise();
30
+ $p->resolve('foo');
31
+ $p->resolve('foo');
32
+ }
33
+
34
+ /**
35
+ * @expectedException \LogicException
36
+ * @expectedExceptionMessage Cannot change a fulfilled promise to rejected
37
+ */
38
+ public function testCannotRejectNonPendingPromise()
39
+ {
40
+ $p = new Promise();
41
+ $p->resolve('foo');
42
+ $p->reject('bar');
43
+ $this->assertEquals('foo', $p->wait());
44
+ }
45
+
46
+ public function testCanRejectWithSameValue()
47
+ {
48
+ $p = new Promise();
49
+ $p->reject('foo');
50
+ $p->reject('foo');
51
+ }
52
+
53
+ /**
54
+ * @expectedException \LogicException
55
+ * @expectedExceptionMessage Cannot change a fulfilled promise to rejected
56
+ */
57
+ public function testCannotRejectResolveWithSameValue()
58
+ {
59
+ $p = new Promise();
60
+ $p->resolve('foo');
61
+ $p->reject('foo');
62
+ }
63
+
64
+ public function testInvokesWaitFunction()
65
+ {
66
+ $p = new Promise(function () use (&$p) { $p->resolve('10'); });
67
+ $this->assertEquals('10', $p->wait());
68
+ }
69
+
70
+ /**
71
+ * @expectedException \GuzzleHttp\Promise\RejectionException
72
+ */
73
+ public function testRejectsAndThrowsWhenWaitFailsToResolve()
74
+ {
75
+ $p = new Promise(function () {});
76
+ $p->wait();
77
+ }
78
+
79
+ /**
80
+ * @expectedException \GuzzleHttp\Promise\RejectionException
81
+ * @expectedExceptionMessage The promise was rejected with reason: foo
82
+ */
83
+ public function testThrowsWhenUnwrapIsRejectedWithNonException()
84
+ {
85
+ $p = new Promise(function () use (&$p) { $p->reject('foo'); });
86
+ $p->wait();
87
+ }
88
+
89
+ /**
90
+ * @expectedException \UnexpectedValueException
91
+ * @expectedExceptionMessage foo
92
+ */
93
+ public function testThrowsWhenUnwrapIsRejectedWithException()
94
+ {
95
+ $e = new \UnexpectedValueException('foo');
96
+ $p = new Promise(function () use (&$p, $e) { $p->reject($e); });
97
+ $p->wait();
98
+ }
99
+
100
+ public function testDoesNotUnwrapExceptionsWhenDisabled()
101
+ {
102
+ $p = new Promise(function () use (&$p) { $p->reject('foo'); });
103
+ $this->assertEquals('pending', $p->getState());
104
+ $p->wait(false);
105
+ $this->assertEquals('rejected', $p->getState());
106
+ }
107
+
108
+ public function testRejectsSelfWhenWaitThrows()
109
+ {
110
+ $e = new \UnexpectedValueException('foo');
111
+ $p = new Promise(function () use ($e) { throw $e; });
112
+ try {
113
+ $p->wait();
114
+ $this->fail();
115
+ } catch (\UnexpectedValueException $e) {
116
+ $this->assertEquals('rejected', $p->getState());
117
+ }
118
+ }
119
+
120
+ public function testWaitsOnNestedPromises()
121
+ {
122
+ $p = new Promise(function () use (&$p) { $p->resolve('_'); });
123
+ $p2 = new Promise(function () use (&$p2) { $p2->resolve('foo'); });
124
+ $p3 = $p->then(function () use ($p2) { return $p2; });
125
+ $this->assertSame('foo', $p3->wait());
126
+ }
127
+
128
+ /**
129
+ * @expectedException \GuzzleHttp\Promise\RejectionException
130
+ */
131
+ public function testThrowsWhenWaitingOnPromiseWithNoWaitFunction()
132
+ {
133
+ $p = new Promise();
134
+ $p->wait();
135
+ }
136
+
137
+ public function testThrowsWaitExceptionAfterPromiseIsResolved()
138
+ {
139
+ $p = new Promise(function () use (&$p) {
140
+ $p->reject('Foo!');
141
+ throw new \Exception('Bar?');
142
+ });
143
+
144
+ try {
145
+ $p->wait();
146
+ $this->fail();
147
+ } catch (\Exception $e) {
148
+ $this->assertEquals('Bar?', $e->getMessage());
149
+ }
150
+ }
151
+
152
+ public function testGetsActualWaitValueFromThen()
153
+ {
154
+ $p = new Promise(function () use (&$p) { $p->reject('Foo!'); });
155
+ $p2 = $p->then(null, function ($reason) {
156
+ return new RejectedPromise([$reason]);
157
+ });
158
+
159
+ try {
160
+ $p2->wait();
161
+ $this->fail('Should have thrown');
162
+ } catch (RejectionException $e) {
163
+ $this->assertEquals(['Foo!'], $e->getReason());
164
+ }
165
+ }
166
+
167
+ public function testWaitBehaviorIsBasedOnLastPromiseInChain()
168
+ {
169
+ $p3 = new Promise(function () use (&$p3) { $p3->resolve('Whoop'); });
170
+ $p2 = new Promise(function () use (&$p2, $p3) { $p2->reject($p3); });
171
+ $p = new Promise(function () use (&$p, $p2) { $p->reject($p2); });
172
+ $this->assertEquals('Whoop', $p->wait());
173
+ }
174
+
175
+ public function testWaitsOnAPromiseChainEvenWhenNotUnwrapped()
176
+ {
177
+ $p2 = new Promise(function () use (&$p2) {
178
+ $p2->reject('Fail');
179
+ });
180
+ $p = new Promise(function () use ($p2, &$p) {
181
+ $p->resolve($p2);
182
+ });
183
+ $p->wait(false);
184
+ $this->assertSame(Promise::REJECTED, $p2->getState());
185
+ }
186
+
187
+ public function testCannotCancelNonPending()
188
+ {
189
+ $p = new Promise();
190
+ $p->resolve('foo');
191
+ $p->cancel();
192
+ $this->assertEquals('fulfilled', $p->getState());
193
+ }
194
+
195
+ /**
196
+ * @expectedException \GuzzleHttp\Promise\CancellationException
197
+ */
198
+ public function testCancelsPromiseWhenNoCancelFunction()
199
+ {
200
+ $p = new Promise();
201
+ $p->cancel();
202
+ $this->assertEquals('rejected', $p->getState());
203
+ $p->wait();
204
+ }
205
+
206
+ public function testCancelsPromiseWithCancelFunction()
207
+ {
208
+ $called = false;
209
+ $p = new Promise(null, function () use (&$called) { $called = true; });
210
+ $p->cancel();
211
+ $this->assertEquals('rejected', $p->getState());
212
+ $this->assertTrue($called);
213
+ }
214
+
215
+ public function testCancelsUppermostPendingPromise()
216
+ {
217
+ $called = false;
218
+ $p1 = new Promise(null, function () use (&$called) { $called = true; });
219
+ $p2 = $p1->then(function () {});
220
+ $p3 = $p2->then(function () {});
221
+ $p4 = $p3->then(function () {});
222
+ $p3->cancel();
223
+ $this->assertEquals('rejected', $p1->getState());
224
+ $this->assertEquals('rejected', $p2->getState());
225
+ $this->assertEquals('rejected', $p3->getState());
226
+ $this->assertEquals('pending', $p4->getState());
227
+ $this->assertTrue($called);
228
+
229
+ try {
230
+ $p3->wait();
231
+ $this->fail();
232
+ } catch (CancellationException $e) {
233
+ $this->assertContains('cancelled', $e->getMessage());
234
+ }
235
+
236
+ try {
237
+ $p4->wait();
238
+ $this->fail();
239
+ } catch (CancellationException $e) {
240
+ $this->assertContains('cancelled', $e->getMessage());
241
+ }
242
+
243
+ $this->assertEquals('rejected', $p4->getState());
244
+ }
245
+
246
+ public function testCancelsChildPromises()
247
+ {
248
+ $called1 = $called2 = $called3 = false;
249
+ $p1 = new Promise(null, function () use (&$called1) { $called1 = true; });
250
+ $p2 = new Promise(null, function () use (&$called2) { $called2 = true; });
251
+ $p3 = new Promise(null, function () use (&$called3) { $called3 = true; });
252
+ $p4 = $p2->then(function () use ($p3) { return $p3; });
253
+ $p5 = $p4->then(function () { $this->fail(); });
254
+ $p4->cancel();
255
+ $this->assertEquals('pending', $p1->getState());
256
+ $this->assertEquals('rejected', $p2->getState());
257
+ $this->assertEquals('rejected', $p4->getState());
258
+ $this->assertEquals('pending', $p5->getState());
259
+ $this->assertFalse($called1);
260
+ $this->assertTrue($called2);
261
+ $this->assertFalse($called3);
262
+ }
263
+
264
+ public function testRejectsPromiseWhenCancelFails()
265
+ {
266
+ $called = false;
267
+ $p = new Promise(null, function () use (&$called) {
268
+ $called = true;
269
+ throw new \Exception('e');
270
+ });
271
+ $p->cancel();
272
+ $this->assertEquals('rejected', $p->getState());
273
+ $this->assertTrue($called);
274
+ try {
275
+ $p->wait();
276
+ $this->fail();
277
+ } catch (\Exception $e) {
278
+ $this->assertEquals('e', $e->getMessage());
279
+ }
280
+ }
281
+
282
+ public function testCreatesPromiseWhenFulfilledAfterThen()
283
+ {
284
+ $p = new Promise();
285
+ $carry = null;
286
+ $p2 = $p->then(function ($v) use (&$carry) { $carry = $v; });
287
+ $this->assertNotSame($p, $p2);
288
+ $p->resolve('foo');
289
+ P\queue()->run();
290
+
291
+ $this->assertEquals('foo', $carry);
292
+ }
293
+
294
+ public function testCreatesPromiseWhenFulfilledBeforeThen()
295
+ {
296
+ $p = new Promise();
297
+ $p->resolve('foo');
298
+ $carry = null;
299
+ $p2 = $p->then(function ($v) use (&$carry) { $carry = $v; });
300
+ $this->assertNotSame($p, $p2);
301
+ $this->assertNull($carry);
302
+ \GuzzleHttp\Promise\queue()->run();
303
+ $this->assertEquals('foo', $carry);
304
+ }
305
+
306
+ public function testCreatesPromiseWhenFulfilledWithNoCallback()
307
+ {
308
+ $p = new Promise();
309
+ $p->resolve('foo');
310
+ $p2 = $p->then();
311
+ $this->assertNotSame($p, $p2);
312
+ $this->assertInstanceOf('GuzzleHttp\Promise\FulfilledPromise', $p2);
313
+ }
314
+
315
+ public function testCreatesPromiseWhenRejectedAfterThen()
316
+ {
317
+ $p = new Promise();
318
+ $carry = null;
319
+ $p2 = $p->then(null, function ($v) use (&$carry) { $carry = $v; });
320
+ $this->assertNotSame($p, $p2);
321
+ $p->reject('foo');
322
+ P\queue()->run();
323
+ $this->assertEquals('foo', $carry);
324
+ }
325
+
326
+ public function testCreatesPromiseWhenRejectedBeforeThen()
327
+ {
328
+ $p = new Promise();
329
+ $p->reject('foo');
330
+ $carry = null;
331
+ $p2 = $p->then(null, function ($v) use (&$carry) { $carry = $v; });
332
+ $this->assertNotSame($p, $p2);
333
+ $this->assertNull($carry);
334
+ P\queue()->run();
335
+ $this->assertEquals('foo', $carry);
336
+ }
337
+
338
+ public function testCreatesPromiseWhenRejectedWithNoCallback()
339
+ {
340
+ $p = new Promise();
341
+ $p->reject('foo');
342
+ $p2 = $p->then();
343
+ $this->assertNotSame($p, $p2);
344
+ $this->assertInstanceOf('GuzzleHttp\Promise\RejectedPromise', $p2);
345
+ }
346
+
347
+ public function testInvokesWaitFnsForThens()
348
+ {
349
+ $p = new Promise(function () use (&$p) { $p->resolve('a'); });
350
+ $p2 = $p
351
+ ->then(function ($v) { return $v . '-1-'; })
352
+ ->then(function ($v) { return $v . '2'; });
353
+ $this->assertEquals('a-1-2', $p2->wait());
354
+ }
355
+
356
+ public function testStacksThenWaitFunctions()
357
+ {
358
+ $p1 = new Promise(function () use (&$p1) { $p1->resolve('a'); });
359
+ $p2 = new Promise(function () use (&$p2) { $p2->resolve('b'); });
360
+ $p3 = new Promise(function () use (&$p3) { $p3->resolve('c'); });
361
+ $p4 = $p1
362
+ ->then(function () use ($p2) { return $p2; })
363
+ ->then(function () use ($p3) { return $p3; });
364
+ $this->assertEquals('c', $p4->wait());
365
+ }
366
+
367
+ public function testForwardsFulfilledDownChainBetweenGaps()
368
+ {
369
+ $p = new Promise();
370
+ $r = $r2 = null;
371
+ $p->then(null, null)
372
+ ->then(function ($v) use (&$r) { $r = $v; return $v . '2'; })
373
+ ->then(function ($v) use (&$r2) { $r2 = $v; });
374
+ $p->resolve('foo');
375
+ P\queue()->run();
376
+ $this->assertEquals('foo', $r);
377
+ $this->assertEquals('foo2', $r2);
378
+ }
379
+
380
+ public function testForwardsRejectedPromisesDownChainBetweenGaps()
381
+ {
382
+ $p = new Promise();
383
+ $r = $r2 = null;
384
+ $p->then(null, null)
385
+ ->then(null, function ($v) use (&$r) { $r = $v; return $v . '2'; })
386
+ ->then(function ($v) use (&$r2) { $r2 = $v; });
387
+ $p->reject('foo');
388
+ P\queue()->run();
389
+ $this->assertEquals('foo', $r);
390
+ $this->assertEquals('foo2', $r2);
391
+ }
392
+
393
+ public function testForwardsThrownPromisesDownChainBetweenGaps()
394
+ {
395
+ $e = new \Exception();
396
+ $p = new Promise();
397
+ $r = $r2 = null;
398
+ $p->then(null, null)
399
+ ->then(null, function ($v) use (&$r, $e) {
400
+ $r = $v;
401
+ throw $e;
402
+ })
403
+ ->then(
404
+ null,
405
+ function ($v) use (&$r2) { $r2 = $v; }
406
+ );
407
+ $p->reject('foo');
408
+ P\queue()->run();
409
+ $this->assertEquals('foo', $r);
410
+ $this->assertSame($e, $r2);
411
+ }
412
+
413
+ public function testForwardsReturnedRejectedPromisesDownChainBetweenGaps()
414
+ {
415
+ $p = new Promise();
416
+ $rejected = new RejectedPromise('bar');
417
+ $r = $r2 = null;
418
+ $p->then(null, null)
419
+ ->then(null, function ($v) use (&$r, $rejected) {
420
+ $r = $v;
421
+ return $rejected;
422
+ })
423
+ ->then(
424
+ null,
425
+ function ($v) use (&$r2) { $r2 = $v; }
426
+ );
427
+ $p->reject('foo');
428
+ P\queue()->run();
429
+ $this->assertEquals('foo', $r);
430
+ $this->assertEquals('bar', $r2);
431
+ try {
432
+ $p->wait();
433
+ } catch (RejectionException $e) {
434
+ $this->assertEquals('foo', $e->getReason());
435
+ }
436
+ }
437
+
438
+ public function testForwardsHandlersToNextPromise()
439
+ {
440
+ $p = new Promise();
441
+ $p2 = new Promise();
442
+ $resolved = null;
443
+ $p
444
+ ->then(function ($v) use ($p2) { return $p2; })
445
+ ->then(function ($value) use (&$resolved) { $resolved = $value; });
446
+ $p->resolve('a');
447
+ $p2->resolve('b');
448
+ P\queue()->run();
449
+ $this->assertEquals('b', $resolved);
450
+ }
451
+
452
+ public function testRemovesReferenceFromChildWhenParentWaitedUpon()
453
+ {
454
+ $r = null;
455
+ $p = new Promise(function () use (&$p) { $p->resolve('a'); });
456
+ $p2 = new Promise(function () use (&$p2) { $p2->resolve('b'); });
457
+ $pb = $p->then(
458
+ function ($v) use ($p2, &$r) {
459
+ $r = $v;
460
+ return $p2;
461
+ })
462
+ ->then(function ($v) { return $v . '.'; });
463
+ $this->assertEquals('a', $p->wait());
464
+ $this->assertEquals('b', $p2->wait());
465
+ $this->assertEquals('b.', $pb->wait());
466
+ $this->assertEquals('a', $r);
467
+ }
468
+
469
+ public function testForwardsHandlersWhenFulfilledPromiseIsReturned()
470
+ {
471
+ $res = [];
472
+ $p = new Promise();
473
+ $p2 = new Promise();
474
+ $p2->resolve('foo');
475
+ $p2->then(function ($v) use (&$res) { $res[] = 'A:' . $v; });
476
+ // $res is A:foo
477
+ $p
478
+ ->then(function () use ($p2, &$res) { $res[] = 'B'; return $p2; })
479
+ ->then(function ($v) use (&$res) { $res[] = 'C:' . $v; });
480
+ $p->resolve('a');
481
+ $p->then(function ($v) use (&$res) { $res[] = 'D:' . $v; });
482
+ P\queue()->run();
483
+ $this->assertEquals(['A:foo', 'B', 'D:a', 'C:foo'], $res);
484
+ }
485
+
486
+ public function testForwardsHandlersWhenRejectedPromiseIsReturned()
487
+ {
488
+ $res = [];
489
+ $p = new Promise();
490
+ $p2 = new Promise();
491
+ $p2->reject('foo');
492
+ $p2->then(null, function ($v) use (&$res) { $res[] = 'A:' . $v; });
493
+ $p->then(null, function () use ($p2, &$res) { $res[] = 'B'; return $p2; })
494
+ ->then(null, function ($v) use (&$res) { $res[] = 'C:' . $v; });
495
+ $p->reject('a');
496
+ $p->then(null, function ($v) use (&$res) { $res[] = 'D:' . $v; });
497
+ P\queue()->run();
498
+ $this->assertEquals(['A:foo', 'B', 'D:a', 'C:foo'], $res);
499
+ }
500
+
501
+ public function testDoesNotForwardRejectedPromise()
502
+ {
503
+ $res = [];
504
+ $p = new Promise();
505
+ $p2 = new Promise();
506
+ $p2->cancel();
507
+ $p2->then(function ($v) use (&$res) { $res[] = "B:$v"; return $v; });
508
+ $p->then(function ($v) use ($p2, &$res) { $res[] = "B:$v"; return $p2; })
509
+ ->then(function ($v) use (&$res) { $res[] = 'C:' . $v; });
510
+ $p->resolve('a');
511
+ $p->then(function ($v) use (&$res) { $res[] = 'D:' . $v; });
512
+ P\queue()->run();
513
+ $this->assertEquals(['B:a', 'D:a'], $res);
514
+ }
515
+
516
+ public function testRecursivelyForwardsWhenOnlyThennable()
517
+ {
518
+ $res = [];
519
+ $p = new Promise();
520
+ $p2 = new Thennable();
521
+ $p2->resolve('foo');
522
+ $p2->then(function ($v) use (&$res) { $res[] = 'A:' . $v; });
523
+ $p->then(function () use ($p2, &$res) { $res[] = 'B'; return $p2; })
524
+ ->then(function ($v) use (&$res) { $res[] = 'C:' . $v; });
525
+ $p->resolve('a');
526
+ $p->then(function ($v) use (&$res) { $res[] = 'D:' . $v; });
527
+ P\queue()->run();
528
+ $this->assertEquals(['A:foo', 'B', 'D:a', 'C:foo'], $res);
529
+ }
530
+
531
+ public function testRecursivelyForwardsWhenNotInstanceOfPromise()
532
+ {
533
+ $res = [];
534
+ $p = new Promise();
535
+ $p2 = new NotPromiseInstance();
536
+ $p2->then(function ($v) use (&$res) { $res[] = 'A:' . $v; });
537
+ $p->then(function () use ($p2, &$res) { $res[] = 'B'; return $p2; })
538
+ ->then(function ($v) use (&$res) { $res[] = 'C:' . $v; });
539
+ $p->resolve('a');
540
+ $p->then(function ($v) use (&$res) { $res[] = 'D:' . $v; });
541
+ P\queue()->run();
542
+ $this->assertEquals(['B', 'D:a'], $res);
543
+ $p2->resolve('foo');
544
+ P\queue()->run();
545
+ $this->assertEquals(['B', 'D:a', 'A:foo', 'C:foo'], $res);
546
+ }
547
+
548
+ /**
549
+ * @expectedException \LogicException
550
+ * @expectedExceptionMessage Cannot fulfill or reject a promise with itself
551
+ */
552
+ public function testCannotResolveWithSelf()
553
+ {
554
+ $p = new Promise();
555
+ $p->resolve($p);
556
+ }
557
+
558
+ /**
559
+ * @expectedException \LogicException
560
+ * @expectedExceptionMessage Cannot fulfill or reject a promise with itself
561
+ */
562
+ public function testCannotRejectWithSelf()
563
+ {
564
+ $p = new Promise();
565
+ $p->reject($p);
566
+ }
567
+
568
+ public function testDoesNotBlowStackWhenWaitingOnNestedThens()
569
+ {
570
+ $inner = new Promise(function () use (&$inner) { $inner->resolve(0); });
571
+ $prev = $inner;
572
+ for ($i = 1; $i < 100; $i++) {
573
+ $prev = $prev->then(function ($i) { return $i + 1; });
574
+ }
575
+
576
+ $parent = new Promise(function () use (&$parent, $prev) {
577
+ $parent->resolve($prev);
578
+ });
579
+
580
+ $this->assertEquals(99, $parent->wait());
581
+ }
582
+
583
+ public function testOtherwiseIsSugarForRejections()
584
+ {
585
+ $p = new Promise();
586
+ $p->reject('foo');
587
+ $p->otherwise(function ($v) use (&$c) { $c = $v; });
588
+ P\queue()->run();
589
+ $this->assertEquals($c, 'foo');
590
+ }
591
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/RejectedPromiseTest.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Tests;
3
+
4
+ use GuzzleHttp\Promise\Promise;
5
+ use GuzzleHttp\Promise\RejectedPromise;
6
+
7
+ /**
8
+ * @covers GuzzleHttp\Promise\RejectedPromise
9
+ */
10
+ class RejectedPromiseTest extends \PHPUnit_Framework_TestCase
11
+ {
12
+ public function testThrowsReasonWhenWaitedUpon()
13
+ {
14
+ $p = new RejectedPromise('foo');
15
+ $this->assertEquals('rejected', $p->getState());
16
+ try {
17
+ $p->wait(true);
18
+ $this->fail();
19
+ } catch (\Exception $e) {
20
+ $this->assertEquals('rejected', $p->getState());
21
+ $this->assertContains('foo', $e->getMessage());
22
+ }
23
+ }
24
+
25
+ public function testCannotCancel()
26
+ {
27
+ $p = new RejectedPromise('foo');
28
+ $p->cancel();
29
+ $this->assertEquals('rejected', $p->getState());
30
+ }
31
+
32
+ /**
33
+ * @expectedException \LogicException
34
+ * @exepctedExceptionMessage Cannot resolve a rejected promise
35
+ */
36
+ public function testCannotResolve()
37
+ {
38
+ $p = new RejectedPromise('foo');
39
+ $p->resolve('bar');
40
+ }
41
+
42
+ /**
43
+ * @expectedException \LogicException
44
+ * @exepctedExceptionMessage Cannot reject a rejected promise
45
+ */
46
+ public function testCannotReject()
47
+ {
48
+ $p = new RejectedPromise('foo');
49
+ $p->reject('bar');
50
+ }
51
+
52
+ public function testCanRejectWithSameValue()
53
+ {
54
+ $p = new RejectedPromise('foo');
55
+ $p->reject('foo');
56
+ }
57
+
58
+ public function testThrowsSpecificException()
59
+ {
60
+ $e = new \Exception();
61
+ $p = new RejectedPromise($e);
62
+ try {
63
+ $p->wait(true);
64
+ $this->fail();
65
+ } catch (\Exception $e2) {
66
+ $this->assertSame($e, $e2);
67
+ }
68
+ }
69
+
70
+ /**
71
+ * @expectedException \InvalidArgumentException
72
+ */
73
+ public function testCannotResolveWithPromise()
74
+ {
75
+ new RejectedPromise(new Promise());
76
+ }
77
+
78
+ public function testReturnsSelfWhenNoOnReject()
79
+ {
80
+ $p = new RejectedPromise('a');
81
+ $this->assertSame($p, $p->then());
82
+ }
83
+
84
+ public function testInvokesOnRejectedAsynchronously()
85
+ {
86
+ $p = new RejectedPromise('a');
87
+ $r = null;
88
+ $f = function ($reason) use (&$r) { $r = $reason; };
89
+ $p->then(null, $f);
90
+ $this->assertNull($r);
91
+ \GuzzleHttp\Promise\queue()->run();
92
+ $this->assertEquals('a', $r);
93
+ }
94
+
95
+ public function testReturnsNewRejectedWhenOnRejectedFails()
96
+ {
97
+ $p = new RejectedPromise('a');
98
+ $f = function () { throw new \Exception('b'); };
99
+ $p2 = $p->then(null, $f);
100
+ $this->assertNotSame($p, $p2);
101
+ try {
102
+ $p2->wait();
103
+ $this->fail();
104
+ } catch (\Exception $e) {
105
+ $this->assertEquals('b', $e->getMessage());
106
+ }
107
+ }
108
+
109
+ public function testWaitingIsNoOp()
110
+ {
111
+ $p = new RejectedPromise('a');
112
+ $p->wait(false);
113
+ }
114
+
115
+ public function testOtherwiseIsSugarForRejections()
116
+ {
117
+ $p = new RejectedPromise('foo');
118
+ $p->otherwise(function ($v) use (&$c) { $c = $v; });
119
+ \GuzzleHttp\Promise\queue()->run();
120
+ $this->assertSame('foo', $c);
121
+ }
122
+
123
+ public function testCanResolveThenWithSuccess()
124
+ {
125
+ $actual = null;
126
+ $p = new RejectedPromise('foo');
127
+ $p->otherwise(function ($v) {
128
+ return $v . ' bar';
129
+ })->then(function ($v) use (&$actual) {
130
+ $actual = $v;
131
+ });
132
+ \GuzzleHttp\Promise\queue()->run();
133
+ $this->assertEquals('foo bar', $actual);
134
+ }
135
+
136
+ public function testDoesNotTryToRejectTwiceDuringTrampoline()
137
+ {
138
+ $fp = new RejectedPromise('a');
139
+ $t1 = $fp->then(null, function ($v) { return $v . ' b'; });
140
+ $t1->resolve('why!');
141
+ $this->assertEquals('why!', $t1->wait());
142
+ }
143
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/RejectionExceptionTest.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Tests;
3
+
4
+ use GuzzleHttp\Promise\RejectionException;
5
+
6
+ class Thing1
7
+ {
8
+ public function __construct($message)
9
+ {
10
+ $this->message = $message;
11
+ }
12
+
13
+ public function __toString()
14
+ {
15
+ return $this->message;
16
+ }
17
+ }
18
+
19
+ class Thing2 implements \JsonSerializable
20
+ {
21
+ public function jsonSerialize()
22
+ {
23
+ return '{}';
24
+ }
25
+ }
26
+
27
+ /**
28
+ * @covers GuzzleHttp\Promise\RejectionException
29
+ */
30
+ class RejectionExceptionTest extends \PHPUnit_Framework_TestCase
31
+ {
32
+ public function testCanGetReasonFromException()
33
+ {
34
+ $thing = new Thing1('foo');
35
+ $e = new RejectionException($thing);
36
+
37
+ $this->assertSame($thing, $e->getReason());
38
+ $this->assertEquals('The promise was rejected with reason: foo', $e->getMessage());
39
+ }
40
+
41
+ public function testCanGetReasonMessageFromJson()
42
+ {
43
+ $reason = new Thing2();
44
+ $e = new RejectionException($reason);
45
+ $this->assertContains("{}", $e->getMessage());
46
+ }
47
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/TaskQueueTest.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Test;
3
+
4
+ use GuzzleHttp\Promise\TaskQueue;
5
+
6
+ class TaskQueueTest extends \PHPUnit_Framework_TestCase
7
+ {
8
+ public function testKnowsIfEmpty()
9
+ {
10
+ $tq = new TaskQueue(false);
11
+ $this->assertTrue($tq->isEmpty());
12
+ }
13
+
14
+ public function testKnowsIfFull()
15
+ {
16
+ $tq = new TaskQueue(false);
17
+ $tq->add(function () {});
18
+ $this->assertFalse($tq->isEmpty());
19
+ }
20
+
21
+ public function testExecutesTasksInOrder()
22
+ {
23
+ $tq = new TaskQueue(false);
24
+ $called = [];
25
+ $tq->add(function () use (&$called) { $called[] = 'a'; });
26
+ $tq->add(function () use (&$called) { $called[] = 'b'; });
27
+ $tq->add(function () use (&$called) { $called[] = 'c'; });
28
+ $tq->run();
29
+ $this->assertEquals(['a', 'b', 'c'], $called);
30
+ }
31
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/Thennable.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Tests;
3
+
4
+ use GuzzleHttp\Promise\Promise;
5
+
6
+ class Thennable
7
+ {
8
+ private $nextPromise = null;
9
+
10
+ public function __construct()
11
+ {
12
+ $this->nextPromise = new Promise();
13
+ }
14
+
15
+ public function then(callable $res = null, callable $rej = null)
16
+ {
17
+ return $this->nextPromise->then($res, $rej);
18
+ }
19
+
20
+ public function resolve($value)
21
+ {
22
+ $this->nextPromise->resolve($value);
23
+ }
24
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/bootstrap.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ require __DIR__ . '/../vendor/autoload.php';
3
+ require __DIR__ . '/Thennable.php';
4
+ require __DIR__ . '/NotPromiseInstance.php';
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/promises/tests/functionsTest.php ADDED
@@ -0,0 +1,694 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Promise\Tests;
3
+
4
+ use GuzzleHttp\Promise as P;
5
+ use GuzzleHttp\Promise\FulfilledPromise;
6
+ use GuzzleHttp\Promise\Promise;
7
+ use GuzzleHttp\Promise\RejectedPromise;
8
+
9
+ class FunctionsTest extends \PHPUnit_Framework_TestCase
10
+ {
11
+ public function testCreatesPromiseForValue()
12
+ {
13
+ $p = \GuzzleHttp\Promise\promise_for('foo');
14
+ $this->assertInstanceOf('GuzzleHttp\Promise\FulfilledPromise', $p);
15
+ }
16
+
17
+ public function testReturnsPromiseForPromise()
18
+ {
19
+ $p = new Promise();
20
+ $this->assertSame($p, \GuzzleHttp\Promise\promise_for($p));
21
+ }
22
+
23
+ public function testReturnsPromiseForThennable()
24
+ {
25
+ $p = new Thennable();
26
+ $wrapped = \GuzzleHttp\Promise\promise_for($p);
27
+ $this->assertNotSame($p, $wrapped);
28
+ $this->assertInstanceOf('GuzzleHttp\Promise\PromiseInterface', $wrapped);
29
+ $p->resolve('foo');
30
+ P\queue()->run();
31
+ $this->assertEquals('foo', $wrapped->wait());
32
+ }
33
+
34
+ public function testReturnsRejection()
35
+ {
36
+ $p = \GuzzleHttp\Promise\rejection_for('fail');
37
+ $this->assertInstanceOf('GuzzleHttp\Promise\RejectedPromise', $p);
38
+ $this->assertEquals('fail', $this->readAttribute($p, 'reason'));
39
+ }
40
+
41
+ public function testReturnsPromisesAsIsInRejectionFor()
42
+ {
43
+ $a = new Promise();
44
+ $b = \GuzzleHttp\Promise\rejection_for($a);
45
+ $this->assertSame($a, $b);
46
+ }
47
+
48
+ public function testWaitsOnAllPromisesIntoArray()
49
+ {
50
+ $e = new \Exception();
51
+ $a = new Promise(function () use (&$a) { $a->resolve('a'); });
52
+ $b = new Promise(function () use (&$b) { $b->reject('b'); });
53
+ $c = new Promise(function () use (&$c, $e) { $c->reject($e); });
54
+ $results = \GuzzleHttp\Promise\inspect_all([$a, $b, $c]);
55
+ $this->assertEquals([
56
+ ['state' => 'fulfilled', 'value' => 'a'],
57
+ ['state' => 'rejected', 'reason' => 'b'],
58
+ ['state' => 'rejected', 'reason' => $e]
59
+ ], $results);
60
+ }
61
+
62
+ /**
63
+ * @expectedException \GuzzleHttp\Promise\RejectionException
64
+ */
65
+ public function testUnwrapsPromisesWithNoDefaultAndFailure()
66
+ {
67
+ $promises = [new FulfilledPromise('a'), new Promise()];
68
+ \GuzzleHttp\Promise\unwrap($promises);
69
+ }
70
+
71
+ public function testUnwrapsPromisesWithNoDefault()
72
+ {
73
+ $promises = [new FulfilledPromise('a')];
74
+ $this->assertEquals(['a'], \GuzzleHttp\Promise\unwrap($promises));
75
+ }
76
+
77
+ public function testUnwrapsPromisesWithKeys()
78
+ {
79
+ $promises = [
80
+ 'foo' => new FulfilledPromise('a'),
81
+ 'bar' => new FulfilledPromise('b'),
82
+ ];
83
+ $this->assertEquals([
84
+ 'foo' => 'a',
85
+ 'bar' => 'b'
86
+ ], \GuzzleHttp\Promise\unwrap($promises));
87
+ }
88
+
89
+ public function testAllAggregatesSortedArray()
90
+ {
91
+ $a = new Promise();
92
+ $b = new Promise();
93
+ $c = new Promise();
94
+ $d = \GuzzleHttp\Promise\all([$a, $b, $c]);
95
+ $b->resolve('b');
96
+ $a->resolve('a');
97
+ $c->resolve('c');
98
+ $d->then(
99
+ function ($value) use (&$result) { $result = $value; },
100
+ function ($reason) use (&$result) { $result = $reason; }
101
+ );
102
+ P\queue()->run();
103
+ $this->assertEquals(['a', 'b', 'c'], $result);
104
+ }
105
+
106
+ public function testAllThrowsWhenAnyRejected()
107
+ {
108
+ $a = new Promise();
109
+ $b = new Promise();
110
+ $c = new Promise();
111
+ $d = \GuzzleHttp\Promise\all([$a, $b, $c]);
112
+ $b->resolve('b');
113
+ $a->reject('fail');
114
+ $c->resolve('c');
115
+ $d->then(
116
+ function ($value) use (&$result) { $result = $value; },
117
+ function ($reason) use (&$result) { $result = $reason; }
118
+ );
119
+ P\queue()->run();
120
+ $this->assertEquals('fail', $result);
121
+ }
122
+
123
+ public function testSomeAggregatesSortedArrayWithMax()
124
+ {
125
+ $a = new Promise();
126
+ $b = new Promise();
127
+ $c = new Promise();
128
+ $d = \GuzzleHttp\Promise\some(2, [$a, $b, $c]);
129
+ $b->resolve('b');
130
+ $c->resolve('c');
131
+ $a->resolve('a');
132
+ $d->then(function ($value) use (&$result) { $result = $value; });
133
+ P\queue()->run();
134
+ $this->assertEquals(['b', 'c'], $result);
135
+ }
136
+
137
+ public function testSomeRejectsWhenTooManyRejections()
138
+ {
139
+ $a = new Promise();
140
+ $b = new Promise();
141
+ $d = \GuzzleHttp\Promise\some(2, [$a, $b]);
142
+ $a->reject('bad');
143
+ $b->resolve('good');
144
+ P\queue()->run();
145
+ $this->assertEquals($a::REJECTED, $d->getState());
146
+ $d->then(null, function ($reason) use (&$called) {
147
+ $called = $reason;
148
+ });
149
+ P\queue()->run();
150
+ $this->assertInstanceOf('GuzzleHttp\Promise\AggregateException', $called);
151
+ $this->assertContains('bad', $called->getReason());
152
+ }
153
+
154
+ public function testCanWaitUntilSomeCountIsSatisfied()
155
+ {
156
+ $a = new Promise(function () use (&$a) { $a->resolve('a'); });
157
+ $b = new Promise(function () use (&$b) { $b->resolve('b'); });
158
+ $c = new Promise(function () use (&$c) { $c->resolve('c'); });
159
+ $d = \GuzzleHttp\Promise\some(2, [$a, $b, $c]);
160
+ $this->assertEquals(['a', 'b'], $d->wait());
161
+ }
162
+
163
+ /**
164
+ * @expectedException \GuzzleHttp\Promise\AggregateException
165
+ * @expectedExceptionMessage Not enough promises to fulfill count
166
+ */
167
+ public function testThrowsIfImpossibleToWaitForSomeCount()
168
+ {
169
+ $a = new Promise(function () use (&$a) { $a->resolve('a'); });
170
+ $d = \GuzzleHttp\Promise\some(2, [$a]);
171
+ $d->wait();
172
+ }
173
+
174
+ /**
175
+ * @expectedException \GuzzleHttp\Promise\AggregateException
176
+ * @expectedExceptionMessage Not enough promises to fulfill count
177
+ */
178
+ public function testThrowsIfResolvedWithoutCountTotalResults()
179
+ {
180
+ $a = new Promise();
181
+ $b = new Promise();
182
+ $d = \GuzzleHttp\Promise\some(3, [$a, $b]);
183
+ $a->resolve('a');
184
+ $b->resolve('b');
185
+ $d->wait();
186
+ }
187
+
188
+ public function testAnyReturnsFirstMatch()
189
+ {
190
+ $a = new Promise();
191
+ $b = new Promise();
192
+ $c = \GuzzleHttp\Promise\any([$a, $b]);
193
+ $b->resolve('b');
194
+ $a->resolve('a');
195
+ //P\queue()->run();
196
+ //$this->assertEquals('fulfilled', $c->getState());
197
+ $c->then(function ($value) use (&$result) { $result = $value; });
198
+ P\queue()->run();
199
+ $this->assertEquals('b', $result);
200
+ }
201
+
202
+ public function testSettleFulfillsWithFulfilledAndRejected()
203
+ {
204
+ $a = new Promise();
205
+ $b = new Promise();
206
+ $c = new Promise();
207
+ $d = \GuzzleHttp\Promise\settle([$a, $b, $c]);
208
+ $b->resolve('b');
209
+ $c->resolve('c');
210
+ $a->reject('a');
211
+ P\queue()->run();
212
+ $this->assertEquals('fulfilled', $d->getState());
213
+ $d->then(function ($value) use (&$result) { $result = $value; });
214
+ P\queue()->run();
215
+ $this->assertEquals([
216
+ ['state' => 'rejected', 'reason' => 'a'],
217
+ ['state' => 'fulfilled', 'value' => 'b'],
218
+ ['state' => 'fulfilled', 'value' => 'c']
219
+ ], $result);
220
+ }
221
+
222
+ public function testCanInspectFulfilledPromise()
223
+ {
224
+ $p = new FulfilledPromise('foo');
225
+ $this->assertEquals([
226
+ 'state' => 'fulfilled',
227
+ 'value' => 'foo'
228
+ ], \GuzzleHttp\Promise\inspect($p));
229
+ }
230
+
231
+ public function testCanInspectRejectedPromise()
232
+ {
233
+ $p = new RejectedPromise('foo');
234
+ $this->assertEquals([
235
+ 'state' => 'rejected',
236
+ 'reason' => 'foo'
237
+ ], \GuzzleHttp\Promise\inspect($p));
238
+ }
239
+
240
+ public function testCanInspectRejectedPromiseWithNormalException()
241
+ {
242
+ $e = new \Exception('foo');
243
+ $p = new RejectedPromise($e);
244
+ $this->assertEquals([
245
+ 'state' => 'rejected',
246
+ 'reason' => $e
247
+ ], \GuzzleHttp\Promise\inspect($p));
248
+ }
249
+
250
+ public function testCallsEachLimit()
251
+ {
252
+ $p = new Promise();
253
+ $aggregate = \GuzzleHttp\Promise\each_limit($p, 2);
254
+ $p->resolve('a');
255
+ P\queue()->run();
256
+ $this->assertEquals($p::FULFILLED, $aggregate->getState());
257
+ }
258
+
259
+ public function testEachLimitAllRejectsOnFailure()
260
+ {
261
+ $p = [new FulfilledPromise('a'), new RejectedPromise('b')];
262
+ $aggregate = \GuzzleHttp\Promise\each_limit_all($p, 2);
263
+ P\queue()->run();
264
+ $this->assertEquals(P\PromiseInterface::REJECTED, $aggregate->getState());
265
+ $result = \GuzzleHttp\Promise\inspect($aggregate);
266
+ $this->assertEquals('b', $result['reason']);
267
+ }
268
+
269
+ public function testIterForReturnsIterator()
270
+ {
271
+ $iter = new \ArrayIterator();
272
+ $this->assertSame($iter, \GuzzleHttp\Promise\iter_for($iter));
273
+ }
274
+
275
+ public function testKnowsIfFulfilled()
276
+ {
277
+ $p = new FulfilledPromise(null);
278
+ $this->assertTrue(P\is_fulfilled($p));
279
+ $this->assertFalse(P\is_rejected($p));
280
+ }
281
+
282
+ public function testKnowsIfRejected()
283
+ {
284
+ $p = new RejectedPromise(null);
285
+ $this->assertTrue(P\is_rejected($p));
286
+ $this->assertFalse(P\is_fulfilled($p));
287
+ }
288
+
289
+ public function testKnowsIfSettled()
290
+ {
291
+ $p = new RejectedPromise(null);
292
+ $this->assertTrue(P\is_settled($p));
293
+ $p = new Promise();
294
+ $this->assertFalse(P\is_settled($p));
295
+ }
296
+
297
+ public function testReturnsTrampoline()
298
+ {
299
+ $this->assertInstanceOf('GuzzleHttp\Promise\TaskQueue', P\queue());
300
+ $this->assertSame(P\queue(), P\queue());
301
+ }
302
+
303
+ public function testCanScheduleThunk()
304
+ {
305
+ $tramp = P\queue();
306
+ $promise = P\task(function () { return 'Hi!'; });
307
+ $c = null;
308
+ $promise->then(function ($v) use (&$c) { $c = $v; });
309
+ $this->assertNull($c);
310
+ $tramp->run();
311
+ $this->assertEquals('Hi!', $c);
312
+ }
313
+
314
+ public function testCanScheduleThunkWithRejection()
315
+ {
316
+ $tramp = P\queue();
317
+ $promise = P\task(function () { throw new \Exception('Hi!'); });
318
+ $c = null;
319
+ $promise->otherwise(function ($v) use (&$c) { $c = $v; });
320
+ $this->assertNull($c);
321
+ $tramp->run();
322
+ $this->assertEquals('Hi!', $c->getMessage());
323
+ }
324
+
325
+ public function testCanScheduleThunkWithWait()
326
+ {
327
+ $tramp = P\queue();
328
+ $promise = P\task(function () { return 'a'; });
329
+ $this->assertEquals('a', $promise->wait());
330
+ $tramp->run();
331
+ }
332
+
333
+ public function testYieldsFromCoroutine()
334
+ {
335
+ $promise = P\coroutine(function () {
336
+ $value = (yield new P\FulfilledPromise('a'));
337
+ yield $value . 'b';
338
+ });
339
+ $promise->then(function ($value) use (&$result) { $result = $value; });
340
+ P\queue()->run();
341
+ $this->assertEquals('ab', $result);
342
+ }
343
+
344
+ public function testCanCatchExceptionsInCoroutine()
345
+ {
346
+ $promise = P\coroutine(function () {
347
+ try {
348
+ yield new P\RejectedPromise('a');
349
+ $this->fail('Should have thrown into the coroutine!');
350
+ } catch (P\RejectionException $e) {
351
+ $value = (yield new P\FulfilledPromise($e->getReason()));
352
+ yield $value . 'b';
353
+ }
354
+ });
355
+ $promise->then(function ($value) use (&$result) { $result = $value; });
356
+ P\queue()->run();
357
+ $this->assertEquals(P\PromiseInterface::FULFILLED, $promise->getState());
358
+ $this->assertEquals('ab', $result);
359
+ }
360
+
361
+ public function testRejectsParentExceptionWhenException()
362
+ {
363
+ $promise = P\coroutine(function () {
364
+ yield new P\FulfilledPromise(0);
365
+ throw new \Exception('a');
366
+ });
367
+ $promise->then(
368
+ function () { $this->fail(); },
369
+ function ($reason) use (&$result) { $result = $reason; }
370
+ );
371
+ P\queue()->run();
372
+ $this->assertInstanceOf('Exception', $result);
373
+ $this->assertEquals('a', $result->getMessage());
374
+ }
375
+
376
+ public function testCanRejectFromRejectionCallback()
377
+ {
378
+ $promise = P\coroutine(function () {
379
+ yield new P\FulfilledPromise(0);
380
+ yield new P\RejectedPromise('no!');
381
+ });
382
+ $promise->then(
383
+ function () { $this->fail(); },
384
+ function ($reason) use (&$result) { $result = $reason; }
385
+ );
386
+ P\queue()->run();
387
+ $this->assertInstanceOf('GuzzleHttp\Promise\RejectionException', $result);
388
+ $this->assertEquals('no!', $result->getReason());
389
+ }
390
+
391
+ public function testCanAsyncReject()
392
+ {
393
+ $rej = new P\Promise();
394
+ $promise = P\coroutine(function () use ($rej) {
395
+ yield new P\FulfilledPromise(0);
396
+ yield $rej;
397
+ });
398
+ $promise->then(
399
+ function () { $this->fail(); },
400
+ function ($reason) use (&$result) { $result = $reason; }
401
+ );
402
+ $rej->reject('no!');
403
+ P\queue()->run();
404
+ $this->assertInstanceOf('GuzzleHttp\Promise\RejectionException', $result);
405
+ $this->assertEquals('no!', $result->getReason());
406
+ }
407
+
408
+ public function testCanCatchAndThrowOtherException()
409
+ {
410
+ $promise = P\coroutine(function () {
411
+ try {
412
+ yield new P\RejectedPromise('a');
413
+ $this->fail('Should have thrown into the coroutine!');
414
+ } catch (P\RejectionException $e) {
415
+ throw new \Exception('foo');
416
+ }
417
+ });
418
+ $promise->otherwise(function ($value) use (&$result) { $result = $value; });
419
+ P\queue()->run();
420
+ $this->assertEquals(P\PromiseInterface::REJECTED, $promise->getState());
421
+ $this->assertContains('foo', $result->getMessage());
422
+ }
423
+
424
+ public function testCanCatchAndYieldOtherException()
425
+ {
426
+ $promise = P\coroutine(function () {
427
+ try {
428
+ yield new P\RejectedPromise('a');
429
+ $this->fail('Should have thrown into the coroutine!');
430
+ } catch (P\RejectionException $e) {
431
+ yield new P\RejectedPromise('foo');
432
+ }
433
+ });
434
+ $promise->otherwise(function ($value) use (&$result) { $result = $value; });
435
+ P\queue()->run();
436
+ $this->assertEquals(P\PromiseInterface::REJECTED, $promise->getState());
437
+ $this->assertContains('foo', $result->getMessage());
438
+ }
439
+
440
+ public function createLotsOfSynchronousPromise()
441
+ {
442
+ return P\coroutine(function () {
443
+ $value = 0;
444
+ for ($i = 0; $i < 1000; $i++) {
445
+ $value = (yield new P\FulfilledPromise($i));
446
+ }
447
+ yield $value;
448
+ });
449
+ }
450
+
451
+ public function testLotsOfSynchronousDoesNotBlowStack()
452
+ {
453
+ $promise = $this->createLotsOfSynchronousPromise();
454
+ $promise->then(function ($v) use (&$r) { $r = $v; });
455
+ P\queue()->run();
456
+ $this->assertEquals(999, $r);
457
+ }
458
+
459
+ public function testLotsOfSynchronousWaitDoesNotBlowStack()
460
+ {
461
+ $promise = $this->createLotsOfSynchronousPromise();
462
+ $promise->then(function ($v) use (&$r) { $r = $v; });
463
+ $this->assertEquals(999, $promise->wait());
464
+ $this->assertEquals(999, $r);
465
+ }
466
+
467
+ private function createLotsOfFlappingPromise()
468
+ {
469
+ return P\coroutine(function () {
470
+ $value = 0;
471
+ for ($i = 0; $i < 1000; $i++) {
472
+ try {
473
+ if ($i % 2) {
474
+ $value = (yield new P\FulfilledPromise($i));
475
+ } else {
476
+ $value = (yield new P\RejectedPromise($i));
477
+ }
478
+ } catch (\Exception $e) {
479
+ $value = (yield new P\FulfilledPromise($i));
480
+ }
481
+ }
482
+ yield $value;
483
+ });
484
+ }
485
+
486
+ public function testLotsOfTryCatchingDoesNotBlowStack()
487
+ {
488
+ $promise = $this->createLotsOfFlappingPromise();
489
+ $promise->then(function ($v) use (&$r) { $r = $v; });
490
+ P\queue()->run();
491
+ $this->assertEquals(999, $r);
492
+ }
493
+
494
+ public function testLotsOfTryCatchingWaitingDoesNotBlowStack()
495
+ {
496
+ $promise = $this->createLotsOfFlappingPromise();
497
+ $promise->then(function ($v) use (&$r) { $r = $v; });
498
+ $this->assertEquals(999, $promise->wait());
499
+ $this->assertEquals(999, $r);
500
+ }
501
+
502
+ public function testAsyncPromisesWithCorrectlyYieldedValues()
503
+ {
504
+ $promises = [
505
+ new P\Promise(),
506
+ new P\Promise(),
507
+ new P\Promise()
508
+ ];
509
+
510
+ $promise = P\coroutine(function () use ($promises) {
511
+ $value = null;
512
+ $this->assertEquals('skip', (yield new P\FulfilledPromise('skip')));
513
+ foreach ($promises as $idx => $p) {
514
+ $value = (yield $p);
515
+ $this->assertEquals($value, $idx);
516
+ $this->assertEquals('skip', (yield new P\FulfilledPromise('skip')));
517
+ }
518
+ $this->assertEquals('skip', (yield new P\FulfilledPromise('skip')));
519
+ yield $value;
520
+ });
521
+
522
+ $promises[0]->resolve(0);
523
+ $promises[1]->resolve(1);
524
+ $promises[2]->resolve(2);
525
+
526
+ $promise->then(function ($v) use (&$r) { $r = $v; });
527
+ P\queue()->run();
528
+ $this->assertEquals(2, $r);
529
+ }
530
+
531
+ public function testYieldFinalWaitablePromise()
532
+ {
533
+ $p1 = new P\Promise(function () use (&$p1) {
534
+ $p1->resolve('skip me');
535
+ });
536
+ $p2 = new P\Promise(function () use (&$p2) {
537
+ $p2->resolve('hello!');
538
+ });
539
+ $co = P\coroutine(function() use ($p1, $p2) {
540
+ yield $p1;
541
+ yield $p2;
542
+ });
543
+ P\queue()->run();
544
+ $this->assertEquals('hello!', $co->wait());
545
+ }
546
+
547
+ public function testCanYieldFinalPendingPromise()
548
+ {
549
+ $p1 = new P\Promise();
550
+ $p2 = new P\Promise();
551
+ $co = P\coroutine(function() use ($p1, $p2) {
552
+ yield $p1;
553
+ yield $p2;
554
+ });
555
+ $p1->resolve('a');
556
+ $p2->resolve('b');
557
+ $co->then(function ($value) use (&$result) { $result = $value; });
558
+ P\queue()->run();
559
+ $this->assertEquals('b', $result);
560
+ }
561
+
562
+ public function testCanNestYieldsAndFailures()
563
+ {
564
+ $p1 = new P\Promise();
565
+ $p2 = new P\Promise();
566
+ $p3 = new P\Promise();
567
+ $p4 = new P\Promise();
568
+ $p5 = new P\Promise();
569
+ $co = P\coroutine(function() use ($p1, $p2, $p3, $p4, $p5) {
570
+ try {
571
+ yield $p1;
572
+ } catch (\Exception $e) {
573
+ yield $p2;
574
+ try {
575
+ yield $p3;
576
+ yield $p4;
577
+ } catch (\Exception $e) {
578
+ yield $p5;
579
+ }
580
+ }
581
+ });
582
+ $p1->reject('a');
583
+ $p2->resolve('b');
584
+ $p3->resolve('c');
585
+ $p4->reject('d');
586
+ $p5->resolve('e');
587
+ $co->then(function ($value) use (&$result) { $result = $value; });
588
+ P\queue()->run();
589
+ $this->assertEquals('e', $result);
590
+ }
591
+
592
+ public function testCanYieldErrorsAndSuccessesWithoutRecursion()
593
+ {
594
+ $promises = [];
595
+ for ($i = 0; $i < 20; $i++) {
596
+ $promises[] = new P\Promise();
597
+ }
598
+
599
+ $co = P\coroutine(function() use ($promises) {
600
+ for ($i = 0; $i < 20; $i += 4) {
601
+ try {
602
+ yield $promises[$i];
603
+ yield $promises[$i + 1];
604
+ } catch (\Exception $e) {
605
+ yield $promises[$i + 2];
606
+ yield $promises[$i + 3];
607
+ }
608
+ }
609
+ });
610
+
611
+ for ($i = 0; $i < 20; $i += 4) {
612
+ $promises[$i]->resolve($i);
613
+ $promises[$i + 1]->reject($i + 1);
614
+ $promises[$i + 2]->resolve($i + 2);
615
+ $promises[$i + 3]->resolve($i + 3);
616
+ }
617
+
618
+ $co->then(function ($value) use (&$result) { $result = $value; });
619
+ P\queue()->run();
620
+ $this->assertEquals('19', $result);
621
+ }
622
+
623
+ public function testCanWaitOnPromiseAfterFulfilled()
624
+ {
625
+ $f = function () {
626
+ static $i = 0;
627
+ $i++;
628
+ return $p = new P\Promise(function () use (&$p, $i) {
629
+ $p->resolve($i . '-bar');
630
+ });
631
+ };
632
+
633
+ $promises = [];
634
+ for ($i = 0; $i < 20; $i++) {
635
+ $promises[] = $f();
636
+ }
637
+
638
+ $p = P\coroutine(function () use ($promises) {
639
+ yield new P\FulfilledPromise('foo!');
640
+ foreach ($promises as $promise) {
641
+ yield $promise;
642
+ }
643
+ });
644
+
645
+ $this->assertEquals('20-bar', $p->wait());
646
+ }
647
+
648
+ public function testCanWaitOnErroredPromises()
649
+ {
650
+ $p1 = new P\Promise(function () use (&$p1) { $p1->reject('a'); });
651
+ $p2 = new P\Promise(function () use (&$p2) { $p2->resolve('b'); });
652
+ $p3 = new P\Promise(function () use (&$p3) { $p3->resolve('c'); });
653
+ $p4 = new P\Promise(function () use (&$p4) { $p4->reject('d'); });
654
+ $p5 = new P\Promise(function () use (&$p5) { $p5->resolve('e'); });
655
+ $p6 = new P\Promise(function () use (&$p6) { $p6->reject('f'); });
656
+
657
+ $co = P\coroutine(function() use ($p1, $p2, $p3, $p4, $p5, $p6) {
658
+ try {
659
+ yield $p1;
660
+ } catch (\Exception $e) {
661
+ yield $p2;
662
+ try {
663
+ yield $p3;
664
+ yield $p4;
665
+ } catch (\Exception $e) {
666
+ yield $p5;
667
+ yield $p6;
668
+ }
669
+ }
670
+ });
671
+
672
+ $res = P\inspect($co);
673
+ $this->assertEquals('f', $res['reason']);
674
+ }
675
+
676
+ public function testCoroutineOtherwiseIntegrationTest()
677
+ {
678
+ $a = new P\Promise();
679
+ $b = new P\Promise();
680
+ $promise = P\coroutine(function () use ($a, $b) {
681
+ // Execute the pool of commands concurrently, and process errors.
682
+ yield $a;
683
+ yield $b;
684
+ })->otherwise(function (\Exception $e) {
685
+ // Throw errors from the operations as a specific Multipart error.
686
+ throw new \OutOfBoundsException('a', 0, $e);
687
+ });
688
+ $a->resolve('a');
689
+ $b->reject('b');
690
+ $reason = P\inspect($promise)['reason'];
691
+ $this->assertInstanceOf('OutOfBoundsException', $reason);
692
+ $this->assertInstanceOf('GuzzleHttp\Promise\RejectionException', $reason->getPrevious());
693
+ }
694
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/.travis.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ php:
4
+ - 5.4
5
+ - 5.5
6
+ - 5.6
7
+ - 7.0
8
+ - hhvm
9
+
10
+ sudo: false
11
+
12
+ install:
13
+ - travis_retry composer install --no-interaction --prefer-source
14
+
15
+ script: make test
16
+
17
+ matrix:
18
+ allow_failures:
19
+ - php: hhvm
20
+ fast_finish: true
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/CHANGELOG.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CHANGELOG
2
+
3
+ ## 1.3.1 - 2016-06-25
4
+
5
+ * Fix `Uri::__toString` for network path references, e.g. `//example.org`.
6
+ * Fix missing lowercase normalization for host.
7
+ * Fix handling of URI components in case they are `'0'` in a lot of places,
8
+ e.g. as a user info password.
9
+ * Fix `Uri::withAddedHeader` to correctly merge headers with different case.
10
+ * Fix trimming of header values in `Uri::withAddedHeader`. Header values may
11
+ be surrounded by whitespace which should be ignored according to RFC 7230
12
+ Section 3.2.4. This does not apply to header names.
13
+ * Fix `Uri::withAddedHeader` with an array of header values.
14
+ * Fix `Uri::resolve` when base path has no slash and handling of fragment.
15
+ * Fix handling of encoding in `Uri::with(out)QueryValue` so one can pass the
16
+ key/value both in encoded as well as decoded form to those methods. This is
17
+ consistent with withPath, withQuery etc.
18
+ * Fix `ServerRequest::withoutAttribute` when attribute value is null.
19
+
20
+ ## 1.3.0 - 2016-04-13
21
+
22
+ * Added remaining interfaces needed for full PSR7 compatibility
23
+ (ServerRequestInterface, UploadedFileInterface, etc.).
24
+ * Added support for stream_for from scalars.
25
+ * Can now extend Uri.
26
+ * Fixed a bug in validating request methods by making it more permissive.
27
+
28
+ ## 1.2.3 - 2016-02-18
29
+
30
+ * Fixed support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
31
+ streams, which can sometimes return fewer bytes than requested with `fread`.
32
+ * Fixed handling of gzipped responses with FNAME headers.
33
+
34
+ ## 1.2.2 - 2016-01-22
35
+
36
+ * Added support for URIs without any authority.
37
+ * Added support for HTTP 451 'Unavailable For Legal Reasons.'
38
+ * Added support for using '0' as a filename.
39
+ * Added support for including non-standard ports in Host headers.
40
+
41
+ ## 1.2.1 - 2015-11-02
42
+
43
+ * Now supporting negative offsets when seeking to SEEK_END.
44
+
45
+ ## 1.2.0 - 2015-08-15
46
+
47
+ * Body as `"0"` is now properly added to a response.
48
+ * Now allowing forward seeking in CachingStream.
49
+ * Now properly parsing HTTP requests that contain proxy targets in
50
+ `parse_request`.
51
+ * functions.php is now conditionally required.
52
+ * user-info is no longer dropped when resolving URIs.
53
+
54
+ ## 1.1.0 - 2015-06-24
55
+
56
+ * URIs can now be relative.
57
+ * `multipart/form-data` headers are now overridden case-insensitively.
58
+ * URI paths no longer encode the following characters because they are allowed
59
+ in URIs: "(", ")", "*", "!", "'"
60
+ * A port is no longer added to a URI when the scheme is missing and no port is
61
+ present.
62
+
63
+ ## 1.0.0 - 2015-05-19
64
+
65
+ Initial release.
66
+
67
+ Currently unsupported:
68
+
69
+ - `Psr\Http\Message\ServerRequestInterface`
70
+ - `Psr\Http\Message\UploadedFileInterface`
app/code/community/NthMobile/EasyWebShopSMS/lib/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.
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/Makefile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ all: clean test
2
+
3
+ test:
4
+ vendor/bin/phpunit $(TEST)
5
+
6
+ coverage:
7
+ vendor/bin/phpunit --coverage-html=artifacts/coverage $(TEST)
8
+
9
+ view-coverage:
10
+ open artifacts/coverage/index.html
11
+
12
+ check-tag:
13
+ $(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1"))
14
+
15
+ tag: check-tag
16
+ @echo Tagging $(TAG)
17
+ chag update $(TAG)
18
+ git commit -a -m '$(TAG) release'
19
+ chag tag
20
+ @echo "Release has been created. Push using 'make release'"
21
+ @echo "Changes made in the release commit"
22
+ git diff HEAD~1 HEAD
23
+
24
+ release: check-tag
25
+ git push origin master
26
+ git push origin $(TAG)
27
+
28
+ clean:
29
+ rm -rf artifacts/*
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/README.md ADDED
@@ -0,0 +1,569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Static URI methods
523
+
524
+ The `GuzzleHttp\Psr7\Uri` class has several static methods to manipulate URIs.
525
+
526
+
527
+ ## `GuzzleHttp\Psr7\Uri::removeDotSegments`
528
+
529
+ `public static function removeDotSegments(string $path): string`
530
+
531
+ Removes dot segments from a path and returns the new path.
532
+
533
+ See http://tools.ietf.org/html/rfc3986#section-5.2.4
534
+
535
+
536
+ ## `GuzzleHttp\Psr7\Uri::resolve`
537
+
538
+ `public static function resolve(UriInterface $base, $rel): UriInterface`
539
+
540
+ Resolve a base URI with a relative URI and return a new URI.
541
+
542
+ See http://tools.ietf.org/html/rfc3986#section-5
543
+
544
+
545
+ ## `GuzzleHttp\Psr7\Uri::withQueryValue`
546
+
547
+ `public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface`
548
+
549
+ Create a new URI with a specific query string value.
550
+
551
+ Any existing query string values that exactly match the provided key are
552
+ removed and replaced with the given key value pair.
553
+
554
+
555
+ ## `GuzzleHttp\Psr7\Uri::withoutQueryValue`
556
+
557
+ `public static function withoutQueryValue(UriInterface $uri, $key): UriInterface`
558
+
559
+ Create a new URI with a specific query string value removed.
560
+
561
+ Any existing query string values that exactly match the provided key are
562
+ removed.
563
+
564
+
565
+ ## `GuzzleHttp\Psr7\Uri::fromParts`
566
+
567
+ `public static function fromParts(array $parts): UriInterface`
568
+
569
+ Create a `GuzzleHttp\Psr7\Uri` object from a hash of `parse_url` parts.
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/composer.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "guzzlehttp/psr7",
3
+ "type": "library",
4
+ "description": "PSR-7 message implementation",
5
+ "keywords": ["message", "stream", "http", "uri"],
6
+ "license": "MIT",
7
+ "authors": [
8
+ {
9
+ "name": "Michael Dowling",
10
+ "email": "mtdowling@gmail.com",
11
+ "homepage": "https://github.com/mtdowling"
12
+ }
13
+ ],
14
+ "require": {
15
+ "php": ">=5.4.0",
16
+ "psr/http-message": "~1.0"
17
+ },
18
+ "require-dev": {
19
+ "phpunit/phpunit": "~4.0"
20
+ },
21
+ "provide": {
22
+ "psr/http-message-implementation": "1.0"
23
+ },
24
+ "autoload": {
25
+ "psr-4": {
26
+ "GuzzleHttp\\Psr7\\": "src/"
27
+ },
28
+ "files": ["src/functions_include.php"]
29
+ },
30
+ "extra": {
31
+ "branch-alias": {
32
+ "dev-master": "1.4-dev"
33
+ }
34
+ }
35
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/phpunit.xml.dist ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit bootstrap="./tests/bootstrap.php"
3
+ colors="true">
4
+ <testsuites>
5
+ <testsuite>
6
+ <directory>tests</directory>
7
+ </testsuite>
8
+ </testsuites>
9
+ <filter>
10
+ <whitelist>
11
+ <directory suffix=".php">src</directory>
12
+ <exclude>
13
+ <directory suffix="Interface.php">src/</directory>
14
+ </exclude>
15
+ </whitelist>
16
+ </filter>
17
+ </phpunit>
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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|null $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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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 ?: uniqid();
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, $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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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 null|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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/Response.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Psr7;
3
+
4
+ use Psr\Http\Message\ResponseInterface;
5
+
6
+ /**
7
+ * PSR-7 response implementation.
8
+ */
9
+ class Response implements ResponseInterface
10
+ {
11
+ use MessageTrait;
12
+
13
+ /** @var array Map of standard HTTP status code/reason phrases */
14
+ private static $phrases = [
15
+ 100 => 'Continue',
16
+ 101 => 'Switching Protocols',
17
+ 102 => 'Processing',
18
+ 200 => 'OK',
19
+ 201 => 'Created',
20
+ 202 => 'Accepted',
21
+ 203 => 'Non-Authoritative Information',
22
+ 204 => 'No Content',
23
+ 205 => 'Reset Content',
24
+ 206 => 'Partial Content',
25
+ 207 => 'Multi-status',
26
+ 208 => 'Already Reported',
27
+ 300 => 'Multiple Choices',
28
+ 301 => 'Moved Permanently',
29
+ 302 => 'Found',
30
+ 303 => 'See Other',
31
+ 304 => 'Not Modified',
32
+ 305 => 'Use Proxy',
33
+ 306 => 'Switch Proxy',
34
+ 307 => 'Temporary Redirect',
35
+ 400 => 'Bad Request',
36
+ 401 => 'Unauthorized',
37
+ 402 => 'Payment Required',
38
+ 403 => 'Forbidden',
39
+ 404 => 'Not Found',
40
+ 405 => 'Method Not Allowed',
41
+ 406 => 'Not Acceptable',
42
+ 407 => 'Proxy Authentication Required',
43
+ 408 => 'Request Time-out',
44
+ 409 => 'Conflict',
45
+ 410 => 'Gone',
46
+ 411 => 'Length Required',
47
+ 412 => 'Precondition Failed',
48
+ 413 => 'Request Entity Too Large',
49
+ 414 => 'Request-URI Too Large',
50
+ 415 => 'Unsupported Media Type',
51
+ 416 => 'Requested range not satisfiable',
52
+ 417 => 'Expectation Failed',
53
+ 418 => 'I\'m a teapot',
54
+ 422 => 'Unprocessable Entity',
55
+ 423 => 'Locked',
56
+ 424 => 'Failed Dependency',
57
+ 425 => 'Unordered Collection',
58
+ 426 => 'Upgrade Required',
59
+ 428 => 'Precondition Required',
60
+ 429 => 'Too Many Requests',
61
+ 431 => 'Request Header Fields Too Large',
62
+ 451 => 'Unavailable For Legal Reasons',
63
+ 500 => 'Internal Server Error',
64
+ 501 => 'Not Implemented',
65
+ 502 => 'Bad Gateway',
66
+ 503 => 'Service Unavailable',
67
+ 504 => 'Gateway Time-out',
68
+ 505 => 'HTTP Version not supported',
69
+ 506 => 'Variant Also Negotiates',
70
+ 507 => 'Insufficient Storage',
71
+ 508 => 'Loop Detected',
72
+ 511 => 'Network Authentication Required',
73
+ ];
74
+
75
+ /** @var string */
76
+ private $reasonPhrase = '';
77
+
78
+ /** @var int */
79
+ private $statusCode = 200;
80
+
81
+ /**
82
+ * @param int $status Status code
83
+ * @param array $headers Response headers
84
+ * @param string|null|resource|StreamInterface $body Response body
85
+ * @param string $version Protocol version
86
+ * @param string|null $reason Reason phrase (when empty a default will be used based on the status code)
87
+ */
88
+ public function __construct(
89
+ $status = 200,
90
+ array $headers = [],
91
+ $body = null,
92
+ $version = '1.1',
93
+ $reason = null
94
+ ) {
95
+ $this->statusCode = (int) $status;
96
+
97
+ if ($body !== '' && $body !== null) {
98
+ $this->stream = stream_for($body);
99
+ }
100
+
101
+ $this->setHeaders($headers);
102
+ if ($reason == '' && isset(self::$phrases[$this->statusCode])) {
103
+ $this->reasonPhrase = self::$phrases[$status];
104
+ } else {
105
+ $this->reasonPhrase = (string) $reason;
106
+ }
107
+
108
+ $this->protocol = $version;
109
+ }
110
+
111
+ public function getStatusCode()
112
+ {
113
+ return $this->statusCode;
114
+ }
115
+
116
+ public function getReasonPhrase()
117
+ {
118
+ return $this->reasonPhrase;
119
+ }
120
+
121
+ public function withStatus($code, $reasonPhrase = '')
122
+ {
123
+ $new = clone $this;
124
+ $new->statusCode = (int) $code;
125
+ if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) {
126
+ $reasonPhrase = self::$phrases[$new->statusCode];
127
+ }
128
+ $new->reasonPhrase = $reasonPhrase;
129
+ return $new;
130
+ }
131
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/ServerRequest.php ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if (isset($_SERVER['HTTPS'])) {
192
+ $uri = $uri->withScheme($_SERVER['HTTPS'] == 'on' ? 'https' : 'http');
193
+ }
194
+
195
+ if (isset($_SERVER['HTTP_HOST'])) {
196
+ $uri = $uri->withHost($_SERVER['HTTP_HOST']);
197
+ } elseif (isset($_SERVER['SERVER_NAME'])) {
198
+ $uri = $uri->withHost($_SERVER['SERVER_NAME']);
199
+ }
200
+
201
+ if (isset($_SERVER['SERVER_PORT'])) {
202
+ $uri = $uri->withPort($_SERVER['SERVER_PORT']);
203
+ }
204
+
205
+ if (isset($_SERVER['REQUEST_URI'])) {
206
+ $uri = $uri->withPath(current(explode('?', $_SERVER['REQUEST_URI'])));
207
+ }
208
+
209
+ if (isset($_SERVER['QUERY_STRING'])) {
210
+ $uri = $uri->withQuery($_SERVER['QUERY_STRING']);
211
+ }
212
+
213
+ return $uri;
214
+ }
215
+
216
+
217
+ /**
218
+ * {@inheritdoc}
219
+ */
220
+ public function getServerParams()
221
+ {
222
+ return $this->serverParams;
223
+ }
224
+
225
+ /**
226
+ * {@inheritdoc}
227
+ */
228
+ public function getUploadedFiles()
229
+ {
230
+ return $this->uploadedFiles;
231
+ }
232
+
233
+ /**
234
+ * {@inheritdoc}
235
+ */
236
+ public function withUploadedFiles(array $uploadedFiles)
237
+ {
238
+ $new = clone $this;
239
+ $new->uploadedFiles = $uploadedFiles;
240
+
241
+ return $new;
242
+ }
243
+
244
+ /**
245
+ * {@inheritdoc}
246
+ */
247
+ public function getCookieParams()
248
+ {
249
+ return $this->cookieParams;
250
+ }
251
+
252
+ /**
253
+ * {@inheritdoc}
254
+ */
255
+ public function withCookieParams(array $cookies)
256
+ {
257
+ $new = clone $this;
258
+ $new->cookieParams = $cookies;
259
+
260
+ return $new;
261
+ }
262
+
263
+ /**
264
+ * {@inheritdoc}
265
+ */
266
+ public function getQueryParams()
267
+ {
268
+ return $this->queryParams;
269
+ }
270
+
271
+ /**
272
+ * {@inheritdoc}
273
+ */
274
+ public function withQueryParams(array $query)
275
+ {
276
+ $new = clone $this;
277
+ $new->queryParams = $query;
278
+
279
+ return $new;
280
+ }
281
+
282
+ /**
283
+ * {@inheritdoc}
284
+ */
285
+ public function getParsedBody()
286
+ {
287
+ return $this->parsedBody;
288
+ }
289
+
290
+ /**
291
+ * {@inheritdoc}
292
+ */
293
+ public function withParsedBody($data)
294
+ {
295
+ $new = clone $this;
296
+ $new->parsedBody = $data;
297
+
298
+ return $new;
299
+ }
300
+
301
+ /**
302
+ * {@inheritdoc}
303
+ */
304
+ public function getAttributes()
305
+ {
306
+ return $this->attributes;
307
+ }
308
+
309
+ /**
310
+ * {@inheritdoc}
311
+ */
312
+ public function getAttribute($attribute, $default = null)
313
+ {
314
+ if (false === array_key_exists($attribute, $this->attributes)) {
315
+ return $default;
316
+ }
317
+
318
+ return $this->attributes[$attribute];
319
+ }
320
+
321
+ /**
322
+ * {@inheritdoc}
323
+ */
324
+ public function withAttribute($attribute, $value)
325
+ {
326
+ $new = clone $this;
327
+ $new->attributes[$attribute] = $value;
328
+
329
+ return $new;
330
+ }
331
+
332
+ /**
333
+ * {@inheritdoc}
334
+ */
335
+ public function withoutAttribute($attribute)
336
+ {
337
+ if (false === array_key_exists($attribute, $this->attributes)) {
338
+ return $this;
339
+ }
340
+
341
+ $new = clone $this;
342
+ unset($new->attributes[$attribute]);
343
+
344
+ return $new;
345
+ }
346
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/Stream.php ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
211
+ return fread($this->stream, $length);
212
+ }
213
+
214
+ public function write($string)
215
+ {
216
+ if (!$this->writable) {
217
+ throw new \RuntimeException('Cannot write to a non-writable stream');
218
+ }
219
+
220
+ // We can't know the size after writing anything
221
+ $this->size = null;
222
+ $result = fwrite($this->stream, $string);
223
+
224
+ if ($result === false) {
225
+ throw new \RuntimeException('Unable to write to stream');
226
+ }
227
+
228
+ return $result;
229
+ }
230
+
231
+ public function getMetadata($key = null)
232
+ {
233
+ if (!isset($this->stream)) {
234
+ return $key ? null : [];
235
+ } elseif (!$key) {
236
+ return $this->customMetadata + stream_get_meta_data($this->stream);
237
+ } elseif (isset($this->customMetadata[$key])) {
238
+ return $this->customMetadata[$key];
239
+ }
240
+
241
+ $meta = stream_get_meta_data($this->stream);
242
+
243
+ return isset($meta[$key]) ? $meta[$key] : null;
244
+ }
245
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/Uri.php ADDED
@@ -0,0 +1,602 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ private static $schemes = [
16
+ 'http' => 80,
17
+ 'https' => 443,
18
+ ];
19
+
20
+ private static $charUnreserved = 'a-zA-Z0-9_\-\.~';
21
+ private static $charSubDelims = '!\$&\'\(\)\*\+,;=';
22
+ private static $replaceQuery = ['=' => '%3D', '&' => '%26'];
23
+
24
+ /** @var string Uri scheme. */
25
+ private $scheme = '';
26
+
27
+ /** @var string Uri user info. */
28
+ private $userInfo = '';
29
+
30
+ /** @var string Uri host. */
31
+ private $host = '';
32
+
33
+ /** @var int|null Uri port. */
34
+ private $port;
35
+
36
+ /** @var string Uri path. */
37
+ private $path = '';
38
+
39
+ /** @var string Uri query string. */
40
+ private $query = '';
41
+
42
+ /** @var string Uri fragment. */
43
+ private $fragment = '';
44
+
45
+ /**
46
+ * @param string $uri URI to parse
47
+ */
48
+ public function __construct($uri = '')
49
+ {
50
+ if ($uri != '') {
51
+ $parts = parse_url($uri);
52
+ if ($parts === false) {
53
+ throw new \InvalidArgumentException("Unable to parse URI: $uri");
54
+ }
55
+ $this->applyParts($parts);
56
+ }
57
+ }
58
+
59
+ public function __toString()
60
+ {
61
+ return self::createUriString(
62
+ $this->scheme,
63
+ $this->getAuthority(),
64
+ $this->path,
65
+ $this->query,
66
+ $this->fragment
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Removes dot segments from a path and returns the new path.
72
+ *
73
+ * @param string $path
74
+ *
75
+ * @return string
76
+ * @link http://tools.ietf.org/html/rfc3986#section-5.2.4
77
+ */
78
+ public static function removeDotSegments($path)
79
+ {
80
+ static $noopPaths = ['' => true, '/' => true, '*' => true];
81
+ static $ignoreSegments = ['.' => true, '..' => true];
82
+
83
+ if (isset($noopPaths[$path])) {
84
+ return $path;
85
+ }
86
+
87
+ $results = [];
88
+ $segments = explode('/', $path);
89
+ foreach ($segments as $segment) {
90
+ if ($segment === '..') {
91
+ array_pop($results);
92
+ } elseif (!isset($ignoreSegments[$segment])) {
93
+ $results[] = $segment;
94
+ }
95
+ }
96
+
97
+ $newPath = implode('/', $results);
98
+ // Add the leading slash if necessary
99
+ if (substr($path, 0, 1) === '/' &&
100
+ substr($newPath, 0, 1) !== '/'
101
+ ) {
102
+ $newPath = '/' . $newPath;
103
+ }
104
+
105
+ // Add the trailing slash if necessary
106
+ if ($newPath !== '/' && isset($ignoreSegments[end($segments)])) {
107
+ $newPath .= '/';
108
+ }
109
+
110
+ return $newPath;
111
+ }
112
+
113
+ /**
114
+ * Resolve a base URI with a relative URI and return a new URI.
115
+ *
116
+ * @param UriInterface $base Base URI
117
+ * @param string|UriInterface $rel Relative URI
118
+ *
119
+ * @return UriInterface
120
+ * @link http://tools.ietf.org/html/rfc3986#section-5.2
121
+ */
122
+ public static function resolve(UriInterface $base, $rel)
123
+ {
124
+ if (!($rel instanceof UriInterface)) {
125
+ $rel = new self($rel);
126
+ }
127
+
128
+ if ((string) $rel === '') {
129
+ // we can simply return the same base URI instance for this same-document reference
130
+ return $base;
131
+ }
132
+
133
+ if ($rel->getScheme() != '') {
134
+ return $rel->withPath(self::removeDotSegments($rel->getPath()));
135
+ }
136
+
137
+ if ($rel->getAuthority() != '') {
138
+ $targetAuthority = $rel->getAuthority();
139
+ $targetPath = self::removeDotSegments($rel->getPath());
140
+ $targetQuery = $rel->getQuery();
141
+ } else {
142
+ $targetAuthority = $base->getAuthority();
143
+ if ($rel->getPath() === '') {
144
+ $targetPath = $base->getPath();
145
+ $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery();
146
+ } else {
147
+ if ($rel->getPath()[0] === '/') {
148
+ $targetPath = $rel->getPath();
149
+ } else {
150
+ if ($targetAuthority != '' && $base->getPath() === '') {
151
+ $targetPath = '/' . $rel->getPath();
152
+ } else {
153
+ $lastSlashPos = strrpos($base->getPath(), '/');
154
+ if ($lastSlashPos === false) {
155
+ $targetPath = $rel->getPath();
156
+ } else {
157
+ $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath();
158
+ }
159
+ }
160
+ }
161
+ $targetPath = self::removeDotSegments($targetPath);
162
+ $targetQuery = $rel->getQuery();
163
+ }
164
+ }
165
+
166
+ return new self(self::createUriString(
167
+ $base->getScheme(),
168
+ $targetAuthority,
169
+ $targetPath,
170
+ $targetQuery,
171
+ $rel->getFragment()
172
+ ));
173
+ }
174
+
175
+ /**
176
+ * Create a new URI with a specific query string value removed.
177
+ *
178
+ * Any existing query string values that exactly match the provided key are
179
+ * removed.
180
+ *
181
+ * @param UriInterface $uri URI to use as a base.
182
+ * @param string $key Query string key to remove.
183
+ *
184
+ * @return UriInterface
185
+ */
186
+ public static function withoutQueryValue(UriInterface $uri, $key)
187
+ {
188
+ $current = $uri->getQuery();
189
+ if ($current == '') {
190
+ return $uri;
191
+ }
192
+
193
+ $decodedKey = rawurldecode($key);
194
+ $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
195
+ return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
196
+ });
197
+
198
+ return $uri->withQuery(implode('&', $result));
199
+ }
200
+
201
+ /**
202
+ * Create a new URI with a specific query string value.
203
+ *
204
+ * Any existing query string values that exactly match the provided key are
205
+ * removed and replaced with the given key value pair.
206
+ *
207
+ * A value of null will set the query string key without a value, e.g. "key"
208
+ * instead of "key=value".
209
+ *
210
+ * @param UriInterface $uri URI to use as a base.
211
+ * @param string $key Key to set.
212
+ * @param string|null $value Value to set
213
+ *
214
+ * @return UriInterface
215
+ */
216
+ public static function withQueryValue(UriInterface $uri, $key, $value)
217
+ {
218
+ $current = $uri->getQuery();
219
+
220
+ if ($current == '') {
221
+ $result = [];
222
+ } else {
223
+ $decodedKey = rawurldecode($key);
224
+ $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
225
+ return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
226
+ });
227
+ }
228
+
229
+ // Query string separators ("=", "&") within the key or value need to be encoded
230
+ // (while preventing double-encoding) before setting the query string. All other
231
+ // chars that need percent-encoding will be encoded by withQuery().
232
+ $key = strtr($key, self::$replaceQuery);
233
+
234
+ if ($value !== null) {
235
+ $result[] = $key . '=' . strtr($value, self::$replaceQuery);
236
+ } else {
237
+ $result[] = $key;
238
+ }
239
+
240
+ return $uri->withQuery(implode('&', $result));
241
+ }
242
+
243
+ /**
244
+ * Create a URI from a hash of parse_url parts.
245
+ *
246
+ * @param array $parts
247
+ *
248
+ * @return self
249
+ */
250
+ public static function fromParts(array $parts)
251
+ {
252
+ $uri = new self();
253
+ $uri->applyParts($parts);
254
+ return $uri;
255
+ }
256
+
257
+ public function getScheme()
258
+ {
259
+ return $this->scheme;
260
+ }
261
+
262
+ public function getAuthority()
263
+ {
264
+ if ($this->host == '') {
265
+ return '';
266
+ }
267
+
268
+ $authority = $this->host;
269
+ if ($this->userInfo != '') {
270
+ $authority = $this->userInfo . '@' . $authority;
271
+ }
272
+
273
+ if ($this->port !== null) {
274
+ $authority .= ':' . $this->port;
275
+ }
276
+
277
+ return $authority;
278
+ }
279
+
280
+ public function getUserInfo()
281
+ {
282
+ return $this->userInfo;
283
+ }
284
+
285
+ public function getHost()
286
+ {
287
+ return $this->host;
288
+ }
289
+
290
+ public function getPort()
291
+ {
292
+ return $this->port;
293
+ }
294
+
295
+ public function getPath()
296
+ {
297
+ return $this->path;
298
+ }
299
+
300
+ public function getQuery()
301
+ {
302
+ return $this->query;
303
+ }
304
+
305
+ public function getFragment()
306
+ {
307
+ return $this->fragment;
308
+ }
309
+
310
+ public function withScheme($scheme)
311
+ {
312
+ $scheme = $this->filterScheme($scheme);
313
+
314
+ if ($this->scheme === $scheme) {
315
+ return $this;
316
+ }
317
+
318
+ $new = clone $this;
319
+ $new->scheme = $scheme;
320
+ $new->port = $new->filterPort($new->port);
321
+ return $new;
322
+ }
323
+
324
+ public function withUserInfo($user, $password = null)
325
+ {
326
+ $info = $user;
327
+ if ($password != '') {
328
+ $info .= ':' . $password;
329
+ }
330
+
331
+ if ($this->userInfo === $info) {
332
+ return $this;
333
+ }
334
+
335
+ $new = clone $this;
336
+ $new->userInfo = $info;
337
+ return $new;
338
+ }
339
+
340
+ public function withHost($host)
341
+ {
342
+ $host = $this->filterHost($host);
343
+
344
+ if ($this->host === $host) {
345
+ return $this;
346
+ }
347
+
348
+ $new = clone $this;
349
+ $new->host = $host;
350
+ return $new;
351
+ }
352
+
353
+ public function withPort($port)
354
+ {
355
+ $port = $this->filterPort($port);
356
+
357
+ if ($this->port === $port) {
358
+ return $this;
359
+ }
360
+
361
+ $new = clone $this;
362
+ $new->port = $port;
363
+ return $new;
364
+ }
365
+
366
+ public function withPath($path)
367
+ {
368
+ $path = $this->filterPath($path);
369
+
370
+ if ($this->path === $path) {
371
+ return $this;
372
+ }
373
+
374
+ $new = clone $this;
375
+ $new->path = $path;
376
+ return $new;
377
+ }
378
+
379
+ public function withQuery($query)
380
+ {
381
+ $query = $this->filterQueryAndFragment($query);
382
+
383
+ if ($this->query === $query) {
384
+ return $this;
385
+ }
386
+
387
+ $new = clone $this;
388
+ $new->query = $query;
389
+ return $new;
390
+ }
391
+
392
+ public function withFragment($fragment)
393
+ {
394
+ $fragment = $this->filterQueryAndFragment($fragment);
395
+
396
+ if ($this->fragment === $fragment) {
397
+ return $this;
398
+ }
399
+
400
+ $new = clone $this;
401
+ $new->fragment = $fragment;
402
+ return $new;
403
+ }
404
+
405
+ /**
406
+ * Apply parse_url parts to a URI.
407
+ *
408
+ * @param array $parts Array of parse_url parts to apply.
409
+ */
410
+ private function applyParts(array $parts)
411
+ {
412
+ $this->scheme = isset($parts['scheme'])
413
+ ? $this->filterScheme($parts['scheme'])
414
+ : '';
415
+ $this->userInfo = isset($parts['user']) ? $parts['user'] : '';
416
+ $this->host = isset($parts['host'])
417
+ ? $this->filterHost($parts['host'])
418
+ : '';
419
+ $this->port = isset($parts['port'])
420
+ ? $this->filterPort($parts['port'])
421
+ : null;
422
+ $this->path = isset($parts['path'])
423
+ ? $this->filterPath($parts['path'])
424
+ : '';
425
+ $this->query = isset($parts['query'])
426
+ ? $this->filterQueryAndFragment($parts['query'])
427
+ : '';
428
+ $this->fragment = isset($parts['fragment'])
429
+ ? $this->filterQueryAndFragment($parts['fragment'])
430
+ : '';
431
+ if (isset($parts['pass'])) {
432
+ $this->userInfo .= ':' . $parts['pass'];
433
+ }
434
+ }
435
+
436
+ /**
437
+ * Create a URI string from its various parts
438
+ *
439
+ * @param string $scheme
440
+ * @param string $authority
441
+ * @param string $path
442
+ * @param string $query
443
+ * @param string $fragment
444
+ * @return string
445
+ */
446
+ private static function createUriString($scheme, $authority, $path, $query, $fragment)
447
+ {
448
+ $uri = '';
449
+
450
+ if ($scheme != '') {
451
+ $uri .= $scheme . ':';
452
+ }
453
+
454
+ if ($authority != '') {
455
+ $uri .= '//' . $authority;
456
+ }
457
+
458
+ if ($path != '') {
459
+ if ($path[0] !== '/') {
460
+ if ($authority != '') {
461
+ // If the path is rootless and an authority is present, the path MUST be prefixed by "/"
462
+ $path = '/' . $path;
463
+ }
464
+ } elseif (isset($path[1]) && $path[1] === '/') {
465
+ if ($authority == '') {
466
+ // If the path is starting with more than one "/" and no authority is present, the
467
+ // starting slashes MUST be reduced to one.
468
+ $path = '/' . ltrim($path, '/');
469
+ }
470
+ }
471
+
472
+ $uri .= $path;
473
+ }
474
+
475
+ if ($query != '') {
476
+ $uri .= '?' . $query;
477
+ }
478
+
479
+ if ($fragment != '') {
480
+ $uri .= '#' . $fragment;
481
+ }
482
+
483
+ return $uri;
484
+ }
485
+
486
+ /**
487
+ * Is a given port non-standard for the current scheme?
488
+ *
489
+ * @param string $scheme
490
+ * @param int $port
491
+ *
492
+ * @return bool
493
+ */
494
+ private static function isNonStandardPort($scheme, $port)
495
+ {
496
+ return !isset(self::$schemes[$scheme]) || $port !== self::$schemes[$scheme];
497
+ }
498
+
499
+ /**
500
+ * @param string $scheme
501
+ *
502
+ * @return string
503
+ *
504
+ * @throws \InvalidArgumentException If the scheme is invalid.
505
+ */
506
+ private function filterScheme($scheme)
507
+ {
508
+ if (!is_string($scheme)) {
509
+ throw new \InvalidArgumentException('Scheme must be a string');
510
+ }
511
+
512
+ return strtolower($scheme);
513
+ }
514
+
515
+ /**
516
+ * @param string $host
517
+ *
518
+ * @return string
519
+ *
520
+ * @throws \InvalidArgumentException If the host is invalid.
521
+ */
522
+ private function filterHost($host)
523
+ {
524
+ if (!is_string($host)) {
525
+ throw new \InvalidArgumentException('Host must be a string');
526
+ }
527
+
528
+ return strtolower($host);
529
+ }
530
+
531
+ /**
532
+ * @param int|null $port
533
+ *
534
+ * @return int|null
535
+ *
536
+ * @throws \InvalidArgumentException If the port is invalid.
537
+ */
538
+ private function filterPort($port)
539
+ {
540
+ if ($port === null) {
541
+ return null;
542
+ }
543
+
544
+ $port = (int) $port;
545
+ if (1 > $port || 0xffff < $port) {
546
+ throw new \InvalidArgumentException(
547
+ sprintf('Invalid port: %d. Must be between 1 and 65535', $port)
548
+ );
549
+ }
550
+
551
+ return self::isNonStandardPort($this->scheme, $port) ? $port : null;
552
+ }
553
+
554
+ /**
555
+ * Filters the path of a URI
556
+ *
557
+ * @param string $path
558
+ *
559
+ * @return string
560
+ *
561
+ * @throws \InvalidArgumentException If the path is invalid.
562
+ */
563
+ private function filterPath($path)
564
+ {
565
+ if (!is_string($path)) {
566
+ throw new \InvalidArgumentException('Path must be a string');
567
+ }
568
+
569
+ return preg_replace_callback(
570
+ '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
571
+ [$this, 'rawurlencodeMatchZero'],
572
+ $path
573
+ );
574
+ }
575
+
576
+ /**
577
+ * Filters the query string or fragment of a URI.
578
+ *
579
+ * @param string $str
580
+ *
581
+ * @return string
582
+ *
583
+ * @throws \InvalidArgumentException If the query or fragment is invalid.
584
+ */
585
+ private function filterQueryAndFragment($str)
586
+ {
587
+ if (!is_string($str)) {
588
+ throw new \InvalidArgumentException('Query and fragment must be a string');
589
+ }
590
+
591
+ return preg_replace_callback(
592
+ '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
593
+ [$this, 'rawurlencodeMatchZero'],
594
+ $str
595
+ );
596
+ }
597
+
598
+ private function rawurlencodeMatchZero(array $match)
599
+ {
600
+ return rawurlencode($match[0]);
601
+ }
602
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/src/functions.php ADDED
@@ -0,0 +1,826 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if ($maxLen === -1) {
375
+ while (!$source->eof()) {
376
+ if (!$dest->write($source->read(1048576))) {
377
+ break;
378
+ }
379
+ }
380
+ return;
381
+ }
382
+
383
+ $bytes = 0;
384
+ while (!$source->eof()) {
385
+ $buf = $source->read($maxLen - $bytes);
386
+ if (!($len = strlen($buf))) {
387
+ break;
388
+ }
389
+ $bytes += $len;
390
+ $dest->write($buf);
391
+ if ($bytes == $maxLen) {
392
+ break;
393
+ }
394
+ }
395
+ }
396
+
397
+ /**
398
+ * Calculate a hash of a Stream
399
+ *
400
+ * @param StreamInterface $stream Stream to calculate the hash for
401
+ * @param string $algo Hash algorithm (e.g. md5, crc32, etc)
402
+ * @param bool $rawOutput Whether or not to use raw output
403
+ *
404
+ * @return string Returns the hash of the stream
405
+ * @throws \RuntimeException on error.
406
+ */
407
+ function hash(
408
+ StreamInterface $stream,
409
+ $algo,
410
+ $rawOutput = false
411
+ ) {
412
+ $pos = $stream->tell();
413
+
414
+ if ($pos > 0) {
415
+ $stream->rewind();
416
+ }
417
+
418
+ $ctx = hash_init($algo);
419
+ while (!$stream->eof()) {
420
+ hash_update($ctx, $stream->read(1048576));
421
+ }
422
+
423
+ $out = hash_final($ctx, (bool) $rawOutput);
424
+ $stream->seek($pos);
425
+
426
+ return $out;
427
+ }
428
+
429
+ /**
430
+ * Read a line from the stream up to the maximum allowed buffer length
431
+ *
432
+ * @param StreamInterface $stream Stream to read from
433
+ * @param int $maxLength Maximum buffer length
434
+ *
435
+ * @return string|bool
436
+ */
437
+ function readline(StreamInterface $stream, $maxLength = null)
438
+ {
439
+ $buffer = '';
440
+ $size = 0;
441
+
442
+ while (!$stream->eof()) {
443
+ // Using a loose equality here to match on '' and false.
444
+ if (null == ($byte = $stream->read(1))) {
445
+ return $buffer;
446
+ }
447
+ $buffer .= $byte;
448
+ // Break when a new line is found or the max length - 1 is reached
449
+ if ($byte === "\n" || ++$size === $maxLength - 1) {
450
+ break;
451
+ }
452
+ }
453
+
454
+ return $buffer;
455
+ }
456
+
457
+ /**
458
+ * Parses a request message string into a request object.
459
+ *
460
+ * @param string $message Request message string.
461
+ *
462
+ * @return Request
463
+ */
464
+ function parse_request($message)
465
+ {
466
+ $data = _parse_message($message);
467
+ $matches = [];
468
+ if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) {
469
+ throw new \InvalidArgumentException('Invalid request string');
470
+ }
471
+ $parts = explode(' ', $data['start-line'], 3);
472
+ $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1';
473
+
474
+ $request = new Request(
475
+ $parts[0],
476
+ $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1],
477
+ $data['headers'],
478
+ $data['body'],
479
+ $version
480
+ );
481
+
482
+ return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]);
483
+ }
484
+
485
+ /**
486
+ * Parses a response message string into a response object.
487
+ *
488
+ * @param string $message Response message string.
489
+ *
490
+ * @return Response
491
+ */
492
+ function parse_response($message)
493
+ {
494
+ $data = _parse_message($message);
495
+ if (!preg_match('/^HTTP\/.* [0-9]{3} .*/', $data['start-line'])) {
496
+ throw new \InvalidArgumentException('Invalid response string');
497
+ }
498
+ $parts = explode(' ', $data['start-line'], 3);
499
+
500
+ return new Response(
501
+ $parts[1],
502
+ $data['headers'],
503
+ $data['body'],
504
+ explode('/', $parts[0])[1],
505
+ isset($parts[2]) ? $parts[2] : null
506
+ );
507
+ }
508
+
509
+ /**
510
+ * Parse a query string into an associative array.
511
+ *
512
+ * If multiple values are found for the same key, the value of that key
513
+ * value pair will become an array. This function does not parse nested
514
+ * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will
515
+ * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
516
+ *
517
+ * @param string $str Query string to parse
518
+ * @param bool|string $urlEncoding How the query string is encoded
519
+ *
520
+ * @return array
521
+ */
522
+ function parse_query($str, $urlEncoding = true)
523
+ {
524
+ $result = [];
525
+
526
+ if ($str === '') {
527
+ return $result;
528
+ }
529
+
530
+ if ($urlEncoding === true) {
531
+ $decoder = function ($value) {
532
+ return rawurldecode(str_replace('+', ' ', $value));
533
+ };
534
+ } elseif ($urlEncoding == PHP_QUERY_RFC3986) {
535
+ $decoder = 'rawurldecode';
536
+ } elseif ($urlEncoding == PHP_QUERY_RFC1738) {
537
+ $decoder = 'urldecode';
538
+ } else {
539
+ $decoder = function ($str) { return $str; };
540
+ }
541
+
542
+ foreach (explode('&', $str) as $kvp) {
543
+ $parts = explode('=', $kvp, 2);
544
+ $key = $decoder($parts[0]);
545
+ $value = isset($parts[1]) ? $decoder($parts[1]) : null;
546
+ if (!isset($result[$key])) {
547
+ $result[$key] = $value;
548
+ } else {
549
+ if (!is_array($result[$key])) {
550
+ $result[$key] = [$result[$key]];
551
+ }
552
+ $result[$key][] = $value;
553
+ }
554
+ }
555
+
556
+ return $result;
557
+ }
558
+
559
+ /**
560
+ * Build a query string from an array of key value pairs.
561
+ *
562
+ * This function can use the return value of parse_query() to build a query
563
+ * string. This function does not modify the provided keys when an array is
564
+ * encountered (like http_build_query would).
565
+ *
566
+ * @param array $params Query string parameters.
567
+ * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
568
+ * to encode using RFC3986, or PHP_QUERY_RFC1738
569
+ * to encode using RFC1738.
570
+ * @return string
571
+ */
572
+ function build_query(array $params, $encoding = PHP_QUERY_RFC3986)
573
+ {
574
+ if (!$params) {
575
+ return '';
576
+ }
577
+
578
+ if ($encoding === false) {
579
+ $encoder = function ($str) { return $str; };
580
+ } elseif ($encoding === PHP_QUERY_RFC3986) {
581
+ $encoder = 'rawurlencode';
582
+ } elseif ($encoding === PHP_QUERY_RFC1738) {
583
+ $encoder = 'urlencode';
584
+ } else {
585
+ throw new \InvalidArgumentException('Invalid type');
586
+ }
587
+
588
+ $qs = '';
589
+ foreach ($params as $k => $v) {
590
+ $k = $encoder($k);
591
+ if (!is_array($v)) {
592
+ $qs .= $k;
593
+ if ($v !== null) {
594
+ $qs .= '=' . $encoder($v);
595
+ }
596
+ $qs .= '&';
597
+ } else {
598
+ foreach ($v as $vv) {
599
+ $qs .= $k;
600
+ if ($vv !== null) {
601
+ $qs .= '=' . $encoder($vv);
602
+ }
603
+ $qs .= '&';
604
+ }
605
+ }
606
+ }
607
+
608
+ return $qs ? (string) substr($qs, 0, -1) : '';
609
+ }
610
+
611
+ /**
612
+ * Determines the mimetype of a file by looking at its extension.
613
+ *
614
+ * @param $filename
615
+ *
616
+ * @return null|string
617
+ */
618
+ function mimetype_from_filename($filename)
619
+ {
620
+ return mimetype_from_extension(pathinfo($filename, PATHINFO_EXTENSION));
621
+ }
622
+
623
+ /**
624
+ * Maps a file extensions to a mimetype.
625
+ *
626
+ * @param $extension string The file extension.
627
+ *
628
+ * @return string|null
629
+ * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
630
+ */
631
+ function mimetype_from_extension($extension)
632
+ {
633
+ static $mimetypes = [
634
+ '7z' => 'application/x-7z-compressed',
635
+ 'aac' => 'audio/x-aac',
636
+ 'ai' => 'application/postscript',
637
+ 'aif' => 'audio/x-aiff',
638
+ 'asc' => 'text/plain',
639
+ 'asf' => 'video/x-ms-asf',
640
+ 'atom' => 'application/atom+xml',
641
+ 'avi' => 'video/x-msvideo',
642
+ 'bmp' => 'image/bmp',
643
+ 'bz2' => 'application/x-bzip2',
644
+ 'cer' => 'application/pkix-cert',
645
+ 'crl' => 'application/pkix-crl',
646
+ 'crt' => 'application/x-x509-ca-cert',
647
+ 'css' => 'text/css',
648
+ 'csv' => 'text/csv',
649
+ 'cu' => 'application/cu-seeme',
650
+ 'deb' => 'application/x-debian-package',
651
+ 'doc' => 'application/msword',
652
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
653
+ 'dvi' => 'application/x-dvi',
654
+ 'eot' => 'application/vnd.ms-fontobject',
655
+ 'eps' => 'application/postscript',
656
+ 'epub' => 'application/epub+zip',
657
+ 'etx' => 'text/x-setext',
658
+ 'flac' => 'audio/flac',
659
+ 'flv' => 'video/x-flv',
660
+ 'gif' => 'image/gif',
661
+ 'gz' => 'application/gzip',
662
+ 'htm' => 'text/html',
663
+ 'html' => 'text/html',
664
+ 'ico' => 'image/x-icon',
665
+ 'ics' => 'text/calendar',
666
+ 'ini' => 'text/plain',
667
+ 'iso' => 'application/x-iso9660-image',
668
+ 'jar' => 'application/java-archive',
669
+ 'jpe' => 'image/jpeg',
670
+ 'jpeg' => 'image/jpeg',
671
+ 'jpg' => 'image/jpeg',
672
+ 'js' => 'text/javascript',
673
+ 'json' => 'application/json',
674
+ 'latex' => 'application/x-latex',
675
+ 'log' => 'text/plain',
676
+ 'm4a' => 'audio/mp4',
677
+ 'm4v' => 'video/mp4',
678
+ 'mid' => 'audio/midi',
679
+ 'midi' => 'audio/midi',
680
+ 'mov' => 'video/quicktime',
681
+ 'mp3' => 'audio/mpeg',
682
+ 'mp4' => 'video/mp4',
683
+ 'mp4a' => 'audio/mp4',
684
+ 'mp4v' => 'video/mp4',
685
+ 'mpe' => 'video/mpeg',
686
+ 'mpeg' => 'video/mpeg',
687
+ 'mpg' => 'video/mpeg',
688
+ 'mpg4' => 'video/mp4',
689
+ 'oga' => 'audio/ogg',
690
+ 'ogg' => 'audio/ogg',
691
+ 'ogv' => 'video/ogg',
692
+ 'ogx' => 'application/ogg',
693
+ 'pbm' => 'image/x-portable-bitmap',
694
+ 'pdf' => 'application/pdf',
695
+ 'pgm' => 'image/x-portable-graymap',
696
+ 'png' => 'image/png',
697
+ 'pnm' => 'image/x-portable-anymap',
698
+ 'ppm' => 'image/x-portable-pixmap',
699
+ 'ppt' => 'application/vnd.ms-powerpoint',
700
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
701
+ 'ps' => 'application/postscript',
702
+ 'qt' => 'video/quicktime',
703
+ 'rar' => 'application/x-rar-compressed',
704
+ 'ras' => 'image/x-cmu-raster',
705
+ 'rss' => 'application/rss+xml',
706
+ 'rtf' => 'application/rtf',
707
+ 'sgm' => 'text/sgml',
708
+ 'sgml' => 'text/sgml',
709
+ 'svg' => 'image/svg+xml',
710
+ 'swf' => 'application/x-shockwave-flash',
711
+ 'tar' => 'application/x-tar',
712
+ 'tif' => 'image/tiff',
713
+ 'tiff' => 'image/tiff',
714
+ 'torrent' => 'application/x-bittorrent',
715
+ 'ttf' => 'application/x-font-ttf',
716
+ 'txt' => 'text/plain',
717
+ 'wav' => 'audio/x-wav',
718
+ 'webm' => 'video/webm',
719
+ 'wma' => 'audio/x-ms-wma',
720
+ 'wmv' => 'video/x-ms-wmv',
721
+ 'woff' => 'application/x-font-woff',
722
+ 'wsdl' => 'application/wsdl+xml',
723
+ 'xbm' => 'image/x-xbitmap',
724
+ 'xls' => 'application/vnd.ms-excel',
725
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
726
+ 'xml' => 'application/xml',
727
+ 'xpm' => 'image/x-xpixmap',
728
+ 'xwd' => 'image/x-xwindowdump',
729
+ 'yaml' => 'text/yaml',
730
+ 'yml' => 'text/yaml',
731
+ 'zip' => 'application/zip',
732
+ ];
733
+
734
+ $extension = strtolower($extension);
735
+
736
+ return isset($mimetypes[$extension])
737
+ ? $mimetypes[$extension]
738
+ : null;
739
+ }
740
+
741
+ /**
742
+ * Parses an HTTP message into an associative array.
743
+ *
744
+ * The array contains the "start-line" key containing the start line of
745
+ * the message, "headers" key containing an associative array of header
746
+ * array values, and a "body" key containing the body of the message.
747
+ *
748
+ * @param string $message HTTP request or response to parse.
749
+ *
750
+ * @return array
751
+ * @internal
752
+ */
753
+ function _parse_message($message)
754
+ {
755
+ if (!$message) {
756
+ throw new \InvalidArgumentException('Invalid message');
757
+ }
758
+
759
+ // Iterate over each line in the message, accounting for line endings
760
+ $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
761
+ $result = ['start-line' => array_shift($lines), 'headers' => [], 'body' => ''];
762
+ array_shift($lines);
763
+
764
+ for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) {
765
+ $line = $lines[$i];
766
+ // If two line breaks were encountered, then this is the end of body
767
+ if (empty($line)) {
768
+ if ($i < $totalLines - 1) {
769
+ $result['body'] = implode('', array_slice($lines, $i + 2));
770
+ }
771
+ break;
772
+ }
773
+ if (strpos($line, ':')) {
774
+ $parts = explode(':', $line, 2);
775
+ $key = trim($parts[0]);
776
+ $value = isset($parts[1]) ? trim($parts[1]) : '';
777
+ $result['headers'][$key][] = $value;
778
+ }
779
+ }
780
+
781
+ return $result;
782
+ }
783
+
784
+ /**
785
+ * Constructs a URI for an HTTP request message.
786
+ *
787
+ * @param string $path Path from the start-line
788
+ * @param array $headers Array of headers (each value an array).
789
+ *
790
+ * @return string
791
+ * @internal
792
+ */
793
+ function _parse_request_uri($path, array $headers)
794
+ {
795
+ $hostKey = array_filter(array_keys($headers), function ($k) {
796
+ return strtolower($k) === 'host';
797
+ });
798
+
799
+ // If no host is found, then a full URI cannot be constructed.
800
+ if (!$hostKey) {
801
+ return $path;
802
+ }
803
+
804
+ $host = $headers[reset($hostKey)][0];
805
+ $scheme = substr($host, -4) === ':443' ? 'https' : 'http';
806
+
807
+ return $scheme . '://' . $host . '/' . ltrim($path, '/');
808
+ }
809
+
810
+ /** @internal */
811
+ function _caseless_remove($keys, array $data)
812
+ {
813
+ $result = [];
814
+
815
+ foreach ($keys as &$key) {
816
+ $key = strtolower($key);
817
+ }
818
+
819
+ foreach ($data as $k => $v) {
820
+ if (!in_array(strtolower($k), $keys)) {
821
+ $result[$k] = $v;
822
+ }
823
+ }
824
+
825
+ return $result;
826
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/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
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/AppendStreamTest.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7\AppendStream;
5
+ use GuzzleHttp\Psr7;
6
+
7
+ class AppendStreamTest extends \PHPUnit_Framework_TestCase
8
+ {
9
+ /**
10
+ * @expectedException \InvalidArgumentException
11
+ * @expectedExceptionMessage Each stream must be readable
12
+ */
13
+ public function testValidatesStreamsAreReadable()
14
+ {
15
+ $a = new AppendStream();
16
+ $s = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
17
+ ->setMethods(['isReadable'])
18
+ ->getMockForAbstractClass();
19
+ $s->expects($this->once())
20
+ ->method('isReadable')
21
+ ->will($this->returnValue(false));
22
+ $a->addStream($s);
23
+ }
24
+
25
+ /**
26
+ * @expectedException \RuntimeException
27
+ * @expectedExceptionMessage The AppendStream can only seek with SEEK_SET
28
+ */
29
+ public function testValidatesSeekType()
30
+ {
31
+ $a = new AppendStream();
32
+ $a->seek(100, SEEK_CUR);
33
+ }
34
+
35
+ /**
36
+ * @expectedException \RuntimeException
37
+ * @expectedExceptionMessage Unable to seek stream 0 of the AppendStream
38
+ */
39
+ public function testTriesToRewindOnSeek()
40
+ {
41
+ $a = new AppendStream();
42
+ $s = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
43
+ ->setMethods(['isReadable', 'rewind', 'isSeekable'])
44
+ ->getMockForAbstractClass();
45
+ $s->expects($this->once())
46
+ ->method('isReadable')
47
+ ->will($this->returnValue(true));
48
+ $s->expects($this->once())
49
+ ->method('isSeekable')
50
+ ->will($this->returnValue(true));
51
+ $s->expects($this->once())
52
+ ->method('rewind')
53
+ ->will($this->throwException(new \RuntimeException()));
54
+ $a->addStream($s);
55
+ $a->seek(10);
56
+ }
57
+
58
+ public function testSeeksToPositionByReading()
59
+ {
60
+ $a = new AppendStream([
61
+ Psr7\stream_for('foo'),
62
+ Psr7\stream_for('bar'),
63
+ Psr7\stream_for('baz'),
64
+ ]);
65
+
66
+ $a->seek(3);
67
+ $this->assertEquals(3, $a->tell());
68
+ $this->assertEquals('bar', $a->read(3));
69
+
70
+ $a->seek(6);
71
+ $this->assertEquals(6, $a->tell());
72
+ $this->assertEquals('baz', $a->read(3));
73
+ }
74
+
75
+ public function testDetachesEachStream()
76
+ {
77
+ $s1 = Psr7\stream_for('foo');
78
+ $s2 = Psr7\stream_for('bar');
79
+ $a = new AppendStream([$s1, $s2]);
80
+ $this->assertSame('foobar', (string) $a);
81
+ $a->detach();
82
+ $this->assertSame('', (string) $a);
83
+ $this->assertSame(0, $a->getSize());
84
+ }
85
+
86
+ public function testClosesEachStream()
87
+ {
88
+ $s1 = Psr7\stream_for('foo');
89
+ $a = new AppendStream([$s1]);
90
+ $a->close();
91
+ $this->assertSame('', (string) $a);
92
+ }
93
+
94
+ /**
95
+ * @expectedExceptionMessage Cannot write to an AppendStream
96
+ * @expectedException \RuntimeException
97
+ */
98
+ public function testIsNotWritable()
99
+ {
100
+ $a = new AppendStream([Psr7\stream_for('foo')]);
101
+ $this->assertFalse($a->isWritable());
102
+ $this->assertTrue($a->isSeekable());
103
+ $this->assertTrue($a->isReadable());
104
+ $a->write('foo');
105
+ }
106
+
107
+ public function testDoesNotNeedStreams()
108
+ {
109
+ $a = new AppendStream();
110
+ $this->assertEquals('', (string) $a);
111
+ }
112
+
113
+ public function testCanReadFromMultipleStreams()
114
+ {
115
+ $a = new AppendStream([
116
+ Psr7\stream_for('foo'),
117
+ Psr7\stream_for('bar'),
118
+ Psr7\stream_for('baz'),
119
+ ]);
120
+ $this->assertFalse($a->eof());
121
+ $this->assertSame(0, $a->tell());
122
+ $this->assertEquals('foo', $a->read(3));
123
+ $this->assertEquals('bar', $a->read(3));
124
+ $this->assertEquals('baz', $a->read(3));
125
+ $this->assertSame('', $a->read(1));
126
+ $this->assertTrue($a->eof());
127
+ $this->assertSame(9, $a->tell());
128
+ $this->assertEquals('foobarbaz', (string) $a);
129
+ }
130
+
131
+ public function testCanDetermineSizeFromMultipleStreams()
132
+ {
133
+ $a = new AppendStream([
134
+ Psr7\stream_for('foo'),
135
+ Psr7\stream_for('bar')
136
+ ]);
137
+ $this->assertEquals(6, $a->getSize());
138
+
139
+ $s = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
140
+ ->setMethods(['isSeekable', 'isReadable'])
141
+ ->getMockForAbstractClass();
142
+ $s->expects($this->once())
143
+ ->method('isSeekable')
144
+ ->will($this->returnValue(null));
145
+ $s->expects($this->once())
146
+ ->method('isReadable')
147
+ ->will($this->returnValue(true));
148
+ $a->addStream($s);
149
+ $this->assertNull($a->getSize());
150
+ }
151
+
152
+ public function testCatchesExceptionsWhenCastingToString()
153
+ {
154
+ $s = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
155
+ ->setMethods(['isSeekable', 'read', 'isReadable', 'eof'])
156
+ ->getMockForAbstractClass();
157
+ $s->expects($this->once())
158
+ ->method('isSeekable')
159
+ ->will($this->returnValue(true));
160
+ $s->expects($this->once())
161
+ ->method('read')
162
+ ->will($this->throwException(new \RuntimeException('foo')));
163
+ $s->expects($this->once())
164
+ ->method('isReadable')
165
+ ->will($this->returnValue(true));
166
+ $s->expects($this->any())
167
+ ->method('eof')
168
+ ->will($this->returnValue(false));
169
+ $a = new AppendStream([$s]);
170
+ $this->assertFalse($a->eof());
171
+ $this->assertSame('', (string) $a);
172
+ }
173
+
174
+ public function testCanDetach()
175
+ {
176
+ $s = new AppendStream();
177
+ $s->detach();
178
+ }
179
+
180
+ public function testReturnsEmptyMetadata()
181
+ {
182
+ $s = new AppendStream();
183
+ $this->assertEquals([], $s->getMetadata());
184
+ $this->assertNull($s->getMetadata('foo'));
185
+ }
186
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/BufferStreamTest.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7\BufferStream;
5
+
6
+ class BufferStreamTest extends \PHPUnit_Framework_TestCase
7
+ {
8
+ public function testHasMetadata()
9
+ {
10
+ $b = new BufferStream(10);
11
+ $this->assertTrue($b->isReadable());
12
+ $this->assertTrue($b->isWritable());
13
+ $this->assertFalse($b->isSeekable());
14
+ $this->assertEquals(null, $b->getMetadata('foo'));
15
+ $this->assertEquals(10, $b->getMetadata('hwm'));
16
+ $this->assertEquals([], $b->getMetadata());
17
+ }
18
+
19
+ public function testRemovesReadDataFromBuffer()
20
+ {
21
+ $b = new BufferStream();
22
+ $this->assertEquals(3, $b->write('foo'));
23
+ $this->assertEquals(3, $b->getSize());
24
+ $this->assertFalse($b->eof());
25
+ $this->assertEquals('foo', $b->read(10));
26
+ $this->assertTrue($b->eof());
27
+ $this->assertEquals('', $b->read(10));
28
+ }
29
+
30
+ /**
31
+ * @expectedException \RuntimeException
32
+ * @expectedExceptionMessage Cannot determine the position of a BufferStream
33
+ */
34
+ public function testCanCastToStringOrGetContents()
35
+ {
36
+ $b = new BufferStream();
37
+ $b->write('foo');
38
+ $b->write('baz');
39
+ $this->assertEquals('foo', $b->read(3));
40
+ $b->write('bar');
41
+ $this->assertEquals('bazbar', (string) $b);
42
+ $b->tell();
43
+ }
44
+
45
+ public function testDetachClearsBuffer()
46
+ {
47
+ $b = new BufferStream();
48
+ $b->write('foo');
49
+ $b->detach();
50
+ $this->assertTrue($b->eof());
51
+ $this->assertEquals(3, $b->write('abc'));
52
+ $this->assertEquals('abc', $b->read(10));
53
+ }
54
+
55
+ public function testExceedingHighwaterMarkReturnsFalseButStillBuffers()
56
+ {
57
+ $b = new BufferStream(5);
58
+ $this->assertEquals(3, $b->write('hi '));
59
+ $this->assertFalse($b->write('hello'));
60
+ $this->assertEquals('hi hello', (string) $b);
61
+ $this->assertEquals(4, $b->write('test'));
62
+ }
63
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use GuzzleHttp\Psr7\CachingStream;
6
+
7
+ /**
8
+ * @covers GuzzleHttp\Psr7\CachingStream
9
+ */
10
+ class CachingStreamTest extends \PHPUnit_Framework_TestCase
11
+ {
12
+ /** @var CachingStream */
13
+ protected $body;
14
+ protected $decorated;
15
+
16
+ public function setUp()
17
+ {
18
+ $this->decorated = Psr7\stream_for('testing');
19
+ $this->body = new CachingStream($this->decorated);
20
+ }
21
+
22
+ public function tearDown()
23
+ {
24
+ $this->decorated->close();
25
+ $this->body->close();
26
+ }
27
+
28
+ public function testUsesRemoteSizeIfPossible()
29
+ {
30
+ $body = Psr7\stream_for('test');
31
+ $caching = new CachingStream($body);
32
+ $this->assertEquals(4, $caching->getSize());
33
+ }
34
+
35
+ public function testReadsUntilCachedToByte()
36
+ {
37
+ $this->body->seek(5);
38
+ $this->assertEquals('n', $this->body->read(1));
39
+ $this->body->seek(0);
40
+ $this->assertEquals('t', $this->body->read(1));
41
+ }
42
+
43
+ public function testCanSeekNearEndWithSeekEnd()
44
+ {
45
+ $baseStream = Psr7\stream_for(implode('', range('a', 'z')));
46
+ $cached = new CachingStream($baseStream);
47
+ $cached->seek(-1, SEEK_END);
48
+ $this->assertEquals(25, $baseStream->tell());
49
+ $this->assertEquals('z', $cached->read(1));
50
+ $this->assertEquals(26, $cached->getSize());
51
+ }
52
+
53
+ public function testCanSeekToEndWithSeekEnd()
54
+ {
55
+ $baseStream = Psr7\stream_for(implode('', range('a', 'z')));
56
+ $cached = new CachingStream($baseStream);
57
+ $cached->seek(0, SEEK_END);
58
+ $this->assertEquals(26, $baseStream->tell());
59
+ $this->assertEquals('', $cached->read(1));
60
+ $this->assertEquals(26, $cached->getSize());
61
+ }
62
+
63
+ public function testCanUseSeekEndWithUnknownSize()
64
+ {
65
+ $baseStream = Psr7\stream_for('testing');
66
+ $decorated = Psr7\FnStream::decorate($baseStream, [
67
+ 'getSize' => function () { return null; }
68
+ ]);
69
+ $cached = new CachingStream($decorated);
70
+ $cached->seek(-1, SEEK_END);
71
+ $this->assertEquals('g', $cached->read(1));
72
+ }
73
+
74
+ public function testRewindUsesSeek()
75
+ {
76
+ $a = Psr7\stream_for('foo');
77
+ $d = $this->getMockBuilder('GuzzleHttp\Psr7\CachingStream')
78
+ ->setMethods(array('seek'))
79
+ ->setConstructorArgs(array($a))
80
+ ->getMock();
81
+ $d->expects($this->once())
82
+ ->method('seek')
83
+ ->with(0)
84
+ ->will($this->returnValue(true));
85
+ $d->seek(0);
86
+ }
87
+
88
+ public function testCanSeekToReadBytes()
89
+ {
90
+ $this->assertEquals('te', $this->body->read(2));
91
+ $this->body->seek(0);
92
+ $this->assertEquals('test', $this->body->read(4));
93
+ $this->assertEquals(4, $this->body->tell());
94
+ $this->body->seek(2);
95
+ $this->assertEquals(2, $this->body->tell());
96
+ $this->body->seek(2, SEEK_CUR);
97
+ $this->assertEquals(4, $this->body->tell());
98
+ $this->assertEquals('ing', $this->body->read(3));
99
+ }
100
+
101
+ public function testCanSeekToReadBytesWithPartialBodyReturned()
102
+ {
103
+ $stream = fopen('php://temp', 'r+');
104
+ fwrite($stream, 'testing');
105
+ fseek($stream, 0);
106
+
107
+ $this->decorated = $this->getMockBuilder('\GuzzleHttp\Psr7\Stream')
108
+ ->setConstructorArgs([$stream])
109
+ ->setMethods(['read'])
110
+ ->getMock();
111
+
112
+ $this->decorated->expects($this->exactly(2))
113
+ ->method('read')
114
+ ->willReturnCallback(function($length) use ($stream){
115
+ return fread($stream, 2);
116
+ });
117
+
118
+ $this->body = new CachingStream($this->decorated);
119
+
120
+ $this->assertEquals(0, $this->body->tell());
121
+ $this->body->seek(4, SEEK_SET);
122
+ $this->assertEquals(4, $this->body->tell());
123
+
124
+ $this->body->seek(0);
125
+ $this->assertEquals('test', $this->body->read(4));
126
+ }
127
+
128
+ public function testWritesToBufferStream()
129
+ {
130
+ $this->body->read(2);
131
+ $this->body->write('hi');
132
+ $this->body->seek(0);
133
+ $this->assertEquals('tehiing', (string) $this->body);
134
+ }
135
+
136
+ public function testSkipsOverwrittenBytes()
137
+ {
138
+ $decorated = Psr7\stream_for(
139
+ implode("\n", array_map(function ($n) {
140
+ return str_pad($n, 4, '0', STR_PAD_LEFT);
141
+ }, range(0, 25)))
142
+ );
143
+
144
+ $body = new CachingStream($decorated);
145
+
146
+ $this->assertEquals("0000\n", Psr7\readline($body));
147
+ $this->assertEquals("0001\n", Psr7\readline($body));
148
+ // Write over part of the body yet to be read, so skip some bytes
149
+ $this->assertEquals(5, $body->write("TEST\n"));
150
+ $this->assertEquals(5, $this->readAttribute($body, 'skipReadBytes'));
151
+ // Read, which skips bytes, then reads
152
+ $this->assertEquals("0003\n", Psr7\readline($body));
153
+ $this->assertEquals(0, $this->readAttribute($body, 'skipReadBytes'));
154
+ $this->assertEquals("0004\n", Psr7\readline($body));
155
+ $this->assertEquals("0005\n", Psr7\readline($body));
156
+
157
+ // Overwrite part of the cached body (so don't skip any bytes)
158
+ $body->seek(5);
159
+ $this->assertEquals(5, $body->write("ABCD\n"));
160
+ $this->assertEquals(0, $this->readAttribute($body, 'skipReadBytes'));
161
+ $this->assertEquals("TEST\n", Psr7\readline($body));
162
+ $this->assertEquals("0003\n", Psr7\readline($body));
163
+ $this->assertEquals("0004\n", Psr7\readline($body));
164
+ $this->assertEquals("0005\n", Psr7\readline($body));
165
+ $this->assertEquals("0006\n", Psr7\readline($body));
166
+ $this->assertEquals(5, $body->write("1234\n"));
167
+ $this->assertEquals(5, $this->readAttribute($body, 'skipReadBytes'));
168
+
169
+ // Seek to 0 and ensure the overwritten bit is replaced
170
+ $body->seek(0);
171
+ $this->assertEquals("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", $body->read(50));
172
+
173
+ // Ensure that casting it to a string does not include the bit that was overwritten
174
+ $this->assertContains("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", (string) $body);
175
+ }
176
+
177
+ public function testClosesBothStreams()
178
+ {
179
+ $s = fopen('php://temp', 'r');
180
+ $a = Psr7\stream_for($s);
181
+ $d = new CachingStream($a);
182
+ $d->close();
183
+ $this->assertFalse(is_resource($s));
184
+ }
185
+
186
+ /**
187
+ * @expectedException \InvalidArgumentException
188
+ */
189
+ public function testEnsuresValidWhence()
190
+ {
191
+ $this->body->seek(10, -123456);
192
+ }
193
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/DroppingStreamTest.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7\BufferStream;
5
+ use GuzzleHttp\Psr7\DroppingStream;
6
+
7
+ class DroppingStreamTest extends \PHPUnit_Framework_TestCase
8
+ {
9
+ public function testBeginsDroppingWhenSizeExceeded()
10
+ {
11
+ $stream = new BufferStream();
12
+ $drop = new DroppingStream($stream, 5);
13
+ $this->assertEquals(3, $drop->write('hel'));
14
+ $this->assertEquals(2, $drop->write('lo'));
15
+ $this->assertEquals(5, $drop->getSize());
16
+ $this->assertEquals('hello', $drop->read(5));
17
+ $this->assertEquals(0, $drop->getSize());
18
+ $drop->write('12345678910');
19
+ $this->assertEquals(5, $stream->getSize());
20
+ $this->assertEquals(5, $drop->getSize());
21
+ $this->assertEquals('12345', (string) $drop);
22
+ $this->assertEquals(0, $drop->getSize());
23
+ $drop->write('hello');
24
+ $this->assertSame(0, $drop->write('test'));
25
+ }
26
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/FnStreamTest.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use GuzzleHttp\Psr7\FnStream;
6
+
7
+ /**
8
+ * @covers GuzzleHttp\Psr7\FnStream
9
+ */
10
+ class FnStreamTest extends \PHPUnit_Framework_TestCase
11
+ {
12
+ /**
13
+ * @expectedException \BadMethodCallException
14
+ * @expectedExceptionMessage seek() is not implemented in the FnStream
15
+ */
16
+ public function testThrowsWhenNotImplemented()
17
+ {
18
+ (new FnStream([]))->seek(1);
19
+ }
20
+
21
+ public function testProxiesToFunction()
22
+ {
23
+ $s = new FnStream([
24
+ 'read' => function ($len) {
25
+ $this->assertEquals(3, $len);
26
+ return 'foo';
27
+ }
28
+ ]);
29
+
30
+ $this->assertEquals('foo', $s->read(3));
31
+ }
32
+
33
+ public function testCanCloseOnDestruct()
34
+ {
35
+ $called = false;
36
+ $s = new FnStream([
37
+ 'close' => function () use (&$called) {
38
+ $called = true;
39
+ }
40
+ ]);
41
+ unset($s);
42
+ $this->assertTrue($called);
43
+ }
44
+
45
+ public function testDoesNotRequireClose()
46
+ {
47
+ $s = new FnStream([]);
48
+ unset($s);
49
+ }
50
+
51
+ public function testDecoratesStream()
52
+ {
53
+ $a = Psr7\stream_for('foo');
54
+ $b = FnStream::decorate($a, []);
55
+ $this->assertEquals(3, $b->getSize());
56
+ $this->assertEquals($b->isWritable(), true);
57
+ $this->assertEquals($b->isReadable(), true);
58
+ $this->assertEquals($b->isSeekable(), true);
59
+ $this->assertEquals($b->read(3), 'foo');
60
+ $this->assertEquals($b->tell(), 3);
61
+ $this->assertEquals($a->tell(), 3);
62
+ $this->assertSame('', $a->read(1));
63
+ $this->assertEquals($b->eof(), true);
64
+ $this->assertEquals($a->eof(), true);
65
+ $b->seek(0);
66
+ $this->assertEquals('foo', (string) $b);
67
+ $b->seek(0);
68
+ $this->assertEquals('foo', $b->getContents());
69
+ $this->assertEquals($a->getMetadata(), $b->getMetadata());
70
+ $b->seek(0, SEEK_END);
71
+ $b->write('bar');
72
+ $this->assertEquals('foobar', (string) $b);
73
+ $this->assertInternalType('resource', $b->detach());
74
+ $b->close();
75
+ }
76
+
77
+ public function testDecoratesWithCustomizations()
78
+ {
79
+ $called = false;
80
+ $a = Psr7\stream_for('foo');
81
+ $b = FnStream::decorate($a, [
82
+ 'read' => function ($len) use (&$called, $a) {
83
+ $called = true;
84
+ return $a->read($len);
85
+ }
86
+ ]);
87
+ $this->assertEquals('foo', $b->read(3));
88
+ $this->assertTrue($called);
89
+ }
90
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/FunctionsTest.php ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use GuzzleHttp\Psr7\FnStream;
6
+ use GuzzleHttp\Psr7\NoSeekStream;
7
+
8
+ class FunctionsTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ public function testCopiesToString()
11
+ {
12
+ $s = Psr7\stream_for('foobaz');
13
+ $this->assertEquals('foobaz', Psr7\copy_to_string($s));
14
+ $s->seek(0);
15
+ $this->assertEquals('foo', Psr7\copy_to_string($s, 3));
16
+ $this->assertEquals('baz', Psr7\copy_to_string($s, 3));
17
+ $this->assertEquals('', Psr7\copy_to_string($s));
18
+ }
19
+
20
+ public function testCopiesToStringStopsWhenReadFails()
21
+ {
22
+ $s1 = Psr7\stream_for('foobaz');
23
+ $s1 = FnStream::decorate($s1, [
24
+ 'read' => function () { return ''; }
25
+ ]);
26
+ $result = Psr7\copy_to_string($s1);
27
+ $this->assertEquals('', $result);
28
+ }
29
+
30
+ public function testCopiesToStream()
31
+ {
32
+ $s1 = Psr7\stream_for('foobaz');
33
+ $s2 = Psr7\stream_for('');
34
+ Psr7\copy_to_stream($s1, $s2);
35
+ $this->assertEquals('foobaz', (string) $s2);
36
+ $s2 = Psr7\stream_for('');
37
+ $s1->seek(0);
38
+ Psr7\copy_to_stream($s1, $s2, 3);
39
+ $this->assertEquals('foo', (string) $s2);
40
+ Psr7\copy_to_stream($s1, $s2, 3);
41
+ $this->assertEquals('foobaz', (string) $s2);
42
+ }
43
+
44
+ public function testStopsCopyToStreamWhenWriteFails()
45
+ {
46
+ $s1 = Psr7\stream_for('foobaz');
47
+ $s2 = Psr7\stream_for('');
48
+ $s2 = FnStream::decorate($s2, ['write' => function () { return 0; }]);
49
+ Psr7\copy_to_stream($s1, $s2);
50
+ $this->assertEquals('', (string) $s2);
51
+ }
52
+
53
+ public function testStopsCopyToSteamWhenWriteFailsWithMaxLen()
54
+ {
55
+ $s1 = Psr7\stream_for('foobaz');
56
+ $s2 = Psr7\stream_for('');
57
+ $s2 = FnStream::decorate($s2, ['write' => function () { return 0; }]);
58
+ Psr7\copy_to_stream($s1, $s2, 10);
59
+ $this->assertEquals('', (string) $s2);
60
+ }
61
+
62
+ public function testStopsCopyToSteamWhenReadFailsWithMaxLen()
63
+ {
64
+ $s1 = Psr7\stream_for('foobaz');
65
+ $s1 = FnStream::decorate($s1, ['read' => function () { return ''; }]);
66
+ $s2 = Psr7\stream_for('');
67
+ Psr7\copy_to_stream($s1, $s2, 10);
68
+ $this->assertEquals('', (string) $s2);
69
+ }
70
+
71
+ public function testReadsLines()
72
+ {
73
+ $s = Psr7\stream_for("foo\nbaz\nbar");
74
+ $this->assertEquals("foo\n", Psr7\readline($s));
75
+ $this->assertEquals("baz\n", Psr7\readline($s));
76
+ $this->assertEquals("bar", Psr7\readline($s));
77
+ }
78
+
79
+ public function testReadsLinesUpToMaxLength()
80
+ {
81
+ $s = Psr7\stream_for("12345\n");
82
+ $this->assertEquals("123", Psr7\readline($s, 4));
83
+ $this->assertEquals("45\n", Psr7\readline($s));
84
+ }
85
+
86
+ public function testReadsLineUntilFalseReturnedFromRead()
87
+ {
88
+ $s = $this->getMockBuilder('GuzzleHttp\Psr7\Stream')
89
+ ->setMethods(['read', 'eof'])
90
+ ->disableOriginalConstructor()
91
+ ->getMock();
92
+ $s->expects($this->exactly(2))
93
+ ->method('read')
94
+ ->will($this->returnCallback(function () {
95
+ static $c = false;
96
+ if ($c) {
97
+ return false;
98
+ }
99
+ $c = true;
100
+ return 'h';
101
+ }));
102
+ $s->expects($this->exactly(2))
103
+ ->method('eof')
104
+ ->will($this->returnValue(false));
105
+ $this->assertEquals("h", Psr7\readline($s));
106
+ }
107
+
108
+ public function testCalculatesHash()
109
+ {
110
+ $s = Psr7\stream_for('foobazbar');
111
+ $this->assertEquals(md5('foobazbar'), Psr7\hash($s, 'md5'));
112
+ }
113
+
114
+ /**
115
+ * @expectedException \RuntimeException
116
+ */
117
+ public function testCalculatesHashThrowsWhenSeekFails()
118
+ {
119
+ $s = new NoSeekStream(Psr7\stream_for('foobazbar'));
120
+ $s->read(2);
121
+ Psr7\hash($s, 'md5');
122
+ }
123
+
124
+ public function testCalculatesHashSeeksToOriginalPosition()
125
+ {
126
+ $s = Psr7\stream_for('foobazbar');
127
+ $s->seek(4);
128
+ $this->assertEquals(md5('foobazbar'), Psr7\hash($s, 'md5'));
129
+ $this->assertEquals(4, $s->tell());
130
+ }
131
+
132
+ public function testOpensFilesSuccessfully()
133
+ {
134
+ $r = Psr7\try_fopen(__FILE__, 'r');
135
+ $this->assertInternalType('resource', $r);
136
+ fclose($r);
137
+ }
138
+
139
+ /**
140
+ * @expectedException \RuntimeException
141
+ * @expectedExceptionMessage Unable to open /path/to/does/not/exist using mode r
142
+ */
143
+ public function testThrowsExceptionNotWarning()
144
+ {
145
+ Psr7\try_fopen('/path/to/does/not/exist', 'r');
146
+ }
147
+
148
+ public function parseQueryProvider()
149
+ {
150
+ return [
151
+ // Does not need to parse when the string is empty
152
+ ['', []],
153
+ // Can parse mult-values items
154
+ ['q=a&q=b', ['q' => ['a', 'b']]],
155
+ // Can parse multi-valued items that use numeric indices
156
+ ['q[0]=a&q[1]=b', ['q[0]' => 'a', 'q[1]' => 'b']],
157
+ // Can parse duplicates and does not include numeric indices
158
+ ['q[]=a&q[]=b', ['q[]' => ['a', 'b']]],
159
+ // Ensures that the value of "q" is an array even though one value
160
+ ['q[]=a', ['q[]' => 'a']],
161
+ // Does not modify "." to "_" like PHP's parse_str()
162
+ ['q.a=a&q.b=b', ['q.a' => 'a', 'q.b' => 'b']],
163
+ // Can decode %20 to " "
164
+ ['q%20a=a%20b', ['q a' => 'a b']],
165
+ // Can parse funky strings with no values by assigning each to null
166
+ ['q&a', ['q' => null, 'a' => null]],
167
+ // Does not strip trailing equal signs
168
+ ['data=abc=', ['data' => 'abc=']],
169
+ // Can store duplicates without affecting other values
170
+ ['foo=a&foo=b&?µ=c', ['foo' => ['a', 'b'], '?µ' => 'c']],
171
+ // Sets value to null when no "=" is present
172
+ ['foo', ['foo' => null]],
173
+ // Preserves "0" keys.
174
+ ['0', ['0' => null]],
175
+ // Sets the value to an empty string when "=" is present
176
+ ['0=', ['0' => '']],
177
+ // Preserves falsey keys
178
+ ['var=0', ['var' => '0']],
179
+ ['a[b][c]=1&a[b][c]=2', ['a[b][c]' => ['1', '2']]],
180
+ ['a[b]=c&a[d]=e', ['a[b]' => 'c', 'a[d]' => 'e']],
181
+ // Ensure it doesn't leave things behind with repeated values
182
+ // Can parse mult-values items
183
+ ['q=a&q=b&q=c', ['q' => ['a', 'b', 'c']]],
184
+ ];
185
+ }
186
+
187
+ /**
188
+ * @dataProvider parseQueryProvider
189
+ */
190
+ public function testParsesQueries($input, $output)
191
+ {
192
+ $result = Psr7\parse_query($input);
193
+ $this->assertSame($output, $result);
194
+ }
195
+
196
+ public function testDoesNotDecode()
197
+ {
198
+ $str = 'foo%20=bar';
199
+ $data = Psr7\parse_query($str, false);
200
+ $this->assertEquals(['foo%20' => 'bar'], $data);
201
+ }
202
+
203
+ /**
204
+ * @dataProvider parseQueryProvider
205
+ */
206
+ public function testParsesAndBuildsQueries($input, $output)
207
+ {
208
+ $result = Psr7\parse_query($input, false);
209
+ $this->assertSame($input, Psr7\build_query($result, false));
210
+ }
211
+
212
+ public function testEncodesWithRfc1738()
213
+ {
214
+ $str = Psr7\build_query(['foo bar' => 'baz+'], PHP_QUERY_RFC1738);
215
+ $this->assertEquals('foo+bar=baz%2B', $str);
216
+ }
217
+
218
+ public function testEncodesWithRfc3986()
219
+ {
220
+ $str = Psr7\build_query(['foo bar' => 'baz+'], PHP_QUERY_RFC3986);
221
+ $this->assertEquals('foo%20bar=baz%2B', $str);
222
+ }
223
+
224
+ public function testDoesNotEncode()
225
+ {
226
+ $str = Psr7\build_query(['foo bar' => 'baz+'], false);
227
+ $this->assertEquals('foo bar=baz+', $str);
228
+ }
229
+
230
+ public function testCanControlDecodingType()
231
+ {
232
+ $result = Psr7\parse_query('var=foo+bar', PHP_QUERY_RFC3986);
233
+ $this->assertEquals('foo+bar', $result['var']);
234
+ $result = Psr7\parse_query('var=foo+bar', PHP_QUERY_RFC1738);
235
+ $this->assertEquals('foo bar', $result['var']);
236
+ }
237
+
238
+ public function testParsesRequestMessages()
239
+ {
240
+ $req = "GET /abc HTTP/1.0\r\nHost: foo.com\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest";
241
+ $request = Psr7\parse_request($req);
242
+ $this->assertEquals('GET', $request->getMethod());
243
+ $this->assertEquals('/abc', $request->getRequestTarget());
244
+ $this->assertEquals('1.0', $request->getProtocolVersion());
245
+ $this->assertEquals('foo.com', $request->getHeaderLine('Host'));
246
+ $this->assertEquals('Bar', $request->getHeaderLine('Foo'));
247
+ $this->assertEquals('Bam, Qux', $request->getHeaderLine('Baz'));
248
+ $this->assertEquals('Test', (string) $request->getBody());
249
+ $this->assertEquals('http://foo.com/abc', (string) $request->getUri());
250
+ }
251
+
252
+ public function testParsesRequestMessagesWithHttpsScheme()
253
+ {
254
+ $req = "PUT /abc?baz=bar HTTP/1.1\r\nHost: foo.com:443\r\n\r\n";
255
+ $request = Psr7\parse_request($req);
256
+ $this->assertEquals('PUT', $request->getMethod());
257
+ $this->assertEquals('/abc?baz=bar', $request->getRequestTarget());
258
+ $this->assertEquals('1.1', $request->getProtocolVersion());
259
+ $this->assertEquals('foo.com:443', $request->getHeaderLine('Host'));
260
+ $this->assertEquals('', (string) $request->getBody());
261
+ $this->assertEquals('https://foo.com/abc?baz=bar', (string) $request->getUri());
262
+ }
263
+
264
+ public function testParsesRequestMessagesWithUriWhenHostIsNotFirst()
265
+ {
266
+ $req = "PUT / HTTP/1.1\r\nFoo: Bar\r\nHost: foo.com\r\n\r\n";
267
+ $request = Psr7\parse_request($req);
268
+ $this->assertEquals('PUT', $request->getMethod());
269
+ $this->assertEquals('/', $request->getRequestTarget());
270
+ $this->assertEquals('http://foo.com/', (string) $request->getUri());
271
+ }
272
+
273
+ public function testParsesRequestMessagesWithFullUri()
274
+ {
275
+ $req = "GET https://www.google.com:443/search?q=foobar HTTP/1.1\r\nHost: www.google.com\r\n\r\n";
276
+ $request = Psr7\parse_request($req);
277
+ $this->assertEquals('GET', $request->getMethod());
278
+ $this->assertEquals('https://www.google.com:443/search?q=foobar', $request->getRequestTarget());
279
+ $this->assertEquals('1.1', $request->getProtocolVersion());
280
+ $this->assertEquals('www.google.com', $request->getHeaderLine('Host'));
281
+ $this->assertEquals('', (string) $request->getBody());
282
+ $this->assertEquals('https://www.google.com/search?q=foobar', (string) $request->getUri());
283
+ }
284
+
285
+ public function testParsesRequestMessagesWithCustomMethod()
286
+ {
287
+ $req = "GET_DATA / HTTP/1.1\r\nFoo: Bar\r\nHost: foo.com\r\n\r\n";
288
+ $request = Psr7\parse_request($req);
289
+ $this->assertEquals('GET_DATA', $request->getMethod());
290
+ }
291
+
292
+ /**
293
+ * @expectedException \InvalidArgumentException
294
+ */
295
+ public function testValidatesRequestMessages()
296
+ {
297
+ Psr7\parse_request("HTTP/1.1 200 OK\r\n\r\n");
298
+ }
299
+
300
+ public function testParsesResponseMessages()
301
+ {
302
+ $res = "HTTP/1.0 200 OK\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest";
303
+ $response = Psr7\parse_response($res);
304
+ $this->assertEquals(200, $response->getStatusCode());
305
+ $this->assertEquals('OK', $response->getReasonPhrase());
306
+ $this->assertEquals('1.0', $response->getProtocolVersion());
307
+ $this->assertEquals('Bar', $response->getHeaderLine('Foo'));
308
+ $this->assertEquals('Bam, Qux', $response->getHeaderLine('Baz'));
309
+ $this->assertEquals('Test', (string) $response->getBody());
310
+ }
311
+
312
+ /**
313
+ * @expectedException \InvalidArgumentException
314
+ */
315
+ public function testValidatesResponseMessages()
316
+ {
317
+ Psr7\parse_response("GET / HTTP/1.1\r\n\r\n");
318
+ }
319
+
320
+ public function testDetermineMimetype()
321
+ {
322
+ $this->assertNull(Psr7\mimetype_from_extension('not-a-real-extension'));
323
+ $this->assertEquals(
324
+ 'application/json',
325
+ Psr7\mimetype_from_extension('json')
326
+ );
327
+ $this->assertEquals(
328
+ 'image/jpeg',
329
+ Psr7\mimetype_from_filename('/tmp/images/IMG034821.JPEG')
330
+ );
331
+ }
332
+
333
+ public function testCreatesUriForValue()
334
+ {
335
+ $this->assertInstanceOf('GuzzleHttp\Psr7\Uri', Psr7\uri_for('/foo'));
336
+ $this->assertInstanceOf(
337
+ 'GuzzleHttp\Psr7\Uri',
338
+ Psr7\uri_for(new Psr7\Uri('/foo'))
339
+ );
340
+ }
341
+
342
+ /**
343
+ * @expectedException \InvalidArgumentException
344
+ */
345
+ public function testValidatesUri()
346
+ {
347
+ Psr7\uri_for([]);
348
+ }
349
+
350
+ public function testKeepsPositionOfResource()
351
+ {
352
+ $h = fopen(__FILE__, 'r');
353
+ fseek($h, 10);
354
+ $stream = Psr7\stream_for($h);
355
+ $this->assertEquals(10, $stream->tell());
356
+ $stream->close();
357
+ }
358
+
359
+ public function testCreatesWithFactory()
360
+ {
361
+ $stream = Psr7\stream_for('foo');
362
+ $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $stream);
363
+ $this->assertEquals('foo', $stream->getContents());
364
+ $stream->close();
365
+ }
366
+
367
+ public function testFactoryCreatesFromEmptyString()
368
+ {
369
+ $s = Psr7\stream_for();
370
+ $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $s);
371
+ }
372
+
373
+ public function testFactoryCreatesFromNull()
374
+ {
375
+ $s = Psr7\stream_for(null);
376
+ $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $s);
377
+ }
378
+
379
+ public function testFactoryCreatesFromResource()
380
+ {
381
+ $r = fopen(__FILE__, 'r');
382
+ $s = Psr7\stream_for($r);
383
+ $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $s);
384
+ $this->assertSame(file_get_contents(__FILE__), (string) $s);
385
+ }
386
+
387
+ public function testFactoryCreatesFromObjectWithToString()
388
+ {
389
+ $r = new HasToString();
390
+ $s = Psr7\stream_for($r);
391
+ $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $s);
392
+ $this->assertEquals('foo', (string) $s);
393
+ }
394
+
395
+ public function testCreatePassesThrough()
396
+ {
397
+ $s = Psr7\stream_for('foo');
398
+ $this->assertSame($s, Psr7\stream_for($s));
399
+ }
400
+
401
+ /**
402
+ * @expectedException \InvalidArgumentException
403
+ */
404
+ public function testThrowsExceptionForUnknown()
405
+ {
406
+ Psr7\stream_for(new \stdClass());
407
+ }
408
+
409
+ public function testReturnsCustomMetadata()
410
+ {
411
+ $s = Psr7\stream_for('foo', ['metadata' => ['hwm' => 3]]);
412
+ $this->assertEquals(3, $s->getMetadata('hwm'));
413
+ $this->assertArrayHasKey('hwm', $s->getMetadata());
414
+ }
415
+
416
+ public function testCanSetSize()
417
+ {
418
+ $s = Psr7\stream_for('', ['size' => 10]);
419
+ $this->assertEquals(10, $s->getSize());
420
+ }
421
+
422
+ public function testCanCreateIteratorBasedStream()
423
+ {
424
+ $a = new \ArrayIterator(['foo', 'bar', '123']);
425
+ $p = Psr7\stream_for($a);
426
+ $this->assertInstanceOf('GuzzleHttp\Psr7\PumpStream', $p);
427
+ $this->assertEquals('foo', $p->read(3));
428
+ $this->assertFalse($p->eof());
429
+ $this->assertEquals('b', $p->read(1));
430
+ $this->assertEquals('a', $p->read(1));
431
+ $this->assertEquals('r12', $p->read(3));
432
+ $this->assertFalse($p->eof());
433
+ $this->assertEquals('3', $p->getContents());
434
+ $this->assertTrue($p->eof());
435
+ $this->assertEquals(9, $p->tell());
436
+ }
437
+
438
+ public function testConvertsRequestsToStrings()
439
+ {
440
+ $request = new Psr7\Request('PUT', 'http://foo.com/hi?123', [
441
+ 'Baz' => 'bar',
442
+ 'Qux' => 'ipsum'
443
+ ], 'hello', '1.0');
444
+ $this->assertEquals(
445
+ "PUT /hi?123 HTTP/1.0\r\nHost: foo.com\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello",
446
+ Psr7\str($request)
447
+ );
448
+ }
449
+
450
+ public function testConvertsResponsesToStrings()
451
+ {
452
+ $response = new Psr7\Response(200, [
453
+ 'Baz' => 'bar',
454
+ 'Qux' => 'ipsum'
455
+ ], 'hello', '1.0', 'FOO');
456
+ $this->assertEquals(
457
+ "HTTP/1.0 200 FOO\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello",
458
+ Psr7\str($response)
459
+ );
460
+ }
461
+
462
+ public function parseParamsProvider()
463
+ {
464
+ $res1 = array(
465
+ array(
466
+ '<http:/.../front.jpeg>',
467
+ 'rel' => 'front',
468
+ 'type' => 'image/jpeg',
469
+ ),
470
+ array(
471
+ '<http://.../back.jpeg>',
472
+ 'rel' => 'back',
473
+ 'type' => 'image/jpeg',
474
+ ),
475
+ );
476
+ return array(
477
+ array(
478
+ '<http:/.../front.jpeg>; rel="front"; type="image/jpeg", <http://.../back.jpeg>; rel=back; type="image/jpeg"',
479
+ $res1
480
+ ),
481
+ array(
482
+ '<http:/.../front.jpeg>; rel="front"; type="image/jpeg",<http://.../back.jpeg>; rel=back; type="image/jpeg"',
483
+ $res1
484
+ ),
485
+ array(
486
+ 'foo="baz"; bar=123, boo, test="123", foobar="foo;bar"',
487
+ array(
488
+ array('foo' => 'baz', 'bar' => '123'),
489
+ array('boo'),
490
+ array('test' => '123'),
491
+ array('foobar' => 'foo;bar')
492
+ )
493
+ ),
494
+ array(
495
+ '<http://.../side.jpeg?test=1>; rel="side"; type="image/jpeg",<http://.../side.jpeg?test=2>; rel=side; type="image/jpeg"',
496
+ array(
497
+ array('<http://.../side.jpeg?test=1>', 'rel' => 'side', 'type' => 'image/jpeg'),
498
+ array('<http://.../side.jpeg?test=2>', 'rel' => 'side', 'type' => 'image/jpeg')
499
+ )
500
+ ),
501
+ array(
502
+ '',
503
+ array()
504
+ )
505
+ );
506
+ }
507
+ /**
508
+ * @dataProvider parseParamsProvider
509
+ */
510
+ public function testParseParams($header, $result)
511
+ {
512
+ $this->assertEquals($result, Psr7\parse_header($header));
513
+ }
514
+
515
+ public function testParsesArrayHeaders()
516
+ {
517
+ $header = ['a, b', 'c', 'd, e'];
518
+ $this->assertEquals(['a', 'b', 'c', 'd', 'e'], Psr7\normalize_header($header));
519
+ }
520
+
521
+ public function testRewindsBody()
522
+ {
523
+ $body = Psr7\stream_for('abc');
524
+ $res = new Psr7\Response(200, [], $body);
525
+ Psr7\rewind_body($res);
526
+ $this->assertEquals(0, $body->tell());
527
+ $body->rewind(1);
528
+ Psr7\rewind_body($res);
529
+ $this->assertEquals(0, $body->tell());
530
+ }
531
+
532
+ /**
533
+ * @expectedException \RuntimeException
534
+ */
535
+ public function testThrowsWhenBodyCannotBeRewound()
536
+ {
537
+ $body = Psr7\stream_for('abc');
538
+ $body->read(1);
539
+ $body = FnStream::decorate($body, [
540
+ 'rewind' => function () { throw new \RuntimeException('a'); }
541
+ ]);
542
+ $res = new Psr7\Response(200, [], $body);
543
+ Psr7\rewind_body($res);
544
+ }
545
+
546
+ public function testCanModifyRequestWithUri()
547
+ {
548
+ $r1 = new Psr7\Request('GET', 'http://foo.com');
549
+ $r2 = Psr7\modify_request($r1, [
550
+ 'uri' => new Psr7\Uri('http://www.foo.com')
551
+ ]);
552
+ $this->assertEquals('http://www.foo.com', (string) $r2->getUri());
553
+ $this->assertEquals('www.foo.com', (string) $r2->getHeaderLine('host'));
554
+ }
555
+
556
+ public function testCanModifyRequestWithUriAndPort()
557
+ {
558
+ $r1 = new Psr7\Request('GET', 'http://foo.com:8000');
559
+ $r2 = Psr7\modify_request($r1, [
560
+ 'uri' => new Psr7\Uri('http://www.foo.com:8000')
561
+ ]);
562
+ $this->assertEquals('http://www.foo.com:8000', (string) $r2->getUri());
563
+ $this->assertEquals('www.foo.com:8000', (string) $r2->getHeaderLine('host'));
564
+ }
565
+
566
+ public function testCanModifyRequestWithCaseInsensitiveHeader()
567
+ {
568
+ $r1 = new Psr7\Request('GET', 'http://foo.com', ['User-Agent' => 'foo']);
569
+ $r2 = Psr7\modify_request($r1, ['set_headers' => ['User-agent' => 'bar']]);
570
+ $this->assertEquals('bar', $r2->getHeaderLine('User-Agent'));
571
+ $this->assertEquals('bar', $r2->getHeaderLine('User-agent'));
572
+ }
573
+
574
+ public function testReturnsAsIsWhenNoChanges()
575
+ {
576
+ $r1 = new Psr7\Request('GET', 'http://foo.com');
577
+ $r2 = Psr7\modify_request($r1, []);
578
+ $this->assertTrue($r2 instanceof Psr7\Request);
579
+
580
+ $r1 = new Psr7\ServerRequest('GET', 'http://foo.com');
581
+ $r2 = Psr7\modify_request($r1, []);
582
+ $this->assertTrue($r2 instanceof \Psr\Http\Message\ServerRequestInterface);
583
+ }
584
+
585
+ public function testReturnsUriAsIsWhenNoChanges()
586
+ {
587
+ $r1 = new Psr7\Request('GET', 'http://foo.com');
588
+ $r2 = Psr7\modify_request($r1, ['set_headers' => ['foo' => 'bar']]);
589
+ $this->assertNotSame($r1, $r2);
590
+ $this->assertEquals('bar', $r2->getHeaderLine('foo'));
591
+ }
592
+
593
+ public function testRemovesHeadersFromMessage()
594
+ {
595
+ $r1 = new Psr7\Request('GET', 'http://foo.com', ['foo' => 'bar']);
596
+ $r2 = Psr7\modify_request($r1, ['remove_headers' => ['foo']]);
597
+ $this->assertNotSame($r1, $r2);
598
+ $this->assertFalse($r2->hasHeader('foo'));
599
+ }
600
+
601
+ public function testAddsQueryToUri()
602
+ {
603
+ $r1 = new Psr7\Request('GET', 'http://foo.com');
604
+ $r2 = Psr7\modify_request($r1, ['query' => 'foo=bar']);
605
+ $this->assertNotSame($r1, $r2);
606
+ $this->assertEquals('foo=bar', $r2->getUri()->getQuery());
607
+ }
608
+
609
+ public function testModifyRequestKeepInstanceOfRequest()
610
+ {
611
+ $r1 = new Psr7\Request('GET', 'http://foo.com');
612
+ $r2 = Psr7\modify_request($r1, ['remove_headers' => ['non-existent']]);
613
+ $this->assertTrue($r2 instanceof Psr7\Request);
614
+
615
+ $r1 = new Psr7\ServerRequest('GET', 'http://foo.com');
616
+ $r2 = Psr7\modify_request($r1, ['remove_headers' => ['non-existent']]);
617
+ $this->assertTrue($r2 instanceof \Psr\Http\Message\ServerRequestInterface);
618
+ }
619
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use GuzzleHttp\Psr7\InflateStream;
6
+
7
+ class InflateStreamtest extends \PHPUnit_Framework_TestCase
8
+ {
9
+ public function testInflatesStreams()
10
+ {
11
+ $content = gzencode('test');
12
+ $a = Psr7\stream_for($content);
13
+ $b = new InflateStream($a);
14
+ $this->assertEquals('test', (string) $b);
15
+ }
16
+
17
+ public function testInflatesStreamsWithFilename()
18
+ {
19
+ $content = $this->getGzipStringWithFilename('test');
20
+ $a = Psr7\stream_for($content);
21
+ $b = new InflateStream($a);
22
+ $this->assertEquals('test', (string) $b);
23
+ }
24
+
25
+ private function getGzipStringWithFilename($original_string)
26
+ {
27
+ $gzipped = bin2hex(gzencode($original_string));
28
+
29
+ $header = substr($gzipped, 0, 20);
30
+ // set FNAME flag
31
+ $header[6]=0;
32
+ $header[7]=8;
33
+ // make a dummy filename
34
+ $filename = "64756d6d7900";
35
+ $rest = substr($gzipped, 20);
36
+
37
+ return hex2bin($header . $filename . $rest);
38
+ }
39
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/LazyOpenStreamTest.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7\LazyOpenStream;
5
+
6
+ class LazyOpenStreamTest extends \PHPUnit_Framework_TestCase
7
+ {
8
+ private $fname;
9
+
10
+ public function setup()
11
+ {
12
+ $this->fname = tempnam('/tmp', 'tfile');
13
+
14
+ if (file_exists($this->fname)) {
15
+ unlink($this->fname);
16
+ }
17
+ }
18
+
19
+ public function tearDown()
20
+ {
21
+ if (file_exists($this->fname)) {
22
+ unlink($this->fname);
23
+ }
24
+ }
25
+
26
+ public function testOpensLazily()
27
+ {
28
+ $l = new LazyOpenStream($this->fname, 'w+');
29
+ $l->write('foo');
30
+ $this->assertInternalType('array', $l->getMetadata());
31
+ $this->assertFileExists($this->fname);
32
+ $this->assertEquals('foo', file_get_contents($this->fname));
33
+ $this->assertEquals('foo', (string) $l);
34
+ }
35
+
36
+ public function testProxiesToFile()
37
+ {
38
+ file_put_contents($this->fname, 'foo');
39
+ $l = new LazyOpenStream($this->fname, 'r');
40
+ $this->assertEquals('foo', $l->read(4));
41
+ $this->assertTrue($l->eof());
42
+ $this->assertEquals(3, $l->tell());
43
+ $this->assertTrue($l->isReadable());
44
+ $this->assertTrue($l->isSeekable());
45
+ $this->assertFalse($l->isWritable());
46
+ $l->seek(1);
47
+ $this->assertEquals('oo', $l->getContents());
48
+ $this->assertEquals('foo', (string) $l);
49
+ $this->assertEquals(3, $l->getSize());
50
+ $this->assertInternalType('array', $l->getMetadata());
51
+ $l->close();
52
+ }
53
+
54
+ public function testDetachesUnderlyingStream()
55
+ {
56
+ file_put_contents($this->fname, 'foo');
57
+ $l = new LazyOpenStream($this->fname, 'r');
58
+ $r = $l->detach();
59
+ $this->assertInternalType('resource', $r);
60
+ fseek($r, 0);
61
+ $this->assertEquals('foo', stream_get_contents($r));
62
+ fclose($r);
63
+ }
64
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/LimitStreamTest.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use GuzzleHttp\Psr7\FnStream;
6
+ use GuzzleHttp\Psr7\Stream;
7
+ use GuzzleHttp\Psr7\LimitStream;
8
+ use GuzzleHttp\Psr7\NoSeekStream;
9
+
10
+ /**
11
+ * @covers GuzzleHttp\Psr7\LimitStream
12
+ */
13
+ class LimitStreamTest extends \PHPUnit_Framework_TestCase
14
+ {
15
+ /** @var LimitStream */
16
+ protected $body;
17
+
18
+ /** @var Stream */
19
+ protected $decorated;
20
+
21
+ public function setUp()
22
+ {
23
+ $this->decorated = Psr7\stream_for(fopen(__FILE__, 'r'));
24
+ $this->body = new LimitStream($this->decorated, 10, 3);
25
+ }
26
+
27
+ public function testReturnsSubset()
28
+ {
29
+ $body = new LimitStream(Psr7\stream_for('foo'), -1, 1);
30
+ $this->assertEquals('oo', (string) $body);
31
+ $this->assertTrue($body->eof());
32
+ $body->seek(0);
33
+ $this->assertFalse($body->eof());
34
+ $this->assertEquals('oo', $body->read(100));
35
+ $this->assertSame('', $body->read(1));
36
+ $this->assertTrue($body->eof());
37
+ }
38
+
39
+ public function testReturnsSubsetWhenCastToString()
40
+ {
41
+ $body = Psr7\stream_for('foo_baz_bar');
42
+ $limited = new LimitStream($body, 3, 4);
43
+ $this->assertEquals('baz', (string) $limited);
44
+ }
45
+
46
+ /**
47
+ * @expectedException \RuntimeException
48
+ * @expectedExceptionMessage Unable to seek to stream position 10 with whence 0
49
+ */
50
+ public function testEnsuresPositionCanBeekSeekedTo()
51
+ {
52
+ new LimitStream(Psr7\stream_for(''), 0, 10);
53
+ }
54
+
55
+ public function testReturnsSubsetOfEmptyBodyWhenCastToString()
56
+ {
57
+ $body = Psr7\stream_for('01234567891234');
58
+ $limited = new LimitStream($body, 0, 10);
59
+ $this->assertEquals('', (string) $limited);
60
+ }
61
+
62
+ public function testReturnsSpecificSubsetOBodyWhenCastToString()
63
+ {
64
+ $body = Psr7\stream_for('0123456789abcdef');
65
+ $limited = new LimitStream($body, 3, 10);
66
+ $this->assertEquals('abc', (string) $limited);
67
+ }
68
+
69
+ public function testSeeksWhenConstructed()
70
+ {
71
+ $this->assertEquals(0, $this->body->tell());
72
+ $this->assertEquals(3, $this->decorated->tell());
73
+ }
74
+
75
+ public function testAllowsBoundedSeek()
76
+ {
77
+ $this->body->seek(100);
78
+ $this->assertEquals(10, $this->body->tell());
79
+ $this->assertEquals(13, $this->decorated->tell());
80
+ $this->body->seek(0);
81
+ $this->assertEquals(0, $this->body->tell());
82
+ $this->assertEquals(3, $this->decorated->tell());
83
+ try {
84
+ $this->body->seek(-10);
85
+ $this->fail();
86
+ } catch (\RuntimeException $e) {}
87
+ $this->assertEquals(0, $this->body->tell());
88
+ $this->assertEquals(3, $this->decorated->tell());
89
+ $this->body->seek(5);
90
+ $this->assertEquals(5, $this->body->tell());
91
+ $this->assertEquals(8, $this->decorated->tell());
92
+ // Fail
93
+ try {
94
+ $this->body->seek(1000, SEEK_END);
95
+ $this->fail();
96
+ } catch (\RuntimeException $e) {}
97
+ }
98
+
99
+ public function testReadsOnlySubsetOfData()
100
+ {
101
+ $data = $this->body->read(100);
102
+ $this->assertEquals(10, strlen($data));
103
+ $this->assertSame('', $this->body->read(1000));
104
+
105
+ $this->body->setOffset(10);
106
+ $newData = $this->body->read(100);
107
+ $this->assertEquals(10, strlen($newData));
108
+ $this->assertNotSame($data, $newData);
109
+ }
110
+
111
+ /**
112
+ * @expectedException \RuntimeException
113
+ * @expectedExceptionMessage Could not seek to stream offset 2
114
+ */
115
+ public function testThrowsWhenCurrentGreaterThanOffsetSeek()
116
+ {
117
+ $a = Psr7\stream_for('foo_bar');
118
+ $b = new NoSeekStream($a);
119
+ $c = new LimitStream($b);
120
+ $a->getContents();
121
+ $c->setOffset(2);
122
+ }
123
+
124
+ public function testCanGetContentsWithoutSeeking()
125
+ {
126
+ $a = Psr7\stream_for('foo_bar');
127
+ $b = new NoSeekStream($a);
128
+ $c = new LimitStream($b);
129
+ $this->assertEquals('foo_bar', $c->getContents());
130
+ }
131
+
132
+ public function testClaimsConsumedWhenReadLimitIsReached()
133
+ {
134
+ $this->assertFalse($this->body->eof());
135
+ $this->body->read(1000);
136
+ $this->assertTrue($this->body->eof());
137
+ }
138
+
139
+ public function testContentLengthIsBounded()
140
+ {
141
+ $this->assertEquals(10, $this->body->getSize());
142
+ }
143
+
144
+ public function testGetContentsIsBasedOnSubset()
145
+ {
146
+ $body = new LimitStream(Psr7\stream_for('foobazbar'), 3, 3);
147
+ $this->assertEquals('baz', $body->getContents());
148
+ }
149
+
150
+ public function testReturnsNullIfSizeCannotBeDetermined()
151
+ {
152
+ $a = new FnStream([
153
+ 'getSize' => function () { return null; },
154
+ 'tell' => function () { return 0; },
155
+ ]);
156
+ $b = new LimitStream($a);
157
+ $this->assertNull($b->getSize());
158
+ }
159
+
160
+ public function testLengthLessOffsetWhenNoLimitSize()
161
+ {
162
+ $a = Psr7\stream_for('foo_bar');
163
+ $b = new LimitStream($a, -1, 4);
164
+ $this->assertEquals(3, $b->getSize());
165
+ }
166
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/MultipartStreamTest.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use GuzzleHttp\Psr7\MultipartStream;
6
+
7
+ class MultipartStreamTest extends \PHPUnit_Framework_TestCase
8
+ {
9
+ public function testCreatesDefaultBoundary()
10
+ {
11
+ $b = new MultipartStream();
12
+ $this->assertNotEmpty($b->getBoundary());
13
+ }
14
+
15
+ public function testCanProvideBoundary()
16
+ {
17
+ $b = new MultipartStream([], 'foo');
18
+ $this->assertEquals('foo', $b->getBoundary());
19
+ }
20
+
21
+ public function testIsNotWritable()
22
+ {
23
+ $b = new MultipartStream();
24
+ $this->assertFalse($b->isWritable());
25
+ }
26
+
27
+ public function testCanCreateEmptyStream()
28
+ {
29
+ $b = new MultipartStream();
30
+ $boundary = $b->getBoundary();
31
+ $this->assertSame("--{$boundary}--\r\n", $b->getContents());
32
+ $this->assertSame(strlen($boundary) + 6, $b->getSize());
33
+ }
34
+
35
+ /**
36
+ * @expectedException \InvalidArgumentException
37
+ */
38
+ public function testValidatesFilesArrayElement()
39
+ {
40
+ new MultipartStream([['foo' => 'bar']]);
41
+ }
42
+
43
+ /**
44
+ * @expectedException \InvalidArgumentException
45
+ */
46
+ public function testEnsuresFileHasName()
47
+ {
48
+ new MultipartStream([['contents' => 'bar']]);
49
+ }
50
+
51
+ public function testSerializesFields()
52
+ {
53
+ $b = new MultipartStream([
54
+ [
55
+ 'name' => 'foo',
56
+ 'contents' => 'bar'
57
+ ],
58
+ [
59
+ 'name' => 'baz',
60
+ 'contents' => 'bam'
61
+ ]
62
+ ], 'boundary');
63
+ $this->assertEquals(
64
+ "--boundary\r\nContent-Disposition: form-data; name=\"foo\"\r\nContent-Length: 3\r\n\r\n"
65
+ . "bar\r\n--boundary\r\nContent-Disposition: form-data; name=\"baz\"\r\nContent-Length: 3"
66
+ . "\r\n\r\nbam\r\n--boundary--\r\n", (string) $b);
67
+ }
68
+
69
+ public function testSerializesNonStringFields()
70
+ {
71
+ $b = new MultipartStream([
72
+ [
73
+ 'name' => 'int',
74
+ 'contents' => (int) 1
75
+ ],
76
+ [
77
+ 'name' => 'bool',
78
+ 'contents' => (boolean) false
79
+ ],
80
+ [
81
+ 'name' => 'bool2',
82
+ 'contents' => (boolean) true
83
+ ],
84
+ [
85
+ 'name' => 'float',
86
+ 'contents' => (float) 1.1
87
+ ]
88
+ ], 'boundary');
89
+ $this->assertEquals(
90
+ "--boundary\r\nContent-Disposition: form-data; name=\"int\"\r\nContent-Length: 1\r\n\r\n"
91
+ . "1\r\n--boundary\r\nContent-Disposition: form-data; name=\"bool\"\r\n\r\n\r\n--boundary"
92
+ . "\r\nContent-Disposition: form-data; name=\"bool2\"\r\nContent-Length: 1\r\n\r\n"
93
+ . "1\r\n--boundary\r\nContent-Disposition: form-data; name=\"float\"\r\nContent-Length: 3"
94
+ . "\r\n\r\n1.1\r\n--boundary--\r\n", (string) $b);
95
+ }
96
+
97
+ public function testSerializesFiles()
98
+ {
99
+ $f1 = Psr7\FnStream::decorate(Psr7\stream_for('foo'), [
100
+ 'getMetadata' => function () {
101
+ return '/foo/bar.txt';
102
+ }
103
+ ]);
104
+
105
+ $f2 = Psr7\FnStream::decorate(Psr7\stream_for('baz'), [
106
+ 'getMetadata' => function () {
107
+ return '/foo/baz.jpg';
108
+ }
109
+ ]);
110
+
111
+ $f3 = Psr7\FnStream::decorate(Psr7\stream_for('bar'), [
112
+ 'getMetadata' => function () {
113
+ return '/foo/bar.gif';
114
+ }
115
+ ]);
116
+
117
+ $b = new MultipartStream([
118
+ [
119
+ 'name' => 'foo',
120
+ 'contents' => $f1
121
+ ],
122
+ [
123
+ 'name' => 'qux',
124
+ 'contents' => $f2
125
+ ],
126
+ [
127
+ 'name' => 'qux',
128
+ 'contents' => $f3
129
+ ],
130
+ ], 'boundary');
131
+
132
+ $expected = <<<EOT
133
+ --boundary
134
+ Content-Disposition: form-data; name="foo"; filename="bar.txt"
135
+ Content-Length: 3
136
+ Content-Type: text/plain
137
+
138
+ foo
139
+ --boundary
140
+ Content-Disposition: form-data; name="qux"; filename="baz.jpg"
141
+ Content-Length: 3
142
+ Content-Type: image/jpeg
143
+
144
+ baz
145
+ --boundary
146
+ Content-Disposition: form-data; name="qux"; filename="bar.gif"
147
+ Content-Length: 3
148
+ Content-Type: image/gif
149
+
150
+ bar
151
+ --boundary--
152
+
153
+ EOT;
154
+
155
+ $this->assertEquals($expected, str_replace("\r", '', $b));
156
+ }
157
+
158
+ public function testSerializesFilesWithCustomHeaders()
159
+ {
160
+ $f1 = Psr7\FnStream::decorate(Psr7\stream_for('foo'), [
161
+ 'getMetadata' => function () {
162
+ return '/foo/bar.txt';
163
+ }
164
+ ]);
165
+
166
+ $b = new MultipartStream([
167
+ [
168
+ 'name' => 'foo',
169
+ 'contents' => $f1,
170
+ 'headers' => [
171
+ 'x-foo' => 'bar',
172
+ 'content-disposition' => 'custom'
173
+ ]
174
+ ]
175
+ ], 'boundary');
176
+
177
+ $expected = <<<EOT
178
+ --boundary
179
+ x-foo: bar
180
+ content-disposition: custom
181
+ Content-Length: 3
182
+ Content-Type: text/plain
183
+
184
+ foo
185
+ --boundary--
186
+
187
+ EOT;
188
+
189
+ $this->assertEquals($expected, str_replace("\r", '', $b));
190
+ }
191
+
192
+ public function testSerializesFilesWithCustomHeadersAndMultipleValues()
193
+ {
194
+ $f1 = Psr7\FnStream::decorate(Psr7\stream_for('foo'), [
195
+ 'getMetadata' => function () {
196
+ return '/foo/bar.txt';
197
+ }
198
+ ]);
199
+
200
+ $f2 = Psr7\FnStream::decorate(Psr7\stream_for('baz'), [
201
+ 'getMetadata' => function () {
202
+ return '/foo/baz.jpg';
203
+ }
204
+ ]);
205
+
206
+ $b = new MultipartStream([
207
+ [
208
+ 'name' => 'foo',
209
+ 'contents' => $f1,
210
+ 'headers' => [
211
+ 'x-foo' => 'bar',
212
+ 'content-disposition' => 'custom'
213
+ ]
214
+ ],
215
+ [
216
+ 'name' => 'foo',
217
+ 'contents' => $f2,
218
+ 'headers' => ['cOntenT-Type' => 'custom'],
219
+ ]
220
+ ], 'boundary');
221
+
222
+ $expected = <<<EOT
223
+ --boundary
224
+ x-foo: bar
225
+ content-disposition: custom
226
+ Content-Length: 3
227
+ Content-Type: text/plain
228
+
229
+ foo
230
+ --boundary
231
+ cOntenT-Type: custom
232
+ Content-Disposition: form-data; name="foo"; filename="baz.jpg"
233
+ Content-Length: 3
234
+
235
+ baz
236
+ --boundary--
237
+
238
+ EOT;
239
+
240
+ $this->assertEquals($expected, str_replace("\r", '', $b));
241
+ }
242
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/NoSeekStreamTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use GuzzleHttp\Psr7\NoSeekStream;
6
+
7
+ /**
8
+ * @covers GuzzleHttp\Psr7\NoSeekStream
9
+ * @covers GuzzleHttp\Psr7\StreamDecoratorTrait
10
+ */
11
+ class NoSeekStreamTest extends \PHPUnit_Framework_TestCase
12
+ {
13
+ /**
14
+ * @expectedException \RuntimeException
15
+ * @expectedExceptionMessage Cannot seek a NoSeekStream
16
+ */
17
+ public function testCannotSeek()
18
+ {
19
+ $s = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
20
+ ->setMethods(['isSeekable', 'seek'])
21
+ ->getMockForAbstractClass();
22
+ $s->expects($this->never())->method('seek');
23
+ $s->expects($this->never())->method('isSeekable');
24
+ $wrapped = new NoSeekStream($s);
25
+ $this->assertFalse($wrapped->isSeekable());
26
+ $wrapped->seek(2);
27
+ }
28
+
29
+ /**
30
+ * @expectedException \RuntimeException
31
+ * @expectedExceptionMessage Cannot write to a non-writable stream
32
+ */
33
+ public function testHandlesClose()
34
+ {
35
+ $s = Psr7\stream_for('foo');
36
+ $wrapped = new NoSeekStream($s);
37
+ $wrapped->close();
38
+ $wrapped->write('foo');
39
+ }
40
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/PumpStreamTest.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7\LimitStream;
5
+ use GuzzleHttp\Psr7\PumpStream;
6
+ use GuzzleHttp\Psr7;
7
+
8
+ class PumpStreamTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ public function testHasMetadataAndSize()
11
+ {
12
+ $p = new PumpStream(function () {}, [
13
+ 'metadata' => ['foo' => 'bar'],
14
+ 'size' => 100
15
+ ]);
16
+
17
+ $this->assertEquals('bar', $p->getMetadata('foo'));
18
+ $this->assertEquals(['foo' => 'bar'], $p->getMetadata());
19
+ $this->assertEquals(100, $p->getSize());
20
+ }
21
+
22
+ public function testCanReadFromCallable()
23
+ {
24
+ $p = Psr7\stream_for(function ($size) {
25
+ return 'a';
26
+ });
27
+ $this->assertEquals('a', $p->read(1));
28
+ $this->assertEquals(1, $p->tell());
29
+ $this->assertEquals('aaaaa', $p->read(5));
30
+ $this->assertEquals(6, $p->tell());
31
+ }
32
+
33
+ public function testStoresExcessDataInBuffer()
34
+ {
35
+ $called = [];
36
+ $p = Psr7\stream_for(function ($size) use (&$called) {
37
+ $called[] = $size;
38
+ return 'abcdef';
39
+ });
40
+ $this->assertEquals('a', $p->read(1));
41
+ $this->assertEquals('b', $p->read(1));
42
+ $this->assertEquals('cdef', $p->read(4));
43
+ $this->assertEquals('abcdefabc', $p->read(9));
44
+ $this->assertEquals([1, 9, 3], $called);
45
+ }
46
+
47
+ public function testInifiniteStreamWrappedInLimitStream()
48
+ {
49
+ $p = Psr7\stream_for(function () { return 'a'; });
50
+ $s = new LimitStream($p, 5);
51
+ $this->assertEquals('aaaaa', (string) $s);
52
+ }
53
+
54
+ public function testDescribesCapabilities()
55
+ {
56
+ $p = Psr7\stream_for(function () {});
57
+ $this->assertTrue($p->isReadable());
58
+ $this->assertFalse($p->isSeekable());
59
+ $this->assertFalse($p->isWritable());
60
+ $this->assertNull($p->getSize());
61
+ $this->assertEquals('', $p->getContents());
62
+ $this->assertEquals('', (string) $p);
63
+ $p->close();
64
+ $this->assertEquals('', $p->read(10));
65
+ $this->assertTrue($p->eof());
66
+
67
+ try {
68
+ $this->assertFalse($p->write('aa'));
69
+ $this->fail();
70
+ } catch (\RuntimeException $e) {}
71
+ }
72
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/RequestTest.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use GuzzleHttp\Psr7\Request;
6
+ use GuzzleHttp\Psr7\Uri;
7
+
8
+ /**
9
+ * @covers GuzzleHttp\Psr7\Request
10
+ */
11
+ class RequestTest extends \PHPUnit_Framework_TestCase
12
+ {
13
+ public function testRequestUriMayBeString()
14
+ {
15
+ $r = new Request('GET', '/');
16
+ $this->assertEquals('/', (string) $r->getUri());
17
+ }
18
+
19
+ public function testRequestUriMayBeUri()
20
+ {
21
+ $uri = new Uri('/');
22
+ $r = new Request('GET', $uri);
23
+ $this->assertSame($uri, $r->getUri());
24
+ }
25
+
26
+ /**
27
+ * @expectedException \InvalidArgumentException
28
+ */
29
+ public function testValidateRequestUri()
30
+ {
31
+ new Request('GET', '///');
32
+ }
33
+
34
+ public function testCanConstructWithBody()
35
+ {
36
+ $r = new Request('GET', '/', [], 'baz');
37
+ $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
38
+ $this->assertEquals('baz', (string) $r->getBody());
39
+ }
40
+
41
+ public function testNullBody()
42
+ {
43
+ $r = new Request('GET', '/', [], null);
44
+ $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
45
+ $this->assertSame('', (string) $r->getBody());
46
+ }
47
+
48
+ public function testFalseyBody()
49
+ {
50
+ $r = new Request('GET', '/', [], '0');
51
+ $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
52
+ $this->assertSame('0', (string) $r->getBody());
53
+ }
54
+
55
+ public function testConstructorDoesNotReadStreamBody()
56
+ {
57
+ $streamIsRead = false;
58
+ $body = Psr7\FnStream::decorate(Psr7\stream_for(''), [
59
+ '__toString' => function () use (&$streamIsRead) {
60
+ $streamIsRead = true;
61
+ return '';
62
+ }
63
+ ]);
64
+
65
+ $r = new Request('GET', '/', [], $body);
66
+ $this->assertFalse($streamIsRead);
67
+ $this->assertSame($body, $r->getBody());
68
+ }
69
+
70
+ public function testCapitalizesMethod()
71
+ {
72
+ $r = new Request('get', '/');
73
+ $this->assertEquals('GET', $r->getMethod());
74
+ }
75
+
76
+ public function testCapitalizesWithMethod()
77
+ {
78
+ $r = new Request('GET', '/');
79
+ $this->assertEquals('PUT', $r->withMethod('put')->getMethod());
80
+ }
81
+
82
+ public function testWithUri()
83
+ {
84
+ $r1 = new Request('GET', '/');
85
+ $u1 = $r1->getUri();
86
+ $u2 = new Uri('http://www.example.com');
87
+ $r2 = $r1->withUri($u2);
88
+ $this->assertNotSame($r1, $r2);
89
+ $this->assertSame($u2, $r2->getUri());
90
+ $this->assertSame($u1, $r1->getUri());
91
+ }
92
+
93
+ public function testSameInstanceWhenSameUri()
94
+ {
95
+ $r1 = new Request('GET', 'http://foo.com');
96
+ $r2 = $r1->withUri($r1->getUri());
97
+ $this->assertSame($r1, $r2);
98
+ }
99
+
100
+ public function testWithRequestTarget()
101
+ {
102
+ $r1 = new Request('GET', '/');
103
+ $r2 = $r1->withRequestTarget('*');
104
+ $this->assertEquals('*', $r2->getRequestTarget());
105
+ $this->assertEquals('/', $r1->getRequestTarget());
106
+ }
107
+
108
+ /**
109
+ * @expectedException \InvalidArgumentException
110
+ */
111
+ public function testRequestTargetDoesNotAllowSpaces()
112
+ {
113
+ $r1 = new Request('GET', '/');
114
+ $r1->withRequestTarget('/foo bar');
115
+ }
116
+
117
+ public function testRequestTargetDefaultsToSlash()
118
+ {
119
+ $r1 = new Request('GET', '');
120
+ $this->assertEquals('/', $r1->getRequestTarget());
121
+ $r2 = new Request('GET', '*');
122
+ $this->assertEquals('*', $r2->getRequestTarget());
123
+ $r3 = new Request('GET', 'http://foo.com/bar baz/');
124
+ $this->assertEquals('/bar%20baz/', $r3->getRequestTarget());
125
+ }
126
+
127
+ public function testBuildsRequestTarget()
128
+ {
129
+ $r1 = new Request('GET', 'http://foo.com/baz?bar=bam');
130
+ $this->assertEquals('/baz?bar=bam', $r1->getRequestTarget());
131
+ }
132
+
133
+ public function testBuildsRequestTargetWithFalseyQuery()
134
+ {
135
+ $r1 = new Request('GET', 'http://foo.com/baz?0');
136
+ $this->assertEquals('/baz?0', $r1->getRequestTarget());
137
+ }
138
+
139
+ public function testHostIsAddedFirst()
140
+ {
141
+ $r = new Request('GET', 'http://foo.com/baz?bar=bam', ['Foo' => 'Bar']);
142
+ $this->assertEquals([
143
+ 'Host' => ['foo.com'],
144
+ 'Foo' => ['Bar']
145
+ ], $r->getHeaders());
146
+ }
147
+
148
+ public function testCanGetHeaderAsCsv()
149
+ {
150
+ $r = new Request('GET', 'http://foo.com/baz?bar=bam', [
151
+ 'Foo' => ['a', 'b', 'c']
152
+ ]);
153
+ $this->assertEquals('a, b, c', $r->getHeaderLine('Foo'));
154
+ $this->assertEquals('', $r->getHeaderLine('Bar'));
155
+ }
156
+
157
+ public function testHostIsNotOverwrittenWhenPreservingHost()
158
+ {
159
+ $r = new Request('GET', 'http://foo.com/baz?bar=bam', ['Host' => 'a.com']);
160
+ $this->assertEquals(['Host' => ['a.com']], $r->getHeaders());
161
+ $r2 = $r->withUri(new Uri('http://www.foo.com/bar'), true);
162
+ $this->assertEquals('a.com', $r2->getHeaderLine('Host'));
163
+ }
164
+
165
+ public function testOverridesHostWithUri()
166
+ {
167
+ $r = new Request('GET', 'http://foo.com/baz?bar=bam');
168
+ $this->assertEquals(['Host' => ['foo.com']], $r->getHeaders());
169
+ $r2 = $r->withUri(new Uri('http://www.baz.com/bar'));
170
+ $this->assertEquals('www.baz.com', $r2->getHeaderLine('Host'));
171
+ }
172
+
173
+ public function testAggregatesHeaders()
174
+ {
175
+ $r = new Request('GET', '', [
176
+ 'ZOO' => 'zoobar',
177
+ 'zoo' => ['foobar', 'zoobar']
178
+ ]);
179
+ $this->assertEquals(['ZOO' => ['zoobar', 'foobar', 'zoobar']], $r->getHeaders());
180
+ $this->assertEquals('zoobar, foobar, zoobar', $r->getHeaderLine('zoo'));
181
+ }
182
+
183
+ public function testAddsPortToHeader()
184
+ {
185
+ $r = new Request('GET', 'http://foo.com:8124/bar');
186
+ $this->assertEquals('foo.com:8124', $r->getHeaderLine('host'));
187
+ }
188
+
189
+ public function testAddsPortToHeaderAndReplacePreviousPort()
190
+ {
191
+ $r = new Request('GET', 'http://foo.com:8124/bar');
192
+ $r = $r->withUri(new Uri('http://foo.com:8125/bar'));
193
+ $this->assertEquals('foo.com:8125', $r->getHeaderLine('host'));
194
+ }
195
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/ResponseTest.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7;
5
+ use GuzzleHttp\Psr7\Response;
6
+
7
+ /**
8
+ * @covers GuzzleHttp\Psr7\MessageTrait
9
+ * @covers GuzzleHttp\Psr7\Response
10
+ */
11
+ class ResponseTest extends \PHPUnit_Framework_TestCase
12
+ {
13
+ public function testDefaultConstructor()
14
+ {
15
+ $r = new Response();
16
+ $this->assertSame(200, $r->getStatusCode());
17
+ $this->assertSame('1.1', $r->getProtocolVersion());
18
+ $this->assertSame('OK', $r->getReasonPhrase());
19
+ $this->assertSame([], $r->getHeaders());
20
+ $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
21
+ $this->assertSame('', (string) $r->getBody());
22
+ }
23
+
24
+ public function testCanConstructWithStatusCode()
25
+ {
26
+ $r = new Response(404);
27
+ $this->assertSame(404, $r->getStatusCode());
28
+ $this->assertSame('Not Found', $r->getReasonPhrase());
29
+ }
30
+
31
+ public function testConstructorDoesNotReadStreamBody()
32
+ {
33
+ $streamIsRead = false;
34
+ $body = Psr7\FnStream::decorate(Psr7\stream_for(''), [
35
+ '__toString' => function () use (&$streamIsRead) {
36
+ $streamIsRead = true;
37
+ return '';
38
+ }
39
+ ]);
40
+
41
+ $r = new Response(200, [], $body);
42
+ $this->assertFalse($streamIsRead);
43
+ $this->assertSame($body, $r->getBody());
44
+ }
45
+
46
+ public function testStatusCanBeNumericString()
47
+ {
48
+ $r = new Response('404');
49
+ $r2 = $r->withStatus('201');
50
+ $this->assertSame(404, $r->getStatusCode());
51
+ $this->assertSame('Not Found', $r->getReasonPhrase());
52
+ $this->assertSame(201, $r2->getStatusCode());
53
+ $this->assertSame('Created', $r2->getReasonPhrase());
54
+ }
55
+
56
+ public function testCanConstructWithHeaders()
57
+ {
58
+ $r = new Response(200, ['Foo' => 'Bar']);
59
+ $this->assertSame(['Foo' => ['Bar']], $r->getHeaders());
60
+ $this->assertSame('Bar', $r->getHeaderLine('Foo'));
61
+ $this->assertSame(['Bar'], $r->getHeader('Foo'));
62
+ }
63
+
64
+ public function testCanConstructWithHeadersAsArray()
65
+ {
66
+ $r = new Response(200, [
67
+ 'Foo' => ['baz', 'bar']
68
+ ]);
69
+ $this->assertSame(['Foo' => ['baz', 'bar']], $r->getHeaders());
70
+ $this->assertSame('baz, bar', $r->getHeaderLine('Foo'));
71
+ $this->assertSame(['baz', 'bar'], $r->getHeader('Foo'));
72
+ }
73
+
74
+ public function testCanConstructWithBody()
75
+ {
76
+ $r = new Response(200, [], 'baz');
77
+ $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
78
+ $this->assertSame('baz', (string) $r->getBody());
79
+ }
80
+
81
+ public function testNullBody()
82
+ {
83
+ $r = new Response(200, [], null);
84
+ $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
85
+ $this->assertSame('', (string) $r->getBody());
86
+ }
87
+
88
+ public function testFalseyBody()
89
+ {
90
+ $r = new Response(200, [], '0');
91
+ $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
92
+ $this->assertSame('0', (string) $r->getBody());
93
+ }
94
+
95
+ public function testCanConstructWithReason()
96
+ {
97
+ $r = new Response(200, [], null, '1.1', 'bar');
98
+ $this->assertSame('bar', $r->getReasonPhrase());
99
+
100
+ $r = new Response(200, [], null, '1.1', '0');
101
+ $this->assertSame('0', $r->getReasonPhrase(), 'Falsey reason works');
102
+ }
103
+
104
+ public function testCanConstructWithProtocolVersion()
105
+ {
106
+ $r = new Response(200, [], null, '1000');
107
+ $this->assertSame('1000', $r->getProtocolVersion());
108
+ }
109
+
110
+ public function testWithStatusCodeAndNoReason()
111
+ {
112
+ $r = (new Response())->withStatus(201);
113
+ $this->assertSame(201, $r->getStatusCode());
114
+ $this->assertSame('Created', $r->getReasonPhrase());
115
+ }
116
+
117
+ public function testWithStatusCodeAndReason()
118
+ {
119
+ $r = (new Response())->withStatus(201, 'Foo');
120
+ $this->assertSame(201, $r->getStatusCode());
121
+ $this->assertSame('Foo', $r->getReasonPhrase());
122
+
123
+ $r = (new Response())->withStatus(201, '0');
124
+ $this->assertSame(201, $r->getStatusCode());
125
+ $this->assertSame('0', $r->getReasonPhrase(), 'Falsey reason works');
126
+ }
127
+
128
+ public function testWithProtocolVersion()
129
+ {
130
+ $r = (new Response())->withProtocolVersion('1000');
131
+ $this->assertSame('1000', $r->getProtocolVersion());
132
+ }
133
+
134
+ public function testSameInstanceWhenSameProtocol()
135
+ {
136
+ $r = new Response();
137
+ $this->assertSame($r, $r->withProtocolVersion('1.1'));
138
+ }
139
+
140
+ public function testWithBody()
141
+ {
142
+ $b = Psr7\stream_for('0');
143
+ $r = (new Response())->withBody($b);
144
+ $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
145
+ $this->assertSame('0', (string) $r->getBody());
146
+ }
147
+
148
+ public function testSameInstanceWhenSameBody()
149
+ {
150
+ $r = new Response();
151
+ $b = $r->getBody();
152
+ $this->assertSame($r, $r->withBody($b));
153
+ }
154
+
155
+ public function testWithHeader()
156
+ {
157
+ $r = new Response(200, ['Foo' => 'Bar']);
158
+ $r2 = $r->withHeader('baZ', 'Bam');
159
+ $this->assertSame(['Foo' => ['Bar']], $r->getHeaders());
160
+ $this->assertSame(['Foo' => ['Bar'], 'baZ' => ['Bam']], $r2->getHeaders());
161
+ $this->assertSame('Bam', $r2->getHeaderLine('baz'));
162
+ $this->assertSame(['Bam'], $r2->getHeader('baz'));
163
+ }
164
+
165
+ public function testWithHeaderAsArray()
166
+ {
167
+ $r = new Response(200, ['Foo' => 'Bar']);
168
+ $r2 = $r->withHeader('baZ', ['Bam', 'Bar']);
169
+ $this->assertSame(['Foo' => ['Bar']], $r->getHeaders());
170
+ $this->assertSame(['Foo' => ['Bar'], 'baZ' => ['Bam', 'Bar']], $r2->getHeaders());
171
+ $this->assertSame('Bam, Bar', $r2->getHeaderLine('baz'));
172
+ $this->assertSame(['Bam', 'Bar'], $r2->getHeader('baz'));
173
+ }
174
+
175
+ public function testWithHeaderReplacesDifferentCase()
176
+ {
177
+ $r = new Response(200, ['Foo' => 'Bar']);
178
+ $r2 = $r->withHeader('foO', 'Bam');
179
+ $this->assertSame(['Foo' => ['Bar']], $r->getHeaders());
180
+ $this->assertSame(['foO' => ['Bam']], $r2->getHeaders());
181
+ $this->assertSame('Bam', $r2->getHeaderLine('foo'));
182
+ $this->assertSame(['Bam'], $r2->getHeader('foo'));
183
+ }
184
+
185
+ public function testWithAddedHeader()
186
+ {
187
+ $r = new Response(200, ['Foo' => 'Bar']);
188
+ $r2 = $r->withAddedHeader('foO', 'Baz');
189
+ $this->assertSame(['Foo' => ['Bar']], $r->getHeaders());
190
+ $this->assertSame(['Foo' => ['Bar', 'Baz']], $r2->getHeaders());
191
+ $this->assertSame('Bar, Baz', $r2->getHeaderLine('foo'));
192
+ $this->assertSame(['Bar', 'Baz'], $r2->getHeader('foo'));
193
+ }
194
+
195
+ public function testWithAddedHeaderAsArray()
196
+ {
197
+ $r = new Response(200, ['Foo' => 'Bar']);
198
+ $r2 = $r->withAddedHeader('foO', ['Baz', 'Bam']);
199
+ $this->assertSame(['Foo' => ['Bar']], $r->getHeaders());
200
+ $this->assertSame(['Foo' => ['Bar', 'Baz', 'Bam']], $r2->getHeaders());
201
+ $this->assertSame('Bar, Baz, Bam', $r2->getHeaderLine('foo'));
202
+ $this->assertSame(['Bar', 'Baz', 'Bam'], $r2->getHeader('foo'));
203
+ }
204
+
205
+ public function testWithAddedHeaderThatDoesNotExist()
206
+ {
207
+ $r = new Response(200, ['Foo' => 'Bar']);
208
+ $r2 = $r->withAddedHeader('nEw', 'Baz');
209
+ $this->assertSame(['Foo' => ['Bar']], $r->getHeaders());
210
+ $this->assertSame(['Foo' => ['Bar'], 'nEw' => ['Baz']], $r2->getHeaders());
211
+ $this->assertSame('Baz', $r2->getHeaderLine('new'));
212
+ $this->assertSame(['Baz'], $r2->getHeader('new'));
213
+ }
214
+
215
+ public function testWithoutHeaderThatExists()
216
+ {
217
+ $r = new Response(200, ['Foo' => 'Bar', 'Baz' => 'Bam']);
218
+ $r2 = $r->withoutHeader('foO');
219
+ $this->assertTrue($r->hasHeader('foo'));
220
+ $this->assertSame(['Foo' => ['Bar'], 'Baz' => ['Bam']], $r->getHeaders());
221
+ $this->assertFalse($r2->hasHeader('foo'));
222
+ $this->assertSame(['Baz' => ['Bam']], $r2->getHeaders());
223
+ }
224
+
225
+ public function testWithoutHeaderThatDoesNotExist()
226
+ {
227
+ $r = new Response(200, ['Baz' => 'Bam']);
228
+ $r2 = $r->withoutHeader('foO');
229
+ $this->assertSame($r, $r2);
230
+ $this->assertFalse($r2->hasHeader('foo'));
231
+ $this->assertSame(['Baz' => ['Bam']], $r2->getHeaders());
232
+ }
233
+
234
+ public function testSameInstanceWhenRemovingMissingHeader()
235
+ {
236
+ $r = new Response();
237
+ $this->assertSame($r, $r->withoutHeader('foo'));
238
+ }
239
+
240
+ public function testHeaderValuesAreTrimmed()
241
+ {
242
+ $r1 = new Response(200, ['OWS' => " \t \tFoo\t \t "]);
243
+ $r2 = (new Response())->withHeader('OWS', " \t \tFoo\t \t ");
244
+ $r3 = (new Response())->withAddedHeader('OWS', " \t \tFoo\t \t ");;
245
+
246
+ foreach ([$r1, $r2, $r3] as $r) {
247
+ $this->assertSame(['OWS' => ['Foo']], $r->getHeaders());
248
+ $this->assertSame('Foo', $r->getHeaderLine('OWS'));
249
+ $this->assertSame(['Foo'], $r->getHeader('OWS'));
250
+ }
251
+ }
252
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/ServerRequestTest.php ADDED
@@ -0,0 +1,532 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7\ServerRequest;
5
+ use GuzzleHttp\Psr7\UploadedFile;
6
+ use GuzzleHttp\Psr7\Uri;
7
+
8
+ /**
9
+ * @covers GuzzleHttp\Psr7\ServerRequest
10
+ */
11
+ class ServerRequestTest extends \PHPUnit_Framework_TestCase
12
+ {
13
+ public function dataNormalizeFiles()
14
+ {
15
+ return [
16
+ 'Single file' => [
17
+ [
18
+ 'file' => [
19
+ 'name' => 'MyFile.txt',
20
+ 'type' => 'text/plain',
21
+ 'tmp_name' => '/tmp/php/php1h4j1o',
22
+ 'error' => '0',
23
+ 'size' => '123'
24
+ ]
25
+ ],
26
+ [
27
+ 'file' => new UploadedFile(
28
+ '/tmp/php/php1h4j1o',
29
+ 123,
30
+ UPLOAD_ERR_OK,
31
+ 'MyFile.txt',
32
+ 'text/plain'
33
+ )
34
+ ]
35
+ ],
36
+ 'Empty file' => [
37
+ [
38
+ 'image_file' => [
39
+ 'name' => '',
40
+ 'type' => '',
41
+ 'tmp_name' => '',
42
+ 'error' => '4',
43
+ 'size' => '0'
44
+ ]
45
+ ],
46
+ [
47
+ 'image_file' => new UploadedFile(
48
+ '',
49
+ 0,
50
+ UPLOAD_ERR_NO_FILE,
51
+ '',
52
+ ''
53
+ )
54
+ ]
55
+ ],
56
+ 'Already Converted' => [
57
+ [
58
+ 'file' => new UploadedFile(
59
+ '/tmp/php/php1h4j1o',
60
+ 123,
61
+ UPLOAD_ERR_OK,
62
+ 'MyFile.txt',
63
+ 'text/plain'
64
+ )
65
+ ],
66
+ [
67
+ 'file' => new UploadedFile(
68
+ '/tmp/php/php1h4j1o',
69
+ 123,
70
+ UPLOAD_ERR_OK,
71
+ 'MyFile.txt',
72
+ 'text/plain'
73
+ )
74
+ ]
75
+ ],
76
+ 'Already Converted array' => [
77
+ [
78
+ 'file' => [
79
+ new UploadedFile(
80
+ '/tmp/php/php1h4j1o',
81
+ 123,
82
+ UPLOAD_ERR_OK,
83
+ 'MyFile.txt',
84
+ 'text/plain'
85
+ ),
86
+ new UploadedFile(
87
+ '',
88
+ 0,
89
+ UPLOAD_ERR_NO_FILE,
90
+ '',
91
+ ''
92
+ )
93
+ ],
94
+ ],
95
+ [
96
+ 'file' => [
97
+ new UploadedFile(
98
+ '/tmp/php/php1h4j1o',
99
+ 123,
100
+ UPLOAD_ERR_OK,
101
+ 'MyFile.txt',
102
+ 'text/plain'
103
+ ),
104
+ new UploadedFile(
105
+ '',
106
+ 0,
107
+ UPLOAD_ERR_NO_FILE,
108
+ '',
109
+ ''
110
+ )
111
+ ],
112
+ ]
113
+ ],
114
+ 'Multiple files' => [
115
+ [
116
+ 'text_file' => [
117
+ 'name' => 'MyFile.txt',
118
+ 'type' => 'text/plain',
119
+ 'tmp_name' => '/tmp/php/php1h4j1o',
120
+ 'error' => '0',
121
+ 'size' => '123'
122
+ ],
123
+ 'image_file' => [
124
+ 'name' => '',
125
+ 'type' => '',
126
+ 'tmp_name' => '',
127
+ 'error' => '4',
128
+ 'size' => '0'
129
+ ]
130
+ ],
131
+ [
132
+ 'text_file' => new UploadedFile(
133
+ '/tmp/php/php1h4j1o',
134
+ 123,
135
+ UPLOAD_ERR_OK,
136
+ 'MyFile.txt',
137
+ 'text/plain'
138
+ ),
139
+ 'image_file' => new UploadedFile(
140
+ '',
141
+ 0,
142
+ UPLOAD_ERR_NO_FILE,
143
+ '',
144
+ ''
145
+ )
146
+ ]
147
+ ],
148
+ 'Nested files' => [
149
+ [
150
+ 'file' => [
151
+ 'name' => [
152
+ 0 => 'MyFile.txt',
153
+ 1 => 'Image.png',
154
+ ],
155
+ 'type' => [
156
+ 0 => 'text/plain',
157
+ 1 => 'image/png',
158
+ ],
159
+ 'tmp_name' => [
160
+ 0 => '/tmp/php/hp9hskjhf',
161
+ 1 => '/tmp/php/php1h4j1o',
162
+ ],
163
+ 'error' => [
164
+ 0 => '0',
165
+ 1 => '0',
166
+ ],
167
+ 'size' => [
168
+ 0 => '123',
169
+ 1 => '7349',
170
+ ],
171
+ ],
172
+ 'nested' => [
173
+ 'name' => [
174
+ 'other' => 'Flag.txt',
175
+ 'test' => [
176
+ 0 => 'Stuff.txt',
177
+ 1 => '',
178
+ ],
179
+ ],
180
+ 'type' => [
181
+ 'other' => 'text/plain',
182
+ 'test' => [
183
+ 0 => 'text/plain',
184
+ 1 => '',
185
+ ],
186
+ ],
187
+ 'tmp_name' => [
188
+ 'other' => '/tmp/php/hp9hskjhf',
189
+ 'test' => [
190
+ 0 => '/tmp/php/asifu2gp3',
191
+ 1 => '',
192
+ ],
193
+ ],
194
+ 'error' => [
195
+ 'other' => '0',
196
+ 'test' => [
197
+ 0 => '0',
198
+ 1 => '4',
199
+ ],
200
+ ],
201
+ 'size' => [
202
+ 'other' => '421',
203
+ 'test' => [
204
+ 0 => '32',
205
+ 1 => '0',
206
+ ]
207
+ ]
208
+ ],
209
+ ],
210
+ [
211
+ 'file' => [
212
+ 0 => new UploadedFile(
213
+ '/tmp/php/hp9hskjhf',
214
+ 123,
215
+ UPLOAD_ERR_OK,
216
+ 'MyFile.txt',
217
+ 'text/plain'
218
+ ),
219
+ 1 => new UploadedFile(
220
+ '/tmp/php/php1h4j1o',
221
+ 7349,
222
+ UPLOAD_ERR_OK,
223
+ 'Image.png',
224
+ 'image/png'
225
+ ),
226
+ ],
227
+ 'nested' => [
228
+ 'other' => new UploadedFile(
229
+ '/tmp/php/hp9hskjhf',
230
+ 421,
231
+ UPLOAD_ERR_OK,
232
+ 'Flag.txt',
233
+ 'text/plain'
234
+ ),
235
+ 'test' => [
236
+ 0 => new UploadedFile(
237
+ '/tmp/php/asifu2gp3',
238
+ 32,
239
+ UPLOAD_ERR_OK,
240
+ 'Stuff.txt',
241
+ 'text/plain'
242
+ ),
243
+ 1 => new UploadedFile(
244
+ '',
245
+ 0,
246
+ UPLOAD_ERR_NO_FILE,
247
+ '',
248
+ ''
249
+ ),
250
+ ]
251
+ ]
252
+ ]
253
+ ]
254
+ ];
255
+ }
256
+
257
+ /**
258
+ * @dataProvider dataNormalizeFiles
259
+ */
260
+ public function testNormalizeFiles($files, $expected)
261
+ {
262
+ $result = ServerRequest::normalizeFiles($files);
263
+
264
+ $this->assertEquals($expected, $result);
265
+ }
266
+
267
+ public function testNormalizeFilesRaisesException()
268
+ {
269
+ $this->setExpectedException('InvalidArgumentException', 'Invalid value in files specification');
270
+
271
+ ServerRequest::normalizeFiles(['test' => 'something']);
272
+ }
273
+
274
+ public function dataGetUriFromGlobals()
275
+ {
276
+ $server = [
277
+ 'PHP_SELF' => '/blog/article.php',
278
+ 'GATEWAY_INTERFACE' => 'CGI/1.1',
279
+ 'SERVER_ADDR' => 'Server IP: 217.112.82.20',
280
+ 'SERVER_NAME' => 'www.blakesimpson.co.uk',
281
+ 'SERVER_SOFTWARE' => 'Apache/2.2.15 (Win32) JRun/4.0 PHP/5.2.13',
282
+ 'SERVER_PROTOCOL' => 'HTTP/1.0',
283
+ 'REQUEST_METHOD' => 'POST',
284
+ 'REQUEST_TIME' => 'Request start time: 1280149029',
285
+ 'QUERY_STRING' => 'id=10&user=foo',
286
+ 'DOCUMENT_ROOT' => '/path/to/your/server/root/',
287
+ 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
288
+ 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
289
+ 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
290
+ 'HTTP_ACCEPT_LANGUAGE' => 'en-gb,en;q=0.5',
291
+ 'HTTP_CONNECTION' => 'keep-alive',
292
+ 'HTTP_HOST' => 'www.blakesimpson.co.uk',
293
+ 'HTTP_REFERER' => 'http://previous.url.com',
294
+ 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 ( .NET CLR 3.5.30729)',
295
+ 'HTTPS' => '1',
296
+ 'REMOTE_ADDR' => '193.60.168.69',
297
+ 'REMOTE_HOST' => 'Client server\'s host name',
298
+ 'REMOTE_PORT' => '5390',
299
+ 'SCRIPT_FILENAME' => '/path/to/this/script.php',
300
+ 'SERVER_ADMIN' => 'webmaster@blakesimpson.co.uk',
301
+ 'SERVER_PORT' => '80',
302
+ 'SERVER_SIGNATURE' => 'Version signature: 5.123',
303
+ 'SCRIPT_NAME' => '/blog/article.php',
304
+ 'REQUEST_URI' => '/blog/article.php?id=10&user=foo',
305
+ ];
306
+
307
+ return [
308
+ 'Normal request' => [
309
+ 'http://www.blakesimpson.co.uk/blog/article.php?id=10&user=foo',
310
+ $server,
311
+ ],
312
+ 'Secure request' => [
313
+ 'https://www.blakesimpson.co.uk/blog/article.php?id=10&user=foo',
314
+ array_merge($server, ['HTTPS' => 'on', 'SERVER_PORT' => '443']),
315
+ ],
316
+ 'HTTP_HOST missing' => [
317
+ 'http://www.blakesimpson.co.uk/blog/article.php?id=10&user=foo',
318
+ array_merge($server, ['HTTP_HOST' => null]),
319
+ ],
320
+ 'No query String' => [
321
+ 'http://www.blakesimpson.co.uk/blog/article.php',
322
+ array_merge($server, ['REQUEST_URI' => '/blog/article.php', 'QUERY_STRING' => '']),
323
+ ],
324
+ 'Different port' => [
325
+ 'http://www.blakesimpson.co.uk:8324/blog/article.php?id=10&user=foo',
326
+ array_merge($server, ['SERVER_PORT' => '8324']),
327
+ ],
328
+ 'Empty server variable' => [
329
+ '',
330
+ [],
331
+ ],
332
+ ];
333
+ }
334
+
335
+ /**
336
+ * @dataProvider dataGetUriFromGlobals
337
+ */
338
+ public function testGetUriFromGlobals($expected, $serverParams)
339
+ {
340
+ $_SERVER = $serverParams;
341
+
342
+ $this->assertEquals(new Uri($expected), ServerRequest::getUriFromGlobals());
343
+ }
344
+
345
+ public function testFromGlobals()
346
+ {
347
+ $_SERVER = [
348
+ 'PHP_SELF' => '/blog/article.php',
349
+ 'GATEWAY_INTERFACE' => 'CGI/1.1',
350
+ 'SERVER_ADDR' => 'Server IP: 217.112.82.20',
351
+ 'SERVER_NAME' => 'www.blakesimpson.co.uk',
352
+ 'SERVER_SOFTWARE' => 'Apache/2.2.15 (Win32) JRun/4.0 PHP/5.2.13',
353
+ 'SERVER_PROTOCOL' => 'HTTP/1.0',
354
+ 'REQUEST_METHOD' => 'POST',
355
+ 'REQUEST_TIME' => 'Request start time: 1280149029',
356
+ 'QUERY_STRING' => 'id=10&user=foo',
357
+ 'DOCUMENT_ROOT' => '/path/to/your/server/root/',
358
+ 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
359
+ 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
360
+ 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
361
+ 'HTTP_ACCEPT_LANGUAGE' => 'en-gb,en;q=0.5',
362
+ 'HTTP_CONNECTION' => 'keep-alive',
363
+ 'HTTP_HOST' => 'www.blakesimpson.co.uk',
364
+ 'HTTP_REFERER' => 'http://previous.url.com',
365
+ 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 ( .NET CLR 3.5.30729)',
366
+ 'HTTPS' => '1',
367
+ 'REMOTE_ADDR' => '193.60.168.69',
368
+ 'REMOTE_HOST' => 'Client server\'s host name',
369
+ 'REMOTE_PORT' => '5390',
370
+ 'SCRIPT_FILENAME' => '/path/to/this/script.php',
371
+ 'SERVER_ADMIN' => 'webmaster@blakesimpson.co.uk',
372
+ 'SERVER_PORT' => '80',
373
+ 'SERVER_SIGNATURE' => 'Version signature: 5.123',
374
+ 'SCRIPT_NAME' => '/blog/article.php',
375
+ 'REQUEST_URI' => '/blog/article.php?id=10&user=foo',
376
+ ];
377
+
378
+ $_COOKIE = [
379
+ 'logged-in' => 'yes!'
380
+ ];
381
+
382
+ $_POST = [
383
+ 'name' => 'Pesho',
384
+ 'email' => 'pesho@example.com',
385
+ ];
386
+
387
+ $_GET = [
388
+ 'id' => 10,
389
+ 'user' => 'foo',
390
+ ];
391
+
392
+ $_FILES = [
393
+ 'file' => [
394
+ 'name' => 'MyFile.txt',
395
+ 'type' => 'text/plain',
396
+ 'tmp_name' => '/tmp/php/php1h4j1o',
397
+ 'error' => UPLOAD_ERR_OK,
398
+ 'size' => 123,
399
+ ]
400
+ ];
401
+
402
+ $server = ServerRequest::fromGlobals();
403
+
404
+ $this->assertEquals('POST', $server->getMethod());
405
+ $this->assertEquals(['Host' => ['www.blakesimpson.co.uk']], $server->getHeaders());
406
+ $this->assertEquals('', (string) $server->getBody());
407
+ $this->assertEquals('1.0', $server->getProtocolVersion());
408
+ $this->assertEquals($_COOKIE, $server->getCookieParams());
409
+ $this->assertEquals($_POST, $server->getParsedBody());
410
+ $this->assertEquals($_GET, $server->getQueryParams());
411
+
412
+ $this->assertEquals(
413
+ new Uri('http://www.blakesimpson.co.uk/blog/article.php?id=10&user=foo'),
414
+ $server->getUri()
415
+ );
416
+
417
+ $expectedFiles = [
418
+ 'file' => new UploadedFile(
419
+ '/tmp/php/php1h4j1o',
420
+ 123,
421
+ UPLOAD_ERR_OK,
422
+ 'MyFile.txt',
423
+ 'text/plain'
424
+ ),
425
+ ];
426
+
427
+ $this->assertEquals($expectedFiles, $server->getUploadedFiles());
428
+ }
429
+
430
+ public function testUploadedFiles()
431
+ {
432
+ $request1 = new ServerRequest('GET', '/');
433
+
434
+ $files = [
435
+ 'file' => new UploadedFile('test', 123, UPLOAD_ERR_OK)
436
+ ];
437
+
438
+ $request2 = $request1->withUploadedFiles($files);
439
+
440
+ $this->assertNotSame($request2, $request1);
441
+ $this->assertSame([], $request1->getUploadedFiles());
442
+ $this->assertSame($files, $request2->getUploadedFiles());
443
+ }
444
+
445
+ public function testServerParams()
446
+ {
447
+ $params = ['name' => 'value'];
448
+
449
+ $request = new ServerRequest('GET', '/', [], null, '1.1', $params);
450
+ $this->assertSame($params, $request->getServerParams());
451
+ }
452
+
453
+ public function testCookieParams()
454
+ {
455
+ $request1 = new ServerRequest('GET', '/');
456
+
457
+ $params = ['name' => 'value'];
458
+
459
+ $request2 = $request1->withCookieParams($params);
460
+
461
+ $this->assertNotSame($request2, $request1);
462
+ $this->assertEmpty($request1->getCookieParams());
463
+ $this->assertSame($params, $request2->getCookieParams());
464
+ }
465
+
466
+ public function testQueryParams()
467
+ {
468
+ $request1 = new ServerRequest('GET', '/');
469
+
470
+ $params = ['name' => 'value'];
471
+
472
+ $request2 = $request1->withQueryParams($params);
473
+
474
+ $this->assertNotSame($request2, $request1);
475
+ $this->assertEmpty($request1->getQueryParams());
476
+ $this->assertSame($params, $request2->getQueryParams());
477
+ }
478
+
479
+ public function testParsedBody()
480
+ {
481
+ $request1 = new ServerRequest('GET', '/');
482
+
483
+ $params = ['name' => 'value'];
484
+
485
+ $request2 = $request1->withParsedBody($params);
486
+
487
+ $this->assertNotSame($request2, $request1);
488
+ $this->assertEmpty($request1->getParsedBody());
489
+ $this->assertSame($params, $request2->getParsedBody());
490
+ }
491
+
492
+ public function testAttributes()
493
+ {
494
+ $request1 = new ServerRequest('GET', '/');
495
+
496
+ $request2 = $request1->withAttribute('name', 'value');
497
+ $request3 = $request2->withAttribute('other', 'otherValue');
498
+ $request4 = $request3->withoutAttribute('other');
499
+ $request5 = $request3->withoutAttribute('unknown');
500
+
501
+ $this->assertNotSame($request2, $request1);
502
+ $this->assertNotSame($request3, $request2);
503
+ $this->assertNotSame($request4, $request3);
504
+ $this->assertNotSame($request5, $request4);
505
+
506
+ $this->assertEmpty($request1->getAttributes());
507
+ $this->assertEmpty($request1->getAttribute('name'));
508
+ $this->assertEquals(
509
+ 'something',
510
+ $request1->getAttribute('name', 'something'),
511
+ 'Should return the default value'
512
+ );
513
+
514
+ $this->assertEquals('value', $request2->getAttribute('name'));
515
+ $this->assertEquals(['name' => 'value'], $request2->getAttributes());
516
+ $this->assertEquals(['name' => 'value', 'other' => 'otherValue'], $request3->getAttributes());
517
+ $this->assertEquals(['name' => 'value'], $request4->getAttributes());
518
+ }
519
+
520
+ public function testNullAttribute()
521
+ {
522
+ $request = (new ServerRequest('GET', '/'))->withAttribute('name', null);
523
+
524
+ $this->assertSame(['name' => null], $request->getAttributes());
525
+ $this->assertNull($request->getAttribute('name', 'different-default'));
526
+
527
+ $requestWithoutAttribute = $request->withoutAttribute('name');
528
+
529
+ $this->assertSame([], $requestWithoutAttribute->getAttributes());
530
+ $this->assertSame('different-default', $requestWithoutAttribute->getAttribute('name', 'different-default'));
531
+ }
532
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use Psr\Http\Message\StreamInterface;
5
+ use GuzzleHttp\Psr7;
6
+ use GuzzleHttp\Psr7\StreamDecoratorTrait;
7
+
8
+ class Str implements StreamInterface
9
+ {
10
+ use StreamDecoratorTrait;
11
+ }
12
+
13
+ /**
14
+ * @covers GuzzleHttp\Psr7\StreamDecoratorTrait
15
+ */
16
+ class StreamDecoratorTraitTest extends \PHPUnit_Framework_TestCase
17
+ {
18
+ private $a;
19
+ private $b;
20
+ private $c;
21
+
22
+ public function setUp()
23
+ {
24
+ $this->c = fopen('php://temp', 'r+');
25
+ fwrite($this->c, 'foo');
26
+ fseek($this->c, 0);
27
+ $this->a = Psr7\stream_for($this->c);
28
+ $this->b = new Str($this->a);
29
+ }
30
+
31
+ public function testCatchesExceptionsWhenCastingToString()
32
+ {
33
+ $s = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
34
+ ->setMethods(['read'])
35
+ ->getMockForAbstractClass();
36
+ $s->expects($this->once())
37
+ ->method('read')
38
+ ->will($this->throwException(new \Exception('foo')));
39
+ $msg = '';
40
+ set_error_handler(function ($errNo, $str) use (&$msg) { $msg = $str; });
41
+ echo new Str($s);
42
+ restore_error_handler();
43
+ $this->assertContains('foo', $msg);
44
+ }
45
+
46
+ public function testToString()
47
+ {
48
+ $this->assertEquals('foo', (string) $this->b);
49
+ }
50
+
51
+ public function testHasSize()
52
+ {
53
+ $this->assertEquals(3, $this->b->getSize());
54
+ }
55
+
56
+ public function testReads()
57
+ {
58
+ $this->assertEquals('foo', $this->b->read(10));
59
+ }
60
+
61
+ public function testCheckMethods()
62
+ {
63
+ $this->assertEquals($this->a->isReadable(), $this->b->isReadable());
64
+ $this->assertEquals($this->a->isWritable(), $this->b->isWritable());
65
+ $this->assertEquals($this->a->isSeekable(), $this->b->isSeekable());
66
+ }
67
+
68
+ public function testSeeksAndTells()
69
+ {
70
+ $this->b->seek(1);
71
+ $this->assertEquals(1, $this->a->tell());
72
+ $this->assertEquals(1, $this->b->tell());
73
+ $this->b->seek(0);
74
+ $this->assertEquals(0, $this->a->tell());
75
+ $this->assertEquals(0, $this->b->tell());
76
+ $this->b->seek(0, SEEK_END);
77
+ $this->assertEquals(3, $this->a->tell());
78
+ $this->assertEquals(3, $this->b->tell());
79
+ }
80
+
81
+ public function testGetsContents()
82
+ {
83
+ $this->assertEquals('foo', $this->b->getContents());
84
+ $this->assertEquals('', $this->b->getContents());
85
+ $this->b->seek(1);
86
+ $this->assertEquals('oo', $this->b->getContents(1));
87
+ }
88
+
89
+ public function testCloses()
90
+ {
91
+ $this->b->close();
92
+ $this->assertFalse(is_resource($this->c));
93
+ }
94
+
95
+ public function testDetaches()
96
+ {
97
+ $this->b->detach();
98
+ $this->assertFalse($this->b->isReadable());
99
+ }
100
+
101
+ public function testWrapsMetadata()
102
+ {
103
+ $this->assertSame($this->b->getMetadata(), $this->a->getMetadata());
104
+ $this->assertSame($this->b->getMetadata('uri'), $this->a->getMetadata('uri'));
105
+ }
106
+
107
+ public function testWrapsWrites()
108
+ {
109
+ $this->b->seek(0, SEEK_END);
110
+ $this->b->write('foo');
111
+ $this->assertEquals('foofoo', (string) $this->a);
112
+ }
113
+
114
+ /**
115
+ * @expectedException \UnexpectedValueException
116
+ */
117
+ public function testThrowsWithInvalidGetter()
118
+ {
119
+ $this->b->foo;
120
+ }
121
+
122
+ /**
123
+ * @expectedException \BadMethodCallException
124
+ */
125
+ public function testThrowsWhenGetterNotImplemented()
126
+ {
127
+ $s = new BadStream();
128
+ $s->stream;
129
+ }
130
+ }
131
+
132
+ class BadStream
133
+ {
134
+ use StreamDecoratorTrait;
135
+
136
+ public function __construct() {}
137
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/StreamTest.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7\NoSeekStream;
5
+ use GuzzleHttp\Psr7\Stream;
6
+
7
+ /**
8
+ * @covers GuzzleHttp\Psr7\Stream
9
+ */
10
+ class StreamTest extends \PHPUnit_Framework_TestCase
11
+ {
12
+ /**
13
+ * @expectedException \InvalidArgumentException
14
+ */
15
+ public function testConstructorThrowsExceptionOnInvalidArgument()
16
+ {
17
+ new Stream(true);
18
+ }
19
+
20
+ public function testConstructorInitializesProperties()
21
+ {
22
+ $handle = fopen('php://temp', 'r+');
23
+ fwrite($handle, 'data');
24
+ $stream = new Stream($handle);
25
+ $this->assertTrue($stream->isReadable());
26
+ $this->assertTrue($stream->isWritable());
27
+ $this->assertTrue($stream->isSeekable());
28
+ $this->assertEquals('php://temp', $stream->getMetadata('uri'));
29
+ $this->assertInternalType('array', $stream->getMetadata());
30
+ $this->assertEquals(4, $stream->getSize());
31
+ $this->assertFalse($stream->eof());
32
+ $stream->close();
33
+ }
34
+
35
+ public function testStreamClosesHandleOnDestruct()
36
+ {
37
+ $handle = fopen('php://temp', 'r');
38
+ $stream = new Stream($handle);
39
+ unset($stream);
40
+ $this->assertFalse(is_resource($handle));
41
+ }
42
+
43
+ public function testConvertsToString()
44
+ {
45
+ $handle = fopen('php://temp', 'w+');
46
+ fwrite($handle, 'data');
47
+ $stream = new Stream($handle);
48
+ $this->assertEquals('data', (string) $stream);
49
+ $this->assertEquals('data', (string) $stream);
50
+ $stream->close();
51
+ }
52
+
53
+ public function testGetsContents()
54
+ {
55
+ $handle = fopen('php://temp', 'w+');
56
+ fwrite($handle, 'data');
57
+ $stream = new Stream($handle);
58
+ $this->assertEquals('', $stream->getContents());
59
+ $stream->seek(0);
60
+ $this->assertEquals('data', $stream->getContents());
61
+ $this->assertEquals('', $stream->getContents());
62
+ }
63
+
64
+ public function testChecksEof()
65
+ {
66
+ $handle = fopen('php://temp', 'w+');
67
+ fwrite($handle, 'data');
68
+ $stream = new Stream($handle);
69
+ $this->assertFalse($stream->eof());
70
+ $stream->read(4);
71
+ $this->assertTrue($stream->eof());
72
+ $stream->close();
73
+ }
74
+
75
+ public function testGetSize()
76
+ {
77
+ $size = filesize(__FILE__);
78
+ $handle = fopen(__FILE__, 'r');
79
+ $stream = new Stream($handle);
80
+ $this->assertEquals($size, $stream->getSize());
81
+ // Load from cache
82
+ $this->assertEquals($size, $stream->getSize());
83
+ $stream->close();
84
+ }
85
+
86
+ public function testEnsuresSizeIsConsistent()
87
+ {
88
+ $h = fopen('php://temp', 'w+');
89
+ $this->assertEquals(3, fwrite($h, 'foo'));
90
+ $stream = new Stream($h);
91
+ $this->assertEquals(3, $stream->getSize());
92
+ $this->assertEquals(4, $stream->write('test'));
93
+ $this->assertEquals(7, $stream->getSize());
94
+ $this->assertEquals(7, $stream->getSize());
95
+ $stream->close();
96
+ }
97
+
98
+ public function testProvidesStreamPosition()
99
+ {
100
+ $handle = fopen('php://temp', 'w+');
101
+ $stream = new Stream($handle);
102
+ $this->assertEquals(0, $stream->tell());
103
+ $stream->write('foo');
104
+ $this->assertEquals(3, $stream->tell());
105
+ $stream->seek(1);
106
+ $this->assertEquals(1, $stream->tell());
107
+ $this->assertSame(ftell($handle), $stream->tell());
108
+ $stream->close();
109
+ }
110
+
111
+ public function testCanDetachStream()
112
+ {
113
+ $r = fopen('php://temp', 'w+');
114
+ $stream = new Stream($r);
115
+ $stream->write('foo');
116
+ $this->assertTrue($stream->isReadable());
117
+ $this->assertSame($r, $stream->detach());
118
+ $stream->detach();
119
+
120
+ $this->assertFalse($stream->isReadable());
121
+ $this->assertFalse($stream->isWritable());
122
+ $this->assertFalse($stream->isSeekable());
123
+
124
+ $throws = function (callable $fn) use ($stream) {
125
+ try {
126
+ $fn($stream);
127
+ $this->fail();
128
+ } catch (\Exception $e) {}
129
+ };
130
+
131
+ $throws(function ($stream) { $stream->read(10); });
132
+ $throws(function ($stream) { $stream->write('bar'); });
133
+ $throws(function ($stream) { $stream->seek(10); });
134
+ $throws(function ($stream) { $stream->tell(); });
135
+ $throws(function ($stream) { $stream->eof(); });
136
+ $throws(function ($stream) { $stream->getSize(); });
137
+ $throws(function ($stream) { $stream->getContents(); });
138
+ $this->assertSame('', (string) $stream);
139
+ $stream->close();
140
+ }
141
+
142
+ public function testCloseClearProperties()
143
+ {
144
+ $handle = fopen('php://temp', 'r+');
145
+ $stream = new Stream($handle);
146
+ $stream->close();
147
+
148
+ $this->assertFalse($stream->isSeekable());
149
+ $this->assertFalse($stream->isReadable());
150
+ $this->assertFalse($stream->isWritable());
151
+ $this->assertNull($stream->getSize());
152
+ $this->assertEmpty($stream->getMetadata());
153
+ }
154
+
155
+ public function testDoesNotThrowInToString()
156
+ {
157
+ $s = \GuzzleHttp\Psr7\stream_for('foo');
158
+ $s = new NoSeekStream($s);
159
+ $this->assertEquals('foo', (string) $s);
160
+ }
161
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/StreamWrapperTest.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7\StreamWrapper;
5
+ use GuzzleHttp\Psr7;
6
+
7
+ /**
8
+ * @covers GuzzleHttp\Psr7\StreamWrapper
9
+ */
10
+ class StreamWrapperTest extends \PHPUnit_Framework_TestCase
11
+ {
12
+ public function testResource()
13
+ {
14
+ $stream = Psr7\stream_for('foo');
15
+ $handle = StreamWrapper::getResource($stream);
16
+ $this->assertSame('foo', fread($handle, 3));
17
+ $this->assertSame(3, ftell($handle));
18
+ $this->assertSame(3, fwrite($handle, 'bar'));
19
+ $this->assertSame(0, fseek($handle, 0));
20
+ $this->assertSame('foobar', fread($handle, 6));
21
+ $this->assertSame('', fread($handle, 1));
22
+ $this->assertTrue(feof($handle));
23
+
24
+ $stBlksize = defined('PHP_WINDOWS_VERSION_BUILD') ? -1 : 0;
25
+
26
+ // This fails on HHVM for some reason
27
+ if (!defined('HHVM_VERSION')) {
28
+ $this->assertEquals([
29
+ 'dev' => 0,
30
+ 'ino' => 0,
31
+ 'mode' => 33206,
32
+ 'nlink' => 0,
33
+ 'uid' => 0,
34
+ 'gid' => 0,
35
+ 'rdev' => 0,
36
+ 'size' => 6,
37
+ 'atime' => 0,
38
+ 'mtime' => 0,
39
+ 'ctime' => 0,
40
+ 'blksize' => $stBlksize,
41
+ 'blocks' => $stBlksize,
42
+ 0 => 0,
43
+ 1 => 0,
44
+ 2 => 33206,
45
+ 3 => 0,
46
+ 4 => 0,
47
+ 5 => 0,
48
+ 6 => 0,
49
+ 7 => 6,
50
+ 8 => 0,
51
+ 9 => 0,
52
+ 10 => 0,
53
+ 11 => $stBlksize,
54
+ 12 => $stBlksize,
55
+ ], fstat($handle));
56
+ }
57
+
58
+ $this->assertTrue(fclose($handle));
59
+ $this->assertSame('foobar', (string) $stream);
60
+ }
61
+
62
+ /**
63
+ * @expectedException \InvalidArgumentException
64
+ */
65
+ public function testValidatesStream()
66
+ {
67
+ $stream = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
68
+ ->setMethods(['isReadable', 'isWritable'])
69
+ ->getMockForAbstractClass();
70
+ $stream->expects($this->once())
71
+ ->method('isReadable')
72
+ ->will($this->returnValue(false));
73
+ $stream->expects($this->once())
74
+ ->method('isWritable')
75
+ ->will($this->returnValue(false));
76
+ StreamWrapper::getResource($stream);
77
+ }
78
+
79
+ /**
80
+ * @expectedException \PHPUnit_Framework_Error_Warning
81
+ */
82
+ public function testReturnsFalseWhenStreamDoesNotExist()
83
+ {
84
+ fopen('guzzle://foo', 'r');
85
+ }
86
+
87
+ public function testCanOpenReadonlyStream()
88
+ {
89
+ $stream = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
90
+ ->setMethods(['isReadable', 'isWritable'])
91
+ ->getMockForAbstractClass();
92
+ $stream->expects($this->once())
93
+ ->method('isReadable')
94
+ ->will($this->returnValue(false));
95
+ $stream->expects($this->once())
96
+ ->method('isWritable')
97
+ ->will($this->returnValue(true));
98
+ $r = StreamWrapper::getResource($stream);
99
+ $this->assertInternalType('resource', $r);
100
+ fclose($r);
101
+ }
102
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/UploadedFileTest.php ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use ReflectionProperty;
5
+ use GuzzleHttp\Psr7\Stream;
6
+ use GuzzleHttp\Psr7\UploadedFile;
7
+
8
+ /**
9
+ * @covers GuzzleHttp\Psr7\UploadedFile
10
+ */
11
+ class UploadedFileTest extends \PHPUnit_Framework_TestCase
12
+ {
13
+ protected $cleanup;
14
+
15
+ public function setUp()
16
+ {
17
+ $this->cleanup = [];
18
+ }
19
+
20
+ public function tearDown()
21
+ {
22
+ foreach ($this->cleanup as $file) {
23
+ if (is_scalar($file) && file_exists($file)) {
24
+ unlink($file);
25
+ }
26
+ }
27
+ }
28
+
29
+ public function invalidStreams()
30
+ {
31
+ return [
32
+ 'null' => [null],
33
+ 'true' => [true],
34
+ 'false' => [false],
35
+ 'int' => [1],
36
+ 'float' => [1.1],
37
+ 'array' => [['filename']],
38
+ 'object' => [(object) ['filename']],
39
+ ];
40
+ }
41
+
42
+ /**
43
+ * @dataProvider invalidStreams
44
+ */
45
+ public function testRaisesExceptionOnInvalidStreamOrFile($streamOrFile)
46
+ {
47
+ $this->setExpectedException('InvalidArgumentException');
48
+
49
+ new UploadedFile($streamOrFile, 0, UPLOAD_ERR_OK);
50
+ }
51
+
52
+ public function invalidSizes()
53
+ {
54
+ return [
55
+ 'null' => [null],
56
+ 'float' => [1.1],
57
+ 'array' => [[1]],
58
+ 'object' => [(object) [1]],
59
+ ];
60
+ }
61
+
62
+ /**
63
+ * @dataProvider invalidSizes
64
+ */
65
+ public function testRaisesExceptionOnInvalidSize($size)
66
+ {
67
+ $this->setExpectedException('InvalidArgumentException', 'size');
68
+
69
+ new UploadedFile(fopen('php://temp', 'wb+'), $size, UPLOAD_ERR_OK);
70
+ }
71
+
72
+ public function invalidErrorStatuses()
73
+ {
74
+ return [
75
+ 'null' => [null],
76
+ 'true' => [true],
77
+ 'false' => [false],
78
+ 'float' => [1.1],
79
+ 'string' => ['1'],
80
+ 'array' => [[1]],
81
+ 'object' => [(object) [1]],
82
+ 'negative' => [-1],
83
+ 'too-big' => [9],
84
+ ];
85
+ }
86
+
87
+ /**
88
+ * @dataProvider invalidErrorStatuses
89
+ */
90
+ public function testRaisesExceptionOnInvalidErrorStatus($status)
91
+ {
92
+ $this->setExpectedException('InvalidArgumentException', 'status');
93
+
94
+ new UploadedFile(fopen('php://temp', 'wb+'), 0, $status);
95
+ }
96
+
97
+ public function invalidFilenamesAndMediaTypes()
98
+ {
99
+ return [
100
+ 'true' => [true],
101
+ 'false' => [false],
102
+ 'int' => [1],
103
+ 'float' => [1.1],
104
+ 'array' => [['string']],
105
+ 'object' => [(object) ['string']],
106
+ ];
107
+ }
108
+
109
+ /**
110
+ * @dataProvider invalidFilenamesAndMediaTypes
111
+ */
112
+ public function testRaisesExceptionOnInvalidClientFilename($filename)
113
+ {
114
+ $this->setExpectedException('InvalidArgumentException', 'filename');
115
+
116
+ new UploadedFile(fopen('php://temp', 'wb+'), 0, UPLOAD_ERR_OK, $filename);
117
+ }
118
+
119
+ /**
120
+ * @dataProvider invalidFilenamesAndMediaTypes
121
+ */
122
+ public function testRaisesExceptionOnInvalidClientMediaType($mediaType)
123
+ {
124
+ $this->setExpectedException('InvalidArgumentException', 'media type');
125
+
126
+ new UploadedFile(fopen('php://temp', 'wb+'), 0, UPLOAD_ERR_OK, 'foobar.baz', $mediaType);
127
+ }
128
+
129
+ public function testGetStreamReturnsOriginalStreamObject()
130
+ {
131
+ $stream = new Stream(fopen('php://temp', 'r'));
132
+ $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
133
+
134
+ $this->assertSame($stream, $upload->getStream());
135
+ }
136
+
137
+ public function testGetStreamReturnsWrappedPhpStream()
138
+ {
139
+ $stream = fopen('php://temp', 'wb+');
140
+ $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
141
+ $uploadStream = $upload->getStream()->detach();
142
+
143
+ $this->assertSame($stream, $uploadStream);
144
+ }
145
+
146
+ public function testGetStreamReturnsStreamForFile()
147
+ {
148
+ $this->cleanup[] = $stream = tempnam(sys_get_temp_dir(), 'stream_file');
149
+ $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
150
+ $uploadStream = $upload->getStream();
151
+ $r = new ReflectionProperty($uploadStream, 'filename');
152
+ $r->setAccessible(true);
153
+
154
+ $this->assertSame($stream, $r->getValue($uploadStream));
155
+ }
156
+
157
+ public function testSuccessful()
158
+ {
159
+ $stream = \GuzzleHttp\Psr7\stream_for('Foo bar!');
160
+ $upload = new UploadedFile($stream, $stream->getSize(), UPLOAD_ERR_OK, 'filename.txt', 'text/plain');
161
+
162
+ $this->assertEquals($stream->getSize(), $upload->getSize());
163
+ $this->assertEquals('filename.txt', $upload->getClientFilename());
164
+ $this->assertEquals('text/plain', $upload->getClientMediaType());
165
+
166
+ $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'successful');
167
+ $upload->moveTo($to);
168
+ $this->assertFileExists($to);
169
+ $this->assertEquals($stream->__toString(), file_get_contents($to));
170
+ }
171
+
172
+ public function invalidMovePaths()
173
+ {
174
+ return [
175
+ 'null' => [null],
176
+ 'true' => [true],
177
+ 'false' => [false],
178
+ 'int' => [1],
179
+ 'float' => [1.1],
180
+ 'empty' => [''],
181
+ 'array' => [['filename']],
182
+ 'object' => [(object) ['filename']],
183
+ ];
184
+ }
185
+
186
+ /**
187
+ * @dataProvider invalidMovePaths
188
+ */
189
+ public function testMoveRaisesExceptionForInvalidPath($path)
190
+ {
191
+ $stream = \GuzzleHttp\Psr7\stream_for('Foo bar!');
192
+ $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
193
+
194
+ $this->cleanup[] = $path;
195
+
196
+ $this->setExpectedException('InvalidArgumentException', 'path');
197
+ $upload->moveTo($path);
198
+ }
199
+
200
+ public function testMoveCannotBeCalledMoreThanOnce()
201
+ {
202
+ $stream = \GuzzleHttp\Psr7\stream_for('Foo bar!');
203
+ $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
204
+
205
+ $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'diac');
206
+ $upload->moveTo($to);
207
+ $this->assertTrue(file_exists($to));
208
+
209
+ $this->setExpectedException('RuntimeException', 'moved');
210
+ $upload->moveTo($to);
211
+ }
212
+
213
+ public function testCannotRetrieveStreamAfterMove()
214
+ {
215
+ $stream = \GuzzleHttp\Psr7\stream_for('Foo bar!');
216
+ $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
217
+
218
+ $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'diac');
219
+ $upload->moveTo($to);
220
+ $this->assertFileExists($to);
221
+
222
+ $this->setExpectedException('RuntimeException', 'moved');
223
+ $upload->getStream();
224
+ }
225
+
226
+ public function nonOkErrorStatus()
227
+ {
228
+ return [
229
+ 'UPLOAD_ERR_INI_SIZE' => [ UPLOAD_ERR_INI_SIZE ],
230
+ 'UPLOAD_ERR_FORM_SIZE' => [ UPLOAD_ERR_FORM_SIZE ],
231
+ 'UPLOAD_ERR_PARTIAL' => [ UPLOAD_ERR_PARTIAL ],
232
+ 'UPLOAD_ERR_NO_FILE' => [ UPLOAD_ERR_NO_FILE ],
233
+ 'UPLOAD_ERR_NO_TMP_DIR' => [ UPLOAD_ERR_NO_TMP_DIR ],
234
+ 'UPLOAD_ERR_CANT_WRITE' => [ UPLOAD_ERR_CANT_WRITE ],
235
+ 'UPLOAD_ERR_EXTENSION' => [ UPLOAD_ERR_EXTENSION ],
236
+ ];
237
+ }
238
+
239
+ /**
240
+ * @dataProvider nonOkErrorStatus
241
+ */
242
+ public function testConstructorDoesNotRaiseExceptionForInvalidStreamWhenErrorStatusPresent($status)
243
+ {
244
+ $uploadedFile = new UploadedFile('not ok', 0, $status);
245
+ $this->assertSame($status, $uploadedFile->getError());
246
+ }
247
+
248
+ /**
249
+ * @dataProvider nonOkErrorStatus
250
+ */
251
+ public function testMoveToRaisesExceptionWhenErrorStatusPresent($status)
252
+ {
253
+ $uploadedFile = new UploadedFile('not ok', 0, $status);
254
+ $this->setExpectedException('RuntimeException', 'upload error');
255
+ $uploadedFile->moveTo(__DIR__ . '/' . uniqid());
256
+ }
257
+
258
+ /**
259
+ * @dataProvider nonOkErrorStatus
260
+ */
261
+ public function testGetStreamRaisesExceptionWhenErrorStatusPresent($status)
262
+ {
263
+ $uploadedFile = new UploadedFile('not ok', 0, $status);
264
+ $this->setExpectedException('RuntimeException', 'upload error');
265
+ $stream = $uploadedFile->getStream();
266
+ }
267
+
268
+ public function testMoveToCreatesStreamIfOnlyAFilenameWasProvided()
269
+ {
270
+ $this->cleanup[] = $from = tempnam(sys_get_temp_dir(), 'copy_from');
271
+ $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'copy_to');
272
+
273
+ copy(__FILE__, $from);
274
+
275
+ $uploadedFile = new UploadedFile($from, 100, UPLOAD_ERR_OK, basename($from), 'text/plain');
276
+ $uploadedFile->moveTo($to);
277
+
278
+ $this->assertFileEquals(__FILE__, $to);
279
+ }
280
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/UriTest.php ADDED
@@ -0,0 +1,573 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ use GuzzleHttp\Psr7\Uri;
5
+
6
+ /**
7
+ * @covers GuzzleHttp\Psr7\Uri
8
+ */
9
+ class UriTest extends \PHPUnit_Framework_TestCase
10
+ {
11
+ const RFC3986_BASE = 'http://a/b/c/d;p?q';
12
+
13
+ public function testParsesProvidedUri()
14
+ {
15
+ $uri = new Uri('https://user:pass@example.com:8080/path/123?q=abc#test');
16
+
17
+ $this->assertSame('https', $uri->getScheme());
18
+ $this->assertSame('user:pass@example.com:8080', $uri->getAuthority());
19
+ $this->assertSame('user:pass', $uri->getUserInfo());
20
+ $this->assertSame('example.com', $uri->getHost());
21
+ $this->assertSame(8080, $uri->getPort());
22
+ $this->assertSame('/path/123', $uri->getPath());
23
+ $this->assertSame('q=abc', $uri->getQuery());
24
+ $this->assertSame('test', $uri->getFragment());
25
+ $this->assertSame('https://user:pass@example.com:8080/path/123?q=abc#test', (string) $uri);
26
+ }
27
+
28
+ public function testCanTransformAndRetrievePartsIndividually()
29
+ {
30
+ $uri = (new Uri())
31
+ ->withScheme('https')
32
+ ->withUserInfo('user', 'pass')
33
+ ->withHost('example.com')
34
+ ->withPort(8080)
35
+ ->withPath('/path/123')
36
+ ->withQuery('q=abc')
37
+ ->withFragment('test');
38
+
39
+ $this->assertSame('https', $uri->getScheme());
40
+ $this->assertSame('user:pass@example.com:8080', $uri->getAuthority());
41
+ $this->assertSame('user:pass', $uri->getUserInfo());
42
+ $this->assertSame('example.com', $uri->getHost());
43
+ $this->assertSame(8080, $uri->getPort());
44
+ $this->assertSame('/path/123', $uri->getPath());
45
+ $this->assertSame('q=abc', $uri->getQuery());
46
+ $this->assertSame('test', $uri->getFragment());
47
+ $this->assertSame('https://user:pass@example.com:8080/path/123?q=abc#test', (string) $uri);
48
+ }
49
+
50
+ /**
51
+ * @dataProvider getValidUris
52
+ */
53
+ public function testValidUrisStayValid($input)
54
+ {
55
+ $uri = new Uri($input);
56
+
57
+ $this->assertSame($input, (string) $uri);
58
+ }
59
+
60
+ /**
61
+ * @dataProvider getValidUris
62
+ */
63
+ public function testFromParts($input)
64
+ {
65
+ $uri = Uri::fromParts(parse_url($input));
66
+
67
+ $this->assertSame($input, (string) $uri);
68
+ }
69
+
70
+ public function getValidUris()
71
+ {
72
+ return [
73
+ ['urn:path-rootless'],
74
+ ['urn:path:with:colon'],
75
+ ['urn:/path-absolute'],
76
+ ['urn:/'],
77
+ // only scheme with empty path
78
+ ['urn:'],
79
+ // only path
80
+ ['/'],
81
+ ['relative/'],
82
+ ['0'],
83
+ // same document reference
84
+ [''],
85
+ // network path without scheme
86
+ ['//example.org'],
87
+ ['//example.org/'],
88
+ ['//example.org?q#h'],
89
+ // only query
90
+ ['?q'],
91
+ ['?q=abc&foo=bar'],
92
+ // only fragment
93
+ ['#fragment'],
94
+ // dot segments are not removed automatically
95
+ ['./foo/../bar'],
96
+ ];
97
+ }
98
+
99
+ /**
100
+ * @expectedException \InvalidArgumentException
101
+ * @expectedExceptionMessage Unable to parse URI
102
+ * @dataProvider getInvalidUris
103
+ */
104
+ public function testInvalidUrisThrowException($invalidUri)
105
+ {
106
+ new Uri($invalidUri);
107
+ }
108
+
109
+ public function getInvalidUris()
110
+ {
111
+ return [
112
+ // parse_url() requires the host component which makes sense for http(s)
113
+ // but not when the scheme is not known or different. So '//' or '///' is
114
+ // currently invalid as well but should not according to RFC 3986.
115
+ ['http://'],
116
+ ['urn://host:with:colon'], // host cannot contain ":"
117
+ ];
118
+ }
119
+
120
+ /**
121
+ * @expectedException \InvalidArgumentException
122
+ * @expectedExceptionMessage Invalid port: 100000. Must be between 1 and 65535
123
+ */
124
+ public function testPortMustBeValid()
125
+ {
126
+ (new Uri())->withPort(100000);
127
+ }
128
+
129
+ /**
130
+ * @expectedException \InvalidArgumentException
131
+ * @expectedExceptionMessage Invalid port: 0. Must be between 1 and 65535
132
+ */
133
+ public function testWithPortCannotBeZero()
134
+ {
135
+ (new Uri())->withPort(0);
136
+ }
137
+
138
+ /**
139
+ * @expectedException \InvalidArgumentException
140
+ * @expectedExceptionMessage Unable to parse URI
141
+ */
142
+ public function testParseUriPortCannotBeZero()
143
+ {
144
+ new Uri('//example.com:0');
145
+ }
146
+
147
+ /**
148
+ * @expectedException \InvalidArgumentException
149
+ */
150
+ public function testSchemeMustHaveCorrectType()
151
+ {
152
+ (new Uri())->withScheme([]);
153
+ }
154
+
155
+ /**
156
+ * @expectedException \InvalidArgumentException
157
+ */
158
+ public function testHostMustHaveCorrectType()
159
+ {
160
+ (new Uri())->withHost([]);
161
+ }
162
+
163
+ /**
164
+ * @expectedException \InvalidArgumentException
165
+ */
166
+ public function testPathMustHaveCorrectType()
167
+ {
168
+ (new Uri())->withPath([]);
169
+ }
170
+
171
+ /**
172
+ * @expectedException \InvalidArgumentException
173
+ */
174
+ public function testQueryMustHaveCorrectType()
175
+ {
176
+ (new Uri())->withQuery([]);
177
+ }
178
+
179
+ /**
180
+ * @expectedException \InvalidArgumentException
181
+ */
182
+ public function testFragmentMustHaveCorrectType()
183
+ {
184
+ (new Uri())->withFragment([]);
185
+ }
186
+
187
+ public function testCanParseFalseyUriParts()
188
+ {
189
+ $uri = new Uri('0://0:0@0/0?0#0');
190
+
191
+ $this->assertSame('0', $uri->getScheme());
192
+ $this->assertSame('0:0@0', $uri->getAuthority());
193
+ $this->assertSame('0:0', $uri->getUserInfo());
194
+ $this->assertSame('0', $uri->getHost());
195
+ $this->assertSame('/0', $uri->getPath());
196
+ $this->assertSame('0', $uri->getQuery());
197
+ $this->assertSame('0', $uri->getFragment());
198
+ $this->assertSame('0://0:0@0/0?0#0', (string) $uri);
199
+ }
200
+
201
+ public function testCanConstructFalseyUriParts()
202
+ {
203
+ $uri = (new Uri())
204
+ ->withScheme('0')
205
+ ->withUserInfo('0', '0')
206
+ ->withHost('0')
207
+ ->withPath('/0')
208
+ ->withQuery('0')
209
+ ->withFragment('0');
210
+
211
+ $this->assertSame('0', $uri->getScheme());
212
+ $this->assertSame('0:0@0', $uri->getAuthority());
213
+ $this->assertSame('0:0', $uri->getUserInfo());
214
+ $this->assertSame('0', $uri->getHost());
215
+ $this->assertSame('/0', $uri->getPath());
216
+ $this->assertSame('0', $uri->getQuery());
217
+ $this->assertSame('0', $uri->getFragment());
218
+ $this->assertSame('0://0:0@0/0?0#0', (string) $uri);
219
+ }
220
+
221
+ /**
222
+ * @dataProvider getResolveTestCases
223
+ */
224
+ public function testResolvesUris($base, $rel, $expected)
225
+ {
226
+ $uri = new Uri($base);
227
+ $actual = Uri::resolve($uri, $rel);
228
+ $this->assertSame($expected, (string) $actual);
229
+ }
230
+
231
+ public function getResolveTestCases()
232
+ {
233
+ return [
234
+ [self::RFC3986_BASE, 'g:h', 'g:h'],
235
+ [self::RFC3986_BASE, 'g', 'http://a/b/c/g'],
236
+ [self::RFC3986_BASE, './g', 'http://a/b/c/g'],
237
+ [self::RFC3986_BASE, 'g/', 'http://a/b/c/g/'],
238
+ [self::RFC3986_BASE, '/g', 'http://a/g'],
239
+ [self::RFC3986_BASE, '//g', 'http://g'],
240
+ [self::RFC3986_BASE, '?y', 'http://a/b/c/d;p?y'],
241
+ [self::RFC3986_BASE, 'g?y', 'http://a/b/c/g?y'],
242
+ [self::RFC3986_BASE, '#s', 'http://a/b/c/d;p?q#s'],
243
+ [self::RFC3986_BASE, 'g#s', 'http://a/b/c/g#s'],
244
+ [self::RFC3986_BASE, 'g?y#s', 'http://a/b/c/g?y#s'],
245
+ [self::RFC3986_BASE, ';x', 'http://a/b/c/;x'],
246
+ [self::RFC3986_BASE, 'g;x', 'http://a/b/c/g;x'],
247
+ [self::RFC3986_BASE, 'g;x?y#s', 'http://a/b/c/g;x?y#s'],
248
+ [self::RFC3986_BASE, '', self::RFC3986_BASE],
249
+ [self::RFC3986_BASE, '.', 'http://a/b/c/'],
250
+ [self::RFC3986_BASE, './', 'http://a/b/c/'],
251
+ [self::RFC3986_BASE, '..', 'http://a/b/'],
252
+ [self::RFC3986_BASE, '../', 'http://a/b/'],
253
+ [self::RFC3986_BASE, '../g', 'http://a/b/g'],
254
+ [self::RFC3986_BASE, '../..', 'http://a/'],
255
+ [self::RFC3986_BASE, '../../', 'http://a/'],
256
+ [self::RFC3986_BASE, '../../g', 'http://a/g'],
257
+ [self::RFC3986_BASE, '../../../g', 'http://a/g'],
258
+ [self::RFC3986_BASE, '../../../../g', 'http://a/g'],
259
+ [self::RFC3986_BASE, '/./g', 'http://a/g'],
260
+ [self::RFC3986_BASE, '/../g', 'http://a/g'],
261
+ [self::RFC3986_BASE, 'g.', 'http://a/b/c/g.'],
262
+ [self::RFC3986_BASE, '.g', 'http://a/b/c/.g'],
263
+ [self::RFC3986_BASE, 'g..', 'http://a/b/c/g..'],
264
+ [self::RFC3986_BASE, '..g', 'http://a/b/c/..g'],
265
+ [self::RFC3986_BASE, './../g', 'http://a/b/g'],
266
+ [self::RFC3986_BASE, 'foo////g', 'http://a/b/c/foo////g'],
267
+ [self::RFC3986_BASE, './g/.', 'http://a/b/c/g/'],
268
+ [self::RFC3986_BASE, 'g/./h', 'http://a/b/c/g/h'],
269
+ [self::RFC3986_BASE, 'g/../h', 'http://a/b/c/h'],
270
+ [self::RFC3986_BASE, 'g;x=1/./y', 'http://a/b/c/g;x=1/y'],
271
+ [self::RFC3986_BASE, 'g;x=1/../y', 'http://a/b/c/y'],
272
+ // dot-segments in the query or fragment
273
+ [self::RFC3986_BASE, 'g?y/./x', 'http://a/b/c/g?y/./x'],
274
+ [self::RFC3986_BASE, 'g?y/../x', 'http://a/b/c/g?y/../x'],
275
+ [self::RFC3986_BASE, 'g#s/./x', 'http://a/b/c/g#s/./x'],
276
+ [self::RFC3986_BASE, 'g#s/../x', 'http://a/b/c/g#s/../x'],
277
+ [self::RFC3986_BASE, 'g#s/../x', 'http://a/b/c/g#s/../x'],
278
+ [self::RFC3986_BASE, '?y#s', 'http://a/b/c/d;p?y#s'],
279
+ ['http://a/b/c/d;p?q#s', '?y', 'http://a/b/c/d;p?y'],
280
+ ['http://u@a/b/c/d;p?q', '.', 'http://u@a/b/c/'],
281
+ ['http://u:p@a/b/c/d;p?q', '.', 'http://u:p@a/b/c/'],
282
+ ['http://a/b/c/d/', 'e', 'http://a/b/c/d/e'],
283
+ ['urn:no-slash', 'e', 'urn:e'],
284
+ // falsey relative parts
285
+ [self::RFC3986_BASE, '//0', 'http://0'],
286
+ [self::RFC3986_BASE, '0', 'http://a/b/c/0'],
287
+ [self::RFC3986_BASE, '?0', 'http://a/b/c/d;p?0'],
288
+ [self::RFC3986_BASE, '#0', 'http://a/b/c/d;p?q#0'],
289
+ ];
290
+ }
291
+
292
+ public function testAddAndRemoveQueryValues()
293
+ {
294
+ $uri = new Uri();
295
+ $uri = Uri::withQueryValue($uri, 'a', 'b');
296
+ $uri = Uri::withQueryValue($uri, 'c', 'd');
297
+ $uri = Uri::withQueryValue($uri, 'e', null);
298
+ $this->assertSame('a=b&c=d&e', $uri->getQuery());
299
+
300
+ $uri = Uri::withoutQueryValue($uri, 'c');
301
+ $this->assertSame('a=b&e', $uri->getQuery());
302
+ $uri = Uri::withoutQueryValue($uri, 'e');
303
+ $this->assertSame('a=b', $uri->getQuery());
304
+ $uri = Uri::withoutQueryValue($uri, 'a');
305
+ $this->assertSame('', $uri->getQuery());
306
+ }
307
+
308
+ public function testWithQueryValueReplacesSameKeys()
309
+ {
310
+ $uri = new Uri();
311
+ $uri = Uri::withQueryValue($uri, 'a', 'b');
312
+ $uri = Uri::withQueryValue($uri, 'c', 'd');
313
+ $uri = Uri::withQueryValue($uri, 'a', 'e');
314
+ $this->assertSame('c=d&a=e', $uri->getQuery());
315
+ }
316
+
317
+ public function testWithoutQueryValueRemovesAllSameKeys()
318
+ {
319
+ $uri = (new Uri())->withQuery('a=b&c=d&a=e');
320
+ $uri = Uri::withoutQueryValue($uri, 'a');
321
+ $this->assertSame('c=d', $uri->getQuery());
322
+ }
323
+
324
+ public function testRemoveNonExistingQueryValue()
325
+ {
326
+ $uri = new Uri();
327
+ $uri = Uri::withQueryValue($uri, 'a', 'b');
328
+ $uri = Uri::withoutQueryValue($uri, 'c');
329
+ $this->assertSame('a=b', $uri->getQuery());
330
+ }
331
+
332
+ public function testWithQueryValueHandlesEncoding()
333
+ {
334
+ $uri = new Uri();
335
+ $uri = Uri::withQueryValue($uri, 'E=mc^2', 'ein&stein');
336
+ $this->assertSame('E%3Dmc%5E2=ein%26stein', $uri->getQuery(), 'Decoded key/value get encoded');
337
+
338
+ $uri = new Uri();
339
+ $uri = Uri::withQueryValue($uri, 'E%3Dmc%5e2', 'ein%26stein');
340
+ $this->assertSame('E%3Dmc%5e2=ein%26stein', $uri->getQuery(), 'Encoded key/value do not get double-encoded');
341
+ }
342
+
343
+ public function testWithoutQueryValueHandlesEncoding()
344
+ {
345
+ // It also tests that the case of the percent-encoding does not matter,
346
+ // i.e. both lowercase "%3d" and uppercase "%5E" can be removed.
347
+ $uri = (new Uri())->withQuery('E%3dmc%5E2=einstein&foo=bar');
348
+ $uri = Uri::withoutQueryValue($uri, 'E=mc^2');
349
+ $this->assertSame('foo=bar', $uri->getQuery(), 'Handles key in decoded form');
350
+
351
+ $uri = (new Uri())->withQuery('E%3dmc%5E2=einstein&foo=bar');
352
+ $uri = Uri::withoutQueryValue($uri, 'E%3Dmc%5e2');
353
+ $this->assertSame('foo=bar', $uri->getQuery(), 'Handles key in encoded form');
354
+ }
355
+
356
+ public function testSchemeIsNormalizedToLowercase()
357
+ {
358
+ $uri = new Uri('HTTP://example.com');
359
+
360
+ $this->assertSame('http', $uri->getScheme());
361
+ $this->assertSame('http://example.com', (string) $uri);
362
+
363
+ $uri = (new Uri('//example.com'))->withScheme('HTTP');
364
+
365
+ $this->assertSame('http', $uri->getScheme());
366
+ $this->assertSame('http://example.com', (string) $uri);
367
+ }
368
+
369
+ public function testHostIsNormalizedToLowercase()
370
+ {
371
+ $uri = new Uri('//eXaMpLe.CoM');
372
+
373
+ $this->assertSame('example.com', $uri->getHost());
374
+ $this->assertSame('//example.com', (string) $uri);
375
+
376
+ $uri = (new Uri())->withHost('eXaMpLe.CoM');
377
+
378
+ $this->assertSame('example.com', $uri->getHost());
379
+ $this->assertSame('//example.com', (string) $uri);
380
+ }
381
+
382
+ public function testPortIsNullIfStandardPortForScheme()
383
+ {
384
+ // HTTPS standard port
385
+ $uri = new Uri('https://example.com:443');
386
+ $this->assertNull($uri->getPort());
387
+ $this->assertSame('example.com', $uri->getAuthority());
388
+
389
+ $uri = (new Uri('https://example.com'))->withPort(443);
390
+ $this->assertNull($uri->getPort());
391
+ $this->assertSame('example.com', $uri->getAuthority());
392
+
393
+ // HTTP standard port
394
+ $uri = new Uri('http://example.com:80');
395
+ $this->assertNull($uri->getPort());
396
+ $this->assertSame('example.com', $uri->getAuthority());
397
+
398
+ $uri = (new Uri('http://example.com'))->withPort(80);
399
+ $this->assertNull($uri->getPort());
400
+ $this->assertSame('example.com', $uri->getAuthority());
401
+ }
402
+
403
+ public function testPortIsReturnedIfSchemeUnknown()
404
+ {
405
+ $uri = (new Uri('//example.com'))->withPort(80);
406
+
407
+ $this->assertSame(80, $uri->getPort());
408
+ $this->assertSame('example.com:80', $uri->getAuthority());
409
+ }
410
+
411
+ public function testStandardPortIsNullIfSchemeChanges()
412
+ {
413
+ $uri = new Uri('http://example.com:443');
414
+ $this->assertSame('http', $uri->getScheme());
415
+ $this->assertSame(443, $uri->getPort());
416
+
417
+ $uri = $uri->withScheme('https');
418
+ $this->assertNull($uri->getPort());
419
+ }
420
+
421
+ public function testPortPassedAsStringIsCastedToInt()
422
+ {
423
+ $uri = (new Uri('//example.com'))->withPort('8080');
424
+
425
+ $this->assertSame(8080, $uri->getPort(), 'Port is returned as integer');
426
+ $this->assertSame('example.com:8080', $uri->getAuthority());
427
+ }
428
+
429
+ public function testPortCanBeRemoved()
430
+ {
431
+ $uri = (new Uri('http://example.com:8080'))->withPort(null);
432
+
433
+ $this->assertNull($uri->getPort());
434
+ $this->assertSame('http://example.com', (string) $uri);
435
+ }
436
+
437
+ public function testAuthorityWithUserInfoButWithoutHost()
438
+ {
439
+ $uri = (new Uri())->withUserInfo('user', 'pass');
440
+
441
+ $this->assertSame('user:pass', $uri->getUserInfo());
442
+ $this->assertSame('', $uri->getAuthority());
443
+ }
444
+
445
+ public function uriComponentsEncodingProvider()
446
+ {
447
+ $unreserved = 'a-zA-Z0-9.-_~!$&\'()*+,;=:@';
448
+
449
+ return [
450
+ // Percent encode spaces
451
+ ['/pa th?q=va lue#frag ment', '/pa%20th', 'q=va%20lue', 'frag%20ment', '/pa%20th?q=va%20lue#frag%20ment'],
452
+ // Percent encode multibyte
453
+ ['/€?€#€', '/%E2%82%AC', '%E2%82%AC', '%E2%82%AC', '/%E2%82%AC?%E2%82%AC#%E2%82%AC'],
454
+ // Don't encode something that's already encoded
455
+ ['/pa%20th?q=va%20lue#frag%20ment', '/pa%20th', 'q=va%20lue', 'frag%20ment', '/pa%20th?q=va%20lue#frag%20ment'],
456
+ // Percent encode invalid percent encodings
457
+ ['/pa%2-th?q=va%2-lue#frag%2-ment', '/pa%252-th', 'q=va%252-lue', 'frag%252-ment', '/pa%252-th?q=va%252-lue#frag%252-ment'],
458
+ // Don't encode path segments
459
+ ['/pa/th//two?q=va/lue#frag/ment', '/pa/th//two', 'q=va/lue', 'frag/ment', '/pa/th//two?q=va/lue#frag/ment'],
460
+ // Don't encode unreserved chars or sub-delimiters
461
+ ["/$unreserved?$unreserved#$unreserved", "/$unreserved", $unreserved, $unreserved, "/$unreserved?$unreserved#$unreserved"],
462
+ // Encoded unreserved chars are not decoded
463
+ ['/p%61th?q=v%61lue#fr%61gment', '/p%61th', 'q=v%61lue', 'fr%61gment', '/p%61th?q=v%61lue#fr%61gment'],
464
+ ];
465
+ }
466
+
467
+ /**
468
+ * @dataProvider uriComponentsEncodingProvider
469
+ */
470
+ public function testUriComponentsGetEncodedProperly($input, $path, $query, $fragment, $output)
471
+ {
472
+ $uri = new Uri($input);
473
+ $this->assertSame($path, $uri->getPath());
474
+ $this->assertSame($query, $uri->getQuery());
475
+ $this->assertSame($fragment, $uri->getFragment());
476
+ $this->assertSame($output, (string) $uri);
477
+ }
478
+
479
+ public function testWithPathEncodesProperly()
480
+ {
481
+ $uri = (new Uri())->withPath('/baz?#€/b%61r');
482
+ // Query and fragment delimiters and multibyte chars are encoded.
483
+ $this->assertSame('/baz%3F%23%E2%82%AC/b%61r', $uri->getPath());
484
+ $this->assertSame('/baz%3F%23%E2%82%AC/b%61r', (string) $uri);
485
+ }
486
+
487
+ public function testWithQueryEncodesProperly()
488
+ {
489
+ $uri = (new Uri())->withQuery('?=#&€=/&b%61r');
490
+ // A query starting with a "?" is valid and must not be magically removed. Otherwise it would be impossible to
491
+ // construct such an URI. Also the "?" and "/" does not need to be encoded in the query.
492
+ $this->assertSame('?=%23&%E2%82%AC=/&b%61r', $uri->getQuery());
493
+ $this->assertSame('??=%23&%E2%82%AC=/&b%61r', (string) $uri);
494
+ }
495
+
496
+ public function testWithFragmentEncodesProperly()
497
+ {
498
+ $uri = (new Uri())->withFragment('#€?/b%61r');
499
+ // A fragment starting with a "#" is valid and must not be magically removed. Otherwise it would be impossible to
500
+ // construct such an URI. Also the "?" and "/" does not need to be encoded in the fragment.
501
+ $this->assertSame('%23%E2%82%AC?/b%61r', $uri->getFragment());
502
+ $this->assertSame('#%23%E2%82%AC?/b%61r', (string) $uri);
503
+ }
504
+
505
+ public function testAllowsForRelativeUri()
506
+ {
507
+ $uri = (new Uri)->withPath('foo');
508
+ $this->assertSame('foo', $uri->getPath());
509
+ $this->assertSame('foo', (string) $uri);
510
+ }
511
+
512
+ public function testAddsSlashForRelativeUriStringWithHost()
513
+ {
514
+ // If the path is rootless and an authority is present, the path MUST
515
+ // be prefixed by "/".
516
+ $uri = (new Uri)->withPath('foo')->withHost('example.com');
517
+ $this->assertSame('foo', $uri->getPath());
518
+ // concatenating a relative path with a host doesn't work: "//example.comfoo" would be wrong
519
+ $this->assertSame('//example.com/foo', (string) $uri);
520
+ }
521
+
522
+ public function testRemoveExtraSlashesWihoutHost()
523
+ {
524
+ // If the path is starting with more than one "/" and no authority is
525
+ // present, the starting slashes MUST be reduced to one.
526
+ $uri = (new Uri)->withPath('//foo');
527
+ $this->assertSame('//foo', $uri->getPath());
528
+ // URI "//foo" would be interpreted as network reference and thus change the original path to the host
529
+ $this->assertSame('/foo', (string) $uri);
530
+ }
531
+
532
+ public function testDefaultReturnValuesOfGetters()
533
+ {
534
+ $uri = new Uri();
535
+
536
+ $this->assertSame('', $uri->getScheme());
537
+ $this->assertSame('', $uri->getAuthority());
538
+ $this->assertSame('', $uri->getUserInfo());
539
+ $this->assertSame('', $uri->getHost());
540
+ $this->assertNull($uri->getPort());
541
+ $this->assertSame('', $uri->getPath());
542
+ $this->assertSame('', $uri->getQuery());
543
+ $this->assertSame('', $uri->getFragment());
544
+ }
545
+
546
+ public function testImmutability()
547
+ {
548
+ $uri = new Uri();
549
+
550
+ $this->assertNotSame($uri, $uri->withScheme('https'));
551
+ $this->assertNotSame($uri, $uri->withUserInfo('user', 'pass'));
552
+ $this->assertNotSame($uri, $uri->withHost('example.com'));
553
+ $this->assertNotSame($uri, $uri->withPort(8080));
554
+ $this->assertNotSame($uri, $uri->withPath('/path/123'));
555
+ $this->assertNotSame($uri, $uri->withQuery('q=abc'));
556
+ $this->assertNotSame($uri, $uri->withFragment('test'));
557
+ }
558
+
559
+ public function testExtendingClassesInstantiates()
560
+ {
561
+ // The non-standard port triggers a cascade of private methods which
562
+ // should not use late static binding to access private static members.
563
+ // If they do, this will fatal.
564
+ $this->assertInstanceOf(
565
+ '\GuzzleHttp\Tests\Psr7\ExtendingClassTest',
566
+ new ExtendingClassTest('http://h:9/')
567
+ );
568
+ }
569
+ }
570
+
571
+ class ExtendingClassTest extends \GuzzleHttp\Psr7\Uri
572
+ {
573
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/guzzlehttp/psr7/tests/bootstrap.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace GuzzleHttp\Tests\Psr7;
3
+
4
+ require __DIR__ . '/../vendor/autoload.php';
5
+
6
+ class HasToString
7
+ {
8
+ public function __toString() {
9
+ return 'foo';
10
+ }
11
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Access/Authorizable.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth\Access;
4
+
5
+ interface Authorizable
6
+ {
7
+ /**
8
+ * Determine if the entity has a given ability.
9
+ *
10
+ * @param string $ability
11
+ * @param array|mixed $arguments
12
+ * @return bool
13
+ */
14
+ public function can($ability, $arguments = []);
15
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Access/Gate.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth\Access;
4
+
5
+ interface Gate
6
+ {
7
+ /**
8
+ * Determine if a given ability has been defined.
9
+ *
10
+ * @param string $ability
11
+ * @return bool
12
+ */
13
+ public function has($ability);
14
+
15
+ /**
16
+ * Define a new ability.
17
+ *
18
+ * @param string $ability
19
+ * @param callable|string $callback
20
+ * @return $this
21
+ */
22
+ public function define($ability, $callback);
23
+
24
+ /**
25
+ * Define a policy class for a given class type.
26
+ *
27
+ * @param string $class
28
+ * @param string $policy
29
+ * @return $this
30
+ */
31
+ public function policy($class, $policy);
32
+
33
+ /**
34
+ * Register a callback to run before all Gate checks.
35
+ *
36
+ * @param callable $callback
37
+ * @return $this
38
+ */
39
+ public function before(callable $callback);
40
+
41
+ /**
42
+ * Register a callback to run after all Gate checks.
43
+ *
44
+ * @param callable $callback
45
+ * @return $this
46
+ */
47
+ public function after(callable $callback);
48
+
49
+ /**
50
+ * Determine if the given ability should be granted for the current user.
51
+ *
52
+ * @param string $ability
53
+ * @param array|mixed $arguments
54
+ * @return bool
55
+ */
56
+ public function allows($ability, $arguments = []);
57
+
58
+ /**
59
+ * Determine if the given ability should be denied for the current user.
60
+ *
61
+ * @param string $ability
62
+ * @param array|mixed $arguments
63
+ * @return bool
64
+ */
65
+ public function denies($ability, $arguments = []);
66
+
67
+ /**
68
+ * Determine if the given ability should be granted.
69
+ *
70
+ * @param string $ability
71
+ * @param array|mixed $arguments
72
+ * @return bool
73
+ */
74
+ public function check($ability, $arguments = []);
75
+
76
+ /**
77
+ * Determine if the given ability should be granted for the current user.
78
+ *
79
+ * @param string $ability
80
+ * @param array|mixed $arguments
81
+ * @return \Illuminate\Auth\Access\Response
82
+ *
83
+ * @throws \Illuminate\Auth\Access\AuthorizationException
84
+ */
85
+ public function authorize($ability, $arguments = []);
86
+
87
+ /**
88
+ * Get a policy instance for a given class.
89
+ *
90
+ * @param object|string $class
91
+ * @return mixed
92
+ *
93
+ * @throws \InvalidArgumentException
94
+ */
95
+ public function getPolicyFor($class);
96
+
97
+ /**
98
+ * Get a guard instance for the given user.
99
+ *
100
+ * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user
101
+ * @return static
102
+ */
103
+ public function forUser($user);
104
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Authenticatable.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth;
4
+
5
+ interface Authenticatable
6
+ {
7
+ /**
8
+ * Get the name of the unique identifier for the user.
9
+ *
10
+ * @return string
11
+ */
12
+ public function getAuthIdentifierName();
13
+
14
+ /**
15
+ * Get the unique identifier for the user.
16
+ *
17
+ * @return mixed
18
+ */
19
+ public function getAuthIdentifier();
20
+
21
+ /**
22
+ * Get the password for the user.
23
+ *
24
+ * @return string
25
+ */
26
+ public function getAuthPassword();
27
+
28
+ /**
29
+ * Get the token value for the "remember me" session.
30
+ *
31
+ * @return string
32
+ */
33
+ public function getRememberToken();
34
+
35
+ /**
36
+ * Set the token value for the "remember me" session.
37
+ *
38
+ * @param string $value
39
+ * @return void
40
+ */
41
+ public function setRememberToken($value);
42
+
43
+ /**
44
+ * Get the column name for the "remember me" token.
45
+ *
46
+ * @return string
47
+ */
48
+ public function getRememberTokenName();
49
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/CanResetPassword.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth;
4
+
5
+ interface CanResetPassword
6
+ {
7
+ /**
8
+ * Get the e-mail address where password reset links are sent.
9
+ *
10
+ * @return string
11
+ */
12
+ public function getEmailForPasswordReset();
13
+
14
+ /**
15
+ * Send the password reset notification.
16
+ *
17
+ * @param string $token
18
+ * @return void
19
+ */
20
+ public function sendPasswordResetNotification($token);
21
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Factory.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth;
4
+
5
+ interface Factory
6
+ {
7
+ /**
8
+ * Get a guard instance by name.
9
+ *
10
+ * @param string|null $name
11
+ * @return mixed
12
+ */
13
+ public function guard($name = null);
14
+
15
+ /**
16
+ * Set the default guard the factory should serve.
17
+ *
18
+ * @param string $name
19
+ * @return void
20
+ */
21
+ public function shouldUse($name);
22
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/Guard.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth;
4
+
5
+ interface Guard
6
+ {
7
+ /**
8
+ * Determine if the current user is authenticated.
9
+ *
10
+ * @return bool
11
+ */
12
+ public function check();
13
+
14
+ /**
15
+ * Determine if the current user is a guest.
16
+ *
17
+ * @return bool
18
+ */
19
+ public function guest();
20
+
21
+ /**
22
+ * Get the currently authenticated user.
23
+ *
24
+ * @return \Illuminate\Contracts\Auth\Authenticatable|null
25
+ */
26
+ public function user();
27
+
28
+ /**
29
+ * Get the ID for the currently authenticated user.
30
+ *
31
+ * @return int|null
32
+ */
33
+ public function id();
34
+
35
+ /**
36
+ * Validate a user's credentials.
37
+ *
38
+ * @param array $credentials
39
+ * @return bool
40
+ */
41
+ public function validate(array $credentials = []);
42
+
43
+ /**
44
+ * Set the current user.
45
+ *
46
+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
47
+ * @return void
48
+ */
49
+ public function setUser(Authenticatable $user);
50
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/PasswordBroker.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth;
4
+
5
+ use Closure;
6
+
7
+ interface PasswordBroker
8
+ {
9
+ /**
10
+ * Constant representing a successfully sent reminder.
11
+ *
12
+ * @var string
13
+ */
14
+ const RESET_LINK_SENT = 'passwords.sent';
15
+
16
+ /**
17
+ * Constant representing a successfully reset password.
18
+ *
19
+ * @var string
20
+ */
21
+ const PASSWORD_RESET = 'passwords.reset';
22
+
23
+ /**
24
+ * Constant representing the user not found response.
25
+ *
26
+ * @var string
27
+ */
28
+ const INVALID_USER = 'passwords.user';
29
+
30
+ /**
31
+ * Constant representing an invalid password.
32
+ *
33
+ * @var string
34
+ */
35
+ const INVALID_PASSWORD = 'passwords.password';
36
+
37
+ /**
38
+ * Constant representing an invalid token.
39
+ *
40
+ * @var string
41
+ */
42
+ const INVALID_TOKEN = 'passwords.token';
43
+
44
+ /**
45
+ * Send a password reset link to a user.
46
+ *
47
+ * @param array $credentials
48
+ * @return string
49
+ */
50
+ public function sendResetLink(array $credentials);
51
+
52
+ /**
53
+ * Reset the password for the given token.
54
+ *
55
+ * @param array $credentials
56
+ * @param \Closure $callback
57
+ * @return mixed
58
+ */
59
+ public function reset(array $credentials, Closure $callback);
60
+
61
+ /**
62
+ * Set a custom password validator.
63
+ *
64
+ * @param \Closure $callback
65
+ * @return void
66
+ */
67
+ public function validator(Closure $callback);
68
+
69
+ /**
70
+ * Determine if the passwords match for the request.
71
+ *
72
+ * @param array $credentials
73
+ * @return bool
74
+ */
75
+ public function validateNewPassword(array $credentials);
76
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/PasswordBrokerFactory.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth;
4
+
5
+ interface PasswordBrokerFactory
6
+ {
7
+ /**
8
+ * Get a password broker instance by name.
9
+ *
10
+ * @param string|null $name
11
+ * @return mixed
12
+ */
13
+ public function broker($name = null);
14
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/StatefulGuard.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth;
4
+
5
+ interface StatefulGuard extends Guard
6
+ {
7
+ /**
8
+ * Attempt to authenticate a user using the given credentials.
9
+ *
10
+ * @param array $credentials
11
+ * @param bool $remember
12
+ * @param bool $login
13
+ * @return bool
14
+ */
15
+ public function attempt(array $credentials = [], $remember = false, $login = true);
16
+
17
+ /**
18
+ * Log a user into the application without sessions or cookies.
19
+ *
20
+ * @param array $credentials
21
+ * @return bool
22
+ */
23
+ public function once(array $credentials = []);
24
+
25
+ /**
26
+ * Log a user into the application.
27
+ *
28
+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
29
+ * @param bool $remember
30
+ * @return void
31
+ */
32
+ public function login(Authenticatable $user, $remember = false);
33
+
34
+ /**
35
+ * Log the given user ID into the application.
36
+ *
37
+ * @param mixed $id
38
+ * @param bool $remember
39
+ * @return \Illuminate\Contracts\Auth\Authenticatable
40
+ */
41
+ public function loginUsingId($id, $remember = false);
42
+
43
+ /**
44
+ * Log the given user ID into the application without sessions or cookies.
45
+ *
46
+ * @param mixed $id
47
+ * @return bool
48
+ */
49
+ public function onceUsingId($id);
50
+
51
+ /**
52
+ * Determine if the user was authenticated via "remember me" cookie.
53
+ *
54
+ * @return bool
55
+ */
56
+ public function viaRemember();
57
+
58
+ /**
59
+ * Log the user out of the application.
60
+ *
61
+ * @return void
62
+ */
63
+ public function logout();
64
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/SupportsBasicAuth.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth;
4
+
5
+ interface SupportsBasicAuth
6
+ {
7
+ /**
8
+ * Attempt to authenticate using HTTP Basic Auth.
9
+ *
10
+ * @param string $field
11
+ * @param array $extraConditions
12
+ * @return \Symfony\Component\HttpFoundation\Response|null
13
+ */
14
+ public function basic($field = 'email', $extraConditions = []);
15
+
16
+ /**
17
+ * Perform a stateless HTTP Basic login attempt.
18
+ *
19
+ * @param string $field
20
+ * @param array $extraConditions
21
+ * @return \Symfony\Component\HttpFoundation\Response|null
22
+ */
23
+ public function onceBasic($field = 'email', $extraConditions = []);
24
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Auth/UserProvider.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Auth;
4
+
5
+ interface UserProvider
6
+ {
7
+ /**
8
+ * Retrieve a user by their unique identifier.
9
+ *
10
+ * @param mixed $identifier
11
+ * @return \Illuminate\Contracts\Auth\Authenticatable|null
12
+ */
13
+ public function retrieveById($identifier);
14
+
15
+ /**
16
+ * Retrieve a user by their unique identifier and "remember me" token.
17
+ *
18
+ * @param mixed $identifier
19
+ * @param string $token
20
+ * @return \Illuminate\Contracts\Auth\Authenticatable|null
21
+ */
22
+ public function retrieveByToken($identifier, $token);
23
+
24
+ /**
25
+ * Update the "remember me" token for the given user in storage.
26
+ *
27
+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
28
+ * @param string $token
29
+ * @return void
30
+ */
31
+ public function updateRememberToken(Authenticatable $user, $token);
32
+
33
+ /**
34
+ * Retrieve a user by the given credentials.
35
+ *
36
+ * @param array $credentials
37
+ * @return \Illuminate\Contracts\Auth\Authenticatable|null
38
+ */
39
+ public function retrieveByCredentials(array $credentials);
40
+
41
+ /**
42
+ * Validate a user against the given credentials.
43
+ *
44
+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
45
+ * @param array $credentials
46
+ * @return bool
47
+ */
48
+ public function validateCredentials(Authenticatable $user, array $credentials);
49
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Broadcasting/Broadcaster.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Broadcasting;
4
+
5
+ interface Broadcaster
6
+ {
7
+ /**
8
+ * Authenticate the incoming request for a given channel.
9
+ *
10
+ * @param \Illuminate\Http\Request $request
11
+ * @return mixed
12
+ */
13
+ public function auth($request);
14
+
15
+ /**
16
+ * Return the valid authentication response.
17
+ *
18
+ * @param \Illuminate\Http\Request $request
19
+ * @param mixed $result
20
+ * @return mixed
21
+ */
22
+ public function validAuthenticationResponse($request, $result);
23
+
24
+ /**
25
+ * Broadcast the given event.
26
+ *
27
+ * @param array $channels
28
+ * @param string $event
29
+ * @param array $payload
30
+ * @return void
31
+ */
32
+ public function broadcast(array $channels, $event, array $payload = []);
33
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Broadcasting/Factory.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Broadcasting;
4
+
5
+ interface Factory
6
+ {
7
+ /**
8
+ * Get a broadcaster implementation by name.
9
+ *
10
+ * @param string $name
11
+ * @return void
12
+ */
13
+ public function connection($name = null);
14
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Broadcasting/ShouldBroadcast.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Broadcasting;
4
+
5
+ interface ShouldBroadcast
6
+ {
7
+ /**
8
+ * Get the channels the event should broadcast on.
9
+ *
10
+ * @return array
11
+ */
12
+ public function broadcastOn();
13
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Broadcasting/ShouldBroadcastNow.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Broadcasting;
4
+
5
+ interface ShouldBroadcastNow extends ShouldBroadcast
6
+ {
7
+ //
8
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Bus/Dispatcher.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Bus;
4
+
5
+ interface Dispatcher
6
+ {
7
+ /**
8
+ * Dispatch a command to its appropriate handler.
9
+ *
10
+ * @param mixed $command
11
+ * @return mixed
12
+ */
13
+ public function dispatch($command);
14
+
15
+ /**
16
+ * Dispatch a command to its appropriate handler in the current process.
17
+ *
18
+ * @param mixed $command
19
+ * @param mixed $handler
20
+ * @return mixed
21
+ */
22
+ public function dispatchNow($command, $handler = null);
23
+
24
+ /**
25
+ * Set the pipes commands should be piped through before dispatching.
26
+ *
27
+ * @param array $pipes
28
+ * @return $this
29
+ */
30
+ public function pipeThrough(array $pipes);
31
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Bus/QueueingDispatcher.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Bus;
4
+
5
+ interface QueueingDispatcher extends Dispatcher
6
+ {
7
+ /**
8
+ * Dispatch a command to its appropriate handler behind a queue.
9
+ *
10
+ * @param mixed $command
11
+ * @return mixed
12
+ */
13
+ public function dispatchToQueue($command);
14
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cache/Factory.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Cache;
4
+
5
+ interface Factory
6
+ {
7
+ /**
8
+ * Get a cache store instance by name.
9
+ *
10
+ * @param string|null $name
11
+ * @return mixed
12
+ */
13
+ public function store($name = null);
14
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cache/Repository.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Cache;
4
+
5
+ use Closure;
6
+
7
+ interface Repository
8
+ {
9
+ /**
10
+ * Determine if an item exists in the cache.
11
+ *
12
+ * @param string $key
13
+ * @return bool
14
+ */
15
+ public function has($key);
16
+
17
+ /**
18
+ * Retrieve an item from the cache by key.
19
+ *
20
+ * @param string $key
21
+ * @param mixed $default
22
+ * @return mixed
23
+ */
24
+ public function get($key, $default = null);
25
+
26
+ /**
27
+ * Retrieve an item from the cache and delete it.
28
+ *
29
+ * @param string $key
30
+ * @param mixed $default
31
+ * @return mixed
32
+ */
33
+ public function pull($key, $default = null);
34
+
35
+ /**
36
+ * Store an item in the cache.
37
+ *
38
+ * @param string $key
39
+ * @param mixed $value
40
+ * @param \DateTime|float|int $minutes
41
+ * @return void
42
+ */
43
+ public function put($key, $value, $minutes);
44
+
45
+ /**
46
+ * Store an item in the cache if the key does not exist.
47
+ *
48
+ * @param string $key
49
+ * @param mixed $value
50
+ * @param \DateTime|float|int $minutes
51
+ * @return bool
52
+ */
53
+ public function add($key, $value, $minutes);
54
+
55
+ /**
56
+ * Increment the value of an item in the cache.
57
+ *
58
+ * @param string $key
59
+ * @param mixed $value
60
+ * @return int|bool
61
+ */
62
+ public function increment($key, $value = 1);
63
+
64
+ /**
65
+ * Decrement the value of an item in the cache.
66
+ *
67
+ * @param string $key
68
+ * @param mixed $value
69
+ * @return int|bool
70
+ */
71
+ public function decrement($key, $value = 1);
72
+
73
+ /**
74
+ * Store an item in the cache indefinitely.
75
+ *
76
+ * @param string $key
77
+ * @param mixed $value
78
+ * @return void
79
+ */
80
+ public function forever($key, $value);
81
+
82
+ /**
83
+ * Get an item from the cache, or store the default value.
84
+ *
85
+ * @param string $key
86
+ * @param \DateTime|float|int $minutes
87
+ * @param \Closure $callback
88
+ * @return mixed
89
+ */
90
+ public function remember($key, $minutes, Closure $callback);
91
+
92
+ /**
93
+ * Get an item from the cache, or store the default value forever.
94
+ *
95
+ * @param string $key
96
+ * @param \Closure $callback
97
+ * @return mixed
98
+ */
99
+ public function sear($key, Closure $callback);
100
+
101
+ /**
102
+ * Get an item from the cache, or store the default value forever.
103
+ *
104
+ * @param string $key
105
+ * @param \Closure $callback
106
+ * @return mixed
107
+ */
108
+ public function rememberForever($key, Closure $callback);
109
+
110
+ /**
111
+ * Remove an item from the cache.
112
+ *
113
+ * @param string $key
114
+ * @return bool
115
+ */
116
+ public function forget($key);
117
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cache/Store.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Cache;
4
+
5
+ interface Store
6
+ {
7
+ /**
8
+ * Retrieve an item from the cache by key.
9
+ *
10
+ * @param string|array $key
11
+ * @return mixed
12
+ */
13
+ public function get($key);
14
+
15
+ /**
16
+ * Retrieve multiple items from the cache by key.
17
+ *
18
+ * Items not found in the cache will have a null value.
19
+ *
20
+ * @param array $keys
21
+ * @return array
22
+ */
23
+ public function many(array $keys);
24
+
25
+ /**
26
+ * Store an item in the cache for a given number of minutes.
27
+ *
28
+ * @param string $key
29
+ * @param mixed $value
30
+ * @param float|int $minutes
31
+ * @return void
32
+ */
33
+ public function put($key, $value, $minutes);
34
+
35
+ /**
36
+ * Store multiple items in the cache for a given number of minutes.
37
+ *
38
+ * @param array $values
39
+ * @param float|int $minutes
40
+ * @return void
41
+ */
42
+ public function putMany(array $values, $minutes);
43
+
44
+ /**
45
+ * Increment the value of an item in the cache.
46
+ *
47
+ * @param string $key
48
+ * @param mixed $value
49
+ * @return int|bool
50
+ */
51
+ public function increment($key, $value = 1);
52
+
53
+ /**
54
+ * Decrement the value of an item in the cache.
55
+ *
56
+ * @param string $key
57
+ * @param mixed $value
58
+ * @return int|bool
59
+ */
60
+ public function decrement($key, $value = 1);
61
+
62
+ /**
63
+ * Store an item in the cache indefinitely.
64
+ *
65
+ * @param string $key
66
+ * @param mixed $value
67
+ * @return void
68
+ */
69
+ public function forever($key, $value);
70
+
71
+ /**
72
+ * Remove an item from the cache.
73
+ *
74
+ * @param string $key
75
+ * @return bool
76
+ */
77
+ public function forget($key);
78
+
79
+ /**
80
+ * Remove all items from the cache.
81
+ *
82
+ * @return void
83
+ */
84
+ public function flush();
85
+
86
+ /**
87
+ * Get the cache key prefix.
88
+ *
89
+ * @return string
90
+ */
91
+ public function getPrefix();
92
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Config/Repository.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Config;
4
+
5
+ interface Repository
6
+ {
7
+ /**
8
+ * Determine if the given configuration value exists.
9
+ *
10
+ * @param string $key
11
+ * @return bool
12
+ */
13
+ public function has($key);
14
+
15
+ /**
16
+ * Get the specified configuration value.
17
+ *
18
+ * @param string $key
19
+ * @param mixed $default
20
+ * @return mixed
21
+ */
22
+ public function get($key, $default = null);
23
+
24
+ /**
25
+ * Get all of the configuration items for the application.
26
+ *
27
+ * @return array
28
+ */
29
+ public function all();
30
+
31
+ /**
32
+ * Set a given configuration value.
33
+ *
34
+ * @param array|string $key
35
+ * @param mixed $value
36
+ * @return void
37
+ */
38
+ public function set($key, $value = null);
39
+
40
+ /**
41
+ * Prepend a value onto an array configuration value.
42
+ *
43
+ * @param string $key
44
+ * @param mixed $value
45
+ * @return void
46
+ */
47
+ public function prepend($key, $value);
48
+
49
+ /**
50
+ * Push a value onto an array configuration value.
51
+ *
52
+ * @param string $key
53
+ * @param mixed $value
54
+ * @return void
55
+ */
56
+ public function push($key, $value);
57
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Console/Application.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Console;
4
+
5
+ interface Application
6
+ {
7
+ /**
8
+ * Call a console application command.
9
+ *
10
+ * @param string $command
11
+ * @param array $parameters
12
+ * @return int
13
+ */
14
+ public function call($command, array $parameters = []);
15
+
16
+ /**
17
+ * Get the output from the last command.
18
+ *
19
+ * @return string
20
+ */
21
+ public function output();
22
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Console/Kernel.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Console;
4
+
5
+ interface Kernel
6
+ {
7
+ /**
8
+ * Handle an incoming console command.
9
+ *
10
+ * @param \Symfony\Component\Console\Input\InputInterface $input
11
+ * @param \Symfony\Component\Console\Output\OutputInterface $output
12
+ * @return int
13
+ */
14
+ public function handle($input, $output = null);
15
+
16
+ /**
17
+ * Run an Artisan console command by name.
18
+ *
19
+ * @param string $command
20
+ * @param array $parameters
21
+ * @return int
22
+ */
23
+ public function call($command, array $parameters = []);
24
+
25
+ /**
26
+ * Queue an Artisan console command by name.
27
+ *
28
+ * @param string $command
29
+ * @param array $parameters
30
+ * @return int
31
+ */
32
+ public function queue($command, array $parameters = []);
33
+
34
+ /**
35
+ * Get all of the commands registered with the console.
36
+ *
37
+ * @return array
38
+ */
39
+ public function all();
40
+
41
+ /**
42
+ * Get the output for the last run command.
43
+ *
44
+ * @return string
45
+ */
46
+ public function output();
47
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Container/BindingResolutionException.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Container;
4
+
5
+ use Exception;
6
+
7
+ class BindingResolutionException extends Exception
8
+ {
9
+ //
10
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Container/Container.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Container;
4
+
5
+ use Closure;
6
+
7
+ interface Container
8
+ {
9
+ /**
10
+ * Determine if the given abstract type has been bound.
11
+ *
12
+ * @param string $abstract
13
+ * @return bool
14
+ */
15
+ public function bound($abstract);
16
+
17
+ /**
18
+ * Alias a type to a different name.
19
+ *
20
+ * @param string $abstract
21
+ * @param string $alias
22
+ * @return void
23
+ */
24
+ public function alias($abstract, $alias);
25
+
26
+ /**
27
+ * Assign a set of tags to a given binding.
28
+ *
29
+ * @param array|string $abstracts
30
+ * @param array|mixed ...$tags
31
+ * @return void
32
+ */
33
+ public function tag($abstracts, $tags);
34
+
35
+ /**
36
+ * Resolve all of the bindings for a given tag.
37
+ *
38
+ * @param array $tag
39
+ * @return array
40
+ */
41
+ public function tagged($tag);
42
+
43
+ /**
44
+ * Register a binding with the container.
45
+ *
46
+ * @param string|array $abstract
47
+ * @param \Closure|string|null $concrete
48
+ * @param bool $shared
49
+ * @return void
50
+ */
51
+ public function bind($abstract, $concrete = null, $shared = false);
52
+
53
+ /**
54
+ * Register a binding if it hasn't already been registered.
55
+ *
56
+ * @param string $abstract
57
+ * @param \Closure|string|null $concrete
58
+ * @param bool $shared
59
+ * @return void
60
+ */
61
+ public function bindIf($abstract, $concrete = null, $shared = false);
62
+
63
+ /**
64
+ * Register a shared binding in the container.
65
+ *
66
+ * @param string|array $abstract
67
+ * @param \Closure|string|null $concrete
68
+ * @return void
69
+ */
70
+ public function singleton($abstract, $concrete = null);
71
+
72
+ /**
73
+ * "Extend" an abstract type in the container.
74
+ *
75
+ * @param string $abstract
76
+ * @param \Closure $closure
77
+ * @return void
78
+ *
79
+ * @throws \InvalidArgumentException
80
+ */
81
+ public function extend($abstract, Closure $closure);
82
+
83
+ /**
84
+ * Register an existing instance as shared in the container.
85
+ *
86
+ * @param string $abstract
87
+ * @param mixed $instance
88
+ * @return void
89
+ */
90
+ public function instance($abstract, $instance);
91
+
92
+ /**
93
+ * Define a contextual binding.
94
+ *
95
+ * @param string $concrete
96
+ * @return \Illuminate\Contracts\Container\ContextualBindingBuilder
97
+ */
98
+ public function when($concrete);
99
+
100
+ /**
101
+ * Resolve the given type from the container.
102
+ *
103
+ * @param string $abstract
104
+ * @param array $parameters
105
+ * @return mixed
106
+ */
107
+ public function make($abstract, array $parameters = []);
108
+
109
+ /**
110
+ * Call the given Closure / class@method and inject its dependencies.
111
+ *
112
+ * @param callable|string $callback
113
+ * @param array $parameters
114
+ * @param string|null $defaultMethod
115
+ * @return mixed
116
+ */
117
+ public function call($callback, array $parameters = [], $defaultMethod = null);
118
+
119
+ /**
120
+ * Determine if the given abstract type has been resolved.
121
+ *
122
+ * @param string $abstract
123
+ * @return bool
124
+ */
125
+ public function resolved($abstract);
126
+
127
+ /**
128
+ * Register a new resolving callback.
129
+ *
130
+ * @param string $abstract
131
+ * @param \Closure|null $callback
132
+ * @return void
133
+ */
134
+ public function resolving($abstract, Closure $callback = null);
135
+
136
+ /**
137
+ * Register a new after resolving callback.
138
+ *
139
+ * @param string $abstract
140
+ * @param \Closure|null $callback
141
+ * @return void
142
+ */
143
+ public function afterResolving($abstract, Closure $callback = null);
144
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Container/ContextualBindingBuilder.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Container;
4
+
5
+ interface ContextualBindingBuilder
6
+ {
7
+ /**
8
+ * Define the abstract target that depends on the context.
9
+ *
10
+ * @param string $abstract
11
+ * @return $this
12
+ */
13
+ public function needs($abstract);
14
+
15
+ /**
16
+ * Define the implementation for the contextual binding.
17
+ *
18
+ * @param \Closure|string $implementation
19
+ * @return void
20
+ */
21
+ public function give($implementation);
22
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cookie/Factory.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Cookie;
4
+
5
+ interface Factory
6
+ {
7
+ /**
8
+ * Create a new cookie instance.
9
+ *
10
+ * @param string $name
11
+ * @param string $value
12
+ * @param int $minutes
13
+ * @param string $path
14
+ * @param string $domain
15
+ * @param bool $secure
16
+ * @param bool $httpOnly
17
+ * @return \Symfony\Component\HttpFoundation\Cookie
18
+ */
19
+ public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true);
20
+
21
+ /**
22
+ * Create a cookie that lasts "forever" (five years).
23
+ *
24
+ * @param string $name
25
+ * @param string $value
26
+ * @param string $path
27
+ * @param string $domain
28
+ * @param bool $secure
29
+ * @param bool $httpOnly
30
+ * @return \Symfony\Component\HttpFoundation\Cookie
31
+ */
32
+ public function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true);
33
+
34
+ /**
35
+ * Expire the given cookie.
36
+ *
37
+ * @param string $name
38
+ * @param string $path
39
+ * @param string $domain
40
+ * @return \Symfony\Component\HttpFoundation\Cookie
41
+ */
42
+ public function forget($name, $path = null, $domain = null);
43
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Cookie/QueueingFactory.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Cookie;
4
+
5
+ interface QueueingFactory extends Factory
6
+ {
7
+ /**
8
+ * Queue a cookie to send with the next response.
9
+ *
10
+ * @return void
11
+ */
12
+ public function queue();
13
+
14
+ /**
15
+ * Remove a cookie from the queue.
16
+ *
17
+ * @param string $name
18
+ */
19
+ public function unqueue($name);
20
+
21
+ /**
22
+ * Get the cookies which have been queued for the next request.
23
+ *
24
+ * @return array
25
+ */
26
+ public function getQueuedCookies();
27
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Database/ModelIdentifier.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Database;
4
+
5
+ class ModelIdentifier
6
+ {
7
+ /**
8
+ * The class name of the model.
9
+ *
10
+ * @var string
11
+ */
12
+ public $class;
13
+
14
+ /**
15
+ * The unique identifier of the model.
16
+ *
17
+ * This may be either a single ID or an array of IDs.
18
+ *
19
+ * @var mixed
20
+ */
21
+ public $id;
22
+
23
+ /**
24
+ * Create a new model identifier.
25
+ *
26
+ * @param string $class
27
+ * @param mixed $id
28
+ * @return void
29
+ */
30
+ public function __construct($class, $id)
31
+ {
32
+ $this->id = $id;
33
+ $this->class = $class;
34
+ }
35
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Debug/ExceptionHandler.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Debug;
4
+
5
+ use Exception;
6
+
7
+ interface ExceptionHandler
8
+ {
9
+ /**
10
+ * Report or log an exception.
11
+ *
12
+ * @param \Exception $e
13
+ * @return void
14
+ */
15
+ public function report(Exception $e);
16
+
17
+ /**
18
+ * Render an exception into an HTTP response.
19
+ *
20
+ * @param \Illuminate\Http\Request $request
21
+ * @param \Exception $e
22
+ * @return \Symfony\Component\HttpFoundation\Response
23
+ */
24
+ public function render($request, Exception $e);
25
+
26
+ /**
27
+ * Render an exception to the console.
28
+ *
29
+ * @param \Symfony\Component\Console\Output\OutputInterface $output
30
+ * @param \Exception $e
31
+ * @return void
32
+ */
33
+ public function renderForConsole($output, Exception $e);
34
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Encryption/DecryptException.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Encryption;
4
+
5
+ use RuntimeException;
6
+
7
+ class DecryptException extends RuntimeException
8
+ {
9
+ //
10
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Encryption/EncryptException.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Encryption;
4
+
5
+ use RuntimeException;
6
+
7
+ class EncryptException extends RuntimeException
8
+ {
9
+ //
10
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Encryption/Encrypter.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Encryption;
4
+
5
+ interface Encrypter
6
+ {
7
+ /**
8
+ * Encrypt the given value.
9
+ *
10
+ * @param string $value
11
+ * @return string
12
+ */
13
+ public function encrypt($value);
14
+
15
+ /**
16
+ * Decrypt the given value.
17
+ *
18
+ * @param string $payload
19
+ * @return string
20
+ */
21
+ public function decrypt($payload);
22
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Events/Dispatcher.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Events;
4
+
5
+ interface Dispatcher
6
+ {
7
+ /**
8
+ * Register an event listener with the dispatcher.
9
+ *
10
+ * @param string|array $events
11
+ * @param mixed $listener
12
+ * @param int $priority
13
+ * @return void
14
+ */
15
+ public function listen($events, $listener, $priority = 0);
16
+
17
+ /**
18
+ * Determine if a given event has listeners.
19
+ *
20
+ * @param string $eventName
21
+ * @return bool
22
+ */
23
+ public function hasListeners($eventName);
24
+
25
+ /**
26
+ * Register an event and payload to be fired later.
27
+ *
28
+ * @param string $event
29
+ * @param array $payload
30
+ * @return void
31
+ */
32
+ public function push($event, $payload = []);
33
+
34
+ /**
35
+ * Register an event subscriber with the dispatcher.
36
+ *
37
+ * @param object|string $subscriber
38
+ * @return void
39
+ */
40
+ public function subscribe($subscriber);
41
+
42
+ /**
43
+ * Fire an event until the first non-null response is returned.
44
+ *
45
+ * @param string $event
46
+ * @param array $payload
47
+ * @return mixed
48
+ */
49
+ public function until($event, $payload = []);
50
+
51
+ /**
52
+ * Flush a set of pushed events.
53
+ *
54
+ * @param string $event
55
+ * @return void
56
+ */
57
+ public function flush($event);
58
+
59
+ /**
60
+ * Fire an event and call the listeners.
61
+ *
62
+ * @param string|object $event
63
+ * @param mixed $payload
64
+ * @param bool $halt
65
+ * @return array|null
66
+ */
67
+ public function fire($event, $payload = [], $halt = false);
68
+
69
+ /**
70
+ * Get the event that is currently firing.
71
+ *
72
+ * @return string
73
+ */
74
+ public function firing();
75
+
76
+ /**
77
+ * Remove a set of listeners from the dispatcher.
78
+ *
79
+ * @param string $event
80
+ * @return void
81
+ */
82
+ public function forget($event);
83
+
84
+ /**
85
+ * Forget all of the queued listeners.
86
+ *
87
+ * @return void
88
+ */
89
+ public function forgetPushed();
90
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Filesystem/Cloud.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Filesystem;
4
+
5
+ interface Cloud extends Filesystem
6
+ {
7
+ /**
8
+ * Get the URL for the file at the given path.
9
+ *
10
+ * @param string $path
11
+ * @return string
12
+ */
13
+ public function url($path);
14
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Filesystem/Factory.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Filesystem;
4
+
5
+ interface Factory
6
+ {
7
+ /**
8
+ * Get a filesystem implementation.
9
+ *
10
+ * @param string $name
11
+ * @return \Illuminate\Contracts\Filesystem\Filesystem
12
+ */
13
+ public function disk($name = null);
14
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Filesystem/FileNotFoundException.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Filesystem;
4
+
5
+ use Exception;
6
+
7
+ class FileNotFoundException extends Exception
8
+ {
9
+ //
10
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Filesystem/Filesystem.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Filesystem;
4
+
5
+ interface Filesystem
6
+ {
7
+ /**
8
+ * The public visibility setting.
9
+ *
10
+ * @var string
11
+ */
12
+ const VISIBILITY_PUBLIC = 'public';
13
+
14
+ /**
15
+ * The private visibility setting.
16
+ *
17
+ * @var string
18
+ */
19
+ const VISIBILITY_PRIVATE = 'private';
20
+
21
+ /**
22
+ * Determine if a file exists.
23
+ *
24
+ * @param string $path
25
+ * @return bool
26
+ */
27
+ public function exists($path);
28
+
29
+ /**
30
+ * Get the contents of a file.
31
+ *
32
+ * @param string $path
33
+ * @return string
34
+ *
35
+ * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
36
+ */
37
+ public function get($path);
38
+
39
+ /**
40
+ * Write the contents of a file.
41
+ *
42
+ * @param string $path
43
+ * @param string|resource $contents
44
+ * @param string $visibility
45
+ * @return bool
46
+ */
47
+ public function put($path, $contents, $visibility = null);
48
+
49
+ /**
50
+ * Get the visibility for the given path.
51
+ *
52
+ * @param string $path
53
+ * @return string
54
+ */
55
+ public function getVisibility($path);
56
+
57
+ /**
58
+ * Set the visibility for the given path.
59
+ *
60
+ * @param string $path
61
+ * @param string $visibility
62
+ * @return void
63
+ */
64
+ public function setVisibility($path, $visibility);
65
+
66
+ /**
67
+ * Prepend to a file.
68
+ *
69
+ * @param string $path
70
+ * @param string $data
71
+ * @return int
72
+ */
73
+ public function prepend($path, $data);
74
+
75
+ /**
76
+ * Append to a file.
77
+ *
78
+ * @param string $path
79
+ * @param string $data
80
+ * @return int
81
+ */
82
+ public function append($path, $data);
83
+
84
+ /**
85
+ * Delete the file at a given path.
86
+ *
87
+ * @param string|array $paths
88
+ * @return bool
89
+ */
90
+ public function delete($paths);
91
+
92
+ /**
93
+ * Copy a file to a new location.
94
+ *
95
+ * @param string $from
96
+ * @param string $to
97
+ * @return bool
98
+ */
99
+ public function copy($from, $to);
100
+
101
+ /**
102
+ * Move a file to a new location.
103
+ *
104
+ * @param string $from
105
+ * @param string $to
106
+ * @return bool
107
+ */
108
+ public function move($from, $to);
109
+
110
+ /**
111
+ * Get the file size of a given file.
112
+ *
113
+ * @param string $path
114
+ * @return int
115
+ */
116
+ public function size($path);
117
+
118
+ /**
119
+ * Get the file's last modification time.
120
+ *
121
+ * @param string $path
122
+ * @return int
123
+ */
124
+ public function lastModified($path);
125
+
126
+ /**
127
+ * Get an array of all files in a directory.
128
+ *
129
+ * @param string|null $directory
130
+ * @param bool $recursive
131
+ * @return array
132
+ */
133
+ public function files($directory = null, $recursive = false);
134
+
135
+ /**
136
+ * Get all of the files from the given directory (recursive).
137
+ *
138
+ * @param string|null $directory
139
+ * @return array
140
+ */
141
+ public function allFiles($directory = null);
142
+
143
+ /**
144
+ * Get all of the directories within a given directory.
145
+ *
146
+ * @param string|null $directory
147
+ * @param bool $recursive
148
+ * @return array
149
+ */
150
+ public function directories($directory = null, $recursive = false);
151
+
152
+ /**
153
+ * Get all (recursive) of the directories within a given directory.
154
+ *
155
+ * @param string|null $directory
156
+ * @return array
157
+ */
158
+ public function allDirectories($directory = null);
159
+
160
+ /**
161
+ * Create a directory.
162
+ *
163
+ * @param string $path
164
+ * @return bool
165
+ */
166
+ public function makeDirectory($path);
167
+
168
+ /**
169
+ * Recursively delete a directory.
170
+ *
171
+ * @param string $directory
172
+ * @return bool
173
+ */
174
+ public function deleteDirectory($directory);
175
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Foundation/Application.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Foundation;
4
+
5
+ use Illuminate\Contracts\Container\Container;
6
+
7
+ interface Application extends Container
8
+ {
9
+ /**
10
+ * Get the version number of the application.
11
+ *
12
+ * @return string
13
+ */
14
+ public function version();
15
+
16
+ /**
17
+ * Get the base path of the Laravel installation.
18
+ *
19
+ * @return string
20
+ */
21
+ public function basePath();
22
+
23
+ /**
24
+ * Get or check the current application environment.
25
+ *
26
+ * @return string
27
+ */
28
+ public function environment();
29
+
30
+ /**
31
+ * Determine if the application is currently down for maintenance.
32
+ *
33
+ * @return bool
34
+ */
35
+ public function isDownForMaintenance();
36
+
37
+ /**
38
+ * Register all of the configured providers.
39
+ *
40
+ * @return void
41
+ */
42
+ public function registerConfiguredProviders();
43
+
44
+ /**
45
+ * Register a service provider with the application.
46
+ *
47
+ * @param \Illuminate\Support\ServiceProvider|string $provider
48
+ * @param array $options
49
+ * @param bool $force
50
+ * @return \Illuminate\Support\ServiceProvider
51
+ */
52
+ public function register($provider, $options = [], $force = false);
53
+
54
+ /**
55
+ * Register a deferred provider and service.
56
+ *
57
+ * @param string $provider
58
+ * @param string $service
59
+ * @return void
60
+ */
61
+ public function registerDeferredProvider($provider, $service = null);
62
+
63
+ /**
64
+ * Boot the application's service providers.
65
+ *
66
+ * @return void
67
+ */
68
+ public function boot();
69
+
70
+ /**
71
+ * Register a new boot listener.
72
+ *
73
+ * @param mixed $callback
74
+ * @return void
75
+ */
76
+ public function booting($callback);
77
+
78
+ /**
79
+ * Register a new "booted" listener.
80
+ *
81
+ * @param mixed $callback
82
+ * @return void
83
+ */
84
+ public function booted($callback);
85
+
86
+ /**
87
+ * Get the path to the cached "compiled.php" file.
88
+ *
89
+ * @return string
90
+ */
91
+ public function getCachedCompilePath();
92
+
93
+ /**
94
+ * Get the path to the cached services.php file.
95
+ *
96
+ * @return string
97
+ */
98
+ public function getCachedServicesPath();
99
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Hashing/Hasher.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Hashing;
4
+
5
+ interface Hasher
6
+ {
7
+ /**
8
+ * Hash the given value.
9
+ *
10
+ * @param string $value
11
+ * @param array $options
12
+ * @return string
13
+ */
14
+ public function make($value, array $options = []);
15
+
16
+ /**
17
+ * Check the given plain value against a hash.
18
+ *
19
+ * @param string $value
20
+ * @param string $hashedValue
21
+ * @param array $options
22
+ * @return bool
23
+ */
24
+ public function check($value, $hashedValue, array $options = []);
25
+
26
+ /**
27
+ * Check if the given hash has been hashed using the given options.
28
+ *
29
+ * @param string $hashedValue
30
+ * @param array $options
31
+ * @return bool
32
+ */
33
+ public function needsRehash($hashedValue, array $options = []);
34
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Http/Kernel.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Http;
4
+
5
+ interface Kernel
6
+ {
7
+ /**
8
+ * Bootstrap the application for HTTP requests.
9
+ *
10
+ * @return void
11
+ */
12
+ public function bootstrap();
13
+
14
+ /**
15
+ * Handle an incoming HTTP request.
16
+ *
17
+ * @param \Symfony\Component\HttpFoundation\Request $request
18
+ * @return \Symfony\Component\HttpFoundation\Response
19
+ */
20
+ public function handle($request);
21
+
22
+ /**
23
+ * Perform any final actions for the request lifecycle.
24
+ *
25
+ * @param \Symfony\Component\HttpFoundation\Request $request
26
+ * @param \Symfony\Component\HttpFoundation\Response $response
27
+ * @return void
28
+ */
29
+ public function terminate($request, $response);
30
+
31
+ /**
32
+ * Get the Laravel application instance.
33
+ *
34
+ * @return \Illuminate\Contracts\Foundation\Application
35
+ */
36
+ public function getApplication();
37
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Logging/Log.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Logging;
4
+
5
+ interface Log
6
+ {
7
+ /**
8
+ * Log an alert message to the logs.
9
+ *
10
+ * @param string $message
11
+ * @param array $context
12
+ * @return void
13
+ */
14
+ public function alert($message, array $context = []);
15
+
16
+ /**
17
+ * Log a critical message to the logs.
18
+ *
19
+ * @param string $message
20
+ * @param array $context
21
+ * @return void
22
+ */
23
+ public function critical($message, array $context = []);
24
+
25
+ /**
26
+ * Log an error message to the logs.
27
+ *
28
+ * @param string $message
29
+ * @param array $context
30
+ * @return void
31
+ */
32
+ public function error($message, array $context = []);
33
+
34
+ /**
35
+ * Log a warning message to the logs.
36
+ *
37
+ * @param string $message
38
+ * @param array $context
39
+ * @return void
40
+ */
41
+ public function warning($message, array $context = []);
42
+
43
+ /**
44
+ * Log a notice to the logs.
45
+ *
46
+ * @param string $message
47
+ * @param array $context
48
+ * @return void
49
+ */
50
+ public function notice($message, array $context = []);
51
+
52
+ /**
53
+ * Log an informational message to the logs.
54
+ *
55
+ * @param string $message
56
+ * @param array $context
57
+ * @return void
58
+ */
59
+ public function info($message, array $context = []);
60
+
61
+ /**
62
+ * Log a debug message to the logs.
63
+ *
64
+ * @param string $message
65
+ * @param array $context
66
+ * @return void
67
+ */
68
+ public function debug($message, array $context = []);
69
+
70
+ /**
71
+ * Log a message to the logs.
72
+ *
73
+ * @param string $level
74
+ * @param string $message
75
+ * @param array $context
76
+ * @return void
77
+ */
78
+ public function log($level, $message, array $context = []);
79
+
80
+ /**
81
+ * Register a file log handler.
82
+ *
83
+ * @param string $path
84
+ * @param string $level
85
+ * @return void
86
+ */
87
+ public function useFiles($path, $level = 'debug');
88
+
89
+ /**
90
+ * Register a daily file log handler.
91
+ *
92
+ * @param string $path
93
+ * @param int $days
94
+ * @param string $level
95
+ * @return void
96
+ */
97
+ public function useDailyFiles($path, $days = 0, $level = 'debug');
98
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Mail/MailQueue.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Mail;
4
+
5
+ interface MailQueue
6
+ {
7
+ /**
8
+ * Queue a new e-mail message for sending.
9
+ *
10
+ * @param string|array $view
11
+ * @param array $data
12
+ * @param \Closure|string $callback
13
+ * @param string $queue
14
+ * @return mixed
15
+ */
16
+ public function queue($view, array $data, $callback, $queue = null);
17
+
18
+ /**
19
+ * Queue a new e-mail message for sending after (n) seconds.
20
+ *
21
+ * @param int $delay
22
+ * @param string|array $view
23
+ * @param array $data
24
+ * @param \Closure|string $callback
25
+ * @param string $queue
26
+ * @return mixed
27
+ */
28
+ public function later($delay, $view, array $data, $callback, $queue = null);
29
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Mail/Mailable.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Mail;
4
+
5
+ use Illuminate\Contracts\Queue\Factory as Queue;
6
+
7
+ interface Mailable
8
+ {
9
+ /**
10
+ * Send the message using the given mailer.
11
+ *
12
+ * @param Mailer $mailer
13
+ * @return void
14
+ */
15
+ public function send(Mailer $mailer);
16
+
17
+ /**
18
+ * Queue the given message.
19
+ *
20
+ * @param Queue $queue
21
+ * @return mixed
22
+ */
23
+ public function queue(Queue $queue);
24
+
25
+ /**
26
+ * Deliver the queued message after the given delay.
27
+ *
28
+ * @param \DateTime|int $delay
29
+ * @param Queue $queue
30
+ * @return mixed
31
+ */
32
+ public function later($delay, Queue $queue);
33
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Mail/Mailer.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Mail;
4
+
5
+ interface Mailer
6
+ {
7
+ /**
8
+ * Send a new message when only a raw text part.
9
+ *
10
+ * @param string $text
11
+ * @param \Closure|string $callback
12
+ * @return int
13
+ */
14
+ public function raw($text, $callback);
15
+
16
+ /**
17
+ * Send a new message using a view.
18
+ *
19
+ * @param string|array $view
20
+ * @param array $data
21
+ * @param \Closure|string $callback
22
+ * @return void
23
+ */
24
+ public function send($view, array $data = [], $callback = null);
25
+
26
+ /**
27
+ * Get the array of failed recipients.
28
+ *
29
+ * @return array
30
+ */
31
+ public function failures();
32
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Notifications/Dispatcher.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Notifications;
4
+
5
+ interface Dispatcher
6
+ {
7
+ /**
8
+ * Send the given notification to the given notifiable entities.
9
+ *
10
+ * @param \Illuminate\Support\Collection|array|mixed $notifiables
11
+ * @param mixed $notification
12
+ * @return void
13
+ */
14
+ public function send($notifiables, $notification);
15
+
16
+ /**
17
+ * Send the given notification immediately.
18
+ *
19
+ * @param \Illuminate\Support\Collection|array|mixed $notifiables
20
+ * @param mixed $notification
21
+ * @return void
22
+ */
23
+ public function sendNow($notifiables, $notification);
24
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Notifications/Factory.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Notifications;
4
+
5
+ interface Factory
6
+ {
7
+ /**
8
+ * Get a channel instance by name.
9
+ *
10
+ * @param string|null $name
11
+ * @return mixed
12
+ */
13
+ public function channel($name = null);
14
+
15
+ /**
16
+ * Send the given notification to the given notifiable entities.
17
+ *
18
+ * @param \Illuminate\Support\Collection|array|mixed $notifiables
19
+ * @param mixed $notification
20
+ * @return void
21
+ */
22
+ public function send($notifiables, $notification);
23
+
24
+ /**
25
+ * Send the given notification immediately.
26
+ *
27
+ * @param \Illuminate\Support\Collection|array|mixed $notifiables
28
+ * @param mixed $notification
29
+ * @return void
30
+ */
31
+ public function sendNow($notifiables, $notification);
32
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Pagination/LengthAwarePaginator.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Pagination;
4
+
5
+ interface LengthAwarePaginator extends Paginator
6
+ {
7
+ /**
8
+ * Determine the total number of items in the data store.
9
+ *
10
+ * @return int
11
+ */
12
+ public function total();
13
+
14
+ /**
15
+ * Get the page number of the last available page.
16
+ *
17
+ * @return int
18
+ */
19
+ public function lastPage();
20
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Pagination/Paginator.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Pagination;
4
+
5
+ interface Paginator
6
+ {
7
+ /**
8
+ * Get the URL for a given page.
9
+ *
10
+ * @param int $page
11
+ * @return string
12
+ */
13
+ public function url($page);
14
+
15
+ /**
16
+ * Add a set of query string values to the paginator.
17
+ *
18
+ * @param array|string $key
19
+ * @param string|null $value
20
+ * @return $this
21
+ */
22
+ public function appends($key, $value = null);
23
+
24
+ /**
25
+ * Get / set the URL fragment to be appended to URLs.
26
+ *
27
+ * @param string|null $fragment
28
+ * @return $this|string
29
+ */
30
+ public function fragment($fragment = null);
31
+
32
+ /**
33
+ * The URL for the next page, or null.
34
+ *
35
+ * @return string|null
36
+ */
37
+ public function nextPageUrl();
38
+
39
+ /**
40
+ * Get the URL for the previous page, or null.
41
+ *
42
+ * @return string|null
43
+ */
44
+ public function previousPageUrl();
45
+
46
+ /**
47
+ * Get all of the items being paginated.
48
+ *
49
+ * @return array
50
+ */
51
+ public function items();
52
+
53
+ /**
54
+ * Get the "index" of the first item being paginated.
55
+ *
56
+ * @return int
57
+ */
58
+ public function firstItem();
59
+
60
+ /**
61
+ * Get the "index" of the last item being paginated.
62
+ *
63
+ * @return int
64
+ */
65
+ public function lastItem();
66
+
67
+ /**
68
+ * Determine how many items are being shown per page.
69
+ *
70
+ * @return int
71
+ */
72
+ public function perPage();
73
+
74
+ /**
75
+ * Determine the current page being paginated.
76
+ *
77
+ * @return int
78
+ */
79
+ public function currentPage();
80
+
81
+ /**
82
+ * Determine if there are enough items to split into multiple pages.
83
+ *
84
+ * @return bool
85
+ */
86
+ public function hasPages();
87
+
88
+ /**
89
+ * Determine if there is more items in the data store.
90
+ *
91
+ * @return bool
92
+ */
93
+ public function hasMorePages();
94
+
95
+ /**
96
+ * Determine if the list of items is empty or not.
97
+ *
98
+ * @return bool
99
+ */
100
+ public function isEmpty();
101
+
102
+ /**
103
+ * Render the paginator using a given view.
104
+ *
105
+ * @param string|null $view
106
+ * @return string
107
+ */
108
+ public function render($view = null);
109
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Pipeline/Hub.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Pipeline;
4
+
5
+ interface Hub
6
+ {
7
+ /**
8
+ * Send an object through one of the available pipelines.
9
+ *
10
+ * @param mixed $object
11
+ * @param string|null $pipeline
12
+ * @return mixed
13
+ */
14
+ public function pipe($object, $pipeline = null);
15
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Pipeline/Pipeline.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Pipeline;
4
+
5
+ use Closure;
6
+
7
+ interface Pipeline
8
+ {
9
+ /**
10
+ * Set the traveler object being sent on the pipeline.
11
+ *
12
+ * @param mixed $traveler
13
+ * @return $this
14
+ */
15
+ public function send($traveler);
16
+
17
+ /**
18
+ * Set the stops of the pipeline.
19
+ *
20
+ * @param dynamic|array $stops
21
+ * @return $this
22
+ */
23
+ public function through($stops);
24
+
25
+ /**
26
+ * Set the method to call on the stops.
27
+ *
28
+ * @param string $method
29
+ * @return $this
30
+ */
31
+ public function via($method);
32
+
33
+ /**
34
+ * Run the pipeline with a final destination callback.
35
+ *
36
+ * @param \Closure $destination
37
+ * @return mixed
38
+ */
39
+ public function then(Closure $destination);
40
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/EntityNotFoundException.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Queue;
4
+
5
+ use InvalidArgumentException;
6
+
7
+ class EntityNotFoundException extends InvalidArgumentException
8
+ {
9
+ /**
10
+ * Create a new exception instance.
11
+ *
12
+ * @param string $type
13
+ * @param mixed $id
14
+ * @return void
15
+ */
16
+ public function __construct($type, $id)
17
+ {
18
+ $id = (string) $id;
19
+
20
+ parent::__construct("Queueable entity [{$type}] not found for ID [{$id}].");
21
+ }
22
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/EntityResolver.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Queue;
4
+
5
+ interface EntityResolver
6
+ {
7
+ /**
8
+ * Resolve the entity for the given ID.
9
+ *
10
+ * @param string $type
11
+ * @param mixed $id
12
+ * @return mixed
13
+ */
14
+ public function resolve($type, $id);
15
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/Factory.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Queue;
4
+
5
+ interface Factory
6
+ {
7
+ /**
8
+ * Resolve a queue connection instance.
9
+ *
10
+ * @param string $name
11
+ * @return \Illuminate\Contracts\Queue\Queue
12
+ */
13
+ public function connection($name = null);
14
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/Job.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Queue;
4
+
5
+ interface Job
6
+ {
7
+ /**
8
+ * Fire the job.
9
+ *
10
+ * @return void
11
+ */
12
+ public function fire();
13
+
14
+ /**
15
+ * Delete the job from the queue.
16
+ *
17
+ * @return void
18
+ */
19
+ public function delete();
20
+
21
+ /**
22
+ * Determine if the job has been deleted.
23
+ *
24
+ * @return bool
25
+ */
26
+ public function isDeleted();
27
+
28
+ /**
29
+ * Release the job back into the queue.
30
+ *
31
+ * @param int $delay
32
+ * @return void
33
+ */
34
+ public function release($delay = 0);
35
+
36
+ /**
37
+ * Determine if the job has been deleted or released.
38
+ *
39
+ * @return bool
40
+ */
41
+ public function isDeletedOrReleased();
42
+
43
+ /**
44
+ * Get the number of times the job has been attempted.
45
+ *
46
+ * @return int
47
+ */
48
+ public function attempts();
49
+
50
+ /**
51
+ * Get the name of the queued job class.
52
+ *
53
+ * @return string
54
+ */
55
+ public function getName();
56
+
57
+ /**
58
+ * Get the resolved name of the queued job class.
59
+ *
60
+ * @return string
61
+ */
62
+ public function resolveName();
63
+
64
+ /**
65
+ * Call the failed method on the job instance.
66
+ *
67
+ * @param \Throwable $e
68
+ * @return void
69
+ */
70
+ public function failed($e);
71
+
72
+ /**
73
+ * Get the name of the queue the job belongs to.
74
+ *
75
+ * @return string
76
+ */
77
+ public function getQueue();
78
+
79
+ /**
80
+ * Get the raw body string for the job.
81
+ *
82
+ * @return string
83
+ */
84
+ public function getRawBody();
85
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/Monitor.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Queue;
4
+
5
+ interface Monitor
6
+ {
7
+ /**
8
+ * Register a callback to be executed on every iteration through the queue loop.
9
+ *
10
+ * @param mixed $callback
11
+ * @return void
12
+ */
13
+ public function looping($callback);
14
+
15
+ /**
16
+ * Register a callback to be executed when a job fails after the maximum amount of retries.
17
+ *
18
+ * @param mixed $callback
19
+ * @return void
20
+ */
21
+ public function failing($callback);
22
+
23
+ /**
24
+ * Register a callback to be executed when a daemon queue is stopping.
25
+ *
26
+ * @param mixed $callback
27
+ * @return void
28
+ */
29
+ public function stopping($callback);
30
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/Queue.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Queue;
4
+
5
+ interface Queue
6
+ {
7
+ /**
8
+ * Get the size of the queue.
9
+ *
10
+ * @param string $queue
11
+ * @return int
12
+ */
13
+ public function size($queue = null);
14
+
15
+ /**
16
+ * Push a new job onto the queue.
17
+ *
18
+ * @param string $job
19
+ * @param mixed $data
20
+ * @param string $queue
21
+ * @return mixed
22
+ */
23
+ public function push($job, $data = '', $queue = null);
24
+
25
+ /**
26
+ * Push a raw payload onto the queue.
27
+ *
28
+ * @param string $payload
29
+ * @param string $queue
30
+ * @param array $options
31
+ * @return mixed
32
+ */
33
+ public function pushRaw($payload, $queue = null, array $options = []);
34
+
35
+ /**
36
+ * Push a new job onto the queue after a delay.
37
+ *
38
+ * @param \DateTime|int $delay
39
+ * @param string $job
40
+ * @param mixed $data
41
+ * @param string $queue
42
+ * @return mixed
43
+ */
44
+ public function later($delay, $job, $data = '', $queue = null);
45
+
46
+ /**
47
+ * Push a new job onto the queue.
48
+ *
49
+ * @param string $queue
50
+ * @param string $job
51
+ * @param mixed $data
52
+ * @return mixed
53
+ */
54
+ public function pushOn($queue, $job, $data = '');
55
+
56
+ /**
57
+ * Push a new job onto the queue after a delay.
58
+ *
59
+ * @param string $queue
60
+ * @param \DateTime|int $delay
61
+ * @param string $job
62
+ * @param mixed $data
63
+ * @return mixed
64
+ */
65
+ public function laterOn($queue, $delay, $job, $data = '');
66
+
67
+ /**
68
+ * Pop the next job off of the queue.
69
+ *
70
+ * @param string $queue
71
+ * @return \Illuminate\Contracts\Queue\Job|null
72
+ */
73
+ public function pop($queue = null);
74
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/QueueableCollection.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Queue;
4
+
5
+ interface QueueableCollection
6
+ {
7
+ /**
8
+ * Get the type of the entities being queued.
9
+ *
10
+ * @return string|null
11
+ */
12
+ public function getQueueableClass();
13
+
14
+ /**
15
+ * Get the identifiers for all of the entities.
16
+ *
17
+ * @return array
18
+ */
19
+ public function getQueueableIds();
20
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/QueueableEntity.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Queue;
4
+
5
+ interface QueueableEntity
6
+ {
7
+ /**
8
+ * Get the queueable identity for the entity.
9
+ *
10
+ * @return mixed
11
+ */
12
+ public function getQueueableId();
13
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Queue/ShouldQueue.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Queue;
4
+
5
+ interface ShouldQueue
6
+ {
7
+ //
8
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Redis/Database.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Redis;
4
+
5
+ interface Database
6
+ {
7
+ /**
8
+ * Run a command against the Redis database.
9
+ *
10
+ * @param string $method
11
+ * @param array $parameters
12
+ * @return mixed
13
+ */
14
+ public function command($method, array $parameters = []);
15
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Routing/Registrar.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Routing;
4
+
5
+ use Closure;
6
+
7
+ interface Registrar
8
+ {
9
+ /**
10
+ * Register a new GET route with the router.
11
+ *
12
+ * @param string $uri
13
+ * @param \Closure|array|string $action
14
+ * @return void
15
+ */
16
+ public function get($uri, $action);
17
+
18
+ /**
19
+ * Register a new POST route with the router.
20
+ *
21
+ * @param string $uri
22
+ * @param \Closure|array|string $action
23
+ * @return void
24
+ */
25
+ public function post($uri, $action);
26
+
27
+ /**
28
+ * Register a new PUT route with the router.
29
+ *
30
+ * @param string $uri
31
+ * @param \Closure|array|string $action
32
+ * @return void
33
+ */
34
+ public function put($uri, $action);
35
+
36
+ /**
37
+ * Register a new DELETE route with the router.
38
+ *
39
+ * @param string $uri
40
+ * @param \Closure|array|string $action
41
+ * @return void
42
+ */
43
+ public function delete($uri, $action);
44
+
45
+ /**
46
+ * Register a new PATCH route with the router.
47
+ *
48
+ * @param string $uri
49
+ * @param \Closure|array|string $action
50
+ * @return void
51
+ */
52
+ public function patch($uri, $action);
53
+
54
+ /**
55
+ * Register a new OPTIONS route with the router.
56
+ *
57
+ * @param string $uri
58
+ * @param \Closure|array|string $action
59
+ * @return void
60
+ */
61
+ public function options($uri, $action);
62
+
63
+ /**
64
+ * Register a new route with the given verbs.
65
+ *
66
+ * @param array|string $methods
67
+ * @param string $uri
68
+ * @param \Closure|array|string $action
69
+ * @return void
70
+ */
71
+ public function match($methods, $uri, $action);
72
+
73
+ /**
74
+ * Route a resource to a controller.
75
+ *
76
+ * @param string $name
77
+ * @param string $controller
78
+ * @param array $options
79
+ * @return void
80
+ */
81
+ public function resource($name, $controller, array $options = []);
82
+
83
+ /**
84
+ * Create a route group with shared attributes.
85
+ *
86
+ * @param array $attributes
87
+ * @param \Closure $callback
88
+ * @return void
89
+ */
90
+ public function group(array $attributes, Closure $callback);
91
+
92
+ /**
93
+ * Substitute the route bindings onto the route.
94
+ *
95
+ * @param \Illuminate\Routing\Route $route
96
+ * @return \Illuminate\Routing\Route
97
+ */
98
+ public function substituteBindings($route);
99
+
100
+ /**
101
+ * Substitute the implicit Eloquent model bindings for the route.
102
+ *
103
+ * @param \Illuminate\Routing\Route $route
104
+ * @return void
105
+ */
106
+ public function substituteImplicitBindings($route);
107
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Routing/ResponseFactory.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Routing;
4
+
5
+ interface ResponseFactory
6
+ {
7
+ /**
8
+ * Return a new response from the application.
9
+ *
10
+ * @param string $content
11
+ * @param int $status
12
+ * @param array $headers
13
+ * @return \Illuminate\Http\Response
14
+ */
15
+ public function make($content = '', $status = 200, array $headers = []);
16
+
17
+ /**
18
+ * Return a new view response from the application.
19
+ *
20
+ * @param string $view
21
+ * @param array $data
22
+ * @param int $status
23
+ * @param array $headers
24
+ * @return \Illuminate\Http\Response
25
+ */
26
+ public function view($view, $data = [], $status = 200, array $headers = []);
27
+
28
+ /**
29
+ * Return a new JSON response from the application.
30
+ *
31
+ * @param string|array $data
32
+ * @param int $status
33
+ * @param array $headers
34
+ * @param int $options
35
+ * @return \Illuminate\Http\JsonResponse
36
+ */
37
+ public function json($data = [], $status = 200, array $headers = [], $options = 0);
38
+
39
+ /**
40
+ * Return a new JSONP response from the application.
41
+ *
42
+ * @param string $callback
43
+ * @param string|array $data
44
+ * @param int $status
45
+ * @param array $headers
46
+ * @param int $options
47
+ * @return \Illuminate\Http\JsonResponse
48
+ */
49
+ public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0);
50
+
51
+ /**
52
+ * Return a new streamed response from the application.
53
+ *
54
+ * @param \Closure $callback
55
+ * @param int $status
56
+ * @param array $headers
57
+ * @return \Symfony\Component\HttpFoundation\StreamedResponse
58
+ */
59
+ public function stream($callback, $status = 200, array $headers = []);
60
+
61
+ /**
62
+ * Create a new file download response.
63
+ *
64
+ * @param \SplFileInfo|string $file
65
+ * @param string $name
66
+ * @param array $headers
67
+ * @param string|null $disposition
68
+ * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
69
+ */
70
+ public function download($file, $name = null, array $headers = [], $disposition = 'attachment');
71
+
72
+ /**
73
+ * Create a new redirect response to the given path.
74
+ *
75
+ * @param string $path
76
+ * @param int $status
77
+ * @param array $headers
78
+ * @param bool|null $secure
79
+ * @return \Illuminate\Http\RedirectResponse
80
+ */
81
+ public function redirectTo($path, $status = 302, $headers = [], $secure = null);
82
+
83
+ /**
84
+ * Create a new redirect response to a named route.
85
+ *
86
+ * @param string $route
87
+ * @param array $parameters
88
+ * @param int $status
89
+ * @param array $headers
90
+ * @return \Illuminate\Http\RedirectResponse
91
+ */
92
+ public function redirectToRoute($route, $parameters = [], $status = 302, $headers = []);
93
+
94
+ /**
95
+ * Create a new redirect response to a controller action.
96
+ *
97
+ * @param string $action
98
+ * @param array $parameters
99
+ * @param int $status
100
+ * @param array $headers
101
+ * @return \Illuminate\Http\RedirectResponse
102
+ */
103
+ public function redirectToAction($action, $parameters = [], $status = 302, $headers = []);
104
+
105
+ /**
106
+ * Create a new redirect response, while putting the current URL in the session.
107
+ *
108
+ * @param string $path
109
+ * @param int $status
110
+ * @param array $headers
111
+ * @param bool|null $secure
112
+ * @return \Illuminate\Http\RedirectResponse
113
+ */
114
+ public function redirectGuest($path, $status = 302, $headers = [], $secure = null);
115
+
116
+ /**
117
+ * Create a new redirect response to the previously intended location.
118
+ *
119
+ * @param string $default
120
+ * @param int $status
121
+ * @param array $headers
122
+ * @param bool|null $secure
123
+ * @return \Illuminate\Http\RedirectResponse
124
+ */
125
+ public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null);
126
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Routing/UrlGenerator.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Routing;
4
+
5
+ interface UrlGenerator
6
+ {
7
+ /**
8
+ * Get the current URL for the request.
9
+ *
10
+ * @return string
11
+ */
12
+ public function current();
13
+
14
+ /**
15
+ * Generate an absolute URL to the given path.
16
+ *
17
+ * @param string $path
18
+ * @param mixed $extra
19
+ * @param bool $secure
20
+ * @return string
21
+ */
22
+ public function to($path, $extra = [], $secure = null);
23
+
24
+ /**
25
+ * Generate a secure, absolute URL to the given path.
26
+ *
27
+ * @param string $path
28
+ * @param array $parameters
29
+ * @return string
30
+ */
31
+ public function secure($path, $parameters = []);
32
+
33
+ /**
34
+ * Generate the URL to an application asset.
35
+ *
36
+ * @param string $path
37
+ * @param bool $secure
38
+ * @return string
39
+ */
40
+ public function asset($path, $secure = null);
41
+
42
+ /**
43
+ * Get the URL to a named route.
44
+ *
45
+ * @param string $name
46
+ * @param mixed $parameters
47
+ * @param bool $absolute
48
+ * @return string
49
+ *
50
+ * @throws \InvalidArgumentException
51
+ */
52
+ public function route($name, $parameters = [], $absolute = true);
53
+
54
+ /**
55
+ * Get the URL to a controller action.
56
+ *
57
+ * @param string $action
58
+ * @param mixed $parameters
59
+ * @param bool $absolute
60
+ * @return string
61
+ */
62
+ public function action($action, $parameters = [], $absolute = true);
63
+
64
+ /**
65
+ * Set the root controller namespace.
66
+ *
67
+ * @param string $rootNamespace
68
+ * @return $this
69
+ */
70
+ public function setRootControllerNamespace($rootNamespace);
71
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Routing/UrlRoutable.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Routing;
4
+
5
+ interface UrlRoutable
6
+ {
7
+ /**
8
+ * Get the value of the model's route key.
9
+ *
10
+ * @return mixed
11
+ */
12
+ public function getRouteKey();
13
+
14
+ /**
15
+ * Get the route key for the model.
16
+ *
17
+ * @return string
18
+ */
19
+ public function getRouteKeyName();
20
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/Arrayable.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Support;
4
+
5
+ interface Arrayable
6
+ {
7
+ /**
8
+ * Get the instance as an array.
9
+ *
10
+ * @return array
11
+ */
12
+ public function toArray();
13
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/Htmlable.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Support;
4
+
5
+ interface Htmlable
6
+ {
7
+ /**
8
+ * Get content as a string of HTML.
9
+ *
10
+ * @return string
11
+ */
12
+ public function toHtml();
13
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/Jsonable.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Support;
4
+
5
+ interface Jsonable
6
+ {
7
+ /**
8
+ * Convert the object to its JSON representation.
9
+ *
10
+ * @param int $options
11
+ * @return string
12
+ */
13
+ public function toJson($options = 0);
14
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/MessageBag.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Support;
4
+
5
+ interface MessageBag
6
+ {
7
+ /**
8
+ * Get the keys present in the message bag.
9
+ *
10
+ * @return array
11
+ */
12
+ public function keys();
13
+
14
+ /**
15
+ * Add a message to the bag.
16
+ *
17
+ * @param string $key
18
+ * @param string $message
19
+ * @return $this
20
+ */
21
+ public function add($key, $message);
22
+
23
+ /**
24
+ * Merge a new array of messages into the bag.
25
+ *
26
+ * @param \Illuminate\Contracts\Support\MessageProvider|array $messages
27
+ * @return $this
28
+ */
29
+ public function merge($messages);
30
+
31
+ /**
32
+ * Determine if messages exist for a given key.
33
+ *
34
+ * @param string|array $key
35
+ * @return bool
36
+ */
37
+ public function has($key);
38
+
39
+ /**
40
+ * Get the first message from the bag for a given key.
41
+ *
42
+ * @param string $key
43
+ * @param string $format
44
+ * @return string
45
+ */
46
+ public function first($key = null, $format = null);
47
+
48
+ /**
49
+ * Get all of the messages from the bag for a given key.
50
+ *
51
+ * @param string $key
52
+ * @param string $format
53
+ * @return array
54
+ */
55
+ public function get($key, $format = null);
56
+
57
+ /**
58
+ * Get all of the messages for every key in the bag.
59
+ *
60
+ * @param string $format
61
+ * @return array
62
+ */
63
+ public function all($format = null);
64
+
65
+ /**
66
+ * Get the default message format.
67
+ *
68
+ * @return string
69
+ */
70
+ public function getFormat();
71
+
72
+ /**
73
+ * Set the default message format.
74
+ *
75
+ * @param string $format
76
+ * @return $this
77
+ */
78
+ public function setFormat($format = ':message');
79
+
80
+ /**
81
+ * Determine if the message bag has any messages.
82
+ *
83
+ * @return bool
84
+ */
85
+ public function isEmpty();
86
+
87
+ /**
88
+ * Get the number of messages in the container.
89
+ *
90
+ * @return int
91
+ */
92
+ public function count();
93
+
94
+ /**
95
+ * Get the instance as an array.
96
+ *
97
+ * @return array
98
+ */
99
+ public function toArray();
100
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/MessageProvider.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Support;
4
+
5
+ interface MessageProvider
6
+ {
7
+ /**
8
+ * Get the messages for the instance.
9
+ *
10
+ * @return \Illuminate\Contracts\Support\MessageBag
11
+ */
12
+ public function getMessageBag();
13
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Support/Renderable.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Support;
4
+
5
+ interface Renderable
6
+ {
7
+ /**
8
+ * Get the evaluated contents of the object.
9
+ *
10
+ * @return string
11
+ */
12
+ public function render();
13
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Validation/Factory.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Validation;
4
+
5
+ interface Factory
6
+ {
7
+ /**
8
+ * Create a new Validator instance.
9
+ *
10
+ * @param array $data
11
+ * @param array $rules
12
+ * @param array $messages
13
+ * @param array $customAttributes
14
+ * @return \Illuminate\Contracts\Validation\Validator
15
+ */
16
+ public function make(array $data, array $rules, array $messages = [], array $customAttributes = []);
17
+
18
+ /**
19
+ * Register a custom validator extension.
20
+ *
21
+ * @param string $rule
22
+ * @param \Closure|string $extension
23
+ * @param string $message
24
+ * @return void
25
+ */
26
+ public function extend($rule, $extension, $message = null);
27
+
28
+ /**
29
+ * Register a custom implicit validator extension.
30
+ *
31
+ * @param string $rule
32
+ * @param \Closure|string $extension
33
+ * @param string $message
34
+ * @return void
35
+ */
36
+ public function extendImplicit($rule, $extension, $message = null);
37
+
38
+ /**
39
+ * Register a custom implicit validator message replacer.
40
+ *
41
+ * @param string $rule
42
+ * @param \Closure|string $replacer
43
+ * @return void
44
+ */
45
+ public function replacer($rule, $replacer);
46
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Validation/ValidatesWhenResolved.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Validation;
4
+
5
+ interface ValidatesWhenResolved
6
+ {
7
+ /**
8
+ * Validate the given class instance.
9
+ *
10
+ * @return void
11
+ */
12
+ public function validate();
13
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/Validation/Validator.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\Validation;
4
+
5
+ use Illuminate\Contracts\Support\MessageProvider;
6
+
7
+ interface Validator extends MessageProvider
8
+ {
9
+ /**
10
+ * Determine if the data fails the validation rules.
11
+ *
12
+ * @return bool
13
+ */
14
+ public function fails();
15
+
16
+ /**
17
+ * Get the failed validation rules.
18
+ *
19
+ * @return array
20
+ */
21
+ public function failed();
22
+
23
+ /**
24
+ * Add conditions to a given field based on a Closure.
25
+ *
26
+ * @param string $attribute
27
+ * @param string|array $rules
28
+ * @param callable $callback
29
+ * @return void
30
+ */
31
+ public function sometimes($attribute, $rules, callable $callback);
32
+
33
+ /**
34
+ * After an after validation callback.
35
+ *
36
+ * @param callable|string $callback
37
+ * @return $this
38
+ */
39
+ public function after($callback);
40
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/View/Factory.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\View;
4
+
5
+ interface Factory
6
+ {
7
+ /**
8
+ * Determine if a given view exists.
9
+ *
10
+ * @param string $view
11
+ * @return bool
12
+ */
13
+ public function exists($view);
14
+
15
+ /**
16
+ * Get the evaluated view contents for the given path.
17
+ *
18
+ * @param string $path
19
+ * @param array $data
20
+ * @param array $mergeData
21
+ * @return \Illuminate\Contracts\View\View
22
+ */
23
+ public function file($path, $data = [], $mergeData = []);
24
+
25
+ /**
26
+ * Get the evaluated view contents for the given view.
27
+ *
28
+ * @param string $view
29
+ * @param array $data
30
+ * @param array $mergeData
31
+ * @return \Illuminate\Contracts\View\View
32
+ */
33
+ public function make($view, $data = [], $mergeData = []);
34
+
35
+ /**
36
+ * Add a piece of shared data to the environment.
37
+ *
38
+ * @param array|string $key
39
+ * @param mixed $value
40
+ * @return mixed
41
+ */
42
+ public function share($key, $value = null);
43
+
44
+ /**
45
+ * Register a view composer event.
46
+ *
47
+ * @param array|string $views
48
+ * @param \Closure|string $callback
49
+ * @param int|null $priority
50
+ * @return array
51
+ */
52
+ public function composer($views, $callback, $priority = null);
53
+
54
+ /**
55
+ * Register a view creator event.
56
+ *
57
+ * @param array|string $views
58
+ * @param \Closure|string $callback
59
+ * @return array
60
+ */
61
+ public function creator($views, $callback);
62
+
63
+ /**
64
+ * Add a new namespace to the loader.
65
+ *
66
+ * @param string $namespace
67
+ * @param string|array $hints
68
+ * @return void
69
+ */
70
+ public function addNamespace($namespace, $hints);
71
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/View/View.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Contracts\View;
4
+
5
+ use Illuminate\Contracts\Support\Renderable;
6
+
7
+ interface View extends Renderable
8
+ {
9
+ /**
10
+ * Get the name of the view.
11
+ *
12
+ * @return string
13
+ */
14
+ public function name();
15
+
16
+ /**
17
+ * Add a piece of data to the view.
18
+ *
19
+ * @param string|array $key
20
+ * @param mixed $value
21
+ * @return $this
22
+ */
23
+ public function with($key, $value = null);
24
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/contracts/composer.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "illuminate/contracts",
3
+ "description": "The Illuminate Contracts package.",
4
+ "license": "MIT",
5
+ "homepage": "https://laravel.com",
6
+ "support": {
7
+ "issues": "https://github.com/laravel/framework/issues",
8
+ "source": "https://github.com/laravel/framework"
9
+ },
10
+ "authors": [
11
+ {
12
+ "name": "Taylor Otwell",
13
+ "email": "taylor@laravel.com"
14
+ }
15
+ ],
16
+ "require": {
17
+ "php": ">=5.6.4"
18
+ },
19
+ "autoload": {
20
+ "psr-4": {
21
+ "Illuminate\\Contracts\\": ""
22
+ }
23
+ },
24
+ "extra": {
25
+ "branch-alias": {
26
+ "dev-master": "5.3-dev"
27
+ }
28
+ },
29
+ "minimum-stability": "dev"
30
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/AggregateServiceProvider.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support;
4
+
5
+ class AggregateServiceProvider extends ServiceProvider
6
+ {
7
+ /**
8
+ * The provider class names.
9
+ *
10
+ * @var array
11
+ */
12
+ protected $providers = [];
13
+
14
+ /**
15
+ * An array of the service provider instances.
16
+ *
17
+ * @var array
18
+ */
19
+ protected $instances = [];
20
+
21
+ /**
22
+ * Register the service provider.
23
+ *
24
+ * @return void
25
+ */
26
+ public function register()
27
+ {
28
+ $this->instances = [];
29
+
30
+ foreach ($this->providers as $provider) {
31
+ $this->instances[] = $this->app->register($provider);
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Get the services provided by the provider.
37
+ *
38
+ * @return array
39
+ */
40
+ public function provides()
41
+ {
42
+ $provides = [];
43
+
44
+ foreach ($this->providers as $provider) {
45
+ $instance = $this->app->resolveProviderClass($provider);
46
+
47
+ $provides = array_merge($provides, $instance->provides());
48
+ }
49
+
50
+ return $provides;
51
+ }
52
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Arr.php ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support;
4
+
5
+ use ArrayAccess;
6
+ use Illuminate\Support\Traits\Macroable;
7
+
8
+ class Arr
9
+ {
10
+ use Macroable;
11
+
12
+ /**
13
+ * Determine whether the given value is array accessible.
14
+ *
15
+ * @param mixed $value
16
+ * @return bool
17
+ */
18
+ public static function accessible($value)
19
+ {
20
+ return is_array($value) || $value instanceof ArrayAccess;
21
+ }
22
+
23
+ /**
24
+ * Add an element to an array using "dot" notation if it doesn't exist.
25
+ *
26
+ * @param array $array
27
+ * @param string $key
28
+ * @param mixed $value
29
+ * @return array
30
+ */
31
+ public static function add($array, $key, $value)
32
+ {
33
+ if (is_null(static::get($array, $key))) {
34
+ static::set($array, $key, $value);
35
+ }
36
+
37
+ return $array;
38
+ }
39
+
40
+ /**
41
+ * Collapse an array of arrays into a single array.
42
+ *
43
+ * @param array $array
44
+ * @return array
45
+ */
46
+ public static function collapse($array)
47
+ {
48
+ $results = [];
49
+
50
+ foreach ($array as $values) {
51
+ if ($values instanceof Collection) {
52
+ $values = $values->all();
53
+ } elseif (! is_array($values)) {
54
+ continue;
55
+ }
56
+
57
+ $results = array_merge($results, $values);
58
+ }
59
+
60
+ return $results;
61
+ }
62
+
63
+ /**
64
+ * Divide an array into two arrays. One with keys and the other with values.
65
+ *
66
+ * @param array $array
67
+ * @return array
68
+ */
69
+ public static function divide($array)
70
+ {
71
+ return [array_keys($array), array_values($array)];
72
+ }
73
+
74
+ /**
75
+ * Flatten a multi-dimensional associative array with dots.
76
+ *
77
+ * @param array $array
78
+ * @param string $prepend
79
+ * @return array
80
+ */
81
+ public static function dot($array, $prepend = '')
82
+ {
83
+ $results = [];
84
+
85
+ foreach ($array as $key => $value) {
86
+ if (is_array($value) && ! empty($value)) {
87
+ $results = array_merge($results, static::dot($value, $prepend.$key.'.'));
88
+ } else {
89
+ $results[$prepend.$key] = $value;
90
+ }
91
+ }
92
+
93
+ return $results;
94
+ }
95
+
96
+ /**
97
+ * Get all of the given array except for a specified array of items.
98
+ *
99
+ * @param array $array
100
+ * @param array|string $keys
101
+ * @return array
102
+ */
103
+ public static function except($array, $keys)
104
+ {
105
+ static::forget($array, $keys);
106
+
107
+ return $array;
108
+ }
109
+
110
+ /**
111
+ * Determine if the given key exists in the provided array.
112
+ *
113
+ * @param \ArrayAccess|array $array
114
+ * @param string|int $key
115
+ * @return bool
116
+ */
117
+ public static function exists($array, $key)
118
+ {
119
+ if ($array instanceof ArrayAccess) {
120
+ return $array->offsetExists($key);
121
+ }
122
+
123
+ return array_key_exists($key, $array);
124
+ }
125
+
126
+ /**
127
+ * Return the first element in an array passing a given truth test.
128
+ *
129
+ * @param array $array
130
+ * @param callable|null $callback
131
+ * @param mixed $default
132
+ * @return mixed
133
+ */
134
+ public static function first($array, callable $callback = null, $default = null)
135
+ {
136
+ if (is_null($callback)) {
137
+ if (empty($array)) {
138
+ return value($default);
139
+ }
140
+
141
+ foreach ($array as $item) {
142
+ return $item;
143
+ }
144
+ }
145
+
146
+ foreach ($array as $key => $value) {
147
+ if (call_user_func($callback, $value, $key)) {
148
+ return $value;
149
+ }
150
+ }
151
+
152
+ return value($default);
153
+ }
154
+
155
+ /**
156
+ * Return the last element in an array passing a given truth test.
157
+ *
158
+ * @param array $array
159
+ * @param callable|null $callback
160
+ * @param mixed $default
161
+ * @return mixed
162
+ */
163
+ public static function last($array, callable $callback = null, $default = null)
164
+ {
165
+ if (is_null($callback)) {
166
+ return empty($array) ? value($default) : end($array);
167
+ }
168
+
169
+ return static::first(array_reverse($array, true), $callback, $default);
170
+ }
171
+
172
+ /**
173
+ * Flatten a multi-dimensional array into a single level.
174
+ *
175
+ * @param array $array
176
+ * @param int $depth
177
+ * @return array
178
+ */
179
+ public static function flatten($array, $depth = INF)
180
+ {
181
+ return array_reduce($array, function ($result, $item) use ($depth) {
182
+ $item = $item instanceof Collection ? $item->all() : $item;
183
+
184
+ if (! is_array($item)) {
185
+ return array_merge($result, [$item]);
186
+ } elseif ($depth === 1) {
187
+ return array_merge($result, array_values($item));
188
+ } else {
189
+ return array_merge($result, static::flatten($item, $depth - 1));
190
+ }
191
+ }, []);
192
+ }
193
+
194
+ /**
195
+ * Remove one or many array items from a given array using "dot" notation.
196
+ *
197
+ * @param array $array
198
+ * @param array|string $keys
199
+ * @return void
200
+ */
201
+ public static function forget(&$array, $keys)
202
+ {
203
+ $original = &$array;
204
+
205
+ $keys = (array) $keys;
206
+
207
+ if (count($keys) === 0) {
208
+ return;
209
+ }
210
+
211
+ foreach ($keys as $key) {
212
+ // if the exact key exists in the top-level, remove it
213
+ if (static::exists($array, $key)) {
214
+ unset($array[$key]);
215
+
216
+ continue;
217
+ }
218
+
219
+ $parts = explode('.', $key);
220
+
221
+ // clean up before each pass
222
+ $array = &$original;
223
+
224
+ while (count($parts) > 1) {
225
+ $part = array_shift($parts);
226
+
227
+ if (isset($array[$part]) && is_array($array[$part])) {
228
+ $array = &$array[$part];
229
+ } else {
230
+ continue 2;
231
+ }
232
+ }
233
+
234
+ unset($array[array_shift($parts)]);
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Get an item from an array using "dot" notation.
240
+ *
241
+ * @param \ArrayAccess|array $array
242
+ * @param string $key
243
+ * @param mixed $default
244
+ * @return mixed
245
+ */
246
+ public static function get($array, $key, $default = null)
247
+ {
248
+ if (! static::accessible($array)) {
249
+ return value($default);
250
+ }
251
+
252
+ if (is_null($key)) {
253
+ return $array;
254
+ }
255
+
256
+ if (static::exists($array, $key)) {
257
+ return $array[$key];
258
+ }
259
+
260
+ foreach (explode('.', $key) as $segment) {
261
+ if (static::accessible($array) && static::exists($array, $segment)) {
262
+ $array = $array[$segment];
263
+ } else {
264
+ return value($default);
265
+ }
266
+ }
267
+
268
+ return $array;
269
+ }
270
+
271
+ /**
272
+ * Check if an item or items exist in an array using "dot" notation.
273
+ *
274
+ * @param \ArrayAccess|array $array
275
+ * @param string|array $keys
276
+ * @return bool
277
+ */
278
+ public static function has($array, $keys)
279
+ {
280
+ if (is_null($keys)) {
281
+ return false;
282
+ }
283
+
284
+ $keys = (array) $keys;
285
+
286
+ if (! $array) {
287
+ return false;
288
+ }
289
+
290
+ if ($keys === []) {
291
+ return false;
292
+ }
293
+
294
+ foreach ($keys as $key) {
295
+ $subKeyArray = $array;
296
+
297
+ if (static::exists($array, $key)) {
298
+ continue;
299
+ }
300
+
301
+ foreach (explode('.', $key) as $segment) {
302
+ if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) {
303
+ $subKeyArray = $subKeyArray[$segment];
304
+ } else {
305
+ return false;
306
+ }
307
+ }
308
+ }
309
+
310
+ return true;
311
+ }
312
+
313
+ /**
314
+ * Determines if an array is associative.
315
+ *
316
+ * An array is "associative" if it doesn't have sequential numerical keys beginning with zero.
317
+ *
318
+ * @param array $array
319
+ * @return bool
320
+ */
321
+ public static function isAssoc(array $array)
322
+ {
323
+ $keys = array_keys($array);
324
+
325
+ return array_keys($keys) !== $keys;
326
+ }
327
+
328
+ /**
329
+ * Get a subset of the items from the given array.
330
+ *
331
+ * @param array $array
332
+ * @param array|string $keys
333
+ * @return array
334
+ */
335
+ public static function only($array, $keys)
336
+ {
337
+ return array_intersect_key($array, array_flip((array) $keys));
338
+ }
339
+
340
+ /**
341
+ * Pluck an array of values from an array.
342
+ *
343
+ * @param array $array
344
+ * @param string|array $value
345
+ * @param string|array|null $key
346
+ * @return array
347
+ */
348
+ public static function pluck($array, $value, $key = null)
349
+ {
350
+ $results = [];
351
+
352
+ list($value, $key) = static::explodePluckParameters($value, $key);
353
+
354
+ foreach ($array as $item) {
355
+ $itemValue = data_get($item, $value);
356
+
357
+ // If the key is "null", we will just append the value to the array and keep
358
+ // looping. Otherwise we will key the array using the value of the key we
359
+ // received from the developer. Then we'll return the final array form.
360
+ if (is_null($key)) {
361
+ $results[] = $itemValue;
362
+ } else {
363
+ $itemKey = data_get($item, $key);
364
+
365
+ $results[$itemKey] = $itemValue;
366
+ }
367
+ }
368
+
369
+ return $results;
370
+ }
371
+
372
+ /**
373
+ * Explode the "value" and "key" arguments passed to "pluck".
374
+ *
375
+ * @param string|array $value
376
+ * @param string|array|null $key
377
+ * @return array
378
+ */
379
+ protected static function explodePluckParameters($value, $key)
380
+ {
381
+ $value = is_string($value) ? explode('.', $value) : $value;
382
+
383
+ $key = is_null($key) || is_array($key) ? $key : explode('.', $key);
384
+
385
+ return [$value, $key];
386
+ }
387
+
388
+ /**
389
+ * Push an item onto the beginning of an array.
390
+ *
391
+ * @param array $array
392
+ * @param mixed $value
393
+ * @param mixed $key
394
+ * @return array
395
+ */
396
+ public static function prepend($array, $value, $key = null)
397
+ {
398
+ if (is_null($key)) {
399
+ array_unshift($array, $value);
400
+ } else {
401
+ $array = [$key => $value] + $array;
402
+ }
403
+
404
+ return $array;
405
+ }
406
+
407
+ /**
408
+ * Get a value from the array, and remove it.
409
+ *
410
+ * @param array $array
411
+ * @param string $key
412
+ * @param mixed $default
413
+ * @return mixed
414
+ */
415
+ public static function pull(&$array, $key, $default = null)
416
+ {
417
+ $value = static::get($array, $key, $default);
418
+
419
+ static::forget($array, $key);
420
+
421
+ return $value;
422
+ }
423
+
424
+ /**
425
+ * Set an array item to a given value using "dot" notation.
426
+ *
427
+ * If no key is given to the method, the entire array will be replaced.
428
+ *
429
+ * @param array $array
430
+ * @param string $key
431
+ * @param mixed $value
432
+ * @return array
433
+ */
434
+ public static function set(&$array, $key, $value)
435
+ {
436
+ if (is_null($key)) {
437
+ return $array = $value;
438
+ }
439
+
440
+ $keys = explode('.', $key);
441
+
442
+ while (count($keys) > 1) {
443
+ $key = array_shift($keys);
444
+
445
+ // If the key doesn't exist at this depth, we will just create an empty array
446
+ // to hold the next value, allowing us to create the arrays to hold final
447
+ // values at the correct depth. Then we'll keep digging into the array.
448
+ if (! isset($array[$key]) || ! is_array($array[$key])) {
449
+ $array[$key] = [];
450
+ }
451
+
452
+ $array = &$array[$key];
453
+ }
454
+
455
+ $array[array_shift($keys)] = $value;
456
+
457
+ return $array;
458
+ }
459
+
460
+ /**
461
+ * Shuffle the given array and return the result.
462
+ *
463
+ * @param array $array
464
+ * @return array
465
+ */
466
+ public static function shuffle($array)
467
+ {
468
+ shuffle($array);
469
+
470
+ return $array;
471
+ }
472
+
473
+ /**
474
+ * Sort the array using the given callback or "dot" notation.
475
+ *
476
+ * @param array $array
477
+ * @param callable|string $callback
478
+ * @return array
479
+ */
480
+ public static function sort($array, $callback)
481
+ {
482
+ return Collection::make($array)->sortBy($callback)->all();
483
+ }
484
+
485
+ /**
486
+ * Recursively sort an array by keys and values.
487
+ *
488
+ * @param array $array
489
+ * @return array
490
+ */
491
+ public static function sortRecursive($array)
492
+ {
493
+ foreach ($array as &$value) {
494
+ if (is_array($value)) {
495
+ $value = static::sortRecursive($value);
496
+ }
497
+ }
498
+
499
+ if (static::isAssoc($array)) {
500
+ ksort($array);
501
+ } else {
502
+ sort($array);
503
+ }
504
+
505
+ return $array;
506
+ }
507
+
508
+ /**
509
+ * Filter the array using the given callback.
510
+ *
511
+ * @param array $array
512
+ * @param callable $callback
513
+ * @return array
514
+ */
515
+ public static function where($array, callable $callback)
516
+ {
517
+ return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH);
518
+ }
519
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/ClassLoader.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support;
4
+
5
+ class ClassLoader
6
+ {
7
+ /**
8
+ * The registered directories.
9
+ *
10
+ * @var array
11
+ */
12
+ protected static $directories = [];
13
+
14
+ /**
15
+ * Indicates if a ClassLoader has been registered.
16
+ *
17
+ * @var bool
18
+ */
19
+ protected static $registered = false;
20
+
21
+ /**
22
+ * Load the given class file.
23
+ *
24
+ * @param string $class
25
+ * @return bool
26
+ */
27
+ public static function load($class)
28
+ {
29
+ $class = static::normalizeClass($class);
30
+
31
+ foreach (static::$directories as $directory) {
32
+ if (file_exists($path = $directory.DIRECTORY_SEPARATOR.$class)) {
33
+ require_once $path;
34
+
35
+ return true;
36
+ }
37
+ }
38
+
39
+ return false;
40
+ }
41
+
42
+ /**
43
+ * Get the normal file name for a class.
44
+ *
45
+ * @param string $class
46
+ * @return string
47
+ */
48
+ public static function normalizeClass($class)
49
+ {
50
+ if ($class[0] == '\\') {
51
+ $class = substr($class, 1);
52
+ }
53
+
54
+ return str_replace(['\\', '_'], DIRECTORY_SEPARATOR, $class).'.php';
55
+ }
56
+
57
+ /**
58
+ * Register the given class loader on the auto-loader stack.
59
+ *
60
+ * @return void
61
+ */
62
+ public static function register()
63
+ {
64
+ if (! static::$registered) {
65
+ static::$registered = spl_autoload_register([static::class, 'load']);
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Add directories to the class loader.
71
+ *
72
+ * @param string|array $directories
73
+ * @return void
74
+ */
75
+ public static function addDirectories($directories)
76
+ {
77
+ static::$directories = array_unique(array_merge(static::$directories, (array) $directories));
78
+ }
79
+
80
+ /**
81
+ * Remove directories from the class loader.
82
+ *
83
+ * @param string|array $directories
84
+ * @return void
85
+ */
86
+ public static function removeDirectories($directories = null)
87
+ {
88
+ if (is_null($directories)) {
89
+ static::$directories = [];
90
+ } else {
91
+ static::$directories = array_diff(static::$directories, (array) $directories);
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Gets all the directories registered with the loader.
97
+ *
98
+ * @return array
99
+ */
100
+ public static function getDirectories()
101
+ {
102
+ return static::$directories;
103
+ }
104
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Collection.php ADDED
@@ -0,0 +1,1352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support;
4
+
5
+ use Countable;
6
+ use ArrayAccess;
7
+ use Traversable;
8
+ use ArrayIterator;
9
+ use CachingIterator;
10
+ use JsonSerializable;
11
+ use IteratorAggregate;
12
+ use InvalidArgumentException;
13
+ use Illuminate\Support\Traits\Macroable;
14
+ use Illuminate\Contracts\Support\Jsonable;
15
+ use Illuminate\Contracts\Support\Arrayable;
16
+
17
+ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable
18
+ {
19
+ use Macroable;
20
+
21
+ /**
22
+ * The items contained in the collection.
23
+ *
24
+ * @var array
25
+ */
26
+ protected $items = [];
27
+
28
+ /**
29
+ * Create a new collection.
30
+ *
31
+ * @param mixed $items
32
+ * @return void
33
+ */
34
+ public function __construct($items = [])
35
+ {
36
+ $this->items = $this->getArrayableItems($items);
37
+ }
38
+
39
+ /**
40
+ * Create a new collection instance if the value isn't one already.
41
+ *
42
+ * @param mixed $items
43
+ * @return static
44
+ */
45
+ public static function make($items = [])
46
+ {
47
+ return new static($items);
48
+ }
49
+
50
+ /**
51
+ * Get all of the items in the collection.
52
+ *
53
+ * @return array
54
+ */
55
+ public function all()
56
+ {
57
+ return $this->items;
58
+ }
59
+
60
+ /**
61
+ * Get the average value of a given key.
62
+ *
63
+ * @param callable|string|null $callback
64
+ * @return mixed
65
+ */
66
+ public function avg($callback = null)
67
+ {
68
+ if ($count = $this->count()) {
69
+ return $this->sum($callback) / $count;
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Alias for the "avg" method.
75
+ *
76
+ * @param callable|string|null $callback
77
+ * @return mixed
78
+ */
79
+ public function average($callback = null)
80
+ {
81
+ return $this->avg($callback);
82
+ }
83
+
84
+ /**
85
+ * Get the median of a given key.
86
+ *
87
+ * @param null $key
88
+ * @return mixed|null
89
+ */
90
+ public function median($key = null)
91
+ {
92
+ $count = $this->count();
93
+
94
+ if ($count == 0) {
95
+ return;
96
+ }
97
+
98
+ $values = with(isset($key) ? $this->pluck($key) : $this)
99
+ ->sort()->values();
100
+
101
+ $middle = (int) ($count / 2);
102
+
103
+ if ($count % 2) {
104
+ return $values->get($middle);
105
+ }
106
+
107
+ return (new static([
108
+ $values->get($middle - 1), $values->get($middle),
109
+ ]))->average();
110
+ }
111
+
112
+ /**
113
+ * Get the mode of a given key.
114
+ *
115
+ * @param null $key
116
+ * @return array
117
+ */
118
+ public function mode($key = null)
119
+ {
120
+ $count = $this->count();
121
+
122
+ if ($count == 0) {
123
+ return;
124
+ }
125
+
126
+ $collection = isset($key) ? $this->pluck($key) : $this;
127
+
128
+ $counts = new self;
129
+
130
+ $collection->each(function ($value) use ($counts) {
131
+ $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1;
132
+ });
133
+
134
+ $sorted = $counts->sort();
135
+
136
+ $highestValue = $sorted->last();
137
+
138
+ return $sorted->filter(function ($value) use ($highestValue) {
139
+ return $value == $highestValue;
140
+ })->sort()->keys()->all();
141
+ }
142
+
143
+ /**
144
+ * Collapse the collection of items into a single array.
145
+ *
146
+ * @return static
147
+ */
148
+ public function collapse()
149
+ {
150
+ return new static(Arr::collapse($this->items));
151
+ }
152
+
153
+ /**
154
+ * Determine if an item exists in the collection.
155
+ *
156
+ * @param mixed $key
157
+ * @param mixed $value
158
+ * @return bool
159
+ */
160
+ public function contains($key, $value = null)
161
+ {
162
+ if (func_num_args() == 2) {
163
+ return $this->contains(function ($item) use ($key, $value) {
164
+ return data_get($item, $key) == $value;
165
+ });
166
+ }
167
+
168
+ if ($this->useAsCallable($key)) {
169
+ return ! is_null($this->first($key));
170
+ }
171
+
172
+ return in_array($key, $this->items);
173
+ }
174
+
175
+ /**
176
+ * Determine if an item exists in the collection using strict comparison.
177
+ *
178
+ * @param mixed $key
179
+ * @param mixed $value
180
+ * @return bool
181
+ */
182
+ public function containsStrict($key, $value = null)
183
+ {
184
+ if (func_num_args() == 2) {
185
+ return $this->contains(function ($item) use ($key, $value) {
186
+ return data_get($item, $key) === $value;
187
+ });
188
+ }
189
+
190
+ if ($this->useAsCallable($key)) {
191
+ return ! is_null($this->first($key));
192
+ }
193
+
194
+ return in_array($key, $this->items, true);
195
+ }
196
+
197
+ /**
198
+ * Get the items in the collection that are not present in the given items.
199
+ *
200
+ * @param mixed $items
201
+ * @return static
202
+ */
203
+ public function diff($items)
204
+ {
205
+ return new static(array_diff($this->items, $this->getArrayableItems($items)));
206
+ }
207
+
208
+ /**
209
+ * Get the items in the collection whose keys are not present in the given items.
210
+ *
211
+ * @param mixed $items
212
+ * @return static
213
+ */
214
+ public function diffKeys($items)
215
+ {
216
+ return new static(array_diff_key($this->items, $this->getArrayableItems($items)));
217
+ }
218
+
219
+ /**
220
+ * Execute a callback over each item.
221
+ *
222
+ * @param callable $callback
223
+ * @return $this
224
+ */
225
+ public function each(callable $callback)
226
+ {
227
+ foreach ($this->items as $key => $item) {
228
+ if ($callback($item, $key) === false) {
229
+ break;
230
+ }
231
+ }
232
+
233
+ return $this;
234
+ }
235
+
236
+ /**
237
+ * Create a new collection consisting of every n-th element.
238
+ *
239
+ * @param int $step
240
+ * @param int $offset
241
+ * @return static
242
+ */
243
+ public function every($step, $offset = 0)
244
+ {
245
+ $new = [];
246
+
247
+ $position = 0;
248
+
249
+ foreach ($this->items as $item) {
250
+ if ($position % $step === $offset) {
251
+ $new[] = $item;
252
+ }
253
+
254
+ $position++;
255
+ }
256
+
257
+ return new static($new);
258
+ }
259
+
260
+ /**
261
+ * Get all items except for those with the specified keys.
262
+ *
263
+ * @param mixed $keys
264
+ * @return static
265
+ */
266
+ public function except($keys)
267
+ {
268
+ $keys = is_array($keys) ? $keys : func_get_args();
269
+
270
+ return new static(Arr::except($this->items, $keys));
271
+ }
272
+
273
+ /**
274
+ * Run a filter over each of the items.
275
+ *
276
+ * @param callable|null $callback
277
+ * @return static
278
+ */
279
+ public function filter(callable $callback = null)
280
+ {
281
+ if ($callback) {
282
+ return new static(Arr::where($this->items, $callback));
283
+ }
284
+
285
+ return new static(array_filter($this->items));
286
+ }
287
+
288
+ /**
289
+ * Filter items by the given key value pair.
290
+ *
291
+ * @param string $key
292
+ * @param mixed $operator
293
+ * @param mixed $value
294
+ * @return static
295
+ */
296
+ public function where($key, $operator, $value = null)
297
+ {
298
+ if (func_num_args() == 2) {
299
+ $value = $operator;
300
+
301
+ $operator = '=';
302
+ }
303
+
304
+ return $this->filter($this->operatorForWhere($key, $operator, $value));
305
+ }
306
+
307
+ /**
308
+ * Get an operator checker callback.
309
+ *
310
+ * @param string $key
311
+ * @param string $operator
312
+ * @param mixed $value
313
+ * @return \Closure
314
+ */
315
+ protected function operatorForWhere($key, $operator, $value)
316
+ {
317
+ return function ($item) use ($key, $operator, $value) {
318
+ $retrieved = data_get($item, $key);
319
+
320
+ switch ($operator) {
321
+ default:
322
+ case '=':
323
+ case '==': return $retrieved == $value;
324
+ case '!=':
325
+ case '<>': return $retrieved != $value;
326
+ case '<': return $retrieved < $value;
327
+ case '>': return $retrieved > $value;
328
+ case '<=': return $retrieved <= $value;
329
+ case '>=': return $retrieved >= $value;
330
+ case '===': return $retrieved === $value;
331
+ case '!==': return $retrieved !== $value;
332
+ }
333
+ };
334
+ }
335
+
336
+ /**
337
+ * Filter items by the given key value pair using strict comparison.
338
+ *
339
+ * @param string $key
340
+ * @param mixed $value
341
+ * @return static
342
+ */
343
+ public function whereStrict($key, $value)
344
+ {
345
+ return $this->where($key, '===', $value);
346
+ }
347
+
348
+ /**
349
+ * Filter items by the given key value pair.
350
+ *
351
+ * @param string $key
352
+ * @param mixed $values
353
+ * @param bool $strict
354
+ * @return static
355
+ */
356
+ public function whereIn($key, $values, $strict = false)
357
+ {
358
+ $values = $this->getArrayableItems($values);
359
+
360
+ return $this->filter(function ($item) use ($key, $values, $strict) {
361
+ return in_array(data_get($item, $key), $values, $strict);
362
+ });
363
+ }
364
+
365
+ /**
366
+ * Filter items by the given key value pair using strict comparison.
367
+ *
368
+ * @param string $key
369
+ * @param mixed $values
370
+ * @return static
371
+ */
372
+ public function whereInStrict($key, $values)
373
+ {
374
+ return $this->whereIn($key, $values, true);
375
+ }
376
+
377
+ /**
378
+ * Get the first item from the collection.
379
+ *
380
+ * @param callable|null $callback
381
+ * @param mixed $default
382
+ * @return mixed
383
+ */
384
+ public function first(callable $callback = null, $default = null)
385
+ {
386
+ return Arr::first($this->items, $callback, $default);
387
+ }
388
+
389
+ /**
390
+ * Get a flattened array of the items in the collection.
391
+ *
392
+ * @param int $depth
393
+ * @return static
394
+ */
395
+ public function flatten($depth = INF)
396
+ {
397
+ return new static(Arr::flatten($this->items, $depth));
398
+ }
399
+
400
+ /**
401
+ * Flip the items in the collection.
402
+ *
403
+ * @return static
404
+ */
405
+ public function flip()
406
+ {
407
+ return new static(array_flip($this->items));
408
+ }
409
+
410
+ /**
411
+ * Remove an item from the collection by key.
412
+ *
413
+ * @param string|array $keys
414
+ * @return $this
415
+ */
416
+ public function forget($keys)
417
+ {
418
+ foreach ((array) $keys as $key) {
419
+ $this->offsetUnset($key);
420
+ }
421
+
422
+ return $this;
423
+ }
424
+
425
+ /**
426
+ * Get an item from the collection by key.
427
+ *
428
+ * @param mixed $key
429
+ * @param mixed $default
430
+ * @return mixed
431
+ */
432
+ public function get($key, $default = null)
433
+ {
434
+ if ($this->offsetExists($key)) {
435
+ return $this->items[$key];
436
+ }
437
+
438
+ return value($default);
439
+ }
440
+
441
+ /**
442
+ * Group an associative array by a field or using a callback.
443
+ *
444
+ * @param callable|string $groupBy
445
+ * @param bool $preserveKeys
446
+ * @return static
447
+ */
448
+ public function groupBy($groupBy, $preserveKeys = false)
449
+ {
450
+ $groupBy = $this->valueRetriever($groupBy);
451
+
452
+ $results = [];
453
+
454
+ foreach ($this->items as $key => $value) {
455
+ $groupKeys = $groupBy($value, $key);
456
+
457
+ if (! is_array($groupKeys)) {
458
+ $groupKeys = [$groupKeys];
459
+ }
460
+
461
+ foreach ($groupKeys as $groupKey) {
462
+ if (! array_key_exists($groupKey, $results)) {
463
+ $results[$groupKey] = new static;
464
+ }
465
+
466
+ $results[$groupKey]->offsetSet($preserveKeys ? $key : null, $value);
467
+ }
468
+ }
469
+
470
+ return new static($results);
471
+ }
472
+
473
+ /**
474
+ * Key an associative array by a field or using a callback.
475
+ *
476
+ * @param callable|string $keyBy
477
+ * @return static
478
+ */
479
+ public function keyBy($keyBy)
480
+ {
481
+ $keyBy = $this->valueRetriever($keyBy);
482
+
483
+ $results = [];
484
+
485
+ foreach ($this->items as $key => $item) {
486
+ $resolvedKey = $keyBy($item, $key);
487
+
488
+ if (is_object($resolvedKey)) {
489
+ $resolvedKey = (string) $resolvedKey;
490
+ }
491
+
492
+ $results[$resolvedKey] = $item;
493
+ }
494
+
495
+ return new static($results);
496
+ }
497
+
498
+ /**
499
+ * Determine if an item exists in the collection by key.
500
+ *
501
+ * @param mixed $key
502
+ * @return bool
503
+ */
504
+ public function has($key)
505
+ {
506
+ return $this->offsetExists($key);
507
+ }
508
+
509
+ /**
510
+ * Concatenate values of a given key as a string.
511
+ *
512
+ * @param string $value
513
+ * @param string $glue
514
+ * @return string
515
+ */
516
+ public function implode($value, $glue = null)
517
+ {
518
+ $first = $this->first();
519
+
520
+ if (is_array($first) || is_object($first)) {
521
+ return implode($glue, $this->pluck($value)->all());
522
+ }
523
+
524
+ return implode($value, $this->items);
525
+ }
526
+
527
+ /**
528
+ * Intersect the collection with the given items.
529
+ *
530
+ * @param mixed $items
531
+ * @return static
532
+ */
533
+ public function intersect($items)
534
+ {
535
+ return new static(array_intersect($this->items, $this->getArrayableItems($items)));
536
+ }
537
+
538
+ /**
539
+ * Determine if the collection is empty or not.
540
+ *
541
+ * @return bool
542
+ */
543
+ public function isEmpty()
544
+ {
545
+ return empty($this->items);
546
+ }
547
+
548
+ /**
549
+ * Determine if the given value is callable, but not a string.
550
+ *
551
+ * @param mixed $value
552
+ * @return bool
553
+ */
554
+ protected function useAsCallable($value)
555
+ {
556
+ return ! is_string($value) && is_callable($value);
557
+ }
558
+
559
+ /**
560
+ * Get the keys of the collection items.
561
+ *
562
+ * @return static
563
+ */
564
+ public function keys()
565
+ {
566
+ return new static(array_keys($this->items));
567
+ }
568
+
569
+ /**
570
+ * Get the last item from the collection.
571
+ *
572
+ * @param callable|null $callback
573
+ * @param mixed $default
574
+ * @return mixed
575
+ */
576
+ public function last(callable $callback = null, $default = null)
577
+ {
578
+ return Arr::last($this->items, $callback, $default);
579
+ }
580
+
581
+ /**
582
+ * Get the values of a given key.
583
+ *
584
+ * @param string $value
585
+ * @param string|null $key
586
+ * @return static
587
+ */
588
+ public function pluck($value, $key = null)
589
+ {
590
+ return new static(Arr::pluck($this->items, $value, $key));
591
+ }
592
+
593
+ /**
594
+ * Run a map over each of the items.
595
+ *
596
+ * @param callable $callback
597
+ * @return static
598
+ */
599
+ public function map(callable $callback)
600
+ {
601
+ $keys = array_keys($this->items);
602
+
603
+ $items = array_map($callback, $this->items, $keys);
604
+
605
+ return new static(array_combine($keys, $items));
606
+ }
607
+
608
+ /**
609
+ * Run an associative map over each of the items.
610
+ *
611
+ * The callback should return an associative array with a single key/value pair.
612
+ *
613
+ * @param callable $callback
614
+ * @return static
615
+ */
616
+ public function mapWithKeys(callable $callback)
617
+ {
618
+ return $this->flatMap($callback);
619
+ }
620
+
621
+ /**
622
+ * Map a collection and flatten the result by a single level.
623
+ *
624
+ * @param callable $callback
625
+ * @return static
626
+ */
627
+ public function flatMap(callable $callback)
628
+ {
629
+ return $this->map($callback)->collapse();
630
+ }
631
+
632
+ /**
633
+ * Get the max value of a given key.
634
+ *
635
+ * @param callable|string|null $callback
636
+ * @return mixed
637
+ */
638
+ public function max($callback = null)
639
+ {
640
+ $callback = $this->valueRetriever($callback);
641
+
642
+ return $this->reduce(function ($result, $item) use ($callback) {
643
+ $value = $callback($item);
644
+
645
+ return is_null($result) || $value > $result ? $value : $result;
646
+ });
647
+ }
648
+
649
+ /**
650
+ * Merge the collection with the given items.
651
+ *
652
+ * @param mixed $items
653
+ * @return static
654
+ */
655
+ public function merge($items)
656
+ {
657
+ return new static(array_merge($this->items, $this->getArrayableItems($items)));
658
+ }
659
+
660
+ /**
661
+ * Create a collection by using this collection for keys and another for its values.
662
+ *
663
+ * @param mixed $values
664
+ * @return static
665
+ */
666
+ public function combine($values)
667
+ {
668
+ return new static(array_combine($this->all(), $this->getArrayableItems($values)));
669
+ }
670
+
671
+ /**
672
+ * Union the collection with the given items.
673
+ *
674
+ * @param mixed $items
675
+ * @return static
676
+ */
677
+ public function union($items)
678
+ {
679
+ return new static($this->items + $this->getArrayableItems($items));
680
+ }
681
+
682
+ /**
683
+ * Get the min value of a given key.
684
+ *
685
+ * @param callable|string|null $callback
686
+ * @return mixed
687
+ */
688
+ public function min($callback = null)
689
+ {
690
+ $callback = $this->valueRetriever($callback);
691
+
692
+ return $this->reduce(function ($result, $item) use ($callback) {
693
+ $value = $callback($item);
694
+
695
+ return is_null($result) || $value < $result ? $value : $result;
696
+ });
697
+ }
698
+
699
+ /**
700
+ * Get the items with the specified keys.
701
+ *
702
+ * @param mixed $keys
703
+ * @return static
704
+ */
705
+ public function only($keys)
706
+ {
707
+ if (is_null($keys)) {
708
+ return new static($this->items);
709
+ }
710
+
711
+ $keys = is_array($keys) ? $keys : func_get_args();
712
+
713
+ return new static(Arr::only($this->items, $keys));
714
+ }
715
+
716
+ /**
717
+ * "Paginate" the collection by slicing it into a smaller collection.
718
+ *
719
+ * @param int $page
720
+ * @param int $perPage
721
+ * @return static
722
+ */
723
+ public function forPage($page, $perPage)
724
+ {
725
+ return $this->slice(($page - 1) * $perPage, $perPage);
726
+ }
727
+
728
+ /**
729
+ * Pass the collection to the given callback and return the result.
730
+ *
731
+ * @param callable $callback
732
+ * @return mixed
733
+ */
734
+ public function pipe(callable $callback)
735
+ {
736
+ return $callback($this);
737
+ }
738
+
739
+ /**
740
+ * Get and remove the last item from the collection.
741
+ *
742
+ * @return mixed
743
+ */
744
+ public function pop()
745
+ {
746
+ return array_pop($this->items);
747
+ }
748
+
749
+ /**
750
+ * Push an item onto the beginning of the collection.
751
+ *
752
+ * @param mixed $value
753
+ * @param mixed $key
754
+ * @return $this
755
+ */
756
+ public function prepend($value, $key = null)
757
+ {
758
+ $this->items = Arr::prepend($this->items, $value, $key);
759
+
760
+ return $this;
761
+ }
762
+
763
+ /**
764
+ * Push an item onto the end of the collection.
765
+ *
766
+ * @param mixed $value
767
+ * @return $this
768
+ */
769
+ public function push($value)
770
+ {
771
+ $this->offsetSet(null, $value);
772
+
773
+ return $this;
774
+ }
775
+
776
+ /**
777
+ * Get and remove an item from the collection.
778
+ *
779
+ * @param mixed $key
780
+ * @param mixed $default
781
+ * @return mixed
782
+ */
783
+ public function pull($key, $default = null)
784
+ {
785
+ return Arr::pull($this->items, $key, $default);
786
+ }
787
+
788
+ /**
789
+ * Put an item in the collection by key.
790
+ *
791
+ * @param mixed $key
792
+ * @param mixed $value
793
+ * @return $this
794
+ */
795
+ public function put($key, $value)
796
+ {
797
+ $this->offsetSet($key, $value);
798
+
799
+ return $this;
800
+ }
801
+
802
+ /**
803
+ * Get one or more items randomly from the collection.
804
+ *
805
+ * @param int $amount
806
+ * @return mixed
807
+ *
808
+ * @throws \InvalidArgumentException
809
+ */
810
+ public function random($amount = 1)
811
+ {
812
+ if ($amount > ($count = $this->count())) {
813
+ throw new InvalidArgumentException("You requested {$amount} items, but there are only {$count} items in the collection");
814
+ }
815
+
816
+ $keys = array_rand($this->items, $amount);
817
+
818
+ if ($amount == 1) {
819
+ return $this->items[$keys];
820
+ }
821
+
822
+ return new static(array_intersect_key($this->items, array_flip($keys)));
823
+ }
824
+
825
+ /**
826
+ * Reduce the collection to a single value.
827
+ *
828
+ * @param callable $callback
829
+ * @param mixed $initial
830
+ * @return mixed
831
+ */
832
+ public function reduce(callable $callback, $initial = null)
833
+ {
834
+ return array_reduce($this->items, $callback, $initial);
835
+ }
836
+
837
+ /**
838
+ * Create a collection of all elements that do not pass a given truth test.
839
+ *
840
+ * @param callable|mixed $callback
841
+ * @return static
842
+ */
843
+ public function reject($callback)
844
+ {
845
+ if ($this->useAsCallable($callback)) {
846
+ return $this->filter(function ($value, $key) use ($callback) {
847
+ return ! $callback($value, $key);
848
+ });
849
+ }
850
+
851
+ return $this->filter(function ($item) use ($callback) {
852
+ return $item != $callback;
853
+ });
854
+ }
855
+
856
+ /**
857
+ * Reverse items order.
858
+ *
859
+ * @return static
860
+ */
861
+ public function reverse()
862
+ {
863
+ return new static(array_reverse($this->items, true));
864
+ }
865
+
866
+ /**
867
+ * Search the collection for a given value and return the corresponding key if successful.
868
+ *
869
+ * @param mixed $value
870
+ * @param bool $strict
871
+ * @return mixed
872
+ */
873
+ public function search($value, $strict = false)
874
+ {
875
+ if (! $this->useAsCallable($value)) {
876
+ return array_search($value, $this->items, $strict);
877
+ }
878
+
879
+ foreach ($this->items as $key => $item) {
880
+ if (call_user_func($value, $item, $key)) {
881
+ return $key;
882
+ }
883
+ }
884
+
885
+ return false;
886
+ }
887
+
888
+ /**
889
+ * Get and remove the first item from the collection.
890
+ *
891
+ * @return mixed
892
+ */
893
+ public function shift()
894
+ {
895
+ return array_shift($this->items);
896
+ }
897
+
898
+ /**
899
+ * Shuffle the items in the collection.
900
+ *
901
+ * @param int $seed
902
+ * @return static
903
+ */
904
+ public function shuffle($seed = null)
905
+ {
906
+ $items = $this->items;
907
+
908
+ if (is_null($seed)) {
909
+ shuffle($items);
910
+ } else {
911
+ srand($seed);
912
+
913
+ usort($items, function () {
914
+ return rand(-1, 1);
915
+ });
916
+ }
917
+
918
+ return new static($items);
919
+ }
920
+
921
+ /**
922
+ * Slice the underlying collection array.
923
+ *
924
+ * @param int $offset
925
+ * @param int $length
926
+ * @return static
927
+ */
928
+ public function slice($offset, $length = null)
929
+ {
930
+ return new static(array_slice($this->items, $offset, $length, true));
931
+ }
932
+
933
+ /**
934
+ * Split a collection into a certain number of groups.
935
+ *
936
+ * @param int $numberOfGroups
937
+ * @return static
938
+ */
939
+ public function split($numberOfGroups)
940
+ {
941
+ if ($this->isEmpty()) {
942
+ return new static;
943
+ }
944
+
945
+ $groupSize = ceil($this->count() / $numberOfGroups);
946
+
947
+ return $this->chunk($groupSize);
948
+ }
949
+
950
+ /**
951
+ * Chunk the underlying collection array.
952
+ *
953
+ * @param int $size
954
+ * @return static
955
+ */
956
+ public function chunk($size)
957
+ {
958
+ if ($size <= 0) {
959
+ return new static;
960
+ }
961
+
962
+ $chunks = [];
963
+
964
+ foreach (array_chunk($this->items, $size, true) as $chunk) {
965
+ $chunks[] = new static($chunk);
966
+ }
967
+
968
+ return new static($chunks);
969
+ }
970
+
971
+ /**
972
+ * Sort through each item with a callback.
973
+ *
974
+ * @param callable|null $callback
975
+ * @return static
976
+ */
977
+ public function sort(callable $callback = null)
978
+ {
979
+ $items = $this->items;
980
+
981
+ $callback
982
+ ? uasort($items, $callback)
983
+ : asort($items);
984
+
985
+ return new static($items);
986
+ }
987
+
988
+ /**
989
+ * Sort the collection using the given callback.
990
+ *
991
+ * @param callable|string $callback
992
+ * @param int $options
993
+ * @param bool $descending
994
+ * @return static
995
+ */
996
+ public function sortBy($callback, $options = SORT_REGULAR, $descending = false)
997
+ {
998
+ $results = [];
999
+
1000
+ $callback = $this->valueRetriever($callback);
1001
+
1002
+ // First we will loop through the items and get the comparator from a callback
1003
+ // function which we were given. Then, we will sort the returned values and
1004
+ // and grab the corresponding values for the sorted keys from this array.
1005
+ foreach ($this->items as $key => $value) {
1006
+ $results[$key] = $callback($value, $key);
1007
+ }
1008
+
1009
+ $descending ? arsort($results, $options)
1010
+ : asort($results, $options);
1011
+
1012
+ // Once we have sorted all of the keys in the array, we will loop through them
1013
+ // and grab the corresponding model so we can set the underlying items list
1014
+ // to the sorted version. Then we'll just return the collection instance.
1015
+ foreach (array_keys($results) as $key) {
1016
+ $results[$key] = $this->items[$key];
1017
+ }
1018
+
1019
+ return new static($results);
1020
+ }
1021
+
1022
+ /**
1023
+ * Sort the collection in descending order using the given callback.
1024
+ *
1025
+ * @param callable|string $callback
1026
+ * @param int $options
1027
+ * @return static
1028
+ */
1029
+ public function sortByDesc($callback, $options = SORT_REGULAR)
1030
+ {
1031
+ return $this->sortBy($callback, $options, true);
1032
+ }
1033
+
1034
+ /**
1035
+ * Splice a portion of the underlying collection array.
1036
+ *
1037
+ * @param int $offset
1038
+ * @param int|null $length
1039
+ * @param mixed $replacement
1040
+ * @return static
1041
+ */
1042
+ public function splice($offset, $length = null, $replacement = [])
1043
+ {
1044
+ if (func_num_args() == 1) {
1045
+ return new static(array_splice($this->items, $offset));
1046
+ }
1047
+
1048
+ return new static(array_splice($this->items, $offset, $length, $replacement));
1049
+ }
1050
+
1051
+ /**
1052
+ * Get the sum of the given values.
1053
+ *
1054
+ * @param callable|string|null $callback
1055
+ * @return mixed
1056
+ */
1057
+ public function sum($callback = null)
1058
+ {
1059
+ if (is_null($callback)) {
1060
+ return array_sum($this->items);
1061
+ }
1062
+
1063
+ $callback = $this->valueRetriever($callback);
1064
+
1065
+ return $this->reduce(function ($result, $item) use ($callback) {
1066
+ return $result + $callback($item);
1067
+ }, 0);
1068
+ }
1069
+
1070
+ /**
1071
+ * Take the first or last {$limit} items.
1072
+ *
1073
+ * @param int $limit
1074
+ * @return static
1075
+ */
1076
+ public function take($limit)
1077
+ {
1078
+ if ($limit < 0) {
1079
+ return $this->slice($limit, abs($limit));
1080
+ }
1081
+
1082
+ return $this->slice(0, $limit);
1083
+ }
1084
+
1085
+ /**
1086
+ * Transform each item in the collection using a callback.
1087
+ *
1088
+ * @param callable $callback
1089
+ * @return $this
1090
+ */
1091
+ public function transform(callable $callback)
1092
+ {
1093
+ $this->items = $this->map($callback)->all();
1094
+
1095
+ return $this;
1096
+ }
1097
+
1098
+ /**
1099
+ * Return only unique items from the collection array.
1100
+ *
1101
+ * @param string|callable|null $key
1102
+ * @param bool $strict
1103
+ *
1104
+ * @return static
1105
+ */
1106
+ public function unique($key = null, $strict = false)
1107
+ {
1108
+ if (is_null($key)) {
1109
+ return new static(array_unique($this->items, SORT_REGULAR));
1110
+ }
1111
+
1112
+ $key = $this->valueRetriever($key);
1113
+
1114
+ $exists = [];
1115
+
1116
+ return $this->reject(function ($item) use ($key, $strict, &$exists) {
1117
+ if (in_array($id = $key($item), $exists, $strict)) {
1118
+ return true;
1119
+ }
1120
+
1121
+ $exists[] = $id;
1122
+ });
1123
+ }
1124
+
1125
+ /**
1126
+ * Return only unique items from the collection array using strict comparison.
1127
+ *
1128
+ * @param string|callable|null $key
1129
+ * @return static
1130
+ */
1131
+ public function uniqueStrict($key = null)
1132
+ {
1133
+ return $this->unique($key, true);
1134
+ }
1135
+
1136
+ /**
1137
+ * Reset the keys on the underlying array.
1138
+ *
1139
+ * @return static
1140
+ */
1141
+ public function values()
1142
+ {
1143
+ return new static(array_values($this->items));
1144
+ }
1145
+
1146
+ /**
1147
+ * Get a value retrieving callback.
1148
+ *
1149
+ * @param string $value
1150
+ * @return callable
1151
+ */
1152
+ protected function valueRetriever($value)
1153
+ {
1154
+ if ($this->useAsCallable($value)) {
1155
+ return $value;
1156
+ }
1157
+
1158
+ return function ($item) use ($value) {
1159
+ return data_get($item, $value);
1160
+ };
1161
+ }
1162
+
1163
+ /**
1164
+ * Zip the collection together with one or more arrays.
1165
+ *
1166
+ * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]);
1167
+ * => [[1, 4], [2, 5], [3, 6]]
1168
+ *
1169
+ * @param mixed ...$items
1170
+ * @return static
1171
+ */
1172
+ public function zip($items)
1173
+ {
1174
+ $arrayableItems = array_map(function ($items) {
1175
+ return $this->getArrayableItems($items);
1176
+ }, func_get_args());
1177
+
1178
+ $params = array_merge([function () {
1179
+ return new static(func_get_args());
1180
+ }, $this->items], $arrayableItems);
1181
+
1182
+ return new static(call_user_func_array('array_map', $params));
1183
+ }
1184
+
1185
+ /**
1186
+ * Get the collection of items as a plain array.
1187
+ *
1188
+ * @return array
1189
+ */
1190
+ public function toArray()
1191
+ {
1192
+ return array_map(function ($value) {
1193
+ return $value instanceof Arrayable ? $value->toArray() : $value;
1194
+ }, $this->items);
1195
+ }
1196
+
1197
+ /**
1198
+ * Convert the object into something JSON serializable.
1199
+ *
1200
+ * @return array
1201
+ */
1202
+ public function jsonSerialize()
1203
+ {
1204
+ return array_map(function ($value) {
1205
+ if ($value instanceof JsonSerializable) {
1206
+ return $value->jsonSerialize();
1207
+ } elseif ($value instanceof Jsonable) {
1208
+ return json_decode($value->toJson(), true);
1209
+ } elseif ($value instanceof Arrayable) {
1210
+ return $value->toArray();
1211
+ } else {
1212
+ return $value;
1213
+ }
1214
+ }, $this->items);
1215
+ }
1216
+
1217
+ /**
1218
+ * Get the collection of items as JSON.
1219
+ *
1220
+ * @param int $options
1221
+ * @return string
1222
+ */
1223
+ public function toJson($options = 0)
1224
+ {
1225
+ return json_encode($this->jsonSerialize(), $options);
1226
+ }
1227
+
1228
+ /**
1229
+ * Get an iterator for the items.
1230
+ *
1231
+ * @return \ArrayIterator
1232
+ */
1233
+ public function getIterator()
1234
+ {
1235
+ return new ArrayIterator($this->items);
1236
+ }
1237
+
1238
+ /**
1239
+ * Get a CachingIterator instance.
1240
+ *
1241
+ * @param int $flags
1242
+ * @return \CachingIterator
1243
+ */
1244
+ public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING)
1245
+ {
1246
+ return new CachingIterator($this->getIterator(), $flags);
1247
+ }
1248
+
1249
+ /**
1250
+ * Count the number of items in the collection.
1251
+ *
1252
+ * @return int
1253
+ */
1254
+ public function count()
1255
+ {
1256
+ return count($this->items);
1257
+ }
1258
+
1259
+ /**
1260
+ * Get a base Support collection instance from this collection.
1261
+ *
1262
+ * @return \Illuminate\Support\Collection
1263
+ */
1264
+ public function toBase()
1265
+ {
1266
+ return new self($this);
1267
+ }
1268
+
1269
+ /**
1270
+ * Determine if an item exists at an offset.
1271
+ *
1272
+ * @param mixed $key
1273
+ * @return bool
1274
+ */
1275
+ public function offsetExists($key)
1276
+ {
1277
+ return array_key_exists($key, $this->items);
1278
+ }
1279
+
1280
+ /**
1281
+ * Get an item at a given offset.
1282
+ *
1283
+ * @param mixed $key
1284
+ * @return mixed
1285
+ */
1286
+ public function offsetGet($key)
1287
+ {
1288
+ return $this->items[$key];
1289
+ }
1290
+
1291
+ /**
1292
+ * Set the item at a given offset.
1293
+ *
1294
+ * @param mixed $key
1295
+ * @param mixed $value
1296
+ * @return void
1297
+ */
1298
+ public function offsetSet($key, $value)
1299
+ {
1300
+ if (is_null($key)) {
1301
+ $this->items[] = $value;
1302
+ } else {
1303
+ $this->items[$key] = $value;
1304
+ }
1305
+ }
1306
+
1307
+ /**
1308
+ * Unset the item at a given offset.
1309
+ *
1310
+ * @param string $key
1311
+ * @return void
1312
+ */
1313
+ public function offsetUnset($key)
1314
+ {
1315
+ unset($this->items[$key]);
1316
+ }
1317
+
1318
+ /**
1319
+ * Convert the collection to its string representation.
1320
+ *
1321
+ * @return string
1322
+ */
1323
+ public function __toString()
1324
+ {
1325
+ return $this->toJson();
1326
+ }
1327
+
1328
+ /**
1329
+ * Results array of items from Collection or Arrayable.
1330
+ *
1331
+ * @param mixed $items
1332
+ * @return array
1333
+ */
1334
+ protected function getArrayableItems($items)
1335
+ {
1336
+ if (is_array($items)) {
1337
+ return $items;
1338
+ } elseif ($items instanceof self) {
1339
+ return $items->all();
1340
+ } elseif ($items instanceof Arrayable) {
1341
+ return $items->toArray();
1342
+ } elseif ($items instanceof Jsonable) {
1343
+ return json_decode($items->toJson(), true);
1344
+ } elseif ($items instanceof JsonSerializable) {
1345
+ return $items->jsonSerialize();
1346
+ } elseif ($items instanceof Traversable) {
1347
+ return iterator_to_array($items);
1348
+ }
1349
+
1350
+ return (array) $items;
1351
+ }
1352
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Composer.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support;
4
+
5
+ use Illuminate\Filesystem\Filesystem;
6
+ use Symfony\Component\Process\Process;
7
+ use Symfony\Component\Process\ProcessUtils;
8
+ use Symfony\Component\Process\PhpExecutableFinder;
9
+
10
+ class Composer
11
+ {
12
+ /**
13
+ * The filesystem instance.
14
+ *
15
+ * @var \Illuminate\Filesystem\Filesystem
16
+ */
17
+ protected $files;
18
+
19
+ /**
20
+ * The working path to regenerate from.
21
+ *
22
+ * @var string
23
+ */
24
+ protected $workingPath;
25
+
26
+ /**
27
+ * Create a new Composer manager instance.
28
+ *
29
+ * @param \Illuminate\Filesystem\Filesystem $files
30
+ * @param string|null $workingPath
31
+ * @return void
32
+ */
33
+ public function __construct(Filesystem $files, $workingPath = null)
34
+ {
35
+ $this->files = $files;
36
+ $this->workingPath = $workingPath;
37
+ }
38
+
39
+ /**
40
+ * Regenerate the Composer autoloader files.
41
+ *
42
+ * @param string $extra
43
+ * @return void
44
+ */
45
+ public function dumpAutoloads($extra = '')
46
+ {
47
+ $process = $this->getProcess();
48
+
49
+ $process->setCommandLine(trim($this->findComposer().' dump-autoload '.$extra));
50
+
51
+ $process->run();
52
+ }
53
+
54
+ /**
55
+ * Regenerate the optimized Composer autoloader files.
56
+ *
57
+ * @return void
58
+ */
59
+ public function dumpOptimized()
60
+ {
61
+ $this->dumpAutoloads('--optimize');
62
+ }
63
+
64
+ /**
65
+ * Get the composer command for the environment.
66
+ *
67
+ * @return string
68
+ */
69
+ protected function findComposer()
70
+ {
71
+ if (! $this->files->exists($this->workingPath.'/composer.phar')) {
72
+ return 'composer';
73
+ }
74
+
75
+ $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));
76
+
77
+ return "{$binary} composer.phar";
78
+ }
79
+
80
+ /**
81
+ * Get a new Symfony process instance.
82
+ *
83
+ * @return \Symfony\Component\Process\Process
84
+ */
85
+ protected function getProcess()
86
+ {
87
+ return (new Process('', $this->workingPath))->setTimeout(null);
88
+ }
89
+
90
+ /**
91
+ * Set the working path used by the class.
92
+ *
93
+ * @param string $path
94
+ * @return $this
95
+ */
96
+ public function setWorkingPath($path)
97
+ {
98
+ $this->workingPath = realpath($path);
99
+
100
+ return $this;
101
+ }
102
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Debug/Dumper.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Debug;
4
+
5
+ use Symfony\Component\VarDumper\Dumper\CliDumper;
6
+ use Symfony\Component\VarDumper\Cloner\VarCloner;
7
+
8
+ class Dumper
9
+ {
10
+ /**
11
+ * Dump a value with elegance.
12
+ *
13
+ * @param mixed $value
14
+ * @return void
15
+ */
16
+ public function dump($value)
17
+ {
18
+ if (class_exists(CliDumper::class)) {
19
+ $dumper = 'cli' === PHP_SAPI ? new CliDumper : new HtmlDumper;
20
+
21
+ $dumper->dump((new VarCloner)->cloneVar($value));
22
+ } else {
23
+ var_dump($value);
24
+ }
25
+ }
26
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Debug/HtmlDumper.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Debug;
4
+
5
+ use Symfony\Component\VarDumper\Dumper\HtmlDumper as SymfonyHtmlDumper;
6
+
7
+ class HtmlDumper extends SymfonyHtmlDumper
8
+ {
9
+ /**
10
+ * Colour definitions for output.
11
+ *
12
+ * @var array
13
+ */
14
+ protected $styles = [
15
+ 'default' => 'background-color:#fff; color:#222; line-height:1.2em; font-weight:normal; font:12px Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:100000',
16
+ 'num' => 'color:#a71d5d',
17
+ 'const' => 'color:#795da3',
18
+ 'str' => 'color:#df5000',
19
+ 'cchr' => 'color:#222',
20
+ 'note' => 'color:#a71d5d',
21
+ 'ref' => 'color:#a0a0a0',
22
+ 'public' => 'color:#795da3',
23
+ 'protected' => 'color:#795da3',
24
+ 'private' => 'color:#795da3',
25
+ 'meta' => 'color:#b729d9',
26
+ 'key' => 'color:#df5000',
27
+ 'index' => 'color:#a71d5d',
28
+ ];
29
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/App.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\Foundation\Application
7
+ */
8
+ class App extends Facade
9
+ {
10
+ /**
11
+ * Get the registered name of the component.
12
+ *
13
+ * @return string
14
+ */
15
+ protected static function getFacadeAccessor()
16
+ {
17
+ return 'app';
18
+ }
19
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Artisan.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\Contracts\Console\Kernel
7
+ */
8
+ class Artisan extends Facade
9
+ {
10
+ /**
11
+ * Get the registered name of the component.
12
+ *
13
+ * @return string
14
+ */
15
+ protected static function getFacadeAccessor()
16
+ {
17
+ return 'Illuminate\Contracts\Console\Kernel';
18
+ }
19
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Auth.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\Auth\AuthManager
7
+ * @see \Illuminate\Contracts\Auth\Factory
8
+ * @see \Illuminate\Contracts\Auth\Guard
9
+ * @see \Illuminate\Contracts\Auth\StatefulGuard
10
+ */
11
+ class Auth extends Facade
12
+ {
13
+ /**
14
+ * Get the registered name of the component.
15
+ *
16
+ * @return string
17
+ */
18
+ protected static function getFacadeAccessor()
19
+ {
20
+ return 'auth';
21
+ }
22
+
23
+ /**
24
+ * Register the typical authentication routes for an application.
25
+ *
26
+ * @return void
27
+ */
28
+ public static function routes()
29
+ {
30
+ static::$app->make('router')->auth();
31
+ }
32
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Blade.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\View\Compilers\BladeCompiler
7
+ */
8
+ class Blade extends Facade
9
+ {
10
+ /**
11
+ * Get the registered name of the component.
12
+ *
13
+ * @return string
14
+ */
15
+ protected static function getFacadeAccessor()
16
+ {
17
+ return static::$app['view']->getEngineResolver()->resolve('blade')->getCompiler();
18
+ }
19
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Broadcast.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\Contracts\Broadcasting\Factory
7
+ */
8
+ class Broadcast extends Facade
9
+ {
10
+ /**
11
+ * Get the registered name of the component.
12
+ *
13
+ * @return string
14
+ */
15
+ protected static function getFacadeAccessor()
16
+ {
17
+ return 'Illuminate\Contracts\Broadcasting\Factory';
18
+ }
19
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Bus.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ use Illuminate\Support\Testing\Fakes\BusFake;
6
+
7
+ /**
8
+ * @see \Illuminate\Contracts\Bus\Dispatcher
9
+ */
10
+ class Bus extends Facade
11
+ {
12
+ /**
13
+ * Replace the bound instance with a fake.
14
+ *
15
+ * @return void
16
+ */
17
+ public static function fake()
18
+ {
19
+ static::swap(new BusFake);
20
+ }
21
+
22
+ /**
23
+ * Get the registered name of the component.
24
+ *
25
+ * @return string
26
+ */
27
+ protected static function getFacadeAccessor()
28
+ {
29
+ return 'Illuminate\Contracts\Bus\Dispatcher';
30
+ }
31
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Cache.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\Cache\CacheManager
7
+ * @see \Illuminate\Cache\Repository
8
+ */
9
+ class Cache extends Facade
10
+ {
11
+ /**
12
+ * Get the registered name of the component.
13
+ *
14
+ * @return string
15
+ */
16
+ protected static function getFacadeAccessor()
17
+ {
18
+ return 'cache';
19
+ }
20
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Config.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\Config\Repository
7
+ */
8
+ class Config extends Facade
9
+ {
10
+ /**
11
+ * Get the registered name of the component.
12
+ *
13
+ * @return string
14
+ */
15
+ protected static function getFacadeAccessor()
16
+ {
17
+ return 'config';
18
+ }
19
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Cookie.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\Cookie\CookieJar
7
+ */
8
+ class Cookie extends Facade
9
+ {
10
+ /**
11
+ * Determine if a cookie exists on the request.
12
+ *
13
+ * @param string $key
14
+ * @return bool
15
+ */
16
+ public static function has($key)
17
+ {
18
+ return ! is_null(static::$app['request']->cookie($key, null));
19
+ }
20
+
21
+ /**
22
+ * Retrieve a cookie from the request.
23
+ *
24
+ * @param string $key
25
+ * @param mixed $default
26
+ * @return string
27
+ */
28
+ public static function get($key = null, $default = null)
29
+ {
30
+ return static::$app['request']->cookie($key, $default);
31
+ }
32
+
33
+ /**
34
+ * Get the registered name of the component.
35
+ *
36
+ * @return string
37
+ */
38
+ protected static function getFacadeAccessor()
39
+ {
40
+ return 'cookie';
41
+ }
42
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Crypt.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\Encryption\Encrypter
7
+ */
8
+ class Crypt extends Facade
9
+ {
10
+ /**
11
+ * Get the registered name of the component.
12
+ *
13
+ * @return string
14
+ */
15
+ protected static function getFacadeAccessor()
16
+ {
17
+ return 'encrypter';
18
+ }
19
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/DB.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ /**
6
+ * @see \Illuminate\Database\DatabaseManager
7
+ * @see \Illuminate\Database\Connection
8
+ */
9
+ class DB extends Facade
10
+ {
11
+ /**
12
+ * Get the registered name of the component.
13
+ *
14
+ * @return string
15
+ */
16
+ protected static function getFacadeAccessor()
17
+ {
18
+ return 'db';
19
+ }
20
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Event.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ use Illuminate\Support\Testing\Fakes\EventFake;
6
+
7
+ /**
8
+ * @see \Illuminate\Events\Dispatcher
9
+ */
10
+ class Event extends Facade
11
+ {
12
+ /**
13
+ * Replace the bound instance with a fake.
14
+ *
15
+ * @return void
16
+ */
17
+ public static function fake()
18
+ {
19
+ static::swap(new EventFake);
20
+ }
21
+
22
+ /**
23
+ * Get the registered name of the component.
24
+ *
25
+ * @return string
26
+ */
27
+ protected static function getFacadeAccessor()
28
+ {
29
+ return 'events';
30
+ }
31
+ }
app/code/community/NthMobile/EasyWebShopSMS/lib/vendor/illuminate/support/Facades/Facade.php ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Illuminate\Support\Facades;
4
+
5
+ use Mockery;
6
+ use RuntimeException;
7
+ use Mockery\MockInterface;
8
+
9
+ abstract class Facade
10
+ {
11
+ /**
12
+ * The application instance being facaded.
13
+ *
14
+ * @var \Illuminate\Contracts\Foundation\Application
15
+ */
16
+ protected static $app;
17
+
18
+ /**
19
+ * The resolved object instances.
20
+ *
21
+ * @var array
22
+ */
23
+ protected static $resolvedInstance;
24
+
25
+ /**
26
+ * Hotswap the underlying instance behind the facade.
27
+ *
28
+ * @param mixed $instance
29
+ * @return void
30
+ */
31
+ public static function swap($instance)
32
+ {
33
+ static::$resolvedInstance[static::getFacadeAccessor()] = $instance;
34
+
35
+ static::$app->instance(static::getFacadeAccessor(), $instance);
36
+ }
37
+
38
+ /**
39
+ * Convert the facade into a Mockery spy.
40
+ *
41
+ * @return void
42
+ */
43
+ public static function spy()
44
+ {
45
+ $name = static::getFacadeAccessor();
46
+
47
+ if (static::isMock()) {
48
+ $mock = static::$resolvedInstance[$name];
49
+ } else {
50
+ $class = static::getMockableClass($name);
51
+
52
+ $mock = $class ? Mockery::spy($class) : Mockery::spy();
53
+
54
+ static::$resolvedInstance[$name] = $mock;
55
+
56
+ if (isset(static::$app)) {
57
+ static::$app->instance($name, $mock);
58
+ }
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Initiate a mock expectation on the facade.
64
+ *
65
+ * @return \Mockery\Expectation
66
+ */
67
+ public static function shouldReceive()
68
+ {
69
+ $name = static::getFacadeAccessor();
70
+
71
+ if (static::isMock()) {
72
+ $mock = static::$resolvedInstance[$name];
73
+ } else {
74
+ $mock = static::createFreshMockInstance($name);
75
+ }
76
+
77
+ return call_user_func_array([$mock, 'shouldReceive'], func_get_args());
78
+ }
79
+
80
+ /**
81
+ * Create a fresh mock instance for the given class.
82
+ *
83
+ * @param string $name
84
+ * @return \Mockery\Expectation
85
+ */
86
+ protected static function createFreshMockInstance($name)
87
+ {
88
+ static::$resolvedInstance[$name] = $mock = static::createMockByName($name);
89
+
90
+ $mock->shouldAllowMockingProtectedMethods();
91
+
92
+ if (isset(static::$app)) {
93
+ static::$app->instance($name, $mock);
94
+ }
95
+
96
+ return $mock;
97
+ }
98
+
99
+ /**
100
+ * Create a fresh mock instance for the given class.
101
+ *
102
+ * @param string $name
103
+ * @return \Mockery\Expectation
104
+ */
105
+ protected static function createMockByName($name)
106
+ {
107
+ $class = static::getMockableClass($name);
108
+
109
+ return $class ? Mockery::mock($class) : Mockery::mock();
110
+ }
111
+
112
+ /**
113
+ * Determines whether a mock is set as the instance of the facade.
114
+ *
115
+ * @return bool
116
+ */
117
+ protected static function isMock()
118
+ {
119
+ $name = static::getFacadeAccessor();
120
+
121
+ return isset(static::$resolvedInstance[$name]) &&
122
+ static::$resolvedInstance[$name] instanceof MockInterface;
123
+ }
124
+
125
+ /**
126
+ * Get the mockable class for the bound instance.
127
+ *
128
+ * @return string|null
129
+ */
130
+ protected static function getMockableClass()
131
+ {
132
+ if ($root = static::getFacadeRoot()) {
133
+ return get_class($root);
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Get the root object behind the facade.
139
+ *
140
+ * @return mixed
141
+ */
142
+ public static function getFacadeRoot()
143
+ {
144
+ return static::resolveFacadeInstance(static::getFacadeAccessor());
145
+ }
146
+
147
+ /**
148
+ * Get the registered name of the component.
149
+ *
150
+ * @return string
151
+ *
152
+ * @throws \RuntimeException
153
+ */
154
+ protected static function getFa