From ece0e83715a7e40cdc4d58b2bec198ba2e626d32 Mon Sep 17 00:00:00 2001 From: Timur Karimov Date: Tue, 25 Jun 2024 09:47:28 +0200 Subject: [PATCH] simplify branching logic --- includes/class-wc-payments-token-service.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/class-wc-payments-token-service.php b/includes/class-wc-payments-token-service.php index a23a30d053f..0eb810bce75 100644 --- a/includes/class-wc-payments-token-service.php +++ b/includes/class-wc-payments-token-service.php @@ -251,16 +251,16 @@ private function get_gateway_specific_retrievable_payment_types( $gateway_id ) { $types = []; foreach ( self::REUSABLE_GATEWAYS_BY_PAYMENT_METHOD as $payment_method => $gateway ) { - if ( $gateway === $gateway_id ) { - // Stripe Link is part of the card gateway, so we need to check separately if Link is enabled. - if ( Payment_Method::LINK === $payment_method ) { - if ( $this->is_payment_method_enabled( Payment_Method::LINK ) ) { - $types[] = Payment_Method::LINK; - } - } else { - $types[] = $payment_method; - } + if ( $gateway !== $gateway_id ) { + continue; + } + + // Stripe Link is part of the card gateway, so we need to check separately if Link is enabled. + if ( Payment_Method::LINK === $payment_method && ! $this->is_payment_method_enabled( Payment_Method::LINK ) ) { + continue; } + + $types[] = $payment_method; } return $types;