XCloner – Backup and Restore - Version 4.1.2

Version Description

  • improved default backup storage path security
  • improved remote storage security
Download this release

Release Info

Developer xcloner
Plugin Icon 128x128 XCloner – Backup and Restore
Version 4.1.2
Comparing to
See all releases

Code changes from version 4.1.1 to 4.1.2

Files changed (188) hide show
  1. README.txt +10 -2
  2. admin/partials/xcloner_remote_storage_page.php +17 -11
  3. composer.json +2 -2
  4. composer.lock +150 -81
  5. includes/class-xcloner-activator.php +4 -0
  6. includes/class-xcloner-database.php +9 -6
  7. includes/class-xcloner-file-system.php +1 -1
  8. includes/class-xcloner-remote-storage.php +13 -7
  9. includes/class-xcloner-settings.php +4 -4
  10. includes/class-xcloner.php +46 -82
  11. vendor/composer/ClassLoader.php +2 -2
  12. vendor/composer/autoload_files.php +3 -2
  13. vendor/composer/autoload_psr4.php +3 -2
  14. vendor/composer/autoload_static.php +14 -8
  15. vendor/composer/installed.json +161 -88
  16. vendor/guzzlehttp/guzzle/.gitattributes +12 -10
  17. vendor/guzzlehttp/guzzle/.github/CONTRIBUTING.md +0 -3
  18. vendor/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE.md +0 -27
  19. vendor/guzzlehttp/guzzle/.php_cs +23 -0
  20. vendor/guzzlehttp/guzzle/.travis.yml +6 -3
  21. vendor/guzzlehttp/guzzle/CHANGELOG.md +26 -0
  22. vendor/guzzlehttp/guzzle/Dockerfile +18 -0
  23. vendor/guzzlehttp/guzzle/README.md +12 -13
  24. vendor/guzzlehttp/guzzle/build/packager.php +3 -3
  25. vendor/guzzlehttp/guzzle/composer.json +29 -14
  26. vendor/guzzlehttp/guzzle/docs/faq.rst +17 -0
  27. vendor/guzzlehttp/guzzle/docs/handlers-and-middleware.rst +1 -1
  28. vendor/guzzlehttp/guzzle/docs/overview.rst +2 -0
  29. vendor/guzzlehttp/guzzle/docs/psr7.rst +1 -0
  30. vendor/guzzlehttp/guzzle/docs/quickstart.rst +72 -14
  31. vendor/guzzlehttp/guzzle/docs/request-options.rst +28 -3
  32. vendor/guzzlehttp/guzzle/docs/testing.rst +23 -9
  33. vendor/guzzlehttp/guzzle/phpstan-baseline.neon +1412 -0
  34. vendor/guzzlehttp/guzzle/phpstan.neon.dist +8 -0
  35. vendor/guzzlehttp/guzzle/phpunit.xml.dist +8 -4
  36. vendor/guzzlehttp/guzzle/src/Client.php +115 -6
  37. vendor/guzzlehttp/guzzle/src/ClientInterface.php +5 -2
  38. vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php +5 -3
  39. vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +3 -3
  40. vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php +2 -1
  41. vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +1 -0
  42. vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +2 -2
  43. vendor/guzzlehttp/guzzle/src/Exception/ClientException.php +3 -1
  44. vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php +20 -10
  45. vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php +7 -0
  46. vendor/guzzlehttp/guzzle/src/Exception/RequestException.php +5 -30
  47. vendor/guzzlehttp/guzzle/src/Exception/ServerException.php +3 -1
  48. vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php +3 -1
  49. vendor/guzzlehttp/guzzle/src/Exception/TransferException.php +3 -1
  50. vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +32 -12
  51. vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +27 -7
  52. vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php +8 -2
  53. vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +18 -6
  54. vendor/guzzlehttp/guzzle/src/HandlerStack.php +9 -5
  55. vendor/guzzlehttp/guzzle/src/MessageFormatter.php +5 -0
  56. vendor/guzzlehttp/guzzle/src/Middleware.php +3 -4
  57. vendor/guzzlehttp/guzzle/src/Pool.php +11 -2
  58. vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php +5 -0
  59. vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php +15 -3
  60. vendor/guzzlehttp/guzzle/src/RequestOptions.php +9 -1
  61. vendor/guzzlehttp/guzzle/src/RetryMiddleware.php +19 -3
  62. vendor/guzzlehttp/guzzle/src/TransferStats.php +6 -6
  63. vendor/guzzlehttp/guzzle/src/functions.php +19 -6
  64. vendor/guzzlehttp/guzzle/tests/ClientTest.php +0 -677
  65. vendor/guzzlehttp/guzzle/tests/Cookie/CookieJarTest.php +0 -406
  66. vendor/guzzlehttp/guzzle/tests/Cookie/FileCookieJarTest.php +0 -88
  67. vendor/guzzlehttp/guzzle/tests/Cookie/SessionCookieJarTest.php +0 -92
  68. vendor/guzzlehttp/guzzle/tests/Cookie/SetCookieTest.php +0 -445
  69. vendor/guzzlehttp/guzzle/tests/Exception/ConnectExceptionTest.php +0 -25
  70. vendor/guzzlehttp/guzzle/tests/Exception/RequestExceptionTest.php +0 -177
  71. vendor/guzzlehttp/guzzle/tests/Exception/SeekExceptionTest.php +0 -17
  72. vendor/guzzlehttp/guzzle/tests/Handler/CurlFactoryTest.php +0 -743
  73. vendor/guzzlehttp/guzzle/tests/Handler/CurlHandlerTest.php +0 -86
  74. vendor/guzzlehttp/guzzle/tests/Handler/CurlMultiHandlerTest.php +0 -80
  75. vendor/guzzlehttp/guzzle/tests/Handler/EasyHandleTest.php +0 -23
  76. vendor/guzzlehttp/guzzle/tests/Handler/MockHandlerTest.php +0 -224
  77. vendor/guzzlehttp/guzzle/tests/Handler/ProxyTest.php +0 -58
  78. vendor/guzzlehttp/guzzle/tests/Handler/StreamHandlerTest.php +0 -683
  79. vendor/guzzlehttp/guzzle/tests/HandlerStackTest.php +0 -203
  80. vendor/guzzlehttp/guzzle/tests/MessageFormatterTest.php +0 -93
  81. vendor/guzzlehttp/guzzle/tests/MiddlewareTest.php +0 -230
  82. vendor/guzzlehttp/guzzle/tests/PoolTest.php +0 -171
  83. vendor/guzzlehttp/guzzle/tests/PrepareBodyMiddlewareTest.php +0 -153
  84. vendor/guzzlehttp/guzzle/tests/RedirectMiddlewareTest.php +0 -261
  85. vendor/guzzlehttp/guzzle/tests/RetryMiddlewareTest.php +0 -79
  86. vendor/guzzlehttp/guzzle/tests/Server.php +0 -174
  87. vendor/guzzlehttp/guzzle/tests/TransferStatsTest.php +0 -30
  88. vendor/guzzlehttp/guzzle/tests/UriTemplateTest.php +0 -202
  89. vendor/guzzlehttp/guzzle/tests/bootstrap.php +0 -24
  90. vendor/guzzlehttp/guzzle/tests/functionsTest.php +0 -139
  91. vendor/guzzlehttp/guzzle/tests/server.js +0 -250
  92. vendor/guzzlehttp/psr7/.editorconfig +9 -0
  93. vendor/guzzlehttp/psr7/.gitattributes +1 -0
  94. vendor/guzzlehttp/psr7/.travis.yml +16 -11
  95. vendor/guzzlehttp/psr7/CHANGELOG.md +194 -58
  96. vendor/guzzlehttp/psr7/README.md +7 -1
  97. vendor/guzzlehttp/psr7/composer.json +14 -4
  98. vendor/guzzlehttp/psr7/phpunit.xml.dist +1 -1
  99. vendor/guzzlehttp/psr7/src/AppendStream.php +12 -4
  100. vendor/guzzlehttp/psr7/src/FnStream.php +9 -0
  101. vendor/guzzlehttp/psr7/src/InflateStream.php +1 -1
  102. vendor/guzzlehttp/psr7/src/LimitStream.php +1 -1
  103. vendor/guzzlehttp/psr7/src/MessageTrait.php +45 -15
  104. vendor/guzzlehttp/psr7/src/Request.php +11 -2
  105. vendor/guzzlehttp/psr7/src/Response.php +24 -2
  106. vendor/guzzlehttp/psr7/src/Rfc7230.php +18 -0
  107. vendor/guzzlehttp/psr7/src/ServerRequest.php +26 -8
  108. vendor/guzzlehttp/psr7/src/Stream.php +39 -29
  109. vendor/guzzlehttp/psr7/src/StreamWrapper.php +43 -3
  110. vendor/guzzlehttp/psr7/src/Uri.php +91 -33
  111. vendor/guzzlehttp/psr7/src/functions.php +101 -30
  112. vendor/guzzlehttp/psr7/tests/AppendStreamTest.php +0 -186
  113. vendor/guzzlehttp/psr7/tests/BufferStreamTest.php +0 -63
  114. vendor/guzzlehttp/psr7/tests/CachingStreamTest.php +0 -195
  115. vendor/guzzlehttp/psr7/tests/DroppingStreamTest.php +0 -26
  116. vendor/guzzlehttp/psr7/tests/FnStreamTest.php +0 -90
  117. vendor/guzzlehttp/psr7/tests/FunctionsTest.php +0 -660
  118. vendor/guzzlehttp/psr7/tests/InflateStreamTest.php +0 -39
  119. vendor/guzzlehttp/psr7/tests/LazyOpenStreamTest.php +0 -64
  120. vendor/guzzlehttp/psr7/tests/LimitStreamTest.php +0 -157
  121. vendor/guzzlehttp/psr7/tests/MultipartStreamTest.php +0 -242
  122. vendor/guzzlehttp/psr7/tests/NoSeekStreamTest.php +0 -40
  123. vendor/guzzlehttp/psr7/tests/PumpStreamTest.php +0 -72
  124. vendor/guzzlehttp/psr7/tests/RequestTest.php +0 -195
  125. vendor/guzzlehttp/psr7/tests/ResponseTest.php +0 -252
  126. vendor/guzzlehttp/psr7/tests/ServerRequestTest.php +0 -522
  127. vendor/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php +0 -140
  128. vendor/guzzlehttp/psr7/tests/StreamTest.php +0 -223
  129. vendor/guzzlehttp/psr7/tests/StreamWrapperTest.php +0 -102
  130. vendor/guzzlehttp/psr7/tests/UploadedFileTest.php +0 -280
  131. vendor/guzzlehttp/psr7/tests/UriNormalizerTest.php +0 -175
  132. vendor/guzzlehttp/psr7/tests/UriResoverTest.php +0 -203
  133. vendor/guzzlehttp/psr7/tests/UriTest.php +0 -660
  134. vendor/league/flysystem-azure-blob-storage/.gitignore +5 -0
  135. vendor/league/flysystem-azure-blob-storage/.travis.yml +19 -0
  136. vendor/league/flysystem-azure-blob-storage/composer.json +24 -0
  137. vendor/league/flysystem-azure-blob-storage/phpunit.xml +29 -0
  138. vendor/league/flysystem-azure-blob-storage/readme.md +3 -0
  139. vendor/league/flysystem-azure-blob-storage/src/AzureBlobStorageAdapter.php +309 -0
  140. vendor/league/flysystem-azure-blob-storage/tests/AzureBlobStorageTest.php +273 -0
  141. vendor/league/flysystem-azure/composer.json +0 -33
  142. vendor/league/flysystem-azure/src/Adapter.php +0 -11
  143. vendor/league/flysystem-azure/src/AzureAdapter.php +0 -392
  144. vendor/league/{flysystem-azure/LICENCE → flysystem-sftp/LICENSE} +1 -1
  145. vendor/league/flysystem/.appveyor.yml +56 -0
  146. vendor/league/flysystem/.github/ISSUE_TEMPLATE/Bug.md +24 -0
  147. vendor/league/flysystem/.github/ISSUE_TEMPLATE/Feature_Request.md +21 -0
  148. vendor/league/flysystem/.github/ISSUE_TEMPLATE/Question.md +12 -0
  149. vendor/league/flysystem/deprecations.md +19 -0
  150. vendor/league/flysystem/docs/guides/laravel-usage.md +18 -0
  151. vendor/microsoft/azure-storage-blob/BreakingChanges.md +5 -0
  152. vendor/microsoft/azure-storage-blob/CONTRIBUTING.md +1 -0
  153. vendor/microsoft/azure-storage-blob/ChangeLog.md +34 -0
  154. vendor/microsoft/{azure-storage → azure-storage-blob}/LICENSE +0 -0
  155. vendor/microsoft/azure-storage-blob/README.md +174 -0
  156. vendor/microsoft/azure-storage-blob/composer.json +22 -0
  157. vendor/microsoft/azure-storage-blob/src/Blob/BlobRestProxy.php +4706 -0
  158. vendor/microsoft/azure-storage-blob/src/Blob/BlobSharedAccessSignatureHelper.php +213 -0
  159. vendor/microsoft/azure-storage-blob/src/Blob/Internal/BlobResources.php +110 -0
  160. vendor/microsoft/azure-storage-blob/src/Blob/Internal/IBlob.php +1588 -0
  161. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/AccessCondition.php +167 -59
  162. vendor/microsoft/azure-storage-blob/src/Blob/Models/AccessTierTrait.php +70 -0
  163. vendor/microsoft/{azure-storage/src/Blob/Models/CreateBlobSnapshotOptions.php → azure-storage-blob/src/Blob/Models/AppendBlockOptions.php} +43 -58
  164. vendor/microsoft/azure-storage-blob/src/Blob/Models/AppendBlockResult.php +244 -0
  165. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/Blob.php +21 -44
  166. vendor/microsoft/{azure-storage/src/Blob/Models/DeleteContainerOptions.php → azure-storage-blob/src/Blob/Models/BlobAccessPolicy.php} +20 -27
  167. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BlobBlockType.php +14 -15
  168. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BlobPrefix.php +6 -12
  169. vendor/microsoft/azure-storage-blob/src/Blob/Models/BlobProperties.php +799 -0
  170. vendor/microsoft/{azure-storage/src/Blob/Models/SetBlobMetadataOptions.php → azure-storage-blob/src/Blob/Models/BlobServiceOptions.php} +30 -33
  171. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BlobType.php +3 -5
  172. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/Block.php +25 -23
  173. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BlockList.php +50 -53
  174. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BreakLeaseResult.php +17 -20
  175. vendor/microsoft/azure-storage-blob/src/Blob/Models/CommitBlobBlocksOptions.php +223 -0
  176. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/Container.php +19 -38
  177. vendor/microsoft/azure-storage-blob/src/Blob/Models/ContainerACL.php +164 -0
  178. vendor/microsoft/{azure-storage/src/Blob/Models/AcquireLeaseOptions.php → azure-storage-blob/src/Blob/Models/ContainerAccessPolicy.php} +20 -27
  179. vendor/microsoft/azure-storage-blob/src/Blob/Models/ContainerProperties.php +184 -0
  180. vendor/microsoft/azure-storage-blob/src/Blob/Models/CopyBlobFromURLOptions.php +138 -0
  181. vendor/microsoft/azure-storage-blob/src/Blob/Models/CopyBlobOptions.php +62 -0
  182. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/CopyBlobResult.php +87 -28
  183. vendor/microsoft/azure-storage-blob/src/Blob/Models/CopyState.php +294 -0
  184. vendor/microsoft/{azure-storage/src/Blob/Models/CreateBlobPagesOptions.php → azure-storage-blob/src/Blob/Models/CreateBlobBlockOptions.php} +41 -62
  185. vendor/microsoft/azure-storage-blob/src/Blob/Models/CreateBlobOptions.php +247 -0
  186. vendor/microsoft/{azure-storage/src/Blob/Models/CreateBlobBlockOptions.php → azure-storage-blob/src/Blob/Models/CreateBlobPagesOptions.php} +7 -40
  187. vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/CreateBlobPagesResult.php +79 -56
  188. vendor/microsoft/azure-storage-blob/src/Blob/Models/CreateBlobSnapshotOptions.php +22 -0
README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: xcloner
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AAPE8PLAE554S
4
  Tags: backup plugin, restore plugin, database backup, backup encryption, site backup, website cloner, wordpress backup, database restore, webdav, azure, ftp, sftp, amazon s3, dropbox, google drive, differential backup
5
  Requires at least: 3.0.1
6
- Tested up to: 5.1
7
- Stable tag: 4.1.1
8
 
9
  Backup your site, restore to any web location, encrypt and send your backups to Dropbox, Amazon S3, Azure, FTP, SFTP, WebDAV, Google Drive with XCloner plugin.
10
 
@@ -114,6 +114,14 @@ Immigration Attorney Montana <a href="https://www.immigrationlawofmt.com" target
114
 
115
  == Changelog ==
116
 
 
 
 
 
 
 
 
 
117
  = 4.1.1 =
118
  * log tmp directories fix, tracking only ERROR reports from php
119
  * security improvement backup log name
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AAPE8PLAE554S
4
  Tags: backup plugin, restore plugin, database backup, backup encryption, site backup, website cloner, wordpress backup, database restore, webdav, azure, ftp, sftp, amazon s3, dropbox, google drive, differential backup
5
  Requires at least: 3.0.1
6
+ Tested up to: 5.3
7
+ Stable tag: 4.1.2
8
 
9
  Backup your site, restore to any web location, encrypt and send your backups to Dropbox, Amazon S3, Azure, FTP, SFTP, WebDAV, Google Drive with XCloner plugin.
10
 
114
 
115
  == Changelog ==
116
 
117
+ = 4.1.2 =
118
+ * improved default backup storage path security
119
+ * improved remote storage security
120
+
121
+ = 4.1.2 =
122
+ * vendor lib updates
123
+ * flysystem azure storage Upgrade
124
+
125
  = 4.1.1 =
126
  * log tmp directories fix, tracking only ERROR reports from php
127
  * security improvement backup log name
admin/partials/xcloner_remote_storage_page.php CHANGED
@@ -68,8 +68,9 @@ $gdrive_construct = $remote_storage->gdrive_construct();
68
  </div>
69
  <div class=" col s12 m6">
70
  <input placeholder="<?php echo __("Ftp Password", 'xcloner-backup-and-restore') ?>"
71
- id="ftp_password" type="password" name="xcloner_ftp_password" class="validate"
72
- value="<?php echo get_option("xcloner_ftp_password") ?>" autocomplete="off">
 
73
  </div>
74
  </div>
75
 
@@ -208,8 +209,9 @@ $gdrive_construct = $remote_storage->gdrive_construct();
208
  </div>
209
  <div class=" col s12 m6">
210
  <input placeholder="<?php echo __("SFTP or Private Key Password", 'xcloner-backup-and-restore') ?>"
211
- id="ftp_spassword" type="password" name="xcloner_sftp_password" class="validate"
212
- value="<?php echo get_option("xcloner_sftp_password") ?>" autocomplete="off">
 
213
  </div>
214
  </div>
215
 
@@ -324,7 +326,8 @@ $gdrive_construct = $remote_storage->gdrive_construct();
324
  <div class=" col s12 m6">
325
  <input placeholder="<?php echo __("S3 Secret", 'xcloner-backup-and-restore') ?>"
326
  id="aws_secret" type="text" name="xcloner_aws_secret" class="validate"
327
- value="<?php echo get_option("xcloner_aws_secret") ?>" autocomplete="off">
 
328
  </div>
329
  </div>
330
 
@@ -464,7 +467,8 @@ $gdrive_construct = $remote_storage->gdrive_construct();
464
  <div class=" col s12 m6">
465
  <input placeholder="<?php echo __("Dropbox App Secret", 'xcloner-backup-and-restore') ?>"
466
  id="dropbox_app_secret" type="text" name="xcloner_dropbox_app_secret"
467
- class="validate" value="<?php echo get_option("xcloner_dropbox_app_secret") ?>"
 
468
  autocomplete="off">
469
  </div>
470
  </div>
@@ -559,7 +563,8 @@ $gdrive_construct = $remote_storage->gdrive_construct();
559
  <div class=" col s12 m6">
560
  <input placeholder="<?php echo __("Azure Api Key", 'xcloner-backup-and-restore') ?>"
561
  id="azure_api_key" type="text" name="xcloner_azure_api_key" class="validate"
562
- value="<?php echo get_option("xcloner_azure_api_key") ?>" autocomplete="off">
 
563
  </div>
564
  </div>
565
 
@@ -655,7 +660,7 @@ $gdrive_construct = $remote_storage->gdrive_construct();
655
  <input placeholder="<?php echo __("Backblaze Application Key", 'xcloner-backup-and-restore') ?>"
656
  id="backblaze_application_key" type="text"
657
  name="xcloner_backblaze_application_key" class="validate"
658
- value="<?php echo get_option("xcloner_backblaze_application_key") ?>"
659
  autocomplete="off">
660
  </div>
661
  </div>
@@ -760,8 +765,9 @@ $gdrive_construct = $remote_storage->gdrive_construct();
760
  </div>
761
  <div class=" col s12 m6">
762
  <input placeholder="<?php echo __("WebDAV Password", 'xcloner-backup-and-restore') ?>"
763
- id="webdav_password" type="password" name="xcloner_webdav_password"
764
- class="validate" value="<?php echo get_option("xcloner_webdav_password") ?>"
 
765
  autocomplete="off">
766
  </div>
767
  </div>
@@ -868,7 +874,7 @@ $gdrive_construct = $remote_storage->gdrive_construct();
868
  <input placeholder="<?php echo __("Google Client Secret", 'xcloner-backup-and-restore') ?>"
869
  id="gdrive_client_secret" type="text" name="xcloner_gdrive_client_secret"
870
  class="validate"
871
- value="<?php echo get_option("xcloner_gdrive_client_secret") ?>">
872
  </div>
873
  </div>
874
 
68
  </div>
69
  <div class=" col s12 m6">
70
  <input placeholder="<?php echo __("Ftp Password", 'xcloner-backup-and-restore') ?>"
71
+ id="ftp_password" type="text" name="xcloner_ftp_password" class="validate"
72
+ value="<?php echo str_repeat('*', strlen( get_option("xcloner_ftp_password"))) ?>"
73
+ autocomplete="off">
74
  </div>
75
  </div>
76
 
209
  </div>
210
  <div class=" col s12 m6">
211
  <input placeholder="<?php echo __("SFTP or Private Key Password", 'xcloner-backup-and-restore') ?>"
212
+ id="ftp_spassword" type="text" name="xcloner_sftp_password" class="validate"
213
+ value="<?php echo str_repeat('*', strlen( get_option("xcloner_sftp_password"))) ?>"
214
+ autocomplete="off">
215
  </div>
216
  </div>
217
 
326
  <div class=" col s12 m6">
327
  <input placeholder="<?php echo __("S3 Secret", 'xcloner-backup-and-restore') ?>"
328
  id="aws_secret" type="text" name="xcloner_aws_secret" class="validate"
329
+ value="<?php echo str_repeat('*', strlen( get_option("xcloner_aws_secret"))) ?>"
330
+ autocomplete="off">
331
  </div>
332
  </div>
333
 
467
  <div class=" col s12 m6">
468
  <input placeholder="<?php echo __("Dropbox App Secret", 'xcloner-backup-and-restore') ?>"
469
  id="dropbox_app_secret" type="text" name="xcloner_dropbox_app_secret"
470
+ class="validate"
471
+ value="<?php echo str_repeat('*', strlen( get_option("xcloner_dropbox_app_secret"))) ?>"
472
  autocomplete="off">
473
  </div>
474
  </div>
563
  <div class=" col s12 m6">
564
  <input placeholder="<?php echo __("Azure Api Key", 'xcloner-backup-and-restore') ?>"
565
  id="azure_api_key" type="text" name="xcloner_azure_api_key" class="validate"
566
+ value="<?php echo str_repeat('*', strlen(get_option("xcloner_azure_api_key"))) ?>"
567
+ autocomplete="off">
568
  </div>
569
  </div>
570
 
660
  <input placeholder="<?php echo __("Backblaze Application Key", 'xcloner-backup-and-restore') ?>"
661
  id="backblaze_application_key" type="text"
662
  name="xcloner_backblaze_application_key" class="validate"
663
+ value="<?php echo str_repeat('*', strlen(get_option("xcloner_backblaze_application_key"))) ?>"
664
  autocomplete="off">
665
  </div>
666
  </div>
765
  </div>
766
  <div class=" col s12 m6">
767
  <input placeholder="<?php echo __("WebDAV Password", 'xcloner-backup-and-restore') ?>"
768
+ id="webdav_password" type="text" name="xcloner_webdav_password"
769
+ class="validate"
770
+ value="<?php echo str_repeat('*', strlen(get_option("xcloner_webdav_password"))) ?>"
771
  autocomplete="off">
772
  </div>
773
  </div>
874
  <input placeholder="<?php echo __("Google Client Secret", 'xcloner-backup-and-restore') ?>"
875
  id="gdrive_client_secret" type="text" name="xcloner_gdrive_client_secret"
876
  class="validate"
877
+ value="<?php echo str_repeat('*', strlen(get_option("xcloner_gdrive_client_secret"))) ?>">
878
  </div>
879
  </div>
880
 
composer.json CHANGED
@@ -5,11 +5,11 @@
5
  "league/flysystem": "^1.0",
6
  "monolog/monolog": "^1.22",
7
  "league/flysystem-sftp": "^1.0",
8
- "league/flysystem-azure": "^1.0",
9
  "league/flysystem-aws-s3-v3": "^1.0",
10
  "mhetreramesh/flysystem-backblaze": "^1.0",
11
  "league/flysystem-webdav": "^1.0",
12
- "srmklive/flysystem-dropbox-v2": "^1.0"
 
13
  },
14
  "prefer-stable": true,
15
  "require-dev": {
5
  "league/flysystem": "^1.0",
6
  "monolog/monolog": "^1.22",
7
  "league/flysystem-sftp": "^1.0",
 
8
  "league/flysystem-aws-s3-v3": "^1.0",
9
  "mhetreramesh/flysystem-backblaze": "^1.0",
10
  "league/flysystem-webdav": "^1.0",
11
+ "srmklive/flysystem-dropbox-v2": "^1.0",
12
+ "league/flysystem-azure-blob-storage": "^0.1.6"
13
  },
14
  "prefer-stable": true,
15
  "require-dev": {
composer.lock CHANGED
@@ -4,7 +4,7 @@
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
- "content-hash": "e32ba7a3036306157c1f3563665aec57",
8
  "packages": [
9
  {
10
  "name": "aws/aws-sdk-php",
@@ -184,44 +184,46 @@
184
  },
185
  {
186
  "name": "guzzlehttp/guzzle",
187
- "version": "6.3.3",
188
  "source": {
189
  "type": "git",
190
  "url": "https://github.com/guzzle/guzzle.git",
191
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
192
  },
193
  "dist": {
194
  "type": "zip",
195
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
196
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
197
  "shasum": ""
198
  },
199
  "require": {
 
200
  "guzzlehttp/promises": "^1.0",
201
- "guzzlehttp/psr7": "^1.4",
202
  "php": ">=5.5"
203
  },
204
  "require-dev": {
205
  "ext-curl": "*",
206
  "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
207
- "psr/log": "^1.0"
208
  },
209
  "suggest": {
 
210
  "psr/log": "Required for using the Log middleware"
211
  },
212
  "type": "library",
213
  "extra": {
214
  "branch-alias": {
215
- "dev-master": "6.3-dev"
216
  }
217
  },
218
  "autoload": {
219
- "files": [
220
- "src/functions_include.php"
221
- ],
222
  "psr-4": {
223
  "GuzzleHttp\\": "src/"
224
- }
 
 
 
225
  },
226
  "notification-url": "https://packagist.org/downloads/",
227
  "license": [
@@ -245,7 +247,7 @@
245
  "rest",
246
  "web service"
247
  ],
248
- "time": "2018-04-22T15:46:56+00:00"
249
  },
250
  {
251
  "name": "guzzlehttp/promises",
@@ -300,32 +302,37 @@
300
  },
301
  {
302
  "name": "guzzlehttp/psr7",
303
- "version": "1.4.2",
304
  "source": {
305
  "type": "git",
306
  "url": "https://github.com/guzzle/psr7.git",
307
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
308
  },
309
  "dist": {
310
  "type": "zip",
311
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
312
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
313
  "shasum": ""
314
  },
315
  "require": {
316
  "php": ">=5.4.0",
317
- "psr/http-message": "~1.0"
 
318
  },
319
  "provide": {
320
  "psr/http-message-implementation": "1.0"
321
  },
322
  "require-dev": {
323
- "phpunit/phpunit": "~4.0"
 
 
 
 
324
  },
325
  "type": "library",
326
  "extra": {
327
  "branch-alias": {
328
- "dev-master": "1.4-dev"
329
  }
330
  },
331
  "autoload": {
@@ -355,13 +362,14 @@
355
  "keywords": [
356
  "http",
357
  "message",
 
358
  "request",
359
  "response",
360
  "stream",
361
  "uri",
362
  "url"
363
  ],
364
- "time": "2017-03-20T17:10:46+00:00"
365
  },
366
  {
367
  "name": "league/flysystem",
@@ -495,37 +503,32 @@
495
  "time": "2018-03-27T20:33:59+00:00"
496
  },
497
  {
498
- "name": "league/flysystem-azure",
499
- "version": "1.0.4",
500
  "source": {
501
  "type": "git",
502
- "url": "https://github.com/thephpleague/flysystem-azure.git",
503
- "reference": "0b9838c4f75ee41bc390357b0350e9a62e3b3a1f"
504
  },
505
  "dist": {
506
  "type": "zip",
507
- "url": "https://api.github.com/repos/thephpleague/flysystem-azure/zipball/0b9838c4f75ee41bc390357b0350e9a62e3b3a1f",
508
- "reference": "0b9838c4f75ee41bc390357b0350e9a62e3b3a1f",
509
  "shasum": ""
510
  },
511
  "require": {
512
- "league/flysystem": "~1.0",
513
- "microsoft/azure-storage": "~0.10.1",
514
- "php": ">=5.5.0"
 
515
  },
516
  "require-dev": {
517
- "mockery/mockery": "~0.9",
518
- "phpunit/phpunit": "~4.0"
519
  },
520
  "type": "library",
521
- "extra": {
522
- "branch-alias": {
523
- "dev-master": "1.0-dev"
524
- }
525
- },
526
  "autoload": {
527
  "psr-4": {
528
- "League\\Flysystem\\Azure\\": "src/"
529
  }
530
  },
531
  "notification-url": "https://packagist.org/downloads/",
@@ -538,9 +541,7 @@
538
  "email": "info@frenky.net"
539
  }
540
  ],
541
- "description": "Flysystem adapter for Windows Azure",
542
- "abandoned": "league/flysystem-azure-blob-storage",
543
- "time": "2016-07-10T19:08:39+00:00"
544
  },
545
  {
546
  "name": "league/flysystem-sftp",
@@ -687,42 +688,71 @@
687
  "time": "2018-06-29T12:06:41+00:00"
688
  },
689
  {
690
- "name": "microsoft/azure-storage",
691
- "version": "v0.10.2",
692
  "source": {
693
  "type": "git",
694
- "url": "https://github.com/Azure/azure-storage-php.git",
695
- "reference": "27de05b00c1858d6e1c6adbc489efa90e0342f82"
696
  },
697
  "dist": {
698
  "type": "zip",
699
- "url": "https://api.github.com/repos/Azure/azure-storage-php/zipball/27de05b00c1858d6e1c6adbc489efa90e0342f82",
700
- "reference": "27de05b00c1858d6e1c6adbc489efa90e0342f82",
701
  "shasum": ""
702
  },
703
  "require": {
704
- "guzzlehttp/guzzle": "~6.0",
705
- "php": ">=5.5.0"
706
- },
707
- "require-dev": {
708
- "mikey179/vfsstream": "~1.6",
709
- "pdepend/pdepend": "~2.2",
710
- "phploc/phploc": "~2.1",
711
- "phpmd/phpmd": "@stable",
712
- "phpunit/phpunit": "~4.0",
713
- "sebastian/phpcpd": "~2.0",
714
- "squizlabs/php_codesniffer": "2.*",
715
- "theseer/phpdox": "~0.8"
716
  },
717
  "type": "library",
718
- "extra": {
719
- "branch-alias": {
720
- "dev-master": "0.10.x-dev"
721
  }
722
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
723
  "autoload": {
724
  "psr-4": {
725
- "MicrosoftAzure\\Storage\\": "src/"
726
  }
727
  },
728
  "notification-url": "https://packagist.org/downloads/",
@@ -731,31 +761,31 @@
731
  ],
732
  "authors": [
733
  {
734
- "name": "Azure Storage PHP SDK",
735
  "email": "dmsh@microsoft.com"
736
  }
737
  ],
738
- "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure storage APIs.",
739
  "keywords": [
740
  "azure",
 
741
  "php",
742
  "sdk",
743
  "storage"
744
  ],
745
- "abandoned": "microsoft/azure-storage-blob, microsoft/azure-storage-table, microsoft/azure-storage-queue, microsoft/azure-storage-file",
746
- "time": "2016-08-19T08:32:57+00:00"
747
  },
748
  {
749
  "name": "mikey179/vfsStream",
750
  "version": "v1.6.5",
751
  "source": {
752
  "type": "git",
753
- "url": "https://github.com/mikey179/vfsStream.git",
754
  "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145"
755
  },
756
  "dist": {
757
  "type": "zip",
758
- "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
759
  "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
760
  "shasum": ""
761
  },
@@ -1113,18 +1143,58 @@
1113
  ],
1114
  "time": "2016-10-10T12:19:37+00:00"
1115
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1116
  {
1117
  "name": "sabre/dav",
1118
- "version": "3.2.2",
1119
  "source": {
1120
  "type": "git",
1121
  "url": "https://github.com/sabre-io/dav.git",
1122
- "reference": "e987775e619728f12205606c9cc3ee565ffb1516"
1123
  },
1124
  "dist": {
1125
  "type": "zip",
1126
- "url": "https://api.github.com/repos/sabre-io/dav/zipball/e987775e619728f12205606c9cc3ee565ffb1516",
1127
- "reference": "e987775e619728f12205606c9cc3ee565ffb1516",
1128
  "shasum": ""
1129
  },
1130
  "require": {
@@ -1194,7 +1264,7 @@
1194
  "framework",
1195
  "iCalendar"
1196
  ],
1197
- "time": "2017-02-15T03:06:08+00:00"
1198
  },
1199
  {
1200
  "name": "sabre/event",
@@ -1362,16 +1432,16 @@
1362
  },
1363
  {
1364
  "name": "sabre/vobject",
1365
- "version": "4.1.6",
1366
  "source": {
1367
  "type": "git",
1368
  "url": "https://github.com/sabre-io/vobject.git",
1369
- "reference": "122cacbdea2c6133ac04db86ec05854beef75adf"
1370
  },
1371
  "dist": {
1372
  "type": "zip",
1373
- "url": "https://api.github.com/repos/sabre-io/vobject/zipball/122cacbdea2c6133ac04db86ec05854beef75adf",
1374
- "reference": "122cacbdea2c6133ac04db86ec05854beef75adf",
1375
  "shasum": ""
1376
  },
1377
  "require": {
@@ -1380,8 +1450,7 @@
1380
  "sabre/xml": ">=1.5 <3.0"
1381
  },
1382
  "require-dev": {
1383
- "phpunit/phpunit": "> 4.8.35, <6.0.0",
1384
- "sabre/cs": "^1.0.0"
1385
  },
1386
  "suggest": {
1387
  "hoa/bench": "If you would like to run the benchmark scripts"
@@ -1455,7 +1524,7 @@
1455
  "xCal",
1456
  "xCard"
1457
  ],
1458
- "time": "2018-04-20T07:22:50+00:00"
1459
  },
1460
  {
1461
  "name": "sabre/xml",
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
+ "content-hash": "59f6f2441b9d1bfe2625a5ff6f6b8414",
8
  "packages": [
9
  {
10
  "name": "aws/aws-sdk-php",
184
  },
185
  {
186
  "name": "guzzlehttp/guzzle",
187
+ "version": "6.5.0",
188
  "source": {
189
  "type": "git",
190
  "url": "https://github.com/guzzle/guzzle.git",
191
+ "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5"
192
  },
193
  "dist": {
194
  "type": "zip",
195
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5",
196
+ "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5",
197
  "shasum": ""
198
  },
199
  "require": {
200
+ "ext-json": "*",
201
  "guzzlehttp/promises": "^1.0",
202
+ "guzzlehttp/psr7": "^1.6.1",
203
  "php": ">=5.5"
204
  },
205
  "require-dev": {
206
  "ext-curl": "*",
207
  "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
208
+ "psr/log": "^1.1"
209
  },
210
  "suggest": {
211
+ "ext-intl": "Required for Internationalized Domain Name (IDN) support",
212
  "psr/log": "Required for using the Log middleware"
213
  },
214
  "type": "library",
215
  "extra": {
216
  "branch-alias": {
217
+ "dev-master": "6.5-dev"
218
  }
219
  },
220
  "autoload": {
 
 
 
221
  "psr-4": {
222
  "GuzzleHttp\\": "src/"
223
+ },
224
+ "files": [
225
+ "src/functions_include.php"
226
+ ]
227
  },
228
  "notification-url": "https://packagist.org/downloads/",
229
  "license": [
247
  "rest",
248
  "web service"
249
  ],
250
+ "time": "2019-12-07T18:20:45+00:00"
251
  },
252
  {
253
  "name": "guzzlehttp/promises",
302
  },
303
  {
304
  "name": "guzzlehttp/psr7",
305
+ "version": "1.6.1",
306
  "source": {
307
  "type": "git",
308
  "url": "https://github.com/guzzle/psr7.git",
309
+ "reference": "239400de7a173fe9901b9ac7c06497751f00727a"
310
  },
311
  "dist": {
312
  "type": "zip",
313
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
314
+ "reference": "239400de7a173fe9901b9ac7c06497751f00727a",
315
  "shasum": ""
316
  },
317
  "require": {
318
  "php": ">=5.4.0",
319
+ "psr/http-message": "~1.0",
320
+ "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
321
  },
322
  "provide": {
323
  "psr/http-message-implementation": "1.0"
324
  },
325
  "require-dev": {
326
+ "ext-zlib": "*",
327
+ "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
328
+ },
329
+ "suggest": {
330
+ "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
331
  },
332
  "type": "library",
333
  "extra": {
334
  "branch-alias": {
335
+ "dev-master": "1.6-dev"
336
  }
337
  },
338
  "autoload": {
362
  "keywords": [
363
  "http",
364
  "message",
365
+ "psr-7",
366
  "request",
367
  "response",
368
  "stream",
369
  "uri",
370
  "url"
371
  ],
372
+ "time": "2019-07-01T23:21:34+00:00"
373
  },
374
  {
375
  "name": "league/flysystem",
503
  "time": "2018-03-27T20:33:59+00:00"
504
  },
505
  {
506
+ "name": "league/flysystem-azure-blob-storage",
507
+ "version": "0.1.6",
508
  "source": {
509
  "type": "git",
510
+ "url": "https://github.com/thephpleague/flysystem-azure-blob-storage.git",
511
+ "reference": "97215345f3c42679299ba556a4d16d4847ee7f6d"
512
  },
513
  "dist": {
514
  "type": "zip",
515
+ "url": "https://api.github.com/repos/thephpleague/flysystem-azure-blob-storage/zipball/97215345f3c42679299ba556a4d16d4847ee7f6d",
516
+ "reference": "97215345f3c42679299ba556a4d16d4847ee7f6d",
517
  "shasum": ""
518
  },
519
  "require": {
520
+ "guzzlehttp/psr7": "^1.5",
521
+ "league/flysystem": "^1.0",
522
+ "microsoft/azure-storage-blob": "^1.1",
523
+ "php": ">=5.6"
524
  },
525
  "require-dev": {
526
+ "phpunit/phpunit": "^5.7"
 
527
  },
528
  "type": "library",
 
 
 
 
 
529
  "autoload": {
530
  "psr-4": {
531
+ "League\\Flysystem\\AzureBlobStorage\\": "src/"
532
  }
533
  },
534
  "notification-url": "https://packagist.org/downloads/",
541
  "email": "info@frenky.net"
542
  }
543
  ],
544
+ "time": "2019-06-07T20:42:16+00:00"
 
 
545
  },
546
  {
547
  "name": "league/flysystem-sftp",
688
  "time": "2018-06-29T12:06:41+00:00"
689
  },
690
  {
691
+ "name": "microsoft/azure-storage-blob",
692
+ "version": "1.4.0",
693
  "source": {
694
  "type": "git",
695
+ "url": "https://github.com/Azure/azure-storage-blob-php.git",
696
+ "reference": "8310c2ecab488fa325db3dcf2f8723bbcfe58941"
697
  },
698
  "dist": {
699
  "type": "zip",
700
+ "url": "https://api.github.com/repos/Azure/azure-storage-blob-php/zipball/8310c2ecab488fa325db3dcf2f8723bbcfe58941",
701
+ "reference": "8310c2ecab488fa325db3dcf2f8723bbcfe58941",
702
  "shasum": ""
703
  },
704
  "require": {
705
+ "microsoft/azure-storage-common": "~1.4",
706
+ "php": ">=5.6.0"
 
 
 
 
 
 
 
 
 
 
707
  },
708
  "type": "library",
709
+ "autoload": {
710
+ "psr-4": {
711
+ "MicrosoftAzure\\Storage\\Blob\\": "src/Blob"
712
  }
713
  },
714
+ "notification-url": "https://packagist.org/downloads/",
715
+ "license": [
716
+ "MIT"
717
+ ],
718
+ "authors": [
719
+ {
720
+ "name": "Azure Storage PHP Client Library",
721
+ "email": "dmsh@microsoft.com"
722
+ }
723
+ ],
724
+ "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.",
725
+ "keywords": [
726
+ "azure",
727
+ "blob",
728
+ "php",
729
+ "sdk",
730
+ "storage"
731
+ ],
732
+ "time": "2019-04-26T15:06:52+00:00"
733
+ },
734
+ {
735
+ "name": "microsoft/azure-storage-common",
736
+ "version": "1.4.0",
737
+ "source": {
738
+ "type": "git",
739
+ "url": "https://github.com/Azure/azure-storage-common-php.git",
740
+ "reference": "435adf4d09f0b34375f899b5627d2926bfe317e6"
741
+ },
742
+ "dist": {
743
+ "type": "zip",
744
+ "url": "https://api.github.com/repos/Azure/azure-storage-common-php/zipball/435adf4d09f0b34375f899b5627d2926bfe317e6",
745
+ "reference": "435adf4d09f0b34375f899b5627d2926bfe317e6",
746
+ "shasum": ""
747
+ },
748
+ "require": {
749
+ "guzzlehttp/guzzle": "~6.0",
750
+ "php": ">=5.6.0"
751
+ },
752
+ "type": "library",
753
  "autoload": {
754
  "psr-4": {
755
+ "MicrosoftAzure\\Storage\\Common\\": "src/Common"
756
  }
757
  },
758
  "notification-url": "https://packagist.org/downloads/",
761
  ],
762
  "authors": [
763
  {
764
+ "name": "Azure Storage PHP Client Library",
765
  "email": "dmsh@microsoft.com"
766
  }
767
  ],
768
+ "description": "This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.",
769
  "keywords": [
770
  "azure",
771
+ "common",
772
  "php",
773
  "sdk",
774
  "storage"
775
  ],
776
+ "time": "2019-04-26T15:02:17+00:00"
 
777
  },
778
  {
779
  "name": "mikey179/vfsStream",
780
  "version": "v1.6.5",
781
  "source": {
782
  "type": "git",
783
+ "url": "https://github.com/bovigo/vfsStream.git",
784
  "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145"
785
  },
786
  "dist": {
787
  "type": "zip",
788
+ "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
789
  "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
790
  "shasum": ""
791
  },
1143
  ],
1144
  "time": "2016-10-10T12:19:37+00:00"
1145
  },
1146
+ {
1147
+ "name": "ralouphie/getallheaders",
1148
+ "version": "3.0.3",
1149
+ "source": {
1150
+ "type": "git",
1151
+ "url": "https://github.com/ralouphie/getallheaders.git",
1152
+ "reference": "120b605dfeb996808c31b6477290a714d356e822"
1153
+ },
1154
+ "dist": {
1155
+ "type": "zip",
1156
+ "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
1157
+ "reference": "120b605dfeb996808c31b6477290a714d356e822",
1158
+ "shasum": ""
1159
+ },
1160
+ "require": {
1161
+ "php": ">=5.6"
1162
+ },
1163
+ "require-dev": {
1164
+ "php-coveralls/php-coveralls": "^2.1",
1165
+ "phpunit/phpunit": "^5 || ^6.5"
1166
+ },
1167
+ "type": "library",
1168
+ "autoload": {
1169
+ "files": [
1170
+ "src/getallheaders.php"
1171
+ ]
1172
+ },
1173
+ "notification-url": "https://packagist.org/downloads/",
1174
+ "license": [
1175
+ "MIT"
1176
+ ],
1177
+ "authors": [
1178
+ {
1179
+ "name": "Ralph Khattar",
1180
+ "email": "ralph.khattar@gmail.com"
1181
+ }
1182
+ ],
1183
+ "description": "A polyfill for getallheaders.",
1184
+ "time": "2019-03-08T08:55:37+00:00"
1185
+ },
1186
  {
1187
  "name": "sabre/dav",
1188
+ "version": "3.2.3",
1189
  "source": {
1190
  "type": "git",
1191
  "url": "https://github.com/sabre-io/dav.git",
1192
+ "reference": "a9780ce4f35560ecbd0af524ad32d9d2c8954b80"
1193
  },
1194
  "dist": {
1195
  "type": "zip",
1196
+ "url": "https://api.github.com/repos/sabre-io/dav/zipball/a9780ce4f35560ecbd0af524ad32d9d2c8954b80",
1197
+ "reference": "a9780ce4f35560ecbd0af524ad32d9d2c8954b80",
1198
  "shasum": ""
1199
  },
1200
  "require": {
1264
  "framework",
1265
  "iCalendar"
1266
  ],
1267
+ "time": "2018-10-19T09:58:27+00:00"
1268
  },
1269
  {
1270
  "name": "sabre/event",
1432
  },
1433
  {
1434
  "name": "sabre/vobject",
1435
+ "version": "4.2.0",
1436
  "source": {
1437
  "type": "git",
1438
  "url": "https://github.com/sabre-io/vobject.git",
1439
+ "reference": "bd500019764e434ff65872d426f523e7882a0739"
1440
  },
1441
  "dist": {
1442
  "type": "zip",
1443
+ "url": "https://api.github.com/repos/sabre-io/vobject/zipball/bd500019764e434ff65872d426f523e7882a0739",
1444
+ "reference": "bd500019764e434ff65872d426f523e7882a0739",
1445
  "shasum": ""
1446
  },
1447
  "require": {
1450
  "sabre/xml": ">=1.5 <3.0"
1451
  },
1452
  "require-dev": {
1453
+ "phpunit/phpunit": "> 4.8.35, <6.0.0"
 
1454
  },
1455
  "suggest": {
1456
  "hoa/bench": "If you would like to run the benchmark scripts"
1524
  "xCal",
1525
  "xCard"
1526
  ],
1527
+ "time": "2019-02-19T13:05:37+00:00"
1528
  },
1529
  {
1530
  "name": "sabre/xml",
includes/class-xcloner-activator.php CHANGED
@@ -104,6 +104,10 @@ class Xcloner_Activator {
104
  update_option('xcloner_enable_log', 1);
105
  }
106
 
 
 
 
 
107
  if (get_option('xcloner_enable_mysql_backup') === false) {
108
  update_option('xcloner_enable_mysql_backup', 1);
109
  }
104
  update_option('xcloner_enable_log', 1);
105
  }
106
 
107
+ if (get_option('xcloner_force_tmp_path_site_root') === false) {
108
+ update_option('xcloner_force_tmp_path_site_root', 1);
109
+ }
110
+
111
  if (get_option('xcloner_enable_mysql_backup') === false) {
112
  update_option('xcloner_enable_mysql_backup', 1);
113
  }
includes/class-xcloner-database.php CHANGED
@@ -513,13 +513,16 @@ class Xcloner_Database extends wpdb {
513
  $this->countRecords++;
514
 
515
  foreach ($arr as $key => $value) {
516
- $value = $this->_real_escape($value);
517
-
518
- if (method_exists($this, 'remove_placeholder_escape')) {
519
- $value = $this->remove_placeholder_escape($value);
 
 
 
 
 
520
  }
521
-
522
- $buffer .= "'".$value."', ";
523
  }
524
  $buffer = rtrim($buffer, ', ').");\n";
525
  $this->fs->get_tmp_filesystem_append()->write($dumpfile, $buffer);
513
  $this->countRecords++;
514
 
515
  foreach ($arr as $key => $value) {
516
+ if (!is_null($value)) {
517
+ $value = $this->_real_escape($value);
518
+
519
+ if (method_exists($this, 'remove_placeholder_escape')) {
520
+ $value = $this->remove_placeholder_escape($value);
521
+ }
522
+ $buffer .= "'" . $value . "', ";
523
+ } else {
524
+ $buffer .= "null, ";
525
  }
 
 
526
  }
527
  $buffer = rtrim($buffer, ', ').");\n";
528
  $this->fs->get_tmp_filesystem_append()->write($dumpfile, $buffer);
includes/class-xcloner-file-system.php CHANGED
@@ -781,7 +781,7 @@ class Xcloner_File_System
781
  } elseif ($tag == '[hostname]') {
782
  $name = str_replace($tag, gethostname(), $name);
783
  }elseif ($tag == '[hash]') {
784
- $name = str_replace($tag, $this->xcloner_settings->randomString(5), $name);
785
  } elseif ($tag == '[domain]') {
786
  $domain = parse_url(admin_url(), PHP_URL_HOST);
787
  $name = str_replace($tag, $domain, $name);
781
  } elseif ($tag == '[hostname]') {
782
  $name = str_replace($tag, gethostname(), $name);
783
  }elseif ($tag == '[hash]') {
784
+ $name = str_replace($tag, $this->xcloner_container->randomString(5), $name);
785
  } elseif ($tag == '[domain]') {
786
  $domain = parse_url(admin_url(), PHP_URL_HOST);
787
  $name = str_replace($tag, $domain, $name);
includes/class-xcloner-remote-storage.php CHANGED
@@ -36,8 +36,8 @@ use League\Flysystem\Sftp\SftpAdapter;
36
  use Srmklive\Dropbox\Client\DropboxClient;
37
  use Srmklive\Dropbox\Adapter\DropboxAdapter;
38
 
39
- use MicrosoftAzure\Storage\Common\ServicesBuilder;
40
- use League\Flysystem\Azure\AzureAdapter;
41
 
42
  use Aws\S3\S3Client;
43
  use League\Flysystem\AwsS3v3\AwsS3Adapter;
@@ -106,7 +106,7 @@ class Xcloner_Remote_Storage
106
  "text" => "Azure BLOB",
107
  "azure_enable" => "int",
108
  "azure_account_name" => "string",
109
- "azure_api_key" => "string",
110
  "azure_container" => "string",
111
  "azure_cleanup_days" => "float",
112
  ),
@@ -114,7 +114,7 @@ class Xcloner_Remote_Storage
114
  "text" => "Backblaze",
115
  "backblaze_enable" => "int",
116
  "backblaze_account_id" => "string",
117
- "backblaze_application_key" => "string",
118
  "backblaze_bucket_name" => "string",
119
  "backblaze_cleanup_days" => "float",
120
  ),
@@ -267,9 +267,16 @@ class Xcloner_Remote_Storage
267
 
268
  if (is_array($this->storage_fields[$storage])) {
269
  foreach ($this->storage_fields[$storage] as $field => $validation) {
 
270
  $check_field = $this->storage_fields["option_prefix"] . $field;
271
  $sanitize_method = "sanitize_input_as_" . $validation;
272
 
 
 
 
 
 
 
273
  if (!isset($_POST[$check_field])) {
274
  $_POST[$check_field] = 0;
275
  }
@@ -507,9 +514,9 @@ class Xcloner_Remote_Storage
507
  get_option("xcloner_azure_api_key")
508
  );
509
 
510
- $blobRestProxy = ServicesBuilder::getInstance()->createBlobService($endpoint);
511
 
512
- $adapter = new AzureAdapter($blobRestProxy, get_option("xcloner_azure_container"));
513
 
514
  $filesystem = new Filesystem($adapter, new Config([
515
  'disable_asserts' => true,
@@ -612,7 +619,6 @@ class Xcloner_Remote_Storage
612
  //'proxy' => 'locahost:8888',
613
  );
614
 
615
-
616
  $client = new SabreClient($settings);
617
  $adapter = new WebDAVAdapter($client, get_option("xcloner_webdav_target_folder"));
618
  $filesystem = new Filesystem($adapter, new Config([
36
  use Srmklive\Dropbox\Client\DropboxClient;
37
  use Srmklive\Dropbox\Adapter\DropboxAdapter;
38
 
39
+ use League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter;
40
+ use MicrosoftAzure\Storage\Blob\BlobRestProxy;
41
 
42
  use Aws\S3\S3Client;
43
  use League\Flysystem\AwsS3v3\AwsS3Adapter;
106
  "text" => "Azure BLOB",
107
  "azure_enable" => "int",
108
  "azure_account_name" => "string",
109
+ "azure_api_key" => "raw",
110
  "azure_container" => "string",
111
  "azure_cleanup_days" => "float",
112
  ),
114
  "text" => "Backblaze",
115
  "backblaze_enable" => "int",
116
  "backblaze_account_id" => "string",
117
+ "backblaze_application_key" => "raw",
118
  "backblaze_bucket_name" => "string",
119
  "backblaze_cleanup_days" => "float",
120
  ),
267
 
268
  if (is_array($this->storage_fields[$storage])) {
269
  foreach ($this->storage_fields[$storage] as $field => $validation) {
270
+
271
  $check_field = $this->storage_fields["option_prefix"] . $field;
272
  $sanitize_method = "sanitize_input_as_" . $validation;
273
 
274
+
275
+ //we do not save empty encrypted credentials
276
+ if($validation == "raw" && str_repeat('*', strlen($_POST[$check_field])) == $_POST[$check_field] ){
277
+ continue;
278
+ }
279
+
280
  if (!isset($_POST[$check_field])) {
281
  $_POST[$check_field] = 0;
282
  }
514
  get_option("xcloner_azure_api_key")
515
  );
516
 
517
+ $blobRestProxy = BlobRestProxy::createBlobService($endpoint);
518
 
519
+ $adapter = new AzureBlobStorageAdapter($blobRestProxy, get_option("xcloner_azure_container"));
520
 
521
  $filesystem = new Filesystem($adapter, new Config([
522
  'disable_asserts' => true,
619
  //'proxy' => 'locahost:8888',
620
  );
621
 
 
622
  $client = new SabreClient($settings);
623
  $adapter = new WebDAVAdapter($client, get_option("xcloner_webdav_target_folder"));
624
  $filesystem = new Filesystem($adapter, new Config([
includes/class-xcloner-settings.php CHANGED
@@ -46,7 +46,7 @@ class Xcloner_Settings {
46
 
47
  public function get_xcloner_store_path() {
48
  if (!get_option('xcloner_store_path') or !is_dir(/** @scrutinizer ignore-type */get_option('xcloner_store_path'))) {
49
- $path = realpath(XCLONER_STORAGE_PATH);
50
  } else {
51
  $path = get_option('xcloner_store_path');
52
  }
@@ -58,7 +58,7 @@ class Xcloner_Settings {
58
 
59
  if (!get_option('xcloner_encryption_key'))
60
  {
61
- $key = $this->randomString(35);
62
  update_option('xcloner_encryption_key', $key);
63
  }
64
 
@@ -71,7 +71,7 @@ class Xcloner_Settings {
71
  * @param $length the length of the string to create
72
  * @return string
73
  */
74
- public function randomString($length = 6) {
75
  $str = "";
76
  $characters = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9'));
77
  $max = count($characters) - 1;
@@ -80,7 +80,7 @@ class Xcloner_Settings {
80
  $str .= $characters[$rand];
81
  }
82
  return $str;
83
- }
84
 
85
  public function get_xcloner_tmp_path_suffix() {
86
  return "xcloner".$this->get_hash();
46
 
47
  public function get_xcloner_store_path() {
48
  if (!get_option('xcloner_store_path') or !is_dir(/** @scrutinizer ignore-type */get_option('xcloner_store_path'))) {
49
+ $this->xcloner_container->check_dependencies();
50
  } else {
51
  $path = get_option('xcloner_store_path');
52
  }
58
 
59
  if (!get_option('xcloner_encryption_key'))
60
  {
61
+ $key = $this->xcloner_container->randomString(35);
62
  update_option('xcloner_encryption_key', $key);
63
  }
64
 
71
  * @param $length the length of the string to create
72
  * @return string
73
  */
74
+ /*public function randomString($length = 6) {
75
  $str = "";
76
  $characters = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9'));
77
  $max = count($characters) - 1;
80
  $str .= $characters[$rand];
81
  }
82
  return $str;
83
+ }*/
84
 
85
  public function get_xcloner_tmp_path_suffix() {
86
  return "xcloner".$this->get_hash();
includes/class-xcloner.php CHANGED
@@ -115,70 +115,11 @@ class Xcloner {
115
  }
116
 
117
  /**
118
- * Retrieve the version number of the plugin.
119
- *
120
- * @since 1.0.0
121
- * @return string The version number of the plugin.
122
  */
123
- /*public function get_version() {
124
- return $this->version;
125
- }
126
-
127
- public function get_xcloner_settings()
128
- {
129
- return $this->xcloner_settings;
130
- }
131
-
132
- public function get_xcloner_filesystem()
133
- {
134
- return $this->xcloner_filesystem;
135
- }
136
-
137
- public function get_xcloner_logger()
138
- {
139
- return $this->xcloner_logger;
140
- }
141
-
142
- public function get_xcloner_sanitization()
143
- {
144
- return $this->xcloner_sanitization;
145
- }
146
-
147
- public function get_xcloner_requirements()
148
- {
149
- return $this->xcloner_requirements;
150
- }
151
-
152
- public function get_archive_system()
153
- {
154
- return $this->archive_system;
155
- }
156
-
157
- public function get_xcloner_database()
158
- {
159
- return $this->xcloner_database;
160
- }
161
-
162
- public function get_xcloner_scheduler()
163
- {
164
- return $this->xcloner_scheduler;
165
- }
166
-
167
- public function get_xcloner_remote_storage()
168
- {
169
- return $this->xcloner_remote_storage;
170
- }
171
-
172
- public function get_xcloner_file_transfer()
173
- {
174
- return $this->xcloner_file_transfer;
175
- }
176
-
177
- public function get_xcloner_encryption()
178
- {
179
- return $this->xcloner_encryption;
180
- }*/
181
-
182
  public function __call($property, $args) {
183
 
184
  $property = str_replace("get_", "", $property);
@@ -188,30 +129,53 @@ class Xcloner {
188
  }
189
  }
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  public function check_dependencies() {
192
 
193
- $backup_storage_path = realpath(__DIR__.DS."..".DS."..".DS."..").DS."backups".DS;
194
 
195
- define("XCLONER_STORAGE_PATH", realpath($backup_storage_path));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
 
197
- if (!is_dir($backup_storage_path))
198
- {
199
- if (!@mkdir($backup_storage_path))
200
- {
201
- $status = "error";
202
- $message = sprintf(__("Unable to create the Backup Storage Location Folder %s . Please fix this before starting the backup process."), $backup_storage_path);
203
- $this->trigger_message($message, $status, $backup_storage_path);
204
- return;
205
- }
206
- }
207
- if (!is_writable($backup_storage_path))
208
- {
209
- $status = "error";
210
- $message = sprintf(__("Unable to write to the Backup Storage Location Folder %s . Please fix this before starting the backup process."), $backup_storage_path);
211
- $this->trigger_message($message, $status, $backup_storage_path);
212
 
213
- return;
214
- }
215
 
216
  }
217
 
115
  }
116
 
117
  /**
118
+ * Dynamic get of class methods get_
119
+ * @param $property
120
+ * @param $args
121
+ * @return mixed
122
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  public function __call($property, $args) {
124
 
125
  $property = str_replace("get_", "", $property);
129
  }
130
  }
131
 
132
+ /**
133
+ * Generate a random string of indicated length $length
134
+ *
135
+ * @param int $length
136
+ * @return string
137
+ */
138
+ public function randomString($length = 6) {
139
+ $str = "";
140
+ $characters = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9'));
141
+ $max = count($characters) - 1;
142
+ for ($i = 0; $i < $length; $i++) {
143
+ $rand = mt_rand(0, $max);
144
+ $str .= $characters[$rand];
145
+ }
146
+ return $str;
147
+ }
148
+
149
  public function check_dependencies() {
150
 
151
+ $backup_storage_path = ( get_option('xcloner_store_path') );
152
 
153
+ if(!$backup_storage_path) {
154
+
155
+ $backup_storage_path = realpath(__DIR__ . DS . ".." . DS . ".." . DS . "..") . DS . "backups-" . $this->randomString('5') . DS;
156
+
157
+ if (!is_dir($backup_storage_path)) {
158
+ if (!@mkdir($backup_storage_path)) {
159
+ $status = "error";
160
+ $message = sprintf(__("Unable to create the Backup Storage Location Folder %s . Please fix this before starting the backup process."),
161
+ $backup_storage_path);
162
+ $this->trigger_message($message, $status, $backup_storage_path);
163
+ return;
164
+ }
165
+ }
166
+ if (!is_writable($backup_storage_path)) {
167
+ $status = "error";
168
+ $message = sprintf(__("Unable to write to the Backup Storage Location Folder %s . Please fix this before starting the backup process."),
169
+ $backup_storage_path);
170
+ $this->trigger_message($message, $status, $backup_storage_path);
171
+
172
+ return;
173
+ }
174
+
175
+ update_option("xcloner_store_path", $backup_storage_path);
176
+ }
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
 
 
179
 
180
  }
181
 
vendor/composer/ClassLoader.php CHANGED
@@ -279,7 +279,7 @@ class ClassLoader
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
282
- $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283
  }
284
 
285
  /**
@@ -377,7 +377,7 @@ class ClassLoader
377
  $subPath = $class;
378
  while (false !== $lastPos = strrpos($subPath, '\\')) {
379
  $subPath = substr($subPath, 0, $lastPos);
380
- $search = $subPath . '\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
382
  $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
282
+ $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
  }
284
 
285
  /**
377
  $subPath = $class;
378
  while (false !== $lastPos = strrpos($subPath, '\\')) {
379
  $subPath = substr($subPath, 0, $lastPos);
380
+ $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
382
  $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
vendor/composer/autoload_files.php CHANGED
@@ -6,10 +6,11 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
10
  'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
11
- '383eaff206634a77a1be54e64e6459c7' => $vendorDir . '/sabre/uri/lib/functions.php',
12
  '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
 
13
  'b067bc7112e384b61c701452d53a14a8' => $vendorDir . '/mtdowling/jmespath.php/src/JmesPath.php',
14
  '2b9d0f43f9552984cfa82fee95491826' => $vendorDir . '/sabre/event/lib/coroutine.php',
15
  'd81bab31d3feb45bfe2f283ea3c8fdf7' => $vendorDir . '/sabre/event/lib/Loop/functions.php',
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
10
  'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
11
+ 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
12
  '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
13
+ '383eaff206634a77a1be54e64e6459c7' => $vendorDir . '/sabre/uri/lib/functions.php',
14
  'b067bc7112e384b61c701452d53a14a8' => $vendorDir . '/mtdowling/jmespath.php/src/JmesPath.php',
15
  '2b9d0f43f9552984cfa82fee95491826' => $vendorDir . '/sabre/event/lib/coroutine.php',
16
  'd81bab31d3feb45bfe2f283ea3c8fdf7' => $vendorDir . '/sabre/event/lib/Loop/functions.php',
vendor/composer/autoload_psr4.php CHANGED
@@ -21,11 +21,12 @@ return array(
21
  'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
22
  'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
23
  'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
24
- 'MicrosoftAzure\\Storage\\' => array($vendorDir . '/microsoft/azure-storage/src'),
 
25
  'Mhetreramesh\\Flysystem\\' => array($vendorDir . '/mhetreramesh/flysystem-backblaze/src'),
26
  'League\\Flysystem\\WebDAV\\' => array($vendorDir . '/league/flysystem-webdav/src'),
27
  'League\\Flysystem\\Sftp\\' => array($vendorDir . '/league/flysystem-sftp/src'),
28
- 'League\\Flysystem\\Azure\\' => array($vendorDir . '/league/flysystem-azure/src'),
29
  'League\\Flysystem\\AwsS3v3\\' => array($vendorDir . '/league/flysystem-aws-s3-v3/src'),
30
  'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'),
31
  'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'),
21
  'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
22
  'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
23
  'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
24
+ 'MicrosoftAzure\\Storage\\Common\\' => array($vendorDir . '/microsoft/azure-storage-common/src/Common'),
25
+ 'MicrosoftAzure\\Storage\\Blob\\' => array($vendorDir . '/microsoft/azure-storage-blob/src/Blob'),
26
  'Mhetreramesh\\Flysystem\\' => array($vendorDir . '/mhetreramesh/flysystem-backblaze/src'),
27
  'League\\Flysystem\\WebDAV\\' => array($vendorDir . '/league/flysystem-webdav/src'),
28
  'League\\Flysystem\\Sftp\\' => array($vendorDir . '/league/flysystem-sftp/src'),
29
+ 'League\\Flysystem\\AzureBlobStorage\\' => array($vendorDir . '/league/flysystem-azure-blob-storage/src'),
30
  'League\\Flysystem\\AwsS3v3\\' => array($vendorDir . '/league/flysystem-aws-s3-v3/src'),
31
  'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'),
32
  'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'),
vendor/composer/autoload_static.php CHANGED
@@ -7,10 +7,11 @@ namespace Composer\Autoload;
7
  class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
8
  {
9
  public static $files = array (
10
- 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
11
  'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
12
- '383eaff206634a77a1be54e64e6459c7' => __DIR__ . '/..' . '/sabre/uri/lib/functions.php',
13
  '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
 
14
  'b067bc7112e384b61c701452d53a14a8' => __DIR__ . '/..' . '/mtdowling/jmespath.php/src/JmesPath.php',
15
  '2b9d0f43f9552984cfa82fee95491826' => __DIR__ . '/..' . '/sabre/event/lib/coroutine.php',
16
  'd81bab31d3feb45bfe2f283ea3c8fdf7' => __DIR__ . '/..' . '/sabre/event/lib/Loop/functions.php',
@@ -52,14 +53,15 @@ class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
52
  'M' =>
53
  array (
54
  'Monolog\\' => 8,
55
- 'MicrosoftAzure\\Storage\\' => 23,
 
56
  'Mhetreramesh\\Flysystem\\' => 23,
57
  ),
58
  'L' =>
59
  array (
60
  'League\\Flysystem\\WebDAV\\' => 24,
61
  'League\\Flysystem\\Sftp\\' => 22,
62
- 'League\\Flysystem\\Azure\\' => 23,
63
  'League\\Flysystem\\AwsS3v3\\' => 25,
64
  'League\\Flysystem\\' => 17,
65
  ),
@@ -144,9 +146,13 @@ class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
144
  array (
145
  0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
146
  ),
147
- 'MicrosoftAzure\\Storage\\' =>
 
 
 
 
148
  array (
149
- 0 => __DIR__ . '/..' . '/microsoft/azure-storage/src',
150
  ),
151
  'Mhetreramesh\\Flysystem\\' =>
152
  array (
@@ -160,9 +166,9 @@ class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
160
  array (
161
  0 => __DIR__ . '/..' . '/league/flysystem-sftp/src',
162
  ),
163
- 'League\\Flysystem\\Azure\\' =>
164
  array (
165
- 0 => __DIR__ . '/..' . '/league/flysystem-azure/src',
166
  ),
167
  'League\\Flysystem\\AwsS3v3\\' =>
168
  array (
7
  class ComposerStaticInit571f9d19802717f7be61d57b40d60b28
8
  {
9
  public static $files = array (
10
+ '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
11
  'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
12
+ 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
13
  '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
14
+ '383eaff206634a77a1be54e64e6459c7' => __DIR__ . '/..' . '/sabre/uri/lib/functions.php',
15
  'b067bc7112e384b61c701452d53a14a8' => __DIR__ . '/..' . '/mtdowling/jmespath.php/src/JmesPath.php',
16
  '2b9d0f43f9552984cfa82fee95491826' => __DIR__ . '/..' . '/sabre/event/lib/coroutine.php',
17
  'd81bab31d3feb45bfe2f283ea3c8fdf7' => __DIR__ . '/..' . '/sabre/event/lib/Loop/functions.php',
53
  'M' =>
54
  array (
55
  'Monolog\\' => 8,
56
+ 'MicrosoftAzure\\Storage\\Common\\' => 30,
57
+ 'MicrosoftAzure\\Storage\\Blob\\' => 28,
58
  'Mhetreramesh\\Flysystem\\' => 23,
59
  ),
60
  'L' =>
61
  array (
62
  'League\\Flysystem\\WebDAV\\' => 24,
63
  'League\\Flysystem\\Sftp\\' => 22,
64
+ 'League\\Flysystem\\AzureBlobStorage\\' => 34,
65
  'League\\Flysystem\\AwsS3v3\\' => 25,
66
  'League\\Flysystem\\' => 17,
67
  ),
146
  array (
147
  0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
148
  ),
149
+ 'MicrosoftAzure\\Storage\\Common\\' =>
150
+ array (
151
+ 0 => __DIR__ . '/..' . '/microsoft/azure-storage-common/src/Common',
152
+ ),
153
+ 'MicrosoftAzure\\Storage\\Blob\\' =>
154
  array (
155
+ 0 => __DIR__ . '/..' . '/microsoft/azure-storage-blob/src/Blob',
156
  ),
157
  'Mhetreramesh\\Flysystem\\' =>
158
  array (
166
  array (
167
  0 => __DIR__ . '/..' . '/league/flysystem-sftp/src',
168
  ),
169
+ 'League\\Flysystem\\AzureBlobStorage\\' =>
170
  array (
171
+ 0 => __DIR__ . '/..' . '/league/flysystem-azure-blob-storage/src',
172
  ),
173
  'League\\Flysystem\\AwsS3v3\\' =>
174
  array (
vendor/composer/installed.json CHANGED
@@ -183,47 +183,49 @@
183
  },
184
  {
185
  "name": "guzzlehttp/guzzle",
186
- "version": "6.3.3",
187
- "version_normalized": "6.3.3.0",
188
  "source": {
189
  "type": "git",
190
  "url": "https://github.com/guzzle/guzzle.git",
191
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
192
  },
193
  "dist": {
194
  "type": "zip",
195
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
196
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
197
  "shasum": ""
198
  },
199
  "require": {
 
200
  "guzzlehttp/promises": "^1.0",
201
- "guzzlehttp/psr7": "^1.4",
202
  "php": ">=5.5"
203
  },
204
  "require-dev": {
205
  "ext-curl": "*",
206
  "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
207
- "psr/log": "^1.0"
208
  },
209
  "suggest": {
 
210
  "psr/log": "Required for using the Log middleware"
211
  },
212
- "time": "2018-04-22T15:46:56+00:00",
213
  "type": "library",
214
  "extra": {
215
  "branch-alias": {
216
- "dev-master": "6.3-dev"
217
  }
218
  },
219
  "installation-source": "source",
220
  "autoload": {
221
- "files": [
222
- "src/functions_include.php"
223
- ],
224
  "psr-4": {
225
  "GuzzleHttp\\": "src/"
226
- }
 
 
 
227
  },
228
  "notification-url": "https://packagist.org/downloads/",
229
  "license": [
@@ -303,34 +305,39 @@
303
  },
304
  {
305
  "name": "guzzlehttp/psr7",
306
- "version": "1.4.2",
307
- "version_normalized": "1.4.2.0",
308
  "source": {
309
  "type": "git",
310
  "url": "https://github.com/guzzle/psr7.git",
311
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
312
  },
313
  "dist": {
314
  "type": "zip",
315
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
316
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
317
  "shasum": ""
318
  },
319
  "require": {
320
  "php": ">=5.4.0",
321
- "psr/http-message": "~1.0"
 
322
  },
323
  "provide": {
324
  "psr/http-message-implementation": "1.0"
325
  },
326
  "require-dev": {
327
- "phpunit/phpunit": "~4.0"
 
 
 
 
328
  },
329
- "time": "2017-03-20T17:10:46+00:00",
330
  "type": "library",
331
  "extra": {
332
  "branch-alias": {
333
- "dev-master": "1.4-dev"
334
  }
335
  },
336
  "installation-source": "source",
@@ -361,6 +368,7 @@
361
  "keywords": [
362
  "http",
363
  "message",
 
364
  "request",
365
  "response",
366
  "stream",
@@ -504,40 +512,35 @@
504
  "description": "Flysystem adapter for the AWS S3 SDK v3.x"
505
  },
506
  {
507
- "name": "league/flysystem-azure",
508
- "version": "1.0.4",
509
- "version_normalized": "1.0.4.0",
510
  "source": {
511
  "type": "git",
512
- "url": "https://github.com/thephpleague/flysystem-azure.git",
513
- "reference": "0b9838c4f75ee41bc390357b0350e9a62e3b3a1f"
514
  },
515
  "dist": {
516
  "type": "zip",
517
- "url": "https://api.github.com/repos/thephpleague/flysystem-azure/zipball/0b9838c4f75ee41bc390357b0350e9a62e3b3a1f",
518
- "reference": "0b9838c4f75ee41bc390357b0350e9a62e3b3a1f",
519
  "shasum": ""
520
  },
521
  "require": {
522
- "league/flysystem": "~1.0",
523
- "microsoft/azure-storage": "~0.10.1",
524
- "php": ">=5.5.0"
 
525
  },
526
  "require-dev": {
527
- "mockery/mockery": "~0.9",
528
- "phpunit/phpunit": "~4.0"
529
  },
530
- "time": "2016-07-10T19:08:39+00:00",
531
  "type": "library",
532
- "extra": {
533
- "branch-alias": {
534
- "dev-master": "1.0-dev"
535
- }
536
- },
537
  "installation-source": "dist",
538
  "autoload": {
539
  "psr-4": {
540
- "League\\Flysystem\\Azure\\": "src/"
541
  }
542
  },
543
  "notification-url": "https://packagist.org/downloads/",
@@ -549,9 +552,7 @@
549
  "name": "Frank de Jonge",
550
  "email": "info@frenky.net"
551
  }
552
- ],
553
- "description": "Flysystem adapter for Windows Azure",
554
- "abandoned": "league/flysystem-azure-blob-storage"
555
  },
556
  {
557
  "name": "league/flysystem-sftp",
@@ -704,45 +705,76 @@
704
  ]
705
  },
706
  {
707
- "name": "microsoft/azure-storage",
708
- "version": "v0.10.2",
709
- "version_normalized": "0.10.2.0",
710
  "source": {
711
  "type": "git",
712
- "url": "https://github.com/Azure/azure-storage-php.git",
713
- "reference": "27de05b00c1858d6e1c6adbc489efa90e0342f82"
714
  },
715
  "dist": {
716
  "type": "zip",
717
- "url": "https://api.github.com/repos/Azure/azure-storage-php/zipball/27de05b00c1858d6e1c6adbc489efa90e0342f82",
718
- "reference": "27de05b00c1858d6e1c6adbc489efa90e0342f82",
719
  "shasum": ""
720
  },
721
  "require": {
722
- "guzzlehttp/guzzle": "~6.0",
723
- "php": ">=5.5.0"
724
  },
725
- "require-dev": {
726
- "mikey179/vfsstream": "~1.6",
727
- "pdepend/pdepend": "~2.2",
728
- "phploc/phploc": "~2.1",
729
- "phpmd/phpmd": "@stable",
730
- "phpunit/phpunit": "~4.0",
731
- "sebastian/phpcpd": "~2.0",
732
- "squizlabs/php_codesniffer": "2.*",
733
- "theseer/phpdox": "~0.8"
734
- },
735
- "time": "2016-08-19T08:32:57+00:00",
736
  "type": "library",
737
- "extra": {
738
- "branch-alias": {
739
- "dev-master": "0.10.x-dev"
 
740
  }
741
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
742
  "installation-source": "dist",
743
  "autoload": {
744
  "psr-4": {
745
- "MicrosoftAzure\\Storage\\": "src/"
746
  }
747
  },
748
  "notification-url": "https://packagist.org/downloads/",
@@ -751,18 +783,18 @@
751
  ],
752
  "authors": [
753
  {
754
- "name": "Azure Storage PHP SDK",
755
  "email": "dmsh@microsoft.com"
756
  }
757
  ],
758
- "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure storage APIs.",
759
  "keywords": [
760
  "azure",
 
761
  "php",
762
  "sdk",
763
  "storage"
764
- ],
765
- "abandoned": "microsoft/azure-storage-blob, microsoft/azure-storage-table, microsoft/azure-storage-queue, microsoft/azure-storage-file"
766
  },
767
  {
768
  "name": "mikey179/vfsStream",
@@ -770,12 +802,12 @@
770
  "version_normalized": "1.6.5.0",
771
  "source": {
772
  "type": "git",
773
- "url": "https://github.com/mikey179/vfsStream.git",
774
  "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145"
775
  },
776
  "dist": {
777
  "type": "zip",
778
- "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
779
  "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
780
  "shasum": ""
781
  },
@@ -1144,19 +1176,61 @@
1144
  "psr-3"
1145
  ]
1146
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1147
  {
1148
  "name": "sabre/dav",
1149
- "version": "3.2.2",
1150
- "version_normalized": "3.2.2.0",
1151
  "source": {
1152
  "type": "git",
1153
  "url": "https://github.com/sabre-io/dav.git",
1154
- "reference": "e987775e619728f12205606c9cc3ee565ffb1516"
1155
  },
1156
  "dist": {
1157
  "type": "zip",
1158
- "url": "https://api.github.com/repos/sabre-io/dav/zipball/e987775e619728f12205606c9cc3ee565ffb1516",
1159
- "reference": "e987775e619728f12205606c9cc3ee565ffb1516",
1160
  "shasum": ""
1161
  },
1162
  "require": {
@@ -1187,7 +1261,7 @@
1187
  "ext-curl": "*",
1188
  "ext-pdo": "*"
1189
  },
1190
- "time": "2017-02-15T03:06:08+00:00",
1191
  "bin": [
1192
  "bin/sabredav",
1193
  "bin/naturalselection"
@@ -1401,17 +1475,17 @@
1401
  },
1402
  {
1403
  "name": "sabre/vobject",
1404
- "version": "4.1.6",
1405
- "version_normalized": "4.1.6.0",
1406
  "source": {
1407
  "type": "git",
1408
  "url": "https://github.com/sabre-io/vobject.git",
1409
- "reference": "122cacbdea2c6133ac04db86ec05854beef75adf"
1410
  },
1411
  "dist": {
1412
  "type": "zip",
1413
- "url": "https://api.github.com/repos/sabre-io/vobject/zipball/122cacbdea2c6133ac04db86ec05854beef75adf",
1414
- "reference": "122cacbdea2c6133ac04db86ec05854beef75adf",
1415
  "shasum": ""
1416
  },
1417
  "require": {
@@ -1420,13 +1494,12 @@
1420
  "sabre/xml": ">=1.5 <3.0"
1421
  },
1422
  "require-dev": {
1423
- "phpunit/phpunit": "> 4.8.35, <6.0.0",
1424
- "sabre/cs": "^1.0.0"
1425
  },
1426
  "suggest": {
1427
  "hoa/bench": "If you would like to run the benchmark scripts"
1428
  },
1429
- "time": "2018-04-20T07:22:50+00:00",
1430
  "bin": [
1431
  "bin/vobject",
1432
  "bin/generate_vcards"
183
  },
184
  {
185
  "name": "guzzlehttp/guzzle",
186
+ "version": "6.5.0",
187
+ "version_normalized": "6.5.0.0",
188
  "source": {
189
  "type": "git",
190
  "url": "https://github.com/guzzle/guzzle.git",
191
+ "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5"
192
  },
193
  "dist": {
194
  "type": "zip",
195
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5",
196
+ "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5",
197
  "shasum": ""
198
  },
199
  "require": {
200
+ "ext-json": "*",
201
  "guzzlehttp/promises": "^1.0",
202
+ "guzzlehttp/psr7": "^1.6.1",
203
  "php": ">=5.5"
204
  },
205
  "require-dev": {
206
  "ext-curl": "*",
207
  "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
208
+ "psr/log": "^1.1"
209
  },
210
  "suggest": {
211
+ "ext-intl": "Required for Internationalized Domain Name (IDN) support",
212
  "psr/log": "Required for using the Log middleware"
213
  },
214
+ "time": "2019-12-07T18:20:45+00:00",
215
  "type": "library",
216
  "extra": {
217
  "branch-alias": {
218
+ "dev-master": "6.5-dev"
219
  }
220
  },
221
  "installation-source": "source",
222
  "autoload": {
 
 
 
223
  "psr-4": {
224
  "GuzzleHttp\\": "src/"
225
+ },
226
+ "files": [
227
+ "src/functions_include.php"
228
+ ]
229
  },
230
  "notification-url": "https://packagist.org/downloads/",
231
  "license": [
305
  },
306
  {
307
  "name": "guzzlehttp/psr7",
308
+ "version": "1.6.1",
309
+ "version_normalized": "1.6.1.0",
310
  "source": {
311
  "type": "git",
312
  "url": "https://github.com/guzzle/psr7.git",
313
+ "reference": "239400de7a173fe9901b9ac7c06497751f00727a"
314
  },
315
  "dist": {
316
  "type": "zip",
317
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
318
+ "reference": "239400de7a173fe9901b9ac7c06497751f00727a",
319
  "shasum": ""
320
  },
321
  "require": {
322
  "php": ">=5.4.0",
323
+ "psr/http-message": "~1.0",
324
+ "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
325
  },
326
  "provide": {
327
  "psr/http-message-implementation": "1.0"
328
  },
329
  "require-dev": {
330
+ "ext-zlib": "*",
331
+ "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
332
+ },
333
+ "suggest": {
334
+ "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
335
  },
336
+ "time": "2019-07-01T23:21:34+00:00",
337
  "type": "library",
338
  "extra": {
339
  "branch-alias": {
340
+ "dev-master": "1.6-dev"
341
  }
342
  },
343
  "installation-source": "source",
368
  "keywords": [
369
  "http",
370
  "message",
371
+ "psr-7",
372
  "request",
373
  "response",
374
  "stream",
512
  "description": "Flysystem adapter for the AWS S3 SDK v3.x"
513
  },
514
  {
515
+ "name": "league/flysystem-azure-blob-storage",
516
+ "version": "0.1.6",
517
+ "version_normalized": "0.1.6.0",
518
  "source": {
519
  "type": "git",
520
+ "url": "https://github.com/thephpleague/flysystem-azure-blob-storage.git",
521
+ "reference": "97215345f3c42679299ba556a4d16d4847ee7f6d"
522
  },
523
  "dist": {
524
  "type": "zip",
525
+ "url": "https://api.github.com/repos/thephpleague/flysystem-azure-blob-storage/zipball/97215345f3c42679299ba556a4d16d4847ee7f6d",
526
+ "reference": "97215345f3c42679299ba556a4d16d4847ee7f6d",
527
  "shasum": ""
528
  },
529
  "require": {
530
+ "guzzlehttp/psr7": "^1.5",
531
+ "league/flysystem": "^1.0",
532
+ "microsoft/azure-storage-blob": "^1.1",
533
+ "php": ">=5.6"
534
  },
535
  "require-dev": {
536
+ "phpunit/phpunit": "^5.7"
 
537
  },
538
+ "time": "2019-06-07T20:42:16+00:00",
539
  "type": "library",
 
 
 
 
 
540
  "installation-source": "dist",
541
  "autoload": {
542
  "psr-4": {
543
+ "League\\Flysystem\\AzureBlobStorage\\": "src/"
544
  }
545
  },
546
  "notification-url": "https://packagist.org/downloads/",
552
  "name": "Frank de Jonge",
553
  "email": "info@frenky.net"
554
  }
555
+ ]
 
 
556
  },
557
  {
558
  "name": "league/flysystem-sftp",
705
  ]
706
  },
707
  {
708
+ "name": "microsoft/azure-storage-blob",
709
+ "version": "1.4.0",
710
+ "version_normalized": "1.4.0.0",
711
  "source": {
712
  "type": "git",
713
+ "url": "https://github.com/Azure/azure-storage-blob-php.git",
714
+ "reference": "8310c2ecab488fa325db3dcf2f8723bbcfe58941"
715
  },
716
  "dist": {
717
  "type": "zip",
718
+ "url": "https://api.github.com/repos/Azure/azure-storage-blob-php/zipball/8310c2ecab488fa325db3dcf2f8723bbcfe58941",
719
+ "reference": "8310c2ecab488fa325db3dcf2f8723bbcfe58941",
720
  "shasum": ""
721
  },
722
  "require": {
723
+ "microsoft/azure-storage-common": "~1.4",
724
+ "php": ">=5.6.0"
725
  },
726
+ "time": "2019-04-26T15:06:52+00:00",
 
 
 
 
 
 
 
 
 
 
727
  "type": "library",
728
+ "installation-source": "dist",
729
+ "autoload": {
730
+ "psr-4": {
731
+ "MicrosoftAzure\\Storage\\Blob\\": "src/Blob"
732
  }
733
  },
734
+ "notification-url": "https://packagist.org/downloads/",
735
+ "license": [
736
+ "MIT"
737
+ ],
738
+ "authors": [
739
+ {
740
+ "name": "Azure Storage PHP Client Library",
741
+ "email": "dmsh@microsoft.com"
742
+ }
743
+ ],
744
+ "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.",
745
+ "keywords": [
746
+ "azure",
747
+ "blob",
748
+ "php",
749
+ "sdk",
750
+ "storage"
751
+ ]
752
+ },
753
+ {
754
+ "name": "microsoft/azure-storage-common",
755
+ "version": "1.4.0",
756
+ "version_normalized": "1.4.0.0",
757
+ "source": {
758
+ "type": "git",
759
+ "url": "https://github.com/Azure/azure-storage-common-php.git",
760
+ "reference": "435adf4d09f0b34375f899b5627d2926bfe317e6"
761
+ },
762
+ "dist": {
763
+ "type": "zip",
764
+ "url": "https://api.github.com/repos/Azure/azure-storage-common-php/zipball/435adf4d09f0b34375f899b5627d2926bfe317e6",
765
+ "reference": "435adf4d09f0b34375f899b5627d2926bfe317e6",
766
+ "shasum": ""
767
+ },
768
+ "require": {
769
+ "guzzlehttp/guzzle": "~6.0",
770
+ "php": ">=5.6.0"
771
+ },
772
+ "time": "2019-04-26T15:02:17+00:00",
773
+ "type": "library",
774
  "installation-source": "dist",
775
  "autoload": {
776
  "psr-4": {
777
+ "MicrosoftAzure\\Storage\\Common\\": "src/Common"
778
  }
779
  },
780
  "notification-url": "https://packagist.org/downloads/",
783
  ],
784
  "authors": [
785
  {
786
+ "name": "Azure Storage PHP Client Library",
787
  "email": "dmsh@microsoft.com"
788
  }
789
  ],
790
+ "description": "This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.",
791
  "keywords": [
792
  "azure",
793
+ "common",
794
  "php",
795
  "sdk",
796
  "storage"
797
+ ]
 
798
  },
799
  {
800
  "name": "mikey179/vfsStream",
802
  "version_normalized": "1.6.5.0",
803
  "source": {
804
  "type": "git",
805
+ "url": "https://github.com/bovigo/vfsStream.git",
806
  "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145"
807
  },
808
  "dist": {
809
  "type": "zip",
810
+ "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
811
  "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
812
  "shasum": ""
813
  },
1176
  "psr-3"
1177
  ]
1178
  },
1179
+ {
1180
+ "name": "ralouphie/getallheaders",
1181
+ "version": "3.0.3",
1182
+ "version_normalized": "3.0.3.0",
1183
+ "source": {
1184
+ "type": "git",
1185
+ "url": "https://github.com/ralouphie/getallheaders.git",
1186
+ "reference": "120b605dfeb996808c31b6477290a714d356e822"
1187
+ },
1188
+ "dist": {
1189
+ "type": "zip",
1190
+ "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
1191
+ "reference": "120b605dfeb996808c31b6477290a714d356e822",
1192
+ "shasum": ""
1193
+ },
1194
+ "require": {
1195
+ "php": ">=5.6"
1196
+ },
1197
+ "require-dev": {
1198
+ "php-coveralls/php-coveralls": "^2.1",
1199
+ "phpunit/phpunit": "^5 || ^6.5"
1200
+ },
1201
+ "time": "2019-03-08T08:55:37+00:00",
1202
+ "type": "library",
1203
+ "installation-source": "dist",
1204
+ "autoload": {
1205
+ "files": [
1206
+ "src/getallheaders.php"
1207
+ ]
1208
+ },
1209
+ "notification-url": "https://packagist.org/downloads/",
1210
+ "license": [
1211
+ "MIT"
1212
+ ],
1213
+ "authors": [
1214
+ {
1215
+ "name": "Ralph Khattar",
1216
+ "email": "ralph.khattar@gmail.com"
1217
+ }
1218
+ ],
1219
+ "description": "A polyfill for getallheaders."
1220
+ },
1221
  {
1222
  "name": "sabre/dav",
1223
+ "version": "3.2.3",
1224
+ "version_normalized": "3.2.3.0",
1225
  "source": {
1226
  "type": "git",
1227
  "url": "https://github.com/sabre-io/dav.git",
1228
+ "reference": "a9780ce4f35560ecbd0af524ad32d9d2c8954b80"
1229
  },
1230
  "dist": {
1231
  "type": "zip",
1232
+ "url": "https://api.github.com/repos/sabre-io/dav/zipball/a9780ce4f35560ecbd0af524ad32d9d2c8954b80",
1233
+ "reference": "a9780ce4f35560ecbd0af524ad32d9d2c8954b80",
1234
  "shasum": ""
1235
  },
1236
  "require": {
1261
  "ext-curl": "*",
1262
  "ext-pdo": "*"
1263
  },
1264
+ "time": "2018-10-19T09:58:27+00:00",
1265
  "bin": [
1266
  "bin/sabredav",
1267
  "bin/naturalselection"
1475
  },
1476
  {
1477
  "name": "sabre/vobject",
1478
+ "version": "4.2.0",
1479
+ "version_normalized": "4.2.0.0",
1480
  "source": {
1481
  "type": "git",
1482
  "url": "https://github.com/sabre-io/vobject.git",
1483
+ "reference": "bd500019764e434ff65872d426f523e7882a0739"
1484
  },
1485
  "dist": {
1486
  "type": "zip",
1487
+ "url": "https://api.github.com/repos/sabre-io/vobject/zipball/bd500019764e434ff65872d426f523e7882a0739",
1488
+ "reference": "bd500019764e434ff65872d426f523e7882a0739",
1489
  "shasum": ""
1490
  },
1491
  "require": {
1494
  "sabre/xml": ">=1.5 <3.0"
1495
  },
1496
  "require-dev": {
1497
+ "phpunit/phpunit": "> 4.8.35, <6.0.0"
 
1498
  },
1499
  "suggest": {
1500
  "hoa/bench": "If you would like to run the benchmark scripts"
1501
  },
1502
+ "time": "2019-02-19T13:05:37+00:00",
1503
  "bin": [
1504
  "bin/vobject",
1505
  "bin/generate_vcards"
vendor/guzzlehttp/guzzle/.gitattributes CHANGED
@@ -1,10 +1,12 @@
1
- .editorconfig export-ignore
2
- .gitattributes export-ignore
3
- /.github/ export-ignore
4
- .gitignore export-ignore
5
- /.travis.yml export-ignore
6
- /build/ export-ignore
7
- /docs/ export-ignore
8
- /Makefile export-ignore
9
- /phpunit.xml.dist export-ignore
10
- /tests/ export-ignore
 
 
1
+ .editorconfig export-ignore
2
+ .gitattributes export-ignore
3
+ /.github/ export-ignore
4
+ .gitignore export-ignore
5
+ /.travis.yml export-ignore
6
+ /build/ export-ignore
7
+ /docs/ export-ignore
8
+ /Makefile export-ignore
9
+ /phpstan-baseline.neon export-ignore
10
+ /phpstan.neon.dist export-ignore
11
+ /phpunit.xml.dist export-ignore
12
+ /tests/ export-ignore
vendor/guzzlehttp/guzzle/.github/CONTRIBUTING.md DELETED
@@ -1,3 +0,0 @@
1
- # Contributing
2
-
3
- Please see our [contributing guide](http://docs.guzzlephp.org/en/latest/overview.html#contributing).
 
 
 
vendor/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE.md DELETED
@@ -1,27 +0,0 @@
1
- | Q | A
2
- | ------------ | ---
3
- | Bug? | no|yes
4
- | New Feature? | no|yes
5
- | Version | Specific version or SHA of a commit
6
-
7
-
8
- #### Actual Behavior
9
-
10
- What is the actual behavior?
11
-
12
-
13
- #### Expected Behavior
14
-
15
- What is the behavior you expect?
16
-
17
-
18
- #### Steps to Reproduce
19
-
20
- What are the steps to reproduce this bug? Please add code examples,
21
- screenshots or links to GitHub repositories that reproduce the problem.
22
-
23
-
24
- #### Possible Solutions
25
-
26
- If you have already ideas how to solve the issue, add them here.
27
- (remove this section if not needed)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/.php_cs ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $config = PhpCsFixer\Config::create()
4
+ ->setRiskyAllowed(true)
5
+ ->setRules([
6
+ '@PSR2' => true,
7
+ 'array_syntax' => ['syntax' => 'short'],
8
+ 'declare_strict_types' => false,
9
+ 'concat_space' => ['spacing'=>'one'],
10
+ 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
11
+ 'ordered_imports' => true,
12
+ // 'phpdoc_align' => ['align'=>'vertical'],
13
+ // 'native_function_invocation' => true,
14
+ ])
15
+ ->setFinder(
16
+ PhpCsFixer\Finder::create()
17
+ ->in(__DIR__.'/src')
18
+ ->in(__DIR__.'/tests')
19
+ ->name('*.php')
20
+ )
21
+ ;
22
+
23
+ return $config;
vendor/guzzlehttp/guzzle/.travis.yml CHANGED
@@ -3,11 +3,12 @@ language: php
3
  sudo: false
4
 
5
  php:
6
- - 5.5
7
  - 5.6
8
  - 7.0
9
  - 7.1
10
  - 7.2
 
 
11
  - nightly
12
 
13
  before_script:
@@ -24,7 +25,9 @@ matrix:
24
  - php: hhvm
25
  dist: trusty
26
  - php: nightly
27
- include:
 
 
28
  - php: hhvm
29
  dist: trusty
30
  fast_finish: true
@@ -36,7 +39,7 @@ deploy:
36
  provider: releases
37
  skip_cleanup: true
38
  api_key:
39
- secure: UpypqlYgsU68QT/x40YzhHXvzWjFwCNo9d+G8KAdm7U9+blFfcWhV1aMdzugvPMl6woXgvJj7qHq5tAL4v6oswCORhpSBfLgOQVFaica5LiHsvWlAedOhxGmnJqMTwuepjBCxXhs3+I8Kof1n4oUL9gKytXjOVCX/f7XU1HiinU=
40
  file:
41
  - build/artifacts/guzzle.phar
42
  - build/artifacts/guzzle.zip
3
  sudo: false
4
 
5
  php:
 
6
  - 5.6
7
  - 7.0
8
  - 7.1
9
  - 7.2
10
+ - 7.3
11
+ - 7.4snapshot
12
  - nightly
13
 
14
  before_script:
25
  - php: hhvm
26
  dist: trusty
27
  - php: nightly
28
+ include:
29
+ - php: 5.5
30
+ dist: trusty
31
  - php: hhvm
32
  dist: trusty
33
  fast_finish: true
39
  provider: releases
40
  skip_cleanup: true
41
  api_key:
42
+ secure: mz9H1B4cPH7dW9hTzgHnbh75+HJ6fJZ9S/1nMWFaqgj5C0wDzTqkJ+BbwiCEiqXGh6VGZbM4EmO1/wnZ7B+Hk8zsB1PP+GKVkq8+7a/261o60W3OS4gQpZQ9R68dyEO1EyZBJvL1Lzc03rkt/0WnKiAjg7nsc1j4aLKhWMDQ6x8=
43
  file:
44
  - build/artifacts/guzzle.phar
45
  - build/artifacts/guzzle.zip
vendor/guzzlehttp/guzzle/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
  # Change Log
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ## 6.3.3 - 2018-04-22
4
 
5
  * Fix: Default headers when decode_content is specified
1
  # Change Log
2
 
3
+ ## 6.5.0 - 2019-11-07
4
+
5
+ * Improvement: Added support for reset internal queue in MockHandler. [#2143](https://github.com/guzzle/guzzle/pull/2143)
6
+ * Improvement: Added support to pass arbitrary options to `curl_multi_init`. [#2287](https://github.com/guzzle/guzzle/pull/2287)
7
+ * Fix: Gracefully handle passing `null` to the `header` option. [#2132](https://github.com/guzzle/guzzle/pull/2132)
8
+ * Fix: `RetryMiddleware` did not do exponential delay between retires due unit mismatch. [#2132](https://github.com/guzzle/guzzle/pull/2132)
9
+ * Fix: Prevent undefined offset when using array for ssl_key options. [#2348](https://github.com/guzzle/guzzle/pull/2348)
10
+ * Deprecated `ClientInterface::VERSION`
11
+
12
+ ## 6.4.1 - 2019-10-23
13
+
14
+ * No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that
15
+ * Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar`
16
+
17
+ ## 6.4.0 - 2019-10-23
18
+
19
+ * Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108)
20
+ * Fix: Test if response is readable before returning a summary in `RequestException::getResponseBodySummary()` [#2081](https://github.com/guzzle/guzzle/pull/2081)
21
+ * Fix: Add support for GUZZLE_CURL_SELECT_TIMEOUT environment variable [#2161](https://github.com/guzzle/guzzle/pull/2161)
22
+ * Improvement: Added `GuzzleHttp\Exception\InvalidArgumentException` [#2163](https://github.com/guzzle/guzzle/pull/2163)
23
+ * Improvement: Added `GuzzleHttp\_current_time()` to use `hrtime()` if that function exists. [#2242](https://github.com/guzzle/guzzle/pull/2242)
24
+ * Improvement: Added curl's `appconnect_time` in `TransferStats` [#2284](https://github.com/guzzle/guzzle/pull/2284)
25
+ * Improvement: Make GuzzleException extend Throwable wherever it's available [#2273](https://github.com/guzzle/guzzle/pull/2273)
26
+ * Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335)
27
+ * Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362)
28
+
29
  ## 6.3.3 - 2018-04-22
30
 
31
  * Fix: Default headers when decode_content is specified
vendor/guzzlehttp/guzzle/Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM composer:latest as setup
2
+
3
+ RUN mkdir /guzzle
4
+
5
+ WORKDIR /guzzle
6
+
7
+ RUN set -xe \
8
+ && composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár <mark.sagikazar@gmail.com>" --no-interaction \
9
+ && composer require guzzlehttp/guzzle
10
+
11
+
12
+ FROM php:7.3
13
+
14
+ RUN mkdir /guzzle
15
+
16
+ WORKDIR /guzzle
17
+
18
+ COPY --from=setup /guzzle /guzzle
vendor/guzzlehttp/guzzle/README.md CHANGED
@@ -21,19 +21,18 @@ trivial to integrate with web services.
21
 
22
  ```php
23
  $client = new \GuzzleHttp\Client();
24
- $res = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
25
- echo $res->getStatusCode();
26
- // 200
27
- echo $res->getHeaderLine('content-type');
28
- // 'application/json; charset=utf8'
29
- echo $res->getBody();
30
- // '{"id": 1420053, "name": "guzzle", ...}'
31
-
32
- // Send an asynchronous request.
33
  $request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
34
  $promise = $client->sendAsync($request)->then(function ($response) {
35
  echo 'I completed! ' . $response->getBody();
36
  });
 
37
  $promise->wait();
38
  ```
39
 
@@ -57,7 +56,7 @@ curl -sS https://getcomposer.org/installer | php
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:
@@ -69,7 +68,7 @@ require 'vendor/autoload.php';
69
  You can then later update Guzzle using composer:
70
 
71
  ```bash
72
- composer.phar update
73
  ```
74
 
75
 
@@ -79,13 +78,13 @@ composer.phar update
79
  |---------|------------|---------------------|--------------|---------------------|---------------------|-------|-------------|
80
  | 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >= 5.3.3 |
81
  | 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >= 5.4 |
82
- | 5.x | Maintained | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 |
83
  | 6.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >= 5.5 |
84
 
85
  [guzzle-3-repo]: https://github.com/guzzle/guzzle3
86
  [guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x
87
  [guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3
88
  [guzzle-6-repo]: https://github.com/guzzle/guzzle
89
- [guzzle-3-docs]: http://guzzle3.readthedocs.org/en/latest/
90
  [guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/
91
  [guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/
21
 
22
  ```php
23
  $client = new \GuzzleHttp\Client();
24
+ $response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
25
+
26
+ echo $response->getStatusCode(); # 200
27
+ echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8'
28
+ echo $response->getBody(); # '{"id": 1420053, "name": "guzzle", ...}'
29
+
30
+ # Send an asynchronous request.
 
 
31
  $request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
32
  $promise = $client->sendAsync($request)->then(function ($response) {
33
  echo 'I completed! ' . $response->getBody();
34
  });
35
+
36
  $promise->wait();
37
  ```
38
 
56
  Next, run the Composer command to install the latest stable version of Guzzle:
57
 
58
  ```bash
59
+ composer require guzzlehttp/guzzle
60
  ```
61
 
62
  After installing, you need to require Composer's autoloader:
68
  You can then later update Guzzle using composer:
69
 
70
  ```bash
71
+ composer update
72
  ```
73
 
74
 
78
  |---------|------------|---------------------|--------------|---------------------|---------------------|-------|-------------|
79
  | 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >= 5.3.3 |
80
  | 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >= 5.4 |
81
+ | 5.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 |
82
  | 6.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >= 5.5 |
83
 
84
  [guzzle-3-repo]: https://github.com/guzzle/guzzle3
85
  [guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x
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
89
  [guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/
90
  [guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/
vendor/guzzlehttp/guzzle/build/packager.php CHANGED
@@ -18,9 +18,9 @@ $packager->recursiveCopy('vendor/guzzlehttp/psr7/src', 'GuzzleHttp/Psr7');
18
  $packager->recursiveCopy('vendor/psr/http-message/src', 'Psr/Http/Message');
19
 
20
  $packager->createAutoloader([
21
- 'GuzzleHttp/functions.php',
22
- 'GuzzleHttp/Psr7/functions.php',
23
- 'GuzzleHttp/Promise/functions.php',
24
  ]);
25
 
26
  $packager->createPhar(__DIR__ . '/artifacts/guzzle.phar');
18
  $packager->recursiveCopy('vendor/psr/http-message/src', 'Psr/Http/Message');
19
 
20
  $packager->createAutoloader([
21
+ 'GuzzleHttp/functions_include.php',
22
+ 'GuzzleHttp/Psr7/functions_include.php',
23
+ 'GuzzleHttp/Promise/functions_include.php',
24
  ]);
25
 
26
  $packager->createPhar(__DIR__ . '/artifacts/guzzle.phar');
vendor/guzzlehttp/guzzle/composer.json CHANGED
@@ -2,7 +2,15 @@
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": [
@@ -14,31 +22,38 @@
14
  ],
15
  "require": {
16
  "php": ">=5.5",
17
- "guzzlehttp/psr7": "^1.4",
18
- "guzzlehttp/promises": "^1.0"
 
19
  },
20
  "require-dev": {
21
  "ext-curl": "*",
22
  "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.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
- "suggest": {
37
- "psr/log": "Required for using the Log middleware"
38
- },
39
- "extra": {
40
- "branch-alias": {
41
- "dev-master": "6.3-dev"
42
- }
43
  }
44
  }
2
  "name": "guzzlehttp/guzzle",
3
  "type": "library",
4
  "description": "Guzzle is a PHP HTTP client library",
5
+ "keywords": [
6
+ "framework",
7
+ "http",
8
+ "rest",
9
+ "web service",
10
+ "curl",
11
+ "client",
12
+ "HTTP client"
13
+ ],
14
  "homepage": "http://guzzlephp.org/",
15
  "license": "MIT",
16
  "authors": [
22
  ],
23
  "require": {
24
  "php": ">=5.5",
25
+ "ext-json": "*",
26
+ "guzzlehttp/promises": "^1.0",
27
+ "guzzlehttp/psr7": "^1.6.1"
28
  },
29
  "require-dev": {
30
  "ext-curl": "*",
31
  "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
32
+ "psr/log": "^1.1"
33
+ },
34
+ "suggest": {
35
+ "psr/log": "Required for using the Log middleware",
36
+ "ext-intl": "Required for Internationalized Domain Name (IDN) support"
37
+ },
38
+ "config": {
39
+ "sort-packages": true
40
+ },
41
+ "extra": {
42
+ "branch-alias": {
43
+ "dev-master": "6.5-dev"
44
+ }
45
  },
46
  "autoload": {
 
47
  "psr-4": {
48
  "GuzzleHttp\\": "src/"
49
+ },
50
+ "files": [
51
+ "src/functions_include.php"
52
+ ]
53
  },
54
  "autoload-dev": {
55
  "psr-4": {
56
  "GuzzleHttp\\Tests\\": "tests/"
57
  }
 
 
 
 
 
 
 
 
58
  }
59
  }
vendor/guzzlehttp/guzzle/docs/faq.rst CHANGED
@@ -65,6 +65,23 @@ used with a client.
65
  ]
66
  ]);
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  How can I add custom stream context options?
70
  ============================================
65
  ]
66
  ]);
67
 
68
+ If you use asynchronous requests with cURL multi handler and want to tweak it,
69
+ additional options can be specified as an associative array in the
70
+ **options** key of the ``CurlMultiHandler`` constructor.
71
+
72
+ .. code-block:: php
73
+
74
+ use \GuzzleHttp\Client;
75
+ use \GuzzleHttp\HandlerStack;
76
+ use \GuzzleHttp\Handler\CurlMultiHandler;
77
+
78
+ $client = new Client(['handler' => HandlerStack::create(new CurlMultiHandler([
79
+ 'options' => [
80
+ CURLMOPT_MAX_TOTAL_CONNECTIONS => 50,
81
+ CURLMOPT_MAX_HOST_CONNECTIONS => 5,
82
+ ]
83
+ ]))]);
84
+
85
 
86
  How can I add custom stream context options?
87
  ============================================
vendor/guzzlehttp/guzzle/docs/handlers-and-middleware.rst CHANGED
@@ -50,7 +50,7 @@ The ``create`` method adds default handlers to the ``HandlerStack``. When the
50
  2. ``cookies`` - extracts response cookies into the cookie jar.
51
  3. ``allow_redirects`` - Follows redirects.
52
  4. ``http_errors`` - throws exceptions when the response status code ``>=``
53
- 300.
54
 
55
  When provided no ``$handler`` argument, ``GuzzleHttp\HandlerStack::create()``
56
  will choose the most appropriate handler based on the extensions available on
50
  2. ``cookies`` - extracts response cookies into the cookie jar.
51
  3. ``allow_redirects`` - Follows redirects.
52
  4. ``http_errors`` - throws exceptions when the response status code ``>=``
53
+ 400.
54
 
55
  When provided no ``$handler`` argument, ``GuzzleHttp\HandlerStack::create()``
56
  will choose the most appropriate handler based on the extensions available on
vendor/guzzlehttp/guzzle/docs/overview.rst CHANGED
@@ -16,6 +16,8 @@ Requirements
16
  Guzzle no longer requires cURL in order to send HTTP requests. Guzzle will
17
  use the PHP stream wrapper to send HTTP requests if cURL is not installed.
18
  Alternatively, you can provide your own HTTP handler used to send requests.
 
 
19
 
20
  .. _installation:
21
 
16
  Guzzle no longer requires cURL in order to send HTTP requests. Guzzle will
17
  use the PHP stream wrapper to send HTTP requests if cURL is not installed.
18
  Alternatively, you can provide your own HTTP handler used to send requests.
19
+ Keep in mind that cURL is still required for sending concurrent requests.
20
+
21
 
22
  .. _installation:
23
 
vendor/guzzlehttp/guzzle/docs/psr7.rst CHANGED
@@ -451,5 +451,6 @@ functionality.
451
  - `InflateStream <https://github.com/guzzle/psr7#inflatestream>`_
452
  - `LazyOpenStream <https://github.com/guzzle/psr7#lazyopenstream>`_
453
  - `LimitStream <https://github.com/guzzle/psr7#limitstream>`_
 
454
  - `NoSeekStream <https://github.com/guzzle/psr7#noseekstream>`_
455
  - `PumpStream <https://github.com/guzzle/psr7#pumpstream>`_
451
  - `InflateStream <https://github.com/guzzle/psr7#inflatestream>`_
452
  - `LazyOpenStream <https://github.com/guzzle/psr7#lazyopenstream>`_
453
  - `LimitStream <https://github.com/guzzle/psr7#limitstream>`_
454
+ - `MultipartStream <https://github.com/guzzle/psr7#multipartstream>`_
455
  - `NoSeekStream <https://github.com/guzzle/psr7#noseekstream>`_
456
  - `PumpStream <https://github.com/guzzle/psr7#pumpstream>`_
vendor/guzzlehttp/guzzle/docs/quickstart.rst CHANGED
@@ -184,26 +184,27 @@ requests.
184
  'webp' => $client->getAsync('/image/webp')
185
  ];
186
 
187
- // Wait on all of the requests to complete. Throws a ConnectException
188
  // if any of the requests fail
189
- $results = Promise\unwrap($promises);
190
-
191
  // Wait for the requests to complete, even if some of them fail
192
- $results = Promise\settle($promises)->wait();
193
 
194
- // You can access each result using the key provided to the unwrap
195
- // function.
196
- echo $results['image']['value']->getHeader('Content-Length')[0]
197
- echo $results['png']['value']->getHeader('Content-Length')[0]
198
 
199
  You can use the ``GuzzleHttp\Pool`` object when you have an indeterminate
200
  amount of requests you wish to send.
201
 
202
  .. code-block:: php
203
 
204
- use GuzzleHttp\Pool;
205
  use GuzzleHttp\Client;
 
 
206
  use GuzzleHttp\Psr7\Request;
 
207
 
208
  $client = new Client();
209
 
@@ -216,10 +217,10 @@ amount of requests you wish to send.
216
 
217
  $pool = new Pool($client, $requests(100), [
218
  'concurrency' => 5,
219
- 'fulfilled' => function ($response, $index) {
220
  // this is delivered each successful response
221
  },
222
- 'rejected' => function ($reason, $index) {
223
  // this is delivered each failed request
224
  },
225
  ]);
@@ -229,7 +230,7 @@ amount of requests you wish to send.
229
 
230
  // Force the pool of requests to complete.
231
  $promise->wait();
232
-
233
  Or using a closure that will return a promise once the pool calls the closure.
234
 
235
  .. code-block:: php
@@ -246,7 +247,7 @@ Or using a closure that will return a promise once the pool calls the closure.
246
  };
247
 
248
  $pool = new Pool($client, $requests(100));
249
-
250
 
251
  Using Responses
252
  ===============
@@ -447,6 +448,43 @@ to use a shared cookie jar for all requests.
447
  $client = new \GuzzleHttp\Client(['cookies' => true]);
448
  $r = $client->request('GET', 'http://httpbin.org/cookies');
449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
 
451
  Redirects
452
  =========
@@ -483,6 +521,23 @@ The following example shows that redirects can be disabled.
483
  Exceptions
484
  ==========
485
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  Guzzle throws exceptions for errors that occur during a transfer.
487
 
488
  - In the event of a networking error (connection timeout, DNS errors, etc.),
@@ -517,6 +572,7 @@ Guzzle throws exceptions for errors that occur during a transfer.
517
 
518
  .. code-block:: php
519
 
 
520
  use GuzzleHttp\Exception\ClientException;
521
 
522
  try {
@@ -551,10 +607,12 @@ behavior of the library.
551
  the timeout.
552
  ``HTTP_PROXY``
553
  Defines the proxy to use when sending requests using the "http" protocol.
554
-
555
  Note: because the HTTP_PROXY variable may contain arbitrary user input on some (CGI) environments, the variable is only used on the CLI SAPI. See https://httpoxy.org for more information.
556
  ``HTTPS_PROXY``
557
  Defines the proxy to use when sending requests using the "https" protocol.
 
 
558
 
559
 
560
  Relevant ini Settings
184
  'webp' => $client->getAsync('/image/webp')
185
  ];
186
 
187
+ // Wait for the requests to complete; throws a ConnectException
188
  // if any of the requests fail
189
+ $responses = Promise\unwrap($promises);
190
+
191
  // Wait for the requests to complete, even if some of them fail
192
+ $responses = Promise\settle($promises)->wait();
193
 
194
+ // You can access each response using the key of the promise
195
+ echo $responses['image']->getHeader('Content-Length')[0];
196
+ echo $responses['png']->getHeader('Content-Length')[0];
 
197
 
198
  You can use the ``GuzzleHttp\Pool`` object when you have an indeterminate
199
  amount of requests you wish to send.
200
 
201
  .. code-block:: php
202
 
 
203
  use GuzzleHttp\Client;
204
+ use GuzzleHttp\Exception\RequestException;
205
+ use GuzzleHttp\Pool;
206
  use GuzzleHttp\Psr7\Request;
207
+ use GuzzleHttp\Psr7\Response;
208
 
209
  $client = new Client();
210
 
217
 
218
  $pool = new Pool($client, $requests(100), [
219
  'concurrency' => 5,
220
+ 'fulfilled' => function (Response $response, $index) {
221
  // this is delivered each successful response
222
  },
223
+ 'rejected' => function (RequestException $reason, $index) {
224
  // this is delivered each failed request
225
  },
226
  ]);
230
 
231
  // Force the pool of requests to complete.
232
  $promise->wait();
233
+
234
  Or using a closure that will return a promise once the pool calls the closure.
235
 
236
  .. code-block:: php
247
  };
248
 
249
  $pool = new Pool($client, $requests(100));
250
+
251
 
252
  Using Responses
253
  ===============
448
  $client = new \GuzzleHttp\Client(['cookies' => true]);
449
  $r = $client->request('GET', 'http://httpbin.org/cookies');
450
 
451
+ Different implementations exist for the ``GuzzleHttp\Cookie\CookieJarInterface``
452
+ :
453
+
454
+ - The ``GuzzleHttp\Cookie\CookieJar`` class stores cookies as an array.
455
+ - The ``GuzzleHttp\Cookie\FileCookieJar`` class persists non-session cookies
456
+ using a JSON formatted file.
457
+ - The ``GuzzleHttp\Cookie\SessionCookieJar`` class persists cookies in the
458
+ client session.
459
+
460
+ You can manually set cookies into a cookie jar with the named constructor
461
+ ``fromArray(array $cookies, $domain)``.
462
+
463
+ .. code-block:: php
464
+
465
+ $jar = \GuzzleHttp\Cookie\CookieJar::fromArray(
466
+ [
467
+ 'some_cookie' => 'foo',
468
+ 'other_cookie' => 'barbaz1234'
469
+ ],
470
+ 'example.org'
471
+ );
472
+
473
+ You can get a cookie by its name with the ``getCookieByName($name)`` method
474
+ which returns a ``GuzzleHttp\Cookie\SetCookie`` instance.
475
+
476
+ .. code-block:: php
477
+
478
+ $cookie = $jar->getCookieByName('some_cookie');
479
+
480
+ $cookie->getValue(); // 'foo'
481
+ $cookie->getDomain(); // 'example.org'
482
+ $cookie->getExpires(); // expiration date as a Unix timestamp
483
+
484
+ The cookies can be also fetched into an array thanks to the `toArray()` method.
485
+ The ``GuzzleHttp\Cookie\CookieJarInterface`` interface extends
486
+ ``Traversable`` so it can be iterated in a foreach loop.
487
+
488
 
489
  Redirects
490
  =========
521
  Exceptions
522
  ==========
523
 
524
+ **Tree View**
525
+
526
+ The following tree view describes how the Guzzle Exceptions depend
527
+ on each other.
528
+
529
+ .. code-block:: none
530
+
531
+ . \RuntimeException
532
+ ├── SeekException (implements GuzzleException)
533
+ └── TransferException (implements GuzzleException)
534
+ └── RequestException
535
+ ├── BadResponseException
536
+ │   ├── ServerException
537
+ │ └── ClientException
538
+ ├── ConnectException
539
+ └── TooManyRedirectsException
540
+
541
  Guzzle throws exceptions for errors that occur during a transfer.
542
 
543
  - In the event of a networking error (connection timeout, DNS errors, etc.),
572
 
573
  .. code-block:: php
574
 
575
+ use GuzzleHttp\Psr7;
576
  use GuzzleHttp\Exception\ClientException;
577
 
578
  try {
607
  the timeout.
608
  ``HTTP_PROXY``
609
  Defines the proxy to use when sending requests using the "http" protocol.
610
+
611
  Note: because the HTTP_PROXY variable may contain arbitrary user input on some (CGI) environments, the variable is only used on the CLI SAPI. See https://httpoxy.org for more information.
612
  ``HTTPS_PROXY``
613
  Defines the proxy to use when sending requests using the "https" protocol.
614
+ ``NO_PROXY``
615
+ Defines URLs for which a proxy should not be used. See :ref:`proxy-option` for usage.
616
 
617
 
618
  Relevant ini Settings
vendor/guzzlehttp/guzzle/docs/request-options.rst CHANGED
@@ -118,7 +118,7 @@ pairs:
118
  This option only has an effect if your handler has the
119
  ``GuzzleHttp\Middleware::redirect`` middleware. This middleware is added
120
  by default when a client is created with no handler, and is added by
121
- default when creating a handler with ``GuzzleHttp\default_handler``.
122
 
123
 
124
  auth
@@ -553,6 +553,31 @@ http_errors
553
  default when creating a handler with ``GuzzleHttp\default_handler``.
554
 
555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
  json
557
  ----
558
 
@@ -737,7 +762,7 @@ progress
737
 
738
  The function accepts the following positional arguments:
739
 
740
- - the total number of bytes expected to be downloaded
741
  - the number of bytes downloaded so far
742
  - the total number of bytes expected to be uploaded
743
  - the number of bytes uploaded so far
@@ -788,7 +813,7 @@ host names that should not be proxied to.
788
 
789
  Guzzle will automatically populate this value with your environment's
790
  ``NO_PROXY`` environment variable. However, when providing a ``proxy``
791
- request option, it is up to your to provide the ``no`` value parsed from
792
  the ``NO_PROXY`` environment variable
793
  (e.g., ``explode(',', getenv('NO_PROXY'))``).
794
 
118
  This option only has an effect if your handler has the
119
  ``GuzzleHttp\Middleware::redirect`` middleware. This middleware is added
120
  by default when a client is created with no handler, and is added by
121
+ default when creating a handler with ``GuzzleHttp\HandlerStack::create``.
122
 
123
 
124
  auth
553
  default when creating a handler with ``GuzzleHttp\default_handler``.
554
 
555
 
556
+ idn_conversion
557
+ ---
558
+
559
+ :Summary: Internationalized Domain Name (IDN) support (enabled by default if
560
+ ``intl`` extension is available).
561
+ :Types:
562
+ - bool
563
+ - int
564
+ :Default: ``true`` if ``intl`` extension is available, ``false`` otherwise
565
+ :Constant: ``GuzzleHttp\RequestOptions::IDN_CONVERSION``
566
+
567
+ .. code-block:: php
568
+
569
+ $client->request('GET', 'https://яндекс.рф');
570
+ // яндекс.рф is translated to xn--d1acpjx3f.xn--p1ai before passing it to the handler
571
+
572
+ $res = $client->request('GET', 'https://яндекс.рф', ['idn_conversion' => false]);
573
+ // The domain part (яндекс.рф) stays unmodified
574
+
575
+ Enables/disables IDN support, can also be used for precise control by combining
576
+ IDNA_* constants (except IDNA_ERROR_*), see ``$options`` parameter in
577
+ `idn_to_ascii() <https://www.php.net/manual/en/function.idn-to-ascii.php>`_
578
+ documentation for more details.
579
+
580
+
581
  json
582
  ----
583
 
762
 
763
  The function accepts the following positional arguments:
764
 
765
+ - the total number of bytes expected to be downloaded, zero if unknown
766
  - the number of bytes downloaded so far
767
  - the total number of bytes expected to be uploaded
768
  - the number of bytes uploaded so far
813
 
814
  Guzzle will automatically populate this value with your environment's
815
  ``NO_PROXY`` environment variable. However, when providing a ``proxy``
816
+ request option, it is up to you to provide the ``no`` value parsed from
817
  the ``NO_PROXY`` environment variable
818
  (e.g., ``explode(',', getenv('NO_PROXY'))``).
819
 
vendor/guzzlehttp/guzzle/docs/testing.rst CHANGED
@@ -32,25 +32,37 @@ a response or exception by shifting return values off of a queue.
32
 
33
  // Create a mock and queue two responses.
34
  $mock = new MockHandler([
35
- new Response(200, ['X-Foo' => 'Bar']),
36
  new Response(202, ['Content-Length' => 0]),
37
- new RequestException("Error Communicating with Server", new Request('GET', 'test'))
38
  ]);
39
 
40
- $handler = HandlerStack::create($mock);
41
- $client = new Client(['handler' => $handler]);
42
 
43
  // The first request is intercepted with the first response.
44
- echo $client->request('GET', '/')->getStatusCode();
 
45
  //> 200
 
 
46
  // The second request is intercepted with the second response.
47
  echo $client->request('GET', '/')->getStatusCode();
48
  //> 202
49
 
 
 
 
 
 
 
 
 
 
 
50
  When no more responses are in the queue and a request is sent, an
51
  ``OutOfBoundsException`` is thrown.
52
 
53
-
54
  History Middleware
55
  ==================
56
 
@@ -68,11 +80,13 @@ history of the requests that were sent by a client.
68
  $container = [];
69
  $history = Middleware::history($container);
70
 
71
- $stack = HandlerStack::create();
 
 
72
  // Add the history middleware to the handler stack.
73
- $stack->push($history);
74
 
75
- $client = new Client(['handler' => $stack]);
76
 
77
  $client->request('GET', 'http://httpbin.org/get');
78
  $client->request('HEAD', 'http://httpbin.org/get');
32
 
33
  // Create a mock and queue two responses.
34
  $mock = new MockHandler([
35
+ new Response(200, ['X-Foo' => 'Bar'], 'Hello, World'),
36
  new Response(202, ['Content-Length' => 0]),
37
+ new RequestException('Error Communicating with Server', new Request('GET', 'test'))
38
  ]);
39
 
40
+ $handlerStack = HandlerStack::create($mock);
41
+ $client = new Client(['handler' => $handlerStack]);
42
 
43
  // The first request is intercepted with the first response.
44
+ $response = $client->request('GET', '/');
45
+ echo $response->getStatusCode();
46
  //> 200
47
+ echo $response->getBody();
48
+ //> Hello, World
49
  // The second request is intercepted with the second response.
50
  echo $client->request('GET', '/')->getStatusCode();
51
  //> 202
52
 
53
+ // Reset the queue and queue up a new response
54
+ $mock->reset();
55
+ $mock->append(new Response(201));
56
+
57
+ // As the mock was reset, the new response is the 201 CREATED,
58
+ // instead of the previously queued RequestException
59
+ echo $client->request('GET', '/')->getStatusCode();
60
+ //> 201
61
+
62
+
63
  When no more responses are in the queue and a request is sent, an
64
  ``OutOfBoundsException`` is thrown.
65
 
 
66
  History Middleware
67
  ==================
68
 
80
  $container = [];
81
  $history = Middleware::history($container);
82
 
83
+ $handlerStack = HandlerStack::create();
84
+ // or $handlerStack = HandlerStack::create($mock); if using the Mock handler.
85
+
86
  // Add the history middleware to the handler stack.
87
+ $handlerStack->push($history);
88
 
89
+ $client = new Client(['handler' => $handlerStack]);
90
 
91
  $client->request('GET', 'http://httpbin.org/get');
92
  $client->request('HEAD', 'http://httpbin.org/get');
vendor/guzzlehttp/guzzle/phpstan-baseline.neon ADDED
@@ -0,0 +1,1412 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ parameters:
2
+ ignoreErrors:
3
+ -
4
+ message: "#^Property GuzzleHttp\\\\Client\\:\\:\\$config type has no value type specified in iterable type array\\.$#"
5
+ count: 1
6
+ path: src/Client.php
7
+
8
+ -
9
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:__construct\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#"
10
+ count: 1
11
+ path: src/Client.php
12
+
13
+ -
14
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:__call\\(\\) has parameter \\$args with no value type specified in iterable type array\\.$#"
15
+ count: 1
16
+ path: src/Client.php
17
+
18
+ -
19
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:__call\\(\\) should return GuzzleHttp\\\\Promise\\\\PromiseInterface but returns GuzzleHttp\\\\PromiseInterface\\|Psr\\\\Http\\\\Message\\\\ResponseInterface\\.$#"
20
+ count: 1
21
+ path: src/Client.php
22
+
23
+ -
24
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:sendAsync\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
25
+ count: 1
26
+ path: src/Client.php
27
+
28
+ -
29
+ message: "#^Return typehint of method GuzzleHttp\\\\Client\\:\\:sendAsync\\(\\) has invalid type GuzzleHttp\\\\PromiseInterface\\.$#"
30
+ count: 1
31
+ path: src/Client.php
32
+
33
+ -
34
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:sendAsync\\(\\) should return GuzzleHttp\\\\PromiseInterface but returns GuzzleHttp\\\\Promise\\\\PromiseInterface\\.$#"
35
+ count: 1
36
+ path: src/Client.php
37
+
38
+ -
39
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:send\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
40
+ count: 1
41
+ path: src/Client.php
42
+
43
+ -
44
+ message: "#^PHPDoc tag @throws with type GuzzleHttp\\\\GuzzleException is not subtype of Throwable$#"
45
+ count: 2
46
+ path: src/Client.php
47
+
48
+ -
49
+ message: "#^Call to method wait\\(\\) on an unknown class GuzzleHttp\\\\PromiseInterface\\.$#"
50
+ count: 2
51
+ path: src/Client.php
52
+
53
+ -
54
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:requestAsync\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
55
+ count: 1
56
+ path: src/Client.php
57
+
58
+ -
59
+ message: "#^Return typehint of method GuzzleHttp\\\\Client\\:\\:requestAsync\\(\\) has invalid type GuzzleHttp\\\\PromiseInterface\\.$#"
60
+ count: 1
61
+ path: src/Client.php
62
+
63
+ -
64
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:requestAsync\\(\\) should return GuzzleHttp\\\\PromiseInterface but returns GuzzleHttp\\\\Promise\\\\PromiseInterface\\.$#"
65
+ count: 1
66
+ path: src/Client.php
67
+
68
+ -
69
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:request\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
70
+ count: 1
71
+ path: src/Client.php
72
+
73
+ -
74
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:buildUri\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#"
75
+ count: 1
76
+ path: src/Client.php
77
+
78
+ -
79
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:configureDefaults\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#"
80
+ count: 1
81
+ path: src/Client.php
82
+
83
+ -
84
+ message: "#^Parameter \\#1 \\$str of function strtolower expects string, int\\|string given\\.$#"
85
+ count: 1
86
+ path: src/Client.php
87
+
88
+ -
89
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:prepareDefaults\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
90
+ count: 1
91
+ path: src/Client.php
92
+
93
+ -
94
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:prepareDefaults\\(\\) return type has no value type specified in iterable type array\\.$#"
95
+ count: 1
96
+ path: src/Client.php
97
+
98
+ -
99
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:transfer\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
100
+ count: 1
101
+ path: src/Client.php
102
+
103
+ -
104
+ message: "#^Method GuzzleHttp\\\\Client\\:\\:applyOptions\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
105
+ count: 1
106
+ path: src/Client.php
107
+
108
+ -
109
+ message: "#^Parameter \\#2 \\$prefix of function http_build_query expects string, null given\\.$#"
110
+ count: 1
111
+ path: src/Client.php
112
+
113
+ -
114
+ message: "#^Method GuzzleHttp\\\\ClientInterface\\:\\:send\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
115
+ count: 1
116
+ path: src/ClientInterface.php
117
+
118
+ -
119
+ message: "#^Method GuzzleHttp\\\\ClientInterface\\:\\:sendAsync\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
120
+ count: 1
121
+ path: src/ClientInterface.php
122
+
123
+ -
124
+ message: "#^Method GuzzleHttp\\\\ClientInterface\\:\\:request\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
125
+ count: 1
126
+ path: src/ClientInterface.php
127
+
128
+ -
129
+ message: "#^Method GuzzleHttp\\\\ClientInterface\\:\\:requestAsync\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
130
+ count: 1
131
+ path: src/ClientInterface.php
132
+
133
+ -
134
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:__construct\\(\\) has parameter \\$cookieArray with no value type specified in iterable type array\\.$#"
135
+ count: 1
136
+ path: src/Cookie/CookieJar.php
137
+
138
+ -
139
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:fromArray\\(\\) has parameter \\$cookies with no value type specified in iterable type array\\.$#"
140
+ count: 1
141
+ path: src/Cookie/CookieJar.php
142
+
143
+ -
144
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:fromArray\\(\\) return type has no value type specified in iterable type GuzzleHttp\\\\Cookie\\\\CookieJar\\.$#"
145
+ count: 1
146
+ path: src/Cookie/CookieJar.php
147
+
148
+ -
149
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:getCookieValue\\(\\) has no return typehint specified\\.$#"
150
+ count: 1
151
+ path: src/Cookie/CookieJar.php
152
+
153
+ -
154
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:getCookieValue\\(\\) has parameter \\$value with no typehint specified\\.$#"
155
+ count: 1
156
+ path: src/Cookie/CookieJar.php
157
+
158
+ -
159
+ message: "#^Result of \\|\\| is always false\\.$#"
160
+ count: 1
161
+ path: src/Cookie/CookieJar.php
162
+
163
+ -
164
+ message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#"
165
+ count: 2
166
+ path: src/Cookie/CookieJar.php
167
+
168
+ -
169
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#"
170
+ count: 1
171
+ path: src/Cookie/CookieJar.php
172
+
173
+ -
174
+ message: "#^Call to an undefined method Traversable\\<mixed, mixed\\>\\:\\:getArrayCopy\\(\\)\\.$#"
175
+ count: 1
176
+ path: src/Cookie/CookieJar.php
177
+
178
+ -
179
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:clear\\(\\) return type has no value type specified in iterable type GuzzleHttp\\\\Cookie\\\\CookieJarInterface\\.$#"
180
+ count: 1
181
+ path: src/Cookie/CookieJar.php
182
+
183
+ -
184
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:clear\\(\\) should return GuzzleHttp\\\\Cookie\\\\CookieJarInterface but return statement is missing\\.$#"
185
+ count: 1
186
+ path: src/Cookie/CookieJar.php
187
+
188
+ -
189
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:clear\\(\\) should return GuzzleHttp\\\\Cookie\\\\CookieJarInterface but empty return statement found\\.$#"
190
+ count: 1
191
+ path: src/Cookie/CookieJar.php
192
+
193
+ -
194
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:clearSessionCookies\\(\\) has no return typehint specified\\.$#"
195
+ count: 1
196
+ path: src/Cookie/CookieJar.php
197
+
198
+ -
199
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:count\\(\\) has no return typehint specified\\.$#"
200
+ count: 1
201
+ path: src/Cookie/CookieJar.php
202
+
203
+ -
204
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:getIterator\\(\\) return type has no value type specified in iterable type Traversable\\<mixed, mixed\\>\\.$#"
205
+ count: 1
206
+ path: src/Cookie/CookieJar.php
207
+
208
+ -
209
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:extractCookies\\(\\) has no return typehint specified\\.$#"
210
+ count: 1
211
+ path: src/Cookie/CookieJar.php
212
+
213
+ -
214
+ message: "#^Parameter \\#3 \\$length of function substr expects int, int\\|false given\\.$#"
215
+ count: 1
216
+ path: src/Cookie/CookieJar.php
217
+
218
+ -
219
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:removeCookieIfEmpty\\(\\) has no return typehint specified\\.$#"
220
+ count: 1
221
+ path: src/Cookie/CookieJar.php
222
+
223
+ -
224
+ message: "#^Interface GuzzleHttp\\\\Cookie\\\\CookieJarInterface extends generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#"
225
+ count: 1
226
+ path: src/Cookie/CookieJarInterface.php
227
+
228
+ -
229
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJarInterface\\:\\:extractCookies\\(\\) has no return typehint specified\\.$#"
230
+ count: 1
231
+ path: src/Cookie/CookieJarInterface.php
232
+
233
+ -
234
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJarInterface\\:\\:clear\\(\\) return type has no value type specified in iterable type GuzzleHttp\\\\Cookie\\\\CookieJarInterface\\.$#"
235
+ count: 1
236
+ path: src/Cookie/CookieJarInterface.php
237
+
238
+ -
239
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJarInterface\\:\\:clearSessionCookies\\(\\) has no return typehint specified\\.$#"
240
+ count: 1
241
+ path: src/Cookie/CookieJarInterface.php
242
+
243
+ -
244
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJarInterface\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#"
245
+ count: 1
246
+ path: src/Cookie/CookieJarInterface.php
247
+
248
+ -
249
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\FileCookieJar\\:\\:save\\(\\) has no return typehint specified\\.$#"
250
+ count: 1
251
+ path: src/Cookie/FileCookieJar.php
252
+
253
+ -
254
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\FileCookieJar\\:\\:load\\(\\) has no return typehint specified\\.$#"
255
+ count: 1
256
+ path: src/Cookie/FileCookieJar.php
257
+
258
+ -
259
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SessionCookieJar\\:\\:save\\(\\) has no return typehint specified\\.$#"
260
+ count: 1
261
+ path: src/Cookie/SessionCookieJar.php
262
+
263
+ -
264
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SessionCookieJar\\:\\:load\\(\\) has no return typehint specified\\.$#"
265
+ count: 1
266
+ path: src/Cookie/SessionCookieJar.php
267
+
268
+ -
269
+ message: "#^Property GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:\\$defaults type has no value type specified in iterable type array\\.$#"
270
+ count: 1
271
+ path: src/Cookie/SetCookie.php
272
+
273
+ -
274
+ message: "#^Property GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:\\$data type has no value type specified in iterable type array\\.$#"
275
+ count: 1
276
+ path: src/Cookie/SetCookie.php
277
+
278
+ -
279
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:__construct\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
280
+ count: 1
281
+ path: src/Cookie/SetCookie.php
282
+
283
+ -
284
+ message: "#^Property GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:\\$data \\(array\\) does not accept array\\|null\\.$#"
285
+ count: 1
286
+ path: src/Cookie/SetCookie.php
287
+
288
+ -
289
+ message: "#^Parameter \\#1 \\$timestamp of method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setExpires\\(\\) expects int, mixed given\\.$#"
290
+ count: 1
291
+ path: src/Cookie/SetCookie.php
292
+
293
+ -
294
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:toArray\\(\\) has no return typehint specified\\.$#"
295
+ count: 1
296
+ path: src/Cookie/SetCookie.php
297
+
298
+ -
299
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setName\\(\\) has no return typehint specified\\.$#"
300
+ count: 1
301
+ path: src/Cookie/SetCookie.php
302
+
303
+ -
304
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setValue\\(\\) has no return typehint specified\\.$#"
305
+ count: 1
306
+ path: src/Cookie/SetCookie.php
307
+
308
+ -
309
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setDomain\\(\\) has no return typehint specified\\.$#"
310
+ count: 1
311
+ path: src/Cookie/SetCookie.php
312
+
313
+ -
314
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setPath\\(\\) has no return typehint specified\\.$#"
315
+ count: 1
316
+ path: src/Cookie/SetCookie.php
317
+
318
+ -
319
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setMaxAge\\(\\) has no return typehint specified\\.$#"
320
+ count: 1
321
+ path: src/Cookie/SetCookie.php
322
+
323
+ -
324
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setExpires\\(\\) has no return typehint specified\\.$#"
325
+ count: 1
326
+ path: src/Cookie/SetCookie.php
327
+
328
+ -
329
+ message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
330
+ count: 1
331
+ path: src/Cookie/SetCookie.php
332
+
333
+ -
334
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setSecure\\(\\) has no return typehint specified\\.$#"
335
+ count: 1
336
+ path: src/Cookie/SetCookie.php
337
+
338
+ -
339
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setDiscard\\(\\) has no return typehint specified\\.$#"
340
+ count: 1
341
+ path: src/Cookie/SetCookie.php
342
+
343
+ -
344
+ message: "#^Method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setHttpOnly\\(\\) has no return typehint specified\\.$#"
345
+ count: 1
346
+ path: src/Cookie/SetCookie.php
347
+
348
+ -
349
+ message: "#^Parameter \\#1 \\$str of function ltrim expects string, string\\|null given\\.$#"
350
+ count: 1
351
+ path: src/Cookie/SetCookie.php
352
+
353
+ -
354
+ message: "#^Method GuzzleHttp\\\\Exception\\\\BadResponseException\\:\\:__construct\\(\\) has parameter \\$handlerContext with no value type specified in iterable type array\\.$#"
355
+ count: 1
356
+ path: src/Exception/BadResponseException.php
357
+
358
+ -
359
+ message: "#^Method GuzzleHttp\\\\Exception\\\\BadResponseException\\:\\:__construct\\(\\) has parameter \\$message with no typehint specified\\.$#"
360
+ count: 1
361
+ path: src/Exception/BadResponseException.php
362
+
363
+ -
364
+ message: "#^Method GuzzleHttp\\\\Exception\\\\ConnectException\\:\\:__construct\\(\\) has parameter \\$handlerContext with no value type specified in iterable type array\\.$#"
365
+ count: 1
366
+ path: src/Exception/ConnectException.php
367
+
368
+ -
369
+ message: "#^Method GuzzleHttp\\\\Exception\\\\ConnectException\\:\\:__construct\\(\\) has parameter \\$message with no typehint specified\\.$#"
370
+ count: 1
371
+ path: src/Exception/ConnectException.php
372
+
373
+ -
374
+ message: "#^Property GuzzleHttp\\\\Exception\\\\RequestException\\:\\:\\$handlerContext type has no value type specified in iterable type array\\.$#"
375
+ count: 1
376
+ path: src/Exception/RequestException.php
377
+
378
+ -
379
+ message: "#^Method GuzzleHttp\\\\Exception\\\\RequestException\\:\\:__construct\\(\\) has parameter \\$handlerContext with no value type specified in iterable type array\\.$#"
380
+ count: 1
381
+ path: src/Exception/RequestException.php
382
+
383
+ -
384
+ message: "#^Method GuzzleHttp\\\\Exception\\\\RequestException\\:\\:__construct\\(\\) has parameter \\$message with no typehint specified\\.$#"
385
+ count: 1
386
+ path: src/Exception/RequestException.php
387
+
388
+ -
389
+ message: "#^Method GuzzleHttp\\\\Exception\\\\RequestException\\:\\:create\\(\\) has parameter \\$ctx with no value type specified in iterable type array\\.$#"
390
+ count: 1
391
+ path: src/Exception/RequestException.php
392
+
393
+ -
394
+ message: "#^Method GuzzleHttp\\\\Exception\\\\RequestException\\:\\:getHandlerContext\\(\\) return type has no value type specified in iterable type array\\.$#"
395
+ count: 1
396
+ path: src/Exception/RequestException.php
397
+
398
+ -
399
+ message: "#^Property GuzzleHttp\\\\Exception\\\\SeekException\\:\\:\\$stream has no typehint specified\\.$#"
400
+ count: 1
401
+ path: src/Exception/SeekException.php
402
+
403
+ -
404
+ message: "#^Method GuzzleHttp\\\\Exception\\\\SeekException\\:\\:__construct\\(\\) has parameter \\$msg with no typehint specified\\.$#"
405
+ count: 1
406
+ path: src/Exception/SeekException.php
407
+
408
+ -
409
+ message: "#^Method GuzzleHttp\\\\Exception\\\\SeekException\\:\\:__construct\\(\\) has parameter \\$pos with no typehint specified\\.$#"
410
+ count: 1
411
+ path: src/Exception/SeekException.php
412
+
413
+ -
414
+ message: "#^Property GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:\\$handles type has no value type specified in iterable type array\\.$#"
415
+ count: 1
416
+ path: src/Handler/CurlFactory.php
417
+
418
+ -
419
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:create\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
420
+ count: 1
421
+ path: src/Handler/CurlFactory.php
422
+
423
+ -
424
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:release\\(\\) has no return typehint specified\\.$#"
425
+ count: 1
426
+ path: src/Handler/CurlFactory.php
427
+
428
+ -
429
+ message: "#^Negated boolean expression is always false\\.$#"
430
+ count: 1
431
+ path: src/Handler/CurlFactory.php
432
+
433
+ -
434
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:invokeStats\\(\\) has no return typehint specified\\.$#"
435
+ count: 1
436
+ path: src/Handler/CurlFactory.php
437
+
438
+ -
439
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:finishError\\(\\) has no return typehint specified\\.$#"
440
+ count: 1
441
+ path: src/Handler/CurlFactory.php
442
+
443
+ -
444
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:createRejection\\(\\) has no return typehint specified\\.$#"
445
+ count: 1
446
+ path: src/Handler/CurlFactory.php
447
+
448
+ -
449
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:createRejection\\(\\) has parameter \\$ctx with no value type specified in iterable type array\\.$#"
450
+ count: 1
451
+ path: src/Handler/CurlFactory.php
452
+
453
+ -
454
+ message: "#^If condition is always true\\.$#"
455
+ count: 1
456
+ path: src/Handler/CurlFactory.php
457
+
458
+ -
459
+ message: "#^Unreachable statement \\- code above always terminates\\.$#"
460
+ count: 1
461
+ path: src/Handler/CurlFactory.php
462
+
463
+ -
464
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:getDefaultConf\\(\\) has no return typehint specified\\.$#"
465
+ count: 1
466
+ path: src/Handler/CurlFactory.php
467
+
468
+ -
469
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:applyMethod\\(\\) has no return typehint specified\\.$#"
470
+ count: 1
471
+ path: src/Handler/CurlFactory.php
472
+
473
+ -
474
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:applyMethod\\(\\) has parameter \\$conf with no value type specified in iterable type array\\.$#"
475
+ count: 1
476
+ path: src/Handler/CurlFactory.php
477
+
478
+ -
479
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:applyBody\\(\\) has no return typehint specified\\.$#"
480
+ count: 1
481
+ path: src/Handler/CurlFactory.php
482
+
483
+ -
484
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:applyBody\\(\\) has parameter \\$conf with no value type specified in iterable type array\\.$#"
485
+ count: 1
486
+ path: src/Handler/CurlFactory.php
487
+
488
+ -
489
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:applyBody\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
490
+ count: 1
491
+ path: src/Handler/CurlFactory.php
492
+
493
+ -
494
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:applyHeaders\\(\\) has no return typehint specified\\.$#"
495
+ count: 1
496
+ path: src/Handler/CurlFactory.php
497
+
498
+ -
499
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:applyHeaders\\(\\) has parameter \\$conf with no value type specified in iterable type array\\.$#"
500
+ count: 1
501
+ path: src/Handler/CurlFactory.php
502
+
503
+ -
504
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:removeHeader\\(\\) has no return typehint specified\\.$#"
505
+ count: 1
506
+ path: src/Handler/CurlFactory.php
507
+
508
+ -
509
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:removeHeader\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
510
+ count: 1
511
+ path: src/Handler/CurlFactory.php
512
+
513
+ -
514
+ message: "#^Parameter \\#1 \\$str1 of function strcasecmp expects string, int\\|string given\\.$#"
515
+ count: 1
516
+ path: src/Handler/CurlFactory.php
517
+
518
+ -
519
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:applyHandlerOptions\\(\\) has no return typehint specified\\.$#"
520
+ count: 1
521
+ path: src/Handler/CurlFactory.php
522
+
523
+ -
524
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:applyHandlerOptions\\(\\) has parameter \\$conf with no value type specified in iterable type array\\.$#"
525
+ count: 1
526
+ path: src/Handler/CurlFactory.php
527
+
528
+ -
529
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:retryFailedRewind\\(\\) has no return typehint specified\\.$#"
530
+ count: 1
531
+ path: src/Handler/CurlFactory.php
532
+
533
+ -
534
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:retryFailedRewind\\(\\) has parameter \\$ctx with no value type specified in iterable type array\\.$#"
535
+ count: 1
536
+ path: src/Handler/CurlFactory.php
537
+
538
+ -
539
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:createHeaderFn\\(\\) has no return typehint specified\\.$#"
540
+ count: 1
541
+ path: src/Handler/CurlFactory.php
542
+
543
+ -
544
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactoryInterface\\:\\:create\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
545
+ count: 1
546
+ path: src/Handler/CurlFactoryInterface.php
547
+
548
+ -
549
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlFactoryInterface\\:\\:release\\(\\) has no return typehint specified\\.$#"
550
+ count: 1
551
+ path: src/Handler/CurlFactoryInterface.php
552
+
553
+ -
554
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlHandler\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
555
+ count: 1
556
+ path: src/Handler/CurlHandler.php
557
+
558
+ -
559
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlHandler\\:\\:__invoke\\(\\) has no return typehint specified\\.$#"
560
+ count: 1
561
+ path: src/Handler/CurlHandler.php
562
+
563
+ -
564
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlHandler\\:\\:__invoke\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
565
+ count: 1
566
+ path: src/Handler/CurlHandler.php
567
+
568
+ -
569
+ message: "#^Property GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:\\$selectTimeout has no typehint specified\\.$#"
570
+ count: 1
571
+ path: src/Handler/CurlMultiHandler.php
572
+
573
+ -
574
+ message: "#^Property GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:\\$active has no typehint specified\\.$#"
575
+ count: 1
576
+ path: src/Handler/CurlMultiHandler.php
577
+
578
+ -
579
+ message: "#^Property GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:\\$handles has no typehint specified\\.$#"
580
+ count: 1
581
+ path: src/Handler/CurlMultiHandler.php
582
+
583
+ -
584
+ message: "#^Property GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:\\$delays has no typehint specified\\.$#"
585
+ count: 1
586
+ path: src/Handler/CurlMultiHandler.php
587
+
588
+ -
589
+ message: "#^Property GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:\\$options has no typehint specified\\.$#"
590
+ count: 1
591
+ path: src/Handler/CurlMultiHandler.php
592
+
593
+ -
594
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
595
+ count: 1
596
+ path: src/Handler/CurlMultiHandler.php
597
+
598
+ -
599
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:__get\\(\\) has no return typehint specified\\.$#"
600
+ count: 1
601
+ path: src/Handler/CurlMultiHandler.php
602
+
603
+ -
604
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:__get\\(\\) has parameter \\$name with no typehint specified\\.$#"
605
+ count: 1
606
+ path: src/Handler/CurlMultiHandler.php
607
+
608
+ -
609
+ message: "#^Property GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:\\$_mh \\(resource\\) does not accept resource\\|false\\.$#"
610
+ count: 1
611
+ path: src/Handler/CurlMultiHandler.php
612
+
613
+ -
614
+ message: "#^Parameter \\#1 \\$mh of function curl_multi_setopt expects resource, resource\\|false given\\.$#"
615
+ count: 1
616
+ path: src/Handler/CurlMultiHandler.php
617
+
618
+ -
619
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:__invoke\\(\\) has no return typehint specified\\.$#"
620
+ count: 1
621
+ path: src/Handler/CurlMultiHandler.php
622
+
623
+ -
624
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:__invoke\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
625
+ count: 1
626
+ path: src/Handler/CurlMultiHandler.php
627
+
628
+ -
629
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:tick\\(\\) has no return typehint specified\\.$#"
630
+ count: 1
631
+ path: src/Handler/CurlMultiHandler.php
632
+
633
+ -
634
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:execute\\(\\) has no return typehint specified\\.$#"
635
+ count: 1
636
+ path: src/Handler/CurlMultiHandler.php
637
+
638
+ -
639
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:addRequest\\(\\) has no return typehint specified\\.$#"
640
+ count: 1
641
+ path: src/Handler/CurlMultiHandler.php
642
+
643
+ -
644
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:addRequest\\(\\) has parameter \\$entry with no value type specified in iterable type array\\.$#"
645
+ count: 1
646
+ path: src/Handler/CurlMultiHandler.php
647
+
648
+ -
649
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:processMessages\\(\\) has no return typehint specified\\.$#"
650
+ count: 1
651
+ path: src/Handler/CurlMultiHandler.php
652
+
653
+ -
654
+ message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:timeToNext\\(\\) has no return typehint specified\\.$#"
655
+ count: 1
656
+ path: src/Handler/CurlMultiHandler.php
657
+
658
+ -
659
+ message: "#^Property GuzzleHttp\\\\Handler\\\\EasyHandle\\:\\:\\$headers type has no value type specified in iterable type array\\.$#"
660
+ count: 1
661
+ path: src/Handler/EasyHandle.php
662
+
663
+ -
664
+ message: "#^Property GuzzleHttp\\\\Handler\\\\EasyHandle\\:\\:\\$options type has no value type specified in iterable type array\\.$#"
665
+ count: 1
666
+ path: src/Handler/EasyHandle.php
667
+
668
+ -
669
+ message: "#^Method GuzzleHttp\\\\Handler\\\\EasyHandle\\:\\:createResponse\\(\\) has no return typehint specified\\.$#"
670
+ count: 1
671
+ path: src/Handler/EasyHandle.php
672
+
673
+ -
674
+ message: "#^Parameter \\#1 \\$status of class GuzzleHttp\\\\Psr7\\\\Response constructor expects int, string given\\.$#"
675
+ count: 1
676
+ path: src/Handler/EasyHandle.php
677
+
678
+ -
679
+ message: "#^Method GuzzleHttp\\\\Handler\\\\EasyHandle\\:\\:__get\\(\\) has no return typehint specified\\.$#"
680
+ count: 1
681
+ path: src/Handler/EasyHandle.php
682
+
683
+ -
684
+ message: "#^Method GuzzleHttp\\\\Handler\\\\EasyHandle\\:\\:__get\\(\\) has parameter \\$name with no typehint specified\\.$#"
685
+ count: 1
686
+ path: src/Handler/EasyHandle.php
687
+
688
+ -
689
+ message: "#^Property GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:\\$queue has no typehint specified\\.$#"
690
+ count: 1
691
+ path: src/Handler/MockHandler.php
692
+
693
+ -
694
+ message: "#^Property GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:\\$lastRequest has no typehint specified\\.$#"
695
+ count: 1
696
+ path: src/Handler/MockHandler.php
697
+
698
+ -
699
+ message: "#^Property GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:\\$lastOptions has no typehint specified\\.$#"
700
+ count: 1
701
+ path: src/Handler/MockHandler.php
702
+
703
+ -
704
+ message: "#^Property GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:\\$onFulfilled has no typehint specified\\.$#"
705
+ count: 1
706
+ path: src/Handler/MockHandler.php
707
+
708
+ -
709
+ message: "#^Property GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:\\$onRejected has no typehint specified\\.$#"
710
+ count: 1
711
+ path: src/Handler/MockHandler.php
712
+
713
+ -
714
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:createWithMiddleware\\(\\) has parameter \\$queue with no value type specified in iterable type array\\.$#"
715
+ count: 1
716
+ path: src/Handler/MockHandler.php
717
+
718
+ -
719
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:__construct\\(\\) has parameter \\$queue with no value type specified in iterable type array\\.$#"
720
+ count: 1
721
+ path: src/Handler/MockHandler.php
722
+
723
+ -
724
+ message: "#^Parameter \\#2 \\$parameters of function call_user_func_array expects array\\<int, mixed\\>, array given\\.$#"
725
+ count: 1
726
+ path: src/Handler/MockHandler.php
727
+
728
+ -
729
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:__invoke\\(\\) has no return typehint specified\\.$#"
730
+ count: 1
731
+ path: src/Handler/MockHandler.php
732
+
733
+ -
734
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:__invoke\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
735
+ count: 1
736
+ path: src/Handler/MockHandler.php
737
+
738
+ -
739
+ message: "#^Binary operation \"\\*\" between float\\|int\\|string and 1000 results in an error\\.$#"
740
+ count: 1
741
+ path: src/Handler/MockHandler.php
742
+
743
+ -
744
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:append\\(\\) has no return typehint specified\\.$#"
745
+ count: 1
746
+ path: src/Handler/MockHandler.php
747
+
748
+ -
749
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:getLastOptions\\(\\) return type has no value type specified in iterable type array\\.$#"
750
+ count: 1
751
+ path: src/Handler/MockHandler.php
752
+
753
+ -
754
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:reset\\(\\) has no return typehint specified\\.$#"
755
+ count: 1
756
+ path: src/Handler/MockHandler.php
757
+
758
+ -
759
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:invokeStats\\(\\) has no return typehint specified\\.$#"
760
+ count: 1
761
+ path: src/Handler/MockHandler.php
762
+
763
+ -
764
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:invokeStats\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
765
+ count: 1
766
+ path: src/Handler/MockHandler.php
767
+
768
+ -
769
+ message: "#^Method GuzzleHttp\\\\Handler\\\\MockHandler\\:\\:invokeStats\\(\\) has parameter \\$reason with no typehint specified\\.$#"
770
+ count: 1
771
+ path: src/Handler/MockHandler.php
772
+
773
+ -
774
+ message: "#^Property GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:\\$lastHeaders has no typehint specified\\.$#"
775
+ count: 1
776
+ path: src/Handler/StreamHandler.php
777
+
778
+ -
779
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:__invoke\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
780
+ count: 1
781
+ path: src/Handler/StreamHandler.php
782
+
783
+ -
784
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:invokeStats\\(\\) has no return typehint specified\\.$#"
785
+ count: 1
786
+ path: src/Handler/StreamHandler.php
787
+
788
+ -
789
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:invokeStats\\(\\) has parameter \\$error with no typehint specified\\.$#"
790
+ count: 1
791
+ path: src/Handler/StreamHandler.php
792
+
793
+ -
794
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:invokeStats\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
795
+ count: 1
796
+ path: src/Handler/StreamHandler.php
797
+
798
+ -
799
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:invokeStats\\(\\) has parameter \\$startTime with no typehint specified\\.$#"
800
+ count: 1
801
+ path: src/Handler/StreamHandler.php
802
+
803
+ -
804
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:createResponse\\(\\) has no return typehint specified\\.$#"
805
+ count: 1
806
+ path: src/Handler/StreamHandler.php
807
+
808
+ -
809
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:createResponse\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
810
+ count: 1
811
+ path: src/Handler/StreamHandler.php
812
+
813
+ -
814
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:createResponse\\(\\) has parameter \\$startTime with no typehint specified\\.$#"
815
+ count: 1
816
+ path: src/Handler/StreamHandler.php
817
+
818
+ -
819
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:createResponse\\(\\) has parameter \\$stream with no typehint specified\\.$#"
820
+ count: 1
821
+ path: src/Handler/StreamHandler.php
822
+
823
+ -
824
+ message: "#^Parameter \\#1 \\$status of class GuzzleHttp\\\\Psr7\\\\Response constructor expects int, string given\\.$#"
825
+ count: 1
826
+ path: src/Handler/StreamHandler.php
827
+
828
+ -
829
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:createSink\\(\\) has no return typehint specified\\.$#"
830
+ count: 1
831
+ path: src/Handler/StreamHandler.php
832
+
833
+ -
834
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:createSink\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
835
+ count: 1
836
+ path: src/Handler/StreamHandler.php
837
+
838
+ -
839
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:checkDecode\\(\\) has no return typehint specified\\.$#"
840
+ count: 1
841
+ path: src/Handler/StreamHandler.php
842
+
843
+ -
844
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:checkDecode\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
845
+ count: 1
846
+ path: src/Handler/StreamHandler.php
847
+
848
+ -
849
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:checkDecode\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
850
+ count: 1
851
+ path: src/Handler/StreamHandler.php
852
+
853
+ -
854
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:checkDecode\\(\\) has parameter \\$stream with no typehint specified\\.$#"
855
+ count: 1
856
+ path: src/Handler/StreamHandler.php
857
+
858
+ -
859
+ message: "#^Argument of an invalid type array\\<int, array\\<string, int\\|string\\>\\>\\|null supplied for foreach, only iterables are supported\\.$#"
860
+ count: 1
861
+ path: src/Handler/StreamHandler.php
862
+
863
+ -
864
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:createStream\\(\\) has no return typehint specified\\.$#"
865
+ count: 1
866
+ path: src/Handler/StreamHandler.php
867
+
868
+ -
869
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:createStream\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
870
+ count: 1
871
+ path: src/Handler/StreamHandler.php
872
+
873
+ -
874
+ message: "#^Parameter \\#3 \\$use_include_path of function fopen expects bool, null given\\.$#"
875
+ count: 1
876
+ path: src/Handler/StreamHandler.php
877
+
878
+ -
879
+ message: "#^Parameter \\#1 \\$stream of function stream_set_timeout expects resource, resource\\|false given\\.$#"
880
+ count: 1
881
+ path: src/Handler/StreamHandler.php
882
+
883
+ -
884
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:resolveHost\\(\\) has no return typehint specified\\.$#"
885
+ count: 1
886
+ path: src/Handler/StreamHandler.php
887
+
888
+ -
889
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:resolveHost\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
890
+ count: 1
891
+ path: src/Handler/StreamHandler.php
892
+
893
+ -
894
+ message: "#^Cannot access offset 0 on array\\|false\\.$#"
895
+ count: 2
896
+ path: src/Handler/StreamHandler.php
897
+
898
+ -
899
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:getDefaultContext\\(\\) has no return typehint specified\\.$#"
900
+ count: 1
901
+ path: src/Handler/StreamHandler.php
902
+
903
+ -
904
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_proxy\\(\\) has no return typehint specified\\.$#"
905
+ count: 1
906
+ path: src/Handler/StreamHandler.php
907
+
908
+ -
909
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_proxy\\(\\) has parameter \\$options with no typehint specified\\.$#"
910
+ count: 1
911
+ path: src/Handler/StreamHandler.php
912
+
913
+ -
914
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_proxy\\(\\) has parameter \\$params with no typehint specified\\.$#"
915
+ count: 1
916
+ path: src/Handler/StreamHandler.php
917
+
918
+ -
919
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_proxy\\(\\) has parameter \\$value with no typehint specified\\.$#"
920
+ count: 1
921
+ path: src/Handler/StreamHandler.php
922
+
923
+ -
924
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_timeout\\(\\) has no return typehint specified\\.$#"
925
+ count: 1
926
+ path: src/Handler/StreamHandler.php
927
+
928
+ -
929
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_timeout\\(\\) has parameter \\$options with no typehint specified\\.$#"
930
+ count: 1
931
+ path: src/Handler/StreamHandler.php
932
+
933
+ -
934
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_timeout\\(\\) has parameter \\$params with no typehint specified\\.$#"
935
+ count: 1
936
+ path: src/Handler/StreamHandler.php
937
+
938
+ -
939
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_timeout\\(\\) has parameter \\$value with no typehint specified\\.$#"
940
+ count: 1
941
+ path: src/Handler/StreamHandler.php
942
+
943
+ -
944
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_verify\\(\\) has no return typehint specified\\.$#"
945
+ count: 1
946
+ path: src/Handler/StreamHandler.php
947
+
948
+ -
949
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_verify\\(\\) has parameter \\$options with no typehint specified\\.$#"
950
+ count: 1
951
+ path: src/Handler/StreamHandler.php
952
+
953
+ -
954
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_verify\\(\\) has parameter \\$params with no typehint specified\\.$#"
955
+ count: 1
956
+ path: src/Handler/StreamHandler.php
957
+
958
+ -
959
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_verify\\(\\) has parameter \\$value with no typehint specified\\.$#"
960
+ count: 1
961
+ path: src/Handler/StreamHandler.php
962
+
963
+ -
964
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_cert\\(\\) has no return typehint specified\\.$#"
965
+ count: 1
966
+ path: src/Handler/StreamHandler.php
967
+
968
+ -
969
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_cert\\(\\) has parameter \\$options with no typehint specified\\.$#"
970
+ count: 1
971
+ path: src/Handler/StreamHandler.php
972
+
973
+ -
974
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_cert\\(\\) has parameter \\$params with no typehint specified\\.$#"
975
+ count: 1
976
+ path: src/Handler/StreamHandler.php
977
+
978
+ -
979
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_cert\\(\\) has parameter \\$value with no typehint specified\\.$#"
980
+ count: 1
981
+ path: src/Handler/StreamHandler.php
982
+
983
+ -
984
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_progress\\(\\) has no return typehint specified\\.$#"
985
+ count: 1
986
+ path: src/Handler/StreamHandler.php
987
+
988
+ -
989
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_progress\\(\\) has parameter \\$options with no typehint specified\\.$#"
990
+ count: 1
991
+ path: src/Handler/StreamHandler.php
992
+
993
+ -
994
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_progress\\(\\) has parameter \\$params with no typehint specified\\.$#"
995
+ count: 1
996
+ path: src/Handler/StreamHandler.php
997
+
998
+ -
999
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_progress\\(\\) has parameter \\$value with no typehint specified\\.$#"
1000
+ count: 1
1001
+ path: src/Handler/StreamHandler.php
1002
+
1003
+ -
1004
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_debug\\(\\) has no return typehint specified\\.$#"
1005
+ count: 1
1006
+ path: src/Handler/StreamHandler.php
1007
+
1008
+ -
1009
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_debug\\(\\) has parameter \\$options with no typehint specified\\.$#"
1010
+ count: 1
1011
+ path: src/Handler/StreamHandler.php
1012
+
1013
+ -
1014
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_debug\\(\\) has parameter \\$params with no typehint specified\\.$#"
1015
+ count: 1
1016
+ path: src/Handler/StreamHandler.php
1017
+
1018
+ -
1019
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:add_debug\\(\\) has parameter \\$value with no typehint specified\\.$#"
1020
+ count: 1
1021
+ path: src/Handler/StreamHandler.php
1022
+
1023
+ -
1024
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:addNotification\\(\\) has no return typehint specified\\.$#"
1025
+ count: 1
1026
+ path: src/Handler/StreamHandler.php
1027
+
1028
+ -
1029
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:addNotification\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
1030
+ count: 1
1031
+ path: src/Handler/StreamHandler.php
1032
+
1033
+ -
1034
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:callArray\\(\\) has no return typehint specified\\.$#"
1035
+ count: 1
1036
+ path: src/Handler/StreamHandler.php
1037
+
1038
+ -
1039
+ message: "#^Method GuzzleHttp\\\\Handler\\\\StreamHandler\\:\\:callArray\\(\\) has parameter \\$functions with no value type specified in iterable type array\\.$#"
1040
+ count: 1
1041
+ path: src/Handler/StreamHandler.php
1042
+
1043
+ -
1044
+ message: "#^Property GuzzleHttp\\\\HandlerStack\\:\\:\\$stack type has no value type specified in iterable type array\\.$#"
1045
+ count: 1
1046
+ path: src/HandlerStack.php
1047
+
1048
+ -
1049
+ message: "#^Method GuzzleHttp\\\\HandlerStack\\:\\:__invoke\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1050
+ count: 1
1051
+ path: src/HandlerStack.php
1052
+
1053
+ -
1054
+ message: "#^Method GuzzleHttp\\\\HandlerStack\\:\\:setHandler\\(\\) has no return typehint specified\\.$#"
1055
+ count: 1
1056
+ path: src/HandlerStack.php
1057
+
1058
+ -
1059
+ message: "#^Method GuzzleHttp\\\\HandlerStack\\:\\:unshift\\(\\) has no return typehint specified\\.$#"
1060
+ count: 1
1061
+ path: src/HandlerStack.php
1062
+
1063
+ -
1064
+ message: "#^Method GuzzleHttp\\\\HandlerStack\\:\\:push\\(\\) has no return typehint specified\\.$#"
1065
+ count: 1
1066
+ path: src/HandlerStack.php
1067
+
1068
+ -
1069
+ message: "#^Method GuzzleHttp\\\\HandlerStack\\:\\:before\\(\\) has no return typehint specified\\.$#"
1070
+ count: 1
1071
+ path: src/HandlerStack.php
1072
+
1073
+ -
1074
+ message: "#^Method GuzzleHttp\\\\HandlerStack\\:\\:after\\(\\) has no return typehint specified\\.$#"
1075
+ count: 1
1076
+ path: src/HandlerStack.php
1077
+
1078
+ -
1079
+ message: "#^Method GuzzleHttp\\\\HandlerStack\\:\\:remove\\(\\) has no return typehint specified\\.$#"
1080
+ count: 1
1081
+ path: src/HandlerStack.php
1082
+
1083
+ -
1084
+ message: "#^Method GuzzleHttp\\\\HandlerStack\\:\\:splice\\(\\) has no return typehint specified\\.$#"
1085
+ count: 1
1086
+ path: src/HandlerStack.php
1087
+
1088
+ -
1089
+ message: "#^Method GuzzleHttp\\\\HandlerStack\\:\\:debugCallable\\(\\) has parameter \\$fn with no value type specified in iterable type array\\.$#"
1090
+ count: 1
1091
+ path: src/HandlerStack.php
1092
+
1093
+ -
1094
+ message: "#^Parameter \\#1 \\$obj of function spl_object_hash expects object, callable given\\.$#"
1095
+ count: 1
1096
+ path: src/HandlerStack.php
1097
+
1098
+ -
1099
+ message: "#^Method GuzzleHttp\\\\MessageFormatter\\:\\:format\\(\\) should return string but returns string\\|null\\.$#"
1100
+ count: 1
1101
+ path: src/MessageFormatter.php
1102
+
1103
+ -
1104
+ message: "#^Method GuzzleHttp\\\\Middleware\\:\\:history\\(\\) has parameter \\$container with generic interface ArrayAccess but does not specify its types\\: TKey, TValue$#"
1105
+ count: 1
1106
+ path: src/Middleware.php
1107
+
1108
+ -
1109
+ message: "#^Method GuzzleHttp\\\\Middleware\\:\\:history\\(\\) has parameter \\$container with no value type specified in iterable type array\\.$#"
1110
+ count: 1
1111
+ path: src/Middleware.php
1112
+
1113
+ -
1114
+ message: "#^Result of && is always false\\.$#"
1115
+ count: 1
1116
+ path: src/Middleware.php
1117
+
1118
+ -
1119
+ message: "#^Method GuzzleHttp\\\\Pool\\:\\:__construct\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#"
1120
+ count: 1
1121
+ path: src/Pool.php
1122
+
1123
+ -
1124
+ message: "#^Method GuzzleHttp\\\\Pool\\:\\:__construct\\(\\) has parameter \\$requests with no value type specified in iterable type array\\|Iterator\\.$#"
1125
+ count: 1
1126
+ path: src/Pool.php
1127
+
1128
+ -
1129
+ message: "#^Return typehint of method GuzzleHttp\\\\Pool\\:\\:promise\\(\\) has invalid type GuzzleHttp\\\\GuzzleHttp\\\\Promise\\\\Promise\\.$#"
1130
+ count: 1
1131
+ path: src/Pool.php
1132
+
1133
+ -
1134
+ message: "#^Method GuzzleHttp\\\\Pool\\:\\:promise\\(\\) should return GuzzleHttp\\\\GuzzleHttp\\\\Promise\\\\Promise but returns GuzzleHttp\\\\Promise\\\\PromiseInterface\\.$#"
1135
+ count: 1
1136
+ path: src/Pool.php
1137
+
1138
+ -
1139
+ message: "#^Method GuzzleHttp\\\\Pool\\:\\:batch\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1140
+ count: 1
1141
+ path: src/Pool.php
1142
+
1143
+ -
1144
+ message: "#^Method GuzzleHttp\\\\Pool\\:\\:batch\\(\\) has parameter \\$requests with no value type specified in iterable type array\\|Iterator\\.$#"
1145
+ count: 1
1146
+ path: src/Pool.php
1147
+
1148
+ -
1149
+ message: "#^Method GuzzleHttp\\\\Pool\\:\\:batch\\(\\) return type has no value type specified in iterable type array\\.$#"
1150
+ count: 1
1151
+ path: src/Pool.php
1152
+
1153
+ -
1154
+ message: "#^Unsafe usage of new static\\(\\)\\.$#"
1155
+ count: 1
1156
+ path: src/Pool.php
1157
+
1158
+ -
1159
+ message: "#^Call to method wait\\(\\) on an unknown class GuzzleHttp\\\\GuzzleHttp\\\\Promise\\\\Promise\\.$#"
1160
+ count: 1
1161
+ path: src/Pool.php
1162
+
1163
+ -
1164
+ message: "#^Method GuzzleHttp\\\\Pool\\:\\:cmpCallback\\(\\) has parameter \\$name with no typehint specified\\.$#"
1165
+ count: 1
1166
+ path: src/Pool.php
1167
+
1168
+ -
1169
+ message: "#^Method GuzzleHttp\\\\Pool\\:\\:cmpCallback\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1170
+ count: 1
1171
+ path: src/Pool.php
1172
+
1173
+ -
1174
+ message: "#^Method GuzzleHttp\\\\Pool\\:\\:cmpCallback\\(\\) has parameter \\$results with no value type specified in iterable type array\\.$#"
1175
+ count: 1
1176
+ path: src/Pool.php
1177
+
1178
+ -
1179
+ message: "#^Method GuzzleHttp\\\\PrepareBodyMiddleware\\:\\:__invoke\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1180
+ count: 1
1181
+ path: src/PrepareBodyMiddleware.php
1182
+
1183
+ -
1184
+ message: "#^Method GuzzleHttp\\\\PrepareBodyMiddleware\\:\\:addExpectHeader\\(\\) has parameter \\$modify with no value type specified in iterable type array\\.$#"
1185
+ count: 1
1186
+ path: src/PrepareBodyMiddleware.php
1187
+
1188
+ -
1189
+ message: "#^Method GuzzleHttp\\\\PrepareBodyMiddleware\\:\\:addExpectHeader\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1190
+ count: 1
1191
+ path: src/PrepareBodyMiddleware.php
1192
+
1193
+ -
1194
+ message: "#^Property GuzzleHttp\\\\RedirectMiddleware\\:\\:\\$defaultSettings has no typehint specified\\.$#"
1195
+ count: 1
1196
+ path: src/RedirectMiddleware.php
1197
+
1198
+ -
1199
+ message: "#^Method GuzzleHttp\\\\RedirectMiddleware\\:\\:__invoke\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1200
+ count: 1
1201
+ path: src/RedirectMiddleware.php
1202
+
1203
+ -
1204
+ message: "#^Method GuzzleHttp\\\\RedirectMiddleware\\:\\:checkRedirect\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1205
+ count: 1
1206
+ path: src/RedirectMiddleware.php
1207
+
1208
+ -
1209
+ message: "#^Parameter \\#1 \\$str of function substr expects string, int given\\.$#"
1210
+ count: 1
1211
+ path: src/RedirectMiddleware.php
1212
+
1213
+ -
1214
+ message: "#^Parameter \\#1 \\$promise of method GuzzleHttp\\\\RedirectMiddleware\\:\\:withTracking\\(\\) expects GuzzleHttp\\\\Promise\\\\PromiseInterface, GuzzleHttp\\\\Promise\\\\PromiseInterface\\|Psr\\\\Http\\\\Message\\\\ResponseInterface given\\.$#"
1215
+ count: 1
1216
+ path: src/RedirectMiddleware.php
1217
+
1218
+ -
1219
+ message: "#^Method GuzzleHttp\\\\RedirectMiddleware\\:\\:withTracking\\(\\) has parameter \\$statusCode with no typehint specified\\.$#"
1220
+ count: 1
1221
+ path: src/RedirectMiddleware.php
1222
+
1223
+ -
1224
+ message: "#^Method GuzzleHttp\\\\RedirectMiddleware\\:\\:withTracking\\(\\) has parameter \\$uri with no typehint specified\\.$#"
1225
+ count: 1
1226
+ path: src/RedirectMiddleware.php
1227
+
1228
+ -
1229
+ message: "#^Parameter \\#2 \\$value of method Psr\\\\Http\\\\Message\\\\MessageInterface\\:\\:withHeader\\(\\) expects array\\<string\\>\\|string, array given\\.$#"
1230
+ count: 2
1231
+ path: src/RedirectMiddleware.php
1232
+
1233
+ -
1234
+ message: "#^Method GuzzleHttp\\\\RedirectMiddleware\\:\\:guardMax\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1235
+ count: 1
1236
+ path: src/RedirectMiddleware.php
1237
+
1238
+ -
1239
+ message: "#^Method GuzzleHttp\\\\RedirectMiddleware\\:\\:modifyRequest\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1240
+ count: 1
1241
+ path: src/RedirectMiddleware.php
1242
+
1243
+ -
1244
+ message: "#^Method GuzzleHttp\\\\RedirectMiddleware\\:\\:redirectUri\\(\\) has parameter \\$protocols with no value type specified in iterable type array\\.$#"
1245
+ count: 1
1246
+ path: src/RedirectMiddleware.php
1247
+
1248
+ -
1249
+ message: "#^Method GuzzleHttp\\\\RetryMiddleware\\:\\:__invoke\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1250
+ count: 1
1251
+ path: src/RetryMiddleware.php
1252
+
1253
+ -
1254
+ message: "#^Method GuzzleHttp\\\\RetryMiddleware\\:\\:onFulfilled\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1255
+ count: 1
1256
+ path: src/RetryMiddleware.php
1257
+
1258
+ -
1259
+ message: "#^Method GuzzleHttp\\\\RetryMiddleware\\:\\:onRejected\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1260
+ count: 1
1261
+ path: src/RetryMiddleware.php
1262
+
1263
+ -
1264
+ message: "#^Method GuzzleHttp\\\\RetryMiddleware\\:\\:doRetry\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
1265
+ count: 1
1266
+ path: src/RetryMiddleware.php
1267
+
1268
+ -
1269
+ message: "#^Method GuzzleHttp\\\\RetryMiddleware\\:\\:doRetry\\(\\) should return GuzzleHttp\\\\RetryMiddleware but returns GuzzleHttp\\\\Promise\\\\PromiseInterface\\.$#"
1270
+ count: 1
1271
+ path: src/RetryMiddleware.php
1272
+
1273
+ -
1274
+ message: "#^Property GuzzleHttp\\\\TransferStats\\:\\:\\$request has no typehint specified\\.$#"
1275
+ count: 1
1276
+ path: src/TransferStats.php
1277
+
1278
+ -
1279
+ message: "#^Property GuzzleHttp\\\\TransferStats\\:\\:\\$response has no typehint specified\\.$#"
1280
+ count: 1
1281
+ path: src/TransferStats.php
1282
+
1283
+ -
1284
+ message: "#^Property GuzzleHttp\\\\TransferStats\\:\\:\\$transferTime has no typehint specified\\.$#"
1285
+ count: 1
1286
+ path: src/TransferStats.php
1287
+
1288
+ -
1289
+ message: "#^Property GuzzleHttp\\\\TransferStats\\:\\:\\$handlerStats has no typehint specified\\.$#"
1290
+ count: 1
1291
+ path: src/TransferStats.php
1292
+
1293
+ -
1294
+ message: "#^Property GuzzleHttp\\\\TransferStats\\:\\:\\$handlerErrorData has no typehint specified\\.$#"
1295
+ count: 1
1296
+ path: src/TransferStats.php
1297
+
1298
+ -
1299
+ message: "#^Method GuzzleHttp\\\\TransferStats\\:\\:__construct\\(\\) has parameter \\$handlerStats with no value type specified in iterable type array\\.$#"
1300
+ count: 1
1301
+ path: src/TransferStats.php
1302
+
1303
+ -
1304
+ message: "#^Method GuzzleHttp\\\\TransferStats\\:\\:getHandlerStats\\(\\) return type has no value type specified in iterable type array\\.$#"
1305
+ count: 1
1306
+ path: src/TransferStats.php
1307
+
1308
+ -
1309
+ message: "#^Property GuzzleHttp\\\\UriTemplate\\:\\:\\$variables type has no value type specified in iterable type array\\.$#"
1310
+ count: 1
1311
+ path: src/UriTemplate.php
1312
+
1313
+ -
1314
+ message: "#^Property GuzzleHttp\\\\UriTemplate\\:\\:\\$operatorHash type has no value type specified in iterable type array\\.$#"
1315
+ count: 1
1316
+ path: src/UriTemplate.php
1317
+
1318
+ -
1319
+ message: "#^Property GuzzleHttp\\\\UriTemplate\\:\\:\\$delims type has no value type specified in iterable type array\\.$#"
1320
+ count: 1
1321
+ path: src/UriTemplate.php
1322
+
1323
+ -
1324
+ message: "#^Property GuzzleHttp\\\\UriTemplate\\:\\:\\$delimsPct type has no value type specified in iterable type array\\.$#"
1325
+ count: 1
1326
+ path: src/UriTemplate.php
1327
+
1328
+ -
1329
+ message: "#^Method GuzzleHttp\\\\UriTemplate\\:\\:expand\\(\\) has no return typehint specified\\.$#"
1330
+ count: 1
1331
+ path: src/UriTemplate.php
1332
+
1333
+ -
1334
+ message: "#^Method GuzzleHttp\\\\UriTemplate\\:\\:expand\\(\\) has parameter \\$template with no typehint specified\\.$#"
1335
+ count: 1
1336
+ path: src/UriTemplate.php
1337
+
1338
+ -
1339
+ message: "#^Method GuzzleHttp\\\\UriTemplate\\:\\:expand\\(\\) has parameter \\$variables with no value type specified in iterable type array\\.$#"
1340
+ count: 1
1341
+ path: src/UriTemplate.php
1342
+
1343
+ -
1344
+ message: "#^Method GuzzleHttp\\\\UriTemplate\\:\\:parseExpression\\(\\) return type has no value type specified in iterable type array\\.$#"
1345
+ count: 1
1346
+ path: src/UriTemplate.php
1347
+
1348
+ -
1349
+ message: "#^Method GuzzleHttp\\\\UriTemplate\\:\\:expandMatch\\(\\) has parameter \\$matches with no value type specified in iterable type array\\.$#"
1350
+ count: 1
1351
+ path: src/UriTemplate.php
1352
+
1353
+ -
1354
+ message: "#^Method GuzzleHttp\\\\UriTemplate\\:\\:isAssoc\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#"
1355
+ count: 1
1356
+ path: src/UriTemplate.php
1357
+
1358
+ -
1359
+ message: "#^Function GuzzleHttp\\\\uri_template\\(\\) has parameter \\$variables with no value type specified in iterable type array\\.$#"
1360
+ count: 1
1361
+ path: src/functions.php
1362
+
1363
+ -
1364
+ message: "#^Function uri_template not found\\.$#"
1365
+ count: 1
1366
+ path: src/functions.php
1367
+
1368
+ -
1369
+ message: "#^Parameter \\#1 \\$str of function rtrim expects string, string\\|false given\\.$#"
1370
+ count: 1
1371
+ path: src/functions.php
1372
+
1373
+ -
1374
+ message: "#^Function GuzzleHttp\\\\headers_from_lines\\(\\) has parameter \\$lines with no value type specified in iterable type iterable\\.$#"
1375
+ count: 1
1376
+ path: src/functions.php
1377
+
1378
+ -
1379
+ message: "#^Function GuzzleHttp\\\\headers_from_lines\\(\\) return type has no value type specified in iterable type array\\.$#"
1380
+ count: 1
1381
+ path: src/functions.php
1382
+
1383
+ -
1384
+ message: "#^Function GuzzleHttp\\\\debug_resource\\(\\) should return resource but returns resource\\|false\\.$#"
1385
+ count: 1
1386
+ path: src/functions.php
1387
+
1388
+ -
1389
+ message: "#^Function GuzzleHttp\\\\normalize_header_keys\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
1390
+ count: 1
1391
+ path: src/functions.php
1392
+
1393
+ -
1394
+ message: "#^Function GuzzleHttp\\\\normalize_header_keys\\(\\) return type has no value type specified in iterable type array\\.$#"
1395
+ count: 1
1396
+ path: src/functions.php
1397
+
1398
+ -
1399
+ message: "#^Function GuzzleHttp\\\\is_host_in_noproxy\\(\\) has parameter \\$noProxyArray with no value type specified in iterable type array\\.$#"
1400
+ count: 1
1401
+ path: src/functions.php
1402
+
1403
+ -
1404
+ message: "#^Cannot access offset 0 on array\\<int, string\\>\\|false\\.$#"
1405
+ count: 1
1406
+ path: src/functions.php
1407
+
1408
+ -
1409
+ message: "#^Function GuzzleHttp\\\\json_encode\\(\\) should return string but returns string\\|false\\.$#"
1410
+ count: 1
1411
+ path: src/functions.php
1412
+
vendor/guzzlehttp/guzzle/phpstan.neon.dist ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ includes:
2
+ - phpstan-baseline.neon
3
+
4
+ parameters:
5
+ level: max
6
+ paths:
7
+ - src
8
+ bootstrap: tests/bootstrap-phpstan.php
vendor/guzzlehttp/guzzle/phpunit.xml.dist CHANGED
@@ -1,9 +1,13 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <phpunit bootstrap="./tests/bootstrap.php"
3
- backupGlobals="true"
4
- colors="true">
 
 
 
 
5
  <testsuites>
6
- <testsuite>
7
  <directory>tests</directory>
8
  </testsuite>
9
  </testsuites>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4
+ bootstrap="./tests/bootstrap.php"
5
+ backupGlobals="true"
6
+ colors="true"
7
+ executionOrder="random"
8
+ >
9
  <testsuites>
10
+ <testsuite name="Test Suite">
11
  <directory>tests</directory>
12
  </testsuite>
13
  </testsuites>
vendor/guzzlehttp/guzzle/src/Client.php CHANGED
@@ -2,11 +2,12 @@
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 = [])
@@ -75,6 +76,12 @@ class Client implements ClientInterface
75
  $this->configureDefaults($config);
76
  }
77
 
 
 
 
 
 
 
78
  public function __call($method, $args)
79
  {
80
  if (count($args) < 1) {
@@ -89,6 +96,14 @@ class Client implements ClientInterface
89
  : $this->request($method, $uri, $opts);
90
  }
91
 
 
 
 
 
 
 
 
 
92
  public function sendAsync(RequestInterface $request, array $options = [])
93
  {
94
  // Merge the base URI into the request URI if needed.
@@ -100,12 +115,35 @@ class Client implements ClientInterface
100
  );
101
  }
102
 
 
 
 
 
 
 
 
 
 
103
  public function send(RequestInterface $request, array $options = [])
104
  {
105
  $options[RequestOptions::SYNCHRONOUS] = true;
106
  return $this->sendAsync($request, $options)->wait();
107
  }
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  public function requestAsync($method, $uri = '', array $options = [])
110
  {
111
  $options = $this->prepareDefaults($options);
@@ -125,12 +163,37 @@ class Client implements ClientInterface
125
  return $this->transfer($request, $options);
126
  }
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  public function request($method, $uri = '', array $options = [])
129
  {
130
  $options[RequestOptions::SYNCHRONOUS] = true;
131
  return $this->requestAsync($method, $uri, $options)->wait();
132
  }
133
 
 
 
 
 
 
 
 
 
 
 
 
134
  public function getConfig($option = null)
135
  {
136
  return $option === null
@@ -138,6 +201,11 @@ class Client implements ClientInterface
138
  : (isset($this->config[$option]) ? $this->config[$option] : null);
139
  }
140
 
 
 
 
 
 
141
  private function buildUri($uri, array $config)
142
  {
143
  // for BC we accept null which would otherwise fail in uri_for
@@ -147,6 +215,38 @@ class Client implements ClientInterface
147
  $uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
148
  }
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
151
  }
152
 
@@ -154,6 +254,7 @@ class Client implements ClientInterface
154
  * Configures the default options for a client.
155
  *
156
  * @param array $config
 
157
  */
158
  private function configureDefaults(array $config)
159
  {
@@ -165,12 +266,15 @@ class Client implements ClientInterface
165
  'cookies' => false
166
  ];
167
 
 
 
 
168
  // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
169
 
170
  // We can only trust the HTTP_PROXY environment variable in a CLI
171
  // process due to the fact that PHP has no reliable mechanism to
172
  // get environment variables that start with "HTTP_".
173
- if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) {
174
  $defaults['proxy']['http'] = getenv('HTTP_PROXY');
175
  }
176
 
@@ -210,7 +314,7 @@ class Client implements ClientInterface
210
  *
211
  * @return array
212
  */
213
- private function prepareDefaults($options)
214
  {
215
  $defaults = $this->config;
216
 
@@ -225,7 +329,7 @@ class Client implements ClientInterface
225
  if (array_key_exists('headers', $options)) {
226
  // Allows default headers to be unset.
227
  if ($options['headers'] === null) {
228
- $defaults['_conditional'] = null;
229
  unset($options['headers']);
230
  } elseif (!is_array($options['headers'])) {
231
  throw new \InvalidArgumentException('headers must be an array');
@@ -251,8 +355,7 @@ class Client implements ClientInterface
251
  * The URI of the request is not modified and the request options are used
252
  * as-is without merging in default options.
253
  *
254
- * @param RequestInterface $request
255
- * @param array $options
256
  *
257
  * @return Promise\PromiseInterface
258
  */
@@ -271,6 +374,7 @@ class Client implements ClientInterface
271
  }
272
 
273
  $request = $this->applyOptions($request, $options);
 
274
  $handler = $options['handler'];
275
 
276
  try {
@@ -411,6 +515,11 @@ class Client implements ClientInterface
411
  return $request;
412
  }
413
 
 
 
 
 
 
414
  private function invalidBody()
415
  {
416
  throw new \InvalidArgumentException('Passing in the "body" request '
2
  namespace GuzzleHttp;
3
 
4
  use GuzzleHttp\Cookie\CookieJar;
5
+ use GuzzleHttp\Exception\InvalidArgumentException;
6
  use GuzzleHttp\Promise;
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
  * @method ResponseInterface get(string|UriInterface $uri, array $options = [])
76
  $this->configureDefaults($config);
77
  }
78
 
79
+ /**
80
+ * @param string $method
81
+ * @param array $args
82
+ *
83
+ * @return Promise\PromiseInterface
84
+ */
85
  public function __call($method, $args)
86
  {
87
  if (count($args) < 1) {
96
  : $this->request($method, $uri, $opts);
97
  }
98
 
99
+ /**
100
+ * Asynchronously send an HTTP request.
101
+ *
102
+ * @param array $options Request options to apply to the given
103
+ * request and to the transfer. See \GuzzleHttp\RequestOptions.
104
+ *
105
+ * @return PromiseInterface
106
+ */
107
  public function sendAsync(RequestInterface $request, array $options = [])
108
  {
109
  // Merge the base URI into the request URI if needed.
115
  );
116
  }
117
 
118
+ /**
119
+ * Send an HTTP request.
120
+ *
121
+ * @param array $options Request options to apply to the given
122
+ * request and to the transfer. See \GuzzleHttp\RequestOptions.
123
+ *
124
+ * @return ResponseInterface
125
+ * @throws GuzzleException
126
+ */
127
  public function send(RequestInterface $request, array $options = [])
128
  {
129
  $options[RequestOptions::SYNCHRONOUS] = true;
130
  return $this->sendAsync($request, $options)->wait();
131
  }
132
 
133
+ /**
134
+ * Create and send an asynchronous HTTP request.
135
+ *
136
+ * Use an absolute path to override the base path of the client, or a
137
+ * relative path to append to the base path of the client. The URL can
138
+ * contain the query string as well. Use an array to provide a URL
139
+ * template and additional variables to use in the URL template expansion.
140
+ *
141
+ * @param string $method HTTP method
142
+ * @param string|UriInterface $uri URI object or string.
143
+ * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
144
+ *
145
+ * @return PromiseInterface
146
+ */
147
  public function requestAsync($method, $uri = '', array $options = [])
148
  {
149
  $options = $this->prepareDefaults($options);
163
  return $this->transfer($request, $options);
164
  }
165
 
166
+ /**
167
+ * Create and send an HTTP request.
168
+ *
169
+ * Use an absolute path to override the base path of the client, or a
170
+ * relative path to append to the base path of the client. The URL can
171
+ * contain the query string as well.
172
+ *
173
+ * @param string $method HTTP method.
174
+ * @param string|UriInterface $uri URI object or string.
175
+ * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
176
+ *
177
+ * @return ResponseInterface
178
+ * @throws GuzzleException
179
+ */
180
  public function request($method, $uri = '', array $options = [])
181
  {
182
  $options[RequestOptions::SYNCHRONOUS] = true;
183
  return $this->requestAsync($method, $uri, $options)->wait();
184
  }
185
 
186
+ /**
187
+ * Get a client configuration option.
188
+ *
189
+ * These options include default request options of the client, a "handler"
190
+ * (if utilized by the concrete client), and a "base_uri" if utilized by
191
+ * the concrete client.
192
+ *
193
+ * @param string|null $option The config option to retrieve.
194
+ *
195
+ * @return mixed
196
+ */
197
  public function getConfig($option = null)
198
  {
199
  return $option === null
201
  : (isset($this->config[$option]) ? $this->config[$option] : null);
202
  }
203
 
204
+ /**
205
+ * @param string|null $uri
206
+ *
207
+ * @return UriInterface
208
+ */
209
  private function buildUri($uri, array $config)
210
  {
211
  // for BC we accept null which would otherwise fail in uri_for
215
  $uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
216
  }
217
 
218
+ if ($uri->getHost() && isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) {
219
+ $idnOptions = ($config['idn_conversion'] === true) ? IDNA_DEFAULT : $config['idn_conversion'];
220
+
221
+ $asciiHost = idn_to_ascii($uri->getHost(), $idnOptions, INTL_IDNA_VARIANT_UTS46, $info);
222
+ if ($asciiHost === false) {
223
+ $errorBitSet = isset($info['errors']) ? $info['errors'] : 0;
224
+
225
+ $errorConstants = array_filter(array_keys(get_defined_constants()), function ($name) {
226
+ return substr($name, 0, 11) === 'IDNA_ERROR_';
227
+ });
228
+
229
+ $errors = [];
230
+ foreach ($errorConstants as $errorConstant) {
231
+ if ($errorBitSet & constant($errorConstant)) {
232
+ $errors[] = $errorConstant;
233
+ }
234
+ }
235
+
236
+ $errorMessage = 'IDN conversion failed';
237
+ if ($errors) {
238
+ $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')';
239
+ }
240
+
241
+ throw new InvalidArgumentException($errorMessage);
242
+ } else {
243
+ if ($uri->getHost() !== $asciiHost) {
244
+ // Replace URI only if the ASCII version is different
245
+ $uri = $uri->withHost($asciiHost);
246
+ }
247
+ }
248
+ }
249
+
250
  return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
251
  }
252
 
254
  * Configures the default options for a client.
255
  *
256
  * @param array $config
257
+ * @return void
258
  */
259
  private function configureDefaults(array $config)
260
  {
266
  'cookies' => false
267
  ];
268
 
269
+ // idn_to_ascii() is a part of ext-intl and might be not available
270
+ $defaults['idn_conversion'] = function_exists('idn_to_ascii');
271
+
272
  // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
273
 
274
  // We can only trust the HTTP_PROXY environment variable in a CLI
275
  // process due to the fact that PHP has no reliable mechanism to
276
  // get environment variables that start with "HTTP_".
277
+ if (php_sapi_name() === 'cli' && getenv('HTTP_PROXY')) {
278
  $defaults['proxy']['http'] = getenv('HTTP_PROXY');
279
  }
280
 
314
  *
315
  * @return array
316
  */
317
+ private function prepareDefaults(array $options)
318
  {
319
  $defaults = $this->config;
320
 
329
  if (array_key_exists('headers', $options)) {
330
  // Allows default headers to be unset.
331
  if ($options['headers'] === null) {
332
+ $defaults['_conditional'] = [];
333
  unset($options['headers']);
334
  } elseif (!is_array($options['headers'])) {
335
  throw new \InvalidArgumentException('headers must be an array');
355
  * The URI of the request is not modified and the request options are used
356
  * as-is without merging in default options.
357
  *
358
+ * @param array $options See \GuzzleHttp\RequestOptions.
 
359
  *
360
  * @return Promise\PromiseInterface
361
  */
374
  }
375
 
376
  $request = $this->applyOptions($request, $options);
377
+ /** @var HandlerStack $handler */
378
  $handler = $options['handler'];
379
 
380
  try {
515
  return $request;
516
  }
517
 
518
+ /**
519
+ * Throw Exception with pre-set message.
520
+ * @return void
521
+ * @throws InvalidArgumentException Invalid body.
522
+ */
523
  private function invalidBody()
524
  {
525
  throw new \InvalidArgumentException('Passing in the "body" request '
vendor/guzzlehttp/guzzle/src/ClientInterface.php CHANGED
@@ -1,8 +1,8 @@
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;
@@ -12,7 +12,10 @@ use Psr\Http\Message\UriInterface;
12
  */
13
  interface ClientInterface
14
  {
15
- const VERSION = '6.3.3';
 
 
 
16
 
17
  /**
18
  * Send an HTTP request.
1
  <?php
2
  namespace GuzzleHttp;
3
 
 
4
  use GuzzleHttp\Exception\GuzzleException;
5
+ use GuzzleHttp\Promise\PromiseInterface;
6
  use Psr\Http\Message\RequestInterface;
7
  use Psr\Http\Message\ResponseInterface;
8
  use Psr\Http\Message\UriInterface;
12
  */
13
  interface ClientInterface
14
  {
15
+ /**
16
+ * @deprecated Will be removed in Guzzle 7.0.0
17
+ */
18
+ const VERSION = '6.5.0';
19
 
20
  /**
21
  * Send an HTTP request.
vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php CHANGED
@@ -94,8 +94,8 @@ class CookieJar implements CookieJarInterface
94
  */
95
  public function getCookieByName($name)
96
  {
97
- // don't allow a null name
98
- if ($name === null) {
99
  return null;
100
  }
101
  foreach ($this->cookies as $cookie) {
@@ -103,6 +103,8 @@ class CookieJar implements CookieJarInterface
103
  return $cookie;
104
  }
105
  }
 
 
106
  }
107
 
108
  public function toArray()
@@ -120,7 +122,7 @@ class CookieJar implements CookieJarInterface
120
  } elseif (!$path) {
121
  $this->cookies = array_filter(
122
  $this->cookies,
123
- function (SetCookie $cookie) use ($path, $domain) {
124
  return !$cookie->matchesDomain($domain);
125
  }
126
  );
94
  */
95
  public function getCookieByName($name)
96
  {
97
+ // don't allow a non string name
98
+ if ($name === null || !is_scalar($name)) {
99
  return null;
100
  }
101
  foreach ($this->cookies as $cookie) {
103
  return $cookie;
104
  }
105
  }
106
+
107
+ return null;
108
  }
109
 
110
  public function toArray()
122
  } elseif (!$path) {
123
  $this->cookies = array_filter(
124
  $this->cookies,
125
+ function (SetCookie $cookie) use ($domain) {
126
  return !$cookie->matchesDomain($domain);
127
  }
128
  );
vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php CHANGED
@@ -58,9 +58,9 @@ interface CookieJarInterface extends \Countable, \IteratorAggregate
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
  */
58
  * arguments, then the cookie with the specified name, path and domain is
59
  * removed.
60
  *
61
+ * @param string|null $domain Clears cookies matching a domain
62
+ * @param string|null $path Clears cookies matching a domain and path
63
+ * @param string|null $name Clears cookies matching a domain, path, and name
64
  *
65
  * @return CookieJarInterface
66
  */
vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php CHANGED
@@ -23,6 +23,7 @@ class FileCookieJar extends CookieJar
23
  */
24
  public function __construct($cookieFile, $storeSessionCookies = false)
25
  {
 
26
  $this->filename = $cookieFile;
27
  $this->storeSessionCookies = $storeSessionCookies;
28
 
@@ -56,7 +57,7 @@ class FileCookieJar extends CookieJar
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
  }
23
  */
24
  public function __construct($cookieFile, $storeSessionCookies = false)
25
  {
26
+ parent::__construct();
27
  $this->filename = $cookieFile;
28
  $this->storeSessionCookies = $storeSessionCookies;
29
 
57
  }
58
 
59
  $jsonStr = \GuzzleHttp\json_encode($json);
60
+ if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) {
61
  throw new \RuntimeException("Unable to save file {$filename}");
62
  }
63
  }
vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php CHANGED
@@ -22,6 +22,7 @@ class SessionCookieJar extends CookieJar
22
  */
23
  public function __construct($sessionKey, $storeSessionCookies = false)
24
  {
 
25
  $this->sessionKey = $sessionKey;
26
  $this->storeSessionCookies = $storeSessionCookies;
27
  $this->load();
22
  */
23
  public function __construct($sessionKey, $storeSessionCookies = false)
24
  {
25
+ parent::__construct();
26
  $this->sessionKey = $sessionKey;
27
  $this->storeSessionCookies = $storeSessionCookies;
28
  $this->load();
vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php CHANGED
@@ -227,7 +227,7 @@ class SetCookie
227
  /**
228
  * Get whether or not this is a secure cookie
229
  *
230
- * @return null|bool
231
  */
232
  public function getSecure()
233
  {
@@ -247,7 +247,7 @@ class SetCookie
247
  /**
248
  * Get whether or not this is a session cookie
249
  *
250
- * @return null|bool
251
  */
252
  public function getDiscard()
253
  {
227
  /**
228
  * Get whether or not this is a secure cookie
229
  *
230
+ * @return bool|null
231
  */
232
  public function getSecure()
233
  {
247
  /**
248
  * Get whether or not this is a session cookie
249
  *
250
+ * @return bool|null
251
  */
252
  public function getDiscard()
253
  {
vendor/guzzlehttp/guzzle/src/Exception/ClientException.php CHANGED
@@ -4,4 +4,6 @@ namespace GuzzleHttp\Exception;
4
  /**
5
  * Exception when a client error is encountered (4xx codes)
6
  */
7
- class ClientException extends BadResponseException {}
 
 
4
  /**
5
  * Exception when a client error is encountered (4xx codes)
6
  */
7
+ class ClientException extends BadResponseException
8
+ {
9
+ }
vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php CHANGED
@@ -1,13 +1,23 @@
1
  <?php
2
  namespace GuzzleHttp\Exception;
3
 
4
- /**
5
- * @method string getMessage()
6
- * @method \Throwable|null getPrevious()
7
- * @method mixed getCode()
8
- * @method string getFile()
9
- * @method int getLine()
10
- * @method array getTrace()
11
- * @method string getTraceAsString()
12
- */
13
- interface GuzzleException {}
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  namespace GuzzleHttp\Exception;
3
 
4
+ use Throwable;
5
+
6
+ if (interface_exists(Throwable::class)) {
7
+ interface GuzzleException extends Throwable
8
+ {
9
+ }
10
+ } else {
11
+ /**
12
+ * @method string getMessage()
13
+ * @method \Throwable|null getPrevious()
14
+ * @method mixed getCode()
15
+ * @method string getFile()
16
+ * @method int getLine()
17
+ * @method array getTrace()
18
+ * @method string getTraceAsString()
19
+ */
20
+ interface GuzzleException
21
+ {
22
+ }
23
+ }
vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace GuzzleHttp\Exception;
4
+
5
+ final class InvalidArgumentException extends \InvalidArgumentException implements GuzzleException
6
+ {
7
+ }
vendor/guzzlehttp/guzzle/src/Exception/RequestException.php CHANGED
@@ -1,9 +1,9 @@
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
  /**
@@ -14,7 +14,7 @@ class RequestException extends TransferException
14
  /** @var RequestInterface */
15
  private $request;
16
 
17
- /** @var ResponseInterface */
18
  private $response;
19
 
20
  /** @var array */
@@ -124,42 +124,17 @@ class RequestException extends TransferException
124
  */
125
  public static function getResponseBodySummary(ResponseInterface $response)
126
  {
127
- $body = $response->getBody();
128
-
129
- if (!$body->isSeekable()) {
130
- return null;
131
- }
132
-
133
- $size = $body->getSize();
134
-
135
- if ($size === 0) {
136
- return null;
137
- }
138
-
139
- $summary = $body->read(120);
140
- $body->rewind();
141
-
142
- if ($size > 120) {
143
- $summary .= ' (truncated...)';
144
- }
145
-
146
- // Matches any printable character, including unicode characters:
147
- // letters, marks, numbers, punctuation, spacing, and separators.
148
- if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
149
- return null;
150
- }
151
-
152
- return $summary;
153
  }
154
 
155
  /**
156
- * Obfuscates URI if there is an username and a password present
157
  *
158
  * @param UriInterface $uri
159
  *
160
  * @return UriInterface
161
  */
162
- private static function obfuscateUri($uri)
163
  {
164
  $userInfo = $uri->getUserInfo();
165
 
1
  <?php
2
  namespace GuzzleHttp\Exception;
3
 
4
+ use GuzzleHttp\Promise\PromiseInterface;
5
  use Psr\Http\Message\RequestInterface;
6
  use Psr\Http\Message\ResponseInterface;
 
7
  use Psr\Http\Message\UriInterface;
8
 
9
  /**
14
  /** @var RequestInterface */
15
  private $request;
16
 
17
+ /** @var ResponseInterface|null */
18
  private $response;
19
 
20
  /** @var array */
124
  */
125
  public static function getResponseBodySummary(ResponseInterface $response)
126
  {
127
+ return \GuzzleHttp\Psr7\get_message_body_summary($response);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
129
 
130
  /**
131
+ * Obfuscates URI if there is a username and a password present
132
  *
133
  * @param UriInterface $uri
134
  *
135
  * @return UriInterface
136
  */
137
+ private static function obfuscateUri(UriInterface $uri)
138
  {
139
  $userInfo = $uri->getUserInfo();
140
 
vendor/guzzlehttp/guzzle/src/Exception/ServerException.php CHANGED
@@ -4,4 +4,6 @@ namespace GuzzleHttp\Exception;
4
  /**
5
  * Exception when a server error is encountered (5xx codes)
6
  */
7
- class ServerException extends BadResponseException {}
 
 
4
  /**
5
  * Exception when a server error is encountered (5xx codes)
6
  */
7
+ class ServerException extends BadResponseException
8
+ {
9
+ }
vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
2
  namespace GuzzleHttp\Exception;
3
 
4
- class TooManyRedirectsException extends RequestException {}
 
 
1
  <?php
2
  namespace GuzzleHttp\Exception;
3
 
4
+ class TooManyRedirectsException extends RequestException
5
+ {
6
+ }
vendor/guzzlehttp/guzzle/src/Exception/TransferException.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
2
  namespace GuzzleHttp\Exception;
3
 
4
- class TransferException extends \RuntimeException implements GuzzleException {}
 
 
1
  <?php
2
  namespace GuzzleHttp\Exception;
3
 
4
+ class TransferException extends \RuntimeException implements GuzzleException
5
+ {
6
+ }
vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php CHANGED
@@ -1,8 +1,8 @@
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\Psr7;
8
  use GuzzleHttp\Psr7\LazyOpenStream;
@@ -14,6 +14,9 @@ use Psr\Http\Message\RequestInterface;
14
  */
15
  class CurlFactory implements CurlFactoryInterface
16
  {
 
 
 
17
  /** @var array */
18
  private $handles = [];
19
 
@@ -117,6 +120,7 @@ class CurlFactory implements CurlFactoryInterface
117
  private static function invokeStats(EasyHandle $easy)
118
  {
119
  $curlStats = curl_getinfo($easy->handle);
 
120
  $stats = new TransferStats(
121
  $easy->request,
122
  $easy->response,
@@ -136,7 +140,9 @@ class CurlFactory implements CurlFactoryInterface
136
  $ctx = [
137
  'errno' => $easy->errno,
138
  'error' => curl_error($easy->handle),
 
139
  ] + curl_getinfo($easy->handle);
 
140
  $factory->release($easy);
141
 
142
  // Retry when nothing is present or when curl failed to rewind.
@@ -172,13 +178,22 @@ class CurlFactory implements CurlFactoryInterface
172
  )
173
  );
174
  }
175
-
176
- $message = sprintf(
177
- 'cURL error %s: %s (%s)',
178
- $ctx['errno'],
179
- $ctx['error'],
180
- 'see http://curl.haxx.se/libcurl/c/libcurl-errors.html'
181
- );
 
 
 
 
 
 
 
 
 
182
 
183
  // Create a connection exception if it was a specific error code.
184
  $error = isset($connectionErrors[$easy->errno])
@@ -439,11 +454,16 @@ class CurlFactory implements CurlFactoryInterface
439
  }
440
 
441
  if (isset($options['ssl_key'])) {
442
- $sslKey = $options['ssl_key'];
443
- if (is_array($sslKey)) {
444
- $conf[CURLOPT_SSLKEYPASSWD] = $sslKey[1];
445
- $sslKey = $sslKey[0];
 
 
446
  }
 
 
 
447
  if (!file_exists($sslKey)) {
448
  throw new \InvalidArgumentException(
449
  "SSL private key not found: {$sslKey}"
1
  <?php
2
  namespace GuzzleHttp\Handler;
3
 
 
4
  use GuzzleHttp\Exception\ConnectException;
5
+ use GuzzleHttp\Exception\RequestException;
6
  use GuzzleHttp\Promise\FulfilledPromise;
7
  use GuzzleHttp\Psr7;
8
  use GuzzleHttp\Psr7\LazyOpenStream;
14
  */
15
  class CurlFactory implements CurlFactoryInterface
16
  {
17
+ const CURL_VERSION_STR = 'curl_version';
18
+ const LOW_CURL_VERSION_NUMBER = '7.21.2';
19
+
20
  /** @var array */
21
  private $handles = [];
22
 
120
  private static function invokeStats(EasyHandle $easy)
121
  {
122
  $curlStats = curl_getinfo($easy->handle);
123
+ $curlStats['appconnect_time'] = curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME);
124
  $stats = new TransferStats(
125
  $easy->request,
126
  $easy->response,
140
  $ctx = [
141
  'errno' => $easy->errno,
142
  'error' => curl_error($easy->handle),
143
+ 'appconnect_time' => curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME),
144
  ] + curl_getinfo($easy->handle);
145
+ $ctx[self::CURL_VERSION_STR] = curl_version()['version'];
146
  $factory->release($easy);
147
 
148
  // Retry when nothing is present or when curl failed to rewind.
178
  )
179
  );
180
  }
181
+ if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) {
182
+ $message = sprintf(
183
+ 'cURL error %s: %s (%s)',
184
+ $ctx['errno'],
185
+ $ctx['error'],
186
+ 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'
187
+ );
188
+ } else {
189
+ $message = sprintf(
190
+ 'cURL error %s: %s (%s) for %s',
191
+ $ctx['errno'],
192
+ $ctx['error'],
193
+ 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html',
194
+ $easy->request->getUri()
195
+ );
196
+ }
197
 
198
  // Create a connection exception if it was a specific error code.
199
  $error = isset($connectionErrors[$easy->errno])
454
  }
455
 
456
  if (isset($options['ssl_key'])) {
457
+ if (is_array($options['ssl_key'])) {
458
+ if (count($options['ssl_key']) === 2) {
459
+ list($sslKey, $conf[CURLOPT_SSLKEYPASSWD]) = $options['ssl_key'];
460
+ } else {
461
+ list($sslKey) = $options['ssl_key'];
462
+ }
463
  }
464
+
465
+ $sslKey = isset($sslKey) ? $sslKey: $options['ssl_key'];
466
+
467
  if (!file_exists($sslKey)) {
468
  throw new \InvalidArgumentException(
469
  "SSL private key not found: {$sslKey}"
vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php CHANGED
@@ -1,9 +1,9 @@
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
  /**
@@ -23,6 +23,7 @@ class CurlMultiHandler
23
  private $active;
24
  private $handles = [];
25
  private $delays = [];
 
26
 
27
  /**
28
  * This handler accepts the following options:
@@ -30,6 +31,8 @@ class CurlMultiHandler
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
  */
@@ -37,14 +40,31 @@ class CurlMultiHandler
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();
@@ -82,7 +102,7 @@ class CurlMultiHandler
82
  {
83
  // Add any delayed handles if needed.
84
  if ($this->delays) {
85
- $currentTime = microtime(true);
86
  foreach ($this->delays as $id => $delay) {
87
  if ($currentTime >= $delay) {
88
  unset($this->delays[$id]);
@@ -134,7 +154,7 @@ class CurlMultiHandler
134
  if (empty($easy->options['delay'])) {
135
  curl_multi_add_handle($this->_mh, $easy->handle);
136
  } else {
137
- $this->delays[$id] = microtime(true) + ($easy->options['delay'] / 1000);
138
  }
139
  }
140
 
@@ -186,7 +206,7 @@ class CurlMultiHandler
186
 
187
  private function timeToNext()
188
  {
189
- $currentTime = microtime(true);
190
  $nextTime = PHP_INT_MAX;
191
  foreach ($this->delays as $time) {
192
  if ($time < $nextTime) {
1
  <?php
2
  namespace GuzzleHttp\Handler;
3
 
4
+ use GuzzleHttp\Exception\InvalidArgumentException;
5
  use GuzzleHttp\Promise as P;
6
  use GuzzleHttp\Promise\Promise;
 
7
  use Psr\Http\Message\RequestInterface;
8
 
9
  /**
23
  private $active;
24
  private $handles = [];
25
  private $delays = [];
26
+ private $options = [];
27
 
28
  /**
29
  * This handler accepts the following options:
31
  * - handle_factory: An optional factory used to create curl handles
32
  * - select_timeout: Optional timeout (in seconds) to block before timing
33
  * out while selecting curl handles. Defaults to 1 second.
34
+ * - options: An associative array of CURLMOPT_* options and
35
+ * corresponding values for curl_multi_setopt()
36
  *
37
  * @param array $options
38
  */
40
  {
41
  $this->factory = isset($options['handle_factory'])
42
  ? $options['handle_factory'] : new CurlFactory(50);
43
+
44
+ if (isset($options['select_timeout'])) {
45
+ $this->selectTimeout = $options['select_timeout'];
46
+ } elseif ($selectTimeout = getenv('GUZZLE_CURL_SELECT_TIMEOUT')) {
47
+ $this->selectTimeout = $selectTimeout;
48
+ } else {
49
+ $this->selectTimeout = 1;
50
+ }
51
+
52
+ $this->options = isset($options['options']) ? $options['options'] : [];
53
  }
54
 
55
  public function __get($name)
56
  {
57
  if ($name === '_mh') {
58
+ $this->_mh = curl_multi_init();
59
+
60
+ foreach ($this->options as $option => $value) {
61
+ // A warning is raised in case of a wrong option.
62
+ curl_multi_setopt($this->_mh, $option, $value);
63
+ }
64
+
65
+ // Further calls to _mh will return the value directly, without entering the
66
+ // __get() method at all.
67
+ return $this->_mh;
68
  }
69
 
70
  throw new \BadMethodCallException();
102
  {
103
  // Add any delayed handles if needed.
104
  if ($this->delays) {
105
+ $currentTime = \GuzzleHttp\_current_time();
106
  foreach ($this->delays as $id => $delay) {
107
  if ($currentTime >= $delay) {
108
  unset($this->delays[$id]);
154
  if (empty($easy->options['delay'])) {
155
  curl_multi_add_handle($this->_mh, $easy->handle);
156
  } else {
157
+ $this->delays[$id] = \GuzzleHttp\_current_time() + ($easy->options['delay'] / 1000);
158
  }
159
  }
160
 
206
 
207
  private function timeToNext()
208
  {
209
+ $currentTime = \GuzzleHttp\_current_time();
210
  $nextTime = PHP_INT_MAX;
211
  foreach ($this->delays as $time) {
212
  if ($time < $nextTime) {
vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php CHANGED
@@ -66,7 +66,7 @@ class MockHandler implements \Countable
66
  throw new \OutOfBoundsException('Mock queue is empty');
67
  }
68
 
69
- if (isset($options['delay'])) {
70
  usleep($options['delay'] * 1000);
71
  }
72
 
@@ -175,6 +175,11 @@ class MockHandler implements \Countable
175
  return count($this->queue);
176
  }
177
 
 
 
 
 
 
178
  private function invokeStats(
179
  RequestInterface $request,
180
  array $options,
@@ -182,7 +187,8 @@ class MockHandler implements \Countable
182
  $reason = null
183
  ) {
184
  if (isset($options['on_stats'])) {
185
- $stats = new TransferStats($request, $response, 0, $reason);
 
186
  call_user_func($options['on_stats'], $stats);
187
  }
188
  }
66
  throw new \OutOfBoundsException('Mock queue is empty');
67
  }
68
 
69
+ if (isset($options['delay']) && is_numeric($options['delay'])) {
70
  usleep($options['delay'] * 1000);
71
  }
72
 
175
  return count($this->queue);
176
  }
177
 
178
+ public function reset()
179
+ {
180
+ $this->queue = [];
181
+ }
182
+
183
  private function invokeStats(
184
  RequestInterface $request,
185
  array $options,
187
  $reason = null
188
  ) {
189
  if (isset($options['on_stats'])) {
190
+ $transferTime = isset($options['transfer_time']) ? $options['transfer_time'] : 0;
191
+ $stats = new TransferStats($request, $response, $transferTime, $reason);
192
  call_user_func($options['on_stats'], $stats);
193
  }
194
  }
vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php CHANGED
@@ -1,8 +1,8 @@
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\PromiseInterface;
8
  use GuzzleHttp\Psr7;
@@ -33,7 +33,7 @@ class StreamHandler
33
  usleep($options['delay'] * 1000);
34
  }
35
 
36
- $startTime = isset($options['on_stats']) ? microtime(true) : null;
37
 
38
  try {
39
  // Does not support the expect header.
@@ -42,7 +42,7 @@ class StreamHandler
42
  // Append a content-length header if body size is zero to match
43
  // cURL's behavior.
44
  if (0 === $request->getBody()->getSize()) {
45
- $request = $request->withHeader('Content-Length', 0);
46
  }
47
 
48
  return $this->createResponse(
@@ -82,7 +82,7 @@ class StreamHandler
82
  $stats = new TransferStats(
83
  $request,
84
  $response,
85
- microtime(true) - $startTime,
86
  $error,
87
  []
88
  );
@@ -343,13 +343,25 @@ class StreamHandler
343
  if ('v4' === $options['force_ip_resolve']) {
344
  $records = dns_get_record($uri->getHost(), DNS_A);
345
  if (!isset($records[0]['ip'])) {
346
- throw new ConnectException(sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request);
 
 
 
 
 
 
347
  }
348
  $uri = $uri->withHost($records[0]['ip']);
349
  } elseif ('v6' === $options['force_ip_resolve']) {
350
  $records = dns_get_record($uri->getHost(), DNS_AAAA);
351
  if (!isset($records[0]['ipv6'])) {
352
- throw new ConnectException(sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request);
 
 
 
 
 
 
353
  }
354
  $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']');
355
  }
1
  <?php
2
  namespace GuzzleHttp\Handler;
3
 
 
4
  use GuzzleHttp\Exception\ConnectException;
5
+ use GuzzleHttp\Exception\RequestException;
6
  use GuzzleHttp\Promise\FulfilledPromise;
7
  use GuzzleHttp\Promise\PromiseInterface;
8
  use GuzzleHttp\Psr7;
33
  usleep($options['delay'] * 1000);
34
  }
35
 
36
+ $startTime = isset($options['on_stats']) ? \GuzzleHttp\_current_time() : null;
37
 
38
  try {
39
  // Does not support the expect header.
42
  // Append a content-length header if body size is zero to match
43
  // cURL's behavior.
44
  if (0 === $request->getBody()->getSize()) {
45
+ $request = $request->withHeader('Content-Length', '0');
46
  }
47
 
48
  return $this->createResponse(
82
  $stats = new TransferStats(
83
  $request,
84
  $response,
85
+ \GuzzleHttp\_current_time() - $startTime,
86
  $error,
87
  []
88
  );
343
  if ('v4' === $options['force_ip_resolve']) {
344
  $records = dns_get_record($uri->getHost(), DNS_A);
345
  if (!isset($records[0]['ip'])) {
346
+ throw new ConnectException(
347
+ sprintf(
348
+ "Could not resolve IPv4 address for host '%s'",
349
+ $uri->getHost()
350
+ ),
351
+ $request
352
+ );
353
  }
354
  $uri = $uri->withHost($records[0]['ip']);
355
  } elseif ('v6' === $options['force_ip_resolve']) {
356
  $records = dns_get_record($uri->getHost(), DNS_AAAA);
357
  if (!isset($records[0]['ipv6'])) {
358
+ throw new ConnectException(
359
+ sprintf(
360
+ "Could not resolve IPv6 address for host '%s'",
361
+ $uri->getHost()
362
+ ),
363
+ $request
364
+ );
365
  }
366
  $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']');
367
  }
vendor/guzzlehttp/guzzle/src/HandlerStack.php CHANGED
@@ -1,7 +1,9 @@
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
@@ -9,7 +11,7 @@ use Psr\Http\Message\RequestInterface;
9
  */
10
  class HandlerStack
11
  {
12
- /** @var callable */
13
  private $handler;
14
 
15
  /** @var array */
@@ -59,6 +61,8 @@ class HandlerStack
59
  *
60
  * @param RequestInterface $request
61
  * @param array $options
 
 
62
  */
63
  public function __invoke(RequestInterface $request, array $options)
64
  {
@@ -206,7 +210,7 @@ class HandlerStack
206
  }
207
 
208
  /**
209
- * @param $name
210
  * @return int
211
  */
212
  private function findByName($name)
@@ -223,10 +227,10 @@ class HandlerStack
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
  {
1
  <?php
2
  namespace GuzzleHttp;
3
 
4
+ use GuzzleHttp\Promise\PromiseInterface;
5
  use Psr\Http\Message\RequestInterface;
6
+ use Psr\Http\Message\ResponseInterface;
7
 
8
  /**
9
  * Creates a composed Guzzle handler function by stacking middlewares on top of
11
  */
12
  class HandlerStack
13
  {
14
+ /** @var callable|null */
15
  private $handler;
16
 
17
  /** @var array */
61
  *
62
  * @param RequestInterface $request
63
  * @param array $options
64
+ *
65
+ * @return ResponseInterface|PromiseInterface
66
  */
67
  public function __invoke(RequestInterface $request, array $options)
68
  {
210
  }
211
 
212
  /**
213
+ * @param string $name
214
  * @return int
215
  */
216
  private function findByName($name)
227
  /**
228
  * Splices a function into the middleware list at a specific position.
229
  *
230
+ * @param string $findName
231
+ * @param string $withName
232
  * @param callable $middleware
233
+ * @param bool $before
234
  */
235
  private function splice($findName, $withName, callable $middleware, $before)
236
  {
vendor/guzzlehttp/guzzle/src/MessageFormatter.php CHANGED
@@ -168,6 +168,11 @@ class MessageFormatter
168
  );
169
  }
170
 
 
 
 
 
 
171
  private function headers(MessageInterface $message)
172
  {
173
  $result = '';
168
  );
169
  }
170
 
171
+ /**
172
+ * Get headers from message as string
173
+ *
174
+ * @return string
175
+ */
176
  private function headers(MessageInterface $message)
177
  {
178
  $result = '';
vendor/guzzlehttp/guzzle/src/Middleware.php CHANGED
@@ -7,7 +7,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.
@@ -39,7 +38,7 @@ final class Middleware
39
  $cookieJar->extractCookies($request, $response);
40
  return $response;
41
  }
42
- );
43
  };
44
  };
45
  }
@@ -58,7 +57,7 @@ final class Middleware
58
  return $handler($request, $options);
59
  }
60
  return $handler($request, $options)->then(
61
- function (ResponseInterface $response) use ($request, $handler) {
62
  $code = $response->getStatusCode();
63
  if ($code < 400) {
64
  return $response;
@@ -183,7 +182,7 @@ final class Middleware
183
  *
184
  * @return callable Returns a function that accepts the next handler.
185
  */
186
- public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = LogLevel::INFO)
187
  {
188
  return function (callable $handler) use ($logger, $formatter, $logLevel) {
189
  return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) {
7
  use GuzzleHttp\Psr7;
8
  use Psr\Http\Message\ResponseInterface;
9
  use Psr\Log\LoggerInterface;
 
10
 
11
  /**
12
  * Functions used to create and wrap handlers with handler middleware.
38
  $cookieJar->extractCookies($request, $response);
39
  return $response;
40
  }
41
+ );
42
  };
43
  };
44
  }
57
  return $handler($request, $options);
58
  }
59
  return $handler($request, $options)->then(
60
+ function (ResponseInterface $response) use ($request) {
61
  $code = $response->getStatusCode();
62
  if ($code < 400) {
63
  return $response;
182
  *
183
  * @return callable Returns a function that accepts the next handler.
184
  */
185
+ public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = 'info' /* \Psr\Log\LogLevel::INFO */)
186
  {
187
  return function (callable $handler) use ($logger, $formatter, $logLevel) {
188
  return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) {
vendor/guzzlehttp/guzzle/src/Pool.php CHANGED
@@ -1,12 +1,12 @@
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
@@ -69,6 +69,10 @@ class Pool implements PromisorInterface
69
  $this->each = new EachPromise($requests(), $config);
70
  }
71
 
 
 
 
 
72
  public function promise()
73
  {
74
  return $this->each->promise();
@@ -106,6 +110,11 @@ class Pool implements PromisorInterface
106
  return $res;
107
  }
108
 
 
 
 
 
 
109
  private static function cmpCallback(array &$options, $name, array &$results)
110
  {
111
  if (!isset($options[$name])) {
1
  <?php
2
  namespace GuzzleHttp;
3
 
4
+ use GuzzleHttp\Promise\EachPromise;
5
  use GuzzleHttp\Promise\PromisorInterface;
6
  use Psr\Http\Message\RequestInterface;
 
7
 
8
  /**
9
+ * Sends an 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
69
  $this->each = new EachPromise($requests(), $config);
70
  }
71
 
72
+ /**
73
+ * Get promise
74
+ * @return GuzzleHttp\Promise\Promise
75
+ */
76
  public function promise()
77
  {
78
  return $this->each->promise();
110
  return $res;
111
  }
112
 
113
+ /**
114
+ * Execute callback(s)
115
+ *
116
+ * @return void
117
+ */
118
  private static function cmpCallback(array &$options, $name, array &$results)
119
  {
120
  if (!isset($options[$name])) {
vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php CHANGED
@@ -66,6 +66,11 @@ class PrepareBodyMiddleware
66
  return $fn(Psr7\modify_request($request, $modify), $options);
67
  }
68
 
 
 
 
 
 
69
  private function addExpectHeader(
70
  RequestInterface $request,
71
  array $options,
66
  return $fn(Psr7\modify_request($request, $modify), $options);
67
  }
68
 
69
+ /**
70
+ * Add expect header
71
+ *
72
+ * @return void
73
+ */
74
  private function addExpectHeader(
75
  RequestInterface $request,
76
  array $options,
vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php CHANGED
@@ -76,7 +76,7 @@ class RedirectMiddleware
76
  /**
77
  * @param RequestInterface $request
78
  * @param array $options
79
- * @param ResponseInterface|PromiseInterface $response
80
  *
81
  * @return ResponseInterface|PromiseInterface
82
  */
@@ -118,6 +118,11 @@ class RedirectMiddleware
118
  return $promise;
119
  }
120
 
 
 
 
 
 
121
  private function withTracking(PromiseInterface $promise, $uri, $statusCode)
122
  {
123
  return $promise->then(
@@ -135,6 +140,13 @@ class RedirectMiddleware
135
  );
136
  }
137
 
 
 
 
 
 
 
 
138
  private function guardMax(RequestInterface $request, array &$options)
139
  {
140
  $current = isset($options['__redirect_count'])
@@ -172,7 +184,7 @@ class RedirectMiddleware
172
  // would do.
173
  $statusCode = $response->getStatusCode();
174
  if ($statusCode == 303 ||
175
- ($statusCode <= 302 && $request->getBody() && !$options['allow_redirects']['strict'])
176
  ) {
177
  $modify['method'] = 'GET';
178
  $modify['body'] = '';
@@ -186,7 +198,7 @@ class RedirectMiddleware
186
  if ($options['allow_redirects']['referer']
187
  && $modify['uri']->getScheme() === $request->getUri()->getScheme()
188
  ) {
189
- $uri = $request->getUri()->withUserInfo('', '');
190
  $modify['set_headers']['Referer'] = (string) $uri;
191
  } else {
192
  $modify['remove_headers'][] = 'Referer';
76
  /**
77
  * @param RequestInterface $request
78
  * @param array $options
79
+ * @param ResponseInterface $response
80
  *
81
  * @return ResponseInterface|PromiseInterface
82
  */
118
  return $promise;
119
  }
120
 
121
+ /**
122
+ * Enable tracking on promise.
123
+ *
124
+ * @return PromiseInterface
125
+ */
126
  private function withTracking(PromiseInterface $promise, $uri, $statusCode)
127
  {
128
  return $promise->then(
140
  );
141
  }
142
 
143
+ /**
144
+ * Check for too many redirects
145
+ *
146
+ * @return void
147
+ *
148
+ * @throws TooManyRedirectsException Too many redirects.
149
+ */
150
  private function guardMax(RequestInterface $request, array &$options)
151
  {
152
  $current = isset($options['__redirect_count'])
184
  // would do.
185
  $statusCode = $response->getStatusCode();
186
  if ($statusCode == 303 ||
187
+ ($statusCode <= 302 && !$options['allow_redirects']['strict'])
188
  ) {
189
  $modify['method'] = 'GET';
190
  $modify['body'] = '';
198
  if ($options['allow_redirects']['referer']
199
  && $modify['uri']->getScheme() === $request->getUri()->getScheme()
200
  ) {
201
+ $uri = $request->getUri()->withUserInfo('');
202
  $modify['set_headers']['Referer'] = (string) $uri;
203
  } else {
204
  $modify['remove_headers'][] = 'Referer';
vendor/guzzlehttp/guzzle/src/RequestOptions.php CHANGED
@@ -22,7 +22,7 @@ final class RequestOptions
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.
@@ -132,6 +132,14 @@ final class RequestOptions
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
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=false) Set to true to enable the Referer
26
  * header.
27
  * - protocols: (array, default=['http', 'https']) Allowed redirect
28
  * protocols.
132
  */
133
  const HTTP_ERRORS = 'http_errors';
134
 
135
+ /**
136
+ * idn: (bool|int, default=true) A combination of IDNA_* constants for
137
+ * idn_to_ascii() PHP's function (see "options" parameter). Set to false to
138
+ * disable IDN support completely, or to true to use the default
139
+ * configuration (IDNA_DEFAULT constant).
140
+ */
141
+ const IDN_CONVERSION = 'idn_conversion';
142
+
143
  /**
144
  * json: (mixed) Adds JSON data to a request. The provided value is JSON
145
  * encoded and a Content-Type header of application/json will be added to
vendor/guzzlehttp/guzzle/src/RetryMiddleware.php CHANGED
@@ -19,6 +19,9 @@ class RetryMiddleware
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
@@ -42,13 +45,13 @@ class RetryMiddleware
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
  /**
@@ -71,6 +74,11 @@ class RetryMiddleware
71
  );
72
  }
73
 
 
 
 
 
 
74
  private function onFulfilled(RequestInterface $req, array $options)
75
  {
76
  return function ($value) use ($req, $options) {
@@ -87,6 +95,11 @@ class RetryMiddleware
87
  };
88
  }
89
 
 
 
 
 
 
90
  private function onRejected(RequestInterface $req, array $options)
91
  {
92
  return function ($reason) use ($req, $options) {
@@ -103,6 +116,9 @@ class RetryMiddleware
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);
19
  /** @var callable */
20
  private $decider;
21
 
22
+ /** @var callable */
23
+ private $delay;
24
+
25
  /**
26
  * @param callable $decider Function that accepts the number of retries,
27
  * a request, [response], and [exception] and
45
  /**
46
  * Default exponential backoff delay function.
47
  *
48
+ * @param int $retries
49
  *
50
+ * @return int milliseconds.
51
  */
52
  public static function exponentialDelay($retries)
53
  {
54
+ return (int) pow(2, $retries - 1) * 1000;
55
  }
56
 
57
  /**
74
  );
75
  }
76
 
77
+ /**
78
+ * Execute fulfilled closure
79
+ *
80
+ * @return mixed
81
+ */
82
  private function onFulfilled(RequestInterface $req, array $options)
83
  {
84
  return function ($value) use ($req, $options) {
95
  };
96
  }
97
 
98
+ /**
99
+ * Execute rejected closure
100
+ *
101
+ * @return callable
102
+ */
103
  private function onRejected(RequestInterface $req, array $options)
104
  {
105
  return function ($reason) use ($req, $options) {
116
  };
117
  }
118
 
119
+ /**
120
+ * @return self
121
+ */
122
  private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null)
123
  {
124
  $options['delay'] = call_user_func($this->delay, ++$options['retries'], $response);
vendor/guzzlehttp/guzzle/src/TransferStats.php CHANGED
@@ -18,11 +18,11 @@ final class TransferStats
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,
@@ -93,7 +93,7 @@ final class TransferStats
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
  {
18
  private $handlerErrorData;
19
 
20
  /**
21
+ * @param RequestInterface $request Request that was sent.
22
+ * @param ResponseInterface|null $response Response received (if any)
23
+ * @param float|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,
93
  /**
94
  * Get the estimated time the request was being transferred by the handler.
95
  *
96
+ * @return float|null Time in seconds.
97
  */
98
  public function getTransferTime()
99
  {
vendor/guzzlehttp/guzzle/src/functions.php CHANGED
@@ -56,7 +56,7 @@ function describe_type($input)
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
  */
@@ -196,7 +196,8 @@ function default_ca_bundle()
196
  }
197
  }
198
 
199
- throw new \RuntimeException(<<< EOT
 
200
  No system CA bundle could be found in any of the the common system locations.
201
  PHP versions earlier than 5.6 are not properly configured to use the system's
202
  CA bundle by default. In order to verify peer certificates, you will need to
@@ -294,14 +295,14 @@ function is_host_in_noproxy($host, array $noProxyArray)
294
  * @param int $options Bitmask of JSON decode options.
295
  *
296
  * @return mixed
297
- * @throws \InvalidArgumentException if the JSON cannot be decoded.
298
  * @link http://www.php.net/manual/en/function.json-decode.php
299
  */
300
  function json_decode($json, $assoc = false, $depth = 512, $options = 0)
301
  {
302
  $data = \json_decode($json, $assoc, $depth, $options);
303
  if (JSON_ERROR_NONE !== json_last_error()) {
304
- throw new \InvalidArgumentException(
305
  'json_decode error: ' . json_last_error_msg()
306
  );
307
  }
@@ -317,17 +318,29 @@ function json_decode($json, $assoc = false, $depth = 512, $options = 0)
317
  * @param int $depth Set the maximum depth. Must be greater than zero.
318
  *
319
  * @return string
320
- * @throws \InvalidArgumentException if the JSON cannot be encoded.
321
  * @link http://www.php.net/manual/en/function.json-encode.php
322
  */
323
  function json_encode($value, $options = 0, $depth = 512)
324
  {
325
  $json = \json_encode($value, $options, $depth);
326
  if (JSON_ERROR_NONE !== json_last_error()) {
327
- throw new \InvalidArgumentException(
328
  'json_encode error: ' . json_last_error_msg()
329
  );
330
  }
331
 
332
  return $json;
333
  }
 
 
 
 
 
 
 
 
 
 
 
 
56
  /**
57
  * Parses an array of header lines into an associative array of headers.
58
  *
59
+ * @param iterable $lines Header lines array of strings in the following
60
  * format: "Name: Value"
61
  * @return array
62
  */
196
  }
197
  }
198
 
199
+ throw new \RuntimeException(
200
+ <<< EOT
201
  No system CA bundle could be found in any of the the common system locations.
202
  PHP versions earlier than 5.6 are not properly configured to use the system's
203
  CA bundle by default. In order to verify peer certificates, you will need to
295
  * @param int $options Bitmask of JSON decode options.
296
  *
297
  * @return mixed
298
+ * @throws Exception\InvalidArgumentException if the JSON cannot be decoded.
299
  * @link http://www.php.net/manual/en/function.json-decode.php
300
  */
301
  function json_decode($json, $assoc = false, $depth = 512, $options = 0)
302
  {
303
  $data = \json_decode($json, $assoc, $depth, $options);
304
  if (JSON_ERROR_NONE !== json_last_error()) {
305
+ throw new Exception\InvalidArgumentException(
306
  'json_decode error: ' . json_last_error_msg()
307
  );
308
  }
318
  * @param int $depth Set the maximum depth. Must be greater than zero.
319
  *
320
  * @return string
321
+ * @throws Exception\InvalidArgumentException if the JSON cannot be encoded.
322
  * @link http://www.php.net/manual/en/function.json-encode.php
323
  */
324
  function json_encode($value, $options = 0, $depth = 512)
325
  {
326
  $json = \json_encode($value, $options, $depth);
327
  if (JSON_ERROR_NONE !== json_last_error()) {
328
+ throw new Exception\InvalidArgumentException(
329
  'json_encode error: ' . json_last_error_msg()
330
  );
331
  }
332
 
333
  return $json;
334
  }
335
+
336
+ /**
337
+ * Wrapper for the hrtime() or microtime() functions
338
+ * (depending on the PHP version, one of the two is used)
339
+ *
340
+ * @return float|mixed UNIX timestamp
341
+ * @internal
342
+ */
343
+ function _current_time()
344
+ {
345
+ return function_exists('hrtime') ? hrtime(true) / 1e9 : microtime(true);
346
+ }
vendor/guzzlehttp/guzzle/tests/ClientTest.php DELETED
@@ -1,677 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\Client;
5
- use GuzzleHttp\Cookie\CookieJar;
6
- use GuzzleHttp\Handler\MockHandler;
7
- use GuzzleHttp\HandlerStack;
8
- use GuzzleHttp\Promise\PromiseInterface;
9
- use GuzzleHttp\Psr7;
10
- use GuzzleHttp\Psr7\Request;
11
- use GuzzleHttp\Psr7\Response;
12
- use GuzzleHttp\Psr7\Uri;
13
- use Psr\Http\Message\ResponseInterface;
14
- use PHPUnit\Framework\TestCase;
15
-
16
- class ClientTest extends TestCase
17
- {
18
- public function testUsesDefaultHandler()
19
- {
20
- $client = new Client();
21
- Server::enqueue([new Response(200, ['Content-Length' => 0])]);
22
- $response = $client->get(Server::$url);
23
- $this->assertEquals(200, $response->getStatusCode());
24
- }
25
-
26
- /**
27
- * @expectedException \InvalidArgumentException
28
- * @expectedExceptionMessage Magic request methods require a URI and optional options array
29
- */
30
- public function testValidatesArgsForMagicMethods()
31
- {
32
- $client = new Client();
33
- $client->get();
34
- }
35
-
36
- public function testCanSendMagicAsyncRequests()
37
- {
38
- $client = new Client();
39
- Server::flush();
40
- Server::enqueue([new Response(200, ['Content-Length' => 2], 'hi')]);
41
- $p = $client->getAsync(Server::$url, ['query' => ['test' => 'foo']]);
42
- $this->assertInstanceOf(PromiseInterface::class, $p);
43
- $this->assertEquals(200, $p->wait()->getStatusCode());
44
- $received = Server::received(true);
45
- $this->assertCount(1, $received);
46
- $this->assertEquals('test=foo', $received[0]->getUri()->getQuery());
47
- }
48
-
49
- public function testCanSendSynchronously()
50
- {
51
- $client = new Client(['handler' => new MockHandler([new Response()])]);
52
- $request = new Request('GET', 'http://example.com');
53
- $r = $client->send($request);
54
- $this->assertInstanceOf(ResponseInterface::class, $r);
55
- $this->assertEquals(200, $r->getStatusCode());
56
- }
57
-
58
- public function testClientHasOptions()
59
- {
60
- $client = new Client([
61
- 'base_uri' => 'http://foo.com',
62
- 'timeout' => 2,
63
- 'headers' => ['bar' => 'baz'],
64
- 'handler' => new MockHandler()
65
- ]);
66
- $base = $client->getConfig('base_uri');
67
- $this->assertEquals('http://foo.com', (string) $base);
68
- $this->assertInstanceOf(Uri::class, $base);
69
- $this->assertNotNull($client->getConfig('handler'));
70
- $this->assertEquals(2, $client->getConfig('timeout'));
71
- $this->assertArrayHasKey('timeout', $client->getConfig());
72
- $this->assertArrayHasKey('headers', $client->getConfig());
73
- }
74
-
75
- public function testCanMergeOnBaseUri()
76
- {
77
- $mock = new MockHandler([new Response()]);
78
- $client = new Client([
79
- 'base_uri' => 'http://foo.com/bar/',
80
- 'handler' => $mock
81
- ]);
82
- $client->get('baz');
83
- $this->assertEquals(
84
- 'http://foo.com/bar/baz',
85
- $mock->getLastRequest()->getUri()
86
- );
87
- }
88
-
89
- public function testCanMergeOnBaseUriWithRequest()
90
- {
91
- $mock = new MockHandler([new Response(), new Response()]);
92
- $client = new Client([
93
- 'handler' => $mock,
94
- 'base_uri' => 'http://foo.com/bar/'
95
- ]);
96
- $client->request('GET', new Uri('baz'));
97
- $this->assertEquals(
98
- 'http://foo.com/bar/baz',
99
- (string) $mock->getLastRequest()->getUri()
100
- );
101
-
102
- $client->request('GET', new Uri('baz'), ['base_uri' => 'http://example.com/foo/']);
103
- $this->assertEquals(
104
- 'http://example.com/foo/baz',
105
- (string) $mock->getLastRequest()->getUri(),
106
- 'Can overwrite the base_uri through the request options'
107
- );
108
- }
109
-
110
- public function testCanUseRelativeUriWithSend()
111
- {
112
- $mock = new MockHandler([new Response()]);
113
- $client = new Client([
114
- 'handler' => $mock,
115
- 'base_uri' => 'http://bar.com'
116
- ]);
117
- $this->assertEquals('http://bar.com', (string) $client->getConfig('base_uri'));
118
- $request = new Request('GET', '/baz');
119
- $client->send($request);
120
- $this->assertEquals(
121
- 'http://bar.com/baz',
122
- (string) $mock->getLastRequest()->getUri()
123
- );
124
- }
125
-
126
- public function testMergesDefaultOptionsAndDoesNotOverwriteUa()
127
- {
128
- $c = new Client(['headers' => ['User-agent' => 'foo']]);
129
- $this->assertEquals(['User-agent' => 'foo'], $c->getConfig('headers'));
130
- $this->assertInternalType('array', $c->getConfig('allow_redirects'));
131
- $this->assertTrue($c->getConfig('http_errors'));
132
- $this->assertTrue($c->getConfig('decode_content'));
133
- $this->assertTrue($c->getConfig('verify'));
134
- }
135
-
136
- public function testDoesNotOverwriteHeaderWithDefault()
137
- {
138
- $mock = new MockHandler([new Response()]);
139
- $c = new Client([
140
- 'headers' => ['User-agent' => 'foo'],
141
- 'handler' => $mock
142
- ]);
143
- $c->get('http://example.com', ['headers' => ['User-Agent' => 'bar']]);
144
- $this->assertEquals('bar', $mock->getLastRequest()->getHeaderLine('User-Agent'));
145
- }
146
-
147
- public function testDoesNotOverwriteHeaderWithDefaultInRequest()
148
- {
149
- $mock = new MockHandler([new Response()]);
150
- $c = new Client([
151
- 'headers' => ['User-agent' => 'foo'],
152
- 'handler' => $mock
153
- ]);
154
- $request = new Request('GET', Server::$url, ['User-Agent' => 'bar']);
155
- $c->send($request);
156
- $this->assertEquals('bar', $mock->getLastRequest()->getHeaderLine('User-Agent'));
157
- }
158
-
159
- public function testDoesOverwriteHeaderWithSetRequestOption()
160
- {
161
- $mock = new MockHandler([new Response()]);
162
- $c = new Client([
163
- 'headers' => ['User-agent' => 'foo'],
164
- 'handler' => $mock
165
- ]);
166
- $request = new Request('GET', Server::$url, ['User-Agent' => 'bar']);
167
- $c->send($request, ['headers' => ['User-Agent' => 'YO']]);
168
- $this->assertEquals('YO', $mock->getLastRequest()->getHeaderLine('User-Agent'));
169
- }
170
-
171
- public function testCanUnsetRequestOptionWithNull()
172
- {
173
- $mock = new MockHandler([new Response()]);
174
- $c = new Client([
175
- 'headers' => ['foo' => 'bar'],
176
- 'handler' => $mock
177
- ]);
178
- $c->get('http://example.com', ['headers' => null]);
179
- $this->assertFalse($mock->getLastRequest()->hasHeader('foo'));
180
- }
181
-
182
- public function testRewriteExceptionsToHttpErrors()
183
- {
184
- $client = new Client(['handler' => new MockHandler([new Response(404)])]);
185
- $res = $client->get('http://foo.com', ['exceptions' => false]);
186
- $this->assertEquals(404, $res->getStatusCode());
187
- }
188
-
189
- public function testRewriteSaveToToSink()
190
- {
191
- $r = Psr7\stream_for(fopen('php://temp', 'r+'));
192
- $mock = new MockHandler([new Response(200, [], 'foo')]);
193
- $client = new Client(['handler' => $mock]);
194
- $client->get('http://foo.com', ['save_to' => $r]);
195
- $this->assertSame($r, $mock->getLastOptions()['sink']);
196
- }
197
-
198
- public function testAllowRedirectsCanBeTrue()
199
- {
200
- $mock = new MockHandler([new Response(200, [], 'foo')]);
201
- $handler = HandlerStack::create($mock);
202
- $client = new Client(['handler' => $handler]);
203
- $client->get('http://foo.com', ['allow_redirects' => true]);
204
- $this->assertInternalType('array', $mock->getLastOptions()['allow_redirects']);
205
- }
206
-
207
- /**
208
- * @expectedException \InvalidArgumentException
209
- * @expectedExceptionMessage allow_redirects must be true, false, or array
210
- */
211
- public function testValidatesAllowRedirects()
212
- {
213
- $mock = new MockHandler([new Response(200, [], 'foo')]);
214
- $handler = HandlerStack::create($mock);
215
- $client = new Client(['handler' => $handler]);
216
- $client->get('http://foo.com', ['allow_redirects' => 'foo']);
217
- }
218
-
219
- /**
220
- * @expectedException \GuzzleHttp\Exception\ClientException
221
- */
222
- public function testThrowsHttpErrorsByDefault()
223
- {
224
- $mock = new MockHandler([new Response(404)]);
225
- $handler = HandlerStack::create($mock);
226
- $client = new Client(['handler' => $handler]);
227
- $client->get('http://foo.com');
228
- }
229
-
230
- /**
231
- * @expectedException \InvalidArgumentException
232
- * @expectedExceptionMessage cookies must be an instance of GuzzleHttp\Cookie\CookieJarInterface
233
- */
234
- public function testValidatesCookies()
235
- {
236
- $mock = new MockHandler([new Response(200, [], 'foo')]);
237
- $handler = HandlerStack::create($mock);
238
- $client = new Client(['handler' => $handler]);
239
- $client->get('http://foo.com', ['cookies' => 'foo']);
240
- }
241
-
242
- public function testSetCookieToTrueUsesSharedJar()
243
- {
244
- $mock = new MockHandler([
245
- new Response(200, ['Set-Cookie' => 'foo=bar']),
246
- new Response()
247
- ]);
248
- $handler = HandlerStack::create($mock);
249
- $client = new Client(['handler' => $handler, 'cookies' => true]);
250
- $client->get('http://foo.com');
251
- $client->get('http://foo.com');
252
- $this->assertEquals('foo=bar', $mock->getLastRequest()->getHeaderLine('Cookie'));
253
- }
254
-
255
- public function testSetCookieToJar()
256
- {
257
- $mock = new MockHandler([
258
- new Response(200, ['Set-Cookie' => 'foo=bar']),
259
- new Response()
260
- ]);
261
- $handler = HandlerStack::create($mock);
262
- $client = new Client(['handler' => $handler]);
263
- $jar = new CookieJar();
264
- $client->get('http://foo.com', ['cookies' => $jar]);
265
- $client->get('http://foo.com', ['cookies' => $jar]);
266
- $this->assertEquals('foo=bar', $mock->getLastRequest()->getHeaderLine('Cookie'));
267
- }
268
-
269
- public function testCanDisableContentDecoding()
270
- {
271
- $mock = new MockHandler([new Response()]);
272
- $client = new Client(['handler' => $mock]);
273
- $client->get('http://foo.com', ['decode_content' => false]);
274
- $last = $mock->getLastRequest();
275
- $this->assertFalse($last->hasHeader('Accept-Encoding'));
276
- $this->assertFalse($mock->getLastOptions()['decode_content']);
277
- }
278
-
279
- public function testCanSetContentDecodingToValue()
280
- {
281
- $mock = new MockHandler([new Response()]);
282
- $client = new Client(['handler' => $mock]);
283
- $client->get('http://foo.com', ['decode_content' => 'gzip']);
284
- $last = $mock->getLastRequest();
285
- $this->assertEquals('gzip', $last->getHeaderLine('Accept-Encoding'));
286
- $this->assertEquals('gzip', $mock->getLastOptions()['decode_content']);
287
- }
288
-
289
- /**
290
- * @expectedException \InvalidArgumentException
291
- */
292
- public function testValidatesHeaders()
293
- {
294
- $mock = new MockHandler();
295
- $client = new Client(['handler' => $mock]);
296
- $client->get('http://foo.com', ['headers' => 'foo']);
297
- }
298
-
299
- public function testAddsBody()
300
- {
301
- $mock = new MockHandler([new Response()]);
302
- $client = new Client(['handler' => $mock]);
303
- $request = new Request('PUT', 'http://foo.com');
304
- $client->send($request, ['body' => 'foo']);
305
- $last = $mock->getLastRequest();
306
- $this->assertEquals('foo', (string) $last->getBody());
307
- }
308
-
309
- /**
310
- * @expectedException \InvalidArgumentException
311
- */
312
- public function testValidatesQuery()
313
- {
314
- $mock = new MockHandler();
315
- $client = new Client(['handler' => $mock]);
316
- $request = new Request('PUT', 'http://foo.com');
317
- $client->send($request, ['query' => false]);
318
- }
319
-
320
- public function testQueryCanBeString()
321
- {
322
- $mock = new MockHandler([new Response()]);
323
- $client = new Client(['handler' => $mock]);
324
- $request = new Request('PUT', 'http://foo.com');
325
- $client->send($request, ['query' => 'foo']);
326
- $this->assertEquals('foo', $mock->getLastRequest()->getUri()->getQuery());
327
- }
328
-
329
- public function testQueryCanBeArray()
330
- {
331
- $mock = new MockHandler([new Response()]);
332
- $client = new Client(['handler' => $mock]);
333
- $request = new Request('PUT', 'http://foo.com');
334
- $client->send($request, ['query' => ['foo' => 'bar baz']]);
335
- $this->assertEquals('foo=bar%20baz', $mock->getLastRequest()->getUri()->getQuery());
336
- }
337
-
338
- public function testCanAddJsonData()
339
- {
340
- $mock = new MockHandler([new Response()]);
341
- $client = new Client(['handler' => $mock]);
342
- $request = new Request('PUT', 'http://foo.com');
343
- $client->send($request, ['json' => ['foo' => 'bar']]);
344
- $last = $mock->getLastRequest();
345
- $this->assertEquals('{"foo":"bar"}', (string) $mock->getLastRequest()->getBody());
346
- $this->assertEquals('application/json', $last->getHeaderLine('Content-Type'));
347
- }
348
-
349
- public function testCanAddJsonDataWithoutOverwritingContentType()
350
- {
351
- $mock = new MockHandler([new Response()]);
352
- $client = new Client(['handler' => $mock]);
353
- $request = new Request('PUT', 'http://foo.com');
354
- $client->send($request, [
355
- 'headers' => ['content-type' => 'foo'],
356
- 'json' => 'a'
357
- ]);
358
- $last = $mock->getLastRequest();
359
- $this->assertEquals('"a"', (string) $mock->getLastRequest()->getBody());
360
- $this->assertEquals('foo', $last->getHeaderLine('Content-Type'));
361
- }
362
-
363
- public function testAuthCanBeTrue()
364
- {
365
- $mock = new MockHandler([new Response()]);
366
- $client = new Client(['handler' => $mock]);
367
- $client->get('http://foo.com', ['auth' => false]);
368
- $last = $mock->getLastRequest();
369
- $this->assertFalse($last->hasHeader('Authorization'));
370
- }
371
-
372
- public function testAuthCanBeArrayForBasicAuth()
373
- {
374
- $mock = new MockHandler([new Response()]);
375
- $client = new Client(['handler' => $mock]);
376
- $client->get('http://foo.com', ['auth' => ['a', 'b']]);
377
- $last = $mock->getLastRequest();
378
- $this->assertEquals('Basic YTpi', $last->getHeaderLine('Authorization'));
379
- }
380
-
381
- public function testAuthCanBeArrayForDigestAuth()
382
- {
383
- $mock = new MockHandler([new Response()]);
384
- $client = new Client(['handler' => $mock]);
385
- $client->get('http://foo.com', ['auth' => ['a', 'b', 'digest']]);
386
- $last = $mock->getLastOptions();
387
- $this->assertEquals([
388
- CURLOPT_HTTPAUTH => 2,
389
- CURLOPT_USERPWD => 'a:b'
390
- ], $last['curl']);
391
- }
392
-
393
- public function testAuthCanBeArrayForNtlmAuth()
394
- {
395
- $mock = new MockHandler([new Response()]);
396
- $client = new Client(['handler' => $mock]);
397
- $client->get('http://foo.com', ['auth' => ['a', 'b', 'ntlm']]);
398
- $last = $mock->getLastOptions();
399
- $this->assertEquals([
400
- CURLOPT_HTTPAUTH => 8,
401
- CURLOPT_USERPWD => 'a:b'
402
- ], $last['curl']);
403
- }
404
-
405
- public function testAuthCanBeCustomType()
406
- {
407
- $mock = new MockHandler([new Response()]);
408
- $client = new Client(['handler' => $mock]);
409
- $client->get('http://foo.com', ['auth' => 'foo']);
410
- $last = $mock->getLastOptions();
411
- $this->assertEquals('foo', $last['auth']);
412
- }
413
-
414
- public function testCanAddFormParams()
415
- {
416
- $mock = new MockHandler([new Response()]);
417
- $client = new Client(['handler' => $mock]);
418
- $client->post('http://foo.com', [
419
- 'form_params' => [
420
- 'foo' => 'bar bam',
421
- 'baz' => ['boo' => 'qux']
422
- ]
423
- ]);
424
- $last = $mock->getLastRequest();
425
- $this->assertEquals(
426
- 'application/x-www-form-urlencoded',
427
- $last->getHeaderLine('Content-Type')
428
- );
429
- $this->assertEquals(
430
- 'foo=bar+bam&baz%5Bboo%5D=qux',
431
- (string) $last->getBody()
432
- );
433
- }
434
-
435
- public function testFormParamsEncodedProperly()
436
- {
437
- $separator = ini_get('arg_separator.output');
438
- ini_set('arg_separator.output', '&amp;');
439
- $mock = new MockHandler([new Response()]);
440
- $client = new Client(['handler' => $mock]);
441
- $client->post('http://foo.com', [
442
- 'form_params' => [
443
- 'foo' => 'bar bam',
444
- 'baz' => ['boo' => 'qux']
445
- ]
446
- ]);
447
- $last = $mock->getLastRequest();
448
- $this->assertEquals(
449
- 'foo=bar+bam&baz%5Bboo%5D=qux',
450
- (string) $last->getBody()
451
- );
452
-
453
- ini_set('arg_separator.output', $separator);
454
- }
455
-
456
- /**
457
- * @expectedException \InvalidArgumentException
458
- */
459
- public function testEnsuresThatFormParamsAndMultipartAreExclusive()
460
- {
461
- $client = new Client(['handler' => function () {}]);
462
- $client->post('http://foo.com', [
463
- 'form_params' => ['foo' => 'bar bam'],
464
- 'multipart' => []
465
- ]);
466
- }
467
-
468
- public function testCanSendMultipart()
469
- {
470
- $mock = new MockHandler([new Response()]);
471
- $client = new Client(['handler' => $mock]);
472
- $client->post('http://foo.com', [
473
- 'multipart' => [
474
- [
475
- 'name' => 'foo',
476
- 'contents' => 'bar'
477
- ],
478
- [
479
- 'name' => 'test',
480
- 'contents' => fopen(__FILE__, 'r')
481
- ]
482
- ]
483
- ]);
484
-
485
- $last = $mock->getLastRequest();
486
- $this->assertContains(
487
- 'multipart/form-data; boundary=',
488
- $last->getHeaderLine('Content-Type')
489
- );
490
-
491
- $this->assertContains(
492
- 'Content-Disposition: form-data; name="foo"',
493
- (string) $last->getBody()
494
- );
495
-
496
- $this->assertContains('bar', (string) $last->getBody());
497
- $this->assertContains(
498
- 'Content-Disposition: form-data; name="foo"' . "\r\n",
499
- (string) $last->getBody()
500
- );
501
- $this->assertContains(
502
- 'Content-Disposition: form-data; name="test"; filename="ClientTest.php"',
503
- (string) $last->getBody()
504
- );
505
- }
506
-
507
- public function testCanSendMultipartWithExplicitBody()
508
- {
509
- $mock = new MockHandler([new Response()]);
510
- $client = new Client(['handler' => $mock]);
511
- $client->send(
512
- new Request(
513
- 'POST',
514
- 'http://foo.com',
515
- [],
516
- new Psr7\MultipartStream(
517
- [
518
- [
519
- 'name' => 'foo',
520
- 'contents' => 'bar',
521
- ],
522
- [
523
- 'name' => 'test',
524
- 'contents' => fopen(__FILE__, 'r'),
525
- ],
526
- ]
527
- )
528
- )
529
- );
530
-
531
- $last = $mock->getLastRequest();
532
- $this->assertContains(
533
- 'multipart/form-data; boundary=',
534
- $last->getHeaderLine('Content-Type')
535
- );
536
-
537
- $this->assertContains(
538
- 'Content-Disposition: form-data; name="foo"',
539
- (string) $last->getBody()
540
- );
541
-
542
- $this->assertContains('bar', (string) $last->getBody());
543
- $this->assertContains(
544
- 'Content-Disposition: form-data; name="foo"' . "\r\n",
545
- (string) $last->getBody()
546
- );
547
- $this->assertContains(
548
- 'Content-Disposition: form-data; name="test"; filename="ClientTest.php"',
549
- (string) $last->getBody()
550
- );
551
- }
552
-
553
- public function testUsesProxyEnvironmentVariables()
554
- {
555
- $http = getenv('HTTP_PROXY');
556
- $https = getenv('HTTPS_PROXY');
557
- $no = getenv('NO_PROXY');
558
- $client = new Client();
559
- $this->assertNull($client->getConfig('proxy'));
560
- putenv('HTTP_PROXY=127.0.0.1');
561
- $client = new Client();
562
- $this->assertEquals(
563
- ['http' => '127.0.0.1'],
564
- $client->getConfig('proxy')
565
- );
566
- putenv('HTTPS_PROXY=127.0.0.2');
567
- putenv('NO_PROXY=127.0.0.3, 127.0.0.4');
568
- $client = new Client();
569
- $this->assertEquals(
570
- ['http' => '127.0.0.1', 'https' => '127.0.0.2', 'no' => ['127.0.0.3','127.0.0.4']],
571
- $client->getConfig('proxy')
572
- );
573
- putenv("HTTP_PROXY=$http");
574
- putenv("HTTPS_PROXY=$https");
575
- putenv("NO_PROXY=$no");
576
- }
577
-
578
- public function testRequestSendsWithSync()
579
- {
580
- $mock = new MockHandler([new Response()]);
581
- $client = new Client(['handler' => $mock]);
582
- $client->request('GET', 'http://foo.com');
583
- $this->assertTrue($mock->getLastOptions()['synchronous']);
584
- }
585
-
586
- public function testSendSendsWithSync()
587
- {
588
- $mock = new MockHandler([new Response()]);
589
- $client = new Client(['handler' => $mock]);
590
- $client->send(new Request('GET', 'http://foo.com'));
591
- $this->assertTrue($mock->getLastOptions()['synchronous']);
592
- }
593
-
594
- public function testCanSetCustomHandler()
595
- {
596
- $mock = new MockHandler([new Response(500)]);
597
- $client = new Client(['handler' => $mock]);
598
- $mock2 = new MockHandler([new Response(200)]);
599
- $this->assertEquals(
600
- 200,
601
- $client->send(new Request('GET', 'http://foo.com'), [
602
- 'handler' => $mock2
603
- ])->getStatusCode()
604
- );
605
- }
606
-
607
- public function testProperlyBuildsQuery()
608
- {
609
- $mock = new MockHandler([new Response()]);
610
- $client = new Client(['handler' => $mock]);
611
- $request = new Request('PUT', 'http://foo.com');
612
- $client->send($request, ['query' => ['foo' => 'bar', 'john' => 'doe']]);
613
- $this->assertEquals('foo=bar&john=doe', $mock->getLastRequest()->getUri()->getQuery());
614
- }
615
-
616
- public function testSendSendsWithIpAddressAndPortAndHostHeaderInRequestTheHostShouldBePreserved()
617
- {
618
- $mockHandler = new MockHandler([new Response()]);
619
- $client = new Client(['base_uri' => 'http://127.0.0.1:8585', 'handler' => $mockHandler]);
620
- $request = new Request('GET', '/test', ['Host'=>'foo.com']);
621
-
622
- $client->send($request);
623
-
624
- $this->assertEquals('foo.com', $mockHandler->getLastRequest()->getHeader('Host')[0]);
625
- }
626
-
627
- public function testSendSendsWithDomainAndHostHeaderInRequestTheHostShouldBePreserved()
628
- {
629
- $mockHandler = new MockHandler([new Response()]);
630
- $client = new Client(['base_uri' => 'http://foo2.com', 'handler' => $mockHandler]);
631
- $request = new Request('GET', '/test', ['Host'=>'foo.com']);
632
-
633
- $client->send($request);
634
-
635
- $this->assertEquals('foo.com', $mockHandler->getLastRequest()->getHeader('Host')[0]);
636
- }
637
-
638
- /**
639
- * @expectedException \InvalidArgumentException
640
- */
641
- public function testValidatesSink()
642
- {
643
- $mockHandler = new MockHandler([new Response()]);
644
- $client = new Client(['handler' => $mockHandler]);
645
- $client->get('http://test.com', ['sink' => true]);
646
- }
647
-
648
- public function testHttpDefaultSchemeIfUriHasNone()
649
- {
650
- $mockHandler = new MockHandler([new Response()]);
651
- $client = new Client(['handler' => $mockHandler]);
652
-
653
- $client->request('GET', '//example.org/test');
654
-
655
- $this->assertSame('http://example.org/test', (string) $mockHandler->getLastRequest()->getUri());
656
- }
657
-
658
- public function testOnlyAddSchemeWhenHostIsPresent()
659
- {
660
- $mockHandler = new MockHandler([new Response()]);
661
- $client = new Client(['handler' => $mockHandler]);
662
-
663
- $client->request('GET', 'baz');
664
- $this->assertSame(
665
- 'baz',
666
- (string) $mockHandler->getLastRequest()->getUri()
667
- );
668
- }
669
-
670
- /**
671
- * @expectedException InvalidArgumentException
672
- */
673
- public function testHandlerIsCallable()
674
- {
675
- new Client(['handler' => 'not_cllable']);
676
- }
677
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Cookie/CookieJarTest.php DELETED
@@ -1,406 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\CookieJar;
3
-
4
- use GuzzleHttp\Cookie\CookieJar;
5
- use GuzzleHttp\Cookie\SetCookie;
6
- use GuzzleHttp\Psr7\Request;
7
- use GuzzleHttp\Psr7\Response;
8
- use PHPUnit\Framework\TestCase;
9
-
10
- /**
11
- * @covers GuzzleHttp\Cookie\CookieJar
12
- */
13
- class CookieJarTest extends TestCase
14
- {
15
- /** @var CookieJar */
16
- private $jar;
17
-
18
- public function setUp()
19
- {
20
- $this->jar = new CookieJar();
21
- }
22
-
23
- protected function getTestCookies()
24
- {
25
- return [
26
- new SetCookie(['Name' => 'foo', 'Value' => 'bar', 'Domain' => 'foo.com', 'Path' => '/', 'Discard' => true]),
27
- new SetCookie(['Name' => 'test', 'Value' => '123', 'Domain' => 'baz.com', 'Path' => '/foo', 'Expires' => 2]),
28
- new SetCookie(['Name' => 'you', 'Value' => '123', 'Domain' => 'bar.com', 'Path' => '/boo', 'Expires' => time() + 1000])
29
- ];
30
- }
31
-
32
- public function testCreatesFromArray()
33
- {
34
- $jar = CookieJar::fromArray([
35
- 'foo' => 'bar',
36
- 'baz' => 'bam'
37
- ], 'example.com');
38
- $this->assertCount(2, $jar);
39
- }
40
-
41
- public function testEmptyJarIsCountable()
42
- {
43
- $this->assertCount(0, new CookieJar());
44
- }
45
-
46
- public function testGetsCookiesByName()
47
- {
48
- $cookies = $this->getTestCookies();
49
- foreach ($this->getTestCookies() as $cookie) {
50
- $this->jar->setCookie($cookie);
51
- }
52
-
53
- $testCookie = $cookies[0];
54
- $this->assertEquals($testCookie, $this->jar->getCookieByName($testCookie->getName()));
55
- $this->assertNull($this->jar->getCookieByName("doesnotexist"));
56
- $this->assertNull($this->jar->getCookieByName(""));
57
- }
58
-
59
- /**
60
- * Provides test data for cookie cookieJar retrieval
61
- */
62
- public function getCookiesDataProvider()
63
- {
64
- return [
65
- [['foo', 'baz', 'test', 'muppet', 'googoo'], '', '', '', false],
66
- [['foo', 'baz', 'muppet', 'googoo'], '', '', '', true],
67
- [['googoo'], 'www.example.com', '', '', false],
68
- [['muppet', 'googoo'], 'test.y.example.com', '', '', false],
69
- [['foo', 'baz'], 'example.com', '', '', false],
70
- [['muppet'], 'x.y.example.com', '/acme/', '', false],
71
- [['muppet'], 'x.y.example.com', '/acme/test/', '', false],
72
- [['googoo'], 'x.y.example.com', '/test/acme/test/', '', false],
73
- [['foo', 'baz'], 'example.com', '', '', false],
74
- [['baz'], 'example.com', '', 'baz', false],
75
- ];
76
- }
77
-
78
- public function testStoresAndRetrievesCookies()
79
- {
80
- $cookies = $this->getTestCookies();
81
- foreach ($cookies as $cookie) {
82
- $this->assertTrue($this->jar->setCookie($cookie));
83
- }
84
-
85
- $this->assertCount(3, $this->jar);
86
- $this->assertCount(3, $this->jar->getIterator());
87
- $this->assertEquals($cookies, $this->jar->getIterator()->getArrayCopy());
88
- }
89
-
90
- public function testRemovesTemporaryCookies()
91
- {
92
- $cookies = $this->getTestCookies();
93
- foreach ($this->getTestCookies() as $cookie) {
94
- $this->jar->setCookie($cookie);
95
- }
96
- $this->jar->clearSessionCookies();
97
- $this->assertEquals(
98
- [$cookies[1], $cookies[2]],
99
- $this->jar->getIterator()->getArrayCopy()
100
- );
101
- }
102
-
103
- public function testRemovesSelectively()
104
- {
105
- foreach ($this->getTestCookies() as $cookie) {
106
- $this->jar->setCookie($cookie);
107
- }
108
-
109
- // Remove foo.com cookies
110
- $this->jar->clear('foo.com');
111
- $this->assertCount(2, $this->jar);
112
- // Try again, removing no further cookies
113
- $this->jar->clear('foo.com');
114
- $this->assertCount(2, $this->jar);
115
-
116
- // Remove bar.com cookies with path of /boo
117
- $this->jar->clear('bar.com', '/boo');
118
- $this->assertCount(1, $this->jar);
119
-
120
- // Remove cookie by name
121
- $this->jar->clear(null, null, 'test');
122
- $this->assertCount(0, $this->jar);
123
- }
124
-
125
- public function testDoesNotAddIncompleteCookies()
126
- {
127
- $this->assertFalse($this->jar->setCookie(new SetCookie()));
128
- $this->assertFalse($this->jar->setCookie(new SetCookie(array(
129
- 'Name' => 'foo'
130
- ))));
131
- $this->assertFalse($this->jar->setCookie(new SetCookie(array(
132
- 'Name' => false
133
- ))));
134
- $this->assertFalse($this->jar->setCookie(new SetCookie(array(
135
- 'Name' => true
136
- ))));
137
- $this->assertFalse($this->jar->setCookie(new SetCookie(array(
138
- 'Name' => 'foo',
139
- 'Domain' => 'foo.com'
140
- ))));
141
- }
142
-
143
- public function testDoesNotAddEmptyCookies()
144
- {
145
- $this->assertFalse($this->jar->setCookie(new SetCookie(array(
146
- 'Name' => '',
147
- 'Domain' => 'foo.com',
148
- 'Value' => 0
149
- ))));
150
- }
151
-
152
- public function testDoesAddValidCookies()
153
- {
154
- $this->assertTrue($this->jar->setCookie(new SetCookie(array(
155
- 'Name' => '0',
156
- 'Domain' => 'foo.com',
157
- 'Value' => 0
158
- ))));
159
- $this->assertTrue($this->jar->setCookie(new SetCookie(array(
160
- 'Name' => 'foo',
161
- 'Domain' => 'foo.com',
162
- 'Value' => 0
163
- ))));
164
- $this->assertTrue($this->jar->setCookie(new SetCookie(array(
165
- 'Name' => 'foo',
166
- 'Domain' => 'foo.com',
167
- 'Value' => 0.0
168
- ))));
169
- $this->assertTrue($this->jar->setCookie(new SetCookie(array(
170
- 'Name' => 'foo',
171
- 'Domain' => 'foo.com',
172
- 'Value' => '0'
173
- ))));
174
- }
175
-
176
- public function testOverwritesCookiesThatAreOlderOrDiscardable()
177
- {
178
- $t = time() + 1000;
179
- $data = array(
180
- 'Name' => 'foo',
181
- 'Value' => 'bar',
182
- 'Domain' => '.example.com',
183
- 'Path' => '/',
184
- 'Max-Age' => '86400',
185
- 'Secure' => true,
186
- 'Discard' => true,
187
- 'Expires' => $t
188
- );
189
-
190
- // Make sure that the discard cookie is overridden with the non-discard
191
- $this->assertTrue($this->jar->setCookie(new SetCookie($data)));
192
- $this->assertCount(1, $this->jar);
193
-
194
- $data['Discard'] = false;
195
- $this->assertTrue($this->jar->setCookie(new SetCookie($data)));
196
- $this->assertCount(1, $this->jar);
197
-
198
- $c = $this->jar->getIterator()->getArrayCopy();
199
- $this->assertFalse($c[0]->getDiscard());
200
-
201
- // Make sure it doesn't duplicate the cookie
202
- $this->jar->setCookie(new SetCookie($data));
203
- $this->assertCount(1, $this->jar);
204
-
205
- // Make sure the more future-ful expiration date supersede the other
206
- $data['Expires'] = time() + 2000;
207
- $this->assertTrue($this->jar->setCookie(new SetCookie($data)));
208
- $this->assertCount(1, $this->jar);
209
- $c = $this->jar->getIterator()->getArrayCopy();
210
- $this->assertNotEquals($t, $c[0]->getExpires());
211
- }
212
-
213
- public function testOverwritesCookiesThatHaveChanged()
214
- {
215
- $t = time() + 1000;
216
- $data = array(
217
- 'Name' => 'foo',
218
- 'Value' => 'bar',
219
- 'Domain' => '.example.com',
220
- 'Path' => '/',
221
- 'Max-Age' => '86400',
222
- 'Secure' => true,
223
- 'Discard' => true,
224
- 'Expires' => $t
225
- );
226
-
227
- // Make sure that the discard cookie is overridden with the non-discard
228
- $this->assertTrue($this->jar->setCookie(new SetCookie($data)));
229
-
230
- $data['Value'] = 'boo';
231
- $this->assertTrue($this->jar->setCookie(new SetCookie($data)));
232
- $this->assertCount(1, $this->jar);
233
-
234
- // Changing the value plus a parameter also must overwrite the existing one
235
- $data['Value'] = 'zoo';
236
- $data['Secure'] = false;
237
- $this->assertTrue($this->jar->setCookie(new SetCookie($data)));
238
- $this->assertCount(1, $this->jar);
239
-
240
- $c = $this->jar->getIterator()->getArrayCopy();
241
- $this->assertEquals('zoo', $c[0]->getValue());
242
- }
243
-
244
- public function testAddsCookiesFromResponseWithRequest()
245
- {
246
- $response = new Response(200, array(
247
- 'Set-Cookie' => "fpc=d=.Hm.yh4.1XmJWjJfs4orLQzKzPImxklQoxXSHOZATHUSEFciRueW_7704iYUtsXNEXq0M92Px2glMdWypmJ7HIQl6XIUvrZimWjQ3vIdeuRbI.FNQMAfcxu_XN1zSx7l.AcPdKL6guHc2V7hIQFhnjRW0rxm2oHY1P4bGQxFNz7f.tHm12ZD3DbdMDiDy7TBXsuP4DM-&v=2; expires=Fri, 02-Mar-2019 02:17:40 GMT;"
248
- ));
249
- $request = new Request('GET', 'http://www.example.com');
250
- $this->jar->extractCookies($request, $response);
251
- $this->assertCount(1, $this->jar);
252
- }
253
-
254
- public function getMatchingCookiesDataProvider()
255
- {
256
- return array(
257
- array('https://example.com', 'foo=bar; baz=foobar'),
258
- array('http://example.com', ''),
259
- array('https://example.com:8912', 'foo=bar; baz=foobar'),
260
- array('https://foo.example.com', 'foo=bar; baz=foobar'),
261
- array('http://foo.example.com/test/acme/', 'googoo=gaga')
262
- );
263
- }
264
-
265
- /**
266
- * @dataProvider getMatchingCookiesDataProvider
267
- */
268
- public function testReturnsCookiesMatchingRequests($url, $cookies)
269
- {
270
- $bag = [
271
- new SetCookie([
272
- 'Name' => 'foo',
273
- 'Value' => 'bar',
274
- 'Domain' => 'example.com',
275
- 'Path' => '/',
276
- 'Max-Age' => '86400',
277
- 'Secure' => true
278
- ]),
279
- new SetCookie([
280
- 'Name' => 'baz',
281
- 'Value' => 'foobar',
282
- 'Domain' => 'example.com',
283
- 'Path' => '/',
284
- 'Max-Age' => '86400',
285
- 'Secure' => true
286
- ]),
287
- new SetCookie([
288
- 'Name' => 'test',
289
- 'Value' => '123',
290
- 'Domain' => 'www.foobar.com',
291
- 'Path' => '/path/',
292
- 'Discard' => true
293
- ]),
294
- new SetCookie([
295
- 'Name' => 'muppet',
296
- 'Value' => 'cookie_monster',
297
- 'Domain' => '.y.example.com',
298
- 'Path' => '/acme/',
299
- 'Expires' => time() + 86400
300
- ]),
301
- new SetCookie([
302
- 'Name' => 'googoo',
303
- 'Value' => 'gaga',
304
- 'Domain' => '.example.com',
305
- 'Path' => '/test/acme/',
306
- 'Max-Age' => 1500
307
- ])
308
- ];
309
-
310
- foreach ($bag as $cookie) {
311
- $this->jar->setCookie($cookie);
312
- }
313
-
314
- $request = new Request('GET', $url);
315
- $request = $this->jar->withCookieHeader($request);
316
- $this->assertEquals($cookies, $request->getHeaderLine('Cookie'));
317
- }
318
-
319
- /**
320
- * @expectedException \RuntimeException
321
- * @expectedExceptionMessage Invalid cookie: Cookie name must not contain invalid characters: ASCII Control characters (0-31;127), space, tab and the following characters: ()<>@,;:\"/?={}
322
- */
323
- public function testThrowsExceptionWithStrictMode()
324
- {
325
- $a = new CookieJar(true);
326
- $a->setCookie(new SetCookie(['Name' => "abc\n", 'Value' => 'foo', 'Domain' => 'bar']));
327
- }
328
-
329
- public function testDeletesCookiesByName()
330
- {
331
- $cookies = $this->getTestCookies();
332
- $cookies[] = new SetCookie([
333
- 'Name' => 'other',
334
- 'Value' => '123',
335
- 'Domain' => 'bar.com',
336
- 'Path' => '/boo',
337
- 'Expires' => time() + 1000
338
- ]);
339
- $jar = new CookieJar();
340
- foreach ($cookies as $cookie) {
341
- $jar->setCookie($cookie);
342
- }
343
- $this->assertCount(4, $jar);
344
- $jar->clear('bar.com', '/boo', 'other');
345
- $this->assertCount(3, $jar);
346
- $names = array_map(function (SetCookie $c) {
347
- return $c->getName();
348
- }, $jar->getIterator()->getArrayCopy());
349
- $this->assertEquals(['foo', 'test', 'you'], $names);
350
- }
351
-
352
- public function testCanConvertToAndLoadFromArray()
353
- {
354
- $jar = new CookieJar(true);
355
- foreach ($this->getTestCookies() as $cookie) {
356
- $jar->setCookie($cookie);
357
- }
358
- $this->assertCount(3, $jar);
359
- $arr = $jar->toArray();
360
- $this->assertCount(3, $arr);
361
- $newCookieJar = new CookieJar(false, $arr);
362
- $this->assertCount(3, $newCookieJar);
363
- $this->assertSame($jar->toArray(), $newCookieJar->toArray());
364
- }
365
-
366
- public function testAddsCookiesWithEmptyPathFromResponse()
367
- {
368
- $response = new Response(200, array(
369
- 'Set-Cookie' => "fpc=foobar; expires=Fri, 02-Mar-2019 02:17:40 GMT; path=;"
370
- ));
371
- $request = new Request('GET', 'http://www.example.com');
372
- $this->jar->extractCookies($request, $response);
373
- $newRequest = $this->jar->withCookieHeader(new Request('GET', 'http://www.example.com/foo'));
374
- $this->assertTrue($newRequest->hasHeader('Cookie'));
375
- }
376
-
377
- public function getCookiePathsDataProvider()
378
- {
379
- return [
380
- ['', '/'],
381
- ['/', '/'],
382
- ['/foo', '/'],
383
- ['/foo/bar', '/foo'],
384
- ['/foo/bar/', '/foo/bar'],
385
- ['foo', '/'],
386
- ['foo/bar', '/'],
387
- ['foo/bar/', '/'],
388
- ];
389
- }
390
-
391
- /**
392
- * @dataProvider getCookiePathsDataProvider
393
- */
394
- public function testCookiePathWithEmptySetCookiePath($uriPath, $cookiePath)
395
- {
396
- $response = (new Response(200))
397
- ->withAddedHeader('Set-Cookie', "foo=bar; expires=Fri, 02-Mar-2019 02:17:40 GMT; domain=www.example.com; path=;")
398
- ->withAddedHeader('Set-Cookie', "bar=foo; expires=Fri, 02-Mar-2019 02:17:40 GMT; domain=www.example.com; path=foobar;")
399
- ;
400
- $request = (new Request('GET', $uriPath))->withHeader('Host', 'www.example.com');
401
- $this->jar->extractCookies($request, $response);
402
-
403
- $this->assertEquals($cookiePath, $this->jar->toArray()[0]['Path']);
404
- $this->assertEquals($cookiePath, $this->jar->toArray()[1]['Path']);
405
- }
406
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Cookie/FileCookieJarTest.php DELETED
@@ -1,88 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\CookieJar;
3
-
4
- use GuzzleHttp\Cookie\FileCookieJar;
5
- use GuzzleHttp\Cookie\SetCookie;
6
- use PHPUnit\Framework\TestCase;
7
-
8
- /**
9
- * @covers GuzzleHttp\Cookie\FileCookieJar
10
- */
11
- class FileCookieJarTest extends TestCase
12
- {
13
- private $file;
14
-
15
- public function setUp()
16
- {
17
- $this->file = tempnam('/tmp', 'file-cookies');
18
- }
19
-
20
- /**
21
- * @expectedException \RuntimeException
22
- */
23
- public function testValidatesCookieFile()
24
- {
25
- file_put_contents($this->file, 'true');
26
- new FileCookieJar($this->file);
27
- }
28
-
29
- public function testLoadsFromFile()
30
- {
31
- $jar = new FileCookieJar($this->file);
32
- $this->assertEquals([], $jar->getIterator()->getArrayCopy());
33
- unlink($this->file);
34
- }
35
-
36
- /**
37
- * @dataProvider testPersistsToFileFileParameters
38
- */
39
- public function testPersistsToFile($testSaveSessionCookie = false)
40
- {
41
- $jar = new FileCookieJar($this->file, $testSaveSessionCookie);
42
- $jar->setCookie(new SetCookie([
43
- 'Name' => 'foo',
44
- 'Value' => 'bar',
45
- 'Domain' => 'foo.com',
46
- 'Expires' => time() + 1000
47
- ]));
48
- $jar->setCookie(new SetCookie([
49
- 'Name' => 'baz',
50
- 'Value' => 'bar',
51
- 'Domain' => 'foo.com',
52
- 'Expires' => time() + 1000
53
- ]));
54
- $jar->setCookie(new SetCookie([
55
- 'Name' => 'boo',
56
- 'Value' => 'bar',
57
- 'Domain' => 'foo.com',
58
- ]));
59
-
60
- $this->assertCount(3, $jar);
61
- unset($jar);
62
-
63
- // Make sure it wrote to the file
64
- $contents = file_get_contents($this->file);
65
- $this->assertNotEmpty($contents);
66
-
67
- // Load the cookieJar from the file
68
- $jar = new FileCookieJar($this->file);
69
-
70
- if ($testSaveSessionCookie) {
71
- $this->assertCount(3, $jar);
72
- } else {
73
- // Weeds out temporary and session cookies
74
- $this->assertCount(2, $jar);
75
- }
76
-
77
- unset($jar);
78
- unlink($this->file);
79
- }
80
-
81
- public function testPersistsToFileFileParameters()
82
- {
83
- return array(
84
- array(false),
85
- array(true)
86
- );
87
- }
88
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Cookie/SessionCookieJarTest.php DELETED
@@ -1,92 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\CookieJar;
3
-
4
- use GuzzleHttp\Cookie\SessionCookieJar;
5
- use GuzzleHttp\Cookie\SetCookie;
6
- use PHPUnit\Framework\TestCase;
7
-
8
- /**
9
- * @covers GuzzleHttp\Cookie\SessionCookieJar
10
- */
11
- class SessionCookieJarTest extends TestCase
12
- {
13
- private $sessionVar;
14
-
15
- public function setUp()
16
- {
17
- $this->sessionVar = 'sessionKey';
18
-
19
- if (!isset($_SESSION)) {
20
- $_SESSION = array();
21
- }
22
- }
23
-
24
- /**
25
- * @expectedException \RuntimeException
26
- */
27
- public function testValidatesCookieSession()
28
- {
29
- $_SESSION[$this->sessionVar] = 'true';
30
- new SessionCookieJar($this->sessionVar);
31
- }
32
-
33
- public function testLoadsFromSession()
34
- {
35
- $jar = new SessionCookieJar($this->sessionVar);
36
- $this->assertEquals([], $jar->getIterator()->getArrayCopy());
37
- unset($_SESSION[$this->sessionVar]);
38
- }
39
-
40
- /**
41
- * @dataProvider testPersistsToSessionParameters
42
- */
43
- public function testPersistsToSession($testSaveSessionCookie = false)
44
- {
45
- $jar = new SessionCookieJar($this->sessionVar, $testSaveSessionCookie);
46
- $jar->setCookie(new SetCookie([
47
- 'Name' => 'foo',
48
- 'Value' => 'bar',
49
- 'Domain' => 'foo.com',
50
- 'Expires' => time() + 1000
51
- ]));
52
- $jar->setCookie(new SetCookie([
53
- 'Name' => 'baz',
54
- 'Value' => 'bar',
55
- 'Domain' => 'foo.com',
56
- 'Expires' => time() + 1000
57
- ]));
58
- $jar->setCookie(new SetCookie([
59
- 'Name' => 'boo',
60
- 'Value' => 'bar',
61
- 'Domain' => 'foo.com',
62
- ]));
63
-
64
- $this->assertCount(3, $jar);
65
- unset($jar);
66
-
67
- // Make sure it wrote to the sessionVar in $_SESSION
68
- $contents = $_SESSION[$this->sessionVar];
69
- $this->assertNotEmpty($contents);
70
-
71
- // Load the cookieJar from the file
72
- $jar = new SessionCookieJar($this->sessionVar);
73
-
74
- if ($testSaveSessionCookie) {
75
- $this->assertCount(3, $jar);
76
- } else {
77
- // Weeds out temporary and session cookies
78
- $this->assertCount(2, $jar);
79
- }
80
-
81
- unset($jar);
82
- unset($_SESSION[$this->sessionVar]);
83
- }
84
-
85
- public function testPersistsToSessionParameters()
86
- {
87
- return array(
88
- array(false),
89
- array(true)
90
- );
91
- }
92
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Cookie/SetCookieTest.php DELETED
@@ -1,445 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\CookieJar;
3
-
4
- use GuzzleHttp\Cookie\SetCookie;
5
- use PHPUnit\Framework\TestCase;
6
-
7
- /**
8
- * @covers GuzzleHttp\Cookie\SetCookie
9
- */
10
- class SetCookieTest extends TestCase
11
- {
12
- public function testInitializesDefaultValues()
13
- {
14
- $cookie = new SetCookie();
15
- $this->assertEquals('/', $cookie->getPath());
16
- }
17
-
18
- public function testConvertsDateTimeMaxAgeToUnixTimestamp()
19
- {
20
- $cookie = new SetCookie(['Expires' => 'November 20, 1984']);
21
- $this->assertInternalType('integer', $cookie->getExpires());
22
- }
23
-
24
- public function testAddsExpiresBasedOnMaxAge()
25
- {
26
- $t = time();
27
- $cookie = new SetCookie(['Max-Age' => 100]);
28
- $this->assertEquals($t + 100, $cookie->getExpires());
29
- }
30
-
31
- public function testHoldsValues()
32
- {
33
- $t = time();
34
- $data = array(
35
- 'Name' => 'foo',
36
- 'Value' => 'baz',
37
- 'Path' => '/bar',
38
- 'Domain' => 'baz.com',
39
- 'Expires' => $t,
40
- 'Max-Age' => 100,
41
- 'Secure' => true,
42
- 'Discard' => true,
43
- 'HttpOnly' => true,
44
- 'foo' => 'baz',
45
- 'bar' => 'bam'
46
- );
47
-
48
- $cookie = new SetCookie($data);
49
- $this->assertEquals($data, $cookie->toArray());
50
-
51
- $this->assertEquals('foo', $cookie->getName());
52
- $this->assertEquals('baz', $cookie->getValue());
53
- $this->assertEquals('baz.com', $cookie->getDomain());
54
- $this->assertEquals('/bar', $cookie->getPath());
55
- $this->assertEquals($t, $cookie->getExpires());
56
- $this->assertEquals(100, $cookie->getMaxAge());
57
- $this->assertTrue($cookie->getSecure());
58
- $this->assertTrue($cookie->getDiscard());
59
- $this->assertTrue($cookie->getHttpOnly());
60
- $this->assertEquals('baz', $cookie->toArray()['foo']);
61
- $this->assertEquals('bam', $cookie->toArray()['bar']);
62
-
63
- $cookie->setName('a');
64
- $cookie->setValue('b');
65
- $cookie->setPath('c');
66
- $cookie->setDomain('bar.com');
67
- $cookie->setExpires(10);
68
- $cookie->setMaxAge(200);
69
- $cookie->setSecure(false);
70
- $cookie->setHttpOnly(false);
71
- $cookie->setDiscard(false);
72
-
73
- $this->assertEquals('a', $cookie->getName());
74
- $this->assertEquals('b', $cookie->getValue());
75
- $this->assertEquals('c', $cookie->getPath());
76
- $this->assertEquals('bar.com', $cookie->getDomain());
77
- $this->assertEquals(10, $cookie->getExpires());
78
- $this->assertEquals(200, $cookie->getMaxAge());
79
- $this->assertFalse($cookie->getSecure());
80
- $this->assertFalse($cookie->getDiscard());
81
- $this->assertFalse($cookie->getHttpOnly());
82
- }
83
-
84
- public function testDeterminesIfExpired()
85
- {
86
- $c = new SetCookie();
87
- $c->setExpires(10);
88
- $this->assertTrue($c->isExpired());
89
- $c->setExpires(time() + 10000);
90
- $this->assertFalse($c->isExpired());
91
- }
92
-
93
- public function testMatchesDomain()
94
- {
95
- $cookie = new SetCookie();
96
- $this->assertTrue($cookie->matchesDomain('baz.com'));
97
-
98
- $cookie->setDomain('baz.com');
99
- $this->assertTrue($cookie->matchesDomain('baz.com'));
100
- $this->assertFalse($cookie->matchesDomain('bar.com'));
101
-
102
- $cookie->setDomain('.baz.com');
103
- $this->assertTrue($cookie->matchesDomain('.baz.com'));
104
- $this->assertTrue($cookie->matchesDomain('foo.baz.com'));
105
- $this->assertFalse($cookie->matchesDomain('baz.bar.com'));
106
- $this->assertTrue($cookie->matchesDomain('baz.com'));
107
-
108
- $cookie->setDomain('.127.0.0.1');
109
- $this->assertTrue($cookie->matchesDomain('127.0.0.1'));
110
-
111
- $cookie->setDomain('127.0.0.1');
112
- $this->assertTrue($cookie->matchesDomain('127.0.0.1'));
113
-
114
- $cookie->setDomain('.com.');
115
- $this->assertFalse($cookie->matchesDomain('baz.com'));
116
-
117
- $cookie->setDomain('.local');
118
- $this->assertTrue($cookie->matchesDomain('example.local'));
119
-
120
- $cookie->setDomain('example.com/'); // malformed domain
121
- $this->assertFalse($cookie->matchesDomain('example.com'));
122
- }
123
-
124
- public function pathMatchProvider()
125
- {
126
- return [
127
- ['/foo', '/foo', true],
128
- ['/foo', '/Foo', false],
129
- ['/foo', '/fo', false],
130
- ['/foo', '/foo/bar', true],
131
- ['/foo', '/foo/bar/baz', true],
132
- ['/foo', '/foo/bar//baz', true],
133
- ['/foo', '/foobar', false],
134
- ['/foo/bar', '/foo', false],
135
- ['/foo/bar', '/foobar', false],
136
- ['/foo/bar', '/foo/bar', true],
137
- ['/foo/bar', '/foo/bar/', true],
138
- ['/foo/bar', '/foo/bar/baz', true],
139
- ['/foo/bar/', '/foo/bar', false],
140
- ['/foo/bar/', '/foo/bar/', true],
141
- ['/foo/bar/', '/foo/bar/baz', true],
142
- ];
143
- }
144
-
145
- /**
146
- * @dataProvider pathMatchProvider
147
- */
148
- public function testMatchesPath($cookiePath, $requestPath, $isMatch)
149
- {
150
- $cookie = new SetCookie();
151
- $cookie->setPath($cookiePath);
152
- $this->assertEquals($isMatch, $cookie->matchesPath($requestPath));
153
- }
154
-
155
- public function cookieValidateProvider()
156
- {
157
- return array(
158
- array('foo', 'baz', 'bar', true),
159
- array('0', '0', '0', true),
160
- array('foo[bar]', 'baz', 'bar', true),
161
- array('', 'baz', 'bar', 'The cookie name must not be empty'),
162
- array('foo', '', 'bar', 'The cookie value must not be empty'),
163
- array('foo', 'baz', '', 'The cookie domain must not be empty'),
164
- array("foo\r", 'baz', '0', 'Cookie name must not contain invalid characters: ASCII Control characters (0-31;127), space, tab and the following characters: ()<>@,;:\"/?={}'),
165
- );
166
- }
167
-
168
- /**
169
- * @dataProvider cookieValidateProvider
170
- */
171
- public function testValidatesCookies($name, $value, $domain, $result)
172
- {
173
- $cookie = new SetCookie(array(
174
- 'Name' => $name,
175
- 'Value' => $value,
176
- 'Domain' => $domain
177
- ));
178
- $this->assertSame($result, $cookie->validate());
179
- }
180
-
181
- public function testDoesNotMatchIp()
182
- {
183
- $cookie = new SetCookie(['Domain' => '192.168.16.']);
184
- $this->assertFalse($cookie->matchesDomain('192.168.16.121'));
185
- }
186
-
187
- public function testConvertsToString()
188
- {
189
- $t = 1382916008;
190
- $cookie = new SetCookie([
191
- 'Name' => 'test',
192
- 'Value' => '123',
193
- 'Domain' => 'foo.com',
194
- 'Expires' => $t,
195
- 'Path' => '/abc',
196
- 'HttpOnly' => true,
197
- 'Secure' => true
198
- ]);
199
- $this->assertEquals(
200
- 'test=123; Domain=foo.com; Path=/abc; Expires=Sun, 27 Oct 2013 23:20:08 GMT; Secure; HttpOnly',
201
- (string) $cookie
202
- );
203
- }
204
-
205
- /**
206
- * Provides the parsed information from a cookie
207
- *
208
- * @return array
209
- */
210
- public function cookieParserDataProvider()
211
- {
212
- return array(
213
- array(
214
- 'ASIHTTPRequestTestCookie=This+is+the+value; expires=Sat, 26-Jul-2008 17:00:42 GMT; path=/tests; domain=allseeing-i.com; PHPSESSID=6c951590e7a9359bcedde25cda73e43c; path=/;',
215
- array(
216
- 'Domain' => 'allseeing-i.com',
217
- 'Path' => '/',
218
- 'PHPSESSID' => '6c951590e7a9359bcedde25cda73e43c',
219
- 'Max-Age' => null,
220
- 'Expires' => 'Sat, 26-Jul-2008 17:00:42 GMT',
221
- 'Secure' => null,
222
- 'Discard' => null,
223
- 'Name' => 'ASIHTTPRequestTestCookie',
224
- 'Value' => 'This+is+the+value',
225
- 'HttpOnly' => false
226
- )
227
- ),
228
- array('', []),
229
- array('foo', []),
230
- array('; foo', []),
231
- array(
232
- 'foo="bar"',
233
- [
234
- 'Name' => 'foo',
235
- 'Value' => '"bar"',
236
- 'Discard' => null,
237
- 'Domain' => null,
238
- 'Expires' => null,
239
- 'Max-Age' => null,
240
- 'Path' => '/',
241
- 'Secure' => null,
242
- 'HttpOnly' => false
243
- ]
244
- ),
245
- // Test setting a blank value for a cookie
246
- array(array(
247
- 'foo=', 'foo =', 'foo =;', 'foo= ;', 'foo =', 'foo= '),
248
- array(
249
- 'Name' => 'foo',
250
- 'Value' => '',
251
- 'Discard' => null,
252
- 'Domain' => null,
253
- 'Expires' => null,
254
- 'Max-Age' => null,
255
- 'Path' => '/',
256
- 'Secure' => null,
257
- 'HttpOnly' => false
258
- )
259
- ),
260
- // Test setting a value and removing quotes
261
- array(array(
262
- 'foo=1', 'foo =1', 'foo =1;', 'foo=1 ;', 'foo =1', 'foo= 1', 'foo = 1 ;'),
263
- array(
264
- 'Name' => 'foo',
265
- 'Value' => '1',
266
- 'Discard' => null,
267
- 'Domain' => null,
268
- 'Expires' => null,
269
- 'Max-Age' => null,
270
- 'Path' => '/',
271
- 'Secure' => null,
272
- 'HttpOnly' => false
273
- )
274
- ),
275
- // Some of the following tests are based on http://framework.zend.com/svn/framework/standard/trunk/tests/Zend/Http/CookieTest.php
276
- array(
277
- 'justacookie=foo; domain=example.com',
278
- array(
279
- 'Name' => 'justacookie',
280
- 'Value' => 'foo',
281
- 'Domain' => 'example.com',
282
- 'Discard' => null,
283
- 'Expires' => null,
284
- 'Max-Age' => null,
285
- 'Path' => '/',
286
- 'Secure' => null,
287
- 'HttpOnly' => false
288
- )
289
- ),
290
- array(
291
- 'expires=tomorrow; secure; path=/Space Out/; expires=Tue, 21-Nov-2006 08:33:44 GMT; domain=.example.com',
292
- array(
293
- 'Name' => 'expires',
294
- 'Value' => 'tomorrow',
295
- 'Domain' => '.example.com',
296
- 'Path' => '/Space Out/',
297
- 'Expires' => 'Tue, 21-Nov-2006 08:33:44 GMT',
298
- 'Discard' => null,
299
- 'Secure' => true,
300
- 'Max-Age' => null,
301
- 'HttpOnly' => false
302
- )
303
- ),
304
- array(
305
- 'domain=unittests; expires=Tue, 21-Nov-2006 08:33:44 GMT; domain=example.com; path=/some value/',
306
- array(
307
- 'Name' => 'domain',
308
- 'Value' => 'unittests',
309
- 'Domain' => 'example.com',
310
- 'Path' => '/some value/',
311
- 'Expires' => 'Tue, 21-Nov-2006 08:33:44 GMT',
312
- 'Secure' => false,
313
- 'Discard' => null,
314
- 'Max-Age' => null,
315
- 'HttpOnly' => false
316
- )
317
- ),
318
- array(
319
- 'path=indexAction; path=/; domain=.foo.com; expires=Tue, 21-Nov-2006 08:33:44 GMT',
320
- array(
321
- 'Name' => 'path',
322
- 'Value' => 'indexAction',
323
- 'Domain' => '.foo.com',
324
- 'Path' => '/',
325
- 'Expires' => 'Tue, 21-Nov-2006 08:33:44 GMT',
326
- 'Secure' => false,
327
- 'Discard' => null,
328
- 'Max-Age' => null,
329
- 'HttpOnly' => false
330
- )
331
- ),
332
- array(
333
- 'secure=sha1; secure; SECURE; domain=some.really.deep.domain.com; version=1; Max-Age=86400',
334
- array(
335
- 'Name' => 'secure',
336
- 'Value' => 'sha1',
337
- 'Domain' => 'some.really.deep.domain.com',
338
- 'Path' => '/',
339
- 'Secure' => true,
340
- 'Discard' => null,
341
- 'Expires' => time() + 86400,
342
- 'Max-Age' => 86400,
343
- 'HttpOnly' => false,
344
- 'version' => '1'
345
- )
346
- ),
347
- array(
348
- 'PHPSESSID=123456789+abcd%2Cef; secure; discard; domain=.localdomain; path=/foo/baz; expires=Tue, 21-Nov-2006 08:33:44 GMT;',
349
- array(
350
- 'Name' => 'PHPSESSID',
351
- 'Value' => '123456789+abcd%2Cef',
352
- 'Domain' => '.localdomain',
353
- 'Path' => '/foo/baz',
354
- 'Expires' => 'Tue, 21-Nov-2006 08:33:44 GMT',
355
- 'Secure' => true,
356
- 'Discard' => true,
357
- 'Max-Age' => null,
358
- 'HttpOnly' => false
359
- )
360
- ),
361
- );
362
- }
363
-
364
- /**
365
- * @dataProvider cookieParserDataProvider
366
- */
367
- public function testParseCookie($cookie, $parsed)
368
- {
369
- foreach ((array) $cookie as $v) {
370
- $c = SetCookie::fromString($v);
371
- $p = $c->toArray();
372
-
373
- if (isset($p['Expires'])) {
374
- // Remove expires values from the assertion if they are relatively equal
375
- if (abs($p['Expires'] != strtotime($parsed['Expires'])) < 40) {
376
- unset($p['Expires']);
377
- unset($parsed['Expires']);
378
- }
379
- }
380
-
381
- if (!empty($parsed)) {
382
- foreach ($parsed as $key => $value) {
383
- $this->assertEquals($parsed[$key], $p[$key], 'Comparing ' . $key . ' ' . var_export($value, true) . ' : ' . var_export($parsed, true) . ' | ' . var_export($p, true));
384
- }
385
- foreach ($p as $key => $value) {
386
- $this->assertEquals($p[$key], $parsed[$key], 'Comparing ' . $key . ' ' . var_export($value, true) . ' : ' . var_export($parsed, true) . ' | ' . var_export($p, true));
387
- }
388
- } else {
389
- $this->assertEquals([
390
- 'Name' => null,
391
- 'Value' => null,
392
- 'Domain' => null,
393
- 'Path' => '/',
394
- 'Max-Age' => null,
395
- 'Expires' => null,
396
- 'Secure' => false,
397
- 'Discard' => false,
398
- 'HttpOnly' => false,
399
- ], $p);
400
- }
401
- }
402
- }
403
-
404
- /**
405
- * Provides the data for testing isExpired
406
- *
407
- * @return array
408
- */
409
- public function isExpiredProvider()
410
- {
411
- return array(
412
- array(
413
- 'FOO=bar; expires=Thu, 01 Jan 1970 00:00:00 GMT;',
414
- true,
415
- ),
416
- array(
417
- 'FOO=bar; expires=Thu, 01 Jan 1970 00:00:01 GMT;',
418
- true,
419
- ),
420
- array(
421
- 'FOO=bar; expires='.date(\DateTime::RFC1123, time()+10).';',
422
- false,
423
- ),
424
- array(
425
- 'FOO=bar; expires='.date(\DateTime::RFC1123, time()-10).';',
426
- true,
427
- ),
428
- array(
429
- 'FOO=bar;',
430
- false,
431
- ),
432
- );
433
- }
434
-
435
- /**
436
- * @dataProvider isExpiredProvider
437
- */
438
- public function testIsExpired($cookie, $expired)
439
- {
440
- $this->assertEquals(
441
- $expired,
442
- SetCookie::fromString($cookie)->isExpired()
443
- );
444
- }
445
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Exception/ConnectExceptionTest.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\Event;
3
-
4
- use GuzzleHttp\Exception\ConnectException;
5
- use GuzzleHttp\Psr7\Request;
6
- use PHPUnit\Framework\TestCase;
7
-
8
- /**
9
- * @covers GuzzleHttp\Exception\ConnectException
10
- */
11
- class ConnectExceptionTest extends TestCase
12
- {
13
- public function testHasNoResponse()
14
- {
15
- $req = new Request('GET', '/');
16
- $prev = new \Exception();
17
- $e = new ConnectException('foo', $req, $prev, ['foo' => 'bar']);
18
- $this->assertSame($req, $e->getRequest());
19
- $this->assertNull($e->getResponse());
20
- $this->assertFalse($e->hasResponse());
21
- $this->assertEquals('foo', $e->getMessage());
22
- $this->assertEquals('bar', $e->getHandlerContext()['foo']);
23
- $this->assertSame($prev, $e->getPrevious());
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Exception/RequestExceptionTest.php DELETED
@@ -1,177 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\Event;
3
-
4
- use GuzzleHttp\Exception\RequestException;
5
- use GuzzleHttp\Psr7\Request;
6
- use GuzzleHttp\Psr7\Response;
7
- use PHPUnit\Framework\TestCase;
8
-
9
- /**
10
- * @covers GuzzleHttp\Exception\RequestException
11
- */
12
- class RequestExceptionTest extends TestCase
13
- {
14
- public function testHasRequestAndResponse()
15
- {
16
- $req = new Request('GET', '/');
17
- $res = new Response(200);
18
- $e = new RequestException('foo', $req, $res);
19
- $this->assertSame($req, $e->getRequest());
20
- $this->assertSame($res, $e->getResponse());
21
- $this->assertTrue($e->hasResponse());
22
- $this->assertEquals('foo', $e->getMessage());
23
- }
24
-
25
- public function testCreatesGenerateException()
26
- {
27
- $e = RequestException::create(new Request('GET', '/'));
28
- $this->assertEquals('Error completing request', $e->getMessage());
29
- $this->assertInstanceOf('GuzzleHttp\Exception\RequestException', $e);
30
- }
31
-
32
- public function testCreatesClientErrorResponseException()
33
- {
34
- $e = RequestException::create(new Request('GET', '/'), new Response(400));
35
- $this->assertContains(
36
- 'GET /',
37
- $e->getMessage()
38
- );
39
- $this->assertContains(
40
- '400 Bad Request',
41
- $e->getMessage()
42
- );
43
- $this->assertInstanceOf('GuzzleHttp\Exception\ClientException', $e);
44
- }
45
-
46
- public function testCreatesServerErrorResponseException()
47
- {
48
- $e = RequestException::create(new Request('GET', '/'), new Response(500));
49
- $this->assertContains(
50
- 'GET /',
51
- $e->getMessage()
52
- );
53
- $this->assertContains(
54
- '500 Internal Server Error',
55
- $e->getMessage()
56
- );
57
- $this->assertInstanceOf('GuzzleHttp\Exception\ServerException', $e);
58
- }
59
-
60
- public function testCreatesGenericErrorResponseException()
61
- {
62
- $e = RequestException::create(new Request('GET', '/'), new Response(600));
63
- $this->assertContains(
64
- 'GET /',
65
- $e->getMessage()
66
- );
67
- $this->assertContains(
68
- '600 ',
69
- $e->getMessage()
70
- );
71
- $this->assertInstanceOf('GuzzleHttp\Exception\RequestException', $e);
72
- }
73
-
74
- public function dataPrintableResponses()
75
- {
76
- return [
77
- ['You broke the test!'],
78
- ['<h1>zlomený zkouška</h1>'],
79
- ['{"tester": "Philépe Gonzalez"}'],
80
- ["<xml>\n\t<text>Your friendly test</text>\n</xml>"],
81
- ['document.body.write("here comes a test");'],
82
- ["body:before {\n\tcontent: 'test style';\n}"],
83
- ];
84
- }
85
-
86
- /**
87
- * @dataProvider dataPrintableResponses
88
- */
89
- public function testCreatesExceptionWithPrintableBodySummary($content)
90
- {
91
- $response = new Response(
92
- 500,
93
- [],
94
- $content
95
- );
96
- $e = RequestException::create(new Request('GET', '/'), $response);
97
- $this->assertContains(
98
- $content,
99
- $e->getMessage()
100
- );
101
- $this->assertInstanceOf('GuzzleHttp\Exception\RequestException', $e);
102
- }
103
-
104
- public function testCreatesExceptionWithTruncatedSummary()
105
- {
106
- $content = str_repeat('+', 121);
107
- $response = new Response(500, [], $content);
108
- $e = RequestException::create(new Request('GET', '/'), $response);
109
- $expected = str_repeat('+', 120) . ' (truncated...)';
110
- $this->assertContains($expected, $e->getMessage());
111
- }
112
-
113
- public function testExceptionMessageIgnoresEmptyBody()
114
- {
115
- $e = RequestException::create(new Request('GET', '/'), new Response(500));
116
- $this->assertStringEndsWith('response', $e->getMessage());
117
- }
118
-
119
- public function testCreatesExceptionWithoutPrintableBody()
120
- {
121
- $response = new Response(
122
- 500,
123
- ['Content-Type' => 'image/gif'],
124
- $content = base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7') // 1x1 gif
125
- );
126
- $e = RequestException::create(new Request('GET', '/'), $response);
127
- $this->assertNotContains(
128
- $content,
129
- $e->getMessage()
130
- );
131
- $this->assertInstanceOf('GuzzleHttp\Exception\RequestException', $e);
132
- }
133
-
134
- public function testHasStatusCodeAsExceptionCode()
135
- {
136
- $e = RequestException::create(new Request('GET', '/'), new Response(442));
137
- $this->assertEquals(442, $e->getCode());
138
- }
139
-
140
- public function testWrapsRequestExceptions()
141
- {
142
- $e = new \Exception('foo');
143
- $r = new Request('GET', 'http://www.oo.com');
144
- $ex = RequestException::wrapException($r, $e);
145
- $this->assertInstanceOf('GuzzleHttp\Exception\RequestException', $ex);
146
- $this->assertSame($e, $ex->getPrevious());
147
- }
148
-
149
- public function testDoesNotWrapExistingRequestExceptions()
150
- {
151
- $r = new Request('GET', 'http://www.oo.com');
152
- $e = new RequestException('foo', $r);
153
- $e2 = RequestException::wrapException($r, $e);
154
- $this->assertSame($e, $e2);
155
- }
156
-
157
- public function testCanProvideHandlerContext()
158
- {
159
- $r = new Request('GET', 'http://www.oo.com');
160
- $e = new RequestException('foo', $r, null, null, ['bar' => 'baz']);
161
- $this->assertEquals(['bar' => 'baz'], $e->getHandlerContext());
162
- }
163
-
164
- public function testObfuscateUrlWithUsername()
165
- {
166
- $r = new Request('GET', 'http://username@www.oo.com');
167
- $e = RequestException::create($r, new Response(500));
168
- $this->assertContains('http://username@www.oo.com', $e->getMessage());
169
- }
170
-
171
- public function testObfuscateUrlWithUsernameAndPassword()
172
- {
173
- $r = new Request('GET', 'http://user:password@www.oo.com');
174
- $e = RequestException::create($r, new Response(500));
175
- $this->assertContains('http://user:***@www.oo.com', $e->getMessage());
176
- }
177
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Exception/SeekExceptionTest.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\Exception;
3
-
4
- use GuzzleHttp\Exception\SeekException;
5
- use GuzzleHttp\Psr7;
6
- use PHPUnit\Framework\TestCase;
7
-
8
- class SeekExceptionTest extends TestCase
9
- {
10
- public function testHasStream()
11
- {
12
- $s = Psr7\stream_for('foo');
13
- $e = new SeekException($s, 10);
14
- $this->assertSame($s, $e->getStream());
15
- $this->assertContains('10', $e->getMessage());
16
- }
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Handler/CurlFactoryTest.php DELETED
@@ -1,743 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Test\Handler;
3
-
4
- use GuzzleHttp\Handler\CurlFactory;
5
- use GuzzleHttp\Handler\EasyHandle;
6
- use GuzzleHttp\Tests\Server;
7
- use GuzzleHttp\Handler;
8
- use GuzzleHttp\Psr7;
9
- use GuzzleHttp\TransferStats;
10
- use Psr\Http\Message\ResponseInterface;
11
- use PHPUnit\Framework\TestCase;
12
-
13
- /**
14
- * @covers \GuzzleHttp\Handler\CurlFactory
15
- */
16
- class CurlFactoryTest extends TestCase
17
- {
18
- public static function setUpBeforeClass()
19
- {
20
- $_SERVER['curl_test'] = true;
21
- unset($_SERVER['_curl']);
22
- }
23
-
24
- public static function tearDownAfterClass()
25
- {
26
- unset($_SERVER['_curl'], $_SERVER['curl_test']);
27
- }
28
-
29
- public function testCreatesCurlHandle()
30
- {
31
- Server::flush();
32
- Server::enqueue([
33
- new Psr7\Response(200, [
34
- 'Foo' => 'Bar',
35
- 'Baz' => 'bam',
36
- 'Content-Length' => 2,
37
- ], 'hi')
38
- ]);
39
- $stream = Psr7\stream_for();
40
- $request = new Psr7\Request('PUT', Server::$url, [
41
- 'Hi' => ' 123',
42
- 'Content-Length' => '7'
43
- ], 'testing');
44
- $f = new Handler\CurlFactory(3);
45
- $result = $f->create($request, ['sink' => $stream]);
46
- $this->assertInstanceOf(EasyHandle::class, $result);
47
- $this->assertInternalType('resource', $result->handle);
48
- $this->assertInternalType('array', $result->headers);
49
- $this->assertSame($stream, $result->sink);
50
- curl_close($result->handle);
51
- $this->assertEquals('PUT', $_SERVER['_curl'][CURLOPT_CUSTOMREQUEST]);
52
- $this->assertEquals(
53
- 'http://127.0.0.1:8126/',
54
- $_SERVER['_curl'][CURLOPT_URL]
55
- );
56
- // Sends via post fields when the request is small enough
57
- $this->assertEquals('testing', $_SERVER['_curl'][CURLOPT_POSTFIELDS]);
58
- $this->assertEquals(0, $_SERVER['_curl'][CURLOPT_RETURNTRANSFER]);
59
- $this->assertEquals(0, $_SERVER['_curl'][CURLOPT_HEADER]);
60
- $this->assertEquals(150, $_SERVER['_curl'][CURLOPT_CONNECTTIMEOUT]);
61
- $this->assertInstanceOf('Closure', $_SERVER['_curl'][CURLOPT_HEADERFUNCTION]);
62
- if (defined('CURLOPT_PROTOCOLS')) {
63
- $this->assertEquals(
64
- CURLPROTO_HTTP | CURLPROTO_HTTPS,
65
- $_SERVER['_curl'][CURLOPT_PROTOCOLS]
66
- );
67
- }
68
- $this->assertContains('Expect:', $_SERVER['_curl'][CURLOPT_HTTPHEADER]);
69
- $this->assertContains('Accept:', $_SERVER['_curl'][CURLOPT_HTTPHEADER]);
70
- $this->assertContains('Content-Type:', $_SERVER['_curl'][CURLOPT_HTTPHEADER]);
71
- $this->assertContains('Hi: 123', $_SERVER['_curl'][CURLOPT_HTTPHEADER]);
72
- $this->assertContains('Host: 127.0.0.1:8126', $_SERVER['_curl'][CURLOPT_HTTPHEADER]);
73
- }
74
-
75
- public function testSendsHeadRequests()
76
- {
77
- Server::flush();
78
- Server::enqueue([new Psr7\Response()]);
79
- $a = new Handler\CurlMultiHandler();
80
- $response = $a(new Psr7\Request('HEAD', Server::$url), []);
81
- $response->wait();
82
- $this->assertEquals(true, $_SERVER['_curl'][CURLOPT_NOBODY]);
83
- $checks = [CURLOPT_WRITEFUNCTION, CURLOPT_READFUNCTION, CURLOPT_INFILE];
84
- foreach ($checks as $check) {
85
- $this->assertArrayNotHasKey($check, $_SERVER['_curl']);
86
- }
87
- $this->assertEquals('HEAD', Server::received()[0]->getMethod());
88
- }
89
-
90
- public function testCanAddCustomCurlOptions()
91
- {
92
- Server::flush();
93
- Server::enqueue([new Psr7\Response()]);
94
- $a = new Handler\CurlMultiHandler();
95
- $req = new Psr7\Request('GET', Server::$url);
96
- $a($req, ['curl' => [CURLOPT_LOW_SPEED_LIMIT => 10]]);
97
- $this->assertEquals(10, $_SERVER['_curl'][CURLOPT_LOW_SPEED_LIMIT]);
98
- }
99
-
100
- public function testCanChangeCurlOptions()
101
- {
102
- Server::flush();
103
- Server::enqueue([new Psr7\Response()]);
104
- $a = new Handler\CurlMultiHandler();
105
- $req = new Psr7\Request('GET', Server::$url);
106
- $a($req, ['curl' => [CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0]]);
107
- $this->assertEquals(CURL_HTTP_VERSION_1_0, $_SERVER['_curl'][CURLOPT_HTTP_VERSION]);
108
- }
109
-
110
- /**
111
- * @expectedException \InvalidArgumentException
112
- * @expectedExceptionMessage SSL CA bundle not found: /does/not/exist
113
- */
114
- public function testValidatesVerify()
115
- {
116
- $f = new Handler\CurlFactory(3);
117
- $f->create(new Psr7\Request('GET', Server::$url), ['verify' => '/does/not/exist']);
118
- }
119
-
120
- public function testCanSetVerifyToFile()
121
- {
122
- $f = new Handler\CurlFactory(3);
123
- $f->create(new Psr7\Request('GET', 'http://foo.com'), ['verify' => __FILE__]);
124
- $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_CAINFO]);
125
- $this->assertEquals(2, $_SERVER['_curl'][CURLOPT_SSL_VERIFYHOST]);
126
- $this->assertEquals(true, $_SERVER['_curl'][CURLOPT_SSL_VERIFYPEER]);
127
- }
128
-
129
- public function testCanSetVerifyToDir()
130
- {
131
- $f = new Handler\CurlFactory(3);
132
- $f->create(new Psr7\Request('GET', 'http://foo.com'), ['verify' => __DIR__]);
133
- $this->assertEquals(__DIR__, $_SERVER['_curl'][CURLOPT_CAPATH]);
134
- $this->assertEquals(2, $_SERVER['_curl'][CURLOPT_SSL_VERIFYHOST]);
135
- $this->assertEquals(true, $_SERVER['_curl'][CURLOPT_SSL_VERIFYPEER]);
136
- }
137
-
138
- public function testAddsVerifyAsTrue()
139
- {
140
- $f = new Handler\CurlFactory(3);
141
- $f->create(new Psr7\Request('GET', Server::$url), ['verify' => true]);
142
- $this->assertEquals(2, $_SERVER['_curl'][CURLOPT_SSL_VERIFYHOST]);
143
- $this->assertEquals(true, $_SERVER['_curl'][CURLOPT_SSL_VERIFYPEER]);
144
- $this->assertArrayNotHasKey(CURLOPT_CAINFO, $_SERVER['_curl']);
145
- }
146
-
147
- public function testCanDisableVerify()
148
- {
149
- $f = new Handler\CurlFactory(3);
150
- $f->create(new Psr7\Request('GET', Server::$url), ['verify' => false]);
151
- $this->assertEquals(0, $_SERVER['_curl'][CURLOPT_SSL_VERIFYHOST]);
152
- $this->assertEquals(false, $_SERVER['_curl'][CURLOPT_SSL_VERIFYPEER]);
153
- }
154
-
155
- public function testAddsProxy()
156
- {
157
- $f = new Handler\CurlFactory(3);
158
- $f->create(new Psr7\Request('GET', Server::$url), ['proxy' => 'http://bar.com']);
159
- $this->assertEquals('http://bar.com', $_SERVER['_curl'][CURLOPT_PROXY]);
160
- }
161
-
162
- public function testAddsViaScheme()
163
- {
164
- $f = new Handler\CurlFactory(3);
165
- $f->create(new Psr7\Request('GET', Server::$url), [
166
- 'proxy' => ['http' => 'http://bar.com', 'https' => 'https://t'],
167
- ]);
168
- $this->assertEquals('http://bar.com', $_SERVER['_curl'][CURLOPT_PROXY]);
169
- $this->checkNoProxyForHost('http://test.test.com', ['test.test.com'], false);
170
- $this->checkNoProxyForHost('http://test.test.com', ['.test.com'], false);
171
- $this->checkNoProxyForHost('http://test.test.com', ['*.test.com'], true);
172
- $this->checkNoProxyForHost('http://test.test.com', ['*'], false);
173
- $this->checkNoProxyForHost('http://127.0.0.1', ['127.0.0.*'], true);
174
- }
175
-
176
- private function checkNoProxyForHost($url, $noProxy, $assertUseProxy)
177
- {
178
- $f = new Handler\CurlFactory(3);
179
- $f->create(new Psr7\Request('GET', $url), [
180
- 'proxy' => [
181
- 'http' => 'http://bar.com',
182
- 'https' => 'https://t',
183
- 'no' => $noProxy
184
- ],
185
- ]);
186
- if ($assertUseProxy) {
187
- $this->assertArrayHasKey(CURLOPT_PROXY, $_SERVER['_curl']);
188
- } else {
189
- $this->assertArrayNotHasKey(CURLOPT_PROXY, $_SERVER['_curl']);
190
- }
191
- }
192
-
193
-
194
- /**
195
- * @expectedException \InvalidArgumentException
196
- * @expectedExceptionMessage SSL private key not found: /does/not/exist
197
- */
198
- public function testValidatesSslKey()
199
- {
200
- $f = new Handler\CurlFactory(3);
201
- $f->create(new Psr7\Request('GET', Server::$url), ['ssl_key' => '/does/not/exist']);
202
- }
203
-
204
- public function testAddsSslKey()
205
- {
206
- $f = new Handler\CurlFactory(3);
207
- $f->create(new Psr7\Request('GET', Server::$url), ['ssl_key' => __FILE__]);
208
- $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_SSLKEY]);
209
- }
210
-
211
- public function testAddsSslKeyWithPassword()
212
- {
213
- $f = new Handler\CurlFactory(3);
214
- $f->create(new Psr7\Request('GET', Server::$url), ['ssl_key' => [__FILE__, 'test']]);
215
- $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_SSLKEY]);
216
- $this->assertEquals('test', $_SERVER['_curl'][CURLOPT_SSLKEYPASSWD]);
217
- }
218
-
219
- /**
220
- * @expectedException \InvalidArgumentException
221
- * @expectedExceptionMessage SSL certificate not found: /does/not/exist
222
- */
223
- public function testValidatesCert()
224
- {
225
- $f = new Handler\CurlFactory(3);
226
- $f->create(new Psr7\Request('GET', Server::$url), ['cert' => '/does/not/exist']);
227
- }
228
-
229
- public function testAddsCert()
230
- {
231
- $f = new Handler\CurlFactory(3);
232
- $f->create(new Psr7\Request('GET', Server::$url), ['cert' => __FILE__]);
233
- $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_SSLCERT]);
234
- }
235
-
236
- public function testAddsCertWithPassword()
237
- {
238
- $f = new Handler\CurlFactory(3);
239
- $f->create(new Psr7\Request('GET', Server::$url), ['cert' => [__FILE__, 'test']]);
240
- $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_SSLCERT]);
241
- $this->assertEquals('test', $_SERVER['_curl'][CURLOPT_SSLCERTPASSWD]);
242
- }
243
-
244
- /**
245
- * @expectedException \InvalidArgumentException
246
- * @expectedExceptionMessage progress client option must be callable
247
- */
248
- public function testValidatesProgress()
249
- {
250
- $f = new Handler\CurlFactory(3);
251
- $f->create(new Psr7\Request('GET', Server::$url), ['progress' => 'foo']);
252
- }
253
-
254
- public function testEmitsDebugInfoToStream()
255
- {
256
- $res = fopen('php://memory', 'r+');
257
- Server::flush();
258
- Server::enqueue([new Psr7\Response()]);
259
- $a = new Handler\CurlMultiHandler();
260
- $response = $a(new Psr7\Request('HEAD', Server::$url), ['debug' => $res]);
261
- $response->wait();
262
- rewind($res);
263
- $output = str_replace("\r", '', stream_get_contents($res));
264
- $this->assertContains("> HEAD / HTTP/1.1", $output);
265
- $this->assertContains("< HTTP/1.1 200", $output);
266
- fclose($res);
267
- }
268
-
269
- public function testEmitsProgressToFunction()
270
- {
271
- Server::flush();
272
- Server::enqueue([new Psr7\Response()]);
273
- $a = new Handler\CurlMultiHandler();
274
- $called = [];
275
- $request = new Psr7\Request('HEAD', Server::$url);
276
- $response = $a($request, [
277
- 'progress' => function () use (&$called) {
278
- $called[] = func_get_args();
279
- },
280
- ]);
281
- $response->wait();
282
- $this->assertNotEmpty($called);
283
- foreach ($called as $call) {
284
- $this->assertCount(4, $call);
285
- }
286
- }
287
-
288
- private function addDecodeResponse($withEncoding = true)
289
- {
290
- $content = gzencode('test');
291
- $headers = ['Content-Length' => strlen($content)];
292
- if ($withEncoding) {
293
- $headers['Content-Encoding'] = 'gzip';
294
- }
295
- $response = new Psr7\Response(200, $headers, $content);
296
- Server::flush();
297
- Server::enqueue([$response]);
298
- return $content;
299
- }
300
-
301
- public function testDecodesGzippedResponses()
302
- {
303
- $this->addDecodeResponse();
304
- $handler = new Handler\CurlMultiHandler();
305
- $request = new Psr7\Request('GET', Server::$url);
306
- $response = $handler($request, ['decode_content' => true]);
307
- $response = $response->wait();
308
- $this->assertEquals('test', (string) $response->getBody());
309
- $this->assertEquals('', $_SERVER['_curl'][CURLOPT_ENCODING]);
310
- $sent = Server::received()[0];
311
- $this->assertFalse($sent->hasHeader('Accept-Encoding'));
312
- }
313
-
314
- public function testReportsOriginalSizeAndContentEncodingAfterDecoding()
315
- {
316
- $this->addDecodeResponse();
317
- $handler = new Handler\CurlMultiHandler();
318
- $request = new Psr7\Request('GET', Server::$url);
319
- $response = $handler($request, ['decode_content' => true]);
320
- $response = $response->wait();
321
- $this->assertSame(
322
- 'gzip',
323
- $response->getHeaderLine('x-encoded-content-encoding')
324
- );
325
- $this->assertSame(
326
- strlen(gzencode('test')),
327
- (int) $response->getHeaderLine('x-encoded-content-length')
328
- );
329
- }
330
-
331
- public function testDecodesGzippedResponsesWithHeader()
332
- {
333
- $this->addDecodeResponse();
334
- $handler = new Handler\CurlMultiHandler();
335
- $request = new Psr7\Request('GET', Server::$url, ['Accept-Encoding' => 'gzip']);
336
- $response = $handler($request, ['decode_content' => true]);
337
- $response = $response->wait();
338
- $this->assertEquals('gzip', $_SERVER['_curl'][CURLOPT_ENCODING]);
339
- $sent = Server::received()[0];
340
- $this->assertEquals('gzip', $sent->getHeaderLine('Accept-Encoding'));
341
- $this->assertEquals('test', (string) $response->getBody());
342
- $this->assertFalse($response->hasHeader('content-encoding'));
343
- $this->assertTrue(!$response->hasHeader('content-length') || $response->getHeaderLine('content-length') == $response->getBody()->getSize());
344
- }
345
-
346
- public function testDoesNotForceDecode()
347
- {
348
- $content = $this->addDecodeResponse();
349
- $handler = new Handler\CurlMultiHandler();
350
- $request = new Psr7\Request('GET', Server::$url);
351
- $response = $handler($request, ['decode_content' => false]);
352
- $response = $response->wait();
353
- $sent = Server::received()[0];
354
- $this->assertFalse($sent->hasHeader('Accept-Encoding'));
355
- $this->assertEquals($content, (string) $response->getBody());
356
- }
357
-
358
- public function testProtocolVersion()
359
- {
360
- Server::flush();
361
- Server::enqueue([new Psr7\Response()]);
362
- $a = new Handler\CurlMultiHandler();
363
- $request = new Psr7\Request('GET', Server::$url, [], null, '1.0');
364
- $a($request, []);
365
- $this->assertEquals(CURL_HTTP_VERSION_1_0, $_SERVER['_curl'][CURLOPT_HTTP_VERSION]);
366
- }
367
-
368
- public function testSavesToStream()
369
- {
370
- $stream = fopen('php://memory', 'r+');
371
- $this->addDecodeResponse();
372
- $handler = new Handler\CurlMultiHandler();
373
- $request = new Psr7\Request('GET', Server::$url);
374
- $response = $handler($request, [
375
- 'decode_content' => true,
376
- 'sink' => $stream,
377
- ]);
378
- $response->wait();
379
- rewind($stream);
380
- $this->assertEquals('test', stream_get_contents($stream));
381
- }
382
-
383
- public function testSavesToGuzzleStream()
384
- {
385
- $stream = Psr7\stream_for();
386
- $this->addDecodeResponse();
387
- $handler = new Handler\CurlMultiHandler();
388
- $request = new Psr7\Request('GET', Server::$url);
389
- $response = $handler($request, [
390
- 'decode_content' => true,
391
- 'sink' => $stream,
392
- ]);
393
- $response->wait();
394
- $this->assertEquals('test', (string) $stream);
395
- }
396
-
397
- public function testSavesToFileOnDisk()
398
- {
399
- $tmpfile = tempnam(sys_get_temp_dir(), 'testfile');
400
- $this->addDecodeResponse();
401
- $handler = new Handler\CurlMultiHandler();
402
- $request = new Psr7\Request('GET', Server::$url);
403
- $response = $handler($request, [
404
- 'decode_content' => true,
405
- 'sink' => $tmpfile,
406
- ]);
407
- $response->wait();
408
- $this->assertStringEqualsFile($tmpfile, 'test');
409
- unlink($tmpfile);
410
- }
411
-
412
- public function testDoesNotAddMultipleContentLengthHeaders()
413
- {
414
- $this->addDecodeResponse();
415
- $handler = new Handler\CurlMultiHandler();
416
- $request = new Psr7\Request('PUT', Server::$url, ['Content-Length' => 3], 'foo');
417
- $response = $handler($request, []);
418
- $response->wait();
419
- $sent = Server::received()[0];
420
- $this->assertEquals(3, $sent->getHeaderLine('Content-Length'));
421
- $this->assertFalse($sent->hasHeader('Transfer-Encoding'));
422
- $this->assertEquals('foo', (string) $sent->getBody());
423
- }
424
-
425
- public function testSendsPostWithNoBodyOrDefaultContentType()
426
- {
427
- Server::flush();
428
- Server::enqueue([new Psr7\Response()]);
429
- $handler = new Handler\CurlMultiHandler();
430
- $request = new Psr7\Request('POST', Server::$url);
431
- $response = $handler($request, []);
432
- $response->wait();
433
- $received = Server::received()[0];
434
- $this->assertEquals('POST', $received->getMethod());
435
- $this->assertFalse($received->hasHeader('content-type'));
436
- $this->assertSame('0', $received->getHeaderLine('content-length'));
437
- }
438
-
439
- /**
440
- * @expectedException \GuzzleHttp\Exception\RequestException
441
- * @expectedExceptionMessage but attempting to rewind the request body failed
442
- */
443
- public function testFailsWhenCannotRewindRetryAfterNoResponse()
444
- {
445
- $factory = new Handler\CurlFactory(1);
446
- $stream = Psr7\stream_for('abc');
447
- $stream->read(1);
448
- $stream = new Psr7\NoSeekStream($stream);
449
- $request = new Psr7\Request('PUT', Server::$url, [], $stream);
450
- $fn = function ($request, $options) use (&$fn, $factory) {
451
- $easy = $factory->create($request, $options);
452
- return Handler\CurlFactory::finish($fn, $easy, $factory);
453
- };
454
- $fn($request, [])->wait();
455
- }
456
-
457
- public function testRetriesWhenBodyCanBeRewound()
458
- {
459
- $callHandler = $called = false;
460
-
461
- $fn = function ($r, $options) use (&$callHandler) {
462
- $callHandler = true;
463
- return \GuzzleHttp\Promise\promise_for(new Psr7\Response());
464
- };
465
-
466
- $bd = Psr7\FnStream::decorate(Psr7\stream_for('test'), [
467
- 'tell' => function () { return 1; },
468
- 'rewind' => function () use (&$called) { $called = true; }
469
- ]);
470
-
471
- $factory = new Handler\CurlFactory(1);
472
- $req = new Psr7\Request('PUT', Server::$url, [], $bd);
473
- $easy = $factory->create($req, []);
474
- $res = Handler\CurlFactory::finish($fn, $easy, $factory);
475
- $res = $res->wait();
476
- $this->assertTrue($callHandler);
477
- $this->assertTrue($called);
478
- $this->assertEquals('200', $res->getStatusCode());
479
- }
480
-
481
- /**
482
- * @expectedException \GuzzleHttp\Exception\RequestException
483
- * @expectedExceptionMessage The cURL request was retried 3 times
484
- */
485
- public function testFailsWhenRetryMoreThanThreeTimes()
486
- {
487
- $factory = new Handler\CurlFactory(1);
488
- $call = 0;
489
- $fn = function ($request, $options) use (&$mock, &$call, $factory) {
490
- $call++;
491
- $easy = $factory->create($request, $options);
492
- return Handler\CurlFactory::finish($mock, $easy, $factory);
493
- };
494
- $mock = new Handler\MockHandler([$fn, $fn, $fn]);
495
- $p = $mock(new Psr7\Request('PUT', Server::$url, [], 'test'), []);
496
- $p->wait(false);
497
- $this->assertEquals(3, $call);
498
- $p->wait(true);
499
- }
500
-
501
- public function testHandles100Continue()
502
- {
503
- Server::flush();
504
- Server::enqueue([
505
- new Psr7\Response(200, ['Test' => 'Hello', 'Content-Length' => 4], 'test'),
506
- ]);
507
- $request = new Psr7\Request('PUT', Server::$url, [
508
- 'Expect' => '100-Continue'
509
- ], 'test');
510
- $handler = new Handler\CurlMultiHandler();
511
- $response = $handler($request, [])->wait();
512
- $this->assertEquals(200, $response->getStatusCode());
513
- $this->assertEquals('OK', $response->getReasonPhrase());
514
- $this->assertEquals('Hello', $response->getHeaderLine('Test'));
515
- $this->assertEquals('4', $response->getHeaderLine('Content-Length'));
516
- $this->assertEquals('test', (string) $response->getBody());
517
- }
518
-
519
- /**
520
- * @expectedException \GuzzleHttp\Exception\ConnectException
521
- */
522
- public function testCreatesConnectException()
523
- {
524
- $m = new \ReflectionMethod(CurlFactory::class, 'finishError');
525
- $m->setAccessible(true);
526
- $factory = new Handler\CurlFactory(1);
527
- $easy = $factory->create(new Psr7\Request('GET', Server::$url), []);
528
- $easy->errno = CURLE_COULDNT_CONNECT;
529
- $response = $m->invoke(
530
- null,
531
- function () {},
532
- $easy,
533
- $factory
534
- );
535
- $response->wait();
536
- }
537
-
538
- public function testAddsTimeouts()
539
- {
540
- $f = new Handler\CurlFactory(3);
541
- $f->create(new Psr7\Request('GET', Server::$url), [
542
- 'timeout' => 0.1,
543
- 'connect_timeout' => 0.2
544
- ]);
545
- $this->assertEquals(100, $_SERVER['_curl'][CURLOPT_TIMEOUT_MS]);
546
- $this->assertEquals(200, $_SERVER['_curl'][CURLOPT_CONNECTTIMEOUT_MS]);
547
- }
548
-
549
- public function testAddsStreamingBody()
550
- {
551
- $f = new Handler\CurlFactory(3);
552
- $bd = Psr7\FnStream::decorate(Psr7\stream_for('foo'), [
553
- 'getSize' => function () {
554
- return null;
555
- }
556
- ]);
557
- $request = new Psr7\Request('PUT', Server::$url, [], $bd);
558
- $f->create($request, []);
559
- $this->assertEquals(1, $_SERVER['_curl'][CURLOPT_UPLOAD]);
560
- $this->assertInternalType('callable', $_SERVER['_curl'][CURLOPT_READFUNCTION]);
561
- }
562
-
563
- /**
564
- * @expectedException \RuntimeException
565
- * @expectedExceptionMessage Directory /does/not/exist/so does not exist for sink value of /does/not/exist/so/error.txt
566
- */
567
- public function testEnsuresDirExistsBeforeThrowingWarning()
568
- {
569
- $f = new Handler\CurlFactory(3);
570
- $f->create(new Psr7\Request('GET', Server::$url), [
571
- 'sink' => '/does/not/exist/so/error.txt'
572
- ]);
573
- }
574
-
575
- public function testClosesIdleHandles()
576
- {
577
- $f = new Handler\CurlFactory(3);
578
- $req = new Psr7\Request('GET', Server::$url);
579
- $easy = $f->create($req, []);
580
- $h1 = $easy->handle;
581
- $f->release($easy);
582
- $this->assertCount(1, $this->readAttribute($f, 'handles'));
583
- $easy = $f->create($req, []);
584
- $this->assertSame($easy->handle, $h1);
585
- $easy2 = $f->create($req, []);
586
- $easy3 = $f->create($req, []);
587
- $easy4 = $f->create($req, []);
588
- $f->release($easy);
589
- $this->assertCount(1, $this->readAttribute($f, 'handles'));
590
- $f->release($easy2);
591
- $this->assertCount(2, $this->readAttribute($f, 'handles'));
592
- $f->release($easy3);
593
- $this->assertCount(3, $this->readAttribute($f, 'handles'));
594
- $f->release($easy4);
595
- $this->assertCount(3, $this->readAttribute($f, 'handles'));
596
- }
597
-
598
- /**
599
- * @expectedException \InvalidArgumentException
600
- */
601
- public function testEnsuresOnHeadersIsCallable()
602
- {
603
- $req = new Psr7\Request('GET', Server::$url);
604
- $handler = new Handler\CurlHandler();
605
- $handler($req, ['on_headers' => 'error!']);
606
- }
607
-
608
- /**
609
- * @expectedException \GuzzleHttp\Exception\RequestException
610
- * @expectedExceptionMessage An error was encountered during the on_headers event
611
- * @expectedExceptionMessage test
612
- */
613
- public function testRejectsPromiseWhenOnHeadersFails()
614
- {
615
- Server::flush();
616
- Server::enqueue([
617
- new Psr7\Response(200, ['X-Foo' => 'bar'], 'abc 123')
618
- ]);
619
- $req = new Psr7\Request('GET', Server::$url);
620
- $handler = new Handler\CurlHandler();
621
- $promise = $handler($req, [
622
- 'on_headers' => function () {
623
- throw new \Exception('test');
624
- }
625
- ]);
626
- $promise->wait();
627
- }
628
-
629
- public function testSuccessfullyCallsOnHeadersBeforeWritingToSink()
630
- {
631
- Server::flush();
632
- Server::enqueue([
633
- new Psr7\Response(200, ['X-Foo' => 'bar'], 'abc 123')
634
- ]);
635
- $req = new Psr7\Request('GET', Server::$url);
636
- $got = null;
637
-
638
- $stream = Psr7\stream_for();
639
- $stream = Psr7\FnStream::decorate($stream, [
640
- 'write' => function ($data) use ($stream, &$got) {
641
- $this->assertNotNull($got);
642
- return $stream->write($data);
643
- }
644
- ]);
645
-
646
- $handler = new Handler\CurlHandler();
647
- $promise = $handler($req, [
648
- 'sink' => $stream,
649
- 'on_headers' => function (ResponseInterface $res) use (&$got) {
650
- $got = $res;
651
- $this->assertEquals('bar', $res->getHeaderLine('X-Foo'));
652
- }
653
- ]);
654
-
655
- $response = $promise->wait();
656
- $this->assertEquals(200, $response->getStatusCode());
657
- $this->assertEquals('bar', $response->getHeaderLine('X-Foo'));
658
- $this->assertEquals('abc 123', (string) $response->getBody());
659
- }
660
-
661
- public function testInvokesOnStatsOnSuccess()
662
- {
663
- Server::flush();
664
- Server::enqueue([new Psr7\Response(200)]);
665
- $req = new Psr7\Request('GET', Server::$url);
666
- $gotStats = null;
667
- $handler = new Handler\CurlHandler();
668
- $promise = $handler($req, [
669
- 'on_stats' => function (TransferStats $stats) use (&$gotStats) {
670
- $gotStats = $stats;
671
- }
672
- ]);
673
- $response = $promise->wait();
674
- $this->assertEquals(200, $response->getStatusCode());
675
- $this->assertEquals(200, $gotStats->getResponse()->getStatusCode());
676
- $this->assertEquals(
677
- Server::$url,
678
- (string) $gotStats->getEffectiveUri()
679
- );
680
- $this->assertEquals(
681
- Server::$url,
682
- (string) $gotStats->getRequest()->getUri()
683
- );
684
- $this->assertGreaterThan(0, $gotStats->getTransferTime());
685
- }
686
-
687
- public function testInvokesOnStatsOnError()
688
- {
689
- $req = new Psr7\Request('GET', 'http://127.0.0.1:123');
690
- $gotStats = null;
691
- $handler = new Handler\CurlHandler();
692
- $promise = $handler($req, [
693
- 'connect_timeout' => 0.001,
694
- 'timeout' => 0.001,
695
- 'on_stats' => function (TransferStats $stats) use (&$gotStats) {
696
- $gotStats = $stats;
697
- }
698
- ]);
699
- $promise->wait(false);
700
- $this->assertFalse($gotStats->hasResponse());
701
- $this->assertEquals(
702
- 'http://127.0.0.1:123',
703
- $gotStats->getEffectiveUri()
704
- );
705
- $this->assertEquals(
706
- 'http://127.0.0.1:123',
707
- $gotStats->getRequest()->getUri()
708
- );
709
- $this->assertInternalType('float', $gotStats->getTransferTime());
710
- $this->assertInternalType('int', $gotStats->getHandlerErrorData());
711
- }
712
-
713
- public function testRewindsBodyIfPossible()
714
- {
715
- $body = Psr7\stream_for(str_repeat('x', 1024 * 1024 * 2));
716
- $body->seek(1024 * 1024);
717
- $this->assertSame(1024 * 1024, $body->tell());
718
-
719
- $req = new Psr7\Request('POST', 'https://www.example.com', [
720
- 'Content-Length' => 1024 * 1024 * 2,
721
- ], $body);
722
- $factory = new CurlFactory(1);
723
- $factory->create($req, []);
724
-
725
- $this->assertSame(0, $body->tell());
726
- }
727
-
728
- public function testDoesNotRewindUnseekableBody()
729
- {
730
- $body = Psr7\stream_for(str_repeat('x', 1024 * 1024 * 2));
731
- $body->seek(1024 * 1024);
732
- $body = new Psr7\NoSeekStream($body);
733
- $this->assertSame(1024 * 1024, $body->tell());
734
-
735
- $req = new Psr7\Request('POST', 'https://www.example.com', [
736
- 'Content-Length' => 1024 * 1024,
737
- ], $body);
738
- $factory = new CurlFactory(1);
739
- $factory->create($req, []);
740
-
741
- $this->assertSame(1024 * 1024, $body->tell());
742
- }
743
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Handler/CurlHandlerTest.php DELETED
@@ -1,86 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Test\Handler;
3
-
4
- use GuzzleHttp\Exception\ConnectException;
5
- use GuzzleHttp\Handler\CurlHandler;
6
- use GuzzleHttp\Psr7;
7
- use GuzzleHttp\Psr7\Request;
8
- use GuzzleHttp\Psr7\Response;
9
- use GuzzleHttp\Tests\Server;
10
- use PHPUnit\Framework\TestCase;
11
-
12
- /**
13
- * @covers \GuzzleHttp\Handler\CurlHandler
14
- */
15
- class CurlHandlerTest extends TestCase
16
- {
17
- protected function getHandler($options = [])
18
- {
19
- return new CurlHandler($options);
20
- }
21
-
22
- /**
23
- * @expectedException \GuzzleHttp\Exception\ConnectException
24
- * @expectedExceptionMessage cURL
25
- */
26
- public function testCreatesCurlErrors()
27
- {
28
- $handler = new CurlHandler();
29
- $request = new Request('GET', 'http://localhost:123');
30
- $handler($request, ['timeout' => 0.001, 'connect_timeout' => 0.001])->wait();
31
- }
32
-
33
- public function testReusesHandles()
34
- {
35
- Server::flush();
36
- $response = new response(200);
37
- Server::enqueue([$response, $response]);
38
- $a = new CurlHandler();
39
- $request = new Request('GET', Server::$url);
40
- $a($request, []);
41
- $a($request, []);
42
- }
43
-
44
- public function testDoesSleep()
45
- {
46
- $response = new response(200);
47
- Server::enqueue([$response]);
48
- $a = new CurlHandler();
49
- $request = new Request('GET', Server::$url);
50
- $s = microtime(true);
51
- $a($request, ['delay' => 0.1])->wait();
52
- $this->assertGreaterThan(0.0001, microtime(true) - $s);
53
- }
54
-
55
- public function testCreatesCurlErrorsWithContext()
56
- {
57
- $handler = new CurlHandler();
58
- $request = new Request('GET', 'http://localhost:123');
59
- $called = false;
60
- $p = $handler($request, ['timeout' => 0.001, 'connect_timeout' => 0.001])
61
- ->otherwise(function (ConnectException $e) use (&$called) {
62
- $called = true;
63
- $this->assertArrayHasKey('errno', $e->getHandlerContext());
64
- });
65
- $p->wait();
66
- $this->assertTrue($called);
67
- }
68
-
69
- public function testUsesContentLengthWhenOverInMemorySize()
70
- {
71
- Server::flush();
72
- Server::enqueue([new Response()]);
73
- $stream = Psr7\stream_for(str_repeat('.', 1000000));
74
- $handler = new CurlHandler();
75
- $request = new Request(
76
- 'PUT',
77
- Server::$url,
78
- ['Content-Length' => 1000000],
79
- $stream
80
- );
81
- $handler($request, [])->wait();
82
- $received = Server::received()[0];
83
- $this->assertEquals(1000000, $received->getHeaderLine('Content-Length'));
84
- $this->assertFalse($received->hasHeader('Transfer-Encoding'));
85
- }
86
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Handler/CurlMultiHandlerTest.php DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\Handler;
3
-
4
- use GuzzleHttp\Handler\CurlMultiHandler;
5
- use GuzzleHttp\Psr7\Request;
6
- use GuzzleHttp\Psr7\Response;
7
- use GuzzleHttp\Tests\Server;
8
- use PHPUnit\Framework\TestCase;
9
-
10
- class CurlMultiHandlerTest extends TestCase
11
- {
12
- public function testSendsRequest()
13
- {
14
- Server::enqueue([new Response()]);
15
- $a = new CurlMultiHandler();
16
- $request = new Request('GET', Server::$url);
17
- $response = $a($request, [])->wait();
18
- $this->assertEquals(200, $response->getStatusCode());
19
- }
20
-
21
- /**
22
- * @expectedException \GuzzleHttp\Exception\ConnectException
23
- * @expectedExceptionMessage cURL error
24
- */
25
- public function testCreatesExceptions()
26
- {
27
- $a = new CurlMultiHandler();
28
- $a(new Request('GET', 'http://localhost:123'), [])->wait();
29
- }
30
-
31
- public function testCanSetSelectTimeout()
32
- {
33
- $a = new CurlMultiHandler(['select_timeout' => 2]);
34
- $this->assertEquals(2, $this->readAttribute($a, 'selectTimeout'));
35
- }
36
-
37
- public function testCanCancel()
38
- {
39
- Server::flush();
40
- $response = new Response(200);
41
- Server::enqueue(array_fill_keys(range(0, 10), $response));
42
- $a = new CurlMultiHandler();
43
- $responses = [];
44
- for ($i = 0; $i < 10; $i++) {
45
- $response = $a(new Request('GET', Server::$url), []);
46
- $response->cancel();
47
- $responses[] = $response;
48
- }
49
- }
50
-
51
- public function testCannotCancelFinished()
52
- {
53
- Server::flush();
54
- Server::enqueue([new Response(200)]);
55
- $a = new CurlMultiHandler();
56
- $response = $a(new Request('GET', Server::$url), []);
57
- $response->wait();
58
- $response->cancel();
59
- }
60
-
61
- public function testDelaysConcurrently()
62
- {
63
- Server::flush();
64
- Server::enqueue([new Response()]);
65
- $a = new CurlMultiHandler();
66
- $expected = microtime(true) + (100 / 1000);
67
- $response = $a(new Request('GET', Server::$url), ['delay' => 100]);
68
- $response->wait();
69
- $this->assertGreaterThanOrEqual($expected, microtime(true));
70
- }
71
-
72
- /**
73
- * @expectedException \BadMethodCallException
74
- */
75
- public function throwsWhenAccessingInvalidProperty()
76
- {
77
- $h = new CurlMultiHandler();
78
- $h->foo;
79
- }
80
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Handler/EasyHandleTest.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Test\Handler;
3
-
4
- use GuzzleHttp\Handler\EasyHandle;
5
- use GuzzleHttp\Psr7;
6
- use PHPUnit\Framework\TestCase;
7
-
8
- /**
9
- * @covers \GuzzleHttp\Handler\EasyHandle
10
- */
11
- class EasyHandleTest extends TestCase
12
- {
13
- /**
14
- * @expectedException \BadMethodCallException
15
- * @expectedExceptionMessage The EasyHandle has been released
16
- */
17
- public function testEnsuresHandleExists()
18
- {
19
- $easy = new EasyHandle;
20
- unset($easy->handle);
21
- $easy->handle;
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Handler/MockHandlerTest.php DELETED
@@ -1,224 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Test\Handler;
3
-
4
- use GuzzleHttp\Handler\MockHandler;
5
- use GuzzleHttp\Promise\PromiseInterface;
6
- use GuzzleHttp\Psr7\Request;
7
- use GuzzleHttp\Psr7\Response;
8
- use GuzzleHttp\TransferStats;
9
- use PHPUnit\Framework\TestCase;
10
-
11
- /**
12
- * @covers \GuzzleHttp\Handler\MockHandler
13
- */
14
- class MockHandlerTest extends TestCase
15
- {
16
- public function testReturnsMockResponse()
17
- {
18
- $res = new Response();
19
- $mock = new MockHandler([$res]);
20
- $request = new Request('GET', 'http://example.com');
21
- $p = $mock($request, []);
22
- $this->assertSame($res, $p->wait());
23
- }
24
-
25
- public function testIsCountable()
26
- {
27
- $res = new Response();
28
- $mock = new MockHandler([$res, $res]);
29
- $this->assertCount(2, $mock);
30
- }
31
-
32
- public function testEmptyHandlerIsCountable()
33
- {
34
- $this->assertCount(0, new MockHandler());
35
- }
36
-
37
- /**
38
- * @expectedException \InvalidArgumentException
39
- */
40
- public function testEnsuresEachAppendIsValid()
41
- {
42
- $mock = new MockHandler(['a']);
43
- $request = new Request('GET', 'http://example.com');
44
- $mock($request, []);
45
- }
46
-
47
- public function testCanQueueExceptions()
48
- {
49
- $e = new \Exception('a');
50
- $mock = new MockHandler([$e]);
51
- $request = new Request('GET', 'http://example.com');
52
- $p = $mock($request, []);
53
- try {
54
- $p->wait();
55
- $this->fail();
56
- } catch (\Exception $e2) {
57
- $this->assertSame($e, $e2);
58
- }
59
- }
60
-
61
- public function testCanGetLastRequestAndOptions()
62
- {
63
- $res = new Response();
64
- $mock = new MockHandler([$res]);
65
- $request = new Request('GET', 'http://example.com');
66
- $mock($request, ['foo' => 'bar']);
67
- $this->assertSame($request, $mock->getLastRequest());
68
- $this->assertEquals(['foo' => 'bar'], $mock->getLastOptions());
69
- }
70
-
71
- public function testSinkFilename()
72
- {
73
- $filename = sys_get_temp_dir().'/mock_test_'.uniqid();
74
- $res = new Response(200, [], 'TEST CONTENT');
75
- $mock = new MockHandler([$res]);
76
- $request = new Request('GET', '/');
77
- $p = $mock($request, ['sink' => $filename]);
78
- $p->wait();
79
-
80
- $this->assertFileExists($filename);
81
- $this->assertStringEqualsFile($filename, 'TEST CONTENT');
82
-
83
- unlink($filename);
84
- }
85
-
86
- public function testSinkResource()
87
- {
88
- $file = tmpfile();
89
- $meta = stream_get_meta_data($file);
90
- $res = new Response(200, [], 'TEST CONTENT');
91
- $mock = new MockHandler([$res]);
92
- $request = new Request('GET', '/');
93
- $p = $mock($request, ['sink' => $file]);
94
- $p->wait();
95
-
96
- $this->assertFileExists($meta['uri']);
97
- $this->assertStringEqualsFile($meta['uri'], 'TEST CONTENT');
98
- }
99
-
100
- public function testSinkStream()
101
- {
102
- $stream = new \GuzzleHttp\Psr7\Stream(tmpfile());
103
- $res = new Response(200, [], 'TEST CONTENT');
104
- $mock = new MockHandler([$res]);
105
- $request = new Request('GET', '/');
106
- $p = $mock($request, ['sink' => $stream]);
107
- $p->wait();
108
-
109
- $this->assertFileExists($stream->getMetadata('uri'));
110
- $this->assertStringEqualsFile($stream->getMetadata('uri'), 'TEST CONTENT');
111
- }
112
-
113
- public function testCanEnqueueCallables()
114
- {
115
- $r = new Response();
116
- $fn = function ($req, $o) use ($r) { return $r; };
117
- $mock = new MockHandler([$fn]);
118
- $request = new Request('GET', 'http://example.com');
119
- $p = $mock($request, ['foo' => 'bar']);
120
- $this->assertSame($r, $p->wait());
121
- }
122
-
123
- /**
124
- * @expectedException \InvalidArgumentException
125
- */
126
- public function testEnsuresOnHeadersIsCallable()
127
- {
128
- $res = new Response();
129
- $mock = new MockHandler([$res]);
130
- $request = new Request('GET', 'http://example.com');
131
- $mock($request, ['on_headers' => 'error!']);
132
- }
133
-
134
- /**
135
- * @expectedException \GuzzleHttp\Exception\RequestException
136
- * @expectedExceptionMessage An error was encountered during the on_headers event
137
- * @expectedExceptionMessage test
138
- */
139
- public function testRejectsPromiseWhenOnHeadersFails()
140
- {
141
- $res = new Response();
142
- $mock = new MockHandler([$res]);
143
- $request = new Request('GET', 'http://example.com');
144
- $promise = $mock($request, [
145
- 'on_headers' => function () {
146
- throw new \Exception('test');
147
- }
148
- ]);
149
-
150
- $promise->wait();
151
- }
152
- public function testInvokesOnFulfilled()
153
- {
154
- $res = new Response();
155
- $mock = new MockHandler([$res], function ($v) use (&$c) {
156
- $c = $v;
157
- });
158
- $request = new Request('GET', 'http://example.com');
159
- $mock($request, [])->wait();
160
- $this->assertSame($res, $c);
161
- }
162
-
163
- public function testInvokesOnRejected()
164
- {
165
- $e = new \Exception('a');
166
- $c = null;
167
- $mock = new MockHandler([$e], null, function ($v) use (&$c) { $c = $v; });
168
- $request = new Request('GET', 'http://example.com');
169
- $mock($request, [])->wait(false);
170
- $this->assertSame($e, $c);
171
- }
172
-
173
- /**
174
- * @expectedException \OutOfBoundsException
175
- */
176
- public function testThrowsWhenNoMoreResponses()
177
- {
178
- $mock = new MockHandler();
179
- $request = new Request('GET', 'http://example.com');
180
- $mock($request, []);
181
- }
182
-
183
- /**
184
- * @expectedException \GuzzleHttp\Exception\BadResponseException
185
- */
186
- public function testCanCreateWithDefaultMiddleware()
187
- {
188
- $r = new Response(500);
189
- $mock = MockHandler::createWithMiddleware([$r]);
190
- $request = new Request('GET', 'http://example.com');
191
- $mock($request, ['http_errors' => true])->wait();
192
- }
193
-
194
- public function testInvokesOnStatsFunctionForResponse()
195
- {
196
- $res = new Response();
197
- $mock = new MockHandler([$res]);
198
- $request = new Request('GET', 'http://example.com');
199
- $stats = null;
200
- $onStats = function (TransferStats $s) use (&$stats) {
201
- $stats = $s;
202
- };
203
- $p = $mock($request, ['on_stats' => $onStats]);
204
- $p->wait();
205
- $this->assertSame($res, $stats->getResponse());
206
- $this->assertSame($request, $stats->getRequest());
207
- }
208
-
209
- public function testInvokesOnStatsFunctionForError()
210
- {
211
- $e = new \Exception('a');
212
- $c = null;
213
- $mock = new MockHandler([$e], null, function ($v) use (&$c) { $c = $v; });
214
- $request = new Request('GET', 'http://example.com');
215
- $stats = null;
216
- $onStats = function (TransferStats $s) use (&$stats) {
217
- $stats = $s;
218
- };
219
- $mock($request, ['on_stats' => $onStats])->wait(false);
220
- $this->assertSame($e, $stats->getHandlerErrorData());
221
- $this->assertNull($stats->getResponse());
222
- $this->assertSame($request, $stats->getRequest());
223
- }
224
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Handler/ProxyTest.php DELETED
@@ -1,58 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Test\Handler;
3
-
4
- use GuzzleHttp\Handler\MockHandler;
5
- use GuzzleHttp\Handler\Proxy;
6
- use GuzzleHttp\Psr7\Request;
7
- use GuzzleHttp\RequestOptions;
8
- use PHPUnit\Framework\TestCase;
9
-
10
- /**
11
- * @covers \GuzzleHttp\Handler\Proxy
12
- */
13
- class ProxyTest extends TestCase
14
- {
15
- public function testSendsToNonSync()
16
- {
17
- $a = $b = null;
18
- $m1 = new MockHandler([function ($v) use (&$a) { $a = $v; }]);
19
- $m2 = new MockHandler([function ($v) use (&$b) { $b = $v; }]);
20
- $h = Proxy::wrapSync($m1, $m2);
21
- $h(new Request('GET', 'http://foo.com'), []);
22
- $this->assertNotNull($a);
23
- $this->assertNull($b);
24
- }
25
-
26
- public function testSendsToSync()
27
- {
28
- $a = $b = null;
29
- $m1 = new MockHandler([function ($v) use (&$a) { $a = $v; }]);
30
- $m2 = new MockHandler([function ($v) use (&$b) { $b = $v; }]);
31
- $h = Proxy::wrapSync($m1, $m2);
32
- $h(new Request('GET', 'http://foo.com'), [RequestOptions::SYNCHRONOUS => true]);
33
- $this->assertNull($a);
34
- $this->assertNotNull($b);
35
- }
36
-
37
- public function testSendsToStreaming()
38
- {
39
- $a = $b = null;
40
- $m1 = new MockHandler([function ($v) use (&$a) { $a = $v; }]);
41
- $m2 = new MockHandler([function ($v) use (&$b) { $b = $v; }]);
42
- $h = Proxy::wrapStreaming($m1, $m2);
43
- $h(new Request('GET', 'http://foo.com'), []);
44
- $this->assertNotNull($a);
45
- $this->assertNull($b);
46
- }
47
-
48
- public function testSendsToNonStreaming()
49
- {
50
- $a = $b = null;
51
- $m1 = new MockHandler([function ($v) use (&$a) { $a = $v; }]);
52
- $m2 = new MockHandler([function ($v) use (&$b) { $b = $v; }]);
53
- $h = Proxy::wrapStreaming($m1, $m2);
54
- $h(new Request('GET', 'http://foo.com'), ['stream' => true]);
55
- $this->assertNull($a);
56
- $this->assertNotNull($b);
57
- }
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Handler/StreamHandlerTest.php DELETED
@@ -1,683 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Test\Handler;
3
-
4
- use GuzzleHttp\Exception\ConnectException;
5
- use GuzzleHttp\Handler\StreamHandler;
6
- use GuzzleHttp\Psr7;
7
- use GuzzleHttp\Psr7\Request;
8
- use GuzzleHttp\Psr7\Response;
9
- use GuzzleHttp\Psr7\FnStream;
10
- use GuzzleHttp\RequestOptions;
11
- use GuzzleHttp\Tests\Server;
12
- use GuzzleHttp\TransferStats;
13
- use Psr\Http\Message\ResponseInterface;
14
- use PHPUnit\Framework\TestCase;
15
-
16
- /**
17
- * @covers \GuzzleHttp\Handler\StreamHandler
18
- */
19
- class StreamHandlerTest extends TestCase
20
- {
21
- private function queueRes()
22
- {
23
- Server::flush();
24
- Server::enqueue([
25
- new Response(200, [
26
- 'Foo' => 'Bar',
27
- 'Content-Length' => 8,
28
- ], 'hi there')
29
- ]);
30
- }
31
-
32
- public function testReturnsResponseForSuccessfulRequest()
33
- {
34
- $this->queueRes();
35
- $handler = new StreamHandler();
36
- $response = $handler(
37
- new Request('GET', Server::$url, ['Foo' => 'Bar']),
38
- []
39
- )->wait();
40
- $this->assertEquals(200, $response->getStatusCode());
41
- $this->assertEquals('OK', $response->getReasonPhrase());
42
- $this->assertEquals('Bar', $response->getHeaderLine('Foo'));
43
- $this->assertEquals('8', $response->getHeaderLine('Content-Length'));
44
- $this->assertEquals('hi there', (string) $response->getBody());
45
- $sent = Server::received()[0];
46
- $this->assertEquals('GET', $sent->getMethod());
47
- $this->assertEquals('/', $sent->getUri()->getPath());
48
- $this->assertEquals('127.0.0.1:8126', $sent->getHeaderLine('Host'));
49
- $this->assertEquals('Bar', $sent->getHeaderLine('foo'));
50
- }
51
-
52
- /**
53
- * @expectedException \GuzzleHttp\Exception\RequestException
54
- */
55
- public function testAddsErrorToResponse()
56
- {
57
- $handler = new StreamHandler();
58
- $handler(
59
- new Request('GET', 'http://localhost:123'),
60
- ['timeout' => 0.01]
61
- )->wait();
62
- }
63
-
64
- public function testStreamAttributeKeepsStreamOpen()
65
- {
66
- $this->queueRes();
67
- $handler = new StreamHandler();
68
- $request = new Request(
69
- 'PUT',
70
- Server::$url . 'foo?baz=bar',
71
- ['Foo' => 'Bar'],
72
- 'test'
73
- );
74
- $response = $handler($request, ['stream' => true])->wait();
75
- $this->assertEquals(200, $response->getStatusCode());
76
- $this->assertEquals('OK', $response->getReasonPhrase());
77
- $this->assertEquals('8', $response->getHeaderLine('Content-Length'));
78
- $body = $response->getBody();
79
- $stream = $body->detach();
80
- $this->assertInternalType('resource', $stream);
81
- $this->assertEquals('http', stream_get_meta_data($stream)['wrapper_type']);
82
- $this->assertEquals('hi there', stream_get_contents($stream));
83
- fclose($stream);
84
- $sent = Server::received()[0];
85
- $this->assertEquals('PUT', $sent->getMethod());
86
- $this->assertEquals('http://127.0.0.1:8126/foo?baz=bar', (string) $sent->getUri());
87
- $this->assertEquals('Bar', $sent->getHeaderLine('Foo'));
88
- $this->assertEquals('test', (string) $sent->getBody());
89
- }
90
-
91
- public function testDrainsResponseIntoTempStream()
92
- {
93
- $this->queueRes();
94
- $handler = new StreamHandler();
95
- $request = new Request('GET', Server::$url);
96
- $response = $handler($request, [])->wait();
97
- $body = $response->getBody();
98
- $stream = $body->detach();
99
- $this->assertEquals('php://temp', stream_get_meta_data($stream)['uri']);
100
- $this->assertEquals('hi', fread($stream, 2));
101
- fclose($stream);
102
- }
103
-
104
- public function testDrainsResponseIntoSaveToBody()
105
- {
106
- $r = fopen('php://temp', 'r+');
107
- $this->queueRes();
108
- $handler = new StreamHandler();
109
- $request = new Request('GET', Server::$url);
110
- $response = $handler($request, ['sink' => $r])->wait();
111
- $body = $response->getBody()->detach();
112
- $this->assertEquals('php://temp', stream_get_meta_data($body)['uri']);
113
- $this->assertEquals('hi', fread($body, 2));
114
- $this->assertEquals(' there', stream_get_contents($r));
115
- fclose($r);
116
- }
117
-
118
- public function testDrainsResponseIntoSaveToBodyAtPath()
119
- {
120
- $tmpfname = tempnam('/tmp', 'save_to_path');
121
- $this->queueRes();
122
- $handler = new StreamHandler();
123
- $request = new Request('GET', Server::$url);
124
- $response = $handler($request, ['sink' => $tmpfname])->wait();
125
- $body = $response->getBody();
126
- $this->assertEquals($tmpfname, $body->getMetadata('uri'));
127
- $this->assertEquals('hi', $body->read(2));
128
- $body->close();
129
- unlink($tmpfname);
130
- }
131
-
132
- public function testDrainsResponseIntoSaveToBodyAtNonExistentPath()
133
- {
134
- $tmpfname = tempnam('/tmp', 'save_to_path');
135
- unlink($tmpfname);
136
- $this->queueRes();
137
- $handler = new StreamHandler();
138
- $request = new Request('GET', Server::$url);
139
- $response = $handler($request, ['sink' => $tmpfname])->wait();
140
- $body = $response->getBody();
141
- $this->assertEquals($tmpfname, $body->getMetadata('uri'));
142
- $this->assertEquals('hi', $body->read(2));
143
- $body->close();
144
- unlink($tmpfname);
145
- }
146
-
147
- public function testDrainsResponseAndReadsOnlyContentLengthBytes()
148
- {
149
- Server::flush();
150
- Server::enqueue([
151
- new Response(200, [
152
- 'Foo' => 'Bar',
153
- 'Content-Length' => 8,
154
- ], 'hi there... This has way too much data!')
155
- ]);
156
- $handler = new StreamHandler();
157
- $request = new Request('GET', Server::$url);
158
- $response = $handler($request, [])->wait();
159
- $body = $response->getBody();
160
- $stream = $body->detach();
161
- $this->assertEquals('hi there', stream_get_contents($stream));
162
- fclose($stream);
163
- }
164
-
165
- public function testDoesNotDrainWhenHeadRequest()
166
- {
167
- Server::flush();
168
- // Say the content-length is 8, but return no response.
169
- Server::enqueue([
170
- new Response(200, [
171
- 'Foo' => 'Bar',
172
- 'Content-Length' => 8,
173
- ], '')
174
- ]);
175
- $handler = new StreamHandler();
176
- $request = new Request('HEAD', Server::$url);
177
- $response = $handler($request, [])->wait();
178
- $body = $response->getBody();
179
- $stream = $body->detach();
180
- $this->assertEquals('', stream_get_contents($stream));
181
- fclose($stream);
182
- }
183
-
184
- public function testAutomaticallyDecompressGzip()
185
- {
186
- Server::flush();
187
- $content = gzencode('test');
188
- Server::enqueue([
189
- new Response(200, [
190
- 'Content-Encoding' => 'gzip',
191
- 'Content-Length' => strlen($content),
192
- ], $content)
193
- ]);
194
- $handler = new StreamHandler();
195
- $request = new Request('GET', Server::$url);
196
- $response = $handler($request, ['decode_content' => true])->wait();
197
- $this->assertEquals('test', (string) $response->getBody());
198
- $this->assertFalse($response->hasHeader('content-encoding'));
199
- $this->assertTrue(!$response->hasHeader('content-length') || $response->getHeaderLine('content-length') == $response->getBody()->getSize());
200
- }
201
-
202
- public function testReportsOriginalSizeAndContentEncodingAfterDecoding()
203
- {
204
- Server::flush();
205
- $content = gzencode('test');
206
- Server::enqueue([
207
- new Response(200, [
208
- 'Content-Encoding' => 'gzip',
209
- 'Content-Length' => strlen($content),
210
- ], $content)
211
- ]);
212
- $handler = new StreamHandler();
213
- $request = new Request('GET', Server::$url);
214
- $response = $handler($request, ['decode_content' => true])->wait();
215
-
216
- $this->assertSame(
217
- 'gzip',
218
- $response->getHeaderLine('x-encoded-content-encoding')
219
- );
220
- $this->assertSame(
221
- strlen($content),
222
- (int) $response->getHeaderLine('x-encoded-content-length')
223
- );
224
- }
225
-
226
- public function testDoesNotForceGzipDecode()
227
- {
228
- Server::flush();
229
- $content = gzencode('test');
230
- Server::enqueue([
231
- new Response(200, [
232
- 'Content-Encoding' => 'gzip',
233
- 'Content-Length' => strlen($content),
234
- ], $content)
235
- ]);
236
- $handler = new StreamHandler();
237
- $request = new Request('GET', Server::$url);
238
- $response = $handler($request, ['decode_content' => false])->wait();
239
- $this->assertSame($content, (string) $response->getBody());
240
- $this->assertEquals('gzip', $response->getHeaderLine('content-encoding'));
241
- $this->assertEquals(strlen($content), $response->getHeaderLine('content-length'));
242
- }
243
-
244
- public function testProtocolVersion()
245
- {
246
- $this->queueRes();
247
- $handler = new StreamHandler();
248
- $request = new Request('GET', Server::$url, [], null, '1.0');
249
- $handler($request, []);
250
- $this->assertEquals('1.0', Server::received()[0]->getProtocolVersion());
251
- }
252
-
253
- protected function getSendResult(array $opts)
254
- {
255
- $this->queueRes();
256
- $handler = new StreamHandler();
257
- $opts['stream'] = true;
258
- $request = new Request('GET', Server::$url);
259
- return $handler($request, $opts)->wait();
260
- }
261
-
262
- /**
263
- * @expectedException \GuzzleHttp\Exception\ConnectException
264
- * @expectedExceptionMessage Connection refused
265
- */
266
- public function testAddsProxy()
267
- {
268
- $this->getSendResult(['proxy' => '127.0.0.1:8125']);
269
- }
270
-
271
- public function testAddsProxyByProtocol()
272
- {
273
- $url = str_replace('http', 'tcp', Server::$url);
274
- // Workaround until #1823 is fixed properly
275
- $url = rtrim($url, '/');
276
- $res = $this->getSendResult(['proxy' => ['http' => $url]]);
277
- $opts = stream_context_get_options($res->getBody()->detach());
278
- $this->assertEquals($url, $opts['http']['proxy']);
279
- }
280
-
281
- public function testAddsProxyButHonorsNoProxy()
282
- {
283
- $url = str_replace('http', 'tcp', Server::$url);
284
- $res = $this->getSendResult(['proxy' => [
285
- 'http' => $url,
286
- 'no' => ['*']
287
- ]]);
288
- $opts = stream_context_get_options($res->getBody()->detach());
289
- $this->assertTrue(empty($opts['http']['proxy']));
290
- }
291
-
292
- public function testAddsTimeout()
293
- {
294
- $res = $this->getSendResult(['stream' => true, 'timeout' => 200]);
295
- $opts = stream_context_get_options($res->getBody()->detach());
296
- $this->assertEquals(200, $opts['http']['timeout']);
297
- }
298
-
299
- /**
300
- * @expectedException \GuzzleHttp\Exception\RequestException
301
- * @expectedExceptionMessage SSL CA bundle not found: /does/not/exist
302
- */
303
- public function testVerifiesVerifyIsValidIfPath()
304
- {
305
- $this->getSendResult(['verify' => '/does/not/exist']);
306
- }
307
-
308
- public function testVerifyCanBeDisabled()
309
- {
310
- $this->getSendResult(['verify' => false]);
311
- }
312
-
313
- /**
314
- * @expectedException \GuzzleHttp\Exception\RequestException
315
- * @expectedExceptionMessage SSL certificate not found: /does/not/exist
316
- */
317
- public function testVerifiesCertIfValidPath()
318
- {
319
- $this->getSendResult(['cert' => '/does/not/exist']);
320
- }
321
-
322
- public function testVerifyCanBeSetToPath()
323
- {
324
- $path = $path = \GuzzleHttp\default_ca_bundle();
325
- $res = $this->getSendResult(['verify' => $path]);
326
- $opts = stream_context_get_options($res->getBody()->detach());
327
- $this->assertTrue($opts['ssl']['verify_peer']);
328
- $this->assertTrue($opts['ssl']['verify_peer_name']);
329
- $this->assertEquals($path, $opts['ssl']['cafile']);
330
- $this->assertFileExists($opts['ssl']['cafile']);
331
- }
332
-
333
- public function testUsesSystemDefaultBundle()
334
- {
335
- $path = $path = \GuzzleHttp\default_ca_bundle();
336
- $res = $this->getSendResult(['verify' => true]);
337
- $opts = stream_context_get_options($res->getBody()->detach());
338
- if (PHP_VERSION_ID < 50600) {
339
- $this->assertEquals($path, $opts['ssl']['cafile']);
340
- }
341
- }
342
-
343
- /**
344
- * @expectedException \InvalidArgumentException
345
- * @expectedExceptionMessage Invalid verify request option
346
- */
347
- public function testEnsuresVerifyOptionIsValid()
348
- {
349
- $this->getSendResult(['verify' => 10]);
350
- }
351
-
352
- public function testCanSetPasswordWhenSettingCert()
353
- {
354
- $path = __FILE__;
355
- $res = $this->getSendResult(['cert' => [$path, 'foo']]);
356
- $opts = stream_context_get_options($res->getBody()->detach());
357
- $this->assertEquals($path, $opts['ssl']['local_cert']);
358
- $this->assertEquals('foo', $opts['ssl']['passphrase']);
359
- }
360
-
361
- public function testDebugAttributeWritesToStream()
362
- {
363
- $this->queueRes();
364
- $f = fopen('php://temp', 'w+');
365
- $this->getSendResult(['debug' => $f]);
366
- fseek($f, 0);
367
- $contents = stream_get_contents($f);
368
- $this->assertContains('<GET http://127.0.0.1:8126/> [CONNECT]', $contents);
369
- $this->assertContains('<GET http://127.0.0.1:8126/> [FILE_SIZE_IS]', $contents);
370
- $this->assertContains('<GET http://127.0.0.1:8126/> [PROGRESS]', $contents);
371
- }
372
-
373
- public function testDebugAttributeWritesStreamInfoToBuffer()
374
- {
375
- $called = false;
376
- $this->queueRes();
377
- $buffer = fopen('php://temp', 'r+');
378
- $this->getSendResult([
379
- 'progress' => function () use (&$called) { $called = true; },
380
- 'debug' => $buffer,
381
- ]);
382
- fseek($buffer, 0);
383
- $contents = stream_get_contents($buffer);
384
- $this->assertContains('<GET http://127.0.0.1:8126/> [CONNECT]', $contents);
385
- $this->assertContains('<GET http://127.0.0.1:8126/> [FILE_SIZE_IS] message: "Content-Length: 8"', $contents);
386
- $this->assertContains('<GET http://127.0.0.1:8126/> [PROGRESS] bytes_max: "8"', $contents);
387
- $this->assertTrue($called);
388
- }
389
-
390
- public function testEmitsProgressInformation()
391
- {
392
- $called = [];
393
- $this->queueRes();
394
- $this->getSendResult([
395
- 'progress' => function () use (&$called) {
396
- $called[] = func_get_args();
397
- },
398
- ]);
399
- $this->assertNotEmpty($called);
400
- $this->assertEquals(8, $called[0][0]);
401
- $this->assertEquals(0, $called[0][1]);
402
- }
403
-
404
- public function testEmitsProgressInformationAndDebugInformation()
405
- {
406
- $called = [];
407
- $this->queueRes();
408
- $buffer = fopen('php://memory', 'w+');
409
- $this->getSendResult([
410
- 'debug' => $buffer,
411
- 'progress' => function () use (&$called) {
412
- $called[] = func_get_args();
413
- },
414
- ]);
415
- $this->assertNotEmpty($called);
416
- $this->assertEquals(8, $called[0][0]);
417
- $this->assertEquals(0, $called[0][1]);
418
- rewind($buffer);
419
- $this->assertNotEmpty(stream_get_contents($buffer));
420
- fclose($buffer);
421
- }
422
-
423
- public function testPerformsShallowMergeOfCustomContextOptions()
424
- {
425
- $res = $this->getSendResult([
426
- 'stream_context' => [
427
- 'http' => [
428
- 'request_fulluri' => true,
429
- 'method' => 'HEAD',
430
- ],
431
- 'socket' => [
432
- 'bindto' => '127.0.0.1:0',
433
- ],
434
- 'ssl' => [
435
- 'verify_peer' => false,
436
- ],
437
- ],
438
- ]);
439
- $opts = stream_context_get_options($res->getBody()->detach());
440
- $this->assertEquals('HEAD', $opts['http']['method']);
441
- $this->assertTrue($opts['http']['request_fulluri']);
442
- $this->assertEquals('127.0.0.1:0', $opts['socket']['bindto']);
443
- $this->assertFalse($opts['ssl']['verify_peer']);
444
- }
445
-
446
- /**
447
- * @expectedException \InvalidArgumentException
448
- * @expectedExceptionMessage stream_context must be an array
449
- */
450
- public function testEnsuresThatStreamContextIsAnArray()
451
- {
452
- $this->getSendResult(['stream_context' => 'foo']);
453
- }
454
-
455
- public function testDoesNotAddContentTypeByDefault()
456
- {
457
- $this->queueRes();
458
- $handler = new StreamHandler();
459
- $request = new Request('PUT', Server::$url, ['Content-Length' => 3], 'foo');
460
- $handler($request, []);
461
- $req = Server::received()[0];
462
- $this->assertEquals('', $req->getHeaderLine('Content-Type'));
463
- $this->assertEquals(3, $req->getHeaderLine('Content-Length'));
464
- }
465
-
466
- public function testAddsContentLengthByDefault()
467
- {
468
- $this->queueRes();
469
- $handler = new StreamHandler();
470
- $request = new Request('PUT', Server::$url, [], 'foo');
471
- $handler($request, []);
472
- $req = Server::received()[0];
473
- $this->assertEquals(3, $req->getHeaderLine('Content-Length'));
474
- }
475
-
476
- public function testAddsContentLengthEvenWhenEmpty()
477
- {
478
- $this->queueRes();
479
- $handler = new StreamHandler();
480
- $request = new Request('PUT', Server::$url, [], '');
481
- $handler($request, []);
482
- $req = Server::received()[0];
483
- $this->assertEquals(0, $req->getHeaderLine('Content-Length'));
484
- }
485
-
486
- public function testSupports100Continue()
487
- {
488
- Server::flush();
489
- $response = new Response(200, ['Test' => 'Hello', 'Content-Length' => '4'], 'test');
490
- Server::enqueue([$response]);
491
- $request = new Request('PUT', Server::$url, ['Expect' => '100-Continue'], 'test');
492
- $handler = new StreamHandler();
493
- $response = $handler($request, [])->wait();
494
- $this->assertEquals(200, $response->getStatusCode());
495
- $this->assertEquals('Hello', $response->getHeaderLine('Test'));
496
- $this->assertEquals('4', $response->getHeaderLine('Content-Length'));
497
- $this->assertEquals('test', (string) $response->getBody());
498
- }
499
-
500
- public function testDoesSleep()
501
- {
502
- $response = new response(200);
503
- Server::enqueue([$response]);
504
- $a = new StreamHandler();
505
- $request = new Request('GET', Server::$url);
506
- $s = microtime(true);
507
- $a($request, ['delay' => 0.1])->wait();
508
- $this->assertGreaterThan(0.0001, microtime(true) - $s);
509
- }
510
-
511
- /**
512
- * @expectedException \InvalidArgumentException
513
- */
514
- public function testEnsuresOnHeadersIsCallable()
515
- {
516
- $req = new Request('GET', Server::$url);
517
- $handler = new StreamHandler();
518
- $handler($req, ['on_headers' => 'error!']);
519
- }
520
-
521
- /**
522
- * @expectedException \GuzzleHttp\Exception\RequestException
523
- * @expectedExceptionMessage An error was encountered during the on_headers event
524
- * @expectedExceptionMessage test
525
- */
526
- public function testRejectsPromiseWhenOnHeadersFails()
527
- {
528
- Server::flush();
529
- Server::enqueue([
530
- new Response(200, ['X-Foo' => 'bar'], 'abc 123')
531
- ]);
532
- $req = new Request('GET', Server::$url);
533
- $handler = new StreamHandler();
534
- $promise = $handler($req, [
535
- 'on_headers' => function () {
536
- throw new \Exception('test');
537
- }
538
- ]);
539
- $promise->wait();
540
- }
541
-
542
- public function testSuccessfullyCallsOnHeadersBeforeWritingToSink()
543
- {
544
- Server::flush();
545
- Server::enqueue([
546
- new Response(200, ['X-Foo' => 'bar'], 'abc 123')
547
- ]);
548
- $req = new Request('GET', Server::$url);
549
- $got = null;
550
-
551
- $stream = Psr7\stream_for();
552
- $stream = FnStream::decorate($stream, [
553
- 'write' => function ($data) use ($stream, &$got) {
554
- $this->assertNotNull($got);
555
- return $stream->write($data);
556
- }
557
- ]);
558
-
559
- $handler = new StreamHandler();
560
- $promise = $handler($req, [
561
- 'sink' => $stream,
562
- 'on_headers' => function (ResponseInterface $res) use (&$got) {
563
- $got = $res;
564
- $this->assertEquals('bar', $res->getHeaderLine('X-Foo'));
565
- }
566
- ]);
567
-
568
- $response = $promise->wait();
569
- $this->assertEquals(200, $response->getStatusCode());
570
- $this->assertEquals('bar', $response->getHeaderLine('X-Foo'));
571
- $this->assertEquals('abc 123', (string) $response->getBody());
572
- }
573
-
574
- public function testInvokesOnStatsOnSuccess()
575
- {
576
- Server::flush();
577
- Server::enqueue([new Psr7\Response(200)]);
578
- $req = new Psr7\Request('GET', Server::$url);
579
- $gotStats = null;
580
- $handler = new StreamHandler();
581
- $promise = $handler($req, [
582
- 'on_stats' => function (TransferStats $stats) use (&$gotStats) {
583
- $gotStats = $stats;
584
- }
585
- ]);
586
- $response = $promise->wait();
587
- $this->assertEquals(200, $response->getStatusCode());
588
- $this->assertEquals(200, $gotStats->getResponse()->getStatusCode());
589
- $this->assertEquals(
590
- Server::$url,
591
- (string) $gotStats->getEffectiveUri()
592
- );
593
- $this->assertEquals(
594
- Server::$url,
595
- (string) $gotStats->getRequest()->getUri()
596
- );
597
- $this->assertGreaterThan(0, $gotStats->getTransferTime());
598
- }
599
-
600
- public function testInvokesOnStatsOnError()
601
- {
602
- $req = new Psr7\Request('GET', 'http://127.0.0.1:123');
603
- $gotStats = null;
604
- $handler = new StreamHandler();
605
- $promise = $handler($req, [
606
- 'connect_timeout' => 0.001,
607
- 'timeout' => 0.001,
608
- 'on_stats' => function (TransferStats $stats) use (&$gotStats) {
609
- $gotStats = $stats;
610
- }
611
- ]);
612
- $promise->wait(false);
613
- $this->assertFalse($gotStats->hasResponse());
614
- $this->assertEquals(
615
- 'http://127.0.0.1:123',
616
- (string) $gotStats->getEffectiveUri()
617
- );
618
- $this->assertEquals(
619
- 'http://127.0.0.1:123',
620
- (string) $gotStats->getRequest()->getUri()
621
- );
622
- $this->assertInternalType('float', $gotStats->getTransferTime());
623
- $this->assertInstanceOf(
624
- ConnectException::class,
625
- $gotStats->getHandlerErrorData()
626
- );
627
- }
628
-
629
- public function testStreamIgnoresZeroTimeout()
630
- {
631
- Server::flush();
632
- Server::enqueue([new Psr7\Response(200)]);
633
- $req = new Psr7\Request('GET', Server::$url);
634
- $gotStats = null;
635
- $handler = new StreamHandler();
636
- $promise = $handler($req, [
637
- 'connect_timeout' => 10,
638
- 'timeout' => 0
639
- ]);
640
- $response = $promise->wait();
641
- $this->assertEquals(200, $response->getStatusCode());
642
- }
643
-
644
- public function testDrainsResponseAndReadsAllContentWhenContentLengthIsZero()
645
- {
646
- Server::flush();
647
- Server::enqueue([
648
- new Response(200, [
649
- 'Foo' => 'Bar',
650
- 'Content-Length' => '0',
651
- ], 'hi there... This has a lot of data!')
652
- ]);
653
- $handler = new StreamHandler();
654
- $request = new Request('GET', Server::$url);
655
- $response = $handler($request, [])->wait();
656
- $body = $response->getBody();
657
- $stream = $body->detach();
658
- $this->assertEquals('hi there... This has a lot of data!', stream_get_contents($stream));
659
- fclose($stream);
660
- }
661
-
662
- public function testHonorsReadTimeout()
663
- {
664
- Server::flush();
665
- $handler = new StreamHandler();
666
- $response = $handler(
667
- new Request('GET', Server::$url . 'guzzle-server/read-timeout'),
668
- [
669
- RequestOptions::READ_TIMEOUT => 1,
670
- RequestOptions::STREAM => true,
671
- ]
672
- )->wait();
673
- $this->assertEquals(200, $response->getStatusCode());
674
- $this->assertEquals('OK', $response->getReasonPhrase());
675
- $body = $response->getBody()->detach();
676
- $line = fgets($body);
677
- $this->assertEquals("sleeping 60 seconds ...\n", $line);
678
- $line = fgets($body);
679
- $this->assertFalse($line);
680
- $this->assertTrue(stream_get_meta_data($body)['timed_out']);
681
- $this->assertFalse(feof($body));
682
- }
683
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/HandlerStackTest.php DELETED
@@ -1,203 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\Cookie\CookieJar;
5
- use GuzzleHttp\Handler\MockHandler;
6
- use GuzzleHttp\HandlerStack;
7
- use GuzzleHttp\Psr7\Request;
8
- use GuzzleHttp\Psr7\Response;
9
- use PHPUnit\Framework\TestCase;
10
-
11
- class HandlerStackTest extends TestCase
12
- {
13
- public function testSetsHandlerInCtor()
14
- {
15
- $f = function () {};
16
- $m1 = function () {};
17
- $h = new HandlerStack($f, [$m1]);
18
- $this->assertTrue($h->hasHandler());
19
- }
20
-
21
- public function testCanSetDifferentHandlerAfterConstruction()
22
- {
23
- $f = function () {};
24
- $h = new HandlerStack();
25
- $h->setHandler($f);
26
- $h->resolve();
27
- }
28
-
29
- /**
30
- * @expectedException \LogicException
31
- */
32
- public function testEnsuresHandlerIsSet()
33
- {
34
- $h = new HandlerStack();
35
- $h->resolve();
36
- }
37
-
38
- public function testPushInOrder()
39
- {
40
- $meths = $this->getFunctions();
41
- $builder = new HandlerStack();
42
- $builder->setHandler($meths[1]);
43
- $builder->push($meths[2]);
44
- $builder->push($meths[3]);
45
- $builder->push($meths[4]);
46
- $composed = $builder->resolve();
47
- $this->assertEquals('Hello - test123', $composed('test'));
48
- $this->assertEquals(
49
- [['a', 'test'], ['b', 'test1'], ['c', 'test12']],
50
- $meths[0]
51
- );
52
- }
53
-
54
- public function testUnshiftsInReverseOrder()
55
- {
56
- $meths = $this->getFunctions();
57
- $builder = new HandlerStack();
58
- $builder->setHandler($meths[1]);
59
- $builder->unshift($meths[2]);
60
- $builder->unshift($meths[3]);
61
- $builder->unshift($meths[4]);
62
- $composed = $builder->resolve();
63
- $this->assertEquals('Hello - test321', $composed('test'));
64
- $this->assertEquals(
65
- [['c', 'test'], ['b', 'test3'], ['a', 'test32']],
66
- $meths[0]
67
- );
68
- }
69
-
70
- public function testCanRemoveMiddlewareByInstance()
71
- {
72
- $meths = $this->getFunctions();
73
- $builder = new HandlerStack();
74
- $builder->setHandler($meths[1]);
75
- $builder->push($meths[2]);
76
- $builder->push($meths[2]);
77
- $builder->push($meths[3]);
78
- $builder->push($meths[4]);
79
- $builder->push($meths[2]);
80
- $builder->remove($meths[3]);
81
- $composed = $builder->resolve();
82
- $this->assertEquals('Hello - test1131', $composed('test'));
83
- }
84
-
85
- public function testCanPrintMiddleware()
86
- {
87
- $meths = $this->getFunctions();
88
- $builder = new HandlerStack();
89
- $builder->setHandler($meths[1]);
90
- $builder->push($meths[2], 'a');
91
- $builder->push([__CLASS__, 'foo']);
92
- $builder->push([$this, 'bar']);
93
- $builder->push(__CLASS__ . '::' . 'foo');
94
- $lines = explode("\n", (string) $builder);
95
- $this->assertContains("> 4) Name: 'a', Function: callable(", $lines[0]);
96
- $this->assertContains("> 3) Name: '', Function: callable(GuzzleHttp\\Tests\\HandlerStackTest::foo)", $lines[1]);
97
- $this->assertContains("> 2) Name: '', Function: callable(['GuzzleHttp\\Tests\\HandlerStackTest', 'bar'])", $lines[2]);
98
- $this->assertContains("> 1) Name: '', Function: callable(GuzzleHttp\\Tests\\HandlerStackTest::foo)", $lines[3]);
99
- $this->assertContains("< 0) Handler: callable(", $lines[4]);
100
- $this->assertContains("< 1) Name: '', Function: callable(GuzzleHttp\\Tests\\HandlerStackTest::foo)", $lines[5]);
101
- $this->assertContains("< 2) Name: '', Function: callable(['GuzzleHttp\\Tests\\HandlerStackTest', 'bar'])", $lines[6]);
102
- $this->assertContains("< 3) Name: '', Function: callable(GuzzleHttp\\Tests\\HandlerStackTest::foo)", $lines[7]);
103
- $this->assertContains("< 4) Name: 'a', Function: callable(", $lines[8]);
104
- }
105
-
106
- public function testCanAddBeforeByName()
107
- {
108
- $meths = $this->getFunctions();
109
- $builder = new HandlerStack();
110
- $builder->setHandler($meths[1]);
111
- $builder->push($meths[2], 'foo');
112
- $builder->before('foo', $meths[3], 'baz');
113
- $builder->before('baz', $meths[4], 'bar');
114
- $builder->before('baz', $meths[4], 'qux');
115
- $lines = explode("\n", (string) $builder);
116
- $this->assertContains('> 4) Name: \'bar\'', $lines[0]);
117
- $this->assertContains('> 3) Name: \'qux\'', $lines[1]);
118
- $this->assertContains('> 2) Name: \'baz\'', $lines[2]);
119
- $this->assertContains('> 1) Name: \'foo\'', $lines[3]);
120
- }
121
-
122
- /**
123
- * @expectedException \InvalidArgumentException
124
- */
125
- public function testEnsuresHandlerExistsByName()
126
- {
127
- $builder = new HandlerStack();
128
- $builder->before('foo', function () {});
129
- }
130
-
131
- public function testCanAddAfterByName()
132
- {
133
- $meths = $this->getFunctions();
134
- $builder = new HandlerStack();
135
- $builder->setHandler($meths[1]);
136
- $builder->push($meths[2], 'a');
137
- $builder->push($meths[3], 'b');
138
- $builder->after('a', $meths[4], 'c');
139
- $builder->after('b', $meths[4], 'd');
140
- $lines = explode("\n", (string) $builder);
141
- $this->assertContains('4) Name: \'a\'', $lines[0]);
142
- $this->assertContains('3) Name: \'c\'', $lines[1]);
143
- $this->assertContains('2) Name: \'b\'', $lines[2]);
144
- $this->assertContains('1) Name: \'d\'', $lines[3]);
145
- }
146
-
147
- public function testPicksUpCookiesFromRedirects()
148
- {
149
- $mock = new MockHandler([
150
- new Response(301, [
151
- 'Location' => 'http://foo.com/baz',
152
- 'Set-Cookie' => 'foo=bar; Domain=foo.com'
153
- ]),
154
- new Response(200)
155
- ]);
156
- $handler = HandlerStack::create($mock);
157
- $request = new Request('GET', 'http://foo.com/bar');
158
- $jar = new CookieJar();
159
- $response = $handler($request, [
160
- 'allow_redirects' => true,
161
- 'cookies' => $jar
162
- ])->wait();
163
- $this->assertEquals(200, $response->getStatusCode());
164
- $lastRequest = $mock->getLastRequest();
165
- $this->assertEquals('http://foo.com/baz', (string) $lastRequest->getUri());
166
- $this->assertEquals('foo=bar', $lastRequest->getHeaderLine('Cookie'));
167
- }
168
-
169
- private function getFunctions()
170
- {
171
- $calls = [];
172
-
173
- $a = function (callable $next) use (&$calls) {
174
- return function ($v) use ($next, &$calls) {
175
- $calls[] = ['a', $v];
176
- return $next($v . '1');
177
- };
178
- };
179
-
180
- $b = function (callable $next) use (&$calls) {
181
- return function ($v) use ($next, &$calls) {
182
- $calls[] = ['b', $v];
183
- return $next($v . '2');
184
- };
185
- };
186
-
187
- $c = function (callable $next) use (&$calls) {
188
- return function ($v) use ($next, &$calls) {
189
- $calls[] = ['c', $v];
190
- return $next($v . '3');
191
- };
192
- };
193
-
194
- $handler = function ($v) {
195
- return 'Hello - ' . $v;
196
- };
197
-
198
- return [&$calls, $handler, $a, $b, $c];
199
- }
200
-
201
- public static function foo() {}
202
- public function bar () {}
203
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/MessageFormatterTest.php DELETED
@@ -1,93 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\Exception\RequestException;
5
- use GuzzleHttp\Psr7;
6
- use GuzzleHttp\Psr7\Request;
7
- use GuzzleHttp\Psr7\Response;
8
- use GuzzleHttp\MessageFormatter;
9
- use PHPUnit\Framework\TestCase;
10
-
11
- /**
12
- * @covers GuzzleHttp\MessageFormatter
13
- */
14
- class MessageFormatterTest extends TestCase
15
- {
16
- public function testCreatesWithClfByDefault()
17
- {
18
- $f = new MessageFormatter();
19
- $this->assertEquals(MessageFormatter::CLF, $this->readAttribute($f, 'template'));
20
- $f = new MessageFormatter(null);
21
- $this->assertEquals(MessageFormatter::CLF, $this->readAttribute($f, 'template'));
22
- }
23
-
24
- public function dateProvider()
25
- {
26
- return [
27
- ['{ts}', '/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}/'],
28
- ['{date_iso_8601}', '/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}/'],
29
- ['{date_common_log}', '/^\d\d\/[A-Z][a-z]{2}\/[0-9]{4}/']
30
- ];
31
- }
32
-
33
- /**
34
- * @dataProvider dateProvider
35
- */
36
- public function testFormatsTimestamps($format, $pattern)
37
- {
38
- $f = new MessageFormatter($format);
39
- $request = new Request('GET', '/');
40
- $result = $f->format($request);
41
- $this->assertEquals(1, preg_match($pattern, $result));
42
- }
43
-
44
- public function formatProvider()
45
- {
46
- $request = new Request('PUT', '/', ['x-test' => 'abc'], Psr7\stream_for('foo'));
47
- $response = new Response(200, ['X-Baz' => 'Bar'], Psr7\stream_for('baz'));
48
- $err = new RequestException('Test', $request, $response);
49
-
50
- return [
51
- ['{request}', [$request], Psr7\str($request)],
52
- ['{response}', [$request, $response], Psr7\str($response)],
53
- ['{request} {response}', [$request, $response], Psr7\str($request) . ' ' . Psr7\str($response)],
54
- // Empty response yields no value
55
- ['{request} {response}', [$request], Psr7\str($request) . ' '],
56
- ['{req_headers}', [$request], "PUT / HTTP/1.1\r\nx-test: abc"],
57
- ['{res_headers}', [$request, $response], "HTTP/1.1 200 OK\r\nX-Baz: Bar"],
58
- ['{res_headers}', [$request], 'NULL'],
59
- ['{req_body}', [$request], 'foo'],
60
- ['{res_body}', [$request, $response], 'baz'],
61
- ['{res_body}', [$request], 'NULL'],
62
- ['{method}', [$request], $request->getMethod()],
63
- ['{url}', [$request], $request->getUri()],
64
- ['{target}', [$request], $request->getRequestTarget()],
65
- ['{req_version}', [$request], $request->getProtocolVersion()],
66
- ['{res_version}', [$request, $response], $response->getProtocolVersion()],
67
- ['{res_version}', [$request], 'NULL'],
68
- ['{host}', [$request], $request->getHeaderLine('Host')],
69
- ['{hostname}', [$request, $response], gethostname()],
70
- ['{hostname}{hostname}', [$request, $response], gethostname() . gethostname()],
71
- ['{code}', [$request, $response], $response->getStatusCode()],
72
- ['{code}', [$request], 'NULL'],
73
- ['{phrase}', [$request, $response], $response->getReasonPhrase()],
74
- ['{phrase}', [$request], 'NULL'],
75
- ['{error}', [$request, $response, $err], 'Test'],
76
- ['{error}', [$request], 'NULL'],
77
- ['{req_header_x-test}', [$request], 'abc'],
78
- ['{req_header_x-not}', [$request], ''],
79
- ['{res_header_X-Baz}', [$request, $response], 'Bar'],
80
- ['{res_header_x-not}', [$request, $response], ''],
81
- ['{res_header_X-Baz}', [$request], 'NULL'],
82
- ];
83
- }
84
-
85
- /**
86
- * @dataProvider formatProvider
87
- */
88
- public function testFormatsMessages($template, $args, $result)
89
- {
90
- $f = new MessageFormatter($template);
91
- $this->assertEquals((string) $result, call_user_func_array(array($f, 'format'), $args));
92
- }
93
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/MiddlewareTest.php DELETED
@@ -1,230 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\Cookie\CookieJar;
5
- use GuzzleHttp\Cookie\SetCookie;
6
- use GuzzleHttp\Exception\RequestException;
7
- use GuzzleHttp\Handler\MockHandler;
8
- use GuzzleHttp\HandlerStack;
9
- use GuzzleHttp\MessageFormatter;
10
- use GuzzleHttp\Middleware;
11
- use GuzzleHttp\Promise\PromiseInterface;
12
- use GuzzleHttp\Psr7;
13
- use GuzzleHttp\Psr7\Request;
14
- use GuzzleHttp\Psr7\Response;
15
- use Psr\Http\Message\RequestInterface;
16
- use Psr\Http\Message\ResponseInterface;
17
- use Psr\Log\LoggerInterface;
18
- use Psr\Log\LoggerTrait;
19
- use PHPUnit\Framework\TestCase;
20
-
21
- class MiddlewareTest extends TestCase
22
- {
23
- public function testAddsCookiesToRequests()
24
- {
25
- $jar = new CookieJar();
26
- $m = Middleware::cookies($jar);
27
- $h = new MockHandler(
28
- [
29
- function (RequestInterface $request) {
30
- return new Response(200, [
31
- 'Set-Cookie' => new SetCookie([
32
- 'Name' => 'name',
33
- 'Value' => 'value',
34
- 'Domain' => 'foo.com'
35
- ])
36
- ]);
37
- }
38
- ]
39
- );
40
- $f = $m($h);
41
- $f(new Request('GET', 'http://foo.com'), ['cookies' => $jar])->wait();
42
- $this->assertCount(1, $jar);
43
- }
44
-
45
- /**
46
- * @expectedException \GuzzleHttp\Exception\ClientException
47
- */
48
- public function testThrowsExceptionOnHttpClientError()
49
- {
50
- $m = Middleware::httpErrors();
51
- $h = new MockHandler([new Response(404)]);
52
- $f = $m($h);
53
- $p = $f(new Request('GET', 'http://foo.com'), ['http_errors' => true]);
54
- $this->assertEquals('pending', $p->getState());
55
- $p->wait();
56
- $this->assertEquals('rejected', $p->getState());
57
- }
58
-
59
- /**
60
- * @expectedException \GuzzleHttp\Exception\ServerException
61
- */
62
- public function testThrowsExceptionOnHttpServerError()
63
- {
64
- $m = Middleware::httpErrors();
65
- $h = new MockHandler([new Response(500)]);
66
- $f = $m($h);
67
- $p = $f(new Request('GET', 'http://foo.com'), ['http_errors' => true]);
68
- $this->assertEquals('pending', $p->getState());
69
- $p->wait();
70
- $this->assertEquals('rejected', $p->getState());
71
- }
72
-
73
- /**
74
- * @dataProvider getHistoryUseCases
75
- */
76
- public function testTracksHistory($container)
77
- {
78
- $m = Middleware::history($container);
79
- $h = new MockHandler([new Response(200), new Response(201)]);
80
- $f = $m($h);
81
- $p1 = $f(new Request('GET', 'http://foo.com'), ['headers' => ['foo' => 'bar']]);
82
- $p2 = $f(new Request('HEAD', 'http://foo.com'), ['headers' => ['foo' => 'baz']]);
83
- $p1->wait();
84
- $p2->wait();
85
- $this->assertCount(2, $container);
86
- $this->assertEquals(200, $container[0]['response']->getStatusCode());
87
- $this->assertEquals(201, $container[1]['response']->getStatusCode());
88
- $this->assertEquals('GET', $container[0]['request']->getMethod());
89
- $this->assertEquals('HEAD', $container[1]['request']->getMethod());
90
- $this->assertEquals('bar', $container[0]['options']['headers']['foo']);
91
- $this->assertEquals('baz', $container[1]['options']['headers']['foo']);
92
- }
93
-
94
- public function getHistoryUseCases()
95
- {
96
- return [
97
- [[]], // 1. Container is an array
98
- [new \ArrayObject()] // 2. Container is an ArrayObject
99
- ];
100
- }
101
-
102
- public function testTracksHistoryForFailures()
103
- {
104
- $container = [];
105
- $m = Middleware::history($container);
106
- $request = new Request('GET', 'http://foo.com');
107
- $h = new MockHandler([new RequestException('error', $request)]);
108
- $f = $m($h);
109
- $f($request, [])->wait(false);
110
- $this->assertCount(1, $container);
111
- $this->assertEquals('GET', $container[0]['request']->getMethod());
112
- $this->assertInstanceOf(RequestException::class, $container[0]['error']);
113
- }
114
-
115
- public function testTapsBeforeAndAfter()
116
- {
117
- $calls = [];
118
- $m = function ($handler) use (&$calls) {
119
- return function ($request, $options) use ($handler, &$calls) {
120
- $calls[] = '2';
121
- return $handler($request, $options);
122
- };
123
- };
124
-
125
- $m2 = Middleware::tap(
126
- function (RequestInterface $request, array $options) use (&$calls) {
127
- $calls[] = '1';
128
- },
129
- function (RequestInterface $request, array $options, PromiseInterface $p) use (&$calls) {
130
- $calls[] = '3';
131
- }
132
- );
133
-
134
- $h = new MockHandler([new Response()]);
135
- $b = new HandlerStack($h);
136
- $b->push($m2);
137
- $b->push($m);
138
- $comp = $b->resolve();
139
- $p = $comp(new Request('GET', 'http://foo.com'), []);
140
- $this->assertEquals('123', implode('', $calls));
141
- $this->assertInstanceOf(PromiseInterface::class, $p);
142
- $this->assertEquals(200, $p->wait()->getStatusCode());
143
- }
144
-
145
- public function testMapsRequest()
146
- {
147
- $h = new MockHandler([
148
- function (RequestInterface $request, array $options) {
149
- $this->assertEquals('foo', $request->getHeaderLine('Bar'));
150
- return new Response(200);
151
- }
152
- ]);
153
- $stack = new HandlerStack($h);
154
- $stack->push(Middleware::mapRequest(function (RequestInterface $request) {
155
- return $request->withHeader('Bar', 'foo');
156
- }));
157
- $comp = $stack->resolve();
158
- $p = $comp(new Request('PUT', 'http://www.google.com'), []);
159
- $this->assertInstanceOf(PromiseInterface::class, $p);
160
- }
161
-
162
- public function testMapsResponse()
163
- {
164
- $h = new MockHandler([new Response(200)]);
165
- $stack = new HandlerStack($h);
166
- $stack->push(Middleware::mapResponse(function (ResponseInterface $response) {
167
- return $response->withHeader('Bar', 'foo');
168
- }));
169
- $comp = $stack->resolve();
170
- $p = $comp(new Request('PUT', 'http://www.google.com'), []);
171
- $p->wait();
172
- $this->assertEquals('foo', $p->wait()->getHeaderLine('Bar'));
173
- }
174
-
175
- public function testLogsRequestsAndResponses()
176
- {
177
- $h = new MockHandler([new Response(200)]);
178
- $stack = new HandlerStack($h);
179
- $logger = new Logger();
180
- $formatter = new MessageFormatter();
181
- $stack->push(Middleware::log($logger, $formatter));
182
- $comp = $stack->resolve();
183
- $p = $comp(new Request('PUT', 'http://www.google.com'), []);
184
- $p->wait();
185
- $this->assertContains('"PUT / HTTP/1.1" 200', $logger->output);
186
- }
187
-
188
- public function testLogsRequestsAndResponsesCustomLevel()
189
- {
190
- $h = new MockHandler([new Response(200)]);
191
- $stack = new HandlerStack($h);
192
- $logger = new Logger();
193
- $formatter = new MessageFormatter();
194
- $stack->push(Middleware::log($logger, $formatter, 'debug'));
195
- $comp = $stack->resolve();
196
- $p = $comp(new Request('PUT', 'http://www.google.com'), []);
197
- $p->wait();
198
- $this->assertContains('"PUT / HTTP/1.1" 200', $logger->output);
199
- $this->assertContains('[debug]', $logger->output);
200
- }
201
-
202
- public function testLogsRequestsAndErrors()
203
- {
204
- $h = new MockHandler([new Response(404)]);
205
- $stack = new HandlerStack($h);
206
- $logger = new Logger();
207
- $formatter = new MessageFormatter('{code} {error}');
208
- $stack->push(Middleware::log($logger, $formatter));
209
- $stack->push(Middleware::httpErrors());
210
- $comp = $stack->resolve();
211
- $p = $comp(new Request('PUT', 'http://www.google.com'), ['http_errors' => true]);
212
- $p->wait(false);
213
- $this->assertContains('PUT http://www.google.com', $logger->output);
214
- $this->assertContains('404 Not Found', $logger->output);
215
- }
216
- }
217
-
218
- /**
219
- * @internal
220
- */
221
- class Logger implements LoggerInterface
222
- {
223
- use LoggerTrait;
224
- public $output;
225
-
226
- public function log($level, $message, array $context = [])
227
- {
228
- $this->output .= "[{$level}] {$message}\n";
229
- }
230
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/PoolTest.php DELETED
@@ -1,171 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\Exception\ClientException;
5
- use GuzzleHttp\Handler\MockHandler;
6
- use GuzzleHttp\HandlerStack;
7
- use GuzzleHttp\Pool;
8
- use GuzzleHttp\Client;
9
- use GuzzleHttp\Psr7\Request;
10
- use GuzzleHttp\Psr7\Response;
11
- use GuzzleHttp\Promise\Promise;
12
- use Psr\Http\Message\RequestInterface;
13
- use PHPUnit\Framework\TestCase;
14
-
15
- class PoolTest extends TestCase
16
- {
17
- /**
18
- * @expectedException \InvalidArgumentException
19
- */
20
- public function testValidatesIterable()
21
- {
22
- $p = new Pool(new Client(), 'foo');
23
- $p->promise()->wait();
24
- }
25
-
26
- /**
27
- * @expectedException \InvalidArgumentException
28
- */
29
- public function testValidatesEachElement()
30
- {
31
- $c = new Client();
32
- $requests = ['foo'];
33
- $p = new Pool($c, new \ArrayIterator($requests));
34
- $p->promise()->wait();
35
- }
36
-
37
- public function testSendsAndRealizesFuture()
38
- {
39
- $c = $this->getClient();
40
- $p = new Pool($c, [new Request('GET', 'http://example.com')]);
41
- $p->promise()->wait();
42
- }
43
-
44
- public function testExecutesPendingWhenWaiting()
45
- {
46
- $r1 = new Promise(function () use (&$r1) { $r1->resolve(new Response()); });
47
- $r2 = new Promise(function () use (&$r2) { $r2->resolve(new Response()); });
48
- $r3 = new Promise(function () use (&$r3) { $r3->resolve(new Response()); });
49
- $handler = new MockHandler([$r1, $r2, $r3]);
50
- $c = new Client(['handler' => $handler]);
51
- $p = new Pool($c, [
52
- new Request('GET', 'http://example.com'),
53
- new Request('GET', 'http://example.com'),
54
- new Request('GET', 'http://example.com'),
55
- ], ['pool_size' => 2]);
56
- $p->promise()->wait();
57
- }
58
-
59
- public function testUsesRequestOptions()
60
- {
61
- $h = [];
62
- $handler = new MockHandler([
63
- function (RequestInterface $request) use (&$h) {
64
- $h[] = $request;
65
- return new Response();
66
- }
67
- ]);
68
- $c = new Client(['handler' => $handler]);
69
- $opts = ['options' => ['headers' => ['x-foo' => 'bar']]];
70
- $p = new Pool($c, [new Request('GET', 'http://example.com')], $opts);
71
- $p->promise()->wait();
72
- $this->assertCount(1, $h);
73
- $this->assertTrue($h[0]->hasHeader('x-foo'));
74
- }
75
-
76
- public function testCanProvideCallablesThatReturnResponses()
77
- {
78
- $h = [];
79
- $handler = new MockHandler([
80
- function (RequestInterface $request) use (&$h) {
81
- $h[] = $request;
82
- return new Response();
83
- }
84
- ]);
85
- $c = new Client(['handler' => $handler]);
86
- $optHistory = [];
87
- $fn = function (array $opts) use (&$optHistory, $c) {
88
- $optHistory = $opts;
89
- return $c->request('GET', 'http://example.com', $opts);
90
- };
91
- $opts = ['options' => ['headers' => ['x-foo' => 'bar']]];
92
- $p = new Pool($c, [$fn], $opts);
93
- $p->promise()->wait();
94
- $this->assertCount(1, $h);
95
- $this->assertTrue($h[0]->hasHeader('x-foo'));
96
- }
97
-
98
- public function testBatchesResults()
99
- {
100
- $requests = [
101
- new Request('GET', 'http://foo.com/200'),
102
- new Request('GET', 'http://foo.com/201'),
103
- new Request('GET', 'http://foo.com/202'),
104
- new Request('GET', 'http://foo.com/404'),
105
- ];
106
- $fn = function (RequestInterface $request) {
107
- return new Response(substr($request->getUri()->getPath(), 1));
108
- };
109
- $mock = new MockHandler([$fn, $fn, $fn, $fn]);
110
- $handler = HandlerStack::create($mock);
111
- $client = new Client(['handler' => $handler]);
112
- $results = Pool::batch($client, $requests);
113
- $this->assertCount(4, $results);
114
- $this->assertEquals([0, 1, 2, 3], array_keys($results));
115
- $this->assertEquals(200, $results[0]->getStatusCode());
116
- $this->assertEquals(201, $results[1]->getStatusCode());
117
- $this->assertEquals(202, $results[2]->getStatusCode());
118
- $this->assertInstanceOf(ClientException::class, $results[3]);
119
- }
120
-
121
- public function testBatchesResultsWithCallbacks()
122
- {
123
- $requests = [
124
- new Request('GET', 'http://foo.com/200'),
125
- new Request('GET', 'http://foo.com/201')
126
- ];
127
- $mock = new MockHandler([
128
- function (RequestInterface $request) {
129
- return new Response(substr($request->getUri()->getPath(), 1));
130
- }
131
- ]);
132
- $client = new Client(['handler' => $mock]);
133
- $results = Pool::batch($client, $requests, [
134
- 'fulfilled' => function ($value) use (&$called) { $called = true; }
135
- ]);
136
- $this->assertCount(2, $results);
137
- $this->assertTrue($called);
138
- }
139
-
140
- public function testUsesYieldedKeyInFulfilledCallback()
141
- {
142
- $r1 = new Promise(function () use (&$r1) { $r1->resolve(new Response()); });
143
- $r2 = new Promise(function () use (&$r2) { $r2->resolve(new Response()); });
144
- $r3 = new Promise(function () use (&$r3) { $r3->resolve(new Response()); });
145
- $handler = new MockHandler([$r1, $r2, $r3]);
146
- $c = new Client(['handler' => $handler]);
147
- $keys = [];
148
- $requests = [
149
- 'request_1' => new Request('GET', 'http://example.com'),
150
- 'request_2' => new Request('GET', 'http://example.com'),
151
- 'request_3' => new Request('GET', 'http://example.com'),
152
- ];
153
- $p = new Pool($c, $requests, [
154
- 'pool_size' => 2,
155
- 'fulfilled' => function($res, $index) use (&$keys) { $keys[] = $index; }
156
- ]);
157
- $p->promise()->wait();
158
- $this->assertCount(3, $keys);
159
- $this->assertSame($keys, array_keys($requests));
160
- }
161
-
162
- private function getClient($total = 1)
163
- {
164
- $queue = [];
165
- for ($i = 0; $i < $total; $i++) {
166
- $queue[] = new Response();
167
- }
168
- $handler = new MockHandler($queue);
169
- return new Client(['handler' => $handler]);
170
- }
171
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/PrepareBodyMiddlewareTest.php DELETED
@@ -1,153 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\Handler\MockHandler;
5
- use GuzzleHttp\HandlerStack;
6
- use GuzzleHttp\Middleware;
7
- use GuzzleHttp\Promise\PromiseInterface;
8
- use GuzzleHttp\Psr7;
9
- use GuzzleHttp\Psr7\FnStream;
10
- use GuzzleHttp\Psr7\Request;
11
- use GuzzleHttp\Psr7\Response;
12
- use Psr\Http\Message\RequestInterface;
13
- use PHPUnit\Framework\TestCase;
14
-
15
- class PrepareBodyMiddlewareTest extends TestCase
16
- {
17
- public function methodProvider()
18
- {
19
- $methods = ['GET', 'PUT', 'POST'];
20
- $bodies = ['Test', ''];
21
- foreach ($methods as $method) {
22
- foreach ($bodies as $body) {
23
- yield [$method, $body];
24
- }
25
- }
26
- }
27
- /**
28
- * @dataProvider methodProvider
29
- */
30
- public function testAddsContentLengthWhenMissingAndPossible($method, $body)
31
- {
32
- $h = new MockHandler([
33
- function (RequestInterface $request) use ($body) {
34
- $length = strlen($body);
35
- if ($length > 0) {
36
- $this->assertEquals($length, $request->getHeaderLine('Content-Length'));
37
- } else {
38
- $this->assertFalse($request->hasHeader('Content-Length'));
39
- }
40
- return new Response(200);
41
- }
42
- ]);
43
- $m = Middleware::prepareBody();
44
- $stack = new HandlerStack($h);
45
- $stack->push($m);
46
- $comp = $stack->resolve();
47
- $p = $comp(new Request($method, 'http://www.google.com', [], $body), []);
48
- $this->assertInstanceOf(PromiseInterface::class, $p);
49
- $response = $p->wait();
50
- $this->assertEquals(200, $response->getStatusCode());
51
- }
52
-
53
- public function testAddsTransferEncodingWhenNoContentLength()
54
- {
55
- $body = FnStream::decorate(Psr7\stream_for('foo'), [
56
- 'getSize' => function () { return null; }
57
- ]);
58
- $h = new MockHandler([
59
- function (RequestInterface $request) {
60
- $this->assertFalse($request->hasHeader('Content-Length'));
61
- $this->assertEquals('chunked', $request->getHeaderLine('Transfer-Encoding'));
62
- return new Response(200);
63
- }
64
- ]);
65
- $m = Middleware::prepareBody();
66
- $stack = new HandlerStack($h);
67
- $stack->push($m);
68
- $comp = $stack->resolve();
69
- $p = $comp(new Request('PUT', 'http://www.google.com', [], $body), []);
70
- $this->assertInstanceOf(PromiseInterface::class, $p);
71
- $response = $p->wait();
72
- $this->assertEquals(200, $response->getStatusCode());
73
- }
74
-
75
- public function testAddsContentTypeWhenMissingAndPossible()
76
- {
77
- $bd = Psr7\stream_for(fopen(__DIR__ . '/../composer.json', 'r'));
78
- $h = new MockHandler([
79
- function (RequestInterface $request) {
80
- $this->assertEquals('application/json', $request->getHeaderLine('Content-Type'));
81
- $this->assertTrue($request->hasHeader('Content-Length'));
82
- return new Response(200);
83
- }
84
- ]);
85
- $m = Middleware::prepareBody();
86
- $stack = new HandlerStack($h);
87
- $stack->push($m);
88
- $comp = $stack->resolve();
89
- $p = $comp(new Request('PUT', 'http://www.google.com', [], $bd), []);
90
- $this->assertInstanceOf(PromiseInterface::class, $p);
91
- $response = $p->wait();
92
- $this->assertEquals(200, $response->getStatusCode());
93
- }
94
-
95
- public function expectProvider()
96
- {
97
- return [
98
- [true, ['100-Continue']],
99
- [false, []],
100
- [10, ['100-Continue']],
101
- [500000, []]
102
- ];
103
- }
104
-
105
- /**
106
- * @dataProvider expectProvider
107
- */
108
- public function testAddsExpect($value, $result)
109
- {
110
- $bd = Psr7\stream_for(fopen(__DIR__ . '/../composer.json', 'r'));
111
-
112
- $h = new MockHandler([
113
- function (RequestInterface $request) use ($result) {
114
- $this->assertEquals($result, $request->getHeader('Expect'));
115
- return new Response(200);
116
- }
117
- ]);
118
-
119
- $m = Middleware::prepareBody();
120
- $stack = new HandlerStack($h);
121
- $stack->push($m);
122
- $comp = $stack->resolve();
123
- $p = $comp(new Request('PUT', 'http://www.google.com', [], $bd), [
124
- 'expect' => $value
125
- ]);
126
- $this->assertInstanceOf(PromiseInterface::class, $p);
127
- $response = $p->wait();
128
- $this->assertEquals(200, $response->getStatusCode());
129
- }
130
-
131
- public function testIgnoresIfExpectIsPresent()
132
- {
133
- $bd = Psr7\stream_for(fopen(__DIR__ . '/../composer.json', 'r'));
134
- $h = new MockHandler([
135
- function (RequestInterface $request) {
136
- $this->assertEquals(['Foo'], $request->getHeader('Expect'));
137
- return new Response(200);
138
- }
139
- ]);
140
-
141
- $m = Middleware::prepareBody();
142
- $stack = new HandlerStack($h);
143
- $stack->push($m);
144
- $comp = $stack->resolve();
145
- $p = $comp(
146
- new Request('PUT', 'http://www.google.com', ['Expect' => 'Foo'], $bd),
147
- ['expect' => true]
148
- );
149
- $this->assertInstanceOf(PromiseInterface::class, $p);
150
- $response = $p->wait();
151
- $this->assertEquals(200, $response->getStatusCode());
152
- }
153
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/RedirectMiddlewareTest.php DELETED
@@ -1,261 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\Client;
5
- use GuzzleHttp\Handler\MockHandler;
6
- use GuzzleHttp\HandlerStack;
7
- use GuzzleHttp\Middleware;
8
- use GuzzleHttp\Psr7\Request;
9
- use GuzzleHttp\Psr7\Response;
10
- use GuzzleHttp\RedirectMiddleware;
11
- use Psr\Http\Message\RequestInterface;
12
- use PHPUnit\Framework\TestCase;
13
-
14
- /**
15
- * @covers GuzzleHttp\RedirectMiddleware
16
- */
17
- class RedirectMiddlewareTest extends TestCase
18
- {
19
- public function testIgnoresNonRedirects()
20
- {
21
- $response = new Response(200);
22
- $stack = new HandlerStack(new MockHandler([$response]));
23
- $stack->push(Middleware::redirect());
24
- $handler = $stack->resolve();
25
- $request = new Request('GET', 'http://example.com');
26
- $promise = $handler($request, []);
27
- $response = $promise->wait();
28
- $this->assertEquals(200, $response->getStatusCode());
29
- }
30
-
31
- public function testIgnoresWhenNoLocation()
32
- {
33
- $response = new Response(304);
34
- $stack = new HandlerStack(new MockHandler([$response]));
35
- $stack->push(Middleware::redirect());
36
- $handler = $stack->resolve();
37
- $request = new Request('GET', 'http://example.com');
38
- $promise = $handler($request, []);
39
- $response = $promise->wait();
40
- $this->assertEquals(304, $response->getStatusCode());
41
- }
42
-
43
- public function testRedirectsWithAbsoluteUri()
44
- {
45
- $mock = new MockHandler([
46
- new Response(302, ['Location' => 'http://test.com']),
47
- new Response(200)
48
- ]);
49
- $stack = new HandlerStack($mock);
50
- $stack->push(Middleware::redirect());
51
- $handler = $stack->resolve();
52
- $request = new Request('GET', 'http://example.com?a=b');
53
- $promise = $handler($request, [
54
- 'allow_redirects' => ['max' => 2]
55
- ]);
56
- $response = $promise->wait();
57
- $this->assertEquals(200, $response->getStatusCode());
58
- $this->assertEquals('http://test.com', $mock->getLastRequest()->getUri());
59
- }
60
-
61
- public function testRedirectsWithRelativeUri()
62
- {
63
- $mock = new MockHandler([
64
- new Response(302, ['Location' => '/foo']),
65
- new Response(200)
66
- ]);
67
- $stack = new HandlerStack($mock);
68
- $stack->push(Middleware::redirect());
69
- $handler = $stack->resolve();
70
- $request = new Request('GET', 'http://example.com?a=b');
71
- $promise = $handler($request, [
72
- 'allow_redirects' => ['max' => 2]
73
- ]);
74
- $response = $promise->wait();
75
- $this->assertEquals(200, $response->getStatusCode());
76
- $this->assertEquals('http://example.com/foo', $mock->getLastRequest()->getUri());
77
- }
78
-
79
- /**
80
- * @expectedException \GuzzleHttp\Exception\TooManyRedirectsException
81
- * @expectedExceptionMessage Will not follow more than 3 redirects
82
- */
83
- public function testLimitsToMaxRedirects()
84
- {
85
- $mock = new MockHandler([
86
- new Response(301, ['Location' => 'http://test.com']),
87
- new Response(302, ['Location' => 'http://test.com']),
88
- new Response(303, ['Location' => 'http://test.com']),
89
- new Response(304, ['Location' => 'http://test.com'])
90
- ]);
91
- $stack = new HandlerStack($mock);
92
- $stack->push(Middleware::redirect());
93
- $handler = $stack->resolve();
94
- $request = new Request('GET', 'http://example.com');
95
- $promise = $handler($request, ['allow_redirects' => ['max' => 3]]);
96
- $promise->wait();
97
- }
98
-
99
- /**
100
- * @expectedException \GuzzleHttp\Exception\BadResponseException
101
- * @expectedExceptionMessage Redirect URI,
102
- */
103
- public function testEnsuresProtocolIsValid()
104
- {
105
- $mock = new MockHandler([
106
- new Response(301, ['Location' => 'ftp://test.com'])
107
- ]);
108
- $stack = new HandlerStack($mock);
109
- $stack->push(Middleware::redirect());
110
- $handler = $stack->resolve();
111
- $request = new Request('GET', 'http://example.com');
112
- $handler($request, ['allow_redirects' => ['max' => 3]])->wait();
113
- }
114
-
115
- public function testAddsRefererHeader()
116
- {
117
- $mock = new MockHandler([
118
- new Response(302, ['Location' => 'http://test.com']),
119
- new Response(200)
120
- ]);
121
- $stack = new HandlerStack($mock);
122
- $stack->push(Middleware::redirect());
123
- $handler = $stack->resolve();
124
- $request = new Request('GET', 'http://example.com?a=b');
125
- $promise = $handler($request, [
126
- 'allow_redirects' => ['max' => 2, 'referer' => true]
127
- ]);
128
- $promise->wait();
129
- $this->assertEquals(
130
- 'http://example.com?a=b',
131
- $mock->getLastRequest()->getHeaderLine('Referer')
132
- );
133
- }
134
-
135
- public function testAddsGuzzleRedirectHeader()
136
- {
137
- $mock = new MockHandler([
138
- new Response(302, ['Location' => 'http://example.com']),
139
- new Response(302, ['Location' => 'http://example.com/foo']),
140
- new Response(302, ['Location' => 'http://example.com/bar']),
141
- new Response(200)
142
- ]);
143
-
144
- $stack = new HandlerStack($mock);
145
- $stack->push(Middleware::redirect());
146
- $handler = $stack->resolve();
147
- $request = new Request('GET', 'http://example.com?a=b');
148
- $promise = $handler($request, [
149
- 'allow_redirects' => ['track_redirects' => true]
150
- ]);
151
- $response = $promise->wait(true);
152
- $this->assertEquals(
153
- [
154
- 'http://example.com',
155
- 'http://example.com/foo',
156
- 'http://example.com/bar',
157
- ],
158
- $response->getHeader(RedirectMiddleware::HISTORY_HEADER)
159
- );
160
- }
161
-
162
- public function testAddsGuzzleRedirectStatusHeader()
163
- {
164
- $mock = new MockHandler([
165
- new Response(301, ['Location' => 'http://example.com']),
166
- new Response(302, ['Location' => 'http://example.com/foo']),
167
- new Response(301, ['Location' => 'http://example.com/bar']),
168
- new Response(302, ['Location' => 'http://example.com/baz']),
169
- new Response(200)
170
- ]);
171
-
172
- $stack = new HandlerStack($mock);
173
- $stack->push(Middleware::redirect());
174
- $handler = $stack->resolve();
175
- $request = new Request('GET', 'http://example.com?a=b');
176
- $promise = $handler($request, [
177
- 'allow_redirects' => ['track_redirects' => true]
178
- ]);
179
- $response = $promise->wait(true);
180
- $this->assertEquals(
181
- [
182
- 301,
183
- 302,
184
- 301,
185
- 302,
186
- ],
187
- $response->getHeader(RedirectMiddleware::STATUS_HISTORY_HEADER)
188
- );
189
- }
190
-
191
- public function testDoesNotAddRefererWhenGoingFromHttpsToHttp()
192
- {
193
- $mock = new MockHandler([
194
- new Response(302, ['Location' => 'http://test.com']),
195
- new Response(200)
196
- ]);
197
- $stack = new HandlerStack($mock);
198
- $stack->push(Middleware::redirect());
199
- $handler = $stack->resolve();
200
- $request = new Request('GET', 'https://example.com?a=b');
201
- $promise = $handler($request, [
202
- 'allow_redirects' => ['max' => 2, 'referer' => true]
203
- ]);
204
- $promise->wait();
205
- $this->assertFalse($mock->getLastRequest()->hasHeader('Referer'));
206
- }
207
-
208
- public function testInvokesOnRedirectForRedirects()
209
- {
210
- $mock = new MockHandler([
211
- new Response(302, ['Location' => 'http://test.com']),
212
- new Response(200)
213
- ]);
214
- $stack = new HandlerStack($mock);
215
- $stack->push(Middleware::redirect());
216
- $handler = $stack->resolve();
217
- $request = new Request('GET', 'http://example.com?a=b');
218
- $call = false;
219
- $promise = $handler($request, [
220
- 'allow_redirects' => [
221
- 'max' => 2,
222
- 'on_redirect' => function ($request, $response, $uri) use (&$call) {
223
- $this->assertEquals(302, $response->getStatusCode());
224
- $this->assertEquals('GET', $request->getMethod());
225
- $this->assertEquals('http://test.com', (string) $uri);
226
- $call = true;
227
- }
228
- ]
229
- ]);
230
- $promise->wait();
231
- $this->assertTrue($call);
232
- }
233
-
234
- public function testRemoveAuthorizationHeaderOnRedirect()
235
- {
236
- $mock = new MockHandler([
237
- new Response(302, ['Location' => 'http://test.com']),
238
- function (RequestInterface $request) {
239
- $this->assertFalse($request->hasHeader('Authorization'));
240
- return new Response(200);
241
- }
242
- ]);
243
- $handler = HandlerStack::create($mock);
244
- $client = new Client(['handler' => $handler]);
245
- $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass']]);
246
- }
247
-
248
- public function testNotRemoveAuthorizationHeaderOnRedirect()
249
- {
250
- $mock = new MockHandler([
251
- new Response(302, ['Location' => 'http://example.com/2']),
252
- function (RequestInterface $request) {
253
- $this->assertTrue($request->hasHeader('Authorization'));
254
- return new Response(200);
255
- }
256
- ]);
257
- $handler = HandlerStack::create($mock);
258
- $client = new Client(['handler' => $handler]);
259
- $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass']]);
260
- }
261
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/RetryMiddlewareTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\Client;
5
- use GuzzleHttp\Handler\MockHandler;
6
- use GuzzleHttp\Middleware;
7
- use GuzzleHttp\Psr7;
8
- use GuzzleHttp\Psr7\Request;
9
- use GuzzleHttp\Psr7\Response;
10
- use GuzzleHttp\RetryMiddleware;
11
- use PHPUnit\Framework\TestCase;
12
-
13
- class RetryMiddlewareTest extends TestCase
14
- {
15
- public function testRetriesWhenDeciderReturnsTrue()
16
- {
17
- $delayCalls = 0;
18
- $calls = [];
19
- $decider = function ($retries, $request, $response, $error) use (&$calls) {
20
- $calls[] = func_get_args();
21
- return count($calls) < 3;
22
- };
23
- $delay = function ($retries, $response) use (&$delayCalls) {
24
- $delayCalls++;
25
- $this->assertEquals($retries, $delayCalls);
26
- $this->assertInstanceOf(Response::class, $response);
27
- return 1;
28
- };
29
- $m = Middleware::retry($decider, $delay);
30
- $h = new MockHandler([new Response(200), new Response(201), new Response(202)]);
31
- $f = $m($h);
32
- $c = new Client(['handler' => $f]);
33
- $p = $c->sendAsync(new Request('GET', 'http://test.com'), []);
34
- $p->wait();
35
- $this->assertCount(3, $calls);
36
- $this->assertEquals(2, $delayCalls);
37
- $this->assertEquals(202, $p->wait()->getStatusCode());
38
- }
39
-
40
- public function testDoesNotRetryWhenDeciderReturnsFalse()
41
- {
42
- $decider = function () { return false; };
43
- $m = Middleware::retry($decider);
44
- $h = new MockHandler([new Response(200)]);
45
- $c = new Client(['handler' => $m($h)]);
46
- $p = $c->sendAsync(new Request('GET', 'http://test.com'), []);
47
- $this->assertEquals(200, $p->wait()->getStatusCode());
48
- }
49
-
50
- public function testCanRetryExceptions()
51
- {
52
- $calls = [];
53
- $decider = function ($retries, $request, $response, $error) use (&$calls) {
54
- $calls[] = func_get_args();
55
- return $error instanceof \Exception;
56
- };
57
- $m = Middleware::retry($decider);
58
- $h = new MockHandler([new \Exception(), new Response(201)]);
59
- $c = new Client(['handler' => $m($h)]);
60
- $p = $c->sendAsync(new Request('GET', 'http://test.com'), []);
61
- $this->assertEquals(201, $p->wait()->getStatusCode());
62
- $this->assertCount(2, $calls);
63
- $this->assertEquals(0, $calls[0][0]);
64
- $this->assertNull($calls[0][2]);
65
- $this->assertInstanceOf('Exception', $calls[0][3]);
66
- $this->assertEquals(1, $calls[1][0]);
67
- $this->assertInstanceOf(Response::class, $calls[1][2]);
68
- $this->assertNull($calls[1][3]);
69
- }
70
-
71
- public function testBackoffCalculateDelay()
72
- {
73
- $this->assertEquals(0, RetryMiddleware::exponentialDelay(0));
74
- $this->assertEquals(1, RetryMiddleware::exponentialDelay(1));
75
- $this->assertEquals(2, RetryMiddleware::exponentialDelay(2));
76
- $this->assertEquals(4, RetryMiddleware::exponentialDelay(3));
77
- $this->assertEquals(8, RetryMiddleware::exponentialDelay(4));
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/Server.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\Client;
5
- use GuzzleHttp\Psr7;
6
- use Psr\Http\Message\ResponseInterface;
7
-
8
- /**
9
- * The Server class is used to control a scripted webserver using node.js that
10
- * will respond to HTTP requests with queued responses.
11
- *
12
- * Queued responses will be served to requests using a FIFO order. All requests
13
- * received by the server are stored on the node.js server and can be retrieved
14
- * by calling {@see Server::received()}.
15
- *
16
- * Mock responses that don't require data to be transmitted over HTTP a great
17
- * for testing. Mock response, however, cannot test the actual sending of an
18
- * HTTP request using cURL. This test server allows the simulation of any
19
- * number of HTTP request response transactions to test the actual sending of
20
- * requests over the wire without having to leave an internal network.
21
- */
22
- class Server
23
- {
24
- /** @var Client */
25
- private static $client;
26
- private static $started = false;
27
- public static $url = 'http://127.0.0.1:8126/';
28
- public static $port = 8126;
29
-
30
- /**
31
- * Flush the received requests from the server
32
- * @throws \RuntimeException
33
- */
34
- public static function flush()
35
- {
36
- return self::getClient()->request('DELETE', 'guzzle-server/requests');
37
- }
38
-
39
- /**
40
- * Queue an array of responses or a single response on the server.
41
- *
42
- * Any currently queued responses will be overwritten. Subsequent requests
43
- * on the server will return queued responses in FIFO order.
44
- *
45
- * @param array|ResponseInterface $responses A single or array of Responses
46
- * to queue.
47
- * @throws \Exception
48
- */
49
- public static function enqueue($responses)
50
- {
51
- $data = [];
52
- foreach ((array) $responses as $response) {
53
- if (!($response instanceof ResponseInterface)) {
54
- throw new \Exception('Invalid response given.');
55
- }
56
- $headers = array_map(function ($h) {
57
- return implode(' ,', $h);
58
- }, $response->getHeaders());
59
-
60
- $data[] = [
61
- 'status' => (string) $response->getStatusCode(),
62
- 'reason' => $response->getReasonPhrase(),
63
- 'headers' => $headers,
64
- 'body' => base64_encode((string) $response->getBody())
65
- ];
66
- }
67
-
68
- self::getClient()->request('PUT', 'guzzle-server/responses', [
69
- 'json' => $data
70
- ]);
71
- }
72
-
73
- /**
74
- * Get all of the received requests
75
- *
76
- * @return ResponseInterface[]
77
- * @throws \RuntimeException
78
- */
79
- public static function received()
80
- {
81
- if (!self::$started) {
82
- return [];
83
- }
84
-
85
- $response = self::getClient()->request('GET', 'guzzle-server/requests');
86
- $data = json_decode($response->getBody(), true);
87
-
88
- return array_map(
89
- function ($message) {
90
- $uri = $message['uri'];
91
- if (isset($message['query_string'])) {
92
- $uri .= '?' . $message['query_string'];
93
- }
94
- $response = new Psr7\Request(
95
- $message['http_method'],
96
- $uri,
97
- $message['headers'],
98
- $message['body'],
99
- $message['version']
100
- );
101
- return $response->withUri(
102
- $response->getUri()
103
- ->withScheme('http')
104
- ->withHost($response->getHeaderLine('host'))
105
- );
106
- },
107
- $data
108
- );
109
- }
110
-
111
- /**
112
- * Stop running the node.js server
113
- */
114
- public static function stop()
115
- {
116
- if (self::$started) {
117
- self::getClient()->request('DELETE', 'guzzle-server');
118
- }
119
-
120
- self::$started = false;
121
- }
122
-
123
- public static function wait($maxTries = 5)
124
- {
125
- $tries = 0;
126
- while (!self::isListening() && ++$tries < $maxTries) {
127
- usleep(100000);
128
- }
129
-
130
- if (!self::isListening()) {
131
- throw new \RuntimeException('Unable to contact node.js server');
132
- }
133
- }
134
-
135
- public static function start()
136
- {
137
- if (self::$started) {
138
- return;
139
- }
140
-
141
- if (!self::isListening()) {
142
- exec('node ' . __DIR__ . '/server.js '
143
- . self::$port . ' >> /tmp/server.log 2>&1 &');
144
- self::wait();
145
- }
146
-
147
- self::$started = true;
148
- }
149
-
150
- private static function isListening()
151
- {
152
- try {
153
- self::getClient()->request('GET', 'guzzle-server/perf', [
154
- 'connect_timeout' => 5,
155
- 'timeout' => 5
156
- ]);
157
- return true;
158
- } catch (\Exception $e) {
159
- return false;
160
- }
161
- }
162
-
163
- private static function getClient()
164
- {
165
- if (!self::$client) {
166
- self::$client = new Client([
167
- 'base_uri' => self::$url,
168
- 'sync' => true,
169
- ]);
170
- }
171
-
172
- return self::$client;
173
- }
174
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/TransferStatsTest.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\TransferStats;
5
- use GuzzleHttp\Psr7;
6
- use PHPUnit\Framework\TestCase;
7
-
8
- class TransferStatsTest extends TestCase
9
- {
10
- public function testHasData()
11
- {
12
- $request = new Psr7\Request('GET', 'http://foo.com');
13
- $response = new Psr7\Response();
14
- $stats = new TransferStats(
15
- $request,
16
- $response,
17
- 10.5,
18
- null,
19
- ['foo' => 'bar']
20
- );
21
- $this->assertSame($request, $stats->getRequest());
22
- $this->assertSame($response, $stats->getResponse());
23
- $this->assertTrue($stats->hasResponse());
24
- $this->assertEquals(['foo' => 'bar'], $stats->getHandlerStats());
25
- $this->assertEquals('bar', $stats->getHandlerStat('foo'));
26
- $this->assertSame($request->getUri(), $stats->getEffectiveUri());
27
- $this->assertEquals(10.5, $stats->getTransferTime());
28
- $this->assertNull($stats->getHandlerErrorData());
29
- }
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/UriTemplateTest.php DELETED
@@ -1,202 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests;
3
-
4
- use GuzzleHttp\UriTemplate;
5
- use PHPUnit\Framework\TestCase;
6
-
7
- /**
8
- * @covers GuzzleHttp\UriTemplate
9
- */
10
- class UriTemplateTest extends TestCase
11
- {
12
- /**
13
- * @return array
14
- */
15
- public function templateProvider()
16
- {
17
- $params = array(
18
- 'var' => 'value',
19
- 'hello' => 'Hello World!',
20
- 'empty' => '',
21
- 'path' => '/foo/bar',
22
- 'x' => '1024',
23
- 'y' => '768',
24
- 'null' => null,
25
- 'list' => array('red', 'green', 'blue'),
26
- 'keys' => array(
27
- "semi" => ';',
28
- "dot" => '.',
29
- "comma" => ','
30
- ),
31
- 'empty_keys' => array(),
32
- );
33
-
34
- return array_map(function ($t) use ($params) {
35
- $t[] = $params;
36
- return $t;
37
- }, array(
38
- array('foo', 'foo'),
39
- array('{var}', 'value'),
40
- array('{hello}', 'Hello%20World%21'),
41
- array('{+var}', 'value'),
42
- array('{+hello}', 'Hello%20World!'),
43
- array('{+path}/here', '/foo/bar/here'),
44
- array('here?ref={+path}', 'here?ref=/foo/bar'),
45
- array('X{#var}', 'X#value'),
46
- array('X{#hello}', 'X#Hello%20World!'),
47
- array('map?{x,y}', 'map?1024,768'),
48
- array('{x,hello,y}', '1024,Hello%20World%21,768'),
49
- array('{+x,hello,y}', '1024,Hello%20World!,768'),
50
- array('{+path,x}/here', '/foo/bar,1024/here'),
51
- array('{#x,hello,y}', '#1024,Hello%20World!,768'),
52
- array('{#path,x}/here', '#/foo/bar,1024/here'),
53
- array('X{.var}', 'X.value'),
54
- array('X{.x,y}', 'X.1024.768'),
55
- array('{/var}', '/value'),
56
- array('{/var,x}/here', '/value/1024/here'),
57
- array('{;x,y}', ';x=1024;y=768'),
58
- array('{;x,y,empty}', ';x=1024;y=768;empty'),
59
- array('{?x,y}', '?x=1024&y=768'),
60
- array('{?x,y,empty}', '?x=1024&y=768&empty='),
61
- array('?fixed=yes{&x}', '?fixed=yes&x=1024'),
62
- array('{&x,y,empty}', '&x=1024&y=768&empty='),
63
- array('{var:3}', 'val'),
64
- array('{var:30}', 'value'),
65
- array('{list}', 'red,green,blue'),
66
- array('{list*}', 'red,green,blue'),
67
- array('{keys}', 'semi,%3B,dot,.,comma,%2C'),
68
- array('{keys*}', 'semi=%3B,dot=.,comma=%2C'),
69
- array('{+path:6}/here', '/foo/b/here'),
70
- array('{+list}', 'red,green,blue'),
71
- array('{+list*}', 'red,green,blue'),
72
- array('{+keys}', 'semi,;,dot,.,comma,,'),
73
- array('{+keys*}', 'semi=;,dot=.,comma=,'),
74
- array('{#path:6}/here', '#/foo/b/here'),
75
- array('{#list}', '#red,green,blue'),
76
- array('{#list*}', '#red,green,blue'),
77
- array('{#keys}', '#semi,;,dot,.,comma,,'),
78
- array('{#keys*}', '#semi=;,dot=.,comma=,'),
79
- array('X{.var:3}', 'X.val'),
80
- array('X{.list}', 'X.red,green,blue'),
81
- array('X{.list*}', 'X.red.green.blue'),
82
- array('X{.keys}', 'X.semi,%3B,dot,.,comma,%2C'),
83
- array('X{.keys*}', 'X.semi=%3B.dot=..comma=%2C'),
84
- array('{/var:1,var}', '/v/value'),
85
- array('{/list}', '/red,green,blue'),
86
- array('{/list*}', '/red/green/blue'),
87
- array('{/list*,path:4}', '/red/green/blue/%2Ffoo'),
88
- array('{/keys}', '/semi,%3B,dot,.,comma,%2C'),
89
- array('{/keys*}', '/semi=%3B/dot=./comma=%2C'),
90
- array('{;hello:5}', ';hello=Hello'),
91
- array('{;list}', ';list=red,green,blue'),
92
- array('{;list*}', ';list=red;list=green;list=blue'),
93
- array('{;keys}', ';keys=semi,%3B,dot,.,comma,%2C'),
94
- array('{;keys*}', ';semi=%3B;dot=.;comma=%2C'),
95
- array('{?var:3}', '?var=val'),
96
- array('{?list}', '?list=red,green,blue'),
97
- array('{?list*}', '?list=red&list=green&list=blue'),
98
- array('{?keys}', '?keys=semi,%3B,dot,.,comma,%2C'),
99
- array('{?keys*}', '?semi=%3B&dot=.&comma=%2C'),
100
- array('{&var:3}', '&var=val'),
101
- array('{&list}', '&list=red,green,blue'),
102
- array('{&list*}', '&list=red&list=green&list=blue'),
103
- array('{&keys}', '&keys=semi,%3B,dot,.,comma,%2C'),
104
- array('{&keys*}', '&semi=%3B&dot=.&comma=%2C'),
105
- array('{.null}', ''),
106
- array('{.null,var}', '.value'),
107
- array('X{.empty_keys*}', 'X'),
108
- array('X{.empty_keys}', 'X'),
109
- // Test that missing expansions are skipped
110
- array('test{&missing*}', 'test'),
111
- // Test that multiple expansions can be set
112
- array('http://{var}/{var:2}{?keys*}', 'http://value/va?semi=%3B&dot=.&comma=%2C'),
113
- // Test more complex query string stuff
114
- array('http://www.test.com{+path}{?var,keys*}', 'http://www.test.com/foo/bar?var=value&semi=%3B&dot=.&comma=%2C')
115
- ));
116
- }
117
-
118
- /**
119
- * @dataProvider templateProvider
120
- */
121
- public function testExpandsUriTemplates($template, $expansion, $params)
122
- {
123
- $uri = new UriTemplate();
124
- $this->assertEquals($expansion, $uri->expand($template, $params));
125
- }
126
-
127
- public function expressionProvider()
128
- {
129
- return array(
130
- array(
131
- '{+var*}', array(
132
- 'operator' => '+',
133
- 'values' => array(
134
- array('value' => 'var', 'modifier' => '*')
135
- )
136
- ),
137
- ),
138
- array(
139
- '{?keys,var,val}', array(
140
- 'operator' => '?',
141
- 'values' => array(
142
- array('value' => 'keys', 'modifier' => ''),
143
- array('value' => 'var', 'modifier' => ''),
144
- array('value' => 'val', 'modifier' => '')
145
- )
146
- ),
147
- ),
148
- array(
149
- '{+x,hello,y}', array(
150
- 'operator' => '+',
151
- 'values' => array(
152
- array('value' => 'x', 'modifier' => ''),
153
- array('value' => 'hello', 'modifier' => ''),
154
- array('value' => 'y', 'modifier' => '')
155
- )
156
- )
157
- )
158
- );
159
- }
160
-
161
- /**
162
- * @dataProvider expressionProvider
163
- */
164
- public function testParsesExpressions($exp, $data)
165
- {
166
- $template = new UriTemplate();
167
-
168
- // Access the config object
169
- $class = new \ReflectionClass($template);
170
- $method = $class->getMethod('parseExpression');
171
- $method->setAccessible(true);
172
-
173
- $exp = substr($exp, 1, -1);
174
- $this->assertEquals($data, $method->invokeArgs($template, array($exp)));
175
- }
176
-
177
- /**
178
- * @ticket https://github.com/guzzle/guzzle/issues/90
179
- */
180
- public function testAllowsNestedArrayExpansion()
181
- {
182
- $template = new UriTemplate();
183
-
184
- $result = $template->expand('http://example.com{+path}{/segments}{?query,data*,foo*}', array(
185
- 'path' => '/foo/bar',
186
- 'segments' => array('one', 'two'),
187
- 'query' => 'test',
188
- 'data' => array(
189
- 'more' => array('fun', 'ice cream')
190
- ),
191
- 'foo' => array(
192
- 'baz' => array(
193
- 'bar' => 'fizz',
194
- 'test' => 'buzz'
195
- ),
196
- 'bam' => 'boo'
197
- )
198
- ));
199
-
200
- $this->assertEquals('http://example.com/foo/bar/one,two?query=test&more%5B0%5D=fun&more%5B1%5D=ice%20cream&baz%5Bbar%5D=fizz&baz%5Btest%5D=buzz&bam=boo', $result);
201
- }
202
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/bootstrap.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Test {
3
- require __DIR__ . '/../vendor/autoload.php';
4
- require __DIR__ . '/Server.php';
5
- use GuzzleHttp\Tests\Server;
6
-
7
- Server::start();
8
- register_shutdown_function(function () {
9
- Server::stop();
10
- });
11
- }
12
-
13
- // Override curl_setopt_array() to get the last set curl options
14
- namespace GuzzleHttp\Handler {
15
- function curl_setopt_array($handle, array $options)
16
- {
17
- if (!empty($_SERVER['curl_test'])) {
18
- $_SERVER['_curl'] = $options;
19
- } else {
20
- unset($_SERVER['_curl']);
21
- }
22
- \curl_setopt_array($handle, $options);
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/functionsTest.php DELETED
@@ -1,139 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Test;
3
-
4
- use GuzzleHttp;
5
- use PHPUnit\Framework\TestCase;
6
-
7
- class FunctionsTest extends TestCase
8
- {
9
- public function testExpandsTemplate()
10
- {
11
- $this->assertEquals(
12
- 'foo/123',
13
- GuzzleHttp\uri_template('foo/{bar}', ['bar' => '123'])
14
- );
15
- }
16
- public function noBodyProvider()
17
- {
18
- return [['get'], ['head'], ['delete']];
19
- }
20
-
21
- public function testProvidesDefaultUserAgent()
22
- {
23
- $ua = GuzzleHttp\default_user_agent();
24
- $this->assertEquals(1, preg_match('#^GuzzleHttp/.+ curl/.+ PHP/.+$#', $ua));
25
- }
26
-
27
- public function typeProvider()
28
- {
29
- return [
30
- ['foo', 'string(3) "foo"'],
31
- [true, 'bool(true)'],
32
- [false, 'bool(false)'],
33
- [10, 'int(10)'],
34
- [1.0, 'float(1)'],
35
- [new StrClass(), 'object(GuzzleHttp\Test\StrClass)'],
36
- [['foo'], 'array(1)']
37
- ];
38
- }
39
- /**
40
- * @dataProvider typeProvider
41
- */
42
- public function testDescribesType($input, $output)
43
- {
44
- $this->assertEquals($output, GuzzleHttp\describe_type($input));
45
- }
46
-
47
- public function testParsesHeadersFromLines()
48
- {
49
- $lines = ['Foo: bar', 'Foo: baz', 'Abc: 123', 'Def: a, b'];
50
- $this->assertEquals([
51
- 'Foo' => ['bar', 'baz'],
52
- 'Abc' => ['123'],
53
- 'Def' => ['a, b'],
54
- ], GuzzleHttp\headers_from_lines($lines));
55
- }
56
-
57
- public function testParsesHeadersFromLinesWithMultipleLines()
58
- {
59
- $lines = ['Foo: bar', 'Foo: baz', 'Foo: 123'];
60
- $this->assertEquals([
61
- 'Foo' => ['bar', 'baz', '123'],
62
- ], GuzzleHttp\headers_from_lines($lines));
63
- }
64
-
65
- public function testReturnsDebugResource()
66
- {
67
- $this->assertInternalType('resource', GuzzleHttp\debug_resource());
68
- }
69
-
70
- public function testProvidesDefaultCaBundler()
71
- {
72
- $this->assertFileExists(GuzzleHttp\default_ca_bundle());
73
- }
74
-
75
- public function noProxyProvider()
76
- {
77
- return [
78
- ['mit.edu', ['.mit.edu'], false],
79
- ['foo.mit.edu', ['.mit.edu'], true],
80
- ['mit.edu', ['mit.edu'], true],
81
- ['mit.edu', ['baz', 'mit.edu'], true],
82
- ['mit.edu', ['', '', 'mit.edu'], true],
83
- ['mit.edu', ['baz', '*'], true],
84
- ];
85
- }
86
-
87
- /**
88
- * @dataProvider noproxyProvider
89
- */
90
- public function testChecksNoProxyList($host, $list, $result)
91
- {
92
- $this->assertSame(
93
- $result,
94
- \GuzzleHttp\is_host_in_noproxy($host, $list)
95
- );
96
- }
97
-
98
- /**
99
- * @expectedException \InvalidArgumentException
100
- */
101
- public function testEnsuresNoProxyCheckHostIsSet()
102
- {
103
- \GuzzleHttp\is_host_in_noproxy('', []);
104
- }
105
-
106
- public function testEncodesJson()
107
- {
108
- $this->assertEquals('true', \GuzzleHttp\json_encode(true));
109
- }
110
-
111
- /**
112
- * @expectedException \InvalidArgumentException
113
- */
114
- public function testEncodesJsonAndThrowsOnError()
115
- {
116
- \GuzzleHttp\json_encode("\x99");
117
- }
118
-
119
- public function testDecodesJson()
120
- {
121
- $this->assertTrue(\GuzzleHttp\json_decode('true'));
122
- }
123
-
124
- /**
125
- * @expectedException \InvalidArgumentException
126
- */
127
- public function testDecodesJsonAndThrowsOnError()
128
- {
129
- \GuzzleHttp\json_decode('{{]]');
130
- }
131
- }
132
-
133
- final class StrClass
134
- {
135
- public function __toString()
136
- {
137
- return 'foo';
138
- }
139
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/tests/server.js DELETED
@@ -1,250 +0,0 @@
1
- /**
2
- * Guzzle node.js test server to return queued responses to HTTP requests and
3
- * expose a RESTful API for enqueueing responses and retrieving the requests
4
- * that have been received.
5
- *
6
- * - Delete all requests that have been received:
7
- * > DELETE /guzzle-server/requests
8
- * > Host: 127.0.0.1:8126
9
- *
10
- * - Enqueue responses
11
- * > PUT /guzzle-server/responses
12
- * > Host: 127.0.0.1:8126
13
- * >
14
- * > [{'status': 200, 'reason': 'OK', 'headers': {}, 'body': '' }]
15
- *
16
- * - Get the received requests
17
- * > GET /guzzle-server/requests
18
- * > Host: 127.0.0.1:8126
19
- *
20
- * < HTTP/1.1 200 OK
21
- * <
22
- * < [{'http_method': 'GET', 'uri': '/', 'headers': {}, 'body': 'string'}]
23
- *
24
- * - Attempt access to the secure area
25
- * > GET /secure/by-digest/qop-auth/guzzle-server/requests
26
- * > Host: 127.0.0.1:8126
27
- *
28
- * < HTTP/1.1 401 Unauthorized
29
- * < WWW-Authenticate: Digest realm="Digest Test", qop="auth", nonce="0796e98e1aeef43141fab2a66bf4521a", algorithm="MD5", stale="false"
30
- * <
31
- * < 401 Unauthorized
32
- *
33
- * - Shutdown the server
34
- * > DELETE /guzzle-server
35
- * > Host: 127.0.0.1:8126
36
- *
37
- * @package Guzzle PHP <http://www.guzzlephp.org>
38
- * @license See the LICENSE file that was distributed with this source code.
39
- */
40
-
41
- var http = require('http');
42
- var url = require('url');
43
-
44
- /**
45
- * Guzzle node.js server
46
- * @class
47
- */
48
- var GuzzleServer = function(port, log) {
49
-
50
- this.port = port;
51
- this.log = log;
52
- this.responses = [];
53
- this.requests = [];
54
- var that = this;
55
-
56
- var md5 = function(input) {
57
- var crypto = require('crypto');
58
- var hasher = crypto.createHash('md5');
59
- hasher.update(input);
60
- return hasher.digest('hex');
61
- };
62
-
63
- /**
64
- * Node.js HTTP server authentication module.
65
- *
66
- * It is only initialized on demand (by loadAuthentifier). This avoids
67
- * requiring the dependency to http-auth on standard operations, and the
68
- * performance hit at startup.
69
- */
70
- var auth;
71
-
72
- /**
73
- * Provides authentication handlers (Basic, Digest).
74
- */
75
- var loadAuthentifier = function(type, options) {
76
- var typeId = type;
77
- if (type == 'digest') {
78
- typeId += '.'+(options && options.qop ? options.qop : 'none');
79
- }
80
- if (!loadAuthentifier[typeId]) {
81
- if (!auth) {
82
- try {
83
- auth = require('http-auth');
84
- } catch (e) {
85
- if (e.code == 'MODULE_NOT_FOUND') {
86
- return;
87
- }
88
- }
89
- }
90
- switch (type) {
91
- case 'digest':
92
- var digestParams = {
93
- realm: 'Digest Test',
94
- login: 'me',
95
- password: 'test'
96
- };
97
- if (options && options.qop) {
98
- digestParams.qop = options.qop;
99
- }
100
- loadAuthentifier[typeId] = auth.digest(digestParams, function(username, callback) {
101
- callback(md5(digestParams.login + ':' + digestParams.realm + ':' + digestParams.password));
102
- });
103
- break
104
- }
105
- }
106
- return loadAuthentifier[typeId];
107
- };
108
-
109
- var firewallRequest = function(request, req, res, requestHandlerCallback) {
110
- var securedAreaUriParts = request.uri.match(/^\/secure\/by-(digest)(\/qop-([^\/]*))?(\/.*)$/);
111
- if (securedAreaUriParts) {
112
- var authentifier = loadAuthentifier(securedAreaUriParts[1], { qop: securedAreaUriParts[2] });
113
- if (!authentifier) {
114
- res.writeHead(501, 'HTTP authentication not implemented', { 'Content-Length': 0 });
115
- res.end();
116
- return;
117
- }
118
- authentifier.check(req, res, function(req, res) {
119
- req.url = securedAreaUriParts[4];
120
- requestHandlerCallback(request, req, res);
121
- });
122
- } else {
123
- requestHandlerCallback(request, req, res);
124
- }
125
- };
126
-
127
- var controlRequest = function(request, req, res) {
128
- if (req.url == '/guzzle-server/perf') {
129
- res.writeHead(200, 'OK', {'Content-Length': 16});
130
- res.end('Body of response');
131
- } else if (req.method == 'DELETE') {
132
- if (req.url == '/guzzle-server/requests') {
133
- // Clear the received requests
134
- that.requests = [];
135
- res.writeHead(200, 'OK', { 'Content-Length': 0 });
136
- res.end();
137
- if (that.log) {
138
- console.log('Flushing requests');
139
- }
140
- } else if (req.url == '/guzzle-server') {
141
- // Shutdown the server
142
- res.writeHead(200, 'OK', { 'Content-Length': 0, 'Connection': 'close' });
143
- res.end();
144
- if (that.log) {
145
- console.log('Shutting down');
146
- }
147
- that.server.close();
148
- }
149
- } else if (req.method == 'GET') {
150
- if (req.url === '/guzzle-server/requests') {
151
- if (that.log) {
152
- console.log('Sending received requests');
153
- }
154
- // Get received requests
155
- var body = JSON.stringify(that.requests);
156
- res.writeHead(200, 'OK', { 'Content-Length': body.length });
157
- res.end(body);
158
- } else if (req.url == '/guzzle-server/read-timeout') {
159
- if (that.log) {
160
- console.log('Sleeping');
161
- }
162
- res.writeHead(200, 'OK');
163
- res.write("sleeping 60 seconds ...\n");
164
- setTimeout(function () {
165
- res.end("slept 60 seconds\n");
166
- }, 60*1000);
167
- }
168
- } else if (req.method == 'PUT' && req.url == '/guzzle-server/responses') {
169
- if (that.log) {
170
- console.log('Adding responses...');
171
- }
172
- if (!request.body) {
173
- if (that.log) {
174
- console.log('No response data was provided');
175
- }
176
- res.writeHead(400, 'NO RESPONSES IN REQUEST', { 'Content-Length': 0 });
177
- } else {
178
- that.responses = eval('(' + request.body + ')');
179
- for (var i = 0; i < that.responses.length; i++) {
180
- if (that.responses[i].body) {
181
- that.responses[i].body = new Buffer(that.responses[i].body, 'base64');
182
- }
183
- }
184
- if (that.log) {
185
- console.log(that.responses);
186
- }
187
- res.writeHead(200, 'OK', { 'Content-Length': 0 });
188
- }
189
- res.end();
190
- }
191
- };
192
-
193
- var receivedRequest = function(request, req, res) {
194
- if (req.url.indexOf('/guzzle-server') === 0) {
195
- controlRequest(request, req, res);
196
- } else if (req.url.indexOf('/guzzle-server') == -1 && !that.responses.length) {
197
- res.writeHead(500);
198
- res.end('No responses in queue');
199
- } else {
200
- if (that.log) {
201
- console.log('Returning response from queue and adding request');
202
- }
203
- that.requests.push(request);
204
- var response = that.responses.shift();
205
- res.writeHead(response.status, response.reason, response.headers);
206
- res.end(response.body);
207
- }
208
- };
209
-
210
- this.start = function() {
211
-
212
- that.server = http.createServer(function(req, res) {
213
-
214
- var parts = url.parse(req.url, false);
215
- var request = {
216
- http_method: req.method,
217
- scheme: parts.scheme,
218
- uri: parts.pathname,
219
- query_string: parts.query,
220
- headers: req.headers,
221
- version: req.httpVersion,
222
- body: ''
223
- };
224
-
225
- // Receive each chunk of the request body
226
- req.addListener('data', function(chunk) {
227
- request.body += chunk;
228
- });
229
-
230
- // Called when the request completes
231
- req.addListener('end', function() {
232
- firewallRequest(request, req, res, receivedRequest);
233
- });
234
- });
235
-
236
- that.server.listen(this.port, '127.0.0.1');
237
-
238
- if (this.log) {
239
- console.log('Server running at http://127.0.0.1:8126/');
240
- }
241
- };
242
- };
243
-
244
- // Get the port from the arguments
245
- port = process.argv.length >= 3 ? process.argv[2] : 8126;
246
- log = process.argv.length >= 4 ? process.argv[3] : false;
247
-
248
- // Start the server
249
- server = new GuzzleServer(port, log);
250
- server.start();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/.editorconfig ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_size = 4
7
+ indent_style = space
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
vendor/guzzlehttp/psr7/.gitattributes CHANGED
@@ -1,4 +1,5 @@
1
  /tests export-ignore
 
2
  .gitattributes export-ignore
3
  .gitignore export-ignore
4
  .travis.yml export-ignore
1
  /tests export-ignore
2
+ .editorconfig export-ignore
3
  .gitattributes export-ignore
4
  .gitignore export-ignore
5
  .travis.yml export-ignore
vendor/guzzlehttp/psr7/.travis.yml CHANGED
@@ -1,21 +1,26 @@
1
  language: php
2
 
3
  php:
4
- - 5.4
5
- - 5.5
6
- - 5.6
7
- - 7.0
8
- - 7.1
9
- - hhvm
 
 
10
 
11
- sudo: false
 
 
 
12
 
13
  cache:
14
- directories:
15
- - vendor
16
- - $HOME/.composer/cache
17
 
18
  install:
19
- - travis_retry composer install --no-interaction --prefer-dist
20
 
21
  script: make test
1
  language: php
2
 
3
  php:
4
+ - 5.4
5
+ - 5.5
6
+ - 5.6
7
+ - 7.0
8
+ - 7.1
9
+ - 7.2
10
+ - 7.3
11
+ - hhvm
12
 
13
+ matrix:
14
+ fast_finish: true
15
+ allow_failures:
16
+ - php: hhvm
17
 
18
  cache:
19
+ directories:
20
+ - vendor
21
+ - $HOME/.composer/cache
22
 
23
  install:
24
+ - travis_retry composer install --no-interaction --prefer-dist
25
 
26
  script: make test
vendor/guzzlehttp/psr7/CHANGELOG.md CHANGED
@@ -1,32 +1,102 @@
1
- # CHANGELOG
2
 
3
- ## 1.4.2 - 2017-03-20
4
 
5
- * Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  calls to `trigger_error` when deprecated methods are invoked.
7
 
8
- ## 1.4.1 - 2017-02-27
9
 
10
- * Reverted BC break by reintroducing behavior to automagically fix a URI with a
 
 
 
 
 
 
 
 
11
  relative path and an authority by adding a leading slash to the path. It's only
12
  deprecated now.
13
- * Added triggering of silenced deprecation warnings.
14
 
15
- ## 1.4.0 - 2017-02-21
16
 
17
- * Fix `Stream::read` when length parameter <= 0.
18
- * `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
19
- * Fix `ServerRequest::getUriFromGlobals` when `Host` header contains port.
20
- * Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
21
- * Allow `parse_response` to parse a response without delimiting space and reason.
22
- * Ensure each URI modification results in a valid URI according to PSR-7 discussions.
23
- Invalid modifications will throw an exception instead of returning a wrong URI or
24
- doing some magic.
25
- - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
26
- because the path of a URI with an authority must start with a slash "/" or be empty
27
- - `(new Uri())->withScheme('http')` will return `'http://localhost'`
28
- * Fix compatibility of URIs with `file` scheme and empty host.
29
- * Added common URI utility methods based on RFC 3986 (see documentation in the readme):
30
  - `Uri::isDefaultPort`
31
  - `Uri::isAbsolute`
32
  - `Uri::isNetworkPathReference`
@@ -37,69 +107,117 @@
37
  - `UriNormalizer::normalize`
38
  - `UriNormalizer::isEquivalent`
39
  - `UriResolver::relativize`
40
- * Deprecated `Uri::resolve` in favor of `UriResolver::resolve`
41
- * Deprecated `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
42
 
43
- ## 1.3.1 - 2016-06-25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
- * Fix `Uri::__toString` for network path references, e.g. `//example.org`.
46
- * Fix missing lowercase normalization for host.
47
- * Fix handling of URI components in case they are `'0'` in a lot of places,
48
  e.g. as a user info password.
49
- * Fix `Uri::withAddedHeader` to correctly merge headers with different case.
50
- * Fix trimming of header values in `Uri::withAddedHeader`. Header values may
51
  be surrounded by whitespace which should be ignored according to RFC 7230
52
  Section 3.2.4. This does not apply to header names.
53
- * Fix `Uri::withAddedHeader` with an array of header values.
54
- * Fix `Uri::resolve` when base path has no slash and handling of fragment.
55
- * Fix handling of encoding in `Uri::with(out)QueryValue` so one can pass the
56
  key/value both in encoded as well as decoded form to those methods. This is
57
  consistent with withPath, withQuery etc.
58
- * Fix `ServerRequest::withoutAttribute` when attribute value is null.
59
 
60
- ## 1.3.0 - 2016-04-13
61
 
62
- * Added remaining interfaces needed for full PSR7 compatibility
 
 
 
 
63
  (ServerRequestInterface, UploadedFileInterface, etc.).
64
- * Added support for stream_for from scalars.
65
- * Can now extend Uri.
66
- * Fixed a bug in validating request methods by making it more permissive.
 
 
 
 
 
67
 
68
- ## 1.2.3 - 2016-02-18
69
 
70
- * Fixed support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
 
 
 
 
71
  streams, which can sometimes return fewer bytes than requested with `fread`.
72
- * Fixed handling of gzipped responses with FNAME headers.
 
 
 
 
 
73
 
74
- ## 1.2.2 - 2016-01-22
 
 
 
75
 
76
- * Added support for URIs without any authority.
77
- * Added support for HTTP 451 'Unavailable For Legal Reasons.'
78
- * Added support for using '0' as a filename.
79
- * Added support for including non-standard ports in Host headers.
80
 
81
- ## 1.2.1 - 2015-11-02
82
 
83
- * Now supporting negative offsets when seeking to SEEK_END.
84
 
85
- ## 1.2.0 - 2015-08-15
86
 
87
- * Body as `"0"` is now properly added to a response.
88
- * Now allowing forward seeking in CachingStream.
89
- * Now properly parsing HTTP requests that contain proxy targets in
 
 
 
 
 
90
  `parse_request`.
91
- * functions.php is now conditionally required.
92
- * user-info is no longer dropped when resolving URIs.
 
 
 
93
 
94
- ## 1.1.0 - 2015-06-24
95
 
96
- * URIs can now be relative.
97
- * `multipart/form-data` headers are now overridden case-insensitively.
98
- * URI paths no longer encode the following characters because they are allowed
99
  in URIs: "(", ")", "*", "!", "'"
100
- * A port is no longer added to a URI when the scheme is missing and no port is
101
  present.
102
 
 
103
  ## 1.0.0 - 2015-05-19
104
 
105
  Initial release.
@@ -108,3 +226,21 @@ Currently unsupported:
108
 
109
  - `Psr\Http\Message\ServerRequestInterface`
110
  - `Psr\Http\Message\UploadedFileInterface`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
 
 
3
 
4
+ All notable changes to this project will be documented in this file.
5
+
6
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
7
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
8
+
9
+
10
+ ## [Unreleased]
11
+
12
+
13
+ ## [1.6.0]
14
+
15
+ ### Added
16
+
17
+ - Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244)
18
+ - Added MIME type for WEBP image format (#246)
19
+ - Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272)
20
+
21
+ ### Changed
22
+
23
+ - Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262)
24
+ - Accept port number 0 to be valid (#270)
25
+
26
+ ### Fixed
27
+
28
+ - Fixed subsequent reads from `php://input` in ServerRequest (#247)
29
+ - Fixed readable/writable detection for certain stream modes (#248)
30
+ - Fixed encoding of special characters in the `userInfo` component of an URI (#253)
31
+
32
+
33
+ ## [1.5.2] - 2018-12-04
34
+
35
+ ### Fixed
36
+
37
+ - Check body size when getting the message summary
38
+
39
+
40
+ ## [1.5.1] - 2018-12-04
41
+
42
+ ### Fixed
43
+
44
+ - Get the summary of a body only if it is readable
45
+
46
+
47
+ ## [1.5.0] - 2018-12-03
48
+
49
+ ### Added
50
+
51
+ - Response first-line to response string exception (fixes #145)
52
+ - A test for #129 behavior
53
+ - `get_message_body_summary` function in order to get the message summary
54
+ - `3gp` and `mkv` mime types
55
+
56
+ ### Changed
57
+
58
+ - Clarify exception message when stream is detached
59
+
60
+ ### Deprecated
61
+
62
+ - Deprecated parsing folded header lines as per RFC 7230
63
+
64
+ ### Fixed
65
+
66
+ - Fix `AppendStream::detach` to not close streams
67
+ - `InflateStream` preserves `isSeekable` attribute of the underlying stream
68
+ - `ServerRequest::getUriFromGlobals` to support URLs in query parameters
69
+
70
+
71
+ Several other fixes and improvements.
72
+
73
+
74
+ ## [1.4.2] - 2017-03-20
75
+
76
+ ### Fixed
77
+
78
+ - Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
79
  calls to `trigger_error` when deprecated methods are invoked.
80
 
 
81
 
82
+ ## [1.4.1] - 2017-02-27
83
+
84
+ ### Added
85
+
86
+ - Rriggering of silenced deprecation warnings.
87
+
88
+ ### Fixed
89
+
90
+ - Reverted BC break by reintroducing behavior to automagically fix a URI with a
91
  relative path and an authority by adding a leading slash to the path. It's only
92
  deprecated now.
 
93
 
 
94
 
95
+ ## [1.4.0] - 2017-02-21
96
+
97
+ ### Added
98
+
99
+ - Added common URI utility methods based on RFC 3986 (see documentation in the readme):
 
 
 
 
 
 
 
 
100
  - `Uri::isDefaultPort`
101
  - `Uri::isAbsolute`
102
  - `Uri::isNetworkPathReference`
107
  - `UriNormalizer::normalize`
108
  - `UriNormalizer::isEquivalent`
109
  - `UriResolver::relativize`
 
 
110
 
111
+ ### Changed
112
+
113
+ - Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
114
+ - Allow `parse_response` to parse a response without delimiting space and reason.
115
+ - Ensure each URI modification results in a valid URI according to PSR-7 discussions.
116
+ Invalid modifications will throw an exception instead of returning a wrong URI or
117
+ doing some magic.
118
+ - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
119
+ because the path of a URI with an authority must start with a slash "/" or be empty
120
+ - `(new Uri())->withScheme('http')` will return `'http://localhost'`
121
+
122
+ ### Deprecated
123
+
124
+ - `Uri::resolve` in favor of `UriResolver::resolve`
125
+ - `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
126
+
127
+ ### Fixed
128
+
129
+ - `Stream::read` when length parameter <= 0.
130
+ - `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
131
+ - `ServerRequest::getUriFromGlobals` when `Host` header contains port.
132
+ - Compatibility of URIs with `file` scheme and empty host.
133
+
134
+
135
+ ## [1.3.1] - 2016-06-25
136
+
137
+ ### Fixed
138
 
139
+ - `Uri::__toString` for network path references, e.g. `//example.org`.
140
+ - Missing lowercase normalization for host.
141
+ - Handling of URI components in case they are `'0'` in a lot of places,
142
  e.g. as a user info password.
143
+ - `Uri::withAddedHeader` to correctly merge headers with different case.
144
+ - Trimming of header values in `Uri::withAddedHeader`. Header values may
145
  be surrounded by whitespace which should be ignored according to RFC 7230
146
  Section 3.2.4. This does not apply to header names.
147
+ - `Uri::withAddedHeader` with an array of header values.
148
+ - `Uri::resolve` when base path has no slash and handling of fragment.
149
+ - Handling of encoding in `Uri::with(out)QueryValue` so one can pass the
150
  key/value both in encoded as well as decoded form to those methods. This is
151
  consistent with withPath, withQuery etc.
152
+ - `ServerRequest::withoutAttribute` when attribute value is null.
153
 
 
154
 
155
+ ## [1.3.0] - 2016-04-13
156
+
157
+ ### Added
158
+
159
+ - Remaining interfaces needed for full PSR7 compatibility
160
  (ServerRequestInterface, UploadedFileInterface, etc.).
161
+ - Support for stream_for from scalars.
162
+
163
+ ### Changed
164
+
165
+ - Can now extend Uri.
166
+
167
+ ### Fixed
168
+ - A bug in validating request methods by making it more permissive.
169
 
 
170
 
171
+ ## [1.2.3] - 2016-02-18
172
+
173
+ ### Fixed
174
+
175
+ - Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
176
  streams, which can sometimes return fewer bytes than requested with `fread`.
177
+ - Handling of gzipped responses with FNAME headers.
178
+
179
+
180
+ ## [1.2.2] - 2016-01-22
181
+
182
+ ### Added
183
 
184
+ - Support for URIs without any authority.
185
+ - Support for HTTP 451 'Unavailable For Legal Reasons.'
186
+ - Support for using '0' as a filename.
187
+ - Support for including non-standard ports in Host headers.
188
 
 
 
 
 
189
 
190
+ ## [1.2.1] - 2015-11-02
191
 
192
+ ### Changes
193
 
194
+ - Now supporting negative offsets when seeking to SEEK_END.
195
 
196
+
197
+ ## [1.2.0] - 2015-08-15
198
+
199
+ ### Changed
200
+
201
+ - Body as `"0"` is now properly added to a response.
202
+ - Now allowing forward seeking in CachingStream.
203
+ - Now properly parsing HTTP requests that contain proxy targets in
204
  `parse_request`.
205
+ - functions.php is now conditionally required.
206
+ - user-info is no longer dropped when resolving URIs.
207
+
208
+
209
+ ## [1.1.0] - 2015-06-24
210
 
211
+ ### Changed
212
 
213
+ - URIs can now be relative.
214
+ - `multipart/form-data` headers are now overridden case-insensitively.
215
+ - URI paths no longer encode the following characters because they are allowed
216
  in URIs: "(", ")", "*", "!", "'"
217
+ - A port is no longer added to a URI when the scheme is missing and no port is
218
  present.
219
 
220
+
221
  ## 1.0.0 - 2015-05-19
222
 
223
  Initial release.
226
 
227
  - `Psr\Http\Message\ServerRequestInterface`
228
  - `Psr\Http\Message\UploadedFileInterface`
229
+
230
+
231
+
232
+ [Unreleased]: https://github.com/guzzle/psr7/compare/1.6.0...HEAD
233
+ [1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0
234
+ [1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2
235
+ [1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1
236
+ [1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0
237
+ [1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2
238
+ [1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1
239
+ [1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0
240
+ [1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1
241
+ [1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0
242
+ [1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3
243
+ [1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2
244
+ [1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1
245
+ [1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0
246
+ [1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0
vendor/guzzlehttp/psr7/README.md CHANGED
@@ -372,7 +372,7 @@ This method accepts the following `$resource` types:
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
  }
@@ -606,6 +606,12 @@ Creates a new URI with a specific query string value. Any existing query string
606
  provided key are removed and replaced with the given key value pair. A value of null will set the query string
607
  key without a value, e.g. "key" instead of "key=value".
608
 
 
 
 
 
 
 
609
 
610
  ### `GuzzleHttp\Psr7\Uri::withoutQueryValue`
611
 
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
  }
606
  provided key are removed and replaced with the given key value pair. A value of null will set the query string
607
  key without a value, e.g. "key" instead of "key=value".
608
 
609
+ ### `GuzzleHttp\Psr7\Uri::withQueryValues`
610
+
611
+ `public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface`
612
+
613
+ Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an
614
+ associative array of key => value.
615
 
616
  ### `GuzzleHttp\Psr7\Uri::withoutQueryValue`
617
 
vendor/guzzlehttp/psr7/composer.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "guzzlehttp/psr7",
3
  "type": "library",
4
  "description": "PSR-7 message implementation that also provides common utility methods",
5
- "keywords": ["request", "response", "message", "stream", "http", "uri", "url"],
6
  "license": "MIT",
7
  "authors": [
8
  {
@@ -17,23 +17,33 @@
17
  ],
18
  "require": {
19
  "php": ">=5.4.0",
20
- "psr/http-message": "~1.0"
 
21
  },
22
  "require-dev": {
23
- "phpunit/phpunit": "~4.0"
 
24
  },
25
  "provide": {
26
  "psr/http-message-implementation": "1.0"
27
  },
 
 
 
28
  "autoload": {
29
  "psr-4": {
30
  "GuzzleHttp\\Psr7\\": "src/"
31
  },
32
  "files": ["src/functions_include.php"]
33
  },
 
 
 
 
 
34
  "extra": {
35
  "branch-alias": {
36
- "dev-master": "1.4-dev"
37
  }
38
  }
39
  }
2
  "name": "guzzlehttp/psr7",
3
  "type": "library",
4
  "description": "PSR-7 message implementation that also provides common utility methods",
5
+ "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
6
  "license": "MIT",
7
  "authors": [
8
  {
17
  ],
18
  "require": {
19
  "php": ">=5.4.0",
20
+ "psr/http-message": "~1.0",
21
+ "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
22
  },
23
  "require-dev": {
24
+ "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8",
25
+ "ext-zlib": "*"
26
  },
27
  "provide": {
28
  "psr/http-message-implementation": "1.0"
29
  },
30
+ "suggest": {
31
+ "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
32
+ },
33
  "autoload": {
34
  "psr-4": {
35
  "GuzzleHttp\\Psr7\\": "src/"
36
  },
37
  "files": ["src/functions_include.php"]
38
  },
39
+ "autoload-dev": {
40
+ "psr-4": {
41
+ "GuzzleHttp\\Tests\\Psr7\\": "tests/"
42
+ }
43
+ },
44
  "extra": {
45
  "branch-alias": {
46
+ "dev-master": "1.6-dev"
47
  }
48
  }
49
  }
vendor/guzzlehttp/psr7/phpunit.xml.dist CHANGED
@@ -1,5 +1,5 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <phpunit bootstrap="vendor/autoload.php"
3
  colors="true">
4
  <testsuites>
5
  <testsuite>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit bootstrap="tests/bootstrap.php"
3
  colors="true">
4
  <testsuites>
5
  <testsuite>
vendor/guzzlehttp/psr7/src/AppendStream.php CHANGED
@@ -16,7 +16,6 @@ class AppendStream implements StreamInterface
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
@@ -73,6 +72,7 @@ class AppendStream implements StreamInterface
73
  public function close()
74
  {
75
  $this->pos = $this->current = 0;
 
76
 
77
  foreach ($this->streams as $stream) {
78
  $stream->close();
@@ -82,14 +82,22 @@ class AppendStream implements StreamInterface
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()
16
  private $seekable = true;
17
  private $current = 0;
18
  private $pos = 0;
 
19
 
20
  /**
21
  * @param StreamInterface[] $streams Streams to decorate. Each stream must
72
  public function close()
73
  {
74
  $this->pos = $this->current = 0;
75
+ $this->seekable = true;
76
 
77
  foreach ($this->streams as $stream) {
78
  $stream->close();
82
  }
83
 
84
  /**
85
+ * Detaches each attached stream.
86
+ *
87
+ * Returns null as it's not clear which underlying stream resource to return.
88
  *
89
  * {@inheritdoc}
90
  */
91
  public function detach()
92
  {
93
+ $this->pos = $this->current = 0;
94
+ $this->seekable = true;
95
+
96
+ foreach ($this->streams as $stream) {
97
+ $stream->detach();
98
+ }
99
+
100
+ $this->streams = [];
101
  }
102
 
103
  public function tell()
vendor/guzzlehttp/psr7/src/FnStream.php CHANGED
@@ -52,6 +52,15 @@ class FnStream implements StreamInterface
52
  }
53
  }
54
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * Adds custom functionality to an underlying stream by intercepting
57
  * specific method calls.
52
  }
53
  }
54
 
55
+ /**
56
+ * An unserialize would allow the __destruct to run when the unserialized value goes out of scope.
57
+ * @throws \LogicException
58
+ */
59
+ public function __wakeup()
60
+ {
61
+ throw new \LogicException('FnStream should never be unserialized');
62
+ }
63
+
64
  /**
65
  * Adds custom functionality to an underlying stream by intercepting
66
  * specific method calls.
vendor/guzzlehttp/psr7/src/InflateStream.php CHANGED
@@ -27,7 +27,7 @@ class InflateStream implements StreamInterface
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
  /**
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 = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
31
  }
32
 
33
  /**
vendor/guzzlehttp/psr7/src/LimitStream.php CHANGED
@@ -72,7 +72,7 @@ class LimitStream implements StreamInterface
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
  ));
72
  {
73
  if ($whence !== SEEK_SET || $offset < 0) {
74
  throw new \RuntimeException(sprintf(
75
+ 'Cannot seek to offset %s with whence %s',
76
  $offset,
77
  $whence
78
  ));
vendor/guzzlehttp/psr7/src/MessageTrait.php CHANGED
@@ -66,11 +66,8 @@ trait MessageTrait
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;
@@ -85,11 +82,8 @@ trait MessageTrait
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;
@@ -144,11 +138,13 @@ trait MessageTrait
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];
@@ -160,6 +156,19 @@ trait MessageTrait
160
  }
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  /**
164
  * Trims whitespace from the header values.
165
  *
@@ -177,7 +186,28 @@ trait MessageTrait
177
  private function trimHeaderValues(array $values)
178
  {
179
  return array_map(function ($value) {
180
- return trim($value, " \t");
 
 
 
 
 
 
 
181
  }, $values);
182
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
66
 
67
  public function withHeader($header, $value)
68
  {
69
+ $this->assertHeader($header);
70
+ $value = $this->normalizeHeaderValue($value);
 
 
 
71
  $normalized = strtolower($header);
72
 
73
  $new = clone $this;
82
 
83
  public function withAddedHeader($header, $value)
84
  {
85
+ $this->assertHeader($header);
86
+ $value = $this->normalizeHeaderValue($value);
 
 
 
87
  $normalized = strtolower($header);
88
 
89
  $new = clone $this;
138
  {
139
  $this->headerNames = $this->headers = [];
140
  foreach ($headers as $header => $value) {
141
+ if (is_int($header)) {
142
+ // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec
143
+ // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass.
144
+ $header = (string) $header;
145
  }
146
+ $this->assertHeader($header);
147
+ $value = $this->normalizeHeaderValue($value);
148
  $normalized = strtolower($header);
149
  if (isset($this->headerNames[$normalized])) {
150
  $header = $this->headerNames[$normalized];
156
  }
157
  }
158
 
159
+ private function normalizeHeaderValue($value)
160
+ {
161
+ if (!is_array($value)) {
162
+ return $this->trimHeaderValues([$value]);
163
+ }
164
+
165
+ if (count($value) === 0) {
166
+ throw new \InvalidArgumentException('Header value can not be an empty array.');
167
+ }
168
+
169
+ return $this->trimHeaderValues($value);
170
+ }
171
+
172
  /**
173
  * Trims whitespace from the header values.
174
  *
186
  private function trimHeaderValues(array $values)
187
  {
188
  return array_map(function ($value) {
189
+ if (!is_scalar($value) && null !== $value) {
190
+ throw new \InvalidArgumentException(sprintf(
191
+ 'Header value must be scalar or null but %s provided.',
192
+ is_object($value) ? get_class($value) : gettype($value)
193
+ ));
194
+ }
195
+
196
+ return trim((string) $value, " \t");
197
  }, $values);
198
  }
199
+
200
+ private function assertHeader($header)
201
+ {
202
+ if (!is_string($header)) {
203
+ throw new \InvalidArgumentException(sprintf(
204
+ 'Header name must be a string but %s provided.',
205
+ is_object($header) ? get_class($header) : gettype($header)
206
+ ));
207
+ }
208
+
209
+ if ($header === '') {
210
+ throw new \InvalidArgumentException('Header name can not be empty.');
211
+ }
212
+ }
213
  }
vendor/guzzlehttp/psr7/src/Request.php CHANGED
@@ -36,6 +36,7 @@ class Request implements RequestInterface
36
  $body = null,
37
  $version = '1.1'
38
  ) {
 
39
  if (!($uri instanceof UriInterface)) {
40
  $uri = new Uri($uri);
41
  }
@@ -45,7 +46,7 @@ class Request implements RequestInterface
45
  $this->setHeaders($headers);
46
  $this->protocol = $version;
47
 
48
- if (!$this->hasHeader('Host')) {
49
  $this->updateHostFromUri();
50
  }
51
 
@@ -91,6 +92,7 @@ class Request implements RequestInterface
91
 
92
  public function withMethod($method)
93
  {
 
94
  $new = clone $this;
95
  $new->method = strtoupper($method);
96
  return $new;
@@ -110,7 +112,7 @@ class Request implements RequestInterface
110
  $new = clone $this;
111
  $new->uri = $uri;
112
 
113
- if (!$preserveHost) {
114
  $new->updateHostFromUri();
115
  }
116
 
@@ -139,4 +141,11 @@ class Request implements RequestInterface
139
  // See: http://tools.ietf.org/html/rfc7230#section-5.4
140
  $this->headers = [$header => [$host]] + $this->headers;
141
  }
 
 
 
 
 
 
 
142
  }
36
  $body = null,
37
  $version = '1.1'
38
  ) {
39
+ $this->assertMethod($method);
40
  if (!($uri instanceof UriInterface)) {
41
  $uri = new Uri($uri);
42
  }
46
  $this->setHeaders($headers);
47
  $this->protocol = $version;
48
 
49
+ if (!isset($this->headerNames['host'])) {
50
  $this->updateHostFromUri();
51
  }
52
 
92
 
93
  public function withMethod($method)
94
  {
95
+ $this->assertMethod($method);
96
  $new = clone $this;
97
  $new->method = strtoupper($method);
98
  return $new;
112
  $new = clone $this;
113
  $new->uri = $uri;
114
 
115
+ if (!$preserveHost || !isset($this->headerNames['host'])) {
116
  $new->updateHostFromUri();
117
  }
118
 
141
  // See: http://tools.ietf.org/html/rfc7230#section-5.4
142
  $this->headers = [$header => [$host]] + $this->headers;
143
  }
144
+
145
+ private function assertMethod($method)
146
+ {
147
+ if (!is_string($method) || $method === '') {
148
+ throw new \InvalidArgumentException('Method must be a non-empty string.');
149
+ }
150
+ }
151
  }
vendor/guzzlehttp/psr7/src/Response.php CHANGED
@@ -93,7 +93,11 @@ class Response implements ResponseInterface
93
  $version = '1.1',
94
  $reason = null
95
  ) {
96
- $this->statusCode = (int) $status;
 
 
 
 
97
 
98
  if ($body !== '' && $body !== null) {
99
  $this->stream = stream_for($body);
@@ -121,12 +125,30 @@ class Response implements ResponseInterface
121
 
122
  public function withStatus($code, $reasonPhrase = '')
123
  {
 
 
 
 
124
  $new = clone $this;
125
- $new->statusCode = (int) $code;
126
  if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) {
127
  $reasonPhrase = self::$phrases[$new->statusCode];
128
  }
129
  $new->reasonPhrase = $reasonPhrase;
130
  return $new;
131
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  }
93
  $version = '1.1',
94
  $reason = null
95
  ) {
96
+ $this->assertStatusCodeIsInteger($status);
97
+ $status = (int) $status;
98
+ $this->assertStatusCodeRange($status);
99
+
100
+ $this->statusCode = $status;
101
 
102
  if ($body !== '' && $body !== null) {
103
  $this->stream = stream_for($body);
125
 
126
  public function withStatus($code, $reasonPhrase = '')
127
  {
128
+ $this->assertStatusCodeIsInteger($code);
129
+ $code = (int) $code;
130
+ $this->assertStatusCodeRange($code);
131
+
132
  $new = clone $this;
133
+ $new->statusCode = $code;
134
  if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) {
135
  $reasonPhrase = self::$phrases[$new->statusCode];
136
  }
137
  $new->reasonPhrase = $reasonPhrase;
138
  return $new;
139
  }
140
+
141
+ private function assertStatusCodeIsInteger($statusCode)
142
+ {
143
+ if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) {
144
+ throw new \InvalidArgumentException('Status code must be an integer value.');
145
+ }
146
+ }
147
+
148
+ private function assertStatusCodeRange($statusCode)
149
+ {
150
+ if ($statusCode < 100 || $statusCode >= 600) {
151
+ throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.');
152
+ }
153
+ }
154
  }
vendor/guzzlehttp/psr7/src/Rfc7230.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace GuzzleHttp\Psr7;
4
+
5
+ final class Rfc7230
6
+ {
7
+ /**
8
+ * Header related regular expressions (copied from amphp/http package)
9
+ * (Note: once we require PHP 7.x we could just depend on the upstream package)
10
+ *
11
+ * Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons.
12
+ *
13
+ * @link https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15
14
+ * @license https://github.com/amphp/http/blob/v1.0.1/LICENSE
15
+ */
16
+ const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m";
17
+ const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)";
18
+ }
vendor/guzzlehttp/psr7/src/ServerRequest.php CHANGED
@@ -166,9 +166,9 @@ class ServerRequest extends Request implements ServerRequestInterface
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);
@@ -180,23 +180,41 @@ class ServerRequest extends Request implements ServerRequestInterface
180
  ->withUploadedFiles(self::normalizeFiles($_FILES));
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  /**
184
  * Get a Uri populated with values from $_SERVER.
185
  *
186
  * @return UriInterface
187
  */
188
- public static function getUriFromGlobals() {
 
189
  $uri = new Uri('');
190
 
191
  $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
192
 
193
  $hasPort = false;
194
  if (isset($_SERVER['HTTP_HOST'])) {
195
- $hostHeaderParts = explode(':', $_SERVER['HTTP_HOST']);
196
- $uri = $uri->withHost($hostHeaderParts[0]);
197
- if (isset($hostHeaderParts[1])) {
 
 
 
198
  $hasPort = true;
199
- $uri = $uri->withPort($hostHeaderParts[1]);
200
  }
201
  } elseif (isset($_SERVER['SERVER_NAME'])) {
202
  $uri = $uri->withHost($_SERVER['SERVER_NAME']);
@@ -210,7 +228,7 @@ class ServerRequest extends Request implements ServerRequestInterface
210
 
211
  $hasQuery = false;
212
  if (isset($_SERVER['REQUEST_URI'])) {
213
- $requestUriParts = explode('?', $_SERVER['REQUEST_URI']);
214
  $uri = $uri->withPath($requestUriParts[0]);
215
  if (isset($requestUriParts[1])) {
216
  $hasQuery = true;
166
  public static function fromGlobals()
167
  {
168
  $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
169
+ $headers = getallheaders();
170
  $uri = self::getUriFromGlobals();
171
+ $body = new CachingStream(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);
180
  ->withUploadedFiles(self::normalizeFiles($_FILES));
181
  }
182
 
183
+ private static function extractHostAndPortFromAuthority($authority)
184
+ {
185
+ $uri = 'http://'.$authority;
186
+ $parts = parse_url($uri);
187
+ if (false === $parts) {
188
+ return [null, null];
189
+ }
190
+
191
+ $host = isset($parts['host']) ? $parts['host'] : null;
192
+ $port = isset($parts['port']) ? $parts['port'] : null;
193
+
194
+ return [$host, $port];
195
+ }
196
+
197
  /**
198
  * Get a Uri populated with values from $_SERVER.
199
  *
200
  * @return UriInterface
201
  */
202
+ public static function getUriFromGlobals()
203
+ {
204
  $uri = new Uri('');
205
 
206
  $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
207
 
208
  $hasPort = false;
209
  if (isset($_SERVER['HTTP_HOST'])) {
210
+ list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
211
+ if ($host !== null) {
212
+ $uri = $uri->withHost($host);
213
+ }
214
+
215
+ if ($port !== null) {
216
  $hasPort = true;
217
+ $uri = $uri->withPort($port);
218
  }
219
  } elseif (isset($_SERVER['SERVER_NAME'])) {
220
  $uri = $uri->withHost($_SERVER['SERVER_NAME']);
228
 
229
  $hasQuery = false;
230
  if (isset($_SERVER['REQUEST_URI'])) {
231
+ $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2);
232
  $uri = $uri->withPath($requestUriParts[0]);
233
  if (isset($requestUriParts[1])) {
234
  $hasQuery = true;
vendor/guzzlehttp/psr7/src/Stream.php CHANGED
@@ -10,6 +10,17 @@ use Psr\Http\Message\StreamInterface;
10
  */
11
  class Stream implements StreamInterface
12
  {
 
 
 
 
 
 
 
 
 
 
 
13
  private $stream;
14
  private $size;
15
  private $seekable;
@@ -18,22 +29,6 @@ class Stream implements StreamInterface
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
  *
@@ -65,20 +60,11 @@ class Stream implements StreamInterface
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
  */
@@ -99,6 +85,10 @@ class Stream implements StreamInterface
99
 
100
  public function getContents()
101
  {
 
 
 
 
102
  $contents = stream_get_contents($this->stream);
103
 
104
  if ($contents === false) {
@@ -173,11 +163,19 @@ class Stream implements StreamInterface
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) {
@@ -194,9 +192,15 @@ class Stream implements StreamInterface
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
  }
@@ -204,6 +208,9 @@ class Stream implements StreamInterface
204
 
205
  public function read($length)
206
  {
 
 
 
207
  if (!$this->readable) {
208
  throw new \RuntimeException('Cannot read from non-readable stream');
209
  }
@@ -225,6 +232,9 @@ class Stream implements StreamInterface
225
 
226
  public function write($string)
227
  {
 
 
 
228
  if (!$this->writable) {
229
  throw new \RuntimeException('Cannot write to a non-writable stream');
230
  }
10
  */
11
  class Stream implements StreamInterface
12
  {
13
+ /**
14
+ * Resource modes.
15
+ *
16
+ * @var string
17
+ *
18
+ * @see http://php.net/manual/function.fopen.php
19
+ * @see http://php.net/manual/en/function.gzopen.php
20
+ */
21
+ const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/';
22
+ const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/';
23
+
24
  private $stream;
25
  private $size;
26
  private $seekable;
29
  private $uri;
30
  private $customMetadata;
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  /**
33
  * This constructor accepts an associative array of options.
34
  *
60
  $this->stream = $stream;
61
  $meta = stream_get_meta_data($this->stream);
62
  $this->seekable = $meta['seekable'];
63
+ $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']);
64
+ $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']);
65
  $this->uri = $this->getMetadata('uri');
66
  }
67
 
 
 
 
 
 
 
 
 
 
68
  /**
69
  * Closes the stream when the destructed
70
  */
85
 
86
  public function getContents()
87
  {
88
+ if (!isset($this->stream)) {
89
+ throw new \RuntimeException('Stream is detached');
90
+ }
91
+
92
  $contents = stream_get_contents($this->stream);
93
 
94
  if ($contents === false) {
163
 
164
  public function eof()
165
  {
166
+ if (!isset($this->stream)) {
167
+ throw new \RuntimeException('Stream is detached');
168
+ }
169
+
170
+ return feof($this->stream);
171
  }
172
 
173
  public function tell()
174
  {
175
+ if (!isset($this->stream)) {
176
+ throw new \RuntimeException('Stream is detached');
177
+ }
178
+
179
  $result = ftell($this->stream);
180
 
181
  if ($result === false) {
192
 
193
  public function seek($offset, $whence = SEEK_SET)
194
  {
195
+ $whence = (int) $whence;
196
+
197
+ if (!isset($this->stream)) {
198
+ throw new \RuntimeException('Stream is detached');
199
+ }
200
  if (!$this->seekable) {
201
  throw new \RuntimeException('Stream is not seekable');
202
+ }
203
+ if (fseek($this->stream, $offset, $whence) === -1) {
204
  throw new \RuntimeException('Unable to seek to stream position '
205
  . $offset . ' with whence ' . var_export($whence, true));
206
  }
208
 
209
  public function read($length)
210
  {
211
+ if (!isset($this->stream)) {
212
+ throw new \RuntimeException('Stream is detached');
213
+ }
214
  if (!$this->readable) {
215
  throw new \RuntimeException('Cannot read from non-readable stream');
216
  }
232
 
233
  public function write($string)
234
  {
235
+ if (!isset($this->stream)) {
236
+ throw new \RuntimeException('Stream is detached');
237
+ }
238
  if (!$this->writable) {
239
  throw new \RuntimeException('Cannot write to a non-writable stream');
240
  }
vendor/guzzlehttp/psr7/src/StreamWrapper.php CHANGED
@@ -38,9 +38,21 @@ class StreamWrapper
38
  . 'writable, or both.');
39
  }
40
 
41
- return fopen('guzzle://stream', $mode, null, stream_context_create([
 
 
 
 
 
 
 
 
 
 
 
 
42
  'guzzle' => ['stream' => $stream]
43
- ]));
44
  }
45
 
46
  /**
@@ -94,12 +106,21 @@ class StreamWrapper
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 [
@@ -118,4 +139,23 @@ class StreamWrapper
118
  'blocks' => 0
119
  ];
120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
38
  . 'writable, or both.');
39
  }
40
 
41
+ return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
42
+ }
43
+
44
+ /**
45
+ * Creates a stream context that can be used to open a stream as a php stream resource.
46
+ *
47
+ * @param StreamInterface $stream
48
+ *
49
+ * @return resource
50
+ */
51
+ public static function createStreamContext(StreamInterface $stream)
52
+ {
53
+ return stream_context_create([
54
  'guzzle' => ['stream' => $stream]
55
+ ]);
56
  }
57
 
58
  /**
106
  return true;
107
  }
108
 
109
+ public function stream_cast($cast_as)
110
+ {
111
+ $stream = clone($this->stream);
112
+
113
+ return $stream->detach();
114
+ }
115
+
116
  public function stream_stat()
117
  {
118
  static $modeMap = [
119
  'r' => 33060,
120
+ 'rb' => 33060,
121
  'r+' => 33206,
122
+ 'w' => 33188,
123
+ 'wb' => 33188
124
  ];
125
 
126
  return [
139
  'blocks' => 0
140
  ];
141
  }
142
+
143
+ public function url_stat($path, $flags)
144
+ {
145
+ return [
146
+ 'dev' => 0,
147
+ 'ino' => 0,
148
+ 'mode' => 0,
149
+ 'nlink' => 0,
150
+ 'uid' => 0,
151
+ 'gid' => 0,
152
+ 'rdev' => 0,
153
+ 'size' => 0,
154
+ 'atime' => 0,
155
+ 'mtime' => 0,
156
+ 'ctime' => 0,
157
+ 'blksize' => 0,
158
+ 'blocks' => 0
159
+ ];
160
+ }
161
  }
vendor/guzzlehttp/psr7/src/Uri.php CHANGED
@@ -301,15 +301,7 @@ class Uri implements UriInterface
301
  */
302
  public static function withoutQueryValue(UriInterface $uri, $key)
303
  {
304
- $current = $uri->getQuery();
305
- if ($current === '') {
306
- return $uri;
307
- }
308
-
309
- $decodedKey = rawurldecode($key);
310
- $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
311
- return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
312
- });
313
 
314
  return $uri->withQuery(implode('&', $result));
315
  }
@@ -331,26 +323,29 @@ class Uri implements UriInterface
331
  */
332
  public static function withQueryValue(UriInterface $uri, $key, $value)
333
  {
334
- $current = $uri->getQuery();
335
 
336
- if ($current === '') {
337
- $result = [];
338
- } else {
339
- $decodedKey = rawurldecode($key);
340
- $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
341
- return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
342
- });
343
- }
344
 
345
- // Query string separators ("=", "&") within the key or value need to be encoded
346
- // (while preventing double-encoding) before setting the query string. All other
347
- // chars that need percent-encoding will be encoded by withQuery().
348
- $key = strtr($key, self::$replaceQuery);
349
 
350
- if ($value !== null) {
351
- $result[] = $key . '=' . strtr($value, self::$replaceQuery);
352
- } else {
353
- $result[] = $key;
 
 
 
 
 
 
 
 
 
 
 
 
354
  }
355
 
356
  return $uri->withQuery(implode('&', $result));
@@ -442,9 +437,9 @@ class Uri implements UriInterface
442
 
443
  public function withUserInfo($user, $password = null)
444
  {
445
- $info = $user;
446
- if ($password != '') {
447
- $info .= ':' . $password;
448
  }
449
 
450
  if ($this->userInfo === $info) {
@@ -542,7 +537,9 @@ class Uri implements UriInterface
542
  $this->scheme = isset($parts['scheme'])
543
  ? $this->filterScheme($parts['scheme'])
544
  : '';
545
- $this->userInfo = isset($parts['user']) ? $parts['user'] : '';
 
 
546
  $this->host = isset($parts['host'])
547
  ? $this->filterHost($parts['host'])
548
  : '';
@@ -559,7 +556,7 @@ class Uri implements UriInterface
559
  ? $this->filterQueryAndFragment($parts['fragment'])
560
  : '';
561
  if (isset($parts['pass'])) {
562
- $this->userInfo .= ':' . $parts['pass'];
563
  }
564
 
565
  $this->removeDefaultPort();
@@ -581,6 +578,26 @@ class Uri implements UriInterface
581
  return strtolower($scheme);
582
  }
583
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584
  /**
585
  * @param string $host
586
  *
@@ -611,15 +628,56 @@ class Uri implements UriInterface
611
  }
612
 
613
  $port = (int) $port;
614
- if (1 > $port || 0xffff < $port) {
615
  throw new \InvalidArgumentException(
616
- sprintf('Invalid port: %d. Must be between 1 and 65535', $port)
617
  );
618
  }
619
 
620
  return $port;
621
  }
622
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623
  private function removeDefaultPort()
624
  {
625
  if ($this->port !== null && self::isDefaultPort($this)) {
301
  */
302
  public static function withoutQueryValue(UriInterface $uri, $key)
303
  {
304
+ $result = self::getFilteredQueryString($uri, [$key]);
 
 
 
 
 
 
 
 
305
 
306
  return $uri->withQuery(implode('&', $result));
307
  }
323
  */
324
  public static function withQueryValue(UriInterface $uri, $key, $value)
325
  {
326
+ $result = self::getFilteredQueryString($uri, [$key]);
327
 
328
+ $result[] = self::generateQueryString($key, $value);
 
 
 
 
 
 
 
329
 
330
+ return $uri->withQuery(implode('&', $result));
331
+ }
 
 
332
 
333
+ /**
334
+ * Creates a new URI with multiple specific query string values.
335
+ *
336
+ * It has the same behavior as withQueryValue() but for an associative array of key => value.
337
+ *
338
+ * @param UriInterface $uri URI to use as a base.
339
+ * @param array $keyValueArray Associative array of key and values
340
+ *
341
+ * @return UriInterface
342
+ */
343
+ public static function withQueryValues(UriInterface $uri, array $keyValueArray)
344
+ {
345
+ $result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
346
+
347
+ foreach ($keyValueArray as $key => $value) {
348
+ $result[] = self::generateQueryString($key, $value);
349
  }
350
 
351
  return $uri->withQuery(implode('&', $result));
437
 
438
  public function withUserInfo($user, $password = null)
439
  {
440
+ $info = $this->filterUserInfoComponent($user);
441
+ if ($password !== null) {
442
+ $info .= ':' . $this->filterUserInfoComponent($password);
443
  }
444
 
445
  if ($this->userInfo === $info) {
537
  $this->scheme = isset($parts['scheme'])
538
  ? $this->filterScheme($parts['scheme'])
539
  : '';
540
+ $this->userInfo = isset($parts['user'])
541
+ ? $this->filterUserInfoComponent($parts['user'])
542
+ : '';
543
  $this->host = isset($parts['host'])
544
  ? $this->filterHost($parts['host'])
545
  : '';
556
  ? $this->filterQueryAndFragment($parts['fragment'])
557
  : '';
558
  if (isset($parts['pass'])) {
559
+ $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']);
560
  }
561
 
562
  $this->removeDefaultPort();
578
  return strtolower($scheme);
579
  }
580
 
581
+ /**
582
+ * @param string $component
583
+ *
584
+ * @return string
585
+ *
586
+ * @throws \InvalidArgumentException If the user info is invalid.
587
+ */
588
+ private function filterUserInfoComponent($component)
589
+ {
590
+ if (!is_string($component)) {
591
+ throw new \InvalidArgumentException('User info must be a string');
592
+ }
593
+
594
+ return preg_replace_callback(
595
+ '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/',
596
+ [$this, 'rawurlencodeMatchZero'],
597
+ $component
598
+ );
599
+ }
600
+
601
  /**
602
  * @param string $host
603
  *
628
  }
629
 
630
  $port = (int) $port;
631
+ if (0 > $port || 0xffff < $port) {
632
  throw new \InvalidArgumentException(
633
+ sprintf('Invalid port: %d. Must be between 0 and 65535', $port)
634
  );
635
  }
636
 
637
  return $port;
638
  }
639
 
640
+ /**
641
+ * @param UriInterface $uri
642
+ * @param array $keys
643
+ *
644
+ * @return array
645
+ */
646
+ private static function getFilteredQueryString(UriInterface $uri, array $keys)
647
+ {
648
+ $current = $uri->getQuery();
649
+
650
+ if ($current === '') {
651
+ return [];
652
+ }
653
+
654
+ $decodedKeys = array_map('rawurldecode', $keys);
655
+
656
+ return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
657
+ return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
658
+ });
659
+ }
660
+
661
+ /**
662
+ * @param string $key
663
+ * @param string|null $value
664
+ *
665
+ * @return string
666
+ */
667
+ private static function generateQueryString($key, $value)
668
+ {
669
+ // Query string separators ("=", "&") within the key or value need to be encoded
670
+ // (while preventing double-encoding) before setting the query string. All other
671
+ // chars that need percent-encoding will be encoded by withQuery().
672
+ $queryString = strtr($key, self::$replaceQuery);
673
+
674
+ if ($value !== null) {
675
+ $queryString .= '=' . strtr($value, self::$replaceQuery);
676
+ }
677
+
678
+ return $queryString;
679
+ }
680
+
681
  private function removeDefaultPort()
682
  {
683
  if ($this->port !== null && self::isDefaultPort($this)) {
vendor/guzzlehttp/psr7/src/functions.php CHANGED
@@ -69,10 +69,10 @@ function uri_for($uri)
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 = [])
@@ -238,7 +238,7 @@ function modify_request(RequestInterface $request, array $changes)
238
  }
239
 
240
  if ($request instanceof ServerRequestInterface) {
241
- return new ServerRequest(
242
  isset($changes['method']) ? $changes['method'] : $request->getMethod(),
243
  $uri,
244
  $headers,
@@ -247,7 +247,11 @@ function modify_request(RequestInterface $request, array $changes)
247
  ? $changes['version']
248
  : $request->getProtocolVersion(),
249
  $request->getServerParams()
250
- );
 
 
 
 
251
  }
252
 
253
  return new Request(
@@ -431,7 +435,7 @@ function hash(
431
  * @param StreamInterface $stream Stream to read from
432
  * @param int $maxLength Maximum buffer length
433
  *
434
- * @return string|bool
435
  */
436
  function readline(StreamInterface $stream, $maxLength = null)
437
  {
@@ -495,7 +499,7 @@ function parse_response($message)
495
  // between status-code and reason-phrase is required. But browsers accept
496
  // responses without space and reason as well.
497
  if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
498
- throw new \InvalidArgumentException('Invalid response string');
499
  }
500
  $parts = explode(' ', $data['start-line'], 3);
501
 
@@ -516,8 +520,8 @@ function parse_response($message)
516
  * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will
517
  * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
518
  *
519
- * @param string $str Query string to parse
520
- * @param bool|string $urlEncoding How the query string is encoded
521
  *
522
  * @return array
523
  */
@@ -533,9 +537,9 @@ function parse_query($str, $urlEncoding = true)
533
  $decoder = function ($value) {
534
  return rawurldecode(str_replace('+', ' ', $value));
535
  };
536
- } elseif ($urlEncoding == PHP_QUERY_RFC3986) {
537
  $decoder = 'rawurldecode';
538
- } elseif ($urlEncoding == PHP_QUERY_RFC1738) {
539
  $decoder = 'urldecode';
540
  } else {
541
  $decoder = function ($str) { return $str; };
@@ -633,6 +637,7 @@ function mimetype_from_filename($filename)
633
  function mimetype_from_extension($extension)
634
  {
635
  static $mimetypes = [
 
636
  '7z' => 'application/x-7z-compressed',
637
  'aac' => 'audio/x-aac',
638
  'ai' => 'application/postscript',
@@ -680,6 +685,7 @@ function mimetype_from_extension($extension)
680
  'mid' => 'audio/midi',
681
  'midi' => 'audio/midi',
682
  'mov' => 'video/quicktime',
 
683
  'mp3' => 'audio/mpeg',
684
  'mp4' => 'video/mp4',
685
  'mp4a' => 'audio/mp4',
@@ -718,6 +724,7 @@ function mimetype_from_extension($extension)
718
  'txt' => 'text/plain',
719
  'wav' => 'audio/x-wav',
720
  'webm' => 'video/webm',
 
721
  'wma' => 'audio/x-ms-wma',
722
  'wmv' => 'video/x-ms-wmv',
723
  'woff' => 'application/x-font-woff',
@@ -758,29 +765,53 @@ function _parse_message($message)
758
  throw new \InvalidArgumentException('Invalid message');
759
  }
760
 
761
- // Iterate over each line in the message, accounting for line endings
762
- $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
763
- $result = ['start-line' => array_shift($lines), 'headers' => [], 'body' => ''];
764
- array_shift($lines);
765
 
766
- for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) {
767
- $line = $lines[$i];
768
- // If two line breaks were encountered, then this is the end of body
769
- if (empty($line)) {
770
- if ($i < $totalLines - 1) {
771
- $result['body'] = implode('', array_slice($lines, $i + 2));
772
- }
773
- break;
774
- }
775
- if (strpos($line, ':')) {
776
- $parts = explode(':', $line, 2);
777
- $key = trim($parts[0]);
778
- $value = isset($parts[1]) ? trim($parts[1]) : '';
779
- $result['headers'][$key][] = $value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  }
 
 
781
  }
782
 
783
- return $result;
 
 
 
 
 
 
 
 
 
 
784
  }
785
 
786
  /**
@@ -809,6 +840,46 @@ function _parse_request_uri($path, array $headers)
809
  return $scheme . '://' . $host . '/' . ltrim($path, '/');
810
  }
811
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
812
  /** @internal */
813
  function _caseless_remove($keys, array $data)
814
  {
69
  * - metadata: Array of custom metadata.
70
  * - size: Size of the stream.
71
  *
72
+ * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data
73
+ * @param array $options Additional options
74
  *
75
+ * @return StreamInterface
76
  * @throws \InvalidArgumentException if the $resource arg is not valid.
77
  */
78
  function stream_for($resource = '', array $options = [])
238
  }
239
 
240
  if ($request instanceof ServerRequestInterface) {
241
+ return (new ServerRequest(
242
  isset($changes['method']) ? $changes['method'] : $request->getMethod(),
243
  $uri,
244
  $headers,
247
  ? $changes['version']
248
  : $request->getProtocolVersion(),
249
  $request->getServerParams()
250
+ ))
251
+ ->withParsedBody($request->getParsedBody())
252
+ ->withQueryParams($request->getQueryParams())
253
+ ->withCookieParams($request->getCookieParams())
254
+ ->withUploadedFiles($request->getUploadedFiles());
255
  }
256
 
257
  return new Request(
435
  * @param StreamInterface $stream Stream to read from
436
  * @param int $maxLength Maximum buffer length
437
  *
438
+ * @return string
439
  */
440
  function readline(StreamInterface $stream, $maxLength = null)
441
  {
499
  // between status-code and reason-phrase is required. But browsers accept
500
  // responses without space and reason as well.
501
  if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
502
+ throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']);
503
  }
504
  $parts = explode(' ', $data['start-line'], 3);
505
 
520
  * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will
521
  * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
522
  *
523
+ * @param string $str Query string to parse
524
+ * @param int|bool $urlEncoding How the query string is encoded
525
  *
526
  * @return array
527
  */
537
  $decoder = function ($value) {
538
  return rawurldecode(str_replace('+', ' ', $value));
539
  };
540
+ } elseif ($urlEncoding === PHP_QUERY_RFC3986) {
541
  $decoder = 'rawurldecode';
542
+ } elseif ($urlEncoding === PHP_QUERY_RFC1738) {
543
  $decoder = 'urldecode';
544
  } else {
545
  $decoder = function ($str) { return $str; };
637
  function mimetype_from_extension($extension)
638
  {
639
  static $mimetypes = [
640
+ '3gp' => 'video/3gpp',
641
  '7z' => 'application/x-7z-compressed',
642
  'aac' => 'audio/x-aac',
643
  'ai' => 'application/postscript',
685
  'mid' => 'audio/midi',
686
  'midi' => 'audio/midi',
687
  'mov' => 'video/quicktime',
688
+ 'mkv' => 'video/x-matroska',
689
  'mp3' => 'audio/mpeg',
690
  'mp4' => 'video/mp4',
691
  'mp4a' => 'audio/mp4',
724
  'txt' => 'text/plain',
725
  'wav' => 'audio/x-wav',
726
  'webm' => 'video/webm',
727
+ 'webp' => 'image/webp',
728
  'wma' => 'audio/x-ms-wma',
729
  'wmv' => 'video/x-ms-wmv',
730
  'woff' => 'application/x-font-woff',
765
  throw new \InvalidArgumentException('Invalid message');
766
  }
767
 
768
+ $message = ltrim($message, "\r\n");
 
 
 
769
 
770
+ $messageParts = preg_split("/\r?\n\r?\n/", $message, 2);
771
+
772
+ if ($messageParts === false || count($messageParts) !== 2) {
773
+ throw new \InvalidArgumentException('Invalid message: Missing header delimiter');
774
+ }
775
+
776
+ list($rawHeaders, $body) = $messageParts;
777
+ $rawHeaders .= "\r\n"; // Put back the delimiter we split previously
778
+ $headerParts = preg_split("/\r?\n/", $rawHeaders, 2);
779
+
780
+ if ($headerParts === false || count($headerParts) !== 2) {
781
+ throw new \InvalidArgumentException('Invalid message: Missing status line');
782
+ }
783
+
784
+ list($startLine, $rawHeaders) = $headerParts;
785
+
786
+ if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') {
787
+ // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0
788
+ $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders);
789
+ }
790
+
791
+ /** @var array[] $headerLines */
792
+ $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER);
793
+
794
+ // If these aren't the same, then one line didn't match and there's an invalid header.
795
+ if ($count !== substr_count($rawHeaders, "\n")) {
796
+ // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
797
+ if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
798
+ throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
799
  }
800
+
801
+ throw new \InvalidArgumentException('Invalid header syntax');
802
  }
803
 
804
+ $headers = [];
805
+
806
+ foreach ($headerLines as $headerLine) {
807
+ $headers[$headerLine[1]][] = $headerLine[2];
808
+ }
809
+
810
+ return [
811
+ 'start-line' => $startLine,
812
+ 'headers' => $headers,
813
+ 'body' => $body,
814
+ ];
815
  }
816
 
817
  /**
840
  return $scheme . '://' . $host . '/' . ltrim($path, '/');
841
  }
842
 
843
+ /**
844
+ * Get a short summary of the message body
845
+ *
846
+ * Will return `null` if the response is not printable.
847
+ *
848
+ * @param MessageInterface $message The message to get the body summary
849
+ * @param int $truncateAt The maximum allowed size of the summary
850
+ *
851
+ * @return null|string
852
+ */
853
+ function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
854
+ {
855
+ $body = $message->getBody();
856
+
857
+ if (!$body->isSeekable() || !$body->isReadable()) {
858
+ return null;
859
+ }
860
+
861
+ $size = $body->getSize();
862
+
863
+ if ($size === 0) {
864
+ return null;
865
+ }
866
+
867
+ $summary = $body->read($truncateAt);
868
+ $body->rewind();
869
+
870
+ if ($size > $truncateAt) {
871
+ $summary .= ' (truncated...)';
872
+ }
873
+
874
+ // Matches any printable character, including unicode characters:
875
+ // letters, marks, numbers, punctuation, spacing, and separators.
876
+ if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
877
+ return null;
878
+ }
879
+
880
+ return $summary;
881
+ }
882
+
883
  /** @internal */
884
  function _caseless_remove($keys, array $data)
885
  {
vendor/guzzlehttp/psr7/tests/AppendStreamTest.php DELETED
@@ -1,186 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/BufferStreamTest.php DELETED
@@ -1,63 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/CachingStreamTest.php DELETED
@@ -1,195 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\Psr7;
3
-
4
- use GuzzleHttp\Psr7;
5
- use GuzzleHttp\Psr7\CachingStream;
6
- use GuzzleHttp\Psr7\Stream;
7
-
8
- /**
9
- * @covers GuzzleHttp\Psr7\CachingStream
10
- */
11
- class CachingStreamTest extends \PHPUnit_Framework_TestCase
12
- {
13
- /** @var CachingStream */
14
- private $body;
15
- /** @var Stream */
16
- private $decorated;
17
-
18
- protected function setUp()
19
- {
20
- $this->decorated = Psr7\stream_for('testing');
21
- $this->body = new CachingStream($this->decorated);
22
- }
23
-
24
- protected function tearDown()
25
- {
26
- $this->decorated->close();
27
- $this->body->close();
28
- }
29
-
30
- public function testUsesRemoteSizeIfPossible()
31
- {
32
- $body = Psr7\stream_for('test');
33
- $caching = new CachingStream($body);
34
- $this->assertEquals(4, $caching->getSize());
35
- }
36
-
37
- public function testReadsUntilCachedToByte()
38
- {
39
- $this->body->seek(5);
40
- $this->assertEquals('n', $this->body->read(1));
41
- $this->body->seek(0);
42
- $this->assertEquals('t', $this->body->read(1));
43
- }
44
-
45
- public function testCanSeekNearEndWithSeekEnd()
46
- {
47
- $baseStream = Psr7\stream_for(implode('', range('a', 'z')));
48
- $cached = new CachingStream($baseStream);
49
- $cached->seek(-1, SEEK_END);
50
- $this->assertEquals(25, $baseStream->tell());
51
- $this->assertEquals('z', $cached->read(1));
52
- $this->assertEquals(26, $cached->getSize());
53
- }
54
-
55
- public function testCanSeekToEndWithSeekEnd()
56
- {
57
- $baseStream = Psr7\stream_for(implode('', range('a', 'z')));
58
- $cached = new CachingStream($baseStream);
59
- $cached->seek(0, SEEK_END);
60
- $this->assertEquals(26, $baseStream->tell());
61
- $this->assertEquals('', $cached->read(1));
62
- $this->assertEquals(26, $cached->getSize());
63
- }
64
-
65
- public function testCanUseSeekEndWithUnknownSize()
66
- {
67
- $baseStream = Psr7\stream_for('testing');
68
- $decorated = Psr7\FnStream::decorate($baseStream, [
69
- 'getSize' => function () { return null; }
70
- ]);
71
- $cached = new CachingStream($decorated);
72
- $cached->seek(-1, SEEK_END);
73
- $this->assertEquals('g', $cached->read(1));
74
- }
75
-
76
- public function testRewindUsesSeek()
77
- {
78
- $a = Psr7\stream_for('foo');
79
- $d = $this->getMockBuilder('GuzzleHttp\Psr7\CachingStream')
80
- ->setMethods(array('seek'))
81
- ->setConstructorArgs(array($a))
82
- ->getMock();
83
- $d->expects($this->once())
84
- ->method('seek')
85
- ->with(0)
86
- ->will($this->returnValue(true));
87
- $d->seek(0);
88
- }
89
-
90
- public function testCanSeekToReadBytes()
91
- {
92
- $this->assertEquals('te', $this->body->read(2));
93
- $this->body->seek(0);
94
- $this->assertEquals('test', $this->body->read(4));
95
- $this->assertEquals(4, $this->body->tell());
96
- $this->body->seek(2);
97
- $this->assertEquals(2, $this->body->tell());
98
- $this->body->seek(2, SEEK_CUR);
99
- $this->assertEquals(4, $this->body->tell());
100
- $this->assertEquals('ing', $this->body->read(3));
101
- }
102
-
103
- public function testCanSeekToReadBytesWithPartialBodyReturned()
104
- {
105
- $stream = fopen('php://temp', 'r+');
106
- fwrite($stream, 'testing');
107
- fseek($stream, 0);
108
-
109
- $this->decorated = $this->getMockBuilder('\GuzzleHttp\Psr7\Stream')
110
- ->setConstructorArgs([$stream])
111
- ->setMethods(['read'])
112
- ->getMock();
113
-
114
- $this->decorated->expects($this->exactly(2))
115
- ->method('read')
116
- ->willReturnCallback(function($length) use ($stream){
117
- return fread($stream, 2);
118
- });
119
-
120
- $this->body = new CachingStream($this->decorated);
121
-
122
- $this->assertEquals(0, $this->body->tell());
123
- $this->body->seek(4, SEEK_SET);
124
- $this->assertEquals(4, $this->body->tell());
125
-
126
- $this->body->seek(0);
127
- $this->assertEquals('test', $this->body->read(4));
128
- }
129
-
130
- public function testWritesToBufferStream()
131
- {
132
- $this->body->read(2);
133
- $this->body->write('hi');
134
- $this->body->seek(0);
135
- $this->assertEquals('tehiing', (string) $this->body);
136
- }
137
-
138
- public function testSkipsOverwrittenBytes()
139
- {
140
- $decorated = Psr7\stream_for(
141
- implode("\n", array_map(function ($n) {
142
- return str_pad($n, 4, '0', STR_PAD_LEFT);
143
- }, range(0, 25)))
144
- );
145
-
146
- $body = new CachingStream($decorated);
147
-
148
- $this->assertEquals("0000\n", Psr7\readline($body));
149
- $this->assertEquals("0001\n", Psr7\readline($body));
150
- // Write over part of the body yet to be read, so skip some bytes
151
- $this->assertEquals(5, $body->write("TEST\n"));
152
- $this->assertEquals(5, $this->readAttribute($body, 'skipReadBytes'));
153
- // Read, which skips bytes, then reads
154
- $this->assertEquals("0003\n", Psr7\readline($body));
155
- $this->assertEquals(0, $this->readAttribute($body, 'skipReadBytes'));
156
- $this->assertEquals("0004\n", Psr7\readline($body));
157
- $this->assertEquals("0005\n", Psr7\readline($body));
158
-
159
- // Overwrite part of the cached body (so don't skip any bytes)
160
- $body->seek(5);
161
- $this->assertEquals(5, $body->write("ABCD\n"));
162
- $this->assertEquals(0, $this->readAttribute($body, 'skipReadBytes'));
163
- $this->assertEquals("TEST\n", Psr7\readline($body));
164
- $this->assertEquals("0003\n", Psr7\readline($body));
165
- $this->assertEquals("0004\n", Psr7\readline($body));
166
- $this->assertEquals("0005\n", Psr7\readline($body));
167
- $this->assertEquals("0006\n", Psr7\readline($body));
168
- $this->assertEquals(5, $body->write("1234\n"));
169
- $this->assertEquals(5, $this->readAttribute($body, 'skipReadBytes'));
170
-
171
- // Seek to 0 and ensure the overwritten bit is replaced
172
- $body->seek(0);
173
- $this->assertEquals("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", $body->read(50));
174
-
175
- // Ensure that casting it to a string does not include the bit that was overwritten
176
- $this->assertContains("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", (string) $body);
177
- }
178
-
179
- public function testClosesBothStreams()
180
- {
181
- $s = fopen('php://temp', 'r');
182
- $a = Psr7\stream_for($s);
183
- $d = new CachingStream($a);
184
- $d->close();
185
- $this->assertFalse(is_resource($s));
186
- }
187
-
188
- /**
189
- * @expectedException \InvalidArgumentException
190
- */
191
- public function testEnsuresValidWhence()
192
- {
193
- $this->body->seek(10, -123456);
194
- }
195
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/DroppingStreamTest.php DELETED
@@ -1,26 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/FnStreamTest.php DELETED
@@ -1,90 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/FunctionsTest.php DELETED
@@ -1,660 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\Psr7;
3
-
4
- use GuzzleHttp\Psr7;
5
- use GuzzleHttp\Psr7\FnStream;
6
- use GuzzleHttp\Psr7\NoSeekStream;
7
- use Psr\Http\Message\ServerRequestInterface;
8
-
9
- class FunctionsTest extends \PHPUnit_Framework_TestCase
10
- {
11
- public function testCopiesToString()
12
- {
13
- $s = Psr7\stream_for('foobaz');
14
- $this->assertEquals('foobaz', Psr7\copy_to_string($s));
15
- $s->seek(0);
16
- $this->assertEquals('foo', Psr7\copy_to_string($s, 3));
17
- $this->assertEquals('baz', Psr7\copy_to_string($s, 3));
18
- $this->assertEquals('', Psr7\copy_to_string($s));
19
- }
20
-
21
- public function testCopiesToStringStopsWhenReadFails()
22
- {
23
- $s1 = Psr7\stream_for('foobaz');
24
- $s1 = FnStream::decorate($s1, [
25
- 'read' => function () { return ''; }
26
- ]);
27
- $result = Psr7\copy_to_string($s1);
28
- $this->assertEquals('', $result);
29
- }
30
-
31
- public function testCopiesToStream()
32
- {
33
- $s1 = Psr7\stream_for('foobaz');
34
- $s2 = Psr7\stream_for('');
35
- Psr7\copy_to_stream($s1, $s2);
36
- $this->assertEquals('foobaz', (string) $s2);
37
- $s2 = Psr7\stream_for('');
38
- $s1->seek(0);
39
- Psr7\copy_to_stream($s1, $s2, 3);
40
- $this->assertEquals('foo', (string) $s2);
41
- Psr7\copy_to_stream($s1, $s2, 3);
42
- $this->assertEquals('foobaz', (string) $s2);
43
- }
44
-
45
- public function testStopsCopyToStreamWhenWriteFails()
46
- {
47
- $s1 = Psr7\stream_for('foobaz');
48
- $s2 = Psr7\stream_for('');
49
- $s2 = FnStream::decorate($s2, ['write' => function () { return 0; }]);
50
- Psr7\copy_to_stream($s1, $s2);
51
- $this->assertEquals('', (string) $s2);
52
- }
53
-
54
- public function testStopsCopyToSteamWhenWriteFailsWithMaxLen()
55
- {
56
- $s1 = Psr7\stream_for('foobaz');
57
- $s2 = Psr7\stream_for('');
58
- $s2 = FnStream::decorate($s2, ['write' => function () { return 0; }]);
59
- Psr7\copy_to_stream($s1, $s2, 10);
60
- $this->assertEquals('', (string) $s2);
61
- }
62
-
63
- public function testCopyToStreamReadsInChunksInsteadOfAllInMemory()
64
- {
65
- $sizes = [];
66
- $s1 = new Psr7\FnStream([
67
- 'eof' => function() {
68
- return false;
69
- },
70
- 'read' => function($size) use (&$sizes) {
71
- $sizes[] = $size;
72
- return str_repeat('.', $size);
73
- }
74
- ]);
75
- $s2 = Psr7\stream_for('');
76
- Psr7\copy_to_stream($s1, $s2, 16394);
77
- $s2->seek(0);
78
- $this->assertEquals(16394, strlen($s2->getContents()));
79
- $this->assertEquals(8192, $sizes[0]);
80
- $this->assertEquals(8192, $sizes[1]);
81
- $this->assertEquals(10, $sizes[2]);
82
- }
83
-
84
- public function testStopsCopyToSteamWhenReadFailsWithMaxLen()
85
- {
86
- $s1 = Psr7\stream_for('foobaz');
87
- $s1 = FnStream::decorate($s1, ['read' => function () { return ''; }]);
88
- $s2 = Psr7\stream_for('');
89
- Psr7\copy_to_stream($s1, $s2, 10);
90
- $this->assertEquals('', (string) $s2);
91
- }
92
-
93
- public function testReadsLines()
94
- {
95
- $s = Psr7\stream_for("foo\nbaz\nbar");
96
- $this->assertEquals("foo\n", Psr7\readline($s));
97
- $this->assertEquals("baz\n", Psr7\readline($s));
98
- $this->assertEquals('bar', Psr7\readline($s));
99
- }
100
-
101
- public function testReadsLinesUpToMaxLength()
102
- {
103
- $s = Psr7\stream_for("12345\n");
104
- $this->assertEquals('123', Psr7\readline($s, 4));
105
- $this->assertEquals("45\n", Psr7\readline($s));
106
- }
107
-
108
- public function testReadsLineUntilFalseReturnedFromRead()
109
- {
110
- $s = $this->getMockBuilder('GuzzleHttp\Psr7\Stream')
111
- ->setMethods(['read', 'eof'])
112
- ->disableOriginalConstructor()
113
- ->getMock();
114
- $s->expects($this->exactly(2))
115
- ->method('read')
116
- ->will($this->returnCallback(function () {
117
- static $c = false;
118
- if ($c) {
119
- return false;
120
- }
121
- $c = true;
122
- return 'h';
123
- }));
124
- $s->expects($this->exactly(2))
125
- ->method('eof')
126
- ->will($this->returnValue(false));
127
- $this->assertEquals('h', Psr7\readline($s));
128
- }
129
-
130
- public function testCalculatesHash()
131
- {
132
- $s = Psr7\stream_for('foobazbar');
133
- $this->assertEquals(md5('foobazbar'), Psr7\hash($s, 'md5'));
134
- }
135
-
136
- /**
137
- * @expectedException \RuntimeException
138
- */
139
- public function testCalculatesHashThrowsWhenSeekFails()
140
- {
141
- $s = new NoSeekStream(Psr7\stream_for('foobazbar'));
142
- $s->read(2);
143
- Psr7\hash($s, 'md5');
144
- }
145
-
146
- public function testCalculatesHashSeeksToOriginalPosition()
147
- {
148
- $s = Psr7\stream_for('foobazbar');
149
- $s->seek(4);
150
- $this->assertEquals(md5('foobazbar'), Psr7\hash($s, 'md5'));
151
- $this->assertEquals(4, $s->tell());
152
- }
153
-
154
- public function testOpensFilesSuccessfully()
155
- {
156
- $r = Psr7\try_fopen(__FILE__, 'r');
157
- $this->assertInternalType('resource', $r);
158
- fclose($r);
159
- }
160
-
161
- /**
162
- * @expectedException \RuntimeException
163
- * @expectedExceptionMessage Unable to open /path/to/does/not/exist using mode r
164
- */
165
- public function testThrowsExceptionNotWarning()
166
- {
167
- Psr7\try_fopen('/path/to/does/not/exist', 'r');
168
- }
169
-
170
- public function parseQueryProvider()
171
- {
172
- return [
173
- // Does not need to parse when the string is empty
174
- ['', []],
175
- // Can parse mult-values items
176
- ['q=a&q=b', ['q' => ['a', 'b']]],
177
- // Can parse multi-valued items that use numeric indices
178
- ['q[0]=a&q[1]=b', ['q[0]' => 'a', 'q[1]' => 'b']],
179
- // Can parse duplicates and does not include numeric indices
180
- ['q[]=a&q[]=b', ['q[]' => ['a', 'b']]],
181
- // Ensures that the value of "q" is an array even though one value
182
- ['q[]=a', ['q[]' => 'a']],
183
- // Does not modify "." to "_" like PHP's parse_str()
184
- ['q.a=a&q.b=b', ['q.a' => 'a', 'q.b' => 'b']],
185
- // Can decode %20 to " "
186
- ['q%20a=a%20b', ['q a' => 'a b']],
187
- // Can parse funky strings with no values by assigning each to null
188
- ['q&a', ['q' => null, 'a' => null]],
189
- // Does not strip trailing equal signs
190
- ['data=abc=', ['data' => 'abc=']],
191
- // Can store duplicates without affecting other values
192
- ['foo=a&foo=b&?µ=c', ['foo' => ['a', 'b'], '?µ' => 'c']],
193
- // Sets value to null when no "=" is present
194
- ['foo', ['foo' => null]],
195
- // Preserves "0" keys.
196
- ['0', ['0' => null]],
197
- // Sets the value to an empty string when "=" is present
198
- ['0=', ['0' => '']],
199
- // Preserves falsey keys
200
- ['var=0', ['var' => '0']],
201
- ['a[b][c]=1&a[b][c]=2', ['a[b][c]' => ['1', '2']]],
202
- ['a[b]=c&a[d]=e', ['a[b]' => 'c', 'a[d]' => 'e']],
203
- // Ensure it doesn't leave things behind with repeated values
204
- // Can parse mult-values items
205
- ['q=a&q=b&q=c', ['q' => ['a', 'b', 'c']]],
206
- ];
207
- }
208
-
209
- /**
210
- * @dataProvider parseQueryProvider
211
- */
212
- public function testParsesQueries($input, $output)
213
- {
214
- $result = Psr7\parse_query($input);
215
- $this->assertSame($output, $result);
216
- }
217
-
218
- public function testDoesNotDecode()
219
- {
220
- $str = 'foo%20=bar';
221
- $data = Psr7\parse_query($str, false);
222
- $this->assertEquals(['foo%20' => 'bar'], $data);
223
- }
224
-
225
- /**
226
- * @dataProvider parseQueryProvider
227
- */
228
- public function testParsesAndBuildsQueries($input)
229
- {
230
- $result = Psr7\parse_query($input, false);
231
- $this->assertSame($input, Psr7\build_query($result, false));
232
- }
233
-
234
- public function testEncodesWithRfc1738()
235
- {
236
- $str = Psr7\build_query(['foo bar' => 'baz+'], PHP_QUERY_RFC1738);
237
- $this->assertEquals('foo+bar=baz%2B', $str);
238
- }
239
-
240
- public function testEncodesWithRfc3986()
241
- {
242
- $str = Psr7\build_query(['foo bar' => 'baz+'], PHP_QUERY_RFC3986);
243
- $this->assertEquals('foo%20bar=baz%2B', $str);
244
- }
245
-
246
- public function testDoesNotEncode()
247
- {
248
- $str = Psr7\build_query(['foo bar' => 'baz+'], false);
249
- $this->assertEquals('foo bar=baz+', $str);
250
- }
251
-
252
- public function testCanControlDecodingType()
253
- {
254
- $result = Psr7\parse_query('var=foo+bar', PHP_QUERY_RFC3986);
255
- $this->assertEquals('foo+bar', $result['var']);
256
- $result = Psr7\parse_query('var=foo+bar', PHP_QUERY_RFC1738);
257
- $this->assertEquals('foo bar', $result['var']);
258
- }
259
-
260
- public function testParsesRequestMessages()
261
- {
262
- $req = "GET /abc HTTP/1.0\r\nHost: foo.com\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest";
263
- $request = Psr7\parse_request($req);
264
- $this->assertEquals('GET', $request->getMethod());
265
- $this->assertEquals('/abc', $request->getRequestTarget());
266
- $this->assertEquals('1.0', $request->getProtocolVersion());
267
- $this->assertEquals('foo.com', $request->getHeaderLine('Host'));
268
- $this->assertEquals('Bar', $request->getHeaderLine('Foo'));
269
- $this->assertEquals('Bam, Qux', $request->getHeaderLine('Baz'));
270
- $this->assertEquals('Test', (string) $request->getBody());
271
- $this->assertEquals('http://foo.com/abc', (string) $request->getUri());
272
- }
273
-
274
- public function testParsesRequestMessagesWithHttpsScheme()
275
- {
276
- $req = "PUT /abc?baz=bar HTTP/1.1\r\nHost: foo.com:443\r\n\r\n";
277
- $request = Psr7\parse_request($req);
278
- $this->assertEquals('PUT', $request->getMethod());
279
- $this->assertEquals('/abc?baz=bar', $request->getRequestTarget());
280
- $this->assertEquals('1.1', $request->getProtocolVersion());
281
- $this->assertEquals('foo.com:443', $request->getHeaderLine('Host'));
282
- $this->assertEquals('', (string) $request->getBody());
283
- $this->assertEquals('https://foo.com/abc?baz=bar', (string) $request->getUri());
284
- }
285
-
286
- public function testParsesRequestMessagesWithUriWhenHostIsNotFirst()
287
- {
288
- $req = "PUT / HTTP/1.1\r\nFoo: Bar\r\nHost: foo.com\r\n\r\n";
289
- $request = Psr7\parse_request($req);
290
- $this->assertEquals('PUT', $request->getMethod());
291
- $this->assertEquals('/', $request->getRequestTarget());
292
- $this->assertEquals('http://foo.com/', (string) $request->getUri());
293
- }
294
-
295
- public function testParsesRequestMessagesWithFullUri()
296
- {
297
- $req = "GET https://www.google.com:443/search?q=foobar HTTP/1.1\r\nHost: www.google.com\r\n\r\n";
298
- $request = Psr7\parse_request($req);
299
- $this->assertEquals('GET', $request->getMethod());
300
- $this->assertEquals('https://www.google.com:443/search?q=foobar', $request->getRequestTarget());
301
- $this->assertEquals('1.1', $request->getProtocolVersion());
302
- $this->assertEquals('www.google.com', $request->getHeaderLine('Host'));
303
- $this->assertEquals('', (string) $request->getBody());
304
- $this->assertEquals('https://www.google.com/search?q=foobar', (string) $request->getUri());
305
- }
306
-
307
- public function testParsesRequestMessagesWithCustomMethod()
308
- {
309
- $req = "GET_DATA / HTTP/1.1\r\nFoo: Bar\r\nHost: foo.com\r\n\r\n";
310
- $request = Psr7\parse_request($req);
311
- $this->assertEquals('GET_DATA', $request->getMethod());
312
- }
313
-
314
- /**
315
- * @expectedException \InvalidArgumentException
316
- */
317
- public function testValidatesRequestMessages()
318
- {
319
- Psr7\parse_request("HTTP/1.1 200 OK\r\n\r\n");
320
- }
321
-
322
- public function testParsesResponseMessages()
323
- {
324
- $res = "HTTP/1.0 200 OK\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest";
325
- $response = Psr7\parse_response($res);
326
- $this->assertSame(200, $response->getStatusCode());
327
- $this->assertSame('OK', $response->getReasonPhrase());
328
- $this->assertSame('1.0', $response->getProtocolVersion());
329
- $this->assertSame('Bar', $response->getHeaderLine('Foo'));
330
- $this->assertSame('Bam, Qux', $response->getHeaderLine('Baz'));
331
- $this->assertSame('Test', (string) $response->getBody());
332
- }
333
-
334
- public function testParsesResponseWithoutReason()
335
- {
336
- $res = "HTTP/1.0 200\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest";
337
- $response = Psr7\parse_response($res);
338
- $this->assertSame(200, $response->getStatusCode());
339
- $this->assertSame('OK', $response->getReasonPhrase());
340
- $this->assertSame('1.0', $response->getProtocolVersion());
341
- $this->assertSame('Bar', $response->getHeaderLine('Foo'));
342
- $this->assertSame('Bam, Qux', $response->getHeaderLine('Baz'));
343
- $this->assertSame('Test', (string) $response->getBody());
344
- }
345
-
346
- /**
347
- * @expectedException \InvalidArgumentException
348
- */
349
- public function testValidatesResponseMessages()
350
- {
351
- Psr7\parse_response("GET / HTTP/1.1\r\n\r\n");
352
- }
353
-
354
- public function testDetermineMimetype()
355
- {
356
- $this->assertNull(Psr7\mimetype_from_extension('not-a-real-extension'));
357
- $this->assertEquals(
358
- 'application/json',
359
- Psr7\mimetype_from_extension('json')
360
- );
361
- $this->assertEquals(
362
- 'image/jpeg',
363
- Psr7\mimetype_from_filename('/tmp/images/IMG034821.JPEG')
364
- );
365
- }
366
-
367
- public function testCreatesUriForValue()
368
- {
369
- $this->assertInstanceOf('GuzzleHttp\Psr7\Uri', Psr7\uri_for('/foo'));
370
- $this->assertInstanceOf(
371
- 'GuzzleHttp\Psr7\Uri',
372
- Psr7\uri_for(new Psr7\Uri('/foo'))
373
- );
374
- }
375
-
376
- /**
377
- * @expectedException \InvalidArgumentException
378
- */
379
- public function testValidatesUri()
380
- {
381
- Psr7\uri_for([]);
382
- }
383
-
384
- public function testKeepsPositionOfResource()
385
- {
386
- $h = fopen(__FILE__, 'r');
387
- fseek($h, 10);
388
- $stream = Psr7\stream_for($h);
389
- $this->assertEquals(10, $stream->tell());
390
- $stream->close();
391
- }
392
-
393
- public function testCreatesWithFactory()
394
- {
395
- $stream = Psr7\stream_for('foo');
396
- $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $stream);
397
- $this->assertEquals('foo', $stream->getContents());
398
- $stream->close();
399
- }
400
-
401
- public function testFactoryCreatesFromEmptyString()
402
- {
403
- $s = Psr7\stream_for();
404
- $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $s);
405
- }
406
-
407
- public function testFactoryCreatesFromNull()
408
- {
409
- $s = Psr7\stream_for(null);
410
- $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $s);
411
- }
412
-
413
- public function testFactoryCreatesFromResource()
414
- {
415
- $r = fopen(__FILE__, 'r');
416
- $s = Psr7\stream_for($r);
417
- $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $s);
418
- $this->assertSame(file_get_contents(__FILE__), (string) $s);
419
- }
420
-
421
- public function testFactoryCreatesFromObjectWithToString()
422
- {
423
- $r = new HasToString();
424
- $s = Psr7\stream_for($r);
425
- $this->assertInstanceOf('GuzzleHttp\Psr7\Stream', $s);
426
- $this->assertEquals('foo', (string) $s);
427
- }
428
-
429
- public function testCreatePassesThrough()
430
- {
431
- $s = Psr7\stream_for('foo');
432
- $this->assertSame($s, Psr7\stream_for($s));
433
- }
434
-
435
- /**
436
- * @expectedException \InvalidArgumentException
437
- */
438
- public function testThrowsExceptionForUnknown()
439
- {
440
- Psr7\stream_for(new \stdClass());
441
- }
442
-
443
- public function testReturnsCustomMetadata()
444
- {
445
- $s = Psr7\stream_for('foo', ['metadata' => ['hwm' => 3]]);
446
- $this->assertEquals(3, $s->getMetadata('hwm'));
447
- $this->assertArrayHasKey('hwm', $s->getMetadata());
448
- }
449
-
450
- public function testCanSetSize()
451
- {
452
- $s = Psr7\stream_for('', ['size' => 10]);
453
- $this->assertEquals(10, $s->getSize());
454
- }
455
-
456
- public function testCanCreateIteratorBasedStream()
457
- {
458
- $a = new \ArrayIterator(['foo', 'bar', '123']);
459
- $p = Psr7\stream_for($a);
460
- $this->assertInstanceOf('GuzzleHttp\Psr7\PumpStream', $p);
461
- $this->assertEquals('foo', $p->read(3));
462
- $this->assertFalse($p->eof());
463
- $this->assertEquals('b', $p->read(1));
464
- $this->assertEquals('a', $p->read(1));
465
- $this->assertEquals('r12', $p->read(3));
466
- $this->assertFalse($p->eof());
467
- $this->assertEquals('3', $p->getContents());
468
- $this->assertTrue($p->eof());
469
- $this->assertEquals(9, $p->tell());
470
- }
471
-
472
- public function testConvertsRequestsToStrings()
473
- {
474
- $request = new Psr7\Request('PUT', 'http://foo.com/hi?123', [
475
- 'Baz' => 'bar',
476
- 'Qux' => 'ipsum'
477
- ], 'hello', '1.0');
478
- $this->assertEquals(
479
- "PUT /hi?123 HTTP/1.0\r\nHost: foo.com\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello",
480
- Psr7\str($request)
481
- );
482
- }
483
-
484
- public function testConvertsResponsesToStrings()
485
- {
486
- $response = new Psr7\Response(200, [
487
- 'Baz' => 'bar',
488
- 'Qux' => 'ipsum'
489
- ], 'hello', '1.0', 'FOO');
490
- $this->assertEquals(
491
- "HTTP/1.0 200 FOO\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello",
492
- Psr7\str($response)
493
- );
494
- }
495
-
496
- public function parseParamsProvider()
497
- {
498
- $res1 = array(
499
- array(
500
- '<http:/.../front.jpeg>',
501
- 'rel' => 'front',
502
- 'type' => 'image/jpeg',
503
- ),
504
- array(
505
- '<http://.../back.jpeg>',
506
- 'rel' => 'back',
507
- 'type' => 'image/jpeg',
508
- ),
509
- );
510
- return array(
511
- array(
512
- '<http:/.../front.jpeg>; rel="front"; type="image/jpeg", <http://.../back.jpeg>; rel=back; type="image/jpeg"',
513
- $res1
514
- ),
515
- array(
516
- '<http:/.../front.jpeg>; rel="front"; type="image/jpeg",<http://.../back.jpeg>; rel=back; type="image/jpeg"',
517
- $res1
518
- ),
519
- array(
520
- 'foo="baz"; bar=123, boo, test="123", foobar="foo;bar"',
521
- array(
522
- array('foo' => 'baz', 'bar' => '123'),
523
- array('boo'),
524
- array('test' => '123'),
525
- array('foobar' => 'foo;bar')
526
- )
527
- ),
528
- array(
529
- '<http://.../side.jpeg?test=1>; rel="side"; type="image/jpeg",<http://.../side.jpeg?test=2>; rel=side; type="image/jpeg"',
530
- array(
531
- array('<http://.../side.jpeg?test=1>', 'rel' => 'side', 'type' => 'image/jpeg'),
532
- array('<http://.../side.jpeg?test=2>', 'rel' => 'side', 'type' => 'image/jpeg')
533
- )
534
- ),
535
- array(
536
- '',
537
- array()
538
- )
539
- );
540
- }
541
- /**
542
- * @dataProvider parseParamsProvider
543
- */
544
- public function testParseParams($header, $result)
545
- {
546
- $this->assertEquals($result, Psr7\parse_header($header));
547
- }
548
-
549
- public function testParsesArrayHeaders()
550
- {
551
- $header = ['a, b', 'c', 'd, e'];
552
- $this->assertEquals(['a', 'b', 'c', 'd', 'e'], Psr7\normalize_header($header));
553
- }
554
-
555
- public function testRewindsBody()
556
- {
557
- $body = Psr7\stream_for('abc');
558
- $res = new Psr7\Response(200, [], $body);
559
- Psr7\rewind_body($res);
560
- $this->assertEquals(0, $body->tell());
561
- $body->rewind();
562
- Psr7\rewind_body($res);
563
- $this->assertEquals(0, $body->tell());
564
- }
565
-
566
- /**
567
- * @expectedException \RuntimeException
568
- */
569
- public function testThrowsWhenBodyCannotBeRewound()
570
- {
571
- $body = Psr7\stream_for('abc');
572
- $body->read(1);
573
- $body = FnStream::decorate($body, [
574
- 'rewind' => function () { throw new \RuntimeException('a'); }
575
- ]);
576
- $res = new Psr7\Response(200, [], $body);
577
- Psr7\rewind_body($res);
578
- }
579
-
580
- public function testCanModifyRequestWithUri()
581
- {
582
- $r1 = new Psr7\Request('GET', 'http://foo.com');
583
- $r2 = Psr7\modify_request($r1, [
584
- 'uri' => new Psr7\Uri('http://www.foo.com')
585
- ]);
586
- $this->assertEquals('http://www.foo.com', (string) $r2->getUri());
587
- $this->assertEquals('www.foo.com', (string) $r2->getHeaderLine('host'));
588
- }
589
-
590
- public function testCanModifyRequestWithUriAndPort()
591
- {
592
- $r1 = new Psr7\Request('GET', 'http://foo.com:8000');
593
- $r2 = Psr7\modify_request($r1, [
594
- 'uri' => new Psr7\Uri('http://www.foo.com:8000')
595
- ]);
596
- $this->assertEquals('http://www.foo.com:8000', (string) $r2->getUri());
597
- $this->assertEquals('www.foo.com:8000', (string) $r2->getHeaderLine('host'));
598
- }
599
-
600
- public function testCanModifyRequestWithCaseInsensitiveHeader()
601
- {
602
- $r1 = new Psr7\Request('GET', 'http://foo.com', ['User-Agent' => 'foo']);
603
- $r2 = Psr7\modify_request($r1, ['set_headers' => ['User-agent' => 'bar']]);
604
- $this->assertEquals('bar', $r2->getHeaderLine('User-Agent'));
605
- $this->assertEquals('bar', $r2->getHeaderLine('User-agent'));
606
- }
607
-
608
- public function testReturnsAsIsWhenNoChanges()
609
- {
610
- $r1 = new Psr7\Request('GET', 'http://foo.com');
611
- $r2 = Psr7\modify_request($r1, []);
612
- $this->assertTrue($r2 instanceof Psr7\Request);
613
-
614
- $r1 = new Psr7\ServerRequest('GET', 'http://foo.com');
615
- $r2 = Psr7\modify_request($r1, []);
616
- $this->assertTrue($r2 instanceof ServerRequestInterface);
617
- }
618
-
619
- public function testReturnsUriAsIsWhenNoChanges()
620
- {
621
- $r1 = new Psr7\Request('GET', 'http://foo.com');
622
- $r2 = Psr7\modify_request($r1, ['set_headers' => ['foo' => 'bar']]);
623
- $this->assertNotSame($r1, $r2);
624
- $this->assertEquals('bar', $r2->getHeaderLine('foo'));
625
- }
626
-
627
- public function testRemovesHeadersFromMessage()
628
- {
629
- $r1 = new Psr7\Request('GET', 'http://foo.com', ['foo' => 'bar']);
630
- $r2 = Psr7\modify_request($r1, ['remove_headers' => ['foo']]);
631
- $this->assertNotSame($r1, $r2);
632
- $this->assertFalse($r2->hasHeader('foo'));
633
- }
634
-
635
- public function testAddsQueryToUri()
636
- {
637
- $r1 = new Psr7\Request('GET', 'http://foo.com');
638
- $r2 = Psr7\modify_request($r1, ['query' => 'foo=bar']);
639
- $this->assertNotSame($r1, $r2);
640
- $this->assertEquals('foo=bar', $r2->getUri()->getQuery());
641
- }
642
-
643
- public function testModifyRequestKeepInstanceOfRequest()
644
- {
645
- $r1 = new Psr7\Request('GET', 'http://foo.com');
646
- $r2 = Psr7\modify_request($r1, ['remove_headers' => ['non-existent']]);
647
- $this->assertTrue($r2 instanceof Psr7\Request);
648
-
649
- $r1 = new Psr7\ServerRequest('GET', 'http://foo.com');
650
- $r2 = Psr7\modify_request($r1, ['remove_headers' => ['non-existent']]);
651
- $this->assertTrue($r2 instanceof ServerRequestInterface);
652
- }
653
- }
654
-
655
- class HasToString
656
- {
657
- public function __toString() {
658
- return 'foo';
659
- }
660
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/InflateStreamTest.php DELETED
@@ -1,39 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/LazyOpenStreamTest.php DELETED
@@ -1,64 +0,0 @@
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
- protected function setUp()
11
- {
12
- $this->fname = tempnam('/tmp', 'tfile');
13
-
14
- if (file_exists($this->fname)) {
15
- unlink($this->fname);
16
- }
17
- }
18
-
19
- protected 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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/LimitStreamTest.php DELETED
@@ -1,157 +0,0 @@
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
- private $body;
17
-
18
- /** @var Stream */
19
- private $decorated;
20
-
21
- protected 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
- public function testReturnsSubsetOfEmptyBodyWhenCastToString()
47
- {
48
- $body = Psr7\stream_for('01234567891234');
49
- $limited = new LimitStream($body, 0, 10);
50
- $this->assertEquals('', (string) $limited);
51
- }
52
-
53
- public function testReturnsSpecificSubsetOBodyWhenCastToString()
54
- {
55
- $body = Psr7\stream_for('0123456789abcdef');
56
- $limited = new LimitStream($body, 3, 10);
57
- $this->assertEquals('abc', (string) $limited);
58
- }
59
-
60
- public function testSeeksWhenConstructed()
61
- {
62
- $this->assertEquals(0, $this->body->tell());
63
- $this->assertEquals(3, $this->decorated->tell());
64
- }
65
-
66
- public function testAllowsBoundedSeek()
67
- {
68
- $this->body->seek(100);
69
- $this->assertEquals(10, $this->body->tell());
70
- $this->assertEquals(13, $this->decorated->tell());
71
- $this->body->seek(0);
72
- $this->assertEquals(0, $this->body->tell());
73
- $this->assertEquals(3, $this->decorated->tell());
74
- try {
75
- $this->body->seek(-10);
76
- $this->fail();
77
- } catch (\RuntimeException $e) {}
78
- $this->assertEquals(0, $this->body->tell());
79
- $this->assertEquals(3, $this->decorated->tell());
80
- $this->body->seek(5);
81
- $this->assertEquals(5, $this->body->tell());
82
- $this->assertEquals(8, $this->decorated->tell());
83
- // Fail
84
- try {
85
- $this->body->seek(1000, SEEK_END);
86
- $this->fail();
87
- } catch (\RuntimeException $e) {}
88
- }
89
-
90
- public function testReadsOnlySubsetOfData()
91
- {
92
- $data = $this->body->read(100);
93
- $this->assertEquals(10, strlen($data));
94
- $this->assertSame('', $this->body->read(1000));
95
-
96
- $this->body->setOffset(10);
97
- $newData = $this->body->read(100);
98
- $this->assertEquals(10, strlen($newData));
99
- $this->assertNotSame($data, $newData);
100
- }
101
-
102
- /**
103
- * @expectedException \RuntimeException
104
- * @expectedExceptionMessage Could not seek to stream offset 2
105
- */
106
- public function testThrowsWhenCurrentGreaterThanOffsetSeek()
107
- {
108
- $a = Psr7\stream_for('foo_bar');
109
- $b = new NoSeekStream($a);
110
- $c = new LimitStream($b);
111
- $a->getContents();
112
- $c->setOffset(2);
113
- }
114
-
115
- public function testCanGetContentsWithoutSeeking()
116
- {
117
- $a = Psr7\stream_for('foo_bar');
118
- $b = new NoSeekStream($a);
119
- $c = new LimitStream($b);
120
- $this->assertEquals('foo_bar', $c->getContents());
121
- }
122
-
123
- public function testClaimsConsumedWhenReadLimitIsReached()
124
- {
125
- $this->assertFalse($this->body->eof());
126
- $this->body->read(1000);
127
- $this->assertTrue($this->body->eof());
128
- }
129
-
130
- public function testContentLengthIsBounded()
131
- {
132
- $this->assertEquals(10, $this->body->getSize());
133
- }
134
-
135
- public function testGetContentsIsBasedOnSubset()
136
- {
137
- $body = new LimitStream(Psr7\stream_for('foobazbar'), 3, 3);
138
- $this->assertEquals('baz', $body->getContents());
139
- }
140
-
141
- public function testReturnsNullIfSizeCannotBeDetermined()
142
- {
143
- $a = new FnStream([
144
- 'getSize' => function () { return null; },
145
- 'tell' => function () { return 0; },
146
- ]);
147
- $b = new LimitStream($a);
148
- $this->assertNull($b->getSize());
149
- }
150
-
151
- public function testLengthLessOffsetWhenNoLimitSize()
152
- {
153
- $a = Psr7\stream_for('foo_bar');
154
- $b = new LimitStream($a, -1, 4);
155
- $this->assertEquals(3, $b->getSize());
156
- }
157
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/MultipartStreamTest.php DELETED
@@ -1,242 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/NoSeekStreamTest.php DELETED
@@ -1,40 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/PumpStreamTest.php DELETED
@@ -1,72 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/RequestTest.php DELETED
@@ -1,195 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/ResponseTest.php DELETED
@@ -1,252 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/ServerRequestTest.php DELETED
@@ -1,522 +0,0 @@
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
- 'REQUEST_URI' => '/blog/article.php?id=10&user=foo',
278
- 'SERVER_PORT' => '443',
279
- 'SERVER_ADDR' => '217.112.82.20',
280
- 'SERVER_NAME' => 'www.example.org',
281
- 'SERVER_PROTOCOL' => 'HTTP/1.1',
282
- 'REQUEST_METHOD' => 'POST',
283
- 'QUERY_STRING' => 'id=10&user=foo',
284
- 'DOCUMENT_ROOT' => '/path/to/your/server/root/',
285
- 'HTTP_HOST' => 'www.example.org',
286
- 'HTTPS' => 'on',
287
- 'REMOTE_ADDR' => '193.60.168.69',
288
- 'REMOTE_PORT' => '5390',
289
- 'SCRIPT_NAME' => '/blog/article.php',
290
- 'SCRIPT_FILENAME' => '/path/to/your/server/root/blog/article.php',
291
- 'PHP_SELF' => '/blog/article.php',
292
- ];
293
-
294
- return [
295
- 'HTTPS request' => [
296
- 'https://www.example.org/blog/article.php?id=10&user=foo',
297
- $server,
298
- ],
299
- 'HTTPS request with different on value' => [
300
- 'https://www.example.org/blog/article.php?id=10&user=foo',
301
- array_merge($server, ['HTTPS' => '1']),
302
- ],
303
- 'HTTP request' => [
304
- 'http://www.example.org/blog/article.php?id=10&user=foo',
305
- array_merge($server, ['HTTPS' => 'off', 'SERVER_PORT' => '80']),
306
- ],
307
- 'HTTP_HOST missing -> fallback to SERVER_NAME' => [
308
- 'https://www.example.org/blog/article.php?id=10&user=foo',
309
- array_merge($server, ['HTTP_HOST' => null]),
310
- ],
311
- 'HTTP_HOST and SERVER_NAME missing -> fallback to SERVER_ADDR' => [
312
- 'https://217.112.82.20/blog/article.php?id=10&user=foo',
313
- array_merge($server, ['HTTP_HOST' => null, 'SERVER_NAME' => null]),
314
- ],
315
- 'No query String' => [
316
- 'https://www.example.org/blog/article.php',
317
- array_merge($server, ['REQUEST_URI' => '/blog/article.php', 'QUERY_STRING' => '']),
318
- ],
319
- 'Host header with port' => [
320
- 'https://www.example.org:8324/blog/article.php?id=10&user=foo',
321
- array_merge($server, ['HTTP_HOST' => 'www.example.org:8324']),
322
- ],
323
- 'Different port with SERVER_PORT' => [
324
- 'https://www.example.org:8324/blog/article.php?id=10&user=foo',
325
- array_merge($server, ['SERVER_PORT' => '8324']),
326
- ],
327
- 'REQUEST_URI missing query string' => [
328
- 'https://www.example.org/blog/article.php?id=10&user=foo',
329
- array_merge($server, ['REQUEST_URI' => '/blog/article.php']),
330
- ],
331
- 'Empty server variable' => [
332
- 'http://localhost',
333
- [],
334
- ],
335
- ];
336
- }
337
-
338
- /**
339
- * @dataProvider dataGetUriFromGlobals
340
- */
341
- public function testGetUriFromGlobals($expected, $serverParams)
342
- {
343
- $_SERVER = $serverParams;
344
-
345
- $this->assertEquals(new Uri($expected), ServerRequest::getUriFromGlobals());
346
- }
347
-
348
- public function testFromGlobals()
349
- {
350
- $_SERVER = [
351
- 'REQUEST_URI' => '/blog/article.php?id=10&user=foo',
352
- 'SERVER_PORT' => '443',
353
- 'SERVER_ADDR' => '217.112.82.20',
354
- 'SERVER_NAME' => 'www.example.org',
355
- 'SERVER_PROTOCOL' => 'HTTP/1.1',
356
- 'REQUEST_METHOD' => 'POST',
357
- 'QUERY_STRING' => 'id=10&user=foo',
358
- 'DOCUMENT_ROOT' => '/path/to/your/server/root/',
359
- 'HTTP_HOST' => 'www.example.org',
360
- 'HTTPS' => 'on',
361
- 'REMOTE_ADDR' => '193.60.168.69',
362
- 'REMOTE_PORT' => '5390',
363
- 'SCRIPT_NAME' => '/blog/article.php',
364
- 'SCRIPT_FILENAME' => '/path/to/your/server/root/blog/article.php',
365
- 'PHP_SELF' => '/blog/article.php',
366
- ];
367
-
368
- $_COOKIE = [
369
- 'logged-in' => 'yes!'
370
- ];
371
-
372
- $_POST = [
373
- 'name' => 'Pesho',
374
- 'email' => 'pesho@example.com',
375
- ];
376
-
377
- $_GET = [
378
- 'id' => 10,
379
- 'user' => 'foo',
380
- ];
381
-
382
- $_FILES = [
383
- 'file' => [
384
- 'name' => 'MyFile.txt',
385
- 'type' => 'text/plain',
386
- 'tmp_name' => '/tmp/php/php1h4j1o',
387
- 'error' => UPLOAD_ERR_OK,
388
- 'size' => 123,
389
- ]
390
- ];
391
-
392
- $server = ServerRequest::fromGlobals();
393
-
394
- $this->assertSame('POST', $server->getMethod());
395
- $this->assertEquals(['Host' => ['www.example.org']], $server->getHeaders());
396
- $this->assertSame('', (string) $server->getBody());
397
- $this->assertSame('1.1', $server->getProtocolVersion());
398
- $this->assertEquals($_COOKIE, $server->getCookieParams());
399
- $this->assertEquals($_POST, $server->getParsedBody());
400
- $this->assertEquals($_GET, $server->getQueryParams());
401
-
402
- $this->assertEquals(
403
- new Uri('https://www.example.org/blog/article.php?id=10&user=foo'),
404
- $server->getUri()
405
- );
406
-
407
- $expectedFiles = [
408
- 'file' => new UploadedFile(
409
- '/tmp/php/php1h4j1o',
410
- 123,
411
- UPLOAD_ERR_OK,
412
- 'MyFile.txt',
413
- 'text/plain'
414
- ),
415
- ];
416
-
417
- $this->assertEquals($expectedFiles, $server->getUploadedFiles());
418
- }
419
-
420
- public function testUploadedFiles()
421
- {
422
- $request1 = new ServerRequest('GET', '/');
423
-
424
- $files = [
425
- 'file' => new UploadedFile('test', 123, UPLOAD_ERR_OK)
426
- ];
427
-
428
- $request2 = $request1->withUploadedFiles($files);
429
-
430
- $this->assertNotSame($request2, $request1);
431
- $this->assertSame([], $request1->getUploadedFiles());
432
- $this->assertSame($files, $request2->getUploadedFiles());
433
- }
434
-
435
- public function testServerParams()
436
- {
437
- $params = ['name' => 'value'];
438
-
439
- $request = new ServerRequest('GET', '/', [], null, '1.1', $params);
440
- $this->assertSame($params, $request->getServerParams());
441
- }
442
-
443
- public function testCookieParams()
444
- {
445
- $request1 = new ServerRequest('GET', '/');
446
-
447
- $params = ['name' => 'value'];
448
-
449
- $request2 = $request1->withCookieParams($params);
450
-
451
- $this->assertNotSame($request2, $request1);
452
- $this->assertEmpty($request1->getCookieParams());
453
- $this->assertSame($params, $request2->getCookieParams());
454
- }
455
-
456
- public function testQueryParams()
457
- {
458
- $request1 = new ServerRequest('GET', '/');
459
-
460
- $params = ['name' => 'value'];
461
-
462
- $request2 = $request1->withQueryParams($params);
463
-
464
- $this->assertNotSame($request2, $request1);
465
- $this->assertEmpty($request1->getQueryParams());
466
- $this->assertSame($params, $request2->getQueryParams());
467
- }
468
-
469
- public function testParsedBody()
470
- {
471
- $request1 = new ServerRequest('GET', '/');
472
-
473
- $params = ['name' => 'value'];
474
-
475
- $request2 = $request1->withParsedBody($params);
476
-
477
- $this->assertNotSame($request2, $request1);
478
- $this->assertEmpty($request1->getParsedBody());
479
- $this->assertSame($params, $request2->getParsedBody());
480
- }
481
-
482
- public function testAttributes()
483
- {
484
- $request1 = new ServerRequest('GET', '/');
485
-
486
- $request2 = $request1->withAttribute('name', 'value');
487
- $request3 = $request2->withAttribute('other', 'otherValue');
488
- $request4 = $request3->withoutAttribute('other');
489
- $request5 = $request3->withoutAttribute('unknown');
490
-
491
- $this->assertNotSame($request2, $request1);
492
- $this->assertNotSame($request3, $request2);
493
- $this->assertNotSame($request4, $request3);
494
- $this->assertSame($request5, $request3);
495
-
496
- $this->assertSame([], $request1->getAttributes());
497
- $this->assertNull($request1->getAttribute('name'));
498
- $this->assertSame(
499
- 'something',
500
- $request1->getAttribute('name', 'something'),
501
- 'Should return the default value'
502
- );
503
-
504
- $this->assertSame('value', $request2->getAttribute('name'));
505
- $this->assertSame(['name' => 'value'], $request2->getAttributes());
506
- $this->assertEquals(['name' => 'value', 'other' => 'otherValue'], $request3->getAttributes());
507
- $this->assertSame(['name' => 'value'], $request4->getAttributes());
508
- }
509
-
510
- public function testNullAttribute()
511
- {
512
- $request = (new ServerRequest('GET', '/'))->withAttribute('name', null);
513
-
514
- $this->assertSame(['name' => null], $request->getAttributes());
515
- $this->assertNull($request->getAttribute('name', 'different-default'));
516
-
517
- $requestWithoutAttribute = $request->withoutAttribute('name');
518
-
519
- $this->assertSame([], $requestWithoutAttribute->getAttributes());
520
- $this->assertSame('different-default', $requestWithoutAttribute->getAttribute('name', 'different-default'));
521
- }
522
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php DELETED
@@ -1,140 +0,0 @@
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
- /** @var StreamInterface */
19
- private $a;
20
- /** @var StreamInterface */
21
- private $b;
22
- /** @var resource */
23
- private $c;
24
-
25
- protected function setUp()
26
- {
27
- $this->c = fopen('php://temp', 'r+');
28
- fwrite($this->c, 'foo');
29
- fseek($this->c, 0);
30
- $this->a = Psr7\stream_for($this->c);
31
- $this->b = new Str($this->a);
32
- }
33
-
34
- public function testCatchesExceptionsWhenCastingToString()
35
- {
36
- $s = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
37
- ->setMethods(['read'])
38
- ->getMockForAbstractClass();
39
- $s->expects($this->once())
40
- ->method('read')
41
- ->will($this->throwException(new \Exception('foo')));
42
- $msg = '';
43
- set_error_handler(function ($errNo, $str) use (&$msg) { $msg = $str; });
44
- echo new Str($s);
45
- restore_error_handler();
46
- $this->assertContains('foo', $msg);
47
- }
48
-
49
- public function testToString()
50
- {
51
- $this->assertEquals('foo', (string) $this->b);
52
- }
53
-
54
- public function testHasSize()
55
- {
56
- $this->assertEquals(3, $this->b->getSize());
57
- }
58
-
59
- public function testReads()
60
- {
61
- $this->assertEquals('foo', $this->b->read(10));
62
- }
63
-
64
- public function testCheckMethods()
65
- {
66
- $this->assertEquals($this->a->isReadable(), $this->b->isReadable());
67
- $this->assertEquals($this->a->isWritable(), $this->b->isWritable());
68
- $this->assertEquals($this->a->isSeekable(), $this->b->isSeekable());
69
- }
70
-
71
- public function testSeeksAndTells()
72
- {
73
- $this->b->seek(1);
74
- $this->assertEquals(1, $this->a->tell());
75
- $this->assertEquals(1, $this->b->tell());
76
- $this->b->seek(0);
77
- $this->assertEquals(0, $this->a->tell());
78
- $this->assertEquals(0, $this->b->tell());
79
- $this->b->seek(0, SEEK_END);
80
- $this->assertEquals(3, $this->a->tell());
81
- $this->assertEquals(3, $this->b->tell());
82
- }
83
-
84
- public function testGetsContents()
85
- {
86
- $this->assertEquals('foo', $this->b->getContents());
87
- $this->assertEquals('', $this->b->getContents());
88
- $this->b->seek(1);
89
- $this->assertEquals('oo', $this->b->getContents());
90
- }
91
-
92
- public function testCloses()
93
- {
94
- $this->b->close();
95
- $this->assertFalse(is_resource($this->c));
96
- }
97
-
98
- public function testDetaches()
99
- {
100
- $this->b->detach();
101
- $this->assertFalse($this->b->isReadable());
102
- }
103
-
104
- public function testWrapsMetadata()
105
- {
106
- $this->assertSame($this->b->getMetadata(), $this->a->getMetadata());
107
- $this->assertSame($this->b->getMetadata('uri'), $this->a->getMetadata('uri'));
108
- }
109
-
110
- public function testWrapsWrites()
111
- {
112
- $this->b->seek(0, SEEK_END);
113
- $this->b->write('foo');
114
- $this->assertEquals('foofoo', (string) $this->a);
115
- }
116
-
117
- /**
118
- * @expectedException \UnexpectedValueException
119
- */
120
- public function testThrowsWithInvalidGetter()
121
- {
122
- $this->b->foo;
123
- }
124
-
125
- /**
126
- * @expectedException \BadMethodCallException
127
- */
128
- public function testThrowsWhenGetterNotImplemented()
129
- {
130
- $s = new BadStream();
131
- $s->stream;
132
- }
133
- }
134
-
135
- class BadStream
136
- {
137
- use StreamDecoratorTrait;
138
-
139
- public function __construct() {}
140
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/StreamTest.php DELETED
@@ -1,223 +0,0 @@
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
- public static $isFReadError = false;
13
-
14
- /**
15
- * @expectedException \InvalidArgumentException
16
- */
17
- public function testConstructorThrowsExceptionOnInvalidArgument()
18
- {
19
- new Stream(true);
20
- }
21
-
22
- public function testConstructorInitializesProperties()
23
- {
24
- $handle = fopen('php://temp', 'r+');
25
- fwrite($handle, 'data');
26
- $stream = new Stream($handle);
27
- $this->assertTrue($stream->isReadable());
28
- $this->assertTrue($stream->isWritable());
29
- $this->assertTrue($stream->isSeekable());
30
- $this->assertEquals('php://temp', $stream->getMetadata('uri'));
31
- $this->assertInternalType('array', $stream->getMetadata());
32
- $this->assertEquals(4, $stream->getSize());
33
- $this->assertFalse($stream->eof());
34
- $stream->close();
35
- }
36
-
37
- public function testStreamClosesHandleOnDestruct()
38
- {
39
- $handle = fopen('php://temp', 'r');
40
- $stream = new Stream($handle);
41
- unset($stream);
42
- $this->assertFalse(is_resource($handle));
43
- }
44
-
45
- public function testConvertsToString()
46
- {
47
- $handle = fopen('php://temp', 'w+');
48
- fwrite($handle, 'data');
49
- $stream = new Stream($handle);
50
- $this->assertEquals('data', (string) $stream);
51
- $this->assertEquals('data', (string) $stream);
52
- $stream->close();
53
- }
54
-
55
- public function testGetsContents()
56
- {
57
- $handle = fopen('php://temp', 'w+');
58
- fwrite($handle, 'data');
59
- $stream = new Stream($handle);
60
- $this->assertEquals('', $stream->getContents());
61
- $stream->seek(0);
62
- $this->assertEquals('data', $stream->getContents());
63
- $this->assertEquals('', $stream->getContents());
64
- }
65
-
66
- public function testChecksEof()
67
- {
68
- $handle = fopen('php://temp', 'w+');
69
- fwrite($handle, 'data');
70
- $stream = new Stream($handle);
71
- $this->assertFalse($stream->eof());
72
- $stream->read(4);
73
- $this->assertTrue($stream->eof());
74
- $stream->close();
75
- }
76
-
77
- public function testGetSize()
78
- {
79
- $size = filesize(__FILE__);
80
- $handle = fopen(__FILE__, 'r');
81
- $stream = new Stream($handle);
82
- $this->assertEquals($size, $stream->getSize());
83
- // Load from cache
84
- $this->assertEquals($size, $stream->getSize());
85
- $stream->close();
86
- }
87
-
88
- public function testEnsuresSizeIsConsistent()
89
- {
90
- $h = fopen('php://temp', 'w+');
91
- $this->assertEquals(3, fwrite($h, 'foo'));
92
- $stream = new Stream($h);
93
- $this->assertEquals(3, $stream->getSize());
94
- $this->assertEquals(4, $stream->write('test'));
95
- $this->assertEquals(7, $stream->getSize());
96
- $this->assertEquals(7, $stream->getSize());
97
- $stream->close();
98
- }
99
-
100
- public function testProvidesStreamPosition()
101
- {
102
- $handle = fopen('php://temp', 'w+');
103
- $stream = new Stream($handle);
104
- $this->assertEquals(0, $stream->tell());
105
- $stream->write('foo');
106
- $this->assertEquals(3, $stream->tell());
107
- $stream->seek(1);
108
- $this->assertEquals(1, $stream->tell());
109
- $this->assertSame(ftell($handle), $stream->tell());
110
- $stream->close();
111
- }
112
-
113
- public function testCanDetachStream()
114
- {
115
- $r = fopen('php://temp', 'w+');
116
- $stream = new Stream($r);
117
- $stream->write('foo');
118
- $this->assertTrue($stream->isReadable());
119
- $this->assertSame($r, $stream->detach());
120
- $stream->detach();
121
-
122
- $this->assertFalse($stream->isReadable());
123
- $this->assertFalse($stream->isWritable());
124
- $this->assertFalse($stream->isSeekable());
125
-
126
- $throws = function (callable $fn) use ($stream) {
127
- try {
128
- $fn($stream);
129
- $this->fail();
130
- } catch (\Exception $e) {}
131
- };
132
-
133
- $throws(function ($stream) { $stream->read(10); });
134
- $throws(function ($stream) { $stream->write('bar'); });
135
- $throws(function ($stream) { $stream->seek(10); });
136
- $throws(function ($stream) { $stream->tell(); });
137
- $throws(function ($stream) { $stream->eof(); });
138
- $throws(function ($stream) { $stream->getSize(); });
139
- $throws(function ($stream) { $stream->getContents(); });
140
- $this->assertSame('', (string) $stream);
141
- $stream->close();
142
- }
143
-
144
- public function testCloseClearProperties()
145
- {
146
- $handle = fopen('php://temp', 'r+');
147
- $stream = new Stream($handle);
148
- $stream->close();
149
-
150
- $this->assertFalse($stream->isSeekable());
151
- $this->assertFalse($stream->isReadable());
152
- $this->assertFalse($stream->isWritable());
153
- $this->assertNull($stream->getSize());
154
- $this->assertEmpty($stream->getMetadata());
155
- }
156
-
157
- public function testDoesNotThrowInToString()
158
- {
159
- $s = \GuzzleHttp\Psr7\stream_for('foo');
160
- $s = new NoSeekStream($s);
161
- $this->assertEquals('foo', (string) $s);
162
- }
163
-
164
- public function testStreamReadingWithZeroLength()
165
- {
166
- $r = fopen('php://temp', 'r');
167
- $stream = new Stream($r);
168
-
169
- $this->assertSame('', $stream->read(0));
170
-
171
- $stream->close();
172
- }
173
-
174
- /**
175
- * @expectedException \RuntimeException
176
- * @expectedExceptionMessage Length parameter cannot be negative
177
- */
178
- public function testStreamReadingWithNegativeLength()
179
- {
180
- $r = fopen('php://temp', 'r');
181
- $stream = new Stream($r);
182
-
183
- try {
184
- $stream->read(-1);
185
- } catch (\Exception $e) {
186
- $stream->close();
187
- throw $e;
188
- }
189
-
190
- $stream->close();
191
- }
192
-
193
- /**
194
- * @expectedException \RuntimeException
195
- * @expectedExceptionMessage Unable to read from stream
196
- */
197
- public function testStreamReadingFreadError()
198
- {
199
- self::$isFReadError = true;
200
- $r = fopen('php://temp', 'r');
201
- $stream = new Stream($r);
202
-
203
- try {
204
- $stream->read(1);
205
- } catch (\Exception $e) {
206
- self::$isFReadError = false;
207
- $stream->close();
208
- throw $e;
209
- }
210
-
211
- self::$isFReadError = false;
212
- $stream->close();
213
- }
214
- }
215
-
216
- namespace GuzzleHttp\Psr7;
217
-
218
- use GuzzleHttp\Tests\Psr7\StreamTest;
219
-
220
- function fread($handle, $length)
221
- {
222
- return StreamTest::$isFReadError ? false : \fread($handle, $length);
223
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/StreamWrapperTest.php DELETED
@@ -1,102 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/UploadedFileTest.php DELETED
@@ -1,280 +0,0 @@
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
- private $cleanup;
14
-
15
- protected function setUp()
16
- {
17
- $this->cleanup = [];
18
- }
19
-
20
- protected 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__ . '/' . sha1(uniqid('', true)));
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
- $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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/UriNormalizerTest.php DELETED
@@ -1,175 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\Psr7;
3
-
4
- use GuzzleHttp\Psr7\Uri;
5
- use GuzzleHttp\Psr7\UriNormalizer;
6
-
7
- /**
8
- * @covers GuzzleHttp\Psr7\UriNormalizer
9
- */
10
- class UriNormalizerTest extends \PHPUnit_Framework_TestCase
11
- {
12
- public function testCapitalizePercentEncoding()
13
- {
14
- $actualEncoding = 'a%c2%7A%5eb%25%fa%fA%Fa';
15
- $expectEncoding = 'a%C2%7A%5Eb%25%FA%FA%FA';
16
- $uri = (new Uri())->withPath("/$actualEncoding")->withQuery($actualEncoding);
17
-
18
- $this->assertSame("/$actualEncoding?$actualEncoding", (string) $uri, 'Not normalized automatically beforehand');
19
-
20
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::CAPITALIZE_PERCENT_ENCODING);
21
-
22
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
23
- $this->assertSame("/$expectEncoding?$expectEncoding", (string) $normalizedUri);
24
- }
25
-
26
- /**
27
- * @dataProvider getUnreservedCharacters
28
- */
29
- public function testDecodeUnreservedCharacters($char)
30
- {
31
- $percentEncoded = '%'.bin2hex($char);
32
- // Add encoded reserved characters to test that those are not decoded and include the percent-encoded
33
- // unreserved character both in lower and upper case to test the decoding is case-insensitive.
34
- $encodedChars = $percentEncoded.'%2F%5B'.strtoupper($percentEncoded);
35
- $uri = (new Uri())->withPath("/$encodedChars")->withQuery($encodedChars);
36
-
37
- $this->assertSame("/$encodedChars?$encodedChars", (string) $uri, 'Not normalized automatically beforehand');
38
-
39
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::DECODE_UNRESERVED_CHARACTERS);
40
-
41
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
42
- $this->assertSame("/$char%2F%5B$char?$char%2F%5B$char", (string) $normalizedUri);
43
- }
44
-
45
- public function getUnreservedCharacters()
46
- {
47
- $unreservedChars = array_merge(range('a', 'z'), range('A', 'Z'), range('0', '9'), ['-', '.', '_', '~']);
48
-
49
- return array_map(function ($char) {
50
- return [$char];
51
- }, $unreservedChars);
52
- }
53
-
54
- /**
55
- * @dataProvider getEmptyPathTestCases
56
- */
57
- public function testConvertEmptyPath($uri, $expected)
58
- {
59
- $normalizedUri = UriNormalizer::normalize(new Uri($uri), UriNormalizer::CONVERT_EMPTY_PATH);
60
-
61
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
62
- $this->assertSame($expected, (string) $normalizedUri);
63
- }
64
-
65
- public function getEmptyPathTestCases()
66
- {
67
- return [
68
- ['http://example.org', 'http://example.org/'],
69
- ['https://example.org', 'https://example.org/'],
70
- ['urn://example.org', 'urn://example.org'],
71
- ];
72
- }
73
-
74
- public function testRemoveDefaultHost()
75
- {
76
- $uri = new Uri('file://localhost/myfile');
77
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DEFAULT_HOST);
78
-
79
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
80
- $this->assertSame('file:///myfile', (string) $normalizedUri);
81
- }
82
-
83
- public function testRemoveDefaultPort()
84
- {
85
- $uri = $this->getMock('Psr\Http\Message\UriInterface');
86
- $uri->expects($this->any())->method('getScheme')->will($this->returnValue('http'));
87
- $uri->expects($this->any())->method('getPort')->will($this->returnValue(80));
88
- $uri->expects($this->once())->method('withPort')->with(null)->will($this->returnValue(new Uri('http://example.org')));
89
-
90
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DEFAULT_PORT);
91
-
92
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
93
- $this->assertNull($normalizedUri->getPort());
94
- }
95
-
96
- public function testRemoveDotSegments()
97
- {
98
- $uri = new Uri('http://example.org/../a/b/../c/./d.html');
99
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DOT_SEGMENTS);
100
-
101
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
102
- $this->assertSame('http://example.org/a/c/d.html', (string) $normalizedUri);
103
- }
104
-
105
- public function testRemoveDotSegmentsOfAbsolutePathReference()
106
- {
107
- $uri = new Uri('/../a/b/../c/./d.html');
108
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DOT_SEGMENTS);
109
-
110
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
111
- $this->assertSame('/a/c/d.html', (string) $normalizedUri);
112
- }
113
-
114
- public function testRemoveDotSegmentsOfRelativePathReference()
115
- {
116
- $uri = new Uri('../c/./d.html');
117
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DOT_SEGMENTS);
118
-
119
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
120
- $this->assertSame('../c/./d.html', (string) $normalizedUri);
121
- }
122
-
123
- public function testRemoveDuplicateSlashes()
124
- {
125
- $uri = new Uri('http://example.org//foo///bar/bam.html');
126
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DUPLICATE_SLASHES);
127
-
128
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
129
- $this->assertSame('http://example.org/foo/bar/bam.html', (string) $normalizedUri);
130
- }
131
-
132
- public function testSortQueryParameters()
133
- {
134
- $uri = new Uri('?lang=en&article=fred');
135
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::SORT_QUERY_PARAMETERS);
136
-
137
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
138
- $this->assertSame('?article=fred&lang=en', (string) $normalizedUri);
139
- }
140
-
141
- public function testSortQueryParametersWithSameKeys()
142
- {
143
- $uri = new Uri('?a=b&b=c&a=a&a&b=a&b=b&a=d&a=c');
144
- $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::SORT_QUERY_PARAMETERS);
145
-
146
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $normalizedUri);
147
- $this->assertSame('?a&a=a&a=b&a=c&a=d&b=a&b=b&b=c', (string) $normalizedUri);
148
- }
149
-
150
- /**
151
- * @dataProvider getEquivalentTestCases
152
- */
153
- public function testIsEquivalent($uri1, $uri2, $expected)
154
- {
155
- $equivalent = UriNormalizer::isEquivalent(new Uri($uri1), new Uri($uri2));
156
-
157
- $this->assertSame($expected, $equivalent);
158
- }
159
-
160
- public function getEquivalentTestCases()
161
- {
162
- return [
163
- ['http://example.org', 'http://example.org', true],
164
- ['hTTp://eXaMpLe.org', 'http://example.org', true],
165
- ['http://example.org/path?#', 'http://example.org/path', true],
166
- ['http://example.org:80', 'http://example.org/', true],
167
- ['http://example.org/../a/.././p%61th?%7a=%5e', 'http://example.org/path?z=%5E', true],
168
- ['https://example.org/', 'http://example.org/', false],
169
- ['https://example.org/', '//example.org/', false],
170
- ['//example.org/', '//example.org/', true],
171
- ['file:/myfile', 'file:///myfile', true],
172
- ['file:///myfile', 'file://localhost/myfile', true],
173
- ];
174
- }
175
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/UriResoverTest.php DELETED
@@ -1,203 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp\Tests\Psr7;
3
-
4
- use GuzzleHttp\Psr7\Uri;
5
- use GuzzleHttp\Psr7\UriResolver;
6
-
7
- /**
8
- * @covers GuzzleHttp\Psr7\UriResolver
9
- */
10
- class UriResolverTest extends \PHPUnit_Framework_TestCase
11
- {
12
- const RFC3986_BASE = 'http://a/b/c/d;p?q';
13
-
14
- /**
15
- * @dataProvider getResolveTestCases
16
- */
17
- public function testResolveUri($base, $rel, $expectedTarget)
18
- {
19
- $baseUri = new Uri($base);
20
- $targetUri = UriResolver::resolve($baseUri, new Uri($rel));
21
-
22
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $targetUri);
23
- $this->assertSame($expectedTarget, (string) $targetUri);
24
- // This ensures there are no test cases that only work in the resolve() direction but not the
25
- // opposite via relativize(). This can happen when both base and rel URI are relative-path
26
- // references resulting in another relative-path URI.
27
- $this->assertSame($expectedTarget, (string) UriResolver::resolve($baseUri, $targetUri));
28
- }
29
-
30
- /**
31
- * @dataProvider getResolveTestCases
32
- */
33
- public function testRelativizeUri($base, $expectedRelativeReference, $target)
34
- {
35
- $baseUri = new Uri($base);
36
- $relativeUri = UriResolver::relativize($baseUri, new Uri($target));
37
-
38
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $relativeUri);
39
- // There are test-cases with too many dot-segments and relative references that are equal like "." == "./".
40
- // So apart from the same-as condition, this alternative success condition is necessary.
41
- $this->assertTrue(
42
- $expectedRelativeReference === (string) $relativeUri
43
- || $target === (string) UriResolver::resolve($baseUri, $relativeUri),
44
- sprintf(
45
- '"%s" is not the correct relative reference as it does not resolve to the target URI from the base URI',
46
- (string) $relativeUri
47
- )
48
- );
49
- }
50
-
51
- /**
52
- * @dataProvider getRelativizeTestCases
53
- */
54
- public function testRelativizeUriWithUniqueTests($base, $target, $expectedRelativeReference)
55
- {
56
- $baseUri = new Uri($base);
57
- $targetUri = new Uri($target);
58
- $relativeUri = UriResolver::relativize($baseUri, $targetUri);
59
-
60
- $this->assertInstanceOf('Psr\Http\Message\UriInterface', $relativeUri);
61
- $this->assertSame($expectedRelativeReference, (string) $relativeUri);
62
-
63
- $this->assertSame((string) UriResolver::resolve($baseUri, $targetUri), (string) UriResolver::resolve($baseUri, $relativeUri));
64
- }
65
-
66
- public function getResolveTestCases()
67
- {
68
- return [
69
- [self::RFC3986_BASE, 'g:h', 'g:h'],
70
- [self::RFC3986_BASE, 'g', 'http://a/b/c/g'],
71
- [self::RFC3986_BASE, './g', 'http://a/b/c/g'],
72
- [self::RFC3986_BASE, 'g/', 'http://a/b/c/g/'],
73
- [self::RFC3986_BASE, '/g', 'http://a/g'],
74
- [self::RFC3986_BASE, '//g', 'http://g'],
75
- [self::RFC3986_BASE, '?y', 'http://a/b/c/d;p?y'],
76
- [self::RFC3986_BASE, 'g?y', 'http://a/b/c/g?y'],
77
- [self::RFC3986_BASE, '#s', 'http://a/b/c/d;p?q#s'],
78
- [self::RFC3986_BASE, 'g#s', 'http://a/b/c/g#s'],
79
- [self::RFC3986_BASE, 'g?y#s', 'http://a/b/c/g?y#s'],
80
- [self::RFC3986_BASE, ';x', 'http://a/b/c/;x'],
81
- [self::RFC3986_BASE, 'g;x', 'http://a/b/c/g;x'],
82
- [self::RFC3986_BASE, 'g;x?y#s', 'http://a/b/c/g;x?y#s'],
83
- [self::RFC3986_BASE, '', self::RFC3986_BASE],
84
- [self::RFC3986_BASE, '.', 'http://a/b/c/'],
85
- [self::RFC3986_BASE, './', 'http://a/b/c/'],
86
- [self::RFC3986_BASE, '..', 'http://a/b/'],
87
- [self::RFC3986_BASE, '../', 'http://a/b/'],
88
- [self::RFC3986_BASE, '../g', 'http://a/b/g'],
89
- [self::RFC3986_BASE, '../..', 'http://a/'],
90
- [self::RFC3986_BASE, '../../', 'http://a/'],
91
- [self::RFC3986_BASE, '../../g', 'http://a/g'],
92
- [self::RFC3986_BASE, '../../../g', 'http://a/g'],
93
- [self::RFC3986_BASE, '../../../../g', 'http://a/g'],
94
- [self::RFC3986_BASE, '/./g', 'http://a/g'],
95
- [self::RFC3986_BASE, '/../g', 'http://a/g'],
96
- [self::RFC3986_BASE, 'g.', 'http://a/b/c/g.'],
97
- [self::RFC3986_BASE, '.g', 'http://a/b/c/.g'],
98
- [self::RFC3986_BASE, 'g..', 'http://a/b/c/g..'],
99
- [self::RFC3986_BASE, '..g', 'http://a/b/c/..g'],
100
- [self::RFC3986_BASE, './../g', 'http://a/b/g'],
101
- [self::RFC3986_BASE, 'foo////g', 'http://a/b/c/foo////g'],
102
- [self::RFC3986_BASE, './g/.', 'http://a/b/c/g/'],
103
- [self::RFC3986_BASE, 'g/./h', 'http://a/b/c/g/h'],
104
- [self::RFC3986_BASE, 'g/../h', 'http://a/b/c/h'],
105
- [self::RFC3986_BASE, 'g;x=1/./y', 'http://a/b/c/g;x=1/y'],
106
- [self::RFC3986_BASE, 'g;x=1/../y', 'http://a/b/c/y'],
107
- // dot-segments in the query or fragment
108
- [self::RFC3986_BASE, 'g?y/./x', 'http://a/b/c/g?y/./x'],
109
- [self::RFC3986_BASE, 'g?y/../x', 'http://a/b/c/g?y/../x'],
110
- [self::RFC3986_BASE, 'g#s/./x', 'http://a/b/c/g#s/./x'],
111
- [self::RFC3986_BASE, 'g#s/../x', 'http://a/b/c/g#s/../x'],
112
- [self::RFC3986_BASE, 'g#s/../x', 'http://a/b/c/g#s/../x'],
113
- [self::RFC3986_BASE, '?y#s', 'http://a/b/c/d;p?y#s'],
114
- // base with fragment
115
- ['http://a/b/c?q#s', '?y', 'http://a/b/c?y'],
116
- // base with user info
117
- ['http://u@a/b/c/d;p?q', '.', 'http://u@a/b/c/'],
118
- ['http://u:p@a/b/c/d;p?q', '.', 'http://u:p@a/b/c/'],
119
- // path ending with slash or no slash at all
120
- ['http://a/b/c/d/', 'e', 'http://a/b/c/d/e'],
121
- ['urn:no-slash', 'e', 'urn:e'],
122
- // falsey relative parts
123
- [self::RFC3986_BASE, '//0', 'http://0'],
124
- [self::RFC3986_BASE, '0', 'http://a/b/c/0'],
125
- [self::RFC3986_BASE, '?0', 'http://a/b/c/d;p?0'],
126
- [self::RFC3986_BASE, '#0', 'http://a/b/c/d;p?q#0'],
127
- // absolute path base URI
128
- ['/a/b/', '', '/a/b/'],
129
- ['/a/b', '', '/a/b'],
130
- ['/', 'a', '/a'],
131
- ['/', 'a/b', '/a/b'],
132
- ['/a/b', 'g', '/a/g'],
133
- ['/a/b/c', './', '/a/b/'],
134
- ['/a/b/', '../', '/a/'],
135
- ['/a/b/c', '../', '/a/'],
136
- ['/a/b/', '../../x/y/z/', '/x/y/z/'],
137
- ['/a/b/c/d/e', '../../../c/d', '/a/c/d'],
138
- ['/a/b/c//', '../', '/a/b/c/'],
139
- ['/a/b/c/', './/', '/a/b/c//'],
140
- ['/a/b/c', '../../../../a', '/a'],
141
- ['/a/b/c', '../../../..', '/'],
142
- // not actually a dot-segment
143
- ['/a/b/c', '..a/b..', '/a/b/..a/b..'],
144
- // '' cannot be used as relative reference as it would inherit the base query component
145
- ['/a/b?q', 'b', '/a/b'],
146
- ['/a/b/?q', './', '/a/b/'],
147
- // path with colon: "with:colon" would be the wrong relative reference
148
- ['/a/', './with:colon', '/a/with:colon'],
149
- ['/a/', 'b/with:colon', '/a/b/with:colon'],
150
- ['/a/', './:b/', '/a/:b/'],
151
- // relative path references
152
- ['a', 'a/b', 'a/b'],
153
- ['', '', ''],
154
- ['', '..', ''],
155
- ['/', '..', '/'],
156
- ['urn:a/b', '..//a/b', 'urn:/a/b'],
157
- // network path references
158
- // empty base path and relative-path reference
159
- ['//example.com', 'a', '//example.com/a'],
160
- // path starting with two slashes
161
- ['//example.com//two-slashes', './', '//example.com//'],
162
- ['//example.com', './/', '//example.com//'],
163
- ['//example.com/', './/', '//example.com//'],
164
- // base URI has less components than relative URI
165
- ['/', '//a/b?q#h', '//a/b?q#h'],
166
- ['/', 'urn:/', 'urn:/'],
167
- ];
168
- }
169
-
170
- /**
171
- * Some additional tests to getResolveTestCases() that only make sense for relativize.
172
- */
173
- public function getRelativizeTestCases()
174
- {
175
- return [
176
- // targets that are relative-path references are returned as-is
177
- ['a/b', 'b/c', 'b/c'],
178
- ['a/b/c', '../b/c', '../b/c'],
179
- ['a', '', ''],
180
- ['a', './', './'],
181
- ['a', 'a/..', 'a/..'],
182
- ['/a/b/?q', '?q#h', '?q#h'],
183
- ['/a/b/?q', '#h', '#h'],
184
- ['/a/b/?q', 'c#h', 'c#h'],
185
- // If the base URI has a query but the target has none, we cannot return an empty path reference as it would
186
- // inherit the base query component when resolving.
187
- ['/a/b/?q', '/a/b/#h', './#h'],
188
- ['/', '/#h', '#h'],
189
- ['/', '/', ''],
190
- ['http://a', 'http://a/', './'],
191
- ['urn:a/b?q', 'urn:x/y?q', '../x/y?q'],
192
- ['urn:', 'urn:/', './/'],
193
- ['urn:a/b?q', 'urn:', '../'],
194
- // target URI has less components than base URI
195
- ['http://a/b/', '//a/b/c', 'c'],
196
- ['http://a/b/', '/b/c', 'c'],
197
- ['http://a/b/', '/x/y', '../x/y'],
198
- ['http://a/b/', '/', '../'],
199
- // absolute target URI without authority but base URI has one
200
- ['urn://a/b/', 'urn:/b/', 'urn:/b/'],
201
- ];
202
- }
203
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/psr7/tests/UriTest.php DELETED
@@ -1,660 +0,0 @@
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
- public function testParsesProvidedUri()
12
- {
13
- $uri = new Uri('https://user:pass@example.com:8080/path/123?q=abc#test');
14
-
15
- $this->assertSame('https', $uri->getScheme());
16
- $this->assertSame('user:pass@example.com:8080', $uri->getAuthority());
17
- $this->assertSame('user:pass', $uri->getUserInfo());
18
- $this->assertSame('example.com', $uri->getHost());
19
- $this->assertSame(8080, $uri->getPort());
20
- $this->assertSame('/path/123', $uri->getPath());
21
- $this->assertSame('q=abc', $uri->getQuery());
22
- $this->assertSame('test', $uri->getFragment());
23
- $this->assertSame('https://user:pass@example.com:8080/path/123?q=abc#test', (string) $uri);
24
- }
25
-
26
- public function testCanTransformAndRetrievePartsIndividually()
27
- {
28
- $uri = (new Uri())
29
- ->withScheme('https')
30
- ->withUserInfo('user', 'pass')
31
- ->withHost('example.com')
32
- ->withPort(8080)
33
- ->withPath('/path/123')
34
- ->withQuery('q=abc')
35
- ->withFragment('test');
36
-
37
- $this->assertSame('https', $uri->getScheme());
38
- $this->assertSame('user:pass@example.com:8080', $uri->getAuthority());
39
- $this->assertSame('user:pass', $uri->getUserInfo());
40
- $this->assertSame('example.com', $uri->getHost());
41
- $this->assertSame(8080, $uri->getPort());
42
- $this->assertSame('/path/123', $uri->getPath());
43
- $this->assertSame('q=abc', $uri->getQuery());
44
- $this->assertSame('test', $uri->getFragment());
45
- $this->assertSame('https://user:pass@example.com:8080/path/123?q=abc#test', (string) $uri);
46
- }
47
-
48
- /**
49
- * @dataProvider getValidUris
50
- */
51
- public function testValidUrisStayValid($input)
52
- {
53
- $uri = new Uri($input);
54
-
55
- $this->assertSame($input, (string) $uri);
56
- }
57
-
58
- /**
59
- * @dataProvider getValidUris
60
- */
61
- public function testFromParts($input)
62
- {
63
- $uri = Uri::fromParts(parse_url($input));
64
-
65
- $this->assertSame($input, (string) $uri);
66
- }
67
-
68
- public function getValidUris()
69
- {
70
- return [
71
- ['urn:path-rootless'],
72
- ['urn:path:with:colon'],
73
- ['urn:/path-absolute'],
74
- ['urn:/'],
75
- // only scheme with empty path
76
- ['urn:'],
77
- // only path
78
- ['/'],
79
- ['relative/'],
80
- ['0'],
81
- // same document reference
82
- [''],
83
- // network path without scheme
84
- ['//example.org'],
85
- ['//example.org/'],
86
- ['//example.org?q#h'],
87
- // only query
88
- ['?q'],
89
- ['?q=abc&foo=bar'],
90
- // only fragment
91
- ['#fragment'],
92
- // dot segments are not removed automatically
93
- ['./foo/../bar'],
94
- ];
95
- }
96
-
97
- /**
98
- * @expectedException \InvalidArgumentException
99
- * @expectedExceptionMessage Unable to parse URI
100
- * @dataProvider getInvalidUris
101
- */
102
- public function testInvalidUrisThrowException($invalidUri)
103
- {
104
- new Uri($invalidUri);
105
- }
106
-
107
- public function getInvalidUris()
108
- {
109
- return [
110
- // parse_url() requires the host component which makes sense for http(s)
111
- // but not when the scheme is not known or different. So '//' or '///' is
112
- // currently invalid as well but should not according to RFC 3986.
113
- ['http://'],
114
- ['urn://host:with:colon'], // host cannot contain ":"
115
- ];
116
- }
117
-
118
- /**
119
- * @expectedException \InvalidArgumentException
120
- * @expectedExceptionMessage Invalid port: 100000. Must be between 1 and 65535
121
- */
122
- public function testPortMustBeValid()
123
- {
124
- (new Uri())->withPort(100000);
125
- }
126
-
127
- /**
128
- * @expectedException \InvalidArgumentException
129
- * @expectedExceptionMessage Invalid port: 0. Must be between 1 and 65535
130
- */
131
- public function testWithPortCannotBeZero()
132
- {
133
- (new Uri())->withPort(0);
134
- }
135
-
136
- /**
137
- * @expectedException \InvalidArgumentException
138
- * @expectedExceptionMessage Unable to parse URI
139
- */
140
- public function testParseUriPortCannotBeZero()
141
- {
142
- new Uri('//example.com:0');
143
- }
144
-
145
- /**
146
- * @expectedException \InvalidArgumentException
147
- */
148
- public function testSchemeMustHaveCorrectType()
149
- {
150
- (new Uri())->withScheme([]);
151
- }
152
-
153
- /**
154
- * @expectedException \InvalidArgumentException
155
- */
156
- public function testHostMustHaveCorrectType()
157
- {
158
- (new Uri())->withHost([]);
159
- }
160
-
161
- /**
162
- * @expectedException \InvalidArgumentException
163
- */
164
- public function testPathMustHaveCorrectType()
165
- {
166
- (new Uri())->withPath([]);
167
- }
168
-
169
- /**
170
- * @expectedException \InvalidArgumentException
171
- */
172
- public function testQueryMustHaveCorrectType()
173
- {
174
- (new Uri())->withQuery([]);
175
- }
176
-
177
- /**
178
- * @expectedException \InvalidArgumentException
179
- */
180
- public function testFragmentMustHaveCorrectType()
181
- {
182
- (new Uri())->withFragment([]);
183
- }
184
-
185
- public function testCanParseFalseyUriParts()
186
- {
187
- $uri = new Uri('0://0:0@0/0?0#0');
188
-
189
- $this->assertSame('0', $uri->getScheme());
190
- $this->assertSame('0:0@0', $uri->getAuthority());
191
- $this->assertSame('0:0', $uri->getUserInfo());
192
- $this->assertSame('0', $uri->getHost());
193
- $this->assertSame('/0', $uri->getPath());
194
- $this->assertSame('0', $uri->getQuery());
195
- $this->assertSame('0', $uri->getFragment());
196
- $this->assertSame('0://0:0@0/0?0#0', (string) $uri);
197
- }
198
-
199
- public function testCanConstructFalseyUriParts()
200
- {
201
- $uri = (new Uri())
202
- ->withScheme('0')
203
- ->withUserInfo('0', '0')
204
- ->withHost('0')
205
- ->withPath('/0')
206
- ->withQuery('0')
207
- ->withFragment('0');
208
-
209
- $this->assertSame('0', $uri->getScheme());
210
- $this->assertSame('0:0@0', $uri->getAuthority());
211
- $this->assertSame('0:0', $uri->getUserInfo());
212
- $this->assertSame('0', $uri->getHost());
213
- $this->assertSame('/0', $uri->getPath());
214
- $this->assertSame('0', $uri->getQuery());
215
- $this->assertSame('0', $uri->getFragment());
216
- $this->assertSame('0://0:0@0/0?0#0', (string) $uri);
217
- }
218
-
219
- /**
220
- * @dataProvider getPortTestCases
221
- */
222
- public function testIsDefaultPort($scheme, $port, $isDefaultPort)
223
- {
224
- $uri = $this->getMock('Psr\Http\Message\UriInterface');
225
- $uri->expects($this->any())->method('getScheme')->will($this->returnValue($scheme));
226
- $uri->expects($this->any())->method('getPort')->will($this->returnValue($port));
227
-
228
- $this->assertSame($isDefaultPort, Uri::isDefaultPort($uri));
229
- }
230
-
231
- public function getPortTestCases()
232
- {
233
- return [
234
- ['http', null, true],
235
- ['http', 80, true],
236
- ['http', 8080, false],
237
- ['https', null, true],
238
- ['https', 443, true],
239
- ['https', 444, false],
240
- ['ftp', 21, true],
241
- ['gopher', 70, true],
242
- ['nntp', 119, true],
243
- ['news', 119, true],
244
- ['telnet', 23, true],
245
- ['tn3270', 23, true],
246
- ['imap', 143, true],
247
- ['pop', 110, true],
248
- ['ldap', 389, true],
249
- ];
250
- }
251
-
252
- public function testIsAbsolute()
253
- {
254
- $this->assertTrue(Uri::isAbsolute(new Uri('http://example.org')));
255
- $this->assertFalse(Uri::isAbsolute(new Uri('//example.org')));
256
- $this->assertFalse(Uri::isAbsolute(new Uri('/abs-path')));
257
- $this->assertFalse(Uri::isAbsolute(new Uri('rel-path')));
258
- }
259
-
260
- public function testIsNetworkPathReference()
261
- {
262
- $this->assertFalse(Uri::isNetworkPathReference(new Uri('http://example.org')));
263
- $this->assertTrue(Uri::isNetworkPathReference(new Uri('//example.org')));
264
- $this->assertFalse(Uri::isNetworkPathReference(new Uri('/abs-path')));
265
- $this->assertFalse(Uri::isNetworkPathReference(new Uri('rel-path')));
266
- }
267
-
268
- public function testIsAbsolutePathReference()
269
- {
270
- $this->assertFalse(Uri::isAbsolutePathReference(new Uri('http://example.org')));
271
- $this->assertFalse(Uri::isAbsolutePathReference(new Uri('//example.org')));
272
- $this->assertTrue(Uri::isAbsolutePathReference(new Uri('/abs-path')));
273
- $this->assertTrue(Uri::isAbsolutePathReference(new Uri('/')));
274
- $this->assertFalse(Uri::isAbsolutePathReference(new Uri('rel-path')));
275
- }
276
-
277
- public function testIsRelativePathReference()
278
- {
279
- $this->assertFalse(Uri::isRelativePathReference(new Uri('http://example.org')));
280
- $this->assertFalse(Uri::isRelativePathReference(new Uri('//example.org')));
281
- $this->assertFalse(Uri::isRelativePathReference(new Uri('/abs-path')));
282
- $this->assertTrue(Uri::isRelativePathReference(new Uri('rel-path')));
283
- $this->assertTrue(Uri::isRelativePathReference(new Uri('')));
284
- }
285
-
286
- public function testIsSameDocumentReference()
287
- {
288
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('http://example.org')));
289
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('//example.org')));
290
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('/abs-path')));
291
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('rel-path')));
292
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('?query')));
293
- $this->assertTrue(Uri::isSameDocumentReference(new Uri('')));
294
- $this->assertTrue(Uri::isSameDocumentReference(new Uri('#fragment')));
295
-
296
- $baseUri = new Uri('http://example.org/path?foo=bar');
297
-
298
- $this->assertTrue(Uri::isSameDocumentReference(new Uri('#fragment'), $baseUri));
299
- $this->assertTrue(Uri::isSameDocumentReference(new Uri('?foo=bar#fragment'), $baseUri));
300
- $this->assertTrue(Uri::isSameDocumentReference(new Uri('/path?foo=bar#fragment'), $baseUri));
301
- $this->assertTrue(Uri::isSameDocumentReference(new Uri('path?foo=bar#fragment'), $baseUri));
302
- $this->assertTrue(Uri::isSameDocumentReference(new Uri('//example.org/path?foo=bar#fragment'), $baseUri));
303
- $this->assertTrue(Uri::isSameDocumentReference(new Uri('http://example.org/path?foo=bar#fragment'), $baseUri));
304
-
305
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('https://example.org/path?foo=bar'), $baseUri));
306
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('http://example.com/path?foo=bar'), $baseUri));
307
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('http://example.org/'), $baseUri));
308
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('http://example.org'), $baseUri));
309
-
310
- $this->assertFalse(Uri::isSameDocumentReference(new Uri('urn:/path'), new Uri('urn://example.com/path')));
311
- }
312
-
313
- public function testAddAndRemoveQueryValues()
314
- {
315
- $uri = new Uri();
316
- $uri = Uri::withQueryValue($uri, 'a', 'b');
317
- $uri = Uri::withQueryValue($uri, 'c', 'd');
318
- $uri = Uri::withQueryValue($uri, 'e', null);
319
- $this->assertSame('a=b&c=d&e', $uri->getQuery());
320
-
321
- $uri = Uri::withoutQueryValue($uri, 'c');
322
- $this->assertSame('a=b&e', $uri->getQuery());
323
- $uri = Uri::withoutQueryValue($uri, 'e');
324
- $this->assertSame('a=b', $uri->getQuery());
325
- $uri = Uri::withoutQueryValue($uri, 'a');
326
- $this->assertSame('', $uri->getQuery());
327
- }
328
-
329
- public function testWithQueryValueReplacesSameKeys()
330
- {
331
- $uri = new Uri();
332
- $uri = Uri::withQueryValue($uri, 'a', 'b');
333
- $uri = Uri::withQueryValue($uri, 'c', 'd');
334
- $uri = Uri::withQueryValue($uri, 'a', 'e');
335
- $this->assertSame('c=d&a=e', $uri->getQuery());
336
- }
337
-
338
- public function testWithoutQueryValueRemovesAllSameKeys()
339
- {
340
- $uri = (new Uri())->withQuery('a=b&c=d&a=e');
341
- $uri = Uri::withoutQueryValue($uri, 'a');
342
- $this->assertSame('c=d', $uri->getQuery());
343
- }
344
-
345
- public function testRemoveNonExistingQueryValue()
346
- {
347
- $uri = new Uri();
348
- $uri = Uri::withQueryValue($uri, 'a', 'b');
349
- $uri = Uri::withoutQueryValue($uri, 'c');
350
- $this->assertSame('a=b', $uri->getQuery());
351
- }
352
-
353
- public function testWithQueryValueHandlesEncoding()
354
- {
355
- $uri = new Uri();
356
- $uri = Uri::withQueryValue($uri, 'E=mc^2', 'ein&stein');
357
- $this->assertSame('E%3Dmc%5E2=ein%26stein', $uri->getQuery(), 'Decoded key/value get encoded');
358
-
359
- $uri = new Uri();
360
- $uri = Uri::withQueryValue($uri, 'E%3Dmc%5e2', 'ein%26stein');
361
- $this->assertSame('E%3Dmc%5e2=ein%26stein', $uri->getQuery(), 'Encoded key/value do not get double-encoded');
362
- }
363
-
364
- public function testWithoutQueryValueHandlesEncoding()
365
- {
366
- // It also tests that the case of the percent-encoding does not matter,
367
- // i.e. both lowercase "%3d" and uppercase "%5E" can be removed.
368
- $uri = (new Uri())->withQuery('E%3dmc%5E2=einstein&foo=bar');
369
- $uri = Uri::withoutQueryValue($uri, 'E=mc^2');
370
- $this->assertSame('foo=bar', $uri->getQuery(), 'Handles key in decoded form');
371
-
372
- $uri = (new Uri())->withQuery('E%3dmc%5E2=einstein&foo=bar');
373
- $uri = Uri::withoutQueryValue($uri, 'E%3Dmc%5e2');
374
- $this->assertSame('foo=bar', $uri->getQuery(), 'Handles key in encoded form');
375
- }
376
-
377
- public function testSchemeIsNormalizedToLowercase()
378
- {
379
- $uri = new Uri('HTTP://example.com');
380
-
381
- $this->assertSame('http', $uri->getScheme());
382
- $this->assertSame('http://example.com', (string) $uri);
383
-
384
- $uri = (new Uri('//example.com'))->withScheme('HTTP');
385
-
386
- $this->assertSame('http', $uri->getScheme());
387
- $this->assertSame('http://example.com', (string) $uri);
388
- }
389
-
390
- public function testHostIsNormalizedToLowercase()
391
- {
392
- $uri = new Uri('//eXaMpLe.CoM');
393
-
394
- $this->assertSame('example.com', $uri->getHost());
395
- $this->assertSame('//example.com', (string) $uri);
396
-
397
- $uri = (new Uri())->withHost('eXaMpLe.CoM');
398
-
399
- $this->assertSame('example.com', $uri->getHost());
400
- $this->assertSame('//example.com', (string) $uri);
401
- }
402
-
403
- public function testPortIsNullIfStandardPortForScheme()
404
- {
405
- // HTTPS standard port
406
- $uri = new Uri('https://example.com:443');
407
- $this->assertNull($uri->getPort());
408
- $this->assertSame('example.com', $uri->getAuthority());
409
-
410
- $uri = (new Uri('https://example.com'))->withPort(443);
411
- $this->assertNull($uri->getPort());
412
- $this->assertSame('example.com', $uri->getAuthority());
413
-
414
- // HTTP standard port
415
- $uri = new Uri('http://example.com:80');
416
- $this->assertNull($uri->getPort());
417
- $this->assertSame('example.com', $uri->getAuthority());
418
-
419
- $uri = (new Uri('http://example.com'))->withPort(80);
420
- $this->assertNull($uri->getPort());
421
- $this->assertSame('example.com', $uri->getAuthority());
422
- }
423
-
424
- public function testPortIsReturnedIfSchemeUnknown()
425
- {
426
- $uri = (new Uri('//example.com'))->withPort(80);
427
-
428
- $this->assertSame(80, $uri->getPort());
429
- $this->assertSame('example.com:80', $uri->getAuthority());
430
- }
431
-
432
- public function testStandardPortIsNullIfSchemeChanges()
433
- {
434
- $uri = new Uri('http://example.com:443');
435
- $this->assertSame('http', $uri->getScheme());
436
- $this->assertSame(443, $uri->getPort());
437
-
438
- $uri = $uri->withScheme('https');
439
- $this->assertNull($uri->getPort());
440
- }
441
-
442
- public function testPortPassedAsStringIsCastedToInt()
443
- {
444
- $uri = (new Uri('//example.com'))->withPort('8080');
445
-
446
- $this->assertSame(8080, $uri->getPort(), 'Port is returned as integer');
447
- $this->assertSame('example.com:8080', $uri->getAuthority());
448
- }
449
-
450
- public function testPortCanBeRemoved()
451
- {
452
- $uri = (new Uri('http://example.com:8080'))->withPort(null);
453
-
454
- $this->assertNull($uri->getPort());
455
- $this->assertSame('http://example.com', (string) $uri);
456
- }
457
-
458
- /**
459
- * In RFC 8986 the host is optional and the authority can only
460
- * consist of the user info and port.
461
- */
462
- public function testAuthorityWithUserInfoOrPortButWithoutHost()
463
- {
464
- $uri = (new Uri())->withUserInfo('user', 'pass');
465
-
466
- $this->assertSame('user:pass', $uri->getUserInfo());
467
- $this->assertSame('user:pass@', $uri->getAuthority());
468
-
469
- $uri = $uri->withPort(8080);
470
- $this->assertSame(8080, $uri->getPort());
471
- $this->assertSame('user:pass@:8080', $uri->getAuthority());
472
- $this->assertSame('//user:pass@:8080', (string) $uri);
473
-
474
- $uri = $uri->withUserInfo('');
475
- $this->assertSame(':8080', $uri->getAuthority());
476
- }
477
-
478
- public function testHostInHttpUriDefaultsToLocalhost()
479
- {
480
- $uri = (new Uri())->withScheme('http');
481
-
482
- $this->assertSame('localhost', $uri->getHost());
483
- $this->assertSame('localhost', $uri->getAuthority());
484
- $this->assertSame('http://localhost', (string) $uri);
485
- }
486
-
487
- public function testHostInHttpsUriDefaultsToLocalhost()
488
- {
489
- $uri = (new Uri())->withScheme('https');
490
-
491
- $this->assertSame('localhost', $uri->getHost());
492
- $this->assertSame('localhost', $uri->getAuthority());
493
- $this->assertSame('https://localhost', (string) $uri);
494
- }
495
-
496
- public function testFileSchemeWithEmptyHostReconstruction()
497
- {
498
- $uri = new Uri('file:///tmp/filename.ext');
499
-
500
- $this->assertSame('', $uri->getHost());
501
- $this->assertSame('', $uri->getAuthority());
502
- $this->assertSame('file:///tmp/filename.ext', (string) $uri);
503
- }
504
-
505
- public function uriComponentsEncodingProvider()
506
- {
507
- $unreserved = 'a-zA-Z0-9.-_~!$&\'()*+,;=:@';
508
-
509
- return [
510
- // Percent encode spaces
511
- ['/pa th?q=va lue#frag ment', '/pa%20th', 'q=va%20lue', 'frag%20ment', '/pa%20th?q=va%20lue#frag%20ment'],
512
- // Percent encode multibyte
513
- ['/€?€#€', '/%E2%82%AC', '%E2%82%AC', '%E2%82%AC', '/%E2%82%AC?%E2%82%AC#%E2%82%AC'],
514
- // Don't encode something that's already encoded
515
- ['/pa%20th?q=va%20lue#frag%20ment', '/pa%20th', 'q=va%20lue', 'frag%20ment', '/pa%20th?q=va%20lue#frag%20ment'],
516
- // Percent encode invalid percent encodings
517
- ['/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'],
518
- // Don't encode path segments
519
- ['/pa/th//two?q=va/lue#frag/ment', '/pa/th//two', 'q=va/lue', 'frag/ment', '/pa/th//two?q=va/lue#frag/ment'],
520
- // Don't encode unreserved chars or sub-delimiters
521
- ["/$unreserved?$unreserved#$unreserved", "/$unreserved", $unreserved, $unreserved, "/$unreserved?$unreserved#$unreserved"],
522
- // Encoded unreserved chars are not decoded
523
- ['/p%61th?q=v%61lue#fr%61gment', '/p%61th', 'q=v%61lue', 'fr%61gment', '/p%61th?q=v%61lue#fr%61gment'],
524
- ];
525
- }
526
-
527
- /**
528
- * @dataProvider uriComponentsEncodingProvider
529
- */
530
- public function testUriComponentsGetEncodedProperly($input, $path, $query, $fragment, $output)
531
- {
532
- $uri = new Uri($input);
533
- $this->assertSame($path, $uri->getPath());
534
- $this->assertSame($query, $uri->getQuery());
535
- $this->assertSame($fragment, $uri->getFragment());
536
- $this->assertSame($output, (string) $uri);
537
- }
538
-
539
- public function testWithPathEncodesProperly()
540
- {
541
- $uri = (new Uri())->withPath('/baz?#€/b%61r');
542
- // Query and fragment delimiters and multibyte chars are encoded.
543
- $this->assertSame('/baz%3F%23%E2%82%AC/b%61r', $uri->getPath());
544
- $this->assertSame('/baz%3F%23%E2%82%AC/b%61r', (string) $uri);
545
- }
546
-
547
- public function testWithQueryEncodesProperly()
548
- {
549
- $uri = (new Uri())->withQuery('?=#&€=/&b%61r');
550
- // A query starting with a "?" is valid and must not be magically removed. Otherwise it would be impossible to
551
- // construct such an URI. Also the "?" and "/" does not need to be encoded in the query.
552
- $this->assertSame('?=%23&%E2%82%AC=/&b%61r', $uri->getQuery());
553
- $this->assertSame('??=%23&%E2%82%AC=/&b%61r', (string) $uri);
554
- }
555
-
556
- public function testWithFragmentEncodesProperly()
557
- {
558
- $uri = (new Uri())->withFragment('#€?/b%61r');
559
- // A fragment starting with a "#" is valid and must not be magically removed. Otherwise it would be impossible to
560
- // construct such an URI. Also the "?" and "/" does not need to be encoded in the fragment.
561
- $this->assertSame('%23%E2%82%AC?/b%61r', $uri->getFragment());
562
- $this->assertSame('#%23%E2%82%AC?/b%61r', (string) $uri);
563
- }
564
-
565
- public function testAllowsForRelativeUri()
566
- {
567
- $uri = (new Uri)->withPath('foo');
568
- $this->assertSame('foo', $uri->getPath());
569
- $this->assertSame('foo', (string) $uri);
570
- }
571
-
572
- public function testRelativePathAndAuhorityIsAutomagicallyFixed()
573
- {
574
- // concatenating a relative path with a host doesn't work: "//example.comfoo" would be wrong
575
- $uri = (new Uri)->withPath('foo')->withHost('example.com');
576
- $this->assertSame('/foo', $uri->getPath());
577
- $this->assertSame('//example.com/foo', (string) $uri);
578
- }
579
-
580
- /**
581
- * @expectedException \InvalidArgumentException
582
- * @expectedExceptionMessage The path of a URI without an authority must not start with two slashes "//"
583
- */
584
- public function testPathStartingWithTwoSlashesAndNoAuthorityIsInvalid()
585
- {
586
- // URI "//foo" would be interpreted as network reference and thus change the original path to the host
587
- (new Uri)->withPath('//foo');
588
- }
589
-
590
- public function testPathStartingWithTwoSlashes()
591
- {
592
- $uri = new Uri('http://example.org//path-not-host.com');
593
- $this->assertSame('//path-not-host.com', $uri->getPath());
594
-
595
- $uri = $uri->withScheme('');
596
- $this->assertSame('//example.org//path-not-host.com', (string) $uri); // This is still valid
597
- $this->setExpectedException('\InvalidArgumentException');
598
- $uri->withHost(''); // Now it becomes invalid
599
- }
600
-
601
- /**
602
- * @expectedException \InvalidArgumentException
603
- * @expectedExceptionMessage A relative URI must not have a path beginning with a segment containing a colon
604
- */
605
- public function testRelativeUriWithPathBeginngWithColonSegmentIsInvalid()
606
- {
607
- (new Uri)->withPath('mailto:foo');
608
- }
609
-
610
- public function testRelativeUriWithPathHavingColonSegment()
611
- {
612
- $uri = (new Uri('urn:/mailto:foo'))->withScheme('');
613
- $this->assertSame('/mailto:foo', $uri->getPath());
614
-
615
- $this->setExpectedException('\InvalidArgumentException');
616
- (new Uri('urn:mailto:foo'))->withScheme('');
617
- }
618
-
619
- public function testDefaultReturnValuesOfGetters()
620
- {
621
- $uri = new Uri();
622
-
623
- $this->assertSame('', $uri->getScheme());
624
- $this->assertSame('', $uri->getAuthority());
625
- $this->assertSame('', $uri->getUserInfo());
626
- $this->assertSame('', $uri->getHost());
627
- $this->assertNull($uri->getPort());
628
- $this->assertSame('', $uri->getPath());
629
- $this->assertSame('', $uri->getQuery());
630
- $this->assertSame('', $uri->getFragment());
631
- }
632
-
633
- public function testImmutability()
634
- {
635
- $uri = new Uri();
636
-
637
- $this->assertNotSame($uri, $uri->withScheme('https'));
638
- $this->assertNotSame($uri, $uri->withUserInfo('user', 'pass'));
639
- $this->assertNotSame($uri, $uri->withHost('example.com'));
640
- $this->assertNotSame($uri, $uri->withPort(8080));
641
- $this->assertNotSame($uri, $uri->withPath('/path/123'));
642
- $this->assertNotSame($uri, $uri->withQuery('q=abc'));
643
- $this->assertNotSame($uri, $uri->withFragment('test'));
644
- }
645
-
646
- public function testExtendingClassesInstantiates()
647
- {
648
- // The non-standard port triggers a cascade of private methods which
649
- // should not use late static binding to access private static members.
650
- // If they do, this will fatal.
651
- $this->assertInstanceOf(
652
- 'GuzzleHttp\Tests\Psr7\ExtendedUriTest',
653
- new ExtendedUriTest('http://h:9/')
654
- );
655
- }
656
- }
657
-
658
- class ExtendedUriTest extends Uri
659
- {
660
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/league/flysystem-azure-blob-storage/.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /vendor/
2
+ /coverage/
3
+ /coverage.xml
4
+ /composer.lock
5
+
vendor/league/flysystem-azure-blob-storage/.travis.yml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ php:
4
+ - 5.6
5
+ - 7.0
6
+ - 7.1
7
+ - 7.2
8
+ - 7.3
9
+
10
+
11
+ install:
12
+ - travis_retry composer install --prefer-dist
13
+
14
+ script:
15
+ - vendor/bin/phpunit
16
+
17
+ #after_script:
18
+ # - wget https://scrutinizer-ci.com/ocular.phar
19
+ # - php ocular.phar code-coverage:upload --format=php-clover coverage.xml
vendor/league/flysystem-azure-blob-storage/composer.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "league/flysystem-azure-blob-storage",
3
+ "autoload": {
4
+ "psr-4": {
5
+ "League\\Flysystem\\AzureBlobStorage\\": "src/"
6
+ }
7
+ },
8
+ "require": {
9
+ "php": ">=5.6",
10
+ "league/flysystem": "^1.0",
11
+ "microsoft/azure-storage-blob": "^1.1",
12
+ "guzzlehttp/psr7": "^1.5"
13
+ },
14
+ "require-dev": {
15
+ "phpunit/phpunit": "^5.7"
16
+ },
17
+ "license": "MIT",
18
+ "authors": [
19
+ {
20
+ "name": "Frank de Jonge",
21
+ "email": "info@frenky.net"
22
+ }
23
+ ]
24
+ }
vendor/league/flysystem-azure-blob-storage/phpunit.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit backupGlobals="false"
3
+ backupStaticAttributes="false"
4
+ bootstrap="./vendor/autoload.php"
5
+ colors="true"
6
+ convertErrorsToExceptions="true"
7
+ convertNoticesToExceptions="true"
8
+ convertWarningsToExceptions="true"
9
+ processIsolation="false"
10
+ stopOnFailure="false"
11
+ syntaxCheck="true"
12
+ verbose="true"
13
+ >
14
+ <testsuites>
15
+ <testsuite name="flysystem/tests">
16
+ <directory suffix="Test.php">./tests/</directory>
17
+ <directory suffix="Tests.php">./tests/</directory>
18
+ </testsuite>
19
+ </testsuites>
20
+ <filter>
21
+ <whitelist>
22
+ <directory suffix=".php">./src/</directory>
23
+ </whitelist>
24
+ </filter>
25
+ <logging>
26
+ <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
27
+ <log type="coverage-clover" target="coverage.xml" showUncoveredFiles="true"/>
28
+ </logging>
29
+ </phpunit>
vendor/league/flysystem-azure-blob-storage/readme.md ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ ## Readme
2
+
3
+ [View the docs.](https://flysystem.thephpleague.com/docs/adapter/azure/)
vendor/league/flysystem-azure-blob-storage/src/AzureBlobStorageAdapter.php ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Flysystem\AzureBlobStorage;
4
+
5
+ use function GuzzleHttp\Psr7\stream_for;
6
+ use League\Flysystem\Adapter\AbstractAdapter;
7
+ use League\Flysystem\Adapter\Polyfill\NotSupportingVisibilityTrait;
8
+ use League\Flysystem\Config;
9
+ use League\Flysystem\Util;
10
+ use MicrosoftAzure\Storage\Blob\BlobRestProxy;
11
+ use MicrosoftAzure\Storage\Blob\Models\BlobPrefix;
12
+ use MicrosoftAzure\Storage\Blob\Models\BlobProperties;
13
+ use MicrosoftAzure\Storage\Blob\Models\CreateBlockBlobOptions;
14
+ use MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions;
15
+ use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;
16
+ use MicrosoftAzure\Storage\Common\Models\ContinuationToken;
17
+ use function array_merge;
18
+ use function compact;
19
+ use function stream_get_contents;
20
+ use function strpos;
21
+
22
+ class AzureBlobStorageAdapter extends AbstractAdapter
23
+ {
24
+ use NotSupportingVisibilityTrait;
25
+
26
+ /**
27
+ * @var string[]
28
+ */
29
+ protected static $metaOptions = [
30
+ 'CacheControl',
31
+ 'ContentType',
32
+ 'Metadata',
33
+ 'ContentLanguage',
34
+ 'ContentEncoding',
35
+ ];
36
+
37
+ /**
38
+ * @var BlobRestProxy
39
+ */
40
+ private $client;
41
+
42
+ private $container;
43
+
44
+ private $maxResultsForContentsListing = 5000;
45
+
46
+ public function __construct(BlobRestProxy $client, $container, $prefix = null)
47
+ {
48
+ $this->client = $client;
49
+ $this->container = $container;
50
+ $this->setPathPrefix($prefix);
51
+ }
52
+
53
+ public function write($path, $contents, Config $config)
54
+ {
55
+ return $this->upload($path, $contents, $config) + compact('contents');
56
+ }
57
+
58
+ public function writeStream($path, $resource, Config $config)
59
+ {
60
+ return $this->upload($path, $resource, $config);
61
+ }
62
+
63
+ protected function upload($path, $contents, Config $config)
64
+ {
65
+ $destination = $this->applyPathPrefix($path);
66
+
67
+ $options = $this->getOptionsFromConfig($config);
68
+
69
+ if (empty($options->getContentType())) {
70
+ $options->setContentType(Util::guessMimeType($path, $contents));
71
+ }
72
+
73
+ /**
74
+ * We manually create the stream to prevent it from closing the resource
75
+ * in its destructor.
76
+ */
77
+ $stream = stream_for($contents);
78
+ $response = $this->client->createBlockBlob(
79
+ $this->container,
80
+ $destination,
81
+ $contents,
82
+ $options
83
+ );
84
+
85
+ $stream->detach();
86
+
87
+ return [
88
+ 'path' => $path,
89
+ 'timestamp' => (int) $response->getLastModified()->getTimestamp(),
90
+ 'dirname' => Util::dirname($path),
91
+ 'type' => 'file',
92
+ ];
93
+ }
94
+
95
+ public function update($path, $contents, Config $config)
96
+ {
97
+ return $this->upload($path, $contents, $config) + compact('contents');
98
+ }
99
+
100
+ public function updateStream($path, $resource, Config $config)
101
+ {
102
+ return $this->upload($path, $resource, $config);
103
+ }
104
+
105
+ public function rename($path, $newpath)
106
+ {
107
+ return $this->copy($path, $newpath) && $this->delete($path);
108
+ }
109
+
110
+ public function copy($path, $newpath)
111
+ {
112
+ $source = $this->applyPathPrefix($path);
113
+ $destination = $this->applyPathPrefix($newpath);
114
+ $this->client->copyBlob($this->container, $destination, $this->container, $source);
115
+
116
+ return true;
117
+ }
118
+
119
+ public function delete($path)
120
+ {
121
+ try {
122
+ $this->client->deleteBlob($this->container, $this->applyPathPrefix($path));
123
+ } catch (ServiceException $exception) {
124
+ if ($exception->getCode() !== 404) {
125
+ throw $exception;
126
+ }
127
+ }
128
+
129
+ return true;
130
+ }
131
+
132
+ public function deleteDir($dirname)
133
+ {
134
+ $prefix = $this->applyPathPrefix($dirname);
135
+ $options = new ListBlobsOptions();
136
+ $options->setPrefix($prefix . '/');
137
+ $listResults = $this->client->listBlobs($this->container, $options);
138
+ foreach ($listResults->getBlobs() as $blob) {
139
+ $this->client->deleteBlob($this->container, $blob->getName());
140
+ }
141
+
142
+ return true;
143
+ }
144
+
145
+ public function createDir($dirname, Config $config)
146
+ {
147
+ return ['path' => $dirname, 'type' => 'dir'];
148
+ }
149
+
150
+ public function has($path)
151
+ {
152
+ return $this->getMetadata($path);
153
+ }
154
+
155
+ public function read($path)
156
+ {
157
+ $response = $this->readStream($path);
158
+
159
+ if ( ! isset($response['stream']) || ! is_resource($response['stream'])) {
160
+ return $response;
161
+ }
162
+
163
+ $response['contents'] = stream_get_contents($response['stream']);
164
+ unset($response['stream']);
165
+
166
+ return $response;
167
+ }
168
+
169
+ public function readStream($path)
170
+ {
171
+ $location = $this->applyPathPrefix($path);
172
+
173
+ try {
174
+ $response = $this->client->getBlob(
175
+ $this->container,
176
+ $location
177
+ );
178
+
179
+ return $this->normalizeBlobProperties($path, $response->getProperties())
180
+ + ['stream' => $response->getContentStream()];
181
+ } catch (ServiceException $exception) {
182
+ if ($exception->getCode() !== 404) {
183
+ throw $exception;
184
+ }
185
+
186
+ return false;
187
+ }
188
+ }
189
+
190
+ public function listContents($directory = '', $recursive = false)
191
+ {
192
+ $result = [];
193
+ $location = $this->applyPathPrefix($directory);
194
+
195
+ if (strlen($location) > 0) {
196
+ $location = rtrim($location, '/') . '/';
197
+ }
198
+
199
+ $options = new ListBlobsOptions();
200
+ $options->setPrefix($location);
201
+ $options->setMaxResults($this->maxResultsForContentsListing);
202
+
203
+ if ( ! $recursive) {
204
+ $options->setDelimiter('/');
205
+ }
206
+
207
+ list_contents:
208
+ $response = $this->client->listBlobs($this->container, $options);
209
+ $continuationToken = $response->getContinuationToken();
210
+ foreach ($response->getBlobs() as $blob) {
211
+ $name = $blob->getName();
212
+
213
+ if ($location === '' || strpos($name, $location) === 0) {
214
+ $result[] = $this->normalizeBlobProperties($name, $blob->getProperties());
215
+ }
216
+ }
217
+
218
+ if ( ! $recursive) {
219
+ $result = array_merge($result, array_map([$this, 'normalizeBlobPrefix'], $response->getBlobPrefixes()));
220
+ }
221
+
222
+ if ($continuationToken instanceof ContinuationToken) {
223
+ $options->setContinuationToken($continuationToken);
224
+ goto list_contents;
225
+ }
226
+
227
+ return Util::emulateDirectories($result);
228
+ }
229
+
230
+ public function getMetadata($path)
231
+ {
232
+ $path = $this->applyPathPrefix($path);
233
+
234
+ try {
235
+ return $this->normalizeBlobProperties(
236
+ $path,
237
+ $this->client->getBlobProperties($this->container, $path)->getProperties()
238
+ );
239
+ } catch (ServiceException $exception) {
240
+ if ($exception->getCode() !== 404) {
241
+ throw $exception;
242
+ }
243
+
244
+ return false;
245
+ }
246
+ }
247
+
248
+ public function getSize($path)
249
+ {
250
+ return $this->getMetadata($path);
251
+ }
252
+
253
+ public function getMimetype($path)
254
+ {
255
+ return $this->getMetadata($path);
256
+ }
257
+
258
+ public function getTimestamp($path)
259
+ {
260
+ return $this->getMetadata($path);
261
+ }
262
+
263
+ protected function getOptionsFromConfig(Config $config)
264
+ {
265
+ $options = $config->get('blobOptions', new CreateBlockBlobOptions());
266
+ foreach (static::$metaOptions as $option) {
267
+ if ( ! $config->has($option)) {
268
+ continue;
269
+ }
270
+ call_user_func([$options, "set$option"], $config->get($option));
271
+ }
272
+ if ($mimetype = $config->get('mimetype')) {
273
+ $options->setContentType($mimetype);
274
+ }
275
+
276
+ return $options;
277
+ }
278
+
279
+ protected function normalizeBlobProperties($path, BlobProperties $properties)
280
+ {
281
+ $path = $this->removePathPrefix($path);
282
+
283
+ if (substr($path, -1) === '/') {
284
+ return ['type' => 'dir', 'path' => rtrim($path, '/')];
285
+ }
286
+
287
+ return [
288
+ 'path' => $path,
289
+ 'timestamp' => (int) $properties->getLastModified()->format('U'),
290
+ 'dirname' => Util::dirname($path),
291
+ 'mimetype' => $properties->getContentType(),
292
+ 'size' => $properties->getContentLength(),
293
+ 'type' => 'file',
294
+ ];
295
+ }
296
+
297
+ /**
298
+ * @param int $numberOfResults
299
+ */
300
+ public function setMaxResultsForContentsListing($numberOfResults)
301
+ {
302
+ $this->maxResultsForContentsListing = $numberOfResults;
303
+ }
304
+
305
+ protected function normalizeBlobPrefix(BlobPrefix $blobPrefix)
306
+ {
307
+ return ['type' => 'dir', 'path' => $this->removePathPrefix(rtrim($blobPrefix->getName(), '/'))];
308
+ }
309
+ }
vendor/league/flysystem-azure-blob-storage/tests/AzureBlobStorageTest.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use GuzzleHttp\Psr7\Response;
4
+ use League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter;
5
+ use League\Flysystem\Filesystem;
6
+ use MicrosoftAzure\Storage\Blob\BlobRestProxy;
7
+ use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;
8
+ use PHPUnit\Framework\TestCase;
9
+
10
+ class AzureBlobStorageTest extends TestCase
11
+ {
12
+ /**
13
+ * @var Filesystem
14
+ */
15
+ protected $filesystem;
16
+
17
+ /**
18
+ * @var AzureBlobStorageAdapter
19
+ */
20
+ private $adapter;
21
+
22
+ /**
23
+ * @var BlobRestProxy
24
+ */
25
+ private $azureClient;
26
+
27
+ /**
28
+ * @before
29
+ */
30
+ public function setup_filesystem()
31
+ {
32
+ $this->azureClient = $client = BlobRestProxy::createBlobService(getenv('FLYSYSTEM_AZURE_CONNECTION_STRING'));
33
+ $adapter = new AzureBlobStorageAdapter($client, 'flysystem', 'root_directory');
34
+ $this->filesystem = new Filesystem($adapter);
35
+ $this->filesystem->getConfig()->set('disable_asserts', true);
36
+ $this->adapter = $adapter;
37
+ }
38
+
39
+ /**
40
+ * @test
41
+ */
42
+ public function writing_and_reading_a_file()
43
+ {
44
+ $contents = 'with contents';
45
+ $filename = 'a_file.txt';
46
+ $this->assertTrue($this->filesystem->write($filename, $contents));
47
+ $this->assertEquals($contents, $this->filesystem->read($filename));
48
+ $this->assertTrue($this->filesystem->delete($filename));
49
+ }
50
+
51
+ /**
52
+ * @test
53
+ */
54
+ public function read_errors()
55
+ {
56
+ $this->assertFalse($this->filesystem->read('not-existing.txt'));
57
+ }
58
+
59
+ /**
60
+ * @test
61
+ */
62
+ public function read_exceptions()
63
+ {
64
+ $this->expectException(ServiceException::class);
65
+ $this->throwServiceException();
66
+ $this->adapter->read('not-existing.txt');
67
+ }
68
+
69
+ /**
70
+ * @test
71
+ */
72
+ public function writing_and_updating_and_reading_a_file()
73
+ {
74
+ $contents = 'new contents';
75
+ $filename = 'a_file.txt';
76
+ $this->assertTrue($this->filesystem->write($filename, 'original contents'));
77
+ $this->assertTrue($this->filesystem->update($filename, $contents));
78
+ $this->assertEquals($contents, $this->filesystem->read($filename));
79
+ $this->assertTrue($this->filesystem->delete($filename));
80
+ }
81
+
82
+ /**
83
+ * @test
84
+ */
85
+ public function writing_and_reading_a_stream()
86
+ {
87
+ $contents = 'with contents';
88
+ $filename = 'a_file.txt';
89
+ $handle = tmpfile();
90
+ fwrite($handle, $contents);
91
+ $this->assertTrue($this->filesystem->writeStream($filename, $handle));
92
+ is_resource($handle) && fclose($handle);
93
+ $handle = $this->filesystem->readStream($filename);
94
+ $this->assertInternalType('resource', $handle);
95
+ $this->assertEquals($contents, stream_get_contents($handle));
96
+ }
97
+
98
+ /**
99
+ * @test
100
+ */
101
+ public function writing_and_listing_contents()
102
+ {
103
+ $contents = 'with contents';
104
+ $filename = 'a_file.txt';
105
+ $handle = tmpfile();
106
+ fwrite($handle, $contents);
107
+ $this->assertTrue($this->filesystem->writeStream($filename, $handle));
108
+ is_resource($handle) && fclose($handle);
109
+ $listing = $this->filesystem->listContents('', true);
110
+ $this->assertCount(1, $listing);
111
+ }
112
+
113
+ /**
114
+ * @test
115
+ */
116
+ public function updating_contents()
117
+ {
118
+ $contents = 'with contents';
119
+ $filename = 'a_file.txt';
120
+ $handle = tmpfile();
121
+ fwrite($handle, $contents);
122
+ $this->assertTrue($this->filesystem->updateStream($filename, $handle));
123
+ is_resource($handle) && fclose($handle);
124
+ $listing = $this->filesystem->listContents('', true);
125
+ $this->assertCount(1, $listing);
126
+ }
127
+
128
+ /**
129
+ * @test
130
+ */
131
+ public function deleting_and_checking_file_existence()
132
+ {
133
+ $this->filesystem->write('directory/filename.txt', 'contents');
134
+ $this->assertNotFalse($this->filesystem->has('directory/filename.txt'));
135
+ $this->assertTrue($this->filesystem->delete('directory/filename.txt'));
136
+ $this->assertFalse($this->filesystem->has('directory/filename.txt'));
137
+ }
138
+
139
+ /**
140
+ * @test
141
+ */
142
+ public function deleting_files_that_dont_exist()
143
+ {
144
+ $this->assertTrue($this->filesystem->delete('nonexisting/filename.txt'));
145
+ }
146
+
147
+ /**
148
+ * @test
149
+ */
150
+ public function errors_during_deletes()
151
+ {
152
+ $this->expectException(ServiceException::class);
153
+ $this->throwServiceException();
154
+
155
+ $this->adapter->delete('something.txt');
156
+ }
157
+
158
+ /**
159
+ * @test
160
+ */
161
+ public function copying_files()
162
+ {
163
+ $this->assertNotFalse($this->filesystem->write('source.txt', 'contents'));
164
+ $this->filesystem->copy('source.txt', 'destination.txt');
165
+ $this->assertTrue($this->filesystem->has('destination.txt'));
166
+ $this->assertEquals('contents', $this->filesystem->read('destination.txt'));
167
+ }
168
+
169
+ /**
170
+ * @test
171
+ */
172
+ public function creating_a_directory()
173
+ {
174
+ $this->assertTrue($this->filesystem->createDir('dirname'));
175
+ }
176
+
177
+ /**
178
+ * @test
179
+ */
180
+ public function listing_a_directory()
181
+ {
182
+ $this->adapter->setMaxResultsForContentsListing(1);
183
+ $this->filesystem->write('path/to/file.txt', 'a file');
184
+ $this->filesystem->write('path/to/another/file.txt', 'a file');
185
+ $this->assertCount(2, $this->filesystem->listContents('path/to'));
186
+ $this->assertCount(3, $this->filesystem->listContents('path/to', true));
187
+ $this->assertCount(4, $this->filesystem->listContents('path', true));
188
+ }
189
+
190
+ /**
191
+ * @test
192
+ */
193
+ public function metadata_getters()
194
+ {
195
+ $this->filesystem->write('file.txt', 'contents');
196
+ $this->assertInternalType('int', $this->filesystem->getTimestamp('file.txt'));
197
+ $this->assertInternalType('array', $this->filesystem->getMetadata('file.txt'));
198
+ $this->assertInternalType('int', $this->filesystem->getSize('file.txt'));
199
+ $this->assertInternalType('string', $this->filesystem->getMimetype('file.txt'));
200
+ }
201
+
202
+ /**
203
+ * @test
204
+ */
205
+ public function renaming_a_file()
206
+ {
207
+ $this->filesystem->write('path/to/file.txt', 'contents');
208
+ $this->filesystem->rename('path/to/file.txt', 'new/path.txt');
209
+ $this->assertTrue($this->filesystem->has('new/path.txt'));
210
+ $this->assertFalse($this->filesystem->has('path/to/file.txt'));
211
+ }
212
+
213
+ /**
214
+ * @test
215
+ */
216
+ public function deleting_a_directory()
217
+ {
218
+ $this->filesystem->write('path/to/file.txt', 'contents');
219
+ $this->filesystem->write('path/to/another/file.txt', 'contents');
220
+ $this->assertTrue($this->filesystem->deleteDir('path/to'));
221
+ $this->assertFalse($this->filesystem->has('path/to/file.txt'));
222
+ $this->assertFalse($this->filesystem->has('path/to/another/file.txt'));
223
+
224
+ }
225
+
226
+ /**
227
+ * @test
228
+ */
229
+ public function pass_blob_options()
230
+ {
231
+ $blobOptions = new \MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions();
232
+ $blobOptions->setContentType('text/plain');
233
+ $this->filesystem->write('path/to/file.txt', 'contents', [
234
+ 'blobOptions' => $blobOptions
235
+ ]);
236
+ $this->assertEquals('text/plain', $this->azureClient->getBlobProperties('flysystem', 'path/to/file.txt')->getProperties()->getContentType());
237
+ $blobOptions = new \MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions();
238
+ $this->filesystem->write('path/to/file2.txt', 'contents', [
239
+ 'blobOptions' => $blobOptions
240
+ ]);
241
+ $this->assertNotEquals('text/plain', $this->azureClient->getBlobProperties('flysystem', 'path/to/file2.txt')->getProperties()->getContentType());
242
+
243
+ }
244
+
245
+
246
+ /**
247
+ * @after
248
+ */
249
+ public function cleanup_files()
250
+ {
251
+ if ($this->filesystem === null) {
252
+ return;
253
+ }
254
+
255
+ $files = $this->filesystem->listContents('', true);
256
+
257
+ foreach ($files as $file) {
258
+ if ($file['type'] === 'dir') continue;
259
+ $this->filesystem->delete($file['path']);
260
+ }
261
+ }
262
+
263
+ protected function throwServiceException()
264
+ {
265
+ $this->filesystem = null;
266
+ $this->azureClient->pushMiddleware(function () {
267
+ return function () {
268
+ throw new ServiceException(new Response(500, [], 'ERROR'));
269
+ };
270
+ });
271
+ }
272
+
273
+ }
vendor/league/flysystem-azure/composer.json DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "name": "league/flysystem-azure",
3
- "description": "Flysystem adapter for Windows Azure",
4
- "license": "MIT",
5
- "authors": [
6
- {
7
- "name": "Frank de Jonge",
8
- "email": "info@frenky.net"
9
- }
10
- ],
11
- "require": {
12
- "php": ">=5.5.0",
13
- "league/flysystem": "~1.0",
14
- "microsoft/azure-storage": "~0.10.1"
15
- },
16
- "require-dev": {
17
- "phpunit/phpunit": "~4.0",
18
- "mockery/mockery": "~0.9"
19
- },
20
- "autoload": {
21
- "psr-4": {
22
- "League\\Flysystem\\Azure\\": "src/"
23
- }
24
- },
25
- "config": {
26
- "bin-dir": "bin"
27
- },
28
- "extra": {
29
- "branch-alias": {
30
- "dev-master": "1.0-dev"
31
- }
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/league/flysystem-azure/src/Adapter.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- namespace League\Flysystem\Azure;
4
-
5
- /**
6
- * @deprecated deprecated since version 1.0.1
7
- */
8
- class Adapter extends AzureAdapter
9
- {
10
- // This is here purely because of BC.
11
- }
 
 
 
 
 
 
 
 
 
 
 
vendor/league/flysystem-azure/src/AzureAdapter.php DELETED
@@ -1,392 +0,0 @@
1
- <?php
2
-
3
- namespace League\Flysystem\Azure;
4
-
5
- use League\Flysystem\Adapter\AbstractAdapter;
6
- use League\Flysystem\Adapter\Polyfill\NotSupportingVisibilityTrait;
7
- use League\Flysystem\Config;
8
- use League\Flysystem\Util;
9
- use MicrosoftAzure\Storage\Blob\Internal\IBlob;
10
- use MicrosoftAzure\Storage\Blob\Models\BlobPrefix;
11
- use MicrosoftAzure\Storage\Blob\Models\BlobProperties;
12
- use MicrosoftAzure\Storage\Blob\Models\CopyBlobResult;
13
- use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions;
14
- use MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions;
15
- use MicrosoftAzure\Storage\Blob\Models\ListBlobsResult;
16
- use MicrosoftAzure\Storage\Common\ServiceException;
17
-
18
- class AzureAdapter extends AbstractAdapter
19
- {
20
- use NotSupportingVisibilityTrait;
21
-
22
- /**
23
- * @var string
24
- */
25
- protected $container;
26
-
27
- /**
28
- * @var IBlob
29
- */
30
- protected $client;
31
-
32
- /**
33
- * @var string[]
34
- */
35
- protected static $metaOptions = [
36
- 'CacheControl',
37
- 'ContentType',
38
- 'Metadata',
39
- 'ContentLanguage',
40
- 'ContentEncoding',
41
- ];
42
-
43
- /**
44
- * Constructor.
45
- *
46
- * @param IBlob $azureClient
47
- * @param string $container
48
- */
49
- public function __construct(IBlob $azureClient, $container, $prefix = null)
50
- {
51
- $this->client = $azureClient;
52
- $this->container = $container;
53
- $this->setPathPrefix($prefix);
54
- }
55
-
56
- /**
57
- * {@inheritdoc}
58
- */
59
- public function write($path, $contents, Config $config)
60
- {
61
- return $this->upload($path, $contents, $config);
62
- }
63
-
64
- /**
65
- * {@inheritdoc}
66
- */
67
- public function writeStream($path, $resource, Config $config)
68
- {
69
- return $this->upload($path, $resource, $config);
70
- }
71
-
72
- /**
73
- * {@inheritdoc}
74
- */
75
- public function update($path, $contents, Config $config)
76
- {
77
- return $this->upload($path, $contents, $config);
78
- }
79
-
80
- /**
81
- * {@inheritdoc}
82
- */
83
- public function updateStream($path, $resource, Config $config)
84
- {
85
- return $this->upload($path, $resource, $config);
86
- }
87
-
88
- /**
89
- * {@inheritdoc}
90
- */
91
- public function rename($path, $newpath)
92
- {
93
- $this->copy($path, $newpath);
94
-
95
- return $this->delete($path);
96
- }
97
-
98
- public function copy($path, $newpath)
99
- {
100
- $path = $this->applyPathPrefix($path);
101
- $newpath = $this->applyPathPrefix($newpath);
102
-
103
- $this->client->copyBlob($this->container, $newpath, $this->container, $path);
104
-
105
- return true;
106
- }
107
-
108
- /**
109
- * {@inheritdoc}
110
- */
111
- public function delete($path)
112
- {
113
- $path = $this->applyPathPrefix($path);
114
-
115
- $this->client->deleteBlob($this->container, $path);
116
-
117
- return true;
118
- }
119
-
120
- /**
121
- * {@inheritdoc}
122
- */
123
- public function deleteDir($dirname)
124
- {
125
- $dirname = $this->applyPathPrefix($dirname);
126
-
127
- $options = new ListBlobsOptions();
128
- $options->setPrefix($dirname . '/');
129
-
130
- /** @var ListBlobsResult $listResults */
131
- $listResults = $this->client->listBlobs($this->container, $options);
132
-
133
- foreach ($listResults->getBlobs() as $blob) {
134
- /** @var \MicrosoftAzure\Storage\Blob\Models\Blob $blob */
135
- $this->client->deleteBlob($this->container, $blob->getName());
136
- }
137
-
138
- return true;
139
- }
140
-
141
- /**
142
- * {@inheritdoc}
143
- */
144
- public function createDir($dirname, Config $config)
145
- {
146
- $this->write(rtrim($dirname, '/').'/', ' ', $config);
147
-
148
- return ['path' => $dirname, 'type' => 'dir'];
149
- }
150
-
151
- /**
152
- * {@inheritdoc}
153
- */
154
- public function has($path)
155
- {
156
- $path = $this->applyPathPrefix($path);
157
-
158
- try {
159
- $this->client->getBlobMetadata($this->container, $path);
160
- } catch (ServiceException $e) {
161
- if ($e->getCode() !== 404) {
162
- throw $e;
163
- }
164
-
165
- return false;
166
- }
167
-
168
- return true;
169
- }
170
-
171
- /**
172
- * {@inheritdoc}
173
- */
174
- public function read($path)
175
- {
176
- $path = $this->applyPathPrefix($path);
177
-
178
- /** @var \MicrosoftAzure\Storage\Blob\Models\GetBlobResult $blobResult */
179
- $blobResult = $this->client->getBlob($this->container, $path);
180
- $properties = $blobResult->getProperties();
181
- $content = $this->streamContentsToString($blobResult->getContentStream());
182
-
183
- return $this->normalizeBlobProperties($path, $properties) + ['contents' => $content];
184
- }
185
-
186
- /**
187
- * {@inheritdoc}
188
- */
189
- public function readStream($path)
190
- {
191
- $path = $this->applyPathPrefix($path);
192
-
193
- /** @var \MicrosoftAzure\Storage\Blob\Models\GetBlobResult $blobResult */
194
- $blobResult = $this->client->getBlob($this->container, $path);
195
- $properties = $blobResult->getProperties();
196
-
197
- return $this->normalizeBlobProperties($path, $properties) + ['stream' => $blobResult->getContentStream()];
198
- }
199
-
200
- /**
201
- * {@inheritdoc}
202
- */
203
- public function listContents($directory = '', $recursive = false)
204
- {
205
- $directory = $this->applyPathPrefix($directory);
206
-
207
- // Append trailing slash only for directory other than root (which after normalization is an empty string).
208
- // Listing for / doesn't work properly otherwise.
209
- if (strlen($directory)) {
210
- $directory = rtrim($directory, '/') . '/';
211
- }
212
-
213
- $options = new ListBlobsOptions();
214
- $options->setPrefix($directory);
215
-
216
- if (!$recursive) {
217
- $options->setDelimiter('/');
218
- }
219
-
220
- /** @var ListBlobsResult $listResults */
221
- $listResults = $this->client->listBlobs($this->container, $options);
222
-
223
- $contents = [];
224
-
225
- foreach ($listResults->getBlobs() as $blob) {
226
- $contents[] = $this->normalizeBlobProperties($blob->getName(), $blob->getProperties());
227
- }
228
-
229
- if (!$recursive) {
230
- $contents = array_merge($contents, array_map([$this, 'normalizeBlobPrefix'], $listResults->getBlobPrefixes()));
231
- }
232
-
233
- return Util::emulateDirectories($contents);
234
- }
235
-
236
- /**
237
- * {@inheritdoc}
238
- */
239
- public function getMetadata($path)
240
- {
241
- $path = $this->applyPathPrefix($path);
242
-
243
- /** @var \MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesResult $result */
244
- $result = $this->client->getBlobProperties($this->container, $path);
245
-
246
- return $this->normalizeBlobProperties($path, $result->getProperties());
247
- }
248
-
249
- /**
250
- * {@inheritdoc}
251
- */
252
- public function getSize($path)
253
- {
254
- return $this->getMetadata($path);
255
- }
256
-
257
- /**
258
- * {@inheritdoc}
259
- */
260
- public function getMimetype($path)
261
- {
262
- return $this->getMetadata($path);
263
- }
264
-
265
- /**
266
- * {@inheritdoc}
267
- */
268
- public function getTimestamp($path)
269
- {
270
- return $this->getMetadata($path);
271
- }
272
-
273
- /**
274
- * Builds the normalized output array.
275
- *
276
- * @param string $path
277
- * @param int $timestamp
278
- * @param mixed $content
279
- *
280
- * @return array
281
- */
282
- protected function normalize($path, $timestamp, $content = null)
283
- {
284
- $data = [
285
- 'path' => $path,
286
- 'timestamp' => (int) $timestamp,
287
- 'dirname' => Util::dirname($path),
288
- 'type' => 'file',
289
- ];
290
-
291
- if (is_string($content)) {
292
- $data['contents'] = $content;
293
- }
294
-
295
- return $data;
296
- }
297
-
298
- /**
299
- * Builds the normalized output array from a Blob object.
300
- *
301
- * @param string $path
302
- * @param BlobProperties $properties
303
- *
304
- * @return array
305
- */
306
- protected function normalizeBlobProperties($path, BlobProperties $properties)
307
- {
308
- if (substr($path, -1) === '/') {
309
- return ['type' => 'dir', 'path' => $this->removePathPrefix(rtrim($path, '/'))];
310
- }
311
-
312
- $path = $this->removePathPrefix($path);
313
-
314
- return [
315
- 'path' => $path,
316
- 'timestamp' => (int) $properties->getLastModified()->format('U'),
317
- 'dirname' => Util::dirname($path),
318
- 'mimetype' => $properties->getContentType(),
319
- 'size' => $properties->getContentLength(),
320
- 'type' => 'file',
321
- ];
322
- }
323
-
324
- /**
325
- * Builds the normalized output array from a BlobPrefix object.
326
- *
327
- * @param BlobPrefix $blobPrefix
328
- *
329
- * @return array
330
- */
331
- protected function normalizeBlobPrefix(BlobPrefix $blobPrefix)
332
- {
333
- return ['type' => 'dir', 'path' => $this->removePathPrefix(rtrim($blobPrefix->getName(), '/'))];
334
- }
335
-
336
- /**
337
- * Retrieves content streamed by Azure into a string.
338
- *
339
- * @param resource $resource
340
- *
341
- * @return string
342
- */
343
- protected function streamContentsToString($resource)
344
- {
345
- return stream_get_contents($resource);
346
- }
347
-
348
- /**
349
- * Upload a file.
350
- *
351
- * @param string $path Path
352
- * @param string|resource $contents Either a string or a stream.
353
- * @param Config $config Config
354
- *
355
- * @return array
356
- */
357
- protected function upload($path, $contents, Config $config)
358
- {
359
- $path = $this->applyPathPrefix($path);
360
-
361
- /** @var CopyBlobResult $result */
362
- $result = $this->client->createBlockBlob($this->container, $path, $contents, $this->getOptionsFromConfig($config));
363
-
364
- return $this->normalize($path, $result->getLastModified()->format('U'), $contents);
365
- }
366
-
367
- /**
368
- * Retrieve options from a Config instance.
369
- *
370
- * @param Config $config
371
- *
372
- * @return CreateBlobOptions
373
- */
374
- protected function getOptionsFromConfig(Config $config)
375
- {
376
- $options = new CreateBlobOptions();
377
-
378
- foreach (static::$metaOptions as $option) {
379
- if (!$config->has($option)) {
380
- continue;
381
- }
382
-
383
- call_user_func([$options, "set$option"], $config->get($option));
384
- }
385
-
386
- if ($mimetype = $config->get('mimetype')) {
387
- $options->setContentType($mimetype);
388
- }
389
-
390
- return $options;
391
- }
392
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/league/{flysystem-azure/LICENCE → flysystem-sftp/LICENSE} RENAMED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Frank de Jonge
2
 
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
  of this software and associated documentation files (the "Software"), to deal
1
+ Copyright (c) 2013-2018 Frank de Jonge
2
 
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
  of this software and associated documentation files (the "Software"), to deal
vendor/league/flysystem/.appveyor.yml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ build: false
2
+
3
+ platform:
4
+ - x64
5
+
6
+ clone_folder: c:\projects\project-code
7
+
8
+ cache:
9
+ - c:\ProgramData\chocolatey\bin -> .appveyor.yml
10
+ - c:\ProgramData\chocolatey\lib -> .appveyor.yml
11
+ - c:\ProgramData\ComposerSetup -> .appveyor.yml
12
+ - c:\tools\php -> .appveyor.yml
13
+
14
+ environment:
15
+ global:
16
+ COMPOSER_NO_INTERACTION: 1
17
+ ANSICON: 121x90 (121x90) # Console colors
18
+
19
+ matrix:
20
+ - PHP_VERSION: 5.6
21
+ COMPOSER_OPTS: --prefer-lowest
22
+
23
+ - PHP_VERSION: 5.6
24
+ COMPOSER_OPTS:
25
+
26
+ - PHP_VERSION: 7.2
27
+ COMPOSER_OPTS: --prefer-lowest
28
+
29
+ - PHP_VERSION: 7.2
30
+ COMPOSER_OPTS:
31
+
32
+ init:
33
+ - ps: $env:PATH = 'c:\tools\php;c:\ProgramData\ComposerSetup\bin;' + $env:PATH
34
+
35
+ install:
36
+ - ps: Set-Service wuauserv -StartupType Manual # Chocolatey will try to install Windows updates when installing PHP.
37
+ - ps: appveyor-retry cinst --no-progress --params '""/InstallDir:c:\tools\php""' -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:PHP_VERSION | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
38
+
39
+ - cd c:\tools\php
40
+ - copy php.ini-production php.ini /Y
41
+ - echo date.timezone="UTC" >> php.ini
42
+ - echo extension_dir=ext >> php.ini
43
+ - echo extension=php_openssl.dll >> php.ini # Needed to install Composer
44
+ - echo extension=php_mbstring.dll >> php.ini # Needed for PHPunit
45
+ - echo extension=php_fileinfo.dll >> php.ini
46
+
47
+ - appveyor-retry cinst --no-progress -y composer
48
+
49
+ - cd c:\projects\project-code
50
+ - appveyor-retry composer self-update
51
+ - appveyor-retry composer update --no-interaction --no-progress --no-suggest --optimize-autoloader --prefer-stable --prefer-dist %COMPOSER_OPTS%
52
+
53
+ test_script:
54
+ - cd c:\projects\project-code
55
+ - bin\phpunit --verbose --exclude-group=integration
56
+ - bin/phpspec run
vendor/league/flysystem/.github/ISSUE_TEMPLATE/Bug.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: 🐛 Bug
3
+ about: Did you encounter a bug?
4
+ ---
5
+
6
+ ### Bug Report
7
+
8
+ <!-- Fill in the relevant information below to help triage your issue. -->
9
+
10
+ | Q | A
11
+ |------------ | ------
12
+ | BC Break | yes
13
+ | Version | x.y.z
14
+
15
+ #### Summary
16
+
17
+ <!-- Provide a summary desciribing the problem you are experiencing. -->
18
+
19
+ #### How to reproduce
20
+
21
+ <!--
22
+ Provide steps to reproduce the issue.
23
+ If possible, also add a code snippet.
24
+ -->
vendor/league/flysystem/.github/ISSUE_TEMPLATE/Feature_Request.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: 🎉 Feature Request
3
+ about: Do you have a new feature in mind?
4
+ ---
5
+
6
+ ### Feature Request
7
+
8
+ <!-- Fill in the relevant information below to help triage your issue. -->
9
+
10
+ | Q | A
11
+ |------------ | ------
12
+ | New Feature | yes
13
+ | BC Break | yes/no
14
+
15
+ #### Scenario
16
+
17
+ <!-- Provide an explain in which scenario the feature would be helpful. -->
18
+
19
+ #### Summary
20
+
21
+ <!-- Provide a summary of the feature you would like to see implemented. -->
vendor/league/flysystem/.github/ISSUE_TEMPLATE/Question.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: ❓ Question
3
+ about: Are you unsure about something?
4
+ ---
5
+
6
+ ### Question
7
+
8
+ <!-- Fill in the relevant information below to help triage your issue. -->
9
+
10
+ | Q | A
11
+ |------------ | ------
12
+ | Version | x.y.z
vendor/league/flysystem/deprecations.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Deprecations
2
+
3
+ This document lists all the planned deprecations.
4
+
5
+ ## Handlers will be removed in 2.0
6
+
7
+ The `Handler` type and associated calls will be removed in version 2.0.
8
+
9
+ ### Upgrade path
10
+
11
+ You should create your own implementation for handling OOP usage,
12
+ but it's recommended to move away from using an OOP-style wrapper entirely.
13
+
14
+ The reason for this is that it's too easy for implementation details (for
15
+ your application this is Flysystem) to leak into the application. The most
16
+ important part for Flysystem is that it improves portability and creates a
17
+ solid boundary between your application core and the infrastructure you use.
18
+ The OOP-style handling breaks this principle, therefore I want to stop
19
+ promoting it.
vendor/league/flysystem/docs/guides/laravel-usage.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ layout: default
3
+ permalink: /docs/guides/laravel-usage/
4
+ title: Laravel Usage
5
+ ---
6
+
7
+ ## Laravel Usage
8
+
9
+ Flysystem is shipped with the default installation of Laravel. It also provides a tight
10
+ integration with the framework. For more information on how to use Flysystem within
11
+ Laravel, <a href="https://laravel.com/docs/5.6/filesystem">check out the documentation</a>.
12
+
13
+ <div class="flex my-6">
14
+ <a target="_blank" href="https://laravel.com" class="flex-no-grow w-1/3 bg-white rounded shadow-md mr-4 overflow-hidden">
15
+ <img src="/img/laravel.svg" class="w-full" alt="Laravel.com"/>
16
+ <span style="background-color: #FB503B" class="text-center text-xl hidden sm:block py-4 bg-indigo-dark text-white bg-grey-lightest">Laravel.com</span>
17
+ </a>
18
+ </div>
vendor/microsoft/azure-storage-blob/BreakingChanges.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ Tracking Breaking changes in 1.0.0
2
+
3
+ * Removed `dataSerializer` parameter from `BlobRextProxy` constructor.
4
+ * Option parameter type of `BlobRestProxy::CreateBlockBlob` and `BlobRestProxy::CreatePageBlobFromContent` changed and added `setUseTransactionalMD5` method.
5
+ * Deprecated PHP 5.5 support.
vendor/microsoft/azure-storage-blob/CONTRIBUTING.md ADDED
@@ -0,0 +1 @@
 
1
+ This [repository](https://github.com/azure/azure-storage-blob-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution.
vendor/microsoft/azure-storage-blob/ChangeLog.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2019.04 - version 1.4.0
2
+ * Added support for OAuth authentication.
3
+ * Resolved some issues on Linux platform.
4
+
5
+ 2019.03 - version 1.3.0
6
+ * Fixed a bug where blob name '0' cannot be created.
7
+ * Documentation refinement.
8
+ * `ListContainer` now can have ETag more robustly fetched from response header.
9
+
10
+ 2018.08 - version 1.2.0
11
+
12
+ * Updated Azure Storage API version from 2016-05-31 to 2017-04-17.
13
+ * Added method `setBlobTier` method in `BlobRestProxy` to set blob tiers.
14
+ * Added support setting or getting blob tiers related properties when creating blobs, listing blobs, getting blob properties and copying blobs.
15
+ * Set the `getBlobUrl()` method in `BlobRestProxy` visibility to public.
16
+
17
+ 2018.04 - version 1.1.0
18
+
19
+ * Private method BlobRestProxy::getBlobUrl now preserves primary URI path when exists.
20
+ * MD files are modified for better readability and formatting.
21
+ * CACERT can now be set when creating RestProxies using `$options` parameter.
22
+ * Added a sample in `BlobSamples.php` to list all blobs with certain prefix. This is a recommended implementation of using continuation token to list all the blobs.
23
+ * Removed unnecessary trailing spaces.
24
+ * Assertions are re-factored in test cases.
25
+ * Now the test framework uses `PHPUnit\Framework\TestCase` instead of `PHPUnit_Framework_TestCase`.
26
+
27
+ 2018.01 - version 1.0.0
28
+
29
+ * Created `BlobSharedAccessSignatureHelper` and moved method `SharedAccessSignatureHelper::generateBlobServiceSharedAccessSignatureToken()` into `BlobSharedAccessSignatureHelper`.
30
+ * Added static builder methods `createBlobService` and `createContainerAnonymousAccess` into `BlobRestProxy`.
31
+ * Removed `dataSerializer` parameter from `BlobRestProxy` constructor.
32
+ * Added `setUseTransactionalMD5` method for options of `BlobRestProxy::CreateBlockBlob` and `BlobRestProxy::CreatePageBlobFromContent`. Default false, enabling transactional MD5 validation will take more cpu and memory resources.
33
+ * Fixed a bug that CopyBlobFromURLOptions not found.
34
+ * Deprecated PHP 5.5 support.
vendor/microsoft/{azure-storage → azure-storage-blob}/LICENSE RENAMED
File without changes
vendor/microsoft/azure-storage-blob/README.md ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Microsoft Azure Storage Blob PHP Client Library
2
+
3
+ This project provides a PHP client library that makes it easy to access Microsoft Azure Storage blob services. For documentation on how to host PHP applications on Microsoft Azure, please see the [Microsoft Azure PHP Developer Center](http://www.windowsazure.com/en-us/develop/php/).
4
+
5
+ [![Latest Stable Version](https://poser.pugx.org/microsoft/azure-storage-blob/v/stable)](https://packagist.org/packages/microsoft/azure-storage-blob)
6
+
7
+ > **Note**
8
+ >
9
+ > * This [repository](https://github.com/azure/azure-storage-blob-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution.
10
+ > * If you are looking for the Service Bus, Service Runtime, Service Management or Media Services libraries, please visit https://github.com/Azure/azure-sdk-for-php.
11
+ > * If you need big file (larger than 2GB) or 64-bit integer support, please install PHP 7 64-bit version.
12
+
13
+ # Features
14
+
15
+ * Blobs
16
+ * create, list, and delete containers, work with container metadata and permissions, list blobs in container
17
+ * create block and page blobs (from a stream or a string), work with blob blocks and pages, delete blobs
18
+ * work with blob properties, metadata, leases, snapshot a blob
19
+
20
+ Please check details on [API reference documents](http://azure.github.io/azure-storage-php).
21
+
22
+ # Getting Started
23
+ ## Minimum Requirements
24
+
25
+ * PHP 5.6 or above
26
+ * See [composer.json](composer.json) for dependencies
27
+ * Required extension for PHP:
28
+ * php_fileinfo.dll
29
+ * php_mbstring.dll
30
+ * php_openssl.dll
31
+ * php_xsl.dll
32
+
33
+ * Recommended extension for PHP:
34
+ * php_curl.dll
35
+
36
+ ## Download Source Code
37
+
38
+ To get the source code from GitHub, type
39
+
40
+ ```
41
+ git clone https://github.com/Azure/azure-storage-php.git
42
+ cd ./azure-storage-php
43
+ ```
44
+
45
+ ## Install via Composer
46
+
47
+ 1. Create a file named **composer.json** in the root of your project and add the following code to it:
48
+ ```json
49
+ {
50
+ "require": {
51
+ "microsoft/azure-storage-blob": "*"
52
+ }
53
+ }
54
+ ```
55
+ 2. Download **[composer.phar](http://getcomposer.org/composer.phar)** in your project root.
56
+
57
+ 3. Open a command prompt and execute this in your project root
58
+
59
+ ```
60
+ php composer.phar install
61
+ ```
62
+
63
+ ## Usage
64
+
65
+ There are four basic steps that have to be performed before you can make a call to any Microsoft Azure Storage API when using the libraries.
66
+
67
+ * First, include the autoloader script:
68
+
69
+ ```php
70
+ require_once "vendor/autoload.php";
71
+ ```
72
+
73
+ * Include the namespaces you are going to use.
74
+
75
+ To create any Microsoft Azure service client you need to use the rest proxy classes, such as **BlobRestProxy** class:
76
+
77
+ ```php
78
+ use MicrosoftAzure\Storage\Blob\BlobRestProxy;
79
+ ```
80
+
81
+ To process exceptions you need:
82
+
83
+ ```php
84
+ use MicrosoftAzure\Storage\Common\ServiceException;
85
+ ```
86
+
87
+ * To instantiate the service client you will also need a valid [connection string](https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/). The format is:
88
+
89
+ ```
90
+ DefaultEndpointsProtocol=[http|https];AccountName=[yourAccount];AccountKey=[yourKey]
91
+ ```
92
+
93
+ or:
94
+
95
+ ```
96
+ BlobEndpoint=[myBlobEndpoint];SharedAccessSignature=[sasToken]
97
+ ```
98
+
99
+ * Instantiate a client object - a wrapper around the available calls for the given service.
100
+
101
+ ```php
102
+ $blobClient = BlobRestProxy::createBlobService($connectionString);
103
+ ```
104
+ Or for token authentication:
105
+ ```php
106
+ $blobClient = BlobRestProxy::createBlobServiceWithTokenCredential($token, $connectionString);
107
+ ```
108
+ ### Using Middlewares
109
+ To specify the middlewares, user have to create an array with middlewares
110
+ and put it in the `$requestOptions` with key 'middlewares'. The sequence of
111
+ the array will affect the sequence in which the middleware is invoked. The
112
+ `$requestOptions` can usually be set in the options of an API call, such as
113
+ `MicrosoftAzure\Storage\Blob\Models\ListBlobOptions`.
114
+
115
+ The user can push the middleware into the array with key 'middlewares' in
116
+ services' `$_options` instead when creating them if the middleware is to be
117
+ applied to each of the API call for a rest proxy. These middlewares will always
118
+ be invoked after the middlewares in the `$requestOptions`.
119
+ e.g.:
120
+ ```php
121
+ $blobClient = BlobRestProxy::createBlobService(
122
+ $connectionString,
123
+ $optionsWithMiddlewares
124
+ );
125
+ ```
126
+
127
+ Each of the middleware should be either an instance of a sub-class that
128
+ implements `MicrosoftAzure\Storage\Common\Internal\IMiddleware`, or a
129
+ `callable` that follows the Guzzle middleware implementation convention.
130
+
131
+ User can create self-defined middleware that inherits from `MicrosoftAzure\Storage\Common\Internal\Middlewares\MiddlewareBase`.
132
+
133
+ ### Using proxies
134
+ To use proxies during HTTP requests, set system variable `HTTP_PROXY` and the proxy will be used.
135
+
136
+ ## Troubleshooting
137
+ ### Error: Unable to get local issuer certificate
138
+ cURL can't verify the validity of Microsoft certificate when trying to issue a request call to Azure Storage Services. You must configure cURL to use a certificate when issuing https requests by the following steps:
139
+
140
+ 1. Download the cacert.pem file from [cURL site](http://curl.haxx.se/docs/caextract.html).
141
+
142
+ 2. Then either:
143
+ * Open your php.ini file and add the following line:
144
+ ```ini
145
+ curl.cainfo = "<absolute path to cacert.pem>"
146
+ ```
147
+ OR
148
+ * Point to the cacert in the options when creating the Proxy.
149
+ ```php
150
+ $options["http"] = ["verify" => "<absolute path to cacert.pem>"];
151
+ BlobRestProxy::createBlobService($connectionString, $options);
152
+ ```
153
+
154
+ ## Code samples
155
+
156
+ You can find samples in the [sample folder](samples)
157
+
158
+
159
+ # Migrate from [Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php/)
160
+
161
+ If you are using [Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php/) to access Azure Storage Service, we highly recommend you to migrate to this SDK for faster issue resolution and quicker feature implementation. We are working on supporting the latest service features as well as improvement on existing APIs.
162
+
163
+ For now, Microsoft Azure Storage PHP client libraries share almost the same interface as the storage blobs, tables, queues and files APIs in Azure SDK for PHP. However, there are some minor breaking changes need to be addressed during your migration. You can find the details in [BreakingChanges.md](BreakingChanges.md).
164
+
165
+ # Need Help?
166
+
167
+ Be sure to check out the Microsoft Azure [Developer Forums on Stack Overflow](http://go.microsoft.com/fwlink/?LinkId=234489) and [github issues](https://github.com/Azure/azure-storage-php/issues) if you have trouble with the provided code.
168
+
169
+ # Contribute Code or Provide Feedback
170
+
171
+ If you would like to become an active contributor to this project please follow the instructions provided in [Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/).
172
+ You can find more details for contributing in the [CONTRIBUTING.md](CONTRIBUTING.md).
173
+
174
+ If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/Azure/azure-storage-php/issues) section of the project.
vendor/microsoft/azure-storage-blob/composer.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "microsoft/azure-storage-blob",
3
+ "version": "1.4.0",
4
+ "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.",
5
+ "keywords": [ "php", "azure", "storage", "sdk", "blob" ],
6
+ "license": "MIT",
7
+ "authors": [
8
+ {
9
+ "name": "Azure Storage PHP Client Library",
10
+ "email": "dmsh@microsoft.com"
11
+ }
12
+ ],
13
+ "require": {
14
+ "php": ">=5.6.0",
15
+ "microsoft/azure-storage-common": "~1.4"
16
+ },
17
+ "autoload": {
18
+ "psr-4": {
19
+ "MicrosoftAzure\\Storage\\Blob\\": "src/Blob"
20
+ }
21
+ }
22
+ }
vendor/microsoft/azure-storage-blob/src/Blob/BlobRestProxy.php ADDED
@@ -0,0 +1,4706 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob;
26
+
27
+ use GuzzleHttp\Psr7;
28
+ use MicrosoftAzure\Storage\Blob\Internal\IBlob;
29
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
30
+ use MicrosoftAzure\Storage\Blob\Models\AppendBlockOptions;
31
+ use MicrosoftAzure\Storage\Blob\Models\AppendBlockResult;
32
+ use MicrosoftAzure\Storage\Blob\Models\BlobServiceOptions;
33
+ use MicrosoftAzure\Storage\Blob\Models\BlobType;
34
+ use MicrosoftAzure\Storage\Blob\Models\Block;
35
+ use MicrosoftAzure\Storage\Blob\Models\BlockList;
36
+ use MicrosoftAzure\Storage\Blob\Models\BreakLeaseResult;
37
+ use MicrosoftAzure\Storage\Blob\Models\CommitBlobBlocksOptions;
38
+ use MicrosoftAzure\Storage\Blob\Models\CopyBlobFromURLOptions;
39
+ use MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions;
40
+ use MicrosoftAzure\Storage\Blob\Models\CopyBlobResult;
41
+ use MicrosoftAzure\Storage\Blob\Models\CreateBlobBlockOptions;
42
+ use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions;
43
+ use MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesOptions;
44
+ use MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesResult;
45
+ use MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotOptions;
46
+ use MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotResult;
47
+ use MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions;
48
+ use MicrosoftAzure\Storage\Blob\Models\CreatePageBlobOptions;
49
+ use MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions;
50
+ use MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataOptions;
51
+ use MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataResult;
52
+ use MicrosoftAzure\Storage\Blob\Models\GetBlobOptions;
53
+ use MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesOptions;
54
+ use MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesResult;
55
+ use MicrosoftAzure\Storage\Blob\Models\GetBlobResult;
56
+ use MicrosoftAzure\Storage\Blob\Models\GetContainerACLResult;
57
+ use MicrosoftAzure\Storage\Blob\Models\GetContainerPropertiesResult;
58
+ use MicrosoftAzure\Storage\Blob\Models\LeaseMode;
59
+ use MicrosoftAzure\Storage\Blob\Models\LeaseResult;
60
+ use MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksOptions;
61
+ use MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksResult;
62
+ use MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions;
63
+ use MicrosoftAzure\Storage\Blob\Models\ListBlobsResult;
64
+ use MicrosoftAzure\Storage\Blob\Models\ListContainersOptions;
65
+ use MicrosoftAzure\Storage\Blob\Models\ListContainersResult;
66
+ use MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesDiffResult;
67
+ use MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions;
68
+ use MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesResult;
69
+ use MicrosoftAzure\Storage\Blob\Models\PageWriteOption;
70
+ use MicrosoftAzure\Storage\Blob\Models\PutBlobResult;
71
+ use MicrosoftAzure\Storage\Blob\Models\PutBlockResult;
72
+ use MicrosoftAzure\Storage\Blob\Models\SetBlobMetadataResult;
73
+ use MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions;
74
+ use MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesResult;
75
+ use MicrosoftAzure\Storage\Blob\Models\SetBlobTierOptions;
76
+ use MicrosoftAzure\Storage\Common\Internal\Authentication\SharedAccessSignatureAuthScheme;
77
+ use MicrosoftAzure\Storage\Common\Internal\Authentication\SharedKeyAuthScheme;
78
+ use MicrosoftAzure\Storage\Common\Internal\Authentication\TokenAuthScheme;
79
+ use MicrosoftAzure\Storage\Common\Internal\Http\HttpFormatter;
80
+ use MicrosoftAzure\Storage\Common\Internal\Middlewares\CommonRequestMiddleware;
81
+ use MicrosoftAzure\Storage\Common\Internal\Serialization\XmlSerializer;
82
+ use MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy;
83
+ use MicrosoftAzure\Storage\Common\Internal\ServiceRestTrait;
84
+ use MicrosoftAzure\Storage\Common\Internal\StorageServiceSettings;
85
+ use MicrosoftAzure\Storage\Common\Internal\Utilities;
86
+ use MicrosoftAzure\Storage\Common\Internal\Validate;
87
+ use MicrosoftAzure\Storage\Common\LocationMode;
88
+ use MicrosoftAzure\Storage\Common\Models\Range;
89
+ use MicrosoftAzure\Storage\Common\SharedAccessSignatureHelper;
90
+ use Psr\Http\Message\StreamInterface;
91
+
92
+ /**
93
+ * This class constructs HTTP requests and receive HTTP responses for blob
94
+ * service layer.
95
+ *
96
+ * @category Microsoft
97
+ * @package MicrosoftAzure\Storage\Blob
98
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
99
+ * @copyright 2016 Microsoft Corporation
100
+ * @license https://github.com/azure/azure-storage-php/LICENSE
101
+ * @link https://github.com/azure/azure-storage-php
102
+ */
103
+ class BlobRestProxy extends ServiceRestProxy implements IBlob
104
+ {
105
+ use ServiceRestTrait;
106
+
107
+ private $singleBlobUploadThresholdInBytes = Resources::MB_IN_BYTES_32;
108
+ private $blockSize = Resources::MB_IN_BYTES_4;
109
+
110
+ /**
111
+ * Builds a blob service object, it accepts the following
112
+ * options:
113
+ *
114
+ * - http: (array) the underlying guzzle options. refer to
115
+ * http://docs.guzzlephp.org/en/latest/request-options.html for detailed available options
116
+ * - middlewares: (mixed) the middleware should be either an instance of a sub-class that
117
+ * implements {@see MicrosoftAzure\Storage\Common\Middlewares\IMiddleware}, or a
118
+ * `callable` that follows the Guzzle middleware implementation convention
119
+ *
120
+ * Please refer to
121
+ * https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string
122
+ * for how to construct a connection string with storage account name/key, or with a shared
123
+ * access signature (SAS Token).
124
+ *
125
+ * @param string $connectionString The configuration connection string.
126
+ * @param array $options Array of options to pass to the service
127
+ * @return BlobRestProxy
128
+ */
129
+ public static function createBlobService(
130
+ $connectionString,
131
+ array $options = []
132
+ ) {
133
+ $settings = StorageServiceSettings::createFromConnectionString(
134
+ $connectionString
135
+ );
136
+
137
+ $primaryUri = Utilities::tryAddUrlScheme(
138
+ $settings->getBlobEndpointUri()
139
+ );
140
+
141
+ $secondaryUri = Utilities::tryAddUrlScheme(
142
+ $settings->getBlobSecondaryEndpointUri()
143
+ );
144
+
145
+ $blobWrapper = new BlobRestProxy(
146
+ $primaryUri,
147
+ $secondaryUri,
148
+ $settings->getName(),
149
+ $options
150
+ );
151
+
152
+ // Getting authentication scheme
153
+ if ($settings->hasSasToken()) {
154
+ $authScheme = new SharedAccessSignatureAuthScheme(
155
+ $settings->getSasToken()
156
+ );
157
+ } else {
158
+ $authScheme = new SharedKeyAuthScheme(
159
+ $settings->getName(),
160
+ $settings->getKey()
161
+ );
162
+ }
163
+
164
+ // Adding common request middleware
165
+ $commonRequestMiddleware = new CommonRequestMiddleware(
166
+ $authScheme,
167
+ Resources::STORAGE_API_LATEST_VERSION,
168
+ Resources::BLOB_SDK_VERSION
169
+ );
170
+ $blobWrapper->pushMiddleware($commonRequestMiddleware);
171
+
172
+ return $blobWrapper;
173
+ }
174
+
175
+ /**
176
+ * Builds a blob service object, it accepts the following
177
+ * options:
178
+ *
179
+ * - http: (array) the underlying guzzle options. refer to
180
+ * http://docs.guzzlephp.org/en/latest/request-options.html for detailed available options
181
+ * - middlewares: (mixed) the middleware should be either an instance of a sub-class that
182
+ * implements {@see MicrosoftAzure\Storage\Common\Middlewares\IMiddleware}, or a
183
+ * `callable` that follows the Guzzle middleware implementation convention
184
+ *
185
+ * Please refer to
186
+ * https://docs.microsoft.com/en-us/azure/storage/common/storage-auth-aad
187
+ * for authenticate access to Azure blobs and queues using Azure Active Directory.
188
+ *
189
+ * @param string $token The bearer token passed as reference.
190
+ * @param string $connectionString The configuration connection string.
191
+ * @param array $options Array of options to pass to the service
192
+ *
193
+ * @return BlobRestProxy
194
+ */
195
+ public static function createBlobServiceWithTokenCredential(
196
+ &$token,
197
+ $connectionString,
198
+ array $options = []
199
+ ) {
200
+ $settings = StorageServiceSettings::createFromConnectionStringForTokenCredential(
201
+ $connectionString
202
+ );
203
+
204
+ $primaryUri = Utilities::tryAddUrlScheme(
205
+ $settings->getBlobEndpointUri()
206
+ );
207
+
208
+ $secondaryUri = Utilities::tryAddUrlScheme(
209
+ $settings->getBlobSecondaryEndpointUri()
210
+ );
211
+
212
+ $blobWrapper = new BlobRestProxy(
213
+ $primaryUri,
214
+ $secondaryUri,
215
+ $settings->getName(),
216
+ $options
217
+ );
218
+
219
+ // Getting authentication scheme
220
+ $authScheme = new TokenAuthScheme(
221
+ $token
222
+ );
223
+
224
+ // Adding common request middleware
225
+ $commonRequestMiddleware = new CommonRequestMiddleware(
226
+ $authScheme,
227
+ Resources::STORAGE_API_LATEST_VERSION,
228
+ Resources::BLOB_SDK_VERSION
229
+ );
230
+ $blobWrapper->pushMiddleware($commonRequestMiddleware);
231
+
232
+ return $blobWrapper;
233
+ }
234
+
235
+ /**
236
+ * Builds an anonymous access object with given primary service
237
+ * endpoint. The service endpoint should contain a scheme and a
238
+ * host, e.g.:
239
+ * http://mystorageaccount.blob.core.windows.net
240
+ *
241
+ * @param string $primaryServiceEndpoint Primary service endpoint.
242
+ * @param array $options Optional request options.
243
+ *
244
+ * @return BlobRestProxy
245
+ */
246
+ public static function createContainerAnonymousAccess(
247
+ $primaryServiceEndpoint,
248
+ array $options = []
249
+ ) {
250
+ Validate::canCastAsString($primaryServiceEndpoint, '$primaryServiceEndpoint');
251
+
252
+ $secondaryServiceEndpoint = Utilities::tryGetSecondaryEndpointFromPrimaryEndpoint(
253
+ $primaryServiceEndpoint
254
+ );
255
+
256
+ $blobWrapper = new BlobRestProxy(
257
+ $primaryServiceEndpoint,
258
+ $secondaryServiceEndpoint,
259
+ Utilities::tryParseAccountNameFromUrl($primaryServiceEndpoint),
260
+ $options
261
+ );
262
+
263
+ $blobWrapper->pushMiddleware(new CommonRequestMiddleware(
264
+ null,
265
+ Resources::STORAGE_API_LATEST_VERSION,
266
+ Resources::BLOB_SDK_VERSION
267
+ ));
268
+
269
+ return $blobWrapper;
270
+ }
271
+
272
+ /**
273
+ * Get the value for SingleBlobUploadThresholdInBytes
274
+ *
275
+ * @return int
276
+ */
277
+ public function getSingleBlobUploadThresholdInBytes()
278
+ {
279
+ return $this->singleBlobUploadThresholdInBytes;
280
+ }
281
+
282
+ /**
283
+ * Get the value for blockSize
284
+ *
285
+ * @return int
286
+ */
287
+ public function getBlockSize()
288
+ {
289
+ return $this->blockSize;
290
+ }
291
+
292
+ /**
293
+ * Set the value for SingleBlobUploadThresholdInBytes, Max 256MB
294
+ *
295
+ * @param int $val The max size to send as a single blob block
296
+ *
297
+ * @return void
298
+ */
299
+ public function setSingleBlobUploadThresholdInBytes($val)
300
+ {
301
+ if ($val > Resources::MB_IN_BYTES_256) {
302
+ // What should the proper action here be?
303
+ $val = Resources::MB_IN_BYTES_256;
304
+ } elseif ($val < 1) {
305
+ // another spot that could use looking at
306
+ $val = Resources::MB_IN_BYTES_32;
307
+ }
308
+ $this->singleBlobUploadThresholdInBytes = $val;
309
+ //If block size is larger than singleBlobUploadThresholdInBytes, honor
310
+ //threshold.
311
+ $this->blockSize = $val > $this->blockSize ? $this->blockSize : $val;
312
+ }
313
+
314
+ /**
315
+ * Set the value for block size, Max 100MB
316
+ *
317
+ * @param int $val The max size for each block to be sent.
318
+ *
319
+ * @return void
320
+ */
321
+ public function setBlockSize($val)
322
+ {
323
+ if ($val > Resources::MB_IN_BYTES_100) {
324
+ // What should the proper action here be?
325
+ $val = Resources::MB_IN_BYTES_100;
326
+ } elseif ($val < 1) {
327
+ // another spot that could use looking at
328
+ $val = Resources::MB_IN_BYTES_4;
329
+ }
330
+ //If block size is larger than singleBlobUploadThresholdInBytes, honor
331
+ //threshold.
332
+ $val = $val > $this->singleBlobUploadThresholdInBytes ?
333
+ $this->singleBlobUploadThresholdInBytes : $val;
334
+ $this->blockSize = $val;
335
+ }
336
+
337
+ /**
338
+ * Get the block size of multiple upload block size using the provided
339
+ * content
340
+ *
341
+ * @param StreamInterface $content The content of the blocks.
342
+ *
343
+ * @return int
344
+ */
345
+ private function getMultipleUploadBlockSizeUsingContent($content)
346
+ {
347
+ //Default value is 100 MB.
348
+ $result = Resources::MB_IN_BYTES_100;
349
+ //PHP must be ran in 64bit environment so content->getSize() could
350
+ //return a guaranteed accurate size.
351
+ if (Utilities::is64BitPHP()) {
352
+ //Content must be seekable to determine the size.
353
+ if ($content->isSeekable()) {
354
+ $size = $content->getSize();
355
+ //When threshold is lower than 100MB, assume maximum number of
356
+ //block is used for the block blob, if the blockSize is still
357
+ //smaller than the assumed size, it means assumed size should
358
+ //be hornored, otherwise the blocks count will exceed maximum
359
+ //value allowed.
360
+ if ($this->blockSize < $result) {
361
+ $assumedSize = ceil((float)$size /
362
+ (float)(Resources::MAX_BLOB_BLOCKS));
363
+ if ($this->blockSize <= $assumedSize) {
364
+ $result = $assumedSize;
365
+ } else {
366
+ $result = $this->blockSize;
367
+ }
368
+ }
369
+ }
370
+ } else {
371
+ // If not, we could only honor user's setting to determine
372
+ // chunk size.
373
+ $result = $this->blockSize;
374
+ }
375
+ return $result;
376
+ }
377
+
378
+ /**
379
+ * Gets the copy blob source name with specified parameters.
380
+ *
381
+ * @param string $containerName The name of the container.
382
+ * @param string $blobName The name of the blob.
383
+ * @param Models\CopyBlobOptions $options The optional parameters.
384
+ *
385
+ * @return string
386
+ */
387
+ private function getCopyBlobSourceName(
388
+ $containerName,
389
+ $blobName,
390
+ Models\CopyBlobOptions $options
391
+ ) {
392
+ $sourceName = $this->getBlobUrl($containerName, $blobName);
393
+
394
+ if (!is_null($options->getSourceSnapshot())) {
395
+ $sourceName .= '?snapshot=' . $options->getSourceSnapshot();
396
+ }
397
+
398
+ return $sourceName;
399
+ }
400
+
401
+ /**
402
+ * Creates URI path for blob or container.
403
+ *
404
+ * @param string $container The container name.
405
+ * @param string $blob The blob name.
406
+ *
407
+ * @return string
408
+ */
409
+ private function createPath($container, $blob = '')
410
+ {
411
+ if (empty($blob) && ($blob != '0')) {
412
+ return empty($container) ? '/' : $container;
413
+ }
414
+ $encodedBlob = urlencode($blob);
415
+ // Unencode the forward slashes to match what the server expects.
416
+ $encodedBlob = str_replace('%2F', '/', $encodedBlob);
417
+ // Unencode the backward slashes to match what the server expects.
418
+ $encodedBlob = str_replace('%5C', '/', $encodedBlob);
419
+ // Re-encode the spaces (encoded as space) to the % encoding.
420
+ $encodedBlob = str_replace('+', '%20', $encodedBlob);
421
+ // Empty container means accessing default container
422
+ if (empty($container)) {
423
+ return $encodedBlob;
424
+ }
425
+ return '/' . $container . '/' . $encodedBlob;
426
+ }
427
+
428
+ /**
429
+ * Creates full URI to the given blob.
430
+ *
431
+ * @param string $container The container name.
432
+ * @param string $blob The blob name.
433
+ *
434
+ * @return string
435
+ */
436
+ public function getBlobUrl($container, $blob)
437
+ {
438
+ $encodedBlob = $this->createPath($container, $blob);
439
+ $uri = $this->getPsrPrimaryUri();
440
+ $exPath = $uri->getPath();
441
+
442
+ if ($exPath != '') {
443
+ //Remove the duplicated slash in the path.
444
+ $encodedBlob = str_replace('//', '/', $exPath . $encodedBlob);
445
+ }
446
+
447
+ return (string) $uri->withPath($encodedBlob);
448
+ }
449
+
450
+ /**
451
+ * Helper method to create promise for getContainerProperties API call.
452
+ *
453
+ * @param string $container The container name.
454
+ * @param Models\BlobServiceOptions $options The optional parameters.
455
+ * @param string $operation The operation string. Should be
456
+ * 'metadata' to get metadata.
457
+ *
458
+ * @return \GuzzleHttp\Promise\PromiseInterface
459
+ */
460
+ private function getContainerPropertiesAsyncImpl(
461
+ $container,
462
+ Models\BlobServiceOptions $options = null,
463
+ $operation = null
464
+ ) {
465
+ Validate::canCastAsString($container, 'container');
466
+
467
+ $method = Resources::HTTP_GET;
468
+ $headers = array();
469
+ $queryParams = array();
470
+ $postParams = array();
471
+ $path = $this->createPath($container);
472
+
473
+ if (is_null($options)) {
474
+ $options = new BlobServiceOptions();
475
+ }
476
+
477
+ $this->addOptionalQueryParam(
478
+ $queryParams,
479
+ Resources::QP_REST_TYPE,
480
+ 'container'
481
+ );
482
+ $this->addOptionalQueryParam(
483
+ $queryParams,
484
+ Resources::QP_COMP,
485
+ $operation
486
+ );
487
+
488
+ $this->addOptionalHeader(
489
+ $headers,
490
+ Resources::X_MS_LEASE_ID,
491
+ $options->getLeaseId()
492
+ );
493
+ $this->addOptionalAccessConditionHeader(
494
+ $headers,
495
+ $options->getAccessConditions()
496
+ );
497
+
498
+ return $this->sendAsync(
499
+ $method,
500
+ $headers,
501
+ $queryParams,
502
+ $postParams,
503
+ $path,
504
+ Resources::STATUS_OK,
505
+ Resources::EMPTY_STRING,
506
+ $options
507
+ )->then(function ($response) {
508
+ $responseHeaders = HttpFormatter::formatHeaders($response->getHeaders());
509
+ return GetContainerPropertiesResult::create($responseHeaders);
510
+ }, null);
511
+ }
512
+
513
+ /**
514
+ * Adds optional create blob headers.
515
+ *
516
+ * @param CreateBlobOptions $options The optional parameters.
517
+ * @param array $headers The HTTP request headers.
518
+ *
519
+ * @return array
520
+ */
521
+ private function addCreateBlobOptionalHeaders(
522
+ CreateBlobOptions $options,
523
+ array $headers
524
+ ) {
525
+ $headers = $this->addOptionalAccessConditionHeader(
526
+ $headers,
527
+ $options->getAccessConditions()
528
+ );
529
+
530
+ $this->addOptionalHeader(
531
+ $headers,
532
+ Resources::X_MS_LEASE_ID,
533
+ $options->getLeaseId()
534
+ );
535
+
536
+ $headers = $this->addMetadataHeaders(
537
+ $headers,
538
+ $options->getMetadata()
539
+ );
540
+
541
+ $contentType = $options->getContentType();
542
+ if (is_null($contentType)) {
543
+ $contentType = Resources::BINARY_FILE_TYPE;
544
+ }
545
+
546
+ $this->addOptionalHeader(
547
+ $headers,
548
+ Resources::X_MS_BLOB_CONTENT_TYPE,
549
+ $contentType
550
+ );
551
+ $this->addOptionalHeader(
552
+ $headers,
553
+ Resources::X_MS_BLOB_CONTENT_ENCODING,
554
+ $options->getContentEncoding()
555
+ );
556
+ $this->addOptionalHeader(
557
+ $headers,
558
+ Resources::X_MS_BLOB_CONTENT_LANGUAGE,
559
+ $options->getContentLanguage()
560
+ );
561
+ $this->addOptionalHeader(
562
+ $headers,
563
+ Resources::X_MS_BLOB_CONTENT_MD5,
564
+ $options->getContentMD5()
565
+ );
566
+ $this->addOptionalHeader(
567
+ $headers,
568
+ Resources::X_MS_BLOB_CACHE_CONTROL,
569
+ $options->getCacheControl()
570
+ );
571
+ $this->addOptionalHeader(
572
+ $headers,
573
+ Resources::X_MS_BLOB_CONTENT_DISPOSITION,
574
+ $options->getContentDisposition()
575
+ );
576
+ $this->addOptionalHeader(
577
+ $headers,
578
+ Resources::CONTENT_TYPE,
579
+ Resources::URL_ENCODED_CONTENT_TYPE
580
+ );
581
+
582
+ return $headers;
583
+ }
584
+
585
+ /**
586
+ * Adds Range header to the headers array.
587
+ *
588
+ * @param array $headers The HTTP request headers.
589
+ * @param integer $start The start byte.
590
+ * @param integer $end The end byte.
591
+ *
592
+ * @return array
593
+ */
594
+ private function addOptionalRangeHeader(array $headers, $start, $end)
595
+ {
596
+ if (!is_null($start) || !is_null($end)) {
597
+ $range = $start . '-' . $end;
598
+ $rangeValue = 'bytes=' . $range;
599
+ $this->addOptionalHeader($headers, Resources::RANGE, $rangeValue);
600
+ }
601
+
602
+ return $headers;
603
+ }
604
+
605
+ /**
606
+ * Get the expected status code of a given lease action.
607
+ *
608
+ * @param string $leaseAction The given lease action
609
+ * @return string
610
+ * @throws \Exception
611
+ */
612
+ private static function getStatusCodeOfLeaseAction($leaseAction)
613
+ {
614
+ switch ($leaseAction) {
615
+ case LeaseMode::ACQUIRE_ACTION:
616
+ $statusCode = Resources::STATUS_CREATED;
617
+ break;
618
+ case LeaseMode::RENEW_ACTION:
619
+ $statusCode = Resources::STATUS_OK;
620
+ break;
621
+ case LeaseMode::RELEASE_ACTION:
622
+ $statusCode = Resources::STATUS_OK;
623
+ break;
624
+ case LeaseMode::BREAK_ACTION:
625
+ $statusCode = Resources::STATUS_ACCEPTED;
626
+ break;
627
+ default:
628
+ throw new \Exception(Resources::NOT_IMPLEMENTED_MSG);
629
+ }
630
+
631
+ return $statusCode;
632
+ }
633
+
634
+ /**
635
+ * Creates promise that does the actual work for leasing a blob.
636
+ *
637
+ * @param string $leaseAction Lease action string.
638
+ * @param string $container Container name.
639
+ * @param string $blob Blob to lease name.
640
+ * @param string $proposedLeaseId Proposed lease id.
641
+ * @param int $leaseDuration Lease duration, in seconds.
642
+ * @param string $leaseId Existing lease id.
643
+ * @param int $breakPeriod Break period, in seconds.
644
+ * @param string $expectedStatusCode Expected status code.
645
+ * @param Models\BlobServiceOptions $options Optional parameters.
646
+ * @param Models\AccessCondition $accessCondition Access conditions.
647
+ *
648
+ * @return \GuzzleHttp\Promise\PromiseInterface
649
+ */
650
+ private function putLeaseAsyncImpl(
651
+ $leaseAction,
652
+ $container,
653
+ $blob,
654
+ $proposedLeaseId,
655
+ $leaseDuration,
656
+ $leaseId,
657
+ $breakPeriod,
658
+ $expectedStatusCode,
659
+ Models\BlobServiceOptions $options,
660
+ Models\AccessCondition $accessCondition = null
661
+ ) {
662
+ Validate::canCastAsString($blob, 'blob');
663
+ Validate::canCastAsString($container, 'container');
664
+ Validate::notNullOrEmpty($container, 'container');
665
+
666
+ $method = Resources::HTTP_PUT;
667
+ $headers = array();
668
+ $queryParams = array();
669
+ $postParams = array();
670
+
671
+ if (empty($blob)) {
672
+ $path = $this->createPath($container);
673
+ $this->addOptionalQueryParam(
674
+ $queryParams,
675
+ Resources::QP_REST_TYPE,
676
+ 'container'
677
+ );
678
+ } else {
679
+ $path = $this->createPath($container, $blob);
680
+ }
681
+ $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'lease');
682
+ $this->addOptionalQueryParam(
683
+ $queryParams,
684
+ Resources::QP_TIMEOUT,
685
+ $options->getTimeout()
686
+ );
687
+
688
+ $this->addOptionalHeader($headers, Resources::X_MS_LEASE_ID, $leaseId);
689
+ $this->addOptionalHeader(
690
+ $headers,
691
+ Resources::X_MS_LEASE_ACTION,
692
+ $leaseAction
693
+ );
694
+ $this->addOptionalHeader(
695
+ $headers,
696
+ Resources::X_MS_LEASE_BREAK_PERIOD,
697
+ $breakPeriod
698
+ );
699
+ $this->addOptionalHeader(
700
+ $headers,
701
+ Resources::X_MS_LEASE_DURATION,
702
+ $leaseDuration
703
+ );
704
+ $this->addOptionalHeader(
705
+ $headers,
706
+ Resources::X_MS_PROPOSED_LEASE_ID,
707
+ $proposedLeaseId
708
+ );
709
+ $this->addOptionalAccessConditionHeader($headers, $accessCondition);
710
+
711
+ if (!is_null($options)) {
712
+ $options = new BlobServiceOptions();
713
+ }
714
+
715
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
716
+
717
+ return $this->sendAsync(
718
+ $method,
719
+ $headers,
720
+ $queryParams,
721
+ $postParams,
722
+ $path,
723
+ $expectedStatusCode,
724
+ Resources::EMPTY_STRING,
725
+ $options
726
+ );
727
+ }
728
+
729
+ /**
730
+ * Creates promise that does actual work for create and clear blob pages.
731
+ *
732
+ * @param string $action Either clear or create.
733
+ * @param string $container The container name.
734
+ * @param string $blob The blob name.
735
+ * @param Range $range The page ranges.
736
+ * @param string $content The content string.
737
+ * @param CreateBlobPagesOptions $options The optional parameters.
738
+ *
739
+ * @return \GuzzleHttp\Promise\PromiseInterface
740
+ */
741
+ private function updatePageBlobPagesAsyncImpl(
742
+ $action,
743
+ $container,
744
+ $blob,
745
+ Range $range,
746
+ $content,
747
+ CreateBlobPagesOptions $options = null
748
+ ) {
749
+ Validate::canCastAsString($blob, 'blob');
750
+ Validate::notNullOrEmpty($blob, 'blob');
751
+ Validate::canCastAsString($container, 'container');
752
+ Validate::canCastAsString($content, 'content');
753
+ Validate::isTrue(
754
+ $range instanceof Range,
755
+ sprintf(
756
+ Resources::INVALID_PARAM_MSG,
757
+ 'range',
758
+ get_class(new Range(0))
759
+ )
760
+ );
761
+ $body = Psr7\stream_for($content);
762
+
763
+ $method = Resources::HTTP_PUT;
764
+ $headers = array();
765
+ $queryParams = array();
766
+ $postParams = array();
767
+ $path = $this->createPath($container, $blob);
768
+
769
+ if (is_null($options)) {
770
+ $options = new CreateBlobPagesOptions();
771
+ }
772
+
773
+ $headers = $this->addOptionalRangeHeader(
774
+ $headers,
775
+ $range->getStart(),
776
+ $range->getEnd()
777
+ );
778
+
779
+ $headers = $this->addOptionalAccessConditionHeader(
780
+ $headers,
781
+ $options->getAccessConditions()
782
+ );
783
+
784
+ $this->addOptionalHeader(
785
+ $headers,
786
+ Resources::X_MS_LEASE_ID,
787
+ $options->getLeaseId()
788
+ );
789
+ $this->addOptionalHeader(
790
+ $headers,
791
+ Resources::CONTENT_MD5,
792
+ $options->getContentMD5()
793
+ );
794
+ $this->addOptionalHeader(
795
+ $headers,
796
+ Resources::X_MS_PAGE_WRITE,
797
+ $action
798
+ );
799
+ $this->addOptionalHeader(
800
+ $headers,
801
+ Resources::CONTENT_TYPE,
802
+ Resources::URL_ENCODED_CONTENT_TYPE
803
+ );
804
+ $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'page');
805
+
806
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
807
+
808
+ return $this->sendAsync(
809
+ $method,
810
+ $headers,
811
+ $queryParams,
812
+ $postParams,
813
+ $path,
814
+ Resources::STATUS_CREATED,
815
+ $body,
816
+ $options
817
+ )->then(function ($response) {
818
+ return CreateBlobPagesResult::create(
819
+ HttpFormatter::formatHeaders($response->getHeaders())
820
+ );
821
+ }, null);
822
+ }
823
+
824
+ /**
825
+ * Lists all of the containers in the given storage account.
826
+ *
827
+ * @param ListContainersOptions $options The optional parameters.
828
+ *
829
+ * @return ListContainersResult
830
+ *
831
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179352.aspx
832
+ */
833
+ public function listContainers(ListContainersOptions $options = null)
834
+ {
835
+ return $this->listContainersAsync($options)->wait();
836
+ }
837
+
838
+ /**
839
+ * Create a promise for lists all of the containers in the given
840
+ * storage account.
841
+ *
842
+ * @param ListContainersOptions $options The optional parameters.
843
+ *
844
+ * @return \GuzzleHttp\Promise\PromiseInterface
845
+ */
846
+ public function listContainersAsync(
847
+ ListContainersOptions $options = null
848
+ ) {
849
+ $method = Resources::HTTP_GET;
850
+ $headers = array();
851
+ $queryParams = array();
852
+ $postParams = array();
853
+ $path = Resources::EMPTY_STRING;
854
+
855
+ if (is_null($options)) {
856
+ $options = new ListContainersOptions();
857
+ }
858
+
859
+ $this->addOptionalQueryParam(
860
+ $queryParams,
861
+ Resources::QP_COMP,
862
+ 'list'
863
+ );
864
+ $this->addOptionalQueryParam(
865
+ $queryParams,
866
+ Resources::QP_PREFIX,
867
+ $options->getPrefix()
868
+ );
869
+ $this->addOptionalQueryParam(
870
+ $queryParams,
871
+ Resources::QP_MARKER,
872
+ $options->getNextMarker()
873
+ );
874
+ $this->addOptionalQueryParam(
875
+ $queryParams,
876
+ Resources::QP_MAX_RESULTS,
877
+ $options->getMaxResults()
878
+ );
879
+ $isInclude = $options->getIncludeMetadata();
880
+ $isInclude = $isInclude ? 'metadata' : null;
881
+ $this->addOptionalQueryParam(
882
+ $queryParams,
883
+ Resources::QP_INCLUDE,
884
+ $isInclude
885
+ );
886
+
887
+ $dataSerializer = $this->dataSerializer;
888
+
889
+ return $this->sendAsync(
890
+ $method,
891
+ $headers,
892
+ $queryParams,
893
+ $postParams,
894
+ $path,
895
+ Resources::STATUS_OK,
896
+ Resources::EMPTY_STRING,
897
+ $options
898
+ )->then(function ($response) use ($dataSerializer) {
899
+ $parsed = $this->dataSerializer->unserialize($response->getBody());
900
+ return ListContainersResult::create(
901
+ $parsed,
902
+ Utilities::getLocationFromHeaders($response->getHeaders())
903
+ );
904
+ });
905
+ }
906
+
907
+ /**
908
+ * Creates a new container in the given storage account.
909
+ *
910
+ * @param string $container The container name.
911
+ * @param Models\CreateContainerOptions $options The optional parameters.
912
+ *
913
+ * @return void
914
+ *
915
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179468.aspx
916
+ */
917
+ public function createContainer(
918
+ $container,
919
+ Models\CreateContainerOptions $options = null
920
+ ) {
921
+ $this->createContainerAsync($container, $options)->wait();
922
+ }
923
+
924
+ /**
925
+ * Creates a new container in the given storage account.
926
+ *
927
+ * @param string $container The container name.
928
+ * @param Models\CreateContainerOptions $options The optional parameters.
929
+ *
930
+ * @return \GuzzleHttp\Promise\PromiseInterface
931
+ *
932
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179468.aspx
933
+ */
934
+ public function createContainerAsync(
935
+ $container,
936
+ Models\CreateContainerOptions $options = null
937
+ ) {
938
+ Validate::canCastAsString($container, 'container');
939
+ Validate::notNullOrEmpty($container, 'container');
940
+
941
+ $method = Resources::HTTP_PUT;
942
+ $postParams = array();
943
+ $queryParams = array(Resources::QP_REST_TYPE => 'container');
944
+ $path = $this->createPath($container);
945
+
946
+ if (is_null($options)) {
947
+ $options = new CreateContainerOptions();
948
+ }
949
+
950
+ $metadata = $options->getMetadata();
951
+ $headers = $this->generateMetadataHeaders($metadata);
952
+ $this->addOptionalHeader(
953
+ $headers,
954
+ Resources::X_MS_BLOB_PUBLIC_ACCESS,
955
+ $options->getPublicAccess()
956
+ );
957
+
958
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
959
+
960
+ return $this->sendAsync(
961
+ $method,
962
+ $headers,
963
+ $queryParams,
964
+ $postParams,
965
+ $path,
966
+ Resources::STATUS_CREATED,
967
+ Resources::EMPTY_STRING,
968
+ $options
969
+ );
970
+ }
971
+
972
+ /**
973
+ * Deletes a container in the given storage account.
974
+ *
975
+ * @param string $container The container name.
976
+ * @param Models\BlobServiceOptions $options The optional parameters.
977
+ *
978
+ * @return void
979
+ *
980
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179408.aspx
981
+ */
982
+ public function deleteContainer(
983
+ $container,
984
+ Models\BlobServiceOptions $options = null
985
+ ) {
986
+ $this->deleteContainerAsync($container, $options)->wait();
987
+ }
988
+
989
+ /**
990
+ * Create a promise for deleting a container.
991
+ *
992
+ * @param string $container name of the container
993
+ * @param Models\BlobServiceOptions|null $options optional parameters
994
+ *
995
+ * @return \GuzzleHttp\Promise\PromiseInterface
996
+ */
997
+ public function deleteContainerAsync(
998
+ $container,
999
+ Models\BlobServiceOptions $options = null
1000
+ ) {
1001
+ Validate::canCastAsString($container, 'container');
1002
+ Validate::notNullOrEmpty($container, 'container');
1003
+
1004
+ $method = Resources::HTTP_DELETE;
1005
+ $headers = array();
1006
+ $postParams = array();
1007
+ $queryParams = array();
1008
+ $path = $this->createPath($container);
1009
+
1010
+ if (is_null($options)) {
1011
+ $options = new BlobServiceOptions();
1012
+ }
1013
+
1014
+ $this->addOptionalHeader(
1015
+ $headers,
1016
+ Resources::X_MS_LEASE_ID,
1017
+ $options->getLeaseId()
1018
+ );
1019
+ $headers = $this->addOptionalAccessConditionHeader(
1020
+ $headers,
1021
+ $options->getAccessConditions()
1022
+ );
1023
+
1024
+ $this->addOptionalQueryParam(
1025
+ $queryParams,
1026
+ Resources::QP_REST_TYPE,
1027
+ 'container'
1028
+ );
1029
+
1030
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
1031
+
1032
+ return $this->sendAsync(
1033
+ $method,
1034
+ $headers,
1035
+ $queryParams,
1036
+ $postParams,
1037
+ $path,
1038
+ Resources::STATUS_ACCEPTED,
1039
+ Resources::EMPTY_STRING,
1040
+ $options
1041
+ );
1042
+ }
1043
+
1044
+ /**
1045
+ * Returns all properties and metadata on the container.
1046
+ *
1047
+ * @param string $container name
1048
+ * @param Models\BlobServiceOptions $options optional parameters
1049
+ *
1050
+ * @return Models\GetContainerPropertiesResult
1051
+ *
1052
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179370.aspx
1053
+ */
1054
+ public function getContainerProperties(
1055
+ $container,
1056
+ Models\BlobServiceOptions $options = null
1057
+ ) {
1058
+ return $this->getContainerPropertiesAsync($container, $options)->wait();
1059
+ }
1060
+
1061
+ /**
1062
+ * Create promise to return all properties and metadata on the container.
1063
+ *
1064
+ * @param string $container name
1065
+ * @param Models\BlobServiceOptions $options optional parameters
1066
+ *
1067
+ * @return \GuzzleHttp\Promise\PromiseInterface
1068
+ *
1069
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179370.aspx
1070
+ */
1071
+ public function getContainerPropertiesAsync(
1072
+ $container,
1073
+ Models\BlobServiceOptions $options = null
1074
+ ) {
1075
+ return $this->getContainerPropertiesAsyncImpl($container, $options);
1076
+ }
1077
+
1078
+ /**
1079
+ * Returns only user-defined metadata for the specified container.
1080
+ *
1081
+ * @param string $container name
1082
+ * @param Models\BlobServiceOptions $options optional parameters
1083
+ *
1084
+ * @return Models\GetContainerPropertiesResult
1085
+ *
1086
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691976.aspx
1087
+ */
1088
+ public function getContainerMetadata(
1089
+ $container,
1090
+ Models\BlobServiceOptions $options = null
1091
+ ) {
1092
+ return $this->getContainerMetadataAsync($container, $options)->wait();
1093
+ }
1094
+
1095
+ /**
1096
+ * Create promise to return only user-defined metadata for the specified
1097
+ * container.
1098
+ *
1099
+ * @param string $container name
1100
+ * @param Models\BlobServiceOptions $options optional parameters
1101
+ *
1102
+ * @return \GuzzleHttp\Promise\PromiseInterface
1103
+ *
1104
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691976.aspx
1105
+ */
1106
+ public function getContainerMetadataAsync(
1107
+ $container,
1108
+ Models\BlobServiceOptions $options = null
1109
+ ) {
1110
+ return $this->getContainerPropertiesAsyncImpl($container, $options, 'metadata');
1111
+ }
1112
+
1113
+ /**
1114
+ * Gets the access control list (ACL) and any container-level access policies
1115
+ * for the container.
1116
+ *
1117
+ * @param string $container The container name.
1118
+ * @param Models\BlobServiceOptions $options The optional parameters.
1119
+ *
1120
+ * @return Models\GetContainerACLResult
1121
+ *
1122
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179469.aspx
1123
+ */
1124
+ public function getContainerAcl(
1125
+ $container,
1126
+ Models\BlobServiceOptions $options = null
1127
+ ) {
1128
+ return $this->getContainerAclAsync($container, $options)->wait();
1129
+ }
1130
+
1131
+ /**
1132
+ * Creates the promise to get the access control list (ACL) and any
1133
+ * container-level access policies for the container.
1134
+ *
1135
+ * @param string $container The container name.
1136
+ * @param Models\BlobServiceOptions $options The optional parameters.
1137
+ *
1138
+ * @return \GuzzleHttp\Promise\PromiseInterface
1139
+ *
1140
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179469.aspx
1141
+ */
1142
+ public function getContainerAclAsync(
1143
+ $container,
1144
+ Models\BlobServiceOptions $options = null
1145
+ ) {
1146
+ Validate::canCastAsString($container, 'container');
1147
+
1148
+ $method = Resources::HTTP_GET;
1149
+ $headers = array();
1150
+ $postParams = array();
1151
+ $queryParams = array();
1152
+ $path = $this->createPath($container);
1153
+
1154
+ if (is_null($options)) {
1155
+ $options = new BlobServiceOptions();
1156
+ }
1157
+
1158
+ $this->addOptionalQueryParam(
1159
+ $queryParams,
1160
+ Resources::QP_REST_TYPE,
1161
+ 'container'
1162
+ );
1163
+ $this->addOptionalQueryParam(
1164
+ $queryParams,
1165
+ Resources::QP_COMP,
1166
+ 'acl'
1167
+ );
1168
+
1169
+ $this->addOptionalHeader(
1170
+ $headers,
1171
+ Resources::X_MS_LEASE_ID,
1172
+ $options->getLeaseId()
1173
+ );
1174
+ $this->addOptionalAccessConditionHeader(
1175
+ $headers,
1176
+ $options->getAccessConditions()
1177
+ );
1178
+
1179
+ $dataSerializer = $this->dataSerializer;
1180
+
1181
+ $promise = $this->sendAsync(
1182
+ $method,
1183
+ $headers,
1184
+ $queryParams,
1185
+ $postParams,
1186
+ $path,
1187
+ Resources::STATUS_OK,
1188
+ Resources::EMPTY_STRING,
1189
+ $options
1190
+ );
1191
+
1192
+ return $promise->then(function ($response) use ($dataSerializer) {
1193
+ $responseHeaders = HttpFormatter::formatHeaders($response->getHeaders());
1194
+
1195
+ $access = Utilities::tryGetValue(
1196
+ $responseHeaders,
1197
+ Resources::X_MS_BLOB_PUBLIC_ACCESS
1198
+ );
1199
+ $etag = Utilities::tryGetValue($responseHeaders, Resources::ETAG);
1200
+ $modified = Utilities::tryGetValue(
1201
+ $responseHeaders,
1202
+ Resources::LAST_MODIFIED
1203
+ );
1204
+ $modifiedDate = Utilities::convertToDateTime($modified);
1205
+ $parsed = $dataSerializer->unserialize($response->getBody());
1206
+
1207
+ return GetContainerAclResult::create(
1208
+ $access,
1209
+ $etag,
1210
+ $modifiedDate,
1211
+ $parsed
1212
+ );
1213
+ }, null);
1214
+ }
1215
+
1216
+ /**
1217
+ * Sets the ACL and any container-level access policies for the container.
1218
+ *
1219
+ * @param string $container name
1220
+ * @param Models\ContainerACL $acl access control list for container
1221
+ * @param Models\BlobServiceOptions $options optional parameters
1222
+ *
1223
+ * @return void
1224
+ *
1225
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179391.aspx
1226
+ */
1227
+ public function setContainerAcl(
1228
+ $container,
1229
+ Models\ContainerACL $acl,
1230
+ Models\BlobServiceOptions $options = null
1231
+ ) {
1232
+ $this->setContainerAclAsync($container, $acl, $options)->wait();
1233
+ }
1234
+
1235
+ /**
1236
+ * Creates promise to set the ACL and any container-level access policies
1237
+ * for the container.
1238
+ *
1239
+ * @param string $container name
1240
+ * @param Models\ContainerACL $acl access control list for container
1241
+ * @param Models\BlobServiceOptions $options optional parameters
1242
+ *
1243
+ * @return \GuzzleHttp\Promise\PromiseInterface
1244
+ *
1245
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179391.aspx
1246
+ */
1247
+ public function setContainerAclAsync(
1248
+ $container,
1249
+ Models\ContainerACL $acl,
1250
+ Models\BlobServiceOptions $options = null
1251
+ ) {
1252
+ Validate::canCastAsString($container, 'container');
1253
+ Validate::notNullOrEmpty($acl, 'acl');
1254
+
1255
+ $method = Resources::HTTP_PUT;
1256
+ $headers = array();
1257
+ $postParams = array();
1258
+ $queryParams = array();
1259
+ $path = $this->createPath($container);
1260
+ $body = $acl->toXml($this->dataSerializer);
1261
+
1262
+ if (is_null($options)) {
1263
+ $options = new BlobServiceOptions();
1264
+ }
1265
+
1266
+ $this->addOptionalQueryParam(
1267
+ $queryParams,
1268
+ Resources::QP_REST_TYPE,
1269
+ 'container'
1270
+ );
1271
+ $this->addOptionalQueryParam(
1272
+ $queryParams,
1273
+ Resources::QP_COMP,
1274
+ 'acl'
1275
+ );
1276
+ $this->addOptionalHeader(
1277
+ $headers,
1278
+ Resources::X_MS_BLOB_PUBLIC_ACCESS,
1279
+ $acl->getPublicAccess()
1280
+ );
1281
+ $this->addOptionalHeader(
1282
+ $headers,
1283
+ Resources::CONTENT_TYPE,
1284
+ Resources::URL_ENCODED_CONTENT_TYPE
1285
+ );
1286
+ $this->addOptionalHeader(
1287
+ $headers,
1288
+ Resources::X_MS_LEASE_ID,
1289
+ $options->getLeaseId()
1290
+ );
1291
+ $this->addOptionalAccessConditionHeader(
1292
+ $headers,
1293
+ $options->getAccessConditions()
1294
+ );
1295
+
1296
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
1297
+
1298
+ return $this->sendAsync(
1299
+ $method,
1300
+ $headers,
1301
+ $queryParams,
1302
+ $postParams,
1303
+ $path,
1304
+ Resources::STATUS_OK,
1305
+ $body,
1306
+ $options
1307
+ );
1308
+ }
1309
+
1310
+ /**
1311
+ * Sets metadata headers on the container.
1312
+ *
1313
+ * @param string $container name
1314
+ * @param array $metadata metadata key/value pair.
1315
+ * @param Models\BlobServiceOptions $options optional parameters
1316
+ *
1317
+ * @return void
1318
+ *
1319
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179362.aspx
1320
+ */
1321
+ public function setContainerMetadata(
1322
+ $container,
1323
+ array $metadata,
1324
+ Models\BlobServiceOptions $options = null
1325
+ ) {
1326
+ $this->setContainerMetadataAsync($container, $metadata, $options)->wait();
1327
+ }
1328
+
1329
+ /**
1330
+ * Sets metadata headers on the container.
1331
+ *
1332
+ * @param string $container name
1333
+ * @param array $metadata metadata key/value pair.
1334
+ * @param Models\BlobServiceOptions $options optional parameters
1335
+ *
1336
+ * @return \GuzzleHttp\Promise\PromiseInterface
1337
+ *
1338
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179362.aspx
1339
+ */
1340
+ public function setContainerMetadataAsync(
1341
+ $container,
1342
+ array $metadata,
1343
+ Models\BlobServiceOptions $options = null
1344
+ ) {
1345
+ Validate::canCastAsString($container, 'container');
1346
+ Utilities::validateMetadata($metadata);
1347
+
1348
+ $method = Resources::HTTP_PUT;
1349
+ $headers = $this->generateMetadataHeaders($metadata);
1350
+ $postParams = array();
1351
+ $queryParams = array();
1352
+ $path = $this->createPath($container);
1353
+
1354
+ if (is_null($options)) {
1355
+ $options = new BlobServiceOptions();
1356
+ }
1357
+
1358
+ $this->addOptionalQueryParam(
1359
+ $queryParams,
1360
+ Resources::QP_REST_TYPE,
1361
+ 'container'
1362
+ );
1363
+ $this->addOptionalQueryParam(
1364
+ $queryParams,
1365
+ Resources::QP_COMP,
1366
+ 'metadata'
1367
+ );
1368
+
1369
+ $this->addOptionalHeader(
1370
+ $headers,
1371
+ Resources::X_MS_LEASE_ID,
1372
+ $options->getLeaseId()
1373
+ );
1374
+
1375
+ $headers = $this->addOptionalAccessConditionHeader(
1376
+ $headers,
1377
+ $options->getAccessConditions()
1378
+ );
1379
+
1380
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
1381
+
1382
+ return $this->sendAsync(
1383
+ $method,
1384
+ $headers,
1385
+ $queryParams,
1386
+ $postParams,
1387
+ $path,
1388
+ Resources::STATUS_OK,
1389
+ Resources::EMPTY_STRING,
1390
+ $options
1391
+ );
1392
+ }
1393
+
1394
+ /**
1395
+ * Sets blob tier on the blob.
1396
+ *
1397
+ * @param string $container name
1398
+ * @param string $blob name of the blob
1399
+ * @param Models\SetBlobTierOptions $options optional parameters
1400
+ *
1401
+ * @return void
1402
+ *
1403
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tier
1404
+ */
1405
+ public function setBlobTier(
1406
+ $container,
1407
+ $blob,
1408
+ Models\SetBlobTierOptions $options = null
1409
+ ) {
1410
+ $this->setBlobTierAsync($container, $blob, $options)->wait();
1411
+ }
1412
+
1413
+ /**
1414
+ * Sets blob tier on the blob.
1415
+ *
1416
+ * @param string $container name
1417
+ * @param string $blob name of the blob
1418
+ * @param Models\SetBlobTierOptions $options optional parameters
1419
+ *
1420
+ * @return \GuzzleHttp\Promise\PromiseInterface
1421
+ *
1422
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tier
1423
+ */
1424
+ public function setBlobTierAsync(
1425
+ $container,
1426
+ $blob,
1427
+ Models\SetBlobTierOptions $options = null
1428
+ )
1429
+ {
1430
+ Validate::canCastAsString($container, 'container');
1431
+ Validate::canCastAsString($blob, 'blob');
1432
+ Validate::notNullOrEmpty($blob, 'blob');
1433
+
1434
+ $method = Resources::HTTP_PUT;
1435
+ $headers = array();
1436
+ $postParams = array();
1437
+ $queryParams = array();
1438
+ $path = $this->createPath($container, $blob);
1439
+
1440
+ if (is_null($options)) {
1441
+ $options = new SetBlobTierOptions();
1442
+ }
1443
+
1444
+ $this->addOptionalQueryParam(
1445
+ $queryParams,
1446
+ Resources::QP_COMP,
1447
+ 'tier'
1448
+ );
1449
+
1450
+ $this->addOptionalHeader(
1451
+ $headers,
1452
+ Resources::X_MS_ACCESS_TIER,
1453
+ $options->getAccessTier()
1454
+ );
1455
+
1456
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
1457
+
1458
+ return $this->sendAsync(
1459
+ $method,
1460
+ $headers,
1461
+ $queryParams,
1462
+ $postParams,
1463
+ $path,
1464
+ array(Resources::STATUS_OK, Resources::STATUS_ACCEPTED),
1465
+ Resources::EMPTY_STRING,
1466
+ $options
1467
+ );
1468
+ }
1469
+
1470
+ /**
1471
+ * Lists all of the blobs in the given container.
1472
+ *
1473
+ * @param string $container The container name.
1474
+ * @param Models\ListBlobsOptions $options The optional parameters.
1475
+ *
1476
+ * @return Models\ListBlobsResult
1477
+ *
1478
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135734.aspx
1479
+ */
1480
+ public function listBlobs($container, Models\ListBlobsOptions $options = null)
1481
+ {
1482
+ return $this->listBlobsAsync($container, $options)->wait();
1483
+ }
1484
+
1485
+ /**
1486
+ * Creates promise to list all of the blobs in the given container.
1487
+ *
1488
+ * @param string $container The container name.
1489
+ * @param Models\ListBlobsOptions $options The optional parameters.
1490
+ *
1491
+ * @return \GuzzleHttp\Promise\PromiseInterface
1492
+ *
1493
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135734.aspx
1494
+ */
1495
+ public function listBlobsAsync(
1496
+ $container,
1497
+ Models\ListBlobsOptions $options = null
1498
+ ) {
1499
+ Validate::notNull($container, 'container');
1500
+ Validate::canCastAsString($container, 'container');
1501
+
1502
+ $method = Resources::HTTP_GET;
1503
+ $headers = array();
1504
+ $postParams = array();
1505
+ $queryParams = array();
1506
+ $path = $this->createPath($container);
1507
+
1508
+ if (is_null($options)) {
1509
+ $options = new ListBlobsOptions();
1510
+ }
1511
+
1512
+ $this->addOptionalQueryParam(
1513
+ $queryParams,
1514
+ Resources::QP_REST_TYPE,
1515
+ 'container'
1516
+ );
1517
+ $this->addOptionalQueryParam(
1518
+ $queryParams,
1519
+ Resources::QP_COMP,
1520
+ 'list'
1521
+ );
1522
+ $this->addOptionalQueryParam(
1523
+ $queryParams,
1524
+ Resources::QP_PREFIX,
1525
+ str_replace('\\', '/', $options->getPrefix())
1526
+ );
1527
+ $this->addOptionalQueryParam(
1528
+ $queryParams,
1529
+ Resources::QP_MARKER,
1530
+ $options->getNextMarker()
1531
+ );
1532
+ $this->addOptionalQueryParam(
1533
+ $queryParams,
1534
+ Resources::QP_DELIMITER,
1535
+ $options->getDelimiter()
1536
+ );
1537
+ $this->addOptionalQueryParam(
1538
+ $queryParams,
1539
+ Resources::QP_MAX_RESULTS,
1540
+ $options->getMaxResults()
1541
+ );
1542
+
1543
+ $includeMetadata = $options->getIncludeMetadata();
1544
+ $includeSnapshots = $options->getIncludeSnapshots();
1545
+ $includeUncommittedBlobs = $options->getIncludeUncommittedBlobs();
1546
+ $includecopy = $options->getIncludeCopy();
1547
+
1548
+ $includeValue = static::groupQueryValues(
1549
+ array(
1550
+ $includeMetadata ? 'metadata' : null,
1551
+ $includeSnapshots ? 'snapshots' : null,
1552
+ $includeUncommittedBlobs ? 'uncommittedblobs' : null,
1553
+ $includecopy ? 'copy' : null
1554
+ )
1555
+ );
1556
+
1557
+ $this->addOptionalQueryParam(
1558
+ $queryParams,
1559
+ Resources::QP_INCLUDE,
1560
+ $includeValue
1561
+ );
1562
+
1563
+ $dataSerializer = $this->dataSerializer;
1564
+
1565
+ return $this->sendAsync(
1566
+ $method,
1567
+ $headers,
1568
+ $queryParams,
1569
+ $postParams,
1570
+ $path,
1571
+ Resources::STATUS_OK,
1572
+ Resources::EMPTY_STRING,
1573
+ $options
1574
+ )->then(function ($response) use ($dataSerializer) {
1575
+ $parsed = $dataSerializer->unserialize($response->getBody());
1576
+ return ListBlobsResult::create(
1577
+ $parsed,
1578
+ Utilities::getLocationFromHeaders($response->getHeaders())
1579
+ );
1580
+ }, null);
1581
+ }
1582
+
1583
+ /**
1584
+ * Creates a new page blob. Note that calling createPageBlob to create a page
1585
+ * blob only initializes the blob.
1586
+ * To add content to a page blob, call createBlobPages method.
1587
+ *
1588
+ * @param string $container The container name.
1589
+ * @param string $blob The blob name.
1590
+ * @param integer $length Specifies the maximum size
1591
+ * for the page blob, up to 1 TB.
1592
+ * The page blob size must be
1593
+ * aligned to a 512-byte
1594
+ * boundary.
1595
+ * @param Models\CreatePageBlobOptions $options The optional parameters.
1596
+ *
1597
+ * @return Models\PutBlobResult
1598
+ *
1599
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
1600
+ */
1601
+ public function createPageBlob(
1602
+ $container,
1603
+ $blob,
1604
+ $length,
1605
+ Models\CreatePageBlobOptions $options = null
1606
+ ) {
1607
+ return $this->createPageBlobAsync(
1608
+ $container,
1609
+ $blob,
1610
+ $length,
1611
+ $options
1612
+ )->wait();
1613
+ }
1614
+
1615
+ /**
1616
+ * Creates promise to create a new page blob. Note that calling
1617
+ * createPageBlob to create a page blob only initializes the blob.
1618
+ * To add content to a page blob, call createBlobPages method.
1619
+ *
1620
+ * @param string $container The container name.
1621
+ * @param string $blob The blob name.
1622
+ * @param integer $length Specifies the maximum size
1623
+ * for the page blob, up to 1 TB.
1624
+ * The page blob size must be
1625
+ * aligned to a 512-byte
1626
+ * boundary.
1627
+ * @param Models\CreatePageBlobOptions $options The optional parameters.
1628
+ *
1629
+ * @return \GuzzleHttp\Promise\PromiseInterface
1630
+ *
1631
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
1632
+ */
1633
+ public function createPageBlobAsync(
1634
+ $container,
1635
+ $blob,
1636
+ $length,
1637
+ Models\CreatePageBlobOptions $options = null
1638
+ ) {
1639
+ Validate::canCastAsString($container, 'container');
1640
+ Validate::canCastAsString($blob, 'blob');
1641
+ Validate::notNullOrEmpty($blob, 'blob');
1642
+ Validate::isInteger($length, 'length');
1643
+ Validate::notNull($length, 'length');
1644
+
1645
+ $method = Resources::HTTP_PUT;
1646
+ $headers = array();
1647
+ $postParams = array();
1648
+ $queryParams = array();
1649
+ $path = $this->createPath($container, $blob);
1650
+
1651
+ if (is_null($options)) {
1652
+ $options = new CreatePageBlobOptions();
1653
+ }
1654
+
1655
+ $this->addOptionalHeader(
1656
+ $headers,
1657
+ Resources::X_MS_BLOB_TYPE,
1658
+ BlobType::PAGE_BLOB
1659
+ );
1660
+ $this->addOptionalHeader(
1661
+ $headers,
1662
+ Resources::X_MS_BLOB_CONTENT_LENGTH,
1663
+ $length
1664
+ );
1665
+ $this->addOptionalHeader(
1666
+ $headers,
1667
+ Resources::X_MS_BLOB_SEQUENCE_NUMBER,
1668
+ $options->getSequenceNumber()
1669
+ );
1670
+ $this->addOptionalHeader(
1671
+ $headers,
1672
+ Resources::X_MS_ACCESS_TIER,
1673
+ $options->getAccessTier()
1674
+ );
1675
+ $headers = $this->addCreateBlobOptionalHeaders($options, $headers);
1676
+
1677
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
1678
+
1679
+ return $this->sendAsync(
1680
+ $method,
1681
+ $headers,
1682
+ $queryParams,
1683
+ $postParams,
1684
+ $path,
1685
+ Resources::STATUS_CREATED,
1686
+ Resources::EMPTY_STRING,
1687
+ $options
1688
+ )->then(function ($response) {
1689
+ return PutBlobResult::create(
1690
+ HttpFormatter::formatHeaders($response->getHeaders())
1691
+ );
1692
+ }, null);
1693
+ }
1694
+
1695
+ /**
1696
+ * Create a new append blob.
1697
+ * If the blob already exists on the service, it will be overwritten.
1698
+ *
1699
+ * @param string $container The container name.
1700
+ * @param string $blob The blob name.
1701
+ * @param Models\CreateBlobOptions $options The optional parameters.
1702
+ *
1703
+ * @return Models\PutBlobResult
1704
+ *
1705
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
1706
+ */
1707
+ public function createAppendBlob(
1708
+ $container,
1709
+ $blob,
1710
+ Models\CreateBlobOptions $options = null
1711
+ ) {
1712
+ return $this->createAppendBlobAsync(
1713
+ $container,
1714
+ $blob,
1715
+ $options
1716
+ )->wait();
1717
+ }
1718
+
1719
+ /**
1720
+ * Creates promise to create a new append blob.
1721
+ * If the blob already exists on the service, it will be overwritten.
1722
+ *
1723
+ * @param string $container The container name.
1724
+ * @param string $blob The blob name.
1725
+ * @param Models\CreateBlobOptions $options The optional parameters.
1726
+ *
1727
+ * @return \GuzzleHttp\Promise\PromiseInterface
1728
+ *
1729
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
1730
+ */
1731
+ public function createAppendBlobAsync(
1732
+ $container,
1733
+ $blob,
1734
+ Models\CreateBlobOptions $options = null
1735
+ ) {
1736
+ Validate::canCastAsString($container, 'container');
1737
+ Validate::notNullOrEmpty($container, 'container');
1738
+ Validate::canCastAsString($blob, 'blob');
1739
+ Validate::notNullOrEmpty($blob, 'blob');
1740
+
1741
+ $method = Resources::HTTP_PUT;
1742
+ $headers = array();
1743
+ $postParams = array();
1744
+ $queryParams = array();
1745
+ $path = $this->createPath($container, $blob);
1746
+
1747
+ if (is_null($options)) {
1748
+ $options = new CreateBlobOptions();
1749
+ }
1750
+
1751
+ $this->addOptionalHeader(
1752
+ $headers,
1753
+ Resources::X_MS_BLOB_TYPE,
1754
+ BlobType::APPEND_BLOB
1755
+ );
1756
+ $headers = $this->addCreateBlobOptionalHeaders($options, $headers);
1757
+
1758
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
1759
+
1760
+ return $this->sendAsync(
1761
+ $method,
1762
+ $headers,
1763
+ $queryParams,
1764
+ $postParams,
1765
+ $path,
1766
+ Resources::STATUS_CREATED,
1767
+ Resources::EMPTY_STRING,
1768
+ $options
1769
+ )->then(function ($response) {
1770
+ return PutBlobResult::create(
1771
+ HttpFormatter::formatHeaders($response->getHeaders())
1772
+ );
1773
+ }, null);
1774
+ }
1775
+
1776
+ /**
1777
+ * Creates a new block blob or updates the content of an existing block blob.
1778
+ *
1779
+ * Updating an existing block blob overwrites any existing metadata on the blob.
1780
+ * Partial updates are not supported with createBlockBlob the content of the
1781
+ * existing blob is overwritten with the content of the new blob. To perform a
1782
+ * partial update of the content of a block blob, use the createBlockList
1783
+ * method.
1784
+ * Note that the default content type is application/octet-stream.
1785
+ *
1786
+ * @param string $container The name of the container.
1787
+ * @param string $blob The name of the blob.
1788
+ * @param string|resource|StreamInterface $content The content of the blob.
1789
+ * @param Models\CreateBlockBlobOptions $options The optional parameters.
1790
+ *
1791
+ * @return Models\PutBlobResult
1792
+ *
1793
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
1794
+ */
1795
+ public function createBlockBlob(
1796
+ $container,
1797
+ $blob,
1798
+ $content,
1799
+ Models\CreateBlockBlobOptions $options = null
1800
+ ) {
1801
+ return $this->createBlockBlobAsync(
1802
+ $container,
1803
+ $blob,
1804
+ $content,
1805
+ $options
1806
+ )->wait();
1807
+ }
1808
+
1809
+ /**
1810
+ * Creates a promise to create a new block blob or updates the content of
1811
+ * an existing block blob.
1812
+ *
1813
+ * Updating an existing block blob overwrites any existing metadata on the blob.
1814
+ * Partial updates are not supported with createBlockBlob the content of the
1815
+ * existing blob is overwritten with the content of the new blob. To perform a
1816
+ * partial update of the content of a block blob, use the createBlockList
1817
+ * method.
1818
+ *
1819
+ * @param string $container The name of the container.
1820
+ * @param string $blob The name of the blob.
1821
+ * @param string|resource|StreamInterface $content The content of the blob.
1822
+ * @param Models\CreateBlockBlobOptions $options The optional parameters.
1823
+ *
1824
+ * @return \GuzzleHttp\Promise\PromiseInterface
1825
+ *
1826
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
1827
+ */
1828
+ public function createBlockBlobAsync(
1829
+ $container,
1830
+ $blob,
1831
+ $content,
1832
+ Models\CreateBlockBlobOptions $options = null
1833
+ ) {
1834
+ $body = Psr7\stream_for($content);
1835
+
1836
+ //If the size of the stream is not seekable or larger than the single
1837
+ //upload threshold then call concurrent upload. Otherwise call putBlob.
1838
+ $promise = null;
1839
+ if (!Utilities::isStreamLargerThanSizeOrNotSeekable(
1840
+ $body,
1841
+ $this->singleBlobUploadThresholdInBytes
1842
+ )) {
1843
+ $promise = $this->createBlockBlobBySingleUploadAsync(
1844
+ $container,
1845
+ $blob,
1846
+ $body,
1847
+ $options
1848
+ );
1849
+ } else {
1850
+ // This is for large or failsafe upload
1851
+ $promise = $this->createBlockBlobByMultipleUploadAsync(
1852
+ $container,
1853
+ $blob,
1854
+ $body,
1855
+ $options
1856
+ );
1857
+ }
1858
+
1859
+ //return the parsed result, instead of the raw response.
1860
+ return $promise;
1861
+ }
1862
+
1863
+ /**
1864
+ * Create a new page blob and upload the content to the page blob.
1865
+ *
1866
+ * @param string $container The name of the container.
1867
+ * @param string $blob The name of the blob.
1868
+ * @param int $length The length of the blob.
1869
+ * @param string|resource|StreamInterface $content The content of the blob.
1870
+ * @param Models\CreatePageBlobFromContentOptions
1871
+ * $options The optional parameters.
1872
+ *
1873
+ * @return Models\GetBlobPropertiesResult
1874
+ *
1875
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-properties
1876
+ */
1877
+ public function createPageBlobFromContent(
1878
+ $container,
1879
+ $blob,
1880
+ $length,
1881
+ $content,
1882
+ Models\CreatePageBlobFromContentOptions $options = null
1883
+ ) {
1884
+ return $this->createPageBlobFromContentAsync(
1885
+ $container,
1886
+ $blob,
1887
+ $length,
1888
+ $content,
1889
+ $options
1890
+ )->wait();
1891
+ }
1892
+
1893
+ /**
1894
+ * Creates a promise to create a new page blob and upload the content
1895
+ * to the page blob.
1896
+ *
1897
+ * @param string $container The name of the container.
1898
+ * @param string $blob The name of the blob.
1899
+ * @param int $length The length of the blob.
1900
+ * @param string|resource|StreamInterface $content The content of the blob.
1901
+ * @param Models\CreatePageBlobFromContentOptions
1902
+ * $options The optional parameters.
1903
+ *
1904
+ * @return \GuzzleHttp\Promise\PromiseInterface
1905
+ *
1906
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-properties
1907
+ */
1908
+ public function createPageBlobFromContentAsync(
1909
+ $container,
1910
+ $blob,
1911
+ $length,
1912
+ $content,
1913
+ Models\CreatePageBlobFromContentOptions $options = null
1914
+ ) {
1915
+ $body = Psr7\stream_for($content);
1916
+ $self = $this;
1917
+
1918
+ if (is_null($options)) {
1919
+ $options = new Models\CreatePageBlobFromContentOptions();
1920
+ }
1921
+
1922
+ $createBlobPromise = $this->createPageBlobAsync(
1923
+ $container,
1924
+ $blob,
1925
+ $length,
1926
+ $options
1927
+ );
1928
+
1929
+ $uploadBlobPromise = $createBlobPromise->then(
1930
+ function ($value) use (
1931
+ $self,
1932
+ $container,
1933
+ $blob,
1934
+ $body,
1935
+ $options
1936
+ ) {
1937
+ $result = $value;
1938
+ return $self->uploadPageBlobAsync(
1939
+ $container,
1940
+ $blob,
1941
+ $body,
1942
+ $options
1943
+ );
1944
+ },
1945
+ null
1946
+ );
1947
+
1948
+ return $uploadBlobPromise->then(
1949
+ function ($value) use (
1950
+ $self,
1951
+ $container,
1952
+ $blob,
1953
+ $options
1954
+ ) {
1955
+ $getBlobPropertiesOptions = new GetBlobPropertiesOptions();
1956
+ $getBlobPropertiesOptions->setLeaseId($options->getLeaseId());
1957
+
1958
+ return $self->getBlobPropertiesAsync(
1959
+ $container,
1960
+ $blob,
1961
+ $getBlobPropertiesOptions
1962
+ );
1963
+ },
1964
+ null
1965
+ );
1966
+ }
1967
+
1968
+ /**
1969
+ * Creates promise to create a new block blob or updates the content of an
1970
+ * existing block blob. This only supports contents smaller than single
1971
+ * upload threashold.
1972
+ *
1973
+ * Updating an existing block blob overwrites any existing metadata on
1974
+ * the blob.
1975
+ *
1976
+ * @param string $container The name of the container.
1977
+ * @param string $blob The name of the blob.
1978
+ * @param StreamInterface $content The content of the blob.
1979
+ * @param Models\CreateBlobOptions $options The optional parameters.
1980
+ *
1981
+ * @return \GuzzleHttp\Promise\PromiseInterface
1982
+ *
1983
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
1984
+ */
1985
+ protected function createBlockBlobBySingleUploadAsync(
1986
+ $container,
1987
+ $blob,
1988
+ $content,
1989
+ Models\CreateBlobOptions $options = null
1990
+ ) {
1991
+ Validate::canCastAsString($container, 'container');
1992
+ Validate::canCastAsString($blob, 'blob');
1993
+ Validate::notNullOrEmpty($blob, 'blob');
1994
+ Validate::isTrue(
1995
+ $options == null ||
1996
+ $options instanceof CreateBlobOptions,
1997
+ sprintf(
1998
+ Resources::INVALID_PARAM_MSG,
1999
+ 'options',
2000
+ get_class(new CreateBlobOptions())
2001
+ )
2002
+ );
2003
+
2004
+ $method = Resources::HTTP_PUT;
2005
+ $headers = array();
2006
+ $postParams = array();
2007
+ $queryParams = array();
2008
+ $path = $this->createPath($container, $blob);
2009
+
2010
+ if (is_null($options)) {
2011
+ $options = new CreateBlobOptions();
2012
+ }
2013
+
2014
+ $headers = $this->addCreateBlobOptionalHeaders($options, $headers);
2015
+
2016
+ $this->addOptionalHeader(
2017
+ $headers,
2018
+ Resources::X_MS_BLOB_TYPE,
2019
+ BlobType::BLOCK_BLOB
2020
+ );
2021
+
2022
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
2023
+
2024
+ return $this->sendAsync(
2025
+ $method,
2026
+ $headers,
2027
+ $queryParams,
2028
+ $postParams,
2029
+ $path,
2030
+ Resources::STATUS_CREATED,
2031
+ $content,
2032
+ $options
2033
+ )->then(
2034
+ function ($response) {
2035
+ return PutBlobResult::create(
2036
+ HttpFormatter::formatHeaders($response->getHeaders())
2037
+ );
2038
+ },
2039
+ null
2040
+ );
2041
+ }
2042
+
2043
+ /**
2044
+ * This method creates the blob blocks. This method will send the request
2045
+ * concurrently for better performance.
2046
+ *
2047
+ * @param string $container Name of the container
2048
+ * @param string $blob Name of the blob
2049
+ * @param StreamInterface $content Content's stream
2050
+ * @param Models\CreateBlockBlobOptions $options Array that contains
2051
+ * all the option
2052
+ *
2053
+ * @return \GuzzleHttp\Promise\PromiseInterface
2054
+ */
2055
+ protected function createBlockBlobByMultipleUploadAsync(
2056
+ $container,
2057
+ $blob,
2058
+ $content,
2059
+ Models\CreateBlockBlobOptions $options = null
2060
+ ) {
2061
+ Validate::canCastAsString($container, 'container');
2062
+ Validate::canCastAsString($blob, 'blob');
2063
+
2064
+ if ($content->isSeekable() && Utilities::is64BitPHP()) {
2065
+ Validate::isTrue(
2066
+ $content->getSize() <= Resources::MAX_BLOCK_BLOB_SIZE,
2067
+ Resources::CONTENT_SIZE_TOO_LARGE
2068
+ );
2069
+ }
2070
+
2071
+ if (is_null($options)) {
2072
+ $options = new Models\CreateBlockBlobOptions();
2073
+ }
2074
+
2075
+ $createBlobBlockOptions = CreateBlobBlockOptions::create($options);
2076
+ $selfInstance = $this;
2077
+
2078
+ $method = Resources::HTTP_PUT;
2079
+ $headers = $this->createBlobBlockHeader($createBlobBlockOptions);
2080
+ $postParams = array();
2081
+ $path = $this->createPath($container, $blob);
2082
+ $useTransactionalMD5 = $options->getUseTransactionalMD5();
2083
+
2084
+ $blockIds = array();
2085
+ //Determine the block size according to the content and threshold.
2086
+ $blockSize = $this->getMultipleUploadBlockSizeUsingContent($content);
2087
+ $counter = 0;
2088
+ //create the generator for requests.
2089
+ //this generator also constructs the blockId array on the fly.
2090
+ $generator = function () use (
2091
+ $content,
2092
+ &$blockIds,
2093
+ $blockSize,
2094
+ $createBlobBlockOptions,
2095
+ $method,
2096
+ $headers,
2097
+ $postParams,
2098
+ $path,
2099
+ $useTransactionalMD5,
2100
+ &$counter,
2101
+ $selfInstance
2102
+ ) {
2103
+ //read the content.
2104
+ $blockContent = $content->read($blockSize);
2105
+ //construct the blockId
2106
+ $blockId = base64_encode(
2107
+ str_pad($counter++, 6, '0', STR_PAD_LEFT)
2108
+ );
2109
+ $size = strlen($blockContent);
2110
+ if ($size == 0) {
2111
+ return null;
2112
+ }
2113
+
2114
+ if ($useTransactionalMD5) {
2115
+ $contentMD5 = base64_encode(md5($blockContent, true));
2116
+ $selfInstance->addOptionalHeader(
2117
+ $headers,
2118
+ Resources::CONTENT_MD5,
2119
+ $contentMD5
2120
+ );
2121
+ }
2122
+
2123
+ //add the id to array.
2124
+ array_push($blockIds, new Block($blockId, 'Uncommitted'));
2125
+ $queryParams = $selfInstance->createBlobBlockQueryParams(
2126
+ $createBlobBlockOptions,
2127
+ $blockId,
2128
+ true
2129
+ );
2130
+ //return the array of requests.
2131
+ return $selfInstance->createRequest(
2132
+ $method,
2133
+ $headers,
2134
+ $queryParams,
2135
+ $postParams,
2136
+ $path,
2137
+ LocationMode::PRIMARY_ONLY,
2138
+ $blockContent
2139
+ );
2140
+ };
2141
+
2142
+ //Send the request concurrently.
2143
+ //Does not need to evaluate the results. If operation not successful,
2144
+ //exception will be thrown.
2145
+ $putBlobPromise = $this->sendConcurrentAsync(
2146
+ $generator,
2147
+ Resources::STATUS_CREATED,
2148
+ $options
2149
+ );
2150
+
2151
+ $commitBlobPromise = $putBlobPromise->then(
2152
+ function ($value) use (
2153
+ $selfInstance,
2154
+ $container,
2155
+ $blob,
2156
+ &$blockIds,
2157
+ $putBlobPromise,
2158
+ $options
2159
+ ) {
2160
+ return $selfInstance->commitBlobBlocksAsync(
2161
+ $container,
2162
+ $blob,
2163
+ $blockIds,
2164
+ CommitBlobBlocksOptions::create($options)
2165
+ );
2166
+ },
2167
+ null
2168
+ );
2169
+
2170
+ return $commitBlobPromise;
2171
+ }
2172
+
2173
+
2174
+ /**
2175
+ * This method upload the page blob pages. This method will send the request
2176
+ * concurrently for better performance.
2177
+ *
2178
+ * @param string $container Name of the container
2179
+ * @param string $blob Name of the blob
2180
+ * @param StreamInterface $content Content's stream
2181
+ * @param Models\CreatePageBlobFromContentOptions
2182
+ * $options Array that contains
2183
+ * all the option
2184
+ *
2185
+ * @return \GuzzleHttp\Promise\PromiseInterface
2186
+ */
2187
+ private function uploadPageBlobAsync(
2188
+ $container,
2189
+ $blob,
2190
+ $content,
2191
+ Models\CreatePageBlobFromContentOptions $options = null
2192
+ ) {
2193
+ Validate::canCastAsString($container, 'container');
2194
+ Validate::notNullOrEmpty($container, 'container');
2195
+
2196
+ Validate::canCastAsString($blob, 'blob');
2197
+ Validate::notNullOrEmpty($blob, 'blob');
2198
+
2199
+ if (is_null($options)) {
2200
+ $options = new Models\CreatePageBlobFromContentOptions();
2201
+ }
2202
+
2203
+ $method = Resources::HTTP_PUT;
2204
+ $postParams = array();
2205
+ $queryParams = array();
2206
+ $path = $this->createPath($container, $blob);
2207
+ $useTransactionalMD5 = $options->getUseTransactionalMD5();
2208
+
2209
+ $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'page');
2210
+ $this->addOptionalQueryParam(
2211
+ $queryParams,
2212
+ Resources::QP_TIMEOUT,
2213
+ $options->getTimeout()
2214
+ );
2215
+
2216
+ $pageSize = Resources::MB_IN_BYTES_4;
2217
+ $start = 0;
2218
+ $end = -1;
2219
+
2220
+ //create the generator for requests.
2221
+ $generator = function () use (
2222
+ $content,
2223
+ $pageSize,
2224
+ $method,
2225
+ $postParams,
2226
+ $queryParams,
2227
+ $path,
2228
+ $useTransactionalMD5,
2229
+ &$start,
2230
+ &$end,
2231
+ $options
2232
+ ) {
2233
+ //read the content.
2234
+ do {
2235
+ $pageContent = $content->read($pageSize);
2236
+ $size = strlen($pageContent);
2237
+
2238
+ if ($size == 0) {
2239
+ return null;
2240
+ }
2241
+
2242
+ $end += $size;
2243
+ $start = ($end - $size + 1);
2244
+
2245
+ // If all Zero, skip this range
2246
+ } while (Utilities::allZero($pageContent));
2247
+
2248
+ $headers = array();
2249
+ $headers = $this->addOptionalRangeHeader(
2250
+ $headers,
2251
+ $start,
2252
+ $end
2253
+ );
2254
+ $headers = $this->addOptionalAccessConditionHeader(
2255
+ $headers,
2256
+ $options->getAccessConditions()
2257
+ );
2258
+ $this->addOptionalHeader(
2259
+ $headers,
2260
+ Resources::X_MS_LEASE_ID,
2261
+ $options->getLeaseId()
2262
+ );
2263
+ $this->addOptionalHeader(
2264
+ $headers,
2265
+ Resources::X_MS_PAGE_WRITE,
2266
+ PageWriteOption::UPDATE_OPTION
2267
+ );
2268
+
2269
+ if ($useTransactionalMD5) {
2270
+ $contentMD5 = base64_encode(md5($pageContent, true));
2271
+ $this->addOptionalHeader(
2272
+ $headers,
2273
+ Resources::CONTENT_MD5,
2274
+ $contentMD5
2275
+ );
2276
+ }
2277
+
2278
+ //return the array of requests.
2279
+ return $this->createRequest(
2280
+ $method,
2281
+ $headers,
2282
+ $queryParams,
2283
+ $postParams,
2284
+ $path,
2285
+ LocationMode::PRIMARY_ONLY,
2286
+ $pageContent
2287
+ );
2288
+ };
2289
+
2290
+ //Send the request concurrently.
2291
+ //Does not need to evaluate the results. If operation is not successful,
2292
+ //exception will be thrown.
2293
+ return $this->sendConcurrentAsync(
2294
+ $generator,
2295
+ Resources::STATUS_CREATED,
2296
+ $options
2297
+ );
2298
+ }
2299
+
2300
+ /**
2301
+ * Clears a range of pages from the blob.
2302
+ *
2303
+ * @param string $container name of the container
2304
+ * @param string $blob name of the blob
2305
+ * @param Range $range Can be up to the value of
2306
+ * the blob's full size.
2307
+ * Note that ranges must be
2308
+ * aligned to 512 (0-511,
2309
+ * 512-1023)
2310
+ * @param Models\CreateBlobPagesOptions $options optional parameters
2311
+ *
2312
+ * @return Models\CreateBlobPagesResult
2313
+ *
2314
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
2315
+ */
2316
+ public function clearBlobPages(
2317
+ $container,
2318
+ $blob,
2319
+ Range $range,
2320
+ Models\CreateBlobPagesOptions $options = null
2321
+ ) {
2322
+ return $this->clearBlobPagesAsync(
2323
+ $container,
2324
+ $blob,
2325
+ $range,
2326
+ $options
2327
+ )->wait();
2328
+ }
2329
+
2330
+ /**
2331
+ * Creates promise to clear a range of pages from the blob.
2332
+ *
2333
+ * @param string $container name of the container
2334
+ * @param string $blob name of the blob
2335
+ * @param Range $range Can be up to the value of
2336
+ * the blob's full size.
2337
+ * Note that ranges must be
2338
+ * aligned to 512 (0-511,
2339
+ * 512-1023)
2340
+ * @param Models\CreateBlobPagesOptions $options optional parameters
2341
+ *
2342
+ * @return \GuzzleHttp\Promise\PromiseInterface
2343
+ *
2344
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
2345
+ */
2346
+ public function clearBlobPagesAsync(
2347
+ $container,
2348
+ $blob,
2349
+ Range $range,
2350
+ Models\CreateBlobPagesOptions $options = null
2351
+ ) {
2352
+ return $this->updatePageBlobPagesAsyncImpl(
2353
+ PageWriteOption::CLEAR_OPTION,
2354
+ $container,
2355
+ $blob,
2356
+ $range,
2357
+ Resources::EMPTY_STRING,
2358
+ $options
2359
+ );
2360
+ }
2361
+
2362
+ /**
2363
+ * Creates a range of pages to a page blob.
2364
+ *
2365
+ * @param string $container name of the container
2366
+ * @param string $blob name of the blob
2367
+ * @param Range $range Can be up to 4 MB in
2368
+ * size. Note that ranges
2369
+ * must be aligned to 512
2370
+ * (0-511, 512-1023)
2371
+ * @param string|resource|StreamInterface $content the blob contents.
2372
+ * @param Models\CreateBlobPagesOptions $options optional parameters
2373
+ *
2374
+ * @return Models\CreateBlobPagesResult
2375
+ *
2376
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
2377
+ */
2378
+ public function createBlobPages(
2379
+ $container,
2380
+ $blob,
2381
+ Range $range,
2382
+ $content,
2383
+ Models\CreateBlobPagesOptions $options = null
2384
+ ) {
2385
+ return $this->createBlobPagesAsync(
2386
+ $container,
2387
+ $blob,
2388
+ $range,
2389
+ $content,
2390
+ $options
2391
+ )->wait();
2392
+ }
2393
+
2394
+ /**
2395
+ * Creates promise to create a range of pages to a page blob.
2396
+ *
2397
+ * @param string $container name of the container
2398
+ * @param string $blob name of the blob
2399
+ * @param Range $range Can be up to 4 MB in
2400
+ * size. Note that ranges
2401
+ * must be aligned to 512
2402
+ * (0-511, 512-1023)
2403
+ * @param string|resource|StreamInterface $content the blob contents.
2404
+ * @param Models\CreateBlobPagesOptions $options optional parameters
2405
+ *
2406
+ * @return \GuzzleHttp\Promise\PromiseInterface
2407
+ *
2408
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
2409
+ */
2410
+ public function createBlobPagesAsync(
2411
+ $container,
2412
+ $blob,
2413
+ Range $range,
2414
+ $content,
2415
+ Models\CreateBlobPagesOptions $options = null
2416
+ ) {
2417
+ $contentStream = Psr7\stream_for($content);
2418
+ //because the content is at most 4MB long, can retrieve all the data
2419
+ //here at once.
2420
+ $body = $contentStream->getContents();
2421
+
2422
+ //if the range is not align to 512, throw exception.
2423
+ $chunks = (int)($range->getLength() / 512);
2424
+ if ($chunks * 512 != $range->getLength()) {
2425
+ throw new \RuntimeException(Resources::ERROR_RANGE_NOT_ALIGN_TO_512);
2426
+ }
2427
+
2428
+ return $this->updatePageBlobPagesAsyncImpl(
2429
+ PageWriteOption::UPDATE_OPTION,
2430
+ $container,
2431
+ $blob,
2432
+ $range,
2433
+ $body,
2434
+ $options
2435
+ );
2436
+ }
2437
+
2438
+ /**
2439
+ * Creates a new block to be committed as part of a block blob.
2440
+ *
2441
+ * @param string $container name of the container
2442
+ * @param string $blob name of the blob
2443
+ * @param string $blockId must be less than or
2444
+ * equal to 64 bytes in
2445
+ * size. For a given blob,
2446
+ * the length of the value
2447
+ * specified for the
2448
+ * blockid parameter must
2449
+ * be the same size for
2450
+ * each block.
2451
+ * @param resource|string|StreamInterface $content the blob block contents
2452
+ * @param Models\CreateBlobBlockOptions $options optional parameters
2453
+ *
2454
+ * @return Models\PutBlockResult
2455
+ *
2456
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135726.aspx
2457
+ */
2458
+ public function createBlobBlock(
2459
+ $container,
2460
+ $blob,
2461
+ $blockId,
2462
+ $content,
2463
+ Models\CreateBlobBlockOptions $options = null
2464
+ ) {
2465
+ return $this->createBlobBlockAsync(
2466
+ $container,
2467
+ $blob,
2468
+ $blockId,
2469
+ $content,
2470
+ $options
2471
+ )->wait();
2472
+ }
2473
+
2474
+ /**
2475
+ * Creates a new block to be committed as part of a block blob.
2476
+ *
2477
+ * @param string $container name of the container
2478
+ * @param string $blob name of the blob
2479
+ * @param string $blockId must be less than or
2480
+ * equal to 64 bytes in
2481
+ * size. For a given blob,
2482
+ * the length of the value
2483
+ * specified for the
2484
+ * blockid parameter must
2485
+ * be the same size for
2486
+ * each block.
2487
+ * @param resource|string|StreamInterface $content the blob block contents
2488
+ * @param Models\CreateBlobBlockOptions $options optional parameters
2489
+ *
2490
+ * @return \GuzzleHttp\Promise\PromiseInterface
2491
+ *
2492
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135726.aspx
2493
+ */
2494
+ public function createBlobBlockAsync(
2495
+ $container,
2496
+ $blob,
2497
+ $blockId,
2498
+ $content,
2499
+ Models\CreateBlobBlockOptions $options = null
2500
+ ) {
2501
+ Validate::canCastAsString($container, 'container');
2502
+ Validate::canCastAsString($blob, 'blob');
2503
+ Validate::notNullOrEmpty($blob, 'blob');
2504
+ Validate::canCastAsString($blockId, 'blockId');
2505
+ Validate::notNullOrEmpty($blockId, 'blockId');
2506
+
2507
+ if (is_null($options)) {
2508
+ $options = new CreateBlobBlockOptions();
2509
+ }
2510
+
2511
+ $method = Resources::HTTP_PUT;
2512
+ $headers = $this->createBlobBlockHeader($options);
2513
+ $postParams = array();
2514
+ $queryParams = $this->createBlobBlockQueryParams($options, $blockId);
2515
+ $path = $this->createPath($container, $blob);
2516
+ $contentStream = Psr7\stream_for($content);
2517
+ $body = $contentStream->getContents();
2518
+
2519
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
2520
+
2521
+ return $this->sendAsync(
2522
+ $method,
2523
+ $headers,
2524
+ $queryParams,
2525
+ $postParams,
2526
+ $path,
2527
+ Resources::STATUS_CREATED,
2528
+ $body,
2529
+ $options
2530
+ )->then(function ($response) {
2531
+ return PutBlockResult::create(
2532
+ HttpFormatter::formatHeaders($response->getHeaders())
2533
+ );
2534
+ });
2535
+ }
2536
+
2537
+ /**
2538
+ * Commits a new block of data to the end of an existing append blob.
2539
+ *
2540
+ * @param string $container name of the container
2541
+ * @param string $blob name of the blob
2542
+ * @param resource|string|StreamInterface $content the blob block contents
2543
+ * @param Models\AppendBlockOptions $options optional parameters
2544
+ *
2545
+ * @return Models\AppendBlockResult
2546
+ *
2547
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block
2548
+ */
2549
+ public function appendBlock(
2550
+ $container,
2551
+ $blob,
2552
+ $content,
2553
+ Models\AppendBlockOptions $options = null
2554
+ ) {
2555
+ return $this->appendBlockAsync(
2556
+ $container,
2557
+ $blob,
2558
+ $content,
2559
+ $options
2560
+ )->wait();
2561
+ }
2562
+
2563
+
2564
+ /**
2565
+ * Creates promise to commit a new block of data to the end of an existing append blob.
2566
+ *
2567
+ * @param string $container name of the container
2568
+ * @param string $blob name of the blob
2569
+ * @param resource|string|StreamInterface $content the blob block contents
2570
+ * @param Models\AppendBlockOptions $options optional parameters
2571
+ *
2572
+ * @return \GuzzleHttp\Promise\PromiseInterface
2573
+ *
2574
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block
2575
+ */
2576
+ public function appendBlockAsync(
2577
+ $container,
2578
+ $blob,
2579
+ $content,
2580
+ Models\AppendBlockOptions $options = null
2581
+ ) {
2582
+ Validate::canCastAsString($container, 'container');
2583
+ Validate::notNullOrEmpty($container, 'container');
2584
+ Validate::canCastAsString($blob, 'blob');
2585
+ Validate::notNullOrEmpty($blob, 'blob');
2586
+
2587
+ if (is_null($options)) {
2588
+ $options = new AppendBlockOptions();
2589
+ }
2590
+
2591
+ $method = Resources::HTTP_PUT;
2592
+ $headers = array();
2593
+ $postParams = array();
2594
+ $queryParams = array();
2595
+ $path = $this->createPath($container, $blob);
2596
+
2597
+ $contentStream = Psr7\stream_for($content);
2598
+ $length = $contentStream->getSize();
2599
+ $body = $contentStream->getContents();
2600
+
2601
+ $this->addOptionalQueryParam(
2602
+ $queryParams,
2603
+ Resources::QP_COMP,
2604
+ 'appendblock'
2605
+ );
2606
+
2607
+ $headers = $this->addOptionalAccessConditionHeader(
2608
+ $headers,
2609
+ $options->getAccessConditions()
2610
+ );
2611
+
2612
+ $this->addOptionalHeader(
2613
+ $headers,
2614
+ Resources::CONTENT_LENGTH,
2615
+ $length
2616
+ );
2617
+ $this->addOptionalHeader(
2618
+ $headers,
2619
+ Resources::CONTENT_MD5,
2620
+ $options->getContentMD5()
2621
+ );
2622
+ $this->addOptionalHeader(
2623
+ $headers,
2624
+ Resources::X_MS_BLOB_CONDITION_MAXSIZE,
2625
+ $options->getMaxBlobSize()
2626
+ );
2627
+ $this->addOptionalHeader(
2628
+ $headers,
2629
+ Resources::X_MS_BLOB_CONDITION_APPENDPOS,
2630
+ $options->getAppendPosition()
2631
+ );
2632
+ $this->addOptionalHeader(
2633
+ $headers,
2634
+ Resources::X_MS_LEASE_ID,
2635
+ $options->getLeaseId()
2636
+ );
2637
+
2638
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
2639
+
2640
+ return $this->sendAsync(
2641
+ $method,
2642
+ $headers,
2643
+ $queryParams,
2644
+ $postParams,
2645
+ $path,
2646
+ Resources::STATUS_CREATED,
2647
+ $body,
2648
+ $options
2649
+ )->then(function ($response) {
2650
+ return AppendBlockResult::create(
2651
+ HttpFormatter::formatHeaders($response->getHeaders())
2652
+ );
2653
+ });
2654
+ }
2655
+
2656
+ /**
2657
+ * create the header for createBlobBlock(s)
2658
+ * @param Models\CreateBlobBlockOptions $options the option of the request
2659
+ *
2660
+ * @return array
2661
+ */
2662
+ protected function createBlobBlockHeader(Models\CreateBlobBlockOptions $options = null)
2663
+ {
2664
+ $headers = array();
2665
+ $this->addOptionalHeader(
2666
+ $headers,
2667
+ Resources::X_MS_LEASE_ID,
2668
+ $options->getLeaseId()
2669
+ );
2670
+ $this->addOptionalHeader(
2671
+ $headers,
2672
+ Resources::CONTENT_MD5,
2673
+ $options->getContentMD5()
2674
+ );
2675
+ $this->addOptionalHeader(
2676
+ $headers,
2677
+ Resources::CONTENT_TYPE,
2678
+ Resources::URL_ENCODED_CONTENT_TYPE
2679
+ );
2680
+
2681
+ return $headers;
2682
+ }
2683
+
2684
+ /**
2685
+ * create the query params for createBlobBlock(s)
2686
+ * @param Models\CreateBlobBlockOptions $options the option of the
2687
+ * request
2688
+ * @param string $blockId the block id of the
2689
+ * block.
2690
+ * @param bool $isConcurrent if the query
2691
+ * parameter is for
2692
+ * concurrent upload.
2693
+ *
2694
+ * @return array the constructed query parameters.
2695
+ */
2696
+ protected function createBlobBlockQueryParams(
2697
+ Models\CreateBlobBlockOptions $options,
2698
+ $blockId,
2699
+ $isConcurrent = false
2700
+ ) {
2701
+ $queryParams = array();
2702
+ $this->addOptionalQueryParam(
2703
+ $queryParams,
2704
+ Resources::QP_COMP,
2705
+ 'block'
2706
+ );
2707
+ $this->addOptionalQueryParam(
2708
+ $queryParams,
2709
+ Resources::QP_BLOCKID,
2710
+ $blockId
2711
+ );
2712
+ if ($isConcurrent) {
2713
+ $this->addOptionalQueryParam(
2714
+ $queryParams,
2715
+ Resources::QP_TIMEOUT,
2716
+ $options->getTimeout()
2717
+ );
2718
+ }
2719
+
2720
+ return $queryParams;
2721
+ }
2722
+
2723
+ /**
2724
+ * This method writes a blob by specifying the list of block IDs that make up the
2725
+ * blob. In order to be written as part of a blob, a block must have been
2726
+ * successfully written to the server in a prior createBlobBlock method.
2727
+ *
2728
+ * You can call Put Block List to update a blob by uploading only those blocks
2729
+ * that have changed, then committing the new and existing blocks together.
2730
+ * You can do this by specifying whether to commit a block from the committed
2731
+ * block list or from the uncommitted block list, or to commit the most recently
2732
+ * uploaded version of the block, whichever list it may belong to.
2733
+ *
2734
+ * @param string $container The container name.
2735
+ * @param string $blob The blob name.
2736
+ * @param Models\BlockList|Block[] $blockList The block entries.
2737
+ * @param Models\CommitBlobBlocksOptions $options The optional parameters.
2738
+ *
2739
+ * @return Models\PutBlobResult
2740
+ *
2741
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179467.aspx
2742
+ */
2743
+ public function commitBlobBlocks(
2744
+ $container,
2745
+ $blob,
2746
+ $blockList,
2747
+ Models\CommitBlobBlocksOptions $options = null
2748
+ ) {
2749
+ return $this->commitBlobBlocksAsync(
2750
+ $container,
2751
+ $blob,
2752
+ $blockList,
2753
+ $options
2754
+ )->wait();
2755
+ }
2756
+
2757
+ /**
2758
+ * This method writes a blob by specifying the list of block IDs that make up the
2759
+ * blob. In order to be written as part of a blob, a block must have been
2760
+ * successfully written to the server in a prior createBlobBlock method.
2761
+ *
2762
+ * You can call Put Block List to update a blob by uploading only those blocks
2763
+ * that have changed, then committing the new and existing blocks together.
2764
+ * You can do this by specifying whether to commit a block from the committed
2765
+ * block list or from the uncommitted block list, or to commit the most recently
2766
+ * uploaded version of the block, whichever list it may belong to.
2767
+ *
2768
+ * @param string $container The container name.
2769
+ * @param string $blob The blob name.
2770
+ * @param Models\BlockList|Block[] $blockList The block entries.
2771
+ * @param Models\CommitBlobBlocksOptions $options The optional parameters.
2772
+ *
2773
+ * @return \GuzzleHttp\Promise\PromiseInterface
2774
+ *
2775
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179467.aspx
2776
+ */
2777
+ public function commitBlobBlocksAsync(
2778
+ $container,
2779
+ $blob,
2780
+ $blockList,
2781
+ Models\CommitBlobBlocksOptions $options = null
2782
+ ) {
2783
+ Validate::canCastAsString($container, 'container');
2784
+ Validate::canCastAsString($blob, 'blob');
2785
+ Validate::notNullOrEmpty($blob, 'blob');
2786
+ Validate::isTrue(
2787
+ $blockList instanceof BlockList || is_array($blockList),
2788
+ sprintf(
2789
+ Resources::INVALID_PARAM_MSG,
2790
+ 'blockList',
2791
+ get_class(new BlockList())
2792
+ )
2793
+ );
2794
+
2795
+ $method = Resources::HTTP_PUT;
2796
+ $postParams = array();
2797
+ $queryParams = array();
2798
+ $path = $this->createPath($container, $blob);
2799
+ $isArray = is_array($blockList);
2800
+ $blockList = $isArray ? BlockList::create($blockList) : $blockList;
2801
+ $body = $blockList->toXml($this->dataSerializer);
2802
+
2803
+ if (is_null($options)) {
2804
+ $options = new CommitBlobBlocksOptions();
2805
+ }
2806
+
2807
+ $blobContentType = $options->getContentType();
2808
+ $blobContentEncoding = $options->getContentEncoding();
2809
+ $blobContentLanguage = $options->getContentLanguage();
2810
+ $blobContentMD5 = $options->getContentMD5();
2811
+ $blobCacheControl = $options->getCacheControl();
2812
+ $blobCcontentDisposition = $options->getContentDisposition();
2813
+ $leaseId = $options->getLeaseId();
2814
+ $contentType = Resources::URL_ENCODED_CONTENT_TYPE;
2815
+
2816
+ $metadata = $options->getMetadata();
2817
+ $headers = $this->generateMetadataHeaders($metadata);
2818
+ $headers = $this->addOptionalAccessConditionHeader(
2819
+ $headers,
2820
+ $options->getAccessConditions()
2821
+ );
2822
+
2823
+ $this->addOptionalHeader(
2824
+ $headers,
2825
+ Resources::X_MS_LEASE_ID,
2826
+ $leaseId
2827
+ );
2828
+ $this->addOptionalHeader(
2829
+ $headers,
2830
+ Resources::X_MS_BLOB_CACHE_CONTROL,
2831
+ $blobCacheControl
2832
+ );
2833
+ $this->addOptionalHeader(
2834
+ $headers,
2835
+ Resources::X_MS_BLOB_CONTENT_DISPOSITION,
2836
+ $blobCcontentDisposition
2837
+ );
2838
+ $this->addOptionalHeader(
2839
+ $headers,
2840
+ Resources::X_MS_BLOB_CONTENT_TYPE,
2841
+ $blobContentType
2842
+ );
2843
+ $this->addOptionalHeader(
2844
+ $headers,
2845
+ Resources::X_MS_BLOB_CONTENT_ENCODING,
2846
+ $blobContentEncoding
2847
+ );
2848
+ $this->addOptionalHeader(
2849
+ $headers,
2850
+ Resources::X_MS_BLOB_CONTENT_LANGUAGE,
2851
+ $blobContentLanguage
2852
+ );
2853
+ $this->addOptionalHeader(
2854
+ $headers,
2855
+ Resources::X_MS_BLOB_CONTENT_MD5,
2856
+ $blobContentMD5
2857
+ );
2858
+ $this->addOptionalHeader(
2859
+ $headers,
2860
+ Resources::CONTENT_TYPE,
2861
+ $contentType
2862
+ );
2863
+
2864
+ $this->addOptionalQueryParam(
2865
+ $queryParams,
2866
+ Resources::QP_COMP,
2867
+ 'blocklist'
2868
+ );
2869
+
2870
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
2871
+
2872
+ return $this->sendAsync(
2873
+ $method,
2874
+ $headers,
2875
+ $queryParams,
2876
+ $postParams,
2877
+ $path,
2878
+ Resources::STATUS_CREATED,
2879
+ $body,
2880
+ $options
2881
+ )->then(function ($response) {
2882
+ return PutBlobResult::create(
2883
+ HttpFormatter::formatHeaders($response->getHeaders())
2884
+ );
2885
+ }, null);
2886
+ }
2887
+
2888
+ /**
2889
+ * Retrieves the list of blocks that have been uploaded as part of a block blob.
2890
+ *
2891
+ * There are two block lists maintained for a blob:
2892
+ * 1) Committed Block List: The list of blocks that have been successfully
2893
+ * committed to a given blob with commitBlobBlocks.
2894
+ * 2) Uncommitted Block List: The list of blocks that have been uploaded for a
2895
+ * blob using Put Block (REST API), but that have not yet been committed.
2896
+ * These blocks are stored in Windows Azure in association with a blob, but do
2897
+ * not yet form part of the blob.
2898
+ *
2899
+ * @param string $container name of the container
2900
+ * @param string $blob name of the blob
2901
+ * @param Models\ListBlobBlocksOptions $options optional parameters
2902
+ *
2903
+ * @return Models\ListBlobBlocksResult
2904
+ *
2905
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179400.aspx
2906
+ */
2907
+ public function listBlobBlocks(
2908
+ $container,
2909
+ $blob,
2910
+ Models\ListBlobBlocksOptions $options = null
2911
+ ) {
2912
+ return $this->listBlobBlocksAsync($container, $blob, $options)->wait();
2913
+ }
2914
+
2915
+ /**
2916
+ * Creates promise to retrieve the list of blocks that have been uploaded as
2917
+ * part of a block blob.
2918
+ *
2919
+ * There are two block lists maintained for a blob:
2920
+ * 1) Committed Block List: The list of blocks that have been successfully
2921
+ * committed to a given blob with commitBlobBlocks.
2922
+ * 2) Uncommitted Block List: The list of blocks that have been uploaded for a
2923
+ * blob using Put Block (REST API), but that have not yet been committed.
2924
+ * These blocks are stored in Windows Azure in association with a blob, but do
2925
+ * not yet form part of the blob.
2926
+ *
2927
+ * @param string $container name of the container
2928
+ * @param string $blob name of the blob
2929
+ * @param Models\ListBlobBlocksOptions $options optional parameters
2930
+ *
2931
+ * @return \GuzzleHttp\Promise\PromiseInterface
2932
+ *
2933
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179400.aspx
2934
+ */
2935
+ public function listBlobBlocksAsync(
2936
+ $container,
2937
+ $blob,
2938
+ Models\ListBlobBlocksOptions $options = null
2939
+ ) {
2940
+ Validate::canCastAsString($container, 'container');
2941
+ Validate::canCastAsString($blob, 'blob');
2942
+ Validate::notNullOrEmpty($blob, 'blob');
2943
+
2944
+ $method = Resources::HTTP_GET;
2945
+ $headers = array();
2946
+ $postParams = array();
2947
+ $queryParams = array();
2948
+ $path = $this->createPath($container, $blob);
2949
+
2950
+ if (is_null($options)) {
2951
+ $options = new ListBlobBlocksOptions();
2952
+ }
2953
+
2954
+ $this->addOptionalHeader(
2955
+ $headers,
2956
+ Resources::X_MS_LEASE_ID,
2957
+ $options->getLeaseId()
2958
+ );
2959
+
2960
+ $this->addOptionalQueryParam(
2961
+ $queryParams,
2962
+ Resources::QP_BLOCK_LIST_TYPE,
2963
+ $options->getBlockListType()
2964
+ );
2965
+ $this->addOptionalQueryParam(
2966
+ $queryParams,
2967
+ Resources::QP_SNAPSHOT,
2968
+ $options->getSnapshot()
2969
+ );
2970
+ $this->addOptionalQueryParam(
2971
+ $queryParams,
2972
+ Resources::QP_COMP,
2973
+ 'blocklist'
2974
+ );
2975
+
2976
+ return $this->sendAsync(
2977
+ $method,
2978
+ $headers,
2979
+ $queryParams,
2980
+ $postParams,
2981
+ $path,
2982
+ Resources::STATUS_OK,
2983
+ Resources::EMPTY_STRING,
2984
+ $options
2985
+ )->then(function ($response) {
2986
+ $parsed = $this->dataSerializer->unserialize($response->getBody());
2987
+
2988
+ return ListBlobBlocksResult::create(
2989
+ HttpFormatter::formatHeaders($response->getHeaders()),
2990
+ $parsed
2991
+ );
2992
+ }, null);
2993
+ }
2994
+
2995
+ /**
2996
+ * Returns all properties and metadata on the blob.
2997
+ *
2998
+ * @param string $container name of the container
2999
+ * @param string $blob name of the blob
3000
+ * @param Models\GetBlobPropertiesOptions $options optional parameters
3001
+ *
3002
+ * @return Models\GetBlobPropertiesResult
3003
+ *
3004
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179394.aspx
3005
+ */
3006
+ public function getBlobProperties(
3007
+ $container,
3008
+ $blob,
3009
+ Models\GetBlobPropertiesOptions $options = null
3010
+ ) {
3011
+ return $this->getBlobPropertiesAsync(
3012
+ $container,
3013
+ $blob,
3014
+ $options
3015
+ )->wait();
3016
+ }
3017
+
3018
+ /**
3019
+ * Creates promise to return all properties and metadata on the blob.
3020
+ *
3021
+ * @param string $container name of the container
3022
+ * @param string $blob name of the blob
3023
+ * @param Models\GetBlobPropertiesOptions $options optional parameters
3024
+ *
3025
+ * @return \GuzzleHttp\Promise\PromiseInterface
3026
+ *
3027
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179394.aspx
3028
+ */
3029
+ public function getBlobPropertiesAsync(
3030
+ $container,
3031
+ $blob,
3032
+ Models\GetBlobPropertiesOptions $options = null
3033
+ ) {
3034
+ Validate::canCastAsString($container, 'container');
3035
+ Validate::canCastAsString($blob, 'blob');
3036
+ Validate::notNullOrEmpty($blob, 'blob');
3037
+
3038
+ $method = Resources::HTTP_HEAD;
3039
+ $headers = array();
3040
+ $postParams = array();
3041
+ $queryParams = array();
3042
+ $path = $this->createPath($container, $blob);
3043
+
3044
+ if (is_null($options)) {
3045
+ $options = new GetBlobPropertiesOptions();
3046
+ }
3047
+
3048
+ $headers = $this->addOptionalAccessConditionHeader(
3049
+ $headers,
3050
+ $options->getAccessConditions()
3051
+ );
3052
+
3053
+ $this->addOptionalHeader(
3054
+ $headers,
3055
+ Resources::X_MS_LEASE_ID,
3056
+ $options->getLeaseId()
3057
+ );
3058
+ $this->addOptionalQueryParam(
3059
+ $queryParams,
3060
+ Resources::QP_SNAPSHOT,
3061
+ $options->getSnapshot()
3062
+ );
3063
+
3064
+ return $this->sendAsync(
3065
+ $method,
3066
+ $headers,
3067
+ $queryParams,
3068
+ $postParams,
3069
+ $path,
3070
+ Resources::STATUS_OK,
3071
+ Resources::EMPTY_STRING,
3072
+ $options
3073
+ )->then(function ($response) {
3074
+ $formattedHeaders = HttpFormatter::formatHeaders($response->getHeaders());
3075
+ return GetBlobPropertiesResult::create($formattedHeaders);
3076
+ }, null);
3077
+ }
3078
+
3079
+ /**
3080
+ * Returns all properties and metadata on the blob.
3081
+ *
3082
+ * @param string $container name of the container
3083
+ * @param string $blob name of the blob
3084
+ * @param Models\GetBlobMetadataOptions $options optional parameters
3085
+ *
3086
+ * @return Models\GetBlobMetadataResult
3087
+ *
3088
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179350.aspx
3089
+ */
3090
+ public function getBlobMetadata(
3091
+ $container,
3092
+ $blob,
3093
+ Models\GetBlobMetadataOptions $options = null
3094
+ ) {
3095
+ return $this->getBlobMetadataAsync($container, $blob, $options)->wait();
3096
+ }
3097
+
3098
+ /**
3099
+ * Creates promise to return all properties and metadata on the blob.
3100
+ *
3101
+ * @param string $container name of the container
3102
+ * @param string $blob name of the blob
3103
+ * @param Models\GetBlobMetadataOptions $options optional parameters
3104
+ *
3105
+ * @return \GuzzleHttp\Promise\PromiseInterface
3106
+ *
3107
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179350.aspx
3108
+ */
3109
+ public function getBlobMetadataAsync(
3110
+ $container,
3111
+ $blob,
3112
+ Models\GetBlobMetadataOptions $options = null
3113
+ ) {
3114
+ Validate::canCastAsString($container, 'container');
3115
+ Validate::canCastAsString($blob, 'blob');
3116
+ Validate::notNullOrEmpty($blob, 'blob');
3117
+
3118
+ $method = Resources::HTTP_HEAD;
3119
+ $headers = array();
3120
+ $postParams = array();
3121
+ $queryParams = array();
3122
+ $path = $this->createPath($container, $blob);
3123
+
3124
+ if (is_null($options)) {
3125
+ $options = new GetBlobMetadataOptions();
3126
+ }
3127
+
3128
+ $headers = $this->addOptionalAccessConditionHeader(
3129
+ $headers,
3130
+ $options->getAccessConditions()
3131
+ );
3132
+
3133
+ $this->addOptionalHeader(
3134
+ $headers,
3135
+ Resources::X_MS_LEASE_ID,
3136
+ $options->getLeaseId()
3137
+ );
3138
+ $this->addOptionalQueryParam(
3139
+ $queryParams,
3140
+ Resources::QP_SNAPSHOT,
3141
+ $options->getSnapshot()
3142
+ );
3143
+
3144
+ $this->addOptionalQueryParam(
3145
+ $queryParams,
3146
+ Resources::QP_COMP,
3147
+ 'metadata'
3148
+ );
3149
+
3150
+ return $this->sendAsync(
3151
+ $method,
3152
+ $headers,
3153
+ $queryParams,
3154
+ $postParams,
3155
+ $path,
3156
+ Resources::STATUS_OK,
3157
+ Resources::EMPTY_STRING,
3158
+ $options
3159
+ )->then(function ($response) {
3160
+ $responseHeaders = HttpFormatter::formatHeaders($response->getHeaders());
3161
+ return GetBlobMetadataResult::create($responseHeaders);
3162
+ });
3163
+ }
3164
+
3165
+ /**
3166
+ * Returns a list of active page ranges for a page blob. Active page ranges are
3167
+ * those that have been populated with data.
3168
+ *
3169
+ * @param string $container name of the container
3170
+ * @param string $blob name of the blob
3171
+ * @param Models\ListPageBlobRangesOptions $options optional parameters
3172
+ *
3173
+ * @return Models\ListPageBlobRangesResult
3174
+ *
3175
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx
3176
+ */
3177
+ public function listPageBlobRanges(
3178
+ $container,
3179
+ $blob,
3180
+ Models\ListPageBlobRangesOptions $options = null
3181
+ ) {
3182
+ return $this->listPageBlobRangesAsync(
3183
+ $container,
3184
+ $blob,
3185
+ $options
3186
+ )->wait();
3187
+ }
3188
+
3189
+ /**
3190
+ * Creates promise to return a list of active page ranges for a page blob.
3191
+ * Active page ranges are those that have been populated with data.
3192
+ *
3193
+ * @param string $container name of the container
3194
+ * @param string $blob name of the blob
3195
+ * @param Models\ListPageBlobRangesOptions $options optional parameters
3196
+ *
3197
+ * @return \GuzzleHttp\Promise\PromiseInterface
3198
+ *
3199
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx
3200
+ */
3201
+ public function listPageBlobRangesAsync(
3202
+ $container,
3203
+ $blob,
3204
+ Models\ListPageBlobRangesOptions $options = null
3205
+ ) {
3206
+ return $this->listPageBlobRangesAsyncImpl($container, $blob, null, $options);
3207
+ }
3208
+
3209
+ /**
3210
+ * Returns a list of page ranges that have been updated or cleared.
3211
+ *
3212
+ * Returns a list of page ranges that have been updated or cleared since
3213
+ * the snapshot specified by `previousSnapshotTime`. Gets all of the page
3214
+ * ranges by default, or only the page ranges over a specific range of
3215
+ * bytes if `rangeStart` and `rangeEnd` in the `options` are specified.
3216
+ *
3217
+ * @param string $container name of the container
3218
+ * @param string $blob name of the blob
3219
+ * @param string $previousSnapshotTime previous snapshot time
3220
+ * for comparison which
3221
+ * should be prior to the
3222
+ * snapshot time defined
3223
+ * in `options`
3224
+ * @param Models\ListPageBlobRangesOptions $options optional parameters
3225
+ *
3226
+ * @return Models\ListPageBlobRangesDiffResult
3227
+ *
3228
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/version-2015-07-08
3229
+ */
3230
+ public function listPageBlobRangesDiff(
3231
+ $container,
3232
+ $blob,
3233
+ $previousSnapshotTime,
3234
+ Models\ListPageBlobRangesOptions $options = null
3235
+ ) {
3236
+ return $this->listPageBlobRangesDiffAsync(
3237
+ $container,
3238
+ $blob,
3239
+ $previousSnapshotTime,
3240
+ $options
3241
+ )->wait();
3242
+ }
3243
+
3244
+ /**
3245
+ * Creates promise to return a list of page ranges that have been updated
3246
+ * or cleared.
3247
+ *
3248
+ * Creates promise to return a list of page ranges that have been updated
3249
+ * or cleared since the snapshot specified by `previousSnapshotTime`. Gets
3250
+ * all of the page ranges by default, or only the page ranges over a specific
3251
+ * range of bytes if `rangeStart` and `rangeEnd` in the `options` are specified.
3252
+ *
3253
+ * @param string $container name of the container
3254
+ * @param string $blob name of the blob
3255
+ * @param string $previousSnapshotTime previous snapshot time
3256
+ * for comparison which
3257
+ * should be prior to the
3258
+ * snapshot time defined
3259
+ * in `options`
3260
+ * @param Models\ListPageBlobRangesOptions $options optional parameters
3261
+ *
3262
+ * @return \GuzzleHttp\Promise\PromiseInterface
3263
+ *
3264
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx
3265
+ */
3266
+ public function listPageBlobRangesDiffAsync(
3267
+ $container,
3268
+ $blob,
3269
+ $previousSnapshotTime,
3270
+ Models\ListPageBlobRangesOptions $options = null
3271
+ ) {
3272
+ return $this->listPageBlobRangesAsyncImpl(
3273
+ $container,
3274
+ $blob,
3275
+ $previousSnapshotTime,
3276
+ $options
3277
+ );
3278
+ }
3279
+
3280
+ /**
3281
+ * Creates promise to return a list of page ranges.
3282
+
3283
+ * If `previousSnapshotTime` is specified, the response will include
3284
+ * only the pages that differ between the target snapshot or blob and
3285
+ * the previous snapshot.
3286
+ *
3287
+ * @param string $container name of the container
3288
+ * @param string $blob name of the blob
3289
+ * @param string $previousSnapshotTime previous snapshot time
3290
+ * for comparison which
3291
+ * should be prior to the
3292
+ * snapshot time defined
3293
+ * in `options`
3294
+ * @param Models\ListPageBlobRangesOptions $options optional parameters
3295
+ *
3296
+ * @return \GuzzleHttp\Promise\PromiseInterface
3297
+ *
3298
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx
3299
+ */
3300
+ private function listPageBlobRangesAsyncImpl(
3301
+ $container,
3302
+ $blob,
3303
+ $previousSnapshotTime = null,
3304
+ Models\ListPageBlobRangesOptions $options = null
3305
+ ) {
3306
+ Validate::canCastAsString($container, 'container');
3307
+ Validate::canCastAsString($blob, 'blob');
3308
+ Validate::notNullOrEmpty($blob, 'blob');
3309
+
3310
+ $method = Resources::HTTP_GET;
3311
+ $headers = array();
3312
+ $queryParams = array();
3313
+ $postParams = array();
3314
+ $path = $this->createPath($container, $blob);
3315
+
3316
+ if (is_null($options)) {
3317
+ $options = new ListPageBlobRangesOptions();
3318
+ }
3319
+
3320
+ $headers = $this->addOptionalAccessConditionHeader(
3321
+ $headers,
3322
+ $options->getAccessConditions()
3323
+ );
3324
+
3325
+ $range = $options->getRange();
3326
+ if ($range) {
3327
+ $headers = $this->addOptionalRangeHeader(
3328
+ $headers,
3329
+ $range->getStart(),
3330
+ $range->getEnd()
3331
+ );
3332
+ }
3333
+
3334
+ $this->addOptionalHeader(
3335
+ $headers,
3336
+ Resources::X_MS_LEASE_ID,
3337
+ $options->getLeaseId()
3338
+ );
3339
+ $this->addOptionalQueryParam(
3340
+ $queryParams,
3341
+ Resources::QP_SNAPSHOT,
3342
+ $options->getSnapshot()
3343
+ );
3344
+ $this->addOptionalQueryParam(
3345
+ $queryParams,
3346
+ Resources::QP_COMP,
3347
+ 'pagelist'
3348
+ );
3349
+ $this->addOptionalQueryParam(
3350
+ $queryParams,
3351
+ Resources::QP_PRE_SNAPSHOT,
3352
+ $previousSnapshotTime
3353
+ );
3354
+
3355
+ $dataSerializer = $this->dataSerializer;
3356
+
3357
+ return $this->sendAsync(
3358
+ $method,
3359
+ $headers,
3360
+ $queryParams,
3361
+ $postParams,
3362
+ $path,
3363
+ Resources::STATUS_OK,
3364
+ Resources::EMPTY_STRING,
3365
+ $options
3366
+ )->then(function ($response) use ($dataSerializer, $previousSnapshotTime) {
3367
+ $parsed = $dataSerializer->unserialize($response->getBody());
3368
+ if (is_null($previousSnapshotTime)) {
3369
+ return ListPageBlobRangesResult::create(
3370
+ HttpFormatter::formatHeaders($response->getHeaders()),
3371
+ $parsed
3372
+ );
3373
+ } else {
3374
+ return ListPageBlobRangesDiffResult::create(
3375
+ HttpFormatter::formatHeaders($response->getHeaders()),
3376
+ $parsed
3377
+ );
3378
+ }
3379
+ }, null);
3380
+ }
3381
+
3382
+ /**
3383
+ * Sets system properties defined for a blob.
3384
+ *
3385
+ * @param string $container name of the container
3386
+ * @param string $blob name of the blob
3387
+ * @param Models\SetBlobPropertiesOptions $options optional parameters
3388
+ *
3389
+ * @return Models\SetBlobPropertiesResult
3390
+ *
3391
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691966.aspx
3392
+ */
3393
+ public function setBlobProperties(
3394
+ $container,
3395
+ $blob,
3396
+ Models\SetBlobPropertiesOptions $options = null
3397
+ ) {
3398
+ return $this->setBlobPropertiesAsync(
3399
+ $container,
3400
+ $blob,
3401
+ $options
3402
+ )->wait();
3403
+ }
3404
+
3405
+ /**
3406
+ * Creates promise to set system properties defined for a blob.
3407
+ *
3408
+ * @param string $container name of the container
3409
+ * @param string $blob name of the blob
3410
+ * @param Models\SetBlobPropertiesOptions $options optional parameters
3411
+ *
3412
+ * @return \GuzzleHttp\Promise\PromiseInterface
3413
+ *
3414
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691966.aspx
3415
+ */
3416
+ public function setBlobPropertiesAsync(
3417
+ $container,
3418
+ $blob,
3419
+ Models\SetBlobPropertiesOptions $options = null
3420
+ ) {
3421
+ Validate::canCastAsString($container, 'container');
3422
+ Validate::canCastAsString($blob, 'blob');
3423
+ Validate::notNullOrEmpty($blob, 'blob');
3424
+
3425
+ $method = Resources::HTTP_PUT;
3426
+ $headers = array();
3427
+ $postParams = array();
3428
+ $queryParams = array();
3429
+ $path = $this->createPath($container, $blob);
3430
+
3431
+ if (is_null($options)) {
3432
+ $options = new SetBlobPropertiesOptions();
3433
+ }
3434
+
3435
+ $blobContentType = $options->getContentType();
3436
+ $blobContentEncoding = $options->getContentEncoding();
3437
+ $blobContentLanguage = $options->getContentLanguage();
3438
+ $blobContentLength = $options->getContentLength();
3439
+ $blobContentMD5 = $options->getContentMD5();
3440
+ $blobCacheControl = $options->getCacheControl();
3441
+ $blobContentDisposition = $options->getContentDisposition();
3442
+ $leaseId = $options->getLeaseId();
3443
+ $sNumberAction = $options->getSequenceNumberAction();
3444
+ $sNumber = $options->getSequenceNumber();
3445
+
3446
+ $headers = $this->addOptionalAccessConditionHeader(
3447
+ $headers,
3448
+ $options->getAccessConditions()
3449
+ );
3450
+
3451
+ $this->addOptionalHeader(
3452
+ $headers,
3453
+ Resources::X_MS_LEASE_ID,
3454
+ $leaseId
3455
+ );
3456
+ $this->addOptionalHeader(
3457
+ $headers,
3458
+ Resources::X_MS_BLOB_CACHE_CONTROL,
3459
+ $blobCacheControl
3460
+ );
3461
+ $this->addOptionalHeader(
3462
+ $headers,
3463
+ Resources::X_MS_BLOB_CONTENT_DISPOSITION,
3464
+ $blobContentDisposition
3465
+ );
3466
+ $this->addOptionalHeader(
3467
+ $headers,
3468
+ Resources::X_MS_BLOB_CONTENT_TYPE,
3469
+ $blobContentType
3470
+ );
3471
+ $this->addOptionalHeader(
3472
+ $headers,
3473
+ Resources::X_MS_BLOB_CONTENT_ENCODING,
3474
+ $blobContentEncoding
3475
+ );
3476
+ $this->addOptionalHeader(
3477
+ $headers,
3478
+ Resources::X_MS_BLOB_CONTENT_LANGUAGE,
3479
+ $blobContentLanguage
3480
+ );
3481
+ $this->addOptionalHeader(
3482
+ $headers,
3483
+ Resources::X_MS_BLOB_CONTENT_LENGTH,
3484
+ $blobContentLength
3485
+ );
3486
+ $this->addOptionalHeader(
3487
+ $headers,
3488
+ Resources::X_MS_BLOB_CONTENT_MD5,
3489
+ $blobContentMD5
3490
+ );
3491
+ $this->addOptionalHeader(
3492
+ $headers,
3493
+ Resources::X_MS_BLOB_SEQUENCE_NUMBER_ACTION,
3494
+ $sNumberAction
3495
+ );
3496
+ $this->addOptionalHeader(
3497
+ $headers,
3498
+ Resources::X_MS_BLOB_SEQUENCE_NUMBER,
3499
+ $sNumber
3500
+ );
3501
+
3502
+ $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'properties');
3503
+
3504
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
3505
+
3506
+ return $this->sendAsync(
3507
+ $method,
3508
+ $headers,
3509
+ $queryParams,
3510
+ $postParams,
3511
+ $path,
3512
+ Resources::STATUS_OK,
3513
+ Resources::EMPTY_STRING,
3514
+ $options
3515
+ )->then(function ($response) {
3516
+ return SetBlobPropertiesResult::create(
3517
+ HttpFormatter::formatHeaders($response->getHeaders())
3518
+ );
3519
+ }, null);
3520
+ }
3521
+
3522
+ /**
3523
+ * Sets metadata headers on the blob.
3524
+ *
3525
+ * @param string $container name of the container
3526
+ * @param string $blob name of the blob
3527
+ * @param array $metadata key/value pair representation
3528
+ * @param Models\BlobServiceOptions $options optional parameters
3529
+ *
3530
+ * @return Models\SetBlobMetadataResult
3531
+ *
3532
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179414.aspx
3533
+ */
3534
+ public function setBlobMetadata(
3535
+ $container,
3536
+ $blob,
3537
+ array $metadata,
3538
+ Models\BlobServiceOptions $options = null
3539
+ ) {
3540
+ return $this->setBlobMetadataAsync(
3541
+ $container,
3542
+ $blob,
3543
+ $metadata,
3544
+ $options
3545
+ )->wait();
3546
+ }
3547
+
3548
+ /**
3549
+ * Creates promise to set metadata headers on the blob.
3550
+ *
3551
+ * @param string $container name of the container
3552
+ * @param string $blob name of the blob
3553
+ * @param array $metadata key/value pair representation
3554
+ * @param Models\BlobServiceOptions $options optional parameters
3555
+ *
3556
+ * @return \GuzzleHttp\Promise\PromiseInterface
3557
+ *
3558
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179414.aspx
3559
+ */
3560
+ public function setBlobMetadataAsync(
3561
+ $container,
3562
+ $blob,
3563
+ array $metadata,
3564
+ Models\BlobServiceOptions $options = null
3565
+ ) {
3566
+ Validate::canCastAsString($container, 'container');
3567
+ Validate::canCastAsString($blob, 'blob');
3568
+ Validate::notNullOrEmpty($blob, 'blob');
3569
+ Utilities::validateMetadata($metadata);
3570
+
3571
+ $method = Resources::HTTP_PUT;
3572
+ $headers = array();
3573
+ $postParams = array();
3574
+ $queryParams = array();
3575
+ $path = $this->createPath($container, $blob);
3576
+
3577
+ if (is_null($options)) {
3578
+ $options = new BlobServiceOptions();
3579
+ }
3580
+
3581
+ $headers = $this->addOptionalAccessConditionHeader(
3582
+ $headers,
3583
+ $options->getAccessConditions()
3584
+ );
3585
+ $headers = $this->addMetadataHeaders($headers, $metadata);
3586
+
3587
+ $this->addOptionalHeader(
3588
+ $headers,
3589
+ Resources::X_MS_LEASE_ID,
3590
+ $options->getLeaseId()
3591
+ );
3592
+ $this->addOptionalQueryParam(
3593
+ $queryParams,
3594
+ Resources::QP_COMP,
3595
+ 'metadata'
3596
+ );
3597
+
3598
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
3599
+
3600
+ return $this->sendAsync(
3601
+ $method,
3602
+ $headers,
3603
+ $queryParams,
3604
+ $postParams,
3605
+ $path,
3606
+ Resources::STATUS_OK,
3607
+ Resources::EMPTY_STRING,
3608
+ $options
3609
+ )->then(function ($response) {
3610
+ return SetBlobMetadataResult::create(
3611
+ HttpFormatter::formatHeaders($response->getHeaders())
3612
+ );
3613
+ }, null);
3614
+ }
3615
+
3616
+ /**
3617
+ * Downloads a blob to a file, the result contains its metadata and
3618
+ * properties. The result will not contain a stream pointing to the
3619
+ * content of the file.
3620
+ *
3621
+ * @param string $path The path and name of the file
3622
+ * @param string $container name of the container
3623
+ * @param string $blob name of the blob
3624
+ * @param Models\GetBlobOptions $options optional parameters
3625
+ *
3626
+ * @return Models\GetBlobResult
3627
+ *
3628
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx
3629
+ */
3630
+ public function saveBlobToFile(
3631
+ $path,
3632
+ $container,
3633
+ $blob,
3634
+ Models\GetBlobOptions $options = null
3635
+ ) {
3636
+ return $this->saveBlobToFileAsync(
3637
+ $path,
3638
+ $container,
3639
+ $blob,
3640
+ $options
3641
+ )->wait();
3642
+ }
3643
+
3644
+ /**
3645
+ * Creates promise to download a blob to a file, the result contains its
3646
+ * metadata and properties. The result will not contain a stream pointing
3647
+ * to the content of the file.
3648
+ *
3649
+ * @param string $path The path and name of the file
3650
+ * @param string $container name of the container
3651
+ * @param string $blob name of the blob
3652
+ * @param Models\GetBlobOptions $options optional parameters
3653
+ *
3654
+ * @return \GuzzleHttp\Promise\PromiseInterface
3655
+ * @throws \Exception
3656
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx
3657
+ */
3658
+ public function saveBlobToFileAsync(
3659
+ $path,
3660
+ $container,
3661
+ $blob,
3662
+ Models\GetBlobOptions $options = null
3663
+ ) {
3664
+ $resource = fopen($path, 'w+');
3665
+ if ($resource == null) {
3666
+ throw new \Exception(Resources::ERROR_FILE_COULD_NOT_BE_OPENED);
3667
+ }
3668
+ return $this->getBlobAsync($container, $blob, $options)->then(
3669
+ function ($result) use ($path, $resource) {
3670
+ $content = $result->getContentStream();
3671
+ while (!feof($content)) {
3672
+ fwrite(
3673
+ $resource,
3674
+ stream_get_contents($content, Resources::MB_IN_BYTES_4)
3675
+ );
3676
+ }
3677
+
3678
+ $content = null;
3679
+ fclose($resource);
3680
+
3681
+ return $result;
3682
+ },
3683
+ null
3684
+ );
3685
+ }
3686
+
3687
+ /**
3688
+ * Reads or downloads a blob from the system, including its metadata and
3689
+ * properties.
3690
+ *
3691
+ * @param string $container name of the container
3692
+ * @param string $blob name of the blob
3693
+ * @param Models\GetBlobOptions $options optional parameters
3694
+ *
3695
+ * @return Models\GetBlobResult
3696
+ *
3697
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx
3698
+ */
3699
+ public function getBlob(
3700
+ $container,
3701
+ $blob,
3702
+ Models\GetBlobOptions $options = null
3703
+ ) {
3704
+ return $this->getBlobAsync($container, $blob, $options)->wait();
3705
+ }
3706
+
3707
+ /**
3708
+ * Creates promise to read or download a blob from the system, including its
3709
+ * metadata and properties.
3710
+ *
3711
+ * @param string $container name of the container
3712
+ * @param string $blob name of the blob
3713
+ * @param Models\GetBlobOptions $options optional parameters
3714
+ *
3715
+ * @return \GuzzleHttp\Promise\PromiseInterface
3716
+ *
3717
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx
3718
+ */
3719
+ public function getBlobAsync(
3720
+ $container,
3721
+ $blob,
3722
+ Models\GetBlobOptions $options = null
3723
+ ) {
3724
+ Validate::canCastAsString($container, 'container');
3725
+ Validate::canCastAsString($blob, 'blob');
3726
+
3727
+ $method = Resources::HTTP_GET;
3728
+ $headers = array();
3729
+ $postParams = array();
3730
+ $queryParams = array();
3731
+ $path = $this->createPath($container, $blob);
3732
+
3733
+ if (is_null($options)) {
3734
+ $options = new GetBlobOptions();
3735
+ }
3736
+
3737
+ $getMD5 = $options->getRangeGetContentMD5();
3738
+ $headers = $this->addOptionalAccessConditionHeader(
3739
+ $headers,
3740
+ $options->getAccessConditions()
3741
+ );
3742
+
3743
+ $range = $options->getRange();
3744
+ if ($range) {
3745
+ $headers = $this->addOptionalRangeHeader(
3746
+ $headers,
3747
+ $range->getStart(),
3748
+ $range->getEnd()
3749
+ );
3750
+ }
3751
+
3752
+ $this->addOptionalHeader(
3753
+ $headers,
3754
+ Resources::X_MS_LEASE_ID,
3755
+ $options->getLeaseId()
3756
+ );
3757
+ $this->addOptionalHeader(
3758
+ $headers,
3759
+ Resources::X_MS_RANGE_GET_CONTENT_MD5,
3760
+ $getMD5 ? 'true' : null
3761
+ );
3762
+ $this->addOptionalQueryParam(
3763
+ $queryParams,
3764
+ Resources::QP_SNAPSHOT,
3765
+ $options->getSnapshot()
3766
+ );
3767
+
3768
+ $options->setIsStreaming(true);
3769
+
3770
+ return $this->sendAsync(
3771
+ $method,
3772
+ $headers,
3773
+ $queryParams,
3774
+ $postParams,
3775
+ $path,
3776
+ array(Resources::STATUS_OK, Resources::STATUS_PARTIAL_CONTENT),
3777
+ Resources::EMPTY_STRING,
3778
+ $options
3779
+ )->then(function ($response) {
3780
+ $metadata = Utilities::getMetadataArray(
3781
+ HttpFormatter::formatHeaders($response->getHeaders())
3782
+ );
3783
+
3784
+ return GetBlobResult::create(
3785
+ HttpFormatter::formatHeaders($response->getHeaders()),
3786
+ $response->getBody(),
3787
+ $metadata
3788
+ );
3789
+ });
3790
+ }
3791
+
3792
+ /**
3793
+ * Deletes a blob or blob snapshot.
3794
+ *
3795
+ * Note that if the snapshot entry is specified in the $options then only this
3796
+ * blob snapshot is deleted. To delete all blob snapshots, do not set Snapshot
3797
+ * and just set getDeleteSnaphotsOnly to true.
3798
+ *
3799
+ * @param string $container name of the container
3800
+ * @param string $blob name of the blob
3801
+ * @param Models\DeleteBlobOptions $options optional parameters
3802
+ *
3803
+ * @return void
3804
+ *
3805
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179413.aspx
3806
+ */
3807
+ public function deleteBlob(
3808
+ $container,
3809
+ $blob,
3810
+ Models\DeleteBlobOptions $options = null
3811
+ ) {
3812
+ $this->deleteBlobAsync($container, $blob, $options)->wait();
3813
+ }
3814
+
3815
+ /**
3816
+ * Creates promise to delete a blob or blob snapshot.
3817
+ *
3818
+ * Note that if the snapshot entry is specified in the $options then only this
3819
+ * blob snapshot is deleted. To delete all blob snapshots, do not set Snapshot
3820
+ * and just set getDeleteSnaphotsOnly to true.
3821
+ *
3822
+ * @param string $container name of the container
3823
+ * @param string $blob name of the blob
3824
+ * @param Models\DeleteBlobOptions $options optional parameters
3825
+ *
3826
+ * @return \GuzzleHttp\Promise\PromiseInterface
3827
+ *
3828
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179413.aspx
3829
+ */
3830
+ public function deleteBlobAsync(
3831
+ $container,
3832
+ $blob,
3833
+ Models\DeleteBlobOptions $options = null
3834
+ ) {
3835
+ Validate::canCastAsString($container, 'container');
3836
+ Validate::canCastAsString($blob, 'blob');
3837
+ Validate::notNullOrEmpty($blob, 'blob');
3838
+
3839
+ $method = Resources::HTTP_DELETE;
3840
+ $headers = array();
3841
+ $postParams = array();
3842
+ $queryParams = array();
3843
+ $path = $this->createPath($container, $blob);
3844
+
3845
+ if (is_null($options)) {
3846
+ $options = new DeleteBlobOptions();
3847
+ }
3848
+
3849
+ if (is_null($options->getSnapshot())) {
3850
+ $delSnapshots = $options->getDeleteSnaphotsOnly() ? 'only' : 'include';
3851
+ $this->addOptionalHeader(
3852
+ $headers,
3853
+ Resources::X_MS_DELETE_SNAPSHOTS,
3854
+ $delSnapshots
3855
+ );
3856
+ } else {
3857
+ $this->addOptionalQueryParam(
3858
+ $queryParams,
3859
+ Resources::QP_SNAPSHOT,
3860
+ $options->getSnapshot()
3861
+ );
3862
+ }
3863
+
3864
+ $headers = $this->addOptionalAccessConditionHeader(
3865
+ $headers,
3866
+ $options->getAccessConditions()
3867
+ );
3868
+
3869
+ $this->addOptionalHeader(
3870
+ $headers,
3871
+ Resources::X_MS_LEASE_ID,
3872
+ $options->getLeaseId()
3873
+ );
3874
+
3875
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
3876
+
3877
+ return $this->sendAsync(
3878
+ $method,
3879
+ $headers,
3880
+ $queryParams,
3881
+ $postParams,
3882
+ $path,
3883
+ Resources::STATUS_ACCEPTED,
3884
+ Resources::EMPTY_STRING,
3885
+ $options
3886
+ );
3887
+ }
3888
+
3889
+ /**
3890
+ * Creates a snapshot of a blob.
3891
+ *
3892
+ * @param string $container The name of the container.
3893
+ * @param string $blob The name of the blob.
3894
+ * @param Models\CreateBlobSnapshotOptions $options The optional parameters.
3895
+ *
3896
+ * @return Models\CreateBlobSnapshotResult
3897
+ *
3898
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691971.aspx
3899
+ */
3900
+ public function createBlobSnapshot(
3901
+ $container,
3902
+ $blob,
3903
+ Models\CreateBlobSnapshotOptions $options = null
3904
+ ) {
3905
+ return $this->createBlobSnapshotAsync(
3906
+ $container,
3907
+ $blob,
3908
+ $options
3909
+ )->wait();
3910
+ }
3911
+
3912
+ /**
3913
+ * Creates promise to create a snapshot of a blob.
3914
+ *
3915
+ * @param string $container The name of the container.
3916
+ * @param string $blob The name of the blob.
3917
+ * @param Models\CreateBlobSnapshotOptions $options The optional parameters.
3918
+ *
3919
+ * @return \GuzzleHttp\Promise\PromiseInterface
3920
+ *
3921
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691971.aspx
3922
+ */
3923
+ public function createBlobSnapshotAsync(
3924
+ $container,
3925
+ $blob,
3926
+ Models\CreateBlobSnapshotOptions $options = null
3927
+ ) {
3928
+ Validate::canCastAsString($container, 'container');
3929
+ Validate::canCastAsString($blob, 'blob');
3930
+ Validate::notNullOrEmpty($blob, 'blob');
3931
+
3932
+ $method = Resources::HTTP_PUT;
3933
+ $headers = array();
3934
+ $postParams = array();
3935
+ $queryParams = array();
3936
+ $path = $this->createPath($container, $blob);
3937
+
3938
+ if (is_null($options)) {
3939
+ $options = new CreateBlobSnapshotOptions();
3940
+ }
3941
+
3942
+ $queryParams[Resources::QP_COMP] = 'snapshot';
3943
+
3944
+ $headers = $this->addOptionalAccessConditionHeader(
3945
+ $headers,
3946
+ $options->getAccessConditions()
3947
+ );
3948
+ $headers = $this->addMetadataHeaders($headers, $options->getMetadata());
3949
+ $this->addOptionalHeader(
3950
+ $headers,
3951
+ Resources::X_MS_LEASE_ID,
3952
+ $options->getLeaseId()
3953
+ );
3954
+
3955
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
3956
+
3957
+ return $this->sendAsync(
3958
+ $method,
3959
+ $headers,
3960
+ $queryParams,
3961
+ $postParams,
3962
+ $path,
3963
+ Resources::STATUS_CREATED,
3964
+ Resources::EMPTY_STRING,
3965
+ $options
3966
+ )->then(function ($response) {
3967
+ return CreateBlobSnapshotResult::create(
3968
+ HttpFormatter::formatHeaders($response->getHeaders())
3969
+ );
3970
+ }, null);
3971
+ }
3972
+
3973
+ /**
3974
+ * Copies a source blob to a destination blob within the same storage account.
3975
+ *
3976
+ * @param string $destinationContainer name of the destination
3977
+ * container
3978
+ * @param string $destinationBlob name of the destination
3979
+ * blob
3980
+ * @param string $sourceContainer name of the source
3981
+ * container
3982
+ * @param string $sourceBlob name of the source
3983
+ * blob
3984
+ * @param Models\CopyBlobOptions $options optional parameters
3985
+ *
3986
+ * @return Models\CopyBlobResult
3987
+ *
3988
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
3989
+ */
3990
+ public function copyBlob(
3991
+ $destinationContainer,
3992
+ $destinationBlob,
3993
+ $sourceContainer,
3994
+ $sourceBlob,
3995
+ Models\CopyBlobOptions $options = null
3996
+ ) {
3997
+ return $this->copyBlobAsync(
3998
+ $destinationContainer,
3999
+ $destinationBlob,
4000
+ $sourceContainer,
4001
+ $sourceBlob,
4002
+ $options
4003
+ )->wait();
4004
+ }
4005
+
4006
+ /**
4007
+ * Creates promise to copy a source blob to a destination blob within the
4008
+ * same storage account.
4009
+ *
4010
+ * @param string $destinationContainer name of the destination
4011
+ * container
4012
+ * @param string $destinationBlob name of the destination
4013
+ * blob
4014
+ * @param string $sourceContainer name of the source
4015
+ * container
4016
+ * @param string $sourceBlob name of the source
4017
+ * blob
4018
+ * @param Models\CopyBlobOptions $options optional parameters
4019
+ *
4020
+ * @return \GuzzleHttp\Promise\PromiseInterface
4021
+ *
4022
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
4023
+ */
4024
+ public function copyBlobAsync(
4025
+ $destinationContainer,
4026
+ $destinationBlob,
4027
+ $sourceContainer,
4028
+ $sourceBlob,
4029
+ Models\CopyBlobOptions $options = null
4030
+ ) {
4031
+ if (is_null($options)) {
4032
+ $options = new CopyBlobOptions();
4033
+ }
4034
+
4035
+ $sourceBlobPath = $this->getCopyBlobSourceName(
4036
+ $sourceContainer,
4037
+ $sourceBlob,
4038
+ $options
4039
+ );
4040
+
4041
+ return $this->copyBlobFromURLAsync(
4042
+ $destinationContainer,
4043
+ $destinationBlob,
4044
+ $sourceBlobPath,
4045
+ $options
4046
+ );
4047
+ }
4048
+
4049
+ /**
4050
+ * Copies from a source URL to a destination blob.
4051
+ *
4052
+ * @param string $destinationContainer name of the
4053
+ * destination
4054
+ * container
4055
+ * @param string $destinationBlob name of the
4056
+ * destination
4057
+ * blob
4058
+ * @param string $sourceURL URL of the
4059
+ * source
4060
+ * resource
4061
+ * @param Models\CopyBlobFromURLOptions $options optional
4062
+ * parameters
4063
+ *
4064
+ * @return Models\CopyBlobResult
4065
+ *
4066
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
4067
+ */
4068
+ public function copyBlobFromURL(
4069
+ $destinationContainer,
4070
+ $destinationBlob,
4071
+ $sourceURL,
4072
+ Models\CopyBlobFromURLOptions $options = null
4073
+ ) {
4074
+ return $this->copyBlobFromURLAsync(
4075
+ $destinationContainer,
4076
+ $destinationBlob,
4077
+ $sourceURL,
4078
+ $options
4079
+ )->wait();
4080
+ }
4081
+
4082
+ /**
4083
+ * Creates promise to copy from source URL to a destination blob.
4084
+ *
4085
+ * @param string $destinationContainer name of the
4086
+ * destination
4087
+ * container
4088
+ * @param string $destinationBlob name of the
4089
+ * destination
4090
+ * blob
4091
+ * @param string $sourceURL URL of the
4092
+ * source
4093
+ * resource
4094
+ * @param Models\CopyBlobFromURLOptions $options optional
4095
+ * parameters
4096
+ *
4097
+ * @return \GuzzleHttp\Promise\PromiseInterface
4098
+ *
4099
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
4100
+ */
4101
+ public function copyBlobFromURLAsync(
4102
+ $destinationContainer,
4103
+ $destinationBlob,
4104
+ $sourceURL,
4105
+ Models\CopyBlobFromURLOptions $options = null
4106
+ ) {
4107
+ $method = Resources::HTTP_PUT;
4108
+ $headers = array();
4109
+ $postParams = array();
4110
+ $queryParams = array();
4111
+ $destinationBlobPath = $this->createPath(
4112
+ $destinationContainer,
4113
+ $destinationBlob
4114
+ );
4115
+
4116
+ if (is_null($options)) {
4117
+ $options = new CopyBlobFromURLOptions();
4118
+ }
4119
+
4120
+ if ($options->getIsIncrementalCopy()) {
4121
+ $this->addOptionalQueryParam(
4122
+ $queryParams,
4123
+ Resources::QP_COMP,
4124
+ 'incrementalcopy'
4125
+ );
4126
+ }
4127
+
4128
+ $headers = $this->addOptionalAccessConditionHeader(
4129
+ $headers,
4130
+ $options->getAccessConditions()
4131
+ );
4132
+
4133
+ $headers = $this->addOptionalSourceAccessConditionHeader(
4134
+ $headers,
4135
+ $options->getSourceAccessConditions()
4136
+ );
4137
+
4138
+ $this->addOptionalHeader(
4139
+ $headers,
4140
+ Resources::X_MS_COPY_SOURCE,
4141
+ $sourceURL
4142
+ );
4143
+
4144
+ $headers = $this->addMetadataHeaders($headers, $options->getMetadata());
4145
+
4146
+ $this->addOptionalHeader(
4147
+ $headers,
4148
+ Resources::X_MS_LEASE_ID,
4149
+ $options->getLeaseId()
4150
+ );
4151
+
4152
+ $this->addOptionalHeader(
4153
+ $headers,
4154
+ Resources::X_MS_SOURCE_LEASE_ID,
4155
+ $options->getSourceLeaseId()
4156
+ );
4157
+
4158
+ $this->addOptionalHeader(
4159
+ $headers,
4160
+ Resources::X_MS_ACCESS_TIER,
4161
+ $options->getAccessTier()
4162
+ );
4163
+
4164
+ $options->setLocationMode(LocationMode::PRIMARY_ONLY);
4165
+
4166
+ return $this->sendAsync(
4167
+ $method,
4168
+ $headers,
4169
+ $queryParams,
4170
+ $postParams,
4171
+ $destinationBlobPath,
4172
+ Resources::STATUS_ACCEPTED,
4173
+ Resources::EMPTY_STRING,
4174
+ $options
4175
+ )->then(function ($response) {
4176
+ return CopyBlobResult::create(
4177
+ HttpFormatter::formatHeaders($response->getHeaders())
4178
+ );
4179
+ }, null);
4180
+ }
4181
+
4182
+ /**
4183
+ * Abort a blob copy operation
4184
+ *
4185
+ * @param string $container name of the container
4186
+ * @param string $blob name of the blob
4187
+ * @param string $copyId copy operation identifier.
4188
+ * @param Models\BlobServiceOptions $options optional parameters
4189
+ *
4190
+ * @return void
4191
+ *
4192
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/abort-copy-blob
4193
+ */
4194
+ public function abortCopy(
4195
+ $container,
4196
+ $blob,
4197
+ $copyId,
4198
+ Models\BlobServiceOptions $options = null
4199
+ ) {
4200
+ return $this->abortCopyAsync(
4201
+ $container,
4202
+ $blob,
4203
+ $copyId,
4204
+ $options
4205
+ )->wait();
4206
+ }
4207
+
4208
+ /**
4209
+ * Creates promise to abort a blob copy operation
4210
+ *
4211
+ * @param string $container name of the container
4212
+ * @param string $blob name of the blob
4213
+ * @param string $copyId copy operation identifier.
4214
+ * @param Models\BlobServiceOptions $options optional parameters
4215
+ *
4216
+ * @return \GuzzleHttp\Promise\PromiseInterface
4217
+ *
4218
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/abort-copy-blob
4219
+ */
4220
+ public function abortCopyAsync(
4221
+ $container,
4222
+ $blob,
4223
+ $copyId,
4224
+ Models\BlobServiceOptions $options = null
4225
+ ) {
4226
+ Validate::canCastAsString($container, 'container');
4227
+ Validate::canCastAsString($blob, 'blob');
4228
+ Validate::canCastAsString($copyId, 'copyId');
4229
+ Validate::notNullOrEmpty($container, 'container');
4230
+ Validate::notNullOrEmpty($blob, 'blob');
4231
+ Validate::notNullOrEmpty($copyId, 'copyId');
4232
+
4233
+ $method = Resources::HTTP_PUT;
4234
+ $headers = array();
4235
+ $postParams = array();
4236
+ $queryParams = array();
4237
+ $destinationBlobPath = $this->createPath(
4238
+ $container,
4239
+ $blob
4240
+ );
4241
+
4242
+ if (is_null($options)) {
4243
+ $options = new BlobServiceOptions();
4244
+ }
4245
+
4246
+ $this->addOptionalQueryParam(
4247
+ $queryParams,
4248
+ Resources::QP_TIMEOUT,
4249
+ $options->getTimeout()
4250
+ );
4251
+
4252
+ $this->addOptionalQueryParam(
4253
+ $queryParams,
4254
+ Resources::QP_COMP,
4255
+ 'copy'
4256
+ );
4257
+
4258
+ $this->addOptionalQueryParam(
4259
+ $queryParams,
4260
+ Resources::QP_COPY_ID,
4261
+ $copyId
4262
+ );
4263
+
4264
+ $this->addOptionalHeader(
4265
+ $headers,
4266
+ Resources::X_MS_LEASE_ID,
4267
+ $options->getLeaseId()
4268
+ );
4269
+
4270
+ $this->addOptionalHeader(
4271
+ $headers,
4272
+ Resources::X_MS_COPY_ACTION,
4273
+ 'abort'
4274
+ );
4275
+
4276
+ return $this->sendAsync(
4277
+ $method,
4278
+ $headers,
4279
+ $queryParams,
4280
+ $postParams,
4281
+ $destinationBlobPath,
4282
+ Resources::STATUS_NO_CONTENT,
4283
+ Resources::EMPTY_STRING,
4284
+ $options
4285
+ );
4286
+ }
4287
+
4288
+ /**
4289
+ * Establishes an exclusive write lock on a blob. To write to a locked
4290
+ * blob, a client must provide a lease ID.
4291
+ *
4292
+ * @param string $container name of the container
4293
+ * @param string $blob name of the blob
4294
+ * @param string $proposedLeaseId lease id when acquiring
4295
+ * @param int $leaseDuration the lease duration.
4296
+ * A non-infinite
4297
+ * lease can be between
4298
+ * 15 and 60 seconds.
4299
+ * Default is never
4300
+ * to expire.
4301
+ * @param Models\BlobServiceOptions $options optional parameters
4302
+ *
4303
+ * @return Models\LeaseResult
4304
+ *
4305
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
4306
+ */
4307
+ public function acquireLease(
4308
+ $container,
4309
+ $blob,
4310
+ $proposedLeaseId = null,
4311
+ $leaseDuration = null,
4312
+ Models\BlobServiceOptions $options = null
4313
+ ) {
4314
+ return $this->acquireLeaseAsync(
4315
+ $container,
4316
+ $blob,
4317
+ $proposedLeaseId,
4318
+ $leaseDuration,
4319
+ $options
4320
+ )->wait();
4321
+ }
4322
+
4323
+ /**
4324
+ * Creates promise to establish an exclusive one-minute write lock on a blob.
4325
+ * To write to a locked blob, a client must provide a lease ID.
4326
+ *
4327
+ * @param string $container name of the container
4328
+ * @param string $blob name of the blob
4329
+ * @param string $proposedLeaseId lease id when acquiring
4330
+ * @param int $leaseDuration the lease duration.
4331
+ * A non-infinite
4332
+ * lease can be between
4333
+ * 15 and 60 seconds.
4334
+ * Default is never to
4335
+ * expire.
4336
+ * @param Models\BlobServiceOptions $options optional parameters
4337
+ *
4338
+ * @return \GuzzleHttp\Promise\PromiseInterface
4339
+ *
4340
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
4341
+ */
4342
+ public function acquireLeaseAsync(
4343
+ $container,
4344
+ $blob,
4345
+ $proposedLeaseId = null,
4346
+ $leaseDuration = null,
4347
+ Models\BlobServiceOptions $options = null
4348
+ ) {
4349
+ if ($options === null) {
4350
+ $options = new BlobServiceOptions();
4351
+ }
4352
+
4353
+ if ($leaseDuration === null) {
4354
+ $leaseDuration = -1;
4355
+ }
4356
+
4357
+ return $this->putLeaseAsyncImpl(
4358
+ LeaseMode::ACQUIRE_ACTION,
4359
+ $container,
4360
+ $blob,
4361
+ $proposedLeaseId,
4362
+ $leaseDuration,
4363
+ null /* leaseId */,
4364
+ null /* breakPeriod */,
4365
+ self::getStatusCodeOfLeaseAction(LeaseMode::ACQUIRE_ACTION),
4366
+ $options,
4367
+ $options->getAccessConditions()
4368
+ )->then(function ($response) {
4369
+ return LeaseResult::create(
4370
+ HttpFormatter::formatHeaders($response->getHeaders())
4371
+ );
4372
+ }, null);
4373
+ }
4374
+
4375
+ /**
4376
+ * change an existing lease
4377
+ *
4378
+ * @param string $container name of the container
4379
+ * @param string $blob name of the blob
4380
+ * @param string $leaseId lease id when acquiring
4381
+ * @param string $proposedLeaseId lease id when acquiring
4382
+ * @param Models\BlobServiceOptions $options optional parameters
4383
+ *
4384
+ * @return Models\LeaseResult
4385
+ *
4386
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
4387
+ */
4388
+ public function changeLease(
4389
+ $container,
4390
+ $blob,
4391
+ $leaseId,
4392
+ $proposedLeaseId,
4393
+ Models\BlobServiceOptions $options = null
4394
+ ) {
4395
+ return $this->changeLeaseAsync(
4396
+ $container,
4397
+ $blob,
4398
+ $leaseId,
4399
+ $proposedLeaseId,
4400
+ $options
4401
+ )->wait();
4402
+ }
4403
+
4404
+ /**
4405
+ * Creates promise to change an existing lease
4406
+ *
4407
+ * @param string $container name of the container
4408
+ * @param string $blob name of the blob
4409
+ * @param string $leaseId lease id when acquiring
4410
+ * @param string $proposedLeaseId the proposed lease id
4411
+ * @param Models\BlobServiceOptions $options optional parameters
4412
+ *
4413
+ * @return \GuzzleHttp\Promise\PromiseInterface
4414
+ *
4415
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
4416
+ */
4417
+ public function changeLeaseAsync(
4418
+ $container,
4419
+ $blob,
4420
+ $leaseId,
4421
+ $proposedLeaseId,
4422
+ Models\BlobServiceOptions $options = null
4423
+ ) {
4424
+ return $this->putLeaseAsyncImpl(
4425
+ LeaseMode::CHANGE_ACTION,
4426
+ $container,
4427
+ $blob,
4428
+ $proposedLeaseId,
4429
+ null /* leaseDuration */,
4430
+ $leaseId,
4431
+ null /* breakPeriod */,
4432
+ self::getStatusCodeOfLeaseAction(LeaseMode::RENEW_ACTION),
4433
+ is_null($options) ? new BlobServiceOptions() : $options
4434
+ )->then(function ($response) {
4435
+ return LeaseResult::create(
4436
+ HttpFormatter::formatHeaders($response->getHeaders())
4437
+ );
4438
+ }, null);
4439
+ }
4440
+
4441
+ /**
4442
+ * Renews an existing lease
4443
+ *
4444
+ * @param string $container name of the container
4445
+ * @param string $blob name of the blob
4446
+ * @param string $leaseId lease id when acquiring
4447
+ * @param Models\BlobServiceOptions $options optional parameters
4448
+ *
4449
+ * @return Models\LeaseResult
4450
+ *
4451
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
4452
+ */
4453
+ public function renewLease(
4454
+ $container,
4455
+ $blob,
4456
+ $leaseId,
4457
+ Models\BlobServiceOptions $options = null
4458
+ ) {
4459
+ return $this->renewLeaseAsync(
4460
+ $container,
4461
+ $blob,
4462
+ $leaseId,
4463
+ $options
4464
+ )->wait();
4465
+ }
4466
+
4467
+ /**
4468
+ * Creates promise to renew an existing lease
4469
+ *
4470
+ * @param string $container name of the container
4471
+ * @param string $blob name of the blob
4472
+ * @param string $leaseId lease id when acquiring
4473
+ * @param Models\BlobServiceOptions $options optional parameters
4474
+ *
4475
+ * @return \GuzzleHttp\Promise\PromiseInterface
4476
+ *
4477
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
4478
+ */
4479
+ public function renewLeaseAsync(
4480
+ $container,
4481
+ $blob,
4482
+ $leaseId,
4483
+ Models\BlobServiceOptions $options = null
4484
+ ) {
4485
+ return $this->putLeaseAsyncImpl(
4486
+ LeaseMode::RENEW_ACTION,
4487
+ $container,
4488
+ $blob,
4489
+ null /* proposedLeaseId */,
4490
+ null /* leaseDuration */,
4491
+ $leaseId,
4492
+ null /* breakPeriod */,
4493
+ self::getStatusCodeOfLeaseAction(LeaseMode::RENEW_ACTION),
4494
+ is_null($options) ? new BlobServiceOptions() : $options
4495
+ )->then(function ($response) {
4496
+ return LeaseResult::create(
4497
+ HttpFormatter::formatHeaders($response->getHeaders())
4498
+ );
4499
+ }, null);
4500
+ }
4501
+
4502
+ /**
4503
+ * Frees the lease if it is no longer needed so that another client may
4504
+ * immediately acquire a lease against the blob.
4505
+ *
4506
+ * @param string $container name of the container
4507
+ * @param string $blob name of the blob
4508
+ * @param string $leaseId lease id when acquiring
4509
+ * @param Models\BlobServiceOptions $options optional parameters
4510
+ *
4511
+ * @return void
4512
+ *
4513
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
4514
+ */
4515
+ public function releaseLease(
4516
+ $container,
4517
+ $blob,
4518
+ $leaseId,
4519
+ Models\BlobServiceOptions $options = null
4520
+ ) {
4521
+ $this->releaseLeaseAsync($container, $blob, $leaseId, $options)->wait();
4522
+ }
4523
+
4524
+ /**
4525
+ * Creates promise to free the lease if it is no longer needed so that
4526
+ * another client may immediately acquire a lease against the blob.
4527
+ *
4528
+ * @param string $container name of the container
4529
+ * @param string $blob name of the blob
4530
+ * @param string $leaseId lease id when acquiring
4531
+ * @param Models\BlobServiceOptions $options optional parameters
4532
+ *
4533
+ * @return \GuzzleHttp\Promise\PromiseInterface
4534
+ *
4535
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
4536
+ */
4537
+ public function releaseLeaseAsync(
4538
+ $container,
4539
+ $blob,
4540
+ $leaseId,
4541
+ Models\BlobServiceOptions $options = null
4542
+ ) {
4543
+ return $this->putLeaseAsyncImpl(
4544
+ LeaseMode::RELEASE_ACTION,
4545
+ $container,
4546
+ $blob,
4547
+ null /* proposedLeaseId */,
4548
+ null /* leaseDuration */,
4549
+ $leaseId,
4550
+ null /* breakPeriod */,
4551
+ self::getStatusCodeOfLeaseAction(LeaseMode::RELEASE_ACTION),
4552
+ is_null($options) ? new BlobServiceOptions() : $options
4553
+ );
4554
+ }
4555
+
4556
+ /**
4557
+ * Ends the lease but ensure that another client cannot acquire a new lease until
4558
+ * the current lease period has expired.
4559
+ *
4560
+ * @param string $container name of the container
4561
+ * @param string $blob name of the blob
4562
+ * @param int $breakPeriod the proposed duration of seconds that
4563
+ * lease should continue before it it broken,
4564
+ * between 0 and 60 seconds.
4565
+ * @param Models\BlobServiceOptions $options optional parameters
4566
+ *
4567
+ * @return BreakLeaseResult
4568
+ *
4569
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
4570
+ */
4571
+ public function breakLease(
4572
+ $container,
4573
+ $blob,
4574
+ $breakPeriod = null,
4575
+ Models\BlobServiceOptions $options = null
4576
+ ) {
4577
+ return $this->breakLeaseAsync(
4578
+ $container,
4579
+ $blob,
4580
+ $breakPeriod,
4581
+ $options
4582
+ )->wait();
4583
+ }
4584
+
4585
+ /**
4586
+ * Creates promise to end the lease but ensure that another client cannot
4587
+ * acquire a new lease until the current lease period has expired.
4588
+ *
4589
+ * @param string $container name of the container
4590
+ * @param string $blob name of the blob
4591
+ * @param int $breakPeriod break period, in seconds
4592
+ * @param Models\BlobServiceOptions $options optional parameters
4593
+ *
4594
+ * @return \GuzzleHttp\Promise\PromiseInterface
4595
+ *
4596
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
4597
+ */
4598
+ public function breakLeaseAsync(
4599
+ $container,
4600
+ $blob,
4601
+ $breakPeriod = null,
4602
+ Models\BlobServiceOptions $options = null
4603
+ ) {
4604
+ return $this->putLeaseAsyncImpl(
4605
+ LeaseMode::BREAK_ACTION,
4606
+ $container,
4607
+ $blob,
4608
+ null /* proposedLeaseId */,
4609
+ null /* leaseDuration */,
4610
+ null /* leaseId */,
4611
+ $breakPeriod,
4612
+ self::getStatusCodeOfLeaseAction(LeaseMode::BREAK_ACTION),
4613
+ is_null($options) ? new BlobServiceOptions() : $options
4614
+ )->then(function ($response) {
4615
+ return BreakLeaseResult::create(
4616
+ HttpFormatter::formatHeaders($response->getHeaders())
4617
+ );
4618
+ }, null);
4619
+ }
4620
+
4621
+ /**
4622
+ * Adds optional header to headers if set
4623
+ *
4624
+ * @param array $headers The array of request headers.
4625
+ * @param Models\AccessCondition $accessCondition The access condition object.
4626
+ *
4627
+ * @return array
4628
+ */
4629
+ public function addOptionalAccessConditionHeader(
4630
+ array $headers,
4631
+ array $accessConditions = null
4632
+ ) {
4633
+ if (!empty($accessConditions)) {
4634
+ foreach ($accessConditions as $accessCondition) {
4635
+ if (!is_null($accessCondition)) {
4636
+ $header = $accessCondition->getHeader();
4637
+
4638
+ if ($header != Resources::EMPTY_STRING) {
4639
+ $value = $accessCondition->getValue();
4640
+ if ($value instanceof \DateTime) {
4641
+ $value = gmdate(
4642
+ Resources::AZURE_DATE_FORMAT,
4643
+ $value->getTimestamp()
4644
+ );
4645
+ }
4646
+ $headers[$header] = $value;
4647
+ }
4648
+ }
4649
+ }
4650
+ }
4651
+
4652
+ return $headers;
4653
+ }
4654
+
4655
+ /**
4656
+ * Adds optional header to headers if set
4657
+ *
4658
+ * @param array $headers The array of request headers.
4659
+ * @param array $accessCondition The access condition object.
4660
+ *
4661
+ * @return array
4662
+ */
4663
+ public function addOptionalSourceAccessConditionHeader(
4664
+ array $headers,
4665
+ array $accessConditions = null
4666
+ ) {
4667
+ if (!empty($accessConditions)) {
4668
+ foreach ($accessConditions as $accessCondition) {
4669
+ if (!is_null($accessCondition)) {
4670
+ $header = $accessCondition->getHeader();
4671
+ $headerName = null;
4672
+ if (!empty($header)) {
4673
+ switch ($header) {
4674
+ case Resources::IF_MATCH:
4675
+ $headerName = Resources::X_MS_SOURCE_IF_MATCH;
4676
+ break;
4677
+ case Resources::IF_UNMODIFIED_SINCE:
4678
+ $headerName = Resources::X_MS_SOURCE_IF_UNMODIFIED_SINCE;
4679
+ break;
4680
+ case Resources::IF_MODIFIED_SINCE:
4681
+ $headerName = Resources::X_MS_SOURCE_IF_MODIFIED_SINCE;
4682
+ break;
4683
+ case Resources::IF_NONE_MATCH:
4684
+ $headerName = Resources::X_MS_SOURCE_IF_NONE_MATCH;
4685
+ break;
4686
+ default:
4687
+ throw new \Exception(Resources::INVALID_ACH_MSG);
4688
+ break;
4689
+ }
4690
+ }
4691
+ $value = $accessCondition->getValue();
4692
+ if ($value instanceof \DateTime) {
4693
+ $value = gmdate(
4694
+ Resources::AZURE_DATE_FORMAT,
4695
+ $value->getTimestamp()
4696
+ );
4697
+ }
4698
+
4699
+ $this->addOptionalHeader($headers, $headerName, $value);
4700
+ }
4701
+ }
4702
+ }
4703
+
4704
+ return $headers;
4705
+ }
4706
+ }
vendor/microsoft/azure-storage-blob/src/Blob/BlobSharedAccessSignatureHelper.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
+ use MicrosoftAzure\Storage\Common\Internal\Utilities;
29
+ use MicrosoftAzure\Storage\Common\Internal\Validate;
30
+ use MicrosoftAzure\Storage\Common\SharedAccessSignatureHelper;
31
+
32
+ /**
33
+ * Provides methods to generate Azure Storage Shared Access Signature
34
+ *
35
+ * @category Microsoft
36
+ * @package MicrosoftAzure\Storage\Blob
37
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
38
+ * @copyright 2017 Microsoft Corporation
39
+ * @license https://github.com/azure/azure-storage-php/LICENSE
40
+ * @link https://github.com/azure/azure-storage-php
41
+ */
42
+ class BlobSharedAccessSignatureHelper extends SharedAccessSignatureHelper
43
+ {
44
+ /**
45
+ * Constructor.
46
+ *
47
+ * @param string $accountName the name of the storage account.
48
+ * @param string $accountKey the shared key of the storage account
49
+ *
50
+ */
51
+ public function __construct($accountName, $accountKey)
52
+ {
53
+ parent::__construct($accountName, $accountKey);
54
+ }
55
+
56
+ /**
57
+ * Generates Blob service shared access signature.
58
+ *
59
+ * This only supports version 2015-04-05 and later.
60
+ *
61
+ * @param string $signedResource Resource name to generate the
62
+ * canonicalized resource.
63
+ * It can be Resources::RESOURCE_TYPE_BLOB
64
+ * or Resources::RESOURCE_TYPE_CONTAINER.
65
+ * @param string $resourceName The name of the resource, including
66
+ * the path of the resource. It should be
67
+ * - {container}/{blob}: for blobs,
68
+ * - {container}: for containers, e.g.:
69
+ * mymusic/music.mp3 or
70
+ * music.mp3
71
+ * @param string $signedPermissions Signed permissions.
72
+ * @param \Datetime|string $signedExpiry Signed expiry date.
73
+ * @param \Datetime|string $signedStart Signed start date.
74
+ * @param string $signedIP Signed IP address.
75
+ * @param string $signedProtocol Signed protocol.
76
+ * @param string $signedIdentifier Signed identifier.
77
+ * @param string $cacheControl Cache-Control header (rscc).
78
+ * @param string $contentDisposition Content-Disposition header (rscd).
79
+ * @param string $contentEncoding Content-Encoding header (rsce).
80
+ * @param string $contentLanguage Content-Language header (rscl).
81
+ * @param string $contentType Content-Type header (rsct).
82
+ *
83
+ * @see Constructing an service SAS at
84
+ * https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
85
+ * @return string
86
+ */
87
+ public function generateBlobServiceSharedAccessSignatureToken(
88
+ $signedResource,
89
+ $resourceName,
90
+ $signedPermissions,
91
+ $signedExpiry,
92
+ $signedStart = "",
93
+ $signedIP = "",
94
+ $signedProtocol = "",
95
+ $signedIdentifier = "",
96
+ $cacheControl = "",
97
+ $contentDisposition = "",
98
+ $contentEncoding = "",
99
+ $contentLanguage = "",
100
+ $contentType = ""
101
+ )
102
+ {
103
+ // check that the resource name is valid.
104
+ Validate::canCastAsString($signedResource, 'signedResource');
105
+ Validate::notNullOrEmpty($signedResource, 'signedResource');
106
+ Validate::isTrue(
107
+ $signedResource == Resources::RESOURCE_TYPE_BLOB ||
108
+ $signedResource == Resources::RESOURCE_TYPE_CONTAINER,
109
+ \sprintf(
110
+ Resources::INVALID_VALUE_MSG,
111
+ '$signedResource',
112
+ 'Can only be \'b\' or \'c\'.'
113
+ )
114
+ );
115
+
116
+ // check that the resource name is valid.
117
+ Validate::notNullOrEmpty($resourceName, 'resourceName');
118
+ Validate::canCastAsString($resourceName, 'resourceName');
119
+
120
+ // validate and sanitize signed permissions
121
+ $signedPermissions = $this->validateAndSanitizeStringWithArray(
122
+ strtolower($signedPermissions),
123
+ Resources::ACCESS_PERMISSIONS[$signedResource]
124
+ );
125
+
126
+ // check that expiry is valid
127
+ if ($signedExpiry instanceof \Datetime) {
128
+ $signedExpiry = Utilities::isoDate($signedExpiry);
129
+ }
130
+ Validate::notNullOrEmpty($signedExpiry, 'signedExpiry');
131
+ Validate::canCastAsString($signedExpiry, 'signedExpiry');
132
+ Validate::isDateString($signedExpiry, 'signedExpiry');
133
+
134
+ // check that signed start is valid
135
+ if ($signedStart instanceof \Datetime) {
136
+ $signedStart = Utilities::isoDate($signedStart);
137
+ }
138
+ Validate::canCastAsString($signedStart, 'signedStart');
139
+ if (strlen($signedStart) > 0) {
140
+ Validate::isDateString($signedStart, 'signedStart');
141
+ }
142
+
143
+ // check that signed IP is valid
144
+ Validate::canCastAsString($signedIP, 'signedIP');
145
+
146
+ // validate and sanitize signed protocol
147
+ $signedProtocol = $this->validateAndSanitizeSignedProtocol($signedProtocol);
148
+
149
+ // check that signed identifier is valid
150
+ Validate::canCastAsString($signedIdentifier, 'signedIdentifier');
151
+ Validate::isTrue(
152
+ strlen($signedIdentifier) <= 64,
153
+ sprintf(Resources::INVALID_STRING_LENGTH, 'signedIdentifier', 'maximum 64')
154
+ );
155
+
156
+ Validate::canCastAsString($cacheControl, 'cacheControl');
157
+ Validate::canCastAsString($contentDisposition, 'contentDisposition');
158
+ Validate::canCastAsString($contentEncoding, 'contentEncoding');
159
+ Validate::canCastAsString($contentLanguage, 'contentLanguage');
160
+ Validate::canCastAsString($contentType, 'contentType');
161
+
162
+ // construct an array with the parameters to generate the shared access signature at the account level
163
+ $parameters = array();
164
+ $parameters[] = $signedPermissions;
165
+ $parameters[] = $signedStart;
166
+ $parameters[] = $signedExpiry;
167
+ $parameters[] = static::generateCanonicalResource(
168
+ $this->accountName,
169
+ Resources::RESOURCE_TYPE_BLOB,
170
+ $resourceName
171
+ );
172
+ $parameters[] = $signedIdentifier;
173
+ $parameters[] = $signedIP;
174
+ $parameters[] = $signedProtocol;
175
+ $parameters[] = Resources::STORAGE_API_LATEST_VERSION;
176
+ $parameters[] = $cacheControl;
177
+ $parameters[] = $contentDisposition;
178
+ $parameters[] = $contentEncoding;
179
+ $parameters[] = $contentLanguage;
180
+ $parameters[] = $contentType;
181
+
182
+ // implode the parameters into a string
183
+ $stringToSign = utf8_encode(implode("\n", $parameters));
184
+ // decode the account key from base64
185
+ $decodedAccountKey = base64_decode($this->accountKey);
186
+ // create the signature with hmac sha256
187
+ $signature = hash_hmac("sha256", $stringToSign, $decodedAccountKey, true);
188
+ // encode the signature as base64
189
+ $sig = urlencode(base64_encode($signature));
190
+
191
+ $buildOptQueryStr = function ($string, $abrv) {
192
+ return $string === '' ? '' : $abrv . $string;
193
+ };
194
+ //adding all the components for account SAS together.
195
+ $sas = 'sv=' . Resources::STORAGE_API_LATEST_VERSION;
196
+ $sas .= '&sr=' . $signedResource;
197
+ $sas .= $buildOptQueryStr($cacheControl, '&rscc=');
198
+ $sas .= $buildOptQueryStr($contentDisposition, '&rscd=');
199
+ $sas .= $buildOptQueryStr($contentEncoding, '&rsce=');
200
+ $sas .= $buildOptQueryStr($contentLanguage, '&rscl=');
201
+ $sas .= $buildOptQueryStr($contentType, '&rsct=');
202
+
203
+ $sas .= $buildOptQueryStr($signedStart, '&st=');
204
+ $sas .= '&se=' . $signedExpiry;
205
+ $sas .= '&sp=' . $signedPermissions;
206
+ $sas .= $buildOptQueryStr($signedIP, '&sip=');
207
+ $sas .= $buildOptQueryStr($signedProtocol, '&spr=');
208
+ $sas .= $buildOptQueryStr($signedIdentifier, '&si=');
209
+ $sas .= '&sig=' . $sig;
210
+
211
+ return $sas;
212
+ }
213
+ }
vendor/microsoft/azure-storage-blob/src/Blob/Internal/BlobResources.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Common\Internal
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Internal;
26
+
27
+ use MicrosoftAzure\Storage\Common\Internal\Resources;
28
+
29
+ /**
30
+ * Project resources.
31
+ *
32
+ * @ignore
33
+ * @category Microsoft
34
+ * @package MicrosoftAzure\Storage\Common\Internal
35
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
36
+ * @copyright 2017 Microsoft Corporation
37
+ * @license https://github.com/azure/azure-storage-php/LICENSE
38
+ * @link https://github.com/azure/azure-storage-php
39
+ */
40
+ class BlobResources extends Resources
41
+ {
42
+ // @codingStandardsIgnoreStart
43
+
44
+ const BLOB_SDK_VERSION = '1.4.0';
45
+ const STORAGE_API_LATEST_VERSION = '2017-11-09';
46
+
47
+ // Error messages
48
+ const INVALID_BTE_MSG = "The blob block type must exist in %s";
49
+ const INVALID_BLOB_PAT_MSG = 'The provided access type is invalid.';
50
+ const INVALID_ACH_MSG = 'The provided access condition header is invalid';
51
+ const ERROR_TOO_LARGE_FOR_BLOCK_BLOB = 'Error: Exceeds the upper limit of the blob.';
52
+ const ERROR_RANGE_NOT_ALIGN_TO_512 = 'Error: Range of the page blob must be align to 512';
53
+ const ERROR_CONTAINER_NOT_EXIST = 'The specified container does not exist';
54
+ const ERROR_BLOB_NOT_EXIST = 'The specified blob does not exist';
55
+ const CONTENT_SIZE_TOO_LARGE = 'The content is too large for the selected blob type.';
56
+
57
+ // Headers
58
+ const X_MS_BLOB_PUBLIC_ACCESS = 'x-ms-blob-public-access';
59
+ const X_MS_BLOB_SEQUENCE_NUMBER = 'x-ms-blob-sequence-number';
60
+ const X_MS_BLOB_SEQUENCE_NUMBER_ACTION = 'x-ms-sequence-number-action';
61
+ const X_MS_BLOB_TYPE = 'x-ms-blob-type';
62
+ const X_MS_BLOB_CONTENT_TYPE = 'x-ms-blob-content-type';
63
+ const X_MS_BLOB_CONTENT_ENCODING = 'x-ms-blob-content-encoding';
64
+ const X_MS_BLOB_CONTENT_LANGUAGE = 'x-ms-blob-content-language';
65
+ const X_MS_BLOB_CONTENT_MD5 = 'x-ms-blob-content-md5';
66
+ const X_MS_BLOB_CACHE_CONTROL = 'x-ms-blob-cache-control';
67
+ const X_MS_BLOB_CONTENT_DISPOSITION = 'x-ms-blob-content-disposition';
68
+ const X_MS_BLOB_CONTENT_LENGTH = 'x-ms-blob-content-length';
69
+ const X_MS_BLOB_CONDITION_MAXSIZE = 'x-ms-blob-condition-maxsize';
70
+ const X_MS_BLOB_CONDITION_APPENDPOS = 'x-ms-blob-condition-appendpos';
71
+ const X_MS_BLOB_APPEND_OFFSET = 'x-ms-blob-append-offset';
72
+ const X_MS_BLOB_COMMITTED_BLOCK_COUNT = 'x-ms-blob-committed-block-count';
73
+ const X_MS_LEASE_DURATION = 'x-ms-lease-duration';
74
+ const X_MS_LEASE_ID = 'x-ms-lease-id';
75
+ const X_MS_LEASE_TIME = 'x-ms-lease-time';
76
+ const X_MS_LEASE_STATUS = 'x-ms-lease-status';
77
+ const X_MS_LEASE_STATE = 'x-ms-lease-state';
78
+ const X_MS_LEASE_ACTION = 'x-ms-lease-action';
79
+ const X_MS_PROPOSED_LEASE_ID = 'x-ms-proposed-lease-id';
80
+ const X_MS_LEASE_BREAK_PERIOD = 'x-ms-lease-break-period';
81
+ const X_MS_PAGE_WRITE = 'x-ms-page-write';
82
+ const X_MS_REQUEST_SERVER_ENCRYPTED = 'x-ms-request-server-encrypted';
83
+ const X_MS_SERVER_ENCRYPTED = 'x-ms-server-encrypted';
84
+ const X_MS_INCREMENTAL_COPY = 'x-ms-incremental-copy';
85
+ const X_MS_COPY_DESTINATION_SNAPSHOT = 'x-ms-copy-destination-snapshot';
86
+ const X_MS_ACCESS_TIER = 'x-ms-access-tier';
87
+ const X_MS_ACCESS_TIER_INFERRED = 'x-ms-access-tier-inferred';
88
+ const X_MS_ACCESS_TIER_CHANGE_TIME = 'x-ms-access-tier-change-time';
89
+ const X_MS_ARCHIVE_STATUS = 'x-ms-archive-status';
90
+ const MAX_BLOB_SIZE = 'x-ms-blob-condition-maxsize';
91
+ const MAX_APPEND_POSITION = 'x-ms-blob-condition-appendpos';
92
+ const SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL = 'x-ms-if-sequence-number-le';
93
+ const SEQUENCE_NUMBER_LESS_THAN = 'x-ms-if-sequence-number-lt';
94
+ const SEQUENCE_NUMBER_EQUAL = 'x-ms-if-sequence-number-eq';
95
+ const BLOB_CONTENT_MD5 = 'x-ms-blob-content-md5';
96
+
97
+ // Query parameters
98
+ const QP_DELIMITER = 'Delimiter';
99
+ const QP_BLOCKID = 'blockid';
100
+ const QP_BLOCK_LIST_TYPE = 'blocklisttype';
101
+ const QP_PRE_SNAPSHOT = 'prevsnapshot';
102
+
103
+ // Resource permissions
104
+ const ACCESS_PERMISSIONS = [
105
+ Resources::RESOURCE_TYPE_BLOB => ['r', 'a', 'c', 'w', 'd'],
106
+ Resources::RESOURCE_TYPE_CONTAINER => ['r', 'a', 'c', 'w', 'd', 'l']
107
+ ];
108
+
109
+ // @codingStandardsIgnoreEnd
110
+ }
vendor/microsoft/azure-storage-blob/src/Blob/Internal/IBlob.php ADDED
@@ -0,0 +1,1588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Internal
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Internal;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Models as BlobModels;
28
+ use MicrosoftAzure\Storage\Common\Models\ServiceOptions;
29
+ use MicrosoftAzure\Storage\Common\Models\ServiceProperties;
30
+ use MicrosoftAzure\Storage\Common\Models\Range;
31
+
32
+ /**
33
+ * This interface has all REST APIs provided by Windows Azure for Blob service.
34
+ *
35
+ * @ignore
36
+ * @category Microsoft
37
+ * @package MicrosoftAzure\Storage\Blob\Internal
38
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
39
+ * @copyright 2016 Microsoft Corporation
40
+ * @license https://github.com/azure/azure-storage-php/LICENSE
41
+ * @link https://github.com/azure/azure-storage-php
42
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135733.aspx
43
+ */
44
+ interface IBlob
45
+ {
46
+ /**
47
+ * Gets the properties of the service.
48
+ *
49
+ * @param ServiceOptions $options optional service options.
50
+ *
51
+ * @return GetServicePropertiesResult
52
+ *
53
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh452239.aspx
54
+ */
55
+ public function getServiceProperties(ServiceOptions $options = null);
56
+
57
+ /**
58
+ * Creates promise to get the properties of the service.
59
+ *
60
+ * @param ServiceOptions $options The optional parameters.
61
+ *
62
+ * @return \GuzzleHttp\Promise\PromiseInterface
63
+ *
64
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh452239.aspx
65
+ */
66
+ public function getServicePropertiesAsync(ServiceOptions $options = null);
67
+
68
+ /**
69
+ * Sets the properties of the service.
70
+ *
71
+ * @param ServiceProperties $serviceProperties new service properties
72
+ * @param ServiceOptions $options optional parameters
73
+ *
74
+ * @return void
75
+ *
76
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh452235.aspx
77
+ */
78
+ public function setServiceProperties(
79
+ ServiceProperties $serviceProperties,
80
+ ServiceOptions $options = null
81
+ );
82
+
83
+ /**
84
+ * Retieves statistics related to replication for the service. The operation
85
+ * will only be sent to secondary location endpoint.
86
+ *
87
+ * @param ServiceOptions|null $options The options this operation sends with.
88
+ *
89
+ * @return GetServiceStatsResult
90
+ *
91
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-stats
92
+ */
93
+ public function getServiceStats(ServiceOptions $options = null);
94
+
95
+ /**
96
+ * Creates promise that retrieves statistics related to replication for the
97
+ * service. The operation will only be sent to secondary location endpoint.
98
+ *
99
+ * @param ServiceOptions|null $options The options this operation sends with.
100
+ *
101
+ * @return \GuzzleHttp\Promise\PromiseInterface
102
+ *
103
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-stats
104
+ */
105
+ public function getServiceStatsAsync(ServiceOptions $options = null);
106
+
107
+ /**
108
+ * Creates the promise to set the properties of the service.
109
+ *
110
+ * It's recommended to use getServiceProperties, alter the returned object and
111
+ * then use setServiceProperties with this altered object.
112
+ *
113
+ * @param ServiceProperties $serviceProperties new service properties.
114
+ * @param ServiceOptions $options optional parameters
115
+ *
116
+ * @return \GuzzleHttp\Promise\PromiseInterface
117
+ *
118
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh452235.aspx
119
+ */
120
+ public function setServicePropertiesAsync(
121
+ ServiceProperties $serviceProperties,
122
+ ServiceOptions $options = null
123
+ );
124
+
125
+ /**
126
+ * Lists all of the containers in the given storage account.
127
+ *
128
+ * @param BlobModels\ListContainersOptions $options optional parameters
129
+ *
130
+ * @return BlobModels\ListContainersResult
131
+ *
132
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179352.aspx
133
+ */
134
+ public function listContainers(BlobModels\ListContainersOptions $options = null);
135
+
136
+ /**
137
+ * Create a promise for lists all of the containers in the given
138
+ * storage account.
139
+ *
140
+ * @param BlobModels\ListContainersOptions $options The optional parameters.
141
+ *
142
+ * @return \GuzzleHttp\Promise\PromiseInterface
143
+ */
144
+ public function listContainersAsync(
145
+ BlobModels\ListContainersOptions $options = null
146
+ );
147
+
148
+ /**
149
+ * Creates a new container in the given storage account.
150
+ *
151
+ * @param string $container name
152
+ * @param BlobModels\CreateContainerOptions $options optional parameters
153
+ *
154
+ * @return void
155
+ *
156
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179468.aspx
157
+ */
158
+ public function createContainer(
159
+ $container,
160
+ BlobModels\CreateContainerOptions $options = null
161
+ );
162
+
163
+ /**
164
+ * Creates a new container in the given storage account.
165
+ *
166
+ * @param string $container The container name.
167
+ * @param BlobModels\CreateContainerOptions $options The optional parameters.
168
+ *
169
+ * @return \GuzzleHttp\Promise\PromiseInterface
170
+ *
171
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179468.aspx
172
+ */
173
+ public function createContainerAsync(
174
+ $container,
175
+ BlobModels\CreateContainerOptions $options = null
176
+ );
177
+
178
+ /**
179
+ * Creates a new container in the given storage account.
180
+ *
181
+ * @param string $container name
182
+ * @param BlobModels\BlobServiceOptions $options optional parameters
183
+ *
184
+ * @return void
185
+ *
186
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179408.aspx
187
+ */
188
+ public function deleteContainer(
189
+ $container,
190
+ BlobModels\BlobServiceOptions $options = null
191
+ );
192
+
193
+ /**
194
+ * Create a promise for deleting a container.
195
+ *
196
+ * @param string $container name of the container
197
+ * @param BlobModels\BlobServiceOptions $options optional parameters
198
+ *
199
+ * @return \GuzzleHttp\Promise\PromiseInterface
200
+ */
201
+ public function deleteContainerAsync(
202
+ $container,
203
+ BlobModels\BlobServiceOptions $options = null
204
+ );
205
+
206
+ /**
207
+ * Returns all properties and metadata on the container.
208
+ *
209
+ * @param string $container name
210
+ * @param BlobModels\BlobServiceOptions $options optional parameters
211
+ *
212
+ * @return BlobModels\GetContainerPropertiesResult
213
+ *
214
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179370.aspx
215
+ */
216
+ public function getContainerProperties(
217
+ $container,
218
+ BlobModels\BlobServiceOptions $options = null
219
+ );
220
+
221
+ /**
222
+ * Create promise to return all properties and metadata on the container.
223
+ *
224
+ * @param string $container name
225
+ * @param BlobModels\BlobServiceOptions $options optional parameters
226
+ *
227
+ * @return \GuzzleHttp\Promise\PromiseInterface
228
+ *
229
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179370.aspx
230
+ */
231
+ public function getContainerPropertiesAsync(
232
+ $container,
233
+ BlobModels\BlobServiceOptions $options = null
234
+ );
235
+
236
+ /**
237
+ * Returns only user-defined metadata for the specified container.
238
+ *
239
+ * @param string $container name
240
+ * @param BlobModels\BlobServiceOptions $options optional parameters
241
+ *
242
+ * @return BlobModels\GetContainerPropertiesResult
243
+ *
244
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691976.aspx
245
+ */
246
+ public function getContainerMetadata(
247
+ $container,
248
+ BlobModels\BlobServiceOptions $options = null
249
+ );
250
+
251
+ /**
252
+ * Create promise to return only user-defined metadata for the specified
253
+ * container.
254
+ *
255
+ * @param string $container name
256
+ * @param BlobModels\BlobServiceOptions $options optional parameters
257
+ *
258
+ * @return \GuzzleHttp\Promise\PromiseInterface
259
+ *
260
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691976.aspx
261
+ */
262
+ public function getContainerMetadataAsync(
263
+ $container,
264
+ BlobModels\BlobServiceOptions $options = null
265
+ );
266
+
267
+ /**
268
+ * Gets the access control list (ACL) and any container-level access policies
269
+ * for the container.
270
+ *
271
+ * @param string $container name
272
+ * @param BlobModels\BlobServiceOptions $options optional parameters
273
+ *
274
+ * @return BlobModels\GetContainerACLResult
275
+ *
276
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179469.aspx
277
+ */
278
+ public function getContainerAcl(
279
+ $container,
280
+ BlobModels\BlobServiceOptions $options = null
281
+ );
282
+
283
+ /**
284
+ * Creates the promise to get the access control list (ACL) and any
285
+ * container-level access policies for the container.
286
+ *
287
+ * @param string $container The container name.
288
+ * @param BlobModels\BlobServiceOptions $options The optional parameters.
289
+ *
290
+ * @return \GuzzleHttp\Promise\PromiseInterface
291
+ *
292
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179469.aspx
293
+ */
294
+ public function getContainerAclAsync(
295
+ $container,
296
+ BlobModels\BlobServiceOptions $options = null
297
+ );
298
+
299
+ /**
300
+ * Sets the ACL and any container-level access policies for the container.
301
+ *
302
+ * @param string $container name
303
+ * @param BlobModels\ContainerACL $acl access control list for container
304
+ * @param BlobModels\BlobServiceOptions $options optional parameters
305
+ *
306
+ * @return void
307
+ *
308
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179391.aspx
309
+ */
310
+ public function setContainerAcl(
311
+ $container,
312
+ BlobModels\ContainerACL $acl,
313
+ BlobModels\BlobServiceOptions $options = null
314
+ );
315
+
316
+ /**
317
+ * Creates promise to set the ACL and any container-level access policies
318
+ * for the container.
319
+ *
320
+ * @param string $container name
321
+ * @param BlobModels\ContainerACL $acl access control list for container
322
+ * @param BlobModels\BlobServiceOptions $options optional parameters
323
+ *
324
+ * @return \GuzzleHttp\Promise\PromiseInterface
325
+ *
326
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179391.aspx
327
+ */
328
+ public function setContainerAclAsync(
329
+ $container,
330
+ BlobModels\ContainerACL $acl,
331
+ BlobModels\BlobServiceOptions $options = null
332
+ );
333
+
334
+ /**
335
+ * Sets metadata headers on the container.
336
+ *
337
+ * @param string $container name
338
+ * @param array $metadata metadata key/value pair.
339
+ * @param BlobModels\BlobServiceOptions $options optional parameters
340
+ *
341
+ * @return void
342
+ *
343
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179362.aspx
344
+ */
345
+ public function setContainerMetadata(
346
+ $container,
347
+ array $metadata,
348
+ BlobModels\BlobServiceOptions $options = null
349
+ );
350
+
351
+ /**
352
+ * Sets metadata headers on the container.
353
+ *
354
+ * @param string $container name
355
+ * @param array $metadata metadata key/value pair.
356
+ * @param BlobModels\BlobServiceOptions $options optional parameters
357
+ *
358
+ * @return \GuzzleHttp\Promise\PromiseInterface
359
+ *
360
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179362.aspx
361
+ */
362
+ public function setContainerMetadataAsync(
363
+ $container,
364
+ array $metadata,
365
+ BlobModels\BlobServiceOptions $options = null
366
+ );
367
+
368
+ /**
369
+ * Lists all of the blobs in the given container.
370
+ *
371
+ * @param string $container name
372
+ * @param BlobModels\ListBlobsOptions $options optional parameters
373
+ *
374
+ * @return BlobModels\ListBlobsResult
375
+ *
376
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135734.aspx
377
+ */
378
+ public function listBlobs(
379
+ $container,
380
+ BlobModels\ListBlobsOptions $options = null
381
+ );
382
+
383
+ /**
384
+ * Creates promise to list all of the blobs in the given container.
385
+ *
386
+ * @param string $container The container name.
387
+ * @param BlobModels\ListBlobsOptions $options The optional parameters.
388
+ *
389
+ * @return \GuzzleHttp\Promise\PromiseInterface
390
+ *
391
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135734.aspx
392
+ */
393
+ public function listBlobsAsync(
394
+ $container,
395
+ BlobModels\ListBlobsOptions $options = null
396
+ );
397
+
398
+ /**
399
+ * Creates a new page blob. Note that calling createPageBlob to create a page
400
+ * blob only initializes the blob.
401
+ * To add content to a page blob, call createBlobPages method.
402
+ *
403
+ * @param string $container name of the container
404
+ * @param string $blob name of the blob
405
+ * @param int $length specifies the maximum size
406
+ * for the page blob, up to 1 TB. The page blob size must be aligned to
407
+ * a 512-byte boundary.
408
+ * @param BlobModels\CreatePageBlobOptions $options optional parameters
409
+ *
410
+ * @return BlobModels\PutBlobResult
411
+ *
412
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
413
+ */
414
+ public function createPageBlob(
415
+ $container,
416
+ $blob,
417
+ $length,
418
+ BlobModels\CreatePageBlobOptions $options = null
419
+ );
420
+
421
+ /**
422
+ * Creates promise to create a new page blob. Note that calling
423
+ * createPageBlob to create a page blob only initializes the blob.
424
+ * To add content to a page blob, call createBlobPages method.
425
+ *
426
+ * @param string $container The container name.
427
+ * @param string $blob The blob name.
428
+ * @param integer $length Specifies the maximum size
429
+ * for the page blob, up to
430
+ * 1 TB. The page blob size
431
+ * must be aligned to a
432
+ * 512-byte boundary.
433
+ * @param BlobModels\CreatePageBlobOptions $options The optional parameters.
434
+ *
435
+ * @return \GuzzleHttp\Promise\PromiseInterface
436
+ *
437
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
438
+ */
439
+ public function createPageBlobAsync(
440
+ $container,
441
+ $blob,
442
+ $length,
443
+ BlobModels\CreatePageBlobOptions $options = null
444
+ );
445
+
446
+ /**
447
+ * Create a new append blob.
448
+ * If the blob already exists on the service, it will be overwritten.
449
+ *
450
+ * @param string $container The container name.
451
+ * @param string $blob The blob name.
452
+ * @param BlobModels\CreateBlobOptions $options The optional parameters.
453
+ *
454
+ * @return BlobModels\PutBlobResult
455
+ *
456
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
457
+ */
458
+ public function createAppendBlob(
459
+ $container,
460
+ $blob,
461
+ BlobModels\CreateBlobOptions $options = null
462
+ );
463
+
464
+
465
+ /**
466
+ * Creates promise to create a new append blob.
467
+ * If the blob already exists on the service, it will be overwritten.
468
+ *
469
+ * @param string $container The container name.
470
+ * @param string $blob The blob name.
471
+ * @param BlobModels\CreateBlobOptions $options The optional parameters.
472
+ *
473
+ * @return \GuzzleHttp\Promise\PromiseInterface
474
+ *
475
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
476
+ */
477
+ public function createAppendBlobAsync(
478
+ $container,
479
+ $blob,
480
+ BlobModels\CreateBlobOptions $options = null
481
+ );
482
+
483
+ /**
484
+ * Creates a new block blob or updates the content of an existing block blob.
485
+ * Updating an existing block blob overwrites any existing metadata on the blob.
486
+ * Partial updates are not supported with createBlockBlob; the content of the
487
+ * existing blob is overwritten with the content of the new blob. To perform a
488
+ * partial update of the content of a block blob, use the createBlockList method.
489
+ *
490
+ * @param string $container name of the container
491
+ * @param string $blob name of the blob
492
+ * @param string|resource|StreamInterface $content content of the blob
493
+ * @param BlobModels\CreateBlockBlobOptions $options optional parameters
494
+ *
495
+ * @return BlobModels\PutBlobResult
496
+ *
497
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
498
+ */
499
+ public function createBlockBlob(
500
+ $container,
501
+ $blob,
502
+ $content,
503
+ BlobModels\CreateBlockBlobOptions $options = null
504
+ );
505
+
506
+ /**
507
+ * Creates a promise to create a new block blob or updates the content of
508
+ * an existing block blob.
509
+ *
510
+ * Updating an existing block blob overwrites any existing metadata on the blob.
511
+ * Partial updates are not supported with createBlockBlob the content of the
512
+ * existing blob is overwritten with the content of the new blob. To perform a
513
+ * partial update of the content of a block blob, use the createBlockList
514
+ * method.
515
+ *
516
+ * @param string $container The name of the container.
517
+ * @param string $blob The name of the blob.
518
+ * @param string|resource|StreamInterface $content The content of the blob.
519
+ * @param BlobModels\CreateBlockBlobOptions $options The optional parameters.
520
+ *
521
+ * @return \GuzzleHttp\Promise\PromiseInterface
522
+ *
523
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
524
+ */
525
+ public function createBlockBlobAsync(
526
+ $container,
527
+ $blob,
528
+ $content,
529
+ BlobModels\CreateBlockBlobOptions $options = null
530
+ );
531
+
532
+ /**
533
+ * Create a new page blob and upload the content to the page blob.
534
+ *
535
+ * @param string $container The name of the container.
536
+ * @param string $blob The name of the blob.
537
+ * @param int $length The length of the blob.
538
+ * @param string|resource|StreamInterface $content The content of the blob.
539
+ * @param BlobModels\CreatePageBlobFromContentOptions
540
+ * $options The optional parameters.
541
+ *
542
+ * @return BlobModels\GetBlobPropertiesResult
543
+ *
544
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-properties
545
+ */
546
+ public function createPageBlobFromContent(
547
+ $container,
548
+ $blob,
549
+ $length,
550
+ $content,
551
+ BlobModels\CreatePageBlobFromContentOptions $options = null
552
+ );
553
+
554
+ /**
555
+ * Creates a promise to create a new page blob and upload the content
556
+ * to the page blob.
557
+ *
558
+ * @param string $container The name of the container.
559
+ * @param string $blob The name of the blob.
560
+ * @param int $length The length of the blob.
561
+ * @param string|resource|StreamInterface $content The content of the blob.
562
+ * @param BlobModels\CreatePageBlobFromContentOptions
563
+ * $options The optional parameters.
564
+ *
565
+ * @return \GuzzleHttp\Promise\PromiseInterface
566
+ *
567
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-properties
568
+ */
569
+ public function createPageBlobFromContentAsync(
570
+ $container,
571
+ $blob,
572
+ $length,
573
+ $content,
574
+ BlobModels\CreatePageBlobFromContentOptions $options = null
575
+ );
576
+
577
+ /**
578
+ * Clears a range of pages from the blob.
579
+ *
580
+ * @param string $container name of the container
581
+ * @param string $blob name of the blob
582
+ * @param Range $range Can be up to the value
583
+ * of the blob's full size.
584
+ * @param BlobModels\CreateBlobPagesOptions $options optional parameters
585
+ *
586
+ * @return BlobModels\CreateBlobPagesResult.
587
+ *
588
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
589
+ */
590
+ public function clearBlobPages(
591
+ $container,
592
+ $blob,
593
+ Range $range,
594
+ BlobModels\CreateBlobPagesOptions $options = null
595
+ );
596
+
597
+ /**
598
+ * Creates promise to clear a range of pages from the blob.
599
+ *
600
+ * @param string $container name of the container
601
+ * @param string $blob name of the blob
602
+ * @param Range $range Can be up to the value
603
+ * of the blob's full size.
604
+ * Note that ranges must be
605
+ * aligned to 512 (0-511,
606
+ * 512-1023)
607
+ * @param BlobModels\CreateBlobPagesOptions $options optional parameters
608
+ *
609
+ * @return \GuzzleHttp\Promise\PromiseInterface
610
+ *
611
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
612
+ */
613
+ public function clearBlobPagesAsync(
614
+ $container,
615
+ $blob,
616
+ Range $range,
617
+ BlobModels\CreateBlobPagesOptions $options = null
618
+ );
619
+
620
+ /**
621
+ * Creates a range of pages to a page blob.
622
+ *
623
+ * @param string $container name of the container
624
+ * @param string $blob name of the blob
625
+ * @param Range $range Can be up to 4 MB in size
626
+ * @param string $content the blob contents
627
+ * @param BlobModels\CreateBlobPagesOptions $options optional parameters
628
+ *
629
+ * @return BlobModels\CreateBlobPagesResult
630
+ *
631
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
632
+ */
633
+ public function createBlobPages(
634
+ $container,
635
+ $blob,
636
+ Range $range,
637
+ $content,
638
+ BlobModels\CreateBlobPagesOptions $options = null
639
+ );
640
+
641
+ /**
642
+ * Creates promise to create a range of pages to a page blob.
643
+ *
644
+ * @param string $container name of the container
645
+ * @param string $blob name of the blob
646
+ * @param Range $range Can be up to 4 MB in
647
+ * size. Note that ranges
648
+ * must be aligned to 512
649
+ * (0-511, 512-1023)
650
+ * @param string|resource|StreamInterface $content the blob contents.
651
+ * @param BlobModels\CreateBlobPagesOptions $options optional parameters
652
+ *
653
+ * @return \GuzzleHttp\Promise\PromiseInterface
654
+ *
655
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
656
+ */
657
+ public function createBlobPagesAsync(
658
+ $container,
659
+ $blob,
660
+ Range $range,
661
+ $content,
662
+ BlobModels\CreateBlobPagesOptions $options = null
663
+ );
664
+
665
+ /**
666
+ * Creates a new block to be committed as part of a block blob.
667
+ *
668
+ * @param string $container name of the container
669
+ * @param string $blob name of the blob
670
+ * @param string $blockId must be less than or equal to
671
+ * 64 bytes in size. For a given blob, the length of the value specified for the
672
+ * blockid parameter must be the same size for each block.
673
+ * @param string $content the blob block contents
674
+ * @param BlobModels\CreateBlobBlockOptions $options optional parameters
675
+ *
676
+ * @return void
677
+ *
678
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135726.aspx
679
+ */
680
+ public function createBlobBlock(
681
+ $container,
682
+ $blob,
683
+ $blockId,
684
+ $content,
685
+ BlobModels\CreateBlobBlockOptions $options = null
686
+ );
687
+
688
+ /**
689
+ * Creates a new block to be committed as part of a block blob.
690
+ *
691
+ * @param string $container name of the container
692
+ * @param string $blob name of the blob
693
+ * @param string $blockId must be less than or
694
+ * equal to 64 bytes in
695
+ * size. For a given
696
+ * blob, the length of
697
+ * the value specified
698
+ * for the blockid
699
+ * parameter must
700
+ * be the same size for
701
+ * each block.
702
+ * @param resource|string|StreamInterface $content the blob block contents
703
+ * @param BlobModels\CreateBlobBlockOptions $options optional parameters
704
+ *
705
+ * @return \GuzzleHttp\Promise\PromiseInterface
706
+ *
707
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135726.aspx
708
+ */
709
+ public function createBlobBlockAsync(
710
+ $container,
711
+ $blob,
712
+ $blockId,
713
+ $content,
714
+ BlobModels\CreateBlobBlockOptions $options = null
715
+ );
716
+
717
+ /**
718
+ * Commits a new block of data to the end of an existing append blob.
719
+ *
720
+ * @param string $container name of the container
721
+ * @param string $blob name of the blob
722
+ * @param resource|string|StreamInterface $content the blob block contents
723
+ * @param BlobModels\AppendBlockOptions $options optional parameters
724
+ *
725
+ * @return BlobModels\AppendBlockResult
726
+ *
727
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block
728
+ */
729
+ public function appendBlock(
730
+ $container,
731
+ $blob,
732
+ $content,
733
+ BlobModels\AppendBlockOptions $options = null
734
+ );
735
+
736
+ /**
737
+ * Creates promise to commit a new block of data to the end of an existing append blob.
738
+ *
739
+ * @param string $container name of the container
740
+ * @param string $blob name of the blob
741
+ * @param resource|string|StreamInterface $content the blob block contents
742
+ * @param BlobModels\AppendBlockOptions $options optional parameters
743
+ *
744
+ * @return \GuzzleHttp\Promise\PromiseInterface
745
+ *
746
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block
747
+ */
748
+ public function appendBlockAsync(
749
+ $container,
750
+ $blob,
751
+ $content,
752
+ BlobModels\AppendBlockOptions $options = null
753
+ );
754
+
755
+ /**
756
+ * This method writes a blob by specifying the list of block IDs that make up the
757
+ * blob. In order to be written as part of a blob, a block must have been
758
+ * successfully written to the server in a prior createBlobBlock method.
759
+ *
760
+ * You can call Put Block List to update a blob by uploading only those blocks
761
+ * that have changed, then committing the new and existing blocks together.
762
+ * You can do this by specifying whether to commit a block from the committed
763
+ * block list or from the uncommitted block list, or to commit the most recently
764
+ * uploaded version of the block, whichever list it may belong to.
765
+ *
766
+ * @param string $container name of the container
767
+ * @param string $blob name of the blob
768
+ * @param BlobModels\BlockList|BlobModels\Block[] $blockList the block list entries
769
+ * @param BlobModels\CommitBlobBlocksOptions $options optional parameters
770
+ *
771
+ * @return BlobModels\PutBlobResult
772
+ *
773
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179467.aspx
774
+ */
775
+ public function commitBlobBlocks(
776
+ $container,
777
+ $blob,
778
+ $blockList,
779
+ BlobModels\CommitBlobBlocksOptions $options = null
780
+ );
781
+
782
+ /**
783
+ * This method writes a blob by specifying the list of block IDs that make up the
784
+ * blob. In order to be written as part of a blob, a block must have been
785
+ * successfully written to the server in a prior createBlobBlock method.
786
+ *
787
+ * You can call Put Block List to update a blob by uploading only those blocks
788
+ * that have changed, then committing the new and existing blocks together.
789
+ * You can do this by specifying whether to commit a block from the committed
790
+ * block list or from the uncommitted block list, or to commit the most recently
791
+ * uploaded version of the block, whichever list it may belong to.
792
+ *
793
+ * @param string $container name of the container
794
+ * @param string $blob name of the blob
795
+ * @param BlobModels\BlockList|BlobModels\Block[] $blockList the block list
796
+ * entries
797
+ * @param BlobModels\CommitBlobBlocksOptions $options optional parameters
798
+ *
799
+ * @return \GuzzleHttp\Promise\PromiseInterface
800
+ *
801
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179467.aspx
802
+ */
803
+ public function commitBlobBlocksAsync(
804
+ $container,
805
+ $blob,
806
+ $blockList,
807
+ BlobModels\CommitBlobBlocksOptions $options = null
808
+ );
809
+
810
+ /**
811
+ * Retrieves the list of blocks that have been uploaded as part of a block blob.
812
+ *
813
+ * There are two block lists maintained for a blob:
814
+ * 1) Committed Block List: The list of blocks that have been successfully
815
+ * committed to a given blob with commitBlobBlocks.
816
+ * 2) Uncommitted Block List: The list of blocks that have been uploaded for a
817
+ * blob using Put Block (REST API), but that have not yet been committed.
818
+ * These blocks are stored in Windows Azure in association with a blob, but do
819
+ * not yet form part of the blob.
820
+ *
821
+ * @param string $container name of the container
822
+ * @param string $blob name of the blob
823
+ * @param BlobModels\ListBlobBlocksOptions $options optional parameters
824
+ *
825
+ * @return BlobModels\ListBlobBlocksResult
826
+ *
827
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179400.aspx
828
+ */
829
+ public function listBlobBlocks(
830
+ $container,
831
+ $blob,
832
+ BlobModels\ListBlobBlocksOptions $options = null
833
+ );
834
+
835
+ /**
836
+ * Creates promise to retrieve the list of blocks that have been uploaded as
837
+ * part of a block blob.
838
+ *
839
+ * There are two block lists maintained for a blob:
840
+ * 1) Committed Block List: The list of blocks that have been successfully
841
+ * committed to a given blob with commitBlobBlocks.
842
+ * 2) Uncommitted Block List: The list of blocks that have been uploaded for a
843
+ * blob using Put Block (REST API), but that have not yet been committed.
844
+ * These blocks are stored in Windows Azure in association with a blob, but do
845
+ * not yet form part of the blob.
846
+ *
847
+ * @param string $container name of the container
848
+ * @param string $blob name of the blob
849
+ * @param BlobModels\ListBlobBlocksOptions $options optional parameters
850
+ *
851
+ * @return \GuzzleHttp\Promise\PromiseInterface
852
+ *
853
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179400.aspx
854
+ */
855
+ public function listBlobBlocksAsync(
856
+ $container,
857
+ $blob,
858
+ BlobModels\ListBlobBlocksOptions $options = null
859
+ );
860
+
861
+ /**
862
+ * Returns all properties and metadata on the blob.
863
+ *
864
+ * @param string $container name of the container
865
+ * @param string $blob name of the blob
866
+ * @param BlobModels\GetBlobPropertiesOptions $options optional parameters
867
+ *
868
+ * @return BlobModels\GetBlobPropertiesResult
869
+ *
870
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179394.aspx
871
+ */
872
+ public function getBlobProperties(
873
+ $container,
874
+ $blob,
875
+ BlobModels\GetBlobPropertiesOptions $options = null
876
+ );
877
+
878
+ /**
879
+ * Creates promise to return all properties and metadata on the blob.
880
+ *
881
+ * @param string $container name of the container
882
+ * @param string $blob name of the blob
883
+ * @param BlobModels\GetBlobPropertiesOptions $options optional parameters
884
+ *
885
+ * @return \GuzzleHttp\Promise\PromiseInterface
886
+ *
887
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179394.aspx
888
+ */
889
+ public function getBlobPropertiesAsync(
890
+ $container,
891
+ $blob,
892
+ BlobModels\GetBlobPropertiesOptions $options = null
893
+ );
894
+
895
+ /**
896
+ * Returns all properties and metadata on the blob.
897
+ *
898
+ * @param string $container name of the container
899
+ * @param string $blob name of the blob
900
+ * @param BlobModels\GetBlobMetadataOptions $options optional parameters
901
+ *
902
+ * @return BlobModels\GetBlobMetadataResult
903
+ *
904
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179350.aspx
905
+ */
906
+ public function getBlobMetadata(
907
+ $container,
908
+ $blob,
909
+ BlobModels\GetBlobMetadataOptions $options = null
910
+ );
911
+
912
+ /**
913
+ * Creates promise to return all properties and metadata on the blob.
914
+ *
915
+ * @param string $container name of the container
916
+ * @param string $blob name of the blob
917
+ * @param BlobModels\GetBlobMetadataOptions $options optional parameters
918
+ *
919
+ * @return \GuzzleHttp\Promise\PromiseInterface
920
+ *
921
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179350.aspx
922
+ */
923
+ public function getBlobMetadataAsync(
924
+ $container,
925
+ $blob,
926
+ BlobModels\GetBlobMetadataOptions $options = null
927
+ );
928
+
929
+ /**
930
+ * Returns a list of active page ranges for a page blob. Active page ranges are
931
+ * those that have been populated with data.
932
+ *
933
+ * @param string $container name of the container
934
+ * @param string $blob name of the blob
935
+ * @param BlobModels\ListPageBlobRangesOptions $options optional parameters
936
+ *
937
+ * @return BlobModels\ListPageBlobRangesResult
938
+ *
939
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx
940
+ */
941
+ public function listPageBlobRanges(
942
+ $container,
943
+ $blob,
944
+ BlobModels\ListPageBlobRangesOptions $options = null
945
+ );
946
+
947
+ /**
948
+ * Creates promise to return a list of active page ranges for a page blob.
949
+ * Active page ranges are those that have been populated with data.
950
+ *
951
+ * @param string $container name of the
952
+ * container
953
+ * @param string $blob name of the blob
954
+ * @param BlobModels\ListPageBlobRangesOptions $options optional parameters
955
+ *
956
+ * @return \GuzzleHttp\Promise\PromiseInterface
957
+ *
958
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx
959
+ */
960
+ public function listPageBlobRangesAsync(
961
+ $container,
962
+ $blob,
963
+ BlobModels\ListPageBlobRangesOptions $options = null
964
+ );
965
+
966
+ /**
967
+ * Returns a list of page ranges that have been updated or cleared.
968
+ *
969
+ * Returns a list of page ranges that have been updated or cleared since
970
+ * the snapshot specified by `previousSnapshotTime`. Gets all of the page
971
+ * ranges by default, or only the page ranges over a specific range of
972
+ * bytes if `rangeStart` and `rangeEnd` in the `options` are specified.
973
+ *
974
+ * @param string $container name of the container
975
+ * @param string $blob name of the blob
976
+ * @param string $previousSnapshotTime previous snapshot time
977
+ * for comparison which
978
+ * should be prior to the
979
+ * snapshot time defined
980
+ * in `options`
981
+ * @param BlobModels\ListPageBlobRangesOptions $options optional parameters
982
+ *
983
+ * @return BlobModels\ListPageBlobRangesDiffResult
984
+ *
985
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/version-2015-07-08
986
+ */
987
+ public function listPageBlobRangesDiff(
988
+ $container,
989
+ $blob,
990
+ $previousSnapshotTime,
991
+ BlobModels\ListPageBlobRangesOptions $options = null
992
+ );
993
+
994
+ /**
995
+ * Creates promise to return a list of page ranges that have been updated
996
+ * or cleared.
997
+ *
998
+ * Creates promise to return a list of page ranges that have been updated
999
+ * or cleared since the snapshot specified by `previousSnapshotTime`. Gets
1000
+ * all of the page ranges by default, or only the page ranges over a specific
1001
+ * range of bytes if `rangeStart` and `rangeEnd` in the `options` are specified.
1002
+ *
1003
+ * @param string $container name of the container
1004
+ * @param string $blob name of the blob
1005
+ * @param string $previousSnapshotTime previous snapshot time
1006
+ * for comparison which
1007
+ * should be prior to the
1008
+ * snapshot time defined
1009
+ * in `options`
1010
+ * @param BlobModels\ListPageBlobRangesOptions $options optional parameters
1011
+ *
1012
+ * @return \GuzzleHttp\Promise\PromiseInterface
1013
+ *
1014
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx
1015
+ */
1016
+ public function listPageBlobRangesDiffAsync(
1017
+ $container,
1018
+ $blob,
1019
+ $previousSnapshotTime,
1020
+ BlobModels\ListPageBlobRangesOptions $options = null
1021
+ );
1022
+
1023
+ /**
1024
+ * Sets blob tier on the blob.
1025
+ *
1026
+ * @param string $container name
1027
+ * @param string $blob name of the blob
1028
+ * @param BlobModels\SetBlobTierOptions $options optional parameters
1029
+ *
1030
+ * @return void
1031
+ *
1032
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tier
1033
+ */
1034
+ public function setBlobTier(
1035
+ $container,
1036
+ $blob,
1037
+ BlobModels\SetBlobTierOptions $options = null
1038
+ );
1039
+
1040
+ /**
1041
+ * Sets blob tier on the blob.
1042
+ *
1043
+ * @param string $container name
1044
+ * @param string $blob name of the blob
1045
+ * @param BlobModels\SetBlobTierOptions $options optional parameters
1046
+ *
1047
+ * @return \GuzzleHttp\Promise\PromiseInterface
1048
+ *
1049
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tier
1050
+ */
1051
+ public function setBlobTierAsync(
1052
+ $container,
1053
+ $blob,
1054
+ BlobModels\SetBlobTierOptions $options = null
1055
+ );
1056
+
1057
+ /**
1058
+ * Sets system properties defined for a blob.
1059
+ *
1060
+ * @param string $container name of the container
1061
+ * @param string $blob name of the blob
1062
+ * @param BlobModels\SetBlobPropertiesOptions $options optional parameters
1063
+ *
1064
+ * @return BlobModels\SetBlobPropertiesResult
1065
+ *
1066
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691966.aspx
1067
+ */
1068
+ public function setBlobProperties(
1069
+ $container,
1070
+ $blob,
1071
+ BlobModels\SetBlobPropertiesOptions $options = null
1072
+ );
1073
+
1074
+ /**
1075
+ * Creates promise to set system properties defined for a blob.
1076
+ *
1077
+ * @param string $container name of the container
1078
+ * @param string $blob name of the blob
1079
+ * @param BlobModels\SetBlobPropertiesOptions $options optional parameters
1080
+ *
1081
+ * @return \GuzzleHttp\Promise\PromiseInterface
1082
+ *
1083
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691966.aspx
1084
+ */
1085
+ public function setBlobPropertiesAsync(
1086
+ $container,
1087
+ $blob,
1088
+ BlobModels\SetBlobPropertiesOptions $options = null
1089
+ );
1090
+
1091
+ /**
1092
+ * Sets metadata headers on the blob.
1093
+ *
1094
+ * @param string $container name of the container
1095
+ * @param string $blob name of the blob
1096
+ * @param array $metadata key/value pair representation
1097
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1098
+ *
1099
+ * @return BlobModels\SetBlobMetadataResult
1100
+ *
1101
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179414.aspx
1102
+ */
1103
+ public function setBlobMetadata(
1104
+ $container,
1105
+ $blob,
1106
+ array $metadata,
1107
+ BlobModels\BlobServiceOptions $options = null
1108
+ );
1109
+
1110
+ /**
1111
+ * Creates promise to set metadata headers on the blob.
1112
+ *
1113
+ * @param string $container name of the container
1114
+ * @param string $blob name of the blob
1115
+ * @param array $metadata key/value pair representation
1116
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1117
+ *
1118
+ * @return \GuzzleHttp\Promise\PromiseInterface
1119
+ *
1120
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179414.aspx
1121
+ */
1122
+ public function setBlobMetadataAsync(
1123
+ $container,
1124
+ $blob,
1125
+ array $metadata,
1126
+ BlobModels\BlobServiceOptions $options = null
1127
+ );
1128
+
1129
+ /**
1130
+ * Reads or downloads a blob from the system, including its metadata and
1131
+ * properties.
1132
+ *
1133
+ * @param string $container name of the container
1134
+ * @param string $blob name of the blob
1135
+ * @param BlobModels\GetBlobOptions $options optional parameters
1136
+ *
1137
+ * @return BlobModels\GetBlobResult
1138
+ *
1139
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx
1140
+ */
1141
+ public function getBlob(
1142
+ $container,
1143
+ $blob,
1144
+ BlobModels\GetBlobOptions $options = null
1145
+ );
1146
+
1147
+ /**
1148
+ * Creates promise to read or download a blob from the system, including its
1149
+ * metadata and properties.
1150
+ *
1151
+ * @param string $container name of the container
1152
+ * @param string $blob name of the blob
1153
+ * @param BlobModels\GetBlobOptions $options optional parameters
1154
+ *
1155
+ * @return \GuzzleHttp\Promise\PromiseInterface
1156
+ *
1157
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx
1158
+ */
1159
+ public function getBlobAsync(
1160
+ $container,
1161
+ $blob,
1162
+ BlobModels\GetBlobOptions $options = null
1163
+ );
1164
+
1165
+ /**
1166
+ * Deletes a blob or blob snapshot.
1167
+ *
1168
+ * Note that if the snapshot entry is specified in the $options then only this
1169
+ * blob snapshot is deleted. To delete all blob snapshots, do not set Snapshot
1170
+ * and just set getDeleteSnaphotsOnly to true.
1171
+ *
1172
+ * @param string $container name of the container
1173
+ * @param string $blob name of the blob
1174
+ * @param BlobModels\DeleteBlobOptions $options optional parameters
1175
+ *
1176
+ * @return void
1177
+ *
1178
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179413.aspx
1179
+ */
1180
+ public function deleteBlob(
1181
+ $container,
1182
+ $blob,
1183
+ BlobModels\DeleteBlobOptions $options = null
1184
+ );
1185
+
1186
+ /**
1187
+ * Creates promise to delete a blob or blob snapshot.
1188
+ *
1189
+ * Note that if the snapshot entry is specified in the $options then only this
1190
+ * blob snapshot is deleted. To delete all blob snapshots, do not set Snapshot
1191
+ * and just set getDeleteSnaphotsOnly to true.
1192
+ *
1193
+ * @param string $container name of the container
1194
+ * @param string $blob name of the blob
1195
+ * @param BlobModels\DeleteBlobOptions $options optional parameters
1196
+ *
1197
+ * @return \GuzzleHttp\Promise\PromiseInterface
1198
+ *
1199
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179413.aspx
1200
+ */
1201
+ public function deleteBlobAsync(
1202
+ $container,
1203
+ $blob,
1204
+ BlobModels\DeleteBlobOptions $options = null
1205
+ );
1206
+
1207
+ /**
1208
+ * Creates a snapshot of a blob.
1209
+ *
1210
+ * @param string $container name of the container
1211
+ * @param string $blob name of the blob
1212
+ * @param BlobModels\CreateBlobSnapshotOptions $options optional parameters
1213
+ *
1214
+ * @return BlobModels\CreateBlobSnapshotResult
1215
+ *
1216
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691971.aspx
1217
+ */
1218
+ public function createBlobSnapshot(
1219
+ $container,
1220
+ $blob,
1221
+ BlobModels\CreateBlobSnapshotOptions $options = null
1222
+ );
1223
+
1224
+ /**
1225
+ * Creates promise to create a snapshot of a blob.
1226
+ *
1227
+ * @param string $container The name of the
1228
+ * container.
1229
+ * @param string $blob The name of the
1230
+ * blob.
1231
+ * @param BlobModels\CreateBlobSnapshotOptions $options The optional
1232
+ * parameters.
1233
+ *
1234
+ * @return \GuzzleHttp\Promise\PromiseInterface
1235
+ *
1236
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691971.aspx
1237
+ */
1238
+ public function createBlobSnapshotAsync(
1239
+ $container,
1240
+ $blob,
1241
+ BlobModels\CreateBlobSnapshotOptions $options = null
1242
+ );
1243
+
1244
+ /**
1245
+ * Copies a source blob to a destination blob within the same storage account.
1246
+ *
1247
+ * @param string $destinationContainer name of container
1248
+ * @param string $destinationBlob name of blob
1249
+ * @param string $sourceContainer name of container
1250
+ * @param string $sourceBlob name of blob
1251
+ * @param BlobModels\CopyBlobOptions $options optional parameters
1252
+ *
1253
+ * @return BlobModels\CopyBlobResult
1254
+ *
1255
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
1256
+ */
1257
+ public function copyBlob(
1258
+ $destinationContainer,
1259
+ $destinationBlob,
1260
+ $sourceContainer,
1261
+ $sourceBlob,
1262
+ BlobModels\CopyBlobOptions $options = null
1263
+ );
1264
+
1265
+ /**
1266
+ * Creates promise to copy a source blob to a destination blob within the
1267
+ * same storage account.
1268
+ *
1269
+ * @param string $destinationContainer name of the
1270
+ * destination
1271
+ * container
1272
+ * @param string $destinationBlob name of the
1273
+ * destination blob
1274
+ * @param string $sourceContainer name of the source
1275
+ * container
1276
+ * @param string $sourceBlob name of the source
1277
+ * blob
1278
+ * @param BlobModels\CopyBlobOptions $options optional parameters
1279
+ *
1280
+ * @return \GuzzleHttp\Promise\PromiseInterface
1281
+ *
1282
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
1283
+ */
1284
+ public function copyBlobAsync(
1285
+ $destinationContainer,
1286
+ $destinationBlob,
1287
+ $sourceContainer,
1288
+ $sourceBlob,
1289
+ BlobModels\CopyBlobOptions $options = null
1290
+ );
1291
+
1292
+ /**
1293
+ * Copies from a source URL to a destination blob.
1294
+ *
1295
+ * @param string $destinationContainer name of the
1296
+ * destination
1297
+ * container
1298
+ * @param string $destinationBlob name of the
1299
+ * destination
1300
+ * blob
1301
+ * @param string $sourceURL URL of the
1302
+ * source
1303
+ * resource
1304
+ * @param BlobModels\CopyBlobFromURLOptions $options optional
1305
+ * parameters
1306
+ *
1307
+ * @return BlobModels\CopyBlobResult
1308
+ *
1309
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
1310
+ */
1311
+ public function copyBlobFromURL(
1312
+ $destinationContainer,
1313
+ $destinationBlob,
1314
+ $sourceURL,
1315
+ BlobModels\CopyBlobFromURLOptions $options = null
1316
+ );
1317
+
1318
+ /**
1319
+ * Creates promise to copy from source URL to a destination blob.
1320
+ *
1321
+ * @param string $destinationContainer name of the
1322
+ * destination
1323
+ * container
1324
+ * @param string $destinationBlob name of the
1325
+ * destination
1326
+ * blob
1327
+ * @param string $sourceURL URL of the
1328
+ * source
1329
+ * resource
1330
+ * @param BlobModels\CopyBlobFromURLOptions $options optional
1331
+ * parameters
1332
+ *
1333
+ * @return \GuzzleHttp\Promise\PromiseInterface
1334
+ *
1335
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
1336
+ */
1337
+ public function copyBlobFromURLAsync(
1338
+ $destinationContainer,
1339
+ $destinationBlob,
1340
+ $sourceURL,
1341
+ BlobModels\CopyBlobFromURLOptions $options = null
1342
+ );
1343
+
1344
+ /**
1345
+ * Abort a blob copy operation
1346
+ *
1347
+ * @param string $container name of the container
1348
+ * @param string $blob name of the blob
1349
+ * @param string $copyId copy operation identifier.
1350
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1351
+ *
1352
+ * @return void
1353
+ *
1354
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/abort-copy-blob
1355
+ */
1356
+ public function abortCopy(
1357
+ $container,
1358
+ $blob,
1359
+ $copyId,
1360
+ BlobModels\BlobServiceOptions $options = null
1361
+ );
1362
+
1363
+ /**
1364
+ * Creates promise to abort a blob copy operation
1365
+ *
1366
+ * @param string $container name of the container
1367
+ * @param string $blob name of the blob
1368
+ * @param string $copyId copy operation identifier.
1369
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1370
+ *
1371
+ * @return \GuzzleHttp\Promise\PromiseInterface
1372
+ *
1373
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/abort-copy-blob
1374
+ */
1375
+ public function abortCopyAsync(
1376
+ $container,
1377
+ $blob,
1378
+ $copyId,
1379
+ BlobModels\BlobServiceOptions $options = null
1380
+ );
1381
+
1382
+ /**
1383
+ * Establishes an exclusive write lock on a blob. To write to a locked
1384
+ * blob, a client must provide a lease ID.
1385
+ *
1386
+ * @param string $container name of the container
1387
+ * @param string $blob name of the blob
1388
+ * @param string $proposedLeaseId lease id when acquiring
1389
+ * @param int $leaseDuration the lease duration. A non-infinite
1390
+ * lease can be between 15 and 60 seconds.
1391
+ * Default is never to expire.
1392
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1393
+ *
1394
+ * @return BlobModels\LeaseResult
1395
+ *
1396
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
1397
+ */
1398
+ public function acquireLease(
1399
+ $container,
1400
+ $blob,
1401
+ $proposedLeaseId = null,
1402
+ $leaseDuration = null,
1403
+ BlobModels\BlobServiceOptions $options = null
1404
+ );
1405
+
1406
+ /**
1407
+ * Creates promise to establish an exclusive one-minute write lock on a blob.
1408
+ * To write to a locked blob, a client must provide a lease ID.
1409
+ *
1410
+ * @param string $container name of the container
1411
+ * @param string $blob name of the blob
1412
+ * @param string $proposedLeaseId lease id when acquiring
1413
+ * @param int $leaseDuration the lease duration. A non-infinite
1414
+ * lease can be between 15 and 60 seconds.
1415
+ * Default is never to expire.
1416
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1417
+ *
1418
+ * @return \GuzzleHttp\Promise\PromiseInterface
1419
+ *
1420
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
1421
+ */
1422
+ public function acquireLeaseAsync(
1423
+ $container,
1424
+ $blob,
1425
+ $proposedLeaseId = null,
1426
+ $leaseDuration = null,
1427
+ BlobModels\BlobServiceOptions $options = null
1428
+ );
1429
+
1430
+ /**
1431
+ * change an existing lease
1432
+ *
1433
+ * @param string $container name of the container
1434
+ * @param string $blob name of the blob
1435
+ * @param string $leaseId lease id when acquiring
1436
+ * @param string $proposedLeaseId lease id when acquiring
1437
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1438
+ *
1439
+ * @return BlobModels\LeaseResult
1440
+ *
1441
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
1442
+ */
1443
+ public function changeLease(
1444
+ $container,
1445
+ $blob,
1446
+ $leaseId,
1447
+ $proposedLeaseId,
1448
+ BlobModels\BlobServiceOptions $options = null
1449
+ );
1450
+
1451
+ /**
1452
+ * Creates promise to change an existing lease
1453
+ *
1454
+ * @param string $container name of the container
1455
+ * @param string $blob name of the blob
1456
+ * @param string $leaseId lease id when acquiring
1457
+ * @param string $proposedLeaseId the proposed lease id
1458
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1459
+ *
1460
+ * @return \GuzzleHttp\Promise\PromiseInterface
1461
+ *
1462
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob
1463
+ */
1464
+ public function changeLeaseAsync(
1465
+ $container,
1466
+ $blob,
1467
+ $leaseId,
1468
+ $proposedLeaseId,
1469
+ BlobModels\BlobServiceOptions $options = null
1470
+ );
1471
+
1472
+ /**
1473
+ * Renews an existing lease
1474
+ *
1475
+ * @param string $container name of the container
1476
+ * @param string $blob name of the blob
1477
+ * @param string $leaseId lease id when acquiring
1478
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1479
+ *
1480
+ * @return BlobModels\AcquireLeaseResult
1481
+ *
1482
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
1483
+ */
1484
+ public function renewLease(
1485
+ $container,
1486
+ $blob,
1487
+ $leaseId,
1488
+ BlobModels\BlobServiceOptions $options = null
1489
+ );
1490
+
1491
+ /**
1492
+ * Creates promise to renew an existing lease
1493
+ *
1494
+ * @param string $container name of the container
1495
+ * @param string $blob name of the blob
1496
+ * @param string $leaseId lease id when acquiring
1497
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1498
+ *
1499
+ * @return \GuzzleHttp\Promise\PromiseInterface
1500
+ *
1501
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
1502
+ */
1503
+ public function renewLeaseAsync(
1504
+ $container,
1505
+ $blob,
1506
+ $leaseId,
1507
+ BlobModels\BlobServiceOptions $options = null
1508
+ );
1509
+
1510
+
1511
+ /**
1512
+ * Frees the lease if it is no longer needed so that another client may
1513
+ * immediately acquire a lease against the blob.
1514
+ *
1515
+ * @param string $container name of the container
1516
+ * @param string $blob name of the blob
1517
+ * @param string $leaseId lease id when acquiring
1518
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1519
+ *
1520
+ * @return void
1521
+ *
1522
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
1523
+ */
1524
+ public function releaseLease(
1525
+ $container,
1526
+ $blob,
1527
+ $leaseId,
1528
+ BlobModels\BlobServiceOptions $options = null
1529
+ );
1530
+
1531
+ /**
1532
+ * Creates promise to free the lease if it is no longer needed so that
1533
+ * another client may immediately acquire a lease against the blob.
1534
+ *
1535
+ * @param string $container name of the container
1536
+ * @param string $blob name of the blob
1537
+ * @param string $leaseId lease id when acquiring
1538
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1539
+ *
1540
+ * @return \GuzzleHttp\Promise\PromiseInterface
1541
+ *
1542
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
1543
+ */
1544
+ public function releaseLeaseAsync(
1545
+ $container,
1546
+ $blob,
1547
+ $leaseId,
1548
+ BlobModels\BlobServiceOptions $options = null
1549
+ );
1550
+
1551
+ /**
1552
+ * Ends the lease but ensure that another client cannot acquire a new lease until
1553
+ * the current lease period has expired.
1554
+ *
1555
+ * @param string $container name of the container
1556
+ * @param string $blob name of the blob
1557
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1558
+ *
1559
+ * @return void
1560
+ *
1561
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
1562
+ */
1563
+ public function breakLease(
1564
+ $container,
1565
+ $blob,
1566
+ $breakPeriod = null,
1567
+ BlobModels\BlobServiceOptions $options = null
1568
+ );
1569
+
1570
+ /**
1571
+ * Creates promise to end the lease but ensure that another client cannot
1572
+ * acquire a new lease until the current lease period has expired.
1573
+ *
1574
+ * @param string $container name of the container
1575
+ * @param string $blob name of the blob
1576
+ * @param BlobModels\BlobServiceOptions $options optional parameters
1577
+ *
1578
+ * @return \GuzzleHttp\Promise\PromiseInterface
1579
+ *
1580
+ * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
1581
+ */
1582
+ public function breakLeaseAsync(
1583
+ $container,
1584
+ $blob,
1585
+ $breakPeriod = null,
1586
+ BlobModels\BlobServiceOptions $options = null
1587
+ );
1588
+ }
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/AccessCondition.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,14 +21,15 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
- use MicrosoftAzure\Storage\Common\Internal\Resources;
 
27
  use MicrosoftAzure\Storage\Common\Internal\Validate;
28
  use MicrosoftAzure\Storage\Common\Internal\WindowsAzureUtilities;
29
 
30
  /**
31
- * Represents a set of access conditions to be used for operations against the
32
  * storage services.
33
  *
34
  * @category Microsoft
@@ -36,57 +37,47 @@ use MicrosoftAzure\Storage\Common\Internal\WindowsAzureUtilities;
36
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
37
  * @copyright 2016 Microsoft Corporation
38
  * @license https://github.com/azure/azure-storage-php/LICENSE
39
- * @version Release: 0.10.2
40
  * @link https://github.com/azure/azure-storage-php
41
  */
42
  class AccessCondition
43
  {
44
- /**
45
- * Represents the header type.
46
- *
47
- * @var string
48
- */
49
  private $_header = Resources::EMPTY_STRING;
50
-
51
- /**
52
- * Represents the header value.
53
- *
54
- * @var string
55
- */
56
  private $_value;
57
 
58
  /**
59
  * Constructor
60
- *
61
  * @param string $headerType header name
62
  * @param string $value header value
 
 
63
  */
64
  protected function __construct($headerType, $value)
65
  {
66
  $this->setHeader($headerType);
67
  $this->setValue($value);
68
  }
69
-
70
  /**
71
  * Specifies that no access condition is set.
72
- *
73
- * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
74
  */
75
  public static function none()
76
  {
77
  return new AccessCondition(Resources::EMPTY_STRING, null);
78
  }
79
-
80
  /**
81
- * Returns an access condition such that an operation will be performed only if
82
  * the resource's ETag value matches the specified ETag value.
83
  * <p>
84
- * Setting this access condition modifies the request to include the HTTP
85
- * <i>If-Match</i> conditional header. If this access condition is set, the
86
  * operation is performed only if the ETag of the resource matches the specified
87
  * ETag.
88
  * <p>
89
- * For more information, see
90
  * <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>
91
  * Specifying Conditional Headers for Blob Service Operations</a>.
92
  *
@@ -98,17 +89,17 @@ class AccessCondition
98
  {
99
  return new AccessCondition(Resources::IF_MATCH, $etag);
100
  }
101
-
102
  /**
103
- * Returns an access condition such that an operation will be performed only if
104
  * the resource has been modified since the specified time.
105
  * <p>
106
- * Setting this access condition modifies the request to include the HTTP
107
  * <i>If-Modified-Since</i> conditional header. If this access condition is set,
108
- * the operation is performed only if the resource has been modified since the
109
  * specified time.
110
  * <p>
111
- * For more information, see
112
  * <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>
113
  * Specifying Conditional Headers for Blob Service Operations</a>.
114
  *
@@ -117,7 +108,7 @@ class AccessCondition
117
  *
118
  * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
119
  */
120
- public static function ifModifiedSince($lastModified)
121
  {
122
  Validate::isDate($lastModified);
123
  return new AccessCondition(
@@ -125,12 +116,12 @@ class AccessCondition
125
  $lastModified
126
  );
127
  }
128
-
129
  /**
130
- * Returns an access condition such that an operation will be performed only if
131
  * the resource's ETag value does not match the specified ETag value.
132
  * <p>
133
- * Setting this access condition modifies the request to include the HTTP
134
  * <i>If-None-Match</i> conditional header. If this access condition is set, the
135
  * operation is performed only if the ETag of the resource does not match the
136
  * specified ETag.
@@ -147,14 +138,14 @@ class AccessCondition
147
  {
148
  return new AccessCondition(Resources::IF_NONE_MATCH, $etag);
149
  }
150
-
151
  /**
152
  * Returns an access condition such that an operation will be performed only if
153
  * the resource has not been modified since the specified time.
154
  * <p>
155
- * Setting this access condition modifies the request to include the HTTP
156
  * <i>If-Unmodified-Since</i> conditional header. If this access condition is
157
- * set, the operation is performed only if the resource has not been modified
158
  * since the specified time.
159
  * <p>
160
  * For more information, see
@@ -166,7 +157,7 @@ class AccessCondition
166
  *
167
  * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
168
  */
169
- public static function ifNotModifiedSince($lastModified)
170
  {
171
  Validate::isDate($lastModified);
172
  return new AccessCondition(
@@ -174,68 +165,187 @@ class AccessCondition
174
  $lastModified
175
  );
176
  }
177
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  /**
179
  * Sets header type
180
- *
181
  * @param string $headerType can be one of Resources
182
- *
183
- * @return none.
184
  */
185
  public function setHeader($headerType)
186
  {
187
  $valid = AccessCondition::isValid($headerType);
188
  Validate::isTrue($valid, Resources::INVALID_HT_MSG);
189
-
190
  $this->_header = $headerType;
191
  }
192
-
193
  /**
194
  * Gets header type
195
- *
196
- * @return string.
197
  */
198
  public function getHeader()
199
  {
200
  return $this->_header;
201
  }
202
-
203
  /**
204
  * Sets the header value
205
- *
206
  * @param string $value the value to use
207
- *
208
- * @return none
209
  */
210
  public function setValue($value)
211
  {
212
  $this->_value = $value;
213
  }
214
-
215
  /**
216
  * Gets the header value
217
- *
218
  * @return string
219
  */
220
  public function getValue()
221
  {
222
  return $this->_value;
223
  }
224
-
225
  /**
226
  * Check if the $headerType belongs to valid header types
227
- *
228
  * @param string $headerType candidate header type
229
- *
230
- * @return boolean
 
 
231
  */
232
  public static function isValid($headerType)
233
  {
234
- if ( $headerType == Resources::EMPTY_STRING
235
  || $headerType == Resources::IF_UNMODIFIED_SINCE
236
  || $headerType == Resources::IF_MATCH
237
  || $headerType == Resources::IF_MODIFIED_SINCE
238
  || $headerType == Resources::IF_NONE_MATCH
 
 
 
 
 
239
  ) {
240
  return true;
241
  } else {
@@ -243,5 +353,3 @@ class AccessCondition
243
  }
244
  }
245
  }
246
-
247
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
  use MicrosoftAzure\Storage\Common\Internal\Validate;
29
  use MicrosoftAzure\Storage\Common\Internal\WindowsAzureUtilities;
30
 
31
  /**
32
+ * Represents a set of access conditions to be used for operations against the
33
  * storage services.
34
  *
35
  * @category Microsoft
37
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
38
  * @copyright 2016 Microsoft Corporation
39
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
40
  * @link https://github.com/azure/azure-storage-php
41
  */
42
  class AccessCondition
43
  {
 
 
 
 
 
44
  private $_header = Resources::EMPTY_STRING;
 
 
 
 
 
 
45
  private $_value;
46
 
47
  /**
48
  * Constructor
49
+ *
50
  * @param string $headerType header name
51
  * @param string $value header value
52
+ *
53
+ * @internal
54
  */
55
  protected function __construct($headerType, $value)
56
  {
57
  $this->setHeader($headerType);
58
  $this->setValue($value);
59
  }
60
+
61
  /**
62
  * Specifies that no access condition is set.
63
+ *
64
+ * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
65
  */
66
  public static function none()
67
  {
68
  return new AccessCondition(Resources::EMPTY_STRING, null);
69
  }
70
+
71
  /**
72
+ * Returns an access condition such that an operation will be performed only if
73
  * the resource's ETag value matches the specified ETag value.
74
  * <p>
75
+ * Setting this access condition modifies the request to include the HTTP
76
+ * <i>If-Match</i> conditional header. If this access condition is set, the
77
  * operation is performed only if the ETag of the resource matches the specified
78
  * ETag.
79
  * <p>
80
+ * For more information, see
81
  * <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>
82
  * Specifying Conditional Headers for Blob Service Operations</a>.
83
  *
89
  {
90
  return new AccessCondition(Resources::IF_MATCH, $etag);
91
  }
92
+
93
  /**
94
+ * Returns an access condition such that an operation will be performed only if
95
  * the resource has been modified since the specified time.
96
  * <p>
97
+ * Setting this access condition modifies the request to include the HTTP
98
  * <i>If-Modified-Since</i> conditional header. If this access condition is set,
99
+ * the operation is performed only if the resource has been modified since the
100
  * specified time.
101
  * <p>
102
+ * For more information, see
103
  * <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>
104
  * Specifying Conditional Headers for Blob Service Operations</a>.
105
  *
108
  *
109
  * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
110
  */
111
+ public static function ifModifiedSince(\DateTime $lastModified)
112
  {
113
  Validate::isDate($lastModified);
114
  return new AccessCondition(
116
  $lastModified
117
  );
118
  }
119
+
120
  /**
121
+ * Returns an access condition such that an operation will be performed only if
122
  * the resource's ETag value does not match the specified ETag value.
123
  * <p>
124
+ * Setting this access condition modifies the request to include the HTTP
125
  * <i>If-None-Match</i> conditional header. If this access condition is set, the
126
  * operation is performed only if the ETag of the resource does not match the
127
  * specified ETag.
138
  {
139
  return new AccessCondition(Resources::IF_NONE_MATCH, $etag);
140
  }
141
+
142
  /**
143
  * Returns an access condition such that an operation will be performed only if
144
  * the resource has not been modified since the specified time.
145
  * <p>
146
+ * Setting this access condition modifies the request to include the HTTP
147
  * <i>If-Unmodified-Since</i> conditional header. If this access condition is
148
+ * set, the operation is performed only if the resource has not been modified
149
  * since the specified time.
150
  * <p>
151
  * For more information, see
157
  *
158
  * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
159
  */
160
+ public static function ifNotModifiedSince(\DateTime $lastModified)
161
  {
162
  Validate::isDate($lastModified);
163
  return new AccessCondition(
165
  $lastModified
166
  );
167
  }
168
+
169
+ /**
170
+ * Returns an access condition such that an operation will be performed only if
171
+ * the operation would cause the blob to exceed that limit or if the append
172
+ * position is equal to this number.
173
+ * <p>
174
+ * Setting this access condition modifies the request to include the HTTP
175
+ * <i>x-ms-blob-condition-appendpos</i> conditional header. If this access condition
176
+ * is set, the operation is performed only if the append position is equal to this number
177
+ * <p>
178
+ * For more information,
179
+ * see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block'>
180
+ * Specifying Conditional Headers for Blob Service Operations</a>.
181
+ *
182
+ * @param int $appendPosition int that represents the append position
183
+ *
184
+ * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
185
+ */
186
+ public static function appendPosition($appendPosition)
187
+ {
188
+ return new AccessCondition(Resources::MAX_APPEND_POSITION, $appendPosition);
189
+ }
190
+
191
+ /**
192
+ * Returns an access condition such that an operation will be performed only if
193
+ * the operation would cause the blob to exceed that limit or if the blob size
194
+ * is already greater than the value specified in this header.
195
+ * <p>
196
+ * Setting this access condition modifies the request to include the HTTP
197
+ * <i>x-ms-blob-condition-maxsize</i> conditional header. If this access condition
198
+ * is set, the operation is performed only if the operation would cause the blob
199
+ * to exceed that limit or if the blob size is already greater than the value
200
+ * specified in this header.
201
+ * <p>
202
+ * For more information,
203
+ * see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block'>
204
+ * Specifying Conditional Headers for Blob Service Operations</a>.
205
+ *
206
+ * @param int $maxBlobSize int that represents the max blob size
207
+ *
208
+ * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
209
+ */
210
+ public static function maxBlobSize($maxBlobSize)
211
+ {
212
+ return new AccessCondition(Resources::MAX_BLOB_SIZE, $maxBlobSize);
213
+ }
214
+
215
+ /**
216
+ * Returns an access condition such that an operation will be performed only if
217
+ * the blob’s sequence number is less than the specified value.
218
+ * <p>
219
+ * Setting this access condition modifies the request to include the HTTP
220
+ * <i>x-ms-if-sequence-number-lt</i> conditional header. If this access condition
221
+ * is set, the operation is performed only if the blob’s sequence number is less
222
+ * than the specified value.
223
+ * <p>
224
+ * For more information,
225
+ * see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-page'>
226
+ * Specifying Conditional Headers for Blob Service Operations</a>.
227
+ *
228
+ * @param int $sequenceNumber int that represents the sequence number value to check.
229
+ *
230
+ * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
231
+ */
232
+ public static function ifSequenceNumberLessThan($sequenceNumber)
233
+ {
234
+ return new AccessCondition(Resources::SEQUENCE_NUMBER_LESS_THAN, $sequenceNumber);
235
+ }
236
+
237
+ /**
238
+ * Returns an access condition such that an operation will be performed only if
239
+ * the blob’s sequence number is equal to the specified value.
240
+ * <p>
241
+ * Setting this access condition modifies the request to include the HTTP
242
+ * <i>x-ms-if-sequence-number-eq</i> conditional header. If this access condition
243
+ * is set, the operation is performed only if the blob’s sequence number is equal to
244
+ * the specified value.
245
+ * <p>
246
+ * For more information,
247
+ * see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-page'>
248
+ * Specifying Conditional Headers for Blob Service Operations</a>.
249
+ *
250
+ * @param int $sequenceNumber int that represents the sequence number value to check.
251
+ *
252
+ * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
253
+ */
254
+ public static function ifSequenceNumberEqual($sequenceNumber)
255
+ {
256
+ return new AccessCondition(Resources::SEQUENCE_NUMBER_EQUAL, $sequenceNumber);
257
+ }
258
+
259
+ /**
260
+ * Returns an access condition such that an operation will be performed only if
261
+ * the blob’s sequence number is less than or equal to the specified value.
262
+ * <p>
263
+ * Setting this access condition modifies the request to include the HTTP
264
+ * <i>x-ms-if-sequence-number-le</i> conditional header. If this access condition
265
+ * is set, the operation is performed only if the blob’s sequence number is less
266
+ * than or equal to the specified value.
267
+ * <p>
268
+ * For more information,
269
+ * see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-page'>
270
+ * Specifying Conditional Headers for Blob Service Operations</a>.
271
+ *
272
+ * @param int $sequenceNumber int that represents the sequence number value to check.
273
+ *
274
+ * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
275
+ */
276
+ public static function ifSequenceNumberLessThanOrEqual($sequenceNumber)
277
+ {
278
+ return new AccessCondition(Resources::SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL, $sequenceNumber);
279
+ }
280
+
281
  /**
282
  * Sets header type
283
+ *
284
  * @param string $headerType can be one of Resources
285
+ *
286
+ * @return void
287
  */
288
  public function setHeader($headerType)
289
  {
290
  $valid = AccessCondition::isValid($headerType);
291
  Validate::isTrue($valid, Resources::INVALID_HT_MSG);
292
+
293
  $this->_header = $headerType;
294
  }
295
+
296
  /**
297
  * Gets header type
298
+ *
299
+ * @return string
300
  */
301
  public function getHeader()
302
  {
303
  return $this->_header;
304
  }
305
+
306
  /**
307
  * Sets the header value
308
+ *
309
  * @param string $value the value to use
310
+ *
311
+ * @return void
312
  */
313
  public function setValue($value)
314
  {
315
  $this->_value = $value;
316
  }
317
+
318
  /**
319
  * Gets the header value
320
+ *
321
  * @return string
322
  */
323
  public function getValue()
324
  {
325
  return $this->_value;
326
  }
327
+
328
  /**
329
  * Check if the $headerType belongs to valid header types
330
+ *
331
  * @param string $headerType candidate header type
332
+ *
333
+ * @internal
334
+ *
335
+ * @return boolean
336
  */
337
  public static function isValid($headerType)
338
  {
339
+ if ($headerType == Resources::EMPTY_STRING
340
  || $headerType == Resources::IF_UNMODIFIED_SINCE
341
  || $headerType == Resources::IF_MATCH
342
  || $headerType == Resources::IF_MODIFIED_SINCE
343
  || $headerType == Resources::IF_NONE_MATCH
344
+ || $headerType == Resources::MAX_BLOB_SIZE
345
+ || $headerType == Resources::MAX_APPEND_POSITION
346
+ || $headerType == Resources::SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL
347
+ || $headerType == Resources::SEQUENCE_NUMBER_LESS_THAN
348
+ || $headerType == Resources::SEQUENCE_NUMBER_EQUAL
349
  ) {
350
  return true;
351
  } else {
353
  }
354
  }
355
  }
 
 
vendor/microsoft/azure-storage-blob/src/Blob/Models/AccessTierTrait.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Common\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2018 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ /**
28
+ * Trait implementing setting and getting accessTier.
29
+ *
30
+ * @category Microsoft
31
+ * @package MicrosoftAzure\Storage\Blob\Models
32
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
+ * @copyright 2018 Microsoft Corporation
34
+ * @license https://github.com/azure/azure-storage-php/LICENSE
35
+ * @link https://github.com/azure/azure-storage-php
36
+ */
37
+ trait AccessTierTrait
38
+ {
39
+ /**
40
+ * @var string $accessTier Version 2017-04-17 and newer. For page blobs on a premium storage account, otherwise a block blob
41
+ * on blob storage account or storageV2 general account.
42
+ * Specifies the tier to be set on the blob. Currently, for block blob, tiers like "Hot", "Cool"
43
+ * and "Archive" can be used; for premium page blobs, "P4", "P6", "P10" and etc. can be set.
44
+ * Check following link for a full list of supported tiers.
45
+ * https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tier
46
+ */
47
+ private $accessTier;
48
+
49
+ /**
50
+ * Gets blob access tier.
51
+ *
52
+ * @return string
53
+ */
54
+ public function getAccessTier()
55
+ {
56
+ return $this->accessTier;
57
+ }
58
+
59
+ /**
60
+ * Sets blob access tier.
61
+ *
62
+ * @param string $accessTier value.
63
+ *
64
+ * @return void
65
+ */
66
+ public function setAccessTier($accessTier)
67
+ {
68
+ $this->accessTier = $accessTier;
69
+ }
70
+ }
vendor/microsoft/{azure-storage/src/Blob/Models/CreateBlobSnapshotOptions.php → azure-storage-blob/src/Blob/Models/AppendBlockOptions.php} RENAMED
@@ -11,113 +11,98 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
18
  * @package MicrosoftAzure\Storage\Blob\Models
19
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
- * @copyright 2016 Microsoft Corporation
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
28
- * The optional parameters for createBlobSnapshot wrapper.
29
  *
30
  * @category Microsoft
31
  * @package MicrosoftAzure\Storage\Blob\Models
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
- class CreateBlobSnapshotOptions extends BlobServiceOptions
39
  {
 
 
 
 
40
  /**
41
- * @var array
42
- */
43
- private $_metadata;
44
-
45
- /**
46
- * @var AccessCondition
47
- */
48
- private $_accessCondition;
49
-
50
- /**
51
- * @var string
52
- */
53
- private $_leaseId;
54
-
55
- /**
56
- * Gets metadata.
57
  *
58
- * @return array
59
  */
60
- public function getMetadata()
61
  {
62
- return $this->_metadata;
63
  }
64
 
65
  /**
66
- * Sets metadata.
67
  *
68
- * @param array $metadata The metadata array.
69
  *
70
- * @return none
71
  */
72
- public function setMetadata($metadata)
73
  {
74
- $this->_metadata = $metadata;
75
  }
76
-
77
  /**
78
- * Gets access condition.
79
- *
80
- * @return AccessCondition
81
  */
82
- public function getAccessCondition()
83
  {
84
- return $this->_accessCondition;
85
  }
86
-
87
  /**
88
- * Sets access condition.
89
- *
90
- * @param AccessCondition $accessCondition The access condition object.
91
- *
92
- * @return none
93
  */
94
- public function setAccessCondition($accessCondition)
95
  {
96
- $this->_accessCondition = $accessCondition;
97
  }
98
-
99
  /**
100
- * Gets lease Id.
101
  *
102
- * @return string
103
  */
104
- public function getLeaseId()
105
  {
106
- return $this->_leaseId;
107
  }
108
 
109
  /**
110
- * Sets lease Id.
 
 
111
  *
112
- * @param string $leaseId The lease Id.
113
- *
114
- * @return none
115
  */
116
- public function setLeaseId($leaseId)
117
  {
118
- $this->_leaseId = $leaseId;
119
  }
120
-
121
  }
122
-
123
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
18
  * @package MicrosoftAzure\Storage\Blob\Models
19
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2017 Microsoft Corporation
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
28
+ * Optional parameters for appendBlock wrapper
29
  *
30
  * @category Microsoft
31
  * @package MicrosoftAzure\Storage\Blob\Models
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
35
  * @link https://github.com/azure/azure-storage-php
36
  */
37
+ class AppendBlockOptions extends BlobServiceOptions
38
  {
39
+ private $contentMD5;
40
+ private $maxBlobSize;
41
+ private $appendPosition;
42
+
43
  /**
44
+ * Gets block contentMD5.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  *
46
+ * @return string
47
  */
48
+ public function getContentMD5()
49
  {
50
+ return $this->contentMD5;
51
  }
52
 
53
  /**
54
+ * Sets block contentMD5.
55
  *
56
+ * @param string $contentMD5 value.
57
  *
58
+ * @return void
59
  */
60
+ public function setContentMD5($contentMD5)
61
  {
62
+ $this->contentMD5 = $contentMD5;
63
  }
64
+
65
  /**
66
+ * Gets the max length in bytes allowed for the append blob to grow to.
67
+ *
68
+ * @return int
69
  */
70
+ public function getMaxBlobSize()
71
  {
72
+ return $this->maxBlobSize;
73
  }
74
+
75
  /**
76
+ * Sets the max length in bytes allowed for the append blob to grow to.
77
+ *
78
+ * @param int $maxBlobSize value.
79
+ *
80
+ * @return void
81
  */
82
+ public function setMaxBlobSize($maxBlobSize)
83
  {
84
+ $this->maxBlobSize = $maxBlobSize;
85
  }
86
+
87
  /**
88
+ * Gets append blob appendPosition.
89
  *
90
+ * @return int
91
  */
92
+ public function getAppendPosition()
93
  {
94
+ return $this->appendPosition;
95
  }
96
 
97
  /**
98
+ * Sets append blob appendPosition.
99
+ *
100
+ * @param int $appendPosition value.
101
  *
102
+ * @return void
 
 
103
  */
104
+ public function setAppendPosition($appendPosition)
105
  {
106
+ $this->appendPosition = $appendPosition;
107
  }
 
108
  }
 
 
vendor/microsoft/azure-storage-blob/src/Blob/Models/AppendBlockResult.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2017 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
+ use MicrosoftAzure\Storage\Common\Internal\Utilities;
29
+
30
+ /**
31
+ * The result of calling appendBlock API.
32
+ *
33
+ * @category Microsoft
34
+ * @package MicrosoftAzure\Storage\Blob\Models
35
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
36
+ * @copyright 2016 Microsoft Corporation
37
+ * @license https://github.com/azure/azure-storage-php/LICENSE
38
+ * @link https://github.com/azure/azure-storage-php
39
+ */
40
+ class AppendBlockResult
41
+ {
42
+ private $appendOffset;
43
+ private $committedBlockCount;
44
+ private $contentMD5;
45
+ private $etag;
46
+ private $lastModified;
47
+ private $requestServerEncrypted;
48
+
49
+ /**
50
+ * Creates AppendBlockResult object from the response of the put block request.
51
+ *
52
+ * @param array $headers The HTTP response headers in array representation.
53
+ *
54
+ * @internal
55
+ *
56
+ * @return AppendBlockResult
57
+ */
58
+ public static function create(array $headers)
59
+ {
60
+ $result = new AppendBlockResult();
61
+
62
+ $result->setAppendOffset(
63
+ intval(
64
+ Utilities::tryGetValueInsensitive(
65
+ Resources::X_MS_BLOB_APPEND_OFFSET, $headers
66
+ )
67
+ )
68
+ );
69
+
70
+ $result->setCommittedBlockCount(
71
+ intval(
72
+ Utilities::tryGetValueInsensitive(
73
+ Resources::X_MS_BLOB_COMMITTED_BLOCK_COUNT, $headers
74
+ )
75
+ )
76
+ );
77
+
78
+ $result->setContentMD5(
79
+ Utilities::tryGetValueInsensitive(Resources::CONTENT_MD5, $headers)
80
+ );
81
+
82
+ $result->setEtag(
83
+ Utilities::tryGetValueInsensitive(Resources::ETAG, $headers)
84
+ );
85
+
86
+ if (Utilities::arrayKeyExistsInsensitive(
87
+ Resources::LAST_MODIFIED,
88
+ $headers
89
+ )) {
90
+ $lastModified = Utilities::tryGetValueInsensitive(
91
+ Resources::LAST_MODIFIED,
92
+ $headers
93
+ );
94
+ $lastModified = Utilities::rfc1123ToDateTime($lastModified);
95
+
96
+ $result->setLastModified($lastModified);
97
+ }
98
+
99
+ $result->setRequestServerEncrypted(
100
+ Utilities::toBoolean(
101
+ Utilities::tryGetValueInsensitive(
102
+ Resources::X_MS_REQUEST_SERVER_ENCRYPTED,
103
+ $headers
104
+ ),
105
+ true
106
+ )
107
+ );
108
+
109
+ return $result;
110
+ }
111
+
112
+ /**
113
+ * Gets Etag of the blob that the client can use to perform conditional
114
+ * PUT operations by using the If-Match request header.
115
+ *
116
+ * @return string
117
+ */
118
+ public function getEtag()
119
+ {
120
+ return $this->etag;
121
+ }
122
+
123
+ /**
124
+ * Sets the etag value.
125
+ *
126
+ * @param string $etag etag as a string.
127
+ *
128
+ * @return void
129
+ */
130
+ protected function setEtag($etag)
131
+ {
132
+ $this->etag = $etag;
133
+ }
134
+
135
+ /**
136
+ * Gets $lastModified value.
137
+ *
138
+ * @return \DateTime
139
+ */
140
+ public function getLastModified()
141
+ {
142
+ return $this->lastModified;
143
+ }
144
+
145
+ /**
146
+ * Sets the $lastModified value.
147
+ *
148
+ * @param \DateTime $lastModified $lastModified value.
149
+ *
150
+ * @return void
151
+ */
152
+ protected function setLastModified($lastModified)
153
+ {
154
+ $this->lastModified = $lastModified;
155
+ }
156
+
157
+ /**
158
+ * Gets block content MD5.
159
+ *
160
+ * @return string
161
+ */
162
+ public function getContentMD5()
163
+ {
164
+ return $this->contentMD5;
165
+ }
166
+
167
+ /**
168
+ * Sets the content MD5 value.
169
+ *
170
+ * @param string $contentMD5 conent MD5 as a string.
171
+ *
172
+ * @return void
173
+ */
174
+ protected function setContentMD5($contentMD5)
175
+ {
176
+ $this->contentMD5 = $contentMD5;
177
+ }
178
+
179
+ /**
180
+ * Gets the offset at which the block was committed, in bytes.
181
+ *
182
+ * @return int
183
+ */
184
+ public function getAppendOffset()
185
+ {
186
+ return $this->appendOffset;
187
+ }
188
+
189
+ /**
190
+ * Sets the offset at which the block was committed, in bytes.
191
+ *
192
+ * @param int $appendOffset append offset, in bytes.
193
+ *
194
+ * @return void
195
+ */
196
+ protected function setAppendOffset($appendOffset)
197
+ {
198
+ $this->appendOffset = $appendOffset;
199
+ }
200
+
201
+ /**
202
+ * Gets the number of committed blocks present in the blob.
203
+ *
204
+ * @return int
205
+ */
206
+ public function getCommittedBlockCount()
207
+ {
208
+ return $this->committedBlockCount;
209
+ }
210
+
211
+ /**
212
+ * Sets the number of committed blocks present in the blob.
213
+ *
214
+ * @param int $committedBlockCount the number of committed blocks present in the blob.
215
+ *
216
+ * @return void
217
+ */
218
+ protected function setCommittedBlockCount($committedBlockCount)
219
+ {
220
+ $this->committedBlockCount = $committedBlockCount;
221
+ }
222
+
223
+ /**
224
+ * Gets the whether the contents of the request are successfully encrypted.
225
+ *
226
+ * @return boolean
227
+ */
228
+ public function getRequestServerEncrypted()
229
+ {
230
+ return $this->requestServerEncrypted;
231
+ }
232
+
233
+ /**
234
+ * Sets the request server encryption value.
235
+ *
236
+ * @param boolean $requestServerEncrypted
237
+ *
238
+ * @return void
239
+ */
240
+ public function setRequestServerEncrypted($requestServerEncrypted)
241
+ {
242
+ $this->requestServerEncrypted = $requestServerEncrypted;
243
+ }
244
+ }
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/Blob.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,7 +21,7 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
@@ -32,40 +32,19 @@ namespace MicrosoftAzure\Storage\Blob\Models;
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
  class Blob
39
  {
40
- /**
41
- * @var string
42
- */
43
  private $_name;
44
-
45
- /**
46
- * @var string
47
- */
48
  private $_url;
49
-
50
- /**
51
- * @var string
52
- */
53
  private $_snapshot;
54
-
55
- /**
56
- * @var array
57
- */
58
  private $_metadata;
59
-
60
- /**
61
- * @var BlobProperties
62
- */
63
  private $_properties;
64
-
65
  /**
66
  * Gets blob name.
67
  *
68
- * @return string.
69
  */
70
  public function getName()
71
  {
@@ -76,18 +55,18 @@ class Blob
76
  * Sets blob name.
77
  *
78
  * @param string $name value.
79
- *
80
- * @return none.
81
  */
82
  public function setName($name)
83
  {
84
  $this->_name = $name;
85
  }
86
-
87
  /**
88
  * Gets blob snapshot.
89
  *
90
- * @return string.
91
  */
92
  public function getSnapshot()
93
  {
@@ -98,8 +77,8 @@ class Blob
98
  * Sets blob snapshot.
99
  *
100
  * @param string $snapshot value.
101
- *
102
- * @return none.
103
  */
104
  public function setSnapshot($snapshot)
105
  {
@@ -109,7 +88,7 @@ class Blob
109
  /**
110
  * Gets blob url.
111
  *
112
- * @return string.
113
  */
114
  public function getUrl()
115
  {
@@ -120,8 +99,8 @@ class Blob
120
  * Sets blob url.
121
  *
122
  * @param string $url value.
123
- *
124
- * @return none.
125
  */
126
  public function setUrl($url)
127
  {
@@ -131,7 +110,7 @@ class Blob
131
  /**
132
  * Gets blob metadata.
133
  *
134
- * @return array.
135
  */
136
  public function getMetadata()
137
  {
@@ -141,19 +120,19 @@ class Blob
141
  /**
142
  * Sets blob metadata.
143
  *
144
- * @param string $metadata value.
145
- *
146
- * @return none.
147
  */
148
- public function setMetadata($metadata)
149
  {
150
  $this->_metadata = $metadata;
151
  }
152
-
153
  /**
154
  * Gets blob properties.
155
  *
156
- * @return BlobProperties.
157
  */
158
  public function getProperties()
159
  {
@@ -164,13 +143,11 @@ class Blob
164
  * Sets blob properties.
165
  *
166
  * @param BlobProperties $properties value.
167
- *
168
- * @return none.
169
  */
170
  public function setProperties($properties)
171
  {
172
  $this->_properties = $properties;
173
  }
174
  }
175
-
176
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
35
  * @link https://github.com/azure/azure-storage-php
36
  */
37
  class Blob
38
  {
 
 
 
39
  private $_name;
 
 
 
 
40
  private $_url;
 
 
 
 
41
  private $_snapshot;
 
 
 
 
42
  private $_metadata;
 
 
 
 
43
  private $_properties;
 
44
  /**
45
  * Gets blob name.
46
  *
47
+ * @return string
48
  */
49
  public function getName()
50
  {
55
  * Sets blob name.
56
  *
57
  * @param string $name value.
58
+ *
59
+ * @return void
60
  */
61
  public function setName($name)
62
  {
63
  $this->_name = $name;
64
  }
65
+
66
  /**
67
  * Gets blob snapshot.
68
  *
69
+ * @return string
70
  */
71
  public function getSnapshot()
72
  {
77
  * Sets blob snapshot.
78
  *
79
  * @param string $snapshot value.
80
+ *
81
+ * @return void
82
  */
83
  public function setSnapshot($snapshot)
84
  {
88
  /**
89
  * Gets blob url.
90
  *
91
+ * @return string
92
  */
93
  public function getUrl()
94
  {
99
  * Sets blob url.
100
  *
101
  * @param string $url value.
102
+ *
103
+ * @return void
104
  */
105
  public function setUrl($url)
106
  {
110
  /**
111
  * Gets blob metadata.
112
  *
113
+ * @return array
114
  */
115
  public function getMetadata()
116
  {
120
  /**
121
  * Sets blob metadata.
122
  *
123
+ * @param array $metadata value.
124
+ *
125
+ * @return void
126
  */
127
+ public function setMetadata(array $metadata = null)
128
  {
129
  $this->_metadata = $metadata;
130
  }
131
+
132
  /**
133
  * Gets blob properties.
134
  *
135
+ * @return BlobProperties
136
  */
137
  public function getProperties()
138
  {
143
  * Sets blob properties.
144
  *
145
  * @param BlobProperties $properties value.
146
+ *
147
+ * @return void
148
  */
149
  public function setProperties($properties)
150
  {
151
  $this->_properties = $properties;
152
  }
153
  }
 
 
vendor/microsoft/{azure-storage/src/Blob/Models/DeleteContainerOptions.php → azure-storage-blob/src/Blob/Models/BlobAccessPolicy.php} RENAMED
@@ -11,58 +11,51 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
18
  * @package MicrosoftAzure\Storage\Blob\Models
19
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
- * @copyright 2016 Microsoft Corporation
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
 
 
 
27
  /**
28
- * The optional for deleteContainer API.
29
  *
30
  * @category Microsoft
31
  * @package MicrosoftAzure\Storage\Blob\Models
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
- * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
- class DeleteContainerOptions extends BlobServiceOptions
39
  {
40
  /**
41
- * @var AccessCondition
42
- */
43
- private $_accessCondition;
44
-
45
- /**
46
- * Gets access condition
47
- *
48
- * @return AccessCondition
49
  */
50
- public function getAccessCondition()
51
  {
52
- return $this->_accessCondition;
 
 
53
  }
54
-
55
  /**
56
- * Sets access condition
57
- *
58
- * @param AccessCondition $accessCondition value to use.
59
- *
60
- * @return none.
61
  */
62
- public function setAccessCondition($accessCondition)
63
  {
64
- $this->_accessCondition = $accessCondition;
65
  }
66
  }
67
-
68
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
18
  * @package MicrosoftAzure\Storage\Blob\Models
19
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2017 Microsoft Corporation
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources;
28
+ use MicrosoftAzure\Storage\Common\Models\AccessPolicy;
29
+
30
  /**
31
+ * Holds access policy elements
32
  *
33
  * @category Microsoft
34
  * @package MicrosoftAzure\Storage\Blob\Models
35
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
36
+ * @copyright 2017 Microsoft Corporation
37
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
38
  * @link https://github.com/azure/azure-storage-php
39
  */
40
+ class BlobAccessPolicy extends AccessPolicy
41
  {
42
  /**
43
+ * Get the valid permissions for the given resource.
44
+ *
45
+ * @return array
 
 
 
 
 
46
  */
47
+ public static function getResourceValidPermissions()
48
  {
49
+ return BlobResources::ACCESS_PERMISSIONS[
50
+ BlobResources::RESOURCE_TYPE_BLOB
51
+ ];
52
  }
53
+
54
  /**
55
+ * Constructor
 
 
 
 
56
  */
57
+ public function __construct()
58
  {
59
+ parent::__construct(BlobResources::RESOURCE_TYPE_BLOB);
60
  }
61
  }
 
 
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BlobBlockType.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,7 +21,7 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
@@ -32,7 +32,6 @@ namespace MicrosoftAzure\Storage\Blob\Models;
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
  class BlobBlockType
@@ -40,26 +39,26 @@ class BlobBlockType
40
  const COMMITTED_TYPE = 'Committed';
41
  const UNCOMMITTED_TYPE = 'Uncommitted';
42
  const LATEST_TYPE = 'Latest';
43
-
44
  /**
45
  * Validates the provided type.
46
- *
47
  * @param string $type The entry type.
48
- *
 
 
49
  * @return boolean
50
  */
51
  public static function isValid($type)
52
  {
53
  switch ($type) {
54
- case self::COMMITTED_TYPE:
55
- case self::LATEST_TYPE:
56
- case self::UNCOMMITTED_TYPE:
57
- return true;
58
-
59
- default:
60
- return false;
61
  }
62
  }
63
  }
64
-
65
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
35
  * @link https://github.com/azure/azure-storage-php
36
  */
37
  class BlobBlockType
39
  const COMMITTED_TYPE = 'Committed';
40
  const UNCOMMITTED_TYPE = 'Uncommitted';
41
  const LATEST_TYPE = 'Latest';
42
+
43
  /**
44
  * Validates the provided type.
45
+ *
46
  * @param string $type The entry type.
47
+ *
48
+ * @internal
49
+ *
50
  * @return boolean
51
  */
52
  public static function isValid($type)
53
  {
54
  switch ($type) {
55
+ case self::COMMITTED_TYPE:
56
+ case self::LATEST_TYPE:
57
+ case self::UNCOMMITTED_TYPE:
58
+ return true;
59
+
60
+ default:
61
+ return false;
62
  }
63
  }
64
  }
 
 
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BlobPrefix.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,7 +21,7 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
@@ -32,20 +32,16 @@ namespace MicrosoftAzure\Storage\Blob\Models;
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
  class BlobPrefix
39
  {
40
- /**
41
- * @var string
42
- */
43
  private $_name;
44
-
45
  /**
46
  * Gets blob name.
47
  *
48
- * @return string.
49
  */
50
  public function getName()
51
  {
@@ -56,13 +52,11 @@ class BlobPrefix
56
  * Sets blob name.
57
  *
58
  * @param string $name value.
59
- *
60
- * @return none.
61
  */
62
  public function setName($name)
63
  {
64
  $this->_name = $name;
65
  }
66
  }
67
-
68
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
35
  * @link https://github.com/azure/azure-storage-php
36
  */
37
  class BlobPrefix
38
  {
 
 
 
39
  private $_name;
40
+
41
  /**
42
  * Gets blob name.
43
  *
44
+ * @return string
45
  */
46
  public function getName()
47
  {
52
  * Sets blob name.
53
  *
54
  * @param string $name value.
55
+ *
56
+ * @return void
57
  */
58
  public function setName($name)
59
  {
60
  $this->_name = $name;
61
  }
62
  }
 
 
vendor/microsoft/azure-storage-blob/src/Blob/Models/BlobProperties.php ADDED
@@ -0,0 +1,799 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
+ use MicrosoftAzure\Storage\Common\Internal\Validate;
29
+ use MicrosoftAzure\Storage\Common\Internal\Utilities;
30
+
31
+ /**
32
+ * Represents blob properties
33
+ *
34
+ * @category Microsoft
35
+ * @package MicrosoftAzure\Storage\Blob\Models
36
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
37
+ * @copyright 2016 Microsoft Corporation
38
+ * @license https://github.com/azure/azure-storage-php/LICENSE
39
+ * @link https://github.com/azure/azure-storage-php
40
+ */
41
+ class BlobProperties
42
+ {
43
+ private $lastModified;
44
+ private $etag;
45
+ private $contentType;
46
+ private $contentLength;
47
+ private $contentEncoding;
48
+ private $contentLanguage;
49
+ private $contentMD5;
50
+ private $contentRange;
51
+ private $cacheControl;
52
+ private $contentDisposition;
53
+ private $blobType;
54
+ private $leaseStatus;
55
+ private $leaseState;
56
+ private $leaseDuration;
57
+ private $sequenceNumber;
58
+ private $serverEncrypted;
59
+ private $committedBlockCount;
60
+ private $copyState;
61
+ private $copyDestinationSnapshot;
62
+ private $incrementalCopy;
63
+ private $rangeContentMD5;
64
+ private $accessTier;
65
+ private $accessTierInferred;
66
+ private $accessTierChangeTime;
67
+ private $archiveStatus;
68
+
69
+ /**
70
+ * Creates BlobProperties object from $parsed response in array representation of XML elements
71
+ *
72
+ * @param array $parsed parsed response in array format.
73
+ *
74
+ * @internal
75
+ *
76
+ * @return BlobProperties
77
+ */
78
+ public static function createFromXml(array $parsed)
79
+ {
80
+ $result = new BlobProperties();
81
+ $clean = array_change_key_case($parsed);
82
+
83
+ $result->setCommonBlobProperties($clean);
84
+ $result->setLeaseStatus(Utilities::tryGetValue($clean, 'leasestatus'));
85
+ $result->setLeaseState(Utilities::tryGetValue($clean, 'leasestate'));
86
+ $result->setLeaseDuration(Utilities::tryGetValue($clean, 'leaseduration'));
87
+ $result->setCopyState(CopyState::createFromXml($clean));
88
+
89
+ $result->setIncrementalCopy(
90
+ Utilities::toBoolean(
91
+ Utilities::tryGetValue($clean, 'incrementalcopy'),
92
+ true
93
+ )
94
+ );
95
+
96
+ $result->setAccessTier((
97
+ Utilities::tryGetValue($clean, 'accesstier')
98
+ ));
99
+
100
+ $result->setAccessTierInferred(
101
+ Utilities::toBoolean(
102
+ Utilities::tryGetValue($clean, 'accesstierinferred'),
103
+ true
104
+ )
105
+ );
106
+
107
+ $date = Utilities::tryGetValue($clean, 'accesstierchangetime');
108
+ if (!is_null($date)) {
109
+ $date = Utilities::rfc1123ToDateTime($date);
110
+ $result->setAccessTierChangeTime($date);
111
+ }
112
+
113
+ $result->setArchiveStatus(
114
+ Utilities::tryGetValue($clean, 'archivestatus')
115
+ );
116
+
117
+ return $result;
118
+ }
119
+
120
+ /**
121
+ * Creates BlobProperties object from $parsed response in array representation of http headers
122
+ *
123
+ * @param array $parsed parsed response in array format.
124
+ *
125
+ * @internal
126
+ *
127
+ * @return BlobProperties
128
+ */
129
+ public static function createFromHttpHeaders(array $parsed)
130
+ {
131
+ $result = new BlobProperties();
132
+ $clean = array_change_key_case($parsed);
133
+
134
+ $result->setCommonBlobProperties($clean);
135
+
136
+ $result->setBlobType(Utilities::tryGetValue($clean, Resources::X_MS_BLOB_TYPE));
137
+ $result->setLeaseStatus(Utilities::tryGetValue($clean, Resources::X_MS_LEASE_STATUS));
138
+ $result->setLeaseState(Utilities::tryGetValue($clean, Resources::X_MS_LEASE_STATE));
139
+ $result->setLeaseDuration(Utilities::tryGetValue($clean, Resources::X_MS_LEASE_DURATION));
140
+ $result->setCopyState(CopyState::createFromHttpHeaders($clean));
141
+
142
+ $result->setServerEncrypted(
143
+ Utilities::toBoolean(
144
+ Utilities::tryGetValue(
145
+ $clean,
146
+ Resources::X_MS_SERVER_ENCRYPTED
147
+ ),
148
+ true
149
+ )
150
+ );
151
+ $result->setIncrementalCopy(
152
+ Utilities::toBoolean(
153
+ Utilities::tryGetValue(
154
+ $clean,
155
+ Resources::X_MS_INCREMENTAL_COPY
156
+ ),
157
+ true
158
+ )
159
+ );
160
+ $result->setCommittedBlockCount(
161
+ intval(Utilities::tryGetValue(
162
+ $clean,
163
+ Resources::X_MS_BLOB_COMMITTED_BLOCK_COUNT
164
+ ))
165
+ );
166
+ $result->setCopyDestinationSnapshot(
167
+ Utilities::tryGetValue(
168
+ $clean,
169
+ Resources::X_MS_COPY_DESTINATION_SNAPSHOT
170
+ )
171
+ );
172
+
173
+ $result->setAccessTier((
174
+ Utilities::tryGetValue($clean, Resources::X_MS_ACCESS_TIER)
175
+ ));
176
+
177
+ $result->setAccessTierInferred(
178
+ Utilities::toBoolean(
179
+ Utilities::tryGetValue($clean, Resources::X_MS_ACCESS_TIER_INFERRED),
180
+ true
181
+ )
182
+ );
183
+
184
+ $date = Utilities::tryGetValue($clean, Resources::X_MS_ACCESS_TIER_CHANGE_TIME);
185
+ if (!is_null($date)) {
186
+ $date = Utilities::rfc1123ToDateTime($date);
187
+ $result->setAccessTierChangeTime($date);
188
+ }
189
+
190
+ $result->setArchiveStatus(
191
+ Utilities::tryGetValue($clean, Resources::X_MS_ARCHIVE_STATUS)
192
+ );
193
+
194
+ return $result;
195
+ }
196
+
197
+ /**
198
+ * Gets blob lastModified.
199
+ *
200
+ * @return \DateTime
201
+ */
202
+ public function getLastModified()
203
+ {
204
+ return $this->lastModified;
205
+ }
206
+
207
+ /**
208
+ * Sets blob lastModified.
209
+ *
210
+ * @param \DateTime $lastModified value.
211
+ *
212
+ * @return void
213
+ */
214
+ public function setLastModified(\DateTime $lastModified)
215
+ {
216
+ Validate::isDate($lastModified);
217
+ $this->lastModified = $lastModified;
218
+ }
219
+
220
+ /**
221
+ * Gets blob etag.
222
+ *
223
+ * @return string
224
+ */
225
+ public function getETag()
226
+ {
227
+ return $this->etag;
228
+ }
229
+
230
+ /**
231
+ * Sets blob etag.
232
+ *
233
+ * @param string $etag value.
234
+ *
235
+ * @return void
236
+ */
237
+ public function setETag($etag)
238
+ {
239
+ $this->etag = $etag;
240
+ }
241
+
242
+ /**
243
+ * Gets blob contentType.
244
+ *
245
+ * @return string
246
+ */
247
+ public function getContentType()
248
+ {
249
+ return $this->contentType;
250
+ }
251
+
252
+ /**
253
+ * Sets blob contentType.
254
+ *
255
+ * @param string $contentType value.
256
+ *
257
+ * @return void
258
+ */
259
+ public function setContentType($contentType)
260
+ {
261
+ $this->contentType = $contentType;
262
+ }
263
+
264
+ /**
265
+ * Gets blob contentRange.
266
+ *
267
+ * @return string
268
+ */
269
+ public function getContentRange()
270
+ {
271
+ return $this->contentRange;
272
+ }
273
+
274
+ /**
275
+ * Sets blob contentRange.
276
+ *
277
+ * @param string $contentRange value.
278
+ *
279
+ * @return void
280
+ */
281
+ public function setContentRange($contentRange)
282
+ {
283
+ $this->contentRange = $contentRange;
284
+ }
285
+
286
+ /**
287
+ * Gets blob contentLength.
288
+ *
289
+ * @return integer
290
+ */
291
+ public function getContentLength()
292
+ {
293
+ return $this->contentLength;
294
+ }
295
+
296
+ /**
297
+ * Sets blob contentLength.
298
+ *
299
+ * @param integer $contentLength value.
300
+ *
301
+ * @return void
302
+ */
303
+ public function setContentLength($contentLength)
304
+ {
305
+ Validate::isInteger($contentLength, 'contentLength');
306
+ $this->contentLength = $contentLength;
307
+ }
308
+
309
+ /**
310
+ * Gets blob contentEncoding.
311
+ *
312
+ * @return string
313
+ */
314
+ public function getContentEncoding()
315
+ {
316
+ return $this->contentEncoding;
317
+ }
318
+
319
+ /**
320
+ * Sets blob contentEncoding.
321
+ *
322
+ * @param string $contentEncoding value.
323
+ *
324
+ * @return void
325
+ */
326
+ public function setContentEncoding($contentEncoding)
327
+ {
328
+ $this->contentEncoding = $contentEncoding;
329
+ }
330
+
331
+ /**
332
+ * Gets blob access tier.
333
+ *
334
+ * @return string
335
+ */
336
+ public function getAccessTier()
337
+ {
338
+ return $this->accessTier;
339
+ }
340
+
341
+ /**
342
+ * Sets blob access tier.
343
+ *
344
+ * @param string $accessTier value.
345
+ *
346
+ * @return void
347
+ */
348
+ public function setAccessTier($accessTier)
349
+ {
350
+ $this->accessTier = $accessTier;
351
+ }
352
+
353
+ /**
354
+ * Gets blob archive status.
355
+ *
356
+ * @return string
357
+ */
358
+ public function getArchiveStatus()
359
+ {
360
+ return $this->archiveStatus;
361
+ }
362
+
363
+ /**
364
+ * Sets blob archive status.
365
+ *
366
+ * @param string $archiveStatus value.
367
+ *
368
+ * @return void
369
+ */
370
+ public function setArchiveStatus($archiveStatus)
371
+ {
372
+ $this->archiveStatus = $archiveStatus;
373
+ }
374
+
375
+ /**
376
+ * Gets blob access inferred.
377
+ *
378
+ * @return boolean
379
+ */
380
+ public function getAccessTierInferred()
381
+ {
382
+ return $this->accessTierInferred;
383
+ }
384
+
385
+ /**
386
+ * Sets blob access tier inferred.
387
+ *
388
+ * @param boolean $accessTierInferred value.
389
+ *
390
+ * @return void
391
+ */
392
+ public function setAccessTierInferred($accessTierInferred)
393
+ {
394
+ Validate::isBoolean($accessTierInferred);
395
+ $this->accessTierInferred = $accessTierInferred;
396
+ }
397
+
398
+ /**
399
+ * Gets blob access tier change time.
400
+ *
401
+ * @return \DateTime
402
+ */
403
+ public function getAccessTierChangeTime()
404
+ {
405
+ return $this->accessTierChangeTime;
406
+ }
407
+
408
+ /**
409
+ * Sets blob access tier change time.
410
+ *
411
+ * @param \DateTime $accessTierChangeTime value.
412
+ *
413
+ * @return void
414
+ */
415
+ public function setAccessTierChangeTime(\DateTime $accessTierChangeTime)
416
+ {
417
+ Validate::isDate($accessTierChangeTime);
418
+ $this->accessTierChangeTime = $accessTierChangeTime;
419
+ }
420
+
421
+ /**
422
+ * Gets blob contentLanguage.
423
+ *
424
+ * @return string
425
+ */
426
+ public function getContentLanguage()
427
+ {
428
+ return $this->contentLanguage;
429
+ }
430
+
431
+ /**
432
+ * Sets blob contentLanguage.
433
+ *
434
+ * @param string $contentLanguage value.
435
+ *
436
+ * @return void
437
+ */
438
+ public function setContentLanguage($contentLanguage)
439
+ {
440
+ $this->contentLanguage = $contentLanguage;
441
+ }
442
+
443
+ /**
444
+ * Gets blob contentMD5.
445
+ *
446
+ * @return string
447
+ */
448
+ public function getContentMD5()
449
+ {
450
+ return $this->contentMD5;
451
+ }
452
+
453
+ /**
454
+ * Sets blob contentMD5.
455
+ *
456
+ * @param string $contentMD5 value.
457
+ *
458
+ * @return void
459
+ */
460
+ public function setContentMD5($contentMD5)
461
+ {
462
+ $this->contentMD5 = $contentMD5;
463
+ }
464
+
465
+ /**
466
+ * Gets blob range contentMD5.
467
+ *
468
+ * @return string
469
+ */
470
+ public function getRangeContentMD5()
471
+ {
472
+ return $this->rangeContentMD5;
473
+ }
474
+
475
+ /**
476
+ * Sets blob range contentMD5.
477
+ *
478
+ * @param string rangeContentMD5 value.
479
+ *
480
+ * @return void
481
+ */
482
+ public function setRangeContentMD5($rangeContentMD5)
483
+ {
484
+ $this->rangeContentMD5 = $rangeContentMD5;
485
+ }
486
+
487
+ /**
488
+ * Gets blob cacheControl.
489
+ *
490
+ * @return string
491
+ */
492
+ public function getCacheControl()
493
+ {
494
+ return $this->cacheControl;
495
+ }
496
+
497
+ /**
498
+ * Sets blob cacheControl.
499
+ *
500
+ * @param string $cacheControl value.
501
+ *
502
+ * @return void
503
+ */
504
+ public function setCacheControl($cacheControl)
505
+ {
506
+ $this->cacheControl = $cacheControl;
507
+ }
508
+
509
+ /**
510
+ * Gets blob contentDisposition.
511
+ *
512
+ * @return string
513
+ */
514
+ public function getContentDisposition()
515
+ {
516
+ return $this->contentDisposition;
517
+ }
518
+
519
+ /**
520
+ * Sets blob contentDisposition.
521
+ *
522
+ * @param string $contentDisposition value.
523
+ *
524
+ * @return void
525
+ */
526
+ public function setContentDisposition($contentDisposition)
527
+ {
528
+ $this->contentDisposition = $contentDisposition;
529
+ }
530
+
531
+ /**
532
+ * Gets blob blobType.
533
+ *
534
+ * @return string
535
+ */
536
+ public function getBlobType()
537
+ {
538
+ return $this->blobType;
539
+ }
540
+
541
+ /**
542
+ * Sets blob blobType.
543
+ *
544
+ * @param string $blobType value.
545
+ *
546
+ * @return void
547
+ */
548
+ public function setBlobType($blobType)
549
+ {
550
+ $this->blobType = $blobType;
551
+ }
552
+
553
+ /**
554
+ * Gets blob leaseStatus.
555
+ *
556
+ * @return string
557
+ */
558
+ public function getLeaseStatus()
559
+ {
560
+ return $this->leaseStatus;
561
+ }
562
+
563
+ /**
564
+ * Sets blob leaseStatus.
565
+ *
566
+ * @param string $leaseStatus value.
567
+ *
568
+ * @return void
569
+ */
570
+ public function setLeaseStatus($leaseStatus)
571
+ {
572
+ $this->leaseStatus = $leaseStatus;
573
+ }
574
+
575
+ /**
576
+ * Gets blob lease state.
577
+ *
578
+ * @return string
579
+ */
580
+ public function getLeaseState()
581
+ {
582
+ return $this->leaseState;
583
+ }
584
+
585
+ /**
586
+ * Sets blob lease state.
587
+ *
588
+ * @param string $leaseState value.
589
+ *
590
+ * @return void
591
+ */
592
+ public function setLeaseState($leaseState)
593
+ {
594
+ $this->leaseState = $leaseState;
595
+ }
596
+
597
+ /**
598
+ * Gets blob lease duration.
599
+ *
600
+ * @return string
601
+ */
602
+ public function getLeaseDuration()
603
+ {
604
+ return $this->leaseDuration;
605
+ }
606
+
607
+ /**
608
+ * Sets blob leaseStatus.
609
+ *
610
+ * @param string $leaseDuration value.
611
+ *
612
+ * @return void
613
+ */
614
+ public function setLeaseDuration($leaseDuration)
615
+ {
616
+ $this->leaseDuration = $leaseDuration;
617
+ }
618
+
619
+ /**
620
+ * Gets blob sequenceNumber.
621
+ *
622
+ * @return int
623
+ */
624
+ public function getSequenceNumber()
625
+ {
626
+ return $this->sequenceNumber;
627
+ }
628
+
629
+ /**
630
+ * Sets blob sequenceNumber.
631
+ *
632
+ * @param int $sequenceNumber value.
633
+ *
634
+ * @return void
635
+ */
636
+ public function setSequenceNumber($sequenceNumber)
637
+ {
638
+ Validate::isInteger($sequenceNumber, 'sequenceNumber');
639
+ $this->sequenceNumber = $sequenceNumber;
640
+ }
641
+
642
+ /**
643
+ * Gets the server encryption status of the blob.
644
+ *
645
+ * @return boolean
646
+ */
647
+ public function getServerEncrypted()
648
+ {
649
+ return $this->serverEncrypted;
650
+ }
651
+
652
+ /**
653
+ * Sets the server encryption status of the blob.
654
+ *
655
+ * @param boolean $serverEncrypted
656
+ *
657
+ * @return void
658
+ */
659
+ public function setServerEncrypted($serverEncrypted)
660
+ {
661
+ $this->serverEncrypted = $serverEncrypted;
662
+ }
663
+
664
+ /**
665
+ * Gets the number of committed blocks present in the blob.
666
+ *
667
+ * @return int
668
+ */
669
+ public function getCommittedBlockCount()
670
+ {
671
+ return $this->committedBlockCount;
672
+ }
673
+
674
+ /**
675
+ * Sets the number of committed blocks present in the blob.
676
+ *
677
+ * @param int $committedBlockCount the number of committed blocks present in the blob.
678
+ *
679
+ * @return void
680
+ */
681
+ public function setCommittedBlockCount($committedBlockCount)
682
+ {
683
+ $this->committedBlockCount = $committedBlockCount;
684
+ }
685
+
686
+ /**
687
+ * Gets copy state of the blob.
688
+ *
689
+ * @return CopyState
690
+ */
691
+ public function getCopyState()
692
+ {
693
+ return $this->copyState;
694
+ }
695
+
696
+ /**
697
+ * Sets the copy state of the blob.
698
+ *
699
+ * @param CopyState $copyState the copy state of the blob.
700
+ *
701
+ * @return void
702
+ */
703
+ public function setCopyState($copyState)
704
+ {
705
+ $this->copyState = $copyState;
706
+ }
707
+
708
+ /**
709
+ * Gets snapshot time of the last successful incremental copy snapshot for this blob.
710
+ *
711
+ * @return string
712
+ */
713
+ public function getCopyDestinationSnapshot()
714
+ {
715
+ return $this->copyDestinationSnapshot;
716
+ }
717
+
718
+ /**
719
+ * Sets snapshot time of the last successful incremental copy snapshot for this blob.
720
+ *
721
+ * @param string $copyDestinationSnapshot last successful incremental copy snapshot.
722
+ */
723
+ public function setCopyDestinationSnapshot($copyDestinationSnapshot)
724
+ {
725
+ $this->copyDestinationSnapshot = $copyDestinationSnapshot;
726
+ }
727
+
728
+ /**
729
+ * Gets whether the blob is an incremental copy blob.
730
+ *
731
+ * @return boolean
732
+ */
733
+ public function getIncrementalCopy()
734
+ {
735
+ return $this->incrementalCopy;
736
+ }
737
+
738
+ /**
739
+ * Sets whether the blob is an incremental copy blob.
740
+ *
741
+ * @param boolean $incrementalCopy whether blob is an incremental copy blob.
742
+ */
743
+ public function setIncrementalCopy($incrementalCopy)
744
+ {
745
+ $this->incrementalCopy = $incrementalCopy;
746
+ }
747
+
748
+ private function setCommonBlobProperties(array $clean)
749
+ {
750
+ $date = Utilities::tryGetValue($clean, Resources::LAST_MODIFIED);
751
+ if (!is_null($date)) {
752
+ $date = Utilities::rfc1123ToDateTime($date);
753
+ $this->setLastModified($date);
754
+ }
755
+
756
+ $this->setBlobType(Utilities::tryGetValue($clean, 'blobtype'));
757
+
758
+ $this->setContentLength(intval($clean[Resources::CONTENT_LENGTH]));
759
+ $this->setETag(Utilities::tryGetValue($clean, Resources::ETAG));
760
+ $this->setSequenceNumber(
761
+ intval(
762
+ Utilities::tryGetValue($clean, Resources::X_MS_BLOB_SEQUENCE_NUMBER)
763
+ )
764
+ );
765
+ $this->setContentRange(
766
+ Utilities::tryGetValue($clean, Resources::CONTENT_RANGE)
767
+ );
768
+ $this->setCacheControl(
769
+ Utilities::tryGetValue($clean, Resources::CACHE_CONTROL)
770
+ );
771
+ $this->setContentDisposition(
772
+ Utilities::tryGetValue($clean, Resources::CONTENT_DISPOSITION)
773
+ );
774
+ $this->setContentEncoding(
775
+ Utilities::tryGetValue($clean, Resources::CONTENT_ENCODING)
776
+ );
777
+ $this->setContentLanguage(
778
+ Utilities::tryGetValue($clean, Resources::CONTENT_LANGUAGE)
779
+ );
780
+ $this->setContentType(
781
+ Utilities::tryGetValue($clean, Resources::CONTENT_TYPE)
782
+ );
783
+
784
+ if (Utilities::tryGetValue($clean, Resources::CONTENT_MD5) &&
785
+ !Utilities::tryGetValue($clean, Resources::CONTENT_RANGE)
786
+ ) {
787
+ $this->setContentMD5(
788
+ Utilities::tryGetValue($clean, Resources::CONTENT_MD5)
789
+ );
790
+ } else {
791
+ $this->setContentMD5(
792
+ Utilities::tryGetValue($clean, Resources::BLOB_CONTENT_MD5)
793
+ );
794
+ $this->setRangeContentMD5(
795
+ Utilities::tryGetValue($clean, Resources::CONTENT_MD5)
796
+ );
797
+ }
798
+ }
799
+ }
vendor/microsoft/{azure-storage/src/Blob/Models/SetBlobMetadataOptions.php → azure-storage-blob/src/Blob/Models/BlobServiceOptions.php} RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,75 +21,72 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
 
 
27
  /**
28
- * The optional parameters for setBlobMetadata API.
29
  *
30
  * @category Microsoft
31
  * @package MicrosoftAzure\Storage\Blob\Models
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
- class SetBlobMetadataOptions extends BlobServiceOptions
39
  {
40
- /**
41
- * @var string
42
- */
43
  private $_leaseId;
44
-
45
- /**
46
- * @var AccessCondition
47
- */
48
- private $_accessCondition;
49
-
50
  /**
51
  * Gets lease Id for the blob
52
- *
53
  * @return string
54
  */
55
  public function getLeaseId()
56
  {
57
  return $this->_leaseId;
58
  }
59
-
60
  /**
61
  * Sets lease Id for the blob
62
- *
63
  * @param string $leaseId the blob lease id.
64
- *
65
- * @return none
66
  */
67
  public function setLeaseId($leaseId)
68
  {
69
  $this->_leaseId = $leaseId;
70
  }
71
-
72
  /**
73
  * Gets access condition
74
- *
75
- * @return AccessCondition
76
  */
77
- public function getAccessCondition()
78
  {
79
- return $this->_accessCondition;
80
  }
81
-
82
  /**
83
  * Sets access condition
84
- *
85
- * @param AccessCondition $accessCondition value to use.
86
- *
87
- * @return none.
88
  */
89
- public function setAccessCondition($accessCondition)
90
  {
91
- $this->_accessCondition = $accessCondition;
 
 
 
 
 
92
  }
93
  }
94
-
95
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
+ use MicrosoftAzure\Storage\Common\Models\ServiceOptions;
28
+
29
  /**
30
+ * Blob service options.
31
  *
32
  * @category Microsoft
33
  * @package MicrosoftAzure\Storage\Blob\Models
34
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
35
  * @copyright 2016 Microsoft Corporation
36
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
37
  * @link https://github.com/azure/azure-storage-php
38
  */
39
+ class BlobServiceOptions extends ServiceOptions
40
  {
 
 
 
41
  private $_leaseId;
42
+ private $_accessConditions;
43
+
 
 
 
 
44
  /**
45
  * Gets lease Id for the blob
46
+ *
47
  * @return string
48
  */
49
  public function getLeaseId()
50
  {
51
  return $this->_leaseId;
52
  }
53
+
54
  /**
55
  * Sets lease Id for the blob
56
+ *
57
  * @param string $leaseId the blob lease id.
58
+ *
59
+ * @return void
60
  */
61
  public function setLeaseId($leaseId)
62
  {
63
  $this->_leaseId = $leaseId;
64
  }
65
+
66
  /**
67
  * Gets access condition
68
+ *
69
+ * @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition[]
70
  */
71
+ public function getAccessConditions()
72
  {
73
+ return $this->_accessConditions;
74
  }
75
+
76
  /**
77
  * Sets access condition
78
+ *
79
+ * @param mixed $accessConditions value to use.
80
+ *
81
+ * @return void
82
  */
83
+ public function setAccessConditions($accessConditions)
84
  {
85
+ if (!is_null($accessConditions) &&
86
+ is_array($accessConditions)) {
87
+ $this->_accessConditions = $accessConditions;
88
+ } else {
89
+ $this->_accessConditions = [$accessConditions];
90
+ }
91
  }
92
  }
 
 
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BlobType.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,7 +21,7 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
@@ -32,13 +32,11 @@ namespace MicrosoftAzure\Storage\Blob\Models;
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
  class BlobType
39
  {
40
  const BLOCK_BLOB = 'BlockBlob';
41
  const PAGE_BLOB = 'PageBlob';
 
42
  }
43
-
44
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
35
  * @link https://github.com/azure/azure-storage-php
36
  */
37
  class BlobType
38
  {
39
  const BLOCK_BLOB = 'BlockBlob';
40
  const PAGE_BLOB = 'PageBlob';
41
+ const APPEND_BLOB = 'AppendBlob';
42
  }
 
 
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/Block.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,7 +21,7 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
@@ -32,58 +32,62 @@ namespace MicrosoftAzure\Storage\Blob\Models;
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
  class Block
39
  {
40
- /**
41
- * @var string
42
- */
43
  private $_blockId;
44
-
 
45
  /**
46
- * @var string
 
 
 
47
  */
48
- private $_type;
49
-
 
 
 
 
50
  /**
51
  * Sets the blockId.
52
- *
53
  * @param string $blockId The id of the block.
54
- *
55
- * @return none
56
  */
57
  public function setBlockId($blockId)
58
  {
59
  $this->_blockId = $blockId;
60
  }
61
-
62
  /**
63
  * Gets the blockId.
64
- *
65
  * @return string
66
  */
67
  public function getBlockId()
68
  {
69
  return $this->_blockId;
70
  }
71
-
72
  /**
73
  * Sets the type.
74
- *
75
  * @param string $type The type of the block.
76
- *
77
- * @return none
78
  */
79
  public function setType($type)
80
  {
81
  $this->_type = $type;
82
  }
83
-
84
  /**
85
  * Gets the type.
86
- *
87
  * @return string
88
  */
89
  public function getType()
@@ -91,5 +95,3 @@ class Block
91
  return $this->_type;
92
  }
93
  }
94
-
95
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
35
  * @link https://github.com/azure/azure-storage-php
36
  */
37
  class Block
38
  {
 
 
 
39
  private $_blockId;
40
+ private $_type;
41
+
42
  /**
43
+ * Constructor.
44
+ *
45
+ * @param string $blockId The ID of this block.
46
+ * @param string $type The type of the block.
47
  */
48
+ public function __construct($blockId = '', $type = '')
49
+ {
50
+ $this->_blockId = $blockId;
51
+ $this->_type = $type;
52
+ }
53
+
54
  /**
55
  * Sets the blockId.
56
+ *
57
  * @param string $blockId The id of the block.
58
+ *
59
+ * @return void
60
  */
61
  public function setBlockId($blockId)
62
  {
63
  $this->_blockId = $blockId;
64
  }
65
+
66
  /**
67
  * Gets the blockId.
68
+ *
69
  * @return string
70
  */
71
  public function getBlockId()
72
  {
73
  return $this->_blockId;
74
  }
75
+
76
  /**
77
  * Sets the type.
78
+ *
79
  * @param string $type The type of the block.
80
+ *
81
+ * @return void
82
  */
83
  public function setType($type)
84
  {
85
  $this->_type = $type;
86
  }
87
+
88
  /**
89
  * Gets the type.
90
+ *
91
  * @return string
92
  */
93
  public function getType()
95
  return $this->_type;
96
  }
97
  }
 
 
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BlockList.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,12 +21,12 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
 
 
26
  use MicrosoftAzure\Storage\Common\Internal\Validate;
27
- use MicrosoftAzure\Storage\Common\Internal\Resources;
28
  use MicrosoftAzure\Storage\Common\Internal\Serialization\XmlSerializer;
29
- use MicrosoftAzure\Storage\Blob\Models\Block;
30
 
31
  /**
32
  * Holds block list used for commitBlobBlocks
@@ -36,46 +36,42 @@ use MicrosoftAzure\Storage\Blob\Models\Block;
36
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
37
  * @copyright 2016 Microsoft Corporation
38
  * @license https://github.com/azure/azure-storage-php/LICENSE
39
- * @version Release: 0.10.2
40
  * @link https://github.com/azure/azure-storage-php
41
  */
42
  class BlockList
43
  {
44
- /**
45
- * @var array
46
- */
47
- private $_entries;
48
- public static $xmlRootName = 'BlockList';
49
-
50
  /**
51
  * Creates block list from array of blocks.
52
- *
53
- * @param array $array The blocks array.
54
- *
55
  * @return BlockList
56
  */
57
- public static function create($array)
58
  {
59
  $blockList = new BlockList();
60
-
61
  foreach ($array as $value) {
62
  $blockList->addEntry($value->getBlockId(), $value->getType());
63
  }
64
-
65
  return $blockList;
66
  }
67
-
68
  /**
69
  * Adds new entry to the block list entries.
70
- *
71
  * @param string $blockId The block id.
72
  * @param string $type The entry type, you can use BlobBlockType.
73
- *
74
- * @return none
75
  */
76
  public function addEntry($blockId, $type)
77
  {
78
- Validate::isString($blockId, 'blockId');
79
  Validate::isTrue(
80
  BlobBlockType::isValid($type),
81
  sprintf(Resources::INVALID_BTE_MSG, get_class(new BlobBlockType()))
@@ -83,93 +79,94 @@ class BlockList
83
  $block = new Block();
84
  $block->setBlockId($blockId);
85
  $block->setType($type);
86
-
87
- $this->_entries[] = $block;
88
  }
89
-
90
  /**
91
  * Addds committed block entry.
92
- *
93
  * @param string $blockId The block id.
94
- *
95
- * @return none
96
  */
97
  public function addCommittedEntry($blockId)
98
  {
99
  $this->addEntry($blockId, BlobBlockType::COMMITTED_TYPE);
100
  }
101
-
102
  /**
103
  * Addds uncommitted block entry.
104
- *
105
  * @param string $blockId The block id.
106
- *
107
- * @return none
108
  */
109
  public function addUncommittedEntry($blockId)
110
  {
111
  $this->addEntry($blockId, BlobBlockType::UNCOMMITTED_TYPE);
112
  }
113
-
114
  /**
115
  * Addds latest block entry.
116
- *
117
  * @param string $blockId The block id.
118
- *
119
- * @return none
120
  */
121
  public function addLatestEntry($blockId)
122
  {
123
  $this->addEntry($blockId, BlobBlockType::LATEST_TYPE);
124
  }
125
-
126
  /**
127
  * Gets blob block entry.
128
- *
129
  * @param string $blockId The id of the block.
130
- *
131
  * @return Block
132
  */
133
  public function getEntry($blockId)
134
  {
135
- foreach ($this->_entries as $value) {
136
  if ($blockId == $value->getBlockId()) {
137
  return $value;
138
  }
139
  }
140
-
141
  return null;
142
  }
143
-
144
  /**
145
  * Gets all blob block entries.
146
- *
147
- * @return string
148
  */
149
  public function getEntries()
150
  {
151
- return $this->_entries;
152
  }
153
-
154
  /**
155
  * Converts the BlockList object to XML representation
156
- *
157
  * @param XmlSerializer $xmlSerializer The XML serializer.
158
- *
 
 
159
  * @return string
160
  */
161
- public function toXml($xmlSerializer)
162
  {
163
  $properties = array(XmlSerializer::ROOT_NAME => self::$xmlRootName);
164
  $array = array();
165
-
166
- foreach ($this->_entries as $value) {
167
  $array[] = array(
168
  $value->getType() => $value->getBlockId()
169
  );
170
  }
171
-
172
  return $xmlSerializer->serialize($array, $properties);
173
  }
174
  }
175
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
  use MicrosoftAzure\Storage\Common\Internal\Validate;
 
29
  use MicrosoftAzure\Storage\Common\Internal\Serialization\XmlSerializer;
 
30
 
31
  /**
32
  * Holds block list used for commitBlobBlocks
36
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
37
  * @copyright 2016 Microsoft Corporation
38
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
39
  * @link https://github.com/azure/azure-storage-php
40
  */
41
  class BlockList
42
  {
43
+ private $entries;
44
+ private static $xmlRootName = 'BlockList';
45
+
 
 
 
46
  /**
47
  * Creates block list from array of blocks.
48
+ *
49
+ * @param Block[] The blocks array.
50
+ *
51
  * @return BlockList
52
  */
53
+ public static function create(array $array)
54
  {
55
  $blockList = new BlockList();
56
+
57
  foreach ($array as $value) {
58
  $blockList->addEntry($value->getBlockId(), $value->getType());
59
  }
60
+
61
  return $blockList;
62
  }
63
+
64
  /**
65
  * Adds new entry to the block list entries.
66
+ *
67
  * @param string $blockId The block id.
68
  * @param string $type The entry type, you can use BlobBlockType.
69
+ *
70
+ * @return void
71
  */
72
  public function addEntry($blockId, $type)
73
  {
74
+ Validate::canCastAsString($blockId, 'blockId');
75
  Validate::isTrue(
76
  BlobBlockType::isValid($type),
77
  sprintf(Resources::INVALID_BTE_MSG, get_class(new BlobBlockType()))
79
  $block = new Block();
80
  $block->setBlockId($blockId);
81
  $block->setType($type);
82
+
83
+ $this->entries[] = $block;
84
  }
85
+
86
  /**
87
  * Addds committed block entry.
88
+ *
89
  * @param string $blockId The block id.
90
+ *
91
+ * @return void
92
  */
93
  public function addCommittedEntry($blockId)
94
  {
95
  $this->addEntry($blockId, BlobBlockType::COMMITTED_TYPE);
96
  }
97
+
98
  /**
99
  * Addds uncommitted block entry.
100
+ *
101
  * @param string $blockId The block id.
102
+ *
103
+ * @return void
104
  */
105
  public function addUncommittedEntry($blockId)
106
  {
107
  $this->addEntry($blockId, BlobBlockType::UNCOMMITTED_TYPE);
108
  }
109
+
110
  /**
111
  * Addds latest block entry.
112
+ *
113
  * @param string $blockId The block id.
114
+ *
115
+ * @return void
116
  */
117
  public function addLatestEntry($blockId)
118
  {
119
  $this->addEntry($blockId, BlobBlockType::LATEST_TYPE);
120
  }
121
+
122
  /**
123
  * Gets blob block entry.
124
+ *
125
  * @param string $blockId The id of the block.
126
+ *
127
  * @return Block
128
  */
129
  public function getEntry($blockId)
130
  {
131
+ foreach ($this->entries as $value) {
132
  if ($blockId == $value->getBlockId()) {
133
  return $value;
134
  }
135
  }
136
+
137
  return null;
138
  }
139
+
140
  /**
141
  * Gets all blob block entries.
142
+ *
143
+ * @return Block[]
144
  */
145
  public function getEntries()
146
  {
147
+ return $this->entries;
148
  }
149
+
150
  /**
151
  * Converts the BlockList object to XML representation
152
+ *
153
  * @param XmlSerializer $xmlSerializer The XML serializer.
154
+ *
155
+ * @internal
156
+ *
157
  * @return string
158
  */
159
+ public function toXml(XmlSerializer $xmlSerializer)
160
  {
161
  $properties = array(XmlSerializer::ROOT_NAME => self::$xmlRootName);
162
  $array = array();
163
+
164
+ foreach ($this->entries as $value) {
165
  $array[] = array(
166
  $value->getType() => $value->getBlockId()
167
  );
168
  }
169
+
170
  return $xmlSerializer->serialize($array, $properties);
171
  }
172
  }
 
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/BreakLeaseResult.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,9 +21,10 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
- use MicrosoftAzure\Storage\Common\Internal\Resources;
 
27
  use MicrosoftAzure\Storage\Common\Internal\Utilities;
28
 
29
  /**
@@ -34,53 +35,49 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities;
34
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
35
  * @copyright 2016 Microsoft Corporation
36
  * @license https://github.com/azure/azure-storage-php/LICENSE
37
- * @version Release: 0.10.2
38
  * @link https://github.com/azure/azure-storage-php
39
  */
40
  class BreakLeaseResult
41
  {
42
- /**
43
- * @var string
44
- */
45
  private $_leaseTime;
46
-
47
  /**
48
  * Creates BreakLeaseResult from response headers
49
- *
50
  * @param array $headers response headers
51
- *
52
  * @return BreakLeaseResult
53
  */
54
  public static function create($headers)
55
  {
56
  $result = new BreakLeaseResult();
57
-
58
  $result->setLeaseTime(
59
  Utilities::tryGetValue($headers, Resources::X_MS_LEASE_TIME)
60
  );
61
-
62
  return $result;
63
  }
64
-
65
  /**
66
  * Gets lease time.
67
- *
68
  * @return string
69
  */
70
  public function getLeaseTime()
71
  {
72
  return $this->_leaseTime;
73
  }
74
-
75
  /**
76
  * Sets lease time.
77
- *
78
  * @param string $leaseTime the blob lease time.
79
- *
80
- * @return none
81
  */
82
- public function setLeaseTime($leaseTime)
83
  {
84
  $this->_leaseTime = $leaseTime;
85
  }
86
- }
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
  use MicrosoftAzure\Storage\Common\Internal\Utilities;
29
 
30
  /**
35
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
36
  * @copyright 2016 Microsoft Corporation
37
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
38
  * @link https://github.com/azure/azure-storage-php
39
  */
40
  class BreakLeaseResult
41
  {
 
 
 
42
  private $_leaseTime;
43
+
44
  /**
45
  * Creates BreakLeaseResult from response headers
46
+ *
47
  * @param array $headers response headers
48
+ *
49
  * @return BreakLeaseResult
50
  */
51
  public static function create($headers)
52
  {
53
  $result = new BreakLeaseResult();
54
+
55
  $result->setLeaseTime(
56
  Utilities::tryGetValue($headers, Resources::X_MS_LEASE_TIME)
57
  );
58
+
59
  return $result;
60
  }
61
+
62
  /**
63
  * Gets lease time.
64
+ *
65
  * @return string
66
  */
67
  public function getLeaseTime()
68
  {
69
  return $this->_leaseTime;
70
  }
71
+
72
  /**
73
  * Sets lease time.
74
+ *
75
  * @param string $leaseTime the blob lease time.
76
+ *
77
+ * @return void
78
  */
79
+ protected function setLeaseTime($leaseTime)
80
  {
81
  $this->_leaseTime = $leaseTime;
82
  }
83
+ }
vendor/microsoft/azure-storage-blob/src/Blob/Models/CommitBlobBlocksOptions.php ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ /**
28
+ * Optional parameters for commitBlobBlocks
29
+ *
30
+ * @category Microsoft
31
+ * @package MicrosoftAzure\Storage\Blob\Models
32
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
+ * @copyright 2016 Microsoft Corporation
34
+ * @license https://github.com/azure/azure-storage-php/LICENSE
35
+ * @link https://github.com/azure/azure-storage-php
36
+ */
37
+ class CommitBlobBlocksOptions extends BlobServiceOptions
38
+ {
39
+ private $_contentType;
40
+ private $_contentEncoding;
41
+ private $_contentLanguage;
42
+ private $_contentMD5;
43
+ private $_cacheControl;
44
+ private $_contentDisposition;
45
+ private $_metadata;
46
+
47
+ /**
48
+ * Gets ContentType.
49
+ *
50
+ * @return string
51
+ */
52
+ public function getContentType()
53
+ {
54
+ return $this->_contentType;
55
+ }
56
+
57
+ /**
58
+ * Sets ContentType.
59
+ *
60
+ * @param string $contentType value.
61
+ *
62
+ * @return void
63
+ */
64
+ public function setContentType($contentType)
65
+ {
66
+ $this->_contentType = $contentType;
67
+ }
68
+
69
+ /**
70
+ * Gets ContentEncoding.
71
+ *
72
+ * @return string
73
+ */
74
+ public function getContentEncoding()
75
+ {
76
+ return $this->_contentEncoding;
77
+ }
78
+
79
+ /**
80
+ * Sets ContentEncoding.
81
+ *
82
+ * @param string $contentEncoding value.
83
+ *
84
+ * @return void
85
+ */
86
+ public function setContentEncoding($contentEncoding)
87
+ {
88
+ $this->_contentEncoding = $contentEncoding;
89
+ }
90
+
91
+ /**
92
+ * Gets ContentLanguage.
93
+ *
94
+ * @return string
95
+ */
96
+ public function getContentLanguage()
97
+ {
98
+ return $this->_contentLanguage;
99
+ }
100
+
101
+ /**
102
+ * Sets ContentLanguage.
103
+ *
104
+ * @param string $contentLanguage value.
105
+ *
106
+ * @return void
107
+ */
108
+ public function setContentLanguage($contentLanguage)
109
+ {
110
+ $this->_contentLanguage = $contentLanguage;
111
+ }
112
+
113
+ /**
114
+ * Gets ContentMD5.
115
+ *
116
+ * @return string
117
+ */
118
+ public function getContentMD5()
119
+ {
120
+ return $this->_contentMD5;
121
+ }
122
+
123
+ /**
124
+ * Sets ContentMD5.
125
+ *
126
+ * @param string $contentMD5 value.
127
+ *
128
+ * @return void
129
+ */
130
+ public function setContentMD5($contentMD5)
131
+ {
132
+ $this->_contentMD5 = $contentMD5;
133
+ }
134
+
135
+ /**
136
+ * Gets cache control.
137
+ *
138
+ * @return string
139
+ */
140
+ public function getCacheControl()
141
+ {
142
+ return $this->_cacheControl;
143
+ }
144
+
145
+ /**
146
+ * Sets cacheControl.
147
+ *
148
+ * @param string $cacheControl value to use.
149
+ *
150
+ * @return void
151
+ */
152
+ public function setCacheControl($cacheControl)
153
+ {
154
+ $this->_cacheControl = $cacheControl;
155
+ }
156
+
157
+ /**
158
+ * Gets content disposition.
159
+ *
160
+ * @return string
161
+ */
162
+ public function getContentDisposition()
163
+ {
164
+ return $this->_contentDisposition;
165
+ }
166
+
167
+ /**
168
+ * Sets contentDisposition.
169
+ *
170
+ * @param string $contentDisposition value to use.
171
+ *
172
+ * @return void
173
+ */
174
+ public function setContentDisposition($contentDisposition)
175
+ {
176
+ $this->_contentDisposition = $contentDisposition;
177
+ }
178
+
179
+ /**
180
+ * Gets blob metadata.
181
+ *
182
+ * @return array
183
+ */
184
+ public function getMetadata()
185
+ {
186
+ return $this->_metadata;
187
+ }
188
+
189
+ /**
190
+ * Sets blob metadata.
191
+ *
192
+ * @param array $metadata value.
193
+ *
194
+ * @return void
195
+ */
196
+ public function setMetadata(array $metadata = null)
197
+ {
198
+ $this->_metadata = $metadata;
199
+ }
200
+
201
+ /**
202
+ * Create a instance using the given options
203
+ * @param mixed $options Input options
204
+ *
205
+ * @internal
206
+ *
207
+ * @return self
208
+ */
209
+ public static function create($options)
210
+ {
211
+ $result = new CommitBlobBlocksOptions();
212
+ $result->setContentType($options->getContentType());
213
+ $result->setContentEncoding($options->getContentEncoding());
214
+ $result->setContentLanguage($options->getContentLanguage());
215
+ $result->setContentMD5($options->getContentMD5());
216
+ $result->setCacheControl($options->getCacheControl());
217
+ $result->setContentDisposition($options->getContentDisposition());
218
+ $result->setMetadata($options->getMetadata());
219
+ $result->setLeaseId($options->getLeaseId());
220
+
221
+ return $result;
222
+ }
223
+ }
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/Container.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,10 +21,8 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
- use MicrosoftAzure\Storage\Common\Internal\Resources;
27
- use MicrosoftAzure\Storage\Common\Internal\Utilities;
28
 
29
  /**
30
  * WindowsAzure container object.
@@ -34,35 +32,19 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities;
34
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
35
  * @copyright 2016 Microsoft Corporation
36
  * @license https://github.com/azure/azure-storage-php/LICENSE
37
- * @version Release: 0.10.2
38
  * @link https://github.com/azure/azure-storage-php
39
  */
40
  class Container
41
  {
42
- /**
43
- * @var string
44
- */
45
  private $_name;
46
-
47
- /**
48
- * @var string
49
- */
50
  private $_url;
51
-
52
- /**
53
- * @var array
54
- */
55
  private $_metadata;
56
-
57
- /**
58
- * @var ContainerProperties
59
- */
60
  private $_properties;
61
 
62
  /**
63
  * Gets container name.
64
  *
65
- * @return string.
66
  */
67
  public function getName()
68
  {
@@ -73,8 +55,8 @@ class Container
73
  * Sets container name.
74
  *
75
  * @param string $name value.
76
- *
77
- * @return none.
78
  */
79
  public function setName($name)
80
  {
@@ -84,7 +66,7 @@ class Container
84
  /**
85
  * Gets container url.
86
  *
87
- * @return string.
88
  */
89
  public function getUrl()
90
  {
@@ -95,8 +77,8 @@ class Container
95
  * Sets container url.
96
  *
97
  * @param string $url value.
98
- *
99
- * @return none.
100
  */
101
  public function setUrl($url)
102
  {
@@ -106,7 +88,7 @@ class Container
106
  /**
107
  * Gets container metadata.
108
  *
109
- * @return array.
110
  */
111
  public function getMetadata()
112
  {
@@ -117,34 +99,33 @@ class Container
117
  * Sets container metadata.
118
  *
119
  * @param array $metadata value.
120
- *
121
- * @return none.
122
  */
123
- public function setMetadata($metadata)
124
  {
125
  $this->_metadata = $metadata;
126
  }
127
-
128
  /**
129
  * Gets container properties
130
- *
131
  * @return ContainerProperties
132
  */
133
  public function getProperties()
134
  {
135
  return $this->_properties;
136
  }
137
-
138
  /**
139
  * Sets container properties
140
- *
141
  * @param ContainerProperties $properties container properties
142
- *
143
- * @return none.
144
  */
145
- public function setProperties($properties)
146
  {
147
  $this->_properties = $properties;
148
  }
149
  }
150
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
 
 
26
 
27
  /**
28
  * WindowsAzure container object.
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
35
  * @link https://github.com/azure/azure-storage-php
36
  */
37
  class Container
38
  {
 
 
 
39
  private $_name;
 
 
 
 
40
  private $_url;
 
 
 
 
41
  private $_metadata;
 
 
 
 
42
  private $_properties;
43
 
44
  /**
45
  * Gets container name.
46
  *
47
+ * @return string
48
  */
49
  public function getName()
50
  {
55
  * Sets container name.
56
  *
57
  * @param string $name value.
58
+ *
59
+ * @return void
60
  */
61
  public function setName($name)
62
  {
66
  /**
67
  * Gets container url.
68
  *
69
+ * @return string
70
  */
71
  public function getUrl()
72
  {
77
  * Sets container url.
78
  *
79
  * @param string $url value.
80
+ *
81
+ * @return void
82
  */
83
  public function setUrl($url)
84
  {
88
  /**
89
  * Gets container metadata.
90
  *
91
+ * @return array
92
  */
93
  public function getMetadata()
94
  {
99
  * Sets container metadata.
100
  *
101
  * @param array $metadata value.
102
+ *
103
+ * @return void
104
  */
105
+ public function setMetadata(array $metadata = null)
106
  {
107
  $this->_metadata = $metadata;
108
  }
109
+
110
  /**
111
  * Gets container properties
112
+ *
113
  * @return ContainerProperties
114
  */
115
  public function getProperties()
116
  {
117
  return $this->_properties;
118
  }
119
+
120
  /**
121
  * Sets container properties
122
+ *
123
  * @param ContainerProperties $properties container properties
124
+ *
125
+ * @return void
126
  */
127
+ public function setProperties(ContainerProperties $properties)
128
  {
129
  $this->_properties = $properties;
130
  }
131
  }
 
vendor/microsoft/azure-storage-blob/src/Blob/Models/ContainerACL.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Common\Internal\ACLBase;
28
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
29
+ use MicrosoftAzure\Storage\Common\Internal\Validate;
30
+
31
+ /**
32
+ * Holds container ACL members.
33
+ *
34
+ * @category Microsoft
35
+ * @package MicrosoftAzure\Storage\Blob\Models
36
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
37
+ * @copyright 2016 Microsoft Corporation
38
+ * @license https://github.com/azure/azure-storage-php/LICENSE
39
+ * @link https://github.com/azure/azure-storage-php
40
+ */
41
+ class ContainerACL extends ACLBase
42
+ {
43
+ private $publicAccess;
44
+
45
+ /**
46
+ * Constructor.
47
+ */
48
+ public function __construct()
49
+ {
50
+ //setting the resource type to a default value.
51
+ $this->setResourceType(Resources::RESOURCE_TYPE_CONTAINER);
52
+ }
53
+
54
+ /**
55
+ * Parses the given array into signed identifiers and create an instance of
56
+ * ContainerACL
57
+ *
58
+ * @param string $publicAccess The container public access.
59
+ * @param array $parsed The parsed response into array representation.
60
+ *
61
+ * @internal
62
+ *
63
+ * @return ContainerACL
64
+ */
65
+ public static function create($publicAccess, array $parsed = null)
66
+ {
67
+ Validate::isTrue(
68
+ PublicAccessType::isValid($publicAccess),
69
+ Resources::INVALID_BLOB_PAT_MSG
70
+ );
71
+ $result = new ContainerACL();
72
+ $result->fromXmlArray($parsed);
73
+ $result->setPublicAccess($publicAccess);
74
+
75
+ return $result;
76
+ }
77
+
78
+ /**
79
+ * Gets container publicAccess.
80
+ *
81
+ * @return string
82
+ */
83
+ public function getPublicAccess()
84
+ {
85
+ return $this->publicAccess;
86
+ }
87
+
88
+ /**
89
+ * Sets container publicAccess.
90
+ *
91
+ * @param string $publicAccess value.
92
+ *
93
+ * @return void
94
+ */
95
+ public function setPublicAccess($publicAccess)
96
+ {
97
+ Validate::isTrue(
98
+ PublicAccessType::isValid($publicAccess),
99
+ Resources::INVALID_BLOB_PAT_MSG
100
+ );
101
+ $this->publicAccess = $publicAccess;
102
+ $this->setResourceType(
103
+ self::getResourceTypeByPublicAccess($publicAccess)
104
+ );
105
+ }
106
+
107
+ /**
108
+ * Gets the resource type according to the given public access. Default
109
+ * value is Resources::RESOURCE_TYPE_CONTAINER.
110
+ *
111
+ * @param string $publicAccess The public access that determines the
112
+ * resource type.
113
+ *
114
+ * @return string
115
+ */
116
+ private static function getResourceTypeByPublicAccess($publicAccess)
117
+ {
118
+ $result = '';
119
+
120
+ switch ($publicAccess) {
121
+ case PublicAccessType::BLOBS_ONLY:
122
+ $result = Resources::RESOURCE_TYPE_BLOB;
123
+ break;
124
+ case PublicAccessType::CONTAINER_AND_BLOBS:
125
+ $result = Resources::RESOURCE_TYPE_CONTAINER;
126
+ break;
127
+ default:
128
+ $result = Resources::RESOURCE_TYPE_CONTAINER;
129
+ break;
130
+ }
131
+
132
+ return $result;
133
+ }
134
+
135
+ /**
136
+ * Validate if the resource type is for the class.
137
+ *
138
+ * @param string $resourceType the resource type to be validated.
139
+ *
140
+ * @throws \InvalidArgumentException
141
+ *
142
+ * @internal
143
+ *
144
+ * @return void
145
+ */
146
+ protected static function validateResourceType($resourceType)
147
+ {
148
+ Validate::isTrue(
149
+ $resourceType == Resources::RESOURCE_TYPE_BLOB ||
150
+ $resourceType == Resources::RESOURCE_TYPE_CONTAINER,
151
+ Resources::INVALID_RESOURCE_TYPE
152
+ );
153
+ }
154
+
155
+ /**
156
+ * Create a ContainerAccessPolicy object.
157
+ *
158
+ * @return ContainerAccessPolicy
159
+ */
160
+ protected static function createAccessPolicy()
161
+ {
162
+ return new ContainerAccessPolicy();
163
+ }
164
+ }
vendor/microsoft/{azure-storage/src/Blob/Models/AcquireLeaseOptions.php → azure-storage-blob/src/Blob/Models/ContainerAccessPolicy.php} RENAMED
@@ -11,58 +11,51 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
18
  * @package MicrosoftAzure\Storage\Blob\Models
19
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
- * @copyright 2016 Microsoft Corporation
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
 
 
 
27
  /**
28
- * Optional parameters for acquireLease wrapper
29
  *
30
  * @category Microsoft
31
  * @package MicrosoftAzure\Storage\Blob\Models
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
- * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
- class AcquireLeaseOptions extends BlobServiceOptions
39
  {
40
  /**
41
- * @var AccessCondition
42
- */
43
- private $_accessCondition;
44
-
45
- /**
46
- * Gets access condition
47
- *
48
- * @return AccessCondition
49
  */
50
- public function getAccessCondition()
51
  {
52
- return $this->_accessCondition;
 
 
53
  }
54
-
55
  /**
56
- * Sets access condition
57
- *
58
- * @param AccessCondition $accessCondition value to use.
59
- *
60
- * @return none.
61
  */
62
- public function setAccessCondition($accessCondition)
63
  {
64
- $this->_accessCondition = $accessCondition;
65
  }
66
  }
67
-
68
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
18
  * @package MicrosoftAzure\Storage\Blob\Models
19
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2017 Microsoft Corporation
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources;
28
+ use MicrosoftAzure\Storage\Common\Models\AccessPolicy;
29
+
30
  /**
31
+ * Holds access policy elements
32
  *
33
  * @category Microsoft
34
  * @package MicrosoftAzure\Storage\Blob\Models
35
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
36
+ * @copyright 2017 Microsoft Corporation
37
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
38
  * @link https://github.com/azure/azure-storage-php
39
  */
40
+ class ContainerAccessPolicy extends AccessPolicy
41
  {
42
  /**
43
+ * Get the valid permissions for the given resource.
44
+ *
45
+ * @return array
 
 
 
 
 
46
  */
47
+ public static function getResourceValidPermissions()
48
  {
49
+ return BlobResources::ACCESS_PERMISSIONS[
50
+ BlobResources::RESOURCE_TYPE_CONTAINER
51
+ ];
52
  }
53
+
54
  /**
55
+ * Constructor
 
 
 
 
56
  */
57
+ public function __construct()
58
  {
59
+ parent::__construct(BlobResources::RESOURCE_TYPE_CONTAINER);
60
  }
61
  }
 
 
vendor/microsoft/azure-storage-blob/src/Blob/Models/ContainerProperties.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
+ use MicrosoftAzure\Storage\Common\Internal\Validate;
29
+
30
+ /**
31
+ * Holds container properties fields
32
+ *
33
+ * @category Microsoft
34
+ * @package MicrosoftAzure\Storage\Blob\Models
35
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
36
+ * @copyright 2016 Microsoft Corporation
37
+ * @license https://github.com/azure/azure-storage-php/LICENSE
38
+ * @link https://github.com/azure/azure-storage-php
39
+ */
40
+ class ContainerProperties
41
+ {
42
+ private $etag;
43
+ private $lastModified;
44
+ private $leaseDuration;
45
+ private $leaseStatus;
46
+ private $leaseState;
47
+ private $publicAccess;
48
+
49
+ /**
50
+ * Gets container lastModified.
51
+ *
52
+ * @return \DateTime
53
+ */
54
+ public function getLastModified()
55
+ {
56
+ return $this->lastModified;
57
+ }
58
+
59
+ /**
60
+ * Sets container lastModified.
61
+ *
62
+ * @param \DateTime $lastModified value.
63
+ *
64
+ * @return void
65
+ */
66
+ public function setLastModified(\DateTime $lastModified)
67
+ {
68
+ $this->lastModified = $lastModified;
69
+ }
70
+
71
+ /**
72
+ * Gets container etag.
73
+ *
74
+ * @return string
75
+ */
76
+ public function getETag()
77
+ {
78
+ return $this->etag;
79
+ }
80
+
81
+ /**
82
+ * Sets container etag.
83
+ *
84
+ * @param string $etag value.
85
+ *
86
+ * @return void
87
+ */
88
+ public function setETag($etag)
89
+ {
90
+ $this->etag = $etag;
91
+ }
92
+
93
+ /**
94
+ * Gets blob leaseStatus.
95
+ *
96
+ * @return string
97
+ */
98
+ public function getLeaseStatus()
99
+ {
100
+ return $this->leaseStatus;
101
+ }
102
+
103
+ /**
104
+ * Sets blob leaseStatus.
105
+ *
106
+ * @param string $leaseStatus value.
107
+ *
108
+ * @return void
109
+ */
110
+ public function setLeaseStatus($leaseStatus)
111
+ {
112
+ $this->leaseStatus = $leaseStatus;
113
+ }
114
+
115
+ /**
116
+ * Gets blob lease state.
117
+ *
118
+ * @return string
119
+ */
120
+ public function getLeaseState()
121
+ {
122
+ return $this->leaseState;
123
+ }
124
+
125
+ /**
126
+ * Sets blob lease state.
127
+ *
128
+ * @param string $leaseState value.
129
+ *
130
+ * @return void
131
+ */
132
+ public function setLeaseState($leaseState)
133
+ {
134
+ $this->leaseState = $leaseState;
135
+ }
136
+
137
+ /**
138
+ * Gets blob lease duration.
139
+ *
140
+ * @return string
141
+ */
142
+ public function getLeaseDuration()
143
+ {
144
+ return $this->leaseDuration;
145
+ }
146
+
147
+ /**
148
+ * Sets blob leaseStatus.
149
+ *
150
+ * @param string $leaseDuration value.
151
+ *
152
+ * @return void
153
+ */
154
+ public function setLeaseDuration($leaseDuration)
155
+ {
156
+ $this->leaseDuration = $leaseDuration;
157
+ }
158
+
159
+ /**
160
+ * Gets container publicAccess.
161
+ *
162
+ * @return string
163
+ */
164
+ public function getPublicAccess()
165
+ {
166
+ return $this->publicAccess;
167
+ }
168
+
169
+ /**
170
+ * Sets container publicAccess.
171
+ *
172
+ * @param string $publicAccess value.
173
+ *
174
+ * @return void
175
+ */
176
+ public function setPublicAccess($publicAccess)
177
+ {
178
+ Validate::isTrue(
179
+ PublicAccessType::isValid($publicAccess),
180
+ Resources::INVALID_BLOB_PAT_MSG
181
+ );
182
+ $this->publicAccess = $publicAccess;
183
+ }
184
+ }
vendor/microsoft/azure-storage-blob/src/Blob/Models/CopyBlobFromURLOptions.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2017 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ /**
28
+ * optional parameters for CopyBlobOptions wrapper
29
+ *
30
+ * @category Microsoft
31
+ * @package MicrosoftAzure\Storage\Blob\Models
32
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
+ * @copyright 2017 Microsoft Corporation
34
+ * @license https://github.com/azure/azure-storage-php/LICENSE
35
+ * @link https://github.com/azure/azure-storage-php
36
+ */
37
+ class CopyBlobFromURLOptions extends BlobServiceOptions
38
+ {
39
+ use AccessTierTrait;
40
+
41
+ private $sourceLeaseId;
42
+ private $sourceAccessConditions;
43
+ private $metadata;
44
+ private $isIncrementalCopy;
45
+
46
+ /**
47
+ * Gets source access condition
48
+ *
49
+ * @return AccessCondition[]
50
+ */
51
+ public function getSourceAccessConditions()
52
+ {
53
+ return $this->sourceAccessConditions;
54
+ }
55
+
56
+ /**
57
+ * Sets source access condition
58
+ *
59
+ * @param array $sourceAccessConditions value to use.
60
+ *
61
+ * @return void
62
+ */
63
+ public function setSourceAccessConditions($sourceAccessConditions)
64
+ {
65
+ if (!is_null($sourceAccessConditions) &&
66
+ is_array($sourceAccessConditions)) {
67
+ $this->sourceAccessConditions = $sourceAccessConditions;
68
+ } else {
69
+ $this->sourceAccessConditions = [$sourceAccessConditions];
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Gets metadata.
75
+ *
76
+ * @return array
77
+ */
78
+ public function getMetadata()
79
+ {
80
+ return $this->metadata;
81
+ }
82
+
83
+ /**
84
+ * Sets metadata.
85
+ *
86
+ * @param array $metadata value.
87
+ *
88
+ * @return void
89
+ */
90
+ public function setMetadata(array $metadata)
91
+ {
92
+ $this->metadata = $metadata;
93
+ }
94
+
95
+ /**
96
+ * Gets source lease ID.
97
+ *
98
+ * @return string
99
+ */
100
+ public function getSourceLeaseId()
101
+ {
102
+ return $this->sourceLeaseId;
103
+ }
104
+
105
+ /**
106
+ * Sets source lease ID.
107
+ *
108
+ * @param string $sourceLeaseId value.
109
+ *
110
+ * @return void
111
+ */
112
+ public function setSourceLeaseId($sourceLeaseId)
113
+ {
114
+ $this->sourceLeaseId = $sourceLeaseId;
115
+ }
116
+
117
+ /**
118
+ * Gets isIncrementalCopy.
119
+ *
120
+ * @return boolean
121
+ */
122
+ public function getIsIncrementalCopy()
123
+ {
124
+ return $this->isIncrementalCopy;
125
+ }
126
+
127
+ /**
128
+ * Sets isIncrementalCopy.
129
+ *
130
+ * @param boolean $isIncrementalCopy
131
+ *
132
+ * @return void
133
+ */
134
+ public function setIsIncrementalCopy($isIncrementalCopy)
135
+ {
136
+ $this->isIncrementalCopy = $isIncrementalCopy;
137
+ }
138
+ }
vendor/microsoft/azure-storage-blob/src/Blob/Models/CopyBlobOptions.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ /**
28
+ * optional parameters for CopyBlobOptions wrapper
29
+ *
30
+ * @category Microsoft
31
+ * @package MicrosoftAzure\Storage\Blob\Models
32
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
+ * @copyright 2016 Microsoft Corporation
34
+ * @license https://github.com/azure/azure-storage-php/LICENSE
35
+ * @link https://github.com/azure/azure-storage-php
36
+ */
37
+ class CopyBlobOptions extends CopyBlobFromURLOptions
38
+ {
39
+ private $sourceSnapshot;
40
+
41
+ /**
42
+ * Gets source snapshot.
43
+ *
44
+ * @return string
45
+ */
46
+ public function getSourceSnapshot()
47
+ {
48
+ return $this->sourceSnapshot;
49
+ }
50
+
51
+ /**
52
+ * Sets source snapshot.
53
+ *
54
+ * @param string $sourceSnapshot value.
55
+ *
56
+ * @return void
57
+ */
58
+ public function setSourceSnapshot($sourceSnapshot)
59
+ {
60
+ $this->sourceSnapshot = $sourceSnapshot;
61
+ }
62
+ }
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/CopyBlobResult.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,9 +21,10 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
- use MicrosoftAzure\Storage\Common\Internal\Resources;
 
27
  use MicrosoftAzure\Storage\Common\Internal\Utilities;
28
 
29
  /**
@@ -34,47 +35,107 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities;
34
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
35
  * @copyright 2016 Microsoft Corporation
36
  * @license https://github.com/azure/azure-storage-php/LICENSE
37
- * @version Release: 0.10.2
38
  * @link https://github.com/azure/azure-storage-php
39
  */
40
  class CopyBlobResult
41
  {
42
- /**
43
- * @var string
44
- */
45
  private $_etag;
46
-
47
- /**
48
- * @var \DateTime
49
- */
50
  private $_lastModified;
51
-
 
 
52
  /**
53
  * Creates CopyBlobResult object from the response of the copy blob request.
54
- *
55
  * @param array $headers The HTTP response headers in array representation.
56
- *
 
 
57
  * @return CopyBlobResult
58
  */
59
- public static function create($headers)
60
  {
61
  $result = new CopyBlobResult();
62
- $result->setETag(Utilities::tryGetValueInsensitive(
 
63
  Resources::ETAG,
64
- $headers));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  if (Utilities::arrayKeyExistsInsensitive(Resources::LAST_MODIFIED, $headers)) {
66
  $lastModified = Utilities::tryGetValueInsensitive(
67
  Resources::LAST_MODIFIED,
68
- $headers);
 
69
  $result->setLastModified(Utilities::rfc1123ToDateTime($lastModified));
70
  }
71
-
72
  return $result;
73
  }
74
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * Gets ETag.
77
- *
78
  * @return string
79
  */
80
  public function getETag()
@@ -87,13 +148,13 @@ class CopyBlobResult
87
  *
88
  * @param string $etag value.
89
  *
90
- * @return none
91
  */
92
- public function setETag($etag)
93
  {
94
  $this->_etag = $etag;
95
  }
96
-
97
  /**
98
  * Gets blob lastModified.
99
  *
@@ -109,12 +170,10 @@ class CopyBlobResult
109
  *
110
  * @param \DateTime $lastModified value.
111
  *
112
- * @return none
113
  */
114
- public function setLastModified($lastModified)
115
  {
116
  $this->_lastModified = $lastModified;
117
  }
118
  }
119
-
120
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
  use MicrosoftAzure\Storage\Common\Internal\Utilities;
29
 
30
  /**
35
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
36
  * @copyright 2016 Microsoft Corporation
37
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
38
  * @link https://github.com/azure/azure-storage-php
39
  */
40
  class CopyBlobResult
41
  {
 
 
 
42
  private $_etag;
 
 
 
 
43
  private $_lastModified;
44
+ private $_copyId;
45
+ private $_copyStatus;
46
+
47
  /**
48
  * Creates CopyBlobResult object from the response of the copy blob request.
49
+ *
50
  * @param array $headers The HTTP response headers in array representation.
51
+ *
52
+ * @internal
53
+ *
54
  * @return CopyBlobResult
55
  */
56
+ public static function create(array $headers)
57
  {
58
  $result = new CopyBlobResult();
59
+ $result->setETag(
60
+ Utilities::tryGetValueInsensitive(
61
  Resources::ETAG,
62
+ $headers
63
+ )
64
+ );
65
+ $result->setCopyId(
66
+ Utilities::tryGetValueInsensitive(
67
+ Resources::X_MS_COPY_ID,
68
+ $headers
69
+ )
70
+ );
71
+ $result->setCopyStatus(
72
+ Utilities::tryGetValueInsensitive(
73
+ Resources::X_MS_COPY_STATUS,
74
+ $headers
75
+ )
76
+ );
77
  if (Utilities::arrayKeyExistsInsensitive(Resources::LAST_MODIFIED, $headers)) {
78
  $lastModified = Utilities::tryGetValueInsensitive(
79
  Resources::LAST_MODIFIED,
80
+ $headers
81
+ );
82
  $result->setLastModified(Utilities::rfc1123ToDateTime($lastModified));
83
  }
84
+
85
  return $result;
86
  }
87
+
88
+ /**
89
+ * Gets copy Id
90
+ *
91
+ * @return string
92
+ */
93
+ public function getCopyId()
94
+ {
95
+ return $this->_copyId;
96
+ }
97
+
98
+ /**
99
+ * Sets copy Id
100
+ *
101
+ * @param string $copyId the blob copy id.
102
+ *
103
+ * @internal
104
+ *
105
+ * @return void
106
+ */
107
+ protected function setCopyId($copyId)
108
+ {
109
+ $this->_copyId = $copyId;
110
+ }
111
+
112
+ /**
113
+ * Gets copy status
114
+ *
115
+ * @return string
116
+ */
117
+ public function getCopyStatus()
118
+ {
119
+ return $this->_copyStatus;
120
+ }
121
+
122
+ /**
123
+ * Sets copy status
124
+ *
125
+ * @param string $status the copy status.
126
+ *
127
+ * @internal
128
+ *
129
+ * @return void
130
+ */
131
+ protected function setCopyStatus($copystatus)
132
+ {
133
+ $this->_copyStatus = $copystatus;
134
+ }
135
+
136
  /**
137
  * Gets ETag.
138
+ *
139
  * @return string
140
  */
141
  public function getETag()
148
  *
149
  * @param string $etag value.
150
  *
151
+ * @return void
152
  */
153
+ protected function setETag($etag)
154
  {
155
  $this->_etag = $etag;
156
  }
157
+
158
  /**
159
  * Gets blob lastModified.
160
  *
170
  *
171
  * @param \DateTime $lastModified value.
172
  *
173
+ * @return void
174
  */
175
+ protected function setLastModified(\DateTime $lastModified)
176
  {
177
  $this->_lastModified = $lastModified;
178
  }
179
  }
 
 
vendor/microsoft/azure-storage-blob/src/Blob/Models/CopyState.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2017 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
+ use MicrosoftAzure\Storage\Common\Internal\Utilities;
29
+
30
+ /**
31
+ * Represents blob copy state
32
+ *
33
+ * @category Microsoft
34
+ * @package MicrosoftAzure\Storage\Blob\Models
35
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
36
+ * @copyright 2016 Microsoft Corporation
37
+ * @license https://github.com/azure/azure-storage-php/LICENSE
38
+ * @link https://github.com/azure/azure-storage-php
39
+ */
40
+ class CopyState
41
+ {
42
+ private $_copyId;
43
+ private $_completionTime;
44
+ private $_status;
45
+ private $_statusDescription;
46
+ private $_source;
47
+ private $_bytesCopied;
48
+ private $_totalBytes;
49
+
50
+ /**
51
+ * Creates CopyState object from $parsed response in array representation of XML elements
52
+ *
53
+ * @param array $parsed parsed response in array format.
54
+ *
55
+ * @internal
56
+ *
57
+ * @return \MicrosoftAzure\Storage\Blob\Models\CopyState
58
+ */
59
+ public static function createFromXml(array $parsed)
60
+ {
61
+ $result = new CopyState();
62
+ $clean = array_change_key_case($parsed);
63
+
64
+ $copyCompletionTime = Utilities::tryGetValue($clean, 'copycompletiontime');
65
+ if (!is_null($copyCompletionTime)) {
66
+ $copyCompletionTime = Utilities::rfc1123ToDateTime($copyCompletionTime);
67
+ $result->setCompletionTime($copyCompletionTime);
68
+ }
69
+
70
+ $result->setCopyId(Utilities::tryGetValue($clean, 'copyid'));
71
+ $result->setStatus(Utilities::tryGetValue($clean, 'copystatus'));
72
+ $result->setStatusDescription(Utilities::tryGetValue($clean, 'copystatusdescription'));
73
+ $result->setSource(Utilities::tryGetValue($clean, 'copysource'));
74
+
75
+ $copyProgress = Utilities::tryGetValue($clean, 'copyprogress');
76
+
77
+ if (strpos($copyProgress, '/') !== false) {
78
+ $parts = explode('/', $copyProgress);
79
+ $bytesCopied = intval($parts[0]);
80
+ $totalBytes = intval($parts[1]);
81
+
82
+ $result->setBytesCopied($bytesCopied);
83
+ $result->setTotalBytes($totalBytes);
84
+ }
85
+
86
+ return $result;
87
+ }
88
+
89
+ /**
90
+ * Creates CopyState object from $parsed response in array representation of http headers
91
+ *
92
+ * @param array $parsed parsed response in array format.
93
+ *
94
+ * @internal
95
+ *
96
+ * @return \MicrosoftAzure\Storage\Blob\Models\CopyState
97
+ */
98
+ public static function createFromHttpHeaders(array $parsed)
99
+ {
100
+ $result = new CopyState();
101
+ $clean = array_change_key_case($parsed);
102
+
103
+ $copyCompletionTime = Utilities::tryGetValue($clean, Resources::X_MS_COPY_COMPLETION_TIME);
104
+ if (!is_null($copyCompletionTime)) {
105
+ $copyCompletionTime = Utilities::rfc1123ToDateTime($copyCompletionTime);
106
+ $result->setCompletionTime($copyCompletionTime);
107
+ }
108
+
109
+ $result->setCopyId(Utilities::tryGetValue($clean, Resources::X_MS_COPY_ID));
110
+ $result->setStatus(Utilities::tryGetValue($clean, Resources::X_MS_COPY_STATUS));
111
+ $result->setStatusDescription(Utilities::tryGetValue($clean, Resources::X_MS_COPY_STATUS_DESCRIPTION));
112
+ $result->setSource(Utilities::tryGetValue($clean, Resources::X_MS_COPY_SOURCE));
113
+
114
+ $copyProgress = Utilities::tryGetValue($clean, Resources::X_MS_COPY_PROGRESS);
115
+ if (strpos($copyProgress, '/') !== false) {
116
+ $parts = explode('/', $copyProgress);
117
+ $bytesCopied = intval($parts[0]);
118
+ $totalBytes = intval($parts[1]);
119
+
120
+ $result->setBytesCopied($bytesCopied);
121
+ $result->setTotalBytes($totalBytes);
122
+ }
123
+
124
+ return $result;
125
+ }
126
+
127
+ /**
128
+ * Gets copy Id
129
+ *
130
+ * @return string
131
+ */
132
+ public function getCopyId()
133
+ {
134
+ return $this->_copyId;
135
+ }
136
+
137
+ /**
138
+ * Sets copy Id
139
+ *
140
+ * @param string $copyId the blob copy id.
141
+ *
142
+ * @internal
143
+ *
144
+ * @return void
145
+ */
146
+ protected function setCopyId($copyId)
147
+ {
148
+ $this->_copyId = $copyId;
149
+ }
150
+
151
+ /**
152
+ * Gets copy completion time
153
+ *
154
+ * @return \DateTime
155
+ */
156
+ public function getCompletionTime()
157
+ {
158
+ return $this->_completionTime;
159
+ }
160
+
161
+ /**
162
+ * Sets copy completion time
163
+ *
164
+ * @param \DateTime $completionTime the copy completion time.
165
+ *
166
+ * @internal
167
+ *
168
+ * @return void
169
+ */
170
+ protected function setCompletionTime($completionTime)
171
+ {
172
+ $this->_completionTime = $completionTime;
173
+ }
174
+
175
+ /**
176
+ * Gets copy status
177
+ *
178
+ * @return string
179
+ */
180
+ public function getStatus()
181
+ {
182
+ return $this->_status;
183
+ }
184
+
185
+ /**
186
+ * Sets copy status
187
+ *
188
+ * @param string $status the copy status.
189
+ *
190
+ * @internal
191
+ *
192
+ * @return void
193
+ */
194
+ protected function setStatus($status)
195
+ {
196
+ $this->_status = $status;
197
+ }
198
+
199
+ /**
200
+ * Gets copy status description
201
+ *
202
+ * @return string
203
+ */
204
+ public function getStatusDescription()
205
+ {
206
+ return $this->_statusDescription;
207
+ }
208
+
209
+ /**
210
+ * Sets copy status description
211
+ *
212
+ * @param string $statusDescription the copy status description.
213
+ *
214
+ * @internal
215
+ *
216
+ * @return void
217
+ */
218
+ protected function setStatusDescription($statusDescription)
219
+ {
220
+ $this->_statusDescription = $statusDescription;
221
+ }
222
+
223
+ /**
224
+ * Gets copy source
225
+ *
226
+ * @return string
227
+ */
228
+ public function getSource()
229
+ {
230
+ return $this->_source;
231
+ }
232
+
233
+ /**
234
+ * Sets copy source
235
+ *
236
+ * @param string $source the copy source.
237
+ *
238
+ * @internal
239
+ *
240
+ * @return void
241
+ */
242
+ protected function setSource($source)
243
+ {
244
+ $this->_source = $source;
245
+ }
246
+
247
+ /**
248
+ * Gets bytes copied
249
+ *
250
+ * @return int
251
+ */
252
+ public function getBytesCopied()
253
+ {
254
+ return $this->_bytesCopied;
255
+ }
256
+
257
+ /**
258
+ * Sets bytes copied
259
+ *
260
+ * @param int $bytesCopied the bytes copied.
261
+ *
262
+ * @internal
263
+ *
264
+ * @return void
265
+ */
266
+ protected function setBytesCopied($bytesCopied)
267
+ {
268
+ $this->_bytesCopied = $bytesCopied;
269
+ }
270
+
271
+ /**
272
+ * Gets total bytes to be copied
273
+ *
274
+ * @return int
275
+ */
276
+ public function getTotalBytes()
277
+ {
278
+ return $this->_bytesCopied;
279
+ }
280
+
281
+ /**
282
+ * Sets total bytes to be copied
283
+ *
284
+ * @param int $totalBytes the bytes copied.
285
+ *
286
+ * @internal
287
+ *
288
+ * @return void
289
+ */
290
+ protected function setTotalBytes($totalBytes)
291
+ {
292
+ $this->_totalBytes = $totalBytes;
293
+ }
294
+ }
vendor/microsoft/{azure-storage/src/Blob/Models/CreateBlobPagesOptions.php → azure-storage-blob/src/Blob/Models/CreateBlobBlockOptions.php} RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,102 +21,81 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
28
- * Optional parameters for create and clear blob pages
29
  *
30
  * @category Microsoft
31
  * @package MicrosoftAzure\Storage\Blob\Models
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
- class CreateBlobPagesOptions extends BlobServiceOptions
39
  {
40
- /**
41
- * @var string
42
- */
43
  private $_contentMD5;
44
-
45
- /**
46
- * @var string
47
- */
48
- private $_leaseId;
49
-
50
- /**
51
- * @var AccessCondition
52
- */
53
- private $_accessCondition;
54
-
55
- /**
56
- * Gets access condition
57
- *
58
- * @return AccessCondition
59
- */
60
- public function getAccessCondition()
61
- {
62
- return $this->_accessCondition;
63
- }
64
-
65
  /**
66
- * Sets access condition
67
- *
68
- * @param AccessCondition $accessCondition value to use.
69
- *
70
- * @return none.
71
  */
72
- public function setAccessCondition($accessCondition)
73
  {
74
- $this->_accessCondition = $accessCondition;
75
  }
76
-
77
  /**
78
- * Gets lease Id for the blob
79
- *
80
- * @return string
 
 
81
  */
82
- public function getLeaseId()
83
  {
84
- return $this->_leaseId;
85
  }
86
-
87
  /**
88
- * Sets lease Id for the blob
89
- *
90
- * @param string $leaseId the blob lease id.
91
- *
92
- * @return none
93
  */
94
- public function setLeaseId($leaseId)
95
  {
96
- $this->_leaseId = $leaseId;
97
  }
98
-
99
  /**
100
- * Gets blob contentMD5.
101
  *
102
- * @return string.
103
  */
104
- public function getContentMD5()
105
  {
106
- return $this->_contentMD5;
107
  }
108
 
109
  /**
110
- * Sets blob contentMD5.
111
  *
112
- * @param string $contentMD5 value.
113
  *
114
- * @return none.
115
  */
116
- public function setContentMD5($contentMD5)
117
  {
118
- $this->_contentMD5 = $contentMD5;
 
 
 
 
 
 
119
  }
120
  }
121
-
122
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
28
+ * Optional parameters for createBlobBlock wrapper
29
  *
30
  * @category Microsoft
31
  * @package MicrosoftAzure\Storage\Blob\Models
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
35
  * @link https://github.com/azure/azure-storage-php
36
  */
37
+ class CreateBlobBlockOptions extends BlobServiceOptions
38
  {
 
 
 
39
  private $_contentMD5;
40
+ private $_numberOfConcurrency;
41
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  /**
43
+ * Gets blob contentMD5.
44
+ *
45
+ * @return string
 
 
46
  */
47
+ public function getContentMD5()
48
  {
49
+ return $this->_contentMD5;
50
  }
51
+
52
  /**
53
+ * Sets blob contentMD5.
54
+ *
55
+ * @param string $contentMD5 value.
56
+ *
57
+ * @return void
58
  */
59
+ public function setContentMD5($contentMD5)
60
  {
61
+ $this->_contentMD5 = $contentMD5;
62
  }
63
+
64
  /**
65
+ * Gets number of concurrency for sending a blob.
66
+ *
67
+ * @return int
 
 
68
  */
69
+ public function getNumberOfConcurrency()
70
  {
71
+ return $this->_numberOfConcurrency;
72
  }
73
+
74
  /**
75
+ * Sets number of concurrency for sending a blob.
76
  *
77
+ * @param int $numberOfConcurrency the number of concurrent requests.
78
  */
79
+ public function setNumberOfConcurrency($numberOfConcurrency)
80
  {
81
+ $this->_numberOfConcurrency = $numberOfConcurrency;
82
  }
83
 
84
  /**
85
+ * Construct a CreateBlobBlockOptions object from a createBlobOptions.
86
  *
87
+ * @param CreateBlobOptions $createBlobOptions
88
  *
89
+ * @return CreateBlobBlockOptions
90
  */
91
+ public static function create(CreateBlobOptions $createBlobOptions)
92
  {
93
+ $result = new CreateBlobBlockOptions();
94
+ $result->setTimeout($createBlobOptions->getTimeout());
95
+ $result->setLeaseId($createBlobOptions->getLeaseId());
96
+ $result->setNumberOfConcurrency(
97
+ $createBlobOptions->getNumberOfConcurrency()
98
+ );
99
+ return $result;
100
  }
101
  }
 
 
vendor/microsoft/azure-storage-blob/src/Blob/Models/CreateBlobOptions.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/azure/azure-storage-php
23
+ */
24
+
25
+ namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Common\Internal\Validate;
28
+
29
+ /**
30
+ * optional parameters for createXXXBlob wrapper
31
+ *
32
+ * @category Microsoft
33
+ * @package MicrosoftAzure\Storage\Blob\Models
34
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
35
+ * @copyright 2016 Microsoft Corporation
36
+ * @license https://github.com/azure/azure-storage-php/LICENSE
37
+ * @link https://github.com/azure/azure-storage-php
38
+ */
39
+ class CreateBlobOptions extends BlobServiceOptions
40
+ {
41
+ private $_contentType;
42
+ private $_contentEncoding;
43
+ private $_contentLanguage;
44
+ private $_contentMD5;
45
+ private $_cacheControl;
46
+ private $_contentDisposition;
47
+ private $_metadata;
48
+ private $_sequenceNumber;
49
+ private $_numberOfConcurrency;
50
+
51
+ /**
52
+ * Gets blob contentType.
53
+ *
54
+ * @return string
55
+ */
56
+ public function getContentType()
57
+ {
58
+ return $this->_contentType;
59
+ }
60
+
61
+ /**
62
+ * Sets blob contentType.
63
+ *
64
+ * @param string $contentType value.
65
+ *
66
+ * @return void
67
+ */
68
+ public function setContentType($contentType)
69
+ {
70
+ $this->_contentType = $contentType;
71
+ }
72
+
73
+ /**
74
+ * Gets contentEncoding.
75
+ *
76
+ * @return string
77
+ */
78
+ public function getContentEncoding()
79
+ {
80
+ return $this->_contentEncoding;
81
+ }
82
+
83
+ /**
84
+ * Sets contentEncoding.
85
+ *
86
+ * @param string $contentEncoding value.
87
+ *
88
+ * @return void
89
+ */
90
+ public function setContentEncoding($contentEncoding)
91
+ {
92
+ $this->_contentEncoding = $contentEncoding;
93
+ }
94
+
95
+ /**
96
+ * Gets contentLanguage.
97
+ *
98
+ * @return string
99
+ */
100
+ public function getContentLanguage()
101
+ {
102
+ return $this->_contentLanguage;
103
+ }
104
+
105
+ /**
106
+ * Sets contentLanguage.
107
+ *
108
+ * @param string $contentLanguage value.
109
+ *
110
+ * @return void
111
+ */
112
+ public function setContentLanguage($contentLanguage)
113
+ {
114
+ $this->_contentLanguage = $contentLanguage;
115
+ }
116
+
117
+ /**
118
+ * Gets contentMD5.
119
+ *
120
+ * @return string
121
+ */
122
+ public function getContentMD5()
123
+ {
124
+ return $this->_contentMD5;
125
+ }
126
+
127
+ /**
128
+ * Sets contentMD5.
129
+ *
130
+ * @param string $contentMD5 value.
131
+ *
132
+ * @return void
133
+ */
134
+ public function setContentMD5($contentMD5)
135
+ {
136
+ $this->_contentMD5 = $contentMD5;
137
+ }
138
+
139
+ /**
140
+ * Gets cacheControl.
141
+ *
142
+ * @return string
143
+ */
144
+ public function getCacheControl()
145
+ {
146
+ return $this->_cacheControl;
147
+ }
148
+
149
+ /**
150
+ * Sets cacheControl.
151
+ *
152
+ * @param string $cacheControl value to use.
153
+ *
154
+ * @return void
155
+ */
156
+ public function setCacheControl($cacheControl)
157
+ {
158
+ $this->_cacheControl = $cacheControl;
159
+ }
160
+
161
+ /**
162
+ * Gets content disposition.
163
+ *
164
+ * @return string
165
+ */
166
+ public function getContentDisposition()
167
+ {
168
+ return $this->_contentDisposition;
169
+ }
170
+
171
+ /**
172
+ * Sets content disposition.
173
+ *
174
+ * @param string $contentDisposition value to use.
175
+ *
176
+ * @return void
177
+ */
178
+ public function setContentDisposition($contentDisposition)
179
+ {
180
+ $this->_contentDisposition = $contentDisposition;
181
+ }
182
+
183
+ /**
184
+ * Gets blob metadata.
185
+ *
186
+ * @return array
187
+ */
188
+ public function getMetadata()
189
+ {
190
+ return $this->_metadata;
191
+ }
192
+
193
+ /**
194
+ * Sets blob metadata.
195
+ *
196
+ * @param array $metadata value.
197
+ *
198
+ * @return void
199
+ */
200
+ public function setMetadata(array $metadata)
201
+ {
202
+ $this->_metadata = $metadata;
203
+ }
204
+
205
+ /**
206
+ * Gets blob sequenceNumber.
207
+ *
208
+ * @return int
209
+ */
210
+ public function getSequenceNumber()
211
+ {
212
+ return $this->_sequenceNumber;
213
+ }
214
+
215
+ /**
216
+ * Sets blob sequenceNumber.
217
+ *
218
+ * @param int $sequenceNumber value.
219
+ *
220
+ * @return void
221
+ */
222
+ public function setSequenceNumber($sequenceNumber)
223
+ {
224
+ Validate::isInteger($sequenceNumber, 'sequenceNumber');
225
+ $this->_sequenceNumber = $sequenceNumber;
226
+ }
227
+
228
+ /**
229
+ * Gets number of concurrency for sending a blob.
230
+ *
231
+ * @return int
232
+ */
233
+ public function getNumberOfConcurrency()
234
+ {
235
+ return $this->_numberOfConcurrency;
236
+ }
237
+
238
+ /**
239
+ * Sets number of concurrency for sending a blob.
240
+ *
241
+ * @param int $numberOfConcurrency the number of concurrent requests.
242
+ */
243
+ public function setNumberOfConcurrency($numberOfConcurrency)
244
+ {
245
+ $this->_numberOfConcurrency = $numberOfConcurrency;
246
+ }
247
+ }
vendor/microsoft/{azure-storage/src/Blob/Models/CreateBlobBlockOptions.php → azure-storage-blob/src/Blob/Models/CreateBlobPagesOptions.php} RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,58 +21,27 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
28
- * Optional parameters for createBlobBlock wrapper
29
  *
30
  * @category Microsoft
31
  * @package MicrosoftAzure\Storage\Blob\Models
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
35
- * @version Release: 0.10.2
36
  * @link https://github.com/azure/azure-storage-php
37
  */
38
- class CreateBlobBlockOptions extends BlobServiceOptions
39
  {
40
- /**
41
- * @var string
42
- */
43
  private $_contentMD5;
44
-
45
- /**
46
- * @var string
47
- */
48
- private $_leaseId;
49
-
50
- /**
51
- * Gets lease Id for the blob
52
- *
53
- * @return string
54
- */
55
- public function getLeaseId()
56
- {
57
- return $this->_leaseId;
58
- }
59
-
60
- /**
61
- * Sets lease Id for the blob
62
- *
63
- * @param string $leaseId the blob lease id.
64
- *
65
- * @return none
66
- */
67
- public function setLeaseId($leaseId)
68
- {
69
- $this->_leaseId = $leaseId;
70
- }
71
-
72
  /**
73
  * Gets blob contentMD5.
74
  *
75
- * @return string.
76
  */
77
  public function getContentMD5()
78
  {
@@ -84,12 +53,10 @@ class CreateBlobBlockOptions extends BlobServiceOptions
84
  *
85
  * @param string $contentMD5 value.
86
  *
87
- * @return none.
88
  */
89
  public function setContentMD5($contentMD5)
90
  {
91
  $this->_contentMD5 = $contentMD5;
92
  }
93
  }
94
-
95
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
 
27
  /**
28
+ * Optional parameters for create and clear blob pages
29
  *
30
  * @category Microsoft
31
  * @package MicrosoftAzure\Storage\Blob\Models
32
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
33
  * @copyright 2016 Microsoft Corporation
34
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
35
  * @link https://github.com/azure/azure-storage-php
36
  */
37
+ class CreateBlobPagesOptions extends BlobServiceOptions
38
  {
 
 
 
39
  private $_contentMD5;
40
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  /**
42
  * Gets blob contentMD5.
43
  *
44
+ * @return string
45
  */
46
  public function getContentMD5()
47
  {
53
  *
54
  * @param string $contentMD5 value.
55
  *
56
+ * @return void
57
  */
58
  public function setContentMD5($contentMD5)
59
  {
60
  $this->_contentMD5 = $contentMD5;
61
  }
62
  }
 
 
vendor/microsoft/{azure-storage → azure-storage-blob}/src/Blob/Models/CreateBlobPagesResult.php RENAMED
@@ -11,7 +11,7 @@
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
- *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
@@ -21,9 +21,10 @@
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
-
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
- use MicrosoftAzure\Storage\Common\Internal\Resources;
 
27
  use MicrosoftAzure\Storage\Common\Internal\Validate;
28
  use MicrosoftAzure\Storage\Common\Internal\Utilities;
29
 
@@ -35,60 +36,62 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities;
35
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
36
  * @copyright 2016 Microsoft Corporation
37
  * @license https://github.com/azure/azure-storage-php/LICENSE
38
- * @version Release: 0.10.2
39
  * @link https://github.com/azure/azure-storage-php
40
  */
41
  class CreateBlobPagesResult
42
  {
 
 
 
 
 
 
43
  /**
44
- * @var \DateTime
45
- */
46
- private $_lastModified;
47
-
48
- /**
49
- * @var string
50
- */
51
- private $_etag;
52
-
53
- /**
54
- * @var integer
55
- */
56
- private $_sequenceNumber;
57
-
58
- /**
59
- * @var string
60
- */
61
- private $_contentMD5;
62
-
63
- /**
64
- * Creates CreateBlobPagesResult object from $parsed response in array
65
  * representation
66
- *
67
  * @param array $headers HTTP response headers
68
- *
 
 
69
  * @return CreateBlobPagesResult
70
  */
71
- public static function create($headers)
72
  {
73
  $result = new CreateBlobPagesResult();
74
  $clean = array_change_key_case($headers);
75
-
76
  $date = $clean[Resources::LAST_MODIFIED];
77
  $date = Utilities::rfc1123ToDateTime($date);
78
  $result->setETag($clean[Resources::ETAG]);
79
  $result->setLastModified($date);
 
80
  $result->setContentMD5(
81
  Utilities::tryGetValue($clean, Resources::CONTENT_MD5)
82
  );
 
 
 
 
 
 
 
 
 
 
 
83
  $result->setSequenceNumber(
84
  intval(
85
- Utilities::tryGetValue($clean, Resources::X_MS_BLOB_SEQUENCE_NUMBER)
 
 
 
86
  )
87
  );
88
-
89
  return $result;
90
  }
91
-
92
  /**
93
  * Gets blob lastModified.
94
  *
@@ -96,7 +99,7 @@ class CreateBlobPagesResult
96
  */
97
  public function getLastModified()
98
  {
99
- return $this->_lastModified;
100
  }
101
 
102
  /**
@@ -104,22 +107,22 @@ class CreateBlobPagesResult
104
  *
105
  * @param \DateTime $lastModified value.
106
  *
107
- * @return none.
108
  */
109
- public function setLastModified($lastModified)
110
  {
111
  Validate::isDate($lastModified);
112
- $this->_lastModified = $lastModified;
113
  }
114
 
115
  /**
116
  * Gets blob etag.
117
  *
118
- * @return string.
119
  */
120
  public function getETag()
121
  {
122
- return $this->_etag;
123
  }
124
 
125
  /**
@@ -127,22 +130,22 @@ class CreateBlobPagesResult
127
  *
128
  * @param string $etag value.
129
  *
130
- * @return none.
131
  */
132
- public function setETag($etag)
133
  {
134
- Validate::isString($etag, 'etag');
135
- $this->_etag = $etag;
136
  }
137
-
138
  /**
139
  * Gets blob contentMD5.
140
  *
141
- * @return string.
142
  */
143
  public function getContentMD5()
144
  {
145
- return $this->_contentMD5;
146
  }
147
 
148
  /**
@@ -150,21 +153,43 @@ class CreateBlobPagesResult
150
  *
151
  * @param string $contentMD5 value.
152
  *
153
- * @return none.
 
 
 
 
 
 
 
 
 
 
154
  */
155
- public function setContentMD5($contentMD5)
156
  {
157
- $this->_contentMD5 = $contentMD5;
158
  }
159
-
 
 
 
 
 
 
 
 
 
 
 
 
160
  /**
161
  * Gets blob sequenceNumber.
162
  *
163
- * @return int.
164
  */
165
  public function getSequenceNumber()
166
  {
167
- return $this->_sequenceNumber;
168
  }
169
 
170
  /**
@@ -172,13 +197,11 @@ class CreateBlobPagesResult
172
  *
173
  * @param int $sequenceNumber value.
174
  *
175
- * @return none.
176
  */
177
- public function setSequenceNumber($sequenceNumber)
178
  {
179
  Validate::isInteger($sequenceNumber, 'sequenceNumber');
180
- $this->_sequenceNumber = $sequenceNumber;
181
  }
182
  }
183
-
184
-
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
  * See the License for the specific language governing permissions and
13
  * limitations under the License.
14
+ *
15
  * PHP version 5
16
  *
17
  * @category Microsoft
21
  * @license https://github.com/azure/azure-storage-php/LICENSE
22
  * @link https://github.com/azure/azure-storage-php
23
  */
24
+
25
  namespace MicrosoftAzure\Storage\Blob\Models;
26
+
27
+ use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
28
  use MicrosoftAzure\Storage\Common\Internal\Validate;
29
  use MicrosoftAzure\Storage\Common\Internal\Utilities;
30
 
36
  * @author Azure Storage PHP SDK <dmsh@microsoft.com>
37
  * @copyright 2016 Microsoft Corporation
38
  * @license https://github.com/azure/azure-storage-php/LICENSE
 
39
  * @link https://github.com/azure/azure-storage-php
40
  */
41
  class CreateBlobPagesResult
42
  {
43
+ private $contentMD5;
44
+ private $etag;
45
+ private $lastModified;
46
+ private $requestServerEncrypted;
47
+ private $sequenceNumber;
48
+
49
  /**
50
+ * Creates CreateBlobPagesResult object from $parsed response in array
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  * representation
52
+ *
53
  * @param array $headers HTTP response headers
54
+ *
55
+ * @internal
56
+ *
57
  * @return CreateBlobPagesResult
58
  */
59
+ public static function create(array $headers)
60
  {
61
  $result = new CreateBlobPagesResult();
62
  $clean = array_change_key_case($headers);
63
+
64
  $date = $clean[Resources::LAST_MODIFIED];
65
  $date = Utilities::rfc1123ToDateTime($date);
66
  $result->setETag($clean[Resources::ETAG]);
67
  $result->setLastModified($date);
68
+
69
  $result->setContentMD5(
70
  Utilities::tryGetValue($clean, Resources::CONTENT_MD5)
71
  );
72
+
73
+ $result->setRequestServerEncrypted(
74
+ Utilities::toBoolean(
75
+ Utilities::tryGetValueInsensitive(
76
+ Resources::X_MS_REQUEST_SERVER_ENCRYPTED,
77
+ $headers
78
+ ),
79
+ true
80
+ )
81
+ );
82
+
83
  $result->setSequenceNumber(
84
  intval(
85
+ Utilities::tryGetValue(
86
+ $clean,
87
+ Resources::X_MS_BLOB_SEQUENCE_NUMBER
88
+ )
89
  )
90
  );
91
+
92
  return $result;
93
  }
94
+
95
  /**
96
  * Gets blob lastModified.
97
  *
99
  */
100
  public function getLastModified()
101
  {
102
+ return $this->lastModified;
103
  }
104
 
105
  /**
107
  *
108
  * @param \DateTime $lastModified value.
109
  *
110
+ * @return void
111
  */
112
+ protected function setLastModified($lastModified)
113
  {
114
  Validate::isDate($lastModified);
115
+ $this->lastModified = $lastModified;
116
  }
117
 
118
  /**
119
  * Gets blob etag.
120
  *
121
+ * @return string
122
  */
123
  public function getETag()
124
  {
125
+ return $this->etag;
126
  }
127
 
128
  /**
130
  *
131
  * @param string $etag value.
132
  *
133
+ * @return void
134
  */
135
+ protected function setETag($etag)
136
  {
137
+ Validate::canCastAsString($etag, 'etag');
138
+ $this->etag = $etag;
139
  }
140
+
141
  /**
142
  * Gets blob contentMD5.
143
  *
144
+ * @return string
145
  */
146
  public function getContentMD5()
147
  {
148
+ return $this->contentMD5;
149
  }
150
 
151
  /**
153
  *
154
  * @param string $contentMD5 value.
155
  *
156
+ * @return void
157
+ */
158
+ protected function setContentMD5($contentMD5)
159
+ {
160
+ $this->contentMD5 = $contentMD5;
161
+ }
162
+
163
+ /**
164
+ * Gets the whether the contents of the request are successfully encrypted.
165
+ *
166
+ * @return boolean
167
  */
168
+ public function getRequestServerEncrypted()
169
  {
170
+ return $this->requestServerEncrypted;
171
  }
172
+
173
+ /**
174
+ * Sets the request server encryption value.
175
+ *
176
+ * @param boolean $requestServerEncrypted
177
+ *
178
+ * @return void
179
+ */
180
+ public function setRequestServerEncrypted($requestServerEncrypted)
181
+ {
182
+ $this->requestServerEncrypted = $requestServerEncrypted;
183
+ }
184
+
185
  /**
186
  * Gets blob sequenceNumber.
187
  *
188
+ * @return int
189
  */
190
  public function getSequenceNumber()
191
  {
192
+ return $this->sequenceNumber;
193
  }
194
 
195
  /**
197
  *
198
  * @param int $sequenceNumber value.
199
  *
200
+ * @return void
201
  */
202
+ protected function setSequenceNumber($sequenceNumber)
203
  {
204
  Validate::isInteger($sequenceNumber, 'sequenceNumber');
205
+ $this->sequenceNumber = $sequenceNumber;
206
  }
207
  }
 
 
vendor/microsoft/azure-storage-blob/src/Blob/Models/CreateBlobSnapshotOptions.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * LICENSE: The MIT License (the "License")
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * https://github.com/azure/azure-storage-php/LICENSE
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * PHP version 5
16
+ *
17
+ * @category Microsoft
18
+ * @package MicrosoftAzure\Storage\Blob\Models
19
+ * @author Azure Storage PHP SDK <dmsh@microsoft.com>
20
+ * @copyright 2016 Microsoft Corporation
21
+ * @license https://github.com/azure/azure-storage-php/LICENSE
22
+ * @link https://github.com/