Skip to content

Commit 1d7c34e

Browse files
committed
♻️ Remove ContextTrait duplication, use existing Context class via callable
1 parent 37b2447 commit 1d7c34e

3 files changed

Lines changed: 9 additions & 343 deletions

File tree

modules/ppcp-button/src/Helper/ContextTrait.php

Lines changed: 0 additions & 337 deletions
This file was deleted.

modules/ppcp-compat/src/Settings/SettingsTabMapHelper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use WooCommerce\PayPalCommerce\ApiClient\Entity\ExperienceContext;
1313
use WooCommerce\PayPalCommerce\ApiClient\Helper\PurchaseUnitSanitizer;
14-
use WooCommerce\PayPalCommerce\Button\Helper\ContextTrait;
1514

1615
/**
1716
* A map of old to new styling settings.
@@ -21,8 +20,6 @@
2120
*/
2221
class SettingsTabMapHelper {
2322

24-
use ContextTrait;
25-
2623
/**
2724
* A map of new to old 3d secure values.
2825
*

modules/ppcp-compat/src/Settings/StylingSettingsMapHelper.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use RuntimeException;
1313
use WooCommerce\PayPalCommerce\Applepay\ApplePayGateway;
14-
use WooCommerce\PayPalCommerce\Button\Helper\ContextTrait;
1514
use WooCommerce\PayPalCommerce\Googlepay\GooglePayGateway;
1615
use WooCommerce\PayPalCommerce\Settings\Data\AbstractDataModel;
1716
use WooCommerce\PayPalCommerce\Settings\Data\PaymentSettings;
@@ -25,8 +24,6 @@
2524
*/
2625
class StylingSettingsMapHelper {
2726

28-
use ContextTrait;
29-
3027
protected const BUTTON_NAMES = array( GooglePayGateway::ID, ApplePayGateway::ID );
3128

3229
/**
@@ -45,6 +42,15 @@ public function __construct( callable $context_provider ) {
4542
$this->context_provider = $context_provider;
4643
}
4744

45+
/**
46+
* Returns the current context string.
47+
*
48+
* @return string
49+
*/
50+
private function context(): string {
51+
return ( $this->context_provider )();
52+
}
53+
4854
/**
4955
* Maps old setting keys to new setting style names.
5056
*

0 commit comments

Comments
 (0)