Payment Plugins for Stripe WooCommerce - Version 3.3.11

Version Description

  • Updated - Changed plugin name to "Payment Plugins for Stripe WooCommerce" at the request of Wordpress.org Plugin Review Team.
  • Updated - If user is logged out and guest checkout is disabled, show save card checkbox if enabled.
  • Added - Filter "wc_stripe_api_request_error_message" for more control over custom error messages.
  • Added - Filter "wc_stripe_pay_order_statuses" so merchants can control when the Pay for Order button appears on the order details page.
Download this release

Release Info

Developer mr.clayton
Plugin Icon wp plugin Payment Plugins for Stripe WooCommerce
Version 3.3.11
Comparing to
See all releases

Code changes from version 3.3.10 to 3.3.11

i18n/languages/woo-stripe-payment.pot CHANGED
@@ -1,21 +1,21 @@
1
  # Copyright (C) 2021 Payment Plugins, support@paymentplugins.com
2
- # This file is distributed under the same license as the Stripe For WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Stripe For WooCommerce 3.3.10\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-09-18T19:38:05+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
16
 
17
  #. Plugin Name of the plugin
18
- msgid "Stripe For WooCommerce"
19
  msgstr ""
20
 
21
  #. Plugin URI of the plugin
@@ -337,7 +337,7 @@ msgstr ""
337
  msgid "Stripe Settings"
338
  msgstr ""
339
 
340
- #: includes/admin/meta-boxes/class-wc-stripe-admin-order-metaboxes.php:80
341
  msgid "You must create the order before payment can be processed."
342
  msgstr ""
343
 
@@ -712,8 +712,8 @@ msgstr ""
712
  msgid "%1$snote:%2$s payment methods will be deleted in Stripe if you use the delete action."
713
  msgstr ""
714
 
715
- #: includes/class-wc-stripe-customer-manager.php:39
716
- #: includes/class-wc-stripe-customer-manager.php:48
717
  msgid "Error saving customer. Reason: %s"
718
  msgstr ""
719
 
@@ -2167,6 +2167,10 @@ msgstr ""
2167
  msgid "The IBAN you entered is incomplete."
2168
  msgstr ""
2169
 
 
 
 
 
2170
  #: includes/wc-stripe-webhook-functions.php:100
2171
  msgid "Charge.succeeded webhook received. Payment has been completed."
2172
  msgstr ""
@@ -2176,7 +2180,7 @@ msgid "payment_intent.succeeded webhook received. Payment has been completed."
2176
  msgstr ""
2177
 
2178
  #: packages/blocks/src/Payments/CreditCardPayment.php:27
2179
- #: templates/checkout/credit-card.php:21
2180
  msgid "Save Card"
2181
  msgstr ""
2182
 
1
  # Copyright (C) 2021 Payment Plugins, support@paymentplugins.com
2
+ # This file is distributed under the same license as the Payment Plugins for Stripe WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Payment Plugins for Stripe WooCommerce 3.3.11\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-10-11T17:00:57+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
16
 
17
  #. Plugin Name of the plugin
18
+ msgid "Payment Plugins for Stripe WooCommerce"
19
  msgstr ""
20
 
21
  #. Plugin URI of the plugin
337
  msgid "Stripe Settings"
338
  msgstr ""
339
 
340
+ #: includes/admin/meta-boxes/class-wc-stripe-admin-order-metaboxes.php:83
341
  msgid "You must create the order before payment can be processed."
342
  msgstr ""
343
 
712
  msgid "%1$snote:%2$s payment methods will be deleted in Stripe if you use the delete action."
713
  msgstr ""
714
 
715
+ #: includes/class-wc-stripe-customer-manager.php:41
716
+ #: includes/class-wc-stripe-customer-manager.php:50
717
  msgid "Error saving customer. Reason: %s"
718
  msgstr ""
719
 
2167
  msgid "The IBAN you entered is incomplete."
2168
  msgstr ""
2169
 
2170
+ #: includes/wc-stripe-functions.php:1104
2171
+ msgid "Your card was declined. Your request was in test mode, but you used a real credit card. Only test cards can be used in test mode."
2172
+ msgstr ""
2173
+
2174
  #: includes/wc-stripe-webhook-functions.php:100
2175
  msgid "Charge.succeeded webhook received. Payment has been completed."
2176
  msgstr ""
2180
  msgstr ""
2181
 
2182
  #: packages/blocks/src/Payments/CreditCardPayment.php:27
2183
+ #: templates/checkout/credit-card.php:22
2184
  msgid "Save Card"
2185
  msgstr ""
2186
 
includes/admin/meta-boxes/class-wc-stripe-admin-order-metaboxes.php CHANGED
@@ -55,7 +55,10 @@ class WC_Stripe_Admin_Order_Metaboxes {
55
  * @param WC_Order $order
56
  */
57
  public static function pay_order_section( $order ) {
58
- if ( $order->get_type() === 'shop_order' && $order->has_status( array( 'pending', 'auto-draft' ) ) ) {
 
 
 
59
  include 'views/html-order-pay.php';
60
  $payment_methods = array();
61
  foreach ( WC()->payment_gateways()->payment_gateways() as $gateway ) {
55
  * @param WC_Order $order
56
  */
57
  public static function pay_order_section( $order ) {
58
+ if ( $order->get_type() === 'shop_order' && $order->has_status( apply_filters( 'wc_stripe_pay_order_statuses', array(
59
+ 'pending',
60
+ 'auto-draft'
61
+ ), $order ) ) ) {
62
  include 'views/html-order-pay.php';
63
  $payment_methods = array();
64
  foreach ( WC()->payment_gateways()->payment_gateways() as $gateway ) {
includes/class-stripe.php CHANGED
@@ -25,7 +25,7 @@ class WC_Stripe_Manager {
25
  *
26
  * @var string
27
  */
28
- public $version = '3.3.10';
29
 
30
  /**
31
  *
25
  *
26
  * @var string
27
  */
28
+ public $version = '3.3.11';
29
 
30
  /**
31
  *
includes/class-wc-stripe-customer-manager.php CHANGED
@@ -36,7 +36,9 @@ class WC_Stripe_Customer_Manager {
36
  if ( $this->should_update_customer( $customer ) ) {
37
  $result = $this->update_customer( $customer );
38
  if ( is_wp_error( $result ) ) {
39
- wc_add_notice( __( 'Error saving customer. Reason: %s', 'woo-stripe-payment' ), $result->get_error_message() );
 
 
40
  }
41
  }
42
  } else {
@@ -45,7 +47,7 @@ class WC_Stripe_Customer_Manager {
45
  if ( ! is_wp_error( $response ) ) {
46
  wc_stripe_save_customer( $response->id, $customer->get_id() );
47
  } else {
48
- wc_add_notice( __( 'Error saving customer. Reason: %s', 'woo-stripe-payment' ), $response->get_error_message() );
49
  }
50
  }
51
  }
@@ -129,24 +131,32 @@ class WC_Stripe_Customer_Manager {
129
  'customer' => $customer_id,
130
  'type' => 'card',
131
  ) );
132
-
133
  if ( ! is_wp_error( $payment_methods ) ) {
134
  foreach ( $payment_methods->data as $payment_method ) {
 
 
 
135
  if ( ! WC_Payment_Token_Stripe::token_exists( $payment_method->id, $user_id ) ) {
136
  $payment_gateways = WC()->payment_gateways()->payment_gateways();
137
  $gateway_id = null;
138
-
139
- if ( strstr( $payment_method->id, 'pm_' ) || strstr( $payment_method->id, 'src_' ) ) {
140
- $gateway_id = 'stripe_cc';
141
- } elseif ( strstr( $payment_method->id, 'card_' ) ) {
142
- $gateway_id = 'stripe_googlepay';
 
 
 
 
 
143
  }
144
  /**
145
  *
146
  * @var WC_Payment_Gateway_Stripe_CC $payment_gateway
147
- */
148
- $payment_gateway = $payment_gateways[ $gateway_id ];
149
- $token = $payment_gateway->get_payment_token( $payment_method->id, $payment_method );
 
150
  $token->set_environment( $payment_method->livemode ? 'live' : 'test' );
151
  $token->set_user_id( $user_id );
152
  $token->set_customer_id( $customer_id );
36
  if ( $this->should_update_customer( $customer ) ) {
37
  $result = $this->update_customer( $customer );
38
  if ( is_wp_error( $result ) ) {
39
+ // add info to log. This error isn't added to wc_add_notice because we don't want a user update to
40
+ // interfere with payment being processed.
41
+ wc_stripe_log_error( sprintf( __( 'Error saving customer. Reason: %s', 'woo-stripe-payment' ), $result->get_error_message() ) );
42
  }
43
  }
44
  } else {
47
  if ( ! is_wp_error( $response ) ) {
48
  wc_stripe_save_customer( $response->id, $customer->get_id() );
49
  } else {
50
+ wc_add_notice( sprintf( __( 'Error saving customer. Reason: %s', 'woo-stripe-payment' ), $response->get_error_message() ), 'error' );
51
  }
52
  }
53
  }
131
  'customer' => $customer_id,
132
  'type' => 'card',
133
  ) );
 
134
  if ( ! is_wp_error( $payment_methods ) ) {
135
  foreach ( $payment_methods->data as $payment_method ) {
136
+ /**
137
+ * @var \Stripe\PaymentMethod $payment_method
138
+ */
139
  if ( ! WC_Payment_Token_Stripe::token_exists( $payment_method->id, $user_id ) ) {
140
  $payment_gateways = WC()->payment_gateways()->payment_gateways();
141
  $gateway_id = null;
142
+ $gateway_id = 'stripe_cc';
143
+ if ( isset( $payment_method->card->wallet->type ) ) {
144
+ switch ( $payment_method->card->wallet->type ) {
145
+ case 'google_pay':
146
+ $gateway_id = 'stripe_googlepay';
147
+ break;
148
+ case 'apple_pay':
149
+ $gateway_id = 'stripe_applepay';
150
+ break;
151
+ }
152
  }
153
  /**
154
  *
155
  * @var WC_Payment_Gateway_Stripe_CC $payment_gateway
156
+ */ {
157
+ $payment_gateway = $payment_gateways[ $gateway_id ];
158
+ }
159
+ $token = $payment_gateway->get_payment_token( $payment_method->id, $payment_method );
160
  $token->set_environment( $payment_method->livemode ? 'live' : 'test' );
161
  $token->set_user_id( $user_id );
162
  $token->set_customer_id( $customer_id );
includes/class-wc-stripe-gateway.php CHANGED
@@ -406,26 +406,47 @@ class WC_Stripe_Gateway {
406
  /**
407
  *
408
  * @param mixed $err
 
 
409
  */
410
  private function get_error_message( $err ) {
 
411
  if ( is_a( $err, '\Stripe\Exception\ApiErrorException' ) ) {
412
  $err = $err->getError();
413
  }
414
  if ( is_array( $err ) || $err instanceof \Stripe\ErrorObject ) {
415
  $this->messages = ! $this->messages ? wc_stripe_get_error_messages() : $this->messages;
416
- if ( isset( $err['decline_code'] ) && isset( $this->messages[ $err['decline_code'] ] ) ) {
417
- return $this->messages[ $err['decline_code'] ];
 
 
 
 
 
 
418
  }
419
- if ( isset( $err['code'] ) && isset( $this->messages[ $err['code'] ] ) ) {
420
- return $this->messages[ $err['code'] ];
 
 
 
 
421
  }
422
- if ( isset( $err['message'] ) ) {
423
- return $err['message'];
424
  }
425
  }
426
  if ( is_string( $err ) ) {
427
- return $err;
428
  }
 
 
 
 
 
 
 
 
429
  }
430
 
431
  /**
406
  /**
407
  *
408
  * @param mixed $err
409
+ *
410
+ * @return string
411
  */
412
  private function get_error_message( $err ) {
413
+ $message = '';
414
  if ( is_a( $err, '\Stripe\Exception\ApiErrorException' ) ) {
415
  $err = $err->getError();
416
  }
417
  if ( is_array( $err ) || $err instanceof \Stripe\ErrorObject ) {
418
  $this->messages = ! $this->messages ? wc_stripe_get_error_messages() : $this->messages;
419
+ $keys = array();
420
+ if ( isset( $err['code'] ) ) {
421
+ $keys[] = $err['code'];
422
+ if ( $err['code'] === 'card_declined' ) {
423
+ if ( isset( $err['decline_code'] ) ) {
424
+ $keys[] = $err['decline_code'];
425
+ }
426
+ }
427
  }
428
+ while ( ! empty( $keys ) ) {
429
+ $key = array_pop( $keys );
430
+ if ( isset( $this->messages[ $key ] ) ) {
431
+ $message = $this->messages[ $key ];
432
+ break;
433
+ }
434
  }
435
+ if ( empty( $message ) && isset( $err['message'] ) ) {
436
+ $message = $err['message'];
437
  }
438
  }
439
  if ( is_string( $err ) ) {
440
+ $message = $err;
441
  }
442
+
443
+ /**
444
+ * @param string $message
445
+ * @param mixed $err
446
+ *
447
+ * @since 3.3.11
448
+ */
449
+ return apply_filters( 'wc_stripe_api_request_error_message', $message, $err );
450
  }
451
 
452
  /**
includes/wc-stripe-functions.php CHANGED
@@ -1100,7 +1100,8 @@ function wc_stripe_get_error_messages() {
1100
  'empty_element_sepa_debit' => __( 'Please enter your IBAN before proceeding.', 'woo-stripe-payment' ),
1101
  'empty_element_ideal' => __( 'Please select a bank before proceeding', 'woo-stripe-payment' ),
1102
  'incomplete_iban' => __( 'The IBAN you entered is incomplete.', 'woo-stripe-payment' ),
1103
- 'incomplete_boleto_tax_id' => __( 'Please enter a valid CPF / CNPJ', 'woo-stripe-payment' )
 
1104
  )
1105
  );
1106
  }
1100
  'empty_element_sepa_debit' => __( 'Please enter your IBAN before proceeding.', 'woo-stripe-payment' ),
1101
  'empty_element_ideal' => __( 'Please select a bank before proceeding', 'woo-stripe-payment' ),
1102
  'incomplete_iban' => __( 'The IBAN you entered is incomplete.', 'woo-stripe-payment' ),
1103
+ 'incomplete_boleto_tax_id' => __( 'Please enter a valid CPF / CNPJ', 'woo-stripe-payment' ),
1104
+ 'test_mode_live_card' => __( 'Your card was declined. Your request was in test mode, but you used a real credit card. Only test cards can be used in test mode.', 'woo-stripe-payment' )
1105
  )
1106
  );
1107
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Stripe For WooCommerce ===
2
  Contributors: mr.clayton
3
  Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofort
4
  Requires at least: 3.0.1
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 3.3.10
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -60,6 +60,11 @@ If you're site is not loading over https, then Stripe won't render the Payment R
60
  8. Edit payment gateways on the product page
61
 
62
  == Changelog ==
 
 
 
 
 
63
  = 3.3.10 =
64
  * Added - Save card checkbox now shows (if enabled in Credit Card Setting) for guest users that select to create new account on checkout page.
65
  * Added - Capability check to Admin profile
1
+ === Payment Plugins for Stripe WooCommerce ===
2
  Contributors: mr.clayton
3
  Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofort
4
  Requires at least: 3.0.1
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 3.3.11
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
60
  8. Edit payment gateways on the product page
61
 
62
  == Changelog ==
63
+ = 3.3.11 =
64
+ * Updated - Changed plugin name to "Payment Plugins for Stripe WooCommerce" at the request of Wordpress.org Plugin Review Team.
65
+ * Updated - If user is logged out and guest checkout is disabled, show save card checkbox if enabled.
66
+ * Added - Filter "wc_stripe_api_request_error_message" for more control over custom error messages.
67
+ * Added - Filter "wc_stripe_pay_order_statuses" so merchants can control when the Pay for Order button appears on the order details page.
68
  = 3.3.10 =
69
  * Added - Save card checkbox now shows (if enabled in Credit Card Setting) for guest users that select to create new account on checkout page.
70
  * Added - Capability check to Admin profile
stripe-payments.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
  /**
3
- * Plugin Name: Stripe For WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept Credit Cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
- * Version: 3.3.10
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
10
  * Tested up to: 5.8
11
  * WC requires at least: 3.0.0
12
- * WC tested up to: 5.7
13
  */
14
  defined( 'ABSPATH' ) || exit ();
15
 
1
  <?php
2
  /**
3
+ * Plugin Name: Payment Plugins for Stripe WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept Credit Cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
+ * Version: 3.3.11
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
10
  * Tested up to: 5.8
11
  * WC requires at least: 3.0.0
12
+ * WC tested up to: 5.8
13
  */
14
  defined( 'ABSPATH' ) || exit ();
15
 
templates/checkout/credit-card.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * @version 3.3.10
4
  *
5
  * @var WC_Payment_Gateway_Stripe_CC $gateway
6
  */
@@ -13,7 +13,8 @@
13
  <div id="wc-stripe-card-element"></div>
14
  <?php endif; ?>
15
  <?php if ( $gateway->show_save_source() ): ?>
16
- <div class="wc-stripe-save-source" <?php if ( ! is_user_logged_in() ): ?>style="display:none"<?php endif ?>>
 
17
  <label class="checkbox">
18
  <input type="checkbox" id="<?php echo $gateway->save_source_key ?>" name="<?php echo $gateway->save_source_key ?>" value="yes"/>
19
  <span class="save-source-checkbox"></span>
1
  <?php
2
  /**
3
+ * @version 3.3.11
4
  *
5
  * @var WC_Payment_Gateway_Stripe_CC $gateway
6
  */
13
  <div id="wc-stripe-card-element"></div>
14
  <?php endif; ?>
15
  <?php if ( $gateway->show_save_source() ): ?>
16
+ <div class="wc-stripe-save-source"
17
+ <?php if ( ! is_user_logged_in() && ! WC()->checkout()->is_registration_required() ): ?>style="display:none"<?php endif ?>>
18
  <label class="checkbox">
19
  <input type="checkbox" id="<?php echo $gateway->save_source_key ?>" name="<?php echo $gateway->save_source_key ?>" value="yes"/>
20
  <span class="save-source-checkbox"></span>
vendor/composer/ClassLoader.php CHANGED
@@ -37,57 +37,130 @@ namespace Composer\Autoload;
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see http://www.php-fig.org/psr/psr-0/
41
- * @see http://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
 
 
 
45
  // PSR-4
 
 
 
 
46
  private $prefixLengthsPsr4 = array();
 
 
 
 
47
  private $prefixDirsPsr4 = array();
 
 
 
 
48
  private $fallbackDirsPsr4 = array();
49
 
50
  // PSR-0
 
 
 
 
51
  private $prefixesPsr0 = array();
 
 
 
 
52
  private $fallbackDirsPsr0 = array();
53
 
 
54
  private $useIncludePath = false;
 
 
 
 
 
55
  private $classMap = array();
 
 
56
  private $classMapAuthoritative = false;
 
 
 
 
 
57
  private $missingClasses = array();
 
 
58
  private $apcuPrefix;
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
63
- return call_user_func_array('array_merge', $this->prefixesPsr0);
64
  }
65
 
66
  return array();
67
  }
68
 
 
 
 
 
69
  public function getPrefixesPsr4()
70
  {
71
  return $this->prefixDirsPsr4;
72
  }
73
 
 
 
 
 
74
  public function getFallbackDirs()
75
  {
76
  return $this->fallbackDirsPsr0;
77
  }
78
 
 
 
 
 
79
  public function getFallbackDirsPsr4()
80
  {
81
  return $this->fallbackDirsPsr4;
82
  }
83
 
 
 
 
 
84
  public function getClassMap()
85
  {
86
  return $this->classMap;
87
  }
88
 
89
  /**
90
- * @param array $classMap Class to filename map
 
 
 
91
  */
92
  public function addClassMap(array $classMap)
93
  {
@@ -102,9 +175,11 @@ class ClassLoader
102
  * Registers a set of PSR-0 directories for a given prefix, either
103
  * appending or prepending to the ones previously set for this prefix.
104
  *
105
- * @param string $prefix The prefix
106
- * @param array|string $paths The PSR-0 root directories
107
- * @param bool $prepend Whether to prepend the directories
 
 
108
  */
109
  public function add($prefix, $paths, $prepend = false)
110
  {
@@ -147,11 +222,13 @@ class ClassLoader
147
  * Registers a set of PSR-4 directories for a given namespace, either
148
  * appending or prepending to the ones previously set for this namespace.
149
  *
150
- * @param string $prefix The prefix/namespace, with trailing '\\'
151
- * @param array|string $paths The PSR-4 base directories
152
- * @param bool $prepend Whether to prepend the directories
153
  *
154
  * @throws \InvalidArgumentException
 
 
155
  */
156
  public function addPsr4($prefix, $paths, $prepend = false)
157
  {
@@ -195,8 +272,10 @@ class ClassLoader
195
  * Registers a set of PSR-0 directories for a given prefix,
196
  * replacing any others previously set for this prefix.
197
  *
198
- * @param string $prefix The prefix
199
- * @param array|string $paths The PSR-0 base directories
 
 
200
  */
201
  public function set($prefix, $paths)
202
  {
@@ -211,10 +290,12 @@ class ClassLoader
211
  * Registers a set of PSR-4 directories for a given namespace,
212
  * replacing any others previously set for this namespace.
213
  *
214
- * @param string $prefix The prefix/namespace, with trailing '\\'
215
- * @param array|string $paths The PSR-4 base directories
216
  *
217
  * @throws \InvalidArgumentException
 
 
218
  */
219
  public function setPsr4($prefix, $paths)
220
  {
@@ -234,6 +315,8 @@ class ClassLoader
234
  * Turns on searching the include path for class files.
235
  *
236
  * @param bool $useIncludePath
 
 
237
  */
238
  public function setUseIncludePath($useIncludePath)
239
  {
@@ -256,6 +339,8 @@ class ClassLoader
256
  * that have not been registered with the class map.
257
  *
258
  * @param bool $classMapAuthoritative
 
 
259
  */
260
  public function setClassMapAuthoritative($classMapAuthoritative)
261
  {
@@ -276,6 +361,8 @@ class ClassLoader
276
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
  *
278
  * @param string|null $apcuPrefix
 
 
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
@@ -296,25 +383,44 @@ class ClassLoader
296
  * Registers this instance as an autoloader.
297
  *
298
  * @param bool $prepend Whether to prepend the autoloader or not
 
 
299
  */
300
  public function register($prepend = false)
301
  {
302
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
 
 
 
 
 
 
 
 
 
 
 
303
  }
304
 
305
  /**
306
  * Unregisters this instance as an autoloader.
 
 
307
  */
308
  public function unregister()
309
  {
310
  spl_autoload_unregister(array($this, 'loadClass'));
 
 
 
 
311
  }
312
 
313
  /**
314
  * Loads the given class or interface.
315
  *
316
  * @param string $class The name of the class
317
- * @return bool|null True if loaded, null otherwise
318
  */
319
  public function loadClass($class)
320
  {
@@ -323,6 +429,8 @@ class ClassLoader
323
 
324
  return true;
325
  }
 
 
326
  }
327
 
328
  /**
@@ -367,6 +475,21 @@ class ClassLoader
367
  return $file;
368
  }
369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  private function findFileWithExtension($class, $ext)
371
  {
372
  // PSR-4 lookup
@@ -438,6 +561,10 @@ class ClassLoader
438
  * Scope isolated include.
439
  *
440
  * Prevents access to $this/self from included files.
 
 
 
 
441
  */
442
  function includeFile($file)
443
  {
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see https://www.php-fig.org/psr/psr-0/
41
+ * @see https://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
45
+ /** @var ?string */
46
+ private $vendorDir;
47
+
48
  // PSR-4
49
+ /**
50
+ * @var array[]
51
+ * @psalm-var array<string, array<string, int>>
52
+ */
53
  private $prefixLengthsPsr4 = array();
54
+ /**
55
+ * @var array[]
56
+ * @psalm-var array<string, array<int, string>>
57
+ */
58
  private $prefixDirsPsr4 = array();
59
+ /**
60
+ * @var array[]
61
+ * @psalm-var array<string, string>
62
+ */
63
  private $fallbackDirsPsr4 = array();
64
 
65
  // PSR-0
66
+ /**
67
+ * @var array[]
68
+ * @psalm-var array<string, array<string, string[]>>
69
+ */
70
  private $prefixesPsr0 = array();
71
+ /**
72
+ * @var array[]
73
+ * @psalm-var array<string, string>
74
+ */
75
  private $fallbackDirsPsr0 = array();
76
 
77
+ /** @var bool */
78
  private $useIncludePath = false;
79
+
80
+ /**
81
+ * @var string[]
82
+ * @psalm-var array<string, string>
83
+ */
84
  private $classMap = array();
85
+
86
+ /** @var bool */
87
  private $classMapAuthoritative = false;
88
+
89
+ /**
90
+ * @var bool[]
91
+ * @psalm-var array<string, bool>
92
+ */
93
  private $missingClasses = array();
94
+
95
+ /** @var ?string */
96
  private $apcuPrefix;
97
 
98
+ /**
99
+ * @var self[]
100
+ */
101
+ private static $registeredLoaders = array();
102
+
103
+ /**
104
+ * @param ?string $vendorDir
105
+ */
106
+ public function __construct($vendorDir = null)
107
+ {
108
+ $this->vendorDir = $vendorDir;
109
+ }
110
+
111
+ /**
112
+ * @return string[]
113
+ */
114
  public function getPrefixes()
115
  {
116
  if (!empty($this->prefixesPsr0)) {
117
+ return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
118
  }
119
 
120
  return array();
121
  }
122
 
123
+ /**
124
+ * @return array[]
125
+ * @psalm-return array<string, array<int, string>>
126
+ */
127
  public function getPrefixesPsr4()
128
  {
129
  return $this->prefixDirsPsr4;
130
  }
131
 
132
+ /**
133
+ * @return array[]
134
+ * @psalm-return array<string, string>
135
+ */
136
  public function getFallbackDirs()
137
  {
138
  return $this->fallbackDirsPsr0;
139
  }
140
 
141
+ /**
142
+ * @return array[]
143
+ * @psalm-return array<string, string>
144
+ */
145
  public function getFallbackDirsPsr4()
146
  {
147
  return $this->fallbackDirsPsr4;
148
  }
149
 
150
+ /**
151
+ * @return string[] Array of classname => path
152
+ * @psalm-var array<string, string>
153
+ */
154
  public function getClassMap()
155
  {
156
  return $this->classMap;
157
  }
158
 
159
  /**
160
+ * @param string[] $classMap Class to filename map
161
+ * @psalm-param array<string, string> $classMap
162
+ *
163
+ * @return void
164
  */
165
  public function addClassMap(array $classMap)
166
  {
175
  * Registers a set of PSR-0 directories for a given prefix, either
176
  * appending or prepending to the ones previously set for this prefix.
177
  *
178
+ * @param string $prefix The prefix
179
+ * @param string[]|string $paths The PSR-0 root directories
180
+ * @param bool $prepend Whether to prepend the directories
181
+ *
182
+ * @return void
183
  */
184
  public function add($prefix, $paths, $prepend = false)
185
  {
222
  * Registers a set of PSR-4 directories for a given namespace, either
223
  * appending or prepending to the ones previously set for this namespace.
224
  *
225
+ * @param string $prefix The prefix/namespace, with trailing '\\'
226
+ * @param string[]|string $paths The PSR-4 base directories
227
+ * @param bool $prepend Whether to prepend the directories
228
  *
229
  * @throws \InvalidArgumentException
230
+ *
231
+ * @return void
232
  */
233
  public function addPsr4($prefix, $paths, $prepend = false)
234
  {
272
  * Registers a set of PSR-0 directories for a given prefix,
273
  * replacing any others previously set for this prefix.
274
  *
275
+ * @param string $prefix The prefix
276
+ * @param string[]|string $paths The PSR-0 base directories
277
+ *
278
+ * @return void
279
  */
280
  public function set($prefix, $paths)
281
  {
290
  * Registers a set of PSR-4 directories for a given namespace,
291
  * replacing any others previously set for this namespace.
292
  *
293
+ * @param string $prefix The prefix/namespace, with trailing '\\'
294
+ * @param string[]|string $paths The PSR-4 base directories
295
  *
296
  * @throws \InvalidArgumentException
297
+ *
298
+ * @return void
299
  */
300
  public function setPsr4($prefix, $paths)
301
  {
315
  * Turns on searching the include path for class files.
316
  *
317
  * @param bool $useIncludePath
318
+ *
319
+ * @return void
320
  */
321
  public function setUseIncludePath($useIncludePath)
322
  {
339
  * that have not been registered with the class map.
340
  *
341
  * @param bool $classMapAuthoritative
342
+ *
343
+ * @return void
344
  */
345
  public function setClassMapAuthoritative($classMapAuthoritative)
346
  {
361
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
362
  *
363
  * @param string|null $apcuPrefix
364
+ *
365
+ * @return void
366
  */
367
  public function setApcuPrefix($apcuPrefix)
368
  {
383
  * Registers this instance as an autoloader.
384
  *
385
  * @param bool $prepend Whether to prepend the autoloader or not
386
+ *
387
+ * @return void
388
  */
389
  public function register($prepend = false)
390
  {
391
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
392
+
393
+ if (null === $this->vendorDir) {
394
+ return;
395
+ }
396
+
397
+ if ($prepend) {
398
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
399
+ } else {
400
+ unset(self::$registeredLoaders[$this->vendorDir]);
401
+ self::$registeredLoaders[$this->vendorDir] = $this;
402
+ }
403
  }
404
 
405
  /**
406
  * Unregisters this instance as an autoloader.
407
+ *
408
+ * @return void
409
  */
410
  public function unregister()
411
  {
412
  spl_autoload_unregister(array($this, 'loadClass'));
413
+
414
+ if (null !== $this->vendorDir) {
415
+ unset(self::$registeredLoaders[$this->vendorDir]);
416
+ }
417
  }
418
 
419
  /**
420
  * Loads the given class or interface.
421
  *
422
  * @param string $class The name of the class
423
+ * @return true|null True if loaded, null otherwise
424
  */
425
  public function loadClass($class)
426
  {
429
 
430
  return true;
431
  }
432
+
433
+ return null;
434
  }
435
 
436
  /**
475
  return $file;
476
  }
477
 
478
+ /**
479
+ * Returns the currently registered loaders indexed by their corresponding vendor directories.
480
+ *
481
+ * @return self[]
482
+ */
483
+ public static function getRegisteredLoaders()
484
+ {
485
+ return self::$registeredLoaders;
486
+ }
487
+
488
+ /**
489
+ * @param string $class
490
+ * @param string $ext
491
+ * @return string|false
492
+ */
493
  private function findFileWithExtension($class, $ext)
494
  {
495
  // PSR-4 lookup
561
  * Scope isolated include.
562
  *
563
  * Prevents access to $this/self from included files.
564
+ *
565
+ * @param string $file
566
+ * @return void
567
+ * @private
568
  */
569
  function includeFile($file)
570
  {
vendor/composer/InstalledVersions.php ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer;
14
+
15
+ use Composer\Autoload\ClassLoader;
16
+ use Composer\Semver\VersionParser;
17
+
18
+ /**
19
+ * This class is copied in every Composer installed project and available to all
20
+ *
21
+ * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
22
+ *
23
+ * To require its presence, you can require `composer-runtime-api ^2.0`
24
+ */
25
+ class InstalledVersions
26
+ {
27
+ private static $installed;
28
+ private static $canGetVendors;
29
+ private static $installedByVendor = array();
30
+
31
+ /**
32
+ * Returns a list of all package names which are present, either by being installed, replaced or provided
33
+ *
34
+ * @return string[]
35
+ * @psalm-return list<string>
36
+ */
37
+ public static function getInstalledPackages()
38
+ {
39
+ $packages = array();
40
+ foreach (self::getInstalled() as $installed) {
41
+ $packages[] = array_keys($installed['versions']);
42
+ }
43
+
44
+ if (1 === \count($packages)) {
45
+ return $packages[0];
46
+ }
47
+
48
+ return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
49
+ }
50
+
51
+ /**
52
+ * Returns a list of all package names with a specific type e.g. 'library'
53
+ *
54
+ * @param string $type
55
+ * @return string[]
56
+ * @psalm-return list<string>
57
+ */
58
+ public static function getInstalledPackagesByType($type)
59
+ {
60
+ $packagesByType = array();
61
+
62
+ foreach (self::getInstalled() as $installed) {
63
+ foreach ($installed['versions'] as $name => $package) {
64
+ if (isset($package['type']) && $package['type'] === $type) {
65
+ $packagesByType[] = $name;
66
+ }
67
+ }
68
+ }
69
+
70
+ return $packagesByType;
71
+ }
72
+
73
+ /**
74
+ * Checks whether the given package is installed
75
+ *
76
+ * This also returns true if the package name is provided or replaced by another package
77
+ *
78
+ * @param string $packageName
79
+ * @param bool $includeDevRequirements
80
+ * @return bool
81
+ */
82
+ public static function isInstalled($packageName, $includeDevRequirements = true)
83
+ {
84
+ foreach (self::getInstalled() as $installed) {
85
+ if (isset($installed['versions'][$packageName])) {
86
+ return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
87
+ }
88
+ }
89
+
90
+ return false;
91
+ }
92
+
93
+ /**
94
+ * Checks whether the given package satisfies a version constraint
95
+ *
96
+ * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
97
+ *
98
+ * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
99
+ *
100
+ * @param VersionParser $parser Install composer/semver to have access to this class and functionality
101
+ * @param string $packageName
102
+ * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
103
+ * @return bool
104
+ */
105
+ public static function satisfies(VersionParser $parser, $packageName, $constraint)
106
+ {
107
+ $constraint = $parser->parseConstraints($constraint);
108
+ $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
109
+
110
+ return $provided->matches($constraint);
111
+ }
112
+
113
+ /**
114
+ * Returns a version constraint representing all the range(s) which are installed for a given package
115
+ *
116
+ * It is easier to use this via isInstalled() with the $constraint argument if you need to check
117
+ * whether a given version of a package is installed, and not just whether it exists
118
+ *
119
+ * @param string $packageName
120
+ * @return string Version constraint usable with composer/semver
121
+ */
122
+ public static function getVersionRanges($packageName)
123
+ {
124
+ foreach (self::getInstalled() as $installed) {
125
+ if (!isset($installed['versions'][$packageName])) {
126
+ continue;
127
+ }
128
+
129
+ $ranges = array();
130
+ if (isset($installed['versions'][$packageName]['pretty_version'])) {
131
+ $ranges[] = $installed['versions'][$packageName]['pretty_version'];
132
+ }
133
+ if (array_key_exists('aliases', $installed['versions'][$packageName])) {
134
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
135
+ }
136
+ if (array_key_exists('replaced', $installed['versions'][$packageName])) {
137
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
138
+ }
139
+ if (array_key_exists('provided', $installed['versions'][$packageName])) {
140
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
141
+ }
142
+
143
+ return implode(' || ', $ranges);
144
+ }
145
+
146
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
147
+ }
148
+
149
+ /**
150
+ * @param string $packageName
151
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
152
+ */
153
+ public static function getVersion($packageName)
154
+ {
155
+ foreach (self::getInstalled() as $installed) {
156
+ if (!isset($installed['versions'][$packageName])) {
157
+ continue;
158
+ }
159
+
160
+ if (!isset($installed['versions'][$packageName]['version'])) {
161
+ return null;
162
+ }
163
+
164
+ return $installed['versions'][$packageName]['version'];
165
+ }
166
+
167
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
168
+ }
169
+
170
+ /**
171
+ * @param string $packageName
172
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
173
+ */
174
+ public static function getPrettyVersion($packageName)
175
+ {
176
+ foreach (self::getInstalled() as $installed) {
177
+ if (!isset($installed['versions'][$packageName])) {
178
+ continue;
179
+ }
180
+
181
+ if (!isset($installed['versions'][$packageName]['pretty_version'])) {
182
+ return null;
183
+ }
184
+
185
+ return $installed['versions'][$packageName]['pretty_version'];
186
+ }
187
+
188
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
189
+ }
190
+
191
+ /**
192
+ * @param string $packageName
193
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
194
+ */
195
+ public static function getReference($packageName)
196
+ {
197
+ foreach (self::getInstalled() as $installed) {
198
+ if (!isset($installed['versions'][$packageName])) {
199
+ continue;
200
+ }
201
+
202
+ if (!isset($installed['versions'][$packageName]['reference'])) {
203
+ return null;
204
+ }
205
+
206
+ return $installed['versions'][$packageName]['reference'];
207
+ }
208
+
209
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
210
+ }
211
+
212
+ /**
213
+ * @param string $packageName
214
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
215
+ */
216
+ public static function getInstallPath($packageName)
217
+ {
218
+ foreach (self::getInstalled() as $installed) {
219
+ if (!isset($installed['versions'][$packageName])) {
220
+ continue;
221
+ }
222
+
223
+ return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
224
+ }
225
+
226
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
227
+ }
228
+
229
+ /**
230
+ * @return array
231
+ * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
232
+ */
233
+ public static function getRootPackage()
234
+ {
235
+ $installed = self::getInstalled();
236
+
237
+ return $installed[0]['root'];
238
+ }
239
+
240
+ /**
241
+ * Returns the raw installed.php data for custom implementations
242
+ *
243
+ * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
244
+ * @return array[]
245
+ * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
246
+ */
247
+ public static function getRawData()
248
+ {
249
+ @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
250
+
251
+ if (null === self::$installed) {
252
+ // only require the installed.php file if this file is loaded from its dumped location,
253
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
254
+ if (substr(__DIR__, -8, 1) !== 'C') {
255
+ self::$installed = include __DIR__ . '/installed.php';
256
+ } else {
257
+ self::$installed = array();
258
+ }
259
+ }
260
+
261
+ return self::$installed;
262
+ }
263
+
264
+ /**
265
+ * Returns the raw data of all installed.php which are currently loaded for custom implementations
266
+ *
267
+ * @return array[]
268
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
269
+ */
270
+ public static function getAllRawData()
271
+ {
272
+ return self::getInstalled();
273
+ }
274
+
275
+ /**
276
+ * Lets you reload the static array from another file
277
+ *
278
+ * This is only useful for complex integrations in which a project needs to use
279
+ * this class but then also needs to execute another project's autoloader in process,
280
+ * and wants to ensure both projects have access to their version of installed.php.
281
+ *
282
+ * A typical case would be PHPUnit, where it would need to make sure it reads all
283
+ * the data it needs from this class, then call reload() with
284
+ * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
285
+ * the project in which it runs can then also use this class safely, without
286
+ * interference between PHPUnit's dependencies and the project's dependencies.
287
+ *
288
+ * @param array[] $data A vendor/composer/installed.php data set
289
+ * @return void
290
+ *
291
+ * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
292
+ */
293
+ public static function reload($data)
294
+ {
295
+ self::$installed = $data;
296
+ self::$installedByVendor = array();
297
+ }
298
+
299
+ /**
300
+ * @return array[]
301
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
302
+ */
303
+ private static function getInstalled()
304
+ {
305
+ if (null === self::$canGetVendors) {
306
+ self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
307
+ }
308
+
309
+ $installed = array();
310
+
311
+ if (self::$canGetVendors) {
312
+ foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
313
+ if (isset(self::$installedByVendor[$vendorDir])) {
314
+ $installed[] = self::$installedByVendor[$vendorDir];
315
+ } elseif (is_file($vendorDir.'/composer/installed.php')) {
316
+ $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
317
+ if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
318
+ self::$installed = $installed[count($installed) - 1];
319
+ }
320
+ }
321
+ }
322
+ }
323
+
324
+ if (null === self::$installed) {
325
+ // only require the installed.php file if this file is loaded from its dumped location,
326
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
327
+ if (substr(__DIR__, -8, 1) !== 'C') {
328
+ self::$installed = require __DIR__ . '/installed.php';
329
+ } else {
330
+ self::$installed = array();
331
+ }
332
+ }
333
+ $installed[] = self::$installed;
334
+
335
+ return $installed;
336
+ }
337
+ }
vendor/composer/autoload_classmap.php CHANGED
@@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
  );
vendor/composer/autoload_real.php CHANGED
@@ -22,13 +22,15 @@ class ComposerAutoloaderInit50989f547160e30b048ac4ee36befb35
22
  return self::$loader;
23
  }
24
 
 
 
25
  spl_autoload_register(array('ComposerAutoloaderInit50989f547160e30b048ac4ee36befb35', 'loadClassLoader'), true, true);
26
- self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
  spl_autoload_unregister(array('ComposerAutoloaderInit50989f547160e30b048ac4ee36befb35', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
- require_once __DIR__ . '/autoload_static.php';
32
 
33
  call_user_func(\Composer\Autoload\ComposerStaticInit50989f547160e30b048ac4ee36befb35::getInitializer($loader));
34
  } else {
22
  return self::$loader;
23
  }
24
 
25
+ require __DIR__ . '/platform_check.php';
26
+
27
  spl_autoload_register(array('ComposerAutoloaderInit50989f547160e30b048ac4ee36befb35', 'loadClassLoader'), true, true);
28
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
  spl_autoload_unregister(array('ComposerAutoloaderInit50989f547160e30b048ac4ee36befb35', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
+ require __DIR__ . '/autoload_static.php';
34
 
35
  call_user_func(\Composer\Autoload\ComposerStaticInit50989f547160e30b048ac4ee36befb35::getInitializer($loader));
36
  } else {
vendor/composer/autoload_static.php CHANGED
@@ -38,11 +38,16 @@ class ComposerStaticInit50989f547160e30b048ac4ee36befb35
38
  ),
39
  );
40
 
 
 
 
 
41
  public static function getInitializer(ClassLoader $loader)
42
  {
43
  return \Closure::bind(function () use ($loader) {
44
  $loader->prefixLengthsPsr4 = ComposerStaticInit50989f547160e30b048ac4ee36befb35::$prefixLengthsPsr4;
45
  $loader->prefixDirsPsr4 = ComposerStaticInit50989f547160e30b048ac4ee36befb35::$prefixDirsPsr4;
 
46
 
47
  }, null, ClassLoader::class);
48
  }
38
  ),
39
  );
40
 
41
+ public static $classMap = array (
42
+ 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
43
+ );
44
+
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
  $loader->prefixLengthsPsr4 = ComposerStaticInit50989f547160e30b048ac4ee36befb35::$prefixLengthsPsr4;
49
  $loader->prefixDirsPsr4 = ComposerStaticInit50989f547160e30b048ac4ee36befb35::$prefixDirsPsr4;
50
+ $loader->classMap = ComposerStaticInit50989f547160e30b048ac4ee36befb35::$classMap;
51
 
52
  }, null, ClassLoader::class);
53
  }
vendor/composer/installed.json CHANGED
@@ -1,61 +1,66 @@
1
- [
2
- {
3
- "name": "stripe/stripe-php",
4
- "version": "v7.75.0",
5
- "version_normalized": "7.75.0.0",
6
- "source": {
7
- "type": "git",
8
- "url": "https://github.com/stripe/stripe-php.git",
9
- "reference": "d377a667cd789b99ccab768441a5a2160cc4ea80"
10
- },
11
- "dist": {
12
- "type": "zip",
13
- "url": "https://api.github.com/repos/stripe/stripe-php/zipball/d377a667cd789b99ccab768441a5a2160cc4ea80",
14
- "reference": "d377a667cd789b99ccab768441a5a2160cc4ea80",
15
- "shasum": ""
16
- },
17
- "require": {
18
- "ext-curl": "*",
19
- "ext-json": "*",
20
- "ext-mbstring": "*",
21
- "php": ">=5.6.0"
22
- },
23
- "require-dev": {
24
- "friendsofphp/php-cs-fixer": "2.17.1",
25
- "php-coveralls/php-coveralls": "^2.1",
26
- "phpunit/phpunit": "^5.7",
27
- "squizlabs/php_codesniffer": "^3.3",
28
- "symfony/process": "~3.4"
29
- },
30
- "time": "2021-02-22T14:31:21+00:00",
31
- "type": "library",
32
- "extra": {
33
- "branch-alias": {
34
- "dev-master": "2.0-dev"
35
- }
36
- },
37
- "installation-source": "dist",
38
- "autoload": {
39
- "psr-4": {
40
- "Stripe\\": "lib/"
41
- }
42
- },
43
- "notification-url": "https://packagist.org/downloads/",
44
- "license": [
45
- "MIT"
46
- ],
47
- "authors": [
48
- {
49
- "name": "Stripe and contributors",
50
- "homepage": "https://github.com/stripe/stripe-php/contributors"
51
- }
52
- ],
53
- "description": "Stripe PHP Library",
54
- "homepage": "https://stripe.com/",
55
- "keywords": [
56
- "api",
57
- "payment processing",
58
- "stripe"
59
- ]
60
- }
61
- ]
 
 
 
 
 
1
+ {
2
+ "packages": [
3
+ {
4
+ "name": "stripe/stripe-php",
5
+ "version": "v7.75.0",
6
+ "version_normalized": "7.75.0.0",
7
+ "source": {
8
+ "type": "git",
9
+ "url": "https://github.com/stripe/stripe-php.git",
10
+ "reference": "d377a667cd789b99ccab768441a5a2160cc4ea80"
11
+ },
12
+ "dist": {
13
+ "type": "zip",
14
+ "url": "https://api.github.com/repos/stripe/stripe-php/zipball/d377a667cd789b99ccab768441a5a2160cc4ea80",
15
+ "reference": "d377a667cd789b99ccab768441a5a2160cc4ea80",
16
+ "shasum": ""
17
+ },
18
+ "require": {
19
+ "ext-curl": "*",
20
+ "ext-json": "*",
21
+ "ext-mbstring": "*",
22
+ "php": ">=5.6.0"
23
+ },
24
+ "require-dev": {
25
+ "friendsofphp/php-cs-fixer": "2.17.1",
26
+ "php-coveralls/php-coveralls": "^2.1",
27
+ "phpunit/phpunit": "^5.7",
28
+ "squizlabs/php_codesniffer": "^3.3",
29
+ "symfony/process": "~3.4"
30
+ },
31
+ "time": "2021-02-22T14:31:21+00:00",
32
+ "type": "library",
33
+ "extra": {
34
+ "branch-alias": {
35
+ "dev-master": "2.0-dev"
36
+ }
37
+ },
38
+ "installation-source": "dist",
39
+ "autoload": {
40
+ "psr-4": {
41
+ "Stripe\\": "lib/"
42
+ }
43
+ },
44
+ "notification-url": "https://packagist.org/downloads/",
45
+ "license": [
46
+ "MIT"
47
+ ],
48
+ "authors": [
49
+ {
50
+ "name": "Stripe and contributors",
51
+ "homepage": "https://github.com/stripe/stripe-php/contributors"
52
+ }
53
+ ],
54
+ "description": "Stripe PHP Library",
55
+ "homepage": "https://stripe.com/",
56
+ "keywords": [
57
+ "api",
58
+ "payment processing",
59
+ "stripe"
60
+ ],
61
+ "install-path": "../stripe/stripe-php"
62
+ }
63
+ ],
64
+ "dev": false,
65
+ "dev-package-names": []
66
+ }
vendor/composer/installed.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php return array(
2
+ 'root' => array(
3
+ 'pretty_version' => 'dev-master',
4
+ 'version' => 'dev-master',
5
+ 'type' => 'library',
6
+ 'install_path' => __DIR__ . '/../../',
7
+ 'aliases' => array(),
8
+ 'reference' => '495172237fdbd024112015fc776268c36de466c2',
9
+ 'name' => '__root__',
10
+ 'dev' => false,
11
+ ),
12
+ 'versions' => array(
13
+ '__root__' => array(
14
+ 'pretty_version' => 'dev-master',
15
+ 'version' => 'dev-master',
16
+ 'type' => 'library',
17
+ 'install_path' => __DIR__ . '/../../',
18
+ 'aliases' => array(),
19
+ 'reference' => '495172237fdbd024112015fc776268c36de466c2',
20
+ 'dev_requirement' => false,
21
+ ),
22
+ 'stripe/stripe-php' => array(
23
+ 'pretty_version' => 'v7.75.0',
24
+ 'version' => '7.75.0.0',
25
+ 'type' => 'library',
26
+ 'install_path' => __DIR__ . '/../stripe/stripe-php',
27
+ 'aliases' => array(),
28
+ 'reference' => 'd377a667cd789b99ccab768441a5a2160cc4ea80',
29
+ 'dev_requirement' => false,
30
+ ),
31
+ ),
32
+ );
vendor/composer/platform_check.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // platform_check.php @generated by Composer
4
+
5
+ $issues = array();
6
+
7
+ if (!(PHP_VERSION_ID >= 50600)) {
8
+ $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
9
+ }
10
+
11
+ if ($issues) {
12
+ if (!headers_sent()) {
13
+ header('HTTP/1.1 500 Internal Server Error');
14
+ }
15
+ if (!ini_get('display_errors')) {
16
+ if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17
+ fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
18
+ } elseif (!headers_sent()) {
19
+ echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
20
+ }
21
+ }
22
+ trigger_error(
23
+ 'Composer detected issues in your platform: ' . implode(' ', $issues),
24
+ E_USER_ERROR
25
+ );
26
+ }