From 50955dd174f148ea74bb9f2a37dff3d4cc7789a1 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 4 May 2022 00:58:39 +1200 Subject: [PATCH] [REF] [Import] Trivial - simplify variable Assign this->_activeFields[i]->_name to a variable rather than keep repeating it... --- CRM/Contact/Import/Parser/Contact.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index cbdaedf826..a3c1b9df91 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -2933,18 +2933,19 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { $params = []; for ($i = 0; $i < $this->_activeFieldCount; $i++) { - if ($this->_activeFields[$i]->_name == 'do_not_import') { + $fieldName = $this->_activeFields[$i]->_name; + if ($fieldName === 'do_not_import') { continue; } if (isset($this->_activeFields[$i]->_value)) { if (isset($this->_activeFields[$i]->_hasLocationType)) { - if (!isset($params[$this->_activeFields[$i]->_name])) { - $params[$this->_activeFields[$i]->_name] = []; + if (!isset($params[$fieldName])) { + $params[$fieldName] = []; } $value = [ - $this->_activeFields[$i]->_name => $this->_activeFields[$i]->_value, + $fieldName => $this->_activeFields[$i]->_value, 'location_type_id' => $this->_activeFields[$i]->_hasLocationType, ]; @@ -2957,20 +2958,20 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { $value['provider_id'] = $this->_activeFields[$i]->_imProvider; } - $params[$this->_activeFields[$i]->_name][] = $value; + $params[$fieldName][] = $value; } elseif (isset($this->_activeFields[$i]->_websiteType)) { $value = [ - $this->_activeFields[$i]->_name => $this->_activeFields[$i]->_value, + $fieldName => $this->_activeFields[$i]->_value, 'website_type_id' => $this->_activeFields[$i]->_websiteType, ]; - $params[$this->_activeFields[$i]->_name][] = $value; + $params[$fieldName][] = $value; } - if (!isset($params[$this->_activeFields[$i]->_name])) { + if (!isset($params[$fieldName])) { if (!isset($this->_activeFields[$i]->_related)) { - $params[$this->_activeFields[$i]->_name] = $this->_activeFields[$i]->_value; + $params[$fieldName] = $this->_activeFields[$i]->_value; } } -- 2.25.1