From 3833914f2456d1493afb9b18784877aa7e3c1697 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 21 Oct 2019 23:59:41 +1300 Subject: [PATCH] Combine IF clause for readability. I'm still making sense of https://github.com/civicrm/civicrm-core/pull/15330 but these lines are simply a readability change & 'hiving them off' into a separate PR & getting that merged should make the actual changes in that PR more parsable. --- CRM/Financial/BAO/PaymentProcessor.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/CRM/Financial/BAO/PaymentProcessor.php b/CRM/Financial/BAO/PaymentProcessor.php index fbf922c7c6..27f563d5f1 100644 --- a/CRM/Financial/BAO/PaymentProcessor.php +++ b/CRM/Financial/BAO/PaymentProcessor.php @@ -371,23 +371,22 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces $testProcessors = in_array('TestMode', $capabilities) ? self::getAllPaymentProcessors('test') : []; if (is_array($ids)) { $processors = self::getAllPaymentProcessors('all', FALSE, FALSE); - } - else { - $processors = self::getAllPaymentProcessors('all'); - } - - if (in_array('TestMode', $capabilities) && is_array($ids)) { - $possibleLiveIDs = array_diff($ids, array_keys($testProcessors)); - foreach ($possibleLiveIDs as $possibleLiveID) { - if (isset($processors[$possibleLiveID]) && ($liveProcessorName = $processors[$possibleLiveID]['name']) != FALSE) { - foreach ($testProcessors as $index => $testProcessor) { - if ($testProcessor['name'] == $liveProcessorName) { - $ids[] = $testProcessor['id']; + if (in_array('TestMode', $capabilities)) { + $possibleLiveIDs = array_diff($ids, array_keys($testProcessors)); + foreach ($possibleLiveIDs as $possibleLiveID) { + if (isset($processors[$possibleLiveID]) && ($liveProcessorName = $processors[$possibleLiveID]['name']) != FALSE) { + foreach ($testProcessors as $index => $testProcessor) { + if ($testProcessor['name'] == $liveProcessorName) { + $ids[] = $testProcessor['id']; + } } } } + $processors = $testProcessors; } - $processors = $testProcessors; + } + else { + $processors = self::getAllPaymentProcessors('all'); } foreach ($processors as $index => $processor) { -- 2.25.1