Revive Old Posts – Auto Post to Social Media - Version 8.5.18

Version Description

  • 2020-09-27
Download this release

Release Info

Developer codeinwp
Plugin Icon 128x128 Revive Old Posts – Auto Post to Social Media
Version 8.5.18
Comparing to
See all releases

Code changes from version 8.5.17 to 8.5.18

Files changed (134) hide show
  1. CHANGELOG.md +4 -0
  2. includes/admin/services/class-rop-gmb-service.php +16 -2
  3. includes/class-rop-i18n.php +2 -0
  4. includes/class-rop.php +1 -1
  5. includes/lib/gmb-service-helper.php +0 -6665
  6. readme.md +5 -0
  7. readme.txt +5 -0
  8. themeisle-hash.json +1 -1
  9. tweet-old-post.php +3 -2
  10. vendor/autoload.php +1 -1
  11. vendor/composer/autoload_classmap.php +0 -2
  12. vendor/composer/autoload_files.php +0 -5
  13. vendor/composer/autoload_namespaces.php +0 -2
  14. vendor/composer/autoload_psr4.php +0 -11
  15. vendor/composer/autoload_real.php +5 -5
  16. vendor/composer/installed.json +0 -835
  17. vendor/firebase/php-jwt/LICENSE +0 -30
  18. vendor/firebase/php-jwt/README.md +0 -200
  19. vendor/firebase/php-jwt/src/BeforeValidException.php +0 -6
  20. vendor/firebase/php-jwt/src/ExpiredException.php +0 -6
  21. vendor/firebase/php-jwt/src/JWK.php +0 -171
  22. vendor/firebase/php-jwt/src/JWT.php +0 -512
  23. vendor/firebase/php-jwt/src/SignatureInvalidException.php +0 -6
  24. vendor/google/apiclient-services/LICENSE +0 -203
  25. vendor/google/apiclient-services/README.md +0 -23
  26. vendor/google/apiclient/LICENSE +0 -203
  27. vendor/google/apiclient/README.md +0 -456
  28. vendor/google/apiclient/src/Google/AccessToken/Revoke.php +0 -78
  29. vendor/google/apiclient/src/Google/AccessToken/Verify.php +0 -274
  30. vendor/google/apiclient/src/Google/AuthHandler/AuthHandlerFactory.php +0 -49
  31. vendor/google/apiclient/src/Google/AuthHandler/Guzzle5AuthHandler.php +0 -99
  32. vendor/google/apiclient/src/Google/AuthHandler/Guzzle6AuthHandler.php +0 -106
  33. vendor/google/apiclient/src/Google/AuthHandler/Guzzle7AuthHandler.php +0 -23
  34. vendor/google/apiclient/src/Google/Client.php +0 -1238
  35. vendor/google/apiclient/src/Google/Collection.php +0 -100
  36. vendor/google/apiclient/src/Google/Exception.php +0 -20
  37. vendor/google/apiclient/src/Google/Http/Batch.php +0 -253
  38. vendor/google/apiclient/src/Google/Http/MediaFileUpload.php +0 -353
  39. vendor/google/apiclient/src/Google/Http/REST.php +0 -187
  40. vendor/google/apiclient/src/Google/Model.php +0 -317
  41. vendor/google/apiclient/src/Google/Service.php +0 -56
  42. vendor/google/apiclient/src/Google/Service/Exception.php +0 -67
  43. vendor/google/apiclient/src/Google/Service/README.md +0 -5
  44. vendor/google/apiclient/src/Google/Service/Resource.php +0 -302
  45. vendor/google/apiclient/src/Google/Task/Composer.php +0 -104
  46. vendor/google/apiclient/src/Google/Task/Exception.php +0 -20
  47. vendor/google/apiclient/src/Google/Task/Retryable.php +0 -24
  48. vendor/google/apiclient/src/Google/Task/Runner.php +0 -281
  49. vendor/google/apiclient/src/Google/Utils/UriTemplate.php +0 -333
  50. vendor/google/apiclient/src/Google/autoload.php +0 -21
  51. vendor/google/auth/CHANGELOG.md +0 -167
  52. vendor/google/auth/CODE_OF_CONDUCT.md +0 -43
  53. vendor/google/auth/COPYING +0 -202
  54. vendor/google/auth/LICENSE +0 -203
  55. vendor/google/auth/README.md +0 -227
  56. vendor/google/auth/autoload.php +0 -34
  57. vendor/google/auth/src/AccessToken.php +0 -479
  58. vendor/google/auth/src/ApplicationDefaultCredentials.php +0 -299
  59. vendor/google/auth/src/Cache/InvalidArgumentException.php +0 -24
  60. vendor/google/auth/src/Cache/Item.php +0 -190
  61. vendor/google/auth/src/Cache/MemoryCacheItemPool.php +0 -154
  62. vendor/google/auth/src/Cache/SysVCacheItemPool.php +0 -241
  63. vendor/google/auth/src/CacheTrait.php +0 -83
  64. vendor/google/auth/src/Credentials/AppIdentityCredentials.php +0 -230
  65. vendor/google/auth/src/Credentials/GCECredentials.php +0 -541
  66. vendor/google/auth/src/Credentials/IAMCredentials.php +0 -91
  67. vendor/google/auth/src/Credentials/InsecureCredentials.php +0 -70
  68. vendor/google/auth/src/Credentials/ServiceAccountCredentials.php +0 -259
  69. vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php +0 -191
  70. vendor/google/auth/src/Credentials/UserRefreshCredentials.php +0 -138
  71. vendor/google/auth/src/CredentialsLoader.php +0 -241
  72. vendor/google/auth/src/FetchAuthTokenCache.php +0 -231
  73. vendor/google/auth/src/FetchAuthTokenInterface.php +0 -54
  74. vendor/google/auth/src/GCECache.php +0 -92
  75. vendor/google/auth/src/GetQuotaProjectInterface.php +0 -33
  76. vendor/google/auth/src/HttpHandler/Guzzle5HttpHandler.php +0 -126
  77. vendor/google/auth/src/HttpHandler/Guzzle6HttpHandler.php +0 -62
  78. vendor/google/auth/src/HttpHandler/Guzzle7HttpHandler.php +0 -21
  79. vendor/google/auth/src/HttpHandler/HttpClientCache.php +0 -54
  80. vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php +0 -53
  81. vendor/google/auth/src/Iam.php +0 -99
  82. vendor/google/auth/src/Middleware/AuthTokenMiddleware.php +0 -148
  83. vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php +0 -175
  84. vendor/google/auth/src/Middleware/SimpleMiddleware.php +0 -92
  85. vendor/google/auth/src/OAuth2.php +0 -1408
  86. vendor/google/auth/src/ProjectIdProviderInterface.php +0 -32
  87. vendor/google/auth/src/ServiceAccountSignerTrait.php +0 -57
  88. vendor/google/auth/src/SignBlobInterface.php +0 -44
  89. vendor/google/auth/src/Subscriber/AuthTokenSubscriber.php +0 -136
  90. vendor/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php +0 -180
  91. vendor/google/auth/src/Subscriber/SimpleSubscriber.php +0 -93
  92. vendor/google/auth/src/UpdateMetadataInterface.php +0 -41
  93. vendor/guzzlehttp/guzzle/CHANGELOG.md +0 -1419
  94. vendor/guzzlehttp/guzzle/LICENSE +0 -19
  95. vendor/guzzlehttp/guzzle/README.md +0 -79
  96. vendor/guzzlehttp/guzzle/UPGRADING.md +0 -1253
  97. vendor/guzzlehttp/guzzle/psalm.baseline.xml +0 -87
  98. vendor/guzzlehttp/guzzle/psalm.xml +0 -16
  99. vendor/guzzlehttp/guzzle/src/Client.php +0 -473
  100. vendor/guzzlehttp/guzzle/src/ClientInterface.php +0 -84
  101. vendor/guzzlehttp/guzzle/src/ClientTrait.php +0 -241
  102. vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php +0 -313
  103. vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +0 -82
  104. vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php +0 -101
  105. vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +0 -77
  106. vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +0 -410
  107. vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php +0 -39
  108. vendor/guzzlehttp/guzzle/src/Exception/ClientException.php +0 -10
  109. vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php +0 -56
  110. vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php +0 -9
  111. vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php +0 -7
  112. vendor/guzzlehttp/guzzle/src/Exception/RequestException.php +0 -164
  113. vendor/guzzlehttp/guzzle/src/Exception/ServerException.php +0 -10
  114. vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php +0 -7
  115. vendor/guzzlehttp/guzzle/src/Exception/TransferException.php +0 -7
  116. vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +0 -604
  117. vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php +0 -25
  118. vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php +0 -49
  119. vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +0 -258
  120. vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php +0 -119
  121. vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php +0 -215
  122. vendor/guzzlehttp/guzzle/src/Handler/Proxy.php +0 -59
  123. vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +0 -578
  124. vendor/guzzlehttp/guzzle/src/HandlerStack.php +0 -271
  125. vendor/guzzlehttp/guzzle/src/MessageFormatter.php +0 -201
  126. vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php +0 -22
  127. vendor/guzzlehttp/guzzle/src/Middleware.php +0 -259
  128. vendor/guzzlehttp/guzzle/src/Pool.php +0 -133
  129. vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php +0 -107
  130. vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php +0 -236
  131. vendor/guzzlehttp/guzzle/src/RequestOptions.php +0 -264
  132. vendor/guzzlehttp/guzzle/src/RetryMiddleware.php +0 -118
  133. vendor/guzzlehttp/guzzle/src/TransferStats.php +0 -135
  134. vendor/guzzlehttp/guzzle/src/Utils.php +0 -237
CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
 
 
 
 
 
2
  ### v8.5.17 - 2020-09-24
3
  **Changes:**
4
  * Dev: Add post-install command to composer.json
1
 
2
+ ### v8.5.18 - 2020-09-27
3
+ **Changes:**
4
+ * Change Pro: Move GMB dependency to Pro plugin.
5
+
6
  ### v8.5.17 - 2020-09-24
7
  **Changes:**
8
  * Dev: Add post-install command to composer.json
includes/admin/services/class-rop-gmb-service.php CHANGED
@@ -450,11 +450,25 @@ class Rop_Gmb_Service extends Rop_Services_Abstract {
450
  */
451
  public function share( $post_details, $args = array() ) {
452
 
 
 
 
 
 
 
 
453
  if ( ! class_exists( 'Google_Service_MyBusiness' ) ) {
454
- require_once ROP_LITE_PATH . 'includes/lib/gmb-service-helper.php';
 
 
 
 
 
 
 
 
455
  }
456
 
457
- $client = new Google_Client();
458
  $access_token = $this->gmb_refresh_access_token();
459
  $client->setAccessToken( $access_token );
460
 
450
  */
451
  public function share( $post_details, $args = array() ) {
452
 
453
+ if ( ! class_exists( 'Google_Client' ) ) {
454
+ $this->logger->alert_error( Rop_I18n::get_labels( 'errors.gmb_missing_main_class' ) );
455
+ return;
456
+ } else {
457
+ $client = new Google_Client();
458
+ }
459
+
460
  if ( ! class_exists( 'Google_Service_MyBusiness' ) ) {
461
+
462
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
463
+
464
+ if ( is_plugin_active( 'tweet-old-post-pro/tweet-old-post-pro.php' ) ) {
465
+ require_once ROP_PRO_PATH . 'lib/gmb/gmb-service-helper.php';
466
+ } else {
467
+ $this->logger->alert_error( Rop_I18n::get_labels( 'errors.gmb_missing_lib_class' ) );
468
+ return;
469
+ }
470
  }
471
 
 
472
  $access_token = $this->gmb_refresh_access_token();
473
  $client->setAccessToken( $access_token );
474
 
includes/class-rop-i18n.php CHANGED
@@ -382,6 +382,8 @@ You can try to disable any of the security plugins that you use in order to see
382
  'gmb_failed_access_token_refresh' => __( 'Failed to retrieve Google My Business access token: ', 'tweet-old-post' ),
383
  'gmb_failed_share' => __( 'Could not share post to Google My Business with LIVE state: ', 'tweet-old-post' ),
384
  'gmb_no_valid_accounts' => __( 'Google My Business error: No valid accounts found. Please make sure you have access to a Google My Business location.', 'tweet-old-post' ),
 
 
385
  ),
386
  );
387
  if ( empty( $key ) ) {
382
  'gmb_failed_access_token_refresh' => __( 'Failed to retrieve Google My Business access token: ', 'tweet-old-post' ),
383
  'gmb_failed_share' => __( 'Could not share post to Google My Business with LIVE state: ', 'tweet-old-post' ),
384
  'gmb_no_valid_accounts' => __( 'Google My Business error: No valid accounts found. Please make sure you have access to a Google My Business location.', 'tweet-old-post' ),
385
+ 'gmb_missing_main_class' => __( 'Unable to find Google_Client Class. Please ensure you have the Revive Old Posts Pro Addon activated.', 'tweet-old-post' ),
386
+ 'gmb_missing_lib_class' => __( 'Unable to find Google_Service_MyBusiness Class. Please ensure you have the Revive Old Posts Pro Addon activated.', 'tweet-old-post' ),
387
  ),
388
  );
389
  if ( empty( $key ) ) {
includes/class-rop.php CHANGED
@@ -68,7 +68,7 @@ class Rop {
68
  public function __construct() {
69
 
70
  $this->plugin_name = 'rop';
71
- $this->version = '8.5.17';
72
 
73
  $this->load_dependencies();
74
  $this->set_locale();
68
  public function __construct() {
69
 
70
  $this->plugin_name = 'rop';
71
+ $this->version = '8.5.18';
72
 
73
  $this->load_dependencies();
74
  $this->set_locale();
includes/lib/gmb-service-helper.php DELETED
@@ -1,6665 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2014 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6
- * use this file except in compliance with the License. You may obtain a copy of
7
- * the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
- * License for the specific language governing permissions and limitations under
15
- * the License.
16
- */
17
-
18
- /**
19
- * Service definition for MyBusiness (v4).
20
- *
21
- * <p>
22
- * The Google My Business API provides an interface for managing business
23
- * location information on Google.</p>
24
- *
25
- * <p>
26
- * For more information about this service, see the API
27
- * <a href="https://developers.google.com/my-business/" target="_blank">Documentation</a>
28
- * </p>
29
- *
30
- * @author Google, Inc.
31
- */
32
- class Google_Service_MyBusiness extends Google_Service {
33
-
34
-
35
-
36
- public $accounts;
37
- public $accounts_admins;
38
- public $accounts_invitations;
39
- public $accounts_locations;
40
- public $accounts_locations_admins;
41
- public $accounts_locations_followers;
42
- public $accounts_locations_localPosts;
43
- public $accounts_locations_media;
44
- public $accounts_locations_media_customers;
45
- public $accounts_locations_questions;
46
- public $accounts_locations_questions_answers;
47
- public $accounts_locations_reviews;
48
- public $accounts_locations_verifications;
49
- public $attributes;
50
- public $categories;
51
- public $chains;
52
- public $googleLocations;
53
-
54
-
55
- /**
56
- * Constructs the internal representation of the MyBusiness service.
57
- *
58
- * @param Google_Client $client
59
- */
60
- public function __construct( Google_Client $client ) {
61
- parent::__construct( $client );
62
- $this->rootUrl = 'https://mybusiness.googleapis.com/';
63
- $this->servicePath = '';
64
- $this->batchPath = 'batch';
65
- $this->version = 'v4';
66
- $this->serviceName = 'mybusiness';
67
-
68
- $this->accounts = new Google_Service_MyBusiness_Accounts_Resource(
69
- $this,
70
- $this->serviceName,
71
- 'accounts',
72
- array(
73
- 'methods' => array(
74
- 'create' => array(
75
- 'path' => 'v4/accounts',
76
- 'httpMethod' => 'POST',
77
- 'parameters' => array(
78
- 'primaryOwner' => array(
79
- 'location' => 'query',
80
- 'type' => 'string',
81
- ),
82
- ),
83
- ), 'deleteNotifications' => array(
84
- 'path' => 'v4/{+name}',
85
- 'httpMethod' => 'DELETE',
86
- 'parameters' => array(
87
- 'name' => array(
88
- 'location' => 'path',
89
- 'type' => 'string',
90
- 'required' => true,
91
- ),
92
- ),
93
- ), 'generateAccountNumber' => array(
94
- 'path' => 'v4/{+name}:generateAccountNumber',
95
- 'httpMethod' => 'POST',
96
- 'parameters' => array(
97
- 'name' => array(
98
- 'location' => 'path',
99
- 'type' => 'string',
100
- 'required' => true,
101
- ),
102
- ),
103
- ), 'get' => array(
104
- 'path' => 'v4/{+name}',
105
- 'httpMethod' => 'GET',
106
- 'parameters' => array(
107
- 'name' => array(
108
- 'location' => 'path',
109
- 'type' => 'string',
110
- 'required' => true,
111
- ),
112
- ),
113
- ), 'getNotifications' => array(
114
- 'path' => 'v4/{+name}',
115
- 'httpMethod' => 'GET',
116
- 'parameters' => array(
117
- 'name' => array(
118
- 'location' => 'path',
119
- 'type' => 'string',
120
- 'required' => true,
121
- ),
122
- ),
123
- ), 'list' => array(
124
- 'path' => 'v4/accounts',
125
- 'httpMethod' => 'GET',
126
- 'parameters' => array(
127
- 'pageSize' => array(
128
- 'location' => 'query',
129
- 'type' => 'integer',
130
- ),
131
- 'pageToken' => array(
132
- 'location' => 'query',
133
- 'type' => 'string',
134
- ),
135
- 'name' => array(
136
- 'location' => 'query',
137
- 'type' => 'string',
138
- ),
139
- 'filter' => array(
140
- 'location' => 'query',
141
- 'type' => 'string',
142
- ),
143
- ),
144
- ), 'listRecommendGoogleLocations' => array(
145
- 'path' => 'v4/{+name}:recommendGoogleLocations',
146
- 'httpMethod' => 'GET',
147
- 'parameters' => array(
148
- 'name' => array(
149
- 'location' => 'path',
150
- 'type' => 'string',
151
- 'required' => true,
152
- ),
153
- 'pageSize' => array(
154
- 'location' => 'query',
155
- 'type' => 'integer',
156
- ),
157
- 'pageToken' => array(
158
- 'location' => 'query',
159
- 'type' => 'string',
160
- ),
161
- ),
162
- ), 'update' => array(
163
- 'path' => 'v4/{+name}',
164
- 'httpMethod' => 'PUT',
165
- 'parameters' => array(
166
- 'name' => array(
167
- 'location' => 'path',
168
- 'type' => 'string',
169
- 'required' => true,
170
- ),
171
- 'validateOnly' => array(
172
- 'location' => 'query',
173
- 'type' => 'boolean',
174
- ),
175
- ),
176
- ), 'updateNotifications' => array(
177
- 'path' => 'v4/{+name}',
178
- 'httpMethod' => 'PUT',
179
- 'parameters' => array(
180
- 'name' => array(
181
- 'location' => 'path',
182
- 'type' => 'string',
183
- 'required' => true,
184
- ),
185
- ),
186
- ),
187
- ),
188
- )
189
- );
190
- $this->accounts_admins = new Google_Service_MyBusiness_AccountsAdmins_Resource(
191
- $this,
192
- $this->serviceName,
193
- 'admins',
194
- array(
195
- 'methods' => array(
196
- 'create' => array(
197
- 'path' => 'v4/{+parent}/admins',
198
- 'httpMethod' => 'POST',
199
- 'parameters' => array(
200
- 'parent' => array(
201
- 'location' => 'path',
202
- 'type' => 'string',
203
- 'required' => true,
204
- ),
205
- ),
206
- ), 'delete' => array(
207
- 'path' => 'v4/{+name}',
208
- 'httpMethod' => 'DELETE',
209
- 'parameters' => array(
210
- 'name' => array(
211
- 'location' => 'path',
212
- 'type' => 'string',
213
- 'required' => true,
214
- ),
215
- ),
216
- ), 'list' => array(
217
- 'path' => 'v4/{+parent}/admins',
218
- 'httpMethod' => 'GET',
219
- 'parameters' => array(
220
- 'parent' => array(
221
- 'location' => 'path',
222
- 'type' => 'string',
223
- 'required' => true,
224
- ),
225
- ),
226
- ), 'patch' => array(
227
- 'path' => 'v4/{+name}',
228
- 'httpMethod' => 'PATCH',
229
- 'parameters' => array(
230
- 'name' => array(
231
- 'location' => 'path',
232
- 'type' => 'string',
233
- 'required' => true,
234
- ),
235
- ),
236
- ),
237
- ),
238
- )
239
- );
240
- $this->accounts_invitations = new Google_Service_MyBusiness_AccountsInvitations_Resource(
241
- $this,
242
- $this->serviceName,
243
- 'invitations',
244
- array(
245
- 'methods' => array(
246
- 'accept' => array(
247
- 'path' => 'v4/{+name}:accept',
248
- 'httpMethod' => 'POST',
249
- 'parameters' => array(
250
- 'name' => array(
251
- 'location' => 'path',
252
- 'type' => 'string',
253
- 'required' => true,
254
- ),
255
- ),
256
- ), 'decline' => array(
257
- 'path' => 'v4/{+name}:decline',
258
- 'httpMethod' => 'POST',
259
- 'parameters' => array(
260
- 'name' => array(
261
- 'location' => 'path',
262
- 'type' => 'string',
263
- 'required' => true,
264
- ),
265
- ),
266
- ), 'list' => array(
267
- 'path' => 'v4/{+parent}/invitations',
268
- 'httpMethod' => 'GET',
269
- 'parameters' => array(
270
- 'parent' => array(
271
- 'location' => 'path',
272
- 'type' => 'string',
273
- 'required' => true,
274
- ),
275
- 'targetType' => array(
276
- 'location' => 'query',
277
- 'type' => 'string',
278
- ),
279
- ),
280
- ),
281
- ),
282
- )
283
- );
284
- $this->accounts_locations = new Google_Service_MyBusiness_AccountsLocations_Resource(
285
- $this,
286
- $this->serviceName,
287
- 'locations',
288
- array(
289
- 'methods' => array(
290
- 'associate' => array(
291
- 'path' => 'v4/{+name}:associate',
292
- 'httpMethod' => 'POST',
293
- 'parameters' => array(
294
- 'name' => array(
295
- 'location' => 'path',
296
- 'type' => 'string',
297
- 'required' => true,
298
- ),
299
- ),
300
- ), 'batchGet' => array(
301
- 'path' => 'v4/{+name}/locations:batchGet',
302
- 'httpMethod' => 'POST',
303
- 'parameters' => array(
304
- 'name' => array(
305
- 'location' => 'path',
306
- 'type' => 'string',
307
- 'required' => true,
308
- ),
309
- ),
310
- ), 'batchGetReviews' => array(
311
- 'path' => 'v4/{+name}/locations:batchGetReviews',
312
- 'httpMethod' => 'POST',
313
- 'parameters' => array(
314
- 'name' => array(
315
- 'location' => 'path',
316
- 'type' => 'string',
317
- 'required' => true,
318
- ),
319
- ),
320
- ), 'clearAssociation' => array(
321
- 'path' => 'v4/{+name}:clearAssociation',
322
- 'httpMethod' => 'POST',
323
- 'parameters' => array(
324
- 'name' => array(
325
- 'location' => 'path',
326
- 'type' => 'string',
327
- 'required' => true,
328
- ),
329
- ),
330
- ), 'create' => array(
331
- 'path' => 'v4/{+parent}/locations',
332
- 'httpMethod' => 'POST',
333
- 'parameters' => array(
334
- 'parent' => array(
335
- 'location' => 'path',
336
- 'type' => 'string',
337
- 'required' => true,
338
- ),
339
- 'validateOnly' => array(
340
- 'location' => 'query',
341
- 'type' => 'boolean',
342
- ),
343
- 'requestId' => array(
344
- 'location' => 'query',
345
- 'type' => 'string',
346
- ),
347
- ),
348
- ), 'delete' => array(
349
- 'path' => 'v4/{+name}',
350
- 'httpMethod' => 'DELETE',
351
- 'parameters' => array(
352
- 'name' => array(
353
- 'location' => 'path',
354
- 'type' => 'string',
355
- 'required' => true,
356
- ),
357
- ),
358
- ), 'fetchVerificationOptions' => array(
359
- 'path' => 'v4/{+name}:fetchVerificationOptions',
360
- 'httpMethod' => 'POST',
361
- 'parameters' => array(
362
- 'name' => array(
363
- 'location' => 'path',
364
- 'type' => 'string',
365
- 'required' => true,
366
- ),
367
- ),
368
- ), 'findMatches' => array(
369
- 'path' => 'v4/{+name}:findMatches',
370
- 'httpMethod' => 'POST',
371
- 'parameters' => array(
372
- 'name' => array(
373
- 'location' => 'path',
374
- 'type' => 'string',
375
- 'required' => true,
376
- ),
377
- ),
378
- ), 'get' => array(
379
- 'path' => 'v4/{+name}',
380
- 'httpMethod' => 'GET',
381
- 'parameters' => array(
382
- 'name' => array(
383
- 'location' => 'path',
384
- 'type' => 'string',
385
- 'required' => true,
386
- ),
387
- ),
388
- ), 'getGoogleUpdated' => array(
389
- 'path' => 'v4/{+name}:googleUpdated',
390
- 'httpMethod' => 'GET',
391
- 'parameters' => array(
392
- 'name' => array(
393
- 'location' => 'path',
394
- 'type' => 'string',
395
- 'required' => true,
396
- ),
397
- ),
398
- ), 'getServiceList' => array(
399
- 'path' => 'v4/{+name}',
400
- 'httpMethod' => 'GET',
401
- 'parameters' => array(
402
- 'name' => array(
403
- 'location' => 'path',
404
- 'type' => 'string',
405
- 'required' => true,
406
- ),
407
- ),
408
- ), 'list' => array(
409
- 'path' => 'v4/{+parent}/locations',
410
- 'httpMethod' => 'GET',
411
- 'parameters' => array(
412
- 'parent' => array(
413
- 'location' => 'path',
414
- 'type' => 'string',
415
- 'required' => true,
416
- ),
417
- 'pageSize' => array(
418
- 'location' => 'query',
419
- 'type' => 'integer',
420
- ),
421
- 'pageToken' => array(
422
- 'location' => 'query',
423
- 'type' => 'string',
424
- ),
425
- 'filter' => array(
426
- 'location' => 'query',
427
- 'type' => 'string',
428
- ),
429
- 'languageCode' => array(
430
- 'location' => 'query',
431
- 'type' => 'string',
432
- ),
433
- 'orderBy' => array(
434
- 'location' => 'query',
435
- 'type' => 'string',
436
- ),
437
- ),
438
- ), 'patch' => array(
439
- 'path' => 'v4/{+name}',
440
- 'httpMethod' => 'PATCH',
441
- 'parameters' => array(
442
- 'name' => array(
443
- 'location' => 'path',
444
- 'type' => 'string',
445
- 'required' => true,
446
- ),
447
- 'updateMask' => array(
448
- 'location' => 'query',
449
- 'type' => 'string',
450
- ),
451
- 'validateOnly' => array(
452
- 'location' => 'query',
453
- 'type' => 'boolean',
454
- ),
455
- 'attributeMask' => array(
456
- 'location' => 'query',
457
- 'type' => 'string',
458
- ),
459
- ),
460
- ), 'reportInsights' => array(
461
- 'path' => 'v4/{+name}/locations:reportInsights',
462
- 'httpMethod' => 'POST',
463
- 'parameters' => array(
464
- 'name' => array(
465
- 'location' => 'path',
466
- 'type' => 'string',
467
- 'required' => true,
468
- ),
469
- ),
470
- ), 'transfer' => array(
471
- 'path' => 'v4/{+name}:transfer',
472
- 'httpMethod' => 'POST',
473
- 'parameters' => array(
474
- 'name' => array(
475
- 'location' => 'path',
476
- 'type' => 'string',
477
- 'required' => true,
478
- ),
479
- ),
480
- ), 'updateServiceList' => array(
481
- 'path' => 'v4/{+name}',
482
- 'httpMethod' => 'PATCH',
483
- 'parameters' => array(
484
- 'name' => array(
485
- 'location' => 'path',
486
- 'type' => 'string',
487
- 'required' => true,
488
- ),
489
- 'updateMask' => array(
490
- 'location' => 'query',
491
- 'type' => 'string',
492
- ),
493
- ),
494
- ), 'verify' => array(
495
- 'path' => 'v4/{+name}:verify',
496
- 'httpMethod' => 'POST',
497
- 'parameters' => array(
498
- 'name' => array(
499
- 'location' => 'path',
500
- 'type' => 'string',
501
- 'required' => true,
502
- ),
503
- ),
504
- ),
505
- ),
506
- )
507
- );
508
- $this->accounts_locations_admins = new Google_Service_MyBusiness_AccountsLocationsAdmins_Resource(
509
- $this,
510
- $this->serviceName,
511
- 'admins',
512
- array(
513
- 'methods' => array(
514
- 'create' => array(
515
- 'path' => 'v4/{+parent}/admins',
516
- 'httpMethod' => 'POST',
517
- 'parameters' => array(
518
- 'parent' => array(
519
- 'location' => 'path',
520
- 'type' => 'string',
521
- 'required' => true,
522
- ),
523
- ),
524
- ), 'delete' => array(
525
- 'path' => 'v4/{+name}',
526
- 'httpMethod' => 'DELETE',
527
- 'parameters' => array(
528
- 'name' => array(
529
- 'location' => 'path',
530
- 'type' => 'string',
531
- 'required' => true,
532
- ),
533
- ),
534
- ), 'list' => array(
535
- 'path' => 'v4/{+parent}/admins',
536
- 'httpMethod' => 'GET',
537
- 'parameters' => array(
538
- 'parent' => array(
539
- 'location' => 'path',
540
- 'type' => 'string',
541
- 'required' => true,
542
- ),
543
- ),
544
- ), 'patch' => array(
545
- 'path' => 'v4/{+name}',
546
- 'httpMethod' => 'PATCH',
547
- 'parameters' => array(
548
- 'name' => array(
549
- 'location' => 'path',
550
- 'type' => 'string',
551
- 'required' => true,
552
- ),
553
- ),
554
- ),
555
- ),
556
- )
557
- );
558
- $this->accounts_locations_followers = new Google_Service_MyBusiness_AccountsLocationsFollowers_Resource(
559
- $this,
560
- $this->serviceName,
561
- 'followers',
562
- array(
563
- 'methods' => array(
564
- 'getMetadata' => array(
565
- 'path' => 'v4/{+name}',
566
- 'httpMethod' => 'GET',
567
- 'parameters' => array(
568
- 'name' => array(
569
- 'location' => 'path',
570
- 'type' => 'string',
571
- 'required' => true,
572
- ),
573
- ),
574
- ),
575
- ),
576
- )
577
- );
578
- $this->accounts_locations_localPosts = new Google_Service_MyBusiness_AccountsLocationsLocalPosts_Resource(
579
- $this,
580
- $this->serviceName,
581
- 'localPosts',
582
- array(
583
- 'methods' => array(
584
- 'create' => array(
585
- 'path' => 'v4/{+parent}/localPosts',
586
- 'httpMethod' => 'POST',
587
- 'parameters' => array(
588
- 'parent' => array(
589
- 'location' => 'path',
590
- 'type' => 'string',
591
- 'required' => true,
592
- ),
593
- ),
594
- ), 'delete' => array(
595
- 'path' => 'v4/{+name}',
596
- 'httpMethod' => 'DELETE',
597
- 'parameters' => array(
598
- 'name' => array(
599
- 'location' => 'path',
600
- 'type' => 'string',
601
- 'required' => true,
602
- ),
603
- ),
604
- ), 'get' => array(
605
- 'path' => 'v4/{+name}',
606
- 'httpMethod' => 'GET',
607
- 'parameters' => array(
608
- 'name' => array(
609
- 'location' => 'path',
610
- 'type' => 'string',
611
- 'required' => true,
612
- ),
613
- ),
614
- ), 'list' => array(
615
- 'path' => 'v4/{+parent}/localPosts',
616
- 'httpMethod' => 'GET',
617
- 'parameters' => array(
618
- 'parent' => array(
619
- 'location' => 'path',
620
- 'type' => 'string',
621
- 'required' => true,
622
- ),
623
- 'pageSize' => array(
624
- 'location' => 'query',
625
- 'type' => 'integer',
626
- ),
627
- 'pageToken' => array(
628
- 'location' => 'query',
629
- 'type' => 'string',
630
- ),
631
- ),
632
- ), 'patch' => array(
633
- 'path' => 'v4/{+name}',
634
- 'httpMethod' => 'PATCH',
635
- 'parameters' => array(
636
- 'name' => array(
637
- 'location' => 'path',
638
- 'type' => 'string',
639
- 'required' => true,
640
- ),
641
- 'updateMask' => array(
642
- 'location' => 'query',
643
- 'type' => 'string',
644
- ),
645
- ),
646
- ), 'reportInsights' => array(
647
- 'path' => 'v4/{+name}/localPosts:reportInsights',
648
- 'httpMethod' => 'POST',
649
- 'parameters' => array(
650
- 'name' => array(
651
- 'location' => 'path',
652
- 'type' => 'string',
653
- 'required' => true,
654
- ),
655
- ),
656
- ),
657
- ),
658
- )
659
- );
660
- $this->accounts_locations_media = new Google_Service_MyBusiness_AccountsLocationsMedia_Resource(
661
- $this,
662
- $this->serviceName,
663
- 'media',
664
- array(
665
- 'methods' => array(
666
- 'create' => array(
667
- 'path' => 'v4/{+parent}/media',
668
- 'httpMethod' => 'POST',
669
- 'parameters' => array(
670
- 'parent' => array(
671
- 'location' => 'path',
672
- 'type' => 'string',
673
- 'required' => true,
674
- ),
675
- ),
676
- ), 'delete' => array(
677
- 'path' => 'v4/{+name}',
678
- 'httpMethod' => 'DELETE',
679
- 'parameters' => array(
680
- 'name' => array(
681
- 'location' => 'path',
682
- 'type' => 'string',
683
- 'required' => true,
684
- ),
685
- ),
686
- ), 'get' => array(
687
- 'path' => 'v4/{+name}',
688
- 'httpMethod' => 'GET',
689
- 'parameters' => array(
690
- 'name' => array(
691
- 'location' => 'path',
692
- 'type' => 'string',
693
- 'required' => true,
694
- ),
695
- ),
696
- ), 'list' => array(
697
- 'path' => 'v4/{+parent}/media',
698
- 'httpMethod' => 'GET',
699
- 'parameters' => array(
700
- 'parent' => array(
701
- 'location' => 'path',
702
- 'type' => 'string',
703
- 'required' => true,
704
- ),
705
- 'pageSize' => array(
706
- 'location' => 'query',
707
- 'type' => 'integer',
708
- ),
709
- 'pageToken' => array(
710
- 'location' => 'query',
711
- 'type' => 'string',
712
- ),
713
- ),
714
- ), 'patch' => array(
715
- 'path' => 'v4/{+name}',
716
- 'httpMethod' => 'PATCH',
717
- 'parameters' => array(
718
- 'name' => array(
719
- 'location' => 'path',
720
- 'type' => 'string',
721
- 'required' => true,
722
- ),
723
- 'updateMask' => array(
724
- 'location' => 'query',
725
- 'type' => 'string',
726
- ),
727
- ),
728
- ), 'startUpload' => array(
729
- 'path' => 'v4/{+parent}/media:startUpload',
730
- 'httpMethod' => 'POST',
731
- 'parameters' => array(
732
- 'parent' => array(
733
- 'location' => 'path',
734
- 'type' => 'string',
735
- 'required' => true,
736
- ),
737
- ),
738
- ),
739
- ),
740
- )
741
- );
742
- $this->accounts_locations_media_customers = new Google_Service_MyBusiness_AccountsLocationsMediaCustomers_Resource(
743
- $this,
744
- $this->serviceName,
745
- 'customers',
746
- array(
747
- 'methods' => array(
748
- 'get' => array(
749
- 'path' => 'v4/{+name}',
750
- 'httpMethod' => 'GET',
751
- 'parameters' => array(
752
- 'name' => array(
753
- 'location' => 'path',
754
- 'type' => 'string',
755
- 'required' => true,
756
- ),
757
- ),
758
- ), 'list' => array(
759
- 'path' => 'v4/{+parent}/media/customers',
760
- 'httpMethod' => 'GET',
761
- 'parameters' => array(
762
- 'parent' => array(
763
- 'location' => 'path',
764
- 'type' => 'string',
765
- 'required' => true,
766
- ),
767
- 'pageSize' => array(
768
- 'location' => 'query',
769
- 'type' => 'integer',
770
- ),
771
- 'pageToken' => array(
772
- 'location' => 'query',
773
- 'type' => 'string',
774
- ),
775
- ),
776
- ),
777
- ),
778
- )
779
- );
780
- $this->accounts_locations_questions = new Google_Service_MyBusiness_AccountsLocationsQuestions_Resource(
781
- $this,
782
- $this->serviceName,
783
- 'questions',
784
- array(
785
- 'methods' => array(
786
- 'create' => array(
787
- 'path' => 'v4/{+parent}/questions',
788
- 'httpMethod' => 'POST',
789
- 'parameters' => array(
790
- 'parent' => array(
791
- 'location' => 'path',
792
- 'type' => 'string',
793
- 'required' => true,
794
- ),
795
- ),
796
- ), 'delete' => array(
797
- 'path' => 'v4/{+name}',
798
- 'httpMethod' => 'DELETE',
799
- 'parameters' => array(
800
- 'name' => array(
801
- 'location' => 'path',
802
- 'type' => 'string',
803
- 'required' => true,
804
- ),
805
- ),
806
- ), 'list' => array(
807
- 'path' => 'v4/{+parent}/questions',
808
- 'httpMethod' => 'GET',
809
- 'parameters' => array(
810
- 'parent' => array(
811
- 'location' => 'path',
812
- 'type' => 'string',
813
- 'required' => true,
814
- ),
815
- 'pageSize' => array(
816
- 'location' => 'query',
817
- 'type' => 'integer',
818
- ),
819
- 'pageToken' => array(
820
- 'location' => 'query',
821
- 'type' => 'string',
822
- ),
823
- 'answersPerQuestion' => array(
824
- 'location' => 'query',
825
- 'type' => 'integer',
826
- ),
827
- 'filter' => array(
828
- 'location' => 'query',
829
- 'type' => 'string',
830
- ),
831
- 'orderBy' => array(
832
- 'location' => 'query',
833
- 'type' => 'string',
834
- ),
835
- ),
836
- ), 'patch' => array(
837
- 'path' => 'v4/{+name}',
838
- 'httpMethod' => 'PATCH',
839
- 'parameters' => array(
840
- 'name' => array(
841
- 'location' => 'path',
842
- 'type' => 'string',
843
- 'required' => true,
844
- ),
845
- ),
846
- ),
847
- ),
848
- )
849
- );
850
- $this->accounts_locations_questions_answers = new Google_Service_MyBusiness_AccountsLocationsQuestionsAnswers_Resource(
851
- $this,
852
- $this->serviceName,
853
- 'answers',
854
- array(
855
- 'methods' => array(
856
- 'delete' => array(
857
- 'path' => 'v4/{+parent}/answers:delete',
858
- 'httpMethod' => 'DELETE',
859
- 'parameters' => array(
860
- 'parent' => array(
861
- 'location' => 'path',
862
- 'type' => 'string',
863
- 'required' => true,
864
- ),
865
- ),
866
- ), 'list' => array(
867
- 'path' => 'v4/{+parent}/answers',
868
- 'httpMethod' => 'GET',
869
- 'parameters' => array(
870
- 'parent' => array(
871
- 'location' => 'path',
872
- 'type' => 'string',
873
- 'required' => true,
874
- ),
875
- 'pageSize' => array(
876
- 'location' => 'query',
877
- 'type' => 'integer',
878
- ),
879
- 'pageToken' => array(
880
- 'location' => 'query',
881
- 'type' => 'string',
882
- ),
883
- 'orderBy' => array(
884
- 'location' => 'query',
885
- 'type' => 'string',
886
- ),
887
- ),
888
- ), 'upsert' => array(
889
- 'path' => 'v4/{+parent}/answers:upsert',
890
- 'httpMethod' => 'POST',
891
- 'parameters' => array(
892
- 'parent' => array(
893
- 'location' => 'path',
894
- 'type' => 'string',
895
- 'required' => true,
896
- ),
897
- ),
898
- ),
899
- ),
900
- )
901
- );
902
- $this->accounts_locations_reviews = new Google_Service_MyBusiness_AccountsLocationsReviews_Resource(
903
- $this,
904
- $this->serviceName,
905
- 'reviews',
906
- array(
907
- 'methods' => array(
908
- 'deleteReply' => array(
909
- 'path' => 'v4/{+name}/reply',
910
- 'httpMethod' => 'DELETE',
911
- 'parameters' => array(
912
- 'name' => array(
913
- 'location' => 'path',
914
- 'type' => 'string',
915
- 'required' => true,
916
- ),
917
- ),
918
- ), 'get' => array(
919
- 'path' => 'v4/{+name}',
920
- 'httpMethod' => 'GET',
921
- 'parameters' => array(
922
- 'name' => array(
923
- 'location' => 'path',
924
- 'type' => 'string',
925
- 'required' => true,
926
- ),
927
- ),
928
- ), 'list' => array(
929
- 'path' => 'v4/{+parent}/reviews',
930
- 'httpMethod' => 'GET',
931
- 'parameters' => array(
932
- 'parent' => array(
933
- 'location' => 'path',
934
- 'type' => 'string',
935
- 'required' => true,
936
- ),
937
- 'pageSize' => array(
938
- 'location' => 'query',
939
- 'type' => 'integer',
940
- ),
941
- 'pageToken' => array(
942
- 'location' => 'query',
943
- 'type' => 'string',
944
- ),
945
- 'orderBy' => array(
946
- 'location' => 'query',
947
- 'type' => 'string',
948
- ),
949
- ),
950
- ), 'updateReply' => array(
951
- 'path' => 'v4/{+name}/reply',
952
- 'httpMethod' => 'PUT',
953
- 'parameters' => array(
954
- 'name' => array(
955
- 'location' => 'path',
956
- 'type' => 'string',
957
- 'required' => true,
958
- ),
959
- ),
960
- ),
961
- ),
962
- )
963
- );
964
- $this->accounts_locations_verifications = new Google_Service_MyBusiness_AccountsLocationsVerifications_Resource(
965
- $this,
966
- $this->serviceName,
967
- 'verifications',
968
- array(
969
- 'methods' => array(
970
- 'complete' => array(
971
- 'path' => 'v4/{+name}:complete',
972
- 'httpMethod' => 'POST',
973
- 'parameters' => array(
974
- 'name' => array(
975
- 'location' => 'path',
976
- 'type' => 'string',
977
- 'required' => true,
978
- ),
979
- ),
980
- ), 'list' => array(
981
- 'path' => 'v4/{+parent}/verifications',
982
- 'httpMethod' => 'GET',
983
- 'parameters' => array(
984
- 'parent' => array(
985
- 'location' => 'path',
986
- 'type' => 'string',
987
- 'required' => true,
988
- ),
989
- 'pageSize' => array(
990
- 'location' => 'query',
991
- 'type' => 'integer',
992
- ),
993
- 'pageToken' => array(
994
- 'location' => 'query',
995
- 'type' => 'string',
996
- ),
997
- ),
998
- ),
999
- ),
1000
- )
1001
- );
1002
- $this->attributes = new Google_Service_MyBusiness_Attributes_Resource(
1003
- $this,
1004
- $this->serviceName,
1005
- 'attributes',
1006
- array(
1007
- 'methods' => array(
1008
- 'list' => array(
1009
- 'path' => 'v4/attributes',
1010
- 'httpMethod' => 'GET',
1011
- 'parameters' => array(
1012
- 'name' => array(
1013
- 'location' => 'query',
1014
- 'type' => 'string',
1015
- ),
1016
- 'categoryId' => array(
1017
- 'location' => 'query',
1018
- 'type' => 'string',
1019
- ),
1020
- 'country' => array(
1021
- 'location' => 'query',
1022
- 'type' => 'string',
1023
- ),
1024
- 'languageCode' => array(
1025
- 'location' => 'query',
1026
- 'type' => 'string',
1027
- ),
1028
- 'pageSize' => array(
1029
- 'location' => 'query',
1030
- 'type' => 'integer',
1031
- ),
1032
- 'pageToken' => array(
1033
- 'location' => 'query',
1034
- 'type' => 'string',
1035
- ),
1036
- ),
1037
- ),
1038
- ),
1039
- )
1040
- );
1041
- $this->categories = new Google_Service_MyBusiness_Categories_Resource(
1042
- $this,
1043
- $this->serviceName,
1044
- 'categories',
1045
- array(
1046
- 'methods' => array(
1047
- 'batchGet' => array(
1048
- 'path' => 'v4/categories:batchGet',
1049
- 'httpMethod' => 'GET',
1050
- 'parameters' => array(
1051
- 'languageCode' => array(
1052
- 'location' => 'query',
1053
- 'type' => 'string',
1054
- ),
1055
- 'categoryIds' => array(
1056
- 'location' => 'query',
1057
- 'type' => 'string',
1058
- 'repeated' => true,
1059
- ),
1060
- 'regionCode' => array(
1061
- 'location' => 'query',
1062
- 'type' => 'string',
1063
- ),
1064
- 'view' => array(
1065
- 'location' => 'query',
1066
- 'type' => 'string',
1067
- ),
1068
- ),
1069
- ), 'list' => array(
1070
- 'path' => 'v4/categories',
1071
- 'httpMethod' => 'GET',
1072
- 'parameters' => array(
1073
- 'regionCode' => array(
1074
- 'location' => 'query',
1075
- 'type' => 'string',
1076
- ),
1077
- 'languageCode' => array(
1078
- 'location' => 'query',
1079
- 'type' => 'string',
1080
- ),
1081
- 'searchTerm' => array(
1082
- 'location' => 'query',
1083
- 'type' => 'string',
1084
- ),
1085
- 'pageSize' => array(
1086
- 'location' => 'query',
1087
- 'type' => 'integer',
1088
- ),
1089
- 'pageToken' => array(
1090
- 'location' => 'query',
1091
- 'type' => 'string',
1092
- ),
1093
- 'view' => array(
1094
- 'location' => 'query',
1095
- 'type' => 'string',
1096
- ),
1097
- ),
1098
- ),
1099
- ),
1100
- )
1101
- );
1102
- $this->chains = new Google_Service_MyBusiness_Chains_Resource(
1103
- $this,
1104
- $this->serviceName,
1105
- 'chains',
1106
- array(
1107
- 'methods' => array(
1108
- 'get' => array(
1109
- 'path' => 'v4/{+name}',
1110
- 'httpMethod' => 'GET',
1111
- 'parameters' => array(
1112
- 'name' => array(
1113
- 'location' => 'path',
1114
- 'type' => 'string',
1115
- 'required' => true,
1116
- ),
1117
- ),
1118
- ), 'search' => array(
1119
- 'path' => 'v4/chains:search',
1120
- 'httpMethod' => 'GET',
1121
- 'parameters' => array(
1122
- 'chainDisplayName' => array(
1123
- 'location' => 'query',
1124
- 'type' => 'string',
1125
- ),
1126
- 'resultCount' => array(
1127
- 'location' => 'query',
1128
- 'type' => 'integer',
1129
- ),
1130
- ),
1131
- ),
1132
- ),
1133
- )
1134
- );
1135
- $this->googleLocations = new Google_Service_MyBusiness_GoogleLocations_Resource(
1136
- $this,
1137
- $this->serviceName,
1138
- 'googleLocations',
1139
- array(
1140
- 'methods' => array(
1141
- 'report' => array(
1142
- 'path' => 'v4/{+name}:report',
1143
- 'httpMethod' => 'POST',
1144
- 'parameters' => array(
1145
- 'name' => array(
1146
- 'location' => 'path',
1147
- 'type' => 'string',
1148
- 'required' => true,
1149
- ),
1150
- ),
1151
- ), 'search' => array(
1152
- 'path' => 'v4/googleLocations:search',
1153
- 'httpMethod' => 'POST',
1154
- 'parameters' => array(),
1155
- ),
1156
- ),
1157
- )
1158
- );
1159
- }
1160
- }
1161
-
1162
-
1163
- /**
1164
- * The "accounts" collection of methods.
1165
- * Typical usage is:
1166
- * <code>
1167
- * $mybusinessService = new Google_Service_MyBusiness(...);
1168
- * $accounts = $mybusinessService->accounts;
1169
- * </code>
1170
- */
1171
- class Google_Service_MyBusiness_Accounts_Resource extends Google_Service_Resource {
1172
-
1173
-
1174
- /**
1175
- * Creates an account with the specified name and type under the given parent.
1176
- *
1177
- * Personal accounts and Organizations cannot be created. User Groups cannot
1178
- * be created with a Personal account as primary owner. Location Groups cannot
1179
- * be created with a primary owner of a Personal account if the Personal account
1180
- * is in an Organization. Location Groups cannot own Location Groups.
1181
- * (accounts.create)
1182
- *
1183
- * @param Google_Account $postBody
1184
- * @param array $optParams Optional parameters.
1185
- *
1186
- * @opt_param string primaryOwner The resource name of the account which will be
1187
- * the primary owner of the account being created. It should be of the form
1188
- * `accounts/{account_id}/`.
1189
- * @return Google_Service_MyBusiness_Account
1190
- */
1191
- public function create( Google_Service_MyBusiness_Account $postBody, $optParams = array() ) {
1192
- $params = array('postBody' => $postBody);
1193
- $params = array_merge( $params, $optParams );
1194
- return $this->call( 'create', array($params), 'Google_Service_MyBusiness_Account' );
1195
- }
1196
-
1197
- /**
1198
- * Clears the pubsub notification settings for the account.
1199
- * (accounts.deleteNotifications)
1200
- *
1201
- * @param string $name The resource name for the notification settings to be
1202
- * cleared.
1203
- * @param array $optParams Optional parameters.
1204
- * @return Google_Service_MyBusiness_MybusinessEmpty
1205
- */
1206
- public function deleteNotifications( $name, $optParams = array() ) {
1207
- $params = array('name' => $name);
1208
- $params = array_merge( $params, $optParams );
1209
- return $this->call( 'deleteNotifications', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
1210
- }
1211
-
1212
- /**
1213
- * Generates an account number for this account. The account number is not
1214
- * provisioned when an account is created. Use this request to create an account
1215
- * number when it is required. (accounts.generateAccountNumber)
1216
- *
1217
- * @param string $name The name of the account to generate an account number
1218
- * for.
1219
- * @param Google_GenerateAccountNumberRequest $postBody
1220
- * @param array $optParams Optional parameters.
1221
- * @return Google_Service_MyBusiness_Account
1222
- */
1223
- public function generateAccountNumber( $name, Google_Service_MyBusiness_GenerateAccountNumberRequest $postBody, $optParams = array() ) {
1224
- $params = array('name' => $name, 'postBody' => $postBody);
1225
- $params = array_merge( $params, $optParams );
1226
- return $this->call( 'generateAccountNumber', array($params), 'Google_Service_MyBusiness_Account' );
1227
- }
1228
-
1229
- /**
1230
- * Gets the specified account. Returns `NOT_FOUND` if the account does not exist
1231
- * or if the caller does not have access rights to it. (accounts.get)
1232
- *
1233
- * @param string $name The name of the account to fetch.
1234
- * @param array $optParams Optional parameters.
1235
- * @return Google_Service_MyBusiness_Account
1236
- */
1237
- public function get( $name, $optParams = array() ) {
1238
- $params = array('name' => $name);
1239
- $params = array_merge( $params, $optParams );
1240
- return $this->call( 'get', array($params), 'Google_Service_MyBusiness_Account' );
1241
- }
1242
-
1243
- /**
1244
- * Returns the pubsub notification settings for the account.
1245
- * (accounts.getNotifications)
1246
- *
1247
- * @param string $name The notification settings resource name.
1248
- * @param array $optParams Optional parameters.
1249
- * @return Google_Service_MyBusiness_Notifications
1250
- */
1251
- public function getNotifications( $name, $optParams = array() ) {
1252
- $params = array('name' => $name);
1253
- $params = array_merge( $params, $optParams );
1254
- return $this->call( 'getNotifications', array($params), 'Google_Service_MyBusiness_Notifications' );
1255
- }
1256
-
1257
- /**
1258
- * Lists all of the accounts for the authenticated user. This includes all
1259
- * accounts that the user owns, as well as any accounts for which the user has
1260
- * management rights. (accounts.listAccounts)
1261
- *
1262
- * @param array $optParams Optional parameters.
1263
- *
1264
- * @opt_param int pageSize How many accounts to fetch per page. Default is 20,
1265
- * minimum is 2, and maximum page size is 20.
1266
- * @opt_param string pageToken If specified, the next page of accounts is
1267
- * retrieved. The `pageToken` is returned when a call to `accounts.list` returns
1268
- * more results than can fit into the requested page size.
1269
- * @opt_param string name The resource name of the account for which the list of
1270
- * directly accessible accounts is to be retrieved. This only makes sense for
1271
- * Organizations and User Groups. If empty, will return `ListAccounts` for the
1272
- * authenticated user.
1273
- * @opt_param string filter A filter constraining the accounts to return. The
1274
- * response includes only entries that match the filter. If `filter` is empty,
1275
- * then no constraints are applied and all accounts (paginated) are retrieved
1276
- * for the requested account.
1277
- *
1278
- * For example, a request with the filter `type=USER_GROUP` will only return
1279
- * user groups.
1280
- * @return Google_Service_MyBusiness_ListAccountsResponse
1281
- */
1282
- public function listAccounts( $optParams = array() ) {
1283
- $params = array();
1284
- $params = array_merge( $params, $optParams );
1285
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListAccountsResponse' );
1286
- }
1287
-
1288
- /**
1289
- * List all the GoogleLocations that have been recommended to the specified GMB
1290
- * account. Recommendations are provided for personal accounts and location
1291
- * groups only, requests for all other account types will result in an error.
1292
- * The recommendations for location groups are based on the locations in that
1293
- * group.
1294
- *
1295
- * The recommendations for personal accounts are based on all of the locations
1296
- * that the user has access to on Google My Business (which includes locations
1297
- * they can access through location groups), and is a superset of all
1298
- * recommendations generated for the user.
1299
- * (accounts.listRecommendGoogleLocations)
1300
- *
1301
- * @param string $name Name of the account resource to fetch recommended Google
1302
- * locations for.
1303
- * @param array $optParams Optional parameters.
1304
- *
1305
- * @opt_param int pageSize How many locations to fetch per page. Default is 25,
1306
- * minimum is 1, and maximum page size is 100.
1307
- * @opt_param string pageToken If specified, the next page of locations is
1308
- * retrieved.
1309
- * @return Google_Service_MyBusiness_ListRecommendedGoogleLocationsResponse
1310
- */
1311
- public function listRecommendGoogleLocations( $name, $optParams = array() ) {
1312
- $params = array('name' => $name);
1313
- $params = array_merge( $params, $optParams );
1314
- return $this->call( 'listRecommendGoogleLocations', array($params), 'Google_Service_MyBusiness_ListRecommendedGoogleLocationsResponse' );
1315
- }
1316
-
1317
- /**
1318
- * Updates the specified business account. Personal accounts cannot be updated
1319
- * using this method. Note: The only editable field for an account is
1320
- * `account_name`. Any other fields passed in (such as `type` or `role`) are
1321
- * ignored. (accounts.update)
1322
- *
1323
- * @param string $name The name of the account to update.
1324
- * @param Google_Account $postBody
1325
- * @param array $optParams Optional parameters.
1326
- *
1327
- * @opt_param bool validateOnly If true, the request is validated without
1328
- * actually updating the account.
1329
- * @return Google_Service_MyBusiness_Account
1330
- */
1331
- public function update( $name, Google_Service_MyBusiness_Account $postBody, $optParams = array() ) {
1332
- $params = array('name' => $name, 'postBody' => $postBody);
1333
- $params = array_merge( $params, $optParams );
1334
- return $this->call( 'update', array($params), 'Google_Service_MyBusiness_Account' );
1335
- }
1336
-
1337
- /**
1338
- * Sets the pubsub notification settings for the account informing My Business
1339
- * which topic to send pubsub notifications for:
1340
- *
1341
- * - New reviews for locations administered by the account. - Updated reviews
1342
- * for locations administered by the account. - New `GoogleUpdates` for
1343
- * locations administered by the account.
1344
- *
1345
- * An account will only have one notification settings resource, and only one
1346
- * pubsub topic can be set. (accounts.updateNotifications)
1347
- *
1348
- * @param string $name The notification settings resource name.
1349
- * @param Google_Notifications $postBody
1350
- * @param array $optParams Optional parameters.
1351
- * @return Google_Service_MyBusiness_Notifications
1352
- */
1353
- public function updateNotifications( $name, Google_Service_MyBusiness_Notifications $postBody, $optParams = array() ) {
1354
- $params = array('name' => $name, 'postBody' => $postBody);
1355
- $params = array_merge( $params, $optParams );
1356
- return $this->call( 'updateNotifications', array($params), 'Google_Service_MyBusiness_Notifications' );
1357
- }
1358
- }
1359
-
1360
- /**
1361
- * The "admins" collection of methods.
1362
- * Typical usage is:
1363
- * <code>
1364
- * $mybusinessService = new Google_Service_MyBusiness(...);
1365
- * $admins = $mybusinessService->admins;
1366
- * </code>
1367
- */
1368
- class Google_Service_MyBusiness_AccountsAdmins_Resource extends Google_Service_Resource {
1369
-
1370
-
1371
- /**
1372
- * Invites the specified user to become an administrator for the specified
1373
- * account. The invitee must accept the invitation in order to be granted access
1374
- * to the account. See AcceptInvitation to programmatically accept an
1375
- * invitation. (admins.create)
1376
- *
1377
- * @param string $parent The resource name of the account this admin is created
1378
- * for.
1379
- * @param Google_Admin $postBody
1380
- * @param array $optParams Optional parameters.
1381
- * @return Google_Service_MyBusiness_Admin
1382
- */
1383
- public function create( $parent, Google_Service_MyBusiness_Admin $postBody, $optParams = array() ) {
1384
- $params = array('parent' => $parent, 'postBody' => $postBody);
1385
- $params = array_merge( $params, $optParams );
1386
- return $this->call( 'create', array($params), 'Google_Service_MyBusiness_Admin' );
1387
- }
1388
-
1389
- /**
1390
- * Removes the specified admin from the specified account. (admins.delete)
1391
- *
1392
- * @param string $name The resource name of the admin to remove from the
1393
- * account.
1394
- * @param array $optParams Optional parameters.
1395
- * @return Google_Service_MyBusiness_MybusinessEmpty
1396
- */
1397
- public function delete( $name, $optParams = array() ) {
1398
- $params = array('name' => $name);
1399
- $params = array_merge( $params, $optParams );
1400
- return $this->call( 'delete', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
1401
- }
1402
-
1403
- /**
1404
- * Lists the admins for the specified account. (admins.listAccountsAdmins)
1405
- *
1406
- * @param string $parent The name of the account from which to retrieve a list
1407
- * of admins.
1408
- * @param array $optParams Optional parameters.
1409
- * @return Google_Service_MyBusiness_ListAccountAdminsResponse
1410
- */
1411
- public function listAccountsAdmins( $parent, $optParams = array() ) {
1412
- $params = array('parent' => $parent);
1413
- $params = array_merge( $params, $optParams );
1414
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListAccountAdminsResponse' );
1415
- }
1416
-
1417
- /**
1418
- * Updates the Admin for the specified Account Admin. Only the AdminRole of the
1419
- * Admin can be updated. (admins.patch)
1420
- *
1421
- * @param string $name The resource name of the admin to update.
1422
- * @param Google_Admin $postBody
1423
- * @param array $optParams Optional parameters.
1424
- * @return Google_Service_MyBusiness_Admin
1425
- */
1426
- public function patch( $name, Google_Service_MyBusiness_Admin $postBody, $optParams = array() ) {
1427
- $params = array('name' => $name, 'postBody' => $postBody);
1428
- $params = array_merge( $params, $optParams );
1429
- return $this->call( 'patch', array($params), 'Google_Service_MyBusiness_Admin' );
1430
- }
1431
- }
1432
- /**
1433
- * The "invitations" collection of methods.
1434
- * Typical usage is:
1435
- * <code>
1436
- * $mybusinessService = new Google_Service_MyBusiness(...);
1437
- * $invitations = $mybusinessService->invitations;
1438
- * </code>
1439
- */
1440
- class Google_Service_MyBusiness_AccountsInvitations_Resource extends Google_Service_Resource {
1441
-
1442
-
1443
- /**
1444
- * Accepts the specified invitation. (invitations.accept)
1445
- *
1446
- * @param string $name The name of the invitation that is being accepted.
1447
- * @param Google_AcceptInvitationRequest $postBody
1448
- * @param array $optParams Optional parameters.
1449
- * @return Google_Service_MyBusiness_MybusinessEmpty
1450
- */
1451
- public function accept( $name, Google_Service_MyBusiness_AcceptInvitationRequest $postBody, $optParams = array() ) {
1452
- $params = array('name' => $name, 'postBody' => $postBody);
1453
- $params = array_merge( $params, $optParams );
1454
- return $this->call( 'accept', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
1455
- }
1456
-
1457
- /**
1458
- * Declines the specified invitation. (invitations.decline)
1459
- *
1460
- * @param string $name The name of the account invitation that is being
1461
- * declined.
1462
- * @param Google_DeclineInvitationRequest $postBody
1463
- * @param array $optParams Optional parameters.
1464
- * @return Google_Service_MyBusiness_MybusinessEmpty
1465
- */
1466
- public function decline( $name, Google_Service_MyBusiness_DeclineInvitationRequest $postBody, $optParams = array() ) {
1467
- $params = array('name' => $name, 'postBody' => $postBody);
1468
- $params = array_merge( $params, $optParams );
1469
- return $this->call( 'decline', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
1470
- }
1471
-
1472
- /**
1473
- * Lists pending invitations for the specified account.
1474
- * (invitations.listAccountsInvitations)
1475
- *
1476
- * @param string $parent The name of the account from which the list of
1477
- * invitations is being retrieved.
1478
- * @param array $optParams Optional parameters.
1479
- *
1480
- * @opt_param string targetType Specifies which target types should appear in
1481
- * the response.
1482
- * @return Google_Service_MyBusiness_ListInvitationsResponse
1483
- */
1484
- public function listAccountsInvitations( $parent, $optParams = array() ) {
1485
- $params = array('parent' => $parent);
1486
- $params = array_merge( $params, $optParams );
1487
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListInvitationsResponse' );
1488
- }
1489
- }
1490
- /**
1491
- * The "locations" collection of methods.
1492
- * Typical usage is:
1493
- * <code>
1494
- * $mybusinessService = new Google_Service_MyBusiness(...);
1495
- * $locations = $mybusinessService->locations;
1496
- * </code>
1497
- */
1498
- class Google_Service_MyBusiness_AccountsLocations_Resource extends Google_Service_Resource {
1499
-
1500
-
1501
- /**
1502
- * Associates a location to a place ID. Any previous association is overwritten.
1503
- * This operation is only valid if the location is unverified. The association
1504
- * must be valid, that is, it appears in the list of `FindMatchingLocations`.
1505
- * (locations.associate)
1506
- *
1507
- * @param string $name The resource name of the location to associate.
1508
- * @param Google_AssociateLocationRequest $postBody
1509
- * @param array $optParams Optional parameters.
1510
- * @return Google_Service_MyBusiness_MybusinessEmpty
1511
- */
1512
- public function associate( $name, Google_Service_MyBusiness_AssociateLocationRequest $postBody, $optParams = array() ) {
1513
- $params = array('name' => $name, 'postBody' => $postBody);
1514
- $params = array_merge( $params, $optParams );
1515
- return $this->call( 'associate', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
1516
- }
1517
-
1518
- /**
1519
- * Gets all of the specified locations in the given account.
1520
- * (locations.batchGet)
1521
- *
1522
- * @param string $name The name of the account from which to fetch locations.
1523
- * @param Google_BatchGetLocationsRequest $postBody
1524
- * @param array $optParams Optional parameters.
1525
- * @return Google_Service_MyBusiness_BatchGetLocationsResponse
1526
- */
1527
- public function batchGet( $name, Google_Service_MyBusiness_BatchGetLocationsRequest $postBody, $optParams = array() ) {
1528
- $params = array('name' => $name, 'postBody' => $postBody);
1529
- $params = array_merge( $params, $optParams );
1530
- return $this->call( 'batchGet', array($params), 'Google_Service_MyBusiness_BatchGetLocationsResponse' );
1531
- }
1532
-
1533
- /**
1534
- * Returns the paginated list of reviews for all specified locations. This
1535
- * operation is only valid if the specified locations are verified. Note:
1536
- * Reviews are limited to a batch size of 200 `location_names` per call.
1537
- * (locations.batchGetReviews)
1538
- *
1539
- * @param string $name The name of the account from which to retrieve a list of
1540
- * reviews across multiple locations.
1541
- * @param Google_BatchGetReviewsRequest $postBody
1542
- * @param array $optParams Optional parameters.
1543
- * @return Google_Service_MyBusiness_BatchGetReviewsResponse
1544
- */
1545
- public function batchGetReviews( $name, Google_Service_MyBusiness_BatchGetReviewsRequest $postBody, $optParams = array() ) {
1546
- $params = array('name' => $name, 'postBody' => $postBody);
1547
- $params = array_merge( $params, $optParams );
1548
- return $this->call( 'batchGetReviews', array($params), 'Google_Service_MyBusiness_BatchGetReviewsResponse' );
1549
- }
1550
-
1551
- /**
1552
- * Clears an association between a location and its place ID. This operation is
1553
- * only valid if the location is unverified. (locations.clearAssociation)
1554
- *
1555
- * @param string $name The resource name of the location to disassociate.
1556
- * @param Google_ClearLocationAssociationRequest $postBody
1557
- * @param array $optParams Optional parameters.
1558
- * @return Google_Service_MyBusiness_MybusinessEmpty
1559
- */
1560
- public function clearAssociation( $name, Google_Service_MyBusiness_ClearLocationAssociationRequest $postBody, $optParams = array() ) {
1561
- $params = array('name' => $name, 'postBody' => $postBody);
1562
- $params = array_merge( $params, $optParams );
1563
- return $this->call( 'clearAssociation', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
1564
- }
1565
-
1566
- /**
1567
- * Creates a new location owned by the specified account, and returns it.
1568
- * (locations.create)
1569
- *
1570
- * @param string $parent The name of the account in which to create this
1571
- * location.
1572
- * @param Google_Location $postBody
1573
- * @param array $optParams Optional parameters.
1574
- *
1575
- * @opt_param bool validateOnly If true, the request is validated without
1576
- * actually creating the location.
1577
- * @opt_param string requestId A unique request ID for the server to detect
1578
- * duplicated requests. We recommend using UUIDs. Max length is 50 characters.
1579
- * @return Google_Service_MyBusiness_Location
1580
- */
1581
- public function create( $parent, Google_Service_MyBusiness_Location $postBody, $optParams = array() ) {
1582
- $params = array('parent' => $parent, 'postBody' => $postBody);
1583
- $params = array_merge( $params, $optParams );
1584
- return $this->call( 'create', array($params), 'Google_Service_MyBusiness_Location' );
1585
- }
1586
-
1587
- /**
1588
- * Deletes a location.
1589
- *
1590
- * Note: If this location cannot be deleted using the API as marked in the
1591
- * LocationState, use the [Google My
1592
- * Business](https://business.google.com/manage/) website.
1593
- *
1594
- * Returns `NOT_FOUND` if the location does not exist. (locations.delete)
1595
- *
1596
- * @param string $name The name of the location to delete.
1597
- * @param array $optParams Optional parameters.
1598
- * @return Google_Service_MyBusiness_MybusinessEmpty
1599
- */
1600
- public function delete( $name, $optParams = array() ) {
1601
- $params = array('name' => $name);
1602
- $params = array_merge( $params, $optParams );
1603
- return $this->call( 'delete', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
1604
- }
1605
-
1606
- /**
1607
- * Reports all eligible verification options for a location in a specific
1608
- * language. (locations.fetchVerificationOptions)
1609
- *
1610
- * @param string $name Resource name of the location to verify.
1611
- * @param Google_FetchVerificationOptionsRequest $postBody
1612
- * @param array $optParams Optional parameters.
1613
- * @return Google_Service_MyBusiness_FetchVerificationOptionsResponse
1614
- */
1615
- public function fetchVerificationOptions( $name, Google_Service_MyBusiness_FetchVerificationOptionsRequest $postBody, $optParams = array() ) {
1616
- $params = array('name' => $name, 'postBody' => $postBody);
1617
- $params = array_merge( $params, $optParams );
1618
- return $this->call( 'fetchVerificationOptions', array($params), 'Google_Service_MyBusiness_FetchVerificationOptionsResponse' );
1619
- }
1620
-
1621
- /**
1622
- * Finds all of the possible locations that are a match to the specified
1623
- * location. This operation is only valid if the location is unverified.
1624
- * (locations.findMatches)
1625
- *
1626
- * @param string $name The resource name of the location to find matches for.
1627
- * @param Google_FindMatchingLocationsRequest $postBody
1628
- * @param array $optParams Optional parameters.
1629
- * @return Google_Service_MyBusiness_FindMatchingLocationsResponse
1630
- */
1631
- public function findMatches( $name, Google_Service_MyBusiness_FindMatchingLocationsRequest $postBody, $optParams = array() ) {
1632
- $params = array('name' => $name, 'postBody' => $postBody);
1633
- $params = array_merge( $params, $optParams );
1634
- return $this->call( 'findMatches', array($params), 'Google_Service_MyBusiness_FindMatchingLocationsResponse' );
1635
- }
1636
-
1637
- /**
1638
- * Gets the specified location. Returns `NOT_FOUND` if the location does not
1639
- * exist. (locations.get)
1640
- *
1641
- * @param string $name The name of the location to fetch.
1642
- * @param array $optParams Optional parameters.
1643
- * @return Google_Service_MyBusiness_Location
1644
- */
1645
- public function get( $name, $optParams = array() ) {
1646
- $params = array('name' => $name);
1647
- $params = array_merge( $params, $optParams );
1648
- return $this->call( 'get', array($params), 'Google_Service_MyBusiness_Location' );
1649
- }
1650
-
1651
- /**
1652
- * Gets the Google-updated version of the specified location. Returns
1653
- * `NOT_FOUND` if the location does not exist. (locations.getGoogleUpdated)
1654
- *
1655
- * @param string $name The name of the location to fetch.
1656
- * @param array $optParams Optional parameters.
1657
- * @return Google_Service_MyBusiness_GoogleUpdatedLocation
1658
- */
1659
- public function getGoogleUpdated( $name, $optParams = array() ) {
1660
- $params = array('name' => $name);
1661
- $params = array_merge( $params, $optParams );
1662
- return $this->call( 'getGoogleUpdated', array($params), 'Google_Service_MyBusiness_GoogleUpdatedLocation' );
1663
- }
1664
-
1665
- /**
1666
- * Get the specified service list of a location. (locations.getServiceList)
1667
- *
1668
- * @param string $name Required. Google identifier for this location in the
1669
- * form: `accounts/{account_id}/locations/{location_id}/servicelist`
1670
- * @param array $optParams Optional parameters.
1671
- * @return Google_Service_MyBusiness_ServiceList
1672
- */
1673
- public function getServiceList( $name, $optParams = array() ) {
1674
- $params = array('name' => $name);
1675
- $params = array_merge( $params, $optParams );
1676
- return $this->call( 'getServiceList', array($params), 'Google_Service_MyBusiness_ServiceList' );
1677
- }
1678
-
1679
- /**
1680
- * Lists the locations for the specified account.
1681
- * (locations.listAccountsLocations)
1682
- *
1683
- * @param string $parent The name of the account to fetch locations from. If the
1684
- * Account is of AccountType PERSONAL, only Locations that are directly owned by
1685
- * the Account are returned, otherwise it will return all accessible locations
1686
- * from the Account, either directly or indirectly.
1687
- * @param array $optParams Optional parameters.
1688
- *
1689
- * @opt_param int pageSize How many locations to fetch per page. Default is 100,
1690
- * minimum is 1, and maximum page size is 100.
1691
- * @opt_param string pageToken If specified, it fetches the next `page` of
1692
- * locations. The page token is returned by previous calls to `ListLocations`
1693
- * when there were more locations than could fit in the requested page size.
1694
- * @opt_param string filter A filter constraining the locations to return. The
1695
- * response includes only entries that match the filter. If `filter` is empty,
1696
- * then constraints are applied and all locations (paginated) are retrieved for
1697
- * the requested account.
1698
- *
1699
- * For more information about valid fields and example usage, see [Work with
1700
- * Location Data Guide](https://developers.google.com/my-business/content
1701
- * /location-data#filter_results_when_you_list_locations).
1702
- * @opt_param string languageCode The BCP 47 code of language to get display
1703
- * location properties in. If this language is not available, they will be
1704
- * provided in the language of the location. If neither is available, they will
1705
- * be provided in English.
1706
- * @opt_param string orderBy Sorting order for the request. Multiple fields
1707
- * should be comma-separated, following SQL syntax. The default sorting order is
1708
- * ascending. To specify descending order, a suffix " desc" should be added.
1709
- * Valid fields to order_by are location_name and store_code. For example:
1710
- * "location_name, store_code desc" or "location_name" or "store_code desc"
1711
- * @return Google_Service_MyBusiness_ListLocationsResponse
1712
- */
1713
- public function listAccountsLocations( $parent, $optParams = array() ) {
1714
- $params = array('parent' => $parent);
1715
- $params = array_merge( $params, $optParams );
1716
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListLocationsResponse' );
1717
- }
1718
-
1719
- /**
1720
- * Updates the specified location.
1721
- *
1722
- * Photos are only allowed on a location that has a Google+ page.
1723
- *
1724
- * Returns `NOT_FOUND` if the location does not exist. (locations.patch)
1725
- *
1726
- * @param string $name The name of the location to update.
1727
- * @param Google_Location $postBody
1728
- * @param array $optParams Optional parameters.
1729
- *
1730
- * @opt_param string updateMask The specific fields to update. If no mask is
1731
- * specified, then this is treated as a full update and all fields are set to
1732
- * the values passed in, which may include unsetting empty fields in the
1733
- * request.
1734
- * @opt_param bool validateOnly If true, the request is validated without
1735
- * actually updating the location.
1736
- * @opt_param string attributeMask The IDs of the attributes to update. Only
1737
- * attributes noted in the mask will be updated. If an attribute is present in
1738
- * the mask and not in the location, it will be removed. An empty mask will
1739
- * update all attributes.
1740
- *
1741
- * Whenever this field is set, the update_mask should include attributes as one
1742
- * of the fields to update.
1743
- * @return Google_Service_MyBusiness_Location
1744
- */
1745
- public function patch( $name, Google_Service_MyBusiness_Location $postBody, $optParams = array() ) {
1746
- $params = array('name' => $name, 'postBody' => $postBody);
1747
- $params = array_merge( $params, $optParams );
1748
- return $this->call( 'patch', array($params), 'Google_Service_MyBusiness_Location' );
1749
- }
1750
-
1751
- /**
1752
- * Returns a report containing insights on one or more metrics by location.
1753
- *
1754
- * Note: Insight reports are limited to a batch size of 10 `location_names` per
1755
- * call. (locations.reportInsights)
1756
- *
1757
- * @param string $name The account resource name.
1758
- * @param Google_ReportLocationInsightsRequest $postBody
1759
- * @param array $optParams Optional parameters.
1760
- * @return Google_Service_MyBusiness_ReportLocationInsightsResponse
1761
- */
1762
- public function reportInsights( $name, Google_Service_MyBusiness_ReportLocationInsightsRequest $postBody, $optParams = array() ) {
1763
- $params = array('name' => $name, 'postBody' => $postBody);
1764
- $params = array_merge( $params, $optParams );
1765
- return $this->call( 'reportInsights', array($params), 'Google_Service_MyBusiness_ReportLocationInsightsResponse' );
1766
- }
1767
-
1768
- /**
1769
- * Moves a location from an account that the user owns to another account that
1770
- * the same user administers. The user must be an owner of the account the
1771
- * location is currently associated with and must also be at least a manager of
1772
- * the destination account. Returns the Location with its new resource name.
1773
- * (locations.transfer)
1774
- *
1775
- * @param string $name The name of the location to transfer.
1776
- * @param Google_TransferLocationRequest $postBody
1777
- * @param array $optParams Optional parameters.
1778
- * @return Google_Service_MyBusiness_Location
1779
- */
1780
- public function transfer( $name, Google_Service_MyBusiness_TransferLocationRequest $postBody, $optParams = array() ) {
1781
- $params = array('name' => $name, 'postBody' => $postBody);
1782
- $params = array_merge( $params, $optParams );
1783
- return $this->call( 'transfer', array($params), 'Google_Service_MyBusiness_Location' );
1784
- }
1785
-
1786
- /**
1787
- * Updates the specified service list of a location.
1788
- * (locations.updateServiceList)
1789
- *
1790
- * @param string $name Required. Google identifier for this location in the
1791
- * form: `accounts/{account_id}/locations/{location_id}/serviceList`
1792
- * @param Google_ServiceList $postBody
1793
- * @param array $optParams Optional parameters.
1794
- *
1795
- * @opt_param string updateMask Optional. The specific fields to update. If no
1796
- * mask is specified, then this is treated as a full update and all fields are
1797
- * set to the values passed in, which may include unsetting empty fields in the
1798
- * request. Repeated field items can not be individually updated.
1799
- * @return Google_Service_MyBusiness_ServiceList
1800
- */
1801
- public function updateServiceList( $name, Google_Service_MyBusiness_ServiceList $postBody, $optParams = array() ) {
1802
- $params = array('name' => $name, 'postBody' => $postBody);
1803
- $params = array_merge( $params, $optParams );
1804
- return $this->call( 'updateServiceList', array($params), 'Google_Service_MyBusiness_ServiceList' );
1805
- }
1806
-
1807
- /**
1808
- * Starts the verification process for a location. (locations.verify)
1809
- *
1810
- * @param string $name Resource name of the location to verify.
1811
- * @param Google_VerifyLocationRequest $postBody
1812
- * @param array $optParams Optional parameters.
1813
- * @return Google_Service_MyBusiness_VerifyLocationResponse
1814
- */
1815
- public function verify( $name, Google_Service_MyBusiness_VerifyLocationRequest $postBody, $optParams = array() ) {
1816
- $params = array('name' => $name, 'postBody' => $postBody);
1817
- $params = array_merge( $params, $optParams );
1818
- return $this->call( 'verify', array($params), 'Google_Service_MyBusiness_VerifyLocationResponse' );
1819
- }
1820
- }
1821
-
1822
- /**
1823
- * The "admins" collection of methods.
1824
- * Typical usage is:
1825
- * <code>
1826
- * $mybusinessService = new Google_Service_MyBusiness(...);
1827
- * $admins = $mybusinessService->admins;
1828
- * </code>
1829
- */
1830
- class Google_Service_MyBusiness_AccountsLocationsAdmins_Resource extends Google_Service_Resource {
1831
-
1832
-
1833
- /**
1834
- * Invites the specified user to become an administrator for the specified
1835
- * location. The invitee must accept the invitation in order to be granted
1836
- * access to the location. See AcceptInvitation to programmatically accept an
1837
- * invitation. (admins.create)
1838
- *
1839
- * @param string $parent The resource name of the location this admin is created
1840
- * for.
1841
- * @param Google_Admin $postBody
1842
- * @param array $optParams Optional parameters.
1843
- * @return Google_Service_MyBusiness_Admin
1844
- */
1845
- public function create( $parent, Google_Service_MyBusiness_Admin $postBody, $optParams = array() ) {
1846
- $params = array('parent' => $parent, 'postBody' => $postBody);
1847
- $params = array_merge( $params, $optParams );
1848
- return $this->call( 'create', array($params), 'Google_Service_MyBusiness_Admin' );
1849
- }
1850
-
1851
- /**
1852
- * Removes the specified admin as a manager of the specified location.
1853
- * (admins.delete)
1854
- *
1855
- * @param string $name The resource name of the admin to remove from the
1856
- * location.
1857
- * @param array $optParams Optional parameters.
1858
- * @return Google_Service_MyBusiness_MybusinessEmpty
1859
- */
1860
- public function delete( $name, $optParams = array() ) {
1861
- $params = array('name' => $name);
1862
- $params = array_merge( $params, $optParams );
1863
- return $this->call( 'delete', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
1864
- }
1865
-
1866
- /**
1867
- * Lists all of the admins for the specified location.
1868
- * (admins.listAccountsLocationsAdmins)
1869
- *
1870
- * @param string $parent The name of the location to list admins of.
1871
- * @param array $optParams Optional parameters.
1872
- * @return Google_Service_MyBusiness_ListLocationAdminsResponse
1873
- */
1874
- public function listAccountsLocationsAdmins( $parent, $optParams = array() ) {
1875
- $params = array('parent' => $parent);
1876
- $params = array_merge( $params, $optParams );
1877
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListLocationAdminsResponse' );
1878
- }
1879
-
1880
- /**
1881
- * Updates the Admin for the specified Location Admin. Only the AdminRole of the
1882
- * Admin can be updated. (admins.patch)
1883
- *
1884
- * @param string $name The resource name of the admin to update.
1885
- * @param Google_Admin $postBody
1886
- * @param array $optParams Optional parameters.
1887
- * @return Google_Service_MyBusiness_Admin
1888
- */
1889
- public function patch( $name, Google_Service_MyBusiness_Admin $postBody, $optParams = array() ) {
1890
- $params = array('name' => $name, 'postBody' => $postBody);
1891
- $params = array_merge( $params, $optParams );
1892
- return $this->call( 'patch', array($params), 'Google_Service_MyBusiness_Admin' );
1893
- }
1894
- }
1895
- /**
1896
- * The "followers" collection of methods.
1897
- * Typical usage is:
1898
- * <code>
1899
- * $mybusinessService = new Google_Service_MyBusiness(...);
1900
- * $followers = $mybusinessService->followers;
1901
- * </code>
1902
- */
1903
- class Google_Service_MyBusiness_AccountsLocationsFollowers_Resource extends Google_Service_Resource {
1904
-
1905
-
1906
- /**
1907
- * Get the followers settings for a location.
1908
- *
1909
- * NOT_FOUND is returned if either the account or the location doesn't exist.
1910
- * PRECONDITION_FAILED is returned if the location is not verified nor connected
1911
- * to Maps. (followers.getMetadata)
1912
- *
1913
- * @param string $name The resource name of the location's followers metadata.
1914
- * accounts/{account_id}/locations/{location_id}/followers/metadata
1915
- * @param array $optParams Optional parameters.
1916
- * @return Google_Service_MyBusiness_FollowersMetadata
1917
- */
1918
- public function getMetadata( $name, $optParams = array() ) {
1919
- $params = array('name' => $name);
1920
- $params = array_merge( $params, $optParams );
1921
- return $this->call( 'getMetadata', array($params), 'Google_Service_MyBusiness_FollowersMetadata' );
1922
- }
1923
- }
1924
- /**
1925
- * The "localPosts" collection of methods.
1926
- * Typical usage is:
1927
- * <code>
1928
- * $mybusinessService = new Google_Service_MyBusiness(...);
1929
- * $localPosts = $mybusinessService->localPosts;
1930
- * </code>
1931
- */
1932
- class Google_Service_MyBusiness_AccountsLocationsLocalPosts_Resource extends Google_Service_Resource {
1933
-
1934
-
1935
- /**
1936
- * Creates a new local post associated with the specified location, and returns
1937
- * it. (localPosts.create)
1938
- *
1939
- * @param string $parent The name of the location in which to create this local
1940
- * post.
1941
- * @param Google_LocalPost $postBody
1942
- * @param array $optParams Optional parameters.
1943
- * @return Google_Service_MyBusiness_LocalPost
1944
- */
1945
- public function create( $parent, Google_Service_MyBusiness_LocalPost $postBody, $optParams = array() ) {
1946
- $params = array('parent' => $parent, 'postBody' => $postBody);
1947
- $params = array_merge( $params, $optParams );
1948
- return $this->call( 'create', array($params), 'Google_Service_MyBusiness_LocalPost' );
1949
- }
1950
-
1951
- /**
1952
- * Deletes a local post. Returns `NOT_FOUND` if the local post does not exist.
1953
- * (localPosts.delete)
1954
- *
1955
- * @param string $name The name of the local post to delete.
1956
- * @param array $optParams Optional parameters.
1957
- * @return Google_Service_MyBusiness_MybusinessEmpty
1958
- */
1959
- public function delete( $name, $optParams = array() ) {
1960
- $params = array('name' => $name);
1961
- $params = array_merge( $params, $optParams );
1962
- return $this->call( 'delete', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
1963
- }
1964
-
1965
- /**
1966
- * Gets the specified local post. Returns `NOT_FOUND` if the local post does not
1967
- * exist. (localPosts.get)
1968
- *
1969
- * @param string $name The name of the local post to fetch.
1970
- * @param array $optParams Optional parameters.
1971
- * @return Google_Service_MyBusiness_LocalPost
1972
- */
1973
- public function get( $name, $optParams = array() ) {
1974
- $params = array('name' => $name);
1975
- $params = array_merge( $params, $optParams );
1976
- return $this->call( 'get', array($params), 'Google_Service_MyBusiness_LocalPost' );
1977
- }
1978
-
1979
- /**
1980
- * Returns a list of local posts associated with a location.
1981
- * (localPosts.listAccountsLocationsLocalPosts)
1982
- *
1983
- * @param string $parent The name of the location whose local posts will be
1984
- * listed.
1985
- * @param array $optParams Optional parameters.
1986
- *
1987
- * @opt_param int pageSize How many local posts to return per page. Default of
1988
- * 20. The minimum is 1, and maximum page size is 100.
1989
- * @opt_param string pageToken If specified, returns the next page of local
1990
- * posts.
1991
- * @return Google_Service_MyBusiness_ListLocalPostsResponse
1992
- */
1993
- public function listAccountsLocationsLocalPosts( $parent, $optParams = array() ) {
1994
- $params = array('parent' => $parent);
1995
- $params = array_merge( $params, $optParams );
1996
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListLocalPostsResponse' );
1997
- }
1998
-
1999
- /**
2000
- * Updates the specified local post and returns the updated local post.
2001
- * (localPosts.patch)
2002
- *
2003
- * @param string $name The name of the local post to update.
2004
- * @param Google_LocalPost $postBody
2005
- * @param array $optParams Optional parameters.
2006
- *
2007
- * @opt_param string updateMask The specific fields to update. You must specify
2008
- * each field that is being updated in the mask.
2009
- * @return Google_Service_MyBusiness_LocalPost
2010
- */
2011
- public function patch( $name, Google_Service_MyBusiness_LocalPost $postBody, $optParams = array() ) {
2012
- $params = array('name' => $name, 'postBody' => $postBody);
2013
- $params = array_merge( $params, $optParams );
2014
- return $this->call( 'patch', array($params), 'Google_Service_MyBusiness_LocalPost' );
2015
- }
2016
-
2017
- /**
2018
- * Returns insights for a set of local posts associated with a single listing.
2019
- * Which metrics and how they are reported are options specified in the request
2020
- * proto. Note: Insight reports are limited to 100 `local_post_names` per call.
2021
- * (localPosts.reportInsights)
2022
- *
2023
- * @param string $name Required. The name of the location for which to fetch
2024
- * insights.
2025
- * @param Google_ReportLocalPostInsightsRequest $postBody
2026
- * @param array $optParams Optional parameters.
2027
- * @return Google_Service_MyBusiness_ReportLocalPostInsightsResponse
2028
- */
2029
- public function reportInsights( $name, Google_Service_MyBusiness_ReportLocalPostInsightsRequest $postBody, $optParams = array() ) {
2030
- $params = array('name' => $name, 'postBody' => $postBody);
2031
- $params = array_merge( $params, $optParams );
2032
- return $this->call( 'reportInsights', array($params), 'Google_Service_MyBusiness_ReportLocalPostInsightsResponse' );
2033
- }
2034
- }
2035
- /**
2036
- * The "media" collection of methods.
2037
- * Typical usage is:
2038
- * <code>
2039
- * $mybusinessService = new Google_Service_MyBusiness(...);
2040
- * $media = $mybusinessService->media;
2041
- * </code>
2042
- */
2043
- class Google_Service_MyBusiness_AccountsLocationsMedia_Resource extends Google_Service_Resource {
2044
-
2045
-
2046
- /**
2047
- * Creates a new media item for the location. (media.create)
2048
- *
2049
- * @param string $parent The resource name of the location where this media item
2050
- * will be created.
2051
- * @param Google_MediaItem $postBody
2052
- * @param array $optParams Optional parameters.
2053
- * @return Google_Service_MyBusiness_MediaItem
2054
- */
2055
- public function create( $parent, Google_Service_MyBusiness_MediaItem $postBody, $optParams = array() ) {
2056
- $params = array('parent' => $parent, 'postBody' => $postBody);
2057
- $params = array_merge( $params, $optParams );
2058
- return $this->call( 'create', array($params), 'Google_Service_MyBusiness_MediaItem' );
2059
- }
2060
-
2061
- /**
2062
- * Deletes the specified media item. (media.delete)
2063
- *
2064
- * @param string $name The name of the media item to be deleted.
2065
- * @param array $optParams Optional parameters.
2066
- * @return Google_Service_MyBusiness_MybusinessEmpty
2067
- */
2068
- public function delete( $name, $optParams = array() ) {
2069
- $params = array('name' => $name);
2070
- $params = array_merge( $params, $optParams );
2071
- return $this->call( 'delete', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
2072
- }
2073
-
2074
- /**
2075
- * Returns metadata for the requested media item. (media.get)
2076
- *
2077
- * @param string $name The name of the requested media item.
2078
- * @param array $optParams Optional parameters.
2079
- * @return Google_Service_MyBusiness_MediaItem
2080
- */
2081
- public function get( $name, $optParams = array() ) {
2082
- $params = array('name' => $name);
2083
- $params = array_merge( $params, $optParams );
2084
- return $this->call( 'get', array($params), 'Google_Service_MyBusiness_MediaItem' );
2085
- }
2086
-
2087
- /**
2088
- * Returns a list of media items associated with a location.
2089
- * (media.listAccountsLocationsMedia)
2090
- *
2091
- * @param string $parent The name of the location whose media items will be
2092
- * listed.
2093
- * @param array $optParams Optional parameters.
2094
- *
2095
- * @opt_param int pageSize How many media items to return per page. The default
2096
- * value is 100, which is also the maximum supported number of media items able
2097
- * to be added to a location with the My Business API. Maximum page size is
2098
- * 2500.
2099
- * @opt_param string pageToken If specified, returns the next page of media
2100
- * items.
2101
- * @return Google_Service_MyBusiness_ListMediaItemsResponse
2102
- */
2103
- public function listAccountsLocationsMedia( $parent, $optParams = array() ) {
2104
- $params = array('parent' => $parent);
2105
- $params = array_merge( $params, $optParams );
2106
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListMediaItemsResponse' );
2107
- }
2108
-
2109
- /**
2110
- * Updates metadata of the specified media item. This can only be used to update
2111
- * the Category of a media item, with the exception that the new category cannot
2112
- * be COVER or PROFILE. (media.patch)
2113
- *
2114
- * @param string $name The name of the media item to be updated.
2115
- * @param Google_MediaItem $postBody
2116
- * @param array $optParams Optional parameters.
2117
- *
2118
- * @opt_param string updateMask The specific fields to update. If no mask is
2119
- * specified, then this is treated as a full update and all editable fields are
2120
- * set to the values passed in.
2121
- * @return Google_Service_MyBusiness_MediaItem
2122
- */
2123
- public function patch( $name, Google_Service_MyBusiness_MediaItem $postBody, $optParams = array() ) {
2124
- $params = array('name' => $name, 'postBody' => $postBody);
2125
- $params = array_merge( $params, $optParams );
2126
- return $this->call( 'patch', array($params), 'Google_Service_MyBusiness_MediaItem' );
2127
- }
2128
-
2129
- /**
2130
- * Generates a `MediaItemDataRef` for media item uploading. (media.startUpload)
2131
- *
2132
- * @param string $parent The resource name of the location this media item is to
2133
- * be added to.
2134
- * @param Google_StartUploadMediaItemDataRequest $postBody
2135
- * @param array $optParams Optional parameters.
2136
- * @return Google_Service_MyBusiness_MediaItemDataRef
2137
- */
2138
- public function startUpload( $parent, Google_Service_MyBusiness_StartUploadMediaItemDataRequest $postBody, $optParams = array() ) {
2139
- $params = array('parent' => $parent, 'postBody' => $postBody);
2140
- $params = array_merge( $params, $optParams );
2141
- return $this->call( 'startUpload', array($params), 'Google_Service_MyBusiness_MediaItemDataRef' );
2142
- }
2143
- }
2144
-
2145
- /**
2146
- * The "customers" collection of methods.
2147
- * Typical usage is:
2148
- * <code>
2149
- * $mybusinessService = new Google_Service_MyBusiness(...);
2150
- * $customers = $mybusinessService->customers;
2151
- * </code>
2152
- */
2153
- class Google_Service_MyBusiness_AccountsLocationsMediaCustomers_Resource extends Google_Service_Resource {
2154
-
2155
-
2156
- /**
2157
- * Returns metadata for the requested customer media item. (customers.get)
2158
- *
2159
- * @param string $name The resource name of the requested customer media item.
2160
- * @param array $optParams Optional parameters.
2161
- * @return Google_Service_MyBusiness_MediaItem
2162
- */
2163
- public function get( $name, $optParams = array() ) {
2164
- $params = array('name' => $name);
2165
- $params = array_merge( $params, $optParams );
2166
- return $this->call( 'get', array($params), 'Google_Service_MyBusiness_MediaItem' );
2167
- }
2168
-
2169
- /**
2170
- * Returns a list of media items associated with a location that have been
2171
- * contributed by customers. (customers.listAccountsLocationsMediaCustomers)
2172
- *
2173
- * @param string $parent The name of the location whose customer media items
2174
- * will be listed.
2175
- * @param array $optParams Optional parameters.
2176
- *
2177
- * @opt_param int pageSize How many media items to return per page. The default
2178
- * value is 100, the maximum supported page size is 200.
2179
- * @opt_param string pageToken If specified, returns the next page of media
2180
- * items.
2181
- * @return Google_Service_MyBusiness_ListCustomerMediaItemsResponse
2182
- */
2183
- public function listAccountsLocationsMediaCustomers( $parent, $optParams = array() ) {
2184
- $params = array('parent' => $parent);
2185
- $params = array_merge( $params, $optParams );
2186
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListCustomerMediaItemsResponse' );
2187
- }
2188
- }
2189
- /**
2190
- * The "questions" collection of methods.
2191
- * Typical usage is:
2192
- * <code>
2193
- * $mybusinessService = new Google_Service_MyBusiness(...);
2194
- * $questions = $mybusinessService->questions;
2195
- * </code>
2196
- */
2197
- class Google_Service_MyBusiness_AccountsLocationsQuestions_Resource extends Google_Service_Resource {
2198
-
2199
-
2200
- /**
2201
- * Adds a question for the specified location. (questions.create)
2202
- *
2203
- * @param string $parent The name of the location to write a question for.
2204
- * @param Google_Question $postBody
2205
- * @param array $optParams Optional parameters.
2206
- * @return Google_Service_MyBusiness_Question
2207
- */
2208
- public function create( $parent, Google_Service_MyBusiness_Question $postBody, $optParams = array() ) {
2209
- $params = array('parent' => $parent, 'postBody' => $postBody);
2210
- $params = array_merge( $params, $optParams );
2211
- return $this->call( 'create', array($params), 'Google_Service_MyBusiness_Question' );
2212
- }
2213
-
2214
- /**
2215
- * Deletes a specific question written by the current user. (questions.delete)
2216
- *
2217
- * @param string $name The name of the question to delete.
2218
- * @param array $optParams Optional parameters.
2219
- * @return Google_Service_MyBusiness_MybusinessEmpty
2220
- */
2221
- public function delete( $name, $optParams = array() ) {
2222
- $params = array('name' => $name);
2223
- $params = array_merge( $params, $optParams );
2224
- return $this->call( 'delete', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
2225
- }
2226
-
2227
- /**
2228
- * Returns the paginated list of questions and some of its answers for a
2229
- * specified location. (questions.listAccountsLocationsQuestions)
2230
- *
2231
- * @param string $parent The name of the location to fetch questions for.
2232
- * @param array $optParams Optional parameters.
2233
- *
2234
- * @opt_param int pageSize How many questions to fetch per page. The default and
2235
- * maximum `page_size` values are 10.
2236
- * @opt_param string pageToken If specified, the next page of questions is
2237
- * retrieved.
2238
- * @opt_param int answersPerQuestion How many answers to fetch per question. The
2239
- * default and maximum `answers_per_question` values are 10.
2240
- * @opt_param string filter A filter constraining the questions to return. The
2241
- * only filter currently supported is "ignore_answered=true"
2242
- * @opt_param string orderBy The order to return the questions. Valid options
2243
- * include 'update_time desc' and 'upvote_count desc', which will return the
2244
- * questions sorted descendingly by the requested field. The default sort order
2245
- * is 'update_time desc'.
2246
- * @return Google_Service_MyBusiness_ListQuestionsResponse
2247
- */
2248
- public function listAccountsLocationsQuestions( $parent, $optParams = array() ) {
2249
- $params = array('parent' => $parent);
2250
- $params = array_merge( $params, $optParams );
2251
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListQuestionsResponse' );
2252
- }
2253
-
2254
- /**
2255
- * Updates a specific question written by the current user. (questions.patch)
2256
- *
2257
- * @param string $name The name of the question to update.
2258
- * @param Google_Question $postBody
2259
- * @param array $optParams Optional parameters.
2260
- * @return Google_Service_MyBusiness_Question
2261
- */
2262
- public function patch( $name, Google_Service_MyBusiness_Question $postBody, $optParams = array() ) {
2263
- $params = array('name' => $name, 'postBody' => $postBody);
2264
- $params = array_merge( $params, $optParams );
2265
- return $this->call( 'patch', array($params), 'Google_Service_MyBusiness_Question' );
2266
- }
2267
- }
2268
-
2269
- /**
2270
- * The "answers" collection of methods.
2271
- * Typical usage is:
2272
- * <code>
2273
- * $mybusinessService = new Google_Service_MyBusiness(...);
2274
- * $answers = $mybusinessService->answers;
2275
- * </code>
2276
- */
2277
- class Google_Service_MyBusiness_AccountsLocationsQuestionsAnswers_Resource extends Google_Service_Resource {
2278
-
2279
-
2280
- /**
2281
- * Deletes the answer written by the current user to a question.
2282
- * (answers.delete)
2283
- *
2284
- * @param string $parent The name of the question to delete an answer for.
2285
- * @param array $optParams Optional parameters.
2286
- * @return Google_Service_MyBusiness_MybusinessEmpty
2287
- */
2288
- public function delete( $parent, $optParams = array() ) {
2289
- $params = array('parent' => $parent);
2290
- $params = array_merge( $params, $optParams );
2291
- return $this->call( 'delete', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
2292
- }
2293
-
2294
- /**
2295
- * Returns the paginated list of answers for a specified question.
2296
- * (answers.listAccountsLocationsQuestionsAnswers)
2297
- *
2298
- * @param string $parent The name of the question to fetch answers for.
2299
- * @param array $optParams Optional parameters.
2300
- *
2301
- * @opt_param int pageSize How many answers to fetch per page. The default and
2302
- * maximum `page_size` values are 10.
2303
- * @opt_param string pageToken If specified, the next page of answers is
2304
- * retrieved.
2305
- * @opt_param string orderBy The order to return the answers. Valid options
2306
- * include 'update_time desc' and 'upvote_count desc', which will return the
2307
- * answers sorted descendingly by the requested field. The default sort order is
2308
- * 'update_time desc'.
2309
- * @return Google_Service_MyBusiness_ListAnswersResponse
2310
- */
2311
- public function listAccountsLocationsQuestionsAnswers( $parent, $optParams = array() ) {
2312
- $params = array('parent' => $parent);
2313
- $params = array_merge( $params, $optParams );
2314
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListAnswersResponse' );
2315
- }
2316
-
2317
- /**
2318
- * Creates an answer or updates the existing answer written by the user for the
2319
- * specified question. A user can only create one answer per question.
2320
- * (answers.upsert)
2321
- *
2322
- * @param string $parent The name of the question to write an answer for.
2323
- * @param Google_UpsertAnswerRequest $postBody
2324
- * @param array $optParams Optional parameters.
2325
- * @return Google_Service_MyBusiness_Answer
2326
- */
2327
- public function upsert( $parent, Google_Service_MyBusiness_UpsertAnswerRequest $postBody, $optParams = array() ) {
2328
- $params = array('parent' => $parent, 'postBody' => $postBody);
2329
- $params = array_merge( $params, $optParams );
2330
- return $this->call( 'upsert', array($params), 'Google_Service_MyBusiness_Answer' );
2331
- }
2332
- }
2333
- /**
2334
- * The "reviews" collection of methods.
2335
- * Typical usage is:
2336
- * <code>
2337
- * $mybusinessService = new Google_Service_MyBusiness(...);
2338
- * $reviews = $mybusinessService->reviews;
2339
- * </code>
2340
- */
2341
- class Google_Service_MyBusiness_AccountsLocationsReviews_Resource extends Google_Service_Resource {
2342
-
2343
-
2344
- /**
2345
- * Deletes the response to the specified review. This operation is only valid if
2346
- * the specified location is verified. (reviews.deleteReply)
2347
- *
2348
- * @param string $name The name of the review reply to delete.
2349
- * @param array $optParams Optional parameters.
2350
- * @return Google_Service_MyBusiness_MybusinessEmpty
2351
- */
2352
- public function deleteReply( $name, $optParams = array() ) {
2353
- $params = array('name' => $name);
2354
- $params = array_merge( $params, $optParams );
2355
- return $this->call( 'deleteReply', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
2356
- }
2357
-
2358
- /**
2359
- * Returns the specified review. This operation is only valid if the specified
2360
- * location is verified. Returns `NOT_FOUND` if the review does not exist, or
2361
- * has been deleted. (reviews.get)
2362
- *
2363
- * @param string $name The name of the review to fetch.
2364
- * @param array $optParams Optional parameters.
2365
- * @return Google_Service_MyBusiness_Review
2366
- */
2367
- public function get( $name, $optParams = array() ) {
2368
- $params = array('name' => $name);
2369
- $params = array_merge( $params, $optParams );
2370
- return $this->call( 'get', array($params), 'Google_Service_MyBusiness_Review' );
2371
- }
2372
-
2373
- /**
2374
- * Returns the paginated list of reviews for the specified location. This
2375
- * operation is only valid if the specified location is verified.
2376
- * (reviews.listAccountsLocationsReviews)
2377
- *
2378
- * @param string $parent The name of the location to fetch reviews for.
2379
- * @param array $optParams Optional parameters.
2380
- *
2381
- * @opt_param int pageSize How many reviews to fetch per page. The maximum
2382
- * `page_size` is 200.
2383
- * @opt_param string pageToken If specified, it fetches the next page of
2384
- * reviews.
2385
- * @opt_param string orderBy Specifies the field to sort reviews by. If
2386
- * unspecified, the order of reviews returned will default to `update_time
2387
- * desc`. Valid orders to sort by are `rating`, `rating desc` and `update_time
2388
- * desc`.
2389
- * @return Google_Service_MyBusiness_ListReviewsResponse
2390
- */
2391
- public function listAccountsLocationsReviews( $parent, $optParams = array() ) {
2392
- $params = array('parent' => $parent);
2393
- $params = array_merge( $params, $optParams );
2394
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListReviewsResponse' );
2395
- }
2396
-
2397
- /**
2398
- * Updates the reply to the specified review. A reply is created if one does not
2399
- * exist. This operation is only valid if the specified location is verified.
2400
- * (reviews.updateReply)
2401
- *
2402
- * @param string $name The name of the review to respond to.
2403
- * @param Google_ReviewReply $postBody
2404
- * @param array $optParams Optional parameters.
2405
- * @return Google_Service_MyBusiness_ReviewReply
2406
- */
2407
- public function updateReply( $name, Google_Service_MyBusiness_ReviewReply $postBody, $optParams = array() ) {
2408
- $params = array('name' => $name, 'postBody' => $postBody);
2409
- $params = array_merge( $params, $optParams );
2410
- return $this->call( 'updateReply', array($params), 'Google_Service_MyBusiness_ReviewReply' );
2411
- }
2412
- }
2413
- /**
2414
- * The "verifications" collection of methods.
2415
- * Typical usage is:
2416
- * <code>
2417
- * $mybusinessService = new Google_Service_MyBusiness(...);
2418
- * $verifications = $mybusinessService->verifications;
2419
- * </code>
2420
- */
2421
- class Google_Service_MyBusiness_AccountsLocationsVerifications_Resource extends Google_Service_Resource {
2422
-
2423
-
2424
- /**
2425
- * Completes a `PENDING` verification.
2426
- *
2427
- * It is only necessary for non `AUTO` verification methods. `AUTO` verification
2428
- * request is instantly `VERIFIED` upon creation. (verifications.complete)
2429
- *
2430
- * @param string $name Resource name of the verification to complete.
2431
- * @param Google_CompleteVerificationRequest $postBody
2432
- * @param array $optParams Optional parameters.
2433
- * @return Google_Service_MyBusiness_CompleteVerificationResponse
2434
- */
2435
- public function complete( $name, Google_Service_MyBusiness_CompleteVerificationRequest $postBody, $optParams = array() ) {
2436
- $params = array('name' => $name, 'postBody' => $postBody);
2437
- $params = array_merge( $params, $optParams );
2438
- return $this->call( 'complete', array($params), 'Google_Service_MyBusiness_CompleteVerificationResponse' );
2439
- }
2440
-
2441
- /**
2442
- * List verifications of a location, ordered by create time.
2443
- * (verifications.listAccountsLocationsVerifications)
2444
- *
2445
- * @param string $parent Resource name of the location that verification
2446
- * requests belong to.
2447
- * @param array $optParams Optional parameters.
2448
- *
2449
- * @opt_param int pageSize How many verification to include per page. If not
2450
- * set, return all.
2451
- * @opt_param string pageToken If specified, returns the next page of
2452
- * verifications.
2453
- * @return Google_Service_MyBusiness_ListVerificationsResponse
2454
- */
2455
- public function listAccountsLocationsVerifications( $parent, $optParams = array() ) {
2456
- $params = array('parent' => $parent);
2457
- $params = array_merge( $params, $optParams );
2458
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListVerificationsResponse' );
2459
- }
2460
- }
2461
-
2462
- /**
2463
- * The "attributes" collection of methods.
2464
- * Typical usage is:
2465
- * <code>
2466
- * $mybusinessService = new Google_Service_MyBusiness(...);
2467
- * $attributes = $mybusinessService->attributes;
2468
- * </code>
2469
- */
2470
- class Google_Service_MyBusiness_Attributes_Resource extends Google_Service_Resource {
2471
-
2472
-
2473
- /**
2474
- * Returns the list of available attributes that would be available for a
2475
- * location with the given primary category and country.
2476
- * (attributes.listAttributes)
2477
- *
2478
- * @param array $optParams Optional parameters.
2479
- *
2480
- * @opt_param string name Resource name of the location to look up available
2481
- * attributes.
2482
- * @opt_param string categoryId The primary category stable ID to find available
2483
- * attributes.
2484
- * @opt_param string country The ISO 3166-1 alpha-2 country code to find
2485
- * available attributes.
2486
- * @opt_param string languageCode The BCP 47 code of language to get attribute
2487
- * display names in. If this language is not available, they will be provided in
2488
- * English.
2489
- * @opt_param int pageSize How many attributes to include per page. Default is
2490
- * 200, minimum is 1.
2491
- * @opt_param string pageToken If specified, the next page of attribute metadata
2492
- * is retrieved. The `pageToken` is returned when a call to `attributes.list`
2493
- * returns more results than can fit into the requested page size.
2494
- * @return Google_Service_MyBusiness_ListAttributeMetadataResponse
2495
- */
2496
- public function listAttributes( $optParams = array() ) {
2497
- $params = array();
2498
- $params = array_merge( $params, $optParams );
2499
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListAttributeMetadataResponse' );
2500
- }
2501
- }
2502
-
2503
- /**
2504
- * The "categories" collection of methods.
2505
- * Typical usage is:
2506
- * <code>
2507
- * $mybusinessService = new Google_Service_MyBusiness(...);
2508
- * $categories = $mybusinessService->categories;
2509
- * </code>
2510
- */
2511
- class Google_Service_MyBusiness_Categories_Resource extends Google_Service_Resource {
2512
-
2513
-
2514
- /**
2515
- * Returns a list of business categories for the provided language and GConcept
2516
- * ids. (categories.batchGet)
2517
- *
2518
- * @param array $optParams Optional parameters.
2519
- *
2520
- * @opt_param string languageCode Required. The BCP 47 code of language that the
2521
- * category names should be returned in.
2522
- * @opt_param string categoryIds Required. At least one name must be set. The
2523
- * GConcept ids the localized category names should be returned for.
2524
- * @opt_param string regionCode Optional. The ISO 3166-1 alpha-2 country code
2525
- * used to infer non-standard language.
2526
- * @opt_param string view Required. Specifies which parts to the Category
2527
- * resource should be returned in the response.
2528
- * @return Google_Service_MyBusiness_BatchGetBusinessCategoriesResponse
2529
- */
2530
- public function batchGet( $optParams = array() ) {
2531
- $params = array();
2532
- $params = array_merge( $params, $optParams );
2533
- return $this->call( 'batchGet', array($params), 'Google_Service_MyBusiness_BatchGetBusinessCategoriesResponse' );
2534
- }
2535
-
2536
- /**
2537
- * Returns a list of business categories. Search will match the category name
2538
- * but not the category ID.
2539
- *
2540
- * Note: Search only matches the front of a category name (that is, 'food' may
2541
- * return 'Food Court' but not 'Fast Food Restaurant').
2542
- * (categories.listCategories)
2543
- *
2544
- * @param array $optParams Optional parameters.
2545
- *
2546
- * @opt_param string regionCode The ISO 3166-1 alpha-2 country code.
2547
- * @opt_param string languageCode The BCP 47 code of language. If the language
2548
- * is not available, it will default to English.
2549
- * @opt_param string searchTerm Optional filter string from user.
2550
- * @opt_param int pageSize How many categories to fetch per page. Default is
2551
- * 100, minimum is 1, and maximum page size is 100.
2552
- * @opt_param string pageToken If specified, the next page of categories will be
2553
- * fetched.
2554
- * @opt_param string view Optional. Specifies which parts to the Category
2555
- * resource should be returned in the response.
2556
- * @return Google_Service_MyBusiness_ListBusinessCategoriesResponse
2557
- */
2558
- public function listCategories( $optParams = array() ) {
2559
- $params = array();
2560
- $params = array_merge( $params, $optParams );
2561
- return $this->call( 'list', array($params), 'Google_Service_MyBusiness_ListBusinessCategoriesResponse' );
2562
- }
2563
- }
2564
-
2565
- /**
2566
- * The "chains" collection of methods.
2567
- * Typical usage is:
2568
- * <code>
2569
- * $mybusinessService = new Google_Service_MyBusiness(...);
2570
- * $chains = $mybusinessService->chains;
2571
- * </code>
2572
- */
2573
- class Google_Service_MyBusiness_Chains_Resource extends Google_Service_Resource {
2574
-
2575
-
2576
- /**
2577
- * Gets the specified chain. Returns `NOT_FOUND` if the chain does not exist.
2578
- * (chains.get)
2579
- *
2580
- * @param string $name The chain's resource name, in the format
2581
- * `chains/{chain_place_id}`.
2582
- * @param array $optParams Optional parameters.
2583
- * @return Google_Service_MyBusiness_Chain
2584
- */
2585
- public function get( $name, $optParams = array() ) {
2586
- $params = array('name' => $name);
2587
- $params = array_merge( $params, $optParams );
2588
- return $this->call( 'get', array($params), 'Google_Service_MyBusiness_Chain' );
2589
- }
2590
-
2591
- /**
2592
- * Searches the chain based on chain name. (chains.search)
2593
- *
2594
- * @param array $optParams Optional parameters.
2595
- *
2596
- * @opt_param string chainDisplayName Search for a chain by its name.
2597
- * Exact/partial/fuzzy/related queries are supported. Examples: "walmart", "wal-
2598
- * mart", "walmmmart", "沃尔玛"
2599
- * @opt_param int resultCount The maximum number of matched chains to return
2600
- * from this query. The default is 10. The maximum possible value is 500.
2601
- * @return Google_Service_MyBusiness_SearchChainsResponse
2602
- */
2603
- public function search( $optParams = array() ) {
2604
- $params = array();
2605
- $params = array_merge( $params, $optParams );
2606
- return $this->call( 'search', array($params), 'Google_Service_MyBusiness_SearchChainsResponse' );
2607
- }
2608
- }
2609
-
2610
- /**
2611
- * The "googleLocations" collection of methods.
2612
- * Typical usage is:
2613
- * <code>
2614
- * $mybusinessService = new Google_Service_MyBusiness(...);
2615
- * $googleLocations = $mybusinessService->googleLocations;
2616
- * </code>
2617
- */
2618
- class Google_Service_MyBusiness_GoogleLocations_Resource extends Google_Service_Resource {
2619
-
2620
-
2621
- /**
2622
- * Report a GoogleLocation. (googleLocations.report)
2623
- *
2624
- * @param string $name Resource name of a [GoogleLocation], in the format
2625
- * `googleLocations/{googleLocationId}`.
2626
- * @param Google_ReportGoogleLocationRequest $postBody
2627
- * @param array $optParams Optional parameters.
2628
- * @return Google_Service_MyBusiness_MybusinessEmpty
2629
- */
2630
- public function report( $name, Google_Service_MyBusiness_ReportGoogleLocationRequest $postBody, $optParams = array() ) {
2631
- $params = array('name' => $name, 'postBody' => $postBody);
2632
- $params = array_merge( $params, $optParams );
2633
- return $this->call( 'report', array($params), 'Google_Service_MyBusiness_MybusinessEmpty' );
2634
- }
2635
-
2636
- /**
2637
- * Search all of the possible locations that are a match to the specified
2638
- * request. (googleLocations.search)
2639
- *
2640
- * @param Google_SearchGoogleLocationsRequest $postBody
2641
- * @param array $optParams Optional parameters.
2642
- * @return Google_Service_MyBusiness_SearchGoogleLocationsResponse
2643
- */
2644
- public function search( Google_Service_MyBusiness_SearchGoogleLocationsRequest $postBody, $optParams = array() ) {
2645
- $params = array('postBody' => $postBody);
2646
- $params = array_merge( $params, $optParams );
2647
- return $this->call( 'search', array($params), 'Google_Service_MyBusiness_SearchGoogleLocationsResponse' );
2648
- }
2649
- }
2650
-
2651
-
2652
-
2653
-
2654
- class Google_Service_MyBusiness_AcceptInvitationRequest extends Google_Model {
2655
-
2656
- }
2657
-
2658
- class Google_Service_MyBusiness_Account extends Google_Model {
2659
-
2660
- protected $internal_gapi_mappings = array(
2661
- );
2662
- public $accountName;
2663
- public $accountNumber;
2664
- public $name;
2665
- protected $organizationInfoType = 'Google_Service_MyBusiness_OrganizationInfo';
2666
- protected $organizationInfoDataType = '';
2667
- public $permissionLevel;
2668
- public $role;
2669
- protected $stateType = 'Google_Service_MyBusiness_AccountState';
2670
- protected $stateDataType = '';
2671
- public $type;
2672
-
2673
-
2674
- public function setAccountName( $accountName ) {
2675
- $this->accountName = $accountName;
2676
- }
2677
- public function getAccountName() {
2678
- return $this->accountName;
2679
- }
2680
- public function setAccountNumber( $accountNumber ) {
2681
- $this->accountNumber = $accountNumber;
2682
- }
2683
- public function getAccountNumber() {
2684
- return $this->accountNumber;
2685
- }
2686
- public function setName( $name ) {
2687
- $this->name = $name;
2688
- }
2689
- public function getName() {
2690
- return $this->name;
2691
- }
2692
- public function setOrganizationInfo( Google_Service_MyBusiness_OrganizationInfo $organizationInfo ) {
2693
- $this->organizationInfo = $organizationInfo;
2694
- }
2695
- public function getOrganizationInfo() {
2696
- return $this->organizationInfo;
2697
- }
2698
- public function setPermissionLevel( $permissionLevel ) {
2699
- $this->permissionLevel = $permissionLevel;
2700
- }
2701
- public function getPermissionLevel() {
2702
- return $this->permissionLevel;
2703
- }
2704
- public function setRole( $role ) {
2705
- $this->role = $role;
2706
- }
2707
- public function getRole() {
2708
- return $this->role;
2709
- }
2710
- public function setState( Google_Service_MyBusiness_AccountState $state ) {
2711
- $this->state = $state;
2712
- }
2713
- public function getState() {
2714
- return $this->state;
2715
- }
2716
- public function setType( $type ) {
2717
- $this->type = $type;
2718
- }
2719
- public function getType() {
2720
- return $this->type;
2721
- }
2722
- }
2723
-
2724
- class Google_Service_MyBusiness_AccountState extends Google_Model {
2725
-
2726
- protected $internal_gapi_mappings = array(
2727
- );
2728
- public $status;
2729
-
2730
-
2731
- public function setStatus( $status ) {
2732
- $this->status = $status;
2733
- }
2734
- public function getStatus() {
2735
- return $this->status;
2736
- }
2737
- }
2738
-
2739
- class Google_Service_MyBusiness_AdWordsLocationExtensions extends Google_Model {
2740
-
2741
- protected $internal_gapi_mappings = array(
2742
- );
2743
- public $adPhone;
2744
-
2745
-
2746
- public function setAdPhone( $adPhone ) {
2747
- $this->adPhone = $adPhone;
2748
- }
2749
- public function getAdPhone() {
2750
- return $this->adPhone;
2751
- }
2752
- }
2753
-
2754
- class Google_Service_MyBusiness_AddressInput extends Google_Model {
2755
-
2756
- protected $internal_gapi_mappings = array(
2757
- );
2758
- public $mailerContactName;
2759
-
2760
-
2761
- public function setMailerContactName( $mailerContactName ) {
2762
- $this->mailerContactName = $mailerContactName;
2763
- }
2764
- public function getMailerContactName() {
2765
- return $this->mailerContactName;
2766
- }
2767
- }
2768
-
2769
- class Google_Service_MyBusiness_AddressVerificationData extends Google_Model {
2770
-
2771
- protected $internal_gapi_mappings = array(
2772
- );
2773
- protected $addressType = 'Google_Service_MyBusiness_PostalAddress';
2774
- protected $addressDataType = '';
2775
- public $businessName;
2776
-
2777
-
2778
- public function setAddress( Google_Service_MyBusiness_PostalAddress $address ) {
2779
- $this->address = $address;
2780
- }
2781
- public function getAddress() {
2782
- return $this->address;
2783
- }
2784
- public function setBusinessName( $businessName ) {
2785
- $this->businessName = $businessName;
2786
- }
2787
- public function getBusinessName() {
2788
- return $this->businessName;
2789
- }
2790
- }
2791
-
2792
- class Google_Service_MyBusiness_Admin extends Google_Model {
2793
-
2794
- protected $internal_gapi_mappings = array(
2795
- );
2796
- public $adminName;
2797
- public $name;
2798
- public $pendingInvitation;
2799
- public $role;
2800
-
2801
-
2802
- public function setAdminName( $adminName ) {
2803
- $this->adminName = $adminName;
2804
- }
2805
- public function getAdminName() {
2806
- return $this->adminName;
2807
- }
2808
- public function setName( $name ) {
2809
- $this->name = $name;
2810
- }
2811
- public function getName() {
2812
- return $this->name;
2813
- }
2814
- public function setPendingInvitation( $pendingInvitation ) {
2815
- $this->pendingInvitation = $pendingInvitation;
2816
- }
2817
- public function getPendingInvitation() {
2818
- return $this->pendingInvitation;
2819
- }
2820
- public function setRole( $role ) {
2821
- $this->role = $role;
2822
- }
2823
- public function getRole() {
2824
- return $this->role;
2825
- }
2826
- }
2827
-
2828
- class Google_Service_MyBusiness_Answer extends Google_Model {
2829
-
2830
- protected $internal_gapi_mappings = array(
2831
- );
2832
- protected $authorType = 'Google_Service_MyBusiness_Author';
2833
- protected $authorDataType = '';
2834
- public $createTime;
2835
- public $name;
2836
- public $text;
2837
- public $updateTime;
2838
- public $upvoteCount;
2839
-
2840
-
2841
- public function setAuthor( Google_Service_MyBusiness_Author $author ) {
2842
- $this->author = $author;
2843
- }
2844
- public function getAuthor() {
2845
- return $this->author;
2846
- }
2847
- public function setCreateTime( $createTime ) {
2848
- $this->createTime = $createTime;
2849
- }
2850
- public function getCreateTime() {
2851
- return $this->createTime;
2852
- }
2853
- public function setName( $name ) {
2854
- $this->name = $name;
2855
- }
2856
- public function getName() {
2857
- return $this->name;
2858
- }
2859
- public function setText( $text ) {
2860
- $this->text = $text;
2861
- }
2862
- public function getText() {
2863
- return $this->text;
2864
- }
2865
- public function setUpdateTime( $updateTime ) {
2866
- $this->updateTime = $updateTime;
2867
- }
2868
- public function getUpdateTime() {
2869
- return $this->updateTime;
2870
- }
2871
- public function setUpvoteCount( $upvoteCount ) {
2872
- $this->upvoteCount = $upvoteCount;
2873
- }
2874
- public function getUpvoteCount() {
2875
- return $this->upvoteCount;
2876
- }
2877
- }
2878
-
2879
- class Google_Service_MyBusiness_AssociateLocationRequest extends Google_Model {
2880
-
2881
- protected $internal_gapi_mappings = array(
2882
- );
2883
- public $placeId;
2884
-
2885
-
2886
- public function setPlaceId( $placeId ) {
2887
- $this->placeId = $placeId;
2888
- }
2889
- public function getPlaceId() {
2890
- return $this->placeId;
2891
- }
2892
- }
2893
-
2894
- class Google_Service_MyBusiness_Attribute extends Google_Collection {
2895
-
2896
- protected $collection_key = 'values';
2897
- protected $internal_gapi_mappings = array(
2898
- );
2899
- public $attributeId;
2900
- protected $repeatedEnumValueType = 'Google_Service_MyBusiness_RepeatedEnumAttributeValue';
2901
- protected $repeatedEnumValueDataType = '';
2902
- protected $urlValuesType = 'Google_Service_MyBusiness_UrlAttributeValue';
2903
- protected $urlValuesDataType = 'array';
2904
- public $valueType;
2905
- public $values;
2906
-
2907
-
2908
- public function setAttributeId( $attributeId ) {
2909
- $this->attributeId = $attributeId;
2910
- }
2911
- public function getAttributeId() {
2912
- return $this->attributeId;
2913
- }
2914
- public function setRepeatedEnumValue( Google_Service_MyBusiness_RepeatedEnumAttributeValue $repeatedEnumValue ) {
2915
- $this->repeatedEnumValue = $repeatedEnumValue;
2916
- }
2917
- public function getRepeatedEnumValue() {
2918
- return $this->repeatedEnumValue;
2919
- }
2920
- public function setUrlValues( $urlValues ) {
2921
- $this->urlValues = $urlValues;
2922
- }
2923
- public function getUrlValues() {
2924
- return $this->urlValues;
2925
- }
2926
- public function setValueType( $valueType ) {
2927
- $this->valueType = $valueType;
2928
- }
2929
- public function getValueType() {
2930
- return $this->valueType;
2931
- }
2932
- public function setValues( $values ) {
2933
- $this->values = $values;
2934
- }
2935
- public function getValues() {
2936
- return $this->values;
2937
- }
2938
- }
2939
-
2940
- class Google_Service_MyBusiness_AttributeMetadata extends Google_Collection {
2941
-
2942
- protected $collection_key = 'valueMetadata';
2943
- protected $internal_gapi_mappings = array(
2944
- );
2945
- public $attributeId;
2946
- public $displayName;
2947
- public $groupDisplayName;
2948
- public $isDeprecated;
2949
- public $isRepeatable;
2950
- protected $valueMetadataType = 'Google_Service_MyBusiness_AttributeValueMetadata';
2951
- protected $valueMetadataDataType = 'array';
2952
- public $valueType;
2953
-
2954
-
2955
- public function setAttributeId( $attributeId ) {
2956
- $this->attributeId = $attributeId;
2957
- }
2958
- public function getAttributeId() {
2959
- return $this->attributeId;
2960
- }
2961
- public function setDisplayName( $displayName ) {
2962
- $this->displayName = $displayName;
2963
- }
2964
- public function getDisplayName() {
2965
- return $this->displayName;
2966
- }
2967
- public function setGroupDisplayName( $groupDisplayName ) {
2968
- $this->groupDisplayName = $groupDisplayName;
2969
- }
2970
- public function getGroupDisplayName() {
2971
- return $this->groupDisplayName;
2972
- }
2973
- public function setIsDeprecated( $isDeprecated ) {
2974
- $this->isDeprecated = $isDeprecated;
2975
- }
2976
- public function getIsDeprecated() {
2977
- return $this->isDeprecated;
2978
- }
2979
- public function setIsRepeatable( $isRepeatable ) {
2980
- $this->isRepeatable = $isRepeatable;
2981
- }
2982
- public function getIsRepeatable() {
2983
- return $this->isRepeatable;
2984
- }
2985
- public function setValueMetadata( $valueMetadata ) {
2986
- $this->valueMetadata = $valueMetadata;
2987
- }
2988
- public function getValueMetadata() {
2989
- return $this->valueMetadata;
2990
- }
2991
- public function setValueType( $valueType ) {
2992
- $this->valueType = $valueType;
2993
- }
2994
- public function getValueType() {
2995
- return $this->valueType;
2996
- }
2997
- }
2998
-
2999
- class Google_Service_MyBusiness_AttributeValueMetadata extends Google_Model {
3000
-
3001
- protected $internal_gapi_mappings = array(
3002
- );
3003
- public $displayName;
3004
- public $value;
3005
-
3006
-
3007
- public function setDisplayName( $displayName ) {
3008
- $this->displayName = $displayName;
3009
- }
3010
- public function getDisplayName() {
3011
- return $this->displayName;
3012
- }
3013
- public function setValue( $value ) {
3014
- $this->value = $value;
3015
- }
3016
- public function getValue() {
3017
- return $this->value;
3018
- }
3019
- }
3020
-
3021
- class Google_Service_MyBusiness_Attribution extends Google_Model {
3022
-
3023
- protected $internal_gapi_mappings = array(
3024
- );
3025
- public $profileName;
3026
- public $profilePhotoUrl;
3027
- public $profileUrl;
3028
- public $takedownUrl;
3029
-
3030
-
3031
- public function setProfileName( $profileName ) {
3032
- $this->profileName = $profileName;
3033
- }
3034
- public function getProfileName() {
3035
- return $this->profileName;
3036
- }
3037
- public function setProfilePhotoUrl( $profilePhotoUrl ) {
3038
- $this->profilePhotoUrl = $profilePhotoUrl;
3039
- }
3040
- public function getProfilePhotoUrl() {
3041
- return $this->profilePhotoUrl;
3042
- }
3043
- public function setProfileUrl( $profileUrl ) {
3044
- $this->profileUrl = $profileUrl;
3045
- }
3046
- public function getProfileUrl() {
3047
- return $this->profileUrl;
3048
- }
3049
- public function setTakedownUrl( $takedownUrl ) {
3050
- $this->takedownUrl = $takedownUrl;
3051
- }
3052
- public function getTakedownUrl() {
3053
- return $this->takedownUrl;
3054
- }
3055
- }
3056
-
3057
- class Google_Service_MyBusiness_Author extends Google_Model {
3058
-
3059
- protected $internal_gapi_mappings = array(
3060
- );
3061
- public $displayName;
3062
- public $profilePhotoUrl;
3063
- public $type;
3064
-
3065
-
3066
- public function setDisplayName( $displayName ) {
3067
- $this->displayName = $displayName;
3068
- }
3069
- public function getDisplayName() {
3070
- return $this->displayName;
3071
- }
3072
- public function setProfilePhotoUrl( $profilePhotoUrl ) {
3073
- $this->profilePhotoUrl = $profilePhotoUrl;
3074
- }
3075
- public function getProfilePhotoUrl() {
3076
- return $this->profilePhotoUrl;
3077
- }
3078
- public function setType( $type ) {
3079
- $this->type = $type;
3080
- }
3081
- public function getType() {
3082
- return $this->type;
3083
- }
3084
- }
3085
-
3086
- class Google_Service_MyBusiness_BasicMetricsRequest extends Google_Collection {
3087
-
3088
- protected $collection_key = 'metricRequests';
3089
- protected $internal_gapi_mappings = array(
3090
- );
3091
- protected $metricRequestsType = 'Google_Service_MyBusiness_MetricRequest';
3092
- protected $metricRequestsDataType = 'array';
3093
- protected $timeRangeType = 'Google_Service_MyBusiness_TimeRange';
3094
- protected $timeRangeDataType = '';
3095
-
3096
-
3097
- public function setMetricRequests( $metricRequests ) {
3098
- $this->metricRequests = $metricRequests;
3099
- }
3100
- public function getMetricRequests() {
3101
- return $this->metricRequests;
3102
- }
3103
- public function setTimeRange( Google_Service_MyBusiness_TimeRange $timeRange ) {
3104
- $this->timeRange = $timeRange;
3105
- }
3106
- public function getTimeRange() {
3107
- return $this->timeRange;
3108
- }
3109
- }
3110
-
3111
- class Google_Service_MyBusiness_BatchGetBusinessCategoriesResponse extends Google_Collection {
3112
-
3113
- protected $collection_key = 'categories';
3114
- protected $internal_gapi_mappings = array(
3115
- );
3116
- protected $categoriesType = 'Google_Service_MyBusiness_Category';
3117
- protected $categoriesDataType = 'array';
3118
-
3119
-
3120
- public function setCategories( $categories ) {
3121
- $this->categories = $categories;
3122
- }
3123
- public function getCategories() {
3124
- return $this->categories;
3125
- }
3126
- }
3127
-
3128
- class Google_Service_MyBusiness_BatchGetLocationsRequest extends Google_Collection {
3129
-
3130
- protected $collection_key = 'locationNames';
3131
- protected $internal_gapi_mappings = array(
3132
- );
3133
- public $locationNames;
3134
-
3135
-
3136
- public function setLocationNames( $locationNames ) {
3137
- $this->locationNames = $locationNames;
3138
- }
3139
- public function getLocationNames() {
3140
- return $this->locationNames;
3141
- }
3142
- }
3143
-
3144
- class Google_Service_MyBusiness_BatchGetLocationsResponse extends Google_Collection {
3145
-
3146
- protected $collection_key = 'locations';
3147
- protected $internal_gapi_mappings = array(
3148
- );
3149
- protected $locationsType = 'Google_Service_MyBusiness_Location';
3150
- protected $locationsDataType = 'array';
3151
-
3152
-
3153
- public function setLocations( $locations ) {
3154
- $this->locations = $locations;
3155
- }
3156
- public function getLocations() {
3157
- return $this->locations;
3158
- }
3159
- }
3160
-
3161
- class Google_Service_MyBusiness_BatchGetReviewsRequest extends Google_Collection {
3162
-
3163
- protected $collection_key = 'locationNames';
3164
- protected $internal_gapi_mappings = array(
3165
- );
3166
- public $ignoreRatingOnlyReviews;
3167
- public $locationNames;
3168
- public $orderBy;
3169
- public $pageSize;
3170
- public $pageToken;
3171
-
3172
-
3173
- public function setIgnoreRatingOnlyReviews( $ignoreRatingOnlyReviews ) {
3174
- $this->ignoreRatingOnlyReviews = $ignoreRatingOnlyReviews;
3175
- }
3176
- public function getIgnoreRatingOnlyReviews() {
3177
- return $this->ignoreRatingOnlyReviews;
3178
- }
3179
- public function setLocationNames( $locationNames ) {
3180
- $this->locationNames = $locationNames;
3181
- }
3182
- public function getLocationNames() {
3183
- return $this->locationNames;
3184
- }
3185
- public function setOrderBy( $orderBy ) {
3186
- $this->orderBy = $orderBy;
3187
- }
3188
- public function getOrderBy() {
3189
- return $this->orderBy;
3190
- }
3191
- public function setPageSize( $pageSize ) {
3192
- $this->pageSize = $pageSize;
3193
- }
3194
- public function getPageSize() {
3195
- return $this->pageSize;
3196
- }
3197
- public function setPageToken( $pageToken ) {
3198
- $this->pageToken = $pageToken;
3199
- }
3200
- public function getPageToken() {
3201
- return $this->pageToken;
3202
- }
3203
- }
3204
-
3205
- class Google_Service_MyBusiness_BatchGetReviewsResponse extends Google_Collection {
3206
-
3207
- protected $collection_key = 'locationReviews';
3208
- protected $internal_gapi_mappings = array(
3209
- );
3210
- protected $locationReviewsType = 'Google_Service_MyBusiness_LocationReview';
3211
- protected $locationReviewsDataType = 'array';
3212
- public $nextPageToken;
3213
-
3214
-
3215
- public function setLocationReviews( $locationReviews ) {
3216
- $this->locationReviews = $locationReviews;
3217
- }
3218
- public function getLocationReviews() {
3219
- return $this->locationReviews;
3220
- }
3221
- public function setNextPageToken( $nextPageToken ) {
3222
- $this->nextPageToken = $nextPageToken;
3223
- }
3224
- public function getNextPageToken() {
3225
- return $this->nextPageToken;
3226
- }
3227
- }
3228
-
3229
- class Google_Service_MyBusiness_BusinessHours extends Google_Collection {
3230
-
3231
- protected $collection_key = 'periods';
3232
- protected $internal_gapi_mappings = array(
3233
- );
3234
- protected $periodsType = 'Google_Service_MyBusiness_TimePeriod';
3235
- protected $periodsDataType = 'array';
3236
-
3237
-
3238
- public function setPeriods( $periods ) {
3239
- $this->periods = $periods;
3240
- }
3241
- public function getPeriods() {
3242
- return $this->periods;
3243
- }
3244
- }
3245
-
3246
- class Google_Service_MyBusiness_CallToAction extends Google_Model {
3247
-
3248
- protected $internal_gapi_mappings = array(
3249
- );
3250
- public $actionType;
3251
- public $url;
3252
-
3253
-
3254
- public function setActionType( $actionType ) {
3255
- $this->actionType = $actionType;
3256
- }
3257
- public function getActionType() {
3258
- return $this->actionType;
3259
- }
3260
- public function setUrl( $url ) {
3261
- $this->url = $url;
3262
- }
3263
- public function getUrl() {
3264
- return $this->url;
3265
- }
3266
- }
3267
-
3268
- class Google_Service_MyBusiness_Category extends Google_Model {
3269
-
3270
- protected $internal_gapi_mappings = array(
3271
- );
3272
- public $categoryId;
3273
- public $displayName;
3274
-
3275
-
3276
- public function setCategoryId( $categoryId ) {
3277
- $this->categoryId = $categoryId;
3278
- }
3279
- public function getCategoryId() {
3280
- return $this->categoryId;
3281
- }
3282
- public function setDisplayName( $displayName ) {
3283
- $this->displayName = $displayName;
3284
- }
3285
- public function getDisplayName() {
3286
- return $this->displayName;
3287
- }
3288
- }
3289
-
3290
- class Google_Service_MyBusiness_Chain extends Google_Collection {
3291
-
3292
- protected $collection_key = 'websites';
3293
- protected $internal_gapi_mappings = array(
3294
- );
3295
- protected $chainNamesType = 'Google_Service_MyBusiness_ChainName';
3296
- protected $chainNamesDataType = 'array';
3297
- public $locationCount;
3298
- public $name;
3299
- protected $websitesType = 'Google_Service_MyBusiness_ChainUrl';
3300
- protected $websitesDataType = 'array';
3301
-
3302
-
3303
- public function setChainNames( $chainNames ) {
3304
- $this->chainNames = $chainNames;
3305
- }
3306
- public function getChainNames() {
3307
- return $this->chainNames;
3308
- }
3309
- public function setLocationCount( $locationCount ) {
3310
- $this->locationCount = $locationCount;
3311
- }
3312
- public function getLocationCount() {
3313
- return $this->locationCount;
3314
- }
3315
- public function setName( $name ) {
3316
- $this->name = $name;
3317
- }
3318
- public function getName() {
3319
- return $this->name;
3320
- }
3321
- public function setWebsites( $websites ) {
3322
- $this->websites = $websites;
3323
- }
3324
- public function getWebsites() {
3325
- return $this->websites;
3326
- }
3327
- }
3328
-
3329
- class Google_Service_MyBusiness_ChainName extends Google_Model {
3330
-
3331
- protected $internal_gapi_mappings = array(
3332
- );
3333
- public $displayName;
3334
- public $languageCode;
3335
-
3336
-
3337
- public function setDisplayName( $displayName ) {
3338
- $this->displayName = $displayName;
3339
- }
3340
- public function getDisplayName() {
3341
- return $this->displayName;
3342
- }
3343
- public function setLanguageCode( $languageCode ) {
3344
- $this->languageCode = $languageCode;
3345
- }
3346
- public function getLanguageCode() {
3347
- return $this->languageCode;
3348
- }
3349
- }
3350
-
3351
- class Google_Service_MyBusiness_ChainUrl extends Google_Model {
3352
-
3353
- protected $internal_gapi_mappings = array(
3354
- );
3355
- public $url;
3356
-
3357
-
3358
- public function setUrl( $url ) {
3359
- $this->url = $url;
3360
- }
3361
- public function getUrl() {
3362
- return $this->url;
3363
- }
3364
- }
3365
-
3366
- class Google_Service_MyBusiness_ClearLocationAssociationRequest extends Google_Model {
3367
-
3368
- }
3369
-
3370
- class Google_Service_MyBusiness_CompleteVerificationRequest extends Google_Model {
3371
-
3372
- protected $internal_gapi_mappings = array(
3373
- );
3374
- public $pin;
3375
-
3376
-
3377
- public function setPin( $pin ) {
3378
- $this->pin = $pin;
3379
- }
3380
- public function getPin() {
3381
- return $this->pin;
3382
- }
3383
- }
3384
-
3385
- class Google_Service_MyBusiness_CompleteVerificationResponse extends Google_Model {
3386
-
3387
- protected $internal_gapi_mappings = array(
3388
- );
3389
- protected $verificationType = 'Google_Service_MyBusiness_Verification';
3390
- protected $verificationDataType = '';
3391
-
3392
-
3393
- public function setVerification( Google_Service_MyBusiness_Verification $verification ) {
3394
- $this->verification = $verification;
3395
- }
3396
- public function getVerification() {
3397
- return $this->verification;
3398
- }
3399
- }
3400
-
3401
- class Google_Service_MyBusiness_Date extends Google_Model {
3402
-
3403
- protected $internal_gapi_mappings = array(
3404
- );
3405
- public $day;
3406
- public $month;
3407
- public $year;
3408
-
3409
-
3410
- public function setDay( $day ) {
3411
- $this->day = $day;
3412
- }
3413
- public function getDay() {
3414
- return $this->day;
3415
- }
3416
- public function setMonth( $month ) {
3417
- $this->month = $month;
3418
- }
3419
- public function getMonth() {
3420
- return $this->month;
3421
- }
3422
- public function setYear( $year ) {
3423
- $this->year = $year;
3424
- }
3425
- public function getYear() {
3426
- return $this->year;
3427
- }
3428
- }
3429
-
3430
- class Google_Service_MyBusiness_DeclineInvitationRequest extends Google_Model {
3431
-
3432
- }
3433
-
3434
- class Google_Service_MyBusiness_DimensionalMetricValue extends Google_Model {
3435
-
3436
- protected $internal_gapi_mappings = array(
3437
- );
3438
- public $metricOption;
3439
- protected $timeDimensionType = 'Google_Service_MyBusiness_TimeDimension';
3440
- protected $timeDimensionDataType = '';
3441
- public $value;
3442
-
3443
-
3444
- public function setMetricOption( $metricOption ) {
3445
- $this->metricOption = $metricOption;
3446
- }
3447
- public function getMetricOption() {
3448
- return $this->metricOption;
3449
- }
3450
- public function setTimeDimension( Google_Service_MyBusiness_TimeDimension $timeDimension ) {
3451
- $this->timeDimension = $timeDimension;
3452
- }
3453
- public function getTimeDimension() {
3454
- return $this->timeDimension;
3455
- }
3456
- public function setValue( $value ) {
3457
- $this->value = $value;
3458
- }
3459
- public function getValue() {
3460
- return $this->value;
3461
- }
3462
- }
3463
-
3464
- class Google_Service_MyBusiness_Dimensions extends Google_Model {
3465
-
3466
- protected $internal_gapi_mappings = array(
3467
- );
3468
- public $heightPixels;
3469
- public $widthPixels;
3470
-
3471
-
3472
- public function setHeightPixels( $heightPixels ) {
3473
- $this->heightPixels = $heightPixels;
3474
- }
3475
- public function getHeightPixels() {
3476
- return $this->heightPixels;
3477
- }
3478
- public function setWidthPixels( $widthPixels ) {
3479
- $this->widthPixels = $widthPixels;
3480
- }
3481
- public function getWidthPixels() {
3482
- return $this->widthPixels;
3483
- }
3484
- }
3485
-
3486
- class Google_Service_MyBusiness_DrivingDirectionMetricsRequest extends Google_Model {
3487
-
3488
- protected $internal_gapi_mappings = array(
3489
- );
3490
- public $languageCode;
3491
- public $numDays;
3492
-
3493
-
3494
- public function setLanguageCode( $languageCode ) {
3495
- $this->languageCode = $languageCode;
3496
- }
3497
- public function getLanguageCode() {
3498
- return $this->languageCode;
3499
- }
3500
- public function setNumDays( $numDays ) {
3501
- $this->numDays = $numDays;
3502
- }
3503
- public function getNumDays() {
3504
- return $this->numDays;
3505
- }
3506
- }
3507
-
3508
- class Google_Service_MyBusiness_Duplicate extends Google_Model {
3509
-
3510
- protected $internal_gapi_mappings = array(
3511
- );
3512
- public $access;
3513
- public $locationName;
3514
- public $placeId;
3515
-
3516
-
3517
- public function setAccess( $access ) {
3518
- $this->access = $access;
3519
- }
3520
- public function getAccess() {
3521
- return $this->access;
3522
- }
3523
- public function setLocationName( $locationName ) {
3524
- $this->locationName = $locationName;
3525
- }
3526
- public function getLocationName() {
3527
- return $this->locationName;
3528
- }
3529
- public function setPlaceId( $placeId ) {
3530
- $this->placeId = $placeId;
3531
- }
3532
- public function getPlaceId() {
3533
- return $this->placeId;
3534
- }
3535
- }
3536
-
3537
- class Google_Service_MyBusiness_EmailInput extends Google_Model {
3538
-
3539
- protected $internal_gapi_mappings = array(
3540
- );
3541
- public $emailAddress;
3542
-
3543
-
3544
- public function setEmailAddress( $emailAddress ) {
3545
- $this->emailAddress = $emailAddress;
3546
- }
3547
- public function getEmailAddress() {
3548
- return $this->emailAddress;
3549
- }
3550
- }
3551
-
3552
- class Google_Service_MyBusiness_EmailVerificationData extends Google_Model {
3553
-
3554
- protected $internal_gapi_mappings = array(
3555
- );
3556
- public $domainName;
3557
- public $isUserNameEditable;
3558
- public $userName;
3559
-
3560
-
3561
- public function setDomainName( $domainName ) {
3562
- $this->domainName = $domainName;
3563
- }
3564
- public function getDomainName() {
3565
- return $this->domainName;
3566
- }
3567
- public function setIsUserNameEditable( $isUserNameEditable ) {
3568
- $this->isUserNameEditable = $isUserNameEditable;
3569
- }
3570
- public function getIsUserNameEditable() {
3571
- return $this->isUserNameEditable;
3572
- }
3573
- public function setUserName( $userName ) {
3574
- $this->userName = $userName;
3575
- }
3576
- public function getUserName() {
3577
- return $this->userName;
3578
- }
3579
- }
3580
-
3581
- class Google_Service_MyBusiness_FetchVerificationOptionsRequest extends Google_Model {
3582
-
3583
- protected $internal_gapi_mappings = array(
3584
- );
3585
- protected $contextType = 'Google_Service_MyBusiness_ServiceBusinessContext';
3586
- protected $contextDataType = '';
3587
- public $languageCode;
3588
-
3589
-
3590
- public function setContext( Google_Service_MyBusiness_ServiceBusinessContext $context ) {
3591
- $this->context = $context;
3592
- }
3593
- public function getContext() {
3594
- return $this->context;
3595
- }
3596
- public function setLanguageCode( $languageCode ) {
3597
- $this->languageCode = $languageCode;
3598
- }
3599
- public function getLanguageCode() {
3600
- return $this->languageCode;
3601
- }
3602
- }
3603
-
3604
- class Google_Service_MyBusiness_FetchVerificationOptionsResponse extends Google_Collection {
3605
-
3606
- protected $collection_key = 'options';
3607
- protected $internal_gapi_mappings = array(
3608
- );
3609
- protected $optionsType = 'Google_Service_MyBusiness_VerificationOption';
3610
- protected $optionsDataType = 'array';
3611
-
3612
-
3613
- public function setOptions( $options ) {
3614
- $this->options = $options;
3615
- }
3616
- public function getOptions() {
3617
- return $this->options;
3618
- }
3619
- }
3620
-
3621
- class Google_Service_MyBusiness_FindMatchingLocationsRequest extends Google_Model {
3622
-
3623
- protected $internal_gapi_mappings = array(
3624
- );
3625
- public $languageCode;
3626
- public $maxCacheDuration;
3627
- public $numResults;
3628
-
3629
-
3630
- public function setLanguageCode( $languageCode ) {
3631
- $this->languageCode = $languageCode;
3632
- }
3633
- public function getLanguageCode() {
3634
- return $this->languageCode;
3635
- }
3636
- public function setMaxCacheDuration( $maxCacheDuration ) {
3637
- $this->maxCacheDuration = $maxCacheDuration;
3638
- }
3639
- public function getMaxCacheDuration() {
3640
- return $this->maxCacheDuration;
3641
- }
3642
- public function setNumResults( $numResults ) {
3643
- $this->numResults = $numResults;
3644
- }
3645
- public function getNumResults() {
3646
- return $this->numResults;
3647
- }
3648
- }
3649
-
3650
- class Google_Service_MyBusiness_FindMatchingLocationsResponse extends Google_Collection {
3651
-
3652
- protected $collection_key = 'matchedLocations';
3653
- protected $internal_gapi_mappings = array(
3654
- );
3655
- public $matchTime;
3656
- protected $matchedLocationsType = 'Google_Service_MyBusiness_MatchedLocation';
3657
- protected $matchedLocationsDataType = 'array';
3658
-
3659
-
3660
- public function setMatchTime( $matchTime ) {
3661
- $this->matchTime = $matchTime;
3662
- }
3663
- public function getMatchTime() {
3664
- return $this->matchTime;
3665
- }
3666
- public function setMatchedLocations( $matchedLocations ) {
3667
- $this->matchedLocations = $matchedLocations;
3668
- }
3669
- public function getMatchedLocations() {
3670
- return $this->matchedLocations;
3671
- }
3672
- }
3673
-
3674
- class Google_Service_MyBusiness_FollowersMetadata extends Google_Model {
3675
-
3676
- protected $internal_gapi_mappings = array(
3677
- );
3678
- public $count;
3679
- public $name;
3680
-
3681
-
3682
- public function setCount( $count ) {
3683
- $this->count = $count;
3684
- }
3685
- public function getCount() {
3686
- return $this->count;
3687
- }
3688
- public function setName( $name ) {
3689
- $this->name = $name;
3690
- }
3691
- public function getName() {
3692
- return $this->name;
3693
- }
3694
- }
3695
-
3696
- class Google_Service_MyBusiness_FreeFormServiceItem extends Google_Model {
3697
-
3698
- protected $internal_gapi_mappings = array(
3699
- );
3700
- public $categoryId;
3701
- protected $labelType = 'Google_Service_MyBusiness_Label';
3702
- protected $labelDataType = '';
3703
-
3704
-
3705
- public function setCategoryId( $categoryId ) {
3706
- $this->categoryId = $categoryId;
3707
- }
3708
- public function getCategoryId() {
3709
- return $this->categoryId;
3710
- }
3711
- public function setLabel( Google_Service_MyBusiness_Label $label ) {
3712
- $this->label = $label;
3713
- }
3714
- public function getLabel() {
3715
- return $this->label;
3716
- }
3717
- }
3718
-
3719
- class Google_Service_MyBusiness_GenerateAccountNumberRequest extends Google_Model {
3720
-
3721
- }
3722
-
3723
- class Google_Service_MyBusiness_GoogleLocation extends Google_Model {
3724
-
3725
- protected $internal_gapi_mappings = array(
3726
- );
3727
- protected $locationType = 'Google_Service_MyBusiness_Location';
3728
- protected $locationDataType = '';
3729
- public $name;
3730
- public $requestAdminRightsUrl;
3731
-
3732
-
3733
- public function setLocation( Google_Service_MyBusiness_Location $location ) {
3734
- $this->location = $location;
3735
- }
3736
- public function getLocation() {
3737
- return $this->location;
3738
- }
3739
- public function setName( $name ) {
3740
- $this->name = $name;
3741
- }
3742
- public function getName() {
3743
- return $this->name;
3744
- }
3745
- public function setRequestAdminRightsUrl( $requestAdminRightsUrl ) {
3746
- $this->requestAdminRightsUrl = $requestAdminRightsUrl;
3747
- }
3748
- public function getRequestAdminRightsUrl() {
3749
- return $this->requestAdminRightsUrl;
3750
- }
3751
- }
3752
-
3753
- class Google_Service_MyBusiness_GoogleUpdatedLocation extends Google_Model {
3754
-
3755
- protected $internal_gapi_mappings = array(
3756
- );
3757
- public $diffMask;
3758
- protected $locationType = 'Google_Service_MyBusiness_Location';
3759
- protected $locationDataType = '';
3760
-
3761
-
3762
- public function setDiffMask( $diffMask ) {
3763
- $this->diffMask = $diffMask;
3764
- }
3765
- public function getDiffMask() {
3766
- return $this->diffMask;
3767
- }
3768
- public function setLocation( Google_Service_MyBusiness_Location $location ) {
3769
- $this->location = $location;
3770
- }
3771
- public function getLocation() {
3772
- return $this->location;
3773
- }
3774
- }
3775
-
3776
- class Google_Service_MyBusiness_Invitation extends Google_Model {
3777
-
3778
- protected $internal_gapi_mappings = array(
3779
- );
3780
- public $name;
3781
- public $role;
3782
- protected $targetAccountType = 'Google_Service_MyBusiness_Account';
3783
- protected $targetAccountDataType = '';
3784
- protected $targetLocationType = 'Google_Service_MyBusiness_TargetLocation';
3785
- protected $targetLocationDataType = '';
3786
-
3787
-
3788
- public function setName( $name ) {
3789
- $this->name = $name;
3790
- }
3791
- public function getName() {
3792
- return $this->name;
3793
- }
3794
- public function setRole( $role ) {
3795
- $this->role = $role;
3796
- }
3797
- public function getRole() {
3798
- return $this->role;
3799
- }
3800
- public function setTargetAccount( Google_Service_MyBusiness_Account $targetAccount ) {
3801
- $this->targetAccount = $targetAccount;
3802
- }
3803
- public function getTargetAccount() {
3804
- return $this->targetAccount;
3805
- }
3806
- public function setTargetLocation( Google_Service_MyBusiness_TargetLocation $targetLocation ) {
3807
- $this->targetLocation = $targetLocation;
3808
- }
3809
- public function getTargetLocation() {
3810
- return $this->targetLocation;
3811
- }
3812
- }
3813
-
3814
- class Google_Service_MyBusiness_Item extends Google_Collection {
3815
-
3816
- protected $collection_key = 'labels';
3817
- protected $internal_gapi_mappings = array(
3818
- );
3819
- public $itemId;
3820
- protected $labelsType = 'Google_Service_MyBusiness_Label';
3821
- protected $labelsDataType = 'array';
3822
- protected $priceType = 'Google_Service_MyBusiness_Money';
3823
- protected $priceDataType = '';
3824
-
3825
-
3826
- public function setItemId( $itemId ) {
3827
- $this->itemId = $itemId;
3828
- }
3829
- public function getItemId() {
3830
- return $this->itemId;
3831
- }
3832
- public function setLabels( $labels ) {
3833
- $this->labels = $labels;
3834
- }
3835
- public function getLabels() {
3836
- return $this->labels;
3837
- }
3838
- public function setPrice( Google_Service_MyBusiness_Money $price ) {
3839
- $this->price = $price;
3840
- }
3841
- public function getPrice() {
3842
- return $this->price;
3843
- }
3844
- }
3845
-
3846
- class Google_Service_MyBusiness_Label extends Google_Model {
3847
-
3848
- protected $internal_gapi_mappings = array(
3849
- );
3850
- public $description;
3851
- public $displayName;
3852
- public $languageCode;
3853
-
3854
-
3855
- public function setDescription( $description ) {
3856
- $this->description = $description;
3857
- }
3858
- public function getDescription() {
3859
- return $this->description;
3860
- }
3861
- public function setDisplayName( $displayName ) {
3862
- $this->displayName = $displayName;
3863
- }
3864
- public function getDisplayName() {
3865
- return $this->displayName;
3866
- }
3867
- public function setLanguageCode( $languageCode ) {
3868
- $this->languageCode = $languageCode;
3869
- }
3870
- public function getLanguageCode() {
3871
- return $this->languageCode;
3872
- }
3873
- }
3874
-
3875
- class Google_Service_MyBusiness_LatLng extends Google_Model {
3876
-
3877
- protected $internal_gapi_mappings = array(
3878
- );
3879
- public $latitude;
3880
- public $longitude;
3881
-
3882
-
3883
- public function setLatitude( $latitude ) {
3884
- $this->latitude = $latitude;
3885
- }
3886
- public function getLatitude() {
3887
- return $this->latitude;
3888
- }
3889
- public function setLongitude( $longitude ) {
3890
- $this->longitude = $longitude;
3891
- }
3892
- public function getLongitude() {
3893
- return $this->longitude;
3894
- }
3895
- }
3896
-
3897
- class Google_Service_MyBusiness_ListAccountAdminsResponse extends Google_Collection {
3898
-
3899
- protected $collection_key = 'admins';
3900
- protected $internal_gapi_mappings = array(
3901
- );
3902
- protected $adminsType = 'Google_Service_MyBusiness_Admin';
3903
- protected $adminsDataType = 'array';
3904
-
3905
-
3906
- public function setAdmins( $admins ) {
3907
- $this->admins = $admins;
3908
- }
3909
- public function getAdmins() {
3910
- return $this->admins;
3911
- }
3912
- }
3913
-
3914
- class Google_Service_MyBusiness_ListAccountsResponse extends Google_Collection {
3915
-
3916
- protected $collection_key = 'accounts';
3917
- protected $internal_gapi_mappings = array(
3918
- );
3919
- protected $accountsType = 'Google_Service_MyBusiness_Account';
3920
- protected $accountsDataType = 'array';
3921
- public $nextPageToken;
3922
-
3923
-
3924
- public function setAccounts( $accounts ) {
3925
- $this->accounts = $accounts;
3926
- }
3927
- public function getAccounts() {
3928
- return $this->accounts;
3929
- }
3930
- public function setNextPageToken( $nextPageToken ) {
3931
- $this->nextPageToken = $nextPageToken;
3932
- }
3933
- public function getNextPageToken() {
3934
- return $this->nextPageToken;
3935
- }
3936
- }
3937
-
3938
- class Google_Service_MyBusiness_ListAnswersResponse extends Google_Collection {
3939
-
3940
- protected $collection_key = 'answers';
3941
- protected $internal_gapi_mappings = array(
3942
- );
3943
- protected $answersType = 'Google_Service_MyBusiness_Answer';
3944
- protected $answersDataType = 'array';
3945
- public $nextPageToken;
3946
- public $totalSize;
3947
-
3948
-
3949
- public function setAnswers( $answers ) {
3950
- $this->answers = $answers;
3951
- }
3952
- public function getAnswers() {
3953
- return $this->answers;
3954
- }
3955
- public function setNextPageToken( $nextPageToken ) {
3956
- $this->nextPageToken = $nextPageToken;
3957
- }
3958
- public function getNextPageToken() {
3959
- return $this->nextPageToken;
3960
- }
3961
- public function setTotalSize( $totalSize ) {
3962
- $this->totalSize = $totalSize;
3963
- }
3964
- public function getTotalSize() {
3965
- return $this->totalSize;
3966
- }
3967
- }
3968
-
3969
- class Google_Service_MyBusiness_ListAttributeMetadataResponse extends Google_Collection {
3970
-
3971
- protected $collection_key = 'attributes';
3972
- protected $internal_gapi_mappings = array(
3973
- );
3974
- protected $attributesType = 'Google_Service_MyBusiness_AttributeMetadata';
3975
- protected $attributesDataType = 'array';
3976
- public $nextPageToken;
3977
-
3978
-
3979
- public function setAttributes( $attributes ) {
3980
- $this->attributes = $attributes;
3981
- }
3982
- public function getAttributes() {
3983
- return $this->attributes;
3984
- }
3985
- public function setNextPageToken( $nextPageToken ) {
3986
- $this->nextPageToken = $nextPageToken;
3987
- }
3988
- public function getNextPageToken() {
3989
- return $this->nextPageToken;
3990
- }
3991
- }
3992
-
3993
- class Google_Service_MyBusiness_ListBusinessCategoriesResponse extends Google_Collection {
3994
-
3995
- protected $collection_key = 'categories';
3996
- protected $internal_gapi_mappings = array(
3997
- );
3998
- protected $categoriesType = 'Google_Service_MyBusiness_Category';
3999
- protected $categoriesDataType = 'array';
4000
- public $nextPageToken;
4001
- public $totalCategoryCount;
4002
-
4003
-
4004
- public function setCategories( $categories ) {
4005
- $this->categories = $categories;
4006
- }
4007
- public function getCategories() {
4008
- return $this->categories;
4009
- }
4010
- public function setNextPageToken( $nextPageToken ) {
4011
- $this->nextPageToken = $nextPageToken;
4012
- }
4013
- public function getNextPageToken() {
4014
- return $this->nextPageToken;
4015
- }
4016
- public function setTotalCategoryCount( $totalCategoryCount ) {
4017
- $this->totalCategoryCount = $totalCategoryCount;
4018
- }
4019
- public function getTotalCategoryCount() {
4020
- return $this->totalCategoryCount;
4021
- }
4022
- }
4023
-
4024
- class Google_Service_MyBusiness_ListCustomerMediaItemsResponse extends Google_Collection {
4025
-
4026
- protected $collection_key = 'mediaItems';
4027
- protected $internal_gapi_mappings = array(
4028
- );
4029
- protected $mediaItemsType = 'Google_Service_MyBusiness_MediaItem';
4030
- protected $mediaItemsDataType = 'array';
4031
- public $nextPageToken;
4032
- public $totalMediaItemCount;
4033
-
4034
-
4035
- public function setMediaItems( $mediaItems ) {
4036
- $this->mediaItems = $mediaItems;
4037
- }
4038
- public function getMediaItems() {
4039
- return $this->mediaItems;
4040
- }
4041
- public function setNextPageToken( $nextPageToken ) {
4042
- $this->nextPageToken = $nextPageToken;
4043
- }
4044
- public function getNextPageToken() {
4045
- return $this->nextPageToken;
4046
- }
4047
- public function setTotalMediaItemCount( $totalMediaItemCount ) {
4048
- $this->totalMediaItemCount = $totalMediaItemCount;
4049
- }
4050
- public function getTotalMediaItemCount() {
4051
- return $this->totalMediaItemCount;
4052
- }
4053
- }
4054
-
4055
- class Google_Service_MyBusiness_ListInvitationsResponse extends Google_Collection {
4056
-
4057
- protected $collection_key = 'invitations';
4058
- protected $internal_gapi_mappings = array(
4059
- );
4060
- protected $invitationsType = 'Google_Service_MyBusiness_Invitation';
4061
- protected $invitationsDataType = 'array';
4062
-
4063
-
4064
- public function setInvitations( $invitations ) {
4065
- $this->invitations = $invitations;
4066
- }
4067
- public function getInvitations() {
4068
- return $this->invitations;
4069
- }
4070
- }
4071
-
4072
- class Google_Service_MyBusiness_ListLocalPostsResponse extends Google_Collection {
4073
-
4074
- protected $collection_key = 'localPosts';
4075
- protected $internal_gapi_mappings = array(
4076
- );
4077
- protected $localPostsType = 'Google_Service_MyBusiness_LocalPost';
4078
- protected $localPostsDataType = 'array';
4079
- public $nextPageToken;
4080
-
4081
-
4082
- public function setLocalPosts( $localPosts ) {
4083
- $this->localPosts = $localPosts;
4084
- }
4085
- public function getLocalPosts() {
4086
- return $this->localPosts;
4087
- }
4088
- public function setNextPageToken( $nextPageToken ) {
4089
- $this->nextPageToken = $nextPageToken;
4090
- }
4091
- public function getNextPageToken() {
4092
- return $this->nextPageToken;
4093
- }
4094
- }
4095
-
4096
- class Google_Service_MyBusiness_ListLocationAdminsResponse extends Google_Collection {
4097
-
4098
- protected $collection_key = 'admins';
4099
- protected $internal_gapi_mappings = array(
4100
- );
4101
- protected $adminsType = 'Google_Service_MyBusiness_Admin';
4102
- protected $adminsDataType = 'array';
4103
-
4104
-
4105
- public function setAdmins( $admins ) {
4106
- $this->admins = $admins;
4107
- }
4108
- public function getAdmins() {
4109
- return $this->admins;
4110
- }
4111
- }
4112
-
4113
- class Google_Service_MyBusiness_ListLocationsResponse extends Google_Collection {
4114
-
4115
- protected $collection_key = 'locations';
4116
- protected $internal_gapi_mappings = array(
4117
- );
4118
- protected $locationsType = 'Google_Service_MyBusiness_Location';
4119
- protected $locationsDataType = 'array';
4120
- public $nextPageToken;
4121
- public $totalSize;
4122
-
4123
-
4124
- public function setLocations( $locations ) {
4125
- $this->locations = $locations;
4126
- }
4127
- public function getLocations() {
4128
- return $this->locations;
4129
- }
4130
- public function setNextPageToken( $nextPageToken ) {
4131
- $this->nextPageToken = $nextPageToken;
4132
- }
4133
- public function getNextPageToken() {
4134
- return $this->nextPageToken;
4135
- }
4136
- public function setTotalSize( $totalSize ) {
4137
- $this->totalSize = $totalSize;
4138
- }
4139
- public function getTotalSize() {
4140
- return $this->totalSize;
4141
- }
4142
- }
4143
-
4144
- class Google_Service_MyBusiness_ListMediaItemsResponse extends Google_Collection {
4145
-
4146
- protected $collection_key = 'mediaItems';
4147
- protected $internal_gapi_mappings = array(
4148
- );
4149
- protected $mediaItemsType = 'Google_Service_MyBusiness_MediaItem';
4150
- protected $mediaItemsDataType = 'array';
4151
- public $nextPageToken;
4152
- public $totalMediaItemCount;
4153
-
4154
-
4155
- public function setMediaItems( $mediaItems ) {
4156
- $this->mediaItems = $mediaItems;
4157
- }
4158
- public function getMediaItems() {
4159
- return $this->mediaItems;
4160
- }
4161
- public function setNextPageToken( $nextPageToken ) {
4162
- $this->nextPageToken = $nextPageToken;
4163
- }
4164
- public function getNextPageToken() {
4165
- return $this->nextPageToken;
4166
- }
4167
- public function setTotalMediaItemCount( $totalMediaItemCount ) {
4168
- $this->totalMediaItemCount = $totalMediaItemCount;
4169
- }
4170
- public function getTotalMediaItemCount() {
4171
- return $this->totalMediaItemCount;
4172
- }
4173
- }
4174
-
4175
- class Google_Service_MyBusiness_ListQuestionsResponse extends Google_Collection {
4176
-
4177
- protected $collection_key = 'questions';
4178
- protected $internal_gapi_mappings = array(
4179
- );
4180
- public $nextPageToken;
4181
- protected $questionsType = 'Google_Service_MyBusiness_Question';
4182
- protected $questionsDataType = 'array';
4183
- public $totalSize;
4184
-
4185
-
4186
- public function setNextPageToken( $nextPageToken ) {
4187
- $this->nextPageToken = $nextPageToken;
4188
- }
4189
- public function getNextPageToken() {
4190
- return $this->nextPageToken;
4191
- }
4192
- public function setQuestions( $questions ) {
4193
- $this->questions = $questions;
4194
- }
4195
- public function getQuestions() {
4196
- return $this->questions;
4197
- }
4198
- public function setTotalSize( $totalSize ) {
4199
- $this->totalSize = $totalSize;
4200
- }
4201
- public function getTotalSize() {
4202
- return $this->totalSize;
4203
- }
4204
- }
4205
-
4206
- class Google_Service_MyBusiness_ListRecommendedGoogleLocationsResponse extends Google_Collection {
4207
-
4208
- protected $collection_key = 'googleLocations';
4209
- protected $internal_gapi_mappings = array(
4210
- );
4211
- protected $googleLocationsType = 'Google_Service_MyBusiness_GoogleLocation';
4212
- protected $googleLocationsDataType = 'array';
4213
- public $nextPageToken;
4214
- public $totalSize;
4215
-
4216
-
4217
- public function setGoogleLocations( $googleLocations ) {
4218
- $this->googleLocations = $googleLocations;
4219
- }
4220
- public function getGoogleLocations() {
4221
- return $this->googleLocations;
4222
- }
4223
- public function setNextPageToken( $nextPageToken ) {
4224
- $this->nextPageToken = $nextPageToken;
4225
- }
4226
- public function getNextPageToken() {
4227
- return $this->nextPageToken;
4228
- }
4229
- public function setTotalSize( $totalSize ) {
4230
- $this->totalSize = $totalSize;
4231
- }
4232
- public function getTotalSize() {
4233
- return $this->totalSize;
4234
- }
4235
- }
4236
-
4237
- class Google_Service_MyBusiness_ListReviewsResponse extends Google_Collection {
4238
-
4239
- protected $collection_key = 'reviews';
4240
- protected $internal_gapi_mappings = array(
4241
- );
4242
- public $averageRating;
4243
- public $nextPageToken;
4244
- protected $reviewsType = 'Google_Service_MyBusiness_Review';
4245
- protected $reviewsDataType = 'array';
4246
- public $totalReviewCount;
4247
-
4248
-
4249
- public function setAverageRating( $averageRating ) {
4250
- $this->averageRating = $averageRating;
4251
- }
4252
- public function getAverageRating() {
4253
- return $this->averageRating;
4254
- }
4255
- public function setNextPageToken( $nextPageToken ) {
4256
- $this->nextPageToken = $nextPageToken;
4257
- }
4258
- public function getNextPageToken() {
4259
- return $this->nextPageToken;
4260
- }
4261
- public function setReviews( $reviews ) {
4262
- $this->reviews = $reviews;
4263
- }
4264
- public function getReviews() {
4265
- return $this->reviews;
4266
- }
4267
- public function setTotalReviewCount( $totalReviewCount ) {
4268
- $this->totalReviewCount = $totalReviewCount;
4269
- }
4270
- public function getTotalReviewCount() {
4271
- return $this->totalReviewCount;
4272
- }
4273
- }
4274
-
4275
- class Google_Service_MyBusiness_ListVerificationsResponse extends Google_Collection {
4276
-
4277
- protected $collection_key = 'verifications';
4278
- protected $internal_gapi_mappings = array(
4279
- );
4280
- public $nextPageToken;
4281
- protected $verificationsType = 'Google_Service_MyBusiness_Verification';
4282
- protected $verificationsDataType = 'array';
4283
-
4284
-
4285
- public function setNextPageToken( $nextPageToken ) {
4286
- $this->nextPageToken = $nextPageToken;
4287
- }
4288
- public function getNextPageToken() {
4289
- return $this->nextPageToken;
4290
- }
4291
- public function setVerifications( $verifications ) {
4292
- $this->verifications = $verifications;
4293
- }
4294
- public function getVerifications() {
4295
- return $this->verifications;
4296
- }
4297
- }
4298
-
4299
- class Google_Service_MyBusiness_LocalPost extends Google_Collection {
4300
-
4301
- protected $collection_key = 'media';
4302
- protected $internal_gapi_mappings = array(
4303
- );
4304
- public $alertType;
4305
- protected $callToActionType = 'Google_Service_MyBusiness_CallToAction';
4306
- protected $callToActionDataType = '';
4307
- public $createTime;
4308
- protected $eventType = 'Google_Service_MyBusiness_LocalPostEvent';
4309
- protected $eventDataType = '';
4310
- public $languageCode;
4311
- protected $mediaType = 'Google_Service_MyBusiness_MediaItem';
4312
- protected $mediaDataType = 'array';
4313
- public $name;
4314
- protected $offerType = 'Google_Service_MyBusiness_LocalPostOffer';
4315
- protected $offerDataType = '';
4316
- public $searchUrl;
4317
- public $state;
4318
- public $summary;
4319
- public $topicType;
4320
- public $updateTime;
4321
-
4322
-
4323
- public function setAlertType( $alertType ) {
4324
- $this->alertType = $alertType;
4325
- }
4326
- public function getAlertType() {
4327
- return $this->alertType;
4328
- }
4329
- public function setCallToAction( Google_Service_MyBusiness_CallToAction $callToAction ) {
4330
- $this->callToAction = $callToAction;
4331
- }
4332
- public function getCallToAction() {
4333
- return $this->callToAction;
4334
- }
4335
- public function setCreateTime( $createTime ) {
4336
- $this->createTime = $createTime;
4337
- }
4338
- public function getCreateTime() {
4339
- return $this->createTime;
4340
- }
4341
- public function setEvent( Google_Service_MyBusiness_LocalPostEvent $event ) {
4342
- $this->event = $event;
4343
- }
4344
- public function getEvent() {
4345
- return $this->event;
4346
- }
4347
- public function setLanguageCode( $languageCode ) {
4348
- $this->languageCode = $languageCode;
4349
- }
4350
- public function getLanguageCode() {
4351
- return $this->languageCode;
4352
- }
4353
- public function setMedia( $media ) {
4354
- $this->media = $media;
4355
- }
4356
- public function getMedia() {
4357
- return $this->media;
4358
- }
4359
- public function setName( $name ) {
4360
- $this->name = $name;
4361
- }
4362
- public function getName() {
4363
- return $this->name;
4364
- }
4365
- public function setOffer( Google_Service_MyBusiness_LocalPostOffer $offer ) {
4366
- $this->offer = $offer;
4367
- }
4368
- public function getOffer() {
4369
- return $this->offer;
4370
- }
4371
- public function setSearchUrl( $searchUrl ) {
4372
- $this->searchUrl = $searchUrl;
4373
- }
4374
- public function getSearchUrl() {
4375
- return $this->searchUrl;
4376
- }
4377
- public function setState( $state ) {
4378
- $this->state = $state;
4379
- }
4380
- public function getState() {
4381
- return $this->state;
4382
- }
4383
- public function setSummary( $summary ) {
4384
- $this->summary = $summary;
4385
- }
4386
- public function getSummary() {
4387
- return $this->summary;
4388
- }
4389
- public function setTopicType( $topicType ) {
4390
- $this->topicType = $topicType;
4391
- }
4392
- public function getTopicType() {
4393
- return $this->topicType;
4394
- }
4395
- public function setUpdateTime( $updateTime ) {
4396
- $this->updateTime = $updateTime;
4397
- }
4398
- public function getUpdateTime() {
4399
- return $this->updateTime;
4400
- }
4401
- }
4402
-
4403
- class Google_Service_MyBusiness_LocalPostEvent extends Google_Model {
4404
-
4405
- protected $internal_gapi_mappings = array(
4406
- );
4407
- protected $scheduleType = 'Google_Service_MyBusiness_TimeInterval';
4408
- protected $scheduleDataType = '';
4409
- public $title;
4410
-
4411
-
4412
- public function setSchedule( Google_Service_MyBusiness_TimeInterval $schedule ) {
4413
- $this->schedule = $schedule;
4414
- }
4415
- public function getSchedule() {
4416
- return $this->schedule;
4417
- }
4418
- public function setTitle( $title ) {
4419
- $this->title = $title;
4420
- }
4421
- public function getTitle() {
4422
- return $this->title;
4423
- }
4424
- }
4425
-
4426
- class Google_Service_MyBusiness_LocalPostMetrics extends Google_Collection {
4427
-
4428
- protected $collection_key = 'metricValues';
4429
- protected $internal_gapi_mappings = array(
4430
- );
4431
- public $localPostName;
4432
- protected $metricValuesType = 'Google_Service_MyBusiness_MetricValue';
4433
- protected $metricValuesDataType = 'array';
4434
-
4435
-
4436
- public function setLocalPostName( $localPostName ) {
4437
- $this->localPostName = $localPostName;
4438
- }
4439
- public function getLocalPostName() {
4440
- return $this->localPostName;
4441
- }
4442
- public function setMetricValues( $metricValues ) {
4443
- $this->metricValues = $metricValues;
4444
- }
4445
- public function getMetricValues() {
4446
- return $this->metricValues;
4447
- }
4448
- }
4449
-
4450
- class Google_Service_MyBusiness_LocalPostOffer extends Google_Model {
4451
-
4452
- protected $internal_gapi_mappings = array(
4453
- );
4454
- public $couponCode;
4455
- public $redeemOnlineUrl;
4456
- public $termsConditions;
4457
-
4458
-
4459
- public function setCouponCode( $couponCode ) {
4460
- $this->couponCode = $couponCode;
4461
- }
4462
- public function getCouponCode() {
4463
- return $this->couponCode;
4464
- }
4465
- public function setRedeemOnlineUrl( $redeemOnlineUrl ) {
4466
- $this->redeemOnlineUrl = $redeemOnlineUrl;
4467
- }
4468
- public function getRedeemOnlineUrl() {
4469
- return $this->redeemOnlineUrl;
4470
- }
4471
- public function setTermsConditions( $termsConditions ) {
4472
- $this->termsConditions = $termsConditions;
4473
- }
4474
- public function getTermsConditions() {
4475
- return $this->termsConditions;
4476
- }
4477
- }
4478
-
4479
- class Google_Service_MyBusiness_Location extends Google_Collection {
4480
-
4481
- protected $collection_key = 'priceLists';
4482
- protected $internal_gapi_mappings = array(
4483
- );
4484
- protected $adWordsLocationExtensionsType = 'Google_Service_MyBusiness_AdWordsLocationExtensions';
4485
- protected $adWordsLocationExtensionsDataType = '';
4486
- protected $additionalCategoriesType = 'Google_Service_MyBusiness_Category';
4487
- protected $additionalCategoriesDataType = 'array';
4488
- public $additionalPhones;
4489
- protected $addressType = 'Google_Service_MyBusiness_PostalAddress';
4490
- protected $addressDataType = '';
4491
- protected $attributesType = 'Google_Service_MyBusiness_Attribute';
4492
- protected $attributesDataType = 'array';
4493
- public $labels;
4494
- public $languageCode;
4495
- protected $latlngType = 'Google_Service_MyBusiness_LatLng';
4496
- protected $latlngDataType = '';
4497
- protected $locationKeyType = 'Google_Service_MyBusiness_LocationKey';
4498
- protected $locationKeyDataType = '';
4499
- public $locationName;
4500
- protected $locationStateType = 'Google_Service_MyBusiness_LocationState';
4501
- protected $locationStateDataType = '';
4502
- protected $metadataType = 'Google_Service_MyBusiness_Metadata';
4503
- protected $metadataDataType = '';
4504
- public $name;
4505
- protected $openInfoType = 'Google_Service_MyBusiness_OpenInfo';
4506
- protected $openInfoDataType = '';
4507
- protected $priceListsType = 'Google_Service_MyBusiness_PriceList';
4508
- protected $priceListsDataType = 'array';
4509
- protected $primaryCategoryType = 'Google_Service_MyBusiness_Category';
4510
- protected $primaryCategoryDataType = '';
4511
- public $primaryPhone;
4512
- protected $profileType = 'Google_Service_MyBusiness_Profile';
4513
- protected $profileDataType = '';
4514
- protected $regularHoursType = 'Google_Service_MyBusiness_BusinessHours';
4515
- protected $regularHoursDataType = '';
4516
- protected $relationshipDataType = 'Google_Service_MyBusiness_RelationshipData';
4517
- protected $relationshipDataDataType = '';
4518
- protected $serviceAreaType = 'Google_Service_MyBusiness_ServiceAreaBusiness';
4519
- protected $serviceAreaDataType = '';
4520
- protected $specialHoursType = 'Google_Service_MyBusiness_SpecialHours';
4521
- protected $specialHoursDataType = '';
4522
- public $storeCode;
4523
- public $websiteUrl;
4524
-
4525
-
4526
- public function setAdWordsLocationExtensions( Google_Service_MyBusiness_AdWordsLocationExtensions $adWordsLocationExtensions ) {
4527
- $this->adWordsLocationExtensions = $adWordsLocationExtensions;
4528
- }
4529
- public function getAdWordsLocationExtensions() {
4530
- return $this->adWordsLocationExtensions;
4531
- }
4532
- public function setAdditionalCategories( $additionalCategories ) {
4533
- $this->additionalCategories = $additionalCategories;
4534
- }
4535
- public function getAdditionalCategories() {
4536
- return $this->additionalCategories;
4537
- }
4538
- public function setAdditionalPhones( $additionalPhones ) {
4539
- $this->additionalPhones = $additionalPhones;
4540
- }
4541
- public function getAdditionalPhones() {
4542
- return $this->additionalPhones;
4543
- }
4544
- public function setAddress( Google_Service_MyBusiness_PostalAddress $address ) {
4545
- $this->address = $address;
4546
- }
4547
- public function getAddress() {
4548
- return $this->address;
4549
- }
4550
- public function setAttributes( $attributes ) {
4551
- $this->attributes = $attributes;
4552
- }
4553
- public function getAttributes() {
4554
- return $this->attributes;
4555
- }
4556
- public function setLabels( $labels ) {
4557
- $this->labels = $labels;
4558
- }
4559
- public function getLabels() {
4560
- return $this->labels;
4561
- }
4562
- public function setLanguageCode( $languageCode ) {
4563
- $this->languageCode = $languageCode;
4564
- }
4565
- public function getLanguageCode() {
4566
- return $this->languageCode;
4567
- }
4568
- public function setLatlng( Google_Service_MyBusiness_LatLng $latlng ) {
4569
- $this->latlng = $latlng;
4570
- }
4571
- public function getLatlng() {
4572
- return $this->latlng;
4573
- }
4574
- public function setLocationKey( Google_Service_MyBusiness_LocationKey $locationKey ) {
4575
- $this->locationKey = $locationKey;
4576
- }
4577
- public function getLocationKey() {
4578
- return $this->locationKey;
4579
- }
4580
- public function setLocationName( $locationName ) {
4581
- $this->locationName = $locationName;
4582
- }
4583
- public function getLocationName() {
4584
- return $this->locationName;
4585
- }
4586
- public function setLocationState( Google_Service_MyBusiness_LocationState $locationState ) {
4587
- $this->locationState = $locationState;
4588
- }
4589
- public function getLocationState() {
4590
- return $this->locationState;
4591
- }
4592
- public function setMetadata( Google_Service_MyBusiness_Metadata $metadata ) {
4593
- $this->metadata = $metadata;
4594
- }
4595
- public function getMetadata() {
4596
- return $this->metadata;
4597
- }
4598
- public function setName( $name ) {
4599
- $this->name = $name;
4600
- }
4601
- public function getName() {
4602
- return $this->name;
4603
- }
4604
- public function setOpenInfo( Google_Service_MyBusiness_OpenInfo $openInfo ) {
4605
- $this->openInfo = $openInfo;
4606
- }
4607
- public function getOpenInfo() {
4608
- return $this->openInfo;
4609
- }
4610
- public function setPriceLists( $priceLists ) {
4611
- $this->priceLists = $priceLists;
4612
- }
4613
- public function getPriceLists() {
4614
- return $this->priceLists;
4615
- }
4616
- public function setPrimaryCategory( Google_Service_MyBusiness_Category $primaryCategory ) {
4617
- $this->primaryCategory = $primaryCategory;
4618
- }
4619
- public function getPrimaryCategory() {
4620
- return $this->primaryCategory;
4621
- }
4622
- public function setPrimaryPhone( $primaryPhone ) {
4623
- $this->primaryPhone = $primaryPhone;
4624
- }
4625
- public function getPrimaryPhone() {
4626
- return $this->primaryPhone;
4627
- }
4628
- public function setProfile( Google_Service_MyBusiness_Profile $profile ) {
4629
- $this->profile = $profile;
4630
- }
4631
- public function getProfile() {
4632
- return $this->profile;
4633
- }
4634
- public function setRegularHours( Google_Service_MyBusiness_BusinessHours $regularHours ) {
4635
- $this->regularHours = $regularHours;
4636
- }
4637
- public function getRegularHours() {
4638
- return $this->regularHours;
4639
- }
4640
- public function setRelationshipData( Google_Service_MyBusiness_RelationshipData $relationshipData ) {
4641
- $this->relationshipData = $relationshipData;
4642
- }
4643
- public function getRelationshipData() {
4644
- return $this->relationshipData;
4645
- }
4646
- public function setServiceArea( Google_Service_MyBusiness_ServiceAreaBusiness $serviceArea ) {
4647
- $this->serviceArea = $serviceArea;
4648
- }
4649
- public function getServiceArea() {
4650
- return $this->serviceArea;
4651
- }
4652
- public function setSpecialHours( Google_Service_MyBusiness_SpecialHours $specialHours ) {
4653
- $this->specialHours = $specialHours;
4654
- }
4655
- public function getSpecialHours() {
4656
- return $this->specialHours;
4657
- }
4658
- public function setStoreCode( $storeCode ) {
4659
- $this->storeCode = $storeCode;
4660
- }
4661
- public function getStoreCode() {
4662
- return $this->storeCode;
4663
- }
4664
- public function setWebsiteUrl( $websiteUrl ) {
4665
- $this->websiteUrl = $websiteUrl;
4666
- }
4667
- public function getWebsiteUrl() {
4668
- return $this->websiteUrl;
4669
- }
4670
- }
4671
-
4672
- class Google_Service_MyBusiness_LocationAssociation extends Google_Model {
4673
-
4674
- protected $internal_gapi_mappings = array(
4675
- );
4676
- public $category;
4677
- public $priceListItemId;
4678
-
4679
-
4680
- public function setCategory( $category ) {
4681
- $this->category = $category;
4682
- }
4683
- public function getCategory() {
4684
- return $this->category;
4685
- }
4686
- public function setPriceListItemId( $priceListItemId ) {
4687
- $this->priceListItemId = $priceListItemId;
4688
- }
4689
- public function getPriceListItemId() {
4690
- return $this->priceListItemId;
4691
- }
4692
- }
4693
-
4694
- class Google_Service_MyBusiness_LocationDrivingDirectionMetrics extends Google_Collection {
4695
-
4696
- protected $collection_key = 'topDirectionSources';
4697
- protected $internal_gapi_mappings = array(
4698
- );
4699
- public $locationName;
4700
- public $timeZone;
4701
- protected $topDirectionSourcesType = 'Google_Service_MyBusiness_TopDirectionSources';
4702
- protected $topDirectionSourcesDataType = 'array';
4703
-
4704
-
4705
- public function setLocationName( $locationName ) {
4706
- $this->locationName = $locationName;
4707
- }
4708
- public function getLocationName() {
4709
- return $this->locationName;
4710
- }
4711
- public function setTimeZone( $timeZone ) {
4712
- $this->timeZone = $timeZone;
4713
- }
4714
- public function getTimeZone() {
4715
- return $this->timeZone;
4716
- }
4717
- public function setTopDirectionSources( $topDirectionSources ) {
4718
- $this->topDirectionSources = $topDirectionSources;
4719
- }
4720
- public function getTopDirectionSources() {
4721
- return $this->topDirectionSources;
4722
- }
4723
- }
4724
-
4725
- class Google_Service_MyBusiness_LocationKey extends Google_Model {
4726
-
4727
- protected $internal_gapi_mappings = array(
4728
- );
4729
- public $explicitNoPlaceId;
4730
- public $placeId;
4731
- public $plusPageId;
4732
- public $requestId;
4733
-
4734
-
4735
- public function setExplicitNoPlaceId( $explicitNoPlaceId ) {
4736
- $this->explicitNoPlaceId = $explicitNoPlaceId;
4737
- }
4738
- public function getExplicitNoPlaceId() {
4739
- return $this->explicitNoPlaceId;
4740
- }
4741
- public function setPlaceId( $placeId ) {
4742
- $this->placeId = $placeId;
4743
- }
4744
- public function getPlaceId() {
4745
- return $this->placeId;
4746
- }
4747
- public function setPlusPageId( $plusPageId ) {
4748
- $this->plusPageId = $plusPageId;
4749
- }
4750
- public function getPlusPageId() {
4751
- return $this->plusPageId;
4752
- }
4753
- public function setRequestId( $requestId ) {
4754
- $this->requestId = $requestId;
4755
- }
4756
- public function getRequestId() {
4757
- return $this->requestId;
4758
- }
4759
- }
4760
-
4761
- class Google_Service_MyBusiness_LocationMetrics extends Google_Collection {
4762
-
4763
- protected $collection_key = 'metricValues';
4764
- protected $internal_gapi_mappings = array(
4765
- );
4766
- public $locationName;
4767
- protected $metricValuesType = 'Google_Service_MyBusiness_MetricValue';
4768
- protected $metricValuesDataType = 'array';
4769
- public $timeZone;
4770
-
4771
-
4772
- public function setLocationName( $locationName ) {
4773
- $this->locationName = $locationName;
4774
- }
4775
- public function getLocationName() {
4776
- return $this->locationName;
4777
- }
4778
- public function setMetricValues( $metricValues ) {
4779
- $this->metricValues = $metricValues;
4780
- }
4781
- public function getMetricValues() {
4782
- return $this->metricValues;
4783
- }
4784
- public function setTimeZone( $timeZone ) {
4785
- $this->timeZone = $timeZone;
4786
- }
4787
- public function getTimeZone() {
4788
- return $this->timeZone;
4789
- }
4790
- }
4791
-
4792
- class Google_Service_MyBusiness_LocationReview extends Google_Model {
4793
-
4794
- protected $internal_gapi_mappings = array(
4795
- );
4796
- public $name;
4797
- protected $reviewType = 'Google_Service_MyBusiness_Review';
4798
- protected $reviewDataType = '';
4799
-
4800
-
4801
- public function setName( $name ) {
4802
- $this->name = $name;
4803
- }
4804
- public function getName() {
4805
- return $this->name;
4806
- }
4807
- public function setReview( Google_Service_MyBusiness_Review $review ) {
4808
- $this->review = $review;
4809
- }
4810
- public function getReview() {
4811
- return $this->review;
4812
- }
4813
- }
4814
-
4815
- class Google_Service_MyBusiness_LocationState extends Google_Model {
4816
-
4817
- protected $internal_gapi_mappings = array(
4818
- );
4819
- public $canDelete;
4820
- public $canModifyServiceList;
4821
- public $canUpdate;
4822
- public $hasPendingEdits;
4823
- public $hasPendingVerification;
4824
- public $isDisabled;
4825
- public $isDisconnected;
4826
- public $isDuplicate;
4827
- public $isGoogleUpdated;
4828
- public $isLocalPostApiDisabled;
4829
- public $isPendingReview;
4830
- public $isPublished;
4831
- public $isSuspended;
4832
- public $isVerified;
4833
- public $needsReverification;
4834
-
4835
-
4836
- public function setCanDelete( $canDelete ) {
4837
- $this->canDelete = $canDelete;
4838
- }
4839
- public function getCanDelete() {
4840
- return $this->canDelete;
4841
- }
4842
- public function setCanModifyServiceList( $canModifyServiceList ) {
4843
- $this->canModifyServiceList = $canModifyServiceList;
4844
- }
4845
- public function getCanModifyServiceList() {
4846
- return $this->canModifyServiceList;
4847
- }
4848
- public function setCanUpdate( $canUpdate ) {
4849
- $this->canUpdate = $canUpdate;
4850
- }
4851
- public function getCanUpdate() {
4852
- return $this->canUpdate;
4853
- }
4854
- public function setHasPendingEdits( $hasPendingEdits ) {
4855
- $this->hasPendingEdits = $hasPendingEdits;
4856
- }
4857
- public function getHasPendingEdits() {
4858
- return $this->hasPendingEdits;
4859
- }
4860
- public function setHasPendingVerification( $hasPendingVerification ) {
4861
- $this->hasPendingVerification = $hasPendingVerification;
4862
- }
4863
- public function getHasPendingVerification() {
4864
- return $this->hasPendingVerification;
4865
- }
4866
- public function setIsDisabled( $isDisabled ) {
4867
- $this->isDisabled = $isDisabled;
4868
- }
4869
- public function getIsDisabled() {
4870
- return $this->isDisabled;
4871
- }
4872
- public function setIsDisconnected( $isDisconnected ) {
4873
- $this->isDisconnected = $isDisconnected;
4874
- }
4875
- public function getIsDisconnected() {
4876
- return $this->isDisconnected;
4877
- }
4878
- public function setIsDuplicate( $isDuplicate ) {
4879
- $this->isDuplicate = $isDuplicate;
4880
- }
4881
- public function getIsDuplicate() {
4882
- return $this->isDuplicate;
4883
- }
4884
- public function setIsGoogleUpdated( $isGoogleUpdated ) {
4885
- $this->isGoogleUpdated = $isGoogleUpdated;
4886
- }
4887
- public function getIsGoogleUpdated() {
4888
- return $this->isGoogleUpdated;
4889
- }
4890
- public function setIsLocalPostApiDisabled( $isLocalPostApiDisabled ) {
4891
- $this->isLocalPostApiDisabled = $isLocalPostApiDisabled;
4892
- }
4893
- public function getIsLocalPostApiDisabled() {
4894
- return $this->isLocalPostApiDisabled;
4895
- }
4896
- public function setIsPendingReview( $isPendingReview ) {
4897
- $this->isPendingReview = $isPendingReview;
4898
- }
4899
- public function getIsPendingReview() {
4900
- return $this->isPendingReview;
4901
- }
4902
- public function setIsPublished( $isPublished ) {
4903
- $this->isPublished = $isPublished;
4904
- }
4905
- public function getIsPublished() {
4906
- return $this->isPublished;
4907
- }
4908
- public function setIsSuspended( $isSuspended ) {
4909
- $this->isSuspended = $isSuspended;
4910
- }
4911
- public function getIsSuspended() {
4912
- return $this->isSuspended;
4913
- }
4914
- public function setIsVerified( $isVerified ) {
4915
- $this->isVerified = $isVerified;
4916
- }
4917
- public function getIsVerified() {
4918
- return $this->isVerified;
4919
- }
4920
- public function setNeedsReverification( $needsReverification ) {
4921
- $this->needsReverification = $needsReverification;
4922
- }
4923
- public function getNeedsReverification() {
4924
- return $this->needsReverification;
4925
- }
4926
- }
4927
-
4928
- class Google_Service_MyBusiness_MatchedLocation extends Google_Model {
4929
-
4930
- protected $internal_gapi_mappings = array(
4931
- );
4932
- public $isExactMatch;
4933
- protected $locationType = 'Google_Service_MyBusiness_Location';
4934
- protected $locationDataType = '';
4935
-
4936
-
4937
- public function setIsExactMatch( $isExactMatch ) {
4938
- $this->isExactMatch = $isExactMatch;
4939
- }
4940
- public function getIsExactMatch() {
4941
- return $this->isExactMatch;
4942
- }
4943
- public function setLocation( Google_Service_MyBusiness_Location $location ) {
4944
- $this->location = $location;
4945
- }
4946
- public function getLocation() {
4947
- return $this->location;
4948
- }
4949
- }
4950
-
4951
- class Google_Service_MyBusiness_MediaInsights extends Google_Model {
4952
-
4953
- protected $internal_gapi_mappings = array(
4954
- );
4955
- public $viewCount;
4956
-
4957
-
4958
- public function setViewCount( $viewCount ) {
4959
- $this->viewCount = $viewCount;
4960
- }
4961
- public function getViewCount() {
4962
- return $this->viewCount;
4963
- }
4964
- }
4965
-
4966
- class Google_Service_MyBusiness_MediaItem extends Google_Model {
4967
-
4968
- protected $internal_gapi_mappings = array(
4969
- );
4970
- protected $attributionType = 'Google_Service_MyBusiness_Attribution';
4971
- protected $attributionDataType = '';
4972
- public $createTime;
4973
- protected $dataRefType = 'Google_Service_MyBusiness_MediaItemDataRef';
4974
- protected $dataRefDataType = '';
4975
- public $description;
4976
- protected $dimensionsType = 'Google_Service_MyBusiness_Dimensions';
4977
- protected $dimensionsDataType = '';
4978
- public $googleUrl;
4979
- protected $insightsType = 'Google_Service_MyBusiness_MediaInsights';
4980
- protected $insightsDataType = '';
4981
- protected $locationAssociationType = 'Google_Service_MyBusiness_LocationAssociation';
4982
- protected $locationAssociationDataType = '';
4983
- public $mediaFormat;
4984
- public $name;
4985
- public $sourceUrl;
4986
- public $thumbnailUrl;
4987
-
4988
-
4989
- public function setAttribution( Google_Service_MyBusiness_Attribution $attribution ) {
4990
- $this->attribution = $attribution;
4991
- }
4992
- public function getAttribution() {
4993
- return $this->attribution;
4994
- }
4995
- public function setCreateTime( $createTime ) {
4996
- $this->createTime = $createTime;
4997
- }
4998
- public function getCreateTime() {
4999
- return $this->createTime;
5000
- }
5001
- public function setDataRef( Google_Service_MyBusiness_MediaItemDataRef $dataRef ) {
5002
- $this->dataRef = $dataRef;
5003
- }
5004
- public function getDataRef() {
5005
- return $this->dataRef;
5006
- }
5007
- public function setDescription( $description ) {
5008
- $this->description = $description;
5009
- }
5010
- public function getDescription() {
5011
- return $this->description;
5012
- }
5013
- public function setDimensions( Google_Service_MyBusiness_Dimensions $dimensions ) {
5014
- $this->dimensions = $dimensions;
5015
- }
5016
- public function getDimensions() {
5017
- return $this->dimensions;
5018
- }
5019
- public function setGoogleUrl( $googleUrl ) {
5020
- $this->googleUrl = $googleUrl;
5021
- }
5022
- public function getGoogleUrl() {
5023
- return $this->googleUrl;
5024
- }
5025
- public function setInsights( Google_Service_MyBusiness_MediaInsights $insights ) {
5026
- $this->insights = $insights;
5027
- }
5028
- public function getInsights() {
5029
- return $this->insights;
5030
- }
5031
- public function setLocationAssociation( Google_Service_MyBusiness_LocationAssociation $locationAssociation ) {
5032
- $this->locationAssociation = $locationAssociation;
5033
- }
5034
- public function getLocationAssociation() {
5035
- return $this->locationAssociation;
5036
- }
5037
- public function setMediaFormat( $mediaFormat ) {
5038
- $this->mediaFormat = $mediaFormat;
5039
- }
5040
- public function getMediaFormat() {
5041
- return $this->mediaFormat;
5042
- }
5043
- public function setName( $name ) {
5044
- $this->name = $name;
5045
- }
5046
- public function getName() {
5047
- return $this->name;
5048
- }
5049
- public function setSourceUrl( $sourceUrl ) {
5050
- $this->sourceUrl = $sourceUrl;
5051
- }
5052
- public function getSourceUrl() {
5053
- return $this->sourceUrl;
5054
- }
5055
- public function setThumbnailUrl( $thumbnailUrl ) {
5056
- $this->thumbnailUrl = $thumbnailUrl;
5057
- }
5058
- public function getThumbnailUrl() {
5059
- return $this->thumbnailUrl;
5060
- }
5061
- }
5062
-
5063
- class Google_Service_MyBusiness_MediaItemDataRef extends Google_Model {
5064
-
5065
- protected $internal_gapi_mappings = array(
5066
- );
5067
- public $resourceName;
5068
-
5069
-
5070
- public function setResourceName( $resourceName ) {
5071
- $this->resourceName = $resourceName;
5072
- }
5073
- public function getResourceName() {
5074
- return $this->resourceName;
5075
- }
5076
- }
5077
-
5078
- class Google_Service_MyBusiness_Metadata extends Google_Model {
5079
-
5080
- protected $internal_gapi_mappings = array(
5081
- );
5082
- protected $duplicateType = 'Google_Service_MyBusiness_Duplicate';
5083
- protected $duplicateDataType = '';
5084
- public $mapsUrl;
5085
- public $newReviewUrl;
5086
-
5087
-
5088
- public function setDuplicate( Google_Service_MyBusiness_Duplicate $duplicate ) {
5089
- $this->duplicate = $duplicate;
5090
- }
5091
- public function getDuplicate() {
5092
- return $this->duplicate;
5093
- }
5094
- public function setMapsUrl( $mapsUrl ) {
5095
- $this->mapsUrl = $mapsUrl;
5096
- }
5097
- public function getMapsUrl() {
5098
- return $this->mapsUrl;
5099
- }
5100
- public function setNewReviewUrl( $newReviewUrl ) {
5101
- $this->newReviewUrl = $newReviewUrl;
5102
- }
5103
- public function getNewReviewUrl() {
5104
- return $this->newReviewUrl;
5105
- }
5106
- }
5107
-
5108
- class Google_Service_MyBusiness_MetricRequest extends Google_Collection {
5109
-
5110
- protected $collection_key = 'options';
5111
- protected $internal_gapi_mappings = array(
5112
- );
5113
- public $metric;
5114
- public $options;
5115
-
5116
-
5117
- public function setMetric( $metric ) {
5118
- $this->metric = $metric;
5119
- }
5120
- public function getMetric() {
5121
- return $this->metric;
5122
- }
5123
- public function setOptions( $options ) {
5124
- $this->options = $options;
5125
- }
5126
- public function getOptions() {
5127
- return $this->options;
5128
- }
5129
- }
5130
-
5131
- class Google_Service_MyBusiness_MetricValue extends Google_Collection {
5132
-
5133
- protected $collection_key = 'dimensionalValues';
5134
- protected $internal_gapi_mappings = array(
5135
- );
5136
- protected $dimensionalValuesType = 'Google_Service_MyBusiness_DimensionalMetricValue';
5137
- protected $dimensionalValuesDataType = 'array';
5138
- public $metric;
5139
- protected $totalValueType = 'Google_Service_MyBusiness_DimensionalMetricValue';
5140
- protected $totalValueDataType = '';
5141
-
5142
-
5143
- public function setDimensionalValues( $dimensionalValues ) {
5144
- $this->dimensionalValues = $dimensionalValues;
5145
- }
5146
- public function getDimensionalValues() {
5147
- return $this->dimensionalValues;
5148
- }
5149
- public function setMetric( $metric ) {
5150
- $this->metric = $metric;
5151
- }
5152
- public function getMetric() {
5153
- return $this->metric;
5154
- }
5155
- public function setTotalValue( Google_Service_MyBusiness_DimensionalMetricValue $totalValue ) {
5156
- $this->totalValue = $totalValue;
5157
- }
5158
- public function getTotalValue() {
5159
- return $this->totalValue;
5160
- }
5161
- }
5162
-
5163
- class Google_Service_MyBusiness_Money extends Google_Model {
5164
-
5165
- protected $internal_gapi_mappings = array(
5166
- );
5167
- public $currencyCode;
5168
- public $nanos;
5169
- public $units;
5170
-
5171
-
5172
- public function setCurrencyCode( $currencyCode ) {
5173
- $this->currencyCode = $currencyCode;
5174
- }
5175
- public function getCurrencyCode() {
5176
- return $this->currencyCode;
5177
- }
5178
- public function setNanos( $nanos ) {
5179
- $this->nanos = $nanos;
5180
- }
5181
- public function getNanos() {
5182
- return $this->nanos;
5183
- }
5184
- public function setUnits( $units ) {
5185
- $this->units = $units;
5186
- }
5187
- public function getUnits() {
5188
- return $this->units;
5189
- }
5190
- }
5191
-
5192
- class Google_Service_MyBusiness_MybusinessEmpty extends Google_Model {
5193
-
5194
- }
5195
-
5196
- class Google_Service_MyBusiness_Notifications extends Google_Collection {
5197
-
5198
- protected $collection_key = 'notificationTypes';
5199
- protected $internal_gapi_mappings = array(
5200
- );
5201
- public $name;
5202
- public $notificationTypes;
5203
- public $topicName;
5204
-
5205
-
5206
- public function setName( $name ) {
5207
- $this->name = $name;
5208
- }
5209
- public function getName() {
5210
- return $this->name;
5211
- }
5212
- public function setNotificationTypes( $notificationTypes ) {
5213
- $this->notificationTypes = $notificationTypes;
5214
- }
5215
- public function getNotificationTypes() {
5216
- return $this->notificationTypes;
5217
- }
5218
- public function setTopicName( $topicName ) {
5219
- $this->topicName = $topicName;
5220
- }
5221
- public function getTopicName() {
5222
- return $this->topicName;
5223
- }
5224
- }
5225
-
5226
- class Google_Service_MyBusiness_OpenInfo extends Google_Model {
5227
-
5228
- protected $internal_gapi_mappings = array(
5229
- );
5230
- public $canReopen;
5231
- protected $openingDateType = 'Google_Service_MyBusiness_Date';
5232
- protected $openingDateDataType = '';
5233
- public $status;
5234
-
5235
-
5236
- public function setCanReopen( $canReopen ) {
5237
- $this->canReopen = $canReopen;
5238
- }
5239
- public function getCanReopen() {
5240
- return $this->canReopen;
5241
- }
5242
- public function setOpeningDate( Google_Service_MyBusiness_Date $openingDate ) {
5243
- $this->openingDate = $openingDate;
5244
- }
5245
- public function getOpeningDate() {
5246
- return $this->openingDate;
5247
- }
5248
- public function setStatus( $status ) {
5249
- $this->status = $status;
5250
- }
5251
- public function getStatus() {
5252
- return $this->status;
5253
- }
5254
- }
5255
-
5256
- class Google_Service_MyBusiness_OrganizationInfo extends Google_Model {
5257
-
5258
- protected $internal_gapi_mappings = array(
5259
- );
5260
- public $phoneNumber;
5261
- protected $postalAddressType = 'Google_Service_MyBusiness_PostalAddress';
5262
- protected $postalAddressDataType = '';
5263
- public $registeredDomain;
5264
-
5265
-
5266
- public function setPhoneNumber( $phoneNumber ) {
5267
- $this->phoneNumber = $phoneNumber;
5268
- }
5269
- public function getPhoneNumber() {
5270
- return $this->phoneNumber;
5271
- }
5272
- public function setPostalAddress( Google_Service_MyBusiness_PostalAddress $postalAddress ) {
5273
- $this->postalAddress = $postalAddress;
5274
- }
5275
- public function getPostalAddress() {
5276
- return $this->postalAddress;
5277
- }
5278
- public function setRegisteredDomain( $registeredDomain ) {
5279
- $this->registeredDomain = $registeredDomain;
5280
- }
5281
- public function getRegisteredDomain() {
5282
- return $this->registeredDomain;
5283
- }
5284
- }
5285
-
5286
- class Google_Service_MyBusiness_PhoneInput extends Google_Model {
5287
-
5288
- protected $internal_gapi_mappings = array(
5289
- );
5290
- public $phoneNumber;
5291
-
5292
-
5293
- public function setPhoneNumber( $phoneNumber ) {
5294
- $this->phoneNumber = $phoneNumber;
5295
- }
5296
- public function getPhoneNumber() {
5297
- return $this->phoneNumber;
5298
- }
5299
- }
5300
-
5301
- class Google_Service_MyBusiness_PhoneVerificationData extends Google_Model {
5302
-
5303
- protected $internal_gapi_mappings = array(
5304
- );
5305
- public $phoneNumber;
5306
-
5307
-
5308
- public function setPhoneNumber( $phoneNumber ) {
5309
- $this->phoneNumber = $phoneNumber;
5310
- }
5311
- public function getPhoneNumber() {
5312
- return $this->phoneNumber;
5313
- }
5314
- }
5315
-
5316
- class Google_Service_MyBusiness_PlaceInfo extends Google_Model {
5317
-
5318
- protected $internal_gapi_mappings = array(
5319
- );
5320
- public $name;
5321
- public $placeId;
5322
-
5323
-
5324
- public function setName( $name ) {
5325
- $this->name = $name;
5326
- }
5327
- public function getName() {
5328
- return $this->name;
5329
- }
5330
- public function setPlaceId( $placeId ) {
5331
- $this->placeId = $placeId;
5332
- }
5333
- public function getPlaceId() {
5334
- return $this->placeId;
5335
- }
5336
- }
5337
-
5338
- class Google_Service_MyBusiness_Places extends Google_Collection {
5339
-
5340
- protected $collection_key = 'placeInfos';
5341
- protected $internal_gapi_mappings = array(
5342
- );
5343
- protected $placeInfosType = 'Google_Service_MyBusiness_PlaceInfo';
5344
- protected $placeInfosDataType = 'array';
5345
-
5346
-
5347
- public function setPlaceInfos( $placeInfos ) {
5348
- $this->placeInfos = $placeInfos;
5349
- }
5350
- public function getPlaceInfos() {
5351
- return $this->placeInfos;
5352
- }
5353
- }
5354
-
5355
- class Google_Service_MyBusiness_PointRadius extends Google_Model {
5356
-
5357
- protected $internal_gapi_mappings = array(
5358
- );
5359
- protected $latlngType = 'Google_Service_MyBusiness_LatLng';
5360
- protected $latlngDataType = '';
5361
- public $radiusKm;
5362
-
5363
-
5364
- public function setLatlng( Google_Service_MyBusiness_LatLng $latlng ) {
5365
- $this->latlng = $latlng;
5366
- }
5367
- public function getLatlng() {
5368
- return $this->latlng;
5369
- }
5370
- public function setRadiusKm( $radiusKm ) {
5371
- $this->radiusKm = $radiusKm;
5372
- }
5373
- public function getRadiusKm() {
5374
- return $this->radiusKm;
5375
- }
5376
- }
5377
-
5378
- class Google_Service_MyBusiness_PostalAddress extends Google_Collection {
5379
-
5380
- protected $collection_key = 'recipients';
5381
- protected $internal_gapi_mappings = array(
5382
- );
5383
- public $addressLines;
5384
- public $administrativeArea;
5385
- public $languageCode;
5386
- public $locality;
5387
- public $organization;
5388
- public $postalCode;
5389
- public $recipients;
5390
- public $regionCode;
5391
- public $revision;
5392
- public $sortingCode;
5393
- public $sublocality;
5394
-
5395
-
5396
- public function setAddressLines( $addressLines ) {
5397
- $this->addressLines = $addressLines;
5398
- }
5399
- public function getAddressLines() {
5400
- return $this->addressLines;
5401
- }
5402
- public function setAdministrativeArea( $administrativeArea ) {
5403
- $this->administrativeArea = $administrativeArea;
5404
- }
5405
- public function getAdministrativeArea() {
5406
- return $this->administrativeArea;
5407
- }
5408
- public function setLanguageCode( $languageCode ) {
5409
- $this->languageCode = $languageCode;
5410
- }
5411
- public function getLanguageCode() {
5412
- return $this->languageCode;
5413
- }
5414
- public function setLocality( $locality ) {
5415
- $this->locality = $locality;
5416
- }
5417
- public function getLocality() {
5418
- return $this->locality;
5419
- }
5420
- public function setOrganization( $organization ) {
5421
- $this->organization = $organization;
5422
- }
5423
- public function getOrganization() {
5424
- return $this->organization;
5425
- }
5426
- public function setPostalCode( $postalCode ) {
5427
- $this->postalCode = $postalCode;
5428
- }
5429
- public function getPostalCode() {
5430
- return $this->postalCode;
5431
- }
5432
- public function setRecipients( $recipients ) {
5433
- $this->recipients = $recipients;
5434
- }
5435
- public function getRecipients() {
5436
- return $this->recipients;
5437
- }
5438
- public function setRegionCode( $regionCode ) {
5439
- $this->regionCode = $regionCode;
5440
- }
5441
- public function getRegionCode() {
5442
- return $this->regionCode;
5443
- }
5444
- public function setRevision( $revision ) {
5445
- $this->revision = $revision;
5446
- }
5447
- public function getRevision() {
5448
- return $this->revision;
5449
- }
5450
- public function setSortingCode( $sortingCode ) {
5451
- $this->sortingCode = $sortingCode;
5452
- }
5453
- public function getSortingCode() {
5454
- return $this->sortingCode;
5455
- }
5456
- public function setSublocality( $sublocality ) {
5457
- $this->sublocality = $sublocality;
5458
- }
5459
- public function getSublocality() {
5460
- return $this->sublocality;
5461
- }
5462
- }
5463
-
5464
- class Google_Service_MyBusiness_PriceList extends Google_Collection {
5465
-
5466
- protected $collection_key = 'sections';
5467
- protected $internal_gapi_mappings = array(
5468
- );
5469
- protected $labelsType = 'Google_Service_MyBusiness_Label';
5470
- protected $labelsDataType = 'array';
5471
- public $priceListId;
5472
- protected $sectionsType = 'Google_Service_MyBusiness_Section';
5473
- protected $sectionsDataType = 'array';
5474
- public $sourceUrl;
5475
-
5476
-
5477
- public function setLabels( $labels ) {
5478
- $this->labels = $labels;
5479
- }
5480
- public function getLabels() {
5481
- return $this->labels;
5482
- }
5483
- public function setPriceListId( $priceListId ) {
5484
- $this->priceListId = $priceListId;
5485
- }
5486
- public function getPriceListId() {
5487
- return $this->priceListId;
5488
- }
5489
- public function setSections( $sections ) {
5490
- $this->sections = $sections;
5491
- }
5492
- public function getSections() {
5493
- return $this->sections;
5494
- }
5495
- public function setSourceUrl( $sourceUrl ) {
5496
- $this->sourceUrl = $sourceUrl;
5497
- }
5498
- public function getSourceUrl() {
5499
- return $this->sourceUrl;
5500
- }
5501
- }
5502
-
5503
- class Google_Service_MyBusiness_Profile extends Google_Model {
5504
-
5505
- protected $internal_gapi_mappings = array(
5506
- );
5507
- public $description;
5508
-
5509
-
5510
- public function setDescription( $description ) {
5511
- $this->description = $description;
5512
- }
5513
- public function getDescription() {
5514
- return $this->description;
5515
- }
5516
- }
5517
-
5518
- class Google_Service_MyBusiness_Question extends Google_Collection {
5519
-
5520
- protected $collection_key = 'topAnswers';
5521
- protected $internal_gapi_mappings = array(
5522
- );
5523
- protected $authorType = 'Google_Service_MyBusiness_Author';
5524
- protected $authorDataType = '';
5525
- public $createTime;
5526
- public $name;
5527
- public $text;
5528
- protected $topAnswersType = 'Google_Service_MyBusiness_Answer';
5529
- protected $topAnswersDataType = 'array';
5530
- public $totalAnswerCount;
5531
- public $updateTime;
5532
- public $upvoteCount;
5533
-
5534
-
5535
- public function setAuthor( Google_Service_MyBusiness_Author $author ) {
5536
- $this->author = $author;
5537
- }
5538
- public function getAuthor() {
5539
- return $this->author;
5540
- }
5541
- public function setCreateTime( $createTime ) {
5542
- $this->createTime = $createTime;
5543
- }
5544
- public function getCreateTime() {
5545
- return $this->createTime;
5546
- }
5547
- public function setName( $name ) {
5548
- $this->name = $name;
5549
- }
5550
- public function getName() {
5551
- return $this->name;
5552
- }
5553
- public function setText( $text ) {
5554
- $this->text = $text;
5555
- }
5556
- public function getText() {
5557
- return $this->text;
5558
- }
5559
- public function setTopAnswers( $topAnswers ) {
5560
- $this->topAnswers = $topAnswers;
5561
- }
5562
- public function getTopAnswers() {
5563
- return $this->topAnswers;
5564
- }
5565
- public function setTotalAnswerCount( $totalAnswerCount ) {
5566
- $this->totalAnswerCount = $totalAnswerCount;
5567
- }
5568
- public function getTotalAnswerCount() {
5569
- return $this->totalAnswerCount;
5570
- }
5571
- public function setUpdateTime( $updateTime ) {
5572
- $this->updateTime = $updateTime;
5573
- }
5574
- public function getUpdateTime() {
5575
- return $this->updateTime;
5576
- }
5577
- public function setUpvoteCount( $upvoteCount ) {
5578
- $this->upvoteCount = $upvoteCount;
5579
- }
5580
- public function getUpvoteCount() {
5581
- return $this->upvoteCount;
5582
- }
5583
- }
5584
-
5585
- class Google_Service_MyBusiness_RegionCount extends Google_Model {
5586
-
5587
- protected $internal_gapi_mappings = array(
5588
- );
5589
- public $count;
5590
- public $label;
5591
- protected $latlngType = 'Google_Service_MyBusiness_LatLng';
5592
- protected $latlngDataType = '';
5593
-
5594
-
5595
- public function setCount( $count ) {
5596
- $this->count = $count;
5597
- }
5598
- public function getCount() {
5599
- return $this->count;
5600
- }
5601
- public function setLabel( $label ) {
5602
- $this->label = $label;
5603
- }
5604
- public function getLabel() {
5605
- return $this->label;
5606
- }
5607
- public function setLatlng( Google_Service_MyBusiness_LatLng $latlng ) {
5608
- $this->latlng = $latlng;
5609
- }
5610
- public function getLatlng() {
5611
- return $this->latlng;
5612
- }
5613
- }
5614
-
5615
- class Google_Service_MyBusiness_RelationshipData extends Google_Model {
5616
-
5617
- protected $internal_gapi_mappings = array(
5618
- );
5619
- public $parentChain;
5620
-
5621
-
5622
- public function setParentChain( $parentChain ) {
5623
- $this->parentChain = $parentChain;
5624
- }
5625
- public function getParentChain() {
5626
- return $this->parentChain;
5627
- }
5628
- }
5629
-
5630
- class Google_Service_MyBusiness_RepeatedEnumAttributeValue extends Google_Collection {
5631
-
5632
- protected $collection_key = 'unsetValues';
5633
- protected $internal_gapi_mappings = array(
5634
- );
5635
- public $setValues;
5636
- public $unsetValues;
5637
-
5638
-
5639
- public function setSetValues( $setValues ) {
5640
- $this->setValues = $setValues;
5641
- }
5642
- public function getSetValues() {
5643
- return $this->setValues;
5644
- }
5645
- public function setUnsetValues( $unsetValues ) {
5646
- $this->unsetValues = $unsetValues;
5647
- }
5648
- public function getUnsetValues() {
5649
- return $this->unsetValues;
5650
- }
5651
- }
5652
-
5653
- class Google_Service_MyBusiness_ReportGoogleLocationRequest extends Google_Model {
5654
-
5655
- protected $internal_gapi_mappings = array(
5656
- );
5657
- public $locationGroupName;
5658
- public $reportReasonBadLocation;
5659
- public $reportReasonBadRecommendation;
5660
- public $reportReasonElaboration;
5661
- public $reportReasonLanguageCode;
5662
-
5663
-
5664
- public function setLocationGroupName( $locationGroupName ) {
5665
- $this->locationGroupName = $locationGroupName;
5666
- }
5667
- public function getLocationGroupName() {
5668
- return $this->locationGroupName;
5669
- }
5670
- public function setReportReasonBadLocation( $reportReasonBadLocation ) {
5671
- $this->reportReasonBadLocation = $reportReasonBadLocation;
5672
- }
5673
- public function getReportReasonBadLocation() {
5674
- return $this->reportReasonBadLocation;
5675
- }
5676
- public function setReportReasonBadRecommendation( $reportReasonBadRecommendation ) {
5677
- $this->reportReasonBadRecommendation = $reportReasonBadRecommendation;
5678
- }
5679
- public function getReportReasonBadRecommendation() {
5680
- return $this->reportReasonBadRecommendation;
5681
- }
5682
- public function setReportReasonElaboration( $reportReasonElaboration ) {
5683
- $this->reportReasonElaboration = $reportReasonElaboration;
5684
- }
5685
- public function getReportReasonElaboration() {
5686
- return $this->reportReasonElaboration;
5687
- }
5688
- public function setReportReasonLanguageCode( $reportReasonLanguageCode ) {
5689
- $this->reportReasonLanguageCode = $reportReasonLanguageCode;
5690
- }
5691
- public function getReportReasonLanguageCode() {
5692
- return $this->reportReasonLanguageCode;
5693
- }
5694
- }
5695
-
5696
- class Google_Service_MyBusiness_ReportLocalPostInsightsRequest extends Google_Collection {
5697
-
5698
- protected $collection_key = 'localPostNames';
5699
- protected $internal_gapi_mappings = array(
5700
- );
5701
- protected $basicRequestType = 'Google_Service_MyBusiness_BasicMetricsRequest';
5702
- protected $basicRequestDataType = '';
5703
- public $localPostNames;
5704
-
5705
-
5706
- public function setBasicRequest( Google_Service_MyBusiness_BasicMetricsRequest $basicRequest ) {
5707
- $this->basicRequest = $basicRequest;
5708
- }
5709
- public function getBasicRequest() {
5710
- return $this->basicRequest;
5711
- }
5712
- public function setLocalPostNames( $localPostNames ) {
5713
- $this->localPostNames = $localPostNames;
5714
- }
5715
- public function getLocalPostNames() {
5716
- return $this->localPostNames;
5717
- }
5718
- }
5719
-
5720
- class Google_Service_MyBusiness_ReportLocalPostInsightsResponse extends Google_Collection {
5721
-
5722
- protected $collection_key = 'localPostMetrics';
5723
- protected $internal_gapi_mappings = array(
5724
- );
5725
- protected $localPostMetricsType = 'Google_Service_MyBusiness_LocalPostMetrics';
5726
- protected $localPostMetricsDataType = 'array';
5727
- public $name;
5728
- public $timeZone;
5729
-
5730
-
5731
- public function setLocalPostMetrics( $localPostMetrics ) {
5732
- $this->localPostMetrics = $localPostMetrics;
5733
- }
5734
- public function getLocalPostMetrics() {
5735
- return $this->localPostMetrics;
5736
- }
5737
- public function setName( $name ) {
5738
- $this->name = $name;
5739
- }
5740
- public function getName() {
5741
- return $this->name;
5742
- }
5743
- public function setTimeZone( $timeZone ) {
5744
- $this->timeZone = $timeZone;
5745
- }
5746
- public function getTimeZone() {
5747
- return $this->timeZone;
5748
- }
5749
- }
5750
-
5751
- class Google_Service_MyBusiness_ReportLocationInsightsRequest extends Google_Collection {
5752
-
5753
- protected $collection_key = 'locationNames';
5754
- protected $internal_gapi_mappings = array(
5755
- );
5756
- protected $basicRequestType = 'Google_Service_MyBusiness_BasicMetricsRequest';
5757
- protected $basicRequestDataType = '';
5758
- protected $drivingDirectionsRequestType = 'Google_Service_MyBusiness_DrivingDirectionMetricsRequest';
5759
- protected $drivingDirectionsRequestDataType = '';
5760
- public $locationNames;
5761
-
5762
-
5763
- public function setBasicRequest( Google_Service_MyBusiness_BasicMetricsRequest $basicRequest ) {
5764
- $this->basicRequest = $basicRequest;
5765
- }
5766
- public function getBasicRequest() {
5767
- return $this->basicRequest;
5768
- }
5769
- public function setDrivingDirectionsRequest( Google_Service_MyBusiness_DrivingDirectionMetricsRequest $drivingDirectionsRequest ) {
5770
- $this->drivingDirectionsRequest = $drivingDirectionsRequest;
5771
- }
5772
- public function getDrivingDirectionsRequest() {
5773
- return $this->drivingDirectionsRequest;
5774
- }
5775
- public function setLocationNames( $locationNames ) {
5776
- $this->locationNames = $locationNames;
5777
- }
5778
- public function getLocationNames() {
5779
- return $this->locationNames;
5780
- }
5781
- }
5782
-
5783
- class Google_Service_MyBusiness_ReportLocationInsightsResponse extends Google_Collection {
5784
-
5785
- protected $collection_key = 'locationMetrics';
5786
- protected $internal_gapi_mappings = array(
5787
- );
5788
- protected $locationDrivingDirectionMetricsType = 'Google_Service_MyBusiness_LocationDrivingDirectionMetrics';
5789
- protected $locationDrivingDirectionMetricsDataType = 'array';
5790
- protected $locationMetricsType = 'Google_Service_MyBusiness_LocationMetrics';
5791
- protected $locationMetricsDataType = 'array';
5792
-
5793
-
5794
- public function setLocationDrivingDirectionMetrics( $locationDrivingDirectionMetrics ) {
5795
- $this->locationDrivingDirectionMetrics = $locationDrivingDirectionMetrics;
5796
- }
5797
- public function getLocationDrivingDirectionMetrics() {
5798
- return $this->locationDrivingDirectionMetrics;
5799
- }
5800
- public function setLocationMetrics( $locationMetrics ) {
5801
- $this->locationMetrics = $locationMetrics;
5802
- }
5803
- public function getLocationMetrics() {
5804
- return $this->locationMetrics;
5805
- }
5806
- }
5807
-
5808
- class Google_Service_MyBusiness_Review extends Google_Model {
5809
-
5810
- protected $internal_gapi_mappings = array(
5811
- );
5812
- public $comment;
5813
- public $createTime;
5814
- public $name;
5815
- public $reviewId;
5816
- protected $reviewReplyType = 'Google_Service_MyBusiness_ReviewReply';
5817
- protected $reviewReplyDataType = '';
5818
- protected $reviewerType = 'Google_Service_MyBusiness_Reviewer';
5819
- protected $reviewerDataType = '';
5820
- public $starRating;
5821
- public $updateTime;
5822
-
5823
-
5824
- public function setComment( $comment ) {
5825
- $this->comment = $comment;
5826
- }
5827
- public function getComment() {
5828
- return $this->comment;
5829
- }
5830
- public function setCreateTime( $createTime ) {
5831
- $this->createTime = $createTime;
5832
- }
5833
- public function getCreateTime() {
5834
- return $this->createTime;
5835
- }
5836
- public function setName( $name ) {
5837
- $this->name = $name;
5838
- }
5839
- public function getName() {
5840
- return $this->name;
5841
- }
5842
- public function setReviewId( $reviewId ) {
5843
- $this->reviewId = $reviewId;
5844
- }
5845
- public function getReviewId() {
5846
- return $this->reviewId;
5847
- }
5848
- public function setReviewReply( Google_Service_MyBusiness_ReviewReply $reviewReply ) {
5849
- $this->reviewReply = $reviewReply;
5850
- }
5851
- public function getReviewReply() {
5852
- return $this->reviewReply;
5853
- }
5854
- public function setReviewer( Google_Service_MyBusiness_Reviewer $reviewer ) {
5855
- $this->reviewer = $reviewer;
5856
- }
5857
- public function getReviewer() {
5858
- return $this->reviewer;
5859
- }
5860
- public function setStarRating( $starRating ) {
5861
- $this->starRating = $starRating;
5862
- }
5863
- public function getStarRating() {
5864
- return $this->starRating;
5865
- }
5866
- public function setUpdateTime( $updateTime ) {
5867
- $this->updateTime = $updateTime;
5868
- }
5869
- public function getUpdateTime() {
5870
- return $this->updateTime;
5871
- }
5872
- }
5873
-
5874
- class Google_Service_MyBusiness_ReviewReply extends Google_Model {
5875
-
5876
- protected $internal_gapi_mappings = array(
5877
- );
5878
- public $comment;
5879
- public $updateTime;
5880
-
5881
-
5882
- public function setComment( $comment ) {
5883
- $this->comment = $comment;
5884
- }
5885
- public function getComment() {
5886
- return $this->comment;
5887
- }
5888
- public function setUpdateTime( $updateTime ) {
5889
- $this->updateTime = $updateTime;
5890
- }
5891
- public function getUpdateTime() {
5892
- return $this->updateTime;
5893
- }
5894
- }
5895
-
5896
- class Google_Service_MyBusiness_Reviewer extends Google_Model {
5897
-
5898
- protected $internal_gapi_mappings = array(
5899
- );
5900
- public $displayName;
5901
- public $isAnonymous;
5902
- public $profilePhotoUrl;
5903
-
5904
-
5905
- public function setDisplayName( $displayName ) {
5906
- $this->displayName = $displayName;
5907
- }
5908
- public function getDisplayName() {
5909
- return $this->displayName;
5910
- }
5911
- public function setIsAnonymous( $isAnonymous ) {
5912
- $this->isAnonymous = $isAnonymous;
5913
- }
5914
- public function getIsAnonymous() {
5915
- return $this->isAnonymous;
5916
- }
5917
- public function setProfilePhotoUrl( $profilePhotoUrl ) {
5918
- $this->profilePhotoUrl = $profilePhotoUrl;
5919
- }
5920
- public function getProfilePhotoUrl() {
5921
- return $this->profilePhotoUrl;
5922
- }
5923
- }
5924
-
5925
- class Google_Service_MyBusiness_SearchChainsResponse extends Google_Collection {
5926
-
5927
- protected $collection_key = 'chains';
5928
- protected $internal_gapi_mappings = array(
5929
- );
5930
- protected $chainsType = 'Google_Service_MyBusiness_Chain';
5931
- protected $chainsDataType = 'array';
5932
-
5933
-
5934
- public function setChains( $chains ) {
5935
- $this->chains = $chains;
5936
- }
5937
- public function getChains() {
5938
- return $this->chains;
5939
- }
5940
- }
5941
-
5942
- class Google_Service_MyBusiness_SearchGoogleLocationsRequest extends Google_Model {
5943
-
5944
- protected $internal_gapi_mappings = array(
5945
- );
5946
- protected $locationType = 'Google_Service_MyBusiness_Location';
5947
- protected $locationDataType = '';
5948
- public $query;
5949
- public $resultCount;
5950
-
5951
-
5952
- public function setLocation( Google_Service_MyBusiness_Location $location ) {
5953
- $this->location = $location;
5954
- }
5955
- public function getLocation() {
5956
- return $this->location;
5957
- }
5958
- public function setQuery( $query ) {
5959
- $this->query = $query;
5960
- }
5961
- public function getQuery() {
5962
- return $this->query;
5963
- }
5964
- public function setResultCount( $resultCount ) {
5965
- $this->resultCount = $resultCount;
5966
- }
5967
- public function getResultCount() {
5968
- return $this->resultCount;
5969
- }
5970
- }
5971
-
5972
- class Google_Service_MyBusiness_SearchGoogleLocationsResponse extends Google_Collection {
5973
-
5974
- protected $collection_key = 'googleLocations';
5975
- protected $internal_gapi_mappings = array(
5976
- );
5977
- protected $googleLocationsType = 'Google_Service_MyBusiness_GoogleLocation';
5978
- protected $googleLocationsDataType = 'array';
5979
-
5980
-
5981
- public function setGoogleLocations( $googleLocations ) {
5982
- $this->googleLocations = $googleLocations;
5983
- }
5984
- public function getGoogleLocations() {
5985
- return $this->googleLocations;
5986
- }
5987
- }
5988
-
5989
- class Google_Service_MyBusiness_Section extends Google_Collection {
5990
-
5991
- protected $collection_key = 'labels';
5992
- protected $internal_gapi_mappings = array(
5993
- );
5994
- protected $itemsType = 'Google_Service_MyBusiness_Item';
5995
- protected $itemsDataType = 'array';
5996
- protected $labelsType = 'Google_Service_MyBusiness_Label';
5997
- protected $labelsDataType = 'array';
5998
- public $sectionId;
5999
- public $sectionType;
6000
-
6001
-
6002
- public function setItems( $items ) {
6003
- $this->items = $items;
6004
- }
6005
- public function getItems() {
6006
- return $this->items;
6007
- }
6008
- public function setLabels( $labels ) {
6009
- $this->labels = $labels;
6010
- }
6011
- public function getLabels() {
6012
- return $this->labels;
6013
- }
6014
- public function setSectionId( $sectionId ) {
6015
- $this->sectionId = $sectionId;
6016
- }
6017
- public function getSectionId() {
6018
- return $this->sectionId;
6019
- }
6020
- public function setSectionType( $sectionType ) {
6021
- $this->sectionType = $sectionType;
6022
- }
6023
- public function getSectionType() {
6024
- return $this->sectionType;
6025
- }
6026
- }
6027
-
6028
- class Google_Service_MyBusiness_ServiceAreaBusiness extends Google_Model {
6029
-
6030
- protected $internal_gapi_mappings = array(
6031
- );
6032
- public $businessType;
6033
- protected $placesType = 'Google_Service_MyBusiness_Places';
6034
- protected $placesDataType = '';
6035
- protected $radiusType = 'Google_Service_MyBusiness_PointRadius';
6036
- protected $radiusDataType = '';
6037
-
6038
-
6039
- public function setBusinessType( $businessType ) {
6040
- $this->businessType = $businessType;
6041
- }
6042
- public function getBusinessType() {
6043
- return $this->businessType;
6044
- }
6045
- public function setPlaces( Google_Service_MyBusiness_Places $places ) {
6046
- $this->places = $places;
6047
- }
6048
- public function getPlaces() {
6049
- return $this->places;
6050
- }
6051
- public function setRadius( Google_Service_MyBusiness_PointRadius $radius ) {
6052
- $this->radius = $radius;
6053
- }
6054
- public function getRadius() {
6055
- return $this->radius;
6056
- }
6057
- }
6058
-
6059
- class Google_Service_MyBusiness_ServiceBusinessContext extends Google_Model {
6060
-
6061
- protected $internal_gapi_mappings = array(
6062
- );
6063
- protected $addressType = 'Google_Service_MyBusiness_PostalAddress';
6064
- protected $addressDataType = '';
6065
-
6066
-
6067
- public function setAddress( Google_Service_MyBusiness_PostalAddress $address ) {
6068
- $this->address = $address;
6069
- }
6070
- public function getAddress() {
6071
- return $this->address;
6072
- }
6073
- }
6074
-
6075
- class Google_Service_MyBusiness_ServiceItem extends Google_Model {
6076
-
6077
- protected $internal_gapi_mappings = array(
6078
- );
6079
- protected $freeFormServiceItemType = 'Google_Service_MyBusiness_FreeFormServiceItem';
6080
- protected $freeFormServiceItemDataType = '';
6081
- public $isOffered;
6082
- protected $priceType = 'Google_Service_MyBusiness_Money';
6083
- protected $priceDataType = '';
6084
- protected $structuredServiceItemType = 'Google_Service_MyBusiness_StructuredServiceItem';
6085
- protected $structuredServiceItemDataType = '';
6086
-
6087
-
6088
- public function setFreeFormServiceItem( Google_Service_MyBusiness_FreeFormServiceItem $freeFormServiceItem ) {
6089
- $this->freeFormServiceItem = $freeFormServiceItem;
6090
- }
6091
- public function getFreeFormServiceItem() {
6092
- return $this->freeFormServiceItem;
6093
- }
6094
- public function setIsOffered( $isOffered ) {
6095
- $this->isOffered = $isOffered;
6096
- }
6097
- public function getIsOffered() {
6098
- return $this->isOffered;
6099
- }
6100
- public function setPrice( Google_Service_MyBusiness_Money $price ) {
6101
- $this->price = $price;
6102
- }
6103
- public function getPrice() {
6104
- return $this->price;
6105
- }
6106
- public function setStructuredServiceItem( Google_Service_MyBusiness_StructuredServiceItem $structuredServiceItem ) {
6107
- $this->structuredServiceItem = $structuredServiceItem;
6108
- }
6109
- public function getStructuredServiceItem() {
6110
- return $this->structuredServiceItem;
6111
- }
6112
- }
6113
-
6114
- class Google_Service_MyBusiness_ServiceList extends Google_Collection {
6115
-
6116
- protected $collection_key = 'serviceItems';
6117
- protected $internal_gapi_mappings = array(
6118
- );
6119
- public $name;
6120
- protected $serviceItemsType = 'Google_Service_MyBusiness_ServiceItem';
6121
- protected $serviceItemsDataType = 'array';
6122
-
6123
-
6124
- public function setName( $name ) {
6125
- $this->name = $name;
6126
- }
6127
- public function getName() {
6128
- return $this->name;
6129
- }
6130
- public function setServiceItems( $serviceItems ) {
6131
- $this->serviceItems = $serviceItems;
6132
- }
6133
- public function getServiceItems() {
6134
- return $this->serviceItems;
6135
- }
6136
- }
6137
-
6138
- class Google_Service_MyBusiness_SpecialHourPeriod extends Google_Model {
6139
-
6140
- protected $internal_gapi_mappings = array(
6141
- );
6142
- public $closeTime;
6143
- protected $endDateType = 'Google_Service_MyBusiness_Date';
6144
- protected $endDateDataType = '';
6145
- public $isClosed;
6146
- public $openTime;
6147
- protected $startDateType = 'Google_Service_MyBusiness_Date';
6148
- protected $startDateDataType = '';
6149
-
6150
-
6151
- public function setCloseTime( $closeTime ) {
6152
- $this->closeTime = $closeTime;
6153
- }
6154
- public function getCloseTime() {
6155
- return $this->closeTime;
6156
- }
6157
- public function setEndDate( Google_Service_MyBusiness_Date $endDate ) {
6158
- $this->endDate = $endDate;
6159
- }
6160
- public function getEndDate() {
6161
- return $this->endDate;
6162
- }
6163
- public function setIsClosed( $isClosed ) {
6164
- $this->isClosed = $isClosed;
6165
- }
6166
- public function getIsClosed() {
6167
- return $this->isClosed;
6168
- }
6169
- public function setOpenTime( $openTime ) {
6170
- $this->openTime = $openTime;
6171
- }
6172
- public function getOpenTime() {
6173
- return $this->openTime;
6174
- }
6175
- public function setStartDate( Google_Service_MyBusiness_Date $startDate ) {
6176
- $this->startDate = $startDate;
6177
- }
6178
- public function getStartDate() {
6179
- return $this->startDate;
6180
- }
6181
- }
6182
-
6183
- class Google_Service_MyBusiness_SpecialHours extends Google_Collection {
6184
-
6185
- protected $collection_key = 'specialHourPeriods';
6186
- protected $internal_gapi_mappings = array(
6187
- );
6188
- protected $specialHourPeriodsType = 'Google_Service_MyBusiness_SpecialHourPeriod';
6189
- protected $specialHourPeriodsDataType = 'array';
6190
-
6191
-
6192
- public function setSpecialHourPeriods( $specialHourPeriods ) {
6193
- $this->specialHourPeriods = $specialHourPeriods;
6194
- }
6195
- public function getSpecialHourPeriods() {
6196
- return $this->specialHourPeriods;
6197
- }
6198
- }
6199
-
6200
- class Google_Service_MyBusiness_StartUploadMediaItemDataRequest extends Google_Model {
6201
-
6202
- }
6203
-
6204
- class Google_Service_MyBusiness_StructuredServiceItem extends Google_Model {
6205
-
6206
- protected $internal_gapi_mappings = array(
6207
- );
6208
- public $description;
6209
- public $serviceTypeId;
6210
-
6211
-
6212
- public function setDescription( $description ) {
6213
- $this->description = $description;
6214
- }
6215
- public function getDescription() {
6216
- return $this->description;
6217
- }
6218
- public function setServiceTypeId( $serviceTypeId ) {
6219
- $this->serviceTypeId = $serviceTypeId;
6220
- }
6221
- public function getServiceTypeId() {
6222
- return $this->serviceTypeId;
6223
- }
6224
- }
6225
-
6226
- class Google_Service_MyBusiness_TargetLocation extends Google_Model {
6227
-
6228
- protected $internal_gapi_mappings = array(
6229
- );
6230
- public $locationAddress;
6231
- public $locationName;
6232
-
6233
-
6234
- public function setLocationAddress( $locationAddress ) {
6235
- $this->locationAddress = $locationAddress;
6236
- }
6237
- public function getLocationAddress() {
6238
- return $this->locationAddress;
6239
- }
6240
- public function setLocationName( $locationName ) {
6241
- $this->locationName = $locationName;
6242
- }
6243
- public function getLocationName() {
6244
- return $this->locationName;
6245
- }
6246
- }
6247
-
6248
- class Google_Service_MyBusiness_TimeDimension extends Google_Model {
6249
-
6250
- protected $internal_gapi_mappings = array(
6251
- );
6252
- public $dayOfWeek;
6253
- protected $timeOfDayType = 'Google_Service_MyBusiness_TimeOfDay';
6254
- protected $timeOfDayDataType = '';
6255
- protected $timeRangeType = 'Google_Service_MyBusiness_TimeRange';
6256
- protected $timeRangeDataType = '';
6257
-
6258
-
6259
- public function setDayOfWeek( $dayOfWeek ) {
6260
- $this->dayOfWeek = $dayOfWeek;
6261
- }
6262
- public function getDayOfWeek() {
6263
- return $this->dayOfWeek;
6264
- }
6265
- public function setTimeOfDay( Google_Service_MyBusiness_TimeOfDay $timeOfDay ) {
6266
- $this->timeOfDay = $timeOfDay;
6267
- }
6268
- public function getTimeOfDay() {
6269
- return $this->timeOfDay;
6270
- }
6271
- public function setTimeRange( Google_Service_MyBusiness_TimeRange $timeRange ) {
6272
- $this->timeRange = $timeRange;
6273
- }
6274
- public function getTimeRange() {
6275
- return $this->timeRange;
6276
- }
6277
- }
6278
-
6279
- class Google_Service_MyBusiness_TimeInterval extends Google_Model {
6280
-
6281
- protected $internal_gapi_mappings = array(
6282
- );
6283
- protected $endDateType = 'Google_Service_MyBusiness_Date';
6284
- protected $endDateDataType = '';
6285
- protected $endTimeType = 'Google_Service_MyBusiness_TimeOfDay';
6286
- protected $endTimeDataType = '';
6287
- protected $startDateType = 'Google_Service_MyBusiness_Date';
6288
- protected $startDateDataType = '';
6289
- protected $startTimeType = 'Google_Service_MyBusiness_TimeOfDay';
6290
- protected $startTimeDataType = '';
6291
-
6292
-
6293
- public function setEndDate( Google_Service_MyBusiness_Date $endDate ) {
6294
- $this->endDate = $endDate;
6295
- }
6296
- public function getEndDate() {
6297
- return $this->endDate;
6298
- }
6299
- public function setEndTime( Google_Service_MyBusiness_TimeOfDay $endTime ) {
6300
- $this->endTime = $endTime;
6301
- }
6302
- public function getEndTime() {
6303
- return $this->endTime;
6304
- }
6305
- public function setStartDate( Google_Service_MyBusiness_Date $startDate ) {
6306
- $this->startDate = $startDate;
6307
- }
6308
- public function getStartDate() {
6309
- return $this->startDate;
6310
- }
6311
- public function setStartTime( Google_Service_MyBusiness_TimeOfDay $startTime ) {
6312
- $this->startTime = $startTime;
6313
- }
6314
- public function getStartTime() {
6315
- return $this->startTime;
6316
- }
6317
- }
6318
-
6319
- class Google_Service_MyBusiness_TimeOfDay extends Google_Model {
6320
-
6321
- protected $internal_gapi_mappings = array(
6322
- );
6323
- public $hours;
6324
- public $minutes;
6325
- public $nanos;
6326
- public $seconds;
6327
-
6328
-
6329
- public function setHours( $hours ) {
6330
- $this->hours = $hours;
6331
- }
6332
- public function getHours() {
6333
- return $this->hours;
6334
- }
6335
- public function setMinutes( $minutes ) {
6336
- $this->minutes = $minutes;
6337
- }
6338
- public function getMinutes() {
6339
- return $this->minutes;
6340
- }
6341
- public function setNanos( $nanos ) {
6342
- $this->nanos = $nanos;
6343
- }
6344
- public function getNanos() {
6345
- return $this->nanos;
6346
- }
6347
- public function setSeconds( $seconds ) {
6348
- $this->seconds = $seconds;
6349
- }
6350
- public function getSeconds() {
6351
- return $this->seconds;
6352
- }
6353
- }
6354
-
6355
- class Google_Service_MyBusiness_TimePeriod extends Google_Model {
6356
-
6357
- protected $internal_gapi_mappings = array(
6358
- );
6359
- public $closeDay;
6360
- public $closeTime;
6361
- public $openDay;
6362
- public $openTime;
6363
-
6364
-
6365
- public function setCloseDay( $closeDay ) {
6366
- $this->closeDay = $closeDay;
6367
- }
6368
- public function getCloseDay() {
6369
- return $this->closeDay;
6370
- }
6371
- public function setCloseTime( $closeTime ) {
6372
- $this->closeTime = $closeTime;
6373
- }
6374
- public function getCloseTime() {
6375
- return $this->closeTime;
6376
- }
6377
- public function setOpenDay( $openDay ) {
6378
- $this->openDay = $openDay;
6379
- }
6380
- public function getOpenDay() {
6381
- return $this->openDay;
6382
- }
6383
- public function setOpenTime( $openTime ) {
6384
- $this->openTime = $openTime;
6385
- }
6386
- public function getOpenTime() {
6387
- return $this->openTime;
6388
- }
6389
- }
6390
-
6391
- class Google_Service_MyBusiness_TimeRange extends Google_Model {
6392
-
6393
- protected $internal_gapi_mappings = array(
6394
- );
6395
- public $endTime;
6396
- public $startTime;
6397
-
6398
-
6399
- public function setEndTime( $endTime ) {
6400
- $this->endTime = $endTime;
6401
- }
6402
- public function getEndTime() {
6403
- return $this->endTime;
6404
- }
6405
- public function setStartTime( $startTime ) {
6406
- $this->startTime = $startTime;
6407
- }
6408
- public function getStartTime() {
6409
- return $this->startTime;
6410
- }
6411
- }
6412
-
6413
- class Google_Service_MyBusiness_TopDirectionSources extends Google_Collection {
6414
-
6415
- protected $collection_key = 'regionCounts';
6416
- protected $internal_gapi_mappings = array(
6417
- );
6418
- public $dayCount;
6419
- protected $regionCountsType = 'Google_Service_MyBusiness_RegionCount';
6420
- protected $regionCountsDataType = 'array';
6421
-
6422
-
6423
- public function setDayCount( $dayCount ) {
6424
- $this->dayCount = $dayCount;
6425
- }
6426
- public function getDayCount() {
6427
- return $this->dayCount;
6428
- }
6429
- public function setRegionCounts( $regionCounts ) {
6430
- $this->regionCounts = $regionCounts;
6431
- }
6432
- public function getRegionCounts() {
6433
- return $this->regionCounts;
6434
- }
6435
- }
6436
-
6437
- class Google_Service_MyBusiness_TransferLocationRequest extends Google_Model {
6438
-
6439
- protected $internal_gapi_mappings = array(
6440
- );
6441
- public $toAccount;
6442
-
6443
-
6444
- public function setToAccount( $toAccount ) {
6445
- $this->toAccount = $toAccount;
6446
- }
6447
- public function getToAccount() {
6448
- return $this->toAccount;
6449
- }
6450
- }
6451
-
6452
- class Google_Service_MyBusiness_UpsertAnswerRequest extends Google_Model {
6453
-
6454
- protected $internal_gapi_mappings = array(
6455
- );
6456
- protected $answerType = 'Google_Service_MyBusiness_Answer';
6457
- protected $answerDataType = '';
6458
-
6459
-
6460
- public function setAnswer( Google_Service_MyBusiness_Answer $answer ) {
6461
- $this->answer = $answer;
6462
- }
6463
- public function getAnswer() {
6464
- return $this->answer;
6465
- }
6466
- }
6467
-
6468
- class Google_Service_MyBusiness_UrlAttributeValue extends Google_Model {
6469
-
6470
- protected $internal_gapi_mappings = array(
6471
- );
6472
- public $url;
6473
-
6474
-
6475
- public function setUrl( $url ) {
6476
- $this->url = $url;
6477
- }
6478
- public function getUrl() {
6479
- return $this->url;
6480
- }
6481
- }
6482
-
6483
- class Google_Service_MyBusiness_Verification extends Google_Model {
6484
-
6485
- protected $internal_gapi_mappings = array(
6486
- );
6487
- public $createTime;
6488
- public $method;
6489
- public $name;
6490
- public $state;
6491
-
6492
-
6493
- public function setCreateTime( $createTime ) {
6494
- $this->createTime = $createTime;
6495
- }
6496
- public function getCreateTime() {
6497
- return $this->createTime;
6498
- }
6499
- public function setMethod( $method ) {
6500
- $this->method = $method;
6501
- }
6502
- public function getMethod() {
6503
- return $this->method;
6504
- }
6505
- public function setName( $name ) {
6506
- $this->name = $name;
6507
- }
6508
- public function getName() {
6509
- return $this->name;
6510
- }
6511
- public function setState( $state ) {
6512
- $this->state = $state;
6513
- }
6514
- public function getState() {
6515
- return $this->state;
6516
- }
6517
- }
6518
-
6519
- class Google_Service_MyBusiness_VerificationOption extends Google_Model {
6520
-
6521
- protected $internal_gapi_mappings = array(
6522
- );
6523
- protected $addressDataType = 'Google_Service_MyBusiness_AddressVerificationData';
6524
- protected $addressDataDataType = '';
6525
- protected $emailDataType = 'Google_Service_MyBusiness_EmailVerificationData';
6526
- protected $emailDataDataType = '';
6527
- protected $phoneDataType = 'Google_Service_MyBusiness_PhoneVerificationData';
6528
- protected $phoneDataDataType = '';
6529
- public $verificationMethod;
6530
-
6531
-
6532
- public function setAddressData( Google_Service_MyBusiness_AddressVerificationData $addressData ) {
6533
- $this->addressData = $addressData;
6534
- }
6535
- public function getAddressData() {
6536
- return $this->addressData;
6537
- }
6538
- public function setEmailData( Google_Service_MyBusiness_EmailVerificationData $emailData ) {
6539
- $this->emailData = $emailData;
6540
- }
6541
- public function getEmailData() {
6542
- return $this->emailData;
6543
- }
6544
- public function setPhoneData( Google_Service_MyBusiness_PhoneVerificationData $phoneData ) {
6545
- $this->phoneData = $phoneData;
6546
- }
6547
- public function getPhoneData() {
6548
- return $this->phoneData;
6549
- }
6550
- public function setVerificationMethod( $verificationMethod ) {
6551
- $this->verificationMethod = $verificationMethod;
6552
- }
6553
- public function getVerificationMethod() {
6554
- return $this->verificationMethod;
6555
- }
6556
- }
6557
-
6558
- class Google_Service_MyBusiness_VerificationToken extends Google_Model {
6559
-
6560
- protected $internal_gapi_mappings = array(
6561
- );
6562
- public $tokenString;
6563
-
6564
-
6565
- public function setTokenString( $tokenString ) {
6566
- $this->tokenString = $tokenString;
6567
- }
6568
- public function getTokenString() {
6569
- return $this->tokenString;
6570
- }
6571
- }
6572
-
6573
- class Google_Service_MyBusiness_VerifyLocationRequest extends Google_Model {
6574
-
6575
- protected $internal_gapi_mappings = array(
6576
- );
6577
- protected $addressInputType = 'Google_Service_MyBusiness_AddressInput';
6578
- protected $addressInputDataType = '';
6579
- protected $contextType = 'Google_Service_MyBusiness_ServiceBusinessContext';
6580
- protected $contextDataType = '';
6581
- protected $emailInputType = 'Google_Service_MyBusiness_EmailInput';
6582
- protected $emailInputDataType = '';
6583
- public $languageCode;
6584
- public $method;
6585
- protected $phoneInputType = 'Google_Service_MyBusiness_PhoneInput';
6586
- protected $phoneInputDataType = '';
6587
- protected $vettedPartnerInputType = 'Google_Service_MyBusiness_VettedPartnerInput';
6588
- protected $vettedPartnerInputDataType = '';
6589
-
6590
-
6591
- public function setAddressInput( Google_Service_MyBusiness_AddressInput $addressInput ) {
6592
- $this->addressInput = $addressInput;
6593
- }
6594
- public function getAddressInput() {
6595
- return $this->addressInput;
6596
- }
6597
- public function setContext( Google_Service_MyBusiness_ServiceBusinessContext $context ) {
6598
- $this->context = $context;
6599
- }
6600
- public function getContext() {
6601
- return $this->context;
6602
- }
6603
- public function setEmailInput( Google_Service_MyBusiness_EmailInput $emailInput ) {
6604
- $this->emailInput = $emailInput;
6605
- }
6606
- public function getEmailInput() {
6607
- return $this->emailInput;
6608
- }
6609
- public function setLanguageCode( $languageCode ) {
6610
- $this->languageCode = $languageCode;
6611
- }
6612
- public function getLanguageCode() {
6613
- return $this->languageCode;
6614
- }
6615
- public function setMethod( $method ) {
6616
- $this->method = $method;
6617
- }
6618
- public function getMethod() {
6619
- return $this->method;
6620
- }
6621
- public function setPhoneInput( Google_Service_MyBusiness_PhoneInput $phoneInput ) {
6622
- $this->phoneInput = $phoneInput;
6623
- }
6624
- public function getPhoneInput() {
6625
- return $this->phoneInput;
6626
- }
6627
- public function setVettedPartnerInput( Google_Service_MyBusiness_VettedPartnerInput $vettedPartnerInput ) {
6628
- $this->vettedPartnerInput = $vettedPartnerInput;
6629
- }
6630
- public function getVettedPartnerInput() {
6631
- return $this->vettedPartnerInput;
6632
- }
6633
- }
6634
-
6635
- class Google_Service_MyBusiness_VerifyLocationResponse extends Google_Model {
6636
-
6637
- protected $internal_gapi_mappings = array(
6638
- );
6639
- protected $verificationType = 'Google_Service_MyBusiness_Verification';
6640
- protected $verificationDataType = '';
6641
-
6642
-
6643
- public function setVerification( Google_Service_MyBusiness_Verification $verification ) {
6644
- $this->verification = $verification;
6645
- }
6646
- public function getVerification() {
6647
- return $this->verification;
6648
- }
6649
- }
6650
-
6651
- class Google_Service_MyBusiness_VettedPartnerInput extends Google_Model {
6652
-
6653
- protected $internal_gapi_mappings = array(
6654
- );
6655
- protected $tokenType = 'Google_Service_MyBusiness_VerificationToken';
6656
- protected $tokenDataType = '';
6657
-
6658
-
6659
- public function setToken( Google_Service_MyBusiness_VerificationToken $token ) {
6660
- $this->token = $token;
6661
- }
6662
- public function getToken() {
6663
- return $this->token;
6664
- }
6665
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.md CHANGED
@@ -258,6 +258,11 @@ http://revive.social/plugins/revive-old-post
258
 
259
 
260
  ## Changelog ##
 
 
 
 
 
261
  ### 8.5.17 - 2020-09-24 ###
262
 
263
  * Dev: Add post-install command to composer.json
258
 
259
 
260
  ## Changelog ##
261
+ ### 8.5.18 - 2020-09-27 ###
262
+
263
+ * Change Pro: Move GMB dependency to Pro plugin.
264
+
265
+
266
  ### 8.5.17 - 2020-09-24 ###
267
 
268
  * Dev: Add post-install command to composer.json
readme.txt CHANGED
@@ -258,6 +258,11 @@ http://revive.social/plugins/revive-old-post
258
 
259
 
260
  == Changelog ==
 
 
 
 
 
261
  = 8.5.17 - 2020-09-24 =
262
 
263
  * Dev: Add post-install command to composer.json
258
 
259
 
260
  == Changelog ==
261
+ = 8.5.18 - 2020-09-27 =
262
+
263
+ * Change Pro: Move GMB dependency to Pro plugin.
264
+
265
+
266
  = 8.5.17 - 2020-09-24 =
267
 
268
  * Dev: Add post-install command to composer.json
themeisle-hash.json CHANGED
@@ -1 +1 @@
1
- {"class-rop-autoloader.php":"7bfbb1554230d0ace777adb2e42bebeb","index.php":"39ab8276fb0e4bd3fcab3270822c5977","tweet-old-post.php":"33dc4948e31b091ae3a85b251ff0fe47","uninstall.php":"e64207755b80ae94cbeec36edf9ebd46"}
1
+ {"class-rop-autoloader.php":"7bfbb1554230d0ace777adb2e42bebeb","index.php":"39ab8276fb0e4bd3fcab3270822c5977","tweet-old-post.php":"eaa2e30a045a725c87ab5d91928e3ef2","uninstall.php":"e64207755b80ae94cbeec36edf9ebd46"}
tweet-old-post.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: Revive Old Posts
17
  * Plugin URI: https://revive.social/
18
  * Description: WordPress plugin that helps you to keeps your old posts alive by sharing them and driving more traffic to them from twitter/facebook or linkedin. It also helps you to promote your content. You can set time and no of posts to share to drive more traffic.For questions, comments, or feature requests, <a href="http://revive.social/support/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
19
- * Version: 8.5.17
20
  * Author: revive.social
21
  * Author URI: https://revive.social/
22
  * Requires at least: 3.5
@@ -110,10 +110,11 @@ register_deactivation_hook( __FILE__, 'rop_deactivation' );
110
  function run_rop() {
111
 
112
  define( 'ROP_PRO_URL', 'http://revive.social/plugins/revive-old-post/' );
113
- define( 'ROP_LITE_VERSION', '8.5.17' );
114
  define( 'ROP_LITE_BASE_FILE', __FILE__ );
115
  define( 'ROP_DEBUG', false );
116
  define( 'ROP_LITE_PATH', plugin_dir_path( __FILE__ ) );
 
117
  define( 'ROP_PATH', plugin_dir_path( __FILE__ ) );
118
  define( 'ROP_LITE_URL', plugin_dir_url( __FILE__ ) );
119
  define( 'ROP_STATUS_ALERT', 6 );// How many consecutive errors count towards status alert "Status: Error (check logs)"
16
  * Plugin Name: Revive Old Posts
17
  * Plugin URI: https://revive.social/
18
  * Description: WordPress plugin that helps you to keeps your old posts alive by sharing them and driving more traffic to them from twitter/facebook or linkedin. It also helps you to promote your content. You can set time and no of posts to share to drive more traffic.For questions, comments, or feature requests, <a href="http://revive.social/support/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
19
+ * Version: 8.5.18
20
  * Author: revive.social
21
  * Author URI: https://revive.social/
22
  * Requires at least: 3.5
110
  function run_rop() {
111
 
112
  define( 'ROP_PRO_URL', 'http://revive.social/plugins/revive-old-post/' );
113
+ define( 'ROP_LITE_VERSION', '8.5.18' );
114
  define( 'ROP_LITE_BASE_FILE', __FILE__ );
115
  define( 'ROP_DEBUG', false );
116
  define( 'ROP_LITE_PATH', plugin_dir_path( __FILE__ ) );
117
+ define( 'ROP_PRO_PATH', WP_PLUGIN_DIR . '/tweet-old-post-pro/' );
118
  define( 'ROP_PATH', plugin_dir_path( __FILE__ ) );
119
  define( 'ROP_LITE_URL', plugin_dir_url( __FILE__ ) );
120
  define( 'ROP_STATUS_ALERT', 6 );// How many consecutive errors count towards status alert "Status: Error (check logs)"
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit5addd03443a7d2d8e7222a53f7da14a1::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit5d7807f895a5f21aa7700f958dc52168::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -6,6 +6,4 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'Google_Service_Exception' => $vendorDir . '/google/apiclient/src/Google/Service/Exception.php',
10
- 'Google_Service_Resource' => $vendorDir . '/google/apiclient/src/Google/Service/Resource.php',
11
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
 
9
  );
vendor/composer/autoload_files.php CHANGED
@@ -6,11 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
10
- 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
11
- 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
12
- '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
13
- 'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
14
  'c65d09b6820da036953a371c8c73a9b1' => $vendorDir . '/facebook/graph-sdk/src/Facebook/polyfills.php',
15
  '36c24edf14e0462467180307deb4c41f' => $vendorDir . '/codeinwp/themeisle-sdk/load.php',
16
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
 
 
 
 
9
  'c65d09b6820da036953a371c8c73a9b1' => $vendorDir . '/facebook/graph-sdk/src/Facebook/polyfills.php',
10
  '36c24edf14e0462467180307deb4c41f' => $vendorDir . '/codeinwp/themeisle-sdk/load.php',
11
  );
vendor/composer/autoload_namespaces.php CHANGED
@@ -6,6 +6,4 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'Google_Service_' => array($vendorDir . '/google/apiclient-services/src'),
10
- 'Google_' => array($vendorDir . '/google/apiclient/src'),
11
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
 
9
  );
vendor/composer/autoload_psr4.php CHANGED
@@ -6,17 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
10
- 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
11
- 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
12
- 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
13
- 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
14
- 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
15
- 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
16
- 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
17
- 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
18
- 'Google\\Auth\\' => array($vendorDir . '/google/auth/src'),
19
- 'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'),
20
  'Facebook\\' => array($vendorDir . '/facebook/graph-sdk/src/Facebook'),
21
  'Abraham\\TwitterOAuth\\' => array($vendorDir . '/abraham/twitteroauth/src'),
22
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
 
 
 
 
 
 
 
 
 
 
9
  'Facebook\\' => array($vendorDir . '/facebook/graph-sdk/src/Facebook'),
10
  'Abraham\\TwitterOAuth\\' => array($vendorDir . '/abraham/twitteroauth/src'),
11
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit5addd03443a7d2d8e7222a53f7da14a1
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit5addd03443a7d2d8e7222a53f7da14a1
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit5addd03443a7d2d8e7222a53f7da14a1', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit5addd03443a7d2d8e7222a53f7da14a1', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
@@ -42,14 +42,14 @@ class ComposerAutoloaderInit5addd03443a7d2d8e7222a53f7da14a1
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
- composerRequire5addd03443a7d2d8e7222a53f7da14a1($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
- function composerRequire5addd03443a7d2d8e7222a53f7da14a1($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit5d7807f895a5f21aa7700f958dc52168
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit5d7807f895a5f21aa7700f958dc52168', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit5d7807f895a5f21aa7700f958dc52168', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
+ composerRequire5d7807f895a5f21aa7700f958dc52168($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
+ function composerRequire5d7807f895a5f21aa7700f958dc52168($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;
vendor/composer/installed.json CHANGED
@@ -154,840 +154,5 @@
154
  "facebook",
155
  "sdk"
156
  ]
157
- },
158
- {
159
- "name": "phpseclib/phpseclib",
160
- "version": "2.0.29",
161
- "version_normalized": "2.0.29.0",
162
- "source": {
163
- "type": "git",
164
- "url": "https://github.com/phpseclib/phpseclib.git",
165
- "reference": "497856a8d997f640b4a516062f84228a772a48a8"
166
- },
167
- "dist": {
168
- "type": "zip",
169
- "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/497856a8d997f640b4a516062f84228a772a48a8",
170
- "reference": "497856a8d997f640b4a516062f84228a772a48a8",
171
- "shasum": ""
172
- },
173
- "require": {
174
- "php": ">=5.3.3"
175
- },
176
- "require-dev": {
177
- "phing/phing": "~2.7",
178
- "phpunit/phpunit": "^4.8.35|^5.7|^6.0",
179
- "squizlabs/php_codesniffer": "~2.0"
180
- },
181
- "suggest": {
182
- "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
183
- "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
184
- "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
185
- "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
186
- },
187
- "time": "2020-09-08 04:24:43",
188
- "type": "library",
189
- "installation-source": "dist",
190
- "autoload": {
191
- "files": [
192
- "phpseclib/bootstrap.php"
193
- ],
194
- "psr-4": {
195
- "phpseclib\\": "phpseclib/"
196
- }
197
- },
198
- "notification-url": "https://packagist.org/downloads/",
199
- "license": [
200
- "MIT"
201
- ],
202
- "authors": [
203
- {
204
- "name": "Jim Wigginton",
205
- "email": "terrafrost@php.net",
206
- "role": "Lead Developer"
207
- },
208
- {
209
- "name": "Patrick Monnerat",
210
- "email": "pm@datasphere.ch",
211
- "role": "Developer"
212
- },
213
- {
214
- "name": "Andreas Fischer",
215
- "email": "bantu@phpbb.com",
216
- "role": "Developer"
217
- },
218
- {
219
- "name": "Hans-Jürgen Petrich",
220
- "email": "petrich@tronic-media.com",
221
- "role": "Developer"
222
- },
223
- {
224
- "name": "Graham Campbell",
225
- "email": "graham@alt-three.com",
226
- "role": "Developer"
227
- }
228
- ],
229
- "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
230
- "homepage": "http://phpseclib.sourceforge.net",
231
- "keywords": [
232
- "BigInteger",
233
- "aes",
234
- "asn.1",
235
- "asn1",
236
- "blowfish",
237
- "crypto",
238
- "cryptography",
239
- "encryption",
240
- "rsa",
241
- "security",
242
- "sftp",
243
- "signature",
244
- "signing",
245
- "ssh",
246
- "twofish",
247
- "x.509",
248
- "x509"
249
- ]
250
- },
251
- {
252
- "name": "psr/log",
253
- "version": "1.1.3",
254
- "version_normalized": "1.1.3.0",
255
- "source": {
256
- "type": "git",
257
- "url": "https://github.com/php-fig/log.git",
258
- "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
259
- },
260
- "dist": {
261
- "type": "zip",
262
- "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
263
- "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
264
- "shasum": ""
265
- },
266
- "require": {
267
- "php": ">=5.3.0"
268
- },
269
- "time": "2020-03-23 09:12:05",
270
- "type": "library",
271
- "extra": {
272
- "branch-alias": {
273
- "dev-master": "1.1.x-dev"
274
- }
275
- },
276
- "installation-source": "dist",
277
- "autoload": {
278
- "psr-4": {
279
- "Psr\\Log\\": "Psr/Log/"
280
- }
281
- },
282
- "notification-url": "https://packagist.org/downloads/",
283
- "license": [
284
- "MIT"
285
- ],
286
- "authors": [
287
- {
288
- "name": "PHP-FIG",
289
- "homepage": "http://www.php-fig.org/"
290
- }
291
- ],
292
- "description": "Common interface for logging libraries",
293
- "homepage": "https://github.com/php-fig/log",
294
- "keywords": [
295
- "log",
296
- "psr",
297
- "psr-3"
298
- ]
299
- },
300
- {
301
- "name": "monolog/monolog",
302
- "version": "2.1.1",
303
- "version_normalized": "2.1.1.0",
304
- "source": {
305
- "type": "git",
306
- "url": "https://github.com/Seldaek/monolog.git",
307
- "reference": "f9eee5cec93dfb313a38b6b288741e84e53f02d5"
308
- },
309
- "dist": {
310
- "type": "zip",
311
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f9eee5cec93dfb313a38b6b288741e84e53f02d5",
312
- "reference": "f9eee5cec93dfb313a38b6b288741e84e53f02d5",
313
- "shasum": ""
314
- },
315
- "require": {
316
- "php": ">=7.2",
317
- "psr/log": "^1.0.1"
318
- },
319
- "provide": {
320
- "psr/log-implementation": "1.0.0"
321
- },
322
- "require-dev": {
323
- "aws/aws-sdk-php": "^2.4.9 || ^3.0",
324
- "doctrine/couchdb": "~1.0@dev",
325
- "elasticsearch/elasticsearch": "^6.0",
326
- "graylog2/gelf-php": "^1.4.2",
327
- "php-amqplib/php-amqplib": "~2.4",
328
- "php-console/php-console": "^3.1.3",
329
- "php-parallel-lint/php-parallel-lint": "^1.0",
330
- "phpspec/prophecy": "^1.6.1",
331
- "phpunit/phpunit": "^8.5",
332
- "predis/predis": "^1.1",
333
- "rollbar/rollbar": "^1.3",
334
- "ruflin/elastica": ">=0.90 <3.0",
335
- "swiftmailer/swiftmailer": "^5.3|^6.0"
336
- },
337
- "suggest": {
338
- "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
339
- "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
340
- "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
341
- "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
342
- "ext-mbstring": "Allow to work properly with unicode symbols",
343
- "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
344
- "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
345
- "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
346
- "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
347
- "php-console/php-console": "Allow sending log messages to Google Chrome",
348
- "rollbar/rollbar": "Allow sending log messages to Rollbar",
349
- "ruflin/elastica": "Allow sending log messages to an Elastic Search server"
350
- },
351
- "time": "2020-07-23 08:41:23",
352
- "type": "library",
353
- "extra": {
354
- "branch-alias": {
355
- "dev-master": "2.x-dev"
356
- }
357
- },
358
- "installation-source": "dist",
359
- "autoload": {
360
- "psr-4": {
361
- "Monolog\\": "src/Monolog"
362
- }
363
- },
364
- "notification-url": "https://packagist.org/downloads/",
365
- "license": [
366
- "MIT"
367
- ],
368
- "authors": [
369
- {
370
- "name": "Jordi Boggiano",
371
- "email": "j.boggiano@seld.be",
372
- "homepage": "http://seld.be"
373
- }
374
- ],
375
- "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
376
- "homepage": "http://github.com/Seldaek/monolog",
377
- "keywords": [
378
- "log",
379
- "logging",
380
- "psr-3"
381
- ]
382
- },
383
- {
384
- "name": "ralouphie/getallheaders",
385
- "version": "3.0.3",
386
- "version_normalized": "3.0.3.0",
387
- "source": {
388
- "type": "git",
389
- "url": "https://github.com/ralouphie/getallheaders.git",
390
- "reference": "120b605dfeb996808c31b6477290a714d356e822"
391
- },
392
- "dist": {
393
- "type": "zip",
394
- "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
395
- "reference": "120b605dfeb996808c31b6477290a714d356e822",
396
- "shasum": ""
397
- },
398
- "require": {
399
- "php": ">=5.6"
400
- },
401
- "require-dev": {
402
- "php-coveralls/php-coveralls": "^2.1",
403
- "phpunit/phpunit": "^5 || ^6.5"
404
- },
405
- "time": "2019-03-08 08:55:37",
406
- "type": "library",
407
- "installation-source": "dist",
408
- "autoload": {
409
- "files": [
410
- "src/getallheaders.php"
411
- ]
412
- },
413
- "notification-url": "https://packagist.org/downloads/",
414
- "license": [
415
- "MIT"
416
- ],
417
- "authors": [
418
- {
419
- "name": "Ralph Khattar",
420
- "email": "ralph.khattar@gmail.com"
421
- }
422
- ],
423
- "description": "A polyfill for getallheaders."
424
- },
425
- {
426
- "name": "psr/http-message",
427
- "version": "1.0.1",
428
- "version_normalized": "1.0.1.0",
429
- "source": {
430
- "type": "git",
431
- "url": "https://github.com/php-fig/http-message.git",
432
- "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
433
- },
434
- "dist": {
435
- "type": "zip",
436
- "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
437
- "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
438
- "shasum": ""
439
- },
440
- "require": {
441
- "php": ">=5.3.0"
442
- },
443
- "time": "2016-08-06 14:39:51",
444
- "type": "library",
445
- "extra": {
446
- "branch-alias": {
447
- "dev-master": "1.0.x-dev"
448
- }
449
- },
450
- "installation-source": "dist",
451
- "autoload": {
452
- "psr-4": {
453
- "Psr\\Http\\Message\\": "src/"
454
- }
455
- },
456
- "notification-url": "https://packagist.org/downloads/",
457
- "license": [
458
- "MIT"
459
- ],
460
- "authors": [
461
- {
462
- "name": "PHP-FIG",
463
- "homepage": "http://www.php-fig.org/"
464
- }
465
- ],
466
- "description": "Common interface for HTTP messages",
467
- "homepage": "https://github.com/php-fig/http-message",
468
- "keywords": [
469
- "http",
470
- "http-message",
471
- "psr",
472
- "psr-7",
473
- "request",
474
- "response"
475
- ]
476
- },
477
- {
478
- "name": "guzzlehttp/psr7",
479
- "version": "1.6.1",
480
- "version_normalized": "1.6.1.0",
481
- "source": {
482
- "type": "git",
483
- "url": "https://github.com/guzzle/psr7.git",
484
- "reference": "239400de7a173fe9901b9ac7c06497751f00727a"
485
- },
486
- "dist": {
487
- "type": "zip",
488
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
489
- "reference": "239400de7a173fe9901b9ac7c06497751f00727a",
490
- "shasum": ""
491
- },
492
- "require": {
493
- "php": ">=5.4.0",
494
- "psr/http-message": "~1.0",
495
- "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
496
- },
497
- "provide": {
498
- "psr/http-message-implementation": "1.0"
499
- },
500
- "require-dev": {
501
- "ext-zlib": "*",
502
- "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
503
- },
504
- "suggest": {
505
- "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
506
- },
507
- "time": "2019-07-01 23:21:34",
508
- "type": "library",
509
- "extra": {
510
- "branch-alias": {
511
- "dev-master": "1.6-dev"
512
- }
513
- },
514
- "installation-source": "dist",
515
- "autoload": {
516
- "psr-4": {
517
- "GuzzleHttp\\Psr7\\": "src/"
518
- },
519
- "files": [
520
- "src/functions_include.php"
521
- ]
522
- },
523
- "notification-url": "https://packagist.org/downloads/",
524
- "license": [
525
- "MIT"
526
- ],
527
- "authors": [
528
- {
529
- "name": "Michael Dowling",
530
- "email": "mtdowling@gmail.com",
531
- "homepage": "https://github.com/mtdowling"
532
- },
533
- {
534
- "name": "Tobias Schultze",
535
- "homepage": "https://github.com/Tobion"
536
- }
537
- ],
538
- "description": "PSR-7 message implementation that also provides common utility methods",
539
- "keywords": [
540
- "http",
541
- "message",
542
- "psr-7",
543
- "request",
544
- "response",
545
- "stream",
546
- "uri",
547
- "url"
548
- ]
549
- },
550
- {
551
- "name": "psr/http-client",
552
- "version": "1.0.1",
553
- "version_normalized": "1.0.1.0",
554
- "source": {
555
- "type": "git",
556
- "url": "https://github.com/php-fig/http-client.git",
557
- "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
558
- },
559
- "dist": {
560
- "type": "zip",
561
- "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
562
- "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
563
- "shasum": ""
564
- },
565
- "require": {
566
- "php": "^7.0 || ^8.0",
567
- "psr/http-message": "^1.0"
568
- },
569
- "time": "2020-06-29 06:28:15",
570
- "type": "library",
571
- "extra": {
572
- "branch-alias": {
573
- "dev-master": "1.0.x-dev"
574
- }
575
- },
576
- "installation-source": "dist",
577
- "autoload": {
578
- "psr-4": {
579
- "Psr\\Http\\Client\\": "src/"
580
- }
581
- },
582
- "notification-url": "https://packagist.org/downloads/",
583
- "license": [
584
- "MIT"
585
- ],
586
- "authors": [
587
- {
588
- "name": "PHP-FIG",
589
- "homepage": "http://www.php-fig.org/"
590
- }
591
- ],
592
- "description": "Common interface for HTTP clients",
593
- "homepage": "https://github.com/php-fig/http-client",
594
- "keywords": [
595
- "http",
596
- "http-client",
597
- "psr",
598
- "psr-18"
599
- ]
600
- },
601
- {
602
- "name": "guzzlehttp/promises",
603
- "version": "v1.3.1",
604
- "version_normalized": "1.3.1.0",
605
- "source": {
606
- "type": "git",
607
- "url": "https://github.com/guzzle/promises.git",
608
- "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
609
- },
610
- "dist": {
611
- "type": "zip",
612
- "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
613
- "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
614
- "shasum": ""
615
- },
616
- "require": {
617
- "php": ">=5.5.0"
618
- },
619
- "require-dev": {
620
- "phpunit/phpunit": "^4.0"
621
- },
622
- "time": "2016-12-20 10:07:11",
623
- "type": "library",
624
- "extra": {
625
- "branch-alias": {
626
- "dev-master": "1.4-dev"
627
- }
628
- },
629
- "installation-source": "dist",
630
- "autoload": {
631
- "psr-4": {
632
- "GuzzleHttp\\Promise\\": "src/"
633
- },
634
- "files": [
635
- "src/functions_include.php"
636
- ]
637
- },
638
- "notification-url": "https://packagist.org/downloads/",
639
- "license": [
640
- "MIT"
641
- ],
642
- "authors": [
643
- {
644
- "name": "Michael Dowling",
645
- "email": "mtdowling@gmail.com",
646
- "homepage": "https://github.com/mtdowling"
647
- }
648
- ],
649
- "description": "Guzzle promises library",
650
- "keywords": [
651
- "promise"
652
- ]
653
- },
654
- {
655
- "name": "guzzlehttp/guzzle",
656
- "version": "7.1.0",
657
- "version_normalized": "7.1.0.0",
658
- "source": {
659
- "type": "git",
660
- "url": "https://github.com/guzzle/guzzle.git",
661
- "reference": "7edeaa528fbb57123028bd5a76b9ce9540194e26"
662
- },
663
- "dist": {
664
- "type": "zip",
665
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7edeaa528fbb57123028bd5a76b9ce9540194e26",
666
- "reference": "7edeaa528fbb57123028bd5a76b9ce9540194e26",
667
- "shasum": ""
668
- },
669
- "require": {
670
- "ext-json": "*",
671
- "guzzlehttp/promises": "^1.0",
672
- "guzzlehttp/psr7": "^1.6.1",
673
- "php": "^7.2.5",
674
- "psr/http-client": "^1.0"
675
- },
676
- "provide": {
677
- "psr/http-client-implementation": "1.0"
678
- },
679
- "require-dev": {
680
- "ext-curl": "*",
681
- "php-http/client-integration-tests": "dev-phpunit8",
682
- "phpunit/phpunit": "^8.5.5",
683
- "psr/log": "^1.1"
684
- },
685
- "suggest": {
686
- "ext-curl": "Required for CURL handler support",
687
- "ext-intl": "Required for Internationalized Domain Name (IDN) support",
688
- "psr/log": "Required for using the Log middleware"
689
- },
690
- "time": "2020-09-22 09:10:04",
691
- "type": "library",
692
- "extra": {
693
- "branch-alias": {
694
- "dev-master": "7.1-dev"
695
- }
696
- },
697
- "installation-source": "dist",
698
- "autoload": {
699
- "psr-4": {
700
- "GuzzleHttp\\": "src/"
701
- },
702
- "files": [
703
- "src/functions_include.php"
704
- ]
705
- },
706
- "notification-url": "https://packagist.org/downloads/",
707
- "license": [
708
- "MIT"
709
- ],
710
- "authors": [
711
- {
712
- "name": "Michael Dowling",
713
- "email": "mtdowling@gmail.com",
714
- "homepage": "https://github.com/mtdowling"
715
- },
716
- {
717
- "name": "Márk Sági-Kazár",
718
- "email": "mark.sagikazar@gmail.com",
719
- "homepage": "https://sagikazarmark.hu"
720
- }
721
- ],
722
- "description": "Guzzle is a PHP HTTP client library",
723
- "homepage": "http://guzzlephp.org/",
724
- "keywords": [
725
- "client",
726
- "curl",
727
- "framework",
728
- "http",
729
- "http client",
730
- "psr-18",
731
- "psr-7",
732
- "rest",
733
- "web service"
734
- ]
735
- },
736
- {
737
- "name": "psr/cache",
738
- "version": "1.0.1",
739
- "version_normalized": "1.0.1.0",
740
- "source": {
741
- "type": "git",
742
- "url": "https://github.com/php-fig/cache.git",
743
- "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
744
- },
745
- "dist": {
746
- "type": "zip",
747
- "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
748
- "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
749
- "shasum": ""
750
- },
751
- "require": {
752
- "php": ">=5.3.0"
753
- },
754
- "time": "2016-08-06 20:24:11",
755
- "type": "library",
756
- "extra": {
757
- "branch-alias": {
758
- "dev-master": "1.0.x-dev"
759
- }
760
- },
761
- "installation-source": "dist",
762
- "autoload": {
763
- "psr-4": {
764
- "Psr\\Cache\\": "src/"
765
- }
766
- },
767
- "notification-url": "https://packagist.org/downloads/",
768
- "license": [
769
- "MIT"
770
- ],
771
- "authors": [
772
- {
773
- "name": "PHP-FIG",
774
- "homepage": "http://www.php-fig.org/"
775
- }
776
- ],
777
- "description": "Common interface for caching libraries",
778
- "keywords": [
779
- "cache",
780
- "psr",
781
- "psr-6"
782
- ]
783
- },
784
- {
785
- "name": "firebase/php-jwt",
786
- "version": "v5.2.0",
787
- "version_normalized": "5.2.0.0",
788
- "source": {
789
- "type": "git",
790
- "url": "https://github.com/firebase/php-jwt.git",
791
- "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb"
792
- },
793
- "dist": {
794
- "type": "zip",
795
- "url": "https://api.github.com/repos/firebase/php-jwt/zipball/feb0e820b8436873675fd3aca04f3728eb2185cb",
796
- "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb",
797
- "shasum": ""
798
- },
799
- "require": {
800
- "php": ">=5.3.0"
801
- },
802
- "require-dev": {
803
- "phpunit/phpunit": ">=4.8 <=9"
804
- },
805
- "time": "2020-03-25 18:49:23",
806
- "type": "library",
807
- "installation-source": "dist",
808
- "autoload": {
809
- "psr-4": {
810
- "Firebase\\JWT\\": "src"
811
- }
812
- },
813
- "notification-url": "https://packagist.org/downloads/",
814
- "license": [
815
- "BSD-3-Clause"
816
- ],
817
- "authors": [
818
- {
819
- "name": "Neuman Vong",
820
- "email": "neuman+pear@twilio.com",
821
- "role": "Developer"
822
- },
823
- {
824
- "name": "Anant Narayanan",
825
- "email": "anant@php.net",
826
- "role": "Developer"
827
- }
828
- ],
829
- "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
830
- "homepage": "https://github.com/firebase/php-jwt",
831
- "keywords": [
832
- "jwt",
833
- "php"
834
- ]
835
- },
836
- {
837
- "name": "google/auth",
838
- "version": "v1.13.0",
839
- "version_normalized": "1.13.0.0",
840
- "source": {
841
- "type": "git",
842
- "url": "https://github.com/googleapis/google-auth-library-php.git",
843
- "reference": "173191f5defd1d9ae8bdfc28da31b63eb73dd34e"
844
- },
845
- "dist": {
846
- "type": "zip",
847
- "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/173191f5defd1d9ae8bdfc28da31b63eb73dd34e",
848
- "reference": "173191f5defd1d9ae8bdfc28da31b63eb73dd34e",
849
- "shasum": ""
850
- },
851
- "require": {
852
- "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0",
853
- "guzzlehttp/guzzle": "^5.3.1|^6.2.1|^7.0",
854
- "guzzlehttp/psr7": "^1.2",
855
- "php": ">=5.4",
856
- "psr/cache": "^1.0",
857
- "psr/http-message": "^1.0"
858
- },
859
- "require-dev": {
860
- "guzzlehttp/promises": "0.1.1|^1.3",
861
- "kelvinmo/simplejwt": "^0.2.5",
862
- "phpseclib/phpseclib": "^2",
863
- "phpunit/phpunit": "^4.8.36|^5.7",
864
- "sebastian/comparator": ">=1.2.3",
865
- "squizlabs/php_codesniffer": "^3.5"
866
- },
867
- "suggest": {
868
- "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2."
869
- },
870
- "time": "2020-09-18 20:03:05",
871
- "type": "library",
872
- "installation-source": "dist",
873
- "autoload": {
874
- "psr-4": {
875
- "Google\\Auth\\": "src"
876
- }
877
- },
878
- "notification-url": "https://packagist.org/downloads/",
879
- "license": [
880
- "Apache-2.0"
881
- ],
882
- "description": "Google Auth Library for PHP",
883
- "homepage": "http://github.com/google/google-auth-library-php",
884
- "keywords": [
885
- "Authentication",
886
- "google",
887
- "oauth2"
888
- ]
889
- },
890
- {
891
- "name": "google/apiclient-services",
892
- "version": "v0.147",
893
- "version_normalized": "0.147.0.0",
894
- "source": {
895
- "type": "git",
896
- "url": "https://github.com/googleapis/google-api-php-client-services.git",
897
- "reference": "8624bd004cfccb33b760ae7650d0b750168cd7f7"
898
- },
899
- "dist": {
900
- "type": "zip",
901
- "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/8624bd004cfccb33b760ae7650d0b750168cd7f7",
902
- "reference": "8624bd004cfccb33b760ae7650d0b750168cd7f7",
903
- "shasum": ""
904
- },
905
- "require": {
906
- "php": ">=5.4"
907
- },
908
- "require-dev": {
909
- "phpunit/phpunit": "^4.8|^5"
910
- },
911
- "time": "2020-09-20 00:24:43",
912
- "type": "library",
913
- "installation-source": "dist",
914
- "autoload": {
915
- "psr-0": {
916
- "Google_Service_": "src"
917
- }
918
- },
919
- "notification-url": "https://packagist.org/downloads/",
920
- "license": [
921
- "Apache-2.0"
922
- ],
923
- "description": "Client library for Google APIs",
924
- "homepage": "http://developers.google.com/api-client-library/php",
925
- "keywords": [
926
- "google"
927
- ]
928
- },
929
- {
930
- "name": "google/apiclient",
931
- "version": "v2.7.1",
932
- "version_normalized": "2.7.1.0",
933
- "source": {
934
- "type": "git",
935
- "url": "https://github.com/googleapis/google-api-php-client.git",
936
- "reference": "e748d1d5a51166754f13809d35f1fa162cbec530"
937
- },
938
- "dist": {
939
- "type": "zip",
940
- "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/e748d1d5a51166754f13809d35f1fa162cbec530",
941
- "reference": "e748d1d5a51166754f13809d35f1fa162cbec530",
942
- "shasum": ""
943
- },
944
- "require": {
945
- "firebase/php-jwt": "~2.0||~3.0||~4.0||~5.0",
946
- "google/apiclient-services": "~0.13",
947
- "google/auth": "^1.10",
948
- "guzzlehttp/guzzle": "~5.3.1||~6.0||~7.0",
949
- "guzzlehttp/psr7": "^1.2",
950
- "monolog/monolog": "^1.17|^2.0",
951
- "php": ">=5.4",
952
- "phpseclib/phpseclib": "~0.3.10||~2.0"
953
- },
954
- "require-dev": {
955
- "cache/filesystem-adapter": "^0.3.2",
956
- "composer/composer": "^1.10",
957
- "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
958
- "phpcompatibility/php-compatibility": "^9.2",
959
- "phpunit/phpunit": "^4.8.36|^5.0",
960
- "squizlabs/php_codesniffer": "~2.3",
961
- "symfony/css-selector": "~2.1",
962
- "symfony/dom-crawler": "~2.1"
963
- },
964
- "suggest": {
965
- "cache/filesystem-adapter": "For caching certs and tokens (using Google_Client::setCache)"
966
- },
967
- "time": "2020-09-08 16:38:08",
968
- "type": "library",
969
- "extra": {
970
- "branch-alias": {
971
- "dev-master": "2.x-dev"
972
- }
973
- },
974
- "installation-source": "dist",
975
- "autoload": {
976
- "psr-0": {
977
- "Google_": "src/"
978
- },
979
- "classmap": [
980
- "src/Google/Service/"
981
- ]
982
- },
983
- "notification-url": "https://packagist.org/downloads/",
984
- "license": [
985
- "Apache-2.0"
986
- ],
987
- "description": "Client library for Google APIs",
988
- "homepage": "http://developers.google.com/api-client-library/php",
989
- "keywords": [
990
- "google"
991
- ]
992
  }
993
  ]
154
  "facebook",
155
  "sdk"
156
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
  ]
vendor/firebase/php-jwt/LICENSE DELETED
@@ -1,30 +0,0 @@
1
- Copyright (c) 2011, Neuman Vong
2
-
3
- All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- * Redistributions of source code must retain the above copyright
9
- notice, this list of conditions and the following disclaimer.
10
-
11
- * Redistributions in binary form must reproduce the above
12
- copyright notice, this list of conditions and the following
13
- disclaimer in the documentation and/or other materials provided
14
- with the distribution.
15
-
16
- * Neither the name of Neuman Vong nor the names of other
17
- contributors may be used to endorse or promote products derived
18
- from this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/firebase/php-jwt/README.md DELETED
@@ -1,200 +0,0 @@
1
- [![Build Status](https://travis-ci.org/firebase/php-jwt.png?branch=master)](https://travis-ci.org/firebase/php-jwt)
2
- [![Latest Stable Version](https://poser.pugx.org/firebase/php-jwt/v/stable)](https://packagist.org/packages/firebase/php-jwt)
3
- [![Total Downloads](https://poser.pugx.org/firebase/php-jwt/downloads)](https://packagist.org/packages/firebase/php-jwt)
4
- [![License](https://poser.pugx.org/firebase/php-jwt/license)](https://packagist.org/packages/firebase/php-jwt)
5
-
6
- PHP-JWT
7
- =======
8
- A simple library to encode and decode JSON Web Tokens (JWT) in PHP, conforming to [RFC 7519](https://tools.ietf.org/html/rfc7519).
9
-
10
- Installation
11
- ------------
12
-
13
- Use composer to manage your dependencies and download PHP-JWT:
14
-
15
- ```bash
16
- composer require firebase/php-jwt
17
- ```
18
-
19
- Example
20
- -------
21
- ```php
22
- <?php
23
- use \Firebase\JWT\JWT;
24
-
25
- $key = "example_key";
26
- $payload = array(
27
- "iss" => "http://example.org",
28
- "aud" => "http://example.com",
29
- "iat" => 1356999524,
30
- "nbf" => 1357000000
31
- );
32
-
33
- /**
34
- * IMPORTANT:
35
- * You must specify supported algorithms for your application. See
36
- * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
37
- * for a list of spec-compliant algorithms.
38
- */
39
- $jwt = JWT::encode($payload, $key);
40
- $decoded = JWT::decode($jwt, $key, array('HS256'));
41
-
42
- print_r($decoded);
43
-
44
- /*
45
- NOTE: This will now be an object instead of an associative array. To get
46
- an associative array, you will need to cast it as such:
47
- */
48
-
49
- $decoded_array = (array) $decoded;
50
-
51
- /**
52
- * You can add a leeway to account for when there is a clock skew times between
53
- * the signing and verifying servers. It is recommended that this leeway should
54
- * not be bigger than a few minutes.
55
- *
56
- * Source: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#nbfDef
57
- */
58
- JWT::$leeway = 60; // $leeway in seconds
59
- $decoded = JWT::decode($jwt, $key, array('HS256'));
60
-
61
- ?>
62
- ```
63
- Example with RS256 (openssl)
64
- ----------------------------
65
- ```php
66
- <?php
67
- use \Firebase\JWT\JWT;
68
-
69
- $privateKey = <<<EOD
70
- -----BEGIN RSA PRIVATE KEY-----
71
- MIICXAIBAAKBgQC8kGa1pSjbSYZVebtTRBLxBz5H4i2p/llLCrEeQhta5kaQu/Rn
72
- vuER4W8oDH3+3iuIYW4VQAzyqFpwuzjkDI+17t5t0tyazyZ8JXw+KgXTxldMPEL9
73
- 5+qVhgXvwtihXC1c5oGbRlEDvDF6Sa53rcFVsYJ4ehde/zUxo6UvS7UrBQIDAQAB
74
- AoGAb/MXV46XxCFRxNuB8LyAtmLDgi/xRnTAlMHjSACddwkyKem8//8eZtw9fzxz
75
- bWZ/1/doQOuHBGYZU8aDzzj59FZ78dyzNFoF91hbvZKkg+6wGyd/LrGVEB+Xre0J
76
- Nil0GReM2AHDNZUYRv+HYJPIOrB0CRczLQsgFJ8K6aAD6F0CQQDzbpjYdx10qgK1
77
- cP59UHiHjPZYC0loEsk7s+hUmT3QHerAQJMZWC11Qrn2N+ybwwNblDKv+s5qgMQ5
78
- 5tNoQ9IfAkEAxkyffU6ythpg/H0Ixe1I2rd0GbF05biIzO/i77Det3n4YsJVlDck
79
- ZkcvY3SK2iRIL4c9yY6hlIhs+K9wXTtGWwJBAO9Dskl48mO7woPR9uD22jDpNSwe
80
- k90OMepTjzSvlhjbfuPN1IdhqvSJTDychRwn1kIJ7LQZgQ8fVz9OCFZ/6qMCQGOb
81
- qaGwHmUK6xzpUbbacnYrIM6nLSkXgOAwv7XXCojvY614ILTK3iXiLBOxPu5Eu13k
82
- eUz9sHyD6vkgZzjtxXECQAkp4Xerf5TGfQXGXhxIX52yH+N2LtujCdkQZjXAsGdm
83
- B2zNzvrlgRmgBrklMTrMYgm1NPcW+bRLGcwgW2PTvNM=
84
- -----END RSA PRIVATE KEY-----
85
- EOD;
86
-
87
- $publicKey = <<<EOD
88
- -----BEGIN PUBLIC KEY-----
89
- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8kGa1pSjbSYZVebtTRBLxBz5H
90
- 4i2p/llLCrEeQhta5kaQu/RnvuER4W8oDH3+3iuIYW4VQAzyqFpwuzjkDI+17t5t
91
- 0tyazyZ8JXw+KgXTxldMPEL95+qVhgXvwtihXC1c5oGbRlEDvDF6Sa53rcFVsYJ4
92
- ehde/zUxo6UvS7UrBQIDAQAB
93
- -----END PUBLIC KEY-----
94
- EOD;
95
-
96
- $payload = array(
97
- "iss" => "example.org",
98
- "aud" => "example.com",
99
- "iat" => 1356999524,
100
- "nbf" => 1357000000
101
- );
102
-
103
- $jwt = JWT::encode($payload, $privateKey, 'RS256');
104
- echo "Encode:\n" . print_r($jwt, true) . "\n";
105
-
106
- $decoded = JWT::decode($jwt, $publicKey, array('RS256'));
107
-
108
- /*
109
- NOTE: This will now be an object instead of an associative array. To get
110
- an associative array, you will need to cast it as such:
111
- */
112
-
113
- $decoded_array = (array) $decoded;
114
- echo "Decode:\n" . print_r($decoded_array, true) . "\n";
115
- ?>
116
- ```
117
-
118
- Changelog
119
- ---------
120
-
121
- #### 5.0.0 / 2017-06-26
122
- - Support RS384 and RS512.
123
- See [#117](https://github.com/firebase/php-jwt/pull/117). Thanks [@joostfaassen](https://github.com/joostfaassen)!
124
- - Add an example for RS256 openssl.
125
- See [#125](https://github.com/firebase/php-jwt/pull/125). Thanks [@akeeman](https://github.com/akeeman)!
126
- - Detect invalid Base64 encoding in signature.
127
- See [#162](https://github.com/firebase/php-jwt/pull/162). Thanks [@psignoret](https://github.com/psignoret)!
128
- - Update `JWT::verify` to handle OpenSSL errors.
129
- See [#159](https://github.com/firebase/php-jwt/pull/159). Thanks [@bshaffer](https://github.com/bshaffer)!
130
- - Add `array` type hinting to `decode` method
131
- See [#101](https://github.com/firebase/php-jwt/pull/101). Thanks [@hywak](https://github.com/hywak)!
132
- - Add all JSON error types.
133
- See [#110](https://github.com/firebase/php-jwt/pull/110). Thanks [@gbalduzzi](https://github.com/gbalduzzi)!
134
- - Bugfix 'kid' not in given key list.
135
- See [#129](https://github.com/firebase/php-jwt/pull/129). Thanks [@stampycode](https://github.com/stampycode)!
136
- - Miscellaneous cleanup, documentation and test fixes.
137
- See [#107](https://github.com/firebase/php-jwt/pull/107), [#115](https://github.com/firebase/php-jwt/pull/115),
138
- [#160](https://github.com/firebase/php-jwt/pull/160), [#161](https://github.com/firebase/php-jwt/pull/161), and
139
- [#165](https://github.com/firebase/php-jwt/pull/165). Thanks [@akeeman](https://github.com/akeeman),
140
- [@chinedufn](https://github.com/chinedufn), and [@bshaffer](https://github.com/bshaffer)!
141
-
142
- #### 4.0.0 / 2016-07-17
143
- - Add support for late static binding. See [#88](https://github.com/firebase/php-jwt/pull/88) for details. Thanks to [@chappy84](https://github.com/chappy84)!
144
- - Use static `$timestamp` instead of `time()` to improve unit testing. See [#93](https://github.com/firebase/php-jwt/pull/93) for details. Thanks to [@josephmcdermott](https://github.com/josephmcdermott)!
145
- - Fixes to exceptions classes. See [#81](https://github.com/firebase/php-jwt/pull/81) for details. Thanks to [@Maks3w](https://github.com/Maks3w)!
146
- - Fixes to PHPDoc. See [#76](https://github.com/firebase/php-jwt/pull/76) for details. Thanks to [@akeeman](https://github.com/akeeman)!
147
-
148
- #### 3.0.0 / 2015-07-22
149
- - Minimum PHP version updated from `5.2.0` to `5.3.0`.
150
- - Add `\Firebase\JWT` namespace. See
151
- [#59](https://github.com/firebase/php-jwt/pull/59) for details. Thanks to
152
- [@Dashron](https://github.com/Dashron)!
153
- - Require a non-empty key to decode and verify a JWT. See
154
- [#60](https://github.com/firebase/php-jwt/pull/60) for details. Thanks to
155
- [@sjones608](https://github.com/sjones608)!
156
- - Cleaner documentation blocks in the code. See
157
- [#62](https://github.com/firebase/php-jwt/pull/62) for details. Thanks to
158
- [@johanderuijter](https://github.com/johanderuijter)!
159
-
160
- #### 2.2.0 / 2015-06-22
161
- - Add support for adding custom, optional JWT headers to `JWT::encode()`. See
162
- [#53](https://github.com/firebase/php-jwt/pull/53/files) for details. Thanks to
163
- [@mcocaro](https://github.com/mcocaro)!
164
-
165
- #### 2.1.0 / 2015-05-20
166
- - Add support for adding a leeway to `JWT:decode()` that accounts for clock skew
167
- between signing and verifying entities. Thanks to [@lcabral](https://github.com/lcabral)!
168
- - Add support for passing an object implementing the `ArrayAccess` interface for
169
- `$keys` argument in `JWT::decode()`. Thanks to [@aztech-dev](https://github.com/aztech-dev)!
170
-
171
- #### 2.0.0 / 2015-04-01
172
- - **Note**: It is strongly recommended that you update to > v2.0.0 to address
173
- known security vulnerabilities in prior versions when both symmetric and
174
- asymmetric keys are used together.
175
- - Update signature for `JWT::decode(...)` to require an array of supported
176
- algorithms to use when verifying token signatures.
177
-
178
-
179
- Tests
180
- -----
181
- Run the tests using phpunit:
182
-
183
- ```bash
184
- $ pear install PHPUnit
185
- $ phpunit --configuration phpunit.xml.dist
186
- PHPUnit 3.7.10 by Sebastian Bergmann.
187
- .....
188
- Time: 0 seconds, Memory: 2.50Mb
189
- OK (5 tests, 5 assertions)
190
- ```
191
-
192
- New Lines in private keys
193
- -----
194
-
195
- If your private key contains `\n` characters, be sure to wrap it in double quotes `""`
196
- and not single quotes `''` in order to properly interpret the escaped characters.
197
-
198
- License
199
- -------
200
- [3-Clause BSD](http://opensource.org/licenses/BSD-3-Clause).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/firebase/php-jwt/src/BeforeValidException.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- namespace Firebase\JWT;
3
-
4
- class BeforeValidException extends \UnexpectedValueException
5
- {
6
- }
 
 
 
 
 
 
vendor/firebase/php-jwt/src/ExpiredException.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- namespace Firebase\JWT;
3
-
4
- class ExpiredException extends \UnexpectedValueException
5
- {
6
- }
 
 
 
 
 
 
vendor/firebase/php-jwt/src/JWK.php DELETED
@@ -1,171 +0,0 @@
1
- <?php
2
-
3
- namespace Firebase\JWT;
4
-
5
- use DomainException;
6
- use UnexpectedValueException;
7
-
8
- /**
9
- * JSON Web Key implementation, based on this spec:
10
- * https://tools.ietf.org/html/draft-ietf-jose-json-web-key-41
11
- *
12
- * PHP version 5
13
- *
14
- * @category Authentication
15
- * @package Authentication_JWT
16
- * @author Bui Sy Nguyen <nguyenbs@gmail.com>
17
- * @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD
18
- * @link https://github.com/firebase/php-jwt
19
- */
20
- class JWK
21
- {
22
- /**
23
- * Parse a set of JWK keys
24
- *
25
- * @param array $jwks The JSON Web Key Set as an associative array
26
- *
27
- * @return array An associative array that represents the set of keys
28
- *
29
- * @throws InvalidArgumentException Provided JWK Set is empty
30
- * @throws UnexpectedValueException Provided JWK Set was invalid
31
- * @throws DomainException OpenSSL failure
32
- *
33
- * @uses parseKey
34
- */
35
- public static function parseKeySet(array $jwks)
36
- {
37
- $keys = array();
38
-
39
- if (!isset($jwks['keys'])) {
40
- throw new UnexpectedValueException('"keys" member must exist in the JWK Set');
41
- }
42
- if (empty($jwks['keys'])) {
43
- throw new InvalidArgumentException('JWK Set did not contain any keys');
44
- }
45
-
46
- foreach ($jwks['keys'] as $k => $v) {
47
- $kid = isset($v['kid']) ? $v['kid'] : $k;
48
- if ($key = self::parseKey($v)) {
49
- $keys[$kid] = $key;
50
- }
51
- }
52
-
53
- if (0 === \count($keys)) {
54
- throw new UnexpectedValueException('No supported algorithms found in JWK Set');
55
- }
56
-
57
- return $keys;
58
- }
59
-
60
- /**
61
- * Parse a JWK key
62
- *
63
- * @param array $jwk An individual JWK
64
- *
65
- * @return resource|array An associative array that represents the key
66
- *
67
- * @throws InvalidArgumentException Provided JWK is empty
68
- * @throws UnexpectedValueException Provided JWK was invalid
69
- * @throws DomainException OpenSSL failure
70
- *
71
- * @uses createPemFromModulusAndExponent
72
- */
73
- private static function parseKey(array $jwk)
74
- {
75
- if (empty($jwk)) {
76
- throw new InvalidArgumentException('JWK must not be empty');
77
- }
78
- if (!isset($jwk['kty'])) {
79
- throw new UnexpectedValueException('JWK must contain a "kty" parameter');
80
- }
81
-
82
- switch ($jwk['kty']) {
83
- case 'RSA':
84
- if (\array_key_exists('d', $jwk)) {
85
- throw new UnexpectedValueException('RSA private keys are not supported');
86
- }
87
- if (!isset($jwk['n']) || !isset($jwk['e'])) {
88
- throw new UnexpectedValueException('RSA keys must contain values for both "n" and "e"');
89
- }
90
-
91
- $pem = self::createPemFromModulusAndExponent($jwk['n'], $jwk['e']);
92
- $publicKey = \openssl_pkey_get_public($pem);
93
- if (false === $publicKey) {
94
- throw new DomainException(
95
- 'OpenSSL error: ' . \openssl_error_string()
96
- );
97
- }
98
- return $publicKey;
99
- default:
100
- // Currently only RSA is supported
101
- break;
102
- }
103
- }
104
-
105
- /**
106
- * Create a public key represented in PEM format from RSA modulus and exponent information
107
- *
108
- * @param string $n The RSA modulus encoded in Base64
109
- * @param string $e The RSA exponent encoded in Base64
110
- *
111
- * @return string The RSA public key represented in PEM format
112
- *
113
- * @uses encodeLength
114
- */
115
- private static function createPemFromModulusAndExponent($n, $e)
116
- {
117
- $modulus = JWT::urlsafeB64Decode($n);
118
- $publicExponent = JWT::urlsafeB64Decode($e);
119
-
120
- $components = array(
121
- 'modulus' => \pack('Ca*a*', 2, self::encodeLength(\strlen($modulus)), $modulus),
122
- 'publicExponent' => \pack('Ca*a*', 2, self::encodeLength(\strlen($publicExponent)), $publicExponent)
123
- );
124
-
125
- $rsaPublicKey = \pack(
126
- 'Ca*a*a*',
127
- 48,
128
- self::encodeLength(\strlen($components['modulus']) + \strlen($components['publicExponent'])),
129
- $components['modulus'],
130
- $components['publicExponent']
131
- );
132
-
133
- // sequence(oid(1.2.840.113549.1.1.1), null)) = rsaEncryption.
134
- $rsaOID = \pack('H*', '300d06092a864886f70d0101010500'); // hex version of MA0GCSqGSIb3DQEBAQUA
135
- $rsaPublicKey = \chr(0) . $rsaPublicKey;
136
- $rsaPublicKey = \chr(3) . self::encodeLength(\strlen($rsaPublicKey)) . $rsaPublicKey;
137
-
138
- $rsaPublicKey = \pack(
139
- 'Ca*a*',
140
- 48,
141
- self::encodeLength(\strlen($rsaOID . $rsaPublicKey)),
142
- $rsaOID . $rsaPublicKey
143
- );
144
-
145
- $rsaPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" .
146
- \chunk_split(\base64_encode($rsaPublicKey), 64) .
147
- '-----END PUBLIC KEY-----';
148
-
149
- return $rsaPublicKey;
150
- }
151
-
152
- /**
153
- * DER-encode the length
154
- *
155
- * DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See
156
- * {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information.
157
- *
158
- * @param int $length
159
- * @return string
160
- */
161
- private static function encodeLength($length)
162
- {
163
- if ($length <= 0x7F) {
164
- return \chr($length);
165
- }
166
-
167
- $temp = \ltrim(\pack('N', $length), \chr(0));
168
-
169
- return \pack('Ca*', 0x80 | \strlen($temp), $temp);
170
- }
171
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/firebase/php-jwt/src/JWT.php DELETED
@@ -1,512 +0,0 @@
1
- <?php
2
-
3
- namespace Firebase\JWT;
4
-
5
- use \DomainException;
6
- use \InvalidArgumentException;
7
- use \UnexpectedValueException;
8
- use \DateTime;
9
-
10
- /**
11
- * JSON Web Token implementation, based on this spec:
12
- * https://tools.ietf.org/html/rfc7519
13
- *
14
- * PHP version 5
15
- *
16
- * @category Authentication
17
- * @package Authentication_JWT
18
- * @author Neuman Vong <neuman@twilio.com>
19
- * @author Anant Narayanan <anant@php.net>
20
- * @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD
21
- * @link https://github.com/firebase/php-jwt
22
- */
23
- class JWT
24
- {
25
- const ASN1_INTEGER = 0x02;
26
- const ASN1_SEQUENCE = 0x10;
27
- const ASN1_BIT_STRING = 0x03;
28
-
29
- /**
30
- * When checking nbf, iat or expiration times,
31
- * we want to provide some extra leeway time to
32
- * account for clock skew.
33
- */
34
- public static $leeway = 0;
35
-
36
- /**
37
- * Allow the current timestamp to be specified.
38
- * Useful for fixing a value within unit testing.
39
- *
40
- * Will default to PHP time() value if null.
41
- */
42
- public static $timestamp = null;
43
-
44
- public static $supported_algs = array(
45
- 'ES256' => array('openssl', 'SHA256'),
46
- 'HS256' => array('hash_hmac', 'SHA256'),
47
- 'HS384' => array('hash_hmac', 'SHA384'),
48
- 'HS512' => array('hash_hmac', 'SHA512'),
49
- 'RS256' => array('openssl', 'SHA256'),
50
- 'RS384' => array('openssl', 'SHA384'),
51
- 'RS512' => array('openssl', 'SHA512'),
52
- );
53
-
54
- /**
55
- * Decodes a JWT string into a PHP object.
56
- *
57
- * @param string $jwt The JWT
58
- * @param string|array|resource $key The key, or map of keys.
59
- * If the algorithm used is asymmetric, this is the public key
60
- * @param array $allowed_algs List of supported verification algorithms
61
- * Supported algorithms are 'ES256', 'HS256', 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
62
- *
63
- * @return object The JWT's payload as a PHP object
64
- *
65
- * @throws UnexpectedValueException Provided JWT was invalid
66
- * @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed
67
- * @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf'
68
- * @throws BeforeValidException Provided JWT is trying to be used before it's been created as defined by 'iat'
69
- * @throws ExpiredException Provided JWT has since expired, as defined by the 'exp' claim
70
- *
71
- * @uses jsonDecode
72
- * @uses urlsafeB64Decode
73
- */
74
- public static function decode($jwt, $key, array $allowed_algs = array())
75
- {
76
- $timestamp = \is_null(static::$timestamp) ? \time() : static::$timestamp;
77
-
78
- if (empty($key)) {
79
- throw new InvalidArgumentException('Key may not be empty');
80
- }
81
- $tks = \explode('.', $jwt);
82
- if (\count($tks) != 3) {
83
- throw new UnexpectedValueException('Wrong number of segments');
84
- }
85
- list($headb64, $bodyb64, $cryptob64) = $tks;
86
- if (null === ($header = static::jsonDecode(static::urlsafeB64Decode($headb64)))) {
87
- throw new UnexpectedValueException('Invalid header encoding');
88
- }
89
- if (null === $payload = static::jsonDecode(static::urlsafeB64Decode($bodyb64))) {
90
- throw new UnexpectedValueException('Invalid claims encoding');
91
- }
92
- if (false === ($sig = static::urlsafeB64Decode($cryptob64))) {
93
- throw new UnexpectedValueException('Invalid signature encoding');
94
- }
95
- if (empty($header->alg)) {
96
- throw new UnexpectedValueException('Empty algorithm');
97
- }
98
- if (empty(static::$supported_algs[$header->alg])) {
99
- throw new UnexpectedValueException('Algorithm not supported');
100
- }
101
- if (!\in_array($header->alg, $allowed_algs)) {
102
- throw new UnexpectedValueException('Algorithm not allowed');
103
- }
104
- if ($header->alg === 'ES256') {
105
- // OpenSSL expects an ASN.1 DER sequence for ES256 signatures
106
- $sig = self::signatureToDER($sig);
107
- }
108
-
109
- if (\is_array($key) || $key instanceof \ArrayAccess) {
110
- if (isset($header->kid)) {
111
- if (!isset($key[$header->kid])) {
112
- throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key');
113
- }
114
- $key = $key[$header->kid];
115
- } else {
116
- throw new UnexpectedValueException('"kid" empty, unable to lookup correct key');
117
- }
118
- }
119
-
120
- // Check the signature
121
- if (!static::verify("$headb64.$bodyb64", $sig, $key, $header->alg)) {
122
- throw new SignatureInvalidException('Signature verification failed');
123
- }
124
-
125
- // Check the nbf if it is defined. This is the time that the
126
- // token can actually be used. If it's not yet that time, abort.
127
- if (isset($payload->nbf) && $payload->nbf > ($timestamp + static::$leeway)) {
128
- throw new BeforeValidException(
129
- 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->nbf)
130
- );
131
- }
132
-
133
- // Check that this token has been created before 'now'. This prevents
134
- // using tokens that have been created for later use (and haven't
135
- // correctly used the nbf claim).
136
- if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
137
- throw new BeforeValidException(
138
- 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->iat)
139
- );
140
- }
141
-
142
- // Check if this token has expired.
143
- if (isset($payload->exp) && ($timestamp - static::$leeway) >= $payload->exp) {
144
- throw new ExpiredException('Expired token');
145
- }
146
-
147
- return $payload;
148
- }
149
-
150
- /**
151
- * Converts and signs a PHP object or array into a JWT string.
152
- *
153
- * @param object|array $payload PHP object or array
154
- * @param string $key The secret key.
155
- * If the algorithm used is asymmetric, this is the private key
156
- * @param string $alg The signing algorithm.
157
- * Supported algorithms are 'ES256', 'HS256', 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
158
- * @param mixed $keyId
159
- * @param array $head An array with header elements to attach
160
- *
161
- * @return string A signed JWT
162
- *
163
- * @uses jsonEncode
164
- * @uses urlsafeB64Encode
165
- */
166
- public static function encode($payload, $key, $alg = 'HS256', $keyId = null, $head = null)
167
- {
168
- $header = array('typ' => 'JWT', 'alg' => $alg);
169
- if ($keyId !== null) {
170
- $header['kid'] = $keyId;
171
- }
172
- if (isset($head) && \is_array($head)) {
173
- $header = \array_merge($head, $header);
174
- }
175
- $segments = array();
176
- $segments[] = static::urlsafeB64Encode(static::jsonEncode($header));
177
- $segments[] = static::urlsafeB64Encode(static::jsonEncode($payload));
178
- $signing_input = \implode('.', $segments);
179
-
180
- $signature = static::sign($signing_input, $key, $alg);
181
- $segments[] = static::urlsafeB64Encode($signature);
182
-
183
- return \implode('.', $segments);
184
- }
185
-
186
- /**
187
- * Sign a string with a given key and algorithm.
188
- *
189
- * @param string $msg The message to sign
190
- * @param string|resource $key The secret key
191
- * @param string $alg The signing algorithm.
192
- * Supported algorithms are 'ES256', 'HS256', 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
193
- *
194
- * @return string An encrypted message
195
- *
196
- * @throws DomainException Unsupported algorithm was specified
197
- */
198
- public static function sign($msg, $key, $alg = 'HS256')
199
- {
200
- if (empty(static::$supported_algs[$alg])) {
201
- throw new DomainException('Algorithm not supported');
202
- }
203
- list($function, $algorithm) = static::$supported_algs[$alg];
204
- switch ($function) {
205
- case 'hash_hmac':
206
- return \hash_hmac($algorithm, $msg, $key, true);
207
- case 'openssl':
208
- $signature = '';
209
- $success = \openssl_sign($msg, $signature, $key, $algorithm);
210
- if (!$success) {
211
- throw new DomainException("OpenSSL unable to sign data");
212
- } else {
213
- if ($alg === 'ES256') {
214
- $signature = self::signatureFromDER($signature, 256);
215
- }
216
- return $signature;
217
- }
218
- }
219
- }
220
-
221
- /**
222
- * Verify a signature with the message, key and method. Not all methods
223
- * are symmetric, so we must have a separate verify and sign method.
224
- *
225
- * @param string $msg The original message (header and body)
226
- * @param string $signature The original signature
227
- * @param string|resource $key For HS*, a string key works. for RS*, must be a resource of an openssl public key
228
- * @param string $alg The algorithm
229
- *
230
- * @return bool
231
- *
232
- * @throws DomainException Invalid Algorithm or OpenSSL failure
233
- */
234
- private static function verify($msg, $signature, $key, $alg)
235
- {
236
- if (empty(static::$supported_algs[$alg])) {
237
- throw new DomainException('Algorithm not supported');
238
- }
239
-
240
- list($function, $algorithm) = static::$supported_algs[$alg];
241
- switch ($function) {
242
- case 'openssl':
243
- $success = \openssl_verify($msg, $signature, $key, $algorithm);
244
- if ($success === 1) {
245
- return true;
246
- } elseif ($success === 0) {
247
- return false;
248
- }
249
- // returns 1 on success, 0 on failure, -1 on error.
250
- throw new DomainException(
251
- 'OpenSSL error: ' . \openssl_error_string()
252
- );
253
- case 'hash_hmac':
254
- default:
255
- $hash = \hash_hmac($algorithm, $msg, $key, true);
256
- if (\function_exists('hash_equals')) {
257
- return \hash_equals($signature, $hash);
258
- }
259
- $len = \min(static::safeStrlen($signature), static::safeStrlen($hash));
260
-
261
- $status = 0;
262
- for ($i = 0; $i < $len; $i++) {
263
- $status |= (\ord($signature[$i]) ^ \ord($hash[$i]));
264
- }
265
- $status |= (static::safeStrlen($signature) ^ static::safeStrlen($hash));
266
-
267
- return ($status === 0);
268
- }
269
- }
270
-
271
- /**
272
- * Decode a JSON string into a PHP object.
273
- *
274
- * @param string $input JSON string
275
- *
276
- * @return object Object representation of JSON string
277
- *
278
- * @throws DomainException Provided string was invalid JSON
279
- */
280
- public static function jsonDecode($input)
281
- {
282
- if (\version_compare(PHP_VERSION, '5.4.0', '>=') && !(\defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
283
- /** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you
284
- * to specify that large ints (like Steam Transaction IDs) should be treated as
285
- * strings, rather than the PHP default behaviour of converting them to floats.
286
- */
287
- $obj = \json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
288
- } else {
289
- /** Not all servers will support that, however, so for older versions we must
290
- * manually detect large ints in the JSON string and quote them (thus converting
291
- *them to strings) before decoding, hence the preg_replace() call.
292
- */
293
- $max_int_length = \strlen((string) PHP_INT_MAX) - 1;
294
- $json_without_bigints = \preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input);
295
- $obj = \json_decode($json_without_bigints);
296
- }
297
-
298
- if ($errno = \json_last_error()) {
299
- static::handleJsonError($errno);
300
- } elseif ($obj === null && $input !== 'null') {
301
- throw new DomainException('Null result with non-null input');
302
- }
303
- return $obj;
304
- }
305
-
306
- /**
307
- * Encode a PHP object into a JSON string.
308
- *
309
- * @param object|array $input A PHP object or array
310
- *
311
- * @return string JSON representation of the PHP object or array
312
- *
313
- * @throws DomainException Provided object could not be encoded to valid JSON
314
- */
315
- public static function jsonEncode($input)
316
- {
317
- $json = \json_encode($input);
318
- if ($errno = \json_last_error()) {
319
- static::handleJsonError($errno);
320
- } elseif ($json === 'null' && $input !== null) {
321
- throw new DomainException('Null result with non-null input');
322
- }
323
- return $json;
324
- }
325
-
326
- /**
327
- * Decode a string with URL-safe Base64.
328
- *
329
- * @param string $input A Base64 encoded string
330
- *
331
- * @return string A decoded string
332
- */
333
- public static function urlsafeB64Decode($input)
334
- {
335
- $remainder = \strlen($input) % 4;
336
- if ($remainder) {
337
- $padlen = 4 - $remainder;
338
- $input .= \str_repeat('=', $padlen);
339
- }
340
- return \base64_decode(\strtr($input, '-_', '+/'));
341
- }
342
-
343
- /**
344
- * Encode a string with URL-safe Base64.
345
- *
346
- * @param string $input The string you want encoded
347
- *
348
- * @return string The base64 encode of what you passed in
349
- */
350
- public static function urlsafeB64Encode($input)
351
- {
352
- return \str_replace('=', '', \strtr(\base64_encode($input), '+/', '-_'));
353
- }
354
-
355
- /**
356
- * Helper method to create a JSON error.
357
- *
358
- * @param int $errno An error number from json_last_error()
359
- *
360
- * @return void
361
- */
362
- private static function handleJsonError($errno)
363
- {
364
- $messages = array(
365
- JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
366
- JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',
367
- JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
368
- JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
369
- JSON_ERROR_UTF8 => 'Malformed UTF-8 characters' //PHP >= 5.3.3
370
- );
371
- throw new DomainException(
372
- isset($messages[$errno])
373
- ? $messages[$errno]
374
- : 'Unknown JSON error: ' . $errno
375
- );
376
- }
377
-
378
- /**
379
- * Get the number of bytes in cryptographic strings.
380
- *
381
- * @param string $str
382
- *
383
- * @return int
384
- */
385
- private static function safeStrlen($str)
386
- {
387
- if (\function_exists('mb_strlen')) {
388
- return \mb_strlen($str, '8bit');
389
- }
390
- return \strlen($str);
391
- }
392
-
393
- /**
394
- * Convert an ECDSA signature to an ASN.1 DER sequence
395
- *
396
- * @param string $sig The ECDSA signature to convert
397
- * @return string The encoded DER object
398
- */
399
- private static function signatureToDER($sig)
400
- {
401
- // Separate the signature into r-value and s-value
402
- list($r, $s) = \str_split($sig, (int) (\strlen($sig) / 2));
403
-
404
- // Trim leading zeros
405
- $r = \ltrim($r, "\x00");
406
- $s = \ltrim($s, "\x00");
407
-
408
- // Convert r-value and s-value from unsigned big-endian integers to
409
- // signed two's complement
410
- if (\ord($r[0]) > 0x7f) {
411
- $r = "\x00" . $r;
412
- }
413
- if (\ord($s[0]) > 0x7f) {
414
- $s = "\x00" . $s;
415
- }
416
-
417
- return self::encodeDER(
418
- self::ASN1_SEQUENCE,
419
- self::encodeDER(self::ASN1_INTEGER, $r) .
420
- self::encodeDER(self::ASN1_INTEGER, $s)
421
- );
422
- }
423
-
424
- /**
425
- * Encodes a value into a DER object.
426
- *
427
- * @param int $type DER tag
428
- * @param string $value the value to encode
429
- * @return string the encoded object
430
- */
431
- private static function encodeDER($type, $value)
432
- {
433
- $tag_header = 0;
434
- if ($type === self::ASN1_SEQUENCE) {
435
- $tag_header |= 0x20;
436
- }
437
-
438
- // Type
439
- $der = \chr($tag_header | $type);
440
-
441
- // Length
442
- $der .= \chr(\strlen($value));
443
-
444
- return $der . $value;
445
- }
446
-
447
- /**
448
- * Encodes signature from a DER object.
449
- *
450
- * @param string $der binary signature in DER format
451
- * @param int $keySize the number of bits in the key
452
- * @return string the signature
453
- */
454
- private static function signatureFromDER($der, $keySize)
455
- {
456
- // OpenSSL returns the ECDSA signatures as a binary ASN.1 DER SEQUENCE
457
- list($offset, $_) = self::readDER($der);
458
- list($offset, $r) = self::readDER($der, $offset);
459
- list($offset, $s) = self::readDER($der, $offset);
460
-
461
- // Convert r-value and s-value from signed two's compliment to unsigned
462
- // big-endian integers
463
- $r = \ltrim($r, "\x00");
464
- $s = \ltrim($s, "\x00");
465
-
466
- // Pad out r and s so that they are $keySize bits long
467
- $r = \str_pad($r, $keySize / 8, "\x00", STR_PAD_LEFT);
468
- $s = \str_pad($s, $keySize / 8, "\x00", STR_PAD_LEFT);
469
-
470
- return $r . $s;
471
- }
472
-
473
- /**
474
- * Reads binary DER-encoded data and decodes into a single object
475
- *
476
- * @param string $der the binary data in DER format
477
- * @param int $offset the offset of the data stream containing the object
478
- * to decode
479
- * @return array [$offset, $data] the new offset and the decoded object
480
- */
481
- private static function readDER($der, $offset = 0)
482
- {
483
- $pos = $offset;
484
- $size = \strlen($der);
485
- $constructed = (\ord($der[$pos]) >> 5) & 0x01;
486
- $type = \ord($der[$pos++]) & 0x1f;
487
-
488
- // Length
489
- $len = \ord($der[$pos++]);
490
- if ($len & 0x80) {
491
- $n = $len & 0x1f;
492
- $len = 0;
493
- while ($n-- && $pos < $size) {
494
- $len = ($len << 8) | \ord($der[$pos++]);
495
- }
496
- }
497
-
498
- // Value
499
- if ($type == self::ASN1_BIT_STRING) {
500
- $pos++; // Skip the first contents octet (padding indicator)
501
- $data = \substr($der, $pos, $len - 1);
502
- $pos += $len - 1;
503
- } elseif (!$constructed) {
504
- $data = \substr($der, $pos, $len);
505
- $pos += $len;
506
- } else {
507
- $data = null;
508
- }
509
-
510
- return array($pos, $data);
511
- }
512
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/firebase/php-jwt/src/SignatureInvalidException.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- namespace Firebase\JWT;
3
-
4
- class SignatureInvalidException extends \UnexpectedValueException
5
- {
6
- }
 
 
 
 
 
 
vendor/google/apiclient-services/LICENSE DELETED
@@ -1,203 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
202
-
203
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient-services/README.md DELETED
@@ -1,23 +0,0 @@
1
- Google PHP API Client Services
2
- ==============================
3
-
4
- ## Requirements
5
-
6
- [Google API PHP Client](https://github.com/googleapis/google-api-php-client/releases)
7
-
8
- ## Usage in v2 of Google API PHP Client
9
-
10
- This library is automatically updated daily with new API changes, and tagged weekly.
11
- It is installed as part of the
12
- [Google API PHP Client](https://github.com/googleapis/google-api-php-client/releases)
13
- library via Composer, which will pull down the most recent tag.
14
-
15
- ## Usage in v1
16
-
17
- If you are currently using the [`v1-master`](https://github.com/googleapis/google-api-php-client/tree/v1-master)
18
- branch of the client library, but want to use the latest API services, you can
19
- do so by requiring this library directly into your project via the same composer command:
20
-
21
- ```sh
22
- composer require google/apiclient-services:dev-master
23
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/LICENSE DELETED
@@ -1,203 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
202
-
203
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/README.md DELETED
@@ -1,456 +0,0 @@
1
- ![](https://github.com/googleapis/google-api-php-client/workflows/.github/workflows/tests.yml/badge.svg)
2
-
3
- # Google APIs Client Library for PHP #
4
-
5
- The Google API Client Library enables you to work with Google APIs such as Gmail, Drive or YouTube on your server.
6
-
7
- These client libraries are officially supported by Google. However, the libraries are considered complete and are in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.
8
-
9
- **NOTE** The actively maintained (v2) version of this client requires PHP 5.4 or above. If you require support for PHP 5.2 or 5.3, use the v1 branch.
10
-
11
- ## Google Cloud Platform
12
-
13
- For Google Cloud Platform APIs such as Datastore, Cloud Storage or Pub/Sub, we recommend using [GoogleCloudPlatform/google-cloud-php](https://github.com/googleapis/google-cloud-php) which is under active development.
14
-
15
- ## Requirements ##
16
- * [PHP 5.4.0 or higher](https://www.php.net/)
17
-
18
- ## Developer Documentation ##
19
-
20
- The [docs folder](docs/) provides detailed guides for using this library.
21
-
22
- ## Installation ##
23
-
24
- You can use **Composer** or simply **Download the Release**
25
-
26
- ### Composer
27
-
28
- The preferred method is via [composer](https://getcomposer.org/). Follow the
29
- [installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have
30
- composer installed.
31
-
32
- Once composer is installed, execute the following command in your project root to install this library:
33
-
34
- ```sh
35
- composer require google/apiclient:"^2.7"
36
- ```
37
-
38
- Finally, be sure to include the autoloader:
39
-
40
- ```php
41
- require_once '/path/to/your-project/vendor/autoload.php';
42
- ```
43
-
44
- This library relies on `google/apiclient-services`. That library provides up-to-date API wrappers for a large number of Google APIs. In order that users may make use of the latest API clients, this library does not pin to a specific version of `google/apiclient-services`. **In order to prevent the accidental installation of API wrappers with breaking changes**, it is highly recommended that you pin to the [latest version](https://github.com/googleapis/google-api-php-client-services/releases) yourself prior to using this library in production.
45
-
46
- #### Cleaning up unused services
47
-
48
- There are over 200 Google API services. The chances are good that you will not
49
- want them all. In order to avoid shipping these dependencies with your code,
50
- you can run the `Google_Task_Composer::cleanup` task and specify the services
51
- you want to keep in `composer.json`:
52
-
53
- ```json
54
- {
55
- "require": {
56
- "google/apiclient": "^2.7"
57
- },
58
- "scripts": {
59
- "post-update-cmd": "Google_Task_Composer::cleanup"
60
- },
61
- "extra": {
62
- "google/apiclient-services": [
63
- "Drive",
64
- "YouTube"
65
- ]
66
- }
67
- }
68
- ```
69
-
70
- This example will remove all services other than "Drive" and "YouTube" when
71
- `composer update` or a fresh `composer install` is run.
72
-
73
- **IMPORTANT**: If you add any services back in `composer.json`, you will need to
74
- remove the `vendor/google/apiclient-services` directory explicity for the
75
- change you made to have effect:
76
-
77
- ```sh
78
- rm -r vendor/google/apiclient-services
79
- composer update
80
- ```
81
-
82
- **NOTE**: This command performs an exact match on the service name, so to keep
83
- `YouTubeReporting` and `YouTubeAnalytics` as well, you'd need to add each of
84
- them explicitly:
85
-
86
- ```json
87
- {
88
- "extra": {
89
- "google/apiclient-services": [
90
- "Drive",
91
- "YouTube",
92
- "YouTubeAnalytics",
93
- "YouTubeReporting"
94
- ]
95
- }
96
- }
97
- ```
98
-
99
- ### Download the Release
100
-
101
- If you prefer not to use composer, you can download the package in its entirety. The [Releases](https://github.com/googleapis/google-api-php-client/releases) page lists all stable versions. Download any file
102
- with the name `google-api-php-client-[RELEASE_NAME].zip` for a package including this library and its dependencies.
103
-
104
- Uncompress the zip file you download, and include the autoloader in your project:
105
-
106
- ```php
107
- require_once '/path/to/google-api-php-client/vendor/autoload.php';
108
- ```
109
-
110
- For additional installation and setup instructions, see [the documentation](docs/).
111
-
112
- ## Examples ##
113
- See the [`examples/`](examples) directory for examples of the key client features. You can
114
- view them in your browser by running the php built-in web server.
115
-
116
- ```
117
- $ php -S localhost:8000 -t examples/
118
- ```
119
-
120
- And then browsing to the host and port you specified
121
- (in the above example, `http://localhost:8000`).
122
-
123
- ### Basic Example ###
124
-
125
- ```php
126
- // include your composer dependencies
127
- require_once 'vendor/autoload.php';
128
-
129
- $client = new Google_Client();
130
- $client->setApplicationName("Client_Library_Examples");
131
- $client->setDeveloperKey("YOUR_APP_KEY");
132
-
133
- $service = new Google_Service_Books($client);
134
- $optParams = array(
135
- 'filter' => 'free-ebooks',
136
- 'q' => 'Henry David Thoreau'
137
- );
138
- $results = $service->volumes->listVolumes($optParams);
139
-
140
- foreach ($results->getItems() as $item) {
141
- echo $item['volumeInfo']['title'], "<br /> \n";
142
- }
143
- ```
144
-
145
- ### Authentication with OAuth ###
146
-
147
- > An example of this can be seen in [`examples/simple-file-upload.php`](examples/simple-file-upload.php).
148
-
149
- 1. Follow the instructions to [Create Web Application Credentials](docs/oauth-web.md#create-authorization-credentials)
150
- 1. Download the JSON credentials
151
- 1. Set the path to these credentials using `Google_Client::setAuthConfig`:
152
-
153
- ```php
154
- $client = new Google_Client();
155
- $client->setAuthConfig('/path/to/client_credentials.json');
156
- ```
157
-
158
- 1. Set the scopes required for the API you are going to call
159
-
160
- ```php
161
- $client->addScope(Google_Service_Drive::DRIVE);
162
- ```
163
-
164
- 1. Set your application's redirect URI
165
-
166
- ```php
167
- // Your redirect URI can be any registered URI, but in this example
168
- // we redirect back to this same page
169
- $redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
170
- $client->setRedirectUri($redirect_uri);
171
- ```
172
-
173
- 1. In the script handling the redirect URI, exchange the authorization code for an access token:
174
-
175
- ```php
176
- if (isset($_GET['code'])) {
177
- $token = $client->fetchAccessTokenWithAuthCode($_GET['code']);
178
- }
179
- ```
180
-
181
- ### Authentication with Service Accounts ###
182
-
183
- > An example of this can be seen in [`examples/service-account.php`](examples/service-account.php).
184
-
185
- Some APIs
186
- (such as the [YouTube Data API](https://developers.google.com/youtube/v3/)) do
187
- not support service accounts. Check with the specific API documentation if API
188
- calls return unexpected 401 or 403 errors.
189
-
190
- 1. Follow the instructions to [Create a Service Account](docs/oauth-server.md#creating-a-service-account)
191
- 1. Download the JSON credentials
192
- 1. Set the path to these credentials using the `GOOGLE_APPLICATION_CREDENTIALS` environment variable:
193
-
194
- ```php
195
- putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');
196
- ```
197
-
198
- 1. Tell the Google client to use your service account credentials to authenticate:
199
-
200
- ```php
201
- $client = new Google_Client();
202
- $client->useApplicationDefaultCredentials();
203
- ```
204
-
205
- 1. Set the scopes required for the API you are going to call
206
-
207
- ```php
208
- $client->addScope(Google_Service_Drive::DRIVE);
209
- ```
210
-
211
- 1. If you have delegated domain-wide access to the service account and you want to impersonate a user account, specify the email address of the user account using the method setSubject:
212
-
213
- ```php
214
- $client->setSubject($user_to_impersonate);
215
- ```
216
-
217
- ### Making Requests ###
218
-
219
- The classes used to call the API in [google-api-php-client-services](https://github.com/googleapis/google-api-php-client-services) are autogenerated. They map directly to the JSON requests and responses found in the [APIs Explorer](https://developers.google.com/apis-explorer/#p/).
220
-
221
- A JSON request to the [Datastore API](https://developers.google.com/apis-explorer/#p/datastore/v1beta3/datastore.projects.runQuery) would look like this:
222
-
223
- ```json
224
- POST https://datastore.googleapis.com/v1beta3/projects/YOUR_PROJECT_ID:runQuery?key=YOUR_API_KEY
225
-
226
- {
227
- "query": {
228
- "kind": [{
229
- "name": "Book"
230
- }],
231
- "order": [{
232
- "property": {
233
- "name": "title"
234
- },
235
- "direction": "descending"
236
- }],
237
- "limit": 10
238
- }
239
- }
240
- ```
241
-
242
- Using this library, the same call would look something like this:
243
-
244
- ```php
245
- // create the datastore service class
246
- $datastore = new Google_Service_Datastore($client);
247
-
248
- // build the query - this maps directly to the JSON
249
- $query = new Google_Service_Datastore_Query([
250
- 'kind' => [
251
- [
252
- 'name' => 'Book',
253
- ],
254
- ],
255
- 'order' => [
256
- 'property' => [
257
- 'name' => 'title',
258
- ],
259
- 'direction' => 'descending',
260
- ],
261
- 'limit' => 10,
262
- ]);
263
-
264
- // build the request and response
265
- $request = new Google_Service_Datastore_RunQueryRequest(['query' => $query]);
266
- $response = $datastore->projects->runQuery('YOUR_DATASET_ID', $request);
267
- ```
268
-
269
- However, as each property of the JSON API has a corresponding generated class, the above code could also be written like this:
270
-
271
- ```php
272
- // create the datastore service class
273
- $datastore = new Google_Service_Datastore($client);
274
-
275
- // build the query
276
- $request = new Google_Service_Datastore_RunQueryRequest();
277
- $query = new Google_Service_Datastore_Query();
278
- // - set the order
279
- $order = new Google_Service_Datastore_PropertyOrder();
280
- $order->setDirection('descending');
281
- $property = new Google_Service_Datastore_PropertyReference();
282
- $property->setName('title');
283
- $order->setProperty($property);
284
- $query->setOrder([$order]);
285
- // - set the kinds
286
- $kind = new Google_Service_Datastore_KindExpression();
287
- $kind->setName('Book');
288
- $query->setKinds([$kind]);
289
- // - set the limit
290
- $query->setLimit(10);
291
-
292
- // add the query to the request and make the request
293
- $request->setQuery($query);
294
- $response = $datastore->projects->runQuery('YOUR_DATASET_ID', $request);
295
- ```
296
-
297
- The method used is a matter of preference, but *it will be very difficult to use this library without first understanding the JSON syntax for the API*, so it is recommended to look at the [APIs Explorer](https://developers.google.com/apis-explorer/#p/) before using any of the services here.
298
-
299
- ### Making HTTP Requests Directly ###
300
-
301
- If Google Authentication is desired for external applications, or a Google API is not available yet in this library, HTTP requests can be made directly.
302
-
303
- If you are installing this client only to authenticate your own HTTP client requests, you should use [`google/auth`](https://github.com/googleapis/google-auth-library-php#call-the-apis) instead.
304
-
305
- The `authorize` method returns an authorized [Guzzle Client](http://docs.guzzlephp.org/), so any request made using the client will contain the corresponding authorization.
306
-
307
- ```php
308
- // create the Google client
309
- $client = new Google_Client();
310
-
311
- /**
312
- * Set your method for authentication. Depending on the API, This could be
313
- * directly with an access token, API key, or (recommended) using
314
- * Application Default Credentials.
315
- */
316
- $client->useApplicationDefaultCredentials();
317
- $client->addScope(Google_Service_Plus::PLUS_ME);
318
-
319
- // returns a Guzzle HTTP Client
320
- $httpClient = $client->authorize();
321
-
322
- // make an HTTP request
323
- $response = $httpClient->get('https://www.googleapis.com/plus/v1/people/me');
324
- ```
325
-
326
- ### Caching ###
327
-
328
- It is recommended to use another caching library to improve performance. This can be done by passing a [PSR-6](https://www.php-fig.org/psr/psr-6/) compatible library to the client:
329
-
330
- ```php
331
- use League\Flysystem\Adapter\Local;
332
- use League\Flysystem\Filesystem;
333
- use Cache\Adapter\Filesystem\FilesystemCachePool;
334
-
335
- $filesystemAdapter = new Local(__DIR__.'/');
336
- $filesystem = new Filesystem($filesystemAdapter);
337
-
338
- $cache = new FilesystemCachePool($filesystem);
339
- $client->setCache($cache);
340
- ```
341
-
342
- In this example we use [PHP Cache](http://www.php-cache.com/). Add this to your project with composer:
343
-
344
- ```
345
- composer require cache/filesystem-adapter
346
- ```
347
-
348
- ### Updating Tokens ###
349
-
350
- When using [Refresh Tokens](https://developers.google.com/identity/protocols/OAuth2InstalledApp#offline) or [Service Account Credentials](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#overview), it may be useful to perform some action when a new access token is granted. To do this, pass a callable to the `setTokenCallback` method on the client:
351
-
352
- ```php
353
- $logger = new Monolog\Logger;
354
- $tokenCallback = function ($cacheKey, $accessToken) use ($logger) {
355
- $logger->debug(sprintf('new access token received at cache key %s', $cacheKey));
356
- };
357
- $client->setTokenCallback($tokenCallback);
358
- ```
359
-
360
- ### Debugging Your HTTP Request using Charles ###
361
-
362
- It is often very useful to debug your API calls by viewing the raw HTTP request. This library supports the use of [Charles Web Proxy](https://www.charlesproxy.com/documentation/getting-started/). Download and run Charles, and then capture all HTTP traffic through Charles with the following code:
363
-
364
- ```php
365
- // FOR DEBUGGING ONLY
366
- $httpClient = new GuzzleHttp\Client([
367
- 'proxy' => 'localhost:8888', // by default, Charles runs on localhost port 8888
368
- 'verify' => false, // otherwise HTTPS requests will fail.
369
- ]);
370
-
371
- $client = new Google_Client();
372
- $client->setHttpClient($httpClient);
373
- ```
374
-
375
- Now all calls made by this library will appear in the Charles UI.
376
-
377
- One additional step is required in Charles to view SSL requests. Go to **Charles > Proxy > SSL Proxying Settings** and add the domain you'd like captured. In the case of the Google APIs, this is usually `*.googleapis.com`.
378
-
379
- ### Controlling HTTP Client Configuration Directly
380
-
381
- Google API Client uses [Guzzle](http://docs.guzzlephp.org/) as its default HTTP client. That means that you can control your HTTP requests in the same manner you would for any application using Guzzle.
382
-
383
- Let's say, for instance, we wished to apply a referrer to each request.
384
-
385
- ```php
386
- use GuzzleHttp\Client;
387
-
388
- $httpClient = new Client([
389
- 'headers' => [
390
- 'referer' => 'mysite.com'
391
- ]
392
- ]);
393
-
394
- $client = new Google_Client();
395
- $client->setHttpClient($httpClient);
396
- ```
397
-
398
- Other Guzzle features such as [Handlers and Middleware](http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html) offer even more control.
399
-
400
- ### Service Specific Examples ###
401
-
402
- YouTube: https://github.com/youtube/api-samples/tree/master/php
403
-
404
- ## How Do I Contribute? ##
405
-
406
- Please see the [contributing](.github/CONTRIBUTING.md) page for more information. In particular, we love pull requests - but please make sure to sign the contributor license agreement.
407
-
408
- ## Frequently Asked Questions ##
409
-
410
- ### What do I do if something isn't working? ###
411
-
412
- For support with the library the best place to ask is via the google-api-php-client tag on StackOverflow: https://stackoverflow.com/questions/tagged/google-api-php-client
413
-
414
- If there is a specific bug with the library, please [file an issue](https://github.com/googleapis/google-api-php-client/issues) in the GitHub issues tracker, including an example of the failing code and any specific errors retrieved. Feature requests can also be filed, as long as they are core library requests, and not-API specific: for those, refer to the documentation for the individual APIs for the best place to file requests. Please try to provide a clear statement of the problem that the feature would address.
415
-
416
- ### I want an example of X! ###
417
-
418
- If X is a feature of the library, file away! If X is an example of using a specific service, the best place to go is to the teams for those specific APIs - our preference is to link to their examples rather than add them to the library, as they can then pin to specific versions of the library. If you have any examples for other APIs, let us know and we will happily add a link to the README above!
419
-
420
- ### Why does Google_..._Service have weird names? ###
421
-
422
- The _Service classes are generally automatically generated from the API discovery documents: https://developers.google.com/discovery/. Sometimes new features are added to APIs with unusual names, which can cause some unexpected or non-standard style naming in the PHP classes.
423
-
424
- ### How do I deal with non-JSON response types? ###
425
-
426
- Some services return XML or similar by default, rather than JSON, which is what the library supports. You can request a JSON response by adding an 'alt' argument to optional params that is normally the last argument to a method call:
427
-
428
- ```
429
- $opt_params = array(
430
- 'alt' => "json"
431
- );
432
- ```
433
-
434
- ### How do I set a field to null? ###
435
-
436
- The library strips out nulls from the objects sent to the Google APIs as its the default value of all of the uninitialized properties. To work around this, set the field you want to null to `Google_Model::NULL_VALUE`. This is a placeholder that will be replaced with a true null when sent over the wire.
437
-
438
- ## Code Quality ##
439
-
440
- Run the PHPUnit tests with PHPUnit. You can configure an API key and token in BaseTest.php to run all calls, but this will require some setup on the Google Developer Console.
441
-
442
- phpunit tests/
443
-
444
- ### Coding Style
445
-
446
- To check for coding style violations, run
447
-
448
- ```
449
- vendor/bin/phpcs src --standard=style/ruleset.xml -np
450
- ```
451
-
452
- To automatically fix (fixable) coding style violations, run
453
-
454
- ```
455
- vendor/bin/phpcbf src --standard=style/ruleset.xml
456
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/AccessToken/Revoke.php DELETED
@@ -1,78 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * Copyright 2008 Google Inc.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- use Google\Auth\HttpHandler\HttpHandlerFactory;
20
- use GuzzleHttp\ClientInterface;
21
- use GuzzleHttp\Psr7;
22
- use GuzzleHttp\Psr7\Request;
23
-
24
- /**
25
- * Wrapper around Google Access Tokens which provides convenience functions
26
- *
27
- */
28
- class Google_AccessToken_Revoke
29
- {
30
- /**
31
- * @var GuzzleHttp\ClientInterface The http client
32
- */
33
- private $http;
34
-
35
- /**
36
- * Instantiates the class, but does not initiate the login flow, leaving it
37
- * to the discretion of the caller.
38
- */
39
- public function __construct(ClientInterface $http = null)
40
- {
41
- $this->http = $http;
42
- }
43
-
44
- /**
45
- * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
46
- * token, if a token isn't provided.
47
- *
48
- * @param string|array $token The token (access token or a refresh token) that should be revoked.
49
- * @return boolean Returns True if the revocation was successful, otherwise False.
50
- */
51
- public function revokeToken($token)
52
- {
53
- if (is_array($token)) {
54
- if (isset($token['refresh_token'])) {
55
- $token = $token['refresh_token'];
56
- } else {
57
- $token = $token['access_token'];
58
- }
59
- }
60
-
61
- $body = Psr7\stream_for(http_build_query(array('token' => $token)));
62
- $request = new Request(
63
- 'POST',
64
- Google_Client::OAUTH2_REVOKE_URI,
65
- [
66
- 'Cache-Control' => 'no-store',
67
- 'Content-Type' => 'application/x-www-form-urlencoded',
68
- ],
69
- $body
70
- );
71
-
72
- $httpHandler = HttpHandlerFactory::build($this->http);
73
-
74
- $response = $httpHandler($request);
75
-
76
- return $response->getStatusCode() == 200;
77
- }
78
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/AccessToken/Verify.php DELETED
@@ -1,274 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * Copyright 2008 Google Inc.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- use Firebase\JWT\ExpiredException as ExpiredExceptionV3;
20
- use Firebase\JWT\SignatureInvalidException;
21
- use GuzzleHttp\Client;
22
- use GuzzleHttp\ClientInterface;
23
- use Psr\Cache\CacheItemPoolInterface;
24
- use Google\Auth\Cache\MemoryCacheItemPool;
25
- use Stash\Driver\FileSystem;
26
- use Stash\Pool;
27
-
28
- /**
29
- * Wrapper around Google Access Tokens which provides convenience functions
30
- *
31
- */
32
- class Google_AccessToken_Verify
33
- {
34
- const FEDERATED_SIGNON_CERT_URL = 'https://www.googleapis.com/oauth2/v3/certs';
35
- const OAUTH2_ISSUER = 'accounts.google.com';
36
- const OAUTH2_ISSUER_HTTPS = 'https://accounts.google.com';
37
-
38
- /**
39
- * @var GuzzleHttp\ClientInterface The http client
40
- */
41
- private $http;
42
-
43
- /**
44
- * @var Psr\Cache\CacheItemPoolInterface cache class
45
- */
46
- private $cache;
47
-
48
- /**
49
- * Instantiates the class, but does not initiate the login flow, leaving it
50
- * to the discretion of the caller.
51
- */
52
- public function __construct(
53
- ClientInterface $http = null,
54
- CacheItemPoolInterface $cache = null,
55
- $jwt = null
56
- ) {
57
- if (null === $http) {
58
- $http = new Client();
59
- }
60
-
61
- if (null === $cache) {
62
- $cache = new MemoryCacheItemPool;
63
- }
64
-
65
- $this->http = $http;
66
- $this->cache = $cache;
67
- $this->jwt = $jwt ?: $this->getJwtService();
68
- }
69
-
70
- /**
71
- * Verifies an id token and returns the authenticated apiLoginTicket.
72
- * Throws an exception if the id token is not valid.
73
- * The audience parameter can be used to control which id tokens are
74
- * accepted. By default, the id token must have been issued to this OAuth2 client.
75
- *
76
- * @param string $idToken the ID token in JWT format
77
- * @param string $audience Optional. The audience to verify against JWt "aud"
78
- * @return array the token payload, if successful
79
- */
80
- public function verifyIdToken($idToken, $audience = null)
81
- {
82
- if (empty($idToken)) {
83
- throw new LogicException('id_token cannot be null');
84
- }
85
-
86
- // set phpseclib constants if applicable
87
- $this->setPhpsecConstants();
88
-
89
- // Check signature
90
- $certs = $this->getFederatedSignOnCerts();
91
- foreach ($certs as $cert) {
92
- $bigIntClass = $this->getBigIntClass();
93
- $rsaClass = $this->getRsaClass();
94
- $modulus = new $bigIntClass($this->jwt->urlsafeB64Decode($cert['n']), 256);
95
- $exponent = new $bigIntClass($this->jwt->urlsafeB64Decode($cert['e']), 256);
96
-
97
- $rsa = new $rsaClass();
98
- $rsa->loadKey(array('n' => $modulus, 'e' => $exponent));
99
-
100
- try {
101
- $payload = $this->jwt->decode(
102
- $idToken,
103
- $rsa->getPublicKey(),
104
- array('RS256')
105
- );
106
-
107
- if (property_exists($payload, 'aud')) {
108
- if ($audience && $payload->aud != $audience) {
109
- return false;
110
- }
111
- }
112
-
113
- // support HTTP and HTTPS issuers
114
- // @see https://developers.google.com/identity/sign-in/web/backend-auth
115
- $issuers = array(self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS);
116
- if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) {
117
- return false;
118
- }
119
-
120
- return (array) $payload;
121
- } catch (ExpiredException $e) {
122
- return false;
123
- } catch (ExpiredExceptionV3 $e) {
124
- return false;
125
- } catch (SignatureInvalidException $e) {
126
- // continue
127
- } catch (DomainException $e) {
128
- // continue
129
- }
130
- }
131
-
132
- return false;
133
- }
134
-
135
- private function getCache()
136
- {
137
- return $this->cache;
138
- }
139
-
140
- /**
141
- * Retrieve and cache a certificates file.
142
- *
143
- * @param $url string location
144
- * @throws Google_Exception
145
- * @return array certificates
146
- */
147
- private function retrieveCertsFromLocation($url)
148
- {
149
- // If we're retrieving a local file, just grab it.
150
- if (0 !== strpos($url, 'http')) {
151
- if (!$file = file_get_contents($url)) {
152
- throw new Google_Exception(
153
- "Failed to retrieve verification certificates: '" .
154
- $url . "'."
155
- );
156
- }
157
-
158
- return json_decode($file, true);
159
- }
160
-
161
- $response = $this->http->get($url);
162
-
163
- if ($response->getStatusCode() == 200) {
164
- return json_decode((string) $response->getBody(), true);
165
- }
166
- throw new Google_Exception(
167
- sprintf(
168
- 'Failed to retrieve verification certificates: "%s".',
169
- $response->getBody()->getContents()
170
- ),
171
- $response->getStatusCode()
172
- );
173
- }
174
-
175
- // Gets federated sign-on certificates to use for verifying identity tokens.
176
- // Returns certs as array structure, where keys are key ids, and values
177
- // are PEM encoded certificates.
178
- private function getFederatedSignOnCerts()
179
- {
180
- $certs = null;
181
- if ($cache = $this->getCache()) {
182
- $cacheItem = $cache->getItem('federated_signon_certs_v3');
183
- $certs = $cacheItem->get();
184
- }
185
-
186
-
187
- if (!$certs) {
188
- $certs = $this->retrieveCertsFromLocation(
189
- self::FEDERATED_SIGNON_CERT_URL
190
- );
191
-
192
- if ($cache) {
193
- $cacheItem->expiresAt(new DateTime('+1 hour'));
194
- $cacheItem->set($certs);
195
- $cache->save($cacheItem);
196
- }
197
- }
198
-
199
- if (!isset($certs['keys'])) {
200
- throw new InvalidArgumentException(
201
- 'federated sign-on certs expects "keys" to be set'
202
- );
203
- }
204
-
205
- return $certs['keys'];
206
- }
207
-
208
- private function getJwtService()
209
- {
210
- $jwtClass = 'JWT';
211
- if (class_exists('\Firebase\JWT\JWT')) {
212
- $jwtClass = 'Firebase\JWT\JWT';
213
- }
214
-
215
- if (property_exists($jwtClass, 'leeway') && $jwtClass::$leeway < 1) {
216
- // Ensures JWT leeway is at least 1
217
- // @see https://github.com/google/google-api-php-client/issues/827
218
- $jwtClass::$leeway = 1;
219
- }
220
-
221
- return new $jwtClass;
222
- }
223
-
224
- private function getRsaClass()
225
- {
226
- if (class_exists('phpseclib\Crypt\RSA')) {
227
- return 'phpseclib\Crypt\RSA';
228
- }
229
-
230
- return 'Crypt_RSA';
231
- }
232
-
233
- private function getBigIntClass()
234
- {
235
- if (class_exists('phpseclib\Math\BigInteger')) {
236
- return 'phpseclib\Math\BigInteger';
237
- }
238
-
239
- return 'Math_BigInteger';
240
- }
241
-
242
- private function getOpenSslConstant()
243
- {
244
- if (class_exists('phpseclib\Crypt\RSA')) {
245
- return 'phpseclib\Crypt\RSA::MODE_OPENSSL';
246
- }
247
-
248
- if (class_exists('Crypt_RSA')) {
249
- return 'CRYPT_RSA_MODE_OPENSSL';
250
- }
251
-
252
- throw new \Exception('Cannot find RSA class');
253
- }
254
-
255
- /**
256
- * phpseclib calls "phpinfo" by default, which requires special
257
- * whitelisting in the AppEngine VM environment. This function
258
- * sets constants to bypass the need for phpseclib to check phpinfo
259
- *
260
- * @see phpseclib/Math/BigInteger
261
- * @see https://github.com/GoogleCloudPlatform/getting-started-php/issues/85
262
- */
263
- private function setPhpsecConstants()
264
- {
265
- if (filter_var(getenv('GAE_VM'), FILTER_VALIDATE_BOOLEAN)) {
266
- if (!defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
267
- define('MATH_BIGINTEGER_OPENSSL_ENABLED', true);
268
- }
269
- if (!defined('CRYPT_RSA_MODE')) {
270
- define('CRYPT_RSA_MODE', constant($this->getOpenSslConstant()));
271
- }
272
- }
273
- }
274
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/AuthHandler/AuthHandlerFactory.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2015 Google Inc. All Rights Reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- use GuzzleHttp\Client;
19
- use GuzzleHttp\ClientInterface;
20
-
21
- class Google_AuthHandler_AuthHandlerFactory
22
- {
23
- /**
24
- * Builds out a default http handler for the installed version of guzzle.
25
- *
26
- * @return Google_AuthHandler_Guzzle5AuthHandler|Google_AuthHandler_Guzzle6AuthHandler
27
- * @throws Exception
28
- */
29
- public static function build($cache = null, array $cacheConfig = [])
30
- {
31
- $guzzleVersion = null;
32
- if (defined('\GuzzleHttp\ClientInterface::MAJOR_VERSION')) {
33
- $guzzleVersion = ClientInterface::MAJOR_VERSION;
34
- } elseif (defined('\GuzzleHttp\ClientInterface::VERSION')) {
35
- $guzzleVersion = (int) substr(ClientInterface::VERSION, 0, 1);
36
- }
37
-
38
- switch ($guzzleVersion) {
39
- case 5:
40
- return new Google_AuthHandler_Guzzle5AuthHandler($cache, $cacheConfig);
41
- case 6:
42
- return new Google_AuthHandler_Guzzle6AuthHandler($cache, $cacheConfig);
43
- case 7:
44
- return new Google_AuthHandler_Guzzle7AuthHandler($cache, $cacheConfig);
45
- default:
46
- throw new Exception('Version not supported');
47
- }
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/AuthHandler/Guzzle5AuthHandler.php DELETED
@@ -1,99 +0,0 @@
1
- <?php
2
-
3
- use Google\Auth\CredentialsLoader;
4
- use Google\Auth\HttpHandler\HttpHandlerFactory;
5
- use Google\Auth\FetchAuthTokenCache;
6
- use Google\Auth\Subscriber\AuthTokenSubscriber;
7
- use Google\Auth\Subscriber\ScopedAccessTokenSubscriber;
8
- use Google\Auth\Subscriber\SimpleSubscriber;
9
- use GuzzleHttp\Client;
10
- use GuzzleHttp\ClientInterface;
11
- use Psr\Cache\CacheItemPoolInterface;
12
-
13
- /**
14
- *
15
- */
16
- class Google_AuthHandler_Guzzle5AuthHandler
17
- {
18
- protected $cache;
19
- protected $cacheConfig;
20
-
21
- public function __construct(CacheItemPoolInterface $cache = null, array $cacheConfig = [])
22
- {
23
- $this->cache = $cache;
24
- $this->cacheConfig = $cacheConfig;
25
- }
26
-
27
- public function attachCredentials(
28
- ClientInterface $http,
29
- CredentialsLoader $credentials,
30
- callable $tokenCallback = null
31
- ) {
32
- // use the provided cache
33
- if ($this->cache) {
34
- $credentials = new FetchAuthTokenCache(
35
- $credentials,
36
- $this->cacheConfig,
37
- $this->cache
38
- );
39
- }
40
- // if we end up needing to make an HTTP request to retrieve credentials, we
41
- // can use our existing one, but we need to throw exceptions so the error
42
- // bubbles up.
43
- $authHttp = $this->createAuthHttp($http);
44
- $authHttpHandler = HttpHandlerFactory::build($authHttp);
45
- $subscriber = new AuthTokenSubscriber(
46
- $credentials,
47
- $authHttpHandler,
48
- $tokenCallback
49
- );
50
-
51
- $http->setDefaultOption('auth', 'google_auth');
52
- $http->getEmitter()->attach($subscriber);
53
-
54
- return $http;
55
- }
56
-
57
- public function attachToken(ClientInterface $http, array $token, array $scopes)
58
- {
59
- $tokenFunc = function ($scopes) use ($token) {
60
- return $token['access_token'];
61
- };
62
-
63
- $subscriber = new ScopedAccessTokenSubscriber(
64
- $tokenFunc,
65
- $scopes,
66
- $this->cacheConfig,
67
- $this->cache
68
- );
69
-
70
- $http->setDefaultOption('auth', 'scoped');
71
- $http->getEmitter()->attach($subscriber);
72
-
73
- return $http;
74
- }
75
-
76
- public function attachKey(ClientInterface $http, $key)
77
- {
78
- $subscriber = new SimpleSubscriber(['key' => $key]);
79
-
80
- $http->setDefaultOption('auth', 'simple');
81
- $http->getEmitter()->attach($subscriber);
82
-
83
- return $http;
84
- }
85
-
86
- private function createAuthHttp(ClientInterface $http)
87
- {
88
- return new Client(
89
- [
90
- 'base_url' => $http->getBaseUrl(),
91
- 'defaults' => [
92
- 'exceptions' => true,
93
- 'verify' => $http->getDefaultOption('verify'),
94
- 'proxy' => $http->getDefaultOption('proxy'),
95
- ]
96
- ]
97
- );
98
- }
99
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/AuthHandler/Guzzle6AuthHandler.php DELETED
@@ -1,106 +0,0 @@
1
- <?php
2
-
3
- use Google\Auth\CredentialsLoader;
4
- use Google\Auth\HttpHandler\HttpHandlerFactory;
5
- use Google\Auth\FetchAuthTokenCache;
6
- use Google\Auth\Middleware\AuthTokenMiddleware;
7
- use Google\Auth\Middleware\ScopedAccessTokenMiddleware;
8
- use Google\Auth\Middleware\SimpleMiddleware;
9
- use GuzzleHttp\Client;
10
- use GuzzleHttp\ClientInterface;
11
- use Psr\Cache\CacheItemPoolInterface;
12
-
13
- /**
14
- * This supports Guzzle 6
15
- */
16
- class Google_AuthHandler_Guzzle6AuthHandler
17
- {
18
- protected $cache;
19
- protected $cacheConfig;
20
-
21
- public function __construct(CacheItemPoolInterface $cache = null, array $cacheConfig = [])
22
- {
23
- $this->cache = $cache;
24
- $this->cacheConfig = $cacheConfig;
25
- }
26
-
27
- public function attachCredentials(
28
- ClientInterface $http,
29
- CredentialsLoader $credentials,
30
- callable $tokenCallback = null
31
- ) {
32
- // use the provided cache
33
- if ($this->cache) {
34
- $credentials = new FetchAuthTokenCache(
35
- $credentials,
36
- $this->cacheConfig,
37
- $this->cache
38
- );
39
- }
40
- // if we end up needing to make an HTTP request to retrieve credentials, we
41
- // can use our existing one, but we need to throw exceptions so the error
42
- // bubbles up.
43
- $authHttp = $this->createAuthHttp($http);
44
- $authHttpHandler = HttpHandlerFactory::build($authHttp);
45
- $middleware = new AuthTokenMiddleware(
46
- $credentials,
47
- $authHttpHandler,
48
- $tokenCallback
49
- );
50
-
51
- $config = $http->getConfig();
52
- $config['handler']->remove('google_auth');
53
- $config['handler']->push($middleware, 'google_auth');
54
- $config['auth'] = 'google_auth';
55
- $http = new Client($config);
56
-
57
- return $http;
58
- }
59
-
60
- public function attachToken(ClientInterface $http, array $token, array $scopes)
61
- {
62
- $tokenFunc = function ($scopes) use ($token) {
63
- return $token['access_token'];
64
- };
65
-
66
- $middleware = new ScopedAccessTokenMiddleware(
67
- $tokenFunc,
68
- $scopes,
69
- $this->cacheConfig,
70
- $this->cache
71
- );
72
-
73
- $config = $http->getConfig();
74
- $config['handler']->remove('google_auth');
75
- $config['handler']->push($middleware, 'google_auth');
76
- $config['auth'] = 'scoped';
77
- $http = new Client($config);
78
-
79
- return $http;
80
- }
81
-
82
- public function attachKey(ClientInterface $http, $key)
83
- {
84
- $middleware = new SimpleMiddleware(['key' => $key]);
85
-
86
- $config = $http->getConfig();
87
- $config['handler']->remove('google_auth');
88
- $config['handler']->push($middleware, 'google_auth');
89
- $config['auth'] = 'simple';
90
- $http = new Client($config);
91
-
92
- return $http;
93
- }
94
-
95
- private function createAuthHttp(ClientInterface $http)
96
- {
97
- return new Client(
98
- [
99
- 'base_uri' => $http->getConfig('base_uri'),
100
- 'exceptions' => true,
101
- 'verify' => $http->getConfig('verify'),
102
- 'proxy' => $http->getConfig('proxy'),
103
- ]
104
- );
105
- }
106
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/AuthHandler/Guzzle7AuthHandler.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2020 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- /**
19
- * This supports Guzzle 7
20
- */
21
- class Google_AuthHandler_Guzzle7AuthHandler extends Google_AuthHandler_Guzzle6AuthHandler
22
- {
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Client.php DELETED
@@ -1,1238 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2010 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- use Google\Auth\ApplicationDefaultCredentials;
19
- use Google\Auth\Cache\MemoryCacheItemPool;
20
- use Google\Auth\CredentialsLoader;
21
- use Google\Auth\HttpHandler\HttpHandlerFactory;
22
- use Google\Auth\OAuth2;
23
- use Google\Auth\Credentials\ServiceAccountCredentials;
24
- use Google\Auth\Credentials\UserRefreshCredentials;
25
- use GuzzleHttp\Client;
26
- use GuzzleHttp\ClientInterface;
27
- use GuzzleHttp\Ring\Client\StreamHandler;
28
- use Psr\Cache\CacheItemPoolInterface;
29
- use Psr\Http\Message\RequestInterface;
30
- use Psr\Log\LoggerInterface;
31
- use Monolog\Logger;
32
- use Monolog\Handler\StreamHandler as MonologStreamHandler;
33
- use Monolog\Handler\SyslogHandler as MonologSyslogHandler;
34
-
35
- /**
36
- * The Google API Client
37
- * https://github.com/google/google-api-php-client
38
- */
39
- class Google_Client
40
- {
41
- const LIBVER = "2.7.1";
42
- const USER_AGENT_SUFFIX = "google-api-php-client/";
43
- const OAUTH2_REVOKE_URI = 'https://oauth2.googleapis.com/revoke';
44
- const OAUTH2_TOKEN_URI = 'https://oauth2.googleapis.com/token';
45
- const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
46
- const API_BASE_PATH = 'https://www.googleapis.com';
47
-
48
- /**
49
- * @var Google\Auth\OAuth2 $auth
50
- */
51
- private $auth;
52
-
53
- /**
54
- * @var GuzzleHttp\ClientInterface $http
55
- */
56
- private $http;
57
-
58
- /**
59
- * @var Psr\Cache\CacheItemPoolInterface $cache
60
- */
61
- private $cache;
62
-
63
- /**
64
- * @var array access token
65
- */
66
- private $token;
67
-
68
- /**
69
- * @var array $config
70
- */
71
- private $config;
72
-
73
- /**
74
- * @var Psr\Log\LoggerInterface $logger
75
- */
76
- private $logger;
77
-
78
- /**
79
- * @var boolean $deferExecution
80
- */
81
- private $deferExecution = false;
82
-
83
- /** @var array $scopes */
84
- // Scopes requested by the client
85
- protected $requestedScopes = [];
86
-
87
- /**
88
- * Construct the Google Client.
89
- *
90
- * @param array $config
91
- */
92
- public function __construct(array $config = array())
93
- {
94
- $this->config = array_merge(
95
- [
96
- 'application_name' => '',
97
-
98
- // Don't change these unless you're working against a special development
99
- // or testing environment.
100
- 'base_path' => self::API_BASE_PATH,
101
-
102
- // https://developers.google.com/console
103
- 'client_id' => '',
104
- 'client_secret' => '',
105
-
106
- // Path to JSON credentials or an array representing those credentials
107
- // @see Google_Client::setAuthConfig
108
- 'credentials' => null,
109
- // @see Google_Client::setScopes
110
- 'scopes' => null,
111
- // Sets X-Goog-User-Project, which specifies a user project to bill
112
- // for access charges associated with the request
113
- 'quota_project' => null,
114
-
115
- 'redirect_uri' => null,
116
- 'state' => null,
117
-
118
- // Simple API access key, also from the API console. Ensure you get
119
- // a Server key, and not a Browser key.
120
- 'developer_key' => '',
121
-
122
- // For use with Google Cloud Platform
123
- // fetch the ApplicationDefaultCredentials, if applicable
124
- // @see https://developers.google.com/identity/protocols/application-default-credentials
125
- 'use_application_default_credentials' => false,
126
- 'signing_key' => null,
127
- 'signing_algorithm' => null,
128
- 'subject' => null,
129
-
130
- // Other OAuth2 parameters.
131
- 'hd' => '',
132
- 'prompt' => '',
133
- 'openid.realm' => '',
134
- 'include_granted_scopes' => null,
135
- 'login_hint' => '',
136
- 'request_visible_actions' => '',
137
- 'access_type' => 'online',
138
- 'approval_prompt' => 'auto',
139
-
140
- // Task Runner retry configuration
141
- // @see Google_Task_Runner
142
- 'retry' => array(),
143
- 'retry_map' => null,
144
-
145
- // cache config for downstream auth caching
146
- 'cache_config' => [],
147
-
148
- // function to be called when an access token is fetched
149
- // follows the signature function ($cacheKey, $accessToken)
150
- 'token_callback' => null,
151
-
152
- // Service class used in Google_Client::verifyIdToken.
153
- // Explicitly pass this in to avoid setting JWT::$leeway
154
- 'jwt' => null,
155
-
156
- // Setting api_format_v2 will return more detailed error messages
157
- // from certain APIs.
158
- 'api_format_v2' => false
159
- ],
160
- $config
161
- );
162
-
163
- if (!is_null($this->config['credentials'])) {
164
- $this->setAuthConfig($this->config['credentials']);
165
- unset($this->config['credentials']);
166
- }
167
-
168
- if (!is_null($this->config['scopes'])) {
169
- $this->setScopes($this->config['scopes']);
170
- unset($this->config['scopes']);
171
- }
172
-
173
- // Set a default token callback to update the in-memory access token
174
- if (is_null($this->config['token_callback'])) {
175
- $this->config['token_callback'] = function ($cacheKey, $newAccessToken) {
176
- $this->setAccessToken(
177
- [
178
- 'access_token' => $newAccessToken,
179
- 'created' => time(),
180
- ]
181
- );
182
- };
183
- }
184
- }
185
-
186
- /**
187
- * Get a string containing the version of the library.
188
- *
189
- * @return string
190
- */
191
- public function getLibraryVersion()
192
- {
193
- return self::LIBVER;
194
- }
195
-
196
- /**
197
- * For backwards compatibility
198
- * alias for fetchAccessTokenWithAuthCode
199
- *
200
- * @param $code string code from accounts.google.com
201
- * @return array access token
202
- * @deprecated
203
- */
204
- public function authenticate($code)
205
- {
206
- return $this->fetchAccessTokenWithAuthCode($code);
207
- }
208
-
209
- /**
210
- * Attempt to exchange a code for an valid authentication token.
211
- * Helper wrapped around the OAuth 2.0 implementation.
212
- *
213
- * @param $code string code from accounts.google.com
214
- * @return array access token
215
- */
216
- public function fetchAccessTokenWithAuthCode($code)
217
- {
218
- if (strlen($code) == 0) {
219
- throw new InvalidArgumentException("Invalid code");
220
- }
221
-
222
- $auth = $this->getOAuth2Service();
223
- $auth->setCode($code);
224
- $auth->setRedirectUri($this->getRedirectUri());
225
-
226
- $httpHandler = HttpHandlerFactory::build($this->getHttpClient());
227
- $creds = $auth->fetchAuthToken($httpHandler);
228
- if ($creds && isset($creds['access_token'])) {
229
- $creds['created'] = time();
230
- $this->setAccessToken($creds);
231
- }
232
-
233
- return $creds;
234
- }
235
-
236
- /**
237
- * For backwards compatibility
238
- * alias for fetchAccessTokenWithAssertion
239
- *
240
- * @return array access token
241
- * @deprecated
242
- */
243
- public function refreshTokenWithAssertion()
244
- {
245
- return $this->fetchAccessTokenWithAssertion();
246
- }
247
-
248
- /**
249
- * Fetches a fresh access token with a given assertion token.
250
- * @param ClientInterface $authHttp optional.
251
- * @return array access token
252
- */
253
- public function fetchAccessTokenWithAssertion(ClientInterface $authHttp = null)
254
- {
255
- if (!$this->isUsingApplicationDefaultCredentials()) {
256
- throw new DomainException(
257
- 'set the JSON service account credentials using'
258
- . ' Google_Client::setAuthConfig or set the path to your JSON file'
259
- . ' with the "GOOGLE_APPLICATION_CREDENTIALS" environment variable'
260
- . ' and call Google_Client::useApplicationDefaultCredentials to'
261
- . ' refresh a token with assertion.'
262
- );
263
- }
264
-
265
- $this->getLogger()->log(
266
- 'info',
267
- 'OAuth2 access token refresh with Signed JWT assertion grants.'
268
- );
269
-
270
- $credentials = $this->createApplicationDefaultCredentials();
271
-
272
- $httpHandler = HttpHandlerFactory::build($authHttp);
273
- $creds = $credentials->fetchAuthToken($httpHandler);
274
- if ($creds && isset($creds['access_token'])) {
275
- $creds['created'] = time();
276
- $this->setAccessToken($creds);
277
- }
278
-
279
- return $creds;
280
- }
281
-
282
- /**
283
- * For backwards compatibility
284
- * alias for fetchAccessTokenWithRefreshToken
285
- *
286
- * @param string $refreshToken
287
- * @return array access token
288
- */
289
- public function refreshToken($refreshToken)
290
- {
291
- return $this->fetchAccessTokenWithRefreshToken($refreshToken);
292
- }
293
-
294
- /**
295
- * Fetches a fresh OAuth 2.0 access token with the given refresh token.
296
- * @param string $refreshToken
297
- * @return array access token
298
- */
299
- public function fetchAccessTokenWithRefreshToken($refreshToken = null)
300
- {
301
- if (null === $refreshToken) {
302
- if (!isset($this->token['refresh_token'])) {
303
- throw new LogicException(
304
- 'refresh token must be passed in or set as part of setAccessToken'
305
- );
306
- }
307
- $refreshToken = $this->token['refresh_token'];
308
- }
309
- $this->getLogger()->info('OAuth2 access token refresh');
310
- $auth = $this->getOAuth2Service();
311
- $auth->setRefreshToken($refreshToken);
312
-
313
- $httpHandler = HttpHandlerFactory::build($this->getHttpClient());
314
- $creds = $auth->fetchAuthToken($httpHandler);
315
- if ($creds && isset($creds['access_token'])) {
316
- $creds['created'] = time();
317
- if (!isset($creds['refresh_token'])) {
318
- $creds['refresh_token'] = $refreshToken;
319
- }
320
- $this->setAccessToken($creds);
321
- }
322
-
323
- return $creds;
324
- }
325
-
326
- /**
327
- * Create a URL to obtain user authorization.
328
- * The authorization endpoint allows the user to first
329
- * authenticate, and then grant/deny the access request.
330
- * @param string|array $scope The scope is expressed as an array or list of space-delimited strings.
331
- * @return string
332
- */
333
- public function createAuthUrl($scope = null)
334
- {
335
- if (empty($scope)) {
336
- $scope = $this->prepareScopes();
337
- }
338
- if (is_array($scope)) {
339
- $scope = implode(' ', $scope);
340
- }
341
-
342
- // only accept one of prompt or approval_prompt
343
- $approvalPrompt = $this->config['prompt']
344
- ? null
345
- : $this->config['approval_prompt'];
346
-
347
- // include_granted_scopes should be string "true", string "false", or null
348
- $includeGrantedScopes = $this->config['include_granted_scopes'] === null
349
- ? null
350
- : var_export($this->config['include_granted_scopes'], true);
351
-
352
- $params = array_filter(
353
- [
354
- 'access_type' => $this->config['access_type'],
355
- 'approval_prompt' => $approvalPrompt,
356
- 'hd' => $this->config['hd'],
357
- 'include_granted_scopes' => $includeGrantedScopes,
358
- 'login_hint' => $this->config['login_hint'],
359
- 'openid.realm' => $this->config['openid.realm'],
360
- 'prompt' => $this->config['prompt'],
361
- 'response_type' => 'code',
362
- 'scope' => $scope,
363
- 'state' => $this->config['state'],
364
- ]
365
- );
366
-
367
- // If the list of scopes contains plus.login, add request_visible_actions
368
- // to auth URL.
369
- $rva = $this->config['request_visible_actions'];
370
- if (strlen($rva) > 0 && false !== strpos($scope, 'plus.login')) {
371
- $params['request_visible_actions'] = $rva;
372
- }
373
-
374
- $auth = $this->getOAuth2Service();
375
-
376
- return (string) $auth->buildFullAuthorizationUri($params);
377
- }
378
-
379
- /**
380
- * Adds auth listeners to the HTTP client based on the credentials
381
- * set in the Google API Client object
382
- *
383
- * @param GuzzleHttp\ClientInterface $http the http client object.
384
- * @return GuzzleHttp\ClientInterface the http client object
385
- */
386
- public function authorize(ClientInterface $http = null)
387
- {
388
- $credentials = null;
389
- $token = null;
390
- $scopes = null;
391
- if (null === $http) {
392
- $http = $this->getHttpClient();
393
- }
394
-
395
- // These conditionals represent the decision tree for authentication
396
- // 1. Check for Application Default Credentials
397
- // 2. Check for API Key
398
- // 3a. Check for an Access Token
399
- // 3b. If access token exists but is expired, try to refresh it
400
- if ($this->isUsingApplicationDefaultCredentials()) {
401
- $credentials = $this->createApplicationDefaultCredentials();
402
- } elseif ($token = $this->getAccessToken()) {
403
- $scopes = $this->prepareScopes();
404
- // add refresh subscriber to request a new token
405
- if (isset($token['refresh_token']) && $this->isAccessTokenExpired()) {
406
- $credentials = $this->createUserRefreshCredentials(
407
- $scopes,
408
- $token['refresh_token']
409
- );
410
- }
411
- }
412
-
413
- $authHandler = $this->getAuthHandler();
414
-
415
- if ($credentials) {
416
- $callback = $this->config['token_callback'];
417
- $http = $authHandler->attachCredentials($http, $credentials, $callback);
418
- } elseif ($token) {
419
- $http = $authHandler->attachToken($http, $token, (array) $scopes);
420
- } elseif ($key = $this->config['developer_key']) {
421
- $http = $authHandler->attachKey($http, $key);
422
- }
423
-
424
- return $http;
425
- }
426
-
427
- /**
428
- * Set the configuration to use application default credentials for
429
- * authentication
430
- *
431
- * @see https://developers.google.com/identity/protocols/application-default-credentials
432
- * @param boolean $useAppCreds
433
- */
434
- public function useApplicationDefaultCredentials($useAppCreds = true)
435
- {
436
- $this->config['use_application_default_credentials'] = $useAppCreds;
437
- }
438
-
439
- /**
440
- * To prevent useApplicationDefaultCredentials from inappropriately being
441
- * called in a conditional
442
- *
443
- * @see https://developers.google.com/identity/protocols/application-default-credentials
444
- */
445
- public function isUsingApplicationDefaultCredentials()
446
- {
447
- return $this->config['use_application_default_credentials'];
448
- }
449
-
450
- /**
451
- * Set the access token used for requests.
452
- *
453
- * Note that at the time requests are sent, tokens are cached. A token will be
454
- * cached for each combination of service and authentication scopes. If a
455
- * cache pool is not provided, creating a new instance of the client will
456
- * allow modification of access tokens. If a persistent cache pool is
457
- * provided, in order to change the access token, you must clear the cached
458
- * token by calling `$client->getCache()->clear()`. (Use caution in this case,
459
- * as calling `clear()` will remove all cache items, including any items not
460
- * related to Google API PHP Client.)
461
- *
462
- * @param string|array $token
463
- * @throws InvalidArgumentException
464
- */
465
- public function setAccessToken($token)
466
- {
467
- if (is_string($token)) {
468
- if ($json = json_decode($token, true)) {
469
- $token = $json;
470
- } else {
471
- // assume $token is just the token string
472
- $token = array(
473
- 'access_token' => $token,
474
- );
475
- }
476
- }
477
- if ($token == null) {
478
- throw new InvalidArgumentException('invalid json token');
479
- }
480
- if (!isset($token['access_token'])) {
481
- throw new InvalidArgumentException("Invalid token format");
482
- }
483
- $this->token = $token;
484
- }
485
-
486
- public function getAccessToken()
487
- {
488
- return $this->token;
489
- }
490
-
491
- /**
492
- * @return string|null
493
- */
494
- public function getRefreshToken()
495
- {
496
- if (isset($this->token['refresh_token'])) {
497
- return $this->token['refresh_token'];
498
- }
499
-
500
- return null;
501
- }
502
-
503
- /**
504
- * Returns if the access_token is expired.
505
- * @return bool Returns True if the access_token is expired.
506
- */
507
- public function isAccessTokenExpired()
508
- {
509
- if (!$this->token) {
510
- return true;
511
- }
512
-
513
- $created = 0;
514
- if (isset($this->token['created'])) {
515
- $created = $this->token['created'];
516
- } elseif (isset($this->token['id_token'])) {
517
- // check the ID token for "iat"
518
- // signature verification is not required here, as we are just
519
- // using this for convenience to save a round trip request
520
- // to the Google API server
521
- $idToken = $this->token['id_token'];
522
- if (substr_count($idToken, '.') == 2) {
523
- $parts = explode('.', $idToken);
524
- $payload = json_decode(base64_decode($parts[1]), true);
525
- if ($payload && isset($payload['iat'])) {
526
- $created = $payload['iat'];
527
- }
528
- }
529
- }
530
-
531
- // If the token is set to expire in the next 30 seconds.
532
- return ($created + ($this->token['expires_in'] - 30)) < time();
533
- }
534
-
535
- /**
536
- * @deprecated See UPGRADING.md for more information
537
- */
538
- public function getAuth()
539
- {
540
- throw new BadMethodCallException(
541
- 'This function no longer exists. See UPGRADING.md for more information'
542
- );
543
- }
544
-
545
- /**
546
- * @deprecated See UPGRADING.md for more information
547
- */
548
- public function setAuth($auth)
549
- {
550
- throw new BadMethodCallException(
551
- 'This function no longer exists. See UPGRADING.md for more information'
552
- );
553
- }
554
-
555
- /**
556
- * Set the OAuth 2.0 Client ID.
557
- * @param string $clientId
558
- */
559
- public function setClientId($clientId)
560
- {
561
- $this->config['client_id'] = $clientId;
562
- }
563
-
564
- public function getClientId()
565
- {
566
- return $this->config['client_id'];
567
- }
568
-
569
- /**
570
- * Set the OAuth 2.0 Client Secret.
571
- * @param string $clientSecret
572
- */
573
- public function setClientSecret($clientSecret)
574
- {
575
- $this->config['client_secret'] = $clientSecret;
576
- }
577
-
578
- public function getClientSecret()
579
- {
580
- return $this->config['client_secret'];
581
- }
582
-
583
- /**
584
- * Set the OAuth 2.0 Redirect URI.
585
- * @param string $redirectUri
586
- */
587
- public function setRedirectUri($redirectUri)
588
- {
589
- $this->config['redirect_uri'] = $redirectUri;
590
- }
591
-
592
- public function getRedirectUri()
593
- {
594
- return $this->config['redirect_uri'];
595
- }
596
-
597
- /**
598
- * Set OAuth 2.0 "state" parameter to achieve per-request customization.
599
- * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
600
- * @param string $state
601
- */
602
- public function setState($state)
603
- {
604
- $this->config['state'] = $state;
605
- }
606
-
607
- /**
608
- * @param string $accessType Possible values for access_type include:
609
- * {@code "offline"} to request offline access from the user.
610
- * {@code "online"} to request online access from the user.
611
- */
612
- public function setAccessType($accessType)
613
- {
614
- $this->config['access_type'] = $accessType;
615
- }
616
-
617
- /**
618
- * @param string $approvalPrompt Possible values for approval_prompt include:
619
- * {@code "force"} to force the approval UI to appear.
620
- * {@code "auto"} to request auto-approval when possible. (This is the default value)
621
- */
622
- public function setApprovalPrompt($approvalPrompt)
623
- {
624
- $this->config['approval_prompt'] = $approvalPrompt;
625
- }
626
-
627
- /**
628
- * Set the login hint, email address or sub id.
629
- * @param string $loginHint
630
- */
631
- public function setLoginHint($loginHint)
632
- {
633
- $this->config['login_hint'] = $loginHint;
634
- }
635
-
636
- /**
637
- * Set the application name, this is included in the User-Agent HTTP header.
638
- * @param string $applicationName
639
- */
640
- public function setApplicationName($applicationName)
641
- {
642
- $this->config['application_name'] = $applicationName;
643
- }
644
-
645
- /**
646
- * If 'plus.login' is included in the list of requested scopes, you can use
647
- * this method to define types of app activities that your app will write.
648
- * You can find a list of available types here:
649
- * @link https://developers.google.com/+/api/moment-types
650
- *
651
- * @param array $requestVisibleActions Array of app activity types
652
- */
653
- public function setRequestVisibleActions($requestVisibleActions)
654
- {
655
- if (is_array($requestVisibleActions)) {
656
- $requestVisibleActions = implode(" ", $requestVisibleActions);
657
- }
658
- $this->config['request_visible_actions'] = $requestVisibleActions;
659
- }
660
-
661
- /**
662
- * Set the developer key to use, these are obtained through the API Console.
663
- * @see http://code.google.com/apis/console-help/#generatingdevkeys
664
- * @param string $developerKey
665
- */
666
- public function setDeveloperKey($developerKey)
667
- {
668
- $this->config['developer_key'] = $developerKey;
669
- }
670
-
671
- /**
672
- * Set the hd (hosted domain) parameter streamlines the login process for
673
- * Google Apps hosted accounts. By including the domain of the user, you
674
- * restrict sign-in to accounts at that domain.
675
- * @param $hd string - the domain to use.
676
- */
677
- public function setHostedDomain($hd)
678
- {
679
- $this->config['hd'] = $hd;
680
- }
681
-
682
- /**
683
- * Set the prompt hint. Valid values are none, consent and select_account.
684
- * If no value is specified and the user has not previously authorized
685
- * access, then the user is shown a consent screen.
686
- * @param $prompt string
687
- * {@code "none"} Do not display any authentication or consent screens. Must not be specified with other values.
688
- * {@code "consent"} Prompt the user for consent.
689
- * {@code "select_account"} Prompt the user to select an account.
690
- */
691
- public function setPrompt($prompt)
692
- {
693
- $this->config['prompt'] = $prompt;
694
- }
695
-
696
- /**
697
- * openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
698
- * 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
699
- * an authentication request is valid.
700
- * @param $realm string - the URL-space to use.
701
- */
702
- public function setOpenidRealm($realm)
703
- {
704
- $this->config['openid.realm'] = $realm;
705
- }
706
-
707
- /**
708
- * If this is provided with the value true, and the authorization request is
709
- * granted, the authorization will include any previous authorizations
710
- * granted to this user/application combination for other scopes.
711
- * @param $include boolean - the URL-space to use.
712
- */
713
- public function setIncludeGrantedScopes($include)
714
- {
715
- $this->config['include_granted_scopes'] = $include;
716
- }
717
-
718
- /**
719
- * sets function to be called when an access token is fetched
720
- * @param callable $tokenCallback - function ($cacheKey, $accessToken)
721
- */
722
- public function setTokenCallback(callable $tokenCallback)
723
- {
724
- $this->config['token_callback'] = $tokenCallback;
725
- }
726
-
727
- /**
728
- * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
729
- * token, if a token isn't provided.
730
- *
731
- * @param string|array|null $token The token (access token or a refresh token) that should be revoked.
732
- * @return boolean Returns True if the revocation was successful, otherwise False.
733
- */
734
- public function revokeToken($token = null)
735
- {
736
- $tokenRevoker = new Google_AccessToken_Revoke(
737
- $this->getHttpClient()
738
- );
739
-
740
- return $tokenRevoker->revokeToken($token ?: $this->getAccessToken());
741
- }
742
-
743
- /**
744
- * Verify an id_token. This method will verify the current id_token, if one
745
- * isn't provided.
746
- *
747
- * @throws LogicException If no token was provided and no token was set using `setAccessToken`.
748
- * @throws UnexpectedValueException If the token is not a valid JWT.
749
- * @param string|null $idToken The token (id_token) that should be verified.
750
- * @return array|false Returns the token payload as an array if the verification was
751
- * successful, false otherwise.
752
- */
753
- public function verifyIdToken($idToken = null)
754
- {
755
- $tokenVerifier = new Google_AccessToken_Verify(
756
- $this->getHttpClient(),
757
- $this->getCache(),
758
- $this->config['jwt']
759
- );
760
-
761
- if (null === $idToken) {
762
- $token = $this->getAccessToken();
763
- if (!isset($token['id_token'])) {
764
- throw new LogicException(
765
- 'id_token must be passed in or set as part of setAccessToken'
766
- );
767
- }
768
- $idToken = $token['id_token'];
769
- }
770
-
771
- return $tokenVerifier->verifyIdToken(
772
- $idToken,
773
- $this->getClientId()
774
- );
775
- }
776
-
777
- /**
778
- * Set the scopes to be requested. Must be called before createAuthUrl().
779
- * Will remove any previously configured scopes.
780
- * @param string|array $scope_or_scopes, ie:
781
- * array(
782
- * 'https://www.googleapis.com/auth/plus.login',
783
- * 'https://www.googleapis.com/auth/moderator'
784
- * );
785
- */
786
- public function setScopes($scope_or_scopes)
787
- {
788
- $this->requestedScopes = array();
789
- $this->addScope($scope_or_scopes);
790
- }
791
-
792
- /**
793
- * This functions adds a scope to be requested as part of the OAuth2.0 flow.
794
- * Will append any scopes not previously requested to the scope parameter.
795
- * A single string will be treated as a scope to request. An array of strings
796
- * will each be appended.
797
- * @param $scope_or_scopes string|array e.g. "profile"
798
- */
799
- public function addScope($scope_or_scopes)
800
- {
801
- if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
802
- $this->requestedScopes[] = $scope_or_scopes;
803
- } else if (is_array($scope_or_scopes)) {
804
- foreach ($scope_or_scopes as $scope) {
805
- $this->addScope($scope);
806
- }
807
- }
808
- }
809
-
810
- /**
811
- * Returns the list of scopes requested by the client
812
- * @return array the list of scopes
813
- *
814
- */
815
- public function getScopes()
816
- {
817
- return $this->requestedScopes;
818
- }
819
-
820
- /**
821
- * @return string|null
822
- * @visible For Testing
823
- */
824
- public function prepareScopes()
825
- {
826
- if (empty($this->requestedScopes)) {
827
- return null;
828
- }
829
-
830
- return implode(' ', $this->requestedScopes);
831
- }
832
-
833
- /**
834
- * Helper method to execute deferred HTTP requests.
835
- *
836
- * @param $request Psr\Http\Message\RequestInterface|Google_Http_Batch
837
- * @param string $expectedClass
838
- * @throws Google_Exception
839
- * @return object of the type of the expected class or Psr\Http\Message\ResponseInterface.
840
- */
841
- public function execute(RequestInterface $request, $expectedClass = null)
842
- {
843
- $request = $request
844
- ->withHeader(
845
- 'User-Agent',
846
- sprintf(
847
- '%s %s%s',
848
- $this->config['application_name'],
849
- self::USER_AGENT_SUFFIX,
850
- $this->getLibraryVersion()
851
- )
852
- )
853
- ->withHeader(
854
- 'x-goog-api-client',
855
- sprintf(
856
- 'gl-php/%s gdcl/%s',
857
- phpversion(),
858
- $this->getLibraryVersion()
859
- )
860
- );
861
-
862
- if ($this->config['api_format_v2']) {
863
- $request = $request->withHeader(
864
- 'X-GOOG-API-FORMAT-VERSION',
865
- 2
866
- );
867
- }
868
-
869
- // call the authorize method
870
- // this is where most of the grunt work is done
871
- $http = $this->authorize();
872
-
873
- return Google_Http_REST::execute(
874
- $http,
875
- $request,
876
- $expectedClass,
877
- $this->config['retry'],
878
- $this->config['retry_map']
879
- );
880
- }
881
-
882
- /**
883
- * Declare whether batch calls should be used. This may increase throughput
884
- * by making multiple requests in one connection.
885
- *
886
- * @param boolean $useBatch True if the batch support should
887
- * be enabled. Defaults to False.
888
- */
889
- public function setUseBatch($useBatch)
890
- {
891
- // This is actually an alias for setDefer.
892
- $this->setDefer($useBatch);
893
- }
894
-
895
- /**
896
- * Are we running in Google AppEngine?
897
- * return bool
898
- */
899
- public function isAppEngine()
900
- {
901
- return (isset($_SERVER['SERVER_SOFTWARE']) &&
902
- strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
903
- }
904
-
905
- public function setConfig($name, $value)
906
- {
907
- $this->config[$name] = $value;
908
- }
909
-
910
- public function getConfig($name, $default = null)
911
- {
912
- return isset($this->config[$name]) ? $this->config[$name] : $default;
913
- }
914
-
915
- /**
916
- * For backwards compatibility
917
- * alias for setAuthConfig
918
- *
919
- * @param string $file the configuration file
920
- * @throws Google_Exception
921
- * @deprecated
922
- */
923
- public function setAuthConfigFile($file)
924
- {
925
- $this->setAuthConfig($file);
926
- }
927
-
928
- /**
929
- * Set the auth config from new or deprecated JSON config.
930
- * This structure should match the file downloaded from
931
- * the "Download JSON" button on in the Google Developer
932
- * Console.
933
- * @param string|array $config the configuration json
934
- * @throws Google_Exception
935
- */
936
- public function setAuthConfig($config)
937
- {
938
- if (is_string($config)) {
939
- if (!file_exists($config)) {
940
- throw new InvalidArgumentException(sprintf('file "%s" does not exist', $config));
941
- }
942
-
943
- $json = file_get_contents($config);
944
-
945
- if (!$config = json_decode($json, true)) {
946
- throw new LogicException('invalid json for auth config');
947
- }
948
- }
949
-
950
- $key = isset($config['installed']) ? 'installed' : 'web';
951
- if (isset($config['type']) && $config['type'] == 'service_account') {
952
- // application default credentials
953
- $this->useApplicationDefaultCredentials();
954
-
955
- // set the information from the config
956
- $this->setClientId($config['client_id']);
957
- $this->config['client_email'] = $config['client_email'];
958
- $this->config['signing_key'] = $config['private_key'];
959
- $this->config['signing_algorithm'] = 'HS256';
960
- } elseif (isset($config[$key])) {
961
- // old-style
962
- $this->setClientId($config[$key]['client_id']);
963
- $this->setClientSecret($config[$key]['client_secret']);
964
- if (isset($config[$key]['redirect_uris'])) {
965
- $this->setRedirectUri($config[$key]['redirect_uris'][0]);
966
- }
967
- } else {
968
- // new-style
969
- $this->setClientId($config['client_id']);
970
- $this->setClientSecret($config['client_secret']);
971
- if (isset($config['redirect_uris'])) {
972
- $this->setRedirectUri($config['redirect_uris'][0]);
973
- }
974
- }
975
- }
976
-
977
- /**
978
- * Use when the service account has been delegated domain wide access.
979
- *
980
- * @param string $subject an email address account to impersonate
981
- */
982
- public function setSubject($subject)
983
- {
984
- $this->config['subject'] = $subject;
985
- }
986
-
987
- /**
988
- * Declare whether making API calls should make the call immediately, or
989
- * return a request which can be called with ->execute();
990
- *
991
- * @param boolean $defer True if calls should not be executed right away.
992
- */
993
- public function setDefer($defer)
994
- {
995
- $this->deferExecution = $defer;
996
- }
997
-
998
- /**
999
- * Whether or not to return raw requests
1000
- * @return boolean
1001
- */
1002
- public function shouldDefer()
1003
- {
1004
- return $this->deferExecution;
1005
- }
1006
-
1007
- /**
1008
- * @return Google\Auth\OAuth2 implementation
1009
- */
1010
- public function getOAuth2Service()
1011
- {
1012
- if (!isset($this->auth)) {
1013
- $this->auth = $this->createOAuth2Service();
1014
- }
1015
-
1016
- return $this->auth;
1017
- }
1018
-
1019
- /**
1020
- * create a default google auth object
1021
- */
1022
- protected function createOAuth2Service()
1023
- {
1024
- $auth = new OAuth2(
1025
- [
1026
- 'clientId' => $this->getClientId(),
1027
- 'clientSecret' => $this->getClientSecret(),
1028
- 'authorizationUri' => self::OAUTH2_AUTH_URL,
1029
- 'tokenCredentialUri' => self::OAUTH2_TOKEN_URI,
1030
- 'redirectUri' => $this->getRedirectUri(),
1031
- 'issuer' => $this->config['client_id'],
1032
- 'signingKey' => $this->config['signing_key'],
1033
- 'signingAlgorithm' => $this->config['signing_algorithm'],
1034
- ]
1035
- );
1036
-
1037
- return $auth;
1038
- }
1039
-
1040
- /**
1041
- * Set the Cache object
1042
- * @param Psr\Cache\CacheItemPoolInterface $cache
1043
- */
1044
- public function setCache(CacheItemPoolInterface $cache)
1045
- {
1046
- $this->cache = $cache;
1047
- }
1048
-
1049
- /**
1050
- * @return Psr\Cache\CacheItemPoolInterface Cache implementation
1051
- */
1052
- public function getCache()
1053
- {
1054
- if (!$this->cache) {
1055
- $this->cache = $this->createDefaultCache();
1056
- }
1057
-
1058
- return $this->cache;
1059
- }
1060
-
1061
- /**
1062
- * @param array $cacheConfig
1063
- */
1064
- public function setCacheConfig(array $cacheConfig)
1065
- {
1066
- $this->config['cache_config'] = $cacheConfig;
1067
- }
1068
-
1069
- /**
1070
- * Set the Logger object
1071
- * @param Psr\Log\LoggerInterface $logger
1072
- */
1073
- public function setLogger(LoggerInterface $logger)
1074
- {
1075
- $this->logger = $logger;
1076
- }
1077
-
1078
- /**
1079
- * @return Psr\Log\LoggerInterface implementation
1080
- */
1081
- public function getLogger()
1082
- {
1083
- if (!isset($this->logger)) {
1084
- $this->logger = $this->createDefaultLogger();
1085
- }
1086
-
1087
- return $this->logger;
1088
- }
1089
-
1090
- protected function createDefaultLogger()
1091
- {
1092
- $logger = new Logger('google-api-php-client');
1093
- if ($this->isAppEngine()) {
1094
- $handler = new MonologSyslogHandler('app', LOG_USER, Logger::NOTICE);
1095
- } else {
1096
- $handler = new MonologStreamHandler('php://stderr', Logger::NOTICE);
1097
- }
1098
- $logger->pushHandler($handler);
1099
-
1100
- return $logger;
1101
- }
1102
-
1103
- protected function createDefaultCache()
1104
- {
1105
- return new MemoryCacheItemPool;
1106
- }
1107
-
1108
- /**
1109
- * Set the Http Client object
1110
- * @param GuzzleHttp\ClientInterface $http
1111
- */
1112
- public function setHttpClient(ClientInterface $http)
1113
- {
1114
- $this->http = $http;
1115
- }
1116
-
1117
- /**
1118
- * @return GuzzleHttp\ClientInterface implementation
1119
- */
1120
- public function getHttpClient()
1121
- {
1122
- if (null === $this->http) {
1123
- $this->http = $this->createDefaultHttpClient();
1124
- }
1125
-
1126
- return $this->http;
1127
- }
1128
-
1129
- /**
1130
- * Set the API format version.
1131
- *
1132
- * `true` will use V2, which may return more useful error messages.
1133
- *
1134
- * @param bool $value
1135
- */
1136
- public function setApiFormatV2($value)
1137
- {
1138
- $this->config['api_format_v2'] = (bool) $value;
1139
- }
1140
-
1141
- protected function createDefaultHttpClient()
1142
- {
1143
- $guzzleVersion = null;
1144
- if (defined('\GuzzleHttp\ClientInterface::MAJOR_VERSION')) {
1145
- $guzzleVersion = ClientInterface::MAJOR_VERSION;
1146
- } elseif (defined('\GuzzleHttp\ClientInterface::VERSION')) {
1147
- $guzzleVersion = (int)substr(ClientInterface::VERSION, 0, 1);
1148
- }
1149
-
1150
- $options = ['exceptions' => false];
1151
- if (5 === $guzzleVersion) {
1152
- $options = [
1153
- 'base_url' => $this->config['base_path'],
1154
- 'defaults' => $options,
1155
- ];
1156
- if ($this->isAppEngine()) {
1157
- // set StreamHandler on AppEngine by default
1158
- $options['handler'] = new StreamHandler();
1159
- $options['defaults']['verify'] = '/etc/ca-certificates.crt';
1160
- }
1161
- } elseif (6 === $guzzleVersion || 7 === $guzzleVersion) {
1162
- // guzzle 6 or 7
1163
- $options['base_uri'] = $this->config['base_path'];
1164
- } else {
1165
- throw new LogicException('Could not find supported version of Guzzle.');
1166
- }
1167
-
1168
- return new Client($options);
1169
- }
1170
-
1171
- private function createApplicationDefaultCredentials()
1172
- {
1173
- $scopes = $this->prepareScopes();
1174
- $sub = $this->config['subject'];
1175
- $signingKey = $this->config['signing_key'];
1176
-
1177
- // create credentials using values supplied in setAuthConfig
1178
- if ($signingKey) {
1179
- $serviceAccountCredentials = array(
1180
- 'client_id' => $this->config['client_id'],
1181
- 'client_email' => $this->config['client_email'],
1182
- 'private_key' => $signingKey,
1183
- 'type' => 'service_account',
1184
- 'quota_project_id' => $this->config['quota_project'],
1185
- );
1186
- $credentials = CredentialsLoader::makeCredentials(
1187
- $scopes,
1188
- $serviceAccountCredentials
1189
- );
1190
- } else {
1191
- $credentials = ApplicationDefaultCredentials::getCredentials(
1192
- $scopes,
1193
- null,
1194
- null,
1195
- null,
1196
- $this->config['quota_project']
1197
- );
1198
- }
1199
-
1200
- // for service account domain-wide authority (impersonating a user)
1201
- // @see https://developers.google.com/identity/protocols/OAuth2ServiceAccount
1202
- if ($sub) {
1203
- if (!$credentials instanceof ServiceAccountCredentials) {
1204
- throw new DomainException('domain-wide authority requires service account credentials');
1205
- }
1206
-
1207
- $credentials->setSub($sub);
1208
- }
1209
-
1210
- return $credentials;
1211
- }
1212
-
1213
- protected function getAuthHandler()
1214
- {
1215
- // Be very careful using the cache, as the underlying auth library's cache
1216
- // implementation is naive, and the cache keys do not account for user
1217
- // sessions.
1218
- //
1219
- // @see https://github.com/google/google-api-php-client/issues/821
1220
- return Google_AuthHandler_AuthHandlerFactory::build(
1221
- $this->getCache(),
1222
- $this->config['cache_config']
1223
- );
1224
- }
1225
-
1226
- private function createUserRefreshCredentials($scope, $refreshToken)
1227
- {
1228
- $creds = array_filter(
1229
- array(
1230
- 'client_id' => $this->getClientId(),
1231
- 'client_secret' => $this->getClientSecret(),
1232
- 'refresh_token' => $refreshToken,
1233
- )
1234
- );
1235
-
1236
- return new UserRefreshCredentials($scope, $creds);
1237
- }
1238
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Collection.php DELETED
@@ -1,100 +0,0 @@
1
- <?php
2
-
3
- if (!class_exists('Google_Client')) {
4
- require_once __DIR__ . '/autoload.php';
5
- }
6
-
7
- /**
8
- * Extension to the regular Google_Model that automatically
9
- * exposes the items array for iteration, so you can just
10
- * iterate over the object rather than a reference inside.
11
- */
12
- class Google_Collection extends Google_Model implements Iterator, Countable
13
- {
14
- protected $collection_key = 'items';
15
-
16
- public function rewind()
17
- {
18
- if (isset($this->{$this->collection_key})
19
- && is_array($this->{$this->collection_key})) {
20
- reset($this->{$this->collection_key});
21
- }
22
- }
23
-
24
- public function current()
25
- {
26
- $this->coerceType($this->key());
27
- if (is_array($this->{$this->collection_key})) {
28
- return current($this->{$this->collection_key});
29
- }
30
- }
31
-
32
- public function key()
33
- {
34
- if (isset($this->{$this->collection_key})
35
- && is_array($this->{$this->collection_key})) {
36
- return key($this->{$this->collection_key});
37
- }
38
- }
39
-
40
- public function next()
41
- {
42
- return next($this->{$this->collection_key});
43
- }
44
-
45
- public function valid()
46
- {
47
- $key = $this->key();
48
- return $key !== null && $key !== false;
49
- }
50
-
51
- public function count()
52
- {
53
- if (!isset($this->{$this->collection_key})) {
54
- return 0;
55
- }
56
- return count($this->{$this->collection_key});
57
- }
58
-
59
- public function offsetExists($offset)
60
- {
61
- if (!is_numeric($offset)) {
62
- return parent::offsetExists($offset);
63
- }
64
- return isset($this->{$this->collection_key}[$offset]);
65
- }
66
-
67
- public function offsetGet($offset)
68
- {
69
- if (!is_numeric($offset)) {
70
- return parent::offsetGet($offset);
71
- }
72
- $this->coerceType($offset);
73
- return $this->{$this->collection_key}[$offset];
74
- }
75
-
76
- public function offsetSet($offset, $value)
77
- {
78
- if (!is_numeric($offset)) {
79
- return parent::offsetSet($offset, $value);
80
- }
81
- $this->{$this->collection_key}[$offset] = $value;
82
- }
83
-
84
- public function offsetUnset($offset)
85
- {
86
- if (!is_numeric($offset)) {
87
- return parent::offsetUnset($offset);
88
- }
89
- unset($this->{$this->collection_key}[$offset]);
90
- }
91
-
92
- private function coerceType($offset)
93
- {
94
- $keyType = $this->keyType($this->collection_key);
95
- if ($keyType && !is_object($this->{$this->collection_key}[$offset])) {
96
- $this->{$this->collection_key}[$offset] =
97
- new $keyType($this->{$this->collection_key}[$offset]);
98
- }
99
- }
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Exception.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2013 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- class Google_Exception extends Exception
19
- {
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Http/Batch.php DELETED
@@ -1,253 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2012 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- use GuzzleHttp\Psr7;
19
- use GuzzleHttp\Psr7\Request;
20
- use GuzzleHttp\Psr7\Response;
21
- use Psr\Http\Message\RequestInterface;
22
- use Psr\Http\Message\ResponseInterface;
23
-
24
- /**
25
- * Class to handle batched requests to the Google API service.
26
- *
27
- * Note that calls to `Google_Http_Batch::execute()` do not clear the queued
28
- * requests. To start a new batch, be sure to create a new instance of this
29
- * class.
30
- */
31
- class Google_Http_Batch
32
- {
33
- const BATCH_PATH = 'batch';
34
-
35
- private static $CONNECTION_ESTABLISHED_HEADERS = array(
36
- "HTTP/1.0 200 Connection established\r\n\r\n",
37
- "HTTP/1.1 200 Connection established\r\n\r\n",
38
- );
39
-
40
- /** @var string Multipart Boundary. */
41
- private $boundary;
42
-
43
- /** @var array service requests to be executed. */
44
- private $requests = array();
45
-
46
- /** @var Google_Client */
47
- private $client;
48
-
49
- private $rootUrl;
50
-
51
- private $batchPath;
52
-
53
- public function __construct(
54
- Google_Client $client,
55
- $boundary = false,
56
- $rootUrl = null,
57
- $batchPath = null
58
- ) {
59
- $this->client = $client;
60
- $this->boundary = $boundary ?: mt_rand();
61
- $this->rootUrl = rtrim($rootUrl ?: $this->client->getConfig('base_path'), '/');
62
- $this->batchPath = $batchPath ?: self::BATCH_PATH;
63
- }
64
-
65
- public function add(RequestInterface $request, $key = false)
66
- {
67
- if (false == $key) {
68
- $key = mt_rand();
69
- }
70
-
71
- $this->requests[$key] = $request;
72
- }
73
-
74
- public function execute()
75
- {
76
- $body = '';
77
- $classes = array();
78
- $batchHttpTemplate = <<<EOF
79
- --%s
80
- Content-Type: application/http
81
- Content-Transfer-Encoding: binary
82
- MIME-Version: 1.0
83
- Content-ID: %s
84
-
85
- %s
86
- %s%s
87
-
88
-
89
- EOF;
90
-
91
- /** @var Google_Http_Request $req */
92
- foreach ($this->requests as $key => $request) {
93
- $firstLine = sprintf(
94
- '%s %s HTTP/%s',
95
- $request->getMethod(),
96
- $request->getRequestTarget(),
97
- $request->getProtocolVersion()
98
- );
99
-
100
- $content = (string) $request->getBody();
101
-
102
- $headers = '';
103
- foreach ($request->getHeaders() as $name => $values) {
104
- $headers .= sprintf("%s:%s\r\n", $name, implode(', ', $values));
105
- }
106
-
107
- $body .= sprintf(
108
- $batchHttpTemplate,
109
- $this->boundary,
110
- $key,
111
- $firstLine,
112
- $headers,
113
- $content ? "\n".$content : ''
114
- );
115
-
116
- $classes['response-' . $key] = $request->getHeaderLine('X-Php-Expected-Class');
117
- }
118
-
119
- $body .= "--{$this->boundary}--";
120
- $body = trim($body);
121
- $url = $this->rootUrl . '/' . $this->batchPath;
122
- $headers = array(
123
- 'Content-Type' => sprintf('multipart/mixed; boundary=%s', $this->boundary),
124
- 'Content-Length' => strlen($body),
125
- );
126
-
127
- $request = new Request(
128
- 'POST',
129
- $url,
130
- $headers,
131
- $body
132
- );
133
-
134
- $response = $this->client->execute($request);
135
-
136
- return $this->parseResponse($response, $classes);
137
- }
138
-
139
- public function parseResponse(ResponseInterface $response, $classes = array())
140
- {
141
- $contentType = $response->getHeaderLine('content-type');
142
- $contentType = explode(';', $contentType);
143
- $boundary = false;
144
- foreach ($contentType as $part) {
145
- $part = explode('=', $part, 2);
146
- if (isset($part[0]) && 'boundary' == trim($part[0])) {
147
- $boundary = $part[1];
148
- }
149
- }
150
-
151
- $body = (string) $response->getBody();
152
- if (!empty($body)) {
153
- $body = str_replace("--$boundary--", "--$boundary", $body);
154
- $parts = explode("--$boundary", $body);
155
- $responses = array();
156
- $requests = array_values($this->requests);
157
-
158
- foreach ($parts as $i => $part) {
159
- $part = trim($part);
160
- if (!empty($part)) {
161
- list($rawHeaders, $part) = explode("\r\n\r\n", $part, 2);
162
- $headers = $this->parseRawHeaders($rawHeaders);
163
-
164
- $status = substr($part, 0, strpos($part, "\n"));
165
- $status = explode(" ", $status);
166
- $status = $status[1];
167
-
168
- list($partHeaders, $partBody) = $this->parseHttpResponse($part, false);
169
- $response = new Response(
170
- $status,
171
- $partHeaders,
172
- Psr7\stream_for($partBody)
173
- );
174
-
175
- // Need content id.
176
- $key = $headers['content-id'];
177
-
178
- try {
179
- $response = Google_Http_REST::decodeHttpResponse($response, $requests[$i-1]);
180
- } catch (Google_Service_Exception $e) {
181
- // Store the exception as the response, so successful responses
182
- // can be processed.
183
- $response = $e;
184
- }
185
-
186
- $responses[$key] = $response;
187
- }
188
- }
189
-
190
- return $responses;
191
- }
192
-
193
- return null;
194
- }
195
-
196
- private function parseRawHeaders($rawHeaders)
197
- {
198
- $headers = array();
199
- $responseHeaderLines = explode("\r\n", $rawHeaders);
200
- foreach ($responseHeaderLines as $headerLine) {
201
- if ($headerLine && strpos($headerLine, ':') !== false) {
202
- list($header, $value) = explode(': ', $headerLine, 2);
203
- $header = strtolower($header);
204
- if (isset($headers[$header])) {
205
- $headers[$header] .= "\n" . $value;
206
- } else {
207
- $headers[$header] = $value;
208
- }
209
- }
210
- }
211
- return $headers;
212
- }
213
-
214
- /**
215
- * Used by the IO lib and also the batch processing.
216
- *
217
- * @param $respData
218
- * @param $headerSize
219
- * @return array
220
- */
221
- private function parseHttpResponse($respData, $headerSize)
222
- {
223
- // check proxy header
224
- foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
225
- if (stripos($respData, $established_header) !== false) {
226
- // existed, remove it
227
- $respData = str_ireplace($established_header, '', $respData);
228
- // Subtract the proxy header size unless the cURL bug prior to 7.30.0
229
- // is present which prevented the proxy header size from being taken into
230
- // account.
231
- // @TODO look into this
232
- // if (!$this->needsQuirk()) {
233
- // $headerSize -= strlen($established_header);
234
- // }
235
- break;
236
- }
237
- }
238
-
239
- if ($headerSize) {
240
- $responseBody = substr($respData, $headerSize);
241
- $responseHeaders = substr($respData, 0, $headerSize);
242
- } else {
243
- $responseSegments = explode("\r\n\r\n", $respData, 2);
244
- $responseHeaders = $responseSegments[0];
245
- $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
246
- null;
247
- }
248
-
249
- $responseHeaders = $this->parseRawHeaders($responseHeaders);
250
-
251
- return array($responseHeaders, $responseBody);
252
- }
253
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Http/MediaFileUpload.php DELETED
@@ -1,353 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2012 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- use GuzzleHttp\Psr7;
19
- use GuzzleHttp\Psr7\Request;
20
- use GuzzleHttp\Psr7\Uri;
21
- use Psr\Http\Message\RequestInterface;
22
-
23
- /**
24
- * Manage large file uploads, which may be media but can be any type
25
- * of sizable data.
26
- */
27
- class Google_Http_MediaFileUpload
28
- {
29
- const UPLOAD_MEDIA_TYPE = 'media';
30
- const UPLOAD_MULTIPART_TYPE = 'multipart';
31
- const UPLOAD_RESUMABLE_TYPE = 'resumable';
32
-
33
- /** @var string $mimeType */
34
- private $mimeType;
35
-
36
- /** @var string $data */
37
- private $data;
38
-
39
- /** @var bool $resumable */
40
- private $resumable;
41
-
42
- /** @var int $chunkSize */
43
- private $chunkSize;
44
-
45
- /** @var int $size */
46
- private $size;
47
-
48
- /** @var string $resumeUri */
49
- private $resumeUri;
50
-
51
- /** @var int $progress */
52
- private $progress;
53
-
54
- /** @var Google_Client */
55
- private $client;
56
-
57
- /** @var Psr\Http\Message\RequestInterface */
58
- private $request;
59
-
60
- /** @var string */
61
- private $boundary;
62
-
63
- /**
64
- * Result code from last HTTP call
65
- * @var int
66
- */
67
- private $httpResultCode;
68
-
69
- /**
70
- * @param Google_Client $client
71
- * @param RequestInterface $request
72
- * @param string $mimeType
73
- * @param string $data The bytes you want to upload.
74
- * @param bool $resumable
75
- * @param bool $chunkSize File will be uploaded in chunks of this many bytes.
76
- * only used if resumable=True
77
- */
78
- public function __construct(
79
- Google_Client $client,
80
- RequestInterface $request,
81
- $mimeType,
82
- $data,
83
- $resumable = false,
84
- $chunkSize = false
85
- ) {
86
- $this->client = $client;
87
- $this->request = $request;
88
- $this->mimeType = $mimeType;
89
- $this->data = $data;
90
- $this->resumable = $resumable;
91
- $this->chunkSize = $chunkSize;
92
- $this->progress = 0;
93
-
94
- $this->process();
95
- }
96
-
97
- /**
98
- * Set the size of the file that is being uploaded.
99
- * @param $size - int file size in bytes
100
- */
101
- public function setFileSize($size)
102
- {
103
- $this->size = $size;
104
- }
105
-
106
- /**
107
- * Return the progress on the upload
108
- * @return int progress in bytes uploaded.
109
- */
110
- public function getProgress()
111
- {
112
- return $this->progress;
113
- }
114
-
115
- /**
116
- * Send the next part of the file to upload.
117
- * @param string|bool $chunk Optional. The next set of bytes to send. If false will
118
- * use $data passed at construct time.
119
- */
120
- public function nextChunk($chunk = false)
121
- {
122
- $resumeUri = $this->getResumeUri();
123
-
124
- if (false == $chunk) {
125
- $chunk = substr($this->data, $this->progress, $this->chunkSize);
126
- }
127
-
128
- $lastBytePos = $this->progress + strlen($chunk) - 1;
129
- $headers = array(
130
- 'content-range' => "bytes $this->progress-$lastBytePos/$this->size",
131
- 'content-length' => strlen($chunk),
132
- 'expect' => '',
133
- );
134
-
135
- $request = new Request(
136
- 'PUT',
137
- $resumeUri,
138
- $headers,
139
- Psr7\stream_for($chunk)
140
- );
141
-
142
- return $this->makePutRequest($request);
143
- }
144
-
145
- /**
146
- * Return the HTTP result code from the last call made.
147
- * @return int code
148
- */
149
- public function getHttpResultCode()
150
- {
151
- return $this->httpResultCode;
152
- }
153
-
154
- /**
155
- * Sends a PUT-Request to google drive and parses the response,
156
- * setting the appropiate variables from the response()
157
- *
158
- * @param Google_Http_Request $httpRequest the Reuqest which will be send
159
- *
160
- * @return false|mixed false when the upload is unfinished or the decoded http response
161
- *
162
- */
163
- private function makePutRequest(RequestInterface $request)
164
- {
165
- $response = $this->client->execute($request);
166
- $this->httpResultCode = $response->getStatusCode();
167
-
168
- if (308 == $this->httpResultCode) {
169
- // Track the amount uploaded.
170
- $range = $response->getHeaderLine('range');
171
- if ($range) {
172
- $range_array = explode('-', $range);
173
- $this->progress = $range_array[1] + 1;
174
- }
175
-
176
- // Allow for changing upload URLs.
177
- $location = $response->getHeaderLine('location');
178
- if ($location) {
179
- $this->resumeUri = $location;
180
- }
181
-
182
- // No problems, but upload not complete.
183
- return false;
184
- }
185
-
186
- return Google_Http_REST::decodeHttpResponse($response, $this->request);
187
- }
188
-
189
- /**
190
- * Resume a previously unfinished upload
191
- * @param $resumeUri the resume-URI of the unfinished, resumable upload.
192
- */
193
- public function resume($resumeUri)
194
- {
195
- $this->resumeUri = $resumeUri;
196
- $headers = array(
197
- 'content-range' => "bytes */$this->size",
198
- 'content-length' => 0,
199
- );
200
- $httpRequest = new Request(
201
- 'PUT',
202
- $this->resumeUri,
203
- $headers
204
- );
205
-
206
- return $this->makePutRequest($httpRequest);
207
- }
208
-
209
- /**
210
- * @return Psr\Http\Message\RequestInterface $request
211
- * @visible for testing
212
- */
213
- private function process()
214
- {
215
- $this->transformToUploadUrl();
216
- $request = $this->request;
217
-
218
- $postBody = '';
219
- $contentType = false;
220
-
221
- $meta = (string) $request->getBody();
222
- $meta = is_string($meta) ? json_decode($meta, true) : $meta;
223
-
224
- $uploadType = $this->getUploadType($meta);
225
- $request = $request->withUri(
226
- Uri::withQueryValue($request->getUri(), 'uploadType', $uploadType)
227
- );
228
-
229
- $mimeType = $this->mimeType ?: $request->getHeaderLine('content-type');
230
-
231
- if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) {
232
- $contentType = $mimeType;
233
- $postBody = is_string($meta) ? $meta : json_encode($meta);
234
- } else if (self::UPLOAD_MEDIA_TYPE == $uploadType) {
235
- $contentType = $mimeType;
236
- $postBody = $this->data;
237
- } else if (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
238
- // This is a multipart/related upload.
239
- $boundary = $this->boundary ?: mt_rand();
240
- $boundary = str_replace('"', '', $boundary);
241
- $contentType = 'multipart/related; boundary=' . $boundary;
242
- $related = "--$boundary\r\n";
243
- $related .= "Content-Type: application/json; charset=UTF-8\r\n";
244
- $related .= "\r\n" . json_encode($meta) . "\r\n";
245
- $related .= "--$boundary\r\n";
246
- $related .= "Content-Type: $mimeType\r\n";
247
- $related .= "Content-Transfer-Encoding: base64\r\n";
248
- $related .= "\r\n" . base64_encode($this->data) . "\r\n";
249
- $related .= "--$boundary--";
250
- $postBody = $related;
251
- }
252
-
253
- $request = $request->withBody(Psr7\stream_for($postBody));
254
-
255
- if (isset($contentType) && $contentType) {
256
- $request = $request->withHeader('content-type', $contentType);
257
- }
258
-
259
- return $this->request = $request;
260
- }
261
-
262
- /**
263
- * Valid upload types:
264
- * - resumable (UPLOAD_RESUMABLE_TYPE)
265
- * - media (UPLOAD_MEDIA_TYPE)
266
- * - multipart (UPLOAD_MULTIPART_TYPE)
267
- * @param $meta
268
- * @return string
269
- * @visible for testing
270
- */
271
- public function getUploadType($meta)
272
- {
273
- if ($this->resumable) {
274
- return self::UPLOAD_RESUMABLE_TYPE;
275
- }
276
-
277
- if (false == $meta && $this->data) {
278
- return self::UPLOAD_MEDIA_TYPE;
279
- }
280
-
281
- return self::UPLOAD_MULTIPART_TYPE;
282
- }
283
-
284
- public function getResumeUri()
285
- {
286
- if (null === $this->resumeUri) {
287
- $this->resumeUri = $this->fetchResumeUri();
288
- }
289
-
290
- return $this->resumeUri;
291
- }
292
-
293
- private function fetchResumeUri()
294
- {
295
- $body = $this->request->getBody();
296
- if ($body) {
297
- $headers = array(
298
- 'content-type' => 'application/json; charset=UTF-8',
299
- 'content-length' => $body->getSize(),
300
- 'x-upload-content-type' => $this->mimeType,
301
- 'x-upload-content-length' => $this->size,
302
- 'expect' => '',
303
- );
304
- foreach ($headers as $key => $value) {
305
- $this->request = $this->request->withHeader($key, $value);
306
- }
307
- }
308
-
309
- $response = $this->client->execute($this->request, false);
310
- $location = $response->getHeaderLine('location');
311
- $code = $response->getStatusCode();
312
-
313
- if (200 == $code && true == $location) {
314
- return $location;
315
- }
316
-
317
- $message = $code;
318
- $body = json_decode((string) $this->request->getBody(), true);
319
- if (isset($body['error']['errors'])) {
320
- $message .= ': ';
321
- foreach ($body['error']['errors'] as $error) {
322
- $message .= "{$error['domain']}, {$error['message']};";
323
- }
324
- $message = rtrim($message, ';');
325
- }
326
-
327
- $error = "Failed to start the resumable upload (HTTP {$message})";
328
- $this->client->getLogger()->error($error);
329
-
330
- throw new Google_Exception($error);
331
- }
332
-
333
- private function transformToUploadUrl()
334
- {
335
- $parts = parse_url((string) $this->request->getUri());
336
- if (!isset($parts['path'])) {
337
- $parts['path'] = '';
338
- }
339
- $parts['path'] = '/upload' . $parts['path'];
340
- $uri = Uri::fromParts($parts);
341
- $this->request = $this->request->withUri($uri);
342
- }
343
-
344
- public function setChunkSize($chunkSize)
345
- {
346
- $this->chunkSize = $chunkSize;
347
- }
348
-
349
- public function getRequest()
350
- {
351
- return $this->request;
352
- }
353
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Http/REST.php DELETED
@@ -1,187 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2010 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- use Google\Auth\HttpHandler\HttpHandlerFactory;
19
- use GuzzleHttp\ClientInterface;
20
- use GuzzleHttp\Exception\RequestException;
21
- use GuzzleHttp\Psr7\Response;
22
- use Psr\Http\Message\RequestInterface;
23
- use Psr\Http\Message\ResponseInterface;
24
-
25
- /**
26
- * This class implements the RESTful transport of apiServiceRequest()'s
27
- */
28
- class Google_Http_REST
29
- {
30
- /**
31
- * Executes a Psr\Http\Message\RequestInterface and (if applicable) automatically retries
32
- * when errors occur.
33
- *
34
- * @param Google_Client $client
35
- * @param Psr\Http\Message\RequestInterface $req
36
- * @param string $expectedClass
37
- * @param array $config
38
- * @param array $retryMap
39
- * @return array decoded result
40
- * @throws Google_Service_Exception on server side error (ie: not authenticated,
41
- * invalid or malformed post body, invalid url)
42
- */
43
- public static function execute(
44
- ClientInterface $client,
45
- RequestInterface $request,
46
- $expectedClass = null,
47
- $config = array(),
48
- $retryMap = null
49
- ) {
50
- $runner = new Google_Task_Runner(
51
- $config,
52
- sprintf('%s %s', $request->getMethod(), (string) $request->getUri()),
53
- array(get_class(), 'doExecute'),
54
- array($client, $request, $expectedClass)
55
- );
56
-
57
- if (null !== $retryMap) {
58
- $runner->setRetryMap($retryMap);
59
- }
60
-
61
- return $runner->run();
62
- }
63
-
64
- /**
65
- * Executes a Psr\Http\Message\RequestInterface
66
- *
67
- * @param Google_Client $client
68
- * @param Psr\Http\Message\RequestInterface $request
69
- * @param string $expectedClass
70
- * @return array decoded result
71
- * @throws Google_Service_Exception on server side error (ie: not authenticated,
72
- * invalid or malformed post body, invalid url)
73
- */
74
- public static function doExecute(ClientInterface $client, RequestInterface $request, $expectedClass = null)
75
- {
76
- try {
77
- $httpHandler = HttpHandlerFactory::build($client);
78
- $response = $httpHandler($request);
79
- } catch (RequestException $e) {
80
- // if Guzzle throws an exception, catch it and handle the response
81
- if (!$e->hasResponse()) {
82
- throw $e;
83
- }
84
-
85
- $response = $e->getResponse();
86
- // specific checking for Guzzle 5: convert to PSR7 response
87
- if ($response instanceof \GuzzleHttp\Message\ResponseInterface) {
88
- $response = new Response(
89
- $response->getStatusCode(),
90
- $response->getHeaders() ?: [],
91
- $response->getBody(),
92
- $response->getProtocolVersion(),
93
- $response->getReasonPhrase()
94
- );
95
- }
96
- }
97
-
98
- return self::decodeHttpResponse($response, $request, $expectedClass);
99
- }
100
-
101
- /**
102
- * Decode an HTTP Response.
103
- * @static
104
- * @throws Google_Service_Exception
105
- * @param Psr\Http\Message\RequestInterface $response The http response to be decoded.
106
- * @param Psr\Http\Message\ResponseInterface $response
107
- * @param string $expectedClass
108
- * @return mixed|null
109
- */
110
- public static function decodeHttpResponse(
111
- ResponseInterface $response,
112
- RequestInterface $request = null,
113
- $expectedClass = null
114
- ) {
115
- $code = $response->getStatusCode();
116
-
117
- // retry strategy
118
- if (intVal($code) >= 400) {
119
- // if we errored out, it should be safe to grab the response body
120
- $body = (string) $response->getBody();
121
-
122
- // Check if we received errors, and add those to the Exception for convenience
123
- throw new Google_Service_Exception($body, $code, null, self::getResponseErrors($body));
124
- }
125
-
126
- // Ensure we only pull the entire body into memory if the request is not
127
- // of media type
128
- $body = self::decodeBody($response, $request);
129
-
130
- if ($expectedClass = self::determineExpectedClass($expectedClass, $request)) {
131
- $json = json_decode($body, true);
132
-
133
- return new $expectedClass($json);
134
- }
135
-
136
- return $response;
137
- }
138
-
139
- private static function decodeBody(ResponseInterface $response, RequestInterface $request = null)
140
- {
141
- if (self::isAltMedia($request)) {
142
- // don't decode the body, it's probably a really long string
143
- return '';
144
- }
145
-
146
- return (string) $response->getBody();
147
- }
148
-
149
- private static function determineExpectedClass($expectedClass, RequestInterface $request = null)
150
- {
151
- // "false" is used to explicitly prevent an expected class from being returned
152
- if (false === $expectedClass) {
153
- return null;
154
- }
155
-
156
- // if we don't have a request, we just use what's passed in
157
- if (null === $request) {
158
- return $expectedClass;
159
- }
160
-
161
- // return what we have in the request header if one was not supplied
162
- return $expectedClass ?: $request->getHeaderLine('X-Php-Expected-Class');
163
- }
164
-
165
- private static function getResponseErrors($body)
166
- {
167
- $json = json_decode($body, true);
168
-
169
- if (isset($json['error']['errors'])) {
170
- return $json['error']['errors'];
171
- }
172
-
173
- return null;
174
- }
175
-
176
- private static function isAltMedia(RequestInterface $request = null)
177
- {
178
- if ($request && $qs = $request->getUri()->getQuery()) {
179
- parse_str($qs, $query);
180
- if (isset($query['alt']) && $query['alt'] == 'media') {
181
- return true;
182
- }
183
- }
184
-
185
- return false;
186
- }
187
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Model.php DELETED
@@ -1,317 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2011 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- /**
19
- * This class defines attributes, valid values, and usage which is generated
20
- * from a given json schema.
21
- * http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5
22
- *
23
- */
24
- class Google_Model implements ArrayAccess
25
- {
26
- /**
27
- * If you need to specify a NULL JSON value, use Google_Model::NULL_VALUE
28
- * instead - it will be replaced when converting to JSON with a real null.
29
- */
30
- const NULL_VALUE = "{}gapi-php-null";
31
- protected $internal_gapi_mappings = array();
32
- protected $modelData = array();
33
- protected $processed = array();
34
-
35
- /**
36
- * Polymorphic - accepts a variable number of arguments dependent
37
- * on the type of the model subclass.
38
- */
39
- final public function __construct()
40
- {
41
- if (func_num_args() == 1 && is_array(func_get_arg(0))) {
42
- // Initialize the model with the array's contents.
43
- $array = func_get_arg(0);
44
- $this->mapTypes($array);
45
- }
46
- $this->gapiInit();
47
- }
48
-
49
- /**
50
- * Getter that handles passthrough access to the data array, and lazy object creation.
51
- * @param string $key Property name.
52
- * @return mixed The value if any, or null.
53
- */
54
- public function __get($key)
55
- {
56
- $keyType = $this->keyType($key);
57
- $keyDataType = $this->dataType($key);
58
- if ($keyType && !isset($this->processed[$key])) {
59
- if (isset($this->modelData[$key])) {
60
- $val = $this->modelData[$key];
61
- } elseif ($keyDataType == 'array' || $keyDataType == 'map') {
62
- $val = array();
63
- } else {
64
- $val = null;
65
- }
66
-
67
- if ($this->isAssociativeArray($val)) {
68
- if ($keyDataType && 'map' == $keyDataType) {
69
- foreach ($val as $arrayKey => $arrayItem) {
70
- $this->modelData[$key][$arrayKey] =
71
- new $keyType($arrayItem);
72
- }
73
- } else {
74
- $this->modelData[$key] = new $keyType($val);
75
- }
76
- } else if (is_array($val)) {
77
- $arrayObject = array();
78
- foreach ($val as $arrayIndex => $arrayItem) {
79
- $arrayObject[$arrayIndex] = new $keyType($arrayItem);
80
- }
81
- $this->modelData[$key] = $arrayObject;
82
- }
83
- $this->processed[$key] = true;
84
- }
85
-
86
- return isset($this->modelData[$key]) ? $this->modelData[$key] : null;
87
- }
88
-
89
- /**
90
- * Initialize this object's properties from an array.
91
- *
92
- * @param array $array Used to seed this object's properties.
93
- * @return void
94
- */
95
- protected function mapTypes($array)
96
- {
97
- // Hard initialise simple types, lazy load more complex ones.
98
- foreach ($array as $key => $val) {
99
- if ($keyType = $this->keyType($key)) {
100
- $dataType = $this->dataType($key);
101
- if ($dataType == 'array' || $dataType == 'map') {
102
- $this->$key = array();
103
- foreach ($val as $itemKey => $itemVal) {
104
- if ($itemVal instanceof $keyType) {
105
- $this->{$key}[$itemKey] = $itemVal;
106
- } else {
107
- $this->{$key}[$itemKey] = new $keyType($itemVal);
108
- }
109
- }
110
- } elseif ($val instanceof $keyType) {
111
- $this->$key = $val;
112
- } else {
113
- $this->$key = new $keyType($val);
114
- }
115
- unset($array[$key]);
116
- } elseif (property_exists($this, $key)) {
117
- $this->$key = $val;
118
- unset($array[$key]);
119
- } elseif (property_exists($this, $camelKey = $this->camelCase($key))) {
120
- // This checks if property exists as camelCase, leaving it in array as snake_case
121
- // in case of backwards compatibility issues.
122
- $this->$camelKey = $val;
123
- }
124
- }
125
- $this->modelData = $array;
126
- }
127
-
128
- /**
129
- * Blank initialiser to be used in subclasses to do post-construction initialisation - this
130
- * avoids the need for subclasses to have to implement the variadics handling in their
131
- * constructors.
132
- */
133
- protected function gapiInit()
134
- {
135
- return;
136
- }
137
-
138
- /**
139
- * Create a simplified object suitable for straightforward
140
- * conversion to JSON. This is relatively expensive
141
- * due to the usage of reflection, but shouldn't be called
142
- * a whole lot, and is the most straightforward way to filter.
143
- */
144
- public function toSimpleObject()
145
- {
146
- $object = new stdClass();
147
-
148
- // Process all other data.
149
- foreach ($this->modelData as $key => $val) {
150
- $result = $this->getSimpleValue($val);
151
- if ($result !== null) {
152
- $object->$key = $this->nullPlaceholderCheck($result);
153
- }
154
- }
155
-
156
- // Process all public properties.
157
- $reflect = new ReflectionObject($this);
158
- $props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
159
- foreach ($props as $member) {
160
- $name = $member->getName();
161
- $result = $this->getSimpleValue($this->$name);
162
- if ($result !== null) {
163
- $name = $this->getMappedName($name);
164
- $object->$name = $this->nullPlaceholderCheck($result);
165
- }
166
- }
167
-
168
- return $object;
169
- }
170
-
171
- /**
172
- * Handle different types of values, primarily
173
- * other objects and map and array data types.
174
- */
175
- private function getSimpleValue($value)
176
- {
177
- if ($value instanceof Google_Model) {
178
- return $value->toSimpleObject();
179
- } else if (is_array($value)) {
180
- $return = array();
181
- foreach ($value as $key => $a_value) {
182
- $a_value = $this->getSimpleValue($a_value);
183
- if ($a_value !== null) {
184
- $key = $this->getMappedName($key);
185
- $return[$key] = $this->nullPlaceholderCheck($a_value);
186
- }
187
- }
188
- return $return;
189
- }
190
- return $value;
191
- }
192
-
193
- /**
194
- * Check whether the value is the null placeholder and return true null.
195
- */
196
- private function nullPlaceholderCheck($value)
197
- {
198
- if ($value === self::NULL_VALUE) {
199
- return null;
200
- }
201
- return $value;
202
- }
203
-
204
- /**
205
- * If there is an internal name mapping, use that.
206
- */
207
- private function getMappedName($key)
208
- {
209
- if (isset($this->internal_gapi_mappings, $this->internal_gapi_mappings[$key])) {
210
- $key = $this->internal_gapi_mappings[$key];
211
- }
212
- return $key;
213
- }
214
-
215
- /**
216
- * Returns true only if the array is associative.
217
- * @param array $array
218
- * @return bool True if the array is associative.
219
- */
220
- protected function isAssociativeArray($array)
221
- {
222
- if (!is_array($array)) {
223
- return false;
224
- }
225
- $keys = array_keys($array);
226
- foreach ($keys as $key) {
227
- if (is_string($key)) {
228
- return true;
229
- }
230
- }
231
- return false;
232
- }
233
-
234
- /**
235
- * Verify if $obj is an array.
236
- * @throws Google_Exception Thrown if $obj isn't an array.
237
- * @param array $obj Items that should be validated.
238
- * @param string $method Method expecting an array as an argument.
239
- */
240
- public function assertIsArray($obj, $method)
241
- {
242
- if ($obj && !is_array($obj)) {
243
- throw new Google_Exception(
244
- "Incorrect parameter type passed to $method(). Expected an array."
245
- );
246
- }
247
- }
248
-
249
- public function offsetExists($offset)
250
- {
251
- return isset($this->$offset) || isset($this->modelData[$offset]);
252
- }
253
-
254
- public function offsetGet($offset)
255
- {
256
- return isset($this->$offset) ?
257
- $this->$offset :
258
- $this->__get($offset);
259
- }
260
-
261
- public function offsetSet($offset, $value)
262
- {
263
- if (property_exists($this, $offset)) {
264
- $this->$offset = $value;
265
- } else {
266
- $this->modelData[$offset] = $value;
267
- $this->processed[$offset] = true;
268
- }
269
- }
270
-
271
- public function offsetUnset($offset)
272
- {
273
- unset($this->modelData[$offset]);
274
- }
275
-
276
- protected function keyType($key)
277
- {
278
- $keyType = $key . "Type";
279
-
280
- // ensure keyType is a valid class
281
- if (property_exists($this, $keyType) && class_exists($this->$keyType)) {
282
- return $this->$keyType;
283
- }
284
- }
285
-
286
- protected function dataType($key)
287
- {
288
- $dataType = $key . "DataType";
289
-
290
- if (property_exists($this, $dataType)) {
291
- return $this->$dataType;
292
- }
293
- }
294
-
295
- public function __isset($key)
296
- {
297
- return isset($this->modelData[$key]);
298
- }
299
-
300
- public function __unset($key)
301
- {
302
- unset($this->modelData[$key]);
303
- }
304
-
305
- /**
306
- * Convert a string to camelCase
307
- * @param string $value
308
- * @return string
309
- */
310
- private function camelCase($value)
311
- {
312
- $value = ucwords(str_replace(array('-', '_'), ' ', $value));
313
- $value = str_replace(' ', '', $value);
314
- $value[0] = strtolower($value[0]);
315
- return $value;
316
- }
317
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Service.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2010 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- class Google_Service
19
- {
20
- public $batchPath;
21
- public $rootUrl;
22
- public $version;
23
- public $servicePath;
24
- public $availableScopes;
25
- public $resource;
26
- private $client;
27
-
28
- public function __construct(Google_Client $client)
29
- {
30
- $this->client = $client;
31
- }
32
-
33
- /**
34
- * Return the associated Google_Client class.
35
- * @return Google_Client
36
- */
37
- public function getClient()
38
- {
39
- return $this->client;
40
- }
41
-
42
- /**
43
- * Create a new HTTP Batch handler for this service
44
- *
45
- * @return Google_Http_Batch
46
- */
47
- public function createBatch()
48
- {
49
- return new Google_Http_Batch(
50
- $this->client,
51
- false,
52
- $this->rootUrl,
53
- $this->batchPath
54
- );
55
- }
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Service/Exception.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2014 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- class Google_Service_Exception extends Google_Exception
19
- {
20
- /**
21
- * Optional list of errors returned in a JSON body of an HTTP error response.
22
- */
23
- protected $errors = array();
24
-
25
- /**
26
- * Override default constructor to add the ability to set $errors and a retry
27
- * map.
28
- *
29
- * @param string $message
30
- * @param int $code
31
- * @param Exception|null $previous
32
- * @param [{string, string}] errors List of errors returned in an HTTP
33
- * response. Defaults to [].
34
- */
35
- public function __construct(
36
- $message,
37
- $code = 0,
38
- Exception $previous = null,
39
- $errors = array()
40
- ) {
41
- if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
42
- parent::__construct($message, $code, $previous);
43
- } else {
44
- parent::__construct($message, $code);
45
- }
46
-
47
- $this->errors = $errors;
48
- }
49
-
50
- /**
51
- * An example of the possible errors returned.
52
- *
53
- * {
54
- * "domain": "global",
55
- * "reason": "authError",
56
- * "message": "Invalid Credentials",
57
- * "locationType": "header",
58
- * "location": "Authorization",
59
- * }
60
- *
61
- * @return [{string, string}] List of errors return in an HTTP response or [].
62
- */
63
- public function getErrors()
64
- {
65
- return $this->errors;
66
- }
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Service/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Google API Client Services
2
-
3
- Google API Client Service classes have been moved to the
4
- [google-api-php-client-services](https://github.com/google/google-api-php-client-services)
5
- repository.
 
 
 
 
 
vendor/google/apiclient/src/Google/Service/Resource.php DELETED
@@ -1,302 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2010 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- use GuzzleHttp\Psr7\Request;
19
-
20
- /**
21
- * Implements the actual methods/resources of the discovered Google API using magic function
22
- * calling overloading (__call()), which on call will see if the method name (plus.activities.list)
23
- * is available in this service, and if so construct an apiHttpRequest representing it.
24
- *
25
- */
26
- class Google_Service_Resource
27
- {
28
- // Valid query parameters that work, but don't appear in discovery.
29
- private $stackParameters = array(
30
- 'alt' => array('type' => 'string', 'location' => 'query'),
31
- 'fields' => array('type' => 'string', 'location' => 'query'),
32
- 'trace' => array('type' => 'string', 'location' => 'query'),
33
- 'userIp' => array('type' => 'string', 'location' => 'query'),
34
- 'quotaUser' => array('type' => 'string', 'location' => 'query'),
35
- 'data' => array('type' => 'string', 'location' => 'body'),
36
- 'mimeType' => array('type' => 'string', 'location' => 'header'),
37
- 'uploadType' => array('type' => 'string', 'location' => 'query'),
38
- 'mediaUpload' => array('type' => 'complex', 'location' => 'query'),
39
- 'prettyPrint' => array('type' => 'string', 'location' => 'query'),
40
- );
41
-
42
- /** @var string $rootUrl */
43
- private $rootUrl;
44
-
45
- /** @var Google_Client $client */
46
- private $client;
47
-
48
- /** @var string $serviceName */
49
- private $serviceName;
50
-
51
- /** @var string $servicePath */
52
- private $servicePath;
53
-
54
- /** @var string $resourceName */
55
- private $resourceName;
56
-
57
- /** @var array $methods */
58
- private $methods;
59
-
60
- public function __construct($service, $serviceName, $resourceName, $resource)
61
- {
62
- $this->rootUrl = $service->rootUrl;
63
- $this->client = $service->getClient();
64
- $this->servicePath = $service->servicePath;
65
- $this->serviceName = $serviceName;
66
- $this->resourceName = $resourceName;
67
- $this->methods = is_array($resource) && isset($resource['methods']) ?
68
- $resource['methods'] :
69
- array($resourceName => $resource);
70
- }
71
-
72
- /**
73
- * TODO: This function needs simplifying.
74
- * @param $name
75
- * @param $arguments
76
- * @param $expectedClass - optional, the expected class name
77
- * @return Google_Http_Request|expectedClass
78
- * @throws Google_Exception
79
- */
80
- public function call($name, $arguments, $expectedClass = null)
81
- {
82
- if (! isset($this->methods[$name])) {
83
- $this->client->getLogger()->error(
84
- 'Service method unknown',
85
- array(
86
- 'service' => $this->serviceName,
87
- 'resource' => $this->resourceName,
88
- 'method' => $name
89
- )
90
- );
91
-
92
- throw new Google_Exception(
93
- "Unknown function: " .
94
- "{$this->serviceName}->{$this->resourceName}->{$name}()"
95
- );
96
- }
97
- $method = $this->methods[$name];
98
- $parameters = $arguments[0];
99
-
100
- // postBody is a special case since it's not defined in the discovery
101
- // document as parameter, but we abuse the param entry for storing it.
102
- $postBody = null;
103
- if (isset($parameters['postBody'])) {
104
- if ($parameters['postBody'] instanceof Google_Model) {
105
- // In the cases the post body is an existing object, we want
106
- // to use the smart method to create a simple object for
107
- // for JSONification.
108
- $parameters['postBody'] = $parameters['postBody']->toSimpleObject();
109
- } else if (is_object($parameters['postBody'])) {
110
- // If the post body is another kind of object, we will try and
111
- // wrangle it into a sensible format.
112
- $parameters['postBody'] =
113
- $this->convertToArrayAndStripNulls($parameters['postBody']);
114
- }
115
- $postBody = (array) $parameters['postBody'];
116
- unset($parameters['postBody']);
117
- }
118
-
119
- // TODO: optParams here probably should have been
120
- // handled already - this may well be redundant code.
121
- if (isset($parameters['optParams'])) {
122
- $optParams = $parameters['optParams'];
123
- unset($parameters['optParams']);
124
- $parameters = array_merge($parameters, $optParams);
125
- }
126
-
127
- if (!isset($method['parameters'])) {
128
- $method['parameters'] = array();
129
- }
130
-
131
- $method['parameters'] = array_merge(
132
- $this->stackParameters,
133
- $method['parameters']
134
- );
135
-
136
- foreach ($parameters as $key => $val) {
137
- if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
138
- $this->client->getLogger()->error(
139
- 'Service parameter unknown',
140
- array(
141
- 'service' => $this->serviceName,
142
- 'resource' => $this->resourceName,
143
- 'method' => $name,
144
- 'parameter' => $key
145
- )
146
- );
147
- throw new Google_Exception("($name) unknown parameter: '$key'");
148
- }
149
- }
150
-
151
- foreach ($method['parameters'] as $paramName => $paramSpec) {
152
- if (isset($paramSpec['required']) &&
153
- $paramSpec['required'] &&
154
- ! isset($parameters[$paramName])
155
- ) {
156
- $this->client->getLogger()->error(
157
- 'Service parameter missing',
158
- array(
159
- 'service' => $this->serviceName,
160
- 'resource' => $this->resourceName,
161
- 'method' => $name,
162
- 'parameter' => $paramName
163
- )
164
- );
165
- throw new Google_Exception("($name) missing required param: '$paramName'");
166
- }
167
- if (isset($parameters[$paramName])) {
168
- $value = $parameters[$paramName];
169
- $parameters[$paramName] = $paramSpec;
170
- $parameters[$paramName]['value'] = $value;
171
- unset($parameters[$paramName]['required']);
172
- } else {
173
- // Ensure we don't pass nulls.
174
- unset($parameters[$paramName]);
175
- }
176
- }
177
-
178
- $this->client->getLogger()->info(
179
- 'Service Call',
180
- array(
181
- 'service' => $this->serviceName,
182
- 'resource' => $this->resourceName,
183
- 'method' => $name,
184
- 'arguments' => $parameters,
185
- )
186
- );
187
-
188
- // build the service uri
189
- $url = $this->createRequestUri(
190
- $method['path'],
191
- $parameters
192
- );
193
-
194
- // NOTE: because we're creating the request by hand,
195
- // and because the service has a rootUrl property
196
- // the "base_uri" of the Http Client is not accounted for
197
- $request = new Request(
198
- $method['httpMethod'],
199
- $url,
200
- ['content-type' => 'application/json'],
201
- $postBody ? json_encode($postBody) : ''
202
- );
203
-
204
- // support uploads
205
- if (isset($parameters['data'])) {
206
- $mimeType = isset($parameters['mimeType'])
207
- ? $parameters['mimeType']['value']
208
- : 'application/octet-stream';
209
- $data = $parameters['data']['value'];
210
- $upload = new Google_Http_MediaFileUpload($this->client, $request, $mimeType, $data);
211
-
212
- // pull down the modified request
213
- $request = $upload->getRequest();
214
- }
215
-
216
- // if this is a media type, we will return the raw response
217
- // rather than using an expected class
218
- if (isset($parameters['alt']) && $parameters['alt']['value'] == 'media') {
219
- $expectedClass = null;
220
- }
221
-
222
- // if the client is marked for deferring, rather than
223
- // execute the request, return the response
224
- if ($this->client->shouldDefer()) {
225
- // @TODO find a better way to do this
226
- $request = $request
227
- ->withHeader('X-Php-Expected-Class', $expectedClass);
228
-
229
- return $request;
230
- }
231
-
232
- return $this->client->execute($request, $expectedClass);
233
- }
234
-
235
- protected function convertToArrayAndStripNulls($o)
236
- {
237
- $o = (array) $o;
238
- foreach ($o as $k => $v) {
239
- if ($v === null) {
240
- unset($o[$k]);
241
- } elseif (is_object($v) || is_array($v)) {
242
- $o[$k] = $this->convertToArrayAndStripNulls($o[$k]);
243
- }
244
- }
245
- return $o;
246
- }
247
-
248
- /**
249
- * Parse/expand request parameters and create a fully qualified
250
- * request uri.
251
- * @static
252
- * @param string $restPath
253
- * @param array $params
254
- * @return string $requestUrl
255
- */
256
- public function createRequestUri($restPath, $params)
257
- {
258
- // Override the default servicePath address if the $restPath use a /
259
- if ('/' == substr($restPath, 0, 1)) {
260
- $requestUrl = substr($restPath, 1);
261
- } else {
262
- $requestUrl = $this->servicePath . $restPath;
263
- }
264
-
265
- // code for leading slash
266
- if ($this->rootUrl) {
267
- if ('/' !== substr($this->rootUrl, -1) && '/' !== substr($requestUrl, 0, 1)) {
268
- $requestUrl = '/' . $requestUrl;
269
- }
270
- $requestUrl = $this->rootUrl . $requestUrl;
271
- }
272
- $uriTemplateVars = array();
273
- $queryVars = array();
274
- foreach ($params as $paramName => $paramSpec) {
275
- if ($paramSpec['type'] == 'boolean') {
276
- $paramSpec['value'] = $paramSpec['value'] ? 'true' : 'false';
277
- }
278
- if ($paramSpec['location'] == 'path') {
279
- $uriTemplateVars[$paramName] = $paramSpec['value'];
280
- } else if ($paramSpec['location'] == 'query') {
281
- if (is_array($paramSpec['value'])) {
282
- foreach ($paramSpec['value'] as $value) {
283
- $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value));
284
- }
285
- } else {
286
- $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value']));
287
- }
288
- }
289
- }
290
-
291
- if (count($uriTemplateVars)) {
292
- $uriTemplateParser = new Google_Utils_UriTemplate();
293
- $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
294
- }
295
-
296
- if (count($queryVars)) {
297
- $requestUrl .= '?' . implode('&', $queryVars);
298
- }
299
-
300
- return $requestUrl;
301
- }
302
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Task/Composer.php DELETED
@@ -1,104 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2020 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6
- * use this file except in compliance with the License. You may obtain a copy of
7
- * the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
- * License for the specific language governing permissions and limitations under
15
- * the License.
16
- */
17
-
18
- use Composer\Script\Event;
19
- use Symfony\Component\Filesystem\Filesystem;
20
- use Symfony\Component\Finder\Finder;
21
-
22
- class Google_Task_Composer
23
- {
24
- /**
25
- * @param Event $event Composer event passed in for any script method
26
- * @param FilesystemInterface $filesystem Optional. Used for testing.
27
- */
28
- public static function cleanup(
29
- Event $event,
30
- Filesystem $filesystem = null
31
- ) {
32
- $composer = $event->getComposer();
33
- $extra = $composer->getPackage()->getExtra();
34
- $servicesToKeep = isset($extra['google/apiclient-services']) ?
35
- $extra['google/apiclient-services'] : [];
36
- if ($servicesToKeep) {
37
- $serviceDir = sprintf(
38
- '%s/google/apiclient-services/src/Google/Service',
39
- $composer->getConfig()->get('vendor-dir')
40
- );
41
- self::verifyServicesToKeep($serviceDir, $servicesToKeep);
42
- $finder = self::getServicesToRemove($serviceDir, $servicesToKeep);
43
- $filesystem = $filesystem ?: new Filesystem();
44
- if (0 !== $count = count($finder)) {
45
- $event->getIO()->write(
46
- sprintf(
47
- 'Removing %s google services',
48
- $count
49
- )
50
- );
51
- foreach ($finder as $file) {
52
- $realpath = $file->getRealPath();
53
- $filesystem->remove($realpath);
54
- $filesystem->remove($realpath . '.php');
55
- }
56
- }
57
- }
58
- }
59
-
60
- /**
61
- * @throws InvalidArgumentException when the service doesn't exist
62
- */
63
- private static function verifyServicesToKeep(
64
- $serviceDir,
65
- array $servicesToKeep
66
- ) {
67
- $finder = (new Finder())
68
- ->directories()
69
- ->depth('== 0');
70
-
71
- foreach ($servicesToKeep as $service) {
72
- if (!preg_match('/^[a-zA-Z0-9]*$/', $service)) {
73
- throw new \InvalidArgumentException(
74
- sprintf(
75
- 'Invalid Google service name "%s"',
76
- $service
77
- )
78
- );
79
- }
80
- try {
81
- $finder->in($serviceDir . '/' . $service);
82
- } catch (\InvalidArgumentException $e) {
83
- throw new \InvalidArgumentException(
84
- sprintf(
85
- 'Google service "%s" does not exist or was removed previously',
86
- $service
87
- )
88
- );
89
- }
90
- }
91
- }
92
-
93
- private static function getServicesToRemove(
94
- $serviceDir,
95
- array $servicesToKeep
96
- ) {
97
- // find all files in the current directory
98
- return (new Finder())
99
- ->directories()
100
- ->depth('== 0')
101
- ->in($serviceDir)
102
- ->exclude($servicesToKeep);
103
- }
104
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Task/Exception.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2014 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- class Google_Task_Exception extends Google_Exception
19
- {
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Task/Retryable.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2014 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- /**
19
- * Interface for checking how many times a given task can be retried following
20
- * a failure.
21
- */
22
- interface Google_Task_Retryable
23
- {
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Task/Runner.php DELETED
@@ -1,281 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2014 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- /**
19
- * A task runner with exponential backoff support.
20
- *
21
- * @see https://developers.google.com/drive/web/handle-errors#implementing_exponential_backoff
22
- */
23
- class Google_Task_Runner
24
- {
25
- const TASK_RETRY_NEVER = 0;
26
- const TASK_RETRY_ONCE = 1;
27
- const TASK_RETRY_ALWAYS = -1;
28
-
29
- /**
30
- * @var integer $maxDelay The max time (in seconds) to wait before a retry.
31
- */
32
- private $maxDelay = 60;
33
- /**
34
- * @var integer $delay The previous delay from which the next is calculated.
35
- */
36
- private $delay = 1;
37
-
38
- /**
39
- * @var integer $factor The base number for the exponential back off.
40
- */
41
- private $factor = 2;
42
- /**
43
- * @var float $jitter A random number between -$jitter and $jitter will be
44
- * added to $factor on each iteration to allow for a better distribution of
45
- * retries.
46
- */
47
- private $jitter = 0.5;
48
-
49
- /**
50
- * @var integer $attempts The number of attempts that have been tried so far.
51
- */
52
- private $attempts = 0;
53
- /**
54
- * @var integer $maxAttempts The max number of attempts allowed.
55
- */
56
- private $maxAttempts = 1;
57
-
58
- /**
59
- * @var callable $action The task to run and possibly retry.
60
- */
61
- private $action;
62
- /**
63
- * @var array $arguments The task arguments.
64
- */
65
- private $arguments;
66
-
67
- /**
68
- * @var array $retryMap Map of errors with retry counts.
69
- */
70
- protected $retryMap = [
71
- '500' => self::TASK_RETRY_ALWAYS,
72
- '503' => self::TASK_RETRY_ALWAYS,
73
- 'rateLimitExceeded' => self::TASK_RETRY_ALWAYS,
74
- 'userRateLimitExceeded' => self::TASK_RETRY_ALWAYS,
75
- 6 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_RESOLVE_HOST
76
- 7 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_CONNECT
77
- 28 => self::TASK_RETRY_ALWAYS, // CURLE_OPERATION_TIMEOUTED
78
- 35 => self::TASK_RETRY_ALWAYS, // CURLE_SSL_CONNECT_ERROR
79
- 52 => self::TASK_RETRY_ALWAYS // CURLE_GOT_NOTHING
80
- ];
81
-
82
- /**
83
- * Creates a new task runner with exponential backoff support.
84
- *
85
- * @param array $config The task runner config
86
- * @param string $name The name of the current task (used for logging)
87
- * @param callable $action The task to run and possibly retry
88
- * @param array $arguments The task arguments
89
- * @throws Google_Task_Exception when misconfigured
90
- */
91
- public function __construct(
92
- $config,
93
- $name,
94
- $action,
95
- array $arguments = array()
96
- ) {
97
- if (isset($config['initial_delay'])) {
98
- if ($config['initial_delay'] < 0) {
99
- throw new Google_Task_Exception(
100
- 'Task configuration `initial_delay` must not be negative.'
101
- );
102
- }
103
-
104
- $this->delay = $config['initial_delay'];
105
- }
106
-
107
- if (isset($config['max_delay'])) {
108
- if ($config['max_delay'] <= 0) {
109
- throw new Google_Task_Exception(
110
- 'Task configuration `max_delay` must be greater than 0.'
111
- );
112
- }
113
-
114
- $this->maxDelay = $config['max_delay'];
115
- }
116
-
117
- if (isset($config['factor'])) {
118
- if ($config['factor'] <= 0) {
119
- throw new Google_Task_Exception(
120
- 'Task configuration `factor` must be greater than 0.'
121
- );
122
- }
123
-
124
- $this->factor = $config['factor'];
125
- }
126
-
127
- if (isset($config['jitter'])) {
128
- if ($config['jitter'] <= 0) {
129
- throw new Google_Task_Exception(
130
- 'Task configuration `jitter` must be greater than 0.'
131
- );
132
- }
133
-
134
- $this->jitter = $config['jitter'];
135
- }
136
-
137
- if (isset($config['retries'])) {
138
- if ($config['retries'] < 0) {
139
- throw new Google_Task_Exception(
140
- 'Task configuration `retries` must not be negative.'
141
- );
142
- }
143
- $this->maxAttempts += $config['retries'];
144
- }
145
-
146
- if (!is_callable($action)) {
147
- throw new Google_Task_Exception(
148
- 'Task argument `$action` must be a valid callable.'
149
- );
150
- }
151
-
152
- $this->action = $action;
153
- $this->arguments = $arguments;
154
- }
155
-
156
- /**
157
- * Checks if a retry can be attempted.
158
- *
159
- * @return boolean
160
- */
161
- public function canAttempt()
162
- {
163
- return $this->attempts < $this->maxAttempts;
164
- }
165
-
166
- /**
167
- * Runs the task and (if applicable) automatically retries when errors occur.
168
- *
169
- * @return mixed
170
- * @throws Google_Task_Retryable on failure when no retries are available.
171
- */
172
- public function run()
173
- {
174
- while ($this->attempt()) {
175
- try {
176
- return call_user_func_array($this->action, $this->arguments);
177
- } catch (Google_Service_Exception $exception) {
178
- $allowedRetries = $this->allowedRetries(
179
- $exception->getCode(),
180
- $exception->getErrors()
181
- );
182
-
183
- if (!$this->canAttempt() || !$allowedRetries) {
184
- throw $exception;
185
- }
186
-
187
- if ($allowedRetries > 0) {
188
- $this->maxAttempts = min(
189
- $this->maxAttempts,
190
- $this->attempts + $allowedRetries
191
- );
192
- }
193
- }
194
- }
195
- }
196
-
197
- /**
198
- * Runs a task once, if possible. This is useful for bypassing the `run()`
199
- * loop.
200
- *
201
- * NOTE: If this is not the first attempt, this function will sleep in
202
- * accordance to the backoff configurations before running the task.
203
- *
204
- * @return boolean
205
- */
206
- public function attempt()
207
- {
208
- if (!$this->canAttempt()) {
209
- return false;
210
- }
211
-
212
- if ($this->attempts > 0) {
213
- $this->backOff();
214
- }
215
-
216
- $this->attempts++;
217
- return true;
218
- }
219
-
220
- /**
221
- * Sleeps in accordance to the backoff configurations.
222
- */
223
- private function backOff()
224
- {
225
- $delay = $this->getDelay();
226
-
227
- usleep($delay * 1000000);
228
- }
229
-
230
- /**
231
- * Gets the delay (in seconds) for the current backoff period.
232
- *
233
- * @return float
234
- */
235
- private function getDelay()
236
- {
237
- $jitter = $this->getJitter();
238
- $factor = $this->attempts > 1 ? $this->factor + $jitter : 1 + abs($jitter);
239
-
240
- return $this->delay = min($this->maxDelay, $this->delay * $factor);
241
- }
242
-
243
- /**
244
- * Gets the current jitter (random number between -$this->jitter and
245
- * $this->jitter).
246
- *
247
- * @return float
248
- */
249
- private function getJitter()
250
- {
251
- return $this->jitter * 2 * mt_rand() / mt_getrandmax() - $this->jitter;
252
- }
253
-
254
- /**
255
- * Gets the number of times the associated task can be retried.
256
- *
257
- * NOTE: -1 is returned if the task can be retried indefinitely
258
- *
259
- * @return integer
260
- */
261
- public function allowedRetries($code, $errors = array())
262
- {
263
- if (isset($this->retryMap[$code])) {
264
- return $this->retryMap[$code];
265
- }
266
-
267
- if (
268
- !empty($errors) &&
269
- isset($errors[0]['reason'], $this->retryMap[$errors[0]['reason']])
270
- ) {
271
- return $this->retryMap[$errors[0]['reason']];
272
- }
273
-
274
- return 0;
275
- }
276
-
277
- public function setRetryMap($retryMap)
278
- {
279
- $this->retryMap = $retryMap;
280
- }
281
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/Utils/UriTemplate.php DELETED
@@ -1,333 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2013 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- /**
19
- * Implementation of levels 1-3 of the URI Template spec.
20
- * @see http://tools.ietf.org/html/rfc6570
21
- */
22
- class Google_Utils_UriTemplate
23
- {
24
- const TYPE_MAP = "1";
25
- const TYPE_LIST = "2";
26
- const TYPE_SCALAR = "4";
27
-
28
- /**
29
- * @var $operators array
30
- * These are valid at the start of a template block to
31
- * modify the way in which the variables inside are
32
- * processed.
33
- */
34
- private $operators = array(
35
- "+" => "reserved",
36
- "/" => "segments",
37
- "." => "dotprefix",
38
- "#" => "fragment",
39
- ";" => "semicolon",
40
- "?" => "form",
41
- "&" => "continuation"
42
- );
43
-
44
- /**
45
- * @var reserved array
46
- * These are the characters which should not be URL encoded in reserved
47
- * strings.
48
- */
49
- private $reserved = array(
50
- "=", ",", "!", "@", "|", ":", "/", "?", "#",
51
- "[", "]",'$', "&", "'", "(", ")", "*", "+", ";"
52
- );
53
- private $reservedEncoded = array(
54
- "%3D", "%2C", "%21", "%40", "%7C", "%3A", "%2F", "%3F",
55
- "%23", "%5B", "%5D", "%24", "%26", "%27", "%28", "%29",
56
- "%2A", "%2B", "%3B"
57
- );
58
-
59
- public function parse($string, array $parameters)
60
- {
61
- return $this->resolveNextSection($string, $parameters);
62
- }
63
-
64
- /**
65
- * This function finds the first matching {...} block and
66
- * executes the replacement. It then calls itself to find
67
- * subsequent blocks, if any.
68
- */
69
- private function resolveNextSection($string, $parameters)
70
- {
71
- $start = strpos($string, "{");
72
- if ($start === false) {
73
- return $string;
74
- }
75
- $end = strpos($string, "}");
76
- if ($end === false) {
77
- return $string;
78
- }
79
- $string = $this->replace($string, $start, $end, $parameters);
80
- return $this->resolveNextSection($string, $parameters);
81
- }
82
-
83
- private function replace($string, $start, $end, $parameters)
84
- {
85
- // We know a data block will have {} round it, so we can strip that.
86
- $data = substr($string, $start + 1, $end - $start - 1);
87
-
88
- // If the first character is one of the reserved operators, it effects
89
- // the processing of the stream.
90
- if (isset($this->operators[$data[0]])) {
91
- $op = $this->operators[$data[0]];
92
- $data = substr($data, 1);
93
- $prefix = "";
94
- $prefix_on_missing = false;
95
-
96
- switch ($op) {
97
- case "reserved":
98
- // Reserved means certain characters should not be URL encoded
99
- $data = $this->replaceVars($data, $parameters, ",", null, true);
100
- break;
101
- case "fragment":
102
- // Comma separated with fragment prefix. Bare values only.
103
- $prefix = "#";
104
- $prefix_on_missing = true;
105
- $data = $this->replaceVars($data, $parameters, ",", null, true);
106
- break;
107
- case "segments":
108
- // Slash separated data. Bare values only.
109
- $prefix = "/";
110
- $data =$this->replaceVars($data, $parameters, "/");
111
- break;
112
- case "dotprefix":
113
- // Dot separated data. Bare values only.
114
- $prefix = ".";
115
- $prefix_on_missing = true;
116
- $data = $this->replaceVars($data, $parameters, ".");
117
- break;
118
- case "semicolon":
119
- // Semicolon prefixed and separated. Uses the key name
120
- $prefix = ";";
121
- $data = $this->replaceVars($data, $parameters, ";", "=", false, true, false);
122
- break;
123
- case "form":
124
- // Standard URL format. Uses the key name
125
- $prefix = "?";
126
- $data = $this->replaceVars($data, $parameters, "&", "=");
127
- break;
128
- case "continuation":
129
- // Standard URL, but with leading ampersand. Uses key name.
130
- $prefix = "&";
131
- $data = $this->replaceVars($data, $parameters, "&", "=");
132
- break;
133
- }
134
-
135
- // Add the initial prefix character if data is valid.
136
- if ($data || ($data !== false && $prefix_on_missing)) {
137
- $data = $prefix . $data;
138
- }
139
-
140
- } else {
141
- // If no operator we replace with the defaults.
142
- $data = $this->replaceVars($data, $parameters);
143
- }
144
- // This is chops out the {...} and replaces with the new section.
145
- return substr($string, 0, $start) . $data . substr($string, $end + 1);
146
- }
147
-
148
- private function replaceVars(
149
- $section,
150
- $parameters,
151
- $sep = ",",
152
- $combine = null,
153
- $reserved = false,
154
- $tag_empty = false,
155
- $combine_on_empty = true
156
- ) {
157
- if (strpos($section, ",") === false) {
158
- // If we only have a single value, we can immediately process.
159
- return $this->combine(
160
- $section,
161
- $parameters,
162
- $sep,
163
- $combine,
164
- $reserved,
165
- $tag_empty,
166
- $combine_on_empty
167
- );
168
- } else {
169
- // If we have multiple values, we need to split and loop over them.
170
- // Each is treated individually, then glued together with the
171
- // separator character.
172
- $vars = explode(",", $section);
173
- return $this->combineList(
174
- $vars,
175
- $sep,
176
- $parameters,
177
- $combine,
178
- $reserved,
179
- false, // Never emit empty strings in multi-param replacements
180
- $combine_on_empty
181
- );
182
- }
183
- }
184
-
185
- public function combine(
186
- $key,
187
- $parameters,
188
- $sep,
189
- $combine,
190
- $reserved,
191
- $tag_empty,
192
- $combine_on_empty
193
- ) {
194
- $length = false;
195
- $explode = false;
196
- $skip_final_combine = false;
197
- $value = false;
198
-
199
- // Check for length restriction.
200
- if (strpos($key, ":") !== false) {
201
- list($key, $length) = explode(":", $key);
202
- }
203
-
204
- // Check for explode parameter.
205
- if ($key[strlen($key) - 1] == "*") {
206
- $explode = true;
207
- $key = substr($key, 0, -1);
208
- $skip_final_combine = true;
209
- }
210
-
211
- // Define the list separator.
212
- $list_sep = $explode ? $sep : ",";
213
-
214
- if (isset($parameters[$key])) {
215
- $data_type = $this->getDataType($parameters[$key]);
216
- switch ($data_type) {
217
- case self::TYPE_SCALAR:
218
- $value = $this->getValue($parameters[$key], $length);
219
- break;
220
- case self::TYPE_LIST:
221
- $values = array();
222
- foreach ($parameters[$key] as $pkey => $pvalue) {
223
- $pvalue = $this->getValue($pvalue, $length);
224
- if ($combine && $explode) {
225
- $values[$pkey] = $key . $combine . $pvalue;
226
- } else {
227
- $values[$pkey] = $pvalue;
228
- }
229
- }
230
- $value = implode($list_sep, $values);
231
- if ($value == '') {
232
- return '';
233
- }
234
- break;
235
- case self::TYPE_MAP:
236
- $values = array();
237
- foreach ($parameters[$key] as $pkey => $pvalue) {
238
- $pvalue = $this->getValue($pvalue, $length);
239
- if ($explode) {
240
- $pkey = $this->getValue($pkey, $length);
241
- $values[] = $pkey . "=" . $pvalue; // Explode triggers = combine.
242
- } else {
243
- $values[] = $pkey;
244
- $values[] = $pvalue;
245
- }
246
- }
247
- $value = implode($list_sep, $values);
248
- if ($value == '') {
249
- return false;
250
- }
251
- break;
252
- }
253
- } else if ($tag_empty) {
254
- // If we are just indicating empty values with their key name, return that.
255
- return $key;
256
- } else {
257
- // Otherwise we can skip this variable due to not being defined.
258
- return false;
259
- }
260
-
261
- if ($reserved) {
262
- $value = str_replace($this->reservedEncoded, $this->reserved, $value);
263
- }
264
-
265
- // If we do not need to include the key name, we just return the raw
266
- // value.
267
- if (!$combine || $skip_final_combine) {
268
- return $value;
269
- }
270
-
271
- // Else we combine the key name: foo=bar, if value is not the empty string.
272
- return $key . ($value != '' || $combine_on_empty ? $combine . $value : '');
273
- }
274
-
275
- /**
276
- * Return the type of a passed in value
277
- */
278
- private function getDataType($data)
279
- {
280
- if (is_array($data)) {
281
- reset($data);
282
- if (key($data) !== 0) {
283
- return self::TYPE_MAP;
284
- }
285
- return self::TYPE_LIST;
286
- }
287
- return self::TYPE_SCALAR;
288
- }
289
-
290
- /**
291
- * Utility function that merges multiple combine calls
292
- * for multi-key templates.
293
- */
294
- private function combineList(
295
- $vars,
296
- $sep,
297
- $parameters,
298
- $combine,
299
- $reserved,
300
- $tag_empty,
301
- $combine_on_empty
302
- ) {
303
- $ret = array();
304
- foreach ($vars as $var) {
305
- $response = $this->combine(
306
- $var,
307
- $parameters,
308
- $sep,
309
- $combine,
310
- $reserved,
311
- $tag_empty,
312
- $combine_on_empty
313
- );
314
- if ($response === false) {
315
- continue;
316
- }
317
- $ret[] = $response;
318
- }
319
- return implode($sep, $ret);
320
- }
321
-
322
- /**
323
- * Utility function to encode and trim values
324
- */
325
- private function getValue($value, $length)
326
- {
327
- if ($length) {
328
- $value = substr($value, 0, $length);
329
- }
330
- $value = rawurlencode($value);
331
- return $value;
332
- }
333
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/apiclient/src/Google/autoload.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * THIS FILE IS FOR BACKWARDS COMPATIBLITY ONLY
5
- *
6
- * If you were not already including this file in your project, please ignore it
7
- */
8
-
9
- $file = __DIR__ . '/../../vendor/autoload.php';
10
-
11
- if (!file_exists($file)) {
12
- $exception = 'This library must be installed via composer or by downloading the full package.';
13
- $exception .= ' See the instructions at https://github.com/google/google-api-php-client#installation.';
14
- throw new Exception($exception);
15
- }
16
-
17
- $error = 'google-api-php-client\'s autoloader was moved to vendor/autoload.php in 2.0.0. This ';
18
- $error .= 'redirect will be removed in 2.1. Please adjust your code to use the new location.';
19
- trigger_error($error, E_USER_DEPRECATED);
20
-
21
- require_once $file;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/CHANGELOG.md DELETED
@@ -1,167 +0,0 @@
1
- ## 1.13.0 (9/18/2020)
2
-
3
- * [feat]: Add service account identity support to GCECredentials (#304)
4
-
5
- ## 1.12.0 (8/31/2020)
6
-
7
- * [feat]: Add QuotaProject option to getMiddleware (#296)
8
- * [feat]: Add caching for calls to GCECredentials::onGce (#301)
9
- * [feat]: Add updateMetadata function to token cache (#298)
10
- * [fix]: Use quota_project_id instead of quota_project (#299)
11
-
12
- ## 1.11.1 (7/27/2020)
13
-
14
- * [fix]: catch ConnectException in GCE check (#294)
15
- * [docs]: Adds [reference docs](https://googleapis.github.io/google-auth-library-php/master)
16
-
17
- ## 1.11.0 (7/22/2020)
18
-
19
- * [feat]: Check cache expiration (#291)
20
- * [fix]: OAuth2 cache key when audience is set (#291)
21
-
22
- ## 1.10.0 (7/8/2020)
23
-
24
- * [feat]: Add support for Guzzle 7 (#256)
25
- * [fix]: Remove SDK warning (#283)
26
- * [chore]: Switch to github pages deploy action (#284)
27
-
28
- ## 1.9.0 (5/14/2020)
29
-
30
- * [feat] Add quotaProject param for extensible client options support (#277)
31
- * [feat] Add signingKeyId param for jwt signing (#270)
32
- * [docs] Misc documentation improvements (#268, #278, #273)
33
- * [chore] Switch from Travis to Github Actions (#273)
34
-
35
- ## 1.8.0 (3/26/2020)
36
-
37
- * [feat] Add option to throw exception in AccessToken::verify(). (#265)
38
- * [feat] Add support for x-goog-user-project. (#254)
39
- * [feat] Add option to specify issuer in AccessToken::verify(). (#267)
40
- * [feat] Add getProjectId to credentials types where project IDs can be determined. (#230)
41
-
42
- ## 1.7.1 (02/12/2020)
43
-
44
- * [fix] Invalid character in iap cert cache key (#263)
45
- * [fix] Typo in exception for package name (#262)
46
-
47
- ## 1.7.0 (02/11/2020)
48
-
49
- * [feat] Add ID token to auth token methods. (#248)
50
- * [feat] Add support for ES256 in `AccessToken::verify`. (#255)
51
- * [fix] Let namespace match the file structure. (#258)
52
- * [fix] Construct RuntimeException. (#257)
53
- * [tests] Update tests for PHP 7.4 compatibility. (#253)
54
- * [chore] Add a couple more things to `.gitattributes`. (#252)
55
-
56
- ## 1.6.1 (10/29/2019)
57
-
58
- * [fix] Handle DST correctly for cache item expirations. (#246)
59
-
60
- ## 1.6.0 (10/01/2019)
61
-
62
- * [feat] Add utility for verifying and revoking access tokens. (#243)
63
- * [docs] Fix README console terminology. (#242)
64
- * [feat] Support custom scopes with GCECredentials. (#239)
65
- * [fix] Fix phpseclib existence check. (#237)
66
-
67
- ## 1.5.2 (07/22/2019)
68
-
69
- * [fix] Move loadItems call out of `SysVCacheItemPool` constructor. (#229)
70
- * [fix] Add `Metadata-Flavor` header to initial GCE metadata call. (#232)
71
-
72
- ## 1.5.1 (04/16/2019)
73
-
74
- * [fix] Moved `getClientName()` from `Google\Auth\FetchAuthTokenInterface`
75
- to `Google\Auth\SignBlobInterface`, and removed `getClientName()` from
76
- `InsecureCredentials` and `UserRefreshCredentials`. (#223)
77
-
78
- ## 1.5.0 (04/15/2019)
79
-
80
- ### Changes
81
-
82
- * Add support for signing strings with a Credentials instance. (#221)
83
- * [Docs] Describe the arrays returned by fetchAuthToken. (#216)
84
- * [Testing] Fix failing tests (#217)
85
- * Update GitHub issue templates (#214, #213)
86
-
87
- ## 1.4.0 (09/17/2018)
88
-
89
- ### Changes
90
-
91
- * Add support for insecure credentials (#208)
92
-
93
- ## 1.3.3 (08/27/2018)
94
-
95
- ### Changes
96
-
97
- * Add retry and increase timeout for GCE credentials (#195)
98
- * [Docs] Fix spelling (#204)
99
- * Update token url (#206)
100
-
101
- ## 1.3.2 (07/23/2018)
102
-
103
- ### Changes
104
-
105
- * Only emits a warning for gcloud credentials (#202)
106
-
107
- ## 1.3.1 (07/19/2018)
108
-
109
- ### Changes
110
-
111
- * Added a warning for 3 legged OAuth credentials (#199)
112
- * [Code cleanup] Removed useless else after return (#193)
113
-
114
- ## 1.3.0 (06/04/2018)
115
-
116
- ### Changes
117
-
118
- * Fixes usage of deprecated env var for GAE Flex (#189)
119
- * fix - guzzlehttp/psr7 dependency version definition (#190)
120
- * Added SystemV shared memory based CacheItemPool (#191)
121
-
122
- ## 1.2.1 (24/01/2018)
123
-
124
- ### Changes
125
-
126
- * Fixes array merging bug in Guzzle5HttpHandler (#186)
127
- * Fixes constructor argument bug in Subscriber & Middleware (#184)
128
-
129
- ## 1.2.0 (6/12/2017)
130
-
131
- ### Changes
132
-
133
- * Adds async method to HTTP handlers (#176)
134
- * Misc bug fixes and improvements (#177, #175, #178)
135
-
136
- ## 1.1.0 (10/10/2017)
137
-
138
- ### Changes
139
-
140
- * Supports additional claims in JWT tokens (#171)
141
- * Adds makeHttpClient for creating authorized Guzzle clients (#162)
142
- * Misc bug fixes/improvements (#168, #161, #167, #170, #143)
143
-
144
- ## 1.0.1 (31/07/2017)
145
-
146
- ### Changes
147
-
148
- * Adds support for Firebase 5.0 (#159)
149
-
150
- ## 1.0.0 (12/06/2017)
151
-
152
- ### Changes
153
-
154
- * Adds hashing and shortening to enforce max key length ([@bshaffer])
155
- * Fix for better PSR-6 compliance - verifies a hit before getting the cache item ([@bshaffer])
156
- * README fixes ([@bshaffer])
157
- * Change authorization header key to lowercase ([@stanley-cheung])
158
-
159
- ## 0.4.0 (23/04/2015)
160
-
161
- ### Changes
162
-
163
- * Export callback function to update auth metadata ([@stanley-cheung][])
164
- * Adds an implementation of User Refresh Token auth ([@stanley-cheung][])
165
-
166
- [@bshaffer]: https://github.com/bshaffer
167
- [@stanley-cheung]: https://github.com/stanley-cheung
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/CODE_OF_CONDUCT.md DELETED
@@ -1,43 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project,
4
- and in the interest of fostering an open and welcoming community,
5
- we pledge to respect all people who contribute through reporting issues,
6
- posting feature requests, updating documentation,
7
- submitting pull requests or patches, and other activities.
8
-
9
- We are committed to making participation in this project
10
- a harassment-free experience for everyone,
11
- regardless of level of experience, gender, gender identity and expression,
12
- sexual orientation, disability, personal appearance,
13
- body size, race, ethnicity, age, religion, or nationality.
14
-
15
- Examples of unacceptable behavior by participants include:
16
-
17
- * The use of sexualized language or imagery
18
- * Personal attacks
19
- * Trolling or insulting/derogatory comments
20
- * Public or private harassment
21
- * Publishing other's private information,
22
- such as physical or electronic
23
- addresses, without explicit permission
24
- * Other unethical or unprofessional conduct.
25
-
26
- Project maintainers have the right and responsibility to remove, edit, or reject
27
- comments, commits, code, wiki edits, issues, and other contributions
28
- that are not aligned to this Code of Conduct.
29
- By adopting this Code of Conduct,
30
- project maintainers commit themselves to fairly and consistently
31
- applying these principles to every aspect of managing this project.
32
- Project maintainers who do not follow or enforce the Code of Conduct
33
- may be permanently removed from the project team.
34
-
35
- This code of conduct applies both within project spaces and in public spaces
36
- when an individual is representing the project or its community.
37
-
38
- Instances of abusive, harassing, or otherwise unacceptable behavior
39
- may be reported by opening an issue
40
- or contacting one or more of the project maintainers.
41
-
42
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
43
- available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/COPYING DELETED
@@ -1,202 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright 2015 Google Inc.
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/LICENSE DELETED
@@ -1,203 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
202
-
203
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/README.md DELETED
@@ -1,227 +0,0 @@
1
- # Google Auth Library for PHP
2
-
3
- <dl>
4
- <dt>Homepage</dt><dd><a href="http://www.github.com/google/google-auth-library-php">http://www.github.com/google/google-auth-library-php</a></dd>
5
- <dt>Reference Docs</dt><dd><a href="https://googleapis.github.io/google-auth-library-php/master/">https://googleapis.github.io/google-auth-library-php/master/</a></dd>
6
- <dt>Authors</dt>
7
- <dd><a href="mailto:temiola@google.com">Tim Emiola</a></dd>
8
- <dd><a href="mailto:stanleycheung@google.com">Stanley Cheung</a></dd>
9
- <dd><a href="mailto:betterbrent@google.com">Brent Shaffer</a></dd>
10
- <dt>Copyright</dt><dd>Copyright © 2015 Google, Inc.</dd>
11
- <dt>License</dt><dd>Apache 2.0</dd>
12
- </dl>
13
-
14
- ## Description
15
-
16
- This is Google's officially supported PHP client library for using OAuth 2.0
17
- authorization and authentication with Google APIs.
18
-
19
- ### Installing via Composer
20
-
21
- The recommended way to install the google auth library is through
22
- [Composer](http://getcomposer.org).
23
-
24
- ```bash
25
- # Install Composer
26
- curl -sS https://getcomposer.org/installer | php
27
- ```
28
-
29
- Next, run the Composer command to install the latest stable version:
30
-
31
- ```bash
32
- composer.phar require google/auth
33
- ```
34
-
35
- ## Application Default Credentials
36
-
37
- This library provides an implementation of
38
- [application default credentials][application default credentials] for PHP.
39
-
40
- The Application Default Credentials provide a simple way to get authorization
41
- credentials for use in calling Google APIs.
42
-
43
- They are best suited for cases when the call needs to have the same identity
44
- and authorization level for the application independent of the user. This is
45
- the recommended approach to authorize calls to Cloud APIs, particularly when
46
- you're building an application that uses Google Compute Engine.
47
-
48
- #### Download your Service Account Credentials JSON file
49
-
50
- To use `Application Default Credentials`, You first need to download a set of
51
- JSON credentials for your project. Go to **APIs & Services** > **Credentials** in
52
- the [Google Developers Console][developer console] and select
53
- **Service account** from the **Add credentials** dropdown.
54
-
55
- > This file is your *only copy* of these credentials. It should never be
56
- > committed with your source code, and should be stored securely.
57
-
58
- Once downloaded, store the path to this file in the
59
- `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
60
-
61
- ```php
62
- putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json');
63
- ```
64
-
65
- > PHP's `putenv` function is just one way to set an environment variable.
66
- > Consider using `.htaccess` or apache configuration files as well.
67
-
68
- #### Enable the API you want to use
69
-
70
- Before making your API call, you must be sure the API you're calling has been
71
- enabled. Go to **APIs & Auth** > **APIs** in the
72
- [Google Developers Console][developer console] and enable the APIs you'd like to
73
- call. For the example below, you must enable the `Drive API`.
74
-
75
- #### Call the APIs
76
-
77
- As long as you update the environment variable below to point to *your* JSON
78
- credentials file, the following code should output a list of your Drive files.
79
-
80
- ```php
81
- use Google\Auth\ApplicationDefaultCredentials;
82
- use GuzzleHttp\Client;
83
- use GuzzleHttp\HandlerStack;
84
-
85
- // specify the path to your application credentials
86
- putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json');
87
-
88
- // define the scopes for your API call
89
- $scopes = ['https://www.googleapis.com/auth/drive.readonly'];
90
-
91
- // create middleware
92
- $middleware = ApplicationDefaultCredentials::getMiddleware($scopes);
93
- $stack = HandlerStack::create();
94
- $stack->push($middleware);
95
-
96
- // create the HTTP client
97
- $client = new Client([
98
- 'handler' => $stack,
99
- 'base_uri' => 'https://www.googleapis.com',
100
- 'auth' => 'google_auth' // authorize all requests
101
- ]);
102
-
103
- // make the request
104
- $response = $client->get('drive/v2/files');
105
-
106
- // show the result!
107
- print_r((string) $response->getBody());
108
- ```
109
-
110
- ##### Guzzle 5 Compatibility
111
-
112
- If you are using [Guzzle 5][Guzzle 5], replace the `create middleware` and
113
- `create the HTTP Client` steps with the following:
114
-
115
- ```php
116
- // create the HTTP client
117
- $client = new Client([
118
- 'base_url' => 'https://www.googleapis.com',
119
- 'auth' => 'google_auth' // authorize all requests
120
- ]);
121
-
122
- // create subscriber
123
- $subscriber = ApplicationDefaultCredentials::getSubscriber($scopes);
124
- $client->getEmitter()->attach($subscriber);
125
- ```
126
-
127
- #### Call using an ID Token
128
- If your application is running behind Cloud Run, or using Cloud Identity-Aware
129
- Proxy (IAP), you will need to fetch an ID token to access your application. For
130
- this, use the static method `getIdTokenMiddleware` on
131
- `ApplicationDefaultCredentials`.
132
-
133
- ```php
134
- use Google\Auth\ApplicationDefaultCredentials;
135
- use GuzzleHttp\Client;
136
- use GuzzleHttp\HandlerStack;
137
-
138
- // specify the path to your application credentials
139
- putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json');
140
-
141
- // Provide the ID token audience. This can be a Client ID associated with an IAP application,
142
- // Or the URL associated with a CloudRun App
143
- // $targetAudience = 'IAP_CLIENT_ID.apps.googleusercontent.com';
144
- // $targetAudience = 'https://service-1234-uc.a.run.app';
145
- $targetAudience = 'YOUR_ID_TOKEN_AUDIENCE';
146
-
147
- // create middleware
148
- $middleware = ApplicationDefaultCredentials::getIdTokenMiddleware($targetAudience);
149
- $stack = HandlerStack::create();
150
- $stack->push($middleware);
151
-
152
- // create the HTTP client
153
- $client = new Client([
154
- 'handler' => $stack,
155
- 'auth' => 'google_auth',
156
- // Cloud Run, IAP, or custom resource URL
157
- 'base_uri' => 'https://YOUR_PROTECTED_RESOURCE',
158
- ]);
159
-
160
- // make the request
161
- $response = $client->get('/');
162
-
163
- // show the result!
164
- print_r((string) $response->getBody());
165
- ```
166
-
167
- For invoking Cloud Run services, your service account will need the
168
- [`Cloud Run Invoker`](https://cloud.google.com/run/docs/authenticating/service-to-service)
169
- IAM permission.
170
-
171
- For invoking Cloud Identity-Aware Proxy, you will need to pass the Client ID
172
- used when you set up your protected resource as the target audience. See how to
173
- [secure your IAP app with signed headers](https://cloud.google.com/iap/docs/signed-headers-howto).
174
-
175
- #### Verifying JWTs
176
-
177
- If you are [using Google ID tokens to authenticate users][google-id-tokens], use
178
- the `Google\Auth\AccessToken` class to verify the ID token:
179
-
180
- ```php
181
- use Google\Auth\AccessToken;
182
-
183
- $auth = new AccessToken();
184
- $auth->verify($idToken);
185
- ```
186
-
187
- If your app is running behind [Google Identity-Aware Proxy][iap-id-tokens]
188
- (IAP), you can verify the ID token coming from the IAP server by pointing to the
189
- appropriate certificate URL for IAP. This is because IAP signs the ID
190
- tokens with a different key than the Google Identity service:
191
-
192
- ```php
193
- use Google\Auth\AccessToken;
194
-
195
- $auth = new AccessToken();
196
- $auth->verify($idToken, [
197
- 'certsLocation' => AccessToken::IAP_CERT_URL
198
- ]);
199
- ```
200
-
201
- [google-id-tokens]: https://developers.google.com/identity/sign-in/web/backend-auth
202
- [iap-id-tokens]: https://cloud.google.com/iap/docs/signed-headers-howto
203
-
204
- ## License
205
-
206
- This library is licensed under Apache 2.0. Full license text is
207
- available in [COPYING][copying].
208
-
209
- ## Contributing
210
-
211
- See [CONTRIBUTING][contributing].
212
-
213
- ## Support
214
-
215
- Please
216
- [report bugs at the project on Github](https://github.com/google/google-auth-library-php/issues). Don't
217
- hesitate to
218
- [ask questions](http://stackoverflow.com/questions/tagged/google-auth-library-php)
219
- about the client or APIs on [StackOverflow](http://stackoverflow.com).
220
-
221
- [google-apis-php-client]: https://github.com/google/google-api-php-client
222
- [application default credentials]: https://developers.google.com/accounts/docs/application-default-credentials
223
- [contributing]: https://github.com/google/google-auth-library-php/tree/master/.github/CONTRIBUTING.md
224
- [copying]: https://github.com/google/google-auth-library-php/tree/master/COPYING
225
- [Guzzle]: https://github.com/guzzle/guzzle
226
- [Guzzle 5]: http://docs.guzzlephp.org/en/5.3
227
- [developer console]: https://console.developers.google.com
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/autoload.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2014 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- function oauth2client_php_autoload($className)
19
- {
20
- $classPath = explode('_', $className);
21
- if ($classPath[0] != 'Google') {
22
- return;
23
- }
24
- if (count($classPath) > 3) {
25
- // Maximum class file path depth in this project is 3.
26
- $classPath = array_slice($classPath, 0, 3);
27
- }
28
- $filePath = dirname(__FILE__) . '/src/' . implode('/', $classPath) . '.php';
29
- if (file_exists($filePath)) {
30
- require_once $filePath;
31
- }
32
- }
33
-
34
- spl_autoload_register('oauth2client_php_autoload');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/AccessToken.php DELETED
@@ -1,479 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2019 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- use DateTime;
21
- use Exception;
22
- use Firebase\JWT\ExpiredException;
23
- use Firebase\JWT\JWT;
24
- use Firebase\JWT\SignatureInvalidException;
25
- use Google\Auth\Cache\MemoryCacheItemPool;
26
- use Google\Auth\HttpHandler\HttpClientCache;
27
- use Google\Auth\HttpHandler\HttpHandlerFactory;
28
- use GuzzleHttp\Psr7;
29
- use GuzzleHttp\Psr7\Request;
30
- use InvalidArgumentException;
31
- use phpseclib\Crypt\RSA;
32
- use phpseclib\Math\BigInteger;
33
- use Psr\Cache\CacheItemPoolInterface;
34
- use RuntimeException;
35
- use SimpleJWT\InvalidTokenException;
36
- use SimpleJWT\JWT as SimpleJWT;
37
- use SimpleJWT\Keys\KeyFactory;
38
- use SimpleJWT\Keys\KeySet;
39
- use UnexpectedValueException;
40
-
41
- /**
42
- * Wrapper around Google Access Tokens which provides convenience functions.
43
- *
44
- * @experimental
45
- */
46
- class AccessToken
47
- {
48
- const FEDERATED_SIGNON_CERT_URL = 'https://www.googleapis.com/oauth2/v3/certs';
49
- const IAP_CERT_URL = 'https://www.gstatic.com/iap/verify/public_key-jwk';
50
- const IAP_ISSUER = 'https://cloud.google.com/iap';
51
- const OAUTH2_ISSUER = 'accounts.google.com';
52
- const OAUTH2_ISSUER_HTTPS = 'https://accounts.google.com';
53
- const OAUTH2_REVOKE_URI = 'https://oauth2.googleapis.com/revoke';
54
-
55
- /**
56
- * @var callable
57
- */
58
- private $httpHandler;
59
-
60
- /**
61
- * @var CacheItemPoolInterface
62
- */
63
- private $cache;
64
-
65
- /**
66
- * @param callable $httpHandler [optional] An HTTP Handler to deliver PSR-7 requests.
67
- * @param CacheItemPoolInterface $cache [optional] A PSR-6 compatible cache implementation.
68
- */
69
- public function __construct(
70
- callable $httpHandler = null,
71
- CacheItemPoolInterface $cache = null
72
- ) {
73
- $this->httpHandler = $httpHandler
74
- ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
75
- $this->cache = $cache ?: new MemoryCacheItemPool();
76
- }
77
-
78
- /**
79
- * Verifies an id token and returns the authenticated apiLoginTicket.
80
- * Throws an exception if the id token is not valid.
81
- * The audience parameter can be used to control which id tokens are
82
- * accepted. By default, the id token must have been issued to this OAuth2 client.
83
- *
84
- * @param string $token The JSON Web Token to be verified.
85
- * @param array $options [optional] Configuration options.
86
- * @param string $options.audience The indended recipient of the token.
87
- * @param string $options.issuer The intended issuer of the token.
88
- * @param string $options.cacheKey The cache key of the cached certs. Defaults to
89
- * the sha1 of $certsLocation if provided, otherwise is set to
90
- * "federated_signon_certs_v3".
91
- * @param string $options.certsLocation The location (remote or local) from which
92
- * to retrieve certificates, if not cached. This value should only be
93
- * provided in limited circumstances in which you are sure of the
94
- * behavior.
95
- * @param bool $options.throwException Whether the function should throw an
96
- * exception if the verification fails. This is useful for
97
- * determining the reason verification failed.
98
- * @return array|bool the token payload, if successful, or false if not.
99
- * @throws InvalidArgumentException If certs could not be retrieved from a local file.
100
- * @throws InvalidArgumentException If received certs are in an invalid format.
101
- * @throws InvalidArgumentException If the cert alg is not supported.
102
- * @throws RuntimeException If certs could not be retrieved from a remote location.
103
- * @throws UnexpectedValueException If the token issuer does not match.
104
- * @throws UnexpectedValueException If the token audience does not match.
105
- */
106
- public function verify($token, array $options = [])
107
- {
108
- $audience = isset($options['audience'])
109
- ? $options['audience']
110
- : null;
111
- $issuer = isset($options['issuer'])
112
- ? $options['issuer']
113
- : null;
114
- $certsLocation = isset($options['certsLocation'])
115
- ? $options['certsLocation']
116
- : self::FEDERATED_SIGNON_CERT_URL;
117
- $cacheKey = isset($options['cacheKey'])
118
- ? $options['cacheKey']
119
- : $this->getCacheKeyFromCertLocation($certsLocation);
120
- $throwException = isset($options['throwException'])
121
- ? $options['throwException']
122
- : false; // for backwards compatibility
123
-
124
- // Check signature against each available cert.
125
- $certs = $this->getCerts($certsLocation, $cacheKey, $options);
126
- $alg = $this->determineAlg($certs);
127
- if (!in_array($alg, ['RS256', 'ES256'])) {
128
- throw new InvalidArgumentException(
129
- 'unrecognized "alg" in certs, expected ES256 or RS256'
130
- );
131
- }
132
- try {
133
- if ($alg == 'RS256') {
134
- return $this->verifyRs256($token, $certs, $audience, $issuer);
135
- }
136
- return $this->verifyEs256($token, $certs, $audience, $issuer);
137
- } catch (ExpiredException $e) { // firebase/php-jwt 3+
138
- } catch (\ExpiredException $e) { // firebase/php-jwt 2
139
- } catch (SignatureInvalidException $e) { // firebase/php-jwt 3+
140
- } catch (\SignatureInvalidException $e) { // firebase/php-jwt 2
141
- } catch (InvalidTokenException $e) { // simplejwt
142
- } catch (DomainException $e) {
143
- } catch (InvalidArgumentException $e) {
144
- } catch (UnexpectedValueException $e) {
145
- }
146
-
147
- if ($throwException) {
148
- throw $e;
149
- }
150
-
151
- return false;
152
- }
153
-
154
- /**
155
- * Identifies the expected algorithm to verify by looking at the "alg" key
156
- * of the provided certs.
157
- *
158
- * @param array $certs Certificate array according to the JWK spec (see
159
- * https://tools.ietf.org/html/rfc7517).
160
- * @return string The expected algorithm, such as "ES256" or "RS256".
161
- */
162
- private function determineAlg(array $certs)
163
- {
164
- $alg = null;
165
- foreach ($certs as $cert) {
166
- if (empty($cert['alg'])) {
167
- throw new InvalidArgumentException(
168
- 'certs expects "alg" to be set'
169
- );
170
- }
171
- $alg = $alg ?: $cert['alg'];
172
-
173
- if ($alg != $cert['alg']) {
174
- throw new InvalidArgumentException(
175
- 'More than one alg detected in certs'
176
- );
177
- }
178
- }
179
- return $alg;
180
- }
181
-
182
- /**
183
- * Verifies an ES256-signed JWT.
184
- *
185
- * @param string $token The JSON Web Token to be verified.
186
- * @param array $certs Certificate array according to the JWK spec (see
187
- * https://tools.ietf.org/html/rfc7517).
188
- * @param string|null $audience If set, returns false if the provided
189
- * audience does not match the "aud" claim on the JWT.
190
- * @param string|null $issuer If set, returns false if the provided
191
- * issuer does not match the "iss" claim on the JWT.
192
- * @return array|bool the token payload, if successful, or false if not.
193
- */
194
- private function verifyEs256($token, array $certs, $audience = null, $issuer = null)
195
- {
196
- $this->checkSimpleJwt();
197
-
198
- $jwkset = new KeySet();
199
- foreach ($certs as $cert) {
200
- $jwkset->add(KeyFactory::create($cert, 'php'));
201
- }
202
-
203
- // Validate the signature using the key set and ES256 algorithm.
204
- $jwt = $this->callSimpleJwtDecode([$token, $jwkset, 'ES256']);
205
- $payload = $jwt->getClaims();
206
-
207
- if (isset($payload['aud'])) {
208
- if ($audience && $payload['aud'] != $audience) {
209
- throw new UnexpectedValueException('Audience does not match');
210
- }
211
- }
212
-
213
- // @see https://cloud.google.com/iap/docs/signed-headers-howto#verifying_the_jwt_payload
214
- $issuer = $issuer ?: self::IAP_ISSUER;
215
- if (!isset($payload['iss']) || $payload['iss'] !== $issuer) {
216
- throw new UnexpectedValueException('Issuer does not match');
217
- }
218
-
219
- return $payload;
220
- }
221
-
222
- /**
223
- * Verifies an RS256-signed JWT.
224
- *
225
- * @param string $token The JSON Web Token to be verified.
226
- * @param array $certs Certificate array according to the JWK spec (see
227
- * https://tools.ietf.org/html/rfc7517).
228
- * @param string|null $audience If set, returns false if the provided
229
- * audience does not match the "aud" claim on the JWT.
230
- * @param string|null $issuer If set, returns false if the provided
231
- * issuer does not match the "iss" claim on the JWT.
232
- * @return array|bool the token payload, if successful, or false if not.
233
- */
234
- private function verifyRs256($token, array $certs, $audience = null, $issuer = null)
235
- {
236
- $this->checkAndInitializePhpsec();
237
- $keys = [];
238
- foreach ($certs as $cert) {
239
- if (empty($cert['kid'])) {
240
- throw new InvalidArgumentException(
241
- 'certs expects "kid" to be set'
242
- );
243
- }
244
- if (empty($cert['n']) || empty($cert['e'])) {
245
- throw new InvalidArgumentException(
246
- 'RSA certs expects "n" and "e" to be set'
247
- );
248
- }
249
- $rsa = new RSA();
250
- $rsa->loadKey([
251
- 'n' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [
252
- $cert['n'],
253
- ]), 256),
254
- 'e' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [
255
- $cert['e']
256
- ]), 256),
257
- ]);
258
-
259
- // create an array of key IDs to certs for the JWT library
260
- $keys[$cert['kid']] = $rsa->getPublicKey();
261
- }
262
-
263
- $payload = $this->callJwtStatic('decode', [
264
- $token,
265
- $keys,
266
- ['RS256']
267
- ]);
268
-
269
- if (property_exists($payload, 'aud')) {
270
- if ($audience && $payload->aud != $audience) {
271
- throw new UnexpectedValueException('Audience does not match');
272
- }
273
- }
274
-
275
- // support HTTP and HTTPS issuers
276
- // @see https://developers.google.com/identity/sign-in/web/backend-auth
277
- $issuers = $issuer ? [$issuer] : [self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS];
278
- if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) {
279
- throw new UnexpectedValueException('Issuer does not match');
280
- }
281
-
282
- return (array) $payload;
283
- }
284
-
285
- /**
286
- * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
287
- * token, if a token isn't provided.
288
- *
289
- * @param string|array $token The token (access token or a refresh token) that should be revoked.
290
- * @param array $options [optional] Configuration options.
291
- * @return bool Returns True if the revocation was successful, otherwise False.
292
- */
293
- public function revoke($token, array $options = [])
294
- {
295
- if (is_array($token)) {
296
- if (isset($token['refresh_token'])) {
297
- $token = $token['refresh_token'];
298
- } else {
299
- $token = $token['access_token'];
300
- }
301
- }
302
-
303
- $body = Psr7\stream_for(http_build_query(['token' => $token]));
304
- $request = new Request('POST', self::OAUTH2_REVOKE_URI, [
305
- 'Cache-Control' => 'no-store',
306
- 'Content-Type' => 'application/x-www-form-urlencoded',
307
- ], $body);
308
-
309
- $httpHandler = $this->httpHandler;
310
-
311
- $response = $httpHandler($request, $options);
312
-
313
- return $response->getStatusCode() == 200;
314
- }
315
-
316
- /**
317
- * Gets federated sign-on certificates to use for verifying identity tokens.
318
- * Returns certs as array structure, where keys are key ids, and values
319
- * are PEM encoded certificates.
320
- *
321
- * @param string $location The location from which to retrieve certs.
322
- * @param string $cacheKey The key under which to cache the retrieved certs.
323
- * @param array $options [optional] Configuration options.
324
- * @return array
325
- * @throws InvalidArgumentException If received certs are in an invalid format.
326
- */
327
- private function getCerts($location, $cacheKey, array $options = [])
328
- {
329
- $cacheItem = $this->cache->getItem($cacheKey);
330
- $certs = $cacheItem ? $cacheItem->get() : null;
331
-
332
- $gotNewCerts = false;
333
- if (!$certs) {
334
- $certs = $this->retrieveCertsFromLocation($location, $options);
335
-
336
- $gotNewCerts = true;
337
- }
338
-
339
- if (!isset($certs['keys'])) {
340
- if ($location !== self::IAP_CERT_URL) {
341
- throw new InvalidArgumentException(
342
- 'federated sign-on certs expects "keys" to be set'
343
- );
344
- }
345
- throw new InvalidArgumentException(
346
- 'certs expects "keys" to be set'
347
- );
348
- }
349
-
350
- // Push caching off until after verifying certs are in a valid format.
351
- // Don't want to cache bad data.
352
- if ($gotNewCerts) {
353
- $cacheItem->expiresAt(new DateTime('+1 hour'));
354
- $cacheItem->set($certs);
355
- $this->cache->save($cacheItem);
356
- }
357
-
358
- return $certs['keys'];
359
- }
360
-
361
- /**
362
- * Retrieve and cache a certificates file.
363
- *
364
- * @param $url string location
365
- * @param array $options [optional] Configuration options.
366
- * @return array certificates
367
- * @throws InvalidArgumentException If certs could not be retrieved from a local file.
368
- * @throws RuntimeException If certs could not be retrieved from a remote location.
369
- */
370
- private function retrieveCertsFromLocation($url, array $options = [])
371
- {
372
- // If we're retrieving a local file, just grab it.
373
- if (strpos($url, 'http') !== 0) {
374
- if (!file_exists($url)) {
375
- throw new InvalidArgumentException(sprintf(
376
- 'Failed to retrieve verification certificates from path: %s.',
377
- $url
378
- ));
379
- }
380
-
381
- return json_decode(file_get_contents($url), true);
382
- }
383
-
384
- $httpHandler = $this->httpHandler;
385
- $response = $httpHandler(new Request('GET', $url), $options);
386
-
387
- if ($response->getStatusCode() == 200) {
388
- return json_decode((string) $response->getBody(), true);
389
- }
390
-
391
- throw new RuntimeException(sprintf(
392
- 'Failed to retrieve verification certificates: "%s".',
393
- $response->getBody()->getContents()
394
- ), $response->getStatusCode());
395
- }
396
-
397
- private function checkAndInitializePhpsec()
398
- {
399
- // @codeCoverageIgnoreStart
400
- if (!class_exists('phpseclib\Crypt\RSA')) {
401
- throw new RuntimeException('Please require phpseclib/phpseclib v2 to use this utility.');
402
- }
403
- // @codeCoverageIgnoreEnd
404
-
405
- $this->setPhpsecConstants();
406
- }
407
-
408
- private function checkSimpleJwt()
409
- {
410
- // @codeCoverageIgnoreStart
411
- if (!class_exists('SimpleJWT\JWT')) {
412
- throw new RuntimeException('Please require kelvinmo/simplejwt ^0.2 to use this utility.');
413
- }
414
- // @codeCoverageIgnoreEnd
415
- }
416
-
417
- /**
418
- * phpseclib calls "phpinfo" by default, which requires special
419
- * whitelisting in the AppEngine VM environment. This function
420
- * sets constants to bypass the need for phpseclib to check phpinfo
421
- *
422
- * @see phpseclib/Math/BigInteger
423
- * @see https://github.com/GoogleCloudPlatform/getting-started-php/issues/85
424
- * @codeCoverageIgnore
425
- */
426
- private function setPhpsecConstants()
427
- {
428
- if (filter_var(getenv('GAE_VM'), FILTER_VALIDATE_BOOLEAN)) {
429
- if (!defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
430
- define('MATH_BIGINTEGER_OPENSSL_ENABLED', true);
431
- }
432
- if (!defined('CRYPT_RSA_MODE')) {
433
- define('CRYPT_RSA_MODE', RSA::MODE_OPENSSL);
434
- }
435
- }
436
- }
437
-
438
- /**
439
- * Provide a hook to mock calls to the JWT static methods.
440
- *
441
- * @param string $method
442
- * @param array $args
443
- * @return mixed
444
- */
445
- protected function callJwtStatic($method, array $args = [])
446
- {
447
- $class = class_exists('Firebase\JWT\JWT')
448
- ? 'Firebase\JWT\JWT'
449
- : 'JWT';
450
- return call_user_func_array([$class, $method], $args);
451
- }
452
-
453
- /**
454
- * Provide a hook to mock calls to the JWT static methods.
455
- *
456
- * @param array $args
457
- * @return mixed
458
- */
459
- protected function callSimpleJwtDecode(array $args = [])
460
- {
461
- return call_user_func_array(['SimpleJWT\JWT', 'decode'], $args);
462
- }
463
-
464
- /**
465
- * Generate a cache key based on the cert location using sha1 with the
466
- * exception of using "federated_signon_certs_v3" to preserve BC.
467
- *
468
- * @param string $certsLocation
469
- * @return string
470
- */
471
- private function getCacheKeyFromCertLocation($certsLocation)
472
- {
473
- $key = $certsLocation === self::FEDERATED_SIGNON_CERT_URL
474
- ? 'federated_signon_certs_v3'
475
- : sha1($certsLocation);
476
-
477
- return 'google_auth_certs_cache|' . $key;
478
- }
479
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/ApplicationDefaultCredentials.php DELETED
@@ -1,299 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- use DomainException;
21
- use Google\Auth\Credentials\AppIdentityCredentials;
22
- use Google\Auth\Credentials\GCECredentials;
23
- use Google\Auth\Credentials\ServiceAccountCredentials;
24
- use Google\Auth\HttpHandler\HttpClientCache;
25
- use Google\Auth\HttpHandler\HttpHandlerFactory;
26
- use Google\Auth\Middleware\AuthTokenMiddleware;
27
- use Google\Auth\Subscriber\AuthTokenSubscriber;
28
- use GuzzleHttp\Client;
29
- use InvalidArgumentException;
30
- use Psr\Cache\CacheItemPoolInterface;
31
-
32
- /**
33
- * ApplicationDefaultCredentials obtains the default credentials for
34
- * authorizing a request to a Google service.
35
- *
36
- * Application Default Credentials are described here:
37
- * https://developers.google.com/accounts/docs/application-default-credentials
38
- *
39
- * This class implements the search for the application default credentials as
40
- * described in the link.
41
- *
42
- * It provides three factory methods:
43
- * - #get returns the computed credentials object
44
- * - #getSubscriber returns an AuthTokenSubscriber built from the credentials object
45
- * - #getMiddleware returns an AuthTokenMiddleware built from the credentials object
46
- *
47
- * This allows it to be used as follows with GuzzleHttp\Client:
48
- *
49
- * ```
50
- * use Google\Auth\ApplicationDefaultCredentials;
51
- * use GuzzleHttp\Client;
52
- * use GuzzleHttp\HandlerStack;
53
- *
54
- * $middleware = ApplicationDefaultCredentials::getMiddleware(
55
- * 'https://www.googleapis.com/auth/taskqueue'
56
- * );
57
- * $stack = HandlerStack::create();
58
- * $stack->push($middleware);
59
- *
60
- * $client = new Client([
61
- * 'handler' => $stack,
62
- * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
63
- * 'auth' => 'google_auth' // authorize all requests
64
- * ]);
65
- *
66
- * $res = $client->get('myproject/taskqueues/myqueue');
67
- * ```
68
- */
69
- class ApplicationDefaultCredentials
70
- {
71
- /**
72
- * Obtains an AuthTokenSubscriber that uses the default FetchAuthTokenInterface
73
- * implementation to use in this environment.
74
- *
75
- * If supplied, $scope is used to in creating the credentials instance if
76
- * this does not fallback to the compute engine defaults.
77
- *
78
- * @param string|array scope the scope of the access request, expressed
79
- * either as an Array or as a space-delimited String.
80
- * @param callable $httpHandler callback which delivers psr7 request
81
- * @param array $cacheConfig configuration for the cache when it's present
82
- * @param CacheItemPoolInterface $cache A cache implementation, may be
83
- * provided if you have one already available for use.
84
- * @return AuthTokenSubscriber
85
- * @throws DomainException if no implementation can be obtained.
86
- */
87
- public static function getSubscriber(
88
- $scope = null,
89
- callable $httpHandler = null,
90
- array $cacheConfig = null,
91
- CacheItemPoolInterface $cache = null
92
- ) {
93
- $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache);
94
-
95
- return new AuthTokenSubscriber($creds, $httpHandler);
96
- }
97
-
98
- /**
99
- * Obtains an AuthTokenMiddleware that uses the default FetchAuthTokenInterface
100
- * implementation to use in this environment.
101
- *
102
- * If supplied, $scope is used to in creating the credentials instance if
103
- * this does not fallback to the compute engine defaults.
104
- *
105
- * @param string|array scope the scope of the access request, expressed
106
- * either as an Array or as a space-delimited String.
107
- * @param callable $httpHandler callback which delivers psr7 request
108
- * @param array $cacheConfig configuration for the cache when it's present
109
- * @param CacheItemPoolInterface $cache A cache implementation, may be
110
- * provided if you have one already available for use.
111
- * @param string $quotaProject specifies a project to bill for access
112
- * charges associated with the request.
113
- * @return AuthTokenMiddleware
114
- * @throws DomainException if no implementation can be obtained.
115
- */
116
- public static function getMiddleware(
117
- $scope = null,
118
- callable $httpHandler = null,
119
- array $cacheConfig = null,
120
- CacheItemPoolInterface $cache = null,
121
- $quotaProject = null
122
- ) {
123
- $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache, $quotaProject);
124
-
125
- return new AuthTokenMiddleware($creds, $httpHandler);
126
- }
127
-
128
- /**
129
- * Obtains an AuthTokenMiddleware which will fetch an access token to use in
130
- * the Authorization header. The middleware is configured with the default
131
- * FetchAuthTokenInterface implementation to use in this environment.
132
- *
133
- * If supplied, $scope is used to in creating the credentials instance if
134
- * this does not fallback to the Compute Engine defaults.
135
- *
136
- * @param string|array scope the scope of the access request, expressed
137
- * either as an Array or as a space-delimited String.
138
- * @param callable $httpHandler callback which delivers psr7 request
139
- * @param array $cacheConfig configuration for the cache when it's present
140
- * @param CacheItemPoolInterface $cache A cache implementation, may be
141
- * provided if you have one already available for use.
142
- * @param string $quotaProject specifies a project to bill for access
143
- * charges associated with the request.
144
- *
145
- * @return CredentialsLoader
146
- * @throws DomainException if no implementation can be obtained.
147
- */
148
- public static function getCredentials(
149
- $scope = null,
150
- callable $httpHandler = null,
151
- array $cacheConfig = null,
152
- CacheItemPoolInterface $cache = null,
153
- $quotaProject = null
154
- ) {
155
- $creds = null;
156
- $jsonKey = CredentialsLoader::fromEnv()
157
- ?: CredentialsLoader::fromWellKnownFile();
158
-
159
- if (!$httpHandler) {
160
- if (!($client = HttpClientCache::getHttpClient())) {
161
- $client = new Client();
162
- HttpClientCache::setHttpClient($client);
163
- }
164
-
165
- $httpHandler = HttpHandlerFactory::build($client);
166
- }
167
-
168
- if (!is_null($jsonKey)) {
169
- if ($quotaProject) {
170
- $jsonKey['quota_project_id'] = $quotaProject;
171
- }
172
- $creds = CredentialsLoader::makeCredentials($scope, $jsonKey);
173
- } elseif (AppIdentityCredentials::onAppEngine() && !GCECredentials::onAppEngineFlexible()) {
174
- $creds = new AppIdentityCredentials($scope);
175
- } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) {
176
- $creds = new GCECredentials(null, $scope, null, $quotaProject);
177
- }
178
-
179
- if (is_null($creds)) {
180
- throw new DomainException(self::notFound());
181
- }
182
- if (!is_null($cache)) {
183
- $creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache);
184
- }
185
- return $creds;
186
- }
187
-
188
- /**
189
- * Obtains an AuthTokenMiddleware which will fetch an ID token to use in the
190
- * Authorization header. The middleware is configured with the default
191
- * FetchAuthTokenInterface implementation to use in this environment.
192
- *
193
- * If supplied, $targetAudience is used to set the "aud" on the resulting
194
- * ID token.
195
- *
196
- * @param string $targetAudience The audience for the ID token.
197
- * @param callable $httpHandler callback which delivers psr7 request
198
- * @param array $cacheConfig configuration for the cache when it's present
199
- * @param CacheItemPoolInterface $cache A cache implementation, may be
200
- * provided if you have one already available for use.
201
- * @return AuthTokenMiddleware
202
- * @throws DomainException if no implementation can be obtained.
203
- */
204
- public static function getIdTokenMiddleware(
205
- $targetAudience,
206
- callable $httpHandler = null,
207
- array $cacheConfig = null,
208
- CacheItemPoolInterface $cache = null
209
- ) {
210
- $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache);
211
-
212
- return new AuthTokenMiddleware($creds, $httpHandler);
213
- }
214
-
215
- /**
216
- * Obtains the default FetchAuthTokenInterface implementation to use
217
- * in this environment, configured with a $targetAudience for fetching an ID
218
- * token.
219
- *
220
- * @param string $targetAudience The audience for the ID token.
221
- * @param callable $httpHandler callback which delivers psr7 request
222
- * @param array $cacheConfig configuration for the cache when it's present
223
- * @param CacheItemPoolInterface $cache A cache implementation, may be
224
- * provided if you have one already available for use.
225
- * @return CredentialsLoader
226
- * @throws DomainException if no implementation can be obtained.
227
- * @throws InvalidArgumentException if JSON "type" key is invalid
228
- */
229
- public static function getIdTokenCredentials(
230
- $targetAudience,
231
- callable $httpHandler = null,
232
- array $cacheConfig = null,
233
- CacheItemPoolInterface $cache = null
234
- ) {
235
- $creds = null;
236
- $jsonKey = CredentialsLoader::fromEnv()
237
- ?: CredentialsLoader::fromWellKnownFile();
238
-
239
- if (!$httpHandler) {
240
- if (!($client = HttpClientCache::getHttpClient())) {
241
- $client = new Client();
242
- HttpClientCache::setHttpClient($client);
243
- }
244
-
245
- $httpHandler = HttpHandlerFactory::build($client);
246
- }
247
-
248
- if (!is_null($jsonKey)) {
249
- if (!array_key_exists('type', $jsonKey)) {
250
- throw new \InvalidArgumentException('json key is missing the type field');
251
- }
252
-
253
- if ($jsonKey['type'] == 'authorized_user') {
254
- throw new InvalidArgumentException('ID tokens are not supported for end user credentials');
255
- }
256
-
257
- if ($jsonKey['type'] != 'service_account') {
258
- throw new InvalidArgumentException('invalid value in the type field');
259
- }
260
-
261
- $creds = new ServiceAccountCredentials(null, $jsonKey, null, $targetAudience);
262
- } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) {
263
- $creds = new GCECredentials(null, null, $targetAudience);
264
- }
265
-
266
- if (is_null($creds)) {
267
- throw new DomainException(self::notFound());
268
- }
269
- if (!is_null($cache)) {
270
- $creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache);
271
- }
272
- return $creds;
273
- }
274
-
275
- private static function notFound()
276
- {
277
- $msg = 'Could not load the default credentials. Browse to ';
278
- $msg .= 'https://developers.google.com';
279
- $msg .= '/accounts/docs/application-default-credentials';
280
- $msg .= ' for more information';
281
-
282
- return $msg;
283
- }
284
-
285
- private static function onGce(
286
- callable $httpHandler = null,
287
- array $cacheConfig = null,
288
- CacheItemPoolInterface $cache = null
289
- ) {
290
- $gceCacheConfig = [];
291
- foreach (['lifetime', 'prefix'] as $key) {
292
- if (isset($cacheConfig['gce_' . $key])) {
293
- $gceCacheConfig[$key] = $cacheConfig['gce_' . $key];
294
- }
295
- }
296
-
297
- return (new GCECache($gceCacheConfig, $cache))->onGce($httpHandler);
298
- }
299
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Cache/InvalidArgumentException.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2016 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Cache;
19
-
20
- use Psr\Cache\InvalidArgumentException as PsrInvalidArgumentException;
21
-
22
- class InvalidArgumentException extends \InvalidArgumentException implements PsrInvalidArgumentException
23
- {
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Cache/Item.php DELETED
@@ -1,190 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2016 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Cache;
19
-
20
- use Psr\Cache\CacheItemInterface;
21
-
22
- /**
23
- * A cache item.
24
- */
25
- final class Item implements CacheItemInterface
26
- {
27
- /**
28
- * @var string
29
- */
30
- private $key;
31
-
32
- /**
33
- * @var mixed
34
- */
35
- private $value;
36
-
37
- /**
38
- * @var \DateTime|null
39
- */
40
- private $expiration;
41
-
42
- /**
43
- * @var bool
44
- */
45
- private $isHit = false;
46
-
47
- /**
48
- * @param string $key
49
- */
50
- public function __construct($key)
51
- {
52
- $this->key = $key;
53
- }
54
-
55
- /**
56
- * {@inheritdoc}
57
- */
58
- public function getKey()
59
- {
60
- return $this->key;
61
- }
62
-
63
- /**
64
- * {@inheritdoc}
65
- */
66
- public function get()
67
- {
68
- return $this->isHit() ? $this->value : null;
69
- }
70
-
71
- /**
72
- * {@inheritdoc}
73
- */
74
- public function isHit()
75
- {
76
- if (!$this->isHit) {
77
- return false;
78
- }
79
-
80
- if ($this->expiration === null) {
81
- return true;
82
- }
83
-
84
- return $this->currentTime()->getTimestamp() < $this->expiration->getTimestamp();
85
- }
86
-
87
- /**
88
- * {@inheritdoc}
89
- */
90
- public function set($value)
91
- {
92
- $this->isHit = true;
93
- $this->value = $value;
94
-
95
- return $this;
96
- }
97
-
98
- /**
99
- * {@inheritdoc}
100
- */
101
- public function expiresAt($expiration)
102
- {
103
- if ($this->isValidExpiration($expiration)) {
104
- $this->expiration = $expiration;
105
-
106
- return $this;
107
- }
108
-
109
- $implementationMessage = interface_exists('DateTimeInterface')
110
- ? 'implement interface DateTimeInterface'
111
- : 'be an instance of DateTime';
112
-
113
- $error = sprintf(
114
- 'Argument 1 passed to %s::expiresAt() must %s, %s given',
115
- get_class($this),
116
- $implementationMessage,
117
- gettype($expiration)
118
- );
119
-
120
- $this->handleError($error);
121
- }
122
-
123
- /**
124
- * {@inheritdoc}
125
- */
126
- public function expiresAfter($time)
127
- {
128
- if (is_int($time)) {
129
- $this->expiration = $this->currentTime()->add(new \DateInterval("PT{$time}S"));
130
- } elseif ($time instanceof \DateInterval) {
131
- $this->expiration = $this->currentTime()->add($time);
132
- } elseif ($time === null) {
133
- $this->expiration = $time;
134
- } else {
135
- $message = 'Argument 1 passed to %s::expiresAfter() must be an ' .
136
- 'instance of DateInterval or of the type integer, %s given';
137
- $error = sprintf($message, get_class($this), gettype($time));
138
-
139
- $this->handleError($error);
140
- }
141
-
142
- return $this;
143
- }
144
-
145
- /**
146
- * Handles an error.
147
- *
148
- * @param string $error
149
- * @throws \TypeError
150
- */
151
- private function handleError($error)
152
- {
153
- if (class_exists('TypeError')) {
154
- throw new \TypeError($error);
155
- }
156
-
157
- trigger_error($error, E_USER_ERROR);
158
- }
159
-
160
- /**
161
- * Determines if an expiration is valid based on the rules defined by PSR6.
162
- *
163
- * @param mixed $expiration
164
- * @return bool
165
- */
166
- private function isValidExpiration($expiration)
167
- {
168
- if ($expiration === null) {
169
- return true;
170
- }
171
-
172
- // We test for two types here due to the fact the DateTimeInterface
173
- // was not introduced until PHP 5.5. Checking for the DateTime type as
174
- // well allows us to support 5.4.
175
- if ($expiration instanceof \DateTimeInterface) {
176
- return true;
177
- }
178
-
179
- if ($expiration instanceof \DateTime) {
180
- return true;
181
- }
182
-
183
- return false;
184
- }
185
-
186
- protected function currentTime()
187
- {
188
- return new \DateTime('now', new \DateTimeZone('UTC'));
189
- }
190
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Cache/MemoryCacheItemPool.php DELETED
@@ -1,154 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2016 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Cache;
19
-
20
- use Psr\Cache\CacheItemInterface;
21
- use Psr\Cache\CacheItemPoolInterface;
22
-
23
- /**
24
- * Simple in-memory cache implementation.
25
- */
26
- final class MemoryCacheItemPool implements CacheItemPoolInterface
27
- {
28
- /**
29
- * @var CacheItemInterface[]
30
- */
31
- private $items;
32
-
33
- /**
34
- * @var CacheItemInterface[]
35
- */
36
- private $deferredItems;
37
-
38
- /**
39
- * {@inheritdoc}
40
- */
41
- public function getItem($key)
42
- {
43
- return current($this->getItems([$key]));
44
- }
45
-
46
- /**
47
- * {@inheritdoc}
48
- */
49
- public function getItems(array $keys = [])
50
- {
51
- $items = [];
52
-
53
- foreach ($keys as $key) {
54
- $items[$key] = $this->hasItem($key) ? clone $this->items[$key] : new Item($key);
55
- }
56
-
57
- return $items;
58
- }
59
-
60
- /**
61
- * {@inheritdoc}
62
- */
63
- public function hasItem($key)
64
- {
65
- $this->isValidKey($key);
66
-
67
- return isset($this->items[$key]) && $this->items[$key]->isHit();
68
- }
69
-
70
- /**
71
- * {@inheritdoc}
72
- */
73
- public function clear()
74
- {
75
- $this->items = [];
76
- $this->deferredItems = [];
77
-
78
- return true;
79
- }
80
-
81
- /**
82
- * {@inheritdoc}
83
- */
84
- public function deleteItem($key)
85
- {
86
- return $this->deleteItems([$key]);
87
- }
88
-
89
- /**
90
- * {@inheritdoc}
91
- */
92
- public function deleteItems(array $keys)
93
- {
94
- array_walk($keys, [$this, 'isValidKey']);
95
-
96
- foreach ($keys as $key) {
97
- unset($this->items[$key]);
98
- }
99
-
100
- return true;
101
- }
102
-
103
- /**
104
- * {@inheritdoc}
105
- */
106
- public function save(CacheItemInterface $item)
107
- {
108
- $this->items[$item->getKey()] = $item;
109
-
110
- return true;
111
- }
112
-
113
- /**
114
- * {@inheritdoc}
115
- */
116
- public function saveDeferred(CacheItemInterface $item)
117
- {
118
- $this->deferredItems[$item->getKey()] = $item;
119
-
120
- return true;
121
- }
122
-
123
- /**
124
- * {@inheritdoc}
125
- */
126
- public function commit()
127
- {
128
- foreach ($this->deferredItems as $item) {
129
- $this->save($item);
130
- }
131
-
132
- $this->deferredItems = [];
133
-
134
- return true;
135
- }
136
-
137
- /**
138
- * Determines if the provided key is valid.
139
- *
140
- * @param string $key
141
- * @return bool
142
- * @throws InvalidArgumentException
143
- */
144
- private function isValidKey($key)
145
- {
146
- $invalidCharacters = '{}()/\\\\@:';
147
-
148
- if (!is_string($key) || preg_match("#[$invalidCharacters]#", $key)) {
149
- throw new InvalidArgumentException('The provided key is not valid: ' . var_export($key, true));
150
- }
151
-
152
- return true;
153
- }
154
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Cache/SysVCacheItemPool.php DELETED
@@ -1,241 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2018 Google Inc. All Rights Reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- namespace Google\Auth\Cache;
18
-
19
- use Psr\Cache\CacheItemInterface;
20
- use Psr\Cache\CacheItemPoolInterface;
21
-
22
- /**
23
- * SystemV shared memory based CacheItemPool implementation.
24
- *
25
- * This CacheItemPool implementation can be used among multiple processes, but
26
- * it doesn't provide any locking mechanism. If multiple processes write to
27
- * this ItemPool, you have to avoid race condition manually in your code.
28
- */
29
- class SysVCacheItemPool implements CacheItemPoolInterface
30
- {
31
- const VAR_KEY = 1;
32
-
33
- const DEFAULT_PROJ = 'A';
34
-
35
- const DEFAULT_MEMSIZE = 10000;
36
-
37
- const DEFAULT_PERM = 0600;
38
-
39
- /** @var int */
40
- private $sysvKey;
41
-
42
- /**
43
- * @var CacheItemInterface[]
44
- */
45
- private $items;
46
-
47
- /**
48
- * @var CacheItemInterface[]
49
- */
50
- private $deferredItems;
51
-
52
- /**
53
- * @var array
54
- */
55
- private $options;
56
-
57
- /*
58
- * @var bool
59
- */
60
- private $hasLoadedItems = false;
61
-
62
- /**
63
- * Create a SystemV shared memory based CacheItemPool.
64
- *
65
- * @param array $options [optional] Configuration options.
66
- * @param int $options.variableKey The variable key for getting the data from
67
- * the shared memory. **Defaults to** 1.
68
- * @param $options.proj string The project identifier for ftok. This needs to
69
- * be a one character string. **Defaults to** 'A'.
70
- * @param $options.memsize int The memory size in bytes for shm_attach.
71
- * **Defaults to** 10000.
72
- * @param $options.perm int The permission for shm_attach. **Defaults to**
73
- * 0600.
74
- */
75
- public function __construct($options = [])
76
- {
77
- if (! extension_loaded('sysvshm')) {
78
- throw new \RuntimeException(
79
- 'sysvshm extension is required to use this ItemPool'
80
- );
81
- }
82
- $this->options = $options + [
83
- 'variableKey' => self::VAR_KEY,
84
- 'proj' => self::DEFAULT_PROJ,
85
- 'memsize' => self::DEFAULT_MEMSIZE,
86
- 'perm' => self::DEFAULT_PERM
87
- ];
88
- $this->items = [];
89
- $this->deferredItems = [];
90
- $this->sysvKey = ftok(__FILE__, $this->options['proj']);
91
- }
92
-
93
- public function getItem($key)
94
- {
95
- $this->loadItems();
96
- return current($this->getItems([$key]));
97
- }
98
-
99
- /**
100
- * {@inheritdoc}
101
- */
102
- public function getItems(array $keys = [])
103
- {
104
- $this->loadItems();
105
- $items = [];
106
- foreach ($keys as $key) {
107
- $items[$key] = $this->hasItem($key) ?
108
- clone $this->items[$key] :
109
- new Item($key);
110
- }
111
- return $items;
112
- }
113
-
114
- /**
115
- * {@inheritdoc}
116
- */
117
- public function hasItem($key)
118
- {
119
- $this->loadItems();
120
- return isset($this->items[$key]) && $this->items[$key]->isHit();
121
- }
122
-
123
- /**
124
- * {@inheritdoc}
125
- */
126
- public function clear()
127
- {
128
- $this->items = [];
129
- $this->deferredItems = [];
130
- return $this->saveCurrentItems();
131
- }
132
-
133
- /**
134
- * {@inheritdoc}
135
- */
136
- public function deleteItem($key)
137
- {
138
- return $this->deleteItems([$key]);
139
- }
140
-
141
- /**
142
- * {@inheritdoc}
143
- */
144
- public function deleteItems(array $keys)
145
- {
146
- if (!$this->hasLoadedItems) {
147
- $this->loadItems();
148
- }
149
-
150
- foreach ($keys as $key) {
151
- unset($this->items[$key]);
152
- }
153
- return $this->saveCurrentItems();
154
- }
155
-
156
- /**
157
- * {@inheritdoc}
158
- */
159
- public function save(CacheItemInterface $item)
160
- {
161
- if (!$this->hasLoadedItems) {
162
- $this->loadItems();
163
- }
164
-
165
- $this->items[$item->getKey()] = $item;
166
- return $this->saveCurrentItems();
167
- }
168
-
169
- /**
170
- * {@inheritdoc}
171
- */
172
- public function saveDeferred(CacheItemInterface $item)
173
- {
174
- $this->deferredItems[$item->getKey()] = $item;
175
- return true;
176
- }
177
-
178
- /**
179
- * {@inheritdoc}
180
- */
181
- public function commit()
182
- {
183
- foreach ($this->deferredItems as $item) {
184
- if ($this->save($item) === false) {
185
- return false;
186
- }
187
- }
188
- $this->deferredItems = [];
189
- return true;
190
- }
191
-
192
- /**
193
- * Save the current items.
194
- *
195
- * @return bool true when success, false upon failure
196
- */
197
- private function saveCurrentItems()
198
- {
199
- $shmid = shm_attach(
200
- $this->sysvKey,
201
- $this->options['memsize'],
202
- $this->options['perm']
203
- );
204
- if ($shmid !== false) {
205
- $ret = shm_put_var(
206
- $shmid,
207
- $this->options['variableKey'],
208
- $this->items
209
- );
210
- shm_detach($shmid);
211
- return $ret;
212
- }
213
- return false;
214
- }
215
-
216
- /**
217
- * Load the items from the shared memory.
218
- *
219
- * @return bool true when success, false upon failure
220
- */
221
- private function loadItems()
222
- {
223
- $shmid = shm_attach(
224
- $this->sysvKey,
225
- $this->options['memsize'],
226
- $this->options['perm']
227
- );
228
- if ($shmid !== false) {
229
- $data = @shm_get_var($shmid, $this->options['variableKey']);
230
- if (!empty($data)) {
231
- $this->items = $data;
232
- } else {
233
- $this->items = [];
234
- }
235
- shm_detach($shmid);
236
- $this->hasLoadedItems = true;
237
- return true;
238
- }
239
- return false;
240
- }
241
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/CacheTrait.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- trait CacheTrait
21
- {
22
- private $maxKeyLength = 64;
23
-
24
- /**
25
- * Gets the cached value if it is present in the cache when that is
26
- * available.
27
- */
28
- private function getCachedValue($k)
29
- {
30
- if (is_null($this->cache)) {
31
- return;
32
- }
33
-
34
- $key = $this->getFullCacheKey($k);
35
- if (is_null($key)) {
36
- return;
37
- }
38
-
39
- $cacheItem = $this->cache->getItem($key);
40
- if ($cacheItem->isHit()) {
41
- return $cacheItem->get();
42
- }
43
- }
44
-
45
- /**
46
- * Saves the value in the cache when that is available.
47
- */
48
- private function setCachedValue($k, $v)
49
- {
50
- if (is_null($this->cache)) {
51
- return;
52
- }
53
-
54
- $key = $this->getFullCacheKey($k);
55
- if (is_null($key)) {
56
- return;
57
- }
58
-
59
- $cacheItem = $this->cache->getItem($key);
60
- $cacheItem->set($v);
61
- $cacheItem->expiresAfter($this->cacheConfig['lifetime']);
62
- return $this->cache->save($cacheItem);
63
- }
64
-
65
- private function getFullCacheKey($key)
66
- {
67
- if (is_null($key)) {
68
- return;
69
- }
70
-
71
- $key = $this->cacheConfig['prefix'] . $key;
72
-
73
- // ensure we do not have illegal characters
74
- $key = preg_replace('|[^a-zA-Z0-9_\.!]|', '', $key);
75
-
76
- // Hash keys if they exceed $maxKeyLength (defaults to 64)
77
- if ($this->maxKeyLength && strlen($key) > $this->maxKeyLength) {
78
- $key = substr(hash('sha256', $key), 0, $this->maxKeyLength);
79
- }
80
-
81
- return $key;
82
- }
83
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Credentials/AppIdentityCredentials.php DELETED
@@ -1,230 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Credentials;
19
-
20
- /*
21
- * The AppIdentityService class is automatically defined on App Engine,
22
- * so including this dependency is not necessary, and will result in a
23
- * PHP fatal error in the App Engine environment.
24
- */
25
- use google\appengine\api\app_identity\AppIdentityService;
26
- use Google\Auth\CredentialsLoader;
27
- use Google\Auth\ProjectIdProviderInterface;
28
- use Google\Auth\SignBlobInterface;
29
-
30
- /**
31
- * AppIdentityCredentials supports authorization on Google App Engine.
32
- *
33
- * It can be used to authorize requests using the AuthTokenMiddleware or
34
- * AuthTokenSubscriber, but will only succeed if being run on App Engine:
35
- *
36
- * Example:
37
- * ```
38
- * use Google\Auth\Credentials\AppIdentityCredentials;
39
- * use Google\Auth\Middleware\AuthTokenMiddleware;
40
- * use GuzzleHttp\Client;
41
- * use GuzzleHttp\HandlerStack;
42
- *
43
- * $gae = new AppIdentityCredentials('https://www.googleapis.com/auth/books');
44
- * $middleware = new AuthTokenMiddleware($gae);
45
- * $stack = HandlerStack::create();
46
- * $stack->push($middleware);
47
- *
48
- * $client = new Client([
49
- * 'handler' => $stack,
50
- * 'base_uri' => 'https://www.googleapis.com/books/v1',
51
- * 'auth' => 'google_auth'
52
- * ]);
53
- *
54
- * $res = $client->get('volumes?q=Henry+David+Thoreau&country=US');
55
- * ```
56
- */
57
- class AppIdentityCredentials extends CredentialsLoader implements
58
- SignBlobInterface,
59
- ProjectIdProviderInterface
60
- {
61
- /**
62
- * Result of fetchAuthToken.
63
- *
64
- * @var array
65
- */
66
- protected $lastReceivedToken;
67
-
68
- /**
69
- * Array of OAuth2 scopes to be requested.
70
- *
71
- * @var array
72
- */
73
- private $scope;
74
-
75
- /**
76
- * @var string
77
- */
78
- private $clientName;
79
-
80
- /**
81
- * @param array $scope One or more scopes.
82
- */
83
- public function __construct($scope = array())
84
- {
85
- $this->scope = $scope;
86
- }
87
-
88
- /**
89
- * Determines if this an App Engine instance, by accessing the
90
- * SERVER_SOFTWARE environment variable (prod) or the APPENGINE_RUNTIME
91
- * environment variable (dev).
92
- *
93
- * @return bool true if this an App Engine Instance, false otherwise
94
- */
95
- public static function onAppEngine()
96
- {
97
- $appEngineProduction = isset($_SERVER['SERVER_SOFTWARE']) &&
98
- 0 === strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine');
99
- if ($appEngineProduction) {
100
- return true;
101
- }
102
- $appEngineDevAppServer = isset($_SERVER['APPENGINE_RUNTIME']) &&
103
- $_SERVER['APPENGINE_RUNTIME'] == 'php';
104
- if ($appEngineDevAppServer) {
105
- return true;
106
- }
107
- return false;
108
- }
109
-
110
- /**
111
- * Implements FetchAuthTokenInterface#fetchAuthToken.
112
- *
113
- * Fetches the auth tokens using the AppIdentityService if available.
114
- * As the AppIdentityService uses protobufs to fetch the access token,
115
- * the GuzzleHttp\ClientInterface instance passed in will not be used.
116
- *
117
- * @param callable $httpHandler callback which delivers psr7 request
118
- * @return array A set of auth related metadata, containing the following
119
- * keys:
120
- * - access_token (string)
121
- * - expiration_time (string)
122
- */
123
- public function fetchAuthToken(callable $httpHandler = null)
124
- {
125
- try {
126
- $this->checkAppEngineContext();
127
- } catch (\Exception $e) {
128
- return [];
129
- }
130
-
131
- // AppIdentityService expects an array when multiple scopes are supplied
132
- $scope = is_array($this->scope) ? $this->scope : explode(' ', $this->scope);
133
-
134
- $token = AppIdentityService::getAccessToken($scope);
135
- $this->lastReceivedToken = $token;
136
-
137
- return $token;
138
- }
139
-
140
- /**
141
- * Sign a string using AppIdentityService.
142
- *
143
- * @param string $stringToSign The string to sign.
144
- * @param bool $forceOpenSsl [optional] Does not apply to this credentials
145
- * type.
146
- * @return string The signature, base64-encoded.
147
- * @throws \Exception If AppEngine SDK or mock is not available.
148
- */
149
- public function signBlob($stringToSign, $forceOpenSsl = false)
150
- {
151
- $this->checkAppEngineContext();
152
-
153
- return base64_encode(AppIdentityService::signForApp($stringToSign)['signature']);
154
- }
155
-
156
- /**
157
- * Get the project ID from AppIdentityService.
158
- *
159
- * Returns null if AppIdentityService is unavailable.
160
- *
161
- * @param callable $httpHandler Not used by this type.
162
- * @return string|null
163
- */
164
- public function getProjectId(callable $httpHander = null)
165
- {
166
- try {
167
- $this->checkAppEngineContext();
168
- } catch (\Exception $e) {
169
- return null;
170
- }
171
-
172
- return AppIdentityService::getApplicationId();
173
- }
174
-
175
- /**
176
- * Get the client name from AppIdentityService.
177
- *
178
- * Subsequent calls to this method will return a cached value.
179
- *
180
- * @param callable $httpHandler Not used in this implementation.
181
- * @return string
182
- * @throws \Exception If AppEngine SDK or mock is not available.
183
- */
184
- public function getClientName(callable $httpHandler = null)
185
- {
186
- $this->checkAppEngineContext();
187
-
188
- if (!$this->clientName) {
189
- $this->clientName = AppIdentityService::getServiceAccountName();
190
- }
191
-
192
- return $this->clientName;
193
- }
194
-
195
- /**
196
- * @return array|null
197
- */
198
- public function getLastReceivedToken()
199
- {
200
- if ($this->lastReceivedToken) {
201
- return [
202
- 'access_token' => $this->lastReceivedToken['access_token'],
203
- 'expires_at' => $this->lastReceivedToken['expiration_time'],
204
- ];
205
- }
206
-
207
- return null;
208
- }
209
-
210
- /**
211
- * Caching is handled by the underlying AppIdentityService, return empty string
212
- * to prevent caching.
213
- *
214
- * @return string
215
- */
216
- public function getCacheKey()
217
- {
218
- return '';
219
- }
220
-
221
- private function checkAppEngineContext()
222
- {
223
- if (!self::onAppEngine() || !class_exists('google\appengine\api\app_identity\AppIdentityService')) {
224
- throw new \Exception(
225
- 'This class must be run in App Engine, or you must include the AppIdentityService '
226
- . 'mock class defined in tests/mocks/AppIdentityService.php'
227
- );
228
- }
229
- }
230
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Credentials/GCECredentials.php DELETED
@@ -1,541 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Credentials;
19
-
20
- use Google\Auth\CredentialsLoader;
21
- use Google\Auth\GetQuotaProjectInterface;
22
- use Google\Auth\HttpHandler\HttpClientCache;
23
- use Google\Auth\HttpHandler\HttpHandlerFactory;
24
- use Google\Auth\Iam;
25
- use Google\Auth\ProjectIdProviderInterface;
26
- use Google\Auth\SignBlobInterface;
27
- use GuzzleHttp\Exception\ClientException;
28
- use GuzzleHttp\Exception\ConnectException;
29
- use GuzzleHttp\Exception\RequestException;
30
- use GuzzleHttp\Exception\ServerException;
31
- use GuzzleHttp\Psr7\Request;
32
- use InvalidArgumentException;
33
-
34
- /**
35
- * GCECredentials supports authorization on Google Compute Engine.
36
- *
37
- * It can be used to authorize requests using the AuthTokenMiddleware, but will
38
- * only succeed if being run on GCE:
39
- *
40
- * use Google\Auth\Credentials\GCECredentials;
41
- * use Google\Auth\Middleware\AuthTokenMiddleware;
42
- * use GuzzleHttp\Client;
43
- * use GuzzleHttp\HandlerStack;
44
- *
45
- * $gce = new GCECredentials();
46
- * $middleware = new AuthTokenMiddleware($gce);
47
- * $stack = HandlerStack::create();
48
- * $stack->push($middleware);
49
- *
50
- * $client = new Client([
51
- * 'handler' => $stack,
52
- * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
53
- * 'auth' => 'google_auth'
54
- * ]);
55
- *
56
- * $res = $client->get('myproject/taskqueues/myqueue');
57
- */
58
- class GCECredentials extends CredentialsLoader implements
59
- SignBlobInterface,
60
- ProjectIdProviderInterface,
61
- GetQuotaProjectInterface
62
- {
63
- // phpcs:disable
64
- const cacheKey = 'GOOGLE_AUTH_PHP_GCE';
65
- // phpcs:enable
66
-
67
- /**
68
- * The metadata IP address on appengine instances.
69
- *
70
- * The IP is used instead of the domain 'metadata' to avoid slow responses
71
- * when not on Compute Engine.
72
- */
73
- const METADATA_IP = '169.254.169.254';
74
-
75
- /**
76
- * The metadata path of the default token.
77
- */
78
- const TOKEN_URI_PATH = 'v1/instance/service-accounts/default/token';
79
-
80
- /**
81
- * The metadata path of the default id token.
82
- */
83
- const ID_TOKEN_URI_PATH = 'v1/instance/service-accounts/default/identity';
84
-
85
- /**
86
- * The metadata path of the client ID.
87
- */
88
- const CLIENT_ID_URI_PATH = 'v1/instance/service-accounts/default/email';
89
-
90
- /**
91
- * The metadata path of the project ID.
92
- */
93
- const PROJECT_ID_URI_PATH = 'v1/project/project-id';
94
-
95
- /**
96
- * The header whose presence indicates GCE presence.
97
- */
98
- const FLAVOR_HEADER = 'Metadata-Flavor';
99
-
100
- /**
101
- * Note: the explicit `timeout` and `tries` below is a workaround. The underlying
102
- * issue is that resolving an unknown host on some networks will take
103
- * 20-30 seconds; making this timeout short fixes the issue, but
104
- * could lead to false negatives in the event that we are on GCE, but
105
- * the metadata resolution was particularly slow. The latter case is
106
- * "unlikely" since the expected 4-nines time is about 0.5 seconds.
107
- * This allows us to limit the total ping maximum timeout to 1.5 seconds
108
- * for developer desktop scenarios.
109
- */
110
- const MAX_COMPUTE_PING_TRIES = 3;
111
- const COMPUTE_PING_CONNECTION_TIMEOUT_S = 0.5;
112
-
113
- /**
114
- * Flag used to ensure that the onGCE test is only done once;.
115
- *
116
- * @var bool
117
- */
118
- private $hasCheckedOnGce = false;
119
-
120
- /**
121
- * Flag that stores the value of the onGCE check.
122
- *
123
- * @var bool
124
- */
125
- private $isOnGce = false;
126
-
127
- /**
128
- * Result of fetchAuthToken.
129
- */
130
- protected $lastReceivedToken;
131
-
132
- /**
133
- * @var string|null
134
- */
135
- private $clientName;
136
-
137
- /**
138
- * @var string|null
139
- */
140
- private $projectId;
141
-
142
- /**
143
- * @var Iam|null
144
- */
145
- private $iam;
146
-
147
- /**
148
- * @var string
149
- */
150
- private $tokenUri;
151
-
152
- /**
153
- * @var string
154
- */
155
- private $targetAudience;
156
-
157
- /**
158
- * @var string|null
159
- */
160
- private $quotaProject;
161
-
162
- /**
163
- * @var string|null
164
- */
165
- private $serviceAccountIdentity;
166
-
167
- /**
168
- * @param Iam $iam [optional] An IAM instance.
169
- * @param string|array $scope [optional] the scope of the access request,
170
- * expressed either as an array or as a space-delimited string.
171
- * @param string $targetAudience [optional] The audience for the ID token.
172
- * @param string $quotaProject [optional] Specifies a project to bill for access
173
- * charges associated with the request.
174
- * @param string $serviceAccountIdentity [optional] Specify a service
175
- * account identity name to use instead of "default".
176
- */
177
- public function __construct(
178
- Iam $iam = null,
179
- $scope = null,
180
- $targetAudience = null,
181
- $quotaProject = null,
182
- $serviceAccountIdentity = null
183
- ) {
184
- $this->iam = $iam;
185
-
186
- if ($scope && $targetAudience) {
187
- throw new InvalidArgumentException(
188
- 'Scope and targetAudience cannot both be supplied'
189
- );
190
- }
191
-
192
- $tokenUri = self::getTokenUri($serviceAccountIdentity);
193
- if ($scope) {
194
- if (is_string($scope)) {
195
- $scope = explode(' ', $scope);
196
- }
197
-
198
- $scope = implode(',', $scope);
199
-
200
- $tokenUri = $tokenUri . '?scopes='. $scope;
201
- } elseif ($targetAudience) {
202
- $tokenUri = self::getIdTokenUri($serviceAccountIdentity);
203
- $tokenUri = $tokenUri . '?audience='. $targetAudience;
204
- $this->targetAudience = $targetAudience;
205
- }
206
-
207
- $this->tokenUri = $tokenUri;
208
- $this->quotaProject = $quotaProject;
209
- $this->serviceAccountIdentity = $serviceAccountIdentity;
210
- }
211
-
212
- /**
213
- * The full uri for accessing the default token.
214
- *
215
- * @param string $serviceAccountIdentity [optional] Specify a service
216
- * account identity name to use instead of "default".
217
- * @return string
218
- */
219
- public static function getTokenUri($serviceAccountIdentity = null)
220
- {
221
- $base = 'http://' . self::METADATA_IP . '/computeMetadata/';
222
- $base .= self::TOKEN_URI_PATH;
223
-
224
- if ($serviceAccountIdentity) {
225
- return str_replace(
226
- '/default/',
227
- '/' . $serviceAccountIdentity . '/',
228
- $base
229
- );
230
- }
231
- return $base;
232
- }
233
-
234
- /**
235
- * The full uri for accessing the default service account.
236
- *
237
- * @param string $serviceAccountIdentity [optional] Specify a service
238
- * account identity name to use instead of "default".
239
- * @return string
240
- */
241
- public static function getClientNameUri($serviceAccountIdentity = null)
242
- {
243
- $base = 'http://' . self::METADATA_IP . '/computeMetadata/';
244
- $base .= self::CLIENT_ID_URI_PATH;
245
-
246
- if ($serviceAccountIdentity) {
247
- return str_replace(
248
- '/default/',
249
- '/' . $serviceAccountIdentity . '/',
250
- $base
251
- );
252
- }
253
-
254
- return $base;
255
- }
256
-
257
- /**
258
- * The full uri for accesesing the default identity token.
259
- *
260
- * @param string $serviceAccountIdentity [optional] Specify a service
261
- * account identity name to use instead of "default".
262
- * @return string
263
- */
264
- private static function getIdTokenUri($serviceAccountIdentity = null)
265
- {
266
- $base = 'http://' . self::METADATA_IP . '/computeMetadata/';
267
- $base .= self::ID_TOKEN_URI_PATH;
268
-
269
- if ($serviceAccountIdentity) {
270
- return str_replace(
271
- '/default/',
272
- '/' . $serviceAccountIdentity . '/',
273
- $base
274
- );
275
- }
276
-
277
- return $base;
278
- }
279
-
280
- /**
281
- * The full uri for accessing the default project ID.
282
- *
283
- * @return string
284
- */
285
- private static function getProjectIdUri()
286
- {
287
- $base = 'http://' . self::METADATA_IP . '/computeMetadata/';
288
-
289
- return $base . self::PROJECT_ID_URI_PATH;
290
- }
291
-
292
- /**
293
- * Determines if this an App Engine Flexible instance, by accessing the
294
- * GAE_INSTANCE environment variable.
295
- *
296
- * @return bool true if this an App Engine Flexible Instance, false otherwise
297
- */
298
- public static function onAppEngineFlexible()
299
- {
300
- return substr(getenv('GAE_INSTANCE'), 0, 4) === 'aef-';
301
- }
302
-
303
- /**
304
- * Determines if this a GCE instance, by accessing the expected metadata
305
- * host.
306
- * If $httpHandler is not specified a the default HttpHandler is used.
307
- *
308
- * @param callable $httpHandler callback which delivers psr7 request
309
- * @return bool True if this a GCEInstance, false otherwise
310
- */
311
- public static function onGce(callable $httpHandler = null)
312
- {
313
- $httpHandler = $httpHandler
314
- ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
315
-
316
- $checkUri = 'http://' . self::METADATA_IP;
317
- for ($i = 1; $i <= self::MAX_COMPUTE_PING_TRIES; $i++) {
318
- try {
319
- // Comment from: oauth2client/client.py
320
- //
321
- // Note: the explicit `timeout` below is a workaround. The underlying
322
- // issue is that resolving an unknown host on some networks will take
323
- // 20-30 seconds; making this timeout short fixes the issue, but
324
- // could lead to false negatives in the event that we are on GCE, but
325
- // the metadata resolution was particularly slow. The latter case is
326
- // "unlikely".
327
- $resp = $httpHandler(
328
- new Request(
329
- 'GET',
330
- $checkUri,
331
- [self::FLAVOR_HEADER => 'Google']
332
- ),
333
- ['timeout' => self::COMPUTE_PING_CONNECTION_TIMEOUT_S]
334
- );
335
-
336
- return $resp->getHeaderLine(self::FLAVOR_HEADER) == 'Google';
337
- } catch (ClientException $e) {
338
- } catch (ServerException $e) {
339
- } catch (RequestException $e) {
340
- } catch (ConnectException $e) {
341
- }
342
- }
343
- return false;
344
- }
345
-
346
- /**
347
- * Implements FetchAuthTokenInterface#fetchAuthToken.
348
- *
349
- * Fetches the auth tokens from the GCE metadata host if it is available.
350
- * If $httpHandler is not specified a the default HttpHandler is used.
351
- *
352
- * @param callable $httpHandler callback which delivers psr7 request
353
- *
354
- * @return array A set of auth related metadata, based on the token type.
355
- *
356
- * Access tokens have the following keys:
357
- * - access_token (string)
358
- * - expires_in (int)
359
- * - token_type (string)
360
- * ID tokens have the following keys:
361
- * - id_token (string)
362
- *
363
- * @throws \Exception
364
- */
365
- public function fetchAuthToken(callable $httpHandler = null)
366
- {
367
- $httpHandler = $httpHandler
368
- ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
369
-
370
- if (!$this->hasCheckedOnGce) {
371
- $this->isOnGce = self::onGce($httpHandler);
372
- $this->hasCheckedOnGce = true;
373
- }
374
- if (!$this->isOnGce) {
375
- return array(); // return an empty array with no access token
376
- }
377
-
378
- $response = $this->getFromMetadata($httpHandler, $this->tokenUri);
379
-
380
- if ($this->targetAudience) {
381
- return ['id_token' => $response];
382
- }
383
-
384
- if (null === $json = json_decode($response, true)) {
385
- throw new \Exception('Invalid JSON response');
386
- }
387
-
388
- // store this so we can retrieve it later
389
- $this->lastReceivedToken = $json;
390
- $this->lastReceivedToken['expires_at'] = time() + $json['expires_in'];
391
-
392
- return $json;
393
- }
394
-
395
- /**
396
- * @return string
397
- */
398
- public function getCacheKey()
399
- {
400
- return self::cacheKey;
401
- }
402
-
403
- /**
404
- * @return array|null
405
- */
406
- public function getLastReceivedToken()
407
- {
408
- if ($this->lastReceivedToken) {
409
- return [
410
- 'access_token' => $this->lastReceivedToken['access_token'],
411
- 'expires_at' => $this->lastReceivedToken['expires_at'],
412
- ];
413
- }
414
-
415
- return null;
416
- }
417
-
418
- /**
419
- * Get the client name from GCE metadata.
420
- *
421
- * Subsequent calls will return a cached value.
422
- *
423
- * @param callable $httpHandler callback which delivers psr7 request
424
- * @return string
425
- */
426
- public function getClientName(callable $httpHandler = null)
427
- {
428
- if ($this->clientName) {
429
- return $this->clientName;
430
- }
431
-
432
- $httpHandler = $httpHandler
433
- ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
434
-
435
- if (!$this->hasCheckedOnGce) {
436
- $this->isOnGce = self::onGce($httpHandler);
437
- $this->hasCheckedOnGce = true;
438
- }
439
-
440
- if (!$this->isOnGce) {
441
- return '';
442
- }
443
-
444
- $this->clientName = $this->getFromMetadata(
445
- $httpHandler,
446
- self::getClientNameUri($this->serviceAccountIdentity)
447
- );
448
-
449
- return $this->clientName;
450
- }
451
-
452
- /**
453
- * Sign a string using the default service account private key.
454
- *
455
- * This implementation uses IAM's signBlob API.
456
- *
457
- * @see https://cloud.google.com/iam/credentials/reference/rest/v1/projects.serviceAccounts/signBlob SignBlob
458
- *
459
- * @param string $stringToSign The string to sign.
460
- * @param bool $forceOpenSsl [optional] Does not apply to this credentials
461
- * type.
462
- * @return string
463
- */
464
- public function signBlob($stringToSign, $forceOpenSsl = false)
465
- {
466
- $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient());
467
-
468
- // Providing a signer is useful for testing, but it's undocumented
469
- // because it's not something a user would generally need to do.
470
- $signer = $this->iam ?: new Iam($httpHandler);
471
-
472
- $email = $this->getClientName($httpHandler);
473
-
474
- $previousToken = $this->getLastReceivedToken();
475
- $accessToken = $previousToken
476
- ? $previousToken['access_token']
477
- : $this->fetchAuthToken($httpHandler)['access_token'];
478
-
479
- return $signer->signBlob($email, $accessToken, $stringToSign);
480
- }
481
-
482
- /**
483
- * Fetch the default Project ID from compute engine.
484
- *
485
- * Returns null if called outside GCE.
486
- *
487
- * @param callable $httpHandler Callback which delivers psr7 request
488
- * @return string|null
489
- */
490
- public function getProjectId(callable $httpHandler = null)
491
- {
492
- if ($this->projectId) {
493
- return $this->projectId;
494
- }
495
-
496
- $httpHandler = $httpHandler
497
- ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
498
-
499
- if (!$this->hasCheckedOnGce) {
500
- $this->isOnGce = self::onGce($httpHandler);
501
- $this->hasCheckedOnGce = true;
502
- }
503
-
504
- if (!$this->isOnGce) {
505
- return null;
506
- }
507
-
508
- $this->projectId = $this->getFromMetadata($httpHandler, self::getProjectIdUri());
509
- return $this->projectId;
510
- }
511
-
512
- /**
513
- * Fetch the value of a GCE metadata server URI.
514
- *
515
- * @param callable $httpHandler An HTTP Handler to deliver PSR7 requests.
516
- * @param string $uri The metadata URI.
517
- * @return string
518
- */
519
- private function getFromMetadata(callable $httpHandler, $uri)
520
- {
521
- $resp = $httpHandler(
522
- new Request(
523
- 'GET',
524
- $uri,
525
- [self::FLAVOR_HEADER => 'Google']
526
- )
527
- );
528
-
529
- return (string) $resp->getBody();
530
- }
531
-
532
- /**
533
- * Get the quota project used for this API request
534
- *
535
- * @return string|null
536
- */
537
- public function getQuotaProject()
538
- {
539
- return $this->quotaProject;
540
- }
541
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Credentials/IAMCredentials.php DELETED
@@ -1,91 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Credentials;
19
-
20
- /**
21
- * Authenticates requests using IAM credentials.
22
- */
23
- class IAMCredentials
24
- {
25
- const SELECTOR_KEY = 'x-goog-iam-authority-selector';
26
- const TOKEN_KEY = 'x-goog-iam-authorization-token';
27
-
28
- /**
29
- * @var string
30
- */
31
- private $selector;
32
-
33
- /**
34
- * @var string
35
- */
36
- private $token;
37
-
38
- /**
39
- * @param $selector string the IAM selector
40
- * @param $token string the IAM token
41
- */
42
- public function __construct($selector, $token)
43
- {
44
- if (!is_string($selector)) {
45
- throw new \InvalidArgumentException(
46
- 'selector must be a string'
47
- );
48
- }
49
- if (!is_string($token)) {
50
- throw new \InvalidArgumentException(
51
- 'token must be a string'
52
- );
53
- }
54
-
55
- $this->selector = $selector;
56
- $this->token = $token;
57
- }
58
-
59
- /**
60
- * export a callback function which updates runtime metadata.
61
- *
62
- * @return array updateMetadata function
63
- */
64
- public function getUpdateMetadataFunc()
65
- {
66
- return array($this, 'updateMetadata');
67
- }
68
-
69
- /**
70
- * Updates metadata with the appropriate header metadata.
71
- *
72
- * @param array $metadata metadata hashmap
73
- * @param string $unusedAuthUri optional auth uri
74
- * @param callable $httpHandler callback which delivers psr7 request
75
- * Note: this param is unused here, only included here for
76
- * consistency with other credentials class
77
- *
78
- * @return array updated metadata hashmap
79
- */
80
- public function updateMetadata(
81
- $metadata,
82
- $unusedAuthUri = null,
83
- callable $httpHandler = null
84
- ) {
85
- $metadata_copy = $metadata;
86
- $metadata_copy[self::SELECTOR_KEY] = $this->selector;
87
- $metadata_copy[self::TOKEN_KEY] = $this->token;
88
-
89
- return $metadata_copy;
90
- }
91
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Credentials/InsecureCredentials.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2018 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Credentials;
19
-
20
- use Google\Auth\FetchAuthTokenInterface;
21
-
22
- /**
23
- * Provides a set of credentials that will always return an empty access token.
24
- * This is useful for APIs which do not require authentication, for local
25
- * service emulators, and for testing.
26
- */
27
- class InsecureCredentials implements FetchAuthTokenInterface
28
- {
29
- /**
30
- * @var array
31
- */
32
- private $token = [
33
- 'access_token' => ''
34
- ];
35
-
36
- /**
37
- * Fetches the auth token. In this case it returns an empty string.
38
- *
39
- * @param callable $httpHandler
40
- * @return array A set of auth related metadata, containing the following
41
- * keys:
42
- * - access_token (string)
43
- */
44
- public function fetchAuthToken(callable $httpHandler = null)
45
- {
46
- return $this->token;
47
- }
48
-
49
- /**
50
- * Returns the cache key. In this case it returns a null value, disabling
51
- * caching.
52
- *
53
- * @return string|null
54
- */
55
- public function getCacheKey()
56
- {
57
- return null;
58
- }
59
-
60
- /**
61
- * Fetches the last received token. In this case, it returns the same empty string
62
- * auth token.
63
- *
64
- * @return array
65
- */
66
- public function getLastReceivedToken()
67
- {
68
- return $this->token;
69
- }
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Credentials/ServiceAccountCredentials.php DELETED
@@ -1,259 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Credentials;
19
-
20
- use Google\Auth\CredentialsLoader;
21
- use Google\Auth\GetQuotaProjectInterface;
22
- use Google\Auth\OAuth2;
23
- use Google\Auth\ProjectIdProviderInterface;
24
- use Google\Auth\ServiceAccountSignerTrait;
25
- use Google\Auth\SignBlobInterface;
26
- use InvalidArgumentException;
27
-
28
- /**
29
- * ServiceAccountCredentials supports authorization using a Google service
30
- * account.
31
- *
32
- * (cf https://developers.google.com/accounts/docs/OAuth2ServiceAccount)
33
- *
34
- * It's initialized using the json key file that's downloadable from developer
35
- * console, which should contain a private_key and client_email fields that it
36
- * uses.
37
- *
38
- * Use it with AuthTokenMiddleware to authorize http requests:
39
- *
40
- * use Google\Auth\Credentials\ServiceAccountCredentials;
41
- * use Google\Auth\Middleware\AuthTokenMiddleware;
42
- * use GuzzleHttp\Client;
43
- * use GuzzleHttp\HandlerStack;
44
- *
45
- * $sa = new ServiceAccountCredentials(
46
- * 'https://www.googleapis.com/auth/taskqueue',
47
- * '/path/to/your/json/key_file.json'
48
- * );
49
- * $middleware = new AuthTokenMiddleware($sa);
50
- * $stack = HandlerStack::create();
51
- * $stack->push($middleware);
52
- *
53
- * $client = new Client([
54
- * 'handler' => $stack,
55
- * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
56
- * 'auth' => 'google_auth' // authorize all requests
57
- * ]);
58
- *
59
- * $res = $client->get('myproject/taskqueues/myqueue');
60
- */
61
- class ServiceAccountCredentials extends CredentialsLoader implements
62
- GetQuotaProjectInterface,
63
- SignBlobInterface,
64
- ProjectIdProviderInterface
65
- {
66
- use ServiceAccountSignerTrait;
67
-
68
- /**
69
- * The OAuth2 instance used to conduct authorization.
70
- *
71
- * @var OAuth2
72
- */
73
- protected $auth;
74
-
75
- /**
76
- * The quota project associated with the JSON credentials
77
- *
78
- * @var string
79
- */
80
- protected $quotaProject;
81
-
82
- /*
83
- * @var string|null
84
- */
85
- protected $projectId;
86
-
87
- /**
88
- * Create a new ServiceAccountCredentials.
89
- *
90
- * @param string|array $scope the scope of the access request, expressed
91
- * either as an Array or as a space-delimited String.
92
- * @param string|array $jsonKey JSON credential file path or JSON credentials
93
- * as an associative array
94
- * @param string $sub an email address account to impersonate, in situations when
95
- * the service account has been delegated domain wide access.
96
- * @param string $targetAudience The audience for the ID token.
97
- */
98
- public function __construct(
99
- $scope,
100
- $jsonKey,
101
- $sub = null,
102
- $targetAudience = null
103
- ) {
104
- if (is_string($jsonKey)) {
105
- if (!file_exists($jsonKey)) {
106
- throw new \InvalidArgumentException('file does not exist');
107
- }
108
- $jsonKeyStream = file_get_contents($jsonKey);
109
- if (!$jsonKey = json_decode($jsonKeyStream, true)) {
110
- throw new \LogicException('invalid json for auth config');
111
- }
112
- }
113
- if (!array_key_exists('client_email', $jsonKey)) {
114
- throw new \InvalidArgumentException(
115
- 'json key is missing the client_email field'
116
- );
117
- }
118
- if (!array_key_exists('private_key', $jsonKey)) {
119
- throw new \InvalidArgumentException(
120
- 'json key is missing the private_key field'
121
- );
122
- }
123
- if (array_key_exists('quota_project_id', $jsonKey)) {
124
- $this->quotaProject = (string) $jsonKey['quota_project_id'];
125
- }
126
- if ($scope && $targetAudience) {
127
- throw new InvalidArgumentException(
128
- 'Scope and targetAudience cannot both be supplied'
129
- );
130
- }
131
- $additionalClaims = [];
132
- if ($targetAudience) {
133
- $additionalClaims = ['target_audience' => $targetAudience];
134
- }
135
- $this->auth = new OAuth2([
136
- 'audience' => self::TOKEN_CREDENTIAL_URI,
137
- 'issuer' => $jsonKey['client_email'],
138
- 'scope' => $scope,
139
- 'signingAlgorithm' => 'RS256',
140
- 'signingKey' => $jsonKey['private_key'],
141
- 'sub' => $sub,
142
- 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI,
143
- 'additionalClaims' => $additionalClaims,
144
- ]);
145
-
146
- $this->projectId = isset($jsonKey['project_id'])
147
- ? $jsonKey['project_id']
148
- : null;
149
- }
150
-
151
- /**
152
- * @param callable $httpHandler
153
- *
154
- * @return array A set of auth related metadata, containing the following
155
- * keys:
156
- * - access_token (string)
157
- * - expires_in (int)
158
- * - token_type (string)
159
- */
160
- public function fetchAuthToken(callable $httpHandler = null)
161
- {
162
- return $this->auth->fetchAuthToken($httpHandler);
163
- }
164
-
165
- /**
166
- * @return string
167
- */
168
- public function getCacheKey()
169
- {
170
- $key = $this->auth->getIssuer() . ':' . $this->auth->getCacheKey();
171
- if ($sub = $this->auth->getSub()) {
172
- $key .= ':' . $sub;
173
- }
174
-
175
- return $key;
176
- }
177
-
178
- /**
179
- * @return array
180
- */
181
- public function getLastReceivedToken()
182
- {
183
- return $this->auth->getLastReceivedToken();
184
- }
185
-
186
- /**
187
- * Get the project ID from the service account keyfile.
188
- *
189
- * Returns null if the project ID does not exist in the keyfile.
190
- *
191
- * @param callable $httpHandler Not used by this credentials type.
192
- * @return string|null
193
- */
194
- public function getProjectId(callable $httpHandler = null)
195
- {
196
- return $this->projectId;
197
- }
198
-
199
- /**
200
- * Updates metadata with the authorization token.
201
- *
202
- * @param array $metadata metadata hashmap
203
- * @param string $authUri optional auth uri
204
- * @param callable $httpHandler callback which delivers psr7 request
205
- * @return array updated metadata hashmap
206
- */
207
- public function updateMetadata(
208
- $metadata,
209
- $authUri = null,
210
- callable $httpHandler = null
211
- ) {
212
- // scope exists. use oauth implementation
213
- $scope = $this->auth->getScope();
214
- if (!is_null($scope)) {
215
- return parent::updateMetadata($metadata, $authUri, $httpHandler);
216
- }
217
-
218
- // no scope found. create jwt with the auth uri
219
- $credJson = array(
220
- 'private_key' => $this->auth->getSigningKey(),
221
- 'client_email' => $this->auth->getIssuer(),
222
- );
223
- $jwtCreds = new ServiceAccountJwtAccessCredentials($credJson);
224
-
225
- return $jwtCreds->updateMetadata($metadata, $authUri, $httpHandler);
226
- }
227
-
228
- /**
229
- * @param string $sub an email address account to impersonate, in situations when
230
- * the service account has been delegated domain wide access.
231
- */
232
- public function setSub($sub)
233
- {
234
- $this->auth->setSub($sub);
235
- }
236
-
237
- /**
238
- * Get the client name from the keyfile.
239
- *
240
- * In this case, it returns the keyfile's client_email key.
241
- *
242
- * @param callable $httpHandler Not used by this credentials type.
243
- * @return string
244
- */
245
- public function getClientName(callable $httpHandler = null)
246
- {
247
- return $this->auth->getIssuer();
248
- }
249
-
250
- /**
251
- * Get the quota project used for this API request
252
- *
253
- * @return string|null
254
- */
255
- public function getQuotaProject()
256
- {
257
- return $this->quotaProject;
258
- }
259
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php DELETED
@@ -1,191 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Credentials;
19
-
20
- use Google\Auth\CredentialsLoader;
21
- use Google\Auth\GetQuotaProjectInterface;
22
- use Google\Auth\OAuth2;
23
- use Google\Auth\ProjectIdProviderInterface;
24
- use Google\Auth\ServiceAccountSignerTrait;
25
- use Google\Auth\SignBlobInterface;
26
-
27
- /**
28
- * Authenticates requests using Google's Service Account credentials via
29
- * JWT Access.
30
- *
31
- * This class allows authorizing requests for service accounts directly
32
- * from credentials from a json key file downloaded from the developer
33
- * console (via 'Generate new Json Key'). It is not part of any OAuth2
34
- * flow, rather it creates a JWT and sends that as a credential.
35
- */
36
- class ServiceAccountJwtAccessCredentials extends CredentialsLoader implements
37
- GetQuotaProjectInterface,
38
- SignBlobInterface,
39
- ProjectIdProviderInterface
40
- {
41
- use ServiceAccountSignerTrait;
42
-
43
- /**
44
- * The OAuth2 instance used to conduct authorization.
45
- *
46
- * @var OAuth2
47
- */
48
- protected $auth;
49
-
50
- /**
51
- * The quota project associated with the JSON credentials
52
- */
53
- protected $quotaProject;
54
-
55
- /**
56
- * Create a new ServiceAccountJwtAccessCredentials.
57
- *
58
- * @param string|array $jsonKey JSON credential file path or JSON credentials
59
- * as an associative array
60
- */
61
- public function __construct($jsonKey)
62
- {
63
- if (is_string($jsonKey)) {
64
- if (!file_exists($jsonKey)) {
65
- throw new \InvalidArgumentException('file does not exist');
66
- }
67
- $jsonKeyStream = file_get_contents($jsonKey);
68
- if (!$jsonKey = json_decode($jsonKeyStream, true)) {
69
- throw new \LogicException('invalid json for auth config');
70
- }
71
- }
72
- if (!array_key_exists('client_email', $jsonKey)) {
73
- throw new \InvalidArgumentException(
74
- 'json key is missing the client_email field'
75
- );
76
- }
77
- if (!array_key_exists('private_key', $jsonKey)) {
78
- throw new \InvalidArgumentException(
79
- 'json key is missing the private_key field'
80
- );
81
- }
82
- if (array_key_exists('quota_project_id', $jsonKey)) {
83
- $this->quotaProject = (string) $jsonKey['quota_project_id'];
84
- }
85
- $this->auth = new OAuth2([
86
- 'issuer' => $jsonKey['client_email'],
87
- 'sub' => $jsonKey['client_email'],
88
- 'signingAlgorithm' => 'RS256',
89
- 'signingKey' => $jsonKey['private_key'],
90
- ]);
91
-
92
- $this->projectId = isset($jsonKey['project_id'])
93
- ? $jsonKey['project_id']
94
- : null;
95
- }
96
-
97
- /**
98
- * Updates metadata with the authorization token.
99
- *
100
- * @param array $metadata metadata hashmap
101
- * @param string $authUri optional auth uri
102
- * @param callable $httpHandler callback which delivers psr7 request
103
- * @return array updated metadata hashmap
104
- */
105
- public function updateMetadata(
106
- $metadata,
107
- $authUri = null,
108
- callable $httpHandler = null
109
- ) {
110
- if (empty($authUri)) {
111
- return $metadata;
112
- }
113
-
114
- $this->auth->setAudience($authUri);
115
-
116
- return parent::updateMetadata($metadata, $authUri, $httpHandler);
117
- }
118
-
119
- /**
120
- * Implements FetchAuthTokenInterface#fetchAuthToken.
121
- *
122
- * @param callable $httpHandler
123
- *
124
- * @return array|void A set of auth related metadata, containing the
125
- * following keys:
126
- * - access_token (string)
127
- */
128
- public function fetchAuthToken(callable $httpHandler = null)
129
- {
130
- $audience = $this->auth->getAudience();
131
- if (empty($audience)) {
132
- return null;
133
- }
134
-
135
- $access_token = $this->auth->toJwt();
136
-
137
- return array('access_token' => $access_token);
138
- }
139
-
140
- /**
141
- * @return string
142
- */
143
- public function getCacheKey()
144
- {
145
- return $this->auth->getCacheKey();
146
- }
147
-
148
- /**
149
- * @return array
150
- */
151
- public function getLastReceivedToken()
152
- {
153
- return $this->auth->getLastReceivedToken();
154
- }
155
-
156
- /**
157
- * Get the project ID from the service account keyfile.
158
- *
159
- * Returns null if the project ID does not exist in the keyfile.
160
- *
161
- * @param callable $httpHandler Not used by this credentials type.
162
- * @return string|null
163
- */
164
- public function getProjectId(callable $httpHandler = null)
165
- {
166
- return $this->projectId;
167
- }
168
-
169
- /**
170
- * Get the client name from the keyfile.
171
- *
172
- * In this case, it returns the keyfile's client_email key.
173
- *
174
- * @param callable $httpHandler Not used by this credentials type.
175
- * @return string
176
- */
177
- public function getClientName(callable $httpHandler = null)
178
- {
179
- return $this->auth->getIssuer();
180
- }
181
-
182
- /**
183
- * Get the quota project used for this API request
184
- *
185
- * @return string|null
186
- */
187
- public function getQuotaProject()
188
- {
189
- return $this->quotaProject;
190
- }
191
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Credentials/UserRefreshCredentials.php DELETED
@@ -1,138 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Credentials;
19
-
20
- use Google\Auth\CredentialsLoader;
21
- use Google\Auth\GetQuotaProjectInterface;
22
- use Google\Auth\OAuth2;
23
-
24
- /**
25
- * Authenticates requests using User Refresh credentials.
26
- *
27
- * This class allows authorizing requests from user refresh tokens.
28
- *
29
- * This the end of the result of a 3LO flow. E.g, the end result of
30
- * 'gcloud auth login' saves a file with these contents in well known
31
- * location
32
- *
33
- * @see [Application Default Credentials](http://goo.gl/mkAHpZ)
34
- */
35
- class UserRefreshCredentials extends CredentialsLoader implements GetQuotaProjectInterface
36
- {
37
- /**
38
- * The OAuth2 instance used to conduct authorization.
39
- *
40
- * @var OAuth2
41
- */
42
- protected $auth;
43
-
44
- /**
45
- * The quota project associated with the JSON credentials
46
- */
47
- protected $quotaProject;
48
-
49
- /**
50
- * Create a new UserRefreshCredentials.
51
- *
52
- * @param string|array $scope the scope of the access request, expressed
53
- * either as an Array or as a space-delimited String.
54
- * @param string|array $jsonKey JSON credential file path or JSON credentials
55
- * as an associative array
56
- */
57
- public function __construct(
58
- $scope,
59
- $jsonKey
60
- ) {
61
- if (is_string($jsonKey)) {
62
- if (!file_exists($jsonKey)) {
63
- throw new \InvalidArgumentException('file does not exist');
64
- }
65
- $jsonKeyStream = file_get_contents($jsonKey);
66
- if (!$jsonKey = json_decode($jsonKeyStream, true)) {
67
- throw new \LogicException('invalid json for auth config');
68
- }
69
- }
70
- if (!array_key_exists('client_id', $jsonKey)) {
71
- throw new \InvalidArgumentException(
72
- 'json key is missing the client_id field'
73
- );
74
- }
75
- if (!array_key_exists('client_secret', $jsonKey)) {
76
- throw new \InvalidArgumentException(
77
- 'json key is missing the client_secret field'
78
- );
79
- }
80
- if (!array_key_exists('refresh_token', $jsonKey)) {
81
- throw new \InvalidArgumentException(
82
- 'json key is missing the refresh_token field'
83
- );
84
- }
85
- $this->auth = new OAuth2([
86
- 'clientId' => $jsonKey['client_id'],
87
- 'clientSecret' => $jsonKey['client_secret'],
88
- 'refresh_token' => $jsonKey['refresh_token'],
89
- 'scope' => $scope,
90
- 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI,
91
- ]);
92
- if (array_key_exists('quota_project_id', $jsonKey)) {
93
- $this->quotaProject = (string) $jsonKey['quota_project_id'];
94
- }
95
- }
96
-
97
- /**
98
- * @param callable $httpHandler
99
- *
100
- * @return array A set of auth related metadata, containing the following
101
- * keys:
102
- * - access_token (string)
103
- * - expires_in (int)
104
- * - scope (string)
105
- * - token_type (string)
106
- * - id_token (string)
107
- */
108
- public function fetchAuthToken(callable $httpHandler = null)
109
- {
110
- return $this->auth->fetchAuthToken($httpHandler);
111
- }
112
-
113
- /**
114
- * @return string
115
- */
116
- public function getCacheKey()
117
- {
118
- return $this->auth->getClientId() . ':' . $this->auth->getCacheKey();
119
- }
120
-
121
- /**
122
- * @return array
123
- */
124
- public function getLastReceivedToken()
125
- {
126
- return $this->auth->getLastReceivedToken();
127
- }
128
-
129
- /**
130
- * Get the quota project used for this API request
131
- *
132
- * @return string|null
133
- */
134
- public function getQuotaProject()
135
- {
136
- return $this->quotaProject;
137
- }
138
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/CredentialsLoader.php DELETED
@@ -1,241 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- use Google\Auth\Credentials\InsecureCredentials;
21
- use Google\Auth\Credentials\ServiceAccountCredentials;
22
- use Google\Auth\Credentials\UserRefreshCredentials;
23
- use GuzzleHttp\ClientInterface;
24
-
25
- /**
26
- * CredentialsLoader contains the behaviour used to locate and find default
27
- * credentials files on the file system.
28
- */
29
- abstract class CredentialsLoader implements
30
- FetchAuthTokenInterface,
31
- UpdateMetadataInterface
32
- {
33
- const TOKEN_CREDENTIAL_URI = 'https://oauth2.googleapis.com/token';
34
- const ENV_VAR = 'GOOGLE_APPLICATION_CREDENTIALS';
35
- const WELL_KNOWN_PATH = 'gcloud/application_default_credentials.json';
36
- const NON_WINDOWS_WELL_KNOWN_PATH_BASE = '.config';
37
-
38
- /**
39
- * @param string $cause
40
- * @return string
41
- */
42
- private static function unableToReadEnv($cause)
43
- {
44
- $msg = 'Unable to read the credential file specified by ';
45
- $msg .= ' GOOGLE_APPLICATION_CREDENTIALS: ';
46
- $msg .= $cause;
47
-
48
- return $msg;
49
- }
50
-
51
- /**
52
- * @return bool
53
- */
54
- private static function isOnWindows()
55
- {
56
- return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
57
- }
58
-
59
- /**
60
- * Returns the currently available major Guzzle version.
61
- *
62
- * @return int
63
- */
64
- private static function getGuzzleMajorVersion()
65
- {
66
- if (defined('GuzzleHttp\ClientInterface::MAJOR_VERSION')) {
67
- return ClientInterface::MAJOR_VERSION;
68
- }
69
-
70
- if (defined('GuzzleHttp\ClientInterface::VERSION')) {
71
- return (int) substr(ClientInterface::VERSION, 0, 1);
72
- }
73
-
74
- throw new \Exception('Version not supported');
75
- }
76
-
77
- /**
78
- * Load a JSON key from the path specified in the environment.
79
- *
80
- * Load a JSON key from the path specified in the environment
81
- * variable GOOGLE_APPLICATION_CREDENTIALS. Return null if
82
- * GOOGLE_APPLICATION_CREDENTIALS is not specified.
83
- *
84
- * @return array|null JSON key | null
85
- */
86
- public static function fromEnv()
87
- {
88
- $path = getenv(self::ENV_VAR);
89
- if (empty($path)) {
90
- return;
91
- }
92
- if (!file_exists($path)) {
93
- $cause = 'file ' . $path . ' does not exist';
94
- throw new \DomainException(self::unableToReadEnv($cause));
95
- }
96
- $jsonKey = file_get_contents($path);
97
- return json_decode($jsonKey, true);
98
- }
99
-
100
- /**
101
- * Load a JSON key from a well known path.
102
- *
103
- * The well known path is OS dependent:
104
- *
105
- * * windows: %APPDATA%/gcloud/application_default_credentials.json
106
- * * others: $HOME/.config/gcloud/application_default_credentials.json
107
- *
108
- * If the file does not exist, this returns null.
109
- *
110
- * @return array|null JSON key | null
111
- */
112
- public static function fromWellKnownFile()
113
- {
114
- $rootEnv = self::isOnWindows() ? 'APPDATA' : 'HOME';
115
- $path = [getenv($rootEnv)];
116
- if (!self::isOnWindows()) {
117
- $path[] = self::NON_WINDOWS_WELL_KNOWN_PATH_BASE;
118
- }
119
- $path[] = self::WELL_KNOWN_PATH;
120
- $path = implode(DIRECTORY_SEPARATOR, $path);
121
- if (!file_exists($path)) {
122
- return;
123
- }
124
- $jsonKey = file_get_contents($path);
125
- return json_decode($jsonKey, true);
126
- }
127
-
128
- /**
129
- * Create a new Credentials instance.
130
- *
131
- * @param string|array $scope the scope of the access request, expressed
132
- * either as an Array or as a space-delimited String.
133
- * @param array $jsonKey the JSON credentials.
134
- * @return ServiceAccountCredentials|UserRefreshCredentials
135
- */
136
- public static function makeCredentials($scope, array $jsonKey)
137
- {
138
- if (!array_key_exists('type', $jsonKey)) {
139
- throw new \InvalidArgumentException('json key is missing the type field');
140
- }
141
-
142
- if ($jsonKey['type'] == 'service_account') {
143
- return new ServiceAccountCredentials($scope, $jsonKey);
144
- }
145
-
146
- if ($jsonKey['type'] == 'authorized_user') {
147
- return new UserRefreshCredentials($scope, $jsonKey);
148
- }
149
-
150
- throw new \InvalidArgumentException('invalid value in the type field');
151
- }
152
-
153
- /**
154
- * Create an authorized HTTP Client from an instance of FetchAuthTokenInterface.
155
- *
156
- * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
157
- * @param array $httpClientOptions (optional) Array of request options to apply.
158
- * @param callable $httpHandler (optional) http client to fetch the token.
159
- * @param callable $tokenCallback (optional) function to be called when a new token is fetched.
160
- * @return \GuzzleHttp\Client
161
- */
162
- public static function makeHttpClient(
163
- FetchAuthTokenInterface $fetcher,
164
- array $httpClientOptions = [],
165
- callable $httpHandler = null,
166
- callable $tokenCallback = null
167
- ) {
168
- if (self::getGuzzleMajorVersion() === 5) {
169
- $client = new \GuzzleHttp\Client($httpClientOptions);
170
- $client->setDefaultOption('auth', 'google_auth');
171
- $subscriber = new Subscriber\AuthTokenSubscriber(
172
- $fetcher,
173
- $httpHandler,
174
- $tokenCallback
175
- );
176
- $client->getEmitter()->attach($subscriber);
177
- return $client;
178
- }
179
-
180
- $middleware = new Middleware\AuthTokenMiddleware(
181
- $fetcher,
182
- $httpHandler,
183
- $tokenCallback
184
- );
185
- $stack = \GuzzleHttp\HandlerStack::create();
186
- $stack->push($middleware);
187
-
188
- return new \GuzzleHttp\Client([
189
- 'handler' => $stack,
190
- 'auth' => 'google_auth',
191
- ] + $httpClientOptions);
192
- }
193
-
194
- /**
195
- * Create a new instance of InsecureCredentials.
196
- *
197
- * @return InsecureCredentials
198
- */
199
- public static function makeInsecureCredentials()
200
- {
201
- return new InsecureCredentials();
202
- }
203
-
204
- /**
205
- * export a callback function which updates runtime metadata.
206
- *
207
- * @return array updateMetadata function
208
- * @deprecated
209
- */
210
- public function getUpdateMetadataFunc()
211
- {
212
- return array($this, 'updateMetadata');
213
- }
214
-
215
- /**
216
- * Updates metadata with the authorization token.
217
- *
218
- * @param array $metadata metadata hashmap
219
- * @param string $authUri optional auth uri
220
- * @param callable $httpHandler callback which delivers psr7 request
221
- * @return array updated metadata hashmap
222
- */
223
- public function updateMetadata(
224
- $metadata,
225
- $authUri = null,
226
- callable $httpHandler = null
227
- ) {
228
- if (isset($metadata[self::AUTH_METADATA_KEY])) {
229
- // Auth metadata has already been set
230
- return $metdadata;
231
- }
232
- $result = $this->fetchAuthToken($httpHandler);
233
- if (!isset($result['access_token'])) {
234
- return $metadata;
235
- }
236
- $metadata_copy = $metadata;
237
- $metadata_copy[self::AUTH_METADATA_KEY] = array('Bearer ' . $result['access_token']);
238
-
239
- return $metadata_copy;
240
- }
241
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/FetchAuthTokenCache.php DELETED
@@ -1,231 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2010 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- use Psr\Cache\CacheItemPoolInterface;
21
-
22
- /**
23
- * A class to implement caching for any object implementing
24
- * FetchAuthTokenInterface
25
- */
26
- class FetchAuthTokenCache implements
27
- FetchAuthTokenInterface,
28
- GetQuotaProjectInterface,
29
- SignBlobInterface,
30
- ProjectIdProviderInterface,
31
- UpdateMetadataInterface
32
- {
33
- use CacheTrait;
34
-
35
- /**
36
- * @var FetchAuthTokenInterface
37
- */
38
- private $fetcher;
39
-
40
- /**
41
- * @var array
42
- */
43
- private $cacheConfig;
44
-
45
- /**
46
- * @var CacheItemPoolInterface
47
- */
48
- private $cache;
49
-
50
- /**
51
- * @param FetchAuthTokenInterface $fetcher A credentials fetcher
52
- * @param array $cacheConfig Configuration for the cache
53
- * @param CacheItemPoolInterface $cache
54
- */
55
- public function __construct(
56
- FetchAuthTokenInterface $fetcher,
57
- array $cacheConfig = null,
58
- CacheItemPoolInterface $cache
59
- ) {
60
- $this->fetcher = $fetcher;
61
- $this->cache = $cache;
62
- $this->cacheConfig = array_merge([
63
- 'lifetime' => 1500,
64
- 'prefix' => '',
65
- ], (array) $cacheConfig);
66
- }
67
-
68
- /**
69
- * Implements FetchAuthTokenInterface#fetchAuthToken.
70
- *
71
- * Checks the cache for a valid auth token and fetches the auth tokens
72
- * from the supplied fetcher.
73
- *
74
- * @param callable $httpHandler callback which delivers psr7 request
75
- * @return array the response
76
- * @throws \Exception
77
- */
78
- public function fetchAuthToken(callable $httpHandler = null)
79
- {
80
- // Use the cached value if its available.
81
- //
82
- // TODO: correct caching; update the call to setCachedValue to set the expiry
83
- // to the value returned with the auth token.
84
- //
85
- // TODO: correct caching; enable the cache to be cleared.
86
- $cacheKey = $this->fetcher->getCacheKey();
87
- $cached = $this->getCachedValue($cacheKey);
88
- if (is_array($cached)) {
89
- if (empty($cached['expires_at'])) {
90
- // If there is no expiration data, assume token is not expired.
91
- // (for JwtAccess and ID tokens)
92
- return $cached;
93
- }
94
- if (time() < $cached['expires_at']) {
95
- // access token is not expired
96
- return $cached;
97
- }
98
- }
99
-
100
- $auth_token = $this->fetcher->fetchAuthToken($httpHandler);
101
-
102
- if (isset($auth_token['access_token']) ||
103
- isset($auth_token['id_token'])) {
104
- $this->setCachedValue($cacheKey, $auth_token);
105
- }
106
-
107
- return $auth_token;
108
- }
109
-
110
- /**
111
- * @return string
112
- */
113
- public function getCacheKey()
114
- {
115
- return $this->getFullCacheKey($this->fetcher->getCacheKey());
116
- }
117
-
118
- /**
119
- * @return array|null
120
- */
121
- public function getLastReceivedToken()
122
- {
123
- return $this->fetcher->getLastReceivedToken();
124
- }
125
-
126
- /**
127
- * Get the client name from the fetcher.
128
- *
129
- * @param callable $httpHandler An HTTP handler to deliver PSR7 requests.
130
- * @return string
131
- */
132
- public function getClientName(callable $httpHandler = null)
133
- {
134
- return $this->fetcher->getClientName($httpHandler);
135
- }
136
-
137
- /**
138
- * Sign a blob using the fetcher.
139
- *
140
- * @param string $stringToSign The string to sign.
141
- * @param bool $forceOpenSsl Require use of OpenSSL for local signing. Does
142
- * not apply to signing done using external services. **Defaults to**
143
- * `false`.
144
- * @return string The resulting signature.
145
- * @throws \RuntimeException If the fetcher does not implement
146
- * `Google\Auth\SignBlobInterface`.
147
- */
148
- public function signBlob($stringToSign, $forceOpenSsl = false)
149
- {
150
- if (!$this->fetcher instanceof SignBlobInterface) {
151
- throw new \RuntimeException(
152
- 'Credentials fetcher does not implement ' .
153
- 'Google\Auth\SignBlobInterface'
154
- );
155
- }
156
-
157
- return $this->fetcher->signBlob($stringToSign, $forceOpenSsl);
158
- }
159
-
160
- /**
161
- * Get the quota project used for this API request from the credentials
162
- * fetcher.
163
- *
164
- * @return string|null
165
- */
166
- public function getQuotaProject()
167
- {
168
- if ($this->fetcher instanceof GetQuotaProjectInterface) {
169
- return $this->fetcher->getQuotaProject();
170
- }
171
- }
172
-
173
- /*
174
- * Get the Project ID from the fetcher.
175
- *
176
- * @param callable $httpHandler Callback which delivers psr7 request
177
- * @return string|null
178
- * @throws \RuntimeException If the fetcher does not implement
179
- * `Google\Auth\ProvidesProjectIdInterface`.
180
- */
181
- public function getProjectId(callable $httpHandler = null)
182
- {
183
- if (!$this->fetcher instanceof ProjectIdProviderInterface) {
184
- throw new \RuntimeException(
185
- 'Credentials fetcher does not implement ' .
186
- 'Google\Auth\ProvidesProjectIdInterface'
187
- );
188
- }
189
-
190
- return $this->fetcher->getProjectId($httpHandler);
191
- }
192
-
193
- /**
194
- * Updates metadata with the authorization token.
195
- *
196
- * @param array $metadata metadata hashmap
197
- * @param string $authUri optional auth uri
198
- * @param callable $httpHandler callback which delivers psr7 request
199
- * @return array updated metadata hashmap
200
- * @throws \RuntimeException If the fetcher does not implement
201
- * `Google\Auth\UpdateMetadataInterface`.
202
- */
203
- public function updateMetadata(
204
- $metadata,
205
- $authUri = null,
206
- callable $httpHandler = null
207
- ) {
208
- if (!$this->fetcher instanceof UpdateMetadataInterface) {
209
- throw new \RuntimeException(
210
- 'Credentials fetcher does not implement ' .
211
- 'Google\Auth\UpdateMetadataInterface'
212
- );
213
- }
214
-
215
- // Set the `Authentication` header from the cache, so it is not set
216
- // again by the fetcher
217
- $result = $this->fetchAuthToken($httpHandler);
218
-
219
- if (isset($result['access_token'])) {
220
- $metadata[self::AUTH_METADATA_KEY] = [
221
- 'Bearer ' . $result['access_token']
222
- ];
223
- }
224
-
225
- return $this->fetcher->updateMetadata(
226
- $metadata,
227
- $authUri,
228
- $httpHandler
229
- );
230
- }
231
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/FetchAuthTokenInterface.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- /**
21
- * An interface implemented by objects that can fetch auth tokens.
22
- */
23
- interface FetchAuthTokenInterface
24
- {
25
- /**
26
- * Fetches the auth tokens based on the current state.
27
- *
28
- * @param callable $httpHandler callback which delivers psr7 request
29
- * @return array a hash of auth tokens
30
- */
31
- public function fetchAuthToken(callable $httpHandler = null);
32
-
33
- /**
34
- * Obtains a key that can used to cache the results of #fetchAuthToken.
35
- *
36
- * If the value is empty, the auth token is not cached.
37
- *
38
- * @return string a key that may be used to cache the auth token.
39
- */
40
- public function getCacheKey();
41
-
42
- /**
43
- * Returns an associative array with the token and
44
- * expiration time.
45
- *
46
- * @return null|array {
47
- * The last received access token.
48
- *
49
- * @var string $access_token The access token string.
50
- * @var int $expires_at The time the token expires as a UNIX timestamp.
51
- * }
52
- */
53
- public function getLastReceivedToken();
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/GCECache.php DELETED
@@ -1,92 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2020 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- use Google\Auth\Credentials\GCECredentials;
21
- use Psr\Cache\CacheItemPoolInterface;
22
-
23
- /**
24
- * A class to implement caching for calls to GCECredentials::onGce. This class
25
- * is used automatically when you pass a `Psr\Cache\CacheItemPoolInterface`
26
- * cache object to `ApplicationDefaultCredentials::getCredentials`.
27
- *
28
- * ```
29
- * $sysvCache = new Google\Auth\SysvCacheItemPool();
30
- * $creds = Google\Auth\ApplicationDefaultCredentials::getCredentials(
31
- * $scope,
32
- * null,
33
- * null,
34
- * $sysvCache
35
- * );
36
- * ```
37
- */
38
- class GCECache
39
- {
40
- const GCE_CACHE_KEY = 'google_auth_on_gce_cache';
41
-
42
- use CacheTrait;
43
-
44
- /**
45
- * @var array
46
- */
47
- private $cacheConfig;
48
-
49
- /**
50
- * @var CacheItemPoolInterface
51
- */
52
- private $cache;
53
-
54
- /**
55
- * @param array $cacheConfig Configuration for the cache
56
- * @param CacheItemPoolInterface $cache
57
- */
58
- public function __construct(
59
- array $cacheConfig = null,
60
- CacheItemPoolInterface $cache = null
61
- ) {
62
- $this->cache = $cache;
63
- $this->cacheConfig = array_merge([
64
- 'lifetime' => 1500,
65
- 'prefix' => '',
66
- ], (array) $cacheConfig);
67
- }
68
-
69
- /**
70
- * Caches the result of onGce so the metadata server is not called multiple
71
- * times.
72
- *
73
- * @param callable $httpHandler callback which delivers psr7 request
74
- * @return bool True if this a GCEInstance, false otherwise
75
- */
76
- public function onGce(callable $httpHandler = null)
77
- {
78
- if (is_null($this->cache)) {
79
- return GCECredentials::onGce($httpHandler);
80
- }
81
-
82
- $cacheKey = self::GCE_CACHE_KEY;
83
- $onGce = $this->getCachedValue($cacheKey);
84
-
85
- if (is_null($onGce)) {
86
- $onGce = GCECredentials::onGce($httpHandler);
87
- $this->setCachedValue($cacheKey, $onGce);
88
- }
89
-
90
- return $onGce;
91
- }
92
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/GetQuotaProjectInterface.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2019 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- /**
21
- * An interface implemented by objects that can get quota projects.
22
- */
23
- interface GetQuotaProjectInterface
24
- {
25
- const X_GOOG_USER_PROJECT_HEADER = 'X-Goog-User-Project';
26
-
27
- /**
28
- * Get the quota project used for this API request
29
- *
30
- * @return string|null
31
- */
32
- public function getQuotaProject();
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/HttpHandler/Guzzle5HttpHandler.php DELETED
@@ -1,126 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2015 Google Inc. All Rights Reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- namespace Google\Auth\HttpHandler;
18
-
19
- use Exception;
20
- use GuzzleHttp\ClientInterface;
21
- use GuzzleHttp\Message\ResponseInterface as Guzzle5ResponseInterface;
22
- use GuzzleHttp\Promise\Promise;
23
- use GuzzleHttp\Promise\RejectedPromise;
24
- use GuzzleHttp\Psr7\Response;
25
- use Psr\Http\Message\RequestInterface;
26
- use Psr\Http\Message\ResponseInterface;
27
-
28
- class Guzzle5HttpHandler
29
- {
30
- /**
31
- * @var ClientInterface
32
- */
33
- private $client;
34
-
35
- /**
36
- * @param ClientInterface $client
37
- */
38
- public function __construct(ClientInterface $client)
39
- {
40
- $this->client = $client;
41
- }
42
-
43
- /**
44
- * Accepts a PSR-7 Request and an array of options and returns a PSR-7 response.
45
- *
46
- * @param RequestInterface $request
47
- * @param array $options
48
- * @return ResponseInterface
49
- */
50
- public function __invoke(RequestInterface $request, array $options = [])
51
- {
52
- $response = $this->client->send(
53
- $this->createGuzzle5Request($request, $options)
54
- );
55
-
56
- return $this->createPsr7Response($response);
57
- }
58
-
59
- /**
60
- * Accepts a PSR-7 request and an array of options and returns a PromiseInterface
61
- *
62
- * @param RequestInterface $request
63
- * @param array $options
64
- * @return Promise
65
- */
66
- public function async(RequestInterface $request, array $options = [])
67
- {
68
- if (!class_exists('GuzzleHttp\Promise\Promise')) {
69
- throw new Exception('Install guzzlehttp/promises to use async with Guzzle 5');
70
- }
71
-
72
- $futureResponse = $this->client->send(
73
- $this->createGuzzle5Request(
74
- $request,
75
- ['future' => true] + $options
76
- )
77
- );
78
-
79
- $promise = new Promise(
80
- function () use ($futureResponse) {
81
- try {
82
- $futureResponse->wait();
83
- } catch (Exception $e) {
84
- // The promise is already delivered when the exception is
85
- // thrown, so don't rethrow it.
86
- }
87
- },
88
- [$futureResponse, 'cancel']
89
- );
90
-
91
- $futureResponse->then([$promise, 'resolve'], [$promise, 'reject']);
92
-
93
- return $promise->then(
94
- function (Guzzle5ResponseInterface $response) {
95
- // Adapt the Guzzle 5 Response to a PSR-7 Response.
96
- return $this->createPsr7Response($response);
97
- },
98
- function (Exception $e) {
99
- return new RejectedPromise($e);
100
- }
101
- );
102
- }
103
-
104
- private function createGuzzle5Request(RequestInterface $request, array $options)
105
- {
106
- return $this->client->createRequest(
107
- $request->getMethod(),
108
- $request->getUri(),
109
- array_merge_recursive([
110
- 'headers' => $request->getHeaders(),
111
- 'body' => $request->getBody(),
112
- ], $options)
113
- );
114
- }
115
-
116
- private function createPsr7Response(Guzzle5ResponseInterface $response)
117
- {
118
- return new Response(
119
- $response->getStatusCode(),
120
- $response->getHeaders() ?: [],
121
- $response->getBody(),
122
- $response->getProtocolVersion(),
123
- $response->getReasonPhrase()
124
- );
125
- }
126
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/HttpHandler/Guzzle6HttpHandler.php DELETED
@@ -1,62 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2015 Google Inc. All Rights Reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- namespace Google\Auth\HttpHandler;
18
-
19
- use GuzzleHttp\ClientInterface;
20
- use Psr\Http\Message\RequestInterface;
21
- use Psr\Http\Message\ResponseInterface;
22
-
23
- class Guzzle6HttpHandler
24
- {
25
- /**
26
- * @var ClientInterface
27
- */
28
- private $client;
29
-
30
- /**
31
- * @param ClientInterface $client
32
- */
33
- public function __construct(ClientInterface $client)
34
- {
35
- $this->client = $client;
36
- }
37
-
38
- /**
39
- * Accepts a PSR-7 request and an array of options and returns a PSR-7 response.
40
- *
41
- * @param RequestInterface $request
42
- * @param array $options
43
- * @return ResponseInterface
44
- */
45
- public function __invoke(RequestInterface $request, array $options = [])
46
- {
47
- return $this->client->send($request, $options);
48
- }
49
-
50
- /**
51
- * Accepts a PSR-7 request and an array of options and returns a PromiseInterface
52
- *
53
- * @param RequestInterface $request
54
- * @param array $options
55
- *
56
- * @return \GuzzleHttp\Promise\PromiseInterface
57
- */
58
- public function async(RequestInterface $request, array $options = [])
59
- {
60
- return $this->client->sendAsync($request, $options);
61
- }
62
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/HttpHandler/Guzzle7HttpHandler.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2020 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- namespace Google\Auth\HttpHandler;
18
-
19
- class Guzzle7HttpHandler extends Guzzle6HttpHandler
20
- {
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/HttpHandler/HttpClientCache.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2019 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\HttpHandler;
19
-
20
- use GuzzleHttp\ClientInterface;
21
-
22
- /**
23
- * Stores an HTTP Client in order to prevent multiple instantiations.
24
- */
25
- class HttpClientCache
26
- {
27
- /**
28
- * @var ClientInterface|null
29
- */
30
- private static $httpClient;
31
-
32
- /**
33
- * Cache an HTTP Client for later calls.
34
- *
35
- * Passing null will unset the cached client.
36
- *
37
- * @param ClientInterface|null $client
38
- * @return void
39
- */
40
- public static function setHttpClient(ClientInterface $client = null)
41
- {
42
- self::$httpClient = $client;
43
- }
44
-
45
- /**
46
- * Get the stored HTTP Client, or null.
47
- *
48
- * @return ClientInterface|null
49
- */
50
- public static function getHttpClient()
51
- {
52
- return self::$httpClient;
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php DELETED
@@ -1,53 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2015 Google Inc. All Rights Reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- namespace Google\Auth\HttpHandler;
18
-
19
- use GuzzleHttp\Client;
20
- use GuzzleHttp\ClientInterface;
21
-
22
- class HttpHandlerFactory
23
- {
24
- /**
25
- * Builds out a default http handler for the installed version of guzzle.
26
- *
27
- * @param ClientInterface $client
28
- * @return Guzzle5HttpHandler|Guzzle6HttpHandler|Guzzle7HttpHandler
29
- * @throws \Exception
30
- */
31
- public static function build(ClientInterface $client = null)
32
- {
33
- $client = $client ?: new Client();
34
-
35
- $version = null;
36
- if (defined('GuzzleHttp\ClientInterface::MAJOR_VERSION')) {
37
- $version = ClientInterface::MAJOR_VERSION;
38
- } elseif (defined('GuzzleHttp\ClientInterface::VERSION')) {
39
- $version = (int) substr(ClientInterface::VERSION, 0, 1);
40
- }
41
-
42
- switch ($version) {
43
- case 5:
44
- return new Guzzle5HttpHandler($client);
45
- case 6:
46
- return new Guzzle6HttpHandler($client);
47
- case 7:
48
- return new Guzzle7HttpHandler($client);
49
- default:
50
- throw new \Exception('Version not supported');
51
- }
52
- }
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Iam.php DELETED
@@ -1,99 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2019 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- use Google\Auth\HttpHandler\HttpClientCache;
21
- use Google\Auth\HttpHandler\HttpHandlerFactory;
22
- use GuzzleHttp\Psr7;
23
-
24
- /**
25
- * Tools for using the IAM API.
26
- *
27
- * @see https://cloud.google.com/iam/docs IAM Documentation
28
- */
29
- class Iam
30
- {
31
- const IAM_API_ROOT = 'https://iamcredentials.googleapis.com/v1';
32
- const SIGN_BLOB_PATH = '%s:signBlob?alt=json';
33
- const SERVICE_ACCOUNT_NAME = 'projects/-/serviceAccounts/%s';
34
-
35
- /**
36
- * @var callable
37
- */
38
- private $httpHandler;
39
-
40
- /**
41
- * @param callable $httpHandler [optional] The HTTP Handler to send requests.
42
- */
43
- public function __construct(callable $httpHandler = null)
44
- {
45
- $this->httpHandler = $httpHandler
46
- ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
47
- }
48
-
49
- /**
50
- * Sign a string using the IAM signBlob API.
51
- *
52
- * Note that signing using IAM requires your service account to have the
53
- * `iam.serviceAccounts.signBlob` permission, part of the "Service Account
54
- * Token Creator" IAM role.
55
- *
56
- * @param string $email The service account email.
57
- * @param string $accessToken An access token from the service account.
58
- * @param string $stringToSign The string to be signed.
59
- * @param array $delegates [optional] A list of service account emails to
60
- * add to the delegate chain. If omitted, the value of `$email` will
61
- * be used.
62
- * @return string The signed string, base64-encoded.
63
- */
64
- public function signBlob($email, $accessToken, $stringToSign, array $delegates = [])
65
- {
66
- $httpHandler = $this->httpHandler;
67
- $name = sprintf(self::SERVICE_ACCOUNT_NAME, $email);
68
- $uri = self::IAM_API_ROOT . '/' . sprintf(self::SIGN_BLOB_PATH, $name);
69
-
70
- if ($delegates) {
71
- foreach ($delegates as &$delegate) {
72
- $delegate = sprintf(self::SERVICE_ACCOUNT_NAME, $delegate);
73
- }
74
- } else {
75
- $delegates = [$name];
76
- }
77
-
78
- $body = [
79
- 'delegates' => $delegates,
80
- 'payload' => base64_encode($stringToSign),
81
- ];
82
-
83
- $headers = [
84
- 'Authorization' => 'Bearer ' . $accessToken
85
- ];
86
-
87
- $request = new Psr7\Request(
88
- 'POST',
89
- $uri,
90
- $headers,
91
- Psr7\stream_for(json_encode($body))
92
- );
93
-
94
- $res = $httpHandler($request);
95
- $body = json_decode((string) $res->getBody(), true);
96
-
97
- return $body['signedBlob'];
98
- }
99
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Middleware/AuthTokenMiddleware.php DELETED
@@ -1,148 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Middleware;
19
-
20
- use Google\Auth\FetchAuthTokenInterface;
21
- use Google\Auth\GetQuotaProjectInterface;
22
- use Psr\Http\Message\RequestInterface;
23
-
24
- /**
25
- * AuthTokenMiddleware is a Guzzle Middleware that adds an Authorization header
26
- * provided by an object implementing FetchAuthTokenInterface.
27
- *
28
- * The FetchAuthTokenInterface#fetchAuthToken is used to obtain a hash; one of
29
- * the values value in that hash is added as the authorization header.
30
- *
31
- * Requests will be accessed with the authorization header:
32
- *
33
- * 'authorization' 'Bearer <value of auth_token>'
34
- */
35
- class AuthTokenMiddleware
36
- {
37
- /**
38
- * @var callback
39
- */
40
- private $httpHandler;
41
-
42
- /**
43
- * @var FetchAuthTokenInterface
44
- */
45
- private $fetcher;
46
-
47
- /**
48
- * @var callable
49
- */
50
- private $tokenCallback;
51
-
52
- /**
53
- * Creates a new AuthTokenMiddleware.
54
- *
55
- * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
56
- * @param callable $httpHandler (optional) callback which delivers psr7 request
57
- * @param callable $tokenCallback (optional) function to be called when a new token is fetched.
58
- */
59
- public function __construct(
60
- FetchAuthTokenInterface $fetcher,
61
- callable $httpHandler = null,
62
- callable $tokenCallback = null
63
- ) {
64
- $this->fetcher = $fetcher;
65
- $this->httpHandler = $httpHandler;
66
- $this->tokenCallback = $tokenCallback;
67
- }
68
-
69
- /**
70
- * Updates the request with an Authorization header when auth is 'google_auth'.
71
- *
72
- * use Google\Auth\Middleware\AuthTokenMiddleware;
73
- * use Google\Auth\OAuth2;
74
- * use GuzzleHttp\Client;
75
- * use GuzzleHttp\HandlerStack;
76
- *
77
- * $config = [..<oauth config param>.];
78
- * $oauth2 = new OAuth2($config)
79
- * $middleware = new AuthTokenMiddleware($oauth2);
80
- * $stack = HandlerStack::create();
81
- * $stack->push($middleware);
82
- *
83
- * $client = new Client([
84
- * 'handler' => $stack,
85
- * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
86
- * 'auth' => 'google_auth' // authorize all requests
87
- * ]);
88
- *
89
- * $res = $client->get('myproject/taskqueues/myqueue');
90
- *
91
- * @param callable $handler
92
- * @return \Closure
93
- */
94
- public function __invoke(callable $handler)
95
- {
96
- return function (RequestInterface $request, array $options) use ($handler) {
97
- // Requests using "auth"="google_auth" will be authorized.
98
- if (!isset($options['auth']) || $options['auth'] !== 'google_auth') {
99
- return $handler($request, $options);
100
- }
101
-
102
- $request = $request->withHeader('authorization', 'Bearer ' . $this->fetchToken());
103
-
104
- if ($quotaProject = $this->getQuotaProject()) {
105
- $request = $request->withHeader(
106
- GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER,
107
- $quotaProject
108
- );
109
- }
110
-
111
- return $handler($request, $options);
112
- };
113
- }
114
-
115
- /**
116
- * Call fetcher to fetch the token.
117
- *
118
- * @return string
119
- */
120
- private function fetchToken()
121
- {
122
- $auth_tokens = $this->fetcher->fetchAuthToken($this->httpHandler);
123
-
124
- if (array_key_exists('access_token', $auth_tokens)) {
125
- // notify the callback if applicable
126
- if ($this->tokenCallback) {
127
- call_user_func(
128
- $this->tokenCallback,
129
- $this->fetcher->getCacheKey(),
130
- $auth_tokens['access_token']
131
- );
132
- }
133
-
134
- return $auth_tokens['access_token'];
135
- }
136
-
137
- if (array_key_exists('id_token', $auth_tokens)) {
138
- return $auth_tokens['id_token'];
139
- }
140
- }
141
-
142
- private function getQuotaProject()
143
- {
144
- if ($this->fetcher instanceof GetQuotaProjectInterface) {
145
- return $this->fetcher->getQuotaProject();
146
- }
147
- }
148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php DELETED
@@ -1,175 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Middleware;
19
-
20
- use Google\Auth\CacheTrait;
21
- use Psr\Cache\CacheItemPoolInterface;
22
- use Psr\Http\Message\RequestInterface;
23
-
24
- /**
25
- * ScopedAccessTokenMiddleware is a Guzzle Middleware that adds an Authorization
26
- * header provided by a closure.
27
- *
28
- * The closure returns an access token, taking the scope, either a single
29
- * string or an array of strings, as its value. If provided, a cache will be
30
- * used to preserve the access token for a given lifetime.
31
- *
32
- * Requests will be accessed with the authorization header:
33
- *
34
- * 'authorization' 'Bearer <value of auth_token>'
35
- */
36
- class ScopedAccessTokenMiddleware
37
- {
38
- use CacheTrait;
39
-
40
- const DEFAULT_CACHE_LIFETIME = 1500;
41
-
42
- /**
43
- * @var CacheItemPoolInterface
44
- */
45
- private $cache;
46
-
47
- /**
48
- * @var array configuration
49
- */
50
- private $cacheConfig;
51
-
52
- /**
53
- * @var callable
54
- */
55
- private $tokenFunc;
56
-
57
- /**
58
- * @var array|string
59
- */
60
- private $scopes;
61
-
62
- /**
63
- * Creates a new ScopedAccessTokenMiddleware.
64
- *
65
- * @param callable $tokenFunc a token generator function
66
- * @param array|string $scopes the token authentication scopes
67
- * @param array $cacheConfig configuration for the cache when it's present
68
- * @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface
69
- */
70
- public function __construct(
71
- callable $tokenFunc,
72
- $scopes,
73
- array $cacheConfig = null,
74
- CacheItemPoolInterface $cache = null
75
- ) {
76
- $this->tokenFunc = $tokenFunc;
77
- if (!(is_string($scopes) || is_array($scopes))) {
78
- throw new \InvalidArgumentException(
79
- 'wants scope should be string or array'
80
- );
81
- }
82
- $this->scopes = $scopes;
83
-
84
- if (!is_null($cache)) {
85
- $this->cache = $cache;
86
- $this->cacheConfig = array_merge([
87
- 'lifetime' => self::DEFAULT_CACHE_LIFETIME,
88
- 'prefix' => '',
89
- ], $cacheConfig);
90
- }
91
- }
92
-
93
- /**
94
- * Updates the request with an Authorization header when auth is 'scoped'.
95
- *
96
- * E.g this could be used to authenticate using the AppEngine
97
- * AppIdentityService.
98
- *
99
- * use google\appengine\api\app_identity\AppIdentityService;
100
- * use Google\Auth\Middleware\ScopedAccessTokenMiddleware;
101
- * use GuzzleHttp\Client;
102
- * use GuzzleHttp\HandlerStack;
103
- *
104
- * $scope = 'https://www.googleapis.com/auth/taskqueue'
105
- * $middleware = new ScopedAccessTokenMiddleware(
106
- * 'AppIdentityService::getAccessToken',
107
- * $scope,
108
- * [ 'prefix' => 'Google\Auth\ScopedAccessToken::' ],
109
- * $cache = new Memcache()
110
- * );
111
- * $stack = HandlerStack::create();
112
- * $stack->push($middleware);
113
- *
114
- * $client = new Client([
115
- * 'handler' => $stack,
116
- * 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
117
- * 'auth' => 'scoped' // authorize all requests
118
- * ]);
119
- *
120
- * $res = $client->get('myproject/taskqueues/myqueue');
121
- *
122
- * @param callable $handler
123
- * @return \Closure
124
- */
125
- public function __invoke(callable $handler)
126
- {
127
- return function (RequestInterface $request, array $options) use ($handler) {
128
- // Requests using "auth"="scoped" will be authorized.
129
- if (!isset($options['auth']) || $options['auth'] !== 'scoped') {
130
- return $handler($request, $options);
131
- }
132
-
133
- $request = $request->withHeader('authorization', 'Bearer ' . $this->fetchToken());
134
-
135
- return $handler($request, $options);
136
- };
137
- }
138
-
139
- /**
140
- * @return string
141
- */
142
- private function getCacheKey()
143
- {
144
- $key = null;
145
-
146
- if (is_string($this->scopes)) {
147
- $key .= $this->scopes;
148
- } elseif (is_array($this->scopes)) {
149
- $key .= implode(':', $this->scopes);
150
- }
151
-
152
- return $key;
153
- }
154
-
155
- /**
156
- * Determine if token is available in the cache, if not call tokenFunc to
157
- * fetch it.
158
- *
159
- * @return string
160
- */
161
- private function fetchToken()
162
- {
163
- $cacheKey = $this->getCacheKey();
164
- $cached = $this->getCachedValue($cacheKey);
165
-
166
- if (!empty($cached)) {
167
- return $cached;
168
- }
169
-
170
- $token = call_user_func($this->tokenFunc, $this->scopes);
171
- $this->setCachedValue($cacheKey, $token);
172
-
173
- return $token;
174
- }
175
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Middleware/SimpleMiddleware.php DELETED
@@ -1,92 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Middleware;
19
-
20
- use GuzzleHttp\Psr7;
21
- use Psr\Http\Message\RequestInterface;
22
-
23
- /**
24
- * SimpleMiddleware is a Guzzle Middleware that implements Google's Simple API
25
- * access.
26
- *
27
- * Requests are accessed using the Simple API access developer key.
28
- */
29
- class SimpleMiddleware
30
- {
31
- /**
32
- * @var array
33
- */
34
- private $config;
35
-
36
- /**
37
- * Create a new Simple plugin.
38
- *
39
- * The configuration array expects one option
40
- * - key: required, otherwise InvalidArgumentException is thrown
41
- *
42
- * @param array $config Configuration array
43
- */
44
- public function __construct(array $config)
45
- {
46
- if (!isset($config['key'])) {
47
- throw new \InvalidArgumentException('requires a key to have been set');
48
- }
49
-
50
- $this->config = array_merge(['key' => null], $config);
51
- }
52
-
53
- /**
54
- * Updates the request query with the developer key if auth is set to simple.
55
- *
56
- * use Google\Auth\Middleware\SimpleMiddleware;
57
- * use GuzzleHttp\Client;
58
- * use GuzzleHttp\HandlerStack;
59
- *
60
- * $my_key = 'is not the same as yours';
61
- * $middleware = new SimpleMiddleware(['key' => $my_key]);
62
- * $stack = HandlerStack::create();
63
- * $stack->push($middleware);
64
- *
65
- * $client = new Client([
66
- * 'handler' => $stack,
67
- * 'base_uri' => 'https://www.googleapis.com/discovery/v1/',
68
- * 'auth' => 'simple'
69
- * ]);
70
- *
71
- * $res = $client->get('drive/v2/rest');
72
- *
73
- * @param callable $handler
74
- * @return \Closure
75
- */
76
- public function __invoke(callable $handler)
77
- {
78
- return function (RequestInterface $request, array $options) use ($handler) {
79
- // Requests using "auth"="scoped" will be authorized.
80
- if (!isset($options['auth']) || $options['auth'] !== 'simple') {
81
- return $handler($request, $options);
82
- }
83
-
84
- $query = Psr7\parse_query($request->getUri()->getQuery());
85
- $params = array_merge($query, $this->config);
86
- $uri = $request->getUri()->withQuery(Psr7\build_query($params));
87
- $request = $request->withUri($uri);
88
-
89
- return $handler($request, $options);
90
- };
91
- }
92
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/OAuth2.php DELETED
@@ -1,1408 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- use Google\Auth\HttpHandler\HttpClientCache;
21
- use Google\Auth\HttpHandler\HttpHandlerFactory;
22
- use GuzzleHttp\Psr7;
23
- use GuzzleHttp\Psr7\Request;
24
- use InvalidArgumentException;
25
- use Psr\Http\Message\RequestInterface;
26
- use Psr\Http\Message\ResponseInterface;
27
- use Psr\Http\Message\UriInterface;
28
-
29
- /**
30
- * OAuth2 supports authentication by OAuth2 2-legged flows.
31
- *
32
- * It primary supports
33
- * - service account authorization
34
- * - authorization where a user already has an access token
35
- */
36
- class OAuth2 implements FetchAuthTokenInterface
37
- {
38
- const DEFAULT_EXPIRY_SECONDS = 3600; // 1 hour
39
- const DEFAULT_SKEW_SECONDS = 60; // 1 minute
40
- const JWT_URN = 'urn:ietf:params:oauth:grant-type:jwt-bearer';
41
-
42
- /**
43
- * TODO: determine known methods from the keys of JWT::methods.
44
- */
45
- public static $knownSigningAlgorithms = array(
46
- 'HS256',
47
- 'HS512',
48
- 'HS384',
49
- 'RS256',
50
- );
51
-
52
- /**
53
- * The well known grant types.
54
- *
55
- * @var array
56
- */
57
- public static $knownGrantTypes = array(
58
- 'authorization_code',
59
- 'refresh_token',
60
- 'password',
61
- 'client_credentials',
62
- );
63
-
64
- /**
65
- * - authorizationUri
66
- * The authorization server's HTTP endpoint capable of
67
- * authenticating the end-user and obtaining authorization.
68
- *
69
- * @var UriInterface
70
- */
71
- private $authorizationUri;
72
-
73
- /**
74
- * - tokenCredentialUri
75
- * The authorization server's HTTP endpoint capable of issuing
76
- * tokens and refreshing expired tokens.
77
- *
78
- * @var UriInterface
79
- */
80
- private $tokenCredentialUri;
81
-
82
- /**
83
- * The redirection URI used in the initial request.
84
- *
85
- * @var string
86
- */
87
- private $redirectUri;
88
-
89
- /**
90
- * A unique identifier issued to the client to identify itself to the
91
- * authorization server.
92
- *
93
- * @var string
94
- */
95
- private $clientId;
96
-
97
- /**
98
- * A shared symmetric secret issued by the authorization server, which is
99
- * used to authenticate the client.
100
- *
101
- * @var string
102
- */
103
- private $clientSecret;
104
-
105
- /**
106
- * The resource owner's username.
107
- *
108
- * @var string
109
- */
110
- private $username;
111
-
112
- /**
113
- * The resource owner's password.
114
- *
115
- * @var string
116
- */
117
- private $password;
118
-
119
- /**
120
- * The scope of the access request, expressed either as an Array or as a
121
- * space-delimited string.
122
- *
123
- * @var array
124
- */
125
- private $scope;
126
-
127
- /**
128
- * An arbitrary string designed to allow the client to maintain state.
129
- *
130
- * @var string
131
- */
132
- private $state;
133
-
134
- /**
135
- * The authorization code issued to this client.
136
- *
137
- * Only used by the authorization code access grant type.
138
- *
139
- * @var string
140
- */
141
- private $code;
142
-
143
- /**
144
- * The issuer ID when using assertion profile.
145
- *
146
- * @var string
147
- */
148
- private $issuer;
149
-
150
- /**
151
- * The target audience for assertions.
152
- *
153
- * @var string
154
- */
155
- private $audience;
156
-
157
- /**
158
- * The target sub when issuing assertions.
159
- *
160
- * @var string
161
- */
162
- private $sub;
163
-
164
- /**
165
- * The number of seconds assertions are valid for.
166
- *
167
- * @var int
168
- */
169
- private $expiry;
170
-
171
- /**
172
- * The signing key when using assertion profile.
173
- *
174
- * @var string
175
- */
176
- private $signingKey;
177
-
178
- /**
179
- * The signing key id when using assertion profile. Param kid in jwt header
180
- *
181
- * @var string
182
- */
183
- private $signingKeyId;
184
-
185
- /**
186
- * The signing algorithm when using an assertion profile.
187
- *
188
- * @var string
189
- */
190
- private $signingAlgorithm;
191
-
192
- /**
193
- * The refresh token associated with the access token to be refreshed.
194
- *
195
- * @var string
196
- */
197
- private $refreshToken;
198
-
199
- /**
200
- * The current access token.
201
- *
202
- * @var string
203
- */
204
- private $accessToken;
205
-
206
- /**
207
- * The current ID token.
208
- *
209
- * @var string
210
- */
211
- private $idToken;
212
-
213
- /**
214
- * The lifetime in seconds of the current access token.
215
- *
216
- * @var int
217
- */
218
- private $expiresIn;
219
-
220
- /**
221
- * The expiration time of the access token as a number of seconds since the
222
- * unix epoch.
223
- *
224
- * @var int
225
- */
226
- private $expiresAt;
227
-
228
- /**
229
- * The issue time of the access token as a number of seconds since the unix
230
- * epoch.
231
- *
232
- * @var int
233
- */
234
- private $issuedAt;
235
-
236
- /**
237
- * The current grant type.
238
- *
239
- * @var string
240
- */
241
- private $grantType;
242
-
243
- /**
244
- * When using an extension grant type, this is the set of parameters used by
245
- * that extension.
246
- */
247
- private $extensionParams;
248
-
249
- /**
250
- * When using the toJwt function, these claims will be added to the JWT
251
- * payload.
252
- */
253
- private $additionalClaims;
254
-
255
- /**
256
- * Create a new OAuthCredentials.
257
- *
258
- * The configuration array accepts various options
259
- *
260
- * - authorizationUri
261
- * The authorization server's HTTP endpoint capable of
262
- * authenticating the end-user and obtaining authorization.
263
- *
264
- * - tokenCredentialUri
265
- * The authorization server's HTTP endpoint capable of issuing
266
- * tokens and refreshing expired tokens.
267
- *
268
- * - clientId
269
- * A unique identifier issued to the client to identify itself to the
270
- * authorization server.
271
- *
272
- * - clientSecret
273
- * A shared symmetric secret issued by the authorization server,
274
- * which is used to authenticate the client.
275
- *
276
- * - scope
277
- * The scope of the access request, expressed either as an Array
278
- * or as a space-delimited String.
279
- *
280
- * - state
281
- * An arbitrary string designed to allow the client to maintain state.
282
- *
283
- * - redirectUri
284
- * The redirection URI used in the initial request.
285
- *
286
- * - username
287
- * The resource owner's username.
288
- *
289
- * - password
290
- * The resource owner's password.
291
- *
292
- * - issuer
293
- * Issuer ID when using assertion profile
294
- *
295
- * - audience
296
- * Target audience for assertions
297
- *
298
- * - expiry
299
- * Number of seconds assertions are valid for
300
- *
301
- * - signingKey
302
- * Signing key when using assertion profile
303
- *
304
- * - signingKeyId
305
- * Signing key id when using assertion profile
306
- *
307
- * - refreshToken
308
- * The refresh token associated with the access token
309
- * to be refreshed.
310
- *
311
- * - accessToken
312
- * The current access token for this client.
313
- *
314
- * - idToken
315
- * The current ID token for this client.
316
- *
317
- * - extensionParams
318
- * When using an extension grant type, this is the set of parameters used
319
- * by that extension.
320
- *
321
- * @param array $config Configuration array
322
- */
323
- public function __construct(array $config)
324
- {
325
- $opts = array_merge([
326
- 'expiry' => self::DEFAULT_EXPIRY_SECONDS,
327
- 'extensionParams' => [],
328
- 'authorizationUri' => null,
329
- 'redirectUri' => null,
330
- 'tokenCredentialUri' => null,
331
- 'state' => null,
332
- 'username' => null,
333
- 'password' => null,
334
- 'clientId' => null,
335
- 'clientSecret' => null,
336
- 'issuer' => null,
337
- 'sub' => null,
338
- 'audience' => null,
339
- 'signingKey' => null,
340
- 'signingKeyId' => null,
341
- 'signingAlgorithm' => null,
342
- 'scope' => null,
343
- 'additionalClaims' => [],
344
- ], $config);
345
-
346
- $this->setAuthorizationUri($opts['authorizationUri']);
347
- $this->setRedirectUri($opts['redirectUri']);
348
- $this->setTokenCredentialUri($opts['tokenCredentialUri']);
349
- $this->setState($opts['state']);
350
- $this->setUsername($opts['username']);
351
- $this->setPassword($opts['password']);
352
- $this->setClientId($opts['clientId']);
353
- $this->setClientSecret($opts['clientSecret']);
354
- $this->setIssuer($opts['issuer']);
355
- $this->setSub($opts['sub']);
356
- $this->setExpiry($opts['expiry']);
357
- $this->setAudience($opts['audience']);
358
- $this->setSigningKey($opts['signingKey']);
359
- $this->setSigningKeyId($opts['signingKeyId']);
360
- $this->setSigningAlgorithm($opts['signingAlgorithm']);
361
- $this->setScope($opts['scope']);
362
- $this->setExtensionParams($opts['extensionParams']);
363
- $this->setAdditionalClaims($opts['additionalClaims']);
364
- $this->updateToken($opts);
365
- }
366
-
367
- /**
368
- * Verifies the idToken if present.
369
- *
370
- * - if none is present, return null
371
- * - if present, but invalid, raises DomainException.
372
- * - otherwise returns the payload in the idtoken as a PHP object.
373
- *
374
- * The behavior of this method varies depending on the version of
375
- * `firebase/php-jwt` you are using. In versions lower than 3.0.0, if
376
- * `$publicKey` is null, the key is decoded without being verified. In
377
- * newer versions, if a public key is not given, this method will throw an
378
- * `\InvalidArgumentException`.
379
- *
380
- * @param string $publicKey The public key to use to authenticate the token
381
- * @param array $allowed_algs List of supported verification algorithms
382
- * @throws \DomainException if the token is missing an audience.
383
- * @throws \DomainException if the audience does not match the one set in
384
- * the OAuth2 class instance.
385
- * @throws \UnexpectedValueException If the token is invalid
386
- * @throws SignatureInvalidException If the signature is invalid.
387
- * @throws BeforeValidException If the token is not yet valid.
388
- * @throws ExpiredException If the token has expired.
389
- * @return null|object
390
- */
391
- public function verifyIdToken($publicKey = null, $allowed_algs = array())
392
- {
393
- $idToken = $this->getIdToken();
394
- if (is_null($idToken)) {
395
- return null;
396
- }
397
-
398
- $resp = $this->jwtDecode($idToken, $publicKey, $allowed_algs);
399
- if (!property_exists($resp, 'aud')) {
400
- throw new \DomainException('No audience found the id token');
401
- }
402
- if ($resp->aud != $this->getAudience()) {
403
- throw new \DomainException('Wrong audience present in the id token');
404
- }
405
-
406
- return $resp;
407
- }
408
-
409
- /**
410
- * Obtains the encoded jwt from the instance data.
411
- *
412
- * @param array $config array optional configuration parameters
413
- * @return string
414
- */
415
- public function toJwt(array $config = [])
416
- {
417
- if (is_null($this->getSigningKey())) {
418
- throw new \DomainException('No signing key available');
419
- }
420
- if (is_null($this->getSigningAlgorithm())) {
421
- throw new \DomainException('No signing algorithm specified');
422
- }
423
- $now = time();
424
-
425
- $opts = array_merge([
426
- 'skew' => self::DEFAULT_SKEW_SECONDS,
427
- ], $config);
428
-
429
- $assertion = [
430
- 'iss' => $this->getIssuer(),
431
- 'aud' => $this->getAudience(),
432
- 'exp' => ($now + $this->getExpiry()),
433
- 'iat' => ($now - $opts['skew']),
434
- ];
435
- foreach ($assertion as $k => $v) {
436
- if (is_null($v)) {
437
- throw new \DomainException($k . ' should not be null');
438
- }
439
- }
440
- if (!(is_null($this->getScope()))) {
441
- $assertion['scope'] = $this->getScope();
442
- }
443
- if (!(is_null($this->getSub()))) {
444
- $assertion['sub'] = $this->getSub();
445
- }
446
- $assertion += $this->getAdditionalClaims();
447
-
448
- return $this->jwtEncode(
449
- $assertion,
450
- $this->getSigningKey(),
451
- $this->getSigningAlgorithm(),
452
- $this->getSigningKeyId()
453
- );
454
- }
455
-
456
- /**
457
- * Generates a request for token credentials.
458
- *
459
- * @return RequestInterface the authorization Url.
460
- */
461
- public function generateCredentialsRequest()
462
- {
463
- $uri = $this->getTokenCredentialUri();
464
- if (is_null($uri)) {
465
- throw new \DomainException('No token credential URI was set.');
466
- }
467
-
468
- $grantType = $this->getGrantType();
469
- $params = array('grant_type' => $grantType);
470
- switch ($grantType) {
471
- case 'authorization_code':
472
- $params['code'] = $this->getCode();
473
- $params['redirect_uri'] = $this->getRedirectUri();
474
- $this->addClientCredentials($params);
475
- break;
476
- case 'password':
477
- $params['username'] = $this->getUsername();
478
- $params['password'] = $this->getPassword();
479
- $this->addClientCredentials($params);
480
- break;
481
- case 'refresh_token':
482
- $params['refresh_token'] = $this->getRefreshToken();
483
- $this->addClientCredentials($params);
484
- break;
485
- case self::JWT_URN:
486
- $params['assertion'] = $this->toJwt();
487
- break;
488
- default:
489
- if (!is_null($this->getRedirectUri())) {
490
- # Grant type was supposed to be 'authorization_code', as there
491
- # is a redirect URI.
492
- throw new \DomainException('Missing authorization code');
493
- }
494
- unset($params['grant_type']);
495
- if (!is_null($grantType)) {
496
- $params['grant_type'] = $grantType;
497
- }
498
- $params = array_merge($params, $this->getExtensionParams());
499
- }
500
-
501
- $headers = [
502
- 'Cache-Control' => 'no-store',
503
- 'Content-Type' => 'application/x-www-form-urlencoded',
504
- ];
505
-
506
- return new Request(
507
- 'POST',
508
- $uri,
509
- $headers,
510
- Psr7\build_query($params)
511
- );
512
- }
513
-
514
- /**
515
- * Fetches the auth tokens based on the current state.
516
- *
517
- * @param callable $httpHandler callback which delivers psr7 request
518
- * @return array the response
519
- */
520
- public function fetchAuthToken(callable $httpHandler = null)
521
- {
522
- if (is_null($httpHandler)) {
523
- $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient());
524
- }
525
-
526
- $response = $httpHandler($this->generateCredentialsRequest());
527
- $credentials = $this->parseTokenResponse($response);
528
- $this->updateToken($credentials);
529
-
530
- return $credentials;
531
- }
532
-
533
- /**
534
- * Obtains a key that can used to cache the results of #fetchAuthToken.
535
- *
536
- * The key is derived from the scopes.
537
- *
538
- * @return string a key that may be used to cache the auth token.
539
- */
540
- public function getCacheKey()
541
- {
542
- if (is_array($this->scope)) {
543
- return implode(':', $this->scope);
544
- }
545
-
546
- if ($this->audience) {
547
- return $this->audience;
548
- }
549
-
550
- // If scope has not set, return null to indicate no caching.
551
- return null;
552
- }
553
-
554
- /**
555
- * Parses the fetched tokens.
556
- *
557
- * @param ResponseInterface $resp the response.
558
- * @return array the tokens parsed from the response body.
559
- * @throws \Exception
560
- */
561
- public function parseTokenResponse(ResponseInterface $resp)
562
- {
563
- $body = (string)$resp->getBody();
564
- if ($resp->hasHeader('Content-Type') &&
565
- $resp->getHeaderLine('Content-Type') == 'application/x-www-form-urlencoded'
566
- ) {
567
- $res = array();
568
- parse_str($body, $res);
569
-
570
- return $res;
571
- }
572
-
573
- // Assume it's JSON; if it's not throw an exception
574
- if (null === $res = json_decode($body, true)) {
575
- throw new \Exception('Invalid JSON response');
576
- }
577
-
578
- return $res;
579
- }
580
-
581
- /**
582
- * Updates an OAuth 2.0 client.
583
- *
584
- * Example:
585
- * ```
586
- * $oauth->updateToken([
587
- * 'refresh_token' => 'n4E9O119d',
588
- * 'access_token' => 'FJQbwq9',
589
- * 'expires_in' => 3600
590
- * ]);
591
- * ```
592
- *
593
- * @param array $config
594
- * The configuration parameters related to the token.
595
- *
596
- * - refresh_token
597
- * The refresh token associated with the access token
598
- * to be refreshed.
599
- *
600
- * - access_token
601
- * The current access token for this client.
602
- *
603
- * - id_token
604
- * The current ID token for this client.
605
- *
606
- * - expires_in
607
- * The time in seconds until access token expiration.
608
- *
609
- * - expires_at
610
- * The time as an integer number of seconds since the Epoch
611
- *
612
- * - issued_at
613
- * The timestamp that the token was issued at.
614
- */
615
- public function updateToken(array $config)
616
- {
617
- $opts = array_merge([
618
- 'extensionParams' => [],
619
- 'access_token' => null,
620
- 'id_token' => null,
621
- 'expires_in' => null,
622
- 'expires_at' => null,
623
- 'issued_at' => null,
624
- ], $config);
625
-
626
- $this->setExpiresAt($opts['expires_at']);
627
- $this->setExpiresIn($opts['expires_in']);
628
- // By default, the token is issued at `Time.now` when `expiresIn` is set,
629
- // but this can be used to supply a more precise time.
630
- if (!is_null($opts['issued_at'])) {
631
- $this->setIssuedAt($opts['issued_at']);
632
- }
633
-
634
- $this->setAccessToken($opts['access_token']);
635
- $this->setIdToken($opts['id_token']);
636
- // The refresh token should only be updated if a value is explicitly
637
- // passed in, as some access token responses do not include a refresh
638
- // token.
639
- if (array_key_exists('refresh_token', $opts)) {
640
- $this->setRefreshToken($opts['refresh_token']);
641
- }
642
- }
643
-
644
- /**
645
- * Builds the authorization Uri that the user should be redirected to.
646
- *
647
- * @param array $config configuration options that customize the return url
648
- * @return UriInterface the authorization Url.
649
- * @throws InvalidArgumentException
650
- */
651
- public function buildFullAuthorizationUri(array $config = [])
652
- {
653
- if (is_null($this->getAuthorizationUri())) {
654
- throw new InvalidArgumentException(
655
- 'requires an authorizationUri to have been set'
656
- );
657
- }
658
-
659
- $params = array_merge([
660
- 'response_type' => 'code',
661
- 'access_type' => 'offline',
662
- 'client_id' => $this->clientId,
663
- 'redirect_uri' => $this->redirectUri,
664
- 'state' => $this->state,
665
- 'scope' => $this->getScope(),
666
- ], $config);
667
-
668
- // Validate the auth_params
669
- if (is_null($params['client_id'])) {
670
- throw new InvalidArgumentException(
671
- 'missing the required client identifier'
672
- );
673
- }
674
- if (is_null($params['redirect_uri'])) {
675
- throw new InvalidArgumentException('missing the required redirect URI');
676
- }
677
- if (!empty($params['prompt']) && !empty($params['approval_prompt'])) {
678
- throw new InvalidArgumentException(
679
- 'prompt and approval_prompt are mutually exclusive'
680
- );
681
- }
682
-
683
- // Construct the uri object; return it if it is valid.
684
- $result = clone $this->authorizationUri;
685
- $existingParams = Psr7\parse_query($result->getQuery());
686
-
687
- $result = $result->withQuery(
688
- Psr7\build_query(array_merge($existingParams, $params))
689
- );
690
-
691
- if ($result->getScheme() != 'https') {
692
- throw new InvalidArgumentException(
693
- 'Authorization endpoint must be protected by TLS'
694
- );
695
- }
696
-
697
- return $result;
698
- }
699
-
700
- /**
701
- * Sets the authorization server's HTTP endpoint capable of authenticating
702
- * the end-user and obtaining authorization.
703
- *
704
- * @param string $uri
705
- */
706
- public function setAuthorizationUri($uri)
707
- {
708
- $this->authorizationUri = $this->coerceUri($uri);
709
- }
710
-
711
- /**
712
- * Gets the authorization server's HTTP endpoint capable of authenticating
713
- * the end-user and obtaining authorization.
714
- *
715
- * @return UriInterface
716
- */
717
- public function getAuthorizationUri()
718
- {
719
- return $this->authorizationUri;
720
- }
721
-
722
- /**
723
- * Gets the authorization server's HTTP endpoint capable of issuing tokens
724
- * and refreshing expired tokens.
725
- *
726
- * @return string
727
- */
728
- public function getTokenCredentialUri()
729
- {
730
- return $this->tokenCredentialUri;
731
- }
732
-
733
- /**
734
- * Sets the authorization server's HTTP endpoint capable of issuing tokens
735
- * and refreshing expired tokens.
736
- *
737
- * @param string $uri
738
- */
739
- public function setTokenCredentialUri($uri)
740
- {
741
- $this->tokenCredentialUri = $this->coerceUri($uri);
742
- }
743
-
744
- /**
745
- * Gets the redirection URI used in the initial request.
746
- *
747
- * @return string
748
- */
749
- public function getRedirectUri()
750
- {
751
- return $this->redirectUri;
752
- }
753
-
754
- /**
755
- * Sets the redirection URI used in the initial request.
756
- *
757
- * @param string $uri
758
- */
759
- public function setRedirectUri($uri)
760
- {
761
- if (is_null($uri)) {
762
- $this->redirectUri = null;
763
-
764
- return;
765
- }
766
- // redirect URI must be absolute
767
- if (!$this->isAbsoluteUri($uri)) {
768
- // "postmessage" is a reserved URI string in Google-land
769
- // @see https://developers.google.com/identity/sign-in/web/server-side-flow
770
- if ('postmessage' !== (string)$uri) {
771
- throw new InvalidArgumentException(
772
- 'Redirect URI must be absolute'
773
- );
774
- }
775
- }
776
- $this->redirectUri = (string)$uri;
777
- }
778
-
779
- /**
780
- * Gets the scope of the access requests as a space-delimited String.
781
- *
782
- * @return string
783
- */
784
- public function getScope()
785
- {
786
- if (is_null($this->scope)) {
787
- return $this->scope;
788
- }
789
-
790
- return implode(' ', $this->scope);
791
- }
792
-
793
- /**
794
- * Sets the scope of the access request, expressed either as an Array or as
795
- * a space-delimited String.
796
- *
797
- * @param string|array $scope
798
- * @throws InvalidArgumentException
799
- */
800
- public function setScope($scope)
801
- {
802
- if (is_null($scope)) {
803
- $this->scope = null;
804
- } elseif (is_string($scope)) {
805
- $this->scope = explode(' ', $scope);
806
- } elseif (is_array($scope)) {
807
- foreach ($scope as $s) {
808
- $pos = strpos($s, ' ');
809
- if ($pos !== false) {
810
- throw new InvalidArgumentException(
811
- 'array scope values should not contain spaces'
812
- );
813
- }
814
- }
815
- $this->scope = $scope;
816
- } else {
817
- throw new InvalidArgumentException(
818
- 'scopes should be a string or array of strings'
819
- );
820
- }
821
- }
822
-
823
- /**
824
- * Gets the current grant type.
825
- *
826
- * @return string
827
- */
828
- public function getGrantType()
829
- {
830
- if (!is_null($this->grantType)) {
831
- return $this->grantType;
832
- }
833
-
834
- // Returns the inferred grant type, based on the current object instance
835
- // state.
836
- if (!is_null($this->code)) {
837
- return 'authorization_code';
838
- }
839
-
840
- if (!is_null($this->refreshToken)) {
841
- return 'refresh_token';
842
- }
843
-
844
- if (!is_null($this->username) && !is_null($this->password)) {
845
- return 'password';
846
- }
847
-
848
- if (!is_null($this->issuer) && !is_null($this->signingKey)) {
849
- return self::JWT_URN;
850
- }
851
-
852
- return null;
853
- }
854
-
855
- /**
856
- * Sets the current grant type.
857
- *
858
- * @param $grantType
859
- * @throws InvalidArgumentException
860
- */
861
- public function setGrantType($grantType)
862
- {
863
- if (in_array($grantType, self::$knownGrantTypes)) {
864
- $this->grantType = $grantType;
865
- } else {
866
- // validate URI
867
- if (!$this->isAbsoluteUri($grantType)) {
868
- throw new InvalidArgumentException(
869
- 'invalid grant type'
870
- );
871
- }
872
- $this->grantType = (string)$grantType;
873
- }
874
- }
875
-
876
- /**
877
- * Gets an arbitrary string designed to allow the client to maintain state.
878
- *
879
- * @return string
880
- */
881
- public function getState()
882
- {
883
- return $this->state;
884
- }
885
-
886
- /**
887
- * Sets an arbitrary string designed to allow the client to maintain state.
888
- *
889
- * @param string $state
890
- */
891
- public function setState($state)
892
- {
893
- $this->state = $state;
894
- }
895
-
896
- /**
897
- * Gets the authorization code issued to this client.
898
- */
899
- public function getCode()
900
- {
901
- return $this->code;
902
- }
903
-
904
- /**
905
- * Sets the authorization code issued to this client.
906
- *
907
- * @param string $code
908
- */
909
- public function setCode($code)
910
- {
911
- $this->code = $code;
912
- }
913
-
914
- /**
915
- * Gets the resource owner's username.
916
- */
917
- public function getUsername()
918
- {
919
- return $this->username;
920
- }
921
-
922
- /**
923
- * Sets the resource owner's username.
924
- *
925
- * @param string $username
926
- */
927
- public function setUsername($username)
928
- {
929
- $this->username = $username;
930
- }
931
-
932
- /**
933
- * Gets the resource owner's password.
934
- */
935
- public function getPassword()
936
- {
937
- return $this->password;
938
- }
939
-
940
- /**
941
- * Sets the resource owner's password.
942
- *
943
- * @param $password
944
- */
945
- public function setPassword($password)
946
- {
947
- $this->password = $password;
948
- }
949
-
950
- /**
951
- * Sets a unique identifier issued to the client to identify itself to the
952
- * authorization server.
953
- */
954
- public function getClientId()
955
- {
956
- return $this->clientId;
957
- }
958
-
959
- /**
960
- * Sets a unique identifier issued to the client to identify itself to the
961
- * authorization server.
962
- *
963
- * @param $clientId
964
- */
965
- public function setClientId($clientId)
966
- {
967
- $this->clientId = $clientId;
968
- }
969
-
970
- /**
971
- * Gets a shared symmetric secret issued by the authorization server, which
972
- * is used to authenticate the client.
973
- */
974
- public function getClientSecret()
975
- {
976
- return $this->clientSecret;
977
- }
978
-
979
- /**
980
- * Sets a shared symmetric secret issued by the authorization server, which
981
- * is used to authenticate the client.
982
- *
983
- * @param $clientSecret
984
- */
985
- public function setClientSecret($clientSecret)
986
- {
987
- $this->clientSecret = $clientSecret;
988
- }
989
-
990
- /**
991
- * Gets the Issuer ID when using assertion profile.
992
- */
993
- public function getIssuer()
994
- {
995
- return $this->issuer;
996
- }
997
-
998
- /**
999
- * Sets the Issuer ID when using assertion profile.
1000
- *
1001
- * @param string $issuer
1002
- */
1003
- public function setIssuer($issuer)
1004
- {
1005
- $this->issuer = $issuer;
1006
- }
1007
-
1008
- /**
1009
- * Gets the target sub when issuing assertions.
1010
- */
1011
- public function getSub()
1012
- {
1013
- return $this->sub;
1014
- }
1015
-
1016
- /**
1017
- * Sets the target sub when issuing assertions.
1018
- *
1019
- * @param string $sub
1020
- */
1021
- public function setSub($sub)
1022
- {
1023
- $this->sub = $sub;
1024
- }
1025
-
1026
- /**
1027
- * Gets the target audience when issuing assertions.
1028
- */
1029
- public function getAudience()
1030
- {
1031
- return $this->audience;
1032
- }
1033
-
1034
- /**
1035
- * Sets the target audience when issuing assertions.
1036
- *
1037
- * @param string $audience
1038
- */
1039
- public function setAudience($audience)
1040
- {
1041
- $this->audience = $audience;
1042
- }
1043
-
1044
- /**
1045
- * Gets the signing key when using an assertion profile.
1046
- */
1047
- public function getSigningKey()
1048
- {
1049
- return $this->signingKey;
1050
- }
1051
-
1052
- /**
1053
- * Sets the signing key when using an assertion profile.
1054
- *
1055
- * @param string $signingKey
1056
- */
1057
- public function setSigningKey($signingKey)
1058
- {
1059
- $this->signingKey = $signingKey;
1060
- }
1061
-
1062
- /**
1063
- * Gets the signing key id when using an assertion profile.
1064
- *
1065
- * @return string
1066
- */
1067
- public function getSigningKeyId()
1068
- {
1069
- return $this->signingKeyId;
1070
- }
1071
-
1072
- /**
1073
- * Sets the signing key id when using an assertion profile.
1074
- *
1075
- * @param string $signingKeyId
1076
- */
1077
- public function setSigningKeyId($signingKeyId)
1078
- {
1079
- $this->signingKeyId = $signingKeyId;
1080
- }
1081
-
1082
- /**
1083
- * Gets the signing algorithm when using an assertion profile.
1084
- *
1085
- * @return string
1086
- */
1087
- public function getSigningAlgorithm()
1088
- {
1089
- return $this->signingAlgorithm;
1090
- }
1091
-
1092
- /**
1093
- * Sets the signing algorithm when using an assertion profile.
1094
- *
1095
- * @param string $signingAlgorithm
1096
- */
1097
- public function setSigningAlgorithm($signingAlgorithm)
1098
- {
1099
- if (is_null($signingAlgorithm)) {
1100
- $this->signingAlgorithm = null;
1101
- } elseif (!in_array($signingAlgorithm, self::$knownSigningAlgorithms)) {
1102
- throw new InvalidArgumentException('unknown signing algorithm');
1103
- } else {
1104
- $this->signingAlgorithm = $signingAlgorithm;
1105
- }
1106
- }
1107
-
1108
- /**
1109
- * Gets the set of parameters used by extension when using an extension
1110
- * grant type.
1111
- */
1112
- public function getExtensionParams()
1113
- {
1114
- return $this->extensionParams;
1115
- }
1116
-
1117
- /**
1118
- * Sets the set of parameters used by extension when using an extension
1119
- * grant type.
1120
- *
1121
- * @param $extensionParams
1122
- */
1123
- public function setExtensionParams($extensionParams)
1124
- {
1125
- $this->extensionParams = $extensionParams;
1126
- }
1127
-
1128
- /**
1129
- * Gets the number of seconds assertions are valid for.
1130
- */
1131
- public function getExpiry()
1132
- {
1133
- return $this->expiry;
1134
- }
1135
-
1136
- /**
1137
- * Sets the number of seconds assertions are valid for.
1138
- *
1139
- * @param int $expiry
1140
- */
1141
- public function setExpiry($expiry)
1142
- {
1143
- $this->expiry = $expiry;
1144
- }
1145
-
1146
- /**
1147
- * Gets the lifetime of the access token in seconds.
1148
- */
1149
- public function getExpiresIn()
1150
- {
1151
- return $this->expiresIn;
1152
- }
1153
-
1154
- /**
1155
- * Sets the lifetime of the access token in seconds.
1156
- *
1157
- * @param int $expiresIn
1158
- */
1159
- public function setExpiresIn($expiresIn)
1160
- {
1161
- if (is_null($expiresIn)) {
1162
- $this->expiresIn = null;
1163
- $this->issuedAt = null;
1164
- } else {
1165
- $this->issuedAt = time();
1166
- $this->expiresIn = (int)$expiresIn;
1167
- }
1168
- }
1169
-
1170
- /**
1171
- * Gets the time the current access token expires at.
1172
- *
1173
- * @return int
1174
- */
1175
- public function getExpiresAt()
1176
- {
1177
- if (!is_null($this->expiresAt)) {
1178
- return $this->expiresAt;
1179
- }
1180
-
1181
- if (!is_null($this->issuedAt) && !is_null($this->expiresIn)) {
1182
- return $this->issuedAt + $this->expiresIn;
1183
- }
1184
-
1185
- return null;
1186
- }
1187
-
1188
- /**
1189
- * Returns true if the acccess token has expired.
1190
- *
1191
- * @return bool
1192
- */
1193
- public function isExpired()
1194
- {
1195
- $expiration = $this->getExpiresAt();
1196
- $now = time();
1197
-
1198
- return !is_null($expiration) && $now >= $expiration;
1199
- }
1200
-
1201
- /**
1202
- * Sets the time the current access token expires at.
1203
- *
1204
- * @param int $expiresAt
1205
- */
1206
- public function setExpiresAt($expiresAt)
1207
- {
1208
- $this->expiresAt = $expiresAt;
1209
- }
1210
-
1211
- /**
1212
- * Gets the time the current access token was issued at.
1213
- */
1214
- public function getIssuedAt()
1215
- {
1216
- return $this->issuedAt;
1217
- }
1218
-
1219
- /**
1220
- * Sets the time the current access token was issued at.
1221
- *
1222
- * @param int $issuedAt
1223
- */
1224
- public function setIssuedAt($issuedAt)
1225
- {
1226
- $this->issuedAt = $issuedAt;
1227
- }
1228
-
1229
- /**
1230
- * Gets the current access token.
1231
- */
1232
- public function getAccessToken()
1233
- {
1234
- return $this->accessToken;
1235
- }
1236
-
1237
- /**
1238
- * Sets the current access token.
1239
- *
1240
- * @param string $accessToken
1241
- */
1242
- public function setAccessToken($accessToken)
1243
- {
1244
- $this->accessToken = $accessToken;
1245
- }
1246
-
1247
- /**
1248
- * Gets the current ID token.
1249
- */
1250
- public function getIdToken()
1251
- {
1252
- return $this->idToken;
1253
- }
1254
-
1255
- /**
1256
- * Sets the current ID token.
1257
- *
1258
- * @param $idToken
1259
- */
1260
- public function setIdToken($idToken)
1261
- {
1262
- $this->idToken = $idToken;
1263
- }
1264
-
1265
- /**
1266
- * Gets the refresh token associated with the current access token.
1267
- */
1268
- public function getRefreshToken()
1269
- {
1270
- return $this->refreshToken;
1271
- }
1272
-
1273
- /**
1274
- * Sets the refresh token associated with the current access token.
1275
- *
1276
- * @param $refreshToken
1277
- */
1278
- public function setRefreshToken($refreshToken)
1279
- {
1280
- $this->refreshToken = $refreshToken;
1281
- }
1282
-
1283
- /**
1284
- * Sets additional claims to be included in the JWT token
1285
- *
1286
- * @param array $additionalClaims
1287
- */
1288
- public function setAdditionalClaims(array $additionalClaims)
1289
- {
1290
- $this->additionalClaims = $additionalClaims;
1291
- }
1292
-
1293
- /**
1294
- * Gets the additional claims to be included in the JWT token.
1295
- *
1296
- * @return array
1297
- */
1298
- public function getAdditionalClaims()
1299
- {
1300
- return $this->additionalClaims;
1301
- }
1302
-
1303
- /**
1304
- * The expiration of the last received token.
1305
- *
1306
- * @return array
1307
- */
1308
- public function getLastReceivedToken()
1309
- {
1310
- if ($token = $this->getAccessToken()) {
1311
- return [
1312
- 'access_token' => $token,
1313
- 'expires_at' => $this->getExpiresAt(),
1314
- ];
1315
- }
1316
-
1317
- return null;
1318
- }
1319
-
1320
- /**
1321
- * Get the client ID.
1322
- *
1323
- * Alias of {@see Google\Auth\OAuth2::getClientId()}.
1324
- *
1325
- * @param callable $httpHandler
1326
- * @return string
1327
- * @access private
1328
- */
1329
- public function getClientName(callable $httpHandler = null)
1330
- {
1331
- return $this->getClientId();
1332
- }
1333
-
1334
- /**
1335
- * @todo handle uri as array
1336
- *
1337
- * @param string $uri
1338
- * @return null|UriInterface
1339
- */
1340
- private function coerceUri($uri)
1341
- {
1342
- if (is_null($uri)) {
1343
- return;
1344
- }
1345
-
1346
- return Psr7\uri_for($uri);
1347
- }
1348
-
1349
- /**
1350
- * @param string $idToken
1351
- * @param string|array|null $publicKey
1352
- * @param array $allowedAlgs
1353
- * @return object
1354
- */
1355
- private function jwtDecode($idToken, $publicKey, $allowedAlgs)
1356
- {
1357
- if (class_exists('Firebase\JWT\JWT')) {
1358
- return \Firebase\JWT\JWT::decode($idToken, $publicKey, $allowedAlgs);
1359
- }
1360
-
1361
- return \JWT::decode($idToken, $publicKey, $allowedAlgs);
1362
- }
1363
-
1364
- private function jwtEncode($assertion, $signingKey, $signingAlgorithm, $signingKeyId = null)
1365
- {
1366
- if (class_exists('Firebase\JWT\JWT')) {
1367
- return \Firebase\JWT\JWT::encode(
1368
- $assertion,
1369
- $signingKey,
1370
- $signingAlgorithm,
1371
- $signingKeyId
1372
- );
1373
- }
1374
-
1375
- return \JWT::encode($assertion, $signingKey, $signingAlgorithm, $signingKeyId);
1376
- }
1377
-
1378
- /**
1379
- * Determines if the URI is absolute based on its scheme and host or path
1380
- * (RFC 3986).
1381
- *
1382
- * @param string $uri
1383
- * @return bool
1384
- */
1385
- private function isAbsoluteUri($uri)
1386
- {
1387
- $uri = $this->coerceUri($uri);
1388
-
1389
- return $uri->getScheme() && ($uri->getHost() || $uri->getPath());
1390
- }
1391
-
1392
- /**
1393
- * @param array $params
1394
- * @return array
1395
- */
1396
- private function addClientCredentials(&$params)
1397
- {
1398
- $clientId = $this->getClientId();
1399
- $clientSecret = $this->getClientSecret();
1400
-
1401
- if ($clientId && $clientSecret) {
1402
- $params['client_id'] = $clientId;
1403
- $params['client_secret'] = $clientSecret;
1404
- }
1405
-
1406
- return $params;
1407
- }
1408
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/ProjectIdProviderInterface.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2020 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- /**
21
- * Describes a Credentials object which supports fetching the project ID.
22
- */
23
- interface ProjectIdProviderInterface
24
- {
25
- /**
26
- * Get the project ID.
27
- *
28
- * @param callable $httpHandler Callback which delivers psr7 request
29
- * @return string|null
30
- */
31
- public function getProjectId(callable $httpHandler = null);
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/ServiceAccountSignerTrait.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2019 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- use phpseclib\Crypt\RSA;
21
-
22
- /**
23
- * Sign a string using a Service Account private key.
24
- */
25
- trait ServiceAccountSignerTrait
26
- {
27
- /**
28
- * Sign a string using the service account private key.
29
- *
30
- * @param string $stringToSign
31
- * @param bool $forceOpenssl Whether to use OpenSSL regardless of
32
- * whether phpseclib is installed. **Defaults to** `false`.
33
- * @return string
34
- */
35
- public function signBlob($stringToSign, $forceOpenssl = false)
36
- {
37
- $privateKey = $this->auth->getSigningKey();
38
-
39
- $signedString = '';
40
- if (class_exists('\\phpseclib\\Crypt\\RSA') && !$forceOpenssl) {
41
- $rsa = new RSA;
42
- $rsa->loadKey($privateKey);
43
- $rsa->setSignatureMode(RSA::SIGNATURE_PKCS1);
44
- $rsa->setHash('sha256');
45
-
46
- $signedString = $rsa->sign($stringToSign);
47
- } elseif (extension_loaded('openssl')) {
48
- openssl_sign($stringToSign, $signedString, $privateKey, 'sha256WithRSAEncryption');
49
- } else {
50
- // @codeCoverageIgnoreStart
51
- throw new \RuntimeException('OpenSSL is not installed.');
52
- }
53
- // @codeCoverageIgnoreEnd
54
-
55
- return base64_encode($signedString);
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/SignBlobInterface.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2019 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- /**
21
- * Describes a class which supports signing arbitrary strings.
22
- */
23
- interface SignBlobInterface extends FetchAuthTokenInterface
24
- {
25
- /**
26
- * Sign a string using the method which is best for a given credentials type.
27
- *
28
- * @param string $stringToSign The string to sign.
29
- * @param bool $forceOpenssl Require use of OpenSSL for local signing. Does
30
- * not apply to signing done using external services. **Defaults to**
31
- * `false`.
32
- * @return string The resulting signature. Value should be base64-encoded.
33
- */
34
- public function signBlob($stringToSign, $forceOpenssl = false);
35
-
36
- /**
37
- * Returns the current Client Name.
38
- *
39
- * @param callable $httpHandler callback which delivers psr7 request, if
40
- * one is required to obtain a client name.
41
- * @return string
42
- */
43
- public function getClientName(callable $httpHandler = null);
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Subscriber/AuthTokenSubscriber.php DELETED
@@ -1,136 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Subscriber;
19
-
20
- use Google\Auth\FetchAuthTokenInterface;
21
- use Google\Auth\GetQuotaProjectInterface;
22
- use GuzzleHttp\Event\BeforeEvent;
23
- use GuzzleHttp\Event\RequestEvents;
24
- use GuzzleHttp\Event\SubscriberInterface;
25
-
26
- /**
27
- * AuthTokenSubscriber is a Guzzle Subscriber that adds an Authorization header
28
- * provided by an object implementing FetchAuthTokenInterface.
29
- *
30
- * The FetchAuthTokenInterface#fetchAuthToken is used to obtain a hash; one of
31
- * the values value in that hash is added as the authorization header.
32
- *
33
- * Requests will be accessed with the authorization header:
34
- *
35
- * 'authorization' 'Bearer <value of auth_token>'
36
- */
37
- class AuthTokenSubscriber implements SubscriberInterface
38
- {
39
- /**
40
- * @var callable
41
- */
42
- private $httpHandler;
43
-
44
- /**
45
- * @var FetchAuthTokenInterface
46
- */
47
- private $fetcher;
48
-
49
- /**
50
- * @var callable
51
- */
52
- private $tokenCallback;
53
-
54
- /**
55
- * Creates a new AuthTokenSubscriber.
56
- *
57
- * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
58
- * @param callable $httpHandler (optional) http client to fetch the token.
59
- * @param callable $tokenCallback (optional) function to be called when a new token is fetched.
60
- */
61
- public function __construct(
62
- FetchAuthTokenInterface $fetcher,
63
- callable $httpHandler = null,
64
- callable $tokenCallback = null
65
- ) {
66
- $this->fetcher = $fetcher;
67
- $this->httpHandler = $httpHandler;
68
- $this->tokenCallback = $tokenCallback;
69
- }
70
-
71
- /**
72
- * @return array
73
- */
74
- public function getEvents()
75
- {
76
- return ['before' => ['onBefore', RequestEvents::SIGN_REQUEST]];
77
- }
78
-
79
- /**
80
- * Updates the request with an Authorization header when auth is 'fetched_auth_token'.
81
- *
82
- * Example:
83
- * ```
84
- * use GuzzleHttp\Client;
85
- * use Google\Auth\OAuth2;
86
- * use Google\Auth\Subscriber\AuthTokenSubscriber;
87
- *
88
- * $config = [..<oauth config param>.];
89
- * $oauth2 = new OAuth2($config)
90
- * $subscriber = new AuthTokenSubscriber($oauth2);
91
- *
92
- * $client = new Client([
93
- * 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
94
- * 'defaults' => ['auth' => 'google_auth']
95
- * ]);
96
- * $client->getEmitter()->attach($subscriber);
97
- *
98
- * $res = $client->get('myproject/taskqueues/myqueue');
99
- * ```
100
- *
101
- * @param BeforeEvent $event
102
- */
103
- public function onBefore(BeforeEvent $event)
104
- {
105
- // Requests using "auth"="google_auth" will be authorized.
106
- $request = $event->getRequest();
107
- if ($request->getConfig()['auth'] != 'google_auth') {
108
- return;
109
- }
110
-
111
- // Fetch the auth token.
112
- $auth_tokens = $this->fetcher->fetchAuthToken($this->httpHandler);
113
- if (array_key_exists('access_token', $auth_tokens)) {
114
- $request->setHeader('authorization', 'Bearer ' . $auth_tokens['access_token']);
115
-
116
- // notify the callback if applicable
117
- if ($this->tokenCallback) {
118
- call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $auth_tokens['access_token']);
119
- }
120
- }
121
-
122
- if ($quotaProject = $this->getQuotaProject()) {
123
- $request->setHeader(
124
- GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER,
125
- $quotaProject
126
- );
127
- }
128
- }
129
-
130
- private function getQuotaProject()
131
- {
132
- if ($this->fetcher instanceof GetQuotaProjectInterface) {
133
- return $this->fetcher->getQuotaProject();
134
- }
135
- }
136
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php DELETED
@@ -1,180 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Subscriber;
19
-
20
- use Google\Auth\CacheTrait;
21
- use GuzzleHttp\Event\BeforeEvent;
22
- use GuzzleHttp\Event\RequestEvents;
23
- use GuzzleHttp\Event\SubscriberInterface;
24
- use Psr\Cache\CacheItemPoolInterface;
25
-
26
- /**
27
- * ScopedAccessTokenSubscriber is a Guzzle Subscriber that adds an Authorization
28
- * header provided by a closure.
29
- *
30
- * The closure returns an access token, taking the scope, either a single
31
- * string or an array of strings, as its value. If provided, a cache will be
32
- * used to preserve the access token for a given lifetime.
33
- *
34
- * Requests will be accessed with the authorization header:
35
- *
36
- * 'authorization' 'Bearer <access token obtained from the closure>'
37
- */
38
- class ScopedAccessTokenSubscriber implements SubscriberInterface
39
- {
40
- use CacheTrait;
41
-
42
- const DEFAULT_CACHE_LIFETIME = 1500;
43
-
44
- /**
45
- * @var CacheItemPoolInterface
46
- */
47
- private $cache;
48
-
49
- /**
50
- * @var callable The access token generator function
51
- */
52
- private $tokenFunc;
53
-
54
- /**
55
- * @var array|string The scopes used to generate the token
56
- */
57
- private $scopes;
58
-
59
- /**
60
- * @var array
61
- */
62
- private $cacheConfig;
63
-
64
- /**
65
- * Creates a new ScopedAccessTokenSubscriber.
66
- *
67
- * @param callable $tokenFunc a token generator function
68
- * @param array|string $scopes the token authentication scopes
69
- * @param array $cacheConfig configuration for the cache when it's present
70
- * @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface
71
- */
72
- public function __construct(
73
- callable $tokenFunc,
74
- $scopes,
75
- array $cacheConfig = null,
76
- CacheItemPoolInterface $cache = null
77
- ) {
78
- $this->tokenFunc = $tokenFunc;
79
- if (!(is_string($scopes) || is_array($scopes))) {
80
- throw new \InvalidArgumentException(
81
- 'wants scope should be string or array'
82
- );
83
- }
84
- $this->scopes = $scopes;
85
-
86
- if (!is_null($cache)) {
87
- $this->cache = $cache;
88
- $this->cacheConfig = array_merge([
89
- 'lifetime' => self::DEFAULT_CACHE_LIFETIME,
90
- 'prefix' => '',
91
- ], $cacheConfig);
92
- }
93
- }
94
-
95
- /**
96
- * @return array
97
- */
98
- public function getEvents()
99
- {
100
- return ['before' => ['onBefore', RequestEvents::SIGN_REQUEST]];
101
- }
102
-
103
- /**
104
- * Updates the request with an Authorization header when auth is 'scoped'.
105
- *
106
- * E.g this could be used to authenticate using the AppEngine AppIdentityService.
107
- *
108
- * Example:
109
- * ```
110
- * use google\appengine\api\app_identity\AppIdentityService;
111
- * use Google\Auth\Subscriber\ScopedAccessTokenSubscriber;
112
- * use GuzzleHttp\Client;
113
- *
114
- * $scope = 'https://www.googleapis.com/auth/taskqueue'
115
- * $subscriber = new ScopedAccessToken(
116
- * 'AppIdentityService::getAccessToken',
117
- * $scope,
118
- * ['prefix' => 'Google\Auth\ScopedAccessToken::'],
119
- * $cache = new Memcache()
120
- * );
121
- *
122
- * $client = new Client([
123
- * 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
124
- * 'defaults' => ['auth' => 'scoped']
125
- * ]);
126
- * $client->getEmitter()->attach($subscriber);
127
- *
128
- * $res = $client->get('myproject/taskqueues/myqueue');
129
- * ```
130
- *
131
- * @param BeforeEvent $event
132
- */
133
- public function onBefore(BeforeEvent $event)
134
- {
135
- // Requests using "auth"="scoped" will be authorized.
136
- $request = $event->getRequest();
137
- if ($request->getConfig()['auth'] != 'scoped') {
138
- return;
139
- }
140
- $auth_header = 'Bearer ' . $this->fetchToken();
141
- $request->setHeader('authorization', $auth_header);
142
- }
143
-
144
- /**
145
- * @return string
146
- */
147
- private function getCacheKey()
148
- {
149
- $key = null;
150
-
151
- if (is_string($this->scopes)) {
152
- $key .= $this->scopes;
153
- } elseif (is_array($this->scopes)) {
154
- $key .= implode(':', $this->scopes);
155
- }
156
-
157
- return $key;
158
- }
159
-
160
- /**
161
- * Determine if token is available in the cache, if not call tokenFunc to
162
- * fetch it.
163
- *
164
- * @return string
165
- */
166
- private function fetchToken()
167
- {
168
- $cacheKey = $this->getCacheKey();
169
- $cached = $this->getCachedValue($cacheKey);
170
-
171
- if (!empty($cached)) {
172
- return $cached;
173
- }
174
-
175
- $token = call_user_func($this->tokenFunc, $this->scopes);
176
- $this->setCachedValue($cacheKey, $token);
177
-
178
- return $token;
179
- }
180
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/Subscriber/SimpleSubscriber.php DELETED
@@ -1,93 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2015 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth\Subscriber;
19
-
20
- use GuzzleHttp\Event\BeforeEvent;
21
- use GuzzleHttp\Event\RequestEvents;
22
- use GuzzleHttp\Event\SubscriberInterface;
23
-
24
- /**
25
- * SimpleSubscriber is a Guzzle Subscriber that implements Google's Simple API
26
- * access.
27
- *
28
- * Requests are accessed using the Simple API access developer key.
29
- */
30
- class SimpleSubscriber implements SubscriberInterface
31
- {
32
- /**
33
- * @var array
34
- */
35
- private $config;
36
-
37
- /**
38
- * Create a new Simple plugin.
39
- *
40
- * The configuration array expects one option
41
- * - key: required, otherwise InvalidArgumentException is thrown
42
- *
43
- * @param array $config Configuration array
44
- */
45
- public function __construct(array $config)
46
- {
47
- if (!isset($config['key'])) {
48
- throw new \InvalidArgumentException('requires a key to have been set');
49
- }
50
-
51
- $this->config = array_merge([], $config);
52
- }
53
-
54
- /**
55
- * @return array
56
- */
57
- public function getEvents()
58
- {
59
- return ['before' => ['onBefore', RequestEvents::SIGN_REQUEST]];
60
- }
61
-
62
- /**
63
- * Updates the request query with the developer key if auth is set to simple.
64
- *
65
- * Example:
66
- * ```
67
- * use Google\Auth\Subscriber\SimpleSubscriber;
68
- * use GuzzleHttp\Client;
69
- *
70
- * $my_key = 'is not the same as yours';
71
- * $subscriber = new SimpleSubscriber(['key' => $my_key]);
72
- *
73
- * $client = new Client([
74
- * 'base_url' => 'https://www.googleapis.com/discovery/v1/',
75
- * 'defaults' => ['auth' => 'simple']
76
- * ]);
77
- * $client->getEmitter()->attach($subscriber);
78
- *
79
- * $res = $client->get('drive/v2/rest');
80
- * ```
81
- *
82
- * @param BeforeEvent $event
83
- */
84
- public function onBefore(BeforeEvent $event)
85
- {
86
- // Requests using "auth"="simple" with the developer key.
87
- $request = $event->getRequest();
88
- if ($request->getConfig()['auth'] != 'simple') {
89
- return;
90
- }
91
- $request->getQuery()->overwriteWith($this->config);
92
- }
93
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/google/auth/src/UpdateMetadataInterface.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- /*
3
- * Copyright 2020 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- namespace Google\Auth;
19
-
20
- /**
21
- * Describes a Credentials object which supports updating request metadata
22
- * (request headers).
23
- */
24
- interface UpdateMetadataInterface
25
- {
26
- const AUTH_METADATA_KEY = 'authorization';
27
-
28
- /**
29
- * Updates metadata with the authorization token.
30
- *
31
- * @param array $metadata metadata hashmap
32
- * @param string $authUri optional auth uri
33
- * @param callable $httpHandler callback which delivers psr7 request
34
- * @return array updated metadata hashmap
35
- */
36
- public function updateMetadata(
37
- $metadata,
38
- $authUri = null,
39
- callable $httpHandler = null
40
- );
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/CHANGELOG.md DELETED
@@ -1,1419 +0,0 @@
1
- # Change Log
2
-
3
- Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version.
4
-
5
- ## UNRELEASED
6
-
7
- ## 7.1.0 - 2020-09-22
8
-
9
- ### Added
10
-
11
- - `GuzzleHttp\MessageFormatterInterface`
12
-
13
- ### Fixed
14
-
15
- - Fixed issue that caused cookies with no value not to be stored.
16
- - On redirects, we allow all safe methods like GET, HEAD and OPTIONS.
17
- - Fixed logging on empty responses.
18
- - Make sure MessageFormatter::format returns string
19
-
20
- ### Deprecated
21
-
22
- - All functions in `GuzzleHttp` has been deprecated. Use static methods on `Utils` instead.
23
- - `ClientInterface::getConfig()`
24
- - `Client::getConfig()`
25
- - `Client::__call()`
26
- - `Utils::defaultCaBundle()`
27
- - `CurlFactory::LOW_CURL_VERSION_NUMBER`
28
-
29
- ## 7.0.1 - 2020-06-27
30
-
31
- * Fix multiply defined functions fatal error [#2699](https://github.com/guzzle/guzzle/pull/2699)
32
-
33
- ## 7.0.0 - 2020-06-27
34
-
35
- No changes since 7.0.0-rc1.
36
-
37
- ## 7.0.0-rc1 - 2020-06-15
38
-
39
- ### Changed
40
-
41
- * Use error level for logging errors in Middleware [#2629](https://github.com/guzzle/guzzle/pull/2629)
42
- * Disabled IDN support by default and require ext-intl to use it [#2675](https://github.com/guzzle/guzzle/pull/2675)
43
-
44
- ## 7.0.0-beta2 - 2020-05-25
45
-
46
- ### Added
47
-
48
- * Using `Utils` class instead of functions in the `GuzzleHttp` namespace. [#2546](https://github.com/guzzle/guzzle/pull/2546)
49
- * `ClientInterface::MAJOR_VERSION` [#2583](https://github.com/guzzle/guzzle/pull/2583)
50
-
51
- ### Changed
52
-
53
- * Avoid the `getenv` function when unsafe [#2531](https://github.com/guzzle/guzzle/pull/2531)
54
- * Added real client methods [#2529](https://github.com/guzzle/guzzle/pull/2529)
55
- * Avoid functions due to global install conflicts [#2546](https://github.com/guzzle/guzzle/pull/2546)
56
- * Use Symfony intl-idn polyfill [#2550](https://github.com/guzzle/guzzle/pull/2550)
57
- * Adding methods for HTTP verbs like `Client::get()`, `Client::head()`, `Client::patch()` etc [#2529](https://github.com/guzzle/guzzle/pull/2529)
58
- * `ConnectException` extends `TransferException` [#2541](https://github.com/guzzle/guzzle/pull/2541)
59
- * Updated the default User Agent to "GuzzleHttp/7" [#2654](https://github.com/guzzle/guzzle/pull/2654)
60
-
61
- ### Fixed
62
-
63
- * Various intl icu issues [#2626](https://github.com/guzzle/guzzle/pull/2626)
64
-
65
- ### Removed
66
-
67
- * Pool option `pool_size` [#2528](https://github.com/guzzle/guzzle/pull/2528)
68
-
69
- ## 7.0.0-beta1 - 2019-12-30
70
-
71
- The diff might look very big but 95% of Guzzle users will be able to upgrade without modification.
72
- Please see [the upgrade document](UPGRADING.md) that describes all BC breaking changes.
73
-
74
- ### Added
75
-
76
- * Implement PSR-18 and dropped PHP 5 support [#2421](https://github.com/guzzle/guzzle/pull/2421) [#2474](https://github.com/guzzle/guzzle/pull/2474)
77
- * PHP 7 types [#2442](https://github.com/guzzle/guzzle/pull/2442) [#2449](https://github.com/guzzle/guzzle/pull/2449) [#2466](https://github.com/guzzle/guzzle/pull/2466) [#2497](https://github.com/guzzle/guzzle/pull/2497) [#2499](https://github.com/guzzle/guzzle/pull/2499)
78
- * IDN support for redirects [2424](https://github.com/guzzle/guzzle/pull/2424)
79
-
80
- ### Changed
81
-
82
- * Dont allow passing null as third argument to `BadResponseException::__construct()` [#2427](https://github.com/guzzle/guzzle/pull/2427)
83
- * Use SAPI constant instead of method call [#2450](https://github.com/guzzle/guzzle/pull/2450)
84
- * Use native function invocation [#2444](https://github.com/guzzle/guzzle/pull/2444)
85
- * Better defaults for PHP installations with old ICU lib [2454](https://github.com/guzzle/guzzle/pull/2454)
86
- * Added visibility to all constants [#2462](https://github.com/guzzle/guzzle/pull/2462)
87
- * Dont allow passing `null` as URI to `Client::request()` and `Client::requestAsync()` [#2461](https://github.com/guzzle/guzzle/pull/2461)
88
- * Widen the exception argument to throwable [#2495](https://github.com/guzzle/guzzle/pull/2495)
89
-
90
- ### Fixed
91
-
92
- * Logging when Promise rejected with a string [#2311](https://github.com/guzzle/guzzle/pull/2311)
93
-
94
- ### Removed
95
-
96
- * Class `SeekException` [#2162](https://github.com/guzzle/guzzle/pull/2162)
97
- * `RequestException::getResponseBodySummary()` [#2425](https://github.com/guzzle/guzzle/pull/2425)
98
- * `CookieJar::getCookieValue()` [#2433](https://github.com/guzzle/guzzle/pull/2433)
99
- * `uri_template()` and `UriTemplate` [#2440](https://github.com/guzzle/guzzle/pull/2440)
100
- * Request options `save_to` and `exceptions` [#2464](https://github.com/guzzle/guzzle/pull/2464)
101
-
102
- ## 6.5.2 - 2019-12-23
103
-
104
- * idn_to_ascii() fix for old PHP versions [#2489](https://github.com/guzzle/guzzle/pull/2489)
105
-
106
- ## 6.5.1 - 2019-12-21
107
-
108
- * Better defaults for PHP installations with old ICU lib [#2454](https://github.com/guzzle/guzzle/pull/2454)
109
- * IDN support for redirects [#2424](https://github.com/guzzle/guzzle/pull/2424)
110
-
111
- ## 6.5.0 - 2019-12-07
112
-
113
- * Improvement: Added support for reset internal queue in MockHandler. [#2143](https://github.com/guzzle/guzzle/pull/2143)
114
- * Improvement: Added support to pass arbitrary options to `curl_multi_init`. [#2287](https://github.com/guzzle/guzzle/pull/2287)
115
- * Fix: Gracefully handle passing `null` to the `header` option. [#2132](https://github.com/guzzle/guzzle/pull/2132)
116
- * Fix: `RetryMiddleware` did not do exponential delay between retires due unit mismatch. [#2132](https://github.com/guzzle/guzzle/pull/2132)
117
- * Fix: Prevent undefined offset when using array for ssl_key options. [#2348](https://github.com/guzzle/guzzle/pull/2348)
118
- * Deprecated `ClientInterface::VERSION`
119
-
120
- ## 6.4.1 - 2019-10-23
121
-
122
- * No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that
123
- * Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar`
124
-
125
- ## 6.4.0 - 2019-10-23
126
-
127
- * Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108)
128
- * Fix: Test if response is readable before returning a summary in `RequestException::getResponseBodySummary()` [#2081](https://github.com/guzzle/guzzle/pull/2081)
129
- * Fix: Add support for GUZZLE_CURL_SELECT_TIMEOUT environment variable [#2161](https://github.com/guzzle/guzzle/pull/2161)
130
- * Improvement: Added `GuzzleHttp\Exception\InvalidArgumentException` [#2163](https://github.com/guzzle/guzzle/pull/2163)
131
- * Improvement: Added `GuzzleHttp\_current_time()` to use `hrtime()` if that function exists. [#2242](https://github.com/guzzle/guzzle/pull/2242)
132
- * Improvement: Added curl's `appconnect_time` in `TransferStats` [#2284](https://github.com/guzzle/guzzle/pull/2284)
133
- * Improvement: Make GuzzleException extend Throwable wherever it's available [#2273](https://github.com/guzzle/guzzle/pull/2273)
134
- * Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335)
135
- * Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362)
136
-
137
- ## 6.3.3 - 2018-04-22
138
-
139
- * Fix: Default headers when decode_content is specified
140
-
141
-
142
- ## 6.3.2 - 2018-03-26
143
-
144
- * Fix: Release process
145
-
146
-
147
- ## 6.3.1 - 2018-03-26
148
-
149
- * Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014)
150
- * Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012)
151
- * Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999)
152
- * Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998)
153
- * Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953)
154
- * Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915)
155
- * Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916)
156
-
157
- + Minor code cleanups, documentation fixes and clarifications.
158
-
159
-
160
- ## 6.3.0 - 2017-06-22
161
-
162
- * Feature: force IP resolution (ipv4 or ipv6) [#1608](https://github.com/guzzle/guzzle/pull/1608), [#1659](https://github.com/guzzle/guzzle/pull/1659)
163
- * Improvement: Don't include summary in exception message when body is empty [#1621](https://github.com/guzzle/guzzle/pull/1621)
164
- * Improvement: Handle `on_headers` option in MockHandler [#1580](https://github.com/guzzle/guzzle/pull/1580)
165
- * Improvement: Added SUSE Linux CA path [#1609](https://github.com/guzzle/guzzle/issues/1609)
166
- * Improvement: Use class reference for getting the name of the class instead of using hardcoded strings [#1641](https://github.com/guzzle/guzzle/pull/1641)
167
- * Feature: Added `read_timeout` option [#1611](https://github.com/guzzle/guzzle/pull/1611)
168
- * Bug fix: PHP 7.x fixes [#1685](https://github.com/guzzle/guzzle/pull/1685), [#1686](https://github.com/guzzle/guzzle/pull/1686), [#1811](https://github.com/guzzle/guzzle/pull/1811)
169
- * Deprecation: BadResponseException instantiation without a response [#1642](https://github.com/guzzle/guzzle/pull/1642)
170
- * Feature: Added NTLM auth [#1569](https://github.com/guzzle/guzzle/pull/1569)
171
- * Feature: Track redirect HTTP status codes [#1711](https://github.com/guzzle/guzzle/pull/1711)
172
- * Improvement: Check handler type during construction [#1745](https://github.com/guzzle/guzzle/pull/1745)
173
- * Improvement: Always include the Content-Length if there's a body [#1721](https://github.com/guzzle/guzzle/pull/1721)
174
- * Feature: Added convenience method to access a cookie by name [#1318](https://github.com/guzzle/guzzle/pull/1318)
175
- * Bug fix: Fill `CURLOPT_CAPATH` and `CURLOPT_CAINFO` properly [#1684](https://github.com/guzzle/guzzle/pull/1684)
176
- * Improvement: Use `\GuzzleHttp\Promise\rejection_for` function instead of object init [#1827](https://github.com/guzzle/guzzle/pull/1827)
177
-
178
-
179
- + Minor code cleanups, documentation fixes and clarifications.
180
-
181
- ## 6.2.3 - 2017-02-28
182
-
183
- * Fix deprecations with guzzle/psr7 version 1.4
184
-
185
- ## 6.2.2 - 2016-10-08
186
-
187
- * Allow to pass nullable Response to delay callable
188
- * Only add scheme when host is present
189
- * Fix drain case where content-length is the literal string zero
190
- * Obfuscate in-URL credentials in exceptions
191
-
192
- ## 6.2.1 - 2016-07-18
193
-
194
- * Address HTTP_PROXY security vulnerability, CVE-2016-5385:
195
- https://httpoxy.org/
196
- * Fixing timeout bug with StreamHandler:
197
- https://github.com/guzzle/guzzle/pull/1488
198
- * Only read up to `Content-Length` in PHP StreamHandler to avoid timeouts when
199
- a server does not honor `Connection: close`.
200
- * Ignore URI fragment when sending requests.
201
-
202
- ## 6.2.0 - 2016-03-21
203
-
204
- * Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`.
205
- https://github.com/guzzle/guzzle/pull/1389
206
- * Bug fix: Fix sleep calculation when waiting for delayed requests.
207
- https://github.com/guzzle/guzzle/pull/1324
208
- * Feature: More flexible history containers.
209
- https://github.com/guzzle/guzzle/pull/1373
210
- * Bug fix: defer sink stream opening in StreamHandler.
211
- https://github.com/guzzle/guzzle/pull/1377
212
- * Bug fix: do not attempt to escape cookie values.
213
- https://github.com/guzzle/guzzle/pull/1406
214
- * Feature: report original content encoding and length on decoded responses.
215
- https://github.com/guzzle/guzzle/pull/1409
216
- * Bug fix: rewind seekable request bodies before dispatching to cURL.
217
- https://github.com/guzzle/guzzle/pull/1422
218
- * Bug fix: provide an empty string to `http_build_query` for HHVM workaround.
219
- https://github.com/guzzle/guzzle/pull/1367
220
-
221
- ## 6.1.1 - 2015-11-22
222
-
223
- * Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler
224
- https://github.com/guzzle/guzzle/commit/911bcbc8b434adce64e223a6d1d14e9a8f63e4e4
225
- * Feature: HandlerStack is now more generic.
226
- https://github.com/guzzle/guzzle/commit/f2102941331cda544745eedd97fc8fd46e1ee33e
227
- * Bug fix: setting verify to false in the StreamHandler now disables peer
228
- verification. https://github.com/guzzle/guzzle/issues/1256
229
- * Feature: Middleware now uses an exception factory, including more error
230
- context. https://github.com/guzzle/guzzle/pull/1282
231
- * Feature: better support for disabled functions.
232
- https://github.com/guzzle/guzzle/pull/1287
233
- * Bug fix: fixed regression where MockHandler was not using `sink`.
234
- https://github.com/guzzle/guzzle/pull/1292
235
-
236
- ## 6.1.0 - 2015-09-08
237
-
238
- * Feature: Added the `on_stats` request option to provide access to transfer
239
- statistics for requests. https://github.com/guzzle/guzzle/pull/1202
240
- * Feature: Added the ability to persist session cookies in CookieJars.
241
- https://github.com/guzzle/guzzle/pull/1195
242
- * Feature: Some compatibility updates for Google APP Engine
243
- https://github.com/guzzle/guzzle/pull/1216
244
- * Feature: Added support for NO_PROXY to prevent the use of a proxy based on
245
- a simple set of rules. https://github.com/guzzle/guzzle/pull/1197
246
- * Feature: Cookies can now contain square brackets.
247
- https://github.com/guzzle/guzzle/pull/1237
248
- * Bug fix: Now correctly parsing `=` inside of quotes in Cookies.
249
- https://github.com/guzzle/guzzle/pull/1232
250
- * Bug fix: Cusotm cURL options now correctly override curl options of the
251
- same name. https://github.com/guzzle/guzzle/pull/1221
252
- * Bug fix: Content-Type header is now added when using an explicitly provided
253
- multipart body. https://github.com/guzzle/guzzle/pull/1218
254
- * Bug fix: Now ignoring Set-Cookie headers that have no name.
255
- * Bug fix: Reason phrase is no longer cast to an int in some cases in the
256
- cURL handler. https://github.com/guzzle/guzzle/pull/1187
257
- * Bug fix: Remove the Authorization header when redirecting if the Host
258
- header changes. https://github.com/guzzle/guzzle/pull/1207
259
- * Bug fix: Cookie path matching fixes
260
- https://github.com/guzzle/guzzle/issues/1129
261
- * Bug fix: Fixing the cURL `body_as_string` setting
262
- https://github.com/guzzle/guzzle/pull/1201
263
- * Bug fix: quotes are no longer stripped when parsing cookies.
264
- https://github.com/guzzle/guzzle/issues/1172
265
- * Bug fix: `form_params` and `query` now always uses the `&` separator.
266
- https://github.com/guzzle/guzzle/pull/1163
267
- * Bug fix: Adding a Content-Length to PHP stream wrapper requests if not set.
268
- https://github.com/guzzle/guzzle/pull/1189
269
-
270
- ## 6.0.2 - 2015-07-04
271
-
272
- * Fixed a memory leak in the curl handlers in which references to callbacks
273
- were not being removed by `curl_reset`.
274
- * Cookies are now extracted properly before redirects.
275
- * Cookies now allow more character ranges.
276
- * Decoded Content-Encoding responses are now modified to correctly reflect
277
- their state if the encoding was automatically removed by a handler. This
278
- means that the `Content-Encoding` header may be removed an the
279
- `Content-Length` modified to reflect the message size after removing the
280
- encoding.
281
- * Added a more explicit error message when trying to use `form_params` and
282
- `multipart` in the same request.
283
- * Several fixes for HHVM support.
284
- * Functions are now conditionally required using an additional level of
285
- indirection to help with global Composer installations.
286
-
287
- ## 6.0.1 - 2015-05-27
288
-
289
- * Fixed a bug with serializing the `query` request option where the `&`
290
- separator was missing.
291
- * Added a better error message for when `body` is provided as an array. Please
292
- use `form_params` or `multipart` instead.
293
- * Various doc fixes.
294
-
295
- ## 6.0.0 - 2015-05-26
296
-
297
- * See the UPGRADING.md document for more information.
298
- * Added `multipart` and `form_params` request options.
299
- * Added `synchronous` request option.
300
- * Added the `on_headers` request option.
301
- * Fixed `expect` handling.
302
- * No longer adding default middlewares in the client ctor. These need to be
303
- present on the provided handler in order to work.
304
- * Requests are no longer initiated when sending async requests with the
305
- CurlMultiHandler. This prevents unexpected recursion from requests completing
306
- while ticking the cURL loop.
307
- * Removed the semantics of setting `default` to `true`. This is no longer
308
- required now that the cURL loop is not ticked for async requests.
309
- * Added request and response logging middleware.
310
- * No longer allowing self signed certificates when using the StreamHandler.
311
- * Ensuring that `sink` is valid if saving to a file.
312
- * Request exceptions now include a "handler context" which provides handler
313
- specific contextual information.
314
- * Added `GuzzleHttp\RequestOptions` to allow request options to be applied
315
- using constants.
316
- * `$maxHandles` has been removed from CurlMultiHandler.
317
- * `MultipartPostBody` is now part of the `guzzlehttp/psr7` package.
318
-
319
- ## 5.3.0 - 2015-05-19
320
-
321
- * Mock now supports `save_to`
322
- * Marked `AbstractRequestEvent::getTransaction()` as public.
323
- * Fixed a bug in which multiple headers using different casing would overwrite
324
- previous headers in the associative array.
325
- * Added `Utils::getDefaultHandler()`
326
- * Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated.
327
- * URL scheme is now always lowercased.
328
-
329
- ## 6.0.0-beta.1
330
-
331
- * Requires PHP >= 5.5
332
- * Updated to use PSR-7
333
- * Requires immutable messages, which basically means an event based system
334
- owned by a request instance is no longer possible.
335
- * Utilizing the [Guzzle PSR-7 package](https://github.com/guzzle/psr7).
336
- * Removed the dependency on `guzzlehttp/streams`. These stream abstractions
337
- are available in the `guzzlehttp/psr7` package under the `GuzzleHttp\Psr7`
338
- namespace.
339
- * Added middleware and handler system
340
- * Replaced the Guzzle event and subscriber system with a middleware system.
341
- * No longer depends on RingPHP, but rather places the HTTP handlers directly
342
- in Guzzle, operating on PSR-7 messages.
343
- * Retry logic is now encapsulated in `GuzzleHttp\Middleware::retry`, which
344
- means the `guzzlehttp/retry-subscriber` is now obsolete.
345
- * Mocking responses is now handled using `GuzzleHttp\Handler\MockHandler`.
346
- * Asynchronous responses
347
- * No longer supports the `future` request option to send an async request.
348
- Instead, use one of the `*Async` methods of a client (e.g., `requestAsync`,
349
- `getAsync`, etc.).
350
- * Utilizing `GuzzleHttp\Promise` instead of React's promise library to avoid
351
- recursion required by chaining and forwarding react promises. See
352
- https://github.com/guzzle/promises
353
- * Added `requestAsync` and `sendAsync` to send request asynchronously.
354
- * Added magic methods for `getAsync()`, `postAsync()`, etc. to send requests
355
- asynchronously.
356
- * Request options
357
- * POST and form updates
358
- * Added the `form_fields` and `form_files` request options.
359
- * Removed the `GuzzleHttp\Post` namespace.
360
- * The `body` request option no longer accepts an array for POST requests.
361
- * The `exceptions` request option has been deprecated in favor of the
362
- `http_errors` request options.
363
- * The `save_to` request option has been deprecated in favor of `sink` request
364
- option.
365
- * Clients no longer accept an array of URI template string and variables for
366
- URI variables. You will need to expand URI templates before passing them
367
- into a client constructor or request method.
368
- * Client methods `get()`, `post()`, `put()`, `patch()`, `options()`, etc. are
369
- now magic methods that will send synchronous requests.
370
- * Replaced `Utils.php` with plain functions in `functions.php`.
371
- * Removed `GuzzleHttp\Collection`.
372
- * Removed `GuzzleHttp\BatchResults`. Batched pool results are now returned as
373
- an array.
374
- * Removed `GuzzleHttp\Query`. Query string handling is now handled using an
375
- associative array passed into the `query` request option. The query string
376
- is serialized using PHP's `http_build_query`. If you need more control, you
377
- can pass the query string in as a string.
378
- * `GuzzleHttp\QueryParser` has been replaced with the
379
- `GuzzleHttp\Psr7\parse_query`.
380
-
381
- ## 5.2.0 - 2015-01-27
382
-
383
- * Added `AppliesHeadersInterface` to make applying headers to a request based
384
- on the body more generic and not specific to `PostBodyInterface`.
385
- * Reduced the number of stack frames needed to send requests.
386
- * Nested futures are now resolved in the client rather than the RequestFsm
387
- * Finishing state transitions is now handled in the RequestFsm rather than the
388
- RingBridge.
389
- * Added a guard in the Pool class to not use recursion for request retries.
390
-
391
- ## 5.1.0 - 2014-12-19
392
-
393
- * Pool class no longer uses recursion when a request is intercepted.
394
- * The size of a Pool can now be dynamically adjusted using a callback.
395
- See https://github.com/guzzle/guzzle/pull/943.
396
- * Setting a request option to `null` when creating a request with a client will
397
- ensure that the option is not set. This allows you to overwrite default
398
- request options on a per-request basis.
399
- See https://github.com/guzzle/guzzle/pull/937.
400
- * Added the ability to limit which protocols are allowed for redirects by
401
- specifying a `protocols` array in the `allow_redirects` request option.
402
- * Nested futures due to retries are now resolved when waiting for synchronous
403
- responses. See https://github.com/guzzle/guzzle/pull/947.
404
- * `"0"` is now an allowed URI path. See
405
- https://github.com/guzzle/guzzle/pull/935.
406
- * `Query` no longer typehints on the `$query` argument in the constructor,
407
- allowing for strings and arrays.
408
- * Exceptions thrown in the `end` event are now correctly wrapped with Guzzle
409
- specific exceptions if necessary.
410
-
411
- ## 5.0.3 - 2014-11-03
412
-
413
- This change updates query strings so that they are treated as un-encoded values
414
- by default where the value represents an un-encoded value to send over the
415
- wire. A Query object then encodes the value before sending over the wire. This
416
- means that even value query string values (e.g., ":") are url encoded. This
417
- makes the Query class match PHP's http_build_query function. However, if you
418
- want to send requests over the wire using valid query string characters that do
419
- not need to be encoded, then you can provide a string to Url::setQuery() and
420
- pass true as the second argument to specify that the query string is a raw
421
- string that should not be parsed or encoded (unless a call to getQuery() is
422
- subsequently made, forcing the query-string to be converted into a Query
423
- object).
424
-
425
- ## 5.0.2 - 2014-10-30
426
-
427
- * Added a trailing `\r\n` to multipart/form-data payloads. See
428
- https://github.com/guzzle/guzzle/pull/871
429
- * Added a `GuzzleHttp\Pool::send()` convenience method to match the docs.
430
- * Status codes are now returned as integers. See
431
- https://github.com/guzzle/guzzle/issues/881
432
- * No longer overwriting an existing `application/x-www-form-urlencoded` header
433
- when sending POST requests, allowing for customized headers. See
434
- https://github.com/guzzle/guzzle/issues/877
435
- * Improved path URL serialization.
436
-
437
- * No longer double percent-encoding characters in the path or query string if
438
- they are already encoded.
439
- * Now properly encoding the supplied path to a URL object, instead of only
440
- encoding ' ' and '?'.
441
- * Note: This has been changed in 5.0.3 to now encode query string values by
442
- default unless the `rawString` argument is provided when setting the query
443
- string on a URL: Now allowing many more characters to be present in the
444
- query string without being percent encoded. See https://tools.ietf.org/html/rfc3986#appendix-A
445
-
446
- ## 5.0.1 - 2014-10-16
447
-
448
- Bugfix release.
449
-
450
- * Fixed an issue where connection errors still returned response object in
451
- error and end events event though the response is unusable. This has been
452
- corrected so that a response is not returned in the `getResponse` method of
453
- these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867
454
- * Fixed an issue where transfer statistics were not being populated in the
455
- RingBridge. https://github.com/guzzle/guzzle/issues/866
456
-
457
- ## 5.0.0 - 2014-10-12
458
-
459
- Adding support for non-blocking responses and some minor API cleanup.
460
-
461
- ### New Features
462
-
463
- * Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`.
464
- * Added a public API for creating a default HTTP adapter.
465
- * Updated the redirect plugin to be non-blocking so that redirects are sent
466
- concurrently. Other plugins like this can now be updated to be non-blocking.
467
- * Added a "progress" event so that you can get upload and download progress
468
- events.
469
- * Added `GuzzleHttp\Pool` which implements FutureInterface and transfers
470
- requests concurrently using a capped pool size as efficiently as possible.
471
- * Added `hasListeners()` to EmitterInterface.
472
- * Removed `GuzzleHttp\ClientInterface::sendAll` and marked
473
- `GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the
474
- recommended way).
475
-
476
- ### Breaking changes
477
-
478
- The breaking changes in this release are relatively minor. The biggest thing to
479
- look out for is that request and response objects no longer implement fluent
480
- interfaces.
481
-
482
- * Removed the fluent interfaces (i.e., `return $this`) from requests,
483
- responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`,
484
- `GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and
485
- `GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of
486
- why I did this: https://ocramius.github.io/blog/fluent-interfaces-are-evil/.
487
- This also makes the Guzzle message interfaces compatible with the current
488
- PSR-7 message proposal.
489
- * Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except
490
- for the HTTP request functions from function.php, these functions are now
491
- implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode`
492
- moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to
493
- `GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to
494
- `GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be
495
- `GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php
496
- caused problems for many users: they aren't PSR-4 compliant, require an
497
- explicit include, and needed an if-guard to ensure that the functions are not
498
- declared multiple times.
499
- * Rewrote adapter layer.
500
- * Removing all classes from `GuzzleHttp\Adapter`, these are now
501
- implemented as callables that are stored in `GuzzleHttp\Ring\Client`.
502
- * Removed the concept of "parallel adapters". Sending requests serially or
503
- concurrently is now handled using a single adapter.
504
- * Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The
505
- Transaction object now exposes the request, response, and client as public
506
- properties. The getters and setters have been removed.
507
- * Removed the "headers" event. This event was only useful for changing the
508
- body a response once the headers of the response were known. You can implement
509
- a similar behavior in a number of ways. One example might be to use a
510
- FnStream that has access to the transaction being sent. For example, when the
511
- first byte is written, you could check if the response headers match your
512
- expectations, and if so, change the actual stream body that is being
513
- written to.
514
- * Removed the `asArray` parameter from
515
- `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
516
- value as an array, then use the newly added `getHeaderAsArray()` method of
517
- `MessageInterface`. This change makes the Guzzle interfaces compatible with
518
- the PSR-7 interfaces.
519
- * `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add
520
- custom request options using double-dispatch (this was an implementation
521
- detail). Instead, you should now provide an associative array to the
522
- constructor which is a mapping of the request option name mapping to a
523
- function that applies the option value to a request.
524
- * Removed the concept of "throwImmediately" from exceptions and error events.
525
- This control mechanism was used to stop a transfer of concurrent requests
526
- from completing. This can now be handled by throwing the exception or by
527
- cancelling a pool of requests or each outstanding future request individually.
528
- * Updated to "GuzzleHttp\Streams" 3.0.
529
- * `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a
530
- `maxLen` parameter. This update makes the Guzzle streams project
531
- compatible with the current PSR-7 proposal.
532
- * `GuzzleHttp\Stream\Stream::__construct`,
533
- `GuzzleHttp\Stream\Stream::factory`, and
534
- `GuzzleHttp\Stream\Utils::create` no longer accept a size in the second
535
- argument. They now accept an associative array of options, including the
536
- "size" key and "metadata" key which can be used to provide custom metadata.
537
-
538
- ## 4.2.2 - 2014-09-08
539
-
540
- * Fixed a memory leak in the CurlAdapter when reusing cURL handles.
541
- * No longer using `request_fulluri` in stream adapter proxies.
542
- * Relative redirects are now based on the last response, not the first response.
543
-
544
- ## 4.2.1 - 2014-08-19
545
-
546
- * Ensuring that the StreamAdapter does not always add a Content-Type header
547
- * Adding automated github releases with a phar and zip
548
-
549
- ## 4.2.0 - 2014-08-17
550
-
551
- * Now merging in default options using a case-insensitive comparison.
552
- Closes https://github.com/guzzle/guzzle/issues/767
553
- * Added the ability to automatically decode `Content-Encoding` response bodies
554
- using the `decode_content` request option. This is set to `true` by default
555
- to decode the response body if it comes over the wire with a
556
- `Content-Encoding`. Set this value to `false` to disable decoding the
557
- response content, and pass a string to provide a request `Accept-Encoding`
558
- header and turn on automatic response decoding. This feature now allows you
559
- to pass an `Accept-Encoding` header in the headers of a request but still
560
- disable automatic response decoding.
561
- Closes https://github.com/guzzle/guzzle/issues/764
562
- * Added the ability to throw an exception immediately when transferring
563
- requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760
564
- * Updating guzzlehttp/streams dependency to ~2.1
565
- * No longer utilizing the now deprecated namespaced methods from the stream
566
- package.
567
-
568
- ## 4.1.8 - 2014-08-14
569
-
570
- * Fixed an issue in the CurlFactory that caused setting the `stream=false`
571
- request option to throw an exception.
572
- See: https://github.com/guzzle/guzzle/issues/769
573
- * TransactionIterator now calls rewind on the inner iterator.
574
- See: https://github.com/guzzle/guzzle/pull/765
575
- * You can now set the `Content-Type` header to `multipart/form-data`
576
- when creating POST requests to force multipart bodies.
577
- See https://github.com/guzzle/guzzle/issues/768
578
-
579
- ## 4.1.7 - 2014-08-07
580
-
581
- * Fixed an error in the HistoryPlugin that caused the same request and response
582
- to be logged multiple times when an HTTP protocol error occurs.
583
- * Ensuring that cURL does not add a default Content-Type when no Content-Type
584
- has been supplied by the user. This prevents the adapter layer from modifying
585
- the request that is sent over the wire after any listeners may have already
586
- put the request in a desired state (e.g., signed the request).
587
- * Throwing an exception when you attempt to send requests that have the
588
- "stream" set to true in parallel using the MultiAdapter.
589
- * Only calling curl_multi_select when there are active cURL handles. This was
590
- previously changed and caused performance problems on some systems due to PHP
591
- always selecting until the maximum select timeout.
592
- * Fixed a bug where multipart/form-data POST fields were not correctly
593
- aggregated (e.g., values with "&").
594
-
595
- ## 4.1.6 - 2014-08-03
596
-
597
- * Added helper methods to make it easier to represent messages as strings,
598
- including getting the start line and getting headers as a string.
599
-
600
- ## 4.1.5 - 2014-08-02
601
-
602
- * Automatically retrying cURL "Connection died, retrying a fresh connect"
603
- errors when possible.
604
- * cURL implementation cleanup
605
- * Allowing multiple event subscriber listeners to be registered per event by
606
- passing an array of arrays of listener configuration.
607
-
608
- ## 4.1.4 - 2014-07-22
609
-
610
- * Fixed a bug that caused multi-part POST requests with more than one field to
611
- serialize incorrectly.
612
- * Paths can now be set to "0"
613
- * `ResponseInterface::xml` now accepts a `libxml_options` option and added a
614
- missing default argument that was required when parsing XML response bodies.
615
- * A `save_to` stream is now created lazily, which means that files are not
616
- created on disk unless a request succeeds.
617
-
618
- ## 4.1.3 - 2014-07-15
619
-
620
- * Various fixes to multipart/form-data POST uploads
621
- * Wrapping function.php in an if-statement to ensure Guzzle can be used
622
- globally and in a Composer install
623
- * Fixed an issue with generating and merging in events to an event array
624
- * POST headers are only applied before sending a request to allow you to change
625
- the query aggregator used before uploading
626
- * Added much more robust query string parsing
627
- * Fixed various parsing and normalization issues with URLs
628
- * Fixing an issue where multi-valued headers were not being utilized correctly
629
- in the StreamAdapter
630
-
631
- ## 4.1.2 - 2014-06-18
632
-
633
- * Added support for sending payloads with GET requests
634
-
635
- ## 4.1.1 - 2014-06-08
636
-
637
- * Fixed an issue related to using custom message factory options in subclasses
638
- * Fixed an issue with nested form fields in a multi-part POST
639
- * Fixed an issue with using the `json` request option for POST requests
640
- * Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar`
641
-
642
- ## 4.1.0 - 2014-05-27
643
-
644
- * Added a `json` request option to easily serialize JSON payloads.
645
- * Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON.
646
- * Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`.
647
- * Added the ability to provide an emitter to a client in the client constructor.
648
- * Added the ability to persist a cookie session using $_SESSION.
649
- * Added a trait that can be used to add event listeners to an iterator.
650
- * Removed request method constants from RequestInterface.
651
- * Fixed warning when invalid request start-lines are received.
652
- * Updated MessageFactory to work with custom request option methods.
653
- * Updated cacert bundle to latest build.
654
-
655
- 4.0.2 (2014-04-16)
656
- ------------------
657
-
658
- * Proxy requests using the StreamAdapter now properly use request_fulluri (#632)
659
- * Added the ability to set scalars as POST fields (#628)
660
-
661
- ## 4.0.1 - 2014-04-04
662
-
663
- * The HTTP status code of a response is now set as the exception code of
664
- RequestException objects.
665
- * 303 redirects will now correctly switch from POST to GET requests.
666
- * The default parallel adapter of a client now correctly uses the MultiAdapter.
667
- * HasDataTrait now initializes the internal data array as an empty array so
668
- that the toArray() method always returns an array.
669
-
670
- ## 4.0.0 - 2014-03-29
671
-
672
- * For information on changes and upgrading, see:
673
- https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
674
- * Added `GuzzleHttp\batch()` as a convenience function for sending requests in
675
- parallel without needing to write asynchronous code.
676
- * Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`.
677
- You can now pass a callable or an array of associative arrays where each
678
- associative array contains the "fn", "priority", and "once" keys.
679
-
680
- ## 4.0.0.rc-2 - 2014-03-25
681
-
682
- * Removed `getConfig()` and `setConfig()` from clients to avoid confusion
683
- around whether things like base_url, message_factory, etc. should be able to
684
- be retrieved or modified.
685
- * Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface
686
- * functions.php functions were renamed using snake_case to match PHP idioms
687
- * Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and
688
- `GUZZLE_CURL_SELECT_TIMEOUT` environment variables
689
- * Added the ability to specify custom `sendAll()` event priorities
690
- * Added the ability to specify custom stream context options to the stream
691
- adapter.
692
- * Added a functions.php function for `get_path()` and `set_path()`
693
- * CurlAdapter and MultiAdapter now use a callable to generate curl resources
694
- * MockAdapter now properly reads a body and emits a `headers` event
695
- * Updated Url class to check if a scheme and host are set before adding ":"
696
- and "//". This allows empty Url (e.g., "") to be serialized as "".
697
- * Parsing invalid XML no longer emits warnings
698
- * Curl classes now properly throw AdapterExceptions
699
- * Various performance optimizations
700
- * Streams are created with the faster `Stream\create()` function
701
- * Marked deprecation_proxy() as internal
702
- * Test server is now a collection of static methods on a class
703
-
704
- ## 4.0.0-rc.1 - 2014-03-15
705
-
706
- * See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
707
-
708
- ## 3.8.1 - 2014-01-28
709
-
710
- * Bug: Always using GET requests when redirecting from a 303 response
711
- * Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in
712
- `Guzzle\Http\ClientInterface::setSslVerification()`
713
- * Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL
714
- * Bug: The body of a request can now be set to `"0"`
715
- * Sending PHP stream requests no longer forces `HTTP/1.0`
716
- * Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of
717
- each sub-exception
718
- * Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than
719
- clobbering everything).
720
- * Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators)
721
- * Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`.
722
- For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`.
723
- * Now properly escaping the regular expression delimiter when matching Cookie domains.
724
- * Network access is now disabled when loading XML documents
725
-
726
- ## 3.8.0 - 2013-12-05
727
-
728
- * Added the ability to define a POST name for a file
729
- * JSON response parsing now properly walks additionalProperties
730
- * cURL error code 18 is now retried automatically in the BackoffPlugin
731
- * Fixed a cURL error when URLs contain fragments
732
- * Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were
733
- CurlExceptions
734
- * CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e)
735
- * Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS`
736
- * Fixed a bug that was encountered when parsing empty header parameters
737
- * UriTemplate now has a `setRegex()` method to match the docs
738
- * The `debug` request parameter now checks if it is truthy rather than if it exists
739
- * Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin
740
- * Added the ability to combine URLs using strict RFC 3986 compliance
741
- * Command objects can now return the validation errors encountered by the command
742
- * Various fixes to cache revalidation (#437 and 29797e5)
743
- * Various fixes to the AsyncPlugin
744
- * Cleaned up build scripts
745
-
746
- ## 3.7.4 - 2013-10-02
747
-
748
- * Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430)
749
- * Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp
750
- (see https://github.com/aws/aws-sdk-php/issues/147)
751
- * Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots
752
- * Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420)
753
- * Updated the bundled cacert.pem (#419)
754
- * OauthPlugin now supports adding authentication to headers or query string (#425)
755
-
756
- ## 3.7.3 - 2013-09-08
757
-
758
- * Added the ability to get the exception associated with a request/command when using `MultiTransferException` and
759
- `CommandTransferException`.
760
- * Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description
761
- * Schemas are only injected into response models when explicitly configured.
762
- * No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of
763
- an EntityBody.
764
- * Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator.
765
- * Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`.
766
- * Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody()
767
- * Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin
768
- * Bug fix: Visiting XML attributes first before visiting XML children when serializing requests
769
- * Bug fix: Properly parsing headers that contain commas contained in quotes
770
- * Bug fix: mimetype guessing based on a filename is now case-insensitive
771
-
772
- ## 3.7.2 - 2013-08-02
773
-
774
- * Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander
775
- See https://github.com/guzzle/guzzle/issues/371
776
- * Bug fix: Cookie domains are now matched correctly according to RFC 6265
777
- See https://github.com/guzzle/guzzle/issues/377
778
- * Bug fix: GET parameters are now used when calculating an OAuth signature
779
- * Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted
780
- * `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched
781
- * `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input.
782
- See https://github.com/guzzle/guzzle/issues/379
783
- * Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See
784
- https://github.com/guzzle/guzzle/pull/380
785
- * cURL multi cleanup and optimizations
786
-
787
- ## 3.7.1 - 2013-07-05
788
-
789
- * Bug fix: Setting default options on a client now works
790
- * Bug fix: Setting options on HEAD requests now works. See #352
791
- * Bug fix: Moving stream factory before send event to before building the stream. See #353
792
- * Bug fix: Cookies no longer match on IP addresses per RFC 6265
793
- * Bug fix: Correctly parsing header parameters that are in `<>` and quotes
794
- * Added `cert` and `ssl_key` as request options
795
- * `Host` header can now diverge from the host part of a URL if the header is set manually
796
- * `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter
797
- * OAuth parameters are only added via the plugin if they aren't already set
798
- * Exceptions are now thrown when a URL cannot be parsed
799
- * Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails
800
- * Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin
801
-
802
- ## 3.7.0 - 2013-06-10
803
-
804
- * See UPGRADING.md for more information on how to upgrade.
805
- * Requests now support the ability to specify an array of $options when creating a request to more easily modify a
806
- request. You can pass a 'request.options' configuration setting to a client to apply default request options to
807
- every request created by a client (e.g. default query string variables, headers, curl options, etc.).
808
- * Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`.
809
- See `Guzzle\Http\StaticClient::mount`.
810
- * Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests
811
- created by a command (e.g. custom headers, query string variables, timeout settings, etc.).
812
- * Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the
813
- headers of a response
814
- * Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key
815
- (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`)
816
- * ServiceBuilders now support storing and retrieving arbitrary data
817
- * CachePlugin can now purge all resources for a given URI
818
- * CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource
819
- * CachePlugin now uses the Vary header to determine if a resource is a cache hit
820
- * `Guzzle\Http\Message\Response` now implements `\Serializable`
821
- * Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters
822
- * `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable
823
- * Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()`
824
- * Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size
825
- * `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message
826
- * Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older
827
- Symfony users can still use the old version of Monolog.
828
- * Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`.
829
- Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`.
830
- * Several performance improvements to `Guzzle\Common\Collection`
831
- * Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
832
- createRequest, head, delete, put, patch, post, options, prepareRequest
833
- * Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
834
- * Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
835
- * Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
836
- `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
837
- resource, string, or EntityBody into the $options parameter to specify the download location of the response.
838
- * Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
839
- default `array()`
840
- * Added `Guzzle\Stream\StreamInterface::isRepeatable`
841
- * Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
842
- $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
843
- $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`.
844
- * Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`.
845
- * Removed `Guzzle\Http\ClientInterface::expandTemplate()`
846
- * Removed `Guzzle\Http\ClientInterface::setRequestFactory()`
847
- * Removed `Guzzle\Http\ClientInterface::getCurlMulti()`
848
- * Removed `Guzzle\Http\Message\RequestInterface::canCache`
849
- * Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`
850
- * Removed `Guzzle\Http\Message\RequestInterface::isRedirect`
851
- * Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
852
- * You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting
853
- `Guzzle\Common\Version::$emitWarnings` to true.
854
- * Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use
855
- `$request->getResponseBody()->isRepeatable()` instead.
856
- * Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
857
- `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
858
- * Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
859
- `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
860
- * Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
861
- * Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
862
- * Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
863
- * Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand.
864
- These will work through Guzzle 4.0
865
- * Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params].
866
- * Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
867
- * Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`.
868
- * Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`.
869
- * Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
870
- * Marked `Guzzle\Common\Collection::inject()` as deprecated.
871
- * Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');`
872
- * CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
873
- CacheStorageInterface. These two objects and interface will be removed in a future version.
874
- * Always setting X-cache headers on cached responses
875
- * Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
876
- * `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
877
- $request, Response $response);`
878
- * `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
879
- * `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
880
- * Added `CacheStorageInterface::purge($url)`
881
- * `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
882
- $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
883
- CanCacheStrategyInterface $canCache = null)`
884
- * Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
885
-
886
- ## 3.6.0 - 2013-05-29
887
-
888
- * ServiceDescription now implements ToArrayInterface
889
- * Added command.hidden_params to blacklist certain headers from being treated as additionalParameters
890
- * Guzzle can now correctly parse incomplete URLs
891
- * Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
892
- * Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
893
- * Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
894
- * Specific header implementations can be created for complex headers. When a message creates a header, it uses a
895
- HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
896
- CacheControl header implementation.
897
- * Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
898
- * Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
899
- * Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
900
- Guzzle\Http\Curl\RequestMediator
901
- * Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
902
- * Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
903
- * Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
904
- * Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
905
- * Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
906
- * All response header helper functions return a string rather than mixing Header objects and strings inconsistently
907
- * Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
908
- directly via interfaces
909
- * Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
910
- but are a no-op until removed.
911
- * Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
912
- `Guzzle\Service\Command\ArrayCommandInterface`.
913
- * Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
914
- on a request while the request is still being transferred
915
- * The ability to case-insensitively search for header values
916
- * Guzzle\Http\Message\Header::hasExactHeader
917
- * Guzzle\Http\Message\Header::raw. Use getAll()
918
- * Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
919
- instead.
920
- * `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
921
- * Added the ability to cast Model objects to a string to view debug information.
922
-
923
- ## 3.5.0 - 2013-05-13
924
-
925
- * Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times
926
- * Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove
927
- itself from the EventDispatcher)
928
- * Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values
929
- * Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too
930
- * Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a
931
- non-existent key
932
- * Bug: All __call() method arguments are now required (helps with mocking frameworks)
933
- * Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference
934
- to help with refcount based garbage collection of resources created by sending a request
935
- * Deprecating ZF1 cache and log adapters. These will be removed in the next major version.
936
- * Deprecating `Response::getPreviousResponse()` (method signature still exists, but it's deprecated). Use the
937
- HistoryPlugin for a history.
938
- * Added a `responseBody` alias for the `response_body` location
939
- * Refactored internals to no longer rely on Response::getRequest()
940
- * HistoryPlugin can now be cast to a string
941
- * HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests
942
- and responses that are sent over the wire
943
- * Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects
944
-
945
- ## 3.4.3 - 2013-04-30
946
-
947
- * Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response
948
- * Added a check to re-extract the temp cacert bundle from the phar before sending each request
949
-
950
- ## 3.4.2 - 2013-04-29
951
-
952
- * Bug fix: Stream objects now work correctly with "a" and "a+" modes
953
- * Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present
954
- * Bug fix: AsyncPlugin no longer forces HEAD requests
955
- * Bug fix: DateTime timezones are now properly handled when using the service description schema formatter
956
- * Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails
957
- * Setting a response on a request will write to the custom request body from the response body if one is specified
958
- * LogPlugin now writes to php://output when STDERR is undefined
959
- * Added the ability to set multiple POST files for the same key in a single call
960
- * application/x-www-form-urlencoded POSTs now use the utf-8 charset by default
961
- * Added the ability to queue CurlExceptions to the MockPlugin
962
- * Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send)
963
- * Configuration loading now allows remote files
964
-
965
- ## 3.4.1 - 2013-04-16
966
-
967
- * Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti
968
- handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost.
969
- * Exceptions are now properly grouped when sending requests in parallel
970
- * Redirects are now properly aggregated when a multi transaction fails
971
- * Redirects now set the response on the original object even in the event of a failure
972
- * Bug fix: Model names are now properly set even when using $refs
973
- * Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax
974
- * Added support for oauth_callback in OAuth signatures
975
- * Added support for oauth_verifier in OAuth signatures
976
- * Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection
977
-
978
- ## 3.4.0 - 2013-04-11
979
-
980
- * Bug fix: URLs are now resolved correctly based on https://tools.ietf.org/html/rfc3986#section-5.2. #289
981
- * Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289
982
- * Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263
983
- * Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264.
984
- * Bug fix: Added `number` type to service descriptions.
985
- * Bug fix: empty parameters are removed from an OAuth signature
986
- * Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header
987
- * Bug fix: Fixed "array to string" error when validating a union of types in a service description
988
- * Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream
989
- * Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin.
990
- * Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs.
991
- * The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections.
992
- * Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if
993
- the Content-Type can be determined based on the entity body or the path of the request.
994
- * Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder.
995
- * Added support for a PSR-3 LogAdapter.
996
- * Added a `command.after_prepare` event
997
- * Added `oauth_callback` parameter to the OauthPlugin
998
- * Added the ability to create a custom stream class when using a stream factory
999
- * Added a CachingEntityBody decorator
1000
- * Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized.
1001
- * The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar.
1002
- * You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies
1003
- * POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This
1004
- means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use
1005
- POST fields or files (the latter is only used when emulating a form POST in the browser).
1006
- * Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest
1007
-
1008
- ## 3.3.1 - 2013-03-10
1009
-
1010
- * Added the ability to create PHP streaming responses from HTTP requests
1011
- * Bug fix: Running any filters when parsing response headers with service descriptions
1012
- * Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing
1013
- * Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across
1014
- response location visitors.
1015
- * Bug fix: Removed the possibility of creating configuration files with circular dependencies
1016
- * RequestFactory::create() now uses the key of a POST file when setting the POST file name
1017
- * Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set
1018
-
1019
- ## 3.3.0 - 2013-03-03
1020
-
1021
- * A large number of performance optimizations have been made
1022
- * Bug fix: Added 'wb' as a valid write mode for streams
1023
- * Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned
1024
- * Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()`
1025
- * BC: Removed `Guzzle\Http\Utils` class
1026
- * BC: Setting a service description on a client will no longer modify the client's command factories.
1027
- * BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using
1028
- the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
1029
- * BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to
1030
- lowercase
1031
- * Operation parameter objects are now lazy loaded internally
1032
- * Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses
1033
- * Added support for instantiating responseType=class responseClass classes. Classes must implement
1034
- `Guzzle\Service\Command\ResponseClassInterface`
1035
- * Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These
1036
- additional properties also support locations and can be used to parse JSON responses where the outermost part of the
1037
- JSON is an array
1038
- * Added support for nested renaming of JSON models (rename sentAs to name)
1039
- * CachePlugin
1040
- * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error
1041
- * Debug headers can now added to cached response in the CachePlugin
1042
-
1043
- ## 3.2.0 - 2013-02-14
1044
-
1045
- * CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients.
1046
- * URLs with no path no longer contain a "/" by default
1047
- * Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url.
1048
- * BadResponseException no longer includes the full request and response message
1049
- * Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface
1050
- * Adding getResponseBody() to Guzzle\Http\Message\RequestInterface
1051
- * Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription
1052
- * Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list
1053
- * xmlEncoding can now be customized for the XML declaration of a XML service description operation
1054
- * Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value
1055
- aggregation and no longer uses callbacks
1056
- * The URL encoding implementation of Guzzle\Http\QueryString can now be customized
1057
- * Bug fix: Filters were not always invoked for array service description parameters
1058
- * Bug fix: Redirects now use a target response body rather than a temporary response body
1059
- * Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded
1060
- * Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives
1061
-
1062
- ## 3.1.2 - 2013-01-27
1063
-
1064
- * Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the
1065
- response body. For example, the XmlVisitor now parses the XML response into an array in the before() method.
1066
- * Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent
1067
- * CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444)
1068
- * Fixed a bug where redirect responses were not chained correctly using getPreviousResponse()
1069
- * Setting default headers on a client after setting the user-agent will not erase the user-agent setting
1070
-
1071
- ## 3.1.1 - 2013-01-20
1072
-
1073
- * Adding wildcard support to Guzzle\Common\Collection::getPath()
1074
- * Adding alias support to ServiceBuilder configs
1075
- * Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface
1076
-
1077
- ## 3.1.0 - 2013-01-12
1078
-
1079
- * BC: CurlException now extends from RequestException rather than BadResponseException
1080
- * BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse()
1081
- * Added getData to ServiceDescriptionInterface
1082
- * Added context array to RequestInterface::setState()
1083
- * Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http
1084
- * Bug: Adding required content-type when JSON request visitor adds JSON to a command
1085
- * Bug: Fixing the serialization of a service description with custom data
1086
- * Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing
1087
- an array of successful and failed responses
1088
- * Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection
1089
- * Added Guzzle\Http\IoEmittingEntityBody
1090
- * Moved command filtration from validators to location visitors
1091
- * Added `extends` attributes to service description parameters
1092
- * Added getModels to ServiceDescriptionInterface
1093
-
1094
- ## 3.0.7 - 2012-12-19
1095
-
1096
- * Fixing phar detection when forcing a cacert to system if null or true
1097
- * Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()`
1098
- * Cleaning up `Guzzle\Common\Collection::inject` method
1099
- * Adding a response_body location to service descriptions
1100
-
1101
- ## 3.0.6 - 2012-12-09
1102
-
1103
- * CurlMulti performance improvements
1104
- * Adding setErrorResponses() to Operation
1105
- * composer.json tweaks
1106
-
1107
- ## 3.0.5 - 2012-11-18
1108
-
1109
- * Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin
1110
- * Bug: Response body can now be a string containing "0"
1111
- * Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert
1112
- * Bug: QueryString::fromString now properly parses query string parameters that contain equal signs
1113
- * Added support for XML attributes in service description responses
1114
- * DefaultRequestSerializer now supports array URI parameter values for URI template expansion
1115
- * Added better mimetype guessing to requests and post files
1116
-
1117
- ## 3.0.4 - 2012-11-11
1118
-
1119
- * Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value
1120
- * Bug: Cookies can now be added that have a name, domain, or value set to "0"
1121
- * Bug: Using the system cacert bundle when using the Phar
1122
- * Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures
1123
- * Enhanced cookie jar de-duplication
1124
- * Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added
1125
- * Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies
1126
- * Added the ability to create any sort of hash for a stream rather than just an MD5 hash
1127
-
1128
- ## 3.0.3 - 2012-11-04
1129
-
1130
- * Implementing redirects in PHP rather than cURL
1131
- * Added PECL URI template extension and using as default parser if available
1132
- * Bug: Fixed Content-Length parsing of Response factory
1133
- * Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams.
1134
- * Adding ToArrayInterface throughout library
1135
- * Fixing OauthPlugin to create unique nonce values per request
1136
-
1137
- ## 3.0.2 - 2012-10-25
1138
-
1139
- * Magic methods are enabled by default on clients
1140
- * Magic methods return the result of a command
1141
- * Service clients no longer require a base_url option in the factory
1142
- * Bug: Fixed an issue with URI templates where null template variables were being expanded
1143
-
1144
- ## 3.0.1 - 2012-10-22
1145
-
1146
- * Models can now be used like regular collection objects by calling filter, map, etc.
1147
- * Models no longer require a Parameter structure or initial data in the constructor
1148
- * Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator`
1149
-
1150
- ## 3.0.0 - 2012-10-15
1151
-
1152
- * Rewrote service description format to be based on Swagger
1153
- * Now based on JSON schema
1154
- * Added nested input structures and nested response models
1155
- * Support for JSON and XML input and output models
1156
- * Renamed `commands` to `operations`
1157
- * Removed dot class notation
1158
- * Removed custom types
1159
- * Broke the project into smaller top-level namespaces to be more component friendly
1160
- * Removed support for XML configs and descriptions. Use arrays or JSON files.
1161
- * Removed the Validation component and Inspector
1162
- * Moved all cookie code to Guzzle\Plugin\Cookie
1163
- * Magic methods on a Guzzle\Service\Client now return the command un-executed.
1164
- * Calling getResult() or getResponse() on a command will lazily execute the command if needed.
1165
- * Now shipping with cURL's CA certs and using it by default
1166
- * Added previousResponse() method to response objects
1167
- * No longer sending Accept and Accept-Encoding headers on every request
1168
- * Only sending an Expect header by default when a payload is greater than 1MB
1169
- * Added/moved client options:
1170
- * curl.blacklist to curl.option.blacklist
1171
- * Added ssl.certificate_authority
1172
- * Added a Guzzle\Iterator component
1173
- * Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin
1174
- * Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin)
1175
- * Added a more robust caching plugin
1176
- * Added setBody to response objects
1177
- * Updating LogPlugin to use a more flexible MessageFormatter
1178
- * Added a completely revamped build process
1179
- * Cleaning up Collection class and removing default values from the get method
1180
- * Fixed ZF2 cache adapters
1181
-
1182
- ## 2.8.8 - 2012-10-15
1183
-
1184
- * Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did
1185
-
1186
- ## 2.8.7 - 2012-09-30
1187
-
1188
- * Bug: Fixed config file aliases for JSON includes
1189
- * Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests
1190
- * Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload
1191
- * Bug: Hardening request and response parsing to account for missing parts
1192
- * Bug: Fixed PEAR packaging
1193
- * Bug: Fixed Request::getInfo
1194
- * Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail
1195
- * Adding the ability for the namespace Iterator factory to look in multiple directories
1196
- * Added more getters/setters/removers from service descriptions
1197
- * Added the ability to remove POST fields from OAuth signatures
1198
- * OAuth plugin now supports 2-legged OAuth
1199
-
1200
- ## 2.8.6 - 2012-09-05
1201
-
1202
- * Added the ability to modify and build service descriptions
1203
- * Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command
1204
- * Added a `json` parameter location
1205
- * Now allowing dot notation for classes in the CacheAdapterFactory
1206
- * Using the union of two arrays rather than an array_merge when extending service builder services and service params
1207
- * Ensuring that a service is a string before doing strpos() checks on it when substituting services for references
1208
- in service builder config files.
1209
- * Services defined in two different config files that include one another will by default replace the previously
1210
- defined service, but you can now create services that extend themselves and merge their settings over the previous
1211
- * The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like
1212
- '_default' with a default JSON configuration file.
1213
-
1214
- ## 2.8.5 - 2012-08-29
1215
-
1216
- * Bug: Suppressed empty arrays from URI templates
1217
- * Bug: Added the missing $options argument from ServiceDescription::factory to enable caching
1218
- * Added support for HTTP responses that do not contain a reason phrase in the start-line
1219
- * AbstractCommand commands are now invokable
1220
- * Added a way to get the data used when signing an Oauth request before a request is sent
1221
-
1222
- ## 2.8.4 - 2012-08-15
1223
-
1224
- * Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin
1225
- * Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable.
1226
- * Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream
1227
- * Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream
1228
- * Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5())
1229
- * Added additional response status codes
1230
- * Removed SSL information from the default User-Agent header
1231
- * DELETE requests can now send an entity body
1232
- * Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries
1233
- * Added the ability of the MockPlugin to consume mocked request bodies
1234
- * LogPlugin now exposes request and response objects in the extras array
1235
-
1236
- ## 2.8.3 - 2012-07-30
1237
-
1238
- * Bug: Fixed a case where empty POST requests were sent as GET requests
1239
- * Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body
1240
- * Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new
1241
- * Added multiple inheritance to service description commands
1242
- * Added an ApiCommandInterface and added `getParamNames()` and `hasParam()`
1243
- * Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything
1244
- * Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles
1245
-
1246
- ## 2.8.2 - 2012-07-24
1247
-
1248
- * Bug: Query string values set to 0 are no longer dropped from the query string
1249
- * Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()`
1250
- * Bug: `+` is now treated as an encoded space when parsing query strings
1251
- * QueryString and Collection performance improvements
1252
- * Allowing dot notation for class paths in filters attribute of a service descriptions
1253
-
1254
- ## 2.8.1 - 2012-07-16
1255
-
1256
- * Loosening Event Dispatcher dependency
1257
- * POST redirects can now be customized using CURLOPT_POSTREDIR
1258
-
1259
- ## 2.8.0 - 2012-07-15
1260
-
1261
- * BC: Guzzle\Http\Query
1262
- * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl)
1263
- * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding()
1264
- * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool)
1265
- * Changed the aggregation functions of QueryString to be static methods
1266
- * Can now use fromString() with querystrings that have a leading ?
1267
- * cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters
1268
- * Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body
1269
- * Cookies are no longer URL decoded by default
1270
- * Bug: URI template variables set to null are no longer expanded
1271
-
1272
- ## 2.7.2 - 2012-07-02
1273
-
1274
- * BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser.
1275
- * BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty()
1276
- * CachePlugin now allows for a custom request parameter function to check if a request can be cached
1277
- * Bug fix: CachePlugin now only caches GET and HEAD requests by default
1278
- * Bug fix: Using header glue when transferring headers over the wire
1279
- * Allowing deeply nested arrays for composite variables in URI templates
1280
- * Batch divisors can now return iterators or arrays
1281
-
1282
- ## 2.7.1 - 2012-06-26
1283
-
1284
- * Minor patch to update version number in UA string
1285
- * Updating build process
1286
-
1287
- ## 2.7.0 - 2012-06-25
1288
-
1289
- * BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes.
1290
- * BC: Removed magic setX methods from commands
1291
- * BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method
1292
- * Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable.
1293
- * Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity)
1294
- * Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace
1295
- * Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin
1296
- * Added the ability to set POST fields and files in a service description
1297
- * Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method
1298
- * Adding a command.before_prepare event to clients
1299
- * Added BatchClosureTransfer and BatchClosureDivisor
1300
- * BatchTransferException now includes references to the batch divisor and transfer strategies
1301
- * Fixed some tests so that they pass more reliably
1302
- * Added Guzzle\Common\Log\ArrayLogAdapter
1303
-
1304
- ## 2.6.6 - 2012-06-10
1305
-
1306
- * BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin
1307
- * BC: Removing Guzzle\Service\Command\CommandSet
1308
- * Adding generic batching system (replaces the batch queue plugin and command set)
1309
- * Updating ZF cache and log adapters and now using ZF's composer repository
1310
- * Bug: Setting the name of each ApiParam when creating through an ApiCommand
1311
- * Adding result_type, result_doc, deprecated, and doc_url to service descriptions
1312
- * Bug: Changed the default cookie header casing back to 'Cookie'
1313
-
1314
- ## 2.6.5 - 2012-06-03
1315
-
1316
- * BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource()
1317
- * BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from
1318
- * BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data
1319
- * BC: Renaming methods in the CookieJarInterface
1320
- * Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations
1321
- * Making the default glue for HTTP headers ';' instead of ','
1322
- * Adding a removeValue to Guzzle\Http\Message\Header
1323
- * Adding getCookies() to request interface.
1324
- * Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber()
1325
-
1326
- ## 2.6.4 - 2012-05-30
1327
-
1328
- * BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class.
1329
- * BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand
1330
- * Bug: Fixing magic method command calls on clients
1331
- * Bug: Email constraint only validates strings
1332
- * Bug: Aggregate POST fields when POST files are present in curl handle
1333
- * Bug: Fixing default User-Agent header
1334
- * Bug: Only appending or prepending parameters in commands if they are specified
1335
- * Bug: Not requiring response reason phrases or status codes to match a predefined list of codes
1336
- * Allowing the use of dot notation for class namespaces when using instance_of constraint
1337
- * Added any_match validation constraint
1338
- * Added an AsyncPlugin
1339
- * Passing request object to the calculateWait method of the ExponentialBackoffPlugin
1340
- * Allowing the result of a command object to be changed
1341
- * Parsing location and type sub values when instantiating a service description rather than over and over at runtime
1342
-
1343
- ## 2.6.3 - 2012-05-23
1344
-
1345
- * [BC] Guzzle\Common\FromConfigInterface no longer requires any config options.
1346
- * [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields.
1347
- * You can now use an array of data when creating PUT request bodies in the request factory.
1348
- * Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable.
1349
- * [Http] Adding support for Content-Type in multipart POST uploads per upload
1350
- * [Http] Added support for uploading multiple files using the same name (foo[0], foo[1])
1351
- * Adding more POST data operations for easier manipulation of POST data.
1352
- * You can now set empty POST fields.
1353
- * The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files.
1354
- * Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate.
1355
- * CS updates
1356
-
1357
- ## 2.6.2 - 2012-05-19
1358
-
1359
- * [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method.
1360
-
1361
- ## 2.6.1 - 2012-05-19
1362
-
1363
- * [BC] Removing 'path' support in service descriptions. Use 'uri'.
1364
- * [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache.
1365
- * [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it.
1366
- * [BC] Removing Guzzle\Common\XmlElement.
1367
- * All commands, both dynamic and concrete, have ApiCommand objects.
1368
- * Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits.
1369
- * Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored.
1370
- * Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible.
1371
-
1372
- ## 2.6.0 - 2012-05-15
1373
-
1374
- * [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder
1375
- * [BC] Executing a Command returns the result of the command rather than the command
1376
- * [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed.
1377
- * [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args.
1378
- * [BC] Moving ResourceIterator* to Guzzle\Service\Resource
1379
- * [BC] Completely refactored ResourceIterators to iterate over a cloned command object
1380
- * [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate
1381
- * [BC] Guzzle\Guzzle is now deprecated
1382
- * Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject
1383
- * Adding Guzzle\Version class to give version information about Guzzle
1384
- * Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate()
1385
- * Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data
1386
- * ServiceDescription and ServiceBuilder are now cacheable using similar configs
1387
- * Changing the format of XML and JSON service builder configs. Backwards compatible.
1388
- * Cleaned up Cookie parsing
1389
- * Trimming the default Guzzle User-Agent header
1390
- * Adding a setOnComplete() method to Commands that is called when a command completes
1391
- * Keeping track of requests that were mocked in the MockPlugin
1392
- * Fixed a caching bug in the CacheAdapterFactory
1393
- * Inspector objects can be injected into a Command object
1394
- * Refactoring a lot of code and tests to be case insensitive when dealing with headers
1395
- * Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL
1396
- * Adding the ability to set global option overrides to service builder configs
1397
- * Adding the ability to include other service builder config files from within XML and JSON files
1398
- * Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method.
1399
-
1400
- ## 2.5.0 - 2012-05-08
1401
-
1402
- * Major performance improvements
1403
- * [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated.
1404
- * [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component.
1405
- * [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}"
1406
- * Added the ability to passed parameters to all requests created by a client
1407
- * Added callback functionality to the ExponentialBackoffPlugin
1408
- * Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies.
1409
- * Rewinding request stream bodies when retrying requests
1410
- * Exception is thrown when JSON response body cannot be decoded
1411
- * Added configurable magic method calls to clients and commands. This is off by default.
1412
- * Fixed a defect that added a hash to every parsed URL part
1413
- * Fixed duplicate none generation for OauthPlugin.
1414
- * Emitting an event each time a client is generated by a ServiceBuilder
1415
- * Using an ApiParams object instead of a Collection for parameters of an ApiCommand
1416
- * cache.* request parameters should be renamed to params.cache.*
1417
- * Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle.
1418
- * Added the ability to disable type validation of service descriptions
1419
- * ServiceDescriptions and ServiceBuilders are now Serializable
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2011 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/README.md DELETED
@@ -1,79 +0,0 @@
1
- ![Guzzle](.github/logo.png?raw=true)
2
-
3
- # Guzzle, PHP HTTP client
4
-
5
- [![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases)
6
- [![Build Status](https://img.shields.io/github/workflow/status/guzzle/guzzle/CI?label=ci%20build&style=flat-square)](https://github.com/guzzle/guzzle/actions?query=workflow%3ACI)
7
- [![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle)
8
-
9
- Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
10
- trivial to integrate with web services.
11
-
12
- - Simple interface for building query strings, POST requests, streaming large
13
- uploads, streaming large downloads, using HTTP cookies, uploading JSON data,
14
- etc...
15
- - Can send both synchronous and asynchronous requests using the same interface.
16
- - Uses PSR-7 interfaces for requests, responses, and streams. This allows you
17
- to utilize other PSR-7 compatible libraries with Guzzle.
18
- - Supports PSR-18 allowing interoperability between other PSR-18 HTTP Clients.
19
- - Abstracts away the underlying HTTP transport, allowing you to write
20
- environment and transport agnostic code; i.e., no hard dependency on cURL,
21
- PHP streams, sockets, or non-blocking event loops.
22
- - Middleware system allows you to augment and compose client behavior.
23
-
24
- ```php
25
- $client = new \GuzzleHttp\Client();
26
- $response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
27
-
28
- echo $response->getStatusCode(); // 200
29
- echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
30
- echo $response->getBody(); // '{"id": 1420053, "name": "guzzle", ...}'
31
-
32
- // Send an asynchronous request.
33
- $request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
34
- $promise = $client->sendAsync($request)->then(function ($response) {
35
- echo 'I completed! ' . $response->getBody();
36
- });
37
-
38
- $promise->wait();
39
- ```
40
-
41
- ## Help and docs
42
-
43
- We use GitHub issues only to discuss bugs and new features. For support please refer to:
44
-
45
- - [Documentation](http://guzzlephp.org/)
46
- - [Stack Overflow](http://stackoverflow.com/questions/tagged/guzzle)
47
- - [#guzzle](https://app.slack.com/client/T0D2S9JCT/CE6UAAKL4) channel on [PHP-HTTP Slack](http://slack.httplug.io/)
48
- - [Gitter](https://gitter.im/guzzle/guzzle)
49
-
50
-
51
- ## Installing Guzzle
52
-
53
- The recommended way to install Guzzle is through
54
- [Composer](https://getcomposer.org/).
55
-
56
- ```bash
57
- composer require guzzlehttp/guzzle
58
- ```
59
-
60
-
61
- ## Version Guidance
62
-
63
- | Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 | PHP Version |
64
- |---------|------------|---------------------|--------------|---------------------|---------------------|-------|-------------|
65
- | 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >= 5.3.3 |
66
- | 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >= 5.4 |
67
- | 5.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 |
68
- | 6.x | Bugfixes | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >= 5.5 |
69
- | 7.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v7][guzzle-7-repo] | [v7][guzzle-7-docs] | Yes | >= 7.2 |
70
-
71
- [guzzle-3-repo]: https://github.com/guzzle/guzzle3
72
- [guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x
73
- [guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3
74
- [guzzle-6-repo]: https://github.com/guzzle/guzzle/tree/6.5
75
- [guzzle-7-repo]: https://github.com/guzzle/guzzle
76
- [guzzle-3-docs]: http://guzzle3.readthedocs.org
77
- [guzzle-5-docs]: http://docs.guzzlephp.org/en/5.3/
78
- [guzzle-6-docs]: http://docs.guzzlephp.org/en/6.5/
79
- [guzzle-7-docs]: http://docs.guzzlephp.org/en/latest/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/UPGRADING.md DELETED
@@ -1,1253 +0,0 @@
1
- Guzzle Upgrade Guide
2
- ====================
3
-
4
- 6.0 to 7.0
5
- ----------
6
-
7
- In order to take advantage of the new features of PHP, Guzzle dropped the support
8
- of PHP 5. The minimum supported PHP version is now PHP 7.2. Type hints and return
9
- types for functions and methods have been added wherever possible.
10
-
11
- Please make sure:
12
- - You are calling a function or a method with the correct type.
13
- - If you extend a class of Guzzle; update all signatures on methods you override.
14
-
15
- #### Other backwards compatibility breaking changes
16
-
17
- - Class `GuzzleHttp\UriTemplate` is removed.
18
- - Class `GuzzleHttp\Exception\SeekException` is removed.
19
- - Classes `GuzzleHttp\Exception\BadResponseException`, `GuzzleHttp\Exception\ClientException`,
20
- `GuzzleHttp\Exception\ServerException` can no longer be initialized with an empty
21
- Response as argument.
22
- - Class `GuzzleHttp\Exception\ConnectException` now extends `GuzzleHttp\Exception\TransferException`
23
- instead of `GuzzleHttp\Exception\RequestException`.
24
- - Function `GuzzleHttp\Exception\ConnectException::getResponse()` is removed.
25
- - Function `GuzzleHttp\Exception\ConnectException::hasResponse()` is removed.
26
- - Constant `GuzzleHttp\ClientInterface::VERSION` is removed. Added `GuzzleHttp\ClientInterface::MAJOR_VERSION` instead.
27
- - Function `GuzzleHttp\Exception\RequestException::getResponseBodySummary` is removed.
28
- Use `\GuzzleHttp\Psr7\get_message_body_summary` as an alternative.
29
- - Function `GuzzleHttp\Cookie\CookieJar::getCookieValue` is removed.
30
- - Request option `exception` is removed. Please use `http_errors`.
31
- - Request option `save_to` is removed. Please use `sink`.
32
- - Pool option `pool_size` is removed. Please use `concurrency`.
33
- - We now look for environment variables in the `$_SERVER` super global, due to thread safety issues with `getenv`. We continue to fallback to `getenv` in CLI environments, for maximum compatibility.
34
- - The `get`, `head`, `put`, `post`, `patch`, `delete`, `getAsync`, `headAsync`, `putAsync`, `postAsync`, `patchAsync`, and `deleteAsync` methods are now implemented as genuine methods on `GuzzleHttp\Client`, with strong typing. The original `__call` implementation remains unchanged for now, for maximum backwards compatibility, but won't be invoked under normal operation.
35
- - The `log` middleware will log the errors with level `error` instead of `notice`
36
- - Support for international domain names (IDN) is now disabled by default, and enabling it requires installing ext-intl, linked against a modern version of the C library (ICU 4.6 or higher).
37
-
38
- #### Native functions calls
39
-
40
- All internal native functions calls of Guzzle are now prefixed with a slash. This
41
- change makes it impossible for method overloading by other libraries or applications.
42
- Example:
43
-
44
- ```php
45
- // Before:
46
- curl_version();
47
-
48
- // After:
49
- \curl_version();
50
- ```
51
-
52
- For the full diff you can check [here](https://github.com/guzzle/guzzle/compare/6.5.4..master).
53
-
54
- 5.0 to 6.0
55
- ----------
56
-
57
- Guzzle now uses [PSR-7](https://www.php-fig.org/psr/psr-7/) for HTTP messages.
58
- Due to the fact that these messages are immutable, this prompted a refactoring
59
- of Guzzle to use a middleware based system rather than an event system. Any
60
- HTTP message interaction (e.g., `GuzzleHttp\Message\Request`) need to be
61
- updated to work with the new immutable PSR-7 request and response objects. Any
62
- event listeners or subscribers need to be updated to become middleware
63
- functions that wrap handlers (or are injected into a
64
- `GuzzleHttp\HandlerStack`).
65
-
66
- - Removed `GuzzleHttp\BatchResults`
67
- - Removed `GuzzleHttp\Collection`
68
- - Removed `GuzzleHttp\HasDataTrait`
69
- - Removed `GuzzleHttp\ToArrayInterface`
70
- - The `guzzlehttp/streams` dependency has been removed. Stream functionality
71
- is now present in the `GuzzleHttp\Psr7` namespace provided by the
72
- `guzzlehttp/psr7` package.
73
- - Guzzle no longer uses ReactPHP promises and now uses the
74
- `guzzlehttp/promises` library. We use a custom promise library for three
75
- significant reasons:
76
- 1. React promises (at the time of writing this) are recursive. Promise
77
- chaining and promise resolution will eventually blow the stack. Guzzle
78
- promises are not recursive as they use a sort of trampolining technique.
79
- Note: there has been movement in the React project to modify promises to
80
- no longer utilize recursion.
81
- 2. Guzzle needs to have the ability to synchronously block on a promise to
82
- wait for a result. Guzzle promises allows this functionality (and does
83
- not require the use of recursion).
84
- 3. Because we need to be able to wait on a result, doing so using React
85
- promises requires wrapping react promises with RingPHP futures. This
86
- overhead is no longer needed, reducing stack sizes, reducing complexity,
87
- and improving performance.
88
- - `GuzzleHttp\Mimetypes` has been moved to a function in
89
- `GuzzleHttp\Psr7\mimetype_from_extension` and
90
- `GuzzleHttp\Psr7\mimetype_from_filename`.
91
- - `GuzzleHttp\Query` and `GuzzleHttp\QueryParser` have been removed. Query
92
- strings must now be passed into request objects as strings, or provided to
93
- the `query` request option when creating requests with clients. The `query`
94
- option uses PHP's `http_build_query` to convert an array to a string. If you
95
- need a different serialization technique, you will need to pass the query
96
- string in as a string. There are a couple helper functions that will make
97
- working with query strings easier: `GuzzleHttp\Psr7\parse_query` and
98
- `GuzzleHttp\Psr7\build_query`.
99
- - Guzzle no longer has a dependency on RingPHP. Due to the use of a middleware
100
- system based on PSR-7, using RingPHP and it's middleware system as well adds
101
- more complexity than the benefits it provides. All HTTP handlers that were
102
- present in RingPHP have been modified to work directly with PSR-7 messages
103
- and placed in the `GuzzleHttp\Handler` namespace. This significantly reduces
104
- complexity in Guzzle, removes a dependency, and improves performance. RingPHP
105
- will be maintained for Guzzle 5 support, but will no longer be a part of
106
- Guzzle 6.
107
- - As Guzzle now uses a middleware based systems the event system and RingPHP
108
- integration has been removed. Note: while the event system has been removed,
109
- it is possible to add your own type of event system that is powered by the
110
- middleware system.
111
- - Removed the `Event` namespace.
112
- - Removed the `Subscriber` namespace.
113
- - Removed `Transaction` class
114
- - Removed `RequestFsm`
115
- - Removed `RingBridge`
116
- - `GuzzleHttp\Subscriber\Cookie` is now provided by
117
- `GuzzleHttp\Middleware::cookies`
118
- - `GuzzleHttp\Subscriber\HttpError` is now provided by
119
- `GuzzleHttp\Middleware::httpError`
120
- - `GuzzleHttp\Subscriber\History` is now provided by
121
- `GuzzleHttp\Middleware::history`
122
- - `GuzzleHttp\Subscriber\Mock` is now provided by
123
- `GuzzleHttp\Handler\MockHandler`
124
- - `GuzzleHttp\Subscriber\Prepare` is now provided by
125
- `GuzzleHttp\PrepareBodyMiddleware`
126
- - `GuzzleHttp\Subscriber\Redirect` is now provided by
127
- `GuzzleHttp\RedirectMiddleware`
128
- - Guzzle now uses `Psr\Http\Message\UriInterface` (implements in
129
- `GuzzleHttp\Psr7\Uri`) for URI support. `GuzzleHttp\Url` is now gone.
130
- - Static functions in `GuzzleHttp\Utils` have been moved to namespaced
131
- functions under the `GuzzleHttp` namespace. This requires either a Composer
132
- based autoloader or you to include functions.php.
133
- - `GuzzleHttp\ClientInterface::getDefaultOption` has been renamed to
134
- `GuzzleHttp\ClientInterface::getConfig`.
135
- - `GuzzleHttp\ClientInterface::setDefaultOption` has been removed.
136
- - The `json` and `xml` methods of response objects has been removed. With the
137
- migration to strictly adhering to PSR-7 as the interface for Guzzle messages,
138
- adding methods to message interfaces would actually require Guzzle messages
139
- to extend from PSR-7 messages rather then work with them directly.
140
-
141
- ## Migrating to middleware
142
-
143
- The change to PSR-7 unfortunately required significant refactoring to Guzzle
144
- due to the fact that PSR-7 messages are immutable. Guzzle 5 relied on an event
145
- system from plugins. The event system relied on mutability of HTTP messages and
146
- side effects in order to work. With immutable messages, you have to change your
147
- workflow to become more about either returning a value (e.g., functional
148
- middlewares) or setting a value on an object. Guzzle v6 has chosen the
149
- functional middleware approach.
150
-
151
- Instead of using the event system to listen for things like the `before` event,
152
- you now create a stack based middleware function that intercepts a request on
153
- the way in and the promise of the response on the way out. This is a much
154
- simpler and more predictable approach than the event system and works nicely
155
- with PSR-7 middleware. Due to the use of promises, the middleware system is
156
- also asynchronous.
157
-
158
- v5:
159
-
160
- ```php
161
- use GuzzleHttp\Event\BeforeEvent;
162
- $client = new GuzzleHttp\Client();
163
- // Get the emitter and listen to the before event.
164
- $client->getEmitter()->on('before', function (BeforeEvent $e) {
165
- // Guzzle v5 events relied on mutation
166
- $e->getRequest()->setHeader('X-Foo', 'Bar');
167
- });
168
- ```
169
-
170
- v6:
171
-
172
- In v6, you can modify the request before it is sent using the `mapRequest`
173
- middleware. The idiomatic way in v6 to modify the request/response lifecycle is
174
- to setup a handler middleware stack up front and inject the handler into a
175
- client.
176
-
177
- ```php
178
- use GuzzleHttp\Middleware;
179
- // Create a handler stack that has all of the default middlewares attached
180
- $handler = GuzzleHttp\HandlerStack::create();
181
- // Push the handler onto the handler stack
182
- $handler->push(Middleware::mapRequest(function (RequestInterface $request) {
183
- // Notice that we have to return a request object
184
- return $request->withHeader('X-Foo', 'Bar');
185
- }));
186
- // Inject the handler into the client
187
- $client = new GuzzleHttp\Client(['handler' => $handler]);
188
- ```
189
-
190
- ## POST Requests
191
-
192
- This version added the [`form_params`](http://guzzle.readthedocs.org/en/latest/request-options.html#form_params)
193
- and `multipart` request options. `form_params` is an associative array of
194
- strings or array of strings and is used to serialize an
195
- `application/x-www-form-urlencoded` POST request. The
196
- [`multipart`](http://guzzle.readthedocs.org/en/latest/request-options.html#multipart)
197
- option is now used to send a multipart/form-data POST request.
198
-
199
- `GuzzleHttp\Post\PostFile` has been removed. Use the `multipart` option to add
200
- POST files to a multipart/form-data request.
201
-
202
- The `body` option no longer accepts an array to send POST requests. Please use
203
- `multipart` or `form_params` instead.
204
-
205
- The `base_url` option has been renamed to `base_uri`.
206
-
207
- 4.x to 5.0
208
- ----------
209
-
210
- ## Rewritten Adapter Layer
211
-
212
- Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send
213
- HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor
214
- is still supported, but it has now been renamed to `handler`. Instead of
215
- passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP
216
- `callable` that follows the RingPHP specification.
217
-
218
- ## Removed Fluent Interfaces
219
-
220
- [Fluent interfaces were removed](https://ocramius.github.io/blog/fluent-interfaces-are-evil/)
221
- from the following classes:
222
-
223
- - `GuzzleHttp\Collection`
224
- - `GuzzleHttp\Url`
225
- - `GuzzleHttp\Query`
226
- - `GuzzleHttp\Post\PostBody`
227
- - `GuzzleHttp\Cookie\SetCookie`
228
-
229
- ## Removed functions.php
230
-
231
- Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following
232
- functions can be used as replacements.
233
-
234
- - `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode`
235
- - `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath`
236
- - `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path`
237
- - `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however,
238
- deprecated in favor of using `GuzzleHttp\Pool::batch()`.
239
-
240
- The "procedural" global client has been removed with no replacement (e.g.,
241
- `GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client`
242
- object as a replacement.
243
-
244
- ## `throwImmediately` has been removed
245
-
246
- The concept of "throwImmediately" has been removed from exceptions and error
247
- events. This control mechanism was used to stop a transfer of concurrent
248
- requests from completing. This can now be handled by throwing the exception or
249
- by cancelling a pool of requests or each outstanding future request
250
- individually.
251
-
252
- ## headers event has been removed
253
-
254
- Removed the "headers" event. This event was only useful for changing the
255
- body a response once the headers of the response were known. You can implement
256
- a similar behavior in a number of ways. One example might be to use a
257
- FnStream that has access to the transaction being sent. For example, when the
258
- first byte is written, you could check if the response headers match your
259
- expectations, and if so, change the actual stream body that is being
260
- written to.
261
-
262
- ## Updates to HTTP Messages
263
-
264
- Removed the `asArray` parameter from
265
- `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
266
- value as an array, then use the newly added `getHeaderAsArray()` method of
267
- `MessageInterface`. This change makes the Guzzle interfaces compatible with
268
- the PSR-7 interfaces.
269
-
270
- 3.x to 4.0
271
- ----------
272
-
273
- ## Overarching changes:
274
-
275
- - Now requires PHP 5.4 or greater.
276
- - No longer requires cURL to send requests.
277
- - Guzzle no longer wraps every exception it throws. Only exceptions that are
278
- recoverable are now wrapped by Guzzle.
279
- - Various namespaces have been removed or renamed.
280
- - No longer requiring the Symfony EventDispatcher. A custom event dispatcher
281
- based on the Symfony EventDispatcher is
282
- now utilized in `GuzzleHttp\Event\EmitterInterface` (resulting in significant
283
- speed and functionality improvements).
284
-
285
- Changes per Guzzle 3.x namespace are described below.
286
-
287
- ## Batch
288
-
289
- The `Guzzle\Batch` namespace has been removed. This is best left to
290
- third-parties to implement on top of Guzzle's core HTTP library.
291
-
292
- ## Cache
293
-
294
- The `Guzzle\Cache` namespace has been removed. (Todo: No suitable replacement
295
- has been implemented yet, but hoping to utilize a PSR cache interface).
296
-
297
- ## Common
298
-
299
- - Removed all of the wrapped exceptions. It's better to use the standard PHP
300
- library for unrecoverable exceptions.
301
- - `FromConfigInterface` has been removed.
302
- - `Guzzle\Common\Version` has been removed. The VERSION constant can be found
303
- at `GuzzleHttp\ClientInterface::VERSION`.
304
-
305
- ### Collection
306
-
307
- - `getAll` has been removed. Use `toArray` to convert a collection to an array.
308
- - `inject` has been removed.
309
- - `keySearch` has been removed.
310
- - `getPath` no longer supports wildcard expressions. Use something better like
311
- JMESPath for this.
312
- - `setPath` now supports appending to an existing array via the `[]` notation.
313
-
314
- ### Events
315
-
316
- Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses
317
- `GuzzleHttp\Event\Emitter`.
318
-
319
- - `Symfony\Component\EventDispatcher\EventDispatcherInterface` is replaced by
320
- `GuzzleHttp\Event\EmitterInterface`.
321
- - `Symfony\Component\EventDispatcher\EventDispatcher` is replaced by
322
- `GuzzleHttp\Event\Emitter`.
323
- - `Symfony\Component\EventDispatcher\Event` is replaced by
324
- `GuzzleHttp\Event\Event`, and Guzzle now has an EventInterface in
325
- `GuzzleHttp\Event\EventInterface`.
326
- - `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and
327
- `HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the
328
- event emitter of a request, client, etc. now uses the `getEmitter` method
329
- rather than the `getDispatcher` method.
330
-
331
- #### Emitter
332
-
333
- - Use the `once()` method to add a listener that automatically removes itself
334
- the first time it is invoked.
335
- - Use the `listeners()` method to retrieve a list of event listeners rather than
336
- the `getListeners()` method.
337
- - Use `emit()` instead of `dispatch()` to emit an event from an emitter.
338
- - Use `attach()` instead of `addSubscriber()` and `detach()` instead of
339
- `removeSubscriber()`.
340
-
341
- ```php
342
- $mock = new Mock();
343
- // 3.x
344
- $request->getEventDispatcher()->addSubscriber($mock);
345
- $request->getEventDispatcher()->removeSubscriber($mock);
346
- // 4.x
347
- $request->getEmitter()->attach($mock);
348
- $request->getEmitter()->detach($mock);
349
- ```
350
-
351
- Use the `on()` method to add a listener rather than the `addListener()` method.
352
-
353
- ```php
354
- // 3.x
355
- $request->getEventDispatcher()->addListener('foo', function (Event $event) { /* ... */ } );
356
- // 4.x
357
- $request->getEmitter()->on('foo', function (Event $event, $name) { /* ... */ } );
358
- ```
359
-
360
- ## Http
361
-
362
- ### General changes
363
-
364
- - The cacert.pem certificate has been moved to `src/cacert.pem`.
365
- - Added the concept of adapters that are used to transfer requests over the
366
- wire.
367
- - Simplified the event system.
368
- - Sending requests in parallel is still possible, but batching is no longer a
369
- concept of the HTTP layer. Instead, you must use the `complete` and `error`
370
- events to asynchronously manage parallel request transfers.
371
- - `Guzzle\Http\Url` has moved to `GuzzleHttp\Url`.
372
- - `Guzzle\Http\QueryString` has moved to `GuzzleHttp\Query`.
373
- - QueryAggregators have been rewritten so that they are simply callable
374
- functions.
375
- - `GuzzleHttp\StaticClient` has been removed. Use the functions provided in
376
- `functions.php` for an easy to use static client instance.
377
- - Exceptions in `GuzzleHttp\Exception` have been updated to all extend from
378
- `GuzzleHttp\Exception\TransferException`.
379
-
380
- ### Client
381
-
382
- Calling methods like `get()`, `post()`, `head()`, etc. no longer create and
383
- return a request, but rather creates a request, sends the request, and returns
384
- the response.
385
-
386
- ```php
387
- // 3.0
388
- $request = $client->get('/');
389
- $response = $request->send();
390
-
391
- // 4.0
392
- $response = $client->get('/');
393
-
394
- // or, to mirror the previous behavior
395
- $request = $client->createRequest('GET', '/');
396
- $response = $client->send($request);
397
- ```
398
-
399
- `GuzzleHttp\ClientInterface` has changed.
400
-
401
- - The `send` method no longer accepts more than one request. Use `sendAll` to
402
- send multiple requests in parallel.
403
- - `setUserAgent()` has been removed. Use a default request option instead. You
404
- could, for example, do something like:
405
- `$client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent())`.
406
- - `setSslVerification()` has been removed. Use default request options instead,
407
- like `$client->setConfig('defaults/verify', true)`.
408
-
409
- `GuzzleHttp\Client` has changed.
410
-
411
- - The constructor now accepts only an associative array. You can include a
412
- `base_url` string or array to use a URI template as the base URL of a client.
413
- You can also specify a `defaults` key that is an associative array of default
414
- request options. You can pass an `adapter` to use a custom adapter,
415
- `batch_adapter` to use a custom adapter for sending requests in parallel, or
416
- a `message_factory` to change the factory used to create HTTP requests and
417
- responses.
418
- - The client no longer emits a `client.create_request` event.
419
- - Creating requests with a client no longer automatically utilize a URI
420
- template. You must pass an array into a creational method (e.g.,
421
- `createRequest`, `get`, `put`, etc.) in order to expand a URI template.
422
-
423
- ### Messages
424
-
425
- Messages no longer have references to their counterparts (i.e., a request no
426
- longer has a reference to it's response, and a response no loger has a
427
- reference to its request). This association is now managed through a
428
- `GuzzleHttp\Adapter\TransactionInterface` object. You can get references to
429
- these transaction objects using request events that are emitted over the
430
- lifecycle of a request.
431
-
432
- #### Requests with a body
433
-
434
- - `GuzzleHttp\Message\EntityEnclosingRequest` and
435
- `GuzzleHttp\Message\EntityEnclosingRequestInterface` have been removed. The
436
- separation between requests that contain a body and requests that do not
437
- contain a body has been removed, and now `GuzzleHttp\Message\RequestInterface`
438
- handles both use cases.
439
- - Any method that previously accepts a `GuzzleHttp\Response` object now accept a
440
- `GuzzleHttp\Message\ResponseInterface`.
441
- - `GuzzleHttp\Message\RequestFactoryInterface` has been renamed to
442
- `GuzzleHttp\Message\MessageFactoryInterface`. This interface is used to create
443
- both requests and responses and is implemented in
444
- `GuzzleHttp\Message\MessageFactory`.
445
- - POST field and file methods have been removed from the request object. You
446
- must now use the methods made available to `GuzzleHttp\Post\PostBodyInterface`
447
- to control the format of a POST body. Requests that are created using a
448
- standard `GuzzleHttp\Message\MessageFactoryInterface` will automatically use
449
- a `GuzzleHttp\Post\PostBody` body if the body was passed as an array or if
450
- the method is POST and no body is provided.
451
-
452
- ```php
453
- $request = $client->createRequest('POST', '/');
454
- $request->getBody()->setField('foo', 'bar');
455
- $request->getBody()->addFile(new PostFile('file_key', fopen('/path/to/content', 'r')));
456
- ```
457
-
458
- #### Headers
459
-
460
- - `GuzzleHttp\Message\Header` has been removed. Header values are now simply
461
- represented by an array of values or as a string. Header values are returned
462
- as a string by default when retrieving a header value from a message. You can
463
- pass an optional argument of `true` to retrieve a header value as an array
464
- of strings instead of a single concatenated string.
465
- - `GuzzleHttp\PostFile` and `GuzzleHttp\PostFileInterface` have been moved to
466
- `GuzzleHttp\Post`. This interface has been simplified and now allows the
467
- addition of arbitrary headers.
468
- - Custom headers like `GuzzleHttp\Message\Header\Link` have been removed. Most
469
- of the custom headers are now handled separately in specific
470
- subscribers/plugins, and `GuzzleHttp\Message\HeaderValues::parseParams()` has
471
- been updated to properly handle headers that contain parameters (like the
472
- `Link` header).
473
-
474
- #### Responses
475
-
476
- - `GuzzleHttp\Message\Response::getInfo()` and
477
- `GuzzleHttp\Message\Response::setInfo()` have been removed. Use the event
478
- system to retrieve this type of information.
479
- - `GuzzleHttp\Message\Response::getRawHeaders()` has been removed.
480
- - `GuzzleHttp\Message\Response::getMessage()` has been removed.
481
- - `GuzzleHttp\Message\Response::calculateAge()` and other cache specific
482
- methods have moved to the CacheSubscriber.
483
- - Header specific helper functions like `getContentMd5()` have been removed.
484
- Just use `getHeader('Content-MD5')` instead.
485
- - `GuzzleHttp\Message\Response::setRequest()` and
486
- `GuzzleHttp\Message\Response::getRequest()` have been removed. Use the event
487
- system to work with request and response objects as a transaction.
488
- - `GuzzleHttp\Message\Response::getRedirectCount()` has been removed. Use the
489
- Redirect subscriber instead.
490
- - `GuzzleHttp\Message\Response::isSuccessful()` and other related methods have
491
- been removed. Use `getStatusCode()` instead.
492
-
493
- #### Streaming responses
494
-
495
- Streaming requests can now be created by a client directly, returning a
496
- `GuzzleHttp\Message\ResponseInterface` object that contains a body stream
497
- referencing an open PHP HTTP stream.
498
-
499
- ```php
500
- // 3.0
501
- use Guzzle\Stream\PhpStreamRequestFactory;
502
- $request = $client->get('/');
503
- $factory = new PhpStreamRequestFactory();
504
- $stream = $factory->fromRequest($request);
505
- $data = $stream->read(1024);
506
-
507
- // 4.0
508
- $response = $client->get('/', ['stream' => true]);
509
- // Read some data off of the stream in the response body
510
- $data = $response->getBody()->read(1024);
511
- ```
512
-
513
- #### Redirects
514
-
515
- The `configureRedirects()` method has been removed in favor of a
516
- `allow_redirects` request option.
517
-
518
- ```php
519
- // Standard redirects with a default of a max of 5 redirects
520
- $request = $client->createRequest('GET', '/', ['allow_redirects' => true]);
521
-
522
- // Strict redirects with a custom number of redirects
523
- $request = $client->createRequest('GET', '/', [
524
- 'allow_redirects' => ['max' => 5, 'strict' => true]
525
- ]);
526
- ```
527
-
528
- #### EntityBody
529
-
530
- EntityBody interfaces and classes have been removed or moved to
531
- `GuzzleHttp\Stream`. All classes and interfaces that once required
532
- `GuzzleHttp\EntityBodyInterface` now require
533
- `GuzzleHttp\Stream\StreamInterface`. Creating a new body for a request no
534
- longer uses `GuzzleHttp\EntityBody::factory` but now uses
535
- `GuzzleHttp\Stream\Stream::factory` or even better:
536
- `GuzzleHttp\Stream\create()`.
537
-
538
- - `Guzzle\Http\EntityBodyInterface` is now `GuzzleHttp\Stream\StreamInterface`
539
- - `Guzzle\Http\EntityBody` is now `GuzzleHttp\Stream\Stream`
540
- - `Guzzle\Http\CachingEntityBody` is now `GuzzleHttp\Stream\CachingStream`
541
- - `Guzzle\Http\ReadLimitEntityBody` is now `GuzzleHttp\Stream\LimitStream`
542
- - `Guzzle\Http\IoEmittyinEntityBody` has been removed.
543
-
544
- #### Request lifecycle events
545
-
546
- Requests previously submitted a large number of requests. The number of events
547
- emitted over the lifecycle of a request has been significantly reduced to make
548
- it easier to understand how to extend the behavior of a request. All events
549
- emitted during the lifecycle of a request now emit a custom
550
- `GuzzleHttp\Event\EventInterface` object that contains context providing
551
- methods and a way in which to modify the transaction at that specific point in
552
- time (e.g., intercept the request and set a response on the transaction).
553
-
554
- - `request.before_send` has been renamed to `before` and now emits a
555
- `GuzzleHttp\Event\BeforeEvent`
556
- - `request.complete` has been renamed to `complete` and now emits a
557
- `GuzzleHttp\Event\CompleteEvent`.
558
- - `request.sent` has been removed. Use `complete`.
559
- - `request.success` has been removed. Use `complete`.
560
- - `error` is now an event that emits a `GuzzleHttp\Event\ErrorEvent`.
561
- - `request.exception` has been removed. Use `error`.
562
- - `request.receive.status_line` has been removed.
563
- - `curl.callback.progress` has been removed. Use a custom `StreamInterface` to
564
- maintain a status update.
565
- - `curl.callback.write` has been removed. Use a custom `StreamInterface` to
566
- intercept writes.
567
- - `curl.callback.read` has been removed. Use a custom `StreamInterface` to
568
- intercept reads.
569
-
570
- `headers` is a new event that is emitted after the response headers of a
571
- request have been received before the body of the response is downloaded. This
572
- event emits a `GuzzleHttp\Event\HeadersEvent`.
573
-
574
- You can intercept a request and inject a response using the `intercept()` event
575
- of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and
576
- `GuzzleHttp\Event\ErrorEvent` event.
577
-
578
- See: http://docs.guzzlephp.org/en/latest/events.html
579
-
580
- ## Inflection
581
-
582
- The `Guzzle\Inflection` namespace has been removed. This is not a core concern
583
- of Guzzle.
584
-
585
- ## Iterator
586
-
587
- The `Guzzle\Iterator` namespace has been removed.
588
-
589
- - `Guzzle\Iterator\AppendIterator`, `Guzzle\Iterator\ChunkedIterator`, and
590
- `Guzzle\Iterator\MethodProxyIterator` are nice, but not a core requirement of
591
- Guzzle itself.
592
- - `Guzzle\Iterator\FilterIterator` is no longer needed because an equivalent
593
- class is shipped with PHP 5.4.
594
- - `Guzzle\Iterator\MapIterator` is not really needed when using PHP 5.5 because
595
- it's easier to just wrap an iterator in a generator that maps values.
596
-
597
- For a replacement of these iterators, see https://github.com/nikic/iter
598
-
599
- ## Log
600
-
601
- The LogPlugin has moved to https://github.com/guzzle/log-subscriber. The
602
- `Guzzle\Log` namespace has been removed. Guzzle now relies on
603
- `Psr\Log\LoggerInterface` for all logging. The MessageFormatter class has been
604
- moved to `GuzzleHttp\Subscriber\Log\Formatter`.
605
-
606
- ## Parser
607
-
608
- The `Guzzle\Parser` namespace has been removed. This was previously used to
609
- make it possible to plug in custom parsers for cookies, messages, URI
610
- templates, and URLs; however, this level of complexity is not needed in Guzzle
611
- so it has been removed.
612
-
613
- - Cookie: Cookie parsing logic has been moved to
614
- `GuzzleHttp\Cookie\SetCookie::fromString`.
615
- - Message: Message parsing logic for both requests and responses has been moved
616
- to `GuzzleHttp\Message\MessageFactory::fromMessage`. Message parsing is only
617
- used in debugging or deserializing messages, so it doesn't make sense for
618
- Guzzle as a library to add this level of complexity to parsing messages.
619
- - UriTemplate: URI template parsing has been moved to
620
- `GuzzleHttp\UriTemplate`. The Guzzle library will automatically use the PECL
621
- URI template library if it is installed.
622
- - Url: URL parsing is now performed in `GuzzleHttp\Url::fromString` (previously
623
- it was `Guzzle\Http\Url::factory()`). If custom URL parsing is necessary,
624
- then developers are free to subclass `GuzzleHttp\Url`.
625
-
626
- ## Plugin
627
-
628
- The `Guzzle\Plugin` namespace has been renamed to `GuzzleHttp\Subscriber`.
629
- Several plugins are shipping with the core Guzzle library under this namespace.
630
-
631
- - `GuzzleHttp\Subscriber\Cookie`: Replaces the old CookiePlugin. Cookie jar
632
- code has moved to `GuzzleHttp\Cookie`.
633
- - `GuzzleHttp\Subscriber\History`: Replaces the old HistoryPlugin.
634
- - `GuzzleHttp\Subscriber\HttpError`: Throws errors when a bad HTTP response is
635
- received.
636
- - `GuzzleHttp\Subscriber\Mock`: Replaces the old MockPlugin.
637
- - `GuzzleHttp\Subscriber\Prepare`: Prepares the body of a request just before
638
- sending. This subscriber is attached to all requests by default.
639
- - `GuzzleHttp\Subscriber\Redirect`: Replaces the RedirectPlugin.
640
-
641
- The following plugins have been removed (third-parties are free to re-implement
642
- these if needed):
643
-
644
- - `GuzzleHttp\Plugin\Async` has been removed.
645
- - `GuzzleHttp\Plugin\CurlAuth` has been removed.
646
- - `GuzzleHttp\Plugin\ErrorResponse\ErrorResponsePlugin` has been removed. This
647
- functionality should instead be implemented with event listeners that occur
648
- after normal response parsing occurs in the guzzle/command package.
649
-
650
- The following plugins are not part of the core Guzzle package, but are provided
651
- in separate repositories:
652
-
653
- - `Guzzle\Http\Plugin\BackoffPlugin` has been rewritten to be much simpler
654
- to build custom retry policies using simple functions rather than various
655
- chained classes. See: https://github.com/guzzle/retry-subscriber
656
- - `Guzzle\Http\Plugin\Cache\CachePlugin` has moved to
657
- https://github.com/guzzle/cache-subscriber
658
- - `Guzzle\Http\Plugin\Log\LogPlugin` has moved to
659
- https://github.com/guzzle/log-subscriber
660
- - `Guzzle\Http\Plugin\Md5\Md5Plugin` has moved to
661
- https://github.com/guzzle/message-integrity-subscriber
662
- - `Guzzle\Http\Plugin\Mock\MockPlugin` has moved to
663
- `GuzzleHttp\Subscriber\MockSubscriber`.
664
- - `Guzzle\Http\Plugin\Oauth\OauthPlugin` has moved to
665
- https://github.com/guzzle/oauth-subscriber
666
-
667
- ## Service
668
-
669
- The service description layer of Guzzle has moved into two separate packages:
670
-
671
- - http://github.com/guzzle/command Provides a high level abstraction over web
672
- services by representing web service operations using commands.
673
- - http://github.com/guzzle/guzzle-services Provides an implementation of
674
- guzzle/command that provides request serialization and response parsing using
675
- Guzzle service descriptions.
676
-
677
- ## Stream
678
-
679
- Stream have moved to a separate package available at
680
- https://github.com/guzzle/streams.
681
-
682
- `Guzzle\Stream\StreamInterface` has been given a large update to cleanly take
683
- on the responsibilities of `Guzzle\Http\EntityBody` and
684
- `Guzzle\Http\EntityBodyInterface` now that they have been removed. The number
685
- of methods implemented by the `StreamInterface` has been drastically reduced to
686
- allow developers to more easily extend and decorate stream behavior.
687
-
688
- ## Removed methods from StreamInterface
689
-
690
- - `getStream` and `setStream` have been removed to better encapsulate streams.
691
- - `getMetadata` and `setMetadata` have been removed in favor of
692
- `GuzzleHttp\Stream\MetadataStreamInterface`.
693
- - `getWrapper`, `getWrapperData`, `getStreamType`, and `getUri` have all been
694
- removed. This data is accessible when
695
- using streams that implement `GuzzleHttp\Stream\MetadataStreamInterface`.
696
- - `rewind` has been removed. Use `seek(0)` for a similar behavior.
697
-
698
- ## Renamed methods
699
-
700
- - `detachStream` has been renamed to `detach`.
701
- - `feof` has been renamed to `eof`.
702
- - `ftell` has been renamed to `tell`.
703
- - `readLine` has moved from an instance method to a static class method of
704
- `GuzzleHttp\Stream\Stream`.
705
-
706
- ## Metadata streams
707
-
708
- `GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams
709
- that contain additional metadata accessible via `getMetadata()`.
710
- `GuzzleHttp\Stream\StreamInterface::getMetadata` and
711
- `GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed.
712
-
713
- ## StreamRequestFactory
714
-
715
- The entire concept of the StreamRequestFactory has been removed. The way this
716
- was used in Guzzle 3 broke the actual interface of sending streaming requests
717
- (instead of getting back a Response, you got a StreamInterface). Streaming
718
- PHP requests are now implemented through the `GuzzleHttp\Adapter\StreamAdapter`.
719
-
720
- 3.6 to 3.7
721
- ----------
722
-
723
- ### Deprecations
724
-
725
- - You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.:
726
-
727
- ```php
728
- \Guzzle\Common\Version::$emitWarnings = true;
729
- ```
730
-
731
- The following APIs and options have been marked as deprecated:
732
-
733
- - Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use `$request->getResponseBody()->isRepeatable()` instead.
734
- - Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
735
- - Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
736
- - Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
737
- - Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
738
- - Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
739
- - Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
740
- - Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
741
- - Marked `Guzzle\Common\Collection::inject()` as deprecated.
742
- - Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use
743
- `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` or
744
- `$client->setDefaultOption('auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));`
745
-
746
- 3.7 introduces `request.options` as a parameter for a client configuration and as an optional argument to all creational
747
- request methods. When paired with a client's configuration settings, these options allow you to specify default settings
748
- for various aspects of a request. Because these options make other previous configuration options redundant, several
749
- configuration options and methods of a client and AbstractCommand have been deprecated.
750
-
751
- - Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use `$client->getDefaultOption('headers')`.
752
- - Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use `$client->setDefaultOption('headers/{header_name}', 'value')`.
753
- - Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use `$client->setDefaultOption('params/{param_name}', 'value')`
754
- - Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. These will work through Guzzle 4.0
755
-
756
- $command = $client->getCommand('foo', array(
757
- 'command.headers' => array('Test' => '123'),
758
- 'command.response_body' => '/path/to/file'
759
- ));
760
-
761
- // Should be changed to:
762
-
763
- $command = $client->getCommand('foo', array(
764
- 'command.request_options' => array(
765
- 'headers' => array('Test' => '123'),
766
- 'save_as' => '/path/to/file'
767
- )
768
- ));
769
-
770
- ### Interface changes
771
-
772
- Additions and changes (you will need to update any implementations or subclasses you may have created):
773
-
774
- - Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
775
- createRequest, head, delete, put, patch, post, options, prepareRequest
776
- - Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
777
- - Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
778
- - Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
779
- `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
780
- resource, string, or EntityBody into the $options parameter to specify the download location of the response.
781
- - Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
782
- default `array()`
783
- - Added `Guzzle\Stream\StreamInterface::isRepeatable`
784
- - Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
785
-
786
- The following methods were removed from interfaces. All of these methods are still available in the concrete classes
787
- that implement them, but you should update your code to use alternative methods:
788
-
789
- - Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
790
- `$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
791
- `$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))` or
792
- `$client->setDefaultOption('headers/{header_name}', 'value')`. or
793
- `$client->setDefaultOption('headers', array('header_name' => 'value'))`.
794
- - Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use `$client->getConfig()->getPath('request.options/headers')`.
795
- - Removed `Guzzle\Http\ClientInterface::expandTemplate()`. This is an implementation detail.
796
- - Removed `Guzzle\Http\ClientInterface::setRequestFactory()`. This is an implementation detail.
797
- - Removed `Guzzle\Http\ClientInterface::getCurlMulti()`. This is a very specific implementation detail.
798
- - Removed `Guzzle\Http\Message\RequestInterface::canCache`. Use the CachePlugin.
799
- - Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`. Use the HistoryPlugin.
800
- - Removed `Guzzle\Http\Message\RequestInterface::isRedirect`. Use the HistoryPlugin.
801
-
802
- ### Cache plugin breaking changes
803
-
804
- - CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
805
- CacheStorageInterface. These two objects and interface will be removed in a future version.
806
- - Always setting X-cache headers on cached responses
807
- - Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
808
- - `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
809
- $request, Response $response);`
810
- - `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
811
- - `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
812
- - Added `CacheStorageInterface::purge($url)`
813
- - `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
814
- $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
815
- CanCacheStrategyInterface $canCache = null)`
816
- - Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
817
-
818
- 3.5 to 3.6
819
- ----------
820
-
821
- * Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
822
- * Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
823
- * Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
824
- For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader().
825
- Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request.
826
- * Specific header implementations can be created for complex headers. When a message creates a header, it uses a
827
- HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
828
- CacheControl header implementation.
829
- * Moved getLinks() from Response to just be used on a Link header object.
830
-
831
- If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the
832
- HeaderInterface (e.g. toArray(), getAll(), etc.).
833
-
834
- ### Interface changes
835
-
836
- * Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
837
- * Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
838
- * Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
839
- Guzzle\Http\Curl\RequestMediator
840
- * Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
841
- * Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
842
- * Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
843
-
844
- ### Removed deprecated functions
845
-
846
- * Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
847
- * Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
848
-
849
- ### Deprecations
850
-
851
- * The ability to case-insensitively search for header values
852
- * Guzzle\Http\Message\Header::hasExactHeader
853
- * Guzzle\Http\Message\Header::raw. Use getAll()
854
- * Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
855
- instead.
856
-
857
- ### Other changes
858
-
859
- * All response header helper functions return a string rather than mixing Header objects and strings inconsistently
860
- * Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
861
- directly via interfaces
862
- * Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
863
- but are a no-op until removed.
864
- * Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
865
- `Guzzle\Service\Command\ArrayCommandInterface`.
866
- * Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
867
- on a request while the request is still being transferred
868
- * `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
869
-
870
- 3.3 to 3.4
871
- ----------
872
-
873
- Base URLs of a client now follow the rules of https://tools.ietf.org/html/rfc3986#section-5.2.2 when merging URLs.
874
-
875
- 3.2 to 3.3
876
- ----------
877
-
878
- ### Response::getEtag() quote stripping removed
879
-
880
- `Guzzle\Http\Message\Response::getEtag()` no longer strips quotes around the ETag response header
881
-
882
- ### Removed `Guzzle\Http\Utils`
883
-
884
- The `Guzzle\Http\Utils` class was removed. This class was only used for testing.
885
-
886
- ### Stream wrapper and type
887
-
888
- `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase.
889
-
890
- ### curl.emit_io became emit_io
891
-
892
- Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using the
893
- 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
894
-
895
- 3.1 to 3.2
896
- ----------
897
-
898
- ### CurlMulti is no longer reused globally
899
-
900
- Before 3.2, the same CurlMulti object was reused globally for each client. This can cause issue where plugins added
901
- to a single client can pollute requests dispatched from other clients.
902
-
903
- If you still wish to reuse the same CurlMulti object with each client, then you can add a listener to the
904
- ServiceBuilder's `service_builder.create_client` event to inject a custom CurlMulti object into each client as it is
905
- created.
906
-
907
- ```php
908
- $multi = new Guzzle\Http\Curl\CurlMulti();
909
- $builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json');
910
- $builder->addListener('service_builder.create_client', function ($event) use ($multi) {
911
- $event['client']->setCurlMulti($multi);
912
- }
913
- });
914
- ```
915
-
916
- ### No default path
917
-
918
- URLs no longer have a default path value of '/' if no path was specified.
919
-
920
- Before:
921
-
922
- ```php
923
- $request = $client->get('http://www.foo.com');
924
- echo $request->getUrl();
925
- // >> http://www.foo.com/
926
- ```
927
-
928
- After:
929
-
930
- ```php
931
- $request = $client->get('http://www.foo.com');
932
- echo $request->getUrl();
933
- // >> http://www.foo.com
934
- ```
935
-
936
- ### Less verbose BadResponseException
937
-
938
- The exception message for `Guzzle\Http\Exception\BadResponseException` no longer contains the full HTTP request and
939
- response information. You can, however, get access to the request and response object by calling `getRequest()` or
940
- `getResponse()` on the exception object.
941
-
942
- ### Query parameter aggregation
943
-
944
- Multi-valued query parameters are no longer aggregated using a callback function. `Guzzle\Http\Query` now has a
945
- setAggregator() method that accepts a `Guzzle\Http\QueryAggregator\QueryAggregatorInterface` object. This object is
946
- responsible for handling the aggregation of multi-valued query string variables into a flattened hash.
947
-
948
- 2.8 to 3.x
949
- ----------
950
-
951
- ### Guzzle\Service\Inspector
952
-
953
- Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fromConfig`
954
-
955
- **Before**
956
-
957
- ```php
958
- use Guzzle\Service\Inspector;
959
-
960
- class YourClient extends \Guzzle\Service\Client
961
- {
962
- public static function factory($config = array())
963
- {
964
- $default = array();
965
- $required = array('base_url', 'username', 'api_key');
966
- $config = Inspector::fromConfig($config, $default, $required);
967
-
968
- $client = new self(
969
- $config->get('base_url'),
970
- $config->get('username'),
971
- $config->get('api_key')
972
- );
973
- $client->setConfig($config);
974
-
975
- $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json'));
976
-
977
- return $client;
978
- }
979
- ```
980
-
981
- **After**
982
-
983
- ```php
984
- use Guzzle\Common\Collection;
985
-
986
- class YourClient extends \Guzzle\Service\Client
987
- {
988
- public static function factory($config = array())
989
- {
990
- $default = array();
991
- $required = array('base_url', 'username', 'api_key');
992
- $config = Collection::fromConfig($config, $default, $required);
993
-
994
- $client = new self(
995
- $config->get('base_url'),
996
- $config->get('username'),
997
- $config->get('api_key')
998
- );
999
- $client->setConfig($config);
1000
-
1001
- $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json'));
1002
-
1003
- return $client;
1004
- }
1005
- ```
1006
-
1007
- ### Convert XML Service Descriptions to JSON
1008
-
1009
- **Before**
1010
-
1011
- ```xml
1012
- <?xml version="1.0" encoding="UTF-8"?>
1013
- <client>
1014
- <commands>
1015
- <!-- Groups -->
1016
- <command name="list_groups" method="GET" uri="groups.json">
1017
- <doc>Get a list of groups</doc>
1018
- </command>
1019
- <command name="search_groups" method="GET" uri='search.json?query="{{query}} type:group"'>
1020
- <doc>Uses a search query to get a list of groups</doc>
1021
- <param name="query" type="string" required="true" />
1022
- </command>
1023
- <command name="create_group" method="POST" uri="groups.json">
1024
- <doc>Create a group</doc>
1025
- <param name="data" type="array" location="body" filters="json_encode" doc="Group JSON"/>
1026
- <param name="Content-Type" location="header" static="application/json"/>
1027
- </command>
1028
- <command name="delete_group" method="DELETE" uri="groups/{{id}}.json">
1029
- <doc>Delete a group by ID</doc>
1030
- <param name="id" type="integer" required="true"/>
1031
- </command>
1032
- <command name="get_group" method="GET" uri="groups/{{id}}.json">
1033
- <param name="id" type="integer" required="true"/>
1034
- </command>
1035
- <command name="update_group" method="PUT" uri="groups/{{id}}.json">
1036
- <doc>Update a group</doc>
1037
- <param name="id" type="integer" required="true"/>
1038
- <param name="data" type="array" location="body" filters="json_encode" doc="Group JSON"/>
1039
- <param name="Content-Type" location="header" static="application/json"/>
1040
- </command>
1041
- </commands>
1042
- </client>
1043
- ```
1044
-
1045
- **After**
1046
-
1047
- ```json
1048
- {
1049
- "name": "Zendesk REST API v2",
1050
- "apiVersion": "2012-12-31",
1051
- "description":"Provides access to Zendesk views, groups, tickets, ticket fields, and users",
1052
- "operations": {
1053
- "list_groups": {
1054
- "httpMethod":"GET",
1055
- "uri": "groups.json",
1056
- "summary": "Get a list of groups"
1057
- },
1058
- "search_groups":{
1059
- "httpMethod":"GET",
1060
- "uri": "search.json?query=\"{query} type:group\"",
1061
- "summary": "Uses a search query to get a list of groups",
1062
- "parameters":{
1063
- "query":{
1064
- "location": "uri",
1065
- "description":"Zendesk Search Query",
1066
- "type": "string",
1067
- "required": true
1068
- }
1069
- }
1070
- },
1071
- "create_group": {
1072
- "httpMethod":"POST",
1073
- "uri": "groups.json",
1074
- "summary": "Create a group",
1075
- "parameters":{
1076
- "data": {
1077
- "type": "array",
1078
- "location": "body",
1079
- "description":"Group JSON",
1080
- "filters": "json_encode",
1081
- "required": true
1082
- },
1083
- "Content-Type":{
1084
- "type": "string",
1085
- "location":"header",
1086
- "static": "application/json"
1087
- }
1088
- }
1089
- },
1090
- "delete_group": {
1091
- "httpMethod":"DELETE",
1092
- "uri": "groups/{id}.json",
1093
- "summary": "Delete a group",
1094
- "parameters":{
1095
- "id":{
1096
- "location": "uri",
1097
- "description":"Group to delete by ID",
1098
- "type": "integer",
1099
- "required": true
1100
- }
1101
- }
1102
- },
1103
- "get_group": {
1104
- "httpMethod":"GET",
1105
- "uri": "groups/{id}.json",
1106
- "summary": "Get a ticket",
1107
- "parameters":{
1108
- "id":{
1109
- "location": "uri",
1110
- "description":"Group to get by ID",
1111
- "type": "integer",
1112
- "required": true
1113
- }
1114
- }
1115
- },
1116
- "update_group": {
1117
- "httpMethod":"PUT",
1118
- "uri": "groups/{id}.json",
1119
- "summary": "Update a group",
1120
- "parameters":{
1121
- "id": {
1122
- "location": "uri",
1123
- "description":"Group to update by ID",
1124
- "type": "integer",
1125
- "required": true
1126
- },
1127
- "data": {
1128
- "type": "array",
1129
- "location": "body",
1130
- "description":"Group JSON",
1131
- "filters": "json_encode",
1132
- "required": true
1133
- },
1134
- "Content-Type":{
1135
- "type": "string",
1136
- "location":"header",
1137
- "static": "application/json"
1138
- }
1139
- }
1140
- }
1141
- }
1142
- ```
1143
-
1144
- ### Guzzle\Service\Description\ServiceDescription
1145
-
1146
- Commands are now called Operations
1147
-
1148
- **Before**
1149
-
1150
- ```php
1151
- use Guzzle\Service\Description\ServiceDescription;
1152
-
1153
- $sd = new ServiceDescription();
1154
- $sd->getCommands(); // @returns ApiCommandInterface[]
1155
- $sd->hasCommand($name);
1156
- $sd->getCommand($name); // @returns ApiCommandInterface|null
1157
- $sd->addCommand($command); // @param ApiCommandInterface $command
1158
- ```
1159
-
1160
- **After**
1161
-
1162
- ```php
1163
- use Guzzle\Service\Description\ServiceDescription;
1164
-
1165
- $sd = new ServiceDescription();
1166
- $sd->getOperations(); // @returns OperationInterface[]
1167
- $sd->hasOperation($name);
1168
- $sd->getOperation($name); // @returns OperationInterface|null
1169
- $sd->addOperation($operation); // @param OperationInterface $operation
1170
- ```
1171
-
1172
- ### Guzzle\Common\Inflection\Inflector
1173
-
1174
- Namespace is now `Guzzle\Inflection\Inflector`
1175
-
1176
- ### Guzzle\Http\Plugin
1177
-
1178
- Namespace is now `Guzzle\Plugin`. Many other changes occur within this namespace and are detailed in their own sections below.
1179
-
1180
- ### Guzzle\Http\Plugin\LogPlugin and Guzzle\Common\Log
1181
-
1182
- Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively.
1183
-
1184
- **Before**
1185
-
1186
- ```php
1187
- use Guzzle\Common\Log\ClosureLogAdapter;
1188
- use Guzzle\Http\Plugin\LogPlugin;
1189
-
1190
- /** @var \Guzzle\Http\Client */
1191
- $client;
1192
-
1193
- // $verbosity is an integer indicating desired message verbosity level
1194
- $client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $verbosity = LogPlugin::LOG_VERBOSE);
1195
- ```
1196
-
1197
- **After**
1198
-
1199
- ```php
1200
- use Guzzle\Log\ClosureLogAdapter;
1201
- use Guzzle\Log\MessageFormatter;
1202
- use Guzzle\Plugin\Log\LogPlugin;
1203
-
1204
- /** @var \Guzzle\Http\Client */
1205
- $client;
1206
-
1207
- // $format is a string indicating desired message format -- @see MessageFormatter
1208
- $client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $format = MessageFormatter::DEBUG_FORMAT);
1209
- ```
1210
-
1211
- ### Guzzle\Http\Plugin\CurlAuthPlugin
1212
-
1213
- Now `Guzzle\Plugin\CurlAuth\CurlAuthPlugin`.
1214
-
1215
- ### Guzzle\Http\Plugin\ExponentialBackoffPlugin
1216
-
1217
- Now `Guzzle\Plugin\Backoff\BackoffPlugin`, and other changes.
1218
-
1219
- **Before**
1220
-
1221
- ```php
1222
- use Guzzle\Http\Plugin\ExponentialBackoffPlugin;
1223
-
1224
- $backoffPlugin = new ExponentialBackoffPlugin($maxRetries, array_merge(
1225
- ExponentialBackoffPlugin::getDefaultFailureCodes(), array(429)
1226
- ));
1227
-
1228
- $client->addSubscriber($backoffPlugin);
1229
- ```
1230
-
1231
- **After**
1232
-
1233
- ```php
1234
- use Guzzle\Plugin\Backoff\BackoffPlugin;
1235
- use Guzzle\Plugin\Backoff\HttpBackoffStrategy;
1236
-
1237
- // Use convenient factory method instead -- see implementation for ideas of what
1238
- // you can do with chaining backoff strategies
1239
- $backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, array_merge(
1240
- HttpBackoffStrategy::getDefaultFailureCodes(), array(429)
1241
- ));
1242
- $client->addSubscriber($backoffPlugin);
1243
- ```
1244
-
1245
- ### Known Issues
1246
-
1247
- #### [BUG] Accept-Encoding header behavior changed unintentionally.
1248
-
1249
- (See #217) (Fixed in 09daeb8c666fb44499a0646d655a8ae36456575e)
1250
-
1251
- In version 2.8 setting the `Accept-Encoding` header would set the CURLOPT_ENCODING option, which permitted cURL to
1252
- properly handle gzip/deflate compressed responses from the server. In versions affected by this bug this does not happen.
1253
- See issue #217 for a workaround, or use a version containing the fix.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/psalm.baseline.xml DELETED
@@ -1,87 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <files psalm-version="3.11.5@3c60609c218d4d4b3b257728b8089094e5c6c6c2">
3
- <file src="src/Client.php">
4
- <NullArgument occurrences="1">
5
- <code>null</code>
6
- </NullArgument>
7
- <PossiblyUndefinedVariable occurrences="1">
8
- <code>$options</code>
9
- </PossiblyUndefinedVariable>
10
- <UndefinedInterfaceMethod occurrences="1">
11
- <code>getBoundary</code>
12
- </UndefinedInterfaceMethod>
13
- </file>
14
- <file src="src/Cookie/CookieJar.php">
15
- <PossiblyFalseOperand occurrences="1">
16
- <code>$result</code>
17
- </PossiblyFalseOperand>
18
- </file>
19
- <file src="src/Exception/RequestException.php">
20
- <ImplicitToStringCast occurrences="1">
21
- <code>$uri</code>
22
- </ImplicitToStringCast>
23
- </file>
24
- <file src="src/Handler/CurlFactory.php">
25
- <ImplicitToStringCast occurrences="1">
26
- <code>$easy-&gt;request-&gt;getUri()</code>
27
- </ImplicitToStringCast>
28
- <TypeDoesNotContainType occurrences="1">
29
- <code>$timeoutRequiresNoSignal &amp;&amp; \strtoupper(\substr(\PHP_OS, 0, 3)) !== 'WIN'</code>
30
- </TypeDoesNotContainType>
31
- </file>
32
- <file src="src/Handler/CurlMultiHandler.php">
33
- <InvalidArgument occurrences="1">
34
- <code>$this-&gt;active</code>
35
- </InvalidArgument>
36
- <InvalidPropertyAssignmentValue occurrences="1">
37
- <code>$this-&gt;active</code>
38
- </InvalidPropertyAssignmentValue>
39
- <UndefinedThisPropertyAssignment occurrences="1">
40
- <code>$this-&gt;_mh</code>
41
- </UndefinedThisPropertyAssignment>
42
- </file>
43
- <file src="src/Handler/MockHandler.php">
44
- <InvalidScalarArgument occurrences="1">
45
- <code>$options['delay'] * 1000</code>
46
- </InvalidScalarArgument>
47
- </file>
48
- <file src="src/Handler/StreamHandler.php">
49
- <ImplicitToStringCast occurrences="1">
50
- <code>$uri</code>
51
- </ImplicitToStringCast>
52
- </file>
53
- <file src="src/HandlerStack.php">
54
- <PropertyTypeCoercion occurrences="4">
55
- <code>$this-&gt;stack</code>
56
- <code>$this-&gt;stack</code>
57
- <code>$this-&gt;stack</code>
58
- <code>$this-&gt;stack</code>
59
- </PropertyTypeCoercion>
60
- </file>
61
- <file src="src/MessageFormatter.php">
62
- <InvalidScalarArgument occurrences="1"/>
63
- </file>
64
- <file src="src/Middleware.php">
65
- <InvalidArgument occurrences="1">
66
- <code>$request</code>
67
- </InvalidArgument>
68
- </file>
69
- <file src="src/RedirectMiddleware.php">
70
- <ImplicitToStringCast occurrences="1">
71
- <code>$location</code>
72
- </ImplicitToStringCast>
73
- </file>
74
- <file src="src/RetryMiddleware.php">
75
- <TooManyArguments occurrences="1">
76
- <code>($this-&gt;delay)(++$options['retries'], $response)</code>
77
- </TooManyArguments>
78
- </file>
79
- <file src="src/Utils.php">
80
- <ForbiddenCode occurrences="1">
81
- <code>\var_dump($input)</code>
82
- </ForbiddenCode>
83
- <PossiblyNullArgument occurrences="1">
84
- <code>$info</code>
85
- </PossiblyNullArgument>
86
- </file>
87
- </files>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/psalm.xml DELETED
@@ -1,16 +0,0 @@
1
- <?xml version="1.0"?>
2
- <psalm
3
- errorLevel="3"
4
- resolveFromConfigFile="true"
5
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
- xmlns="https://getpsalm.org/schema/config"
7
- xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8
- errorBaseline="psalm.baseline.xml"
9
- >
10
- <projectFiles>
11
- <directory name="src" />
12
- <ignoreFiles>
13
- <directory name="vendor" />
14
- </ignoreFiles>
15
- </projectFiles>
16
- </psalm>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Client.php DELETED
@@ -1,473 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Cookie\CookieJar;
6
- use GuzzleHttp\Exception\GuzzleException;
7
- use GuzzleHttp\Exception\InvalidArgumentException;
8
- use GuzzleHttp\Promise\PromiseInterface;
9
- use Psr\Http\Message\RequestInterface;
10
- use Psr\Http\Message\ResponseInterface;
11
- use Psr\Http\Message\UriInterface;
12
-
13
- /**
14
- * @final
15
- */
16
- class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
17
- {
18
- use ClientTrait;
19
-
20
- /**
21
- * @var array Default request options
22
- */
23
- private $config;
24
-
25
- /**
26
- * Clients accept an array of constructor parameters.
27
- *
28
- * Here's an example of creating a client using a base_uri and an array of
29
- * default request options to apply to each request:
30
- *
31
- * $client = new Client([
32
- * 'base_uri' => 'http://www.foo.com/1.0/',
33
- * 'timeout' => 0,
34
- * 'allow_redirects' => false,
35
- * 'proxy' => '192.168.16.1:10'
36
- * ]);
37
- *
38
- * Client configuration settings include the following options:
39
- *
40
- * - handler: (callable) Function that transfers HTTP requests over the
41
- * wire. The function is called with a Psr7\Http\Message\RequestInterface
42
- * and array of transfer options, and must return a
43
- * GuzzleHttp\Promise\PromiseInterface that is fulfilled with a
44
- * Psr7\Http\Message\ResponseInterface on success.
45
- * If no handler is provided, a default handler will be created
46
- * that enables all of the request options below by attaching all of the
47
- * default middleware to the handler.
48
- * - base_uri: (string|UriInterface) Base URI of the client that is merged
49
- * into relative URIs. Can be a string or instance of UriInterface.
50
- * - **: any request option
51
- *
52
- * @param array $config Client configuration settings.
53
- *
54
- * @see \GuzzleHttp\RequestOptions for a list of available request options.
55
- */
56
- public function __construct(array $config = [])
57
- {
58
- if (!isset($config['handler'])) {
59
- $config['handler'] = HandlerStack::create();
60
- } elseif (!\is_callable($config['handler'])) {
61
- throw new InvalidArgumentException('handler must be a callable');
62
- }
63
-
64
- // Convert the base_uri to a UriInterface
65
- if (isset($config['base_uri'])) {
66
- $config['base_uri'] = Psr7\uri_for($config['base_uri']);
67
- }
68
-
69
- $this->configureDefaults($config);
70
- }
71
-
72
- /**
73
- * @param string $method
74
- * @param array $args
75
- *
76
- * @return PromiseInterface|ResponseInterface
77
- *
78
- * @deprecated Client::__call will be removed in guzzlehttp/guzzle:8.0.
79
- */
80
- public function __call($method, $args)
81
- {
82
- if (\count($args) < 1) {
83
- throw new InvalidArgumentException('Magic request methods require a URI and optional options array');
84
- }
85
-
86
- $uri = $args[0];
87
- $opts = $args[1] ?? [];
88
-
89
- return \substr($method, -5) === 'Async'
90
- ? $this->requestAsync(\substr($method, 0, -5), $uri, $opts)
91
- : $this->request($method, $uri, $opts);
92
- }
93
-
94
- /**
95
- * Asynchronously send an HTTP request.
96
- *
97
- * @param array $options Request options to apply to the given
98
- * request and to the transfer. See \GuzzleHttp\RequestOptions.
99
- */
100
- public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface
101
- {
102
- // Merge the base URI into the request URI if needed.
103
- $options = $this->prepareDefaults($options);
104
-
105
- return $this->transfer(
106
- $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')),
107
- $options
108
- );
109
- }
110
-
111
- /**
112
- * Send an HTTP request.
113
- *
114
- * @param array $options Request options to apply to the given
115
- * request and to the transfer. See \GuzzleHttp\RequestOptions.
116
- *
117
- * @throws GuzzleException
118
- */
119
- public function send(RequestInterface $request, array $options = []): ResponseInterface
120
- {
121
- $options[RequestOptions::SYNCHRONOUS] = true;
122
- return $this->sendAsync($request, $options)->wait();
123
- }
124
-
125
- /**
126
- * The HttpClient PSR (PSR-18) specify this method.
127
- *
128
- * @inheritDoc
129
- */
130
- public function sendRequest(RequestInterface $request): ResponseInterface
131
- {
132
- $options[RequestOptions::SYNCHRONOUS] = true;
133
- $options[RequestOptions::ALLOW_REDIRECTS] = false;
134
- $options[RequestOptions::HTTP_ERRORS] = false;
135
-
136
- return $this->sendAsync($request, $options)->wait();
137
- }
138
-
139
- /**
140
- * Create and send an asynchronous HTTP request.
141
- *
142
- * Use an absolute path to override the base path of the client, or a
143
- * relative path to append to the base path of the client. The URL can
144
- * contain the query string as well. Use an array to provide a URL
145
- * template and additional variables to use in the URL template expansion.
146
- *
147
- * @param string $method HTTP method
148
- * @param string|UriInterface $uri URI object or string.
149
- * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
150
- */
151
- public function requestAsync(string $method, $uri = '', array $options = []): PromiseInterface
152
- {
153
- $options = $this->prepareDefaults($options);
154
- // Remove request modifying parameter because it can be done up-front.
155
- $headers = $options['headers'] ?? [];
156
- $body = $options['body'] ?? null;
157
- $version = $options['version'] ?? '1.1';
158
- // Merge the URI into the base URI.
159
- $uri = $this->buildUri(Psr7\uri_for($uri), $options);
160
- if (\is_array($body)) {
161
- throw $this->invalidBody();
162
- }
163
- $request = new Psr7\Request($method, $uri, $headers, $body, $version);
164
- // Remove the option so that they are not doubly-applied.
165
- unset($options['headers'], $options['body'], $options['version']);
166
-
167
- return $this->transfer($request, $options);
168
- }
169
-
170
- /**
171
- * Create and send an HTTP request.
172
- *
173
- * Use an absolute path to override the base path of the client, or a
174
- * relative path to append to the base path of the client. The URL can
175
- * contain the query string as well.
176
- *
177
- * @param string $method HTTP method.
178
- * @param string|UriInterface $uri URI object or string.
179
- * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
180
- *
181
- * @throws GuzzleException
182
- */
183
- public function request(string $method, $uri = '', array $options = []): ResponseInterface
184
- {
185
- $options[RequestOptions::SYNCHRONOUS] = true;
186
- return $this->requestAsync($method, $uri, $options)->wait();
187
- }
188
-
189
- /**
190
- * Get a client configuration option.
191
- *
192
- * These options include default request options of the client, a "handler"
193
- * (if utilized by the concrete client), and a "base_uri" if utilized by
194
- * the concrete client.
195
- *
196
- * @param string|null $option The config option to retrieve.
197
- *
198
- * @return mixed
199
- *
200
- * @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0.
201
- */
202
- public function getConfig(?string $option = null)
203
- {
204
- return $option === null
205
- ? $this->config
206
- : (isset($this->config[$option]) ? $this->config[$option] : null);
207
- }
208
-
209
- private function buildUri(UriInterface $uri, array $config): UriInterface
210
- {
211
- if (isset($config['base_uri'])) {
212
- $uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
213
- }
214
-
215
- if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) {
216
- $idnOptions = ($config['idn_conversion'] === true) ? \IDNA_DEFAULT : $config['idn_conversion'];
217
- $uri = Utils::idnUriConvert($uri, $idnOptions);
218
- }
219
-
220
- return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
221
- }
222
-
223
- /**
224
- * Configures the default options for a client.
225
- */
226
- private function configureDefaults(array $config): void
227
- {
228
- $defaults = [
229
- 'allow_redirects' => RedirectMiddleware::$defaultSettings,
230
- 'http_errors' => true,
231
- 'decode_content' => true,
232
- 'verify' => true,
233
- 'cookies' => false,
234
- 'idn_conversion' => false,
235
- ];
236
-
237
- // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
238
-
239
- // We can only trust the HTTP_PROXY environment variable in a CLI
240
- // process due to the fact that PHP has no reliable mechanism to
241
- // get environment variables that start with "HTTP_".
242
- if (\PHP_SAPI === 'cli' && ($proxy = Utils::getenv('HTTP_PROXY'))) {
243
- $defaults['proxy']['http'] = $proxy;
244
- }
245
-
246
- if ($proxy = Utils::getenv('HTTPS_PROXY')) {
247
- $defaults['proxy']['https'] = $proxy;
248
- }
249
-
250
- if ($noProxy = Utils::getenv('NO_PROXY')) {
251
- $cleanedNoProxy = \str_replace(' ', '', $noProxy);
252
- $defaults['proxy']['no'] = \explode(',', $cleanedNoProxy);
253
- }
254
-
255
- $this->config = $config + $defaults;
256
-
257
- if (!empty($config['cookies']) && $config['cookies'] === true) {
258
- $this->config['cookies'] = new CookieJar();
259
- }
260
-
261
- // Add the default user-agent header.
262
- if (!isset($this->config['headers'])) {
263
- $this->config['headers'] = ['User-Agent' => Utils::defaultUserAgent()];
264
- } else {
265
- // Add the User-Agent header if one was not already set.
266
- foreach (\array_keys($this->config['headers']) as $name) {
267
- if (\strtolower($name) === 'user-agent') {
268
- return;
269
- }
270
- }
271
- $this->config['headers']['User-Agent'] = Utils::defaultUserAgent();
272
- }
273
- }
274
-
275
- /**
276
- * Merges default options into the array.
277
- *
278
- * @param array $options Options to modify by reference
279
- */
280
- private function prepareDefaults(array $options): array
281
- {
282
- $defaults = $this->config;
283
-
284
- if (!empty($defaults['headers'])) {
285
- // Default headers are only added if they are not present.
286
- $defaults['_conditional'] = $defaults['headers'];
287
- unset($defaults['headers']);
288
- }
289
-
290
- // Special handling for headers is required as they are added as
291
- // conditional headers and as headers passed to a request ctor.
292
- if (\array_key_exists('headers', $options)) {
293
- // Allows default headers to be unset.
294
- if ($options['headers'] === null) {
295
- $defaults['_conditional'] = [];
296
- unset($options['headers']);
297
- } elseif (!\is_array($options['headers'])) {
298
- throw new InvalidArgumentException('headers must be an array');
299
- }
300
- }
301
-
302
- // Shallow merge defaults underneath options.
303
- $result = $options + $defaults;
304
-
305
- // Remove null values.
306
- foreach ($result as $k => $v) {
307
- if ($v === null) {
308
- unset($result[$k]);
309
- }
310
- }
311
-
312
- return $result;
313
- }
314
-
315
- /**
316
- * Transfers the given request and applies request options.
317
- *
318
- * The URI of the request is not modified and the request options are used
319
- * as-is without merging in default options.
320
- *
321
- * @param array $options See \GuzzleHttp\RequestOptions.
322
- */
323
- private function transfer(RequestInterface $request, array $options): PromiseInterface
324
- {
325
- $request = $this->applyOptions($request, $options);
326
- /** @var HandlerStack $handler */
327
- $handler = $options['handler'];
328
-
329
- try {
330
- return Promise\promise_for($handler($request, $options));
331
- } catch (\Exception $e) {
332
- return Promise\rejection_for($e);
333
- }
334
- }
335
-
336
- /**
337
- * Applies the array of request options to a request.
338
- */
339
- private function applyOptions(RequestInterface $request, array &$options): RequestInterface
340
- {
341
- $modify = [
342
- 'set_headers' => [],
343
- ];
344
-
345
- if (isset($options['headers'])) {
346
- $modify['set_headers'] = $options['headers'];
347
- unset($options['headers']);
348
- }
349
-
350
- if (isset($options['form_params'])) {
351
- if (isset($options['multipart'])) {
352
- throw new InvalidArgumentException('You cannot use '
353
- . 'form_params and multipart at the same time. Use the '
354
- . 'form_params option if you want to send application/'
355
- . 'x-www-form-urlencoded requests, and the multipart '
356
- . 'option to send multipart/form-data requests.');
357
- }
358
- $options['body'] = \http_build_query($options['form_params'], '', '&');
359
- unset($options['form_params']);
360
- // Ensure that we don't have the header in different case and set the new value.
361
- $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
362
- $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
363
- }
364
-
365
- if (isset($options['multipart'])) {
366
- $options['body'] = new Psr7\MultipartStream($options['multipart']);
367
- unset($options['multipart']);
368
- }
369
-
370
- if (isset($options['json'])) {
371
- $options['body'] = Utils::jsonEncode($options['json']);
372
- unset($options['json']);
373
- // Ensure that we don't have the header in different case and set the new value.
374
- $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
375
- $options['_conditional']['Content-Type'] = 'application/json';
376
- }
377
-
378
- if (!empty($options['decode_content'])
379
- && $options['decode_content'] !== true
380
- ) {
381
- // Ensure that we don't have the header in different case and set the new value.
382
- $options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']);
383
- $modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
384
- }
385
-
386
- if (isset($options['body'])) {
387
- if (\is_array($options['body'])) {
388
- throw $this->invalidBody();
389
- }
390
- $modify['body'] = Psr7\stream_for($options['body']);
391
- unset($options['body']);
392
- }
393
-
394
- if (!empty($options['auth']) && \is_array($options['auth'])) {
395
- $value = $options['auth'];
396
- $type = isset($value[2]) ? \strtolower($value[2]) : 'basic';
397
- switch ($type) {
398
- case 'basic':
399
- // Ensure that we don't have the header in different case and set the new value.
400
- $modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']);
401
- $modify['set_headers']['Authorization'] = 'Basic '
402
- . \base64_encode("$value[0]:$value[1]");
403
- break;
404
- case 'digest':
405
- // @todo: Do not rely on curl
406
- $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_DIGEST;
407
- $options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]";
408
- break;
409
- case 'ntlm':
410
- $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_NTLM;
411
- $options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]";
412
- break;
413
- }
414
- }
415
-
416
- if (isset($options['query'])) {
417
- $value = $options['query'];
418
- if (\is_array($value)) {
419
- $value = \http_build_query($value, '', '&', \PHP_QUERY_RFC3986);
420
- }
421
- if (!\is_string($value)) {
422
- throw new InvalidArgumentException('query must be a string or array');
423
- }
424
- $modify['query'] = $value;
425
- unset($options['query']);
426
- }
427
-
428
- // Ensure that sink is not an invalid value.
429
- if (isset($options['sink'])) {
430
- // TODO: Add more sink validation?
431
- if (\is_bool($options['sink'])) {
432
- throw new InvalidArgumentException('sink must not be a boolean');
433
- }
434
- }
435
-
436
- $request = Psr7\modify_request($request, $modify);
437
- if ($request->getBody() instanceof Psr7\MultipartStream) {
438
- // Use a multipart/form-data POST if a Content-Type is not set.
439
- // Ensure that we don't have the header in different case and set the new value.
440
- $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
441
- $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
442
- . $request->getBody()->getBoundary();
443
- }
444
-
445
- // Merge in conditional headers if they are not present.
446
- if (isset($options['_conditional'])) {
447
- // Build up the changes so it's in a single clone of the message.
448
- $modify = [];
449
- foreach ($options['_conditional'] as $k => $v) {
450
- if (!$request->hasHeader($k)) {
451
- $modify['set_headers'][$k] = $v;
452
- }
453
- }
454
- $request = Psr7\modify_request($request, $modify);
455
- // Don't pass this internal value along to middleware/handlers.
456
- unset($options['_conditional']);
457
- }
458
-
459
- return $request;
460
- }
461
-
462
- /**
463
- * Return an InvalidArgumentException with pre-set message.
464
- */
465
- private function invalidBody(): InvalidArgumentException
466
- {
467
- return new InvalidArgumentException('Passing in the "body" request '
468
- . 'option as an array to send a request is not supported. '
469
- . 'Please use the "form_params" request option to send a '
470
- . 'application/x-www-form-urlencoded request, or the "multipart" '
471
- . 'request option to send a multipart/form-data request.');
472
- }
473
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/ClientInterface.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Exception\GuzzleException;
6
- use GuzzleHttp\Promise\PromiseInterface;
7
- use Psr\Http\Message\RequestInterface;
8
- use Psr\Http\Message\ResponseInterface;
9
- use Psr\Http\Message\UriInterface;
10
-
11
- /**
12
- * Client interface for sending HTTP requests.
13
- */
14
- interface ClientInterface
15
- {
16
- /**
17
- * The Guzzle major version.
18
- */
19
- const MAJOR_VERSION = 7;
20
-
21
- /**
22
- * Send an HTTP request.
23
- *
24
- * @param RequestInterface $request Request to send
25
- * @param array $options Request options to apply to the given
26
- * request and to the transfer.
27
- *
28
- * @throws GuzzleException
29
- */
30
- public function send(RequestInterface $request, array $options = []): ResponseInterface;
31
-
32
- /**
33
- * Asynchronously send an HTTP request.
34
- *
35
- * @param RequestInterface $request Request to send
36
- * @param array $options Request options to apply to the given
37
- * request and to the transfer.
38
- */
39
- public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface;
40
-
41
- /**
42
- * Create and send an HTTP request.
43
- *
44
- * Use an absolute path to override the base path of the client, or a
45
- * relative path to append to the base path of the client. The URL can
46
- * contain the query string as well.
47
- *
48
- * @param string $method HTTP method.
49
- * @param string|UriInterface $uri URI object or string.
50
- * @param array $options Request options to apply.
51
- *
52
- * @throws GuzzleException
53
- */
54
- public function request(string $method, $uri, array $options = []): ResponseInterface;
55
-
56
- /**
57
- * Create and send an asynchronous HTTP request.
58
- *
59
- * Use an absolute path to override the base path of the client, or a
60
- * relative path to append to the base path of the client. The URL can
61
- * contain the query string as well. Use an array to provide a URL
62
- * template and additional variables to use in the URL template expansion.
63
- *
64
- * @param string $method HTTP method
65
- * @param string|UriInterface $uri URI object or string.
66
- * @param array $options Request options to apply.
67
- */
68
- public function requestAsync(string $method, $uri, array $options = []): PromiseInterface;
69
-
70
- /**
71
- * Get a client configuration option.
72
- *
73
- * These options include default request options of the client, a "handler"
74
- * (if utilized by the concrete client), and a "base_uri" if utilized by
75
- * the concrete client.
76
- *
77
- * @param string|null $option The config option to retrieve.
78
- *
79
- * @return mixed
80
- *
81
- * @deprecated ClientInterface::getConfig will be removed in guzzlehttp/guzzle:8.0.
82
- */
83
- public function getConfig(?string $option = null);
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/ClientTrait.php DELETED
@@ -1,241 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Exception\GuzzleException;
6
- use GuzzleHttp\Promise\PromiseInterface;
7
- use Psr\Http\Message\ResponseInterface;
8
- use Psr\Http\Message\UriInterface;
9
-
10
- /**
11
- * Client interface for sending HTTP requests.
12
- */
13
- trait ClientTrait
14
- {
15
- /**
16
- * Create and send an HTTP request.
17
- *
18
- * Use an absolute path to override the base path of the client, or a
19
- * relative path to append to the base path of the client. The URL can
20
- * contain the query string as well.
21
- *
22
- * @param string $method HTTP method.
23
- * @param string|UriInterface $uri URI object or string.
24
- * @param array $options Request options to apply.
25
- *
26
- * @throws GuzzleException
27
- */
28
- abstract public function request(string $method, $uri, array $options = []): ResponseInterface;
29
-
30
- /**
31
- * Create and send an HTTP GET request.
32
- *
33
- * Use an absolute path to override the base path of the client, or a
34
- * relative path to append to the base path of the client. The URL can
35
- * contain the query string as well.
36
- *
37
- * @param string|UriInterface $uri URI object or string.
38
- * @param array $options Request options to apply.
39
- *
40
- * @throws GuzzleException
41
- */
42
- public function get($uri, array $options = []): ResponseInterface
43
- {
44
- return $this->request('GET', $uri, $options);
45
- }
46
-
47
- /**
48
- * Create and send an HTTP HEAD request.
49
- *
50
- * Use an absolute path to override the base path of the client, or a
51
- * relative path to append to the base path of the client. The URL can
52
- * contain the query string as well.
53
- *
54
- * @param string|UriInterface $uri URI object or string.
55
- * @param array $options Request options to apply.
56
- *
57
- * @throws GuzzleException
58
- */
59
- public function head($uri, array $options = []): ResponseInterface
60
- {
61
- return $this->request('HEAD', $uri, $options);
62
- }
63
-
64
- /**
65
- * Create and send an HTTP PUT request.
66
- *
67
- * Use an absolute path to override the base path of the client, or a
68
- * relative path to append to the base path of the client. The URL can
69
- * contain the query string as well.
70
- *
71
- * @param string|UriInterface $uri URI object or string.
72
- * @param array $options Request options to apply.
73
- *
74
- * @throws GuzzleException
75
- */
76
- public function put($uri, array $options = []): ResponseInterface
77
- {
78
- return $this->request('PUT', $uri, $options);
79
- }
80
-
81
- /**
82
- * Create and send an HTTP POST request.
83
- *
84
- * Use an absolute path to override the base path of the client, or a
85
- * relative path to append to the base path of the client. The URL can
86
- * contain the query string as well.
87
- *
88
- * @param string|UriInterface $uri URI object or string.
89
- * @param array $options Request options to apply.
90
- *
91
- * @throws GuzzleException
92
- */
93
- public function post($uri, array $options = []): ResponseInterface
94
- {
95
- return $this->request('POST', $uri, $options);
96
- }
97
-
98
- /**
99
- * Create and send an HTTP PATCH request.
100
- *
101
- * Use an absolute path to override the base path of the client, or a
102
- * relative path to append to the base path of the client. The URL can
103
- * contain the query string as well.
104
- *
105
- * @param string|UriInterface $uri URI object or string.
106
- * @param array $options Request options to apply.
107
- *
108
- * @throws GuzzleException
109
- */
110
- public function patch($uri, array $options = []): ResponseInterface
111
- {
112
- return $this->request('PATCH', $uri, $options);
113
- }
114
-
115
- /**
116
- * Create and send an HTTP DELETE request.
117
- *
118
- * Use an absolute path to override the base path of the client, or a
119
- * relative path to append to the base path of the client. The URL can
120
- * contain the query string as well.
121
- *
122
- * @param string|UriInterface $uri URI object or string.
123
- * @param array $options Request options to apply.
124
- *
125
- * @throws GuzzleException
126
- */
127
- public function delete($uri, array $options = []): ResponseInterface
128
- {
129
- return $this->request('DELETE', $uri, $options);
130
- }
131
-
132
- /**
133
- * Create and send an asynchronous HTTP request.
134
- *
135
- * Use an absolute path to override the base path of the client, or a
136
- * relative path to append to the base path of the client. The URL can
137
- * contain the query string as well. Use an array to provide a URL
138
- * template and additional variables to use in the URL template expansion.
139
- *
140
- * @param string $method HTTP method
141
- * @param string|UriInterface $uri URI object or string.
142
- * @param array $options Request options to apply.
143
- */
144
- abstract public function requestAsync(string $method, $uri, array $options = []): PromiseInterface;
145
-
146
- /**
147
- * Create and send an asynchronous HTTP GET request.
148
- *
149
- * Use an absolute path to override the base path of the client, or a
150
- * relative path to append to the base path of the client. The URL can
151
- * contain the query string as well. Use an array to provide a URL
152
- * template and additional variables to use in the URL template expansion.
153
- *
154
- * @param string|UriInterface $uri URI object or string.
155
- * @param array $options Request options to apply.
156
- */
157
- public function getAsync($uri, array $options = []): PromiseInterface
158
- {
159
- return $this->requestAsync('GET', $uri, $options);
160
- }
161
-
162
- /**
163
- * Create and send an asynchronous HTTP HEAD request.
164
- *
165
- * Use an absolute path to override the base path of the client, or a
166
- * relative path to append to the base path of the client. The URL can
167
- * contain the query string as well. Use an array to provide a URL
168
- * template and additional variables to use in the URL template expansion.
169
- *
170
- * @param string|UriInterface $uri URI object or string.
171
- * @param array $options Request options to apply.
172
- */
173
- public function headAsync($uri, array $options = []): PromiseInterface
174
- {
175
- return $this->requestAsync('HEAD', $uri, $options);
176
- }
177
-
178
- /**
179
- * Create and send an asynchronous HTTP PUT request.
180
- *
181
- * Use an absolute path to override the base path of the client, or a
182
- * relative path to append to the base path of the client. The URL can
183
- * contain the query string as well. Use an array to provide a URL
184
- * template and additional variables to use in the URL template expansion.
185
- *
186
- * @param string|UriInterface $uri URI object or string.
187
- * @param array $options Request options to apply.
188
- */
189
- public function putAsync($uri, array $options = []): PromiseInterface
190
- {
191
- return $this->requestAsync('PUT', $uri, $options);
192
- }
193
-
194
- /**
195
- * Create and send an asynchronous HTTP POST request.
196
- *
197
- * Use an absolute path to override the base path of the client, or a
198
- * relative path to append to the base path of the client. The URL can
199
- * contain the query string as well. Use an array to provide a URL
200
- * template and additional variables to use in the URL template expansion.
201
- *
202
- * @param string|UriInterface $uri URI object or string.
203
- * @param array $options Request options to apply.
204
- */
205
- public function postAsync($uri, array $options = []): PromiseInterface
206
- {
207
- return $this->requestAsync('POST', $uri, $options);
208
- }
209
-
210
- /**
211
- * Create and send an asynchronous HTTP PATCH request.
212
- *
213
- * Use an absolute path to override the base path of the client, or a
214
- * relative path to append to the base path of the client. The URL can
215
- * contain the query string as well. Use an array to provide a URL
216
- * template and additional variables to use in the URL template expansion.
217
- *
218
- * @param string|UriInterface $uri URI object or string.
219
- * @param array $options Request options to apply.
220
- */
221
- public function patchAsync($uri, array $options = []): PromiseInterface
222
- {
223
- return $this->requestAsync('PATCH', $uri, $options);
224
- }
225
-
226
- /**
227
- * Create and send an asynchronous HTTP DELETE request.
228
- *
229
- * Use an absolute path to override the base path of the client, or a
230
- * relative path to append to the base path of the client. The URL can
231
- * contain the query string as well. Use an array to provide a URL
232
- * template and additional variables to use in the URL template expansion.
233
- *
234
- * @param string|UriInterface $uri URI object or string.
235
- * @param array $options Request options to apply.
236
- */
237
- public function deleteAsync($uri, array $options = []): PromiseInterface
238
- {
239
- return $this->requestAsync('DELETE', $uri, $options);
240
- }
241
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php DELETED
@@ -1,313 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Cookie;
4
-
5
- use Psr\Http\Message\RequestInterface;
6
- use Psr\Http\Message\ResponseInterface;
7
-
8
- /**
9
- * Cookie jar that stores cookies as an array
10
- */
11
- class CookieJar implements CookieJarInterface
12
- {
13
- /**
14
- * @var SetCookie[] Loaded cookie data
15
- */
16
- private $cookies = [];
17
-
18
- /**
19
- * @var bool
20
- */
21
- private $strictMode;
22
-
23
- /**
24
- * @param bool $strictMode Set to true to throw exceptions when invalid
25
- * cookies are added to the cookie jar.
26
- * @param array $cookieArray Array of SetCookie objects or a hash of
27
- * arrays that can be used with the SetCookie
28
- * constructor
29
- */
30
- public function __construct(bool $strictMode = false, array $cookieArray = [])
31
- {
32
- $this->strictMode = $strictMode;
33
-
34
- foreach ($cookieArray as $cookie) {
35
- if (!($cookie instanceof SetCookie)) {
36
- $cookie = new SetCookie($cookie);
37
- }
38
- $this->setCookie($cookie);
39
- }
40
- }
41
-
42
- /**
43
- * Create a new Cookie jar from an associative array and domain.
44
- *
45
- * @param array $cookies Cookies to create the jar from
46
- * @param string $domain Domain to set the cookies to
47
- */
48
- public static function fromArray(array $cookies, string $domain): self
49
- {
50
- $cookieJar = new self();
51
- foreach ($cookies as $name => $value) {
52
- $cookieJar->setCookie(new SetCookie([
53
- 'Domain' => $domain,
54
- 'Name' => $name,
55
- 'Value' => $value,
56
- 'Discard' => true
57
- ]));
58
- }
59
-
60
- return $cookieJar;
61
- }
62
-
63
- /**
64
- * Evaluate if this cookie should be persisted to storage
65
- * that survives between requests.
66
- *
67
- * @param SetCookie $cookie Being evaluated.
68
- * @param bool $allowSessionCookies If we should persist session cookies
69
- */
70
- public static function shouldPersist(SetCookie $cookie, bool $allowSessionCookies = false): bool
71
- {
72
- if ($cookie->getExpires() || $allowSessionCookies) {
73
- if (!$cookie->getDiscard()) {
74
- return true;
75
- }
76
- }
77
-
78
- return false;
79
- }
80
-
81
- /**
82
- * Finds and returns the cookie based on the name
83
- *
84
- * @param string $name cookie name to search for
85
- *
86
- * @return SetCookie|null cookie that was found or null if not found
87
- */
88
- public function getCookieByName(string $name): ?SetCookie
89
- {
90
- foreach ($this->cookies as $cookie) {
91
- if ($cookie->getName() !== null && \strcasecmp($cookie->getName(), $name) === 0) {
92
- return $cookie;
93
- }
94
- }
95
-
96
- return null;
97
- }
98
-
99
- /**
100
- * @inheritDoc
101
- */
102
- public function toArray(): array
103
- {
104
- return \array_map(static function (SetCookie $cookie): array {
105
- return $cookie->toArray();
106
- }, $this->getIterator()->getArrayCopy());
107
- }
108
-
109
- /**
110
- * @inheritDoc
111
- */
112
- public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void
113
- {
114
- if (!$domain) {
115
- $this->cookies = [];
116
- return;
117
- } elseif (!$path) {
118
- $this->cookies = \array_filter(
119
- $this->cookies,
120
- static function (SetCookie $cookie) use ($domain): bool {
121
- return !$cookie->matchesDomain($domain);
122
- }
123
- );
124
- } elseif (!$name) {
125
- $this->cookies = \array_filter(
126
- $this->cookies,
127
- static function (SetCookie $cookie) use ($path, $domain): bool {
128
- return !($cookie->matchesPath($path) &&
129
- $cookie->matchesDomain($domain));
130
- }
131
- );
132
- } else {
133
- $this->cookies = \array_filter(
134
- $this->cookies,
135
- static function (SetCookie $cookie) use ($path, $domain, $name) {
136
- return !($cookie->getName() == $name &&
137
- $cookie->matchesPath($path) &&
138
- $cookie->matchesDomain($domain));
139
- }
140
- );
141
- }
142
- }
143
-
144
- /**
145
- * @inheritDoc
146
- */
147
- public function clearSessionCookies(): void
148
- {
149
- $this->cookies = \array_filter(
150
- $this->cookies,
151
- static function (SetCookie $cookie): bool {
152
- return !$cookie->getDiscard() && $cookie->getExpires();
153
- }
154
- );
155
- }
156
-
157
- /**
158
- * @inheritDoc
159
- */
160
- public function setCookie(SetCookie $cookie): bool
161
- {
162
- // If the name string is empty (but not 0), ignore the set-cookie
163
- // string entirely.
164
- $name = $cookie->getName();
165
- if (!$name && $name !== '0') {
166
- return false;
167
- }
168
-
169
- // Only allow cookies with set and valid domain, name, value
170
- $result = $cookie->validate();
171
- if ($result !== true) {
172
- if ($this->strictMode) {
173
- throw new \RuntimeException('Invalid cookie: ' . $result);
174
- }
175
- $this->removeCookieIfEmpty($cookie);
176
- return false;
177
- }
178
-
179
- // Resolve conflicts with previously set cookies
180
- foreach ($this->cookies as $i => $c) {
181
-
182
- // Two cookies are identical, when their path, and domain are
183
- // identical.
184
- if ($c->getPath() != $cookie->getPath() ||
185
- $c->getDomain() != $cookie->getDomain() ||
186
- $c->getName() != $cookie->getName()
187
- ) {
188
- continue;
189
- }
190
-
191
- // The previously set cookie is a discard cookie and this one is
192
- // not so allow the new cookie to be set
193
- if (!$cookie->getDiscard() && $c->getDiscard()) {
194
- unset($this->cookies[$i]);
195
- continue;
196
- }
197
-
198
- // If the new cookie's expiration is further into the future, then
199
- // replace the old cookie
200
- if ($cookie->getExpires() > $c->getExpires()) {
201
- unset($this->cookies[$i]);
202
- continue;
203
- }
204
-
205
- // If the value has changed, we better change it
206
- if ($cookie->getValue() !== $c->getValue()) {
207
- unset($this->cookies[$i]);
208
- continue;
209
- }
210
-
211
- // The cookie exists, so no need to continue
212
- return false;
213
- }
214
-
215
- $this->cookies[] = $cookie;
216
-
217
- return true;
218
- }
219
-
220
- public function count(): int
221
- {
222
- return \count($this->cookies);
223
- }
224
-
225
- /**
226
- * @return \ArrayIterator<int, SetCookie>
227
- */
228
- public function getIterator(): \ArrayIterator
229
- {
230
- return new \ArrayIterator(\array_values($this->cookies));
231
- }
232
-
233
- public function extractCookies(RequestInterface $request, ResponseInterface $response): void
234
- {
235
- if ($cookieHeader = $response->getHeader('Set-Cookie')) {
236
- foreach ($cookieHeader as $cookie) {
237
- $sc = SetCookie::fromString($cookie);
238
- if (!$sc->getDomain()) {
239
- $sc->setDomain($request->getUri()->getHost());
240
- }
241
- if (0 !== \strpos($sc->getPath(), '/')) {
242
- $sc->setPath($this->getCookiePathFromRequest($request));
243
- }
244
- $this->setCookie($sc);
245
- }
246
- }
247
- }
248
-
249
- /**
250
- * Computes cookie path following RFC 6265 section 5.1.4
251
- *
252
- * @link https://tools.ietf.org/html/rfc6265#section-5.1.4
253
- */
254
- private function getCookiePathFromRequest(RequestInterface $request): string
255
- {
256
- $uriPath = $request->getUri()->getPath();
257
- if ('' === $uriPath) {
258
- return '/';
259
- }
260
- if (0 !== \strpos($uriPath, '/')) {
261
- return '/';
262
- }
263
- if ('/' === $uriPath) {
264
- return '/';
265
- }
266
- $lastSlashPos = \strrpos($uriPath, '/');
267
- if (0 === $lastSlashPos || false === $lastSlashPos) {
268
- return '/';
269
- }
270
-
271
- return \substr($uriPath, 0, $lastSlashPos);
272
- }
273
-
274
- public function withCookieHeader(RequestInterface $request): RequestInterface
275
- {
276
- $values = [];
277
- $uri = $request->getUri();
278
- $scheme = $uri->getScheme();
279
- $host = $uri->getHost();
280
- $path = $uri->getPath() ?: '/';
281
-
282
- foreach ($this->cookies as $cookie) {
283
- if ($cookie->matchesPath($path) &&
284
- $cookie->matchesDomain($host) &&
285
- !$cookie->isExpired() &&
286
- (!$cookie->getSecure() || $scheme === 'https')
287
- ) {
288
- $values[] = $cookie->getName() . '='
289
- . $cookie->getValue();
290
- }
291
- }
292
-
293
- return $values
294
- ? $request->withHeader('Cookie', \implode('; ', $values))
295
- : $request;
296
- }
297
-
298
- /**
299
- * If a cookie already exists and the server asks to set it again with a
300
- * null value, the cookie must be deleted.
301
- */
302
- private function removeCookieIfEmpty(SetCookie $cookie): void
303
- {
304
- $cookieValue = $cookie->getValue();
305
- if ($cookieValue === null || $cookieValue === '') {
306
- $this->clear(
307
- $cookie->getDomain(),
308
- $cookie->getPath(),
309
- $cookie->getName()
310
- );
311
- }
312
- }
313
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php DELETED
@@ -1,82 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Cookie;
4
-
5
- use Psr\Http\Message\RequestInterface;
6
- use Psr\Http\Message\ResponseInterface;
7
-
8
- /**
9
- * Stores HTTP cookies.
10
- *
11
- * It extracts cookies from HTTP requests, and returns them in HTTP responses.
12
- * CookieJarInterface instances automatically expire contained cookies when
13
- * necessary. Subclasses are also responsible for storing and retrieving
14
- * cookies from a file, database, etc.
15
- *
16
- * @link https://docs.python.org/2/library/cookielib.html Inspiration
17
- * @extends \IteratorAggregate<SetCookie>
18
- */
19
- interface CookieJarInterface extends \Countable, \IteratorAggregate
20
- {
21
- /**
22
- * Create a request with added cookie headers.
23
- *
24
- * If no matching cookies are found in the cookie jar, then no Cookie
25
- * header is added to the request and the same request is returned.
26
- *
27
- * @param RequestInterface $request Request object to modify.
28
- *
29
- * @return RequestInterface returns the modified request.
30
- */
31
- public function withCookieHeader(RequestInterface $request): RequestInterface;
32
-
33
- /**
34
- * Extract cookies from an HTTP response and store them in the CookieJar.
35
- *
36
- * @param RequestInterface $request Request that was sent
37
- * @param ResponseInterface $response Response that was received
38
- */
39
- public function extractCookies(
40
- RequestInterface $request,
41
- ResponseInterface $response
42
- ): void;
43
-
44
- /**
45
- * Sets a cookie in the cookie jar.
46
- *
47
- * @param SetCookie $cookie Cookie to set.
48
- *
49
- * @return bool Returns true on success or false on failure
50
- */
51
- public function setCookie(SetCookie $cookie): bool;
52
-
53
- /**
54
- * Remove cookies currently held in the cookie jar.
55
- *
56
- * Invoking this method without arguments will empty the whole cookie jar.
57
- * If given a $domain argument only cookies belonging to that domain will
58
- * be removed. If given a $domain and $path argument, cookies belonging to
59
- * the specified path within that domain are removed. If given all three
60
- * arguments, then the cookie with the specified name, path and domain is
61
- * removed.
62
- *
63
- * @param string|null $domain Clears cookies matching a domain
64
- * @param string|null $path Clears cookies matching a domain and path
65
- * @param string|null $name Clears cookies matching a domain, path, and name
66
- */
67
- public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void;
68
-
69
- /**
70
- * Discard all sessions cookies.
71
- *
72
- * Removes cookies that don't have an expire field or a have a discard
73
- * field set to true. To be called when the user agent shuts down according
74
- * to RFC 2965.
75
- */
76
- public function clearSessionCookies(): void;
77
-
78
- /**
79
- * Converts the cookie jar to an array.
80
- */
81
- public function toArray(): array;
82
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php DELETED
@@ -1,101 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Cookie;
4
-
5
- use GuzzleHttp\Utils;
6
-
7
- /**
8
- * Persists non-session cookies using a JSON formatted file
9
- */
10
- class FileCookieJar extends CookieJar
11
- {
12
- /**
13
- * @var string filename
14
- */
15
- private $filename;
16
-
17
- /**
18
- * @var bool Control whether to persist session cookies or not.
19
- */
20
- private $storeSessionCookies;
21
-
22
- /**
23
- * Create a new FileCookieJar object
24
- *
25
- * @param string $cookieFile File to store the cookie data
26
- * @param bool $storeSessionCookies Set to true to store session cookies
27
- * in the cookie jar.
28
- *
29
- * @throws \RuntimeException if the file cannot be found or created
30
- */
31
- public function __construct(string $cookieFile, bool $storeSessionCookies = false)
32
- {
33
- parent::__construct();
34
- $this->filename = $cookieFile;
35
- $this->storeSessionCookies = $storeSessionCookies;
36
-
37
- if (\file_exists($cookieFile)) {
38
- $this->load($cookieFile);
39
- }
40
- }
41
-
42
- /**
43
- * Saves the file when shutting down
44
- */
45
- public function __destruct()
46
- {
47
- $this->save($this->filename);
48
- }
49
-
50
- /**
51
- * Saves the cookies to a file.
52
- *
53
- * @param string $filename File to save
54
- *
55
- * @throws \RuntimeException if the file cannot be found or created
56
- */
57
- public function save(string $filename): void
58
- {
59
- $json = [];
60
- /** @var SetCookie $cookie */
61
- foreach ($this as $cookie) {
62
- if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
63
- $json[] = $cookie->toArray();
64
- }
65
- }
66
-
67
- $jsonStr = Utils::jsonEncode($json);
68
- if (false === \file_put_contents($filename, $jsonStr, \LOCK_EX)) {
69
- throw new \RuntimeException("Unable to save file {$filename}");
70
- }
71
- }
72
-
73
- /**
74
- * Load cookies from a JSON formatted file.
75
- *
76
- * Old cookies are kept unless overwritten by newly loaded ones.
77
- *
78
- * @param string $filename Cookie file to load.
79
- *
80
- * @throws \RuntimeException if the file cannot be loaded.
81
- */
82
- public function load(string $filename): void
83
- {
84
- $json = \file_get_contents($filename);
85
- if (false === $json) {
86
- throw new \RuntimeException("Unable to load file {$filename}");
87
- }
88
- if ($json === '') {
89
- return;
90
- }
91
-
92
- $data = Utils::jsonDecode($json, true);
93
- if (\is_array($data)) {
94
- foreach ($data as $cookie) {
95
- $this->setCookie(new SetCookie($cookie));
96
- }
97
- } elseif (\is_scalar($data) && !empty($data)) {
98
- throw new \RuntimeException("Invalid cookie file: {$filename}");
99
- }
100
- }
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Cookie;
4
-
5
- /**
6
- * Persists cookies in the client session
7
- */
8
- class SessionCookieJar extends CookieJar
9
- {
10
- /**
11
- * @var string session key
12
- */
13
- private $sessionKey;
14
-
15
- /**
16
- * @var bool Control whether to persist session cookies or not.
17
- */
18
- private $storeSessionCookies;
19
-
20
- /**
21
- * Create a new SessionCookieJar object
22
- *
23
- * @param string $sessionKey Session key name to store the cookie
24
- * data in session
25
- * @param bool $storeSessionCookies Set to true to store session cookies
26
- * in the cookie jar.
27
- */
28
- public function __construct(string $sessionKey, bool $storeSessionCookies = false)
29
- {
30
- parent::__construct();
31
- $this->sessionKey = $sessionKey;
32
- $this->storeSessionCookies = $storeSessionCookies;
33
- $this->load();
34
- }
35
-
36
- /**
37
- * Saves cookies to session when shutting down
38
- */
39
- public function __destruct()
40
- {
41
- $this->save();
42
- }
43
-
44
- /**
45
- * Save cookies to the client session
46
- */
47
- public function save(): void
48
- {
49
- $json = [];
50
- /** @var SetCookie $cookie */
51
- foreach ($this as $cookie) {
52
- if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
53
- $json[] = $cookie->toArray();
54
- }
55
- }
56
-
57
- $_SESSION[$this->sessionKey] = \json_encode($json);
58
- }
59
-
60
- /**
61
- * Load the contents of the client session into the data array
62
- */
63
- protected function load(): void
64
- {
65
- if (!isset($_SESSION[$this->sessionKey])) {
66
- return;
67
- }
68
- $data = \json_decode($_SESSION[$this->sessionKey], true);
69
- if (\is_array($data)) {
70
- foreach ($data as $cookie) {
71
- $this->setCookie(new SetCookie($cookie));
72
- }
73
- } elseif (\strlen($data)) {
74
- throw new \RuntimeException("Invalid cookie data");
75
- }
76
- }
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php DELETED
@@ -1,410 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Cookie;
4
-
5
- /**
6
- * Set-Cookie object
7
- */
8
- class SetCookie
9
- {
10
- /**
11
- * @var array
12
- */
13
- private static $defaults = [
14
- 'Name' => null,
15
- 'Value' => null,
16
- 'Domain' => null,
17
- 'Path' => '/',
18
- 'Max-Age' => null,
19
- 'Expires' => null,
20
- 'Secure' => false,
21
- 'Discard' => false,
22
- 'HttpOnly' => false
23
- ];
24
-
25
- /**
26
- * @var array Cookie data
27
- */
28
- private $data;
29
-
30
- /**
31
- * Create a new SetCookie object from a string.
32
- *
33
- * @param string $cookie Set-Cookie header string
34
- */
35
- public static function fromString(string $cookie): self
36
- {
37
- // Create the default return array
38
- $data = self::$defaults;
39
- // Explode the cookie string using a series of semicolons
40
- $pieces = \array_filter(\array_map('trim', \explode(';', $cookie)));
41
- // The name of the cookie (first kvp) must exist and include an equal sign.
42
- if (!isset($pieces[0]) || \strpos($pieces[0], '=') === false) {
43
- return new self($data);
44
- }
45
-
46
- // Add the cookie pieces into the parsed data array
47
- foreach ($pieces as $part) {
48
- $cookieParts = \explode('=', $part, 2);
49
- $key = \trim($cookieParts[0]);
50
- $value = isset($cookieParts[1])
51
- ? \trim($cookieParts[1], " \n\r\t\0\x0B")
52
- : true;
53
-
54
- // Only check for non-cookies when cookies have been found
55
- if (!isset($data['Name'])) {
56
- $data['Name'] = $key;
57
- $data['Value'] = $value;
58
- } else {
59
- foreach (\array_keys(self::$defaults) as $search) {
60
- if (!\strcasecmp($search, $key)) {
61
- $data[$search] = $value;
62
- continue 2;
63
- }
64
- }
65
- $data[$key] = $value;
66
- }
67
- }
68
-
69
- return new self($data);
70
- }
71
-
72
- /**
73
- * @param array $data Array of cookie data provided by a Cookie parser
74
- */
75
- public function __construct(array $data = [])
76
- {
77
- /** @var array|null $replaced will be null in case of replace error */
78
- $replaced = \array_replace(self::$defaults, $data);
79
- if ($replaced === null) {
80
- throw new \InvalidArgumentException('Unable to replace the default values for the Cookie.');
81
- }
82
-
83
- $this->data = $replaced;
84
- // Extract the Expires value and turn it into a UNIX timestamp if needed
85
- if (!$this->getExpires() && $this->getMaxAge()) {
86
- // Calculate the Expires date
87
- $this->setExpires(\time() + $this->getMaxAge());
88
- } elseif (null !== ($expires = $this->getExpires()) && !\is_numeric($expires)) {
89
- $this->setExpires($expires);
90
- }
91
- }
92
-
93
- public function __toString()
94
- {
95
- $str = $this->data['Name'] . '=' . $this->data['Value'] . '; ';
96
- foreach ($this->data as $k => $v) {
97
- if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) {
98
- if ($k === 'Expires') {
99
- $str .= 'Expires=' . \gmdate('D, d M Y H:i:s \G\M\T', $v) . '; ';
100
- } else {
101
- $str .= ($v === true ? $k : "{$k}={$v}") . '; ';
102
- }
103
- }
104
- }
105
-
106
- return \rtrim($str, '; ');
107
- }
108
-
109
- public function toArray(): array
110
- {
111
- return $this->data;
112
- }
113
-
114
- /**
115
- * Get the cookie name.
116
- *
117
- * @return string
118
- */
119
- public function getName()
120
- {
121
- return $this->data['Name'];
122
- }
123
-
124
- /**
125
- * Set the cookie name.
126
- *
127
- * @param string $name Cookie name
128
- */
129
- public function setName($name): void
130
- {
131
- $this->data['Name'] = $name;
132
- }
133
-
134
- /**
135
- * Get the cookie value.
136
- *
137
- * @return string|null
138
- */
139
- public function getValue()
140
- {
141
- return $this->data['Value'];
142
- }
143
-
144
- /**
145
- * Set the cookie value.
146
- *
147
- * @param string $value Cookie value
148
- */
149
- public function setValue($value): void
150
- {
151
- $this->data['Value'] = $value;
152
- }
153
-
154
- /**
155
- * Get the domain.
156
- *
157
- * @return string|null
158
- */
159
- public function getDomain()
160
- {
161
- return $this->data['Domain'];
162
- }
163
-
164
- /**
165
- * Set the domain of the cookie.
166
- *
167
- * @param string $domain
168
- */
169
- public function setDomain($domain): void
170
- {
171
- $this->data['Domain'] = $domain;
172
- }
173
-
174
- /**
175
- * Get the path.
176
- *
177
- * @return string
178
- */
179
- public function getPath()
180
- {
181
- return $this->data['Path'];
182
- }
183
-
184
- /**
185
- * Set the path of the cookie.
186
- *
187
- * @param string $path Path of the cookie
188
- */
189
- public function setPath($path): void
190
- {
191
- $this->data['Path'] = $path;
192
- }
193
-
194
- /**
195
- * Maximum lifetime of the cookie in seconds.
196
- *
197
- * @return int|null
198
- */
199
- public function getMaxAge()
200
- {
201
- return $this->data['Max-Age'];
202
- }
203
-
204
- /**
205
- * Set the max-age of the cookie.
206
- *
207
- * @param int $maxAge Max age of the cookie in seconds
208
- */
209
- public function setMaxAge($maxAge): void
210
- {
211
- $this->data['Max-Age'] = $maxAge;
212
- }
213
-
214
- /**
215
- * The UNIX timestamp when the cookie Expires.
216
- *
217
- * @return string|int|null
218
- */
219
- public function getExpires()
220
- {
221
- return $this->data['Expires'];
222
- }
223
-
224
- /**
225
- * Set the unix timestamp for which the cookie will expire.
226
- *
227
- * @param int|string $timestamp Unix timestamp or any English textual datetime description.
228
- */
229
- public function setExpires($timestamp): void
230
- {
231
- $this->data['Expires'] = \is_numeric($timestamp)
232
- ? (int) $timestamp
233
- : \strtotime($timestamp);
234
- }
235
-
236
- /**
237
- * Get whether or not this is a secure cookie.
238
- *
239
- * @return bool|null
240
- */
241
- public function getSecure()
242
- {
243
- return $this->data['Secure'];
244
- }
245
-
246
- /**
247
- * Set whether or not the cookie is secure.
248
- *
249
- * @param bool $secure Set to true or false if secure
250
- */
251
- public function setSecure($secure): void
252
- {
253
- $this->data['Secure'] = $secure;
254
- }
255
-
256
- /**
257
- * Get whether or not this is a session cookie.
258
- *
259
- * @return bool|null
260
- */
261
- public function getDiscard()
262
- {
263
- return $this->data['Discard'];
264
- }
265
-
266
- /**
267
- * Set whether or not this is a session cookie.
268
- *
269
- * @param bool $discard Set to true or false if this is a session cookie
270
- */
271
- public function setDiscard($discard): void
272
- {
273
- $this->data['Discard'] = $discard;
274
- }
275
-
276
- /**
277
- * Get whether or not this is an HTTP only cookie.
278
- *
279
- * @return bool
280
- */
281
- public function getHttpOnly()
282
- {
283
- return $this->data['HttpOnly'];
284
- }
285
-
286
- /**
287
- * Set whether or not this is an HTTP only cookie.
288
- *
289
- * @param bool $httpOnly Set to true or false if this is HTTP only
290
- */
291
- public function setHttpOnly($httpOnly): void
292
- {
293
- $this->data['HttpOnly'] = $httpOnly;
294
- }
295
-
296
- /**
297
- * Check if the cookie matches a path value.
298
- *
299
- * A request-path path-matches a given cookie-path if at least one of
300
- * the following conditions holds:
301
- *
302
- * - The cookie-path and the request-path are identical.
303
- * - The cookie-path is a prefix of the request-path, and the last
304
- * character of the cookie-path is %x2F ("/").
305
- * - The cookie-path is a prefix of the request-path, and the first
306
- * character of the request-path that is not included in the cookie-
307
- * path is a %x2F ("/") character.
308
- *
309
- * @param string $requestPath Path to check against
310
- */
311
- public function matchesPath(string $requestPath): bool
312
- {
313
- $cookiePath = $this->getPath();
314
-
315
- // Match on exact matches or when path is the default empty "/"
316
- if ($cookiePath === '/' || $cookiePath == $requestPath) {
317
- return true;
318
- }
319
-
320
- // Ensure that the cookie-path is a prefix of the request path.
321
- if (0 !== \strpos($requestPath, $cookiePath)) {
322
- return false;
323
- }
324
-
325
- // Match if the last character of the cookie-path is "/"
326
- if (\substr($cookiePath, -1, 1) === '/') {
327
- return true;
328
- }
329
-
330
- // Match if the first character not included in cookie path is "/"
331
- return \substr($requestPath, \strlen($cookiePath), 1) === '/';
332
- }
333
-
334
- /**
335
- * Check if the cookie matches a domain value.
336
- *
337
- * @param string $domain Domain to check against
338
- */
339
- public function matchesDomain(string $domain): bool
340
- {
341
- $cookieDomain = $this->getDomain();
342
- if (null === $cookieDomain) {
343
- return true;
344
- }
345
-
346
- // Remove the leading '.' as per spec in RFC 6265.
347
- // https://tools.ietf.org/html/rfc6265#section-5.2.3
348
- $cookieDomain = \ltrim($cookieDomain, '.');
349
-
350
- // Domain not set or exact match.
351
- if (!$cookieDomain || !\strcasecmp($domain, $cookieDomain)) {
352
- return true;
353
- }
354
-
355
- // Matching the subdomain according to RFC 6265.
356
- // https://tools.ietf.org/html/rfc6265#section-5.1.3
357
- if (\filter_var($domain, \FILTER_VALIDATE_IP)) {
358
- return false;
359
- }
360
-
361
- return (bool) \preg_match('/\.' . \preg_quote($cookieDomain, '/') . '$/', $domain);
362
- }
363
-
364
- /**
365
- * Check if the cookie is expired.
366
- */
367
- public function isExpired(): bool
368
- {
369
- return $this->getExpires() !== null && \time() > $this->getExpires();
370
- }
371
-
372
- /**
373
- * Check if the cookie is valid according to RFC 6265.
374
- *
375
- * @return bool|string Returns true if valid or an error message if invalid
376
- */
377
- public function validate()
378
- {
379
- $name = $this->getName();
380
- if ($name === '') {
381
- return 'The cookie name must not be empty';
382
- }
383
-
384
- // Check if any of the invalid characters are present in the cookie name
385
- if (\preg_match(
386
- '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/',
387
- $name
388
- )) {
389
- return 'Cookie name must not contain invalid characters: ASCII '
390
- . 'Control characters (0-31;127), space, tab and the '
391
- . 'following characters: ()<>@,;:\"/?={}';
392
- }
393
-
394
- // Value must not be null. 0 and empty string are valid. Empty strings
395
- // are technically against RFC 6265, but known to happen in the wild.
396
- $value = $this->getValue();
397
- if ($value === null) {
398
- return 'The cookie value must not be empty';
399
- }
400
-
401
- // Domains must not be empty, but can be 0. "0" is not a valid internet
402
- // domain, but may be used as server name in a private network.
403
- $domain = $this->getDomain();
404
- if ($domain === null || $domain === '') {
405
- return 'The cookie domain must not be empty';
406
- }
407
-
408
- return true;
409
- }
410
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php DELETED
@@ -1,39 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Exception;
4
-
5
- use Psr\Http\Message\RequestInterface;
6
- use Psr\Http\Message\ResponseInterface;
7
-
8
- /**
9
- * Exception when an HTTP error occurs (4xx or 5xx error)
10
- */
11
- class BadResponseException extends RequestException
12
- {
13
- public function __construct(
14
- string $message,
15
- RequestInterface $request,
16
- ResponseInterface $response,
17
- \Throwable $previous = null,
18
- array $handlerContext = []
19
- ) {
20
- parent::__construct($message, $request, $response, $previous, $handlerContext);
21
- }
22
-
23
- /**
24
- * Current exception and the ones that extend it will always have a response.
25
- */
26
- public function hasResponse(): bool
27
- {
28
- return true;
29
- }
30
-
31
- /**
32
- * This function narrows the return type from the parent class and does not allow it to be nullable.
33
- */
34
- public function getResponse(): ResponseInterface
35
- {
36
- /** @var ResponseInterface */
37
- return parent::getResponse();
38
- }
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Exception/ClientException.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Exception;
4
-
5
- /**
6
- * Exception when a client error is encountered (4xx codes)
7
- */
8
- class ClientException extends BadResponseException
9
- {
10
- }
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Exception;
4
-
5
- use Psr\Http\Client\NetworkExceptionInterface;
6
- use Psr\Http\Message\RequestInterface;
7
-
8
- /**
9
- * Exception thrown when a connection cannot be established.
10
- *
11
- * Note that no response is present for a ConnectException
12
- */
13
- class ConnectException extends TransferException implements NetworkExceptionInterface
14
- {
15
- /**
16
- * @var RequestInterface
17
- */
18
- private $request;
19
-
20
- /**
21
- * @var array
22
- */
23
- private $handlerContext;
24
-
25
- public function __construct(
26
- string $message,
27
- RequestInterface $request,
28
- \Throwable $previous = null,
29
- array $handlerContext = []
30
- ) {
31
- parent::__construct($message, 0, $previous);
32
- $this->request = $request;
33
- $this->handlerContext = $handlerContext;
34
- }
35
-
36
- /**
37
- * Get the request that caused the exception
38
- */
39
- public function getRequest(): RequestInterface
40
- {
41
- return $this->request;
42
- }
43
-
44
- /**
45
- * Get contextual information about the error from the underlying handler.
46
- *
47
- * The contents of this array will vary depending on which handler you are
48
- * using. It may also be just an empty array. Relying on this data will
49
- * couple you to a specific handler, but can give more debug information
50
- * when needed.
51
- */
52
- public function getHandlerContext(): array
53
- {
54
- return $this->handlerContext;
55
- }
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Exception;
4
-
5
- use Psr\Http\Client\ClientExceptionInterface;
6
-
7
- interface GuzzleException extends ClientExceptionInterface
8
- {
9
- }
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Exception;
4
-
5
- final class InvalidArgumentException extends \InvalidArgumentException implements GuzzleException
6
- {
7
- }
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Exception/RequestException.php DELETED
@@ -1,164 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Exception;
4
-
5
- use Psr\Http\Client\RequestExceptionInterface;
6
- use Psr\Http\Message\RequestInterface;
7
- use Psr\Http\Message\ResponseInterface;
8
- use Psr\Http\Message\UriInterface;
9
-
10
- /**
11
- * HTTP Request exception
12
- */
13
- class RequestException extends TransferException implements RequestExceptionInterface
14
- {
15
- /**
16
- * @var RequestInterface
17
- */
18
- private $request;
19
-
20
- /**
21
- * @var ResponseInterface|null
22
- */
23
- private $response;
24
-
25
- /**
26
- * @var array
27
- */
28
- private $handlerContext;
29
-
30
- public function __construct(
31
- string $message,
32
- RequestInterface $request,
33
- ResponseInterface $response = null,
34
- \Throwable $previous = null,
35
- array $handlerContext = []
36
- ) {
37
- // Set the code of the exception if the response is set and not future.
38
- $code = $response ? $response->getStatusCode() : 0;
39
- parent::__construct($message, $code, $previous);
40
- $this->request = $request;
41
- $this->response = $response;
42
- $this->handlerContext = $handlerContext;
43
- }
44
-
45
- /**
46
- * Wrap non-RequestExceptions with a RequestException
47
- */
48
- public static function wrapException(RequestInterface $request, \Throwable $e): RequestException
49
- {
50
- return $e instanceof RequestException
51
- ? $e
52
- : new RequestException($e->getMessage(), $request, null, $e);
53
- }
54
-
55
- /**
56
- * Factory method to create a new exception with a normalized error message
57
- *
58
- * @param RequestInterface $request Request
59
- * @param ResponseInterface $response Response received
60
- * @param \Throwable $previous Previous exception
61
- * @param array $ctx Optional handler context.
62
- */
63
- public static function create(
64
- RequestInterface $request,
65
- ResponseInterface $response = null,
66
- \Throwable $previous = null,
67
- array $ctx = []
68
- ): self {
69
- if (!$response) {
70
- return new self(
71
- 'Error completing request',
72
- $request,
73
- null,
74
- $previous,
75
- $ctx
76
- );
77
- }
78
-
79
- $level = (int) \floor($response->getStatusCode() / 100);
80
- if ($level === 4) {
81
- $label = 'Client error';
82
- $className = ClientException::class;
83
- } elseif ($level === 5) {
84
- $label = 'Server error';
85
- $className = ServerException::class;
86
- } else {
87
- $label = 'Unsuccessful request';
88
- $className = __CLASS__;
89
- }
90
-
91
- $uri = $request->getUri();
92
- $uri = static::obfuscateUri($uri);
93
-
94
- // Client Error: `GET /` resulted in a `404 Not Found` response:
95
- // <html> ... (truncated)
96
- $message = \sprintf(
97
- '%s: `%s %s` resulted in a `%s %s` response',
98
- $label,
99
- $request->getMethod(),
100
- $uri,
101
- $response->getStatusCode(),
102
- $response->getReasonPhrase()
103
- );
104
-
105
- $summary = \GuzzleHttp\Psr7\get_message_body_summary($response);
106
-
107
- if ($summary !== null) {
108
- $message .= ":\n{$summary}\n";
109
- }
110
-
111
- return new $className($message, $request, $response, $previous, $ctx);
112
- }
113
-
114
- /**
115
- * Obfuscates URI if there is a username and a password present
116
- */
117
- private static function obfuscateUri(UriInterface $uri): UriInterface
118
- {
119
- $userInfo = $uri->getUserInfo();
120
-
121
- if (false !== ($pos = \strpos($userInfo, ':'))) {
122
- return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***');
123
- }
124
-
125
- return $uri;
126
- }
127
-
128
- /**
129
- * Get the request that caused the exception
130
- */
131
- public function getRequest(): RequestInterface
132
- {
133
- return $this->request;
134
- }
135
-
136
- /**
137
- * Get the associated response
138
- */
139
- public function getResponse(): ?ResponseInterface
140
- {
141
- return $this->response;
142
- }
143
-
144
- /**
145
- * Check if a response was received
146
- */
147
- public function hasResponse(): bool
148
- {
149
- return $this->response !== null;
150
- }
151
-
152
- /**
153
- * Get contextual information about the error from the underlying handler.
154
- *
155
- * The contents of this array will vary depending on which handler you are
156
- * using. It may also be just an empty array. Relying on this data will
157
- * couple you to a specific handler, but can give more debug information
158
- * when needed.
159
- */
160
- public function getHandlerContext(): array
161
- {
162
- return $this->handlerContext;
163
- }
164
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Exception/ServerException.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Exception;
4
-
5
- /**
6
- * Exception when a server error is encountered (5xx codes)
7
- */
8
- class ServerException extends BadResponseException
9
- {
10
- }
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Exception;
4
-
5
- class TooManyRedirectsException extends RequestException
6
- {
7
- }
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Exception/TransferException.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Exception;
4
-
5
- class TransferException extends \RuntimeException implements GuzzleException
6
- {
7
- }
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php DELETED
@@ -1,604 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Handler;
4
-
5
- use GuzzleHttp\Exception\ConnectException;
6
- use GuzzleHttp\Exception\RequestException;
7
- use GuzzleHttp\Promise\FulfilledPromise;
8
- use GuzzleHttp\Promise\PromiseInterface;
9
- use GuzzleHttp\Psr7;
10
- use GuzzleHttp\Psr7\LazyOpenStream;
11
- use GuzzleHttp\TransferStats;
12
- use GuzzleHttp\Utils;
13
- use Psr\Http\Message\RequestInterface;
14
-
15
- /**
16
- * Creates curl resources from a request
17
- *
18
- * @final
19
- */
20
- class CurlFactory implements CurlFactoryInterface
21
- {
22
- public const CURL_VERSION_STR = 'curl_version';
23
-
24
- /**
25
- * @deprecated
26
- */
27
- public const LOW_CURL_VERSION_NUMBER = '7.21.2';
28
-
29
- /**
30
- * @var resource[]
31
- */
32
- private $handles = [];
33
-
34
- /**
35
- * @var int Total number of idle handles to keep in cache
36
- */
37
- private $maxHandles;
38
-
39
- /**
40
- * @param int $maxHandles Maximum number of idle handles.
41
- */
42
- public function __construct(int $maxHandles)
43
- {
44
- $this->maxHandles = $maxHandles;
45
- }
46
-
47
- public function create(RequestInterface $request, array $options): EasyHandle
48
- {
49
- if (isset($options['curl']['body_as_string'])) {
50
- $options['_body_as_string'] = $options['curl']['body_as_string'];
51
- unset($options['curl']['body_as_string']);
52
- }
53
-
54
- $easy = new EasyHandle;
55
- $easy->request = $request;
56
- $easy->options = $options;
57
- $conf = $this->getDefaultConf($easy);
58
- $this->applyMethod($easy, $conf);
59
- $this->applyHandlerOptions($easy, $conf);
60
- $this->applyHeaders($easy, $conf);
61
- unset($conf['_headers']);
62
-
63
- // Add handler options from the request configuration options
64
- if (isset($options['curl'])) {
65
- $conf = \array_replace($conf, $options['curl']);
66
- }
67
-
68
- $conf[\CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy);
69
- $easy->handle = $this->handles
70
- ? \array_pop($this->handles)
71
- : \curl_init();
72
- curl_setopt_array($easy->handle, $conf);
73
-
74
- return $easy;
75
- }
76
-
77
- public function release(EasyHandle $easy): void
78
- {
79
- $resource = $easy->handle;
80
- unset($easy->handle);
81
-
82
- if (\count($this->handles) >= $this->maxHandles) {
83
- \curl_close($resource);
84
- } else {
85
- // Remove all callback functions as they can hold onto references
86
- // and are not cleaned up by curl_reset. Using curl_setopt_array
87
- // does not work for some reason, so removing each one
88
- // individually.
89
- \curl_setopt($resource, \CURLOPT_HEADERFUNCTION, null);
90
- \curl_setopt($resource, \CURLOPT_READFUNCTION, null);
91
- \curl_setopt($resource, \CURLOPT_WRITEFUNCTION, null);
92
- \curl_setopt($resource, \CURLOPT_PROGRESSFUNCTION, null);
93
- \curl_reset($resource);
94
- $this->handles[] = $resource;
95
- }
96
- }
97
-
98
- /**
99
- * Completes a cURL transaction, either returning a response promise or a
100
- * rejected promise.
101
- *
102
- * @param callable(RequestInterface, array): PromiseInterface $handler
103
- * @param CurlFactoryInterface $factory Dictates how the handle is released
104
- */
105
- public static function finish(
106
- callable $handler,
107
- EasyHandle $easy,
108
- CurlFactoryInterface $factory
109
- ): PromiseInterface {
110
- if (isset($easy->options['on_stats'])) {
111
- self::invokeStats($easy);
112
- }
113
-
114
- if (!$easy->response || $easy->errno) {
115
- return self::finishError($handler, $easy, $factory);
116
- }
117
-
118
- // Return the response if it is present and there is no error.
119
- $factory->release($easy);
120
-
121
- // Rewind the body of the response if possible.
122
- $body = $easy->response->getBody();
123
- if ($body->isSeekable()) {
124
- $body->rewind();
125
- }
126
-
127
- return new FulfilledPromise($easy->response);
128
- }
129
-
130
- private static function invokeStats(EasyHandle $easy): void
131
- {
132
- $curlStats = \curl_getinfo($easy->handle);
133
- $curlStats['appconnect_time'] = \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME);
134
- $stats = new TransferStats(
135
- $easy->request,
136
- $easy->response,
137
- $curlStats['total_time'],
138
- $easy->errno,
139
- $curlStats
140
- );
141
- ($easy->options['on_stats'])($stats);
142
- }
143
-
144
- /**
145
- * @param callable(RequestInterface, array): PromiseInterface $handler
146
- */
147
- private static function finishError(
148
- callable $handler,
149
- EasyHandle $easy,
150
- CurlFactoryInterface $factory
151
- ): PromiseInterface {
152
- // Get error information and release the handle to the factory.
153
- $ctx = [
154
- 'errno' => $easy->errno,
155
- 'error' => \curl_error($easy->handle),
156
- 'appconnect_time' => \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME),
157
- ] + \curl_getinfo($easy->handle);
158
- $ctx[self::CURL_VERSION_STR] = \curl_version()['version'];
159
- $factory->release($easy);
160
-
161
- // Retry when nothing is present or when curl failed to rewind.
162
- if (empty($easy->options['_err_message'])
163
- && (!$easy->errno || $easy->errno == 65)
164
- ) {
165
- return self::retryFailedRewind($handler, $easy, $ctx);
166
- }
167
-
168
- return self::createRejection($easy, $ctx);
169
- }
170
-
171
- private static function createRejection(EasyHandle $easy, array $ctx): PromiseInterface
172
- {
173
- static $connectionErrors = [
174
- \CURLE_OPERATION_TIMEOUTED => true,
175
- \CURLE_COULDNT_RESOLVE_HOST => true,
176
- \CURLE_COULDNT_CONNECT => true,
177
- \CURLE_SSL_CONNECT_ERROR => true,
178
- \CURLE_GOT_NOTHING => true,
179
- ];
180
-
181
- // If an exception was encountered during the onHeaders event, then
182
- // return a rejected promise that wraps that exception.
183
- if ($easy->onHeadersException) {
184
- return \GuzzleHttp\Promise\rejection_for(
185
- new RequestException(
186
- 'An error was encountered during the on_headers event',
187
- $easy->request,
188
- $easy->response,
189
- $easy->onHeadersException,
190
- $ctx
191
- )
192
- );
193
- }
194
-
195
- $message = \sprintf(
196
- 'cURL error %s: %s (%s)',
197
- $ctx['errno'],
198
- $ctx['error'],
199
- 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'
200
- );
201
- $uriString = (string) $easy->request->getUri();
202
- if ($uriString !== '' && false === \strpos($ctx['error'], $uriString)) {
203
- $message .= \sprintf(' for %s', $uriString);
204
- }
205
-
206
- // Create a connection exception if it was a specific error code.
207
- $error = isset($connectionErrors[$easy->errno])
208
- ? new ConnectException($message, $easy->request, null, $ctx)
209
- : new RequestException($message, $easy->request, $easy->response, null, $ctx);
210
-
211
- return \GuzzleHttp\Promise\rejection_for($error);
212
- }
213
-
214
- /**
215
- * @return array<int|string, mixed>
216
- */
217
- private function getDefaultConf(EasyHandle $easy): array
218
- {
219
- $conf = [
220
- '_headers' => $easy->request->getHeaders(),
221
- \CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(),
222
- \CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''),
223
- \CURLOPT_RETURNTRANSFER => false,
224
- \CURLOPT_HEADER => false,
225
- \CURLOPT_CONNECTTIMEOUT => 150,
226
- ];
227
-
228
- if (\defined('CURLOPT_PROTOCOLS')) {
229
- $conf[\CURLOPT_PROTOCOLS] = \CURLPROTO_HTTP | \CURLPROTO_HTTPS;
230
- }
231
-
232
- $version = $easy->request->getProtocolVersion();
233
- if ($version == 1.1) {
234
- $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1;
235
- } elseif ($version == 2.0) {
236
- $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0;
237
- } else {
238
- $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0;
239
- }
240
-
241
- return $conf;
242
- }
243
-
244
- private function applyMethod(EasyHandle $easy, array &$conf): void
245
- {
246
- $body = $easy->request->getBody();
247
- $size = $body->getSize();
248
-
249
- if ($size === null || $size > 0) {
250
- $this->applyBody($easy->request, $easy->options, $conf);
251
- return;
252
- }
253
-
254
- $method = $easy->request->getMethod();
255
- if ($method === 'PUT' || $method === 'POST') {
256
- // See https://tools.ietf.org/html/rfc7230#section-3.3.2
257
- if (!$easy->request->hasHeader('Content-Length')) {
258
- $conf[\CURLOPT_HTTPHEADER][] = 'Content-Length: 0';
259
- }
260
- } elseif ($method === 'HEAD') {
261
- $conf[\CURLOPT_NOBODY] = true;
262
- unset(
263
- $conf[\CURLOPT_WRITEFUNCTION],
264
- $conf[\CURLOPT_READFUNCTION],
265
- $conf[\CURLOPT_FILE],
266
- $conf[\CURLOPT_INFILE]
267
- );
268
- }
269
- }
270
-
271
- private function applyBody(RequestInterface $request, array $options, array &$conf): void
272
- {
273
- $size = $request->hasHeader('Content-Length')
274
- ? (int) $request->getHeaderLine('Content-Length')
275
- : null;
276
-
277
- // Send the body as a string if the size is less than 1MB OR if the
278
- // [curl][body_as_string] request value is set.
279
- if (($size !== null && $size < 1000000) ||
280
- !empty($options['_body_as_string'])
281
- ) {
282
- $conf[\CURLOPT_POSTFIELDS] = (string) $request->getBody();
283
- // Don't duplicate the Content-Length header
284
- $this->removeHeader('Content-Length', $conf);
285
- $this->removeHeader('Transfer-Encoding', $conf);
286
- } else {
287
- $conf[\CURLOPT_UPLOAD] = true;
288
- if ($size !== null) {
289
- $conf[\CURLOPT_INFILESIZE] = $size;
290
- $this->removeHeader('Content-Length', $conf);
291
- }
292
- $body = $request->getBody();
293
- if ($body->isSeekable()) {
294
- $body->rewind();
295
- }
296
- $conf[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body) {
297
- return $body->read($length);
298
- };
299
- }
300
-
301
- // If the Expect header is not present, prevent curl from adding it
302
- if (!$request->hasHeader('Expect')) {
303
- $conf[\CURLOPT_HTTPHEADER][] = 'Expect:';
304
- }
305
-
306
- // cURL sometimes adds a content-type by default. Prevent this.
307
- if (!$request->hasHeader('Content-Type')) {
308
- $conf[\CURLOPT_HTTPHEADER][] = 'Content-Type:';
309
- }
310
- }
311
-
312
- private function applyHeaders(EasyHandle $easy, array &$conf): void
313
- {
314
- foreach ($conf['_headers'] as $name => $values) {
315
- foreach ($values as $value) {
316
- $value = (string) $value;
317
- if ($value === '') {
318
- // cURL requires a special format for empty headers.
319
- // See https://github.com/guzzle/guzzle/issues/1882 for more details.
320
- $conf[\CURLOPT_HTTPHEADER][] = "$name;";
321
- } else {
322
- $conf[\CURLOPT_HTTPHEADER][] = "$name: $value";
323
- }
324
- }
325
- }
326
-
327
- // Remove the Accept header if one was not set
328
- if (!$easy->request->hasHeader('Accept')) {
329
- $conf[\CURLOPT_HTTPHEADER][] = 'Accept:';
330
- }
331
- }
332
-
333
- /**
334
- * Remove a header from the options array.
335
- *
336
- * @param string $name Case-insensitive header to remove
337
- * @param array $options Array of options to modify
338
- */
339
- private function removeHeader(string $name, array &$options): void
340
- {
341
- foreach (\array_keys($options['_headers']) as $key) {
342
- if (!\strcasecmp($key, $name)) {
343
- unset($options['_headers'][$key]);
344
- return;
345
- }
346
- }
347
- }
348
-
349
- private function applyHandlerOptions(EasyHandle $easy, array &$conf): void
350
- {
351
- $options = $easy->options;
352
- if (isset($options['verify'])) {
353
- if ($options['verify'] === false) {
354
- unset($conf[\CURLOPT_CAINFO]);
355
- $conf[\CURLOPT_SSL_VERIFYHOST] = 0;
356
- $conf[\CURLOPT_SSL_VERIFYPEER] = false;
357
- } else {
358
- $conf[\CURLOPT_SSL_VERIFYHOST] = 2;
359
- $conf[\CURLOPT_SSL_VERIFYPEER] = true;
360
- if (\is_string($options['verify'])) {
361
- // Throw an error if the file/folder/link path is not valid or doesn't exist.
362
- if (!\file_exists($options['verify'])) {
363
- throw new \InvalidArgumentException(
364
- "SSL CA bundle not found: {$options['verify']}"
365
- );
366
- }
367
- // If it's a directory or a link to a directory use CURLOPT_CAPATH.
368
- // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO.
369
- if (
370
- \is_dir($options['verify']) ||
371
- (
372
- \is_link($options['verify']) === true &&
373
- ($verifyLink = \readlink($options['verify'])) !== false &&
374
- \is_dir($verifyLink)
375
- )
376
- ) {
377
- $conf[\CURLOPT_CAPATH] = $options['verify'];
378
- } else {
379
- $conf[\CURLOPT_CAINFO] = $options['verify'];
380
- }
381
- }
382
- }
383
- }
384
-
385
- if (!empty($options['decode_content'])) {
386
- $accept = $easy->request->getHeaderLine('Accept-Encoding');
387
- if ($accept) {
388
- $conf[\CURLOPT_ENCODING] = $accept;
389
- } else {
390
- $conf[\CURLOPT_ENCODING] = '';
391
- // Don't let curl send the header over the wire
392
- $conf[\CURLOPT_HTTPHEADER][] = 'Accept-Encoding:';
393
- }
394
- }
395
-
396
- if (isset($options['sink'])) {
397
- $sink = $options['sink'];
398
- if (!\is_string($sink)) {
399
- $sink = \GuzzleHttp\Psr7\stream_for($sink);
400
- } elseif (!\is_dir(\dirname($sink))) {
401
- // Ensure that the directory exists before failing in curl.
402
- throw new \RuntimeException(\sprintf(
403
- 'Directory %s does not exist for sink value of %s',
404
- \dirname($sink),
405
- $sink
406
- ));
407
- } else {
408
- $sink = new LazyOpenStream($sink, 'w+');
409
- }
410
- $easy->sink = $sink;
411
- $conf[\CURLOPT_WRITEFUNCTION] = static function ($ch, $write) use ($sink): int {
412
- return $sink->write($write);
413
- };
414
- } else {
415
- // Use a default temp stream if no sink was set.
416
- $conf[\CURLOPT_FILE] = \fopen('php://temp', 'w+');
417
- $easy->sink = Psr7\stream_for($conf[\CURLOPT_FILE]);
418
- }
419
- $timeoutRequiresNoSignal = false;
420
- if (isset($options['timeout'])) {
421
- $timeoutRequiresNoSignal |= $options['timeout'] < 1;
422
- $conf[\CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000;
423
- }
424
-
425
- // CURL default value is CURL_IPRESOLVE_WHATEVER
426
- if (isset($options['force_ip_resolve'])) {
427
- if ('v4' === $options['force_ip_resolve']) {
428
- $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4;
429
- } elseif ('v6' === $options['force_ip_resolve']) {
430
- $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V6;
431
- }
432
- }
433
-
434
- if (isset($options['connect_timeout'])) {
435
- $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1;
436
- $conf[\CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000;
437
- }
438
-
439
- if ($timeoutRequiresNoSignal && \strtoupper(\substr(\PHP_OS, 0, 3)) !== 'WIN') {
440
- $conf[\CURLOPT_NOSIGNAL] = true;
441
- }
442
-
443
- if (isset($options['proxy'])) {
444
- if (!\is_array($options['proxy'])) {
445
- $conf[\CURLOPT_PROXY] = $options['proxy'];
446
- } else {
447
- $scheme = $easy->request->getUri()->getScheme();
448
- if (isset($options['proxy'][$scheme])) {
449
- $host = $easy->request->getUri()->getHost();
450
- if (!isset($options['proxy']['no']) ||
451
- !Utils::isHostInNoProxy($host, $options['proxy']['no'])
452
- ) {
453
- $conf[\CURLOPT_PROXY] = $options['proxy'][$scheme];
454
- }
455
- }
456
- }
457
- }
458
-
459
- if (isset($options['cert'])) {
460
- $cert = $options['cert'];
461
- if (\is_array($cert)) {
462
- $conf[\CURLOPT_SSLCERTPASSWD] = $cert[1];
463
- $cert = $cert[0];
464
- }
465
- if (!\file_exists($cert)) {
466
- throw new \InvalidArgumentException(
467
- "SSL certificate not found: {$cert}"
468
- );
469
- }
470
- $conf[\CURLOPT_SSLCERT] = $cert;
471
- }
472
-
473
- if (isset($options['ssl_key'])) {
474
- if (\is_array($options['ssl_key'])) {
475
- if (\count($options['ssl_key']) === 2) {
476
- [$sslKey, $conf[\CURLOPT_SSLKEYPASSWD]] = $options['ssl_key'];
477
- } else {
478
- [$sslKey] = $options['ssl_key'];
479
- }
480
- }
481
-
482
- $sslKey = $sslKey ?? $options['ssl_key'];
483
-
484
- if (!\file_exists($sslKey)) {
485
- throw new \InvalidArgumentException(
486
- "SSL private key not found: {$sslKey}"
487
- );
488
- }
489
- $conf[\CURLOPT_SSLKEY] = $sslKey;
490
- }
491
-
492
- if (isset($options['progress'])) {
493
- $progress = $options['progress'];
494
- if (!\is_callable($progress)) {
495
- throw new \InvalidArgumentException(
496
- 'progress client option must be callable'
497
- );
498
- }
499
- $conf[\CURLOPT_NOPROGRESS] = false;
500
- $conf[\CURLOPT_PROGRESSFUNCTION] = static function () use ($progress) {
501
- $args = \func_get_args();
502
- // PHP 5.5 pushed the handle onto the start of the args
503
- if (\is_resource($args[0])) {
504
- \array_shift($args);
505
- }
506
- \call_user_func_array($progress, $args);
507
- };
508
- }
509
-
510
- if (!empty($options['debug'])) {
511
- $conf[\CURLOPT_STDERR] = Utils::debugResource($options['debug']);
512
- $conf[\CURLOPT_VERBOSE] = true;
513
- }
514
- }
515
-
516
- /**
517
- * This function ensures that a response was set on a transaction. If one
518
- * was not set, then the request is retried if possible. This error
519
- * typically means you are sending a payload, curl encountered a
520
- * "Connection died, retrying a fresh connect" error, tried to rewind the
521
- * stream, and then encountered a "necessary data rewind wasn't possible"
522
- * error, causing the request to be sent through curl_multi_info_read()
523
- * without an error status.
524
- *
525
- * @param callable(RequestInterface, array): PromiseInterface $handler
526
- */
527
- private static function retryFailedRewind(
528
- callable $handler,
529
- EasyHandle $easy,
530
- array $ctx
531
- ): PromiseInterface {
532
- try {
533
- // Only rewind if the body has been read from.
534
- $body = $easy->request->getBody();
535
- if ($body->tell() > 0) {
536
- $body->rewind();
537
- }
538
- } catch (\RuntimeException $e) {
539
- $ctx['error'] = 'The connection unexpectedly failed without '
540
- . 'providing an error. The request would have been retried, '
541
- . 'but attempting to rewind the request body failed. '
542
- . 'Exception: ' . $e;
543
- return self::createRejection($easy, $ctx);
544
- }
545
-
546
- // Retry no more than 3 times before giving up.
547
- if (!isset($easy->options['_curl_retries'])) {
548
- $easy->options['_curl_retries'] = 1;
549
- } elseif ($easy->options['_curl_retries'] == 2) {
550
- $ctx['error'] = 'The cURL request was retried 3 times '
551
- . 'and did not succeed. The most likely reason for the failure '
552
- . 'is that cURL was unable to rewind the body of the request '
553
- . 'and subsequent retries resulted in the same error. Turn on '
554
- . 'the debug option to see what went wrong. See '
555
- . 'https://bugs.php.net/bug.php?id=47204 for more information.';
556
- return self::createRejection($easy, $ctx);
557
- } else {
558
- $easy->options['_curl_retries']++;
559
- }
560
-
561
- return $handler($easy->request, $easy->options);
562
- }
563
-
564
- private function createHeaderFn(EasyHandle $easy): callable
565
- {
566
- if (isset($easy->options['on_headers'])) {
567
- $onHeaders = $easy->options['on_headers'];
568
-
569
- if (!\is_callable($onHeaders)) {
570
- throw new \InvalidArgumentException('on_headers must be callable');
571
- }
572
- } else {
573
- $onHeaders = null;
574
- }
575
-
576
- return static function ($ch, $h) use (
577
- $onHeaders,
578
- $easy,
579
- &$startingResponse
580
- ) {
581
- $value = \trim($h);
582
- if ($value === '') {
583
- $startingResponse = true;
584
- $easy->createResponse();
585
- if ($onHeaders !== null) {
586
- try {
587
- $onHeaders($easy->response);
588
- } catch (\Exception $e) {
589
- // Associate the exception with the handle and trigger
590
- // a curl header write error by returning 0.
591
- $easy->onHeadersException = $e;
592
- return -1;
593
- }
594
- }
595
- } elseif ($startingResponse) {
596
- $startingResponse = false;
597
- $easy->headers = [$value];
598
- } else {
599
- $easy->headers[] = $value;
600
- }
601
- return \strlen($h);
602
- };
603
- }
604
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Handler;
4
-
5
- use Psr\Http\Message\RequestInterface;
6
-
7
- interface CurlFactoryInterface
8
- {
9
- /**
10
- * Creates a cURL handle resource.
11
- *
12
- * @param RequestInterface $request Request
13
- * @param array $options Transfer options
14
- *
15
- * @throws \RuntimeException when an option cannot be applied
16
- */
17
- public function create(RequestInterface $request, array $options): EasyHandle;
18
-
19
- /**
20
- * Release an easy handle, allowing it to be reused or closed.
21
- *
22
- * This function must call unset on the easy handle's "handle" property.
23
- */
24
- public function release(EasyHandle $easy): void;
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Handler;
4
-
5
- use GuzzleHttp\Promise\PromiseInterface;
6
- use Psr\Http\Message\RequestInterface;
7
-
8
- /**
9
- * HTTP handler that uses cURL easy handles as a transport layer.
10
- *
11
- * When using the CurlHandler, custom curl options can be specified as an
12
- * associative array of curl option constants mapping to values in the
13
- * **curl** key of the "client" key of the request.
14
- *
15
- * @final
16
- */
17
- class CurlHandler
18
- {
19
- /**
20
- * @var CurlFactoryInterface
21
- */
22
- private $factory;
23
-
24
- /**
25
- * Accepts an associative array of options:
26
- *
27
- * - factory: Optional curl factory used to create cURL handles.
28
- *
29
- * @param array $options Array of options to use with the handler
30
- */
31
- public function __construct(array $options = [])
32
- {
33
- $this->factory = $options['handle_factory']
34
- ?? new CurlFactory(3);
35
- }
36
-
37
- public function __invoke(RequestInterface $request, array $options): PromiseInterface
38
- {
39
- if (isset($options['delay'])) {
40
- \usleep($options['delay'] * 1000);
41
- }
42
-
43
- $easy = $this->factory->create($request, $options);
44
- \curl_exec($easy->handle);
45
- $easy->errno = \curl_errno($easy->handle);
46
-
47
- return CurlFactory::finish($this, $easy, $this->factory);
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php DELETED
@@ -1,258 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Handler;
4
-
5
- use GuzzleHttp\Promise as P;
6
- use GuzzleHttp\Promise\Promise;
7
- use GuzzleHttp\Promise\PromiseInterface;
8
- use GuzzleHttp\Utils;
9
- use Psr\Http\Message\RequestInterface;
10
-
11
- /**
12
- * Returns an asynchronous response using curl_multi_* functions.
13
- *
14
- * When using the CurlMultiHandler, custom curl options can be specified as an
15
- * associative array of curl option constants mapping to values in the
16
- * **curl** key of the provided request options.
17
- *
18
- * @property resource $_mh Internal use only. Lazy loaded multi-handle.
19
- *
20
- * @final
21
- */
22
- class CurlMultiHandler
23
- {
24
- /**
25
- * @var CurlFactoryInterface
26
- */
27
- private $factory;
28
-
29
- /**
30
- * @var int
31
- */
32
- private $selectTimeout;
33
-
34
- /**
35
- * @var resource|null the currently executing resource in `curl_multi_exec`.
36
- */
37
- private $active;
38
-
39
- /**
40
- * @var array Request entry handles, indexed by handle id in `addRequest`.
41
- *
42
- * @see CurlMultiHandler::addRequest
43
- */
44
- private $handles = [];
45
-
46
- /**
47
- * @var array<int, float> An array of delay times, indexed by handle id in `addRequest`.
48
- *
49
- * @see CurlMultiHandler::addRequest
50
- */
51
- private $delays = [];
52
-
53
- /**
54
- * @var array<mixed> An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt()
55
- */
56
- private $options = [];
57
-
58
- /**
59
- * This handler accepts the following options:
60
- *
61
- * - handle_factory: An optional factory used to create curl handles
62
- * - select_timeout: Optional timeout (in seconds) to block before timing
63
- * out while selecting curl handles. Defaults to 1 second.
64
- * - options: An associative array of CURLMOPT_* options and
65
- * corresponding values for curl_multi_setopt()
66
- */
67
- public function __construct(array $options = [])
68
- {
69
- $this->factory = $options['handle_factory'] ?? new CurlFactory(50);
70
-
71
- if (isset($options['select_timeout'])) {
72
- $this->selectTimeout = $options['select_timeout'];
73
- } elseif ($selectTimeout = Utils::getenv('GUZZLE_CURL_SELECT_TIMEOUT')) {
74
- $this->selectTimeout = (int) $selectTimeout;
75
- } else {
76
- $this->selectTimeout = 1;
77
- }
78
-
79
- $this->options = $options['options'] ?? [];
80
- }
81
-
82
- /**
83
- * @param string $name
84
- *
85
- * @return resource
86
- *
87
- * @throws \BadMethodCallException when another field as `_mh` will be gotten
88
- * @throws \RuntimeException when curl can not initialize a multi handle
89
- */
90
- public function __get($name)
91
- {
92
- if ($name !== '_mh') {
93
- throw new \BadMethodCallException("Can not get other property as '_mh'.");
94
- }
95
-
96
- $multiHandle = \curl_multi_init();
97
-
98
- if (false === $multiHandle) {
99
- throw new \RuntimeException('Can not initialize curl multi handle.');
100
- }
101
-
102
- $this->_mh = $multiHandle;
103
-
104
- foreach ($this->options as $option => $value) {
105
- // A warning is raised in case of a wrong option.
106
- curl_multi_setopt($this->_mh, $option, $value);
107
- }
108
-
109
- return $this->_mh;
110
- }
111
-
112
- public function __destruct()
113
- {
114
- if (isset($this->_mh)) {
115
- \curl_multi_close($this->_mh);
116
- unset($this->_mh);
117
- }
118
- }
119
-
120
- public function __invoke(RequestInterface $request, array $options): PromiseInterface
121
- {
122
- $easy = $this->factory->create($request, $options);
123
- $id = (int) $easy->handle;
124
-
125
- $promise = new Promise(
126
- [$this, 'execute'],
127
- function () use ($id) {
128
- return $this->cancel($id);
129
- }
130
- );
131
-
132
- $this->addRequest(['easy' => $easy, 'deferred' => $promise]);
133
-
134
- return $promise;
135
- }
136
-
137
- /**
138
- * Ticks the curl event loop.
139
- */
140
- public function tick(): void
141
- {
142
- // Add any delayed handles if needed.
143
- if ($this->delays) {
144
- $currentTime = Utils::currentTime();
145
- foreach ($this->delays as $id => $delay) {
146
- if ($currentTime >= $delay) {
147
- unset($this->delays[$id]);
148
- \curl_multi_add_handle(
149
- $this->_mh,
150
- $this->handles[$id]['easy']->handle
151
- );
152
- }
153
- }
154
- }
155
-
156
- // Step through the task queue which may add additional requests.
157
- P\queue()->run();
158
-
159
- if ($this->active &&
160
- \curl_multi_select($this->_mh, $this->selectTimeout) === -1
161
- ) {
162
- // Perform a usleep if a select returns -1.
163
- // See: https://bugs.php.net/bug.php?id=61141
164
- \usleep(250);
165
- }
166
-
167
- while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM);
168
-
169
- $this->processMessages();
170
- }
171
-
172
- /**
173
- * Runs until all outstanding connections have completed.
174
- */
175
- public function execute(): void
176
- {
177
- $queue = P\queue();
178
-
179
- while ($this->handles || !$queue->isEmpty()) {
180
- // If there are no transfers, then sleep for the next delay
181
- if (!$this->active && $this->delays) {
182
- \usleep($this->timeToNext());
183
- }
184
- $this->tick();
185
- }
186
- }
187
-
188
- private function addRequest(array $entry): void
189
- {
190
- $easy = $entry['easy'];
191
- $id = (int) $easy->handle;
192
- $this->handles[$id] = $entry;
193
- if (empty($easy->options['delay'])) {
194
- \curl_multi_add_handle($this->_mh, $easy->handle);
195
- } else {
196
- $this->delays[$id] = Utils::currentTime() + ($easy->options['delay'] / 1000);
197
- }
198
- }
199
-
200
- /**
201
- * Cancels a handle from sending and removes references to it.
202
- *
203
- * @param int $id Handle ID to cancel and remove.
204
- *
205
- * @return bool True on success, false on failure.
206
- */
207
- private function cancel($id): bool
208
- {
209
- // Cannot cancel if it has been processed.
210
- if (!isset($this->handles[$id])) {
211
- return false;
212
- }
213
-
214
- $handle = $this->handles[$id]['easy']->handle;
215
- unset($this->delays[$id], $this->handles[$id]);
216
- \curl_multi_remove_handle($this->_mh, $handle);
217
- \curl_close($handle);
218
-
219
- return true;
220
- }
221
-
222
- private function processMessages(): void
223
- {
224
- while ($done = \curl_multi_info_read($this->_mh)) {
225
- $id = (int) $done['handle'];
226
- \curl_multi_remove_handle($this->_mh, $done['handle']);
227
-
228
- if (!isset($this->handles[$id])) {
229
- // Probably was cancelled.
230
- continue;
231
- }
232
-
233
- $entry = $this->handles[$id];
234
- unset($this->handles[$id], $this->delays[$id]);
235
- $entry['easy']->errno = $done['result'];
236
- $entry['deferred']->resolve(
237
- CurlFactory::finish(
238
- $this,
239
- $entry['easy'],
240
- $this->factory
241
- )
242
- );
243
- }
244
- }
245
-
246
- private function timeToNext(): int
247
- {
248
- $currentTime = Utils::currentTime();
249
- $nextTime = \PHP_INT_MAX;
250
- foreach ($this->delays as $time) {
251
- if ($time < $nextTime) {
252
- $nextTime = $time;
253
- }
254
- }
255
-
256
- return ((int) \max(0, $nextTime - $currentTime)) * 1000000;
257
- }
258
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php DELETED
@@ -1,119 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Handler;
4
-
5
- use GuzzleHttp\Psr7\Response;
6
- use GuzzleHttp\Utils;
7
- use Psr\Http\Message\RequestInterface;
8
- use Psr\Http\Message\ResponseInterface;
9
- use Psr\Http\Message\StreamInterface;
10
-
11
- /**
12
- * Represents a cURL easy handle and the data it populates.
13
- *
14
- * @internal
15
- */
16
- final class EasyHandle
17
- {
18
- /**
19
- * @var resource cURL resource
20
- */
21
- public $handle;
22
-
23
- /**
24
- * @var StreamInterface Where data is being written
25
- */
26
- public $sink;
27
-
28
- /**
29
- * @var array Received HTTP headers so far
30
- */
31
- public $headers = [];
32
-
33
- /**
34
- * @var ResponseInterface|null Received response (if any)
35
- */
36
- public $response;
37
-
38
- /**
39
- * @var RequestInterface Request being sent
40
- */
41
- public $request;
42
-
43
- /**
44
- * @var array Request options
45
- */
46
- public $options = [];
47
-
48
- /**
49
- * @var int cURL error number (if any)
50
- */
51
- public $errno = 0;
52
-
53
- /**
54
- * @var \Throwable|null Exception during on_headers (if any)
55
- */
56
- public $onHeadersException;
57
-
58
- /**
59
- * Attach a response to the easy handle based on the received headers.
60
- *
61
- * @throws \RuntimeException if no headers have been received.
62
- */
63
- public function createResponse(): void
64
- {
65
- if (empty($this->headers)) {
66
- throw new \RuntimeException('No headers have been received');
67
- }
68
-
69
- // HTTP-version SP status-code SP reason-phrase
70
- $startLine = \explode(' ', \array_shift($this->headers), 3);
71
- $headers = Utils::headersFromLines($this->headers);
72
- $normalizedKeys = Utils::normalizeHeaderKeys($headers);
73
-
74
- if (!empty($this->options['decode_content'])
75
- && isset($normalizedKeys['content-encoding'])
76
- ) {
77
- $headers['x-encoded-content-encoding']
78
- = $headers[$normalizedKeys['content-encoding']];
79
- unset($headers[$normalizedKeys['content-encoding']]);
80
- if (isset($normalizedKeys['content-length'])) {
81
- $headers['x-encoded-content-length']
82
- = $headers[$normalizedKeys['content-length']];
83
-
84
- $bodyLength = (int) $this->sink->getSize();
85
- if ($bodyLength) {
86
- $headers[$normalizedKeys['content-length']] = $bodyLength;
87
- } else {
88
- unset($headers[$normalizedKeys['content-length']]);
89
- }
90
- }
91
- }
92
-
93
- $statusCode = (int) $startLine[1];
94
-
95
- // Attach a response to the easy handle with the parsed headers.
96
- $this->response = new Response(
97
- $statusCode,
98
- $headers,
99
- $this->sink,
100
- \substr($startLine[0], 5),
101
- isset($startLine[2]) ? (string) $startLine[2] : null
102
- );
103
- }
104
-
105
- /**
106
- * @param string $name
107
- *
108
- * @return void
109
- *
110
- * @throws \BadMethodCallException
111
- */
112
- public function __get($name)
113
- {
114
- $msg = $name === 'handle'
115
- ? 'The EasyHandle has been released'
116
- : 'Invalid property: ' . $name;
117
- throw new \BadMethodCallException($msg);
118
- }
119
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php DELETED
@@ -1,215 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Handler;
4
-
5
- use GuzzleHttp\Exception\RequestException;
6
- use GuzzleHttp\HandlerStack;
7
- use GuzzleHttp\Promise\PromiseInterface;
8
- use GuzzleHttp\TransferStats;
9
- use GuzzleHttp\Utils;
10
- use Psr\Http\Message\RequestInterface;
11
- use Psr\Http\Message\ResponseInterface;
12
- use Psr\Http\Message\StreamInterface;
13
-
14
- /**
15
- * Handler that returns responses or throw exceptions from a queue.
16
- *
17
- * @final
18
- */
19
- class MockHandler implements \Countable
20
- {
21
- /**
22
- * @var array
23
- */
24
- private $queue = [];
25
-
26
- /**
27
- * @var RequestInterface|null
28
- */
29
- private $lastRequest;
30
-
31
- /**
32
- * @var array
33
- */
34
- private $lastOptions = [];
35
-
36
- /**
37
- * @var callable|null
38
- */
39
- private $onFulfilled;
40
-
41
- /**
42
- * @var callable|null
43
- */
44
- private $onRejected;
45
-
46
- /**
47
- * Creates a new MockHandler that uses the default handler stack list of
48
- * middlewares.
49
- *
50
- * @param array|null $queue Array of responses, callables, or exceptions.
51
- * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
52
- * @param callable|null $onRejected Callback to invoke when the return value is rejected.
53
- */
54
- public static function createWithMiddleware(
55
- array $queue = null,
56
- callable $onFulfilled = null,
57
- callable $onRejected = null
58
- ): HandlerStack {
59
- return HandlerStack::create(new self($queue, $onFulfilled, $onRejected));
60
- }
61
-
62
- /**
63
- * The passed in value must be an array of
64
- * {@see \Psr\Http\Message\ResponseInterface} objects, Exceptions,
65
- * callables, or Promises.
66
- *
67
- * @param array<int, mixed>|null $queue The parameters to be passed to the append function, as an indexed array.
68
- * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
69
- * @param callable|null $onRejected Callback to invoke when the return value is rejected.
70
- */
71
- public function __construct(
72
- array $queue = null,
73
- callable $onFulfilled = null,
74
- callable $onRejected = null
75
- ) {
76
- $this->onFulfilled = $onFulfilled;
77
- $this->onRejected = $onRejected;
78
-
79
- if ($queue) {
80
- \call_user_func_array([$this, 'append'], $queue);
81
- }
82
- }
83
-
84
- public function __invoke(RequestInterface $request, array $options): PromiseInterface
85
- {
86
- if (!$this->queue) {
87
- throw new \OutOfBoundsException('Mock queue is empty');
88
- }
89
-
90
- if (isset($options['delay']) && \is_numeric($options['delay'])) {
91
- \usleep((int) $options['delay'] * 1000);
92
- }
93
-
94
- $this->lastRequest = $request;
95
- $this->lastOptions = $options;
96
- $response = \array_shift($this->queue);
97
-
98
- if (isset($options['on_headers'])) {
99
- if (!\is_callable($options['on_headers'])) {
100
- throw new \InvalidArgumentException('on_headers must be callable');
101
- }
102
- try {
103
- $options['on_headers']($response);
104
- } catch (\Exception $e) {
105
- $msg = 'An error was encountered during the on_headers event';
106
- $response = new RequestException($msg, $request, $response, $e);
107
- }
108
- }
109
-
110
- if (\is_callable($response)) {
111
- $response = $response($request, $options);
112
- }
113
-
114
- $response = $response instanceof \Throwable
115
- ? \GuzzleHttp\Promise\rejection_for($response)
116
- : \GuzzleHttp\Promise\promise_for($response);
117
-
118
- return $response->then(
119
- function (?ResponseInterface $value) use ($request, $options) {
120
- $this->invokeStats($request, $options, $value);
121
- if ($this->onFulfilled) {
122
- ($this->onFulfilled)($value);
123
- }
124
-
125
- if ($value !== null && isset($options['sink'])) {
126
- $contents = (string) $value->getBody();
127
- $sink = $options['sink'];
128
-
129
- if (\is_resource($sink)) {
130
- \fwrite($sink, $contents);
131
- } elseif (\is_string($sink)) {
132
- \file_put_contents($sink, $contents);
133
- } elseif ($sink instanceof StreamInterface) {
134
- $sink->write($contents);
135
- }
136
- }
137
-
138
- return $value;
139
- },
140
- function ($reason) use ($request, $options) {
141
- $this->invokeStats($request, $options, null, $reason);
142
- if ($this->onRejected) {
143
- ($this->onRejected)($reason);
144
- }
145
- return \GuzzleHttp\Promise\rejection_for($reason);
146
- }
147
- );
148
- }
149
-
150
- /**
151
- * Adds one or more variadic requests, exceptions, callables, or promises
152
- * to the queue.
153
- *
154
- * @param mixed ...$values
155
- */
156
- public function append(...$values): void
157
- {
158
- foreach ($values as $value) {
159
- if ($value instanceof ResponseInterface
160
- || $value instanceof \Throwable
161
- || $value instanceof PromiseInterface
162
- || \is_callable($value)
163
- ) {
164
- $this->queue[] = $value;
165
- } else {
166
- throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found ' . Utils::describeType($value));
167
- }
168
- }
169
- }
170
-
171
- /**
172
- * Get the last received request.
173
- */
174
- public function getLastRequest(): ?RequestInterface
175
- {
176
- return $this->lastRequest;
177
- }
178
-
179
- /**
180
- * Get the last received request options.
181
- */
182
- public function getLastOptions(): array
183
- {
184
- return $this->lastOptions;
185
- }
186
-
187
- /**
188
- * Returns the number of remaining items in the queue.
189
- */
190
- public function count(): int
191
- {
192
- return \count($this->queue);
193
- }
194
-
195
- public function reset(): void
196
- {
197
- $this->queue = [];
198
- }
199
-
200
- /**
201
- * @param mixed $reason Promise or reason.
202
- */
203
- private function invokeStats(
204
- RequestInterface $request,
205
- array $options,
206
- ResponseInterface $response = null,
207
- $reason = null
208
- ): void {
209
- if (isset($options['on_stats'])) {
210
- $transferTime = $options['transfer_time'] ?? 0;
211
- $stats = new TransferStats($request, $response, $transferTime, $reason);
212
- ($options['on_stats'])($stats);
213
- }
214
- }
215
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Handler/Proxy.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Handler;
4
-
5
- use GuzzleHttp\Promise\PromiseInterface;
6
- use GuzzleHttp\RequestOptions;
7
- use Psr\Http\Message\RequestInterface;
8
-
9
- /**
10
- * Provides basic proxies for handlers.
11
- *
12
- * @final
13
- */
14
- class Proxy
15
- {
16
- /**
17
- * Sends synchronous requests to a specific handler while sending all other
18
- * requests to another handler.
19
- *
20
- * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for normal responses
21
- * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $sync Handler used for synchronous responses.
22
- *
23
- * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
24
- */
25
- public static function wrapSync(
26
- callable $default,
27
- callable $sync
28
- ): callable {
29
- return static function (RequestInterface $request, array $options) use ($default, $sync): PromiseInterface {
30
- return empty($options[RequestOptions::SYNCHRONOUS])
31
- ? $default($request, $options)
32
- : $sync($request, $options);
33
- };
34
- }
35
-
36
- /**
37
- * Sends streaming requests to a streaming compatible handler while sending
38
- * all other requests to a default handler.
39
- *
40
- * This, for example, could be useful for taking advantage of the
41
- * performance benefits of curl while still supporting true streaming
42
- * through the StreamHandler.
43
- *
44
- * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for non-streaming responses
45
- * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $streaming Handler used for streaming responses
46
- *
47
- * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
48
- */
49
- public static function wrapStreaming(
50
- callable $default,
51
- callable $streaming
52
- ): callable {
53
- return static function (RequestInterface $request, array $options) use ($default, $streaming): PromiseInterface {
54
- return empty($options['stream'])
55
- ? $default($request, $options)
56
- : $streaming($request, $options);
57
- };
58
- }
59
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php DELETED
@@ -1,578 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp\Handler;
4
-
5
- use GuzzleHttp\Exception\ConnectException;
6
- use GuzzleHttp\Exception\RequestException;
7
- use GuzzleHttp\Promise\FulfilledPromise;
8
- use GuzzleHttp\Promise\PromiseInterface;
9
- use GuzzleHttp\Psr7;
10
- use GuzzleHttp\TransferStats;
11
- use GuzzleHttp\Utils;
12
- use Psr\Http\Message\RequestInterface;
13
- use Psr\Http\Message\ResponseInterface;
14
- use Psr\Http\Message\StreamInterface;
15
- use Psr\Http\Message\UriInterface;
16
-
17
- /**
18
- * HTTP handler that uses PHP's HTTP stream wrapper.
19
- *
20
- * @final
21
- */
22
- class StreamHandler
23
- {
24
- /**
25
- * @var array
26
- */
27
- private $lastHeaders = [];
28
-
29
- /**
30
- * Sends an HTTP request.
31
- *
32
- * @param RequestInterface $request Request to send.
33
- * @param array $options Request transfer options.
34
- */
35
- public function __invoke(RequestInterface $request, array $options): PromiseInterface
36
- {
37
- // Sleep if there is a delay specified.
38
- if (isset($options['delay'])) {
39
- \usleep($options['delay'] * 1000);
40
- }
41
-
42
- $startTime = isset($options['on_stats']) ? Utils::currentTime() : null;
43
-
44
- try {
45
- // Does not support the expect header.
46
- $request = $request->withoutHeader('Expect');
47
-
48
- // Append a content-length header if body size is zero to match
49
- // cURL's behavior.
50
- if (0 === $request->getBody()->getSize()) {
51
- $request = $request->withHeader('Content-Length', '0');
52
- }
53
-
54
- return $this->createResponse(
55
- $request,
56
- $options,
57
- $this->createStream($request, $options),
58
- $startTime
59
- );
60
- } catch (\InvalidArgumentException $e) {
61
- throw $e;
62
- } catch (\Exception $e) {
63
- // Determine if the error was a networking error.
64
- $message = $e->getMessage();
65
- // This list can probably get more comprehensive.
66
- if (false !== \strpos($message, 'getaddrinfo') // DNS lookup failed
67
- || false !== \strpos($message, 'Connection refused')
68
- || false !== \strpos($message, "couldn't connect to host") // error on HHVM
69
- || false !== \strpos($message, "connection attempt failed")
70
- ) {
71
- $e = new ConnectException($e->getMessage(), $request, $e);
72
- } else {
73
- $e = RequestException::wrapException($request, $e);
74
- }
75
- $this->invokeStats($options, $request, $startTime, null, $e);
76
-
77
- return \GuzzleHttp\Promise\rejection_for($e);
78
- }
79
- }
80
-
81
- private function invokeStats(
82
- array $options,
83
- RequestInterface $request,
84
- ?float $startTime,
85
- ResponseInterface $response = null,
86
- \Throwable $error = null
87
- ): void {
88
- if (isset($options['on_stats'])) {
89
- $stats = new TransferStats(
90
- $request,
91
- $response,
92
- Utils::currentTime() - $startTime,
93
- $error,
94
- []
95
- );
96
- ($options['on_stats'])($stats);
97
- }
98
- }
99
-
100
- /**
101
- * @param resource $stream
102
- */
103
- private function createResponse(
104
- RequestInterface $request,
105
- array $options,
106
- $stream,
107
- ?float $startTime
108
- ): PromiseInterface {
109
- $hdrs = $this->lastHeaders;
110
- $this->lastHeaders = [];
111
- $parts = \explode(' ', \array_shift($hdrs), 3);
112
- $ver = \explode('/', $parts[0])[1];
113
- $status = (int) $parts[1];
114
- $reason = $parts[2] ?? null;
115
- $headers = Utils::headersFromLines($hdrs);
116
- [$stream, $headers] = $this->checkDecode($options, $headers, $stream);
117
- $stream = Psr7\stream_for($stream);
118
- $sink = $stream;
119
-
120
- if (\strcasecmp('HEAD', $request->getMethod())) {
121
- $sink = $this->createSink($stream, $options);
122
- }
123
-
124
- $response = new Psr7\Response($status, $headers, $sink, $ver, $reason);
125
-
126
- if (isset($options['on_headers'])) {
127
- try {
128
- $options['on_headers']($response);
129
- } catch (\Exception $e) {
130
- $msg = 'An error was encountered during the on_headers event';
131
- $ex = new RequestException($msg, $request, $response, $e);
132
- return \GuzzleHttp\Promise\rejection_for($ex);
133
- }
134
- }
135
-
136
- // Do not drain when the request is a HEAD request because they have
137
- // no body.
138
- if ($sink !== $stream) {
139
- $this->drain(
140
- $stream,
141
- $sink,
142
- $response->getHeaderLine('Content-Length')
143
- );
144
- }
145
-
146
- $this->invokeStats($options, $request, $startTime, $response, null);
147
-
148
- return new FulfilledPromise($response);
149
- }
150
-
151
- private function createSink(StreamInterface $stream, array $options): StreamInterface
152
- {
153
- if (!empty($options['stream'])) {
154
- return $stream;
155
- }
156
-
157
- $sink = $options['sink']
158
- ?? \fopen('php://temp', 'r+');
159
-
160
- return \is_string($sink)
161
- ? new Psr7\LazyOpenStream($sink, 'w+')
162
- : Psr7\stream_for($sink);
163
- }
164
-
165
- /**
166
- * @param resource $stream
167
- */
168
- private function checkDecode(array $options, array $headers, $stream): array
169
- {
170
- // Automatically decode responses when instructed.
171
- if (!empty($options['decode_content'])) {
172
- $normalizedKeys = Utils::normalizeHeaderKeys($headers);
173
- if (isset($normalizedKeys['content-encoding'])) {
174
- $encoding = $headers[$normalizedKeys['content-encoding']];
175
- if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') {
176
- $stream = new Psr7\InflateStream(
177
- Psr7\stream_for($stream)
178
- );
179
- $headers['x-encoded-content-encoding']
180
- = $headers[$normalizedKeys['content-encoding']];
181
- // Remove content-encoding header
182
- unset($headers[$normalizedKeys['content-encoding']]);
183
- // Fix content-length header
184
- if (isset($normalizedKeys['content-length'])) {
185
- $headers['x-encoded-content-length']
186
- = $headers[$normalizedKeys['content-length']];
187
-
188
- $length = (int) $stream->getSize();
189
- if ($length === 0) {
190
- unset($headers[$normalizedKeys['content-length']]);
191
- } else {
192
- $headers[$normalizedKeys['content-length']] = [$length];
193
- }
194
- }
195
- }
196
- }
197
- }
198
-
199
- return [$stream, $headers];
200
- }
201
-
202
- /**
203
- * Drains the source stream into the "sink" client option.
204
- *
205
- * @param string $contentLength Header specifying the amount of
206
- * data to read.
207
- *
208
- * @throws \RuntimeException when the sink option is invalid.
209
- */
210
- private function drain(
211
- StreamInterface $source,
212
- StreamInterface $sink,
213
- string $contentLength
214
- ): StreamInterface {
215
- // If a content-length header is provided, then stop reading once
216
- // that number of bytes has been read. This can prevent infinitely
217
- // reading from a stream when dealing with servers that do not honor
218
- // Connection: Close headers.
219
- Psr7\copy_to_stream(
220
- $source,
221
- $sink,
222
- (\strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1
223
- );
224
-
225
- $sink->seek(0);
226
- $source->close();
227
-
228
- return $sink;
229
- }
230
-
231
- /**
232
- * Create a resource and check to ensure it was created successfully
233
- *
234
- * @param callable $callback Callable that returns stream resource
235
- *
236
- * @return resource
237
- *
238
- * @throws \RuntimeException on error
239
- */
240
- private function createResource(callable $callback)
241
- {
242
- $errors = [];
243
- \set_error_handler(static function ($_, $msg, $file, $line) use (&$errors): bool {
244
- $errors[] = [
245
- 'message' => $msg,
246
- 'file' => $file,
247
- 'line' => $line
248
- ];
249
- return true;
250
- });
251
-
252
- $resource = $callback();
253
- \restore_error_handler();
254
-
255
- if (!$resource) {
256
- $message = 'Error creating resource: ';
257
- foreach ($errors as $err) {
258
- foreach ($err as $key => $value) {
259
- $message .= "[$key] $value" . \PHP_EOL;
260
- }
261
- }
262
- throw new \RuntimeException(\trim($message));
263
- }
264
-
265
- return $resource;
266
- }
267
-
268
- /**
269
- * @return resource
270
- */
271
- private function createStream(RequestInterface $request, array $options)
272
- {
273
- static $methods;
274
- if (!$methods) {
275
- $methods = \array_flip(\get_class_methods(__CLASS__));
276
- }
277
-
278
- // HTTP/1.1 streams using the PHP stream wrapper require a
279
- // Connection: close header
280
- if ($request->getProtocolVersion() == '1.1'
281
- && !$request->hasHeader('Connection')
282
- ) {
283
- $request = $request->withHeader('Connection', 'close');
284
- }
285
-
286
- // Ensure SSL is verified by default
287
- if (!isset($options['verify'])) {
288
- $options['verify'] = true;
289
- }
290
-
291
- $params = [];
292
- $context = $this->getDefaultContext($request);
293
-
294
- if (isset($options['on_headers']) && !\is_callable($options['on_headers'])) {
295
- throw new \InvalidArgumentException('on_headers must be callable');
296
- }
297
-
298
- if (!empty($options)) {
299
- foreach ($options as $key => $value) {
300
- $method = "add_{$key}";
301
- if (isset($methods[$method])) {
302
- $this->{$method}($request, $context, $value, $params);
303
- }
304
- }
305
- }
306
-
307
- if (isset($options['stream_context'])) {
308
- if (!\is_array($options['stream_context'])) {
309
- throw new \InvalidArgumentException('stream_context must be an array');
310
- }
311
- $context = \array_replace_recursive(
312
- $context,
313
- $options['stream_context']
314
- );
315
- }
316
-
317
- // Microsoft NTLM authentication only supported with curl handler
318
- if (isset($options['auth'][2]) && 'ntlm' === $options['auth'][2]) {
319
- throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler');
320
- }
321
-
322
- $uri = $this->resolveHost($request, $options);
323
-
324
- $contextResource = $this->createResource(
325
- static function () use ($context, $params) {
326
- return \stream_context_create($context, $params);
327
- }
328
- );
329
-
330
- return $this->createResource(
331
- function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) {
332
- $resource = \fopen((string) $uri, 'r', false, $contextResource);
333
- $this->lastHeaders = $http_response_header;
334
-
335
- if (false === $resource) {
336
- throw new ConnectException(
337
- sprintf('Connection refused for URI %s', $uri),
338
- $request,
339
- null,
340
- $context
341
- );
342
- }
343
-
344
- if (isset($options['read_timeout'])) {
345
- $readTimeout = $options['read_timeout'];
346
- $sec = (int) $readTimeout;
347
- $usec = ($readTimeout - $sec) * 100000;
348
- \stream_set_timeout($resource, $sec, $usec);
349
- }
350
-
351
- return $resource;
352
- }
353
- );
354
- }
355
-
356
- private function resolveHost(RequestInterface $request, array $options): UriInterface
357
- {
358
- $uri = $request->getUri();
359
-
360
- if (isset($options['force_ip_resolve']) && !\filter_var($uri->getHost(), \FILTER_VALIDATE_IP)) {
361
- if ('v4' === $options['force_ip_resolve']) {
362
- $records = \dns_get_record($uri->getHost(), \DNS_A);
363
- if (false === $records || !isset($records[0]['ip'])) {
364
- throw new ConnectException(
365
- \sprintf(
366
- "Could not resolve IPv4 address for host '%s'",
367
- $uri->getHost()
368
- ),
369
- $request
370
- );
371
- }
372
- return $uri->withHost($records[0]['ip']);
373
- }
374
- if ('v6' === $options['force_ip_resolve']) {
375
- $records = \dns_get_record($uri->getHost(), \DNS_AAAA);
376
- if (false === $records || !isset($records[0]['ipv6'])) {
377
- throw new ConnectException(
378
- \sprintf(
379
- "Could not resolve IPv6 address for host '%s'",
380
- $uri->getHost()
381
- ),
382
- $request
383
- );
384
- }
385
- return $uri->withHost('[' . $records[0]['ipv6'] . ']');
386
- }
387
- }
388
-
389
- return $uri;
390
- }
391
-
392
- private function getDefaultContext(RequestInterface $request): array
393
- {
394
- $headers = '';
395
- foreach ($request->getHeaders() as $name => $value) {
396
- foreach ($value as $val) {
397
- $headers .= "$name: $val\r\n";
398
- }
399
- }
400
-
401
- $context = [
402
- 'http' => [
403
- 'method' => $request->getMethod(),
404
- 'header' => $headers,
405
- 'protocol_version' => $request->getProtocolVersion(),
406
- 'ignore_errors' => true,
407
- 'follow_location' => 0,
408
- ],
409
- ];
410
-
411
- $body = (string) $request->getBody();
412
-
413
- if (!empty($body)) {
414
- $context['http']['content'] = $body;
415
- // Prevent the HTTP handler from adding a Content-Type header.
416
- if (!$request->hasHeader('Content-Type')) {
417
- $context['http']['header'] .= "Content-Type:\r\n";
418
- }
419
- }
420
-
421
- $context['http']['header'] = \rtrim($context['http']['header']);
422
-
423
- return $context;
424
- }
425
-
426
- /**
427
- * @param mixed $value as passed via Request transfer options.
428
- */
429
- private function add_proxy(RequestInterface $request, array &$options, $value, array &$params): void
430
- {
431
- if (!\is_array($value)) {
432
- $options['http']['proxy'] = $value;
433
- } else {
434
- $scheme = $request->getUri()->getScheme();
435
- if (isset($value[$scheme])) {
436
- if (!isset($value['no'])
437
- || !Utils::isHostInNoProxy(
438
- $request->getUri()->getHost(),
439
- $value['no']
440
- )
441
- ) {
442
- $options['http']['proxy'] = $value[$scheme];
443
- }
444
- }
445
- }
446
- }
447
-
448
- /**
449
- * @param mixed $value as passed via Request transfer options.
450
- */
451
- private function add_timeout(RequestInterface $request, array &$options, $value, array &$params): void
452
- {
453
- if ($value > 0) {
454
- $options['http']['timeout'] = $value;
455
- }
456
- }
457
-
458
- /**
459
- * @param mixed $value as passed via Request transfer options.
460
- */
461
- private function add_verify(RequestInterface $request, array &$options, $value, array &$params): void
462
- {
463
- if ($value === false) {
464
- $options['ssl']['verify_peer'] = false;
465
- $options['ssl']['verify_peer_name'] = false;
466
-
467
- return;
468
- }
469
-
470
- if (\is_string($value)) {
471
- $options['ssl']['cafile'] = $value;
472
- if (!\file_exists($value)) {
473
- throw new \RuntimeException("SSL CA bundle not found: $value");
474
- }
475
- } elseif ($value !== true) {
476
- throw new \InvalidArgumentException('Invalid verify request option');
477
- }
478
-
479
- $options['ssl']['verify_peer'] = true;
480
- $options['ssl']['verify_peer_name'] = true;
481
- $options['ssl']['allow_self_signed'] = false;
482
- }
483
-
484
- /**
485
- * @param mixed $value as passed via Request transfer options.
486
- */
487
- private function add_cert(RequestInterface $request, array &$options, $value, array &$params): void
488
- {
489
- if (\is_array($value)) {
490
- $options['ssl']['passphrase'] = $value[1];
491
- $value = $value[0];
492
- }
493
-
494
- if (!\file_exists($value)) {
495
- throw new \RuntimeException("SSL certificate not found: {$value}");
496
- }
497
-
498
- $options['ssl']['local_cert'] = $value;
499
- }
500
-
501
- /**
502
- * @param mixed $value as passed via Request transfer options.
503
- */
504
- private function add_progress(RequestInterface $request, array &$options, $value, array &$params): void
505
- {
506
- $this->addNotification(
507
- $params,
508
- static function ($code, $a, $b, $c, $transferred, $total) use ($value) {
509
- if ($code == \STREAM_NOTIFY_PROGRESS) {
510
- $value($total, $transferred, null, null);
511
- }
512
- }
513
- );
514
- }
515
-
516
- /**
517
- * @param mixed $value as passed via Request transfer options.
518
- */
519
- private function add_debug(RequestInterface $request, array &$options, $value, array &$params): void
520
- {
521
- if ($value === false) {
522
- return;
523
- }
524
-
525
- static $map = [
526
- \STREAM_NOTIFY_CONNECT => 'CONNECT',
527
- \STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED',
528
- \STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT',
529
- \STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS',
530
- \STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS',
531
- \STREAM_NOTIFY_REDIRECTED => 'REDIRECTED',
532
- \STREAM_NOTIFY_PROGRESS => 'PROGRESS',
533
- \STREAM_NOTIFY_FAILURE => 'FAILURE',
534
- \STREAM_NOTIFY_COMPLETED => 'COMPLETED',
535
- \STREAM_NOTIFY_RESOLVE => 'RESOLVE',
536
- ];
537
- static $args = ['severity', 'message', 'message_code',
538
- 'bytes_transferred', 'bytes_max'];
539
-
540
- $value = Utils::debugResource($value);
541
- $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment('');
542
- $this->addNotification(
543
- $params,
544
- static function () use ($ident, $value, $map, $args): void {
545
- $passed = \func_get_args();
546
- $code = \array_shift($passed);
547
- \fprintf($value, '<%s> [%s] ', $ident, $map[$code]);
548
- foreach (\array_filter($passed) as $i => $v) {
549
- \fwrite($value, $args[$i] . ': "' . $v . '" ');
550
- }
551
- \fwrite($value, "\n");
552
- }
553
- );
554
- }
555
-
556
- private function addNotification(array &$params, callable $notify): void
557
- {
558
- // Wrap the existing function if needed.
559
- if (!isset($params['notification'])) {
560
- $params['notification'] = $notify;
561
- } else {
562
- $params['notification'] = $this->callArray([
563
- $params['notification'],
564
- $notify
565
- ]);
566
- }
567
- }
568
-
569
- private function callArray(array $functions): callable
570
- {
571
- return static function () use ($functions) {
572
- $args = \func_get_args();
573
- foreach ($functions as $fn) {
574
- \call_user_func_array($fn, $args);
575
- }
576
- };
577
- }
578
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/HandlerStack.php DELETED
@@ -1,271 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Promise\PromiseInterface;
6
- use Psr\Http\Message\RequestInterface;
7
- use Psr\Http\Message\ResponseInterface;
8
-
9
- /**
10
- * Creates a composed Guzzle handler function by stacking middlewares on top of
11
- * an HTTP handler function.
12
- *
13
- * @final
14
- */
15
- class HandlerStack
16
- {
17
- /**
18
- * @var null|callable(RequestInterface, array): PromiseInterface
19
- */
20
- private $handler;
21
-
22
- /**
23
- * @var array{(callable(callable(RequestInterface, array): PromiseInterface): callable), (string|null)}[]
24
- */
25
- private $stack = [];
26
-
27
- /**
28
- * @var null|callable(RequestInterface, array): PromiseInterface
29
- */
30
- private $cached;
31
-
32
- /**
33
- * Creates a default handler stack that can be used by clients.
34
- *
35
- * The returned handler will wrap the provided handler or use the most
36
- * appropriate default handler for your system. The returned HandlerStack has
37
- * support for cookies, redirects, HTTP error exceptions, and preparing a body
38
- * before sending.
39
- *
40
- * The returned handler stack can be passed to a client in the "handler"
41
- * option.
42
- *
43
- * @param null|callable(RequestInterface, array): PromiseInterface $handler HTTP handler function to use with the stack. If no
44
- * handler is provided, the best handler for your
45
- * system will be utilized.
46
- */
47
- public static function create(?callable $handler = null): self
48
- {
49
- $stack = new self($handler ?: Utils::chooseHandler());
50
- $stack->push(Middleware::httpErrors(), 'http_errors');
51
- $stack->push(Middleware::redirect(), 'allow_redirects');
52
- $stack->push(Middleware::cookies(), 'cookies');
53
- $stack->push(Middleware::prepareBody(), 'prepare_body');
54
-
55
- return $stack;
56
- }
57
-
58
- /**
59
- * @param null|callable(RequestInterface, array): PromiseInterface $handler Underlying HTTP handler.
60
- */
61
- public function __construct(callable $handler = null)
62
- {
63
- $this->handler = $handler;
64
- }
65
-
66
- /**
67
- * Invokes the handler stack as a composed handler
68
- *
69
- * @return ResponseInterface|PromiseInterface
70
- */
71
- public function __invoke(RequestInterface $request, array $options)
72
- {
73
- $handler = $this->resolve();
74
-
75
- return $handler($request, $options);
76
- }
77
-
78
- /**
79
- * Dumps a string representation of the stack.
80
- *
81
- * @return string
82
- */
83
- public function __toString()
84
- {
85
- $depth = 0;
86
- $stack = [];
87
-
88
- if ($this->handler !== null) {
89
- $stack[] = "0) Handler: " . $this->debugCallable($this->handler);
90
- }
91
-
92
- $result = '';
93
- foreach (\array_reverse($this->stack) as $tuple) {
94
- $depth++;
95
- $str = "{$depth}) Name: '{$tuple[1]}', ";
96
- $str .= "Function: " . $this->debugCallable($tuple[0]);
97
- $result = "> {$str}\n{$result}";
98
- $stack[] = $str;
99
- }
100
-
101
- foreach (\array_keys($stack) as $k) {
102
- $result .= "< {$stack[$k]}\n";
103
- }
104
-
105
- return $result;
106
- }
107
-
108
- /**
109
- * Set the HTTP handler that actually returns a promise.
110
- *
111
- * @param callable(RequestInterface, array): PromiseInterface $handler Accepts a request and array of options and
112
- * returns a Promise.
113
- */
114
- public function setHandler(callable $handler): void
115
- {
116
- $this->handler = $handler;
117
- $this->cached = null;
118
- }
119
-
120
- /**
121
- * Returns true if the builder has a handler.
122
- */
123
- public function hasHandler(): bool
124
- {
125
- return $this->handler !== null ;
126
- }
127
-
128
- /**
129
- * Unshift a middleware to the bottom of the stack.
130
- *
131
- * @param callable(callable): callable $middleware Middleware function
132
- * @param string $name Name to register for this middleware.
133
- */
134
- public function unshift(callable $middleware, ?string $name = null): void
135
- {
136
- \array_unshift($this->stack, [$middleware, $name]);
137
- $this->cached = null;
138
- }
139
-
140
- /**
141
- * Push a middleware to the top of the stack.
142
- *
143
- * @param callable(callable): callable $middleware Middleware function
144
- * @param string $name Name to register for this middleware.
145
- */
146
- public function push(callable $middleware, string $name = ''): void
147
- {
148
- $this->stack[] = [$middleware, $name];
149
- $this->cached = null;
150
- }
151
-
152
- /**
153
- * Add a middleware before another middleware by name.
154
- *
155
- * @param string $findName Middleware to find
156
- * @param callable(callable): callable $middleware Middleware function
157
- * @param string $withName Name to register for this middleware.
158
- */
159
- public function before(string $findName, callable $middleware, string $withName = ''): void
160
- {
161
- $this->splice($findName, $withName, $middleware, true);
162
- }
163
-
164
- /**
165
- * Add a middleware after another middleware by name.
166
- *
167
- * @param string $findName Middleware to find
168
- * @param callable(callable): callable $middleware Middleware function
169
- * @param string $withName Name to register for this middleware.
170
- */
171
- public function after(string $findName, callable $middleware, string $withName = ''): void
172
- {
173
- $this->splice($findName, $withName, $middleware, false);
174
- }
175
-
176
- /**
177
- * Remove a middleware by instance or name from the stack.
178
- *
179
- * @param callable|string $remove Middleware to remove by instance or name.
180
- */
181
- public function remove($remove): void
182
- {
183
- $this->cached = null;
184
- $idx = \is_callable($remove) ? 0 : 1;
185
- $this->stack = \array_values(\array_filter(
186
- $this->stack,
187
- static function ($tuple) use ($idx, $remove) {
188
- return $tuple[$idx] !== $remove;
189
- }
190
- ));
191
- }
192
-
193
- /**
194
- * Compose the middleware and handler into a single callable function.
195
- *
196
- * @return callable(RequestInterface, array): PromiseInterface
197
- */
198
- public function resolve(): callable
199
- {
200
- if ($this->cached === null) {
201
- if (($prev = $this->handler) === null) {
202
- throw new \LogicException('No handler has been specified');
203
- }
204
-
205
- foreach (\array_reverse($this->stack) as $fn) {
206
- /** @var callable(RequestInterface, array): PromiseInterface $prev */
207
- $prev = $fn[0]($prev);
208
- }
209
-
210
- $this->cached = $prev;
211
- }
212
-
213
- return $this->cached;
214
- }
215
-
216
- private function findByName(string $name): int
217
- {
218
- foreach ($this->stack as $k => $v) {
219
- if ($v[1] === $name) {
220
- return $k;
221
- }
222
- }
223
-
224
- throw new \InvalidArgumentException("Middleware not found: $name");
225
- }
226
-
227
- /**
228
- * Splices a function into the middleware list at a specific position.
229
- */
230
- private function splice(string $findName, string $withName, callable $middleware, bool $before): void
231
- {
232
- $this->cached = null;
233
- $idx = $this->findByName($findName);
234
- $tuple = [$middleware, $withName];
235
-
236
- if ($before) {
237
- if ($idx === 0) {
238
- \array_unshift($this->stack, $tuple);
239
- } else {
240
- $replacement = [$tuple, $this->stack[$idx]];
241
- \array_splice($this->stack, $idx, 1, $replacement);
242
- }
243
- } elseif ($idx === \count($this->stack) - 1) {
244
- $this->stack[] = $tuple;
245
- } else {
246
- $replacement = [$this->stack[$idx], $tuple];
247
- \array_splice($this->stack, $idx, 1, $replacement);
248
- }
249
- }
250
-
251
- /**
252
- * Provides a debug string for a given callable.
253
- *
254
- * @param callable $fn Function to write as a string.
255
- */
256
- private function debugCallable($fn): string
257
- {
258
- if (\is_string($fn)) {
259
- return "callable({$fn})";
260
- }
261
-
262
- if (\is_array($fn)) {
263
- return \is_string($fn[0])
264
- ? "callable({$fn[0]}::{$fn[1]})"
265
- : "callable(['" . \get_class($fn[0]) . "', '{$fn[1]}'])";
266
- }
267
-
268
- /** @var object $fn */
269
- return 'callable(' . \spl_object_hash($fn) . ')';
270
- }
271
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/MessageFormatter.php DELETED
@@ -1,201 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use Psr\Http\Message\MessageInterface;
6
- use Psr\Http\Message\RequestInterface;
7
- use Psr\Http\Message\ResponseInterface;
8
-
9
- /**
10
- * Formats log messages using variable substitutions for requests, responses,
11
- * and other transactional data.
12
- *
13
- * The following variable substitutions are supported:
14
- *
15
- * - {request}: Full HTTP request message
16
- * - {response}: Full HTTP response message
17
- * - {ts}: ISO 8601 date in GMT
18
- * - {date_iso_8601} ISO 8601 date in GMT
19
- * - {date_common_log} Apache common log date using the configured timezone.
20
- * - {host}: Host of the request
21
- * - {method}: Method of the request
22
- * - {uri}: URI of the request
23
- * - {version}: Protocol version
24
- * - {target}: Request target of the request (path + query + fragment)
25
- * - {hostname}: Hostname of the machine that sent the request
26
- * - {code}: Status code of the response (if available)
27
- * - {phrase}: Reason phrase of the response (if available)
28
- * - {error}: Any error messages (if available)
29
- * - {req_header_*}: Replace `*` with the lowercased name of a request header to add to the message
30
- * - {res_header_*}: Replace `*` with the lowercased name of a response header to add to the message
31
- * - {req_headers}: Request headers
32
- * - {res_headers}: Response headers
33
- * - {req_body}: Request body
34
- * - {res_body}: Response body
35
- *
36
- * @final
37
- */
38
- class MessageFormatter implements MessageFormatterInterface
39
- {
40
- /**
41
- * Apache Common Log Format.
42
- *
43
- * @link https://httpd.apache.org/docs/2.4/logs.html#common
44
- *
45
- * @var string
46
- */
47
- public const CLF = "{hostname} {req_header_User-Agent} - [{date_common_log}] \"{method} {target} HTTP/{version}\" {code} {res_header_Content-Length}";
48
- public const DEBUG = ">>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}";
49
- public const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}';
50
-
51
- /**
52
- * @var string Template used to format log messages
53
- */
54
- private $template;
55
-
56
- /**
57
- * @param string $template Log message template
58
- */
59
- public function __construct(?string $template = self::CLF)
60
- {
61
- $this->template = $template ?: self::CLF;
62
- }
63
-
64
- /**
65
- * Returns a formatted message string.
66
- *
67
- * @param RequestInterface $request Request that was sent
68
- * @param ResponseInterface|null $response Response that was received
69
- * @param \Throwable|null $error Exception that was received
70
- */
71
- public function format(
72
- RequestInterface $request,
73
- ?ResponseInterface $response = null,
74
- ?\Throwable $error = null
75
- ): string {
76
- $cache = [];
77
-
78
- /** @var string */
79
- return \preg_replace_callback(
80
- '/{\s*([A-Za-z_\-\.0-9]+)\s*}/',
81
- function (array $matches) use ($request, $response, $error, &$cache) {
82
- if (isset($cache[$matches[1]])) {
83
- return $cache[$matches[1]];
84
- }
85
-
86
- $result = '';
87
- switch ($matches[1]) {
88
- case 'request':
89
- $result = Psr7\str($request);
90
- break;
91
- case 'response':
92
- $result = $response ? Psr7\str($response) : '';
93
- break;
94
- case 'req_headers':
95
- $result = \trim($request->getMethod()
96
- . ' ' . $request->getRequestTarget())
97
- . ' HTTP/' . $request->getProtocolVersion() . "\r\n"
98
- . $this->headers($request);
99
- break;
100
- case 'res_headers':
101
- $result = $response ?
102
- \sprintf(
103
- 'HTTP/%s %d %s',
104
- $response->getProtocolVersion(),
105
- $response->getStatusCode(),
106
- $response->getReasonPhrase()
107
- ) . "\r\n" . $this->headers($response)
108
- : 'NULL';
109
- break;
110
- case 'req_body':
111
- $result = $request->getBody()->__toString();
112
- break;
113
- case 'res_body':
114
- if (!$response instanceof ResponseInterface) {
115
- $result = 'NULL';
116
- break;
117
- }
118
-
119
- $body = $response->getBody();
120
-
121
- if (!$body->isSeekable()) {
122
- $result = 'RESPONSE_NOT_LOGGEABLE';
123
- break;
124
- }
125
-
126
- $result = $response->getBody()->__toString();
127
- break;
128
- case 'ts':
129
- case 'date_iso_8601':
130
- $result = \gmdate('c');
131
- break;
132
- case 'date_common_log':
133
- $result = \date('d/M/Y:H:i:s O');
134
- break;
135
- case 'method':
136
- $result = $request->getMethod();
137
- break;
138
- case 'version':
139
- $result = $request->getProtocolVersion();
140
- break;
141
- case 'uri':
142
- case 'url':
143
- $result = $request->getUri();
144
- break;
145
- case 'target':
146
- $result = $request->getRequestTarget();
147
- break;
148
- case 'req_version':
149
- $result = $request->getProtocolVersion();
150
- break;
151
- case 'res_version':
152
- $result = $response
153
- ? $response->getProtocolVersion()
154
- : 'NULL';
155
- break;
156
- case 'host':
157
- $result = $request->getHeaderLine('Host');
158
- break;
159
- case 'hostname':
160
- $result = \gethostname();
161
- break;
162
- case 'code':
163
- $result = $response ? $response->getStatusCode() : 'NULL';
164
- break;
165
- case 'phrase':
166
- $result = $response ? $response->getReasonPhrase() : 'NULL';
167
- break;
168
- case 'error':
169
- $result = $error ? $error->getMessage() : 'NULL';
170
- break;
171
- default:
172
- // handle prefixed dynamic headers
173
- if (\strpos($matches[1], 'req_header_') === 0) {
174
- $result = $request->getHeaderLine(\substr($matches[1], 11));
175
- } elseif (\strpos($matches[1], 'res_header_') === 0) {
176
- $result = $response
177
- ? $response->getHeaderLine(\substr($matches[1], 11))
178
- : 'NULL';
179
- }
180
- }
181
-
182
- $cache[$matches[1]] = $result;
183
- return $result;
184
- },
185
- $this->template
186
- );
187
- }
188
-
189
- /**
190
- * Get headers from message as string
191
- */
192
- private function headers(MessageInterface $message): string
193
- {
194
- $result = '';
195
- foreach ($message->getHeaders() as $name => $values) {
196
- $result .= $name . ': ' . \implode(', ', $values) . "\r\n";
197
- }
198
-
199
- return \trim($result);
200
- }
201
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use Psr\Http\Message\RequestInterface;
6
- use Psr\Http\Message\ResponseInterface;
7
-
8
- interface MessageFormatterInterface
9
- {
10
- /**
11
- * Returns a formatted message string.
12
- *
13
- * @param RequestInterface $request Request that was sent
14
- * @param ResponseInterface|null $response Response that was received
15
- * @param \Throwable|null $error Exception that was received
16
- */
17
- public function format(
18
- RequestInterface $request,
19
- ?ResponseInterface $response = null,
20
- ?\Throwable $error = null
21
- ): string;
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Middleware.php DELETED
@@ -1,259 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Cookie\CookieJarInterface;
6
- use GuzzleHttp\Exception\RequestException;
7
- use GuzzleHttp\Promise\PromiseInterface;
8
- use Psr\Http\Message\RequestInterface;
9
- use Psr\Http\Message\ResponseInterface;
10
- use Psr\Log\LoggerInterface;
11
-
12
- /**
13
- * Functions used to create and wrap handlers with handler middleware.
14
- */
15
- final class Middleware
16
- {
17
- /**
18
- * Middleware that adds cookies to requests.
19
- *
20
- * The options array must be set to a CookieJarInterface in order to use
21
- * cookies. This is typically handled for you by a client.
22
- *
23
- * @return callable Returns a function that accepts the next handler.
24
- */
25
- public static function cookies(): callable
26
- {
27
- return static function (callable $handler): callable {
28
- return static function ($request, array $options) use ($handler) {
29
- if (empty($options['cookies'])) {
30
- return $handler($request, $options);
31
- } elseif (!($options['cookies'] instanceof CookieJarInterface)) {
32
- throw new \InvalidArgumentException('cookies must be an instance of GuzzleHttp\Cookie\CookieJarInterface');
33
- }
34
- $cookieJar = $options['cookies'];
35
- $request = $cookieJar->withCookieHeader($request);
36
- return $handler($request, $options)
37
- ->then(
38
- static function (ResponseInterface $response) use ($cookieJar, $request): ResponseInterface {
39
- $cookieJar->extractCookies($request, $response);
40
- return $response;
41
- }
42
- );
43
- };
44
- };
45
- }
46
-
47
- /**
48
- * Middleware that throws exceptions for 4xx or 5xx responses when the
49
- * "http_error" request option is set to true.
50
- *
51
- * @return callable(callable): callable Returns a function that accepts the next handler.
52
- */
53
- public static function httpErrors(): callable
54
- {
55
- return static function (callable $handler): callable {
56
- return static function ($request, array $options) use ($handler) {
57
- if (empty($options['http_errors'])) {
58
- return $handler($request, $options);
59
- }
60
- return $handler($request, $options)->then(
61
- static function (ResponseInterface $response) use ($request) {
62
- $code = $response->getStatusCode();
63
- if ($code < 400) {
64
- return $response;
65
- }
66
- throw RequestException::create($request, $response);
67
- }
68
- );
69
- };
70
- };
71
- }
72
-
73
- /**
74
- * Middleware that pushes history data to an ArrayAccess container.
75
- *
76
- * @param array|\ArrayAccess<int, array> $container Container to hold the history (by reference).
77
- *
78
- * @return callable(callable): callable Returns a function that accepts the next handler.
79
- *
80
- * @throws \InvalidArgumentException if container is not an array or ArrayAccess.
81
- */
82
- public static function history(&$container): callable
83
- {
84
- if (!\is_array($container) && !$container instanceof \ArrayAccess) {
85
- throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess');
86
- }
87
-
88
- return static function (callable $handler) use (&$container): callable {
89
- return static function (RequestInterface $request, array $options) use ($handler, &$container) {
90
- return $handler($request, $options)->then(
91
- static function ($value) use ($request, &$container, $options) {
92
- $container[] = [
93
- 'request' => $request,
94
- 'response' => $value,
95
- 'error' => null,
96
- 'options' => $options
97
- ];
98
- return $value;
99
- },
100
- static function ($reason) use ($request, &$container, $options) {
101
- $container[] = [
102
- 'request' => $request,
103
- 'response' => null,
104
- 'error' => $reason,
105
- 'options' => $options
106
- ];
107
- return \GuzzleHttp\Promise\rejection_for($reason);
108
- }
109
- );
110
- };
111
- };
112
- }
113
-
114
- /**
115
- * Middleware that invokes a callback before and after sending a request.
116
- *
117
- * The provided listener cannot modify or alter the response. It simply
118
- * "taps" into the chain to be notified before returning the promise. The
119
- * before listener accepts a request and options array, and the after
120
- * listener accepts a request, options array, and response promise.
121
- *
122
- * @param callable $before Function to invoke before forwarding the request.
123
- * @param callable $after Function invoked after forwarding.
124
- *
125
- * @return callable Returns a function that accepts the next handler.
126
- */
127
- public static function tap(callable $before = null, callable $after = null): callable
128
- {
129
- return static function (callable $handler) use ($before, $after): callable {
130
- return static function (RequestInterface $request, array $options) use ($handler, $before, $after) {
131
- if ($before) {
132
- $before($request, $options);
133
- }
134
- $response = $handler($request, $options);
135
- if ($after) {
136
- $after($request, $options, $response);
137
- }
138
- return $response;
139
- };
140
- };
141
- }
142
-
143
- /**
144
- * Middleware that handles request redirects.
145
- *
146
- * @return callable Returns a function that accepts the next handler.
147
- */
148
- public static function redirect(): callable
149
- {
150
- return static function (callable $handler): RedirectMiddleware {
151
- return new RedirectMiddleware($handler);
152
- };
153
- }
154
-
155
- /**
156
- * Middleware that retries requests based on the boolean result of
157
- * invoking the provided "decider" function.
158
- *
159
- * If no delay function is provided, a simple implementation of exponential
160
- * backoff will be utilized.
161
- *
162
- * @param callable $decider Function that accepts the number of retries,
163
- * a request, [response], and [exception] and
164
- * returns true if the request is to be retried.
165
- * @param callable $delay Function that accepts the number of retries and
166
- * returns the number of milliseconds to delay.
167
- *
168
- * @return callable Returns a function that accepts the next handler.
169
- */
170
- public static function retry(callable $decider, callable $delay = null): callable
171
- {
172
- return static function (callable $handler) use ($decider, $delay): RetryMiddleware {
173
- return new RetryMiddleware($decider, $handler, $delay);
174
- };
175
- }
176
-
177
- /**
178
- * Middleware that logs requests, responses, and errors using a message
179
- * formatter.
180
- *
181
- * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests.
182
- *
183
- * @param LoggerInterface $logger Logs messages.
184
- * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings.
185
- * @param string $logLevel Level at which to log requests.
186
- *
187
- * @return callable Returns a function that accepts the next handler.
188
- */
189
- public static function log(LoggerInterface $logger, $formatter, string $logLevel = 'info'): callable
190
- {
191
- // To be compatible with Guzzle 7.1.x we need to allow users to pass a MessageFormatter
192
- if (!$formatter instanceof MessageFormatter && !$formatter instanceof MessageFormatterInterface) {
193
- throw new \LogicException(sprintf('Argument 2 to %s::log() must be of type %s', self::class, MessageFormatterInterface::class));
194
- }
195
-
196
- return static function (callable $handler) use ($logger, $formatter, $logLevel): callable {
197
- return static function (RequestInterface $request, array $options = []) use ($handler, $logger, $formatter, $logLevel) {
198
- return $handler($request, $options)->then(
199
- static function ($response) use ($logger, $request, $formatter, $logLevel): ResponseInterface {
200
- $message = $formatter->format($request, $response);
201
- $logger->log($logLevel, $message);
202
- return $response;
203
- },
204
- static function ($reason) use ($logger, $request, $formatter): PromiseInterface {
205
- $response = $reason instanceof RequestException
206
- ? $reason->getResponse()
207
- : null;
208
- $message = $formatter->format($request, $response, \GuzzleHttp\Promise\exception_for($reason));
209
- $logger->error($message);
210
- return \GuzzleHttp\Promise\rejection_for($reason);
211
- }
212
- );
213
- };
214
- };
215
- }
216
-
217
- /**
218
- * This middleware adds a default content-type if possible, a default
219
- * content-length or transfer-encoding header, and the expect header.
220
- */
221
- public static function prepareBody(): callable
222
- {
223
- return static function (callable $handler): PrepareBodyMiddleware {
224
- return new PrepareBodyMiddleware($handler);
225
- };
226
- }
227
-
228
- /**
229
- * Middleware that applies a map function to the request before passing to
230
- * the next handler.
231
- *
232
- * @param callable $fn Function that accepts a RequestInterface and returns
233
- * a RequestInterface.
234
- */
235
- public static function mapRequest(callable $fn): callable
236
- {
237
- return static function (callable $handler) use ($fn): callable {
238
- return static function (RequestInterface $request, array $options) use ($handler, $fn) {
239
- return $handler($fn($request), $options);
240
- };
241
- };
242
- }
243
-
244
- /**
245
- * Middleware that applies a map function to the resolved promise's
246
- * response.
247
- *
248
- * @param callable $fn Function that accepts a ResponseInterface and
249
- * returns a ResponseInterface.
250
- */
251
- public static function mapResponse(callable $fn): callable
252
- {
253
- return static function (callable $handler) use ($fn): callable {
254
- return static function (RequestInterface $request, array $options) use ($handler, $fn) {
255
- return $handler($request, $options)->then($fn);
256
- };
257
- };
258
- }
259
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Pool.php DELETED
@@ -1,133 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Promise\EachPromise;
6
- use GuzzleHttp\Promise\PromiseInterface;
7
- use GuzzleHttp\Promise\PromisorInterface;
8
- use Psr\Http\Message\RequestInterface;
9
-
10
- /**
11
- * Sends an iterator of requests concurrently using a capped pool size.
12
- *
13
- * The pool will read from an iterator until it is cancelled or until the
14
- * iterator is consumed. When a request is yielded, the request is sent after
15
- * applying the "request_options" request options (if provided in the ctor).
16
- *
17
- * When a function is yielded by the iterator, the function is provided the
18
- * "request_options" array that should be merged on top of any existing
19
- * options, and the function MUST then return a wait-able promise.
20
- *
21
- * @final
22
- */
23
- class Pool implements PromisorInterface
24
- {
25
- /**
26
- * @var EachPromise
27
- */
28
- private $each;
29
-
30
- /**
31
- * @param ClientInterface $client Client used to send the requests.
32
- * @param array|\Iterator $requests Requests or functions that return
33
- * requests to send concurrently.
34
- * @param array $config Associative array of options
35
- * - concurrency: (int) Maximum number of requests to send concurrently
36
- * - options: Array of request options to apply to each request.
37
- * - fulfilled: (callable) Function to invoke when a request completes.
38
- * - rejected: (callable) Function to invoke when a request is rejected.
39
- */
40
- public function __construct(
41
- ClientInterface $client,
42
- $requests,
43
- array $config = []
44
- ) {
45
- if (!isset($config['concurrency'])) {
46
- $config['concurrency'] = 25;
47
- }
48
-
49
- if (isset($config['options'])) {
50
- $opts = $config['options'];
51
- unset($config['options']);
52
- } else {
53
- $opts = [];
54
- }
55
-
56
- $iterable = \GuzzleHttp\Promise\iter_for($requests);
57
- $requests = static function () use ($iterable, $client, $opts) {
58
- foreach ($iterable as $key => $rfn) {
59
- if ($rfn instanceof RequestInterface) {
60
- yield $key => $client->sendAsync($rfn, $opts);
61
- } elseif (\is_callable($rfn)) {
62
- yield $key => $rfn($opts);
63
- } else {
64
- throw new \InvalidArgumentException('Each value yielded by '
65
- . 'the iterator must be a Psr7\Http\Message\RequestInterface '
66
- . 'or a callable that returns a promise that fulfills '
67
- . 'with a Psr7\Message\Http\ResponseInterface object.');
68
- }
69
- }
70
- };
71
-
72
- $this->each = new EachPromise($requests(), $config);
73
- }
74
-
75
- /**
76
- * Get promise
77
- */
78
- public function promise(): PromiseInterface
79
- {
80
- return $this->each->promise();
81
- }
82
-
83
- /**
84
- * Sends multiple requests concurrently and returns an array of responses
85
- * and exceptions that uses the same ordering as the provided requests.
86
- *
87
- * IMPORTANT: This method keeps every request and response in memory, and
88
- * as such, is NOT recommended when sending a large number or an
89
- * indeterminate number of requests concurrently.
90
- *
91
- * @param ClientInterface $client Client used to send the requests
92
- * @param array|\Iterator $requests Requests to send concurrently.
93
- * @param array $options Passes through the options available in
94
- * {@see \GuzzleHttp\Pool::__construct}
95
- *
96
- * @return array Returns an array containing the response or an exception
97
- * in the same order that the requests were sent.
98
- *
99
- * @throws \InvalidArgumentException if the event format is incorrect.
100
- */
101
- public static function batch(
102
- ClientInterface $client,
103
- $requests,
104
- array $options = []
105
- ): array {
106
- $res = [];
107
- self::cmpCallback($options, 'fulfilled', $res);
108
- self::cmpCallback($options, 'rejected', $res);
109
- $pool = new static($client, $requests, $options);
110
- $pool->promise()->wait();
111
- \ksort($res);
112
-
113
- return $res;
114
- }
115
-
116
- /**
117
- * Execute callback(s)
118
- */
119
- private static function cmpCallback(array &$options, string $name, array &$results): void
120
- {
121
- if (!isset($options[$name])) {
122
- $options[$name] = static function ($v, $k) use (&$results) {
123
- $results[$k] = $v;
124
- };
125
- } else {
126
- $currentFn = $options[$name];
127
- $options[$name] = static function ($v, $k) use (&$results, $currentFn) {
128
- $currentFn($v, $k);
129
- $results[$k] = $v;
130
- };
131
- }
132
- }
133
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php DELETED
@@ -1,107 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Promise\PromiseInterface;
6
- use Psr\Http\Message\RequestInterface;
7
-
8
- /**
9
- * Prepares requests that contain a body, adding the Content-Length,
10
- * Content-Type, and Expect headers.
11
- *
12
- * @final
13
- */
14
- class PrepareBodyMiddleware
15
- {
16
- /**
17
- * @var callable(RequestInterface, array): PromiseInterface
18
- */
19
- private $nextHandler;
20
-
21
- /**
22
- * @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke.
23
- */
24
- public function __construct(callable $nextHandler)
25
- {
26
- $this->nextHandler = $nextHandler;
27
- }
28
-
29
- public function __invoke(RequestInterface $request, array $options): PromiseInterface
30
- {
31
- $fn = $this->nextHandler;
32
-
33
- // Don't do anything if the request has no body.
34
- if ($request->getBody()->getSize() === 0) {
35
- return $fn($request, $options);
36
- }
37
-
38
- $modify = [];
39
-
40
- // Add a default content-type if possible.
41
- if (!$request->hasHeader('Content-Type')) {
42
- if ($uri = $request->getBody()->getMetadata('uri')) {
43
- if (is_string($uri) && $type = Psr7\mimetype_from_filename($uri)) {
44
- $modify['set_headers']['Content-Type'] = $type;
45
- }
46
- }
47
- }
48
-
49
- // Add a default content-length or transfer-encoding header.
50
- if (!$request->hasHeader('Content-Length')
51
- && !$request->hasHeader('Transfer-Encoding')
52
- ) {
53
- $size = $request->getBody()->getSize();
54
- if ($size !== null) {
55
- $modify['set_headers']['Content-Length'] = $size;
56
- } else {
57
- $modify['set_headers']['Transfer-Encoding'] = 'chunked';
58
- }
59
- }
60
-
61
- // Add the expect header if needed.
62
- $this->addExpectHeader($request, $options, $modify);
63
-
64
- return $fn(Psr7\modify_request($request, $modify), $options);
65
- }
66
-
67
- /**
68
- * Add expect header
69
- */
70
- private function addExpectHeader(
71
- RequestInterface $request,
72
- array $options,
73
- array &$modify
74
- ): void {
75
- // Determine if the Expect header should be used
76
- if ($request->hasHeader('Expect')) {
77
- return;
78
- }
79
-
80
- $expect = $options['expect'] ?? null;
81
-
82
- // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0
83
- if ($expect === false || $request->getProtocolVersion() < 1.1) {
84
- return;
85
- }
86
-
87
- // The expect header is unconditionally enabled
88
- if ($expect === true) {
89
- $modify['set_headers']['Expect'] = '100-Continue';
90
- return;
91
- }
92
-
93
- // By default, send the expect header when the payload is > 1mb
94
- if ($expect === null) {
95
- $expect = 1048576;
96
- }
97
-
98
- // Always add if the body cannot be rewound, the size cannot be
99
- // determined, or the size is greater than the cutoff threshold
100
- $body = $request->getBody();
101
- $size = $body->getSize();
102
-
103
- if ($size === null || $size >= (int) $expect || !$body->isSeekable()) {
104
- $modify['set_headers']['Expect'] = '100-Continue';
105
- }
106
- }
107
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php DELETED
@@ -1,236 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Exception\BadResponseException;
6
- use GuzzleHttp\Exception\TooManyRedirectsException;
7
- use GuzzleHttp\Promise\PromiseInterface;
8
- use Psr\Http\Message\RequestInterface;
9
- use Psr\Http\Message\ResponseInterface;
10
- use Psr\Http\Message\UriInterface;
11
-
12
- /**
13
- * Request redirect middleware.
14
- *
15
- * Apply this middleware like other middleware using
16
- * {@see \GuzzleHttp\Middleware::redirect()}.
17
- *
18
- * @final
19
- */
20
- class RedirectMiddleware
21
- {
22
- public const HISTORY_HEADER = 'X-Guzzle-Redirect-History';
23
-
24
- public const STATUS_HISTORY_HEADER = 'X-Guzzle-Redirect-Status-History';
25
-
26
- /**
27
- * @var array
28
- */
29
- public static $defaultSettings = [
30
- 'max' => 5,
31
- 'protocols' => ['http', 'https'],
32
- 'strict' => false,
33
- 'referer' => false,
34
- 'track_redirects' => false,
35
- ];
36
-
37
- /**
38
- * @var callable(RequestInterface, array): PromiseInterface
39
- */
40
- private $nextHandler;
41
-
42
- /**
43
- * @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke.
44
- */
45
- public function __construct(callable $nextHandler)
46
- {
47
- $this->nextHandler = $nextHandler;
48
- }
49
-
50
- public function __invoke(RequestInterface $request, array $options): PromiseInterface
51
- {
52
- $fn = $this->nextHandler;
53
-
54
- if (empty($options['allow_redirects'])) {
55
- return $fn($request, $options);
56
- }
57
-
58
- if ($options['allow_redirects'] === true) {
59
- $options['allow_redirects'] = self::$defaultSettings;
60
- } elseif (!\is_array($options['allow_redirects'])) {
61
- throw new \InvalidArgumentException('allow_redirects must be true, false, or array');
62
- } else {
63
- // Merge the default settings with the provided settings
64
- $options['allow_redirects'] += self::$defaultSettings;
65
- }
66
-
67
- if (empty($options['allow_redirects']['max'])) {
68
- return $fn($request, $options);
69
- }
70
-
71
- return $fn($request, $options)
72
- ->then(function (ResponseInterface $response) use ($request, $options) {
73
- return $this->checkRedirect($request, $options, $response);
74
- });
75
- }
76
-
77
- /**
78
- * @return ResponseInterface|PromiseInterface
79
- */
80
- public function checkRedirect(
81
- RequestInterface $request,
82
- array $options,
83
- ResponseInterface $response
84
- ) {
85
- if (\strpos((string) $response->getStatusCode(), '3') !== 0
86
- || !$response->hasHeader('Location')
87
- ) {
88
- return $response;
89
- }
90
-
91
- $this->guardMax($request, $options);
92
- $nextRequest = $this->modifyRequest($request, $options, $response);
93
-
94
- if (isset($options['allow_redirects']['on_redirect'])) {
95
- ($options['allow_redirects']['on_redirect'])(
96
- $request,
97
- $response,
98
- $nextRequest->getUri()
99
- );
100
- }
101
-
102
- $promise = $this($nextRequest, $options);
103
-
104
- // Add headers to be able to track history of redirects.
105
- if (!empty($options['allow_redirects']['track_redirects'])) {
106
- return $this->withTracking(
107
- $promise,
108
- (string) $nextRequest->getUri(),
109
- $response->getStatusCode()
110
- );
111
- }
112
-
113
- return $promise;
114
- }
115
-
116
- /**
117
- * Enable tracking on promise.
118
- */
119
- private function withTracking(PromiseInterface $promise, string $uri, int $statusCode): PromiseInterface
120
- {
121
- return $promise->then(
122
- static function (ResponseInterface $response) use ($uri, $statusCode) {
123
- // Note that we are pushing to the front of the list as this
124
- // would be an earlier response than what is currently present
125
- // in the history header.
126
- $historyHeader = $response->getHeader(self::HISTORY_HEADER);
127
- $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER);
128
- \array_unshift($historyHeader, $uri);
129
- \array_unshift($statusHeader, (string) $statusCode);
130
-
131
- return $response->withHeader(self::HISTORY_HEADER, $historyHeader)
132
- ->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader);
133
- }
134
- );
135
- }
136
-
137
- /**
138
- * Check for too many redirects
139
- *
140
- * @throws TooManyRedirectsException Too many redirects.
141
- */
142
- private function guardMax(RequestInterface $request, array &$options): void
143
- {
144
- $current = $options['__redirect_count']
145
- ?? 0;
146
- $options['__redirect_count'] = $current + 1;
147
- $max = $options['allow_redirects']['max'];
148
-
149
- if ($options['__redirect_count'] > $max) {
150
- throw new TooManyRedirectsException(
151
- "Will not follow more than {$max} redirects",
152
- $request
153
- );
154
- }
155
- }
156
-
157
- public function modifyRequest(
158
- RequestInterface $request,
159
- array $options,
160
- ResponseInterface $response
161
- ): RequestInterface {
162
- // Request modifications to apply.
163
- $modify = [];
164
- $protocols = $options['allow_redirects']['protocols'];
165
-
166
- // Use a GET request if this is an entity enclosing request and we are
167
- // not forcing RFC compliance, but rather emulating what all browsers
168
- // would do.
169
- $statusCode = $response->getStatusCode();
170
- if ($statusCode == 303 ||
171
- ($statusCode <= 302 && !$options['allow_redirects']['strict'])
172
- ) {
173
- $safeMethods = ['GET', 'HEAD', 'OPTIONS'];
174
- $requestMethod = $request->getMethod();
175
-
176
- $modify['method'] = in_array($requestMethod, $safeMethods) ? $requestMethod : 'GET';
177
- $modify['body'] = '';
178
- }
179
-
180
- $uri = $this->redirectUri($request, $response, $protocols);
181
- if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) {
182
- $idnOptions = ($options['idn_conversion'] === true) ? \IDNA_DEFAULT : $options['idn_conversion'];
183
- $uri = Utils::idnUriConvert($uri, $idnOptions);
184
- }
185
-
186
- $modify['uri'] = $uri;
187
- Psr7\rewind_body($request);
188
-
189
- // Add the Referer header if it is told to do so and only
190
- // add the header if we are not redirecting from https to http.
191
- if ($options['allow_redirects']['referer']
192
- && $modify['uri']->getScheme() === $request->getUri()->getScheme()
193
- ) {
194
- $uri = $request->getUri()->withUserInfo('');
195
- $modify['set_headers']['Referer'] = (string) $uri;
196
- } else {
197
- $modify['remove_headers'][] = 'Referer';
198
- }
199
-
200
- // Remove Authorization header if host is different.
201
- if ($request->getUri()->getHost() !== $modify['uri']->getHost()) {
202
- $modify['remove_headers'][] = 'Authorization';
203
- }
204
-
205
- return Psr7\modify_request($request, $modify);
206
- }
207
-
208
- /**
209
- * Set the appropriate URL on the request based on the location header
210
- */
211
- private function redirectUri(
212
- RequestInterface $request,
213
- ResponseInterface $response,
214
- array $protocols
215
- ): UriInterface {
216
- $location = Psr7\UriResolver::resolve(
217
- $request->getUri(),
218
- new Psr7\Uri($response->getHeaderLine('Location'))
219
- );
220
-
221
- // Ensure that the redirect URI is allowed based on the protocols.
222
- if (!\in_array($location->getScheme(), $protocols)) {
223
- throw new BadResponseException(
224
- \sprintf(
225
- 'Redirect URI, %s, does not use one of the allowed redirect protocols: %s',
226
- $location,
227
- \implode(', ', $protocols)
228
- ),
229
- $request,
230
- $response
231
- );
232
- }
233
-
234
- return $location;
235
- }
236
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/RequestOptions.php DELETED
@@ -1,264 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- /**
6
- * This class contains a list of built-in Guzzle request options.
7
- *
8
- * More documentation for each option can be found at http://guzzlephp.org/.
9
- *
10
- * @link http://docs.guzzlephp.org/en/v6/request-options.html
11
- */
12
- final class RequestOptions
13
- {
14
- /**
15
- * allow_redirects: (bool|array) Controls redirect behavior. Pass false
16
- * to disable redirects, pass true to enable redirects, pass an
17
- * associative to provide custom redirect settings. Defaults to "false".
18
- * This option only works if your handler has the RedirectMiddleware. When
19
- * passing an associative array, you can provide the following key value
20
- * pairs:
21
- *
22
- * - max: (int, default=5) maximum number of allowed redirects.
23
- * - strict: (bool, default=false) Set to true to use strict redirects
24
- * meaning redirect POST requests with POST requests vs. doing what most
25
- * browsers do which is redirect POST requests with GET requests
26
- * - referer: (bool, default=false) Set to true to enable the Referer
27
- * header.
28
- * - protocols: (array, default=['http', 'https']) Allowed redirect
29
- * protocols.
30
- * - on_redirect: (callable) PHP callable that is invoked when a redirect
31
- * is encountered. The callable is invoked with the request, the redirect
32
- * response that was received, and the effective URI. Any return value
33
- * from the on_redirect function is ignored.
34
- */
35
- public const ALLOW_REDIRECTS = 'allow_redirects';
36
-
37
- /**
38
- * auth: (array) Pass an array of HTTP authentication parameters to use
39
- * with the request. The array must contain the username in index [0],
40
- * the password in index [1], and you can optionally provide a built-in
41
- * authentication type in index [2]. Pass null to disable authentication
42
- * for a request.
43
- */
44
- public const AUTH = 'auth';
45
-
46
- /**
47
- * body: (resource|string|null|int|float|StreamInterface|callable|\Iterator)
48
- * Body to send in the request.
49
- */
50
- public const BODY = 'body';
51
-
52
- /**
53
- * cert: (string|array) Set to a string to specify the path to a file
54
- * containing a PEM formatted SSL client side certificate. If a password
55
- * is required, then set cert to an array containing the path to the PEM
56
- * file in the first array element followed by the certificate password
57
- * in the second array element.
58
- */
59
- public const CERT = 'cert';
60
-
61
- /**
62
- * cookies: (bool|GuzzleHttp\Cookie\CookieJarInterface, default=false)
63
- * Specifies whether or not cookies are used in a request or what cookie
64
- * jar to use or what cookies to send. This option only works if your
65
- * handler has the `cookie` middleware. Valid values are `false` and
66
- * an instance of {@see \GuzzleHttp\Cookie\CookieJarInterface}.
67
- */
68
- public const COOKIES = 'cookies';
69
-
70
- /**
71
- * connect_timeout: (float, default=0) Float describing the number of
72
- * seconds to wait while trying to connect to a server. Use 0 to wait
73
- * indefinitely (the default behavior).
74
- */
75
- public const CONNECT_TIMEOUT = 'connect_timeout';
76
-
77
- /**
78
- * debug: (bool|resource) Set to true or set to a PHP stream returned by
79
- * fopen() enable debug output with the HTTP handler used to send a
80
- * request.
81
- */
82
- public const DEBUG = 'debug';
83
-
84
- /**
85
- * decode_content: (bool, default=true) Specify whether or not
86
- * Content-Encoding responses (gzip, deflate, etc.) are automatically
87
- * decoded.
88
- */
89
- public const DECODE_CONTENT = 'decode_content';
90
-
91
- /**
92
- * delay: (int) The amount of time to delay before sending in milliseconds.
93
- */
94
- public const DELAY = 'delay';
95
-
96
- /**
97
- * expect: (bool|integer) Controls the behavior of the
98
- * "Expect: 100-Continue" header.
99
- *
100
- * Set to `true` to enable the "Expect: 100-Continue" header for all
101
- * requests that sends a body. Set to `false` to disable the
102
- * "Expect: 100-Continue" header for all requests. Set to a number so that
103
- * the size of the payload must be greater than the number in order to send
104
- * the Expect header. Setting to a number will send the Expect header for
105
- * all requests in which the size of the payload cannot be determined or
106
- * where the body is not rewindable.
107
- *
108
- * By default, Guzzle will add the "Expect: 100-Continue" header when the
109
- * size of the body of a request is greater than 1 MB and a request is
110
- * using HTTP/1.1.
111
- */
112
- public const EXPECT = 'expect';
113
-
114
- /**
115
- * form_params: (array) Associative array of form field names to values
116
- * where each value is a string or array of strings. Sets the Content-Type
117
- * header to application/x-www-form-urlencoded when no Content-Type header
118
- * is already present.
119
- */
120
- public const FORM_PARAMS = 'form_params';
121
-
122
- /**
123
- * headers: (array) Associative array of HTTP headers. Each value MUST be
124
- * a string or array of strings.
125
- */
126
- public const HEADERS = 'headers';
127
-
128
- /**
129
- * http_errors: (bool, default=true) Set to false to disable exceptions
130
- * when a non- successful HTTP response is received. By default,
131
- * exceptions will be thrown for 4xx and 5xx responses. This option only
132
- * works if your handler has the `httpErrors` middleware.
133
- */
134
- public const HTTP_ERRORS = 'http_errors';
135
-
136
- /**
137
- * idn: (bool|int, default=true) A combination of IDNA_* constants for
138
- * idn_to_ascii() PHP's function (see "options" parameter). Set to false to
139
- * disable IDN support completely, or to true to use the default
140
- * configuration (IDNA_DEFAULT constant).
141
- */
142
- public const IDN_CONVERSION = 'idn_conversion';
143
-
144
- /**
145
- * json: (mixed) Adds JSON data to a request. The provided value is JSON
146
- * encoded and a Content-Type header of application/json will be added to
147
- * the request if no Content-Type header is already present.
148
- */
149
- public const JSON = 'json';
150
-
151
- /**
152
- * multipart: (array) Array of associative arrays, each containing a
153
- * required "name" key mapping to the form field, name, a required
154
- * "contents" key mapping to a StreamInterface|resource|string, an
155
- * optional "headers" associative array of custom headers, and an
156
- * optional "filename" key mapping to a string to send as the filename in
157
- * the part. If no "filename" key is present, then no "filename" attribute
158
- * will be added to the part.
159
- */
160
- public const MULTIPART = 'multipart';
161
-
162
- /**
163
- * on_headers: (callable) A callable that is invoked when the HTTP headers
164
- * of the response have been received but the body has not yet begun to
165
- * download.
166
- */
167
- public const ON_HEADERS = 'on_headers';
168
-
169
- /**
170
- * on_stats: (callable) allows you to get access to transfer statistics of
171
- * a request and access the lower level transfer details of the handler
172
- * associated with your client. ``on_stats`` is a callable that is invoked
173
- * when a handler has finished sending a request. The callback is invoked
174
- * with transfer statistics about the request, the response received, or
175
- * the error encountered. Included in the data is the total amount of time
176
- * taken to send the request.
177
- */
178
- public const ON_STATS = 'on_stats';
179
-
180
- /**
181
- * progress: (callable) Defines a function to invoke when transfer
182
- * progress is made. The function accepts the following positional
183
- * arguments: the total number of bytes expected to be downloaded, the
184
- * number of bytes downloaded so far, the number of bytes expected to be
185
- * uploaded, the number of bytes uploaded so far.
186
- */
187
- public const PROGRESS = 'progress';
188
-
189
- /**
190
- * proxy: (string|array) Pass a string to specify an HTTP proxy, or an
191
- * array to specify different proxies for different protocols (where the
192
- * key is the protocol and the value is a proxy string).
193
- */
194
- public const PROXY = 'proxy';
195
-
196
- /**
197
- * query: (array|string) Associative array of query string values to add
198
- * to the request. This option uses PHP's http_build_query() to create
199
- * the string representation. Pass a string value if you need more
200
- * control than what this method provides
201
- */
202
- public const QUERY = 'query';
203
-
204
- /**
205
- * sink: (resource|string|StreamInterface) Where the data of the
206
- * response is written to. Defaults to a PHP temp stream. Providing a
207
- * string will write data to a file by the given name.
208
- */
209
- public const SINK = 'sink';
210
-
211
- /**
212
- * synchronous: (bool) Set to true to inform HTTP handlers that you intend
213
- * on waiting on the response. This can be useful for optimizations. Note
214
- * that a promise is still returned if you are using one of the async
215
- * client methods.
216
- */
217
- public const SYNCHRONOUS = 'synchronous';
218
-
219
- /**
220
- * ssl_key: (array|string) Specify the path to a file containing a private
221
- * SSL key in PEM format. If a password is required, then set to an array
222
- * containing the path to the SSL key in the first array element followed
223
- * by the password required for the certificate in the second element.
224
- */
225
- public const SSL_KEY = 'ssl_key';
226
-
227
- /**
228
- * stream: Set to true to attempt to stream a response rather than
229
- * download it all up-front.
230
- */
231
- public const STREAM = 'stream';
232
-
233
- /**
234
- * verify: (bool|string, default=true) Describes the SSL certificate
235
- * verification behavior of a request. Set to true to enable SSL
236
- * certificate verification using the system CA bundle when available
237
- * (the default). Set to false to disable certificate verification (this
238
- * is insecure!). Set to a string to provide the path to a CA bundle on
239
- * disk to enable verification using a custom certificate.
240
- */
241
- public const VERIFY = 'verify';
242
-
243
- /**
244
- * timeout: (float, default=0) Float describing the timeout of the
245
- * request in seconds. Use 0 to wait indefinitely (the default behavior).
246
- */
247
- public const TIMEOUT = 'timeout';
248
-
249
- /**
250
- * read_timeout: (float, default=default_socket_timeout ini setting) Float describing
251
- * the body read timeout, for stream requests.
252
- */
253
- public const READ_TIMEOUT = 'read_timeout';
254
-
255
- /**
256
- * version: (float) Specifies the HTTP protocol version to attempt to use.
257
- */
258
- public const VERSION = 'version';
259
-
260
- /**
261
- * force_ip_resolve: (bool) Force client to use only ipv4 or ipv6 protocol
262
- */
263
- public const FORCE_IP_RESOLVE = 'force_ip_resolve';
264
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/RetryMiddleware.php DELETED
@@ -1,118 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Promise\PromiseInterface;
6
- use Psr\Http\Message\RequestInterface;
7
- use Psr\Http\Message\ResponseInterface;
8
-
9
- /**
10
- * Middleware that retries requests based on the boolean result of
11
- * invoking the provided "decider" function.
12
- *
13
- * @final
14
- */
15
- class RetryMiddleware
16
- {
17
- /**
18
- * @var callable(RequestInterface, array): PromiseInterface
19
- */
20
- private $nextHandler;
21
-
22
- /**
23
- * @var callable
24
- */
25
- private $decider;
26
-
27
- /**
28
- * @var callable(int)
29
- */
30
- private $delay;
31
-
32
- /**
33
- * @param callable $decider Function that accepts the number of retries,
34
- * a request, [response], and [exception] and
35
- * returns true if the request is to be
36
- * retried.
37
- * @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke.
38
- * @param null|callable(int): int $delay Function that accepts the number of retries
39
- * and returns the number of
40
- * milliseconds to delay.
41
- */
42
- public function __construct(
43
- callable $decider,
44
- callable $nextHandler,
45
- callable $delay = null
46
- ) {
47
- $this->decider = $decider;
48
- $this->nextHandler = $nextHandler;
49
- $this->delay = $delay ?: __CLASS__ . '::exponentialDelay';
50
- }
51
-
52
- /**
53
- * Default exponential backoff delay function.
54
- *
55
- * @return int milliseconds.
56
- */
57
- public static function exponentialDelay(int $retries): int
58
- {
59
- return (int) \pow(2, $retries - 1) * 1000;
60
- }
61
-
62
- public function __invoke(RequestInterface $request, array $options): PromiseInterface
63
- {
64
- if (!isset($options['retries'])) {
65
- $options['retries'] = 0;
66
- }
67
-
68
- $fn = $this->nextHandler;
69
- return $fn($request, $options)
70
- ->then(
71
- $this->onFulfilled($request, $options),
72
- $this->onRejected($request, $options)
73
- );
74
- }
75
-
76
- /**
77
- * Execute fulfilled closure
78
- */
79
- private function onFulfilled(RequestInterface $request, array $options): callable
80
- {
81
- return function ($value) use ($request, $options) {
82
- if (!($this->decider)(
83
- $options['retries'],
84
- $request,
85
- $value,
86
- null
87
- )) {
88
- return $value;
89
- }
90
- return $this->doRetry($request, $options, $value);
91
- };
92
- }
93
-
94
- /**
95
- * Execute rejected closure
96
- */
97
- private function onRejected(RequestInterface $req, array $options): callable
98
- {
99
- return function ($reason) use ($req, $options) {
100
- if (!($this->decider)(
101
- $options['retries'],
102
- $req,
103
- null,
104
- $reason
105
- )) {
106
- return \GuzzleHttp\Promise\rejection_for($reason);
107
- }
108
- return $this->doRetry($req, $options);
109
- };
110
- }
111
-
112
- private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null): PromiseInterface
113
- {
114
- $options['delay'] = ($this->delay)(++$options['retries'], $response);
115
-
116
- return $this($request, $options);
117
- }
118
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/TransferStats.php DELETED
@@ -1,135 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use Psr\Http\Message\RequestInterface;
6
- use Psr\Http\Message\ResponseInterface;
7
- use Psr\Http\Message\UriInterface;
8
-
9
- /**
10
- * Represents data at the point after it was transferred either successfully
11
- * or after a network error.
12
- */
13
- final class TransferStats
14
- {
15
- /**
16
- * @var RequestInterface
17
- */
18
- private $request;
19
-
20
- /**
21
- * @var ResponseInterface|null
22
- */
23
- private $response;
24
-
25
- /**
26
- * @var float|null
27
- */
28
- private $transferTime;
29
-
30
- /**
31
- * @var array
32
- */
33
- private $handlerStats;
34
-
35
- /**
36
- * @var mixed|null
37
- */
38
- private $handlerErrorData;
39
-
40
- /**
41
- * @param RequestInterface $request Request that was sent.
42
- * @param ResponseInterface|null $response Response received (if any)
43
- * @param float|null $transferTime Total handler transfer time.
44
- * @param mixed $handlerErrorData Handler error data.
45
- * @param array $handlerStats Handler specific stats.
46
- */
47
- public function __construct(
48
- RequestInterface $request,
49
- ?ResponseInterface $response = null,
50
- ?float $transferTime = null,
51
- $handlerErrorData = null,
52
- array $handlerStats = []
53
- ) {
54
- $this->request = $request;
55
- $this->response = $response;
56
- $this->transferTime = $transferTime;
57
- $this->handlerErrorData = $handlerErrorData;
58
- $this->handlerStats = $handlerStats;
59
- }
60
-
61
- public function getRequest(): RequestInterface
62
- {
63
- return $this->request;
64
- }
65
-
66
- /**
67
- * Returns the response that was received (if any).
68
- */
69
- public function getResponse(): ?ResponseInterface
70
- {
71
- return $this->response;
72
- }
73
-
74
- /**
75
- * Returns true if a response was received.
76
- */
77
- public function hasResponse(): bool
78
- {
79
- return $this->response !== null;
80
- }
81
-
82
- /**
83
- * Gets handler specific error data.
84
- *
85
- * This might be an exception, a integer representing an error code, or
86
- * anything else. Relying on this value assumes that you know what handler
87
- * you are using.
88
- *
89
- * @return mixed
90
- */
91
- public function getHandlerErrorData()
92
- {
93
- return $this->handlerErrorData;
94
- }
95
-
96
- /**
97
- * Get the effective URI the request was sent to.
98
- */
99
- public function getEffectiveUri(): UriInterface
100
- {
101
- return $this->request->getUri();
102
- }
103
-
104
- /**
105
- * Get the estimated time the request was being transferred by the handler.
106
- *
107
- * @return float|null Time in seconds.
108
- */
109
- public function getTransferTime(): ?float
110
- {
111
- return $this->transferTime;
112
- }
113
-
114
- /**
115
- * Gets an array of all of the handler specific transfer data.
116
- */
117
- public function getHandlerStats(): array
118
- {
119
- return $this->handlerStats;
120
- }
121
-
122
- /**
123
- * Get a specific handler statistic from the handler by name.
124
- *
125
- * @param string $stat Handler specific transfer stat to retrieve.
126
- *
127
- * @return mixed|null
128
- */
129
- public function getHandlerStat(string $stat)
130
- {
131
- return isset($this->handlerStats[$stat])
132
- ? $this->handlerStats[$stat]
133
- : null;
134
- }
135
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/guzzlehttp/guzzle/src/Utils.php DELETED
@@ -1,394 +0,0 @@
1
- <?php
2
-
3
- namespace GuzzleHttp;
4
-
5
- use GuzzleHttp\Exception\InvalidArgumentException;
6
- use GuzzleHttp\Handler\CurlHandler;
7
- use GuzzleHttp\Handler\CurlMultiHandler;
8
- use GuzzleHttp\Handler\Proxy;
9
- use GuzzleHttp\Handler\StreamHandler;
10
- use Psr\Http\Message\UriInterface;
11
-
12
- final class Utils
13
- {
14
- /**
15
- * Debug function used to describe the provided value type and class.
16
- *
17
- * @param mixed $input
18
- *
19
- * @return string Returns a string containing the type of the variable and
20
- * if a class is provided, the class name.
21
- */
22
- public static function describeType($input): string
23
- {
24
- switch (\gettype($input)) {
25
- case 'object':
26
- return 'object(' . \get_class($input) . ')';
27
- case 'array':
28
- return 'array(' . \count($input) . ')';
29
- default:
30
- \ob_start();
31
- \var_dump($input);
32
- // normalize float vs double
33
- /** @var string $varDumpContent */
34
- $varDumpContent = \ob_get_clean();
35
-
36
- return \str_replace('double(', 'float(', \rtrim($varDumpContent));
37
- }
38
- }
39
-
40
- /**
41
- * Parses an array of header lines into an associative array of headers.
42
- *
43
- * @param iterable $lines Header lines array of strings in the following
44
- * format: "Name: Value"
45
- */
46
- public static function headersFromLines(iterable $lines): array
47
- {
48
- $headers = [];
49
-
50
- foreach ($lines as $line) {
51
- $parts = \explode(':', $line, 2);
52
- $headers[\trim($parts[0])][] = isset($parts[1])
53
- ? \trim($parts[1])
54
- : null;
55
- }
56
-
57
- return $headers;
58
- }
59
-
60
- /**
61
- * Returns a debug stream based on the provided variable.
62
- *
63
- * @param mixed $value Optional value
64
- *
65
- * @return resource
66
- */
67
- public static function debugResource($value = null)
68
- {
69
- if (\is_resource($value)) {
70
- return $value;
71
- }
72
- if (\defined('STDOUT')) {
73
- return \STDOUT;
74
- }
75
-
76
- $resource = \fopen('php://output', 'w');
77
- if (false === $resource) {
78
- throw new \RuntimeException('Can not open php output for writing to debug the resource.');
79
- }
80
-
81
- return $resource;
82
- }
83
-
84
- /**
85
- * Chooses and creates a default handler to use based on the environment.
86
- *
87
- * The returned handler is not wrapped by any default middlewares.
88
- *
89
- * @throws \RuntimeException if no viable Handler is available.
90
- *
91
- * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system.
92
- */
93
- public static function chooseHandler(): callable
94
- {
95
- $handler = null;
96
- if (\function_exists('curl_multi_exec') && \function_exists('curl_exec')) {
97
- $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler());
98
- } elseif (\function_exists('curl_exec')) {
99
- $handler = new CurlHandler();
100
- } elseif (\function_exists('curl_multi_exec')) {
101
- $handler = new CurlMultiHandler();
102
- }
103
-
104
- if (\ini_get('allow_url_fopen')) {
105
- $handler = $handler
106
- ? Proxy::wrapStreaming($handler, new StreamHandler())
107
- : new StreamHandler();
108
- } elseif (!$handler) {
109
- throw new \RuntimeException('GuzzleHttp requires cURL, the '
110
- . 'allow_url_fopen ini setting, or a custom HTTP handler.');
111
- }
112
-
113
- return $handler;
114
- }
115
-
116
- /**
117
- * Get the default User-Agent string to use with Guzzle.
118
- */
119
- public static function defaultUserAgent(): string
120
- {
121
- return sprintf('GuzzleHttp/%d', ClientInterface::MAJOR_VERSION);
122
- }
123
-
124
- /**
125
- * Returns the default cacert bundle for the current system.
126
- *
127
- * First, the openssl.cafile and curl.cainfo php.ini settings are checked.
128
- * If those settings are not configured, then the common locations for
129
- * bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X
130
- * and Windows are checked. If any of these file locations are found on
131
- * disk, they will be utilized.
132
- *
133
- * Note: the result of this function is cached for subsequent calls.
134
- *
135
- * @throws \RuntimeException if no bundle can be found.
136
- *
137
- * @deprecated Utils::defaultCaBundle will be removed in guzzlehttp/guzzle:8.0. This method is not needed in PHP 5.6+.
138
- */
139
- public static function defaultCaBundle(): string
140
- {
141
- static $cached = null;
142
- static $cafiles = [
143
- // Red Hat, CentOS, Fedora (provided by the ca-certificates package)
144
- '/etc/pki/tls/certs/ca-bundle.crt',
145
- // Ubuntu, Debian (provided by the ca-certificates package)
146
- '/etc/ssl/certs/ca-certificates.crt',
147
- // FreeBSD (provided by the ca_root_nss package)
148
- '/usr/local/share/certs/ca-root-nss.crt',
149
- // SLES 12 (provided by the ca-certificates package)
150
- '/var/lib/ca-certificates/ca-bundle.pem',
151
- // OS X provided by homebrew (using the default path)
152
- '/usr/local/etc/openssl/cert.pem',
153
- // Google app engine
154
- '/etc/ca-certificates.crt',
155
- // Windows?
156
- 'C:\\windows\\system32\\curl-ca-bundle.crt',
157
- 'C:\\windows\\curl-ca-bundle.crt',
158
- ];
159
-
160
- if ($cached) {
161
- return $cached;
162
- }
163
-
164
- if ($ca = \ini_get('openssl.cafile')) {
165
- return $cached = $ca;
166
- }
167
-
168
- if ($ca = \ini_get('curl.cainfo')) {
169
- return $cached = $ca;
170
- }
171
-
172
- foreach ($cafiles as $filename) {
173
- if (\file_exists($filename)) {
174
- return $cached = $filename;
175
- }
176
- }
177
-
178
- throw new \RuntimeException(
179
- <<< EOT
180
- No system CA bundle could be found in any of the the common system locations.
181
- PHP versions earlier than 5.6 are not properly configured to use the system's
182
- CA bundle by default. In order to verify peer certificates, you will need to
183
- supply the path on disk to a certificate bundle to the 'verify' request
184
- option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not
185
- need a specific certificate bundle, then Mozilla provides a commonly used CA
186
- bundle which can be downloaded here (provided by the maintainer of cURL):
187
- https://curl.haxx.se/ca/cacert.pem. Once
188
- you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP
189
- ini setting to point to the path to the file, allowing you to omit the 'verify'
190
- request option. See https://curl.haxx.se/docs/sslcerts.html for more
191
- information.
192
- EOT
193
- );
194
- }
195
-
196
- /**
197
- * Creates an associative array of lowercase header names to the actual
198
- * header casing.
199
- */
200
- public static function normalizeHeaderKeys(array $headers): array
201
- {
202
- $result = [];
203
- foreach (\array_keys($headers) as $key) {
204
- $result[\strtolower($key)] = $key;
205
- }
206
-
207
- return $result;
208
- }
209
-
210
- /**
211
- * Returns true if the provided host matches any of the no proxy areas.
212
- *
213
- * This method will strip a port from the host if it is present. Each pattern
214
- * can be matched with an exact match (e.g., "foo.com" == "foo.com") or a
215
- * partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" ==
216
- * "baz.foo.com", but ".foo.com" != "foo.com").
217
- *
218
- * Areas are matched in the following cases:
219
- * 1. "*" (without quotes) always matches any hosts.
220
- * 2. An exact match.
221
- * 3. The area starts with "." and the area is the last part of the host. e.g.
222
- * '.mit.edu' will match any host that ends with '.mit.edu'.
223
- *
224
- * @param string $host Host to check against the patterns.
225
- * @param string[] $noProxyArray An array of host patterns.
226
- *
227
- * @throws InvalidArgumentException
228
- */
229
- public static function isHostInNoProxy(string $host, array $noProxyArray): bool
230
- {
231
- if (\strlen($host) === 0) {
232
- throw new InvalidArgumentException('Empty host provided');
233
- }
234
-
235
- // Strip port if present.
236
- if (\strpos($host, ':')) {
237
- /** @var string[] $hostParts will never be false