From acc1a46b0ce203f2603278438b49cbcfa3dbe3ec Mon Sep 17 00:00:00 2001 From: L3RAZ Date: Tue, 12 Nov 2024 11:25:17 +0200 Subject: [PATCH] CS fixes --- src/PayPal/Order/Cache/PayPalOrderCache.php | 7 +------ src/PayPal/Order/PaypalOrderDataProvider.php | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/PayPal/Order/Cache/PayPalOrderCache.php b/src/PayPal/Order/Cache/PayPalOrderCache.php index 46ddcfd73..031d3b3c4 100644 --- a/src/PayPal/Order/Cache/PayPalOrderCache.php +++ b/src/PayPal/Order/Cache/PayPalOrderCache.php @@ -22,7 +22,6 @@ namespace PrestaShop\Module\PrestashopCheckout\PayPal\Order\Cache; use PsCheckoutCart; -use Psr\SimpleCache\InvalidArgumentException; use Symfony\Component\Cache\Simple\ChainCache; class PayPalOrderCache extends ChainCache @@ -38,13 +37,9 @@ class PayPalOrderCache extends ChainCache ]; /** - * @param string $key - * @param $value - * @param int $ttl Time To Live in seconds. Defines how long the value will be stored in the cache. + * {@inheritdoc} * * @return bool - * - * @throws InvalidArgumentException */ public function set($key, $value, $ttl = null) { diff --git a/src/PayPal/Order/PaypalOrderDataProvider.php b/src/PayPal/Order/PaypalOrderDataProvider.php index 344d71fd3..b2c0fc1aa 100644 --- a/src/PayPal/Order/PaypalOrderDataProvider.php +++ b/src/PayPal/Order/PaypalOrderDataProvider.php @@ -158,15 +158,16 @@ public function isTokenSaved() public function getPaymentTokenIdentifier() { - $fundingSource = $this->payPalOrder->getFundingSource(); - - if ($this->payPalOrder && isset($this->payPalOrder->getPaymentSource()[$fundingSource])) { - $paymentSource = $this->payPalOrder->getPaymentSource()[$fundingSource]; - - if ($fundingSource === 'card') { - return (isset($paymentSource['brand']) ? $paymentSource['brand'] : '') . (isset($paymentSource['last_digits']) ? ' *' . $paymentSource['last_digits'] : ''); - } else { - return isset($paymentSource['email_address']) ? $paymentSource['email_address'] : ''; + if ($this->payPalOrder) { + $fundingSource = $this->payPalOrder->getFundingSource(); + if (isset($this->payPalOrder->getPaymentSource()[$fundingSource])) { + $paymentSource = $this->payPalOrder->getPaymentSource()[$fundingSource]; + + if ($fundingSource === 'card') { + return (isset($paymentSource['brand']) ? $paymentSource['brand'] : '') . (isset($paymentSource['last_digits']) ? ' *' . $paymentSource['last_digits'] : ''); + } else { + return isset($paymentSource['email_address']) ? $paymentSource['email_address'] : ''; + } } }