From 76753e5cdf33650971d16f767a33b44068e9365f Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Sat, 15 Apr 2023 15:16:45 +0100 Subject: [PATCH] Reworked based on @elidrissidev suggestions --- app/code/core/Mage/Paypal/Model/Config.php | 44 +++++++--------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/app/code/core/Mage/Paypal/Model/Config.php b/app/code/core/Mage/Paypal/Model/Config.php index 62000252072..9d722ad7f68 100644 --- a/app/code/core/Mage/Paypal/Model/Config.php +++ b/app/code/core/Mage/Paypal/Model/Config.php @@ -19,32 +19,6 @@ * * @category Mage * @package Mage_Paypal - * - * @property mixed $allow_ba_signup; - * @property mixed $api_cert; - * @property mixed $api_password; - * @property mixed $api_signature; - * @property mixed $api_username; - * @property mixed $apiAuthentication; - * @property mixed $apiPassword; - * @property mixed $apiSignature; - * @property mixed $apiUsername; - * @property mixed $business_account; - * @property mixed $businessAccount; - * @property mixed $buttonFlavor; - * @property mixed $buttonType; - * @property mixed $cctypes; - * @property mixed $debug; - * @property mixed $lineItemsEnabled; - * @property mixed $lineItemsSummary; - * @property mixed $payment_action; - * @property mixed $paymentAction; - * @property mixed $paymentMarkSize; - * @property mixed $requireBillingAddress; - * @property mixed $sandboxFlag; - * @property mixed $solutionType; - * @property mixed $transferShippingOptions; - * @property mixed $verifyPeer; */ class Mage_Paypal_Model_Config { @@ -619,8 +593,10 @@ class Mage_Paypal_Model_Config 'zh_XC', ]; - public $visible_on_cart; - public $visible_on_product; + /** + * @var array + */ + protected $_config = []; /** * Set method and store id, if specified @@ -776,11 +752,19 @@ public function isMethodAvailable($methodCode = null) */ public function __get($key) { + if (array_key_exists($key, $this->_config)) { + return $this->_config[$key]; + } + $underscored = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $key)); + if (array_key_exists($underscored, $this->_config)) { + return $this->_config[$underscored]; + } + $value = Mage::getStoreConfig($this->_getSpecificConfigPath($underscored), $this->_storeId); $value = $this->_prepareValue($underscored, $value); - $this->$key = $value; - $this->$underscored = $value; + $this->_config[$key] = $value; + $this->_config[$underscored] = $value; return $value; }