Changeset 3428340
- Timestamp:
- 12/27/2025 05:46:51 PM (3 months ago)
- Location:
- pay-with-flex/trunk
- Files:
-
- 18 edited
-
composer.json (modified) (3 diffs)
-
composer.lock (modified) (5 diffs)
-
pay-with-flex.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
src/Resource/CheckoutSession/LineItem.php (modified) (2 diffs)
-
src/Resource/Price.php (modified) (2 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (2 diffs)
-
vendor/composer/autoload_static.php (modified) (2 diffs)
-
vendor/composer/installed.json (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (1 diff)
-
vendor/composer/platform_check.php (modified) (1 diff)
-
vendor/scoper-autoload.php (modified) (1 diff)
-
vendor/symfony/options-resolver/CHANGELOG.md (modified) (1 diff)
-
vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php (modified) (1 diff)
-
vendor/symfony/options-resolver/OptionConfigurator.php (modified) (2 diffs)
-
vendor/symfony/options-resolver/OptionsResolver.php (modified) (13 diffs)
-
vendor/symfony/options-resolver/composer.json (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pay-with-flex/trunk/composer.json
r3427514 r3428340 2 2 "type": "wordpress-plugin", 3 3 "require": { 4 "php": ">=8.1", 4 5 "symfony/polyfill-php84": ">=1.31", 5 6 "sentry/sentry": ">=4.11" … … 14 15 "Flex\\": "src" 15 16 }, 16 "files": ["includes/functions.php"] 17 "files": [ 18 "includes/functions.php" 19 ] 17 20 }, 18 21 "autoload-dev": { … … 25 28 }, 26 29 "config": { 27 "optimize-autoloader": true 30 "optimize-autoloader": true, 31 "platform": { 32 "php": "8.1.34" 33 } 28 34 } 29 35 } -
pay-with-flex/trunk/composer.lock
r3427514 r3428340 5 5 "This file is @generated automatically" 6 6 ], 7 "content-hash": " 400fe045e9fce44650d89f3d72a1981a",7 "content-hash": "f720d3c2e1d29922303b6c6cd82eb01a", 8 8 "packages": [ 9 9 { … … 542 542 { 543 543 "name": "symfony/options-resolver", 544 "version": "v 8.0.0",544 "version": "v6.4.30", 545 545 "source": { 546 546 "type": "git", 547 547 "url": "https://github.com/symfony/options-resolver.git", 548 "reference": " d2b592535ffa6600c265a3893a7f7fd2bad82dd7"549 }, 550 "dist": { 551 "type": "zip", 552 "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ d2b592535ffa6600c265a3893a7f7fd2bad82dd7",553 "reference": " d2b592535ffa6600c265a3893a7f7fd2bad82dd7",554 "shasum": "" 555 }, 556 "require": { 557 "php": ">=8. 4",548 "reference": "eeaa8cabe54c7b3516938c72a4a161c0cc80a34f" 549 }, 550 "dist": { 551 "type": "zip", 552 "url": "https://api.github.com/repos/symfony/options-resolver/zipball/eeaa8cabe54c7b3516938c72a4a161c0cc80a34f", 553 "reference": "eeaa8cabe54c7b3516938c72a4a161c0cc80a34f", 554 "shasum": "" 555 }, 556 "require": { 557 "php": ">=8.1", 558 558 "symfony/deprecation-contracts": "^2.5|^3" 559 559 }, … … 589 589 ], 590 590 "support": { 591 "source": "https://github.com/symfony/options-resolver/tree/v 8.0.0"591 "source": "https://github.com/symfony/options-resolver/tree/v6.4.30" 592 592 }, 593 593 "funding": [ … … 609 609 } 610 610 ], 611 "time": "2025-11-12T1 5:55:31+00:00"611 "time": "2025-11-12T13:06:53+00:00" 612 612 }, 613 613 { … … 2607 2607 "prefer-stable": false, 2608 2608 "prefer-lowest": false, 2609 "platform": {}, 2609 "platform": { 2610 "php": ">=8.1" 2611 }, 2610 2612 "platform-dev": {}, 2613 "platform-overrides": { 2614 "php": "8.1.34" 2615 }, 2611 2616 "plugin-api-version": "2.6.0" 2612 2617 } -
pay-with-flex/trunk/pay-with-flex.php
r3427514 r3428340 4 4 * Plugin Name: Flex HSA/FSA Payments 5 5 * Description: Accept HSA/FSA payments directly in the checkout flow. 6 * Version: 3.2. 06 * Version: 3.2.1 7 7 * Plugin URI: https://wordpress.org/plugins/pay-with-flex/ 8 8 * Author: Flex -
pay-with-flex/trunk/readme.txt
r3427514 r3428340 4 4 Requires at least: 6.7 5 5 Tested up to: 6.9 6 Stable tag: 3. 1.186 Stable tag: 3.2.1 7 7 Requires PHP: 8.1 8 8 License: GPLv3 or later … … 55 55 56 56 == Changelog == 57 58 = 3.2.1 = 59 * Fixed a memory leak when a checkout session is created multiple times. 57 60 58 61 = 3.2.0 = -
pay-with-flex/trunk/src/Resource/CheckoutSession/LineItem.php
r3427514 r3428340 9 9 namespace Flex\Resource\CheckoutSession; 10 10 11 use Automattic\WooCommerce\Enums\OrderStatus; 11 12 use Flex\Resource\Price; 12 13 use Flex\Resource\Resource; … … 76 77 */ 77 78 public static function from_wc( \WC_Order_Item_Product $item ): self { 78 // If the order has a transaction id, the checkout session was completed79 // and the price id is fixed.80 if ( $item->get_order()->get_transaction_id() && $item->meta_exists( self::META_PREFIX . self::KEY_PRICE ) ) {81 $price = new Price( id: $item->get_meta( self::META_PREFIX . self::KEY_PRICE ) );82 } else{83 $ price = Price::from_wc_item( $item);79 // For non-pending orders with stored metadata, pass the stored price ID. 80 // This ensures refunds reference the correct price. 81 $stored_id = null; 82 $meta_key = self::META_PREFIX . self::KEY_PRICE; 83 if ( OrderStatus::PENDING !== $item->get_order()->get_status() && $item->meta_exists( $meta_key ) ) { 84 $stored_id = $item->get_meta( $meta_key ); 84 85 } 85 $line_item = new self( price: $price, quantity: $item->get_quantity() );86 $line_item = new self( price: Price::from_wc_item( $item, $stored_id ), quantity: $item->get_quantity() ); 86 87 $line_item->wc = $item; 87 88 return $line_item; -
pay-with-flex/trunk/src/Resource/Price.php
r3427514 r3428340 100 100 * 101 101 * @param \WC_Order_Item_Product $item The WooCommerce Order Item. 102 */ 103 public static function from_wc_item( \WC_Order_Item_Product $item ): self { 102 * @param ?string $id Optional price ID from stored metadata. 103 */ 104 public static function from_wc_item( \WC_Order_Item_Product $item, ?string $id = null ): self { 104 105 $product = $item->get_product(); 105 106 $quantity = $item->get_quantity(); … … 108 109 $actual_total = self::currency_to_unit_amount( $item->get_subtotal() ); 109 110 $price = self::from_wc( $product ); 111 // Use the provided ID if present (from stored metadata). 112 if ( null !== $id ) { 113 $price->id = $id; 114 } 110 115 // If prices match, use the standard product-based price. 111 116 if ( $expected_total === $actual_total ) { 112 117 return $price; 113 118 } 114 return new self( product: $price->product, description: $item->get_name(), unit_amount: $actual_total / $quantity, hsa_fsa_eligibility: $price->hsa_fsa_eligibility ); 119 return new self( 120 product: $price->product, 121 id: $price->id, 122 // Preserve stored ID if present. 123 description: $item->get_name(), 124 unit_amount: $actual_total / $quantity, 125 hsa_fsa_eligibility: $price->hsa_fsa_eligibility 126 ); 115 127 } 116 128 /** -
pay-with-flex/trunk/vendor/autoload.php
r3427514 r3428340 20 20 require_once __DIR__ . '/composer/autoload_real.php'; 21 21 22 return ComposerAutoloaderInit 400fe045e9fce44650d89f3d72a1981a::getLoader();22 return ComposerAutoloaderInitf720d3c2e1d29922303b6c6cd82eb01a::getLoader(); -
pay-with-flex/trunk/vendor/composer/autoload_real.php
r3427514 r3428340 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 400fe045e9fce44650d89f3d72a1981a5 class ComposerAutoloaderInitf720d3c2e1d29922303b6c6cd82eb01a 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 400fe045e9fce44650d89f3d72a1981a', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitf720d3c2e1d29922303b6c6cd82eb01a', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 400fe045e9fce44650d89f3d72a1981a', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitf720d3c2e1d29922303b6c6cd82eb01a', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 400fe045e9fce44650d89f3d72a1981a::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInitf720d3c2e1d29922303b6c6cd82eb01a::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 400fe045e9fce44650d89f3d72a1981a::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInitf720d3c2e1d29922303b6c6cd82eb01a::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
pay-with-flex/trunk/vendor/composer/autoload_static.php
r3427514 r3428340 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 400fe045e9fce44650d89f3d72a1981a7 class ComposerStaticInitf720d3c2e1d29922303b6c6cd82eb01a 8 8 { 9 9 public static $files = array ( … … 302 302 { 303 303 return \Closure::bind(function () use ($loader) { 304 $loader->prefixLengthsPsr4 = ComposerStaticInit 400fe045e9fce44650d89f3d72a1981a::$prefixLengthsPsr4;305 $loader->prefixDirsPsr4 = ComposerStaticInit 400fe045e9fce44650d89f3d72a1981a::$prefixDirsPsr4;306 $loader->classMap = ComposerStaticInit 400fe045e9fce44650d89f3d72a1981a::$classMap;304 $loader->prefixLengthsPsr4 = ComposerStaticInitf720d3c2e1d29922303b6c6cd82eb01a::$prefixLengthsPsr4; 305 $loader->prefixDirsPsr4 = ComposerStaticInitf720d3c2e1d29922303b6c6cd82eb01a::$prefixDirsPsr4; 306 $loader->classMap = ComposerStaticInitf720d3c2e1d29922303b6c6cd82eb01a::$classMap; 307 307 308 308 }, null, ClassLoader::class); -
pay-with-flex/trunk/vendor/composer/installed.json
r3427514 r3428340 560 560 { 561 561 "name": "symfony\/options-resolver", 562 "version": "v 8.0.0",563 "version_normalized": " 8.0.0.0",562 "version": "v6.4.30", 563 "version_normalized": "6.4.30.0", 564 564 "source": { 565 565 "type": "git", 566 566 "url": "https:\/\/github.com\/symfony\/options-resolver.git", 567 "reference": " d2b592535ffa6600c265a3893a7f7fd2bad82dd7"568 }, 569 "dist": { 570 "type": "zip", 571 "url": "https:\/\/api.github.com\/repos\/symfony\/options-resolver\/zipball\/ d2b592535ffa6600c265a3893a7f7fd2bad82dd7",572 "reference": " d2b592535ffa6600c265a3893a7f7fd2bad82dd7",573 "shasum": "" 574 }, 575 "require": { 576 "php": ">=8. 4",567 "reference": "eeaa8cabe54c7b3516938c72a4a161c0cc80a34f" 568 }, 569 "dist": { 570 "type": "zip", 571 "url": "https:\/\/api.github.com\/repos\/symfony\/options-resolver\/zipball\/eeaa8cabe54c7b3516938c72a4a161c0cc80a34f", 572 "reference": "eeaa8cabe54c7b3516938c72a4a161c0cc80a34f", 573 "shasum": "" 574 }, 575 "require": { 576 "php": ">=8.1", 577 577 "symfony\/deprecation-contracts": "^2.5|^3" 578 578 }, 579 "time": "2025-11-12T1 5:55:31+00:00",579 "time": "2025-11-12T13:06:53+00:00", 580 580 "type": "library", 581 581 "installation-source": "dist", … … 610 610 ], 611 611 "support": { 612 "source": "https:\/\/github.com\/symfony\/options-resolver\/tree\/v 8.0.0"612 "source": "https:\/\/github.com\/symfony\/options-resolver\/tree\/v6.4.30" 613 613 }, 614 614 "funding": [ -
pay-with-flex/trunk/vendor/composer/installed.php
r3427514 r3428340 3 3 namespace Flex; 4 4 5 return array('root' => array('name' => '__root__', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => ' 64e52af59652cf3a0461591681440deb601bb9ef', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('__root__' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '64e52af59652cf3a0461591681440deb601bb9ef', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'guzzlehttp/psr7' => array('pretty_version' => '2.8.0', 'version' => '2.8.0.0', 'reference' => '21dc724a0583619cd1652f673303492272778051', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), 'dev_requirement' => \false), 'jean85/pretty-package-versions' => array('pretty_version' => '2.1.1', 'version' => '2.1.1.0', 'reference' => '4d7aa5dab42e2a76d99559706022885de0e18e1a', 'type' => 'library', 'install_path' => __DIR__ . '/../jean85/pretty-package-versions', 'aliases' => array(), 'dev_requirement' => \false), 'psr/http-factory' => array('pretty_version' => '1.1.0', 'version' => '1.1.0.0', 'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-factory', 'aliases' => array(), 'dev_requirement' => \false), 'psr/http-factory-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0')), 'psr/http-message' => array('pretty_version' => '2.0', 'version' => '2.0.0.0', 'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-message', 'aliases' => array(), 'dev_requirement' => \false), 'psr/http-message-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0')), 'psr/log' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'ralouphie/getallheaders' => array('pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'reference' => '120b605dfeb996808c31b6477290a714d356e822', 'type' => 'library', 'install_path' => __DIR__ . '/../ralouphie/getallheaders', 'aliases' => array(), 'dev_requirement' => \false), 'sentry/sentry' => array('pretty_version' => '4.19.1', 'version' => '4.19.1.0', 'reference' => '1c21d60bebe67c0122335bd3fe977990435af0a3', 'type' => 'library', 'install_path' => __DIR__ . '/../sentry/sentry', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.6.0', 'version' => '3.6.0.0', 'reference' => '63afe740e99a13ba87ec199bb07bbdee937a5b62', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/options-resolver' => array('pretty_version' => 'v8.0.0', 'version' => '8.0.0.0', 'reference' => 'd2b592535ffa6600c265a3893a7f7fd2bad82dd7', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/options-resolver', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-php84' => array('pretty_version' => 'v1.33.0', 'version' => '1.33.0.0', 'reference' => 'd8ced4d875142b6a7426000426b8abc631d6b191', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php84', 'aliases' => array(), 'dev_requirement' => \false)));5 return array('root' => array('name' => '__root__', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '2a34d9973d22cbe56647992d29c557397af3a745', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('__root__' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '2a34d9973d22cbe56647992d29c557397af3a745', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'guzzlehttp/psr7' => array('pretty_version' => '2.8.0', 'version' => '2.8.0.0', 'reference' => '21dc724a0583619cd1652f673303492272778051', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), 'dev_requirement' => \false), 'jean85/pretty-package-versions' => array('pretty_version' => '2.1.1', 'version' => '2.1.1.0', 'reference' => '4d7aa5dab42e2a76d99559706022885de0e18e1a', 'type' => 'library', 'install_path' => __DIR__ . '/../jean85/pretty-package-versions', 'aliases' => array(), 'dev_requirement' => \false), 'psr/http-factory' => array('pretty_version' => '1.1.0', 'version' => '1.1.0.0', 'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-factory', 'aliases' => array(), 'dev_requirement' => \false), 'psr/http-factory-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0')), 'psr/http-message' => array('pretty_version' => '2.0', 'version' => '2.0.0.0', 'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-message', 'aliases' => array(), 'dev_requirement' => \false), 'psr/http-message-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0')), 'psr/log' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'ralouphie/getallheaders' => array('pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'reference' => '120b605dfeb996808c31b6477290a714d356e822', 'type' => 'library', 'install_path' => __DIR__ . '/../ralouphie/getallheaders', 'aliases' => array(), 'dev_requirement' => \false), 'sentry/sentry' => array('pretty_version' => '4.19.1', 'version' => '4.19.1.0', 'reference' => '1c21d60bebe67c0122335bd3fe977990435af0a3', 'type' => 'library', 'install_path' => __DIR__ . '/../sentry/sentry', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.6.0', 'version' => '3.6.0.0', 'reference' => '63afe740e99a13ba87ec199bb07bbdee937a5b62', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/options-resolver' => array('pretty_version' => 'v6.4.30', 'version' => '6.4.30.0', 'reference' => 'eeaa8cabe54c7b3516938c72a4a161c0cc80a34f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/options-resolver', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-php84' => array('pretty_version' => 'v1.33.0', 'version' => '1.33.0.0', 'reference' => 'd8ced4d875142b6a7426000426b8abc631d6b191', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php84', 'aliases' => array(), 'dev_requirement' => \false))); -
pay-with-flex/trunk/vendor/composer/platform_check.php
r3427514 r3428340 5 5 $issues = array(); 6 6 7 if (!(PHP_VERSION_ID >= 80 400)) {8 $issues[] = 'Your Composer dependencies require a PHP version ">= 8. 4.0". You are running ' . PHP_VERSION . '.';7 if (!(PHP_VERSION_ID >= 80100)) { 8 $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; 9 9 } 10 10 -
pay-with-flex/trunk/vendor/scoper-autoload.php
r3427514 r3428340 30 30 } 31 31 } 32 humbug_phpscoper_expose_class('ComposerAutoloaderInit 400fe045e9fce44650d89f3d72a1981a', 'Flex\ComposerAutoloaderInit400fe045e9fce44650d89f3d72a1981a');32 humbug_phpscoper_expose_class('ComposerAutoloaderInitf720d3c2e1d29922303b6c6cd82eb01a', 'Flex\ComposerAutoloaderInitf720d3c2e1d29922303b6c6cd82eb01a'); 33 33 humbug_phpscoper_expose_class('Deprecated', 'Flex\Deprecated'); 34 34 humbug_phpscoper_expose_class('ReflectionConstant', 'Flex\ReflectionConstant'); -
pay-with-flex/trunk/vendor/symfony/options-resolver/CHANGELOG.md
r3427514 r3428340 1 1 CHANGELOG 2 2 ========= 3 4 8.05 ---6 7 * Remove support for nested options definition via `setDefault()`, use `setOptions()` instead8 9 7.310 ---11 12 * Support union type in `OptionResolver::setAllowedTypes()` method13 * Add `OptionsResolver::setOptions()` and `OptionConfigurator::options()` methods14 * Deprecate defining nested options via `setDefault()`, use `setOptions()` instead15 3 16 4 6.4 17 5 --- 18 6 19 * Improve message with full path on invalid type in nested option7 * Improve message with full path on invalid type in nested option 20 8 21 9 6.3 -
pay-with-flex/trunk/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php
r3352167 r3428340 90 90 return ($this->get)('deprecated', $option, \sprintf('No deprecation was set for the "%s" option.', $option)); 91 91 } 92 /**93 * @return \Closure[]94 *95 * @throws NoConfigurationException when no nested option is configured96 */97 public function getNestedOptions(string $option): array98 {99 return ($this->get)('nested', $option, \sprintf('No nested option was set for the "%s" option.', $option));100 }101 92 } -
pay-with-flex/trunk/vendor/symfony/options-resolver/OptionConfigurator.php
r3352167 r3428340 14 14 final class OptionConfigurator 15 15 { 16 public function __construct(private string $name, private OptionsResolver $resolver) 16 private string $name; 17 private OptionsResolver $resolver; 18 public function __construct(string $name, OptionsResolver $resolver) 17 19 { 20 $this->name = $name; 21 $this->resolver = $resolver; 18 22 $this->resolver->setDefined($name); 19 23 } … … 123 127 return $this; 124 128 } 125 /**126 * Defines nested options.127 *128 * @param \Closure(OptionsResolver $resolver, Options $parent): void $nested129 *130 * @return $this131 */132 public function options(\Closure $nested): static133 {134 $this->resolver->setOptions($this->name, $nested);135 return $this;136 }137 129 } -
pay-with-flex/trunk/vendor/symfony/options-resolver/OptionsResolver.php
r3427514 r3428340 140 140 * sub-classes. 141 141 * 142 * If you want to define nested options, you can pass a closure with the 143 * following signature: 144 * 145 * $options->setDefault('database', function (OptionsResolver $resolver) { 146 * $resolver->setDefined(['dbname', 'host', 'port', 'user', 'pass']); 147 * } 148 * 149 * To get access to the parent options, add a second argument to the closure's 150 * signature: 151 * 152 * function (OptionsResolver $resolver, Options $parent) { 153 * // 'default' === $parent['connection'] 154 * } 155 * 142 156 * @return $this 143 157 * … … 169 183 $this->lazy[$option][] = $value; 170 184 $this->defined[$option] = \true; 171 // Make sure the option is processed 172 unset($this->resolved[$option] );185 // Make sure the option is processed and is not nested anymore 186 unset($this->resolved[$option], $this->nested[$option]); 173 187 return $this; 174 188 } 175 } 176 // This option is not lazy anymore 177 unset($this->lazy[$option]); 189 if (isset($params[0]) && ($type = $params[0]->getType()) instanceof \ReflectionNamedType && self::class === $type->getName() && (!isset($params[1]) || ($type = $params[1]->getType()) instanceof \ReflectionNamedType && Options::class === $type->getName())) { 190 // Store closure for later evaluation 191 $this->nested[$option][] = $value; 192 $this->defaults[$option] = []; 193 $this->defined[$option] = \true; 194 // Make sure the option is processed and is not lazy anymore 195 unset($this->resolved[$option], $this->lazy[$option]); 196 return $this; 197 } 198 } 199 // This option is not lazy nor nested anymore 200 unset($this->lazy[$option], $this->nested[$option]); 178 201 // Yet undefined options can be marked as resolved, because we only need 179 202 // to resolve options with lazy closures, normalizers or validation … … 313 336 return array_keys($this->defined); 314 337 } 315 /**316 * Defines nested options.317 *318 * @param \Closure(self $resolver, Options $parent): void $nested319 *320 * @return $this321 */322 public function setOptions(string $option, \Closure $nested): static323 {324 if ($this->locked) {325 throw new AccessException('Nested options cannot be defined from a lazy option or normalizer.');326 }327 // Store closure for later evaluation328 $this->nested[$option][] = $nested;329 $this->defaults[$option] = [];330 $this->defined[$option] = \true;331 // Make sure the option is processed332 unset($this->resolved[$option]);333 return $this;334 }335 338 public function isNested(string $option): bool 336 339 { … … 407 410 * @throws AccessException If called from a lazy option or normalizer 408 411 */ 409 public function setNormalizer(string $option, \Closure $normalizer) : static412 public function setNormalizer(string $option, \Closure $normalizer) 410 413 { 411 414 if ($this->locked) { … … 481 484 * @throws AccessException If called from a lazy option or normalizer 482 485 */ 483 public function setAllowedValues(string $option, mixed $allowedValues) : static486 public function setAllowedValues(string $option, mixed $allowedValues) 484 487 { 485 488 if ($this->locked) { … … 516 519 * @throws AccessException If called from a lazy option or normalizer 517 520 */ 518 public function addAllowedValues(string $option, mixed $allowedValues) : static521 public function addAllowedValues(string $option, mixed $allowedValues) 519 522 { 520 523 if ($this->locked) { … … 550 553 * @throws AccessException If called from a lazy option or normalizer 551 554 */ 552 public function setAllowedTypes(string $option, string|array $allowedTypes) : static555 public function setAllowedTypes(string $option, string|array $allowedTypes) 553 556 { 554 557 if ($this->locked) { … … 579 582 * @throws AccessException If called from a lazy option or normalizer 580 583 */ 581 public function addAllowedTypes(string $option, string|array $allowedTypes) : static584 public function addAllowedTypes(string $option, string|array $allowedTypes) 582 585 { 583 586 if ($this->locked) { … … 795 798 } 796 799 $value = $this->defaults[$option]; 797 // Resolve the option if the default value is lazily evaluated798 if (isset($this->lazy[$option])) {799 // If the closure is already being called, we have a cyclic dependency800 if (isset($this->calling[$option])) {801 throw new OptionDefinitionException(\sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));802 }803 $this->calling[$option] = \true;804 try {805 foreach ($this->lazy[$option] as $closure) {806 $value = $closure($this, $value);807 }808 } finally {809 unset($this->calling[$option]);810 }811 }812 800 // Resolve the option if it is a nested definition 813 801 if (isset($this->nested[$option])) { … … 819 807 throw new InvalidOptionsException(\sprintf('The nested option "%s" with value %s is expected to be of type array, but is of type "%s".', $this->formatOptions([$option]), $this->formatValue($value), get_debug_type($value))); 820 808 } 809 // The following section must be protected from cyclic calls. 821 810 $this->calling[$option] = \true; 822 811 try { … … 849 838 } 850 839 } 840 // Resolve the option if the default value is lazily evaluated 841 if (isset($this->lazy[$option])) { 842 // If the closure is already being called, we have a cyclic 843 // dependency 844 if (isset($this->calling[$option])) { 845 throw new OptionDefinitionException(\sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); 846 } 847 // The following section must be protected from cyclic 848 // calls. Set $calling for the current $option to detect a cyclic 849 // dependency 850 // BEGIN 851 $this->calling[$option] = \true; 852 try { 853 foreach ($this->lazy[$option] as $closure) { 854 $value = $closure($this, $value); 855 } 856 } finally { 857 unset($this->calling[$option]); 858 } 859 // END 860 } 851 861 // Validate the type of the resolved option 852 862 if (isset($this->allowedTypes[$option])) { … … 947 957 return $value; 948 958 } 949 private function verifyTypes(string $type, mixed $value, ?array &$invalidTypes = null, int $level = 0): bool 950 { 951 $type = trim($type); 952 $allowedTypes = $this->splitOutsideParenthesis($type); 953 if (\count($allowedTypes) > 1) { 954 foreach ($allowedTypes as $allowedType) { 955 if ($this->verifyTypes($allowedType, $value)) { 956 return \true; 957 } 958 } 959 if (\is_array($invalidTypes) && (!$invalidTypes || $level > 0)) { 960 $invalidTypes[get_debug_type($value)] = \true; 961 } 962 return \false; 963 } 964 $type = $allowedTypes[0]; 965 if (str_starts_with($type, '(') && str_ends_with($type, ')')) { 966 return $this->verifyTypes(substr($type, 1, -1), $value, $invalidTypes, $level); 967 } 959 private function verifyTypes(string $type, mixed $value, array &$invalidTypes, int $level = 0): bool 960 { 968 961 if (\is_array($value) && str_ends_with($type, '[]')) { 969 962 $type = substr($type, 0, -2); … … 979 972 return \true; 980 973 } 981 if ( \is_array($invalidTypes) && (!$invalidTypes || $level > 0)) {974 if (!$invalidTypes || $level > 0) { 982 975 $invalidTypes[get_debug_type($value)] = \true; 983 976 } 984 977 return \false; 985 }986 /**987 * @return list<string>988 */989 private function splitOutsideParenthesis(string $type): array990 {991 return preg_split(<<<'EOF'992 /993 # Define a recursive subroutine for matching balanced parentheses994 (?(DEFINE)995 (?<balanced>996 \( # Match an opening parenthesis997 (?: # Start a non-capturing group for the contents998 [^()] # Match any character that is not a parenthesis999 | # OR1000 (?&balanced) # Recursively match a nested balanced group1001 )* # Repeat the group for all contents1002 \) # Match the final closing parenthesis1003 )1004 )1005 1006 # Match any balanced parenthetical group, then skip it1007 (?&balanced)(*SKIP)(*FAIL) # Use the defined subroutine and discard the match1008 1009 | # OR1010 1011 \| # Match the pipe delimiter (only if not inside a skipped group)1012 /x1013 EOF, $type);1014 978 } 1015 979 /** -
pay-with-flex/trunk/vendor/symfony/options-resolver/composer.json
r3427514 r3428340 21 21 ], 22 22 "require": { 23 "php": ">=8. 4",23 "php": ">=8.1", 24 24 "symfony\/deprecation-contracts": "^2.5|^3" 25 25 },
Note: See TracChangeset
for help on using the changeset viewer.