From 3d603a3ada560389524dddb3c6c7c7f538f31a44 Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 12 Dec 2020 16:34:28 +1300 Subject: [PATCH] Squash 2 if clauses into 1 The action is the same for both criteria so in_array rather than 2 * if = makes it more readable --- CRM/Contact/Import/Parser/Contact.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 21579263f1..9984c220e2 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -2016,10 +2016,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { civicrm_api('contact', 'delete', $vals); $cid = CRM_Contact_BAO_Contact::createProfileContact($formatted, $contactFields, $contactId, NULL, NULL, $formatted['contact_type']); } - elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { - $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId); - } - elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { + if (in_array((int) $onDuplicate, [CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::DUPLICATE_FILL], TRUE)) { $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId); } // else skip does nothing and just returns an error code. -- 2.25.1