Skip to content

Commit

Permalink
[NFC] swap instances where double = is used but it should be triple =
Browse files Browse the repository at this point in the history
In all the changed cases this is a specific comparison with a string so the change is best practice but not functional.

One unused variable removed
  • Loading branch information
eileenmcnaughton committed Aug 15, 2019
1 parent 92cd6df commit 4009859
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions CRM/Contact/Import/Form/MapField.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function preProcess() {
}

$showColNames = TRUE;
if ($dataSource == 'CRM_Import_DataSource_CSV' && !$skipColumnHeader) {
if ($dataSource === 'CRM_Import_DataSource_CSV' && !$skipColumnHeader) {
$showColNames = FALSE;
}
$this->assign('showColNames', $showColNames);
Expand Down Expand Up @@ -301,7 +301,7 @@ public function buildQuickForm() {
else {
$id = $first = $second = NULL;
}
if (($first == 'a' && $second == 'b') || ($first == 'b' && $second == 'a')) {
if (($first === 'a' && $second === 'b') || ($first === 'b' && $second === 'a')) {
$cType = $contactRelationCache[$id]["contact_type_{$second}"];

//CRM-5125 for contact subtype specific relationshiptypes
Expand All @@ -322,7 +322,7 @@ public function buildQuickForm() {
if (isset($hasLocationTypes[$name])) {
$sel3[$key][$name] = $this->_location_types;
}
elseif ($name == 'url') {
elseif ($name === 'url') {
$sel3[$key][$name] = $websiteTypes;
}
else {
Expand Down Expand Up @@ -354,7 +354,7 @@ public function buildQuickForm() {
}

foreach ($highlightedFields as $k => $v) {
if ($v == $cType || $v == 'All') {
if ($v == $cType || $v === 'All') {
$highlightedRelFields[$key][] = $k;
}
}
Expand Down Expand Up @@ -385,7 +385,7 @@ public function buildQuickForm() {
if (!empty($hasLocationTypes[$key])) {
$options = $this->_location_types;
}
elseif ($key == 'url') {
elseif ($key === 'url') {
$options = $websiteTypes;
}
$sel2[$key] = $options;
Expand All @@ -407,7 +407,6 @@ public function buildQuickForm() {
$js .= "swapOptions($formName, 'mapper[$i]', 0, 3, 'hs_mapper_0_');\n";
if ($hasColumnNames) {
// do array search first to see if has mapped key
$columnKey = '';
$columnKey = array_search($this->_columnNames[$i], $this->_mapperFields);
if (isset($this->_fieldUsed[$columnKey])) {
$defaults["mapper[$i]"] = $columnKey;
Expand Down Expand Up @@ -589,17 +588,17 @@ public function submit($params, $mapperKeys) {

//need to differentiate non location elements.
if ($selOne && (is_numeric($selOne) || $selOne === 'Primary')) {
if ($fldName == 'url') {
if ($fldName === 'url') {
$parserParameters['mapperWebsiteType'][$i] = $websiteTypes[$selOne];
}
else {
$locations[$i] = $locationTypes[$selOne];
$parserParameters['mapperLocType'][$i] = $selOne;
if ($selTwo && is_numeric($selTwo)) {
if ($fldName == 'phone') {
if ($fldName === 'phone') {
$parserParameters['mapperPhoneType'][$i] = $phoneTypes[$selTwo];
}
elseif ($fldName == 'im') {
elseif ($fldName === 'im') {
$parserParameters['mapperImProvider'][$i] = $imProviders[$selTwo];
}
}
Expand All @@ -608,21 +607,21 @@ public function submit($params, $mapperKeys) {

//relationship contact mapper info.
list($id, $first, $second) = CRM_Utils_System::explode('_', $fldName, 3);
if (($first == 'a' && $second == 'b') ||
($first == 'b' && $second == 'a')
if (($first === 'a' && $second === 'b') ||
($first === 'b' && $second === 'a')
) {
$parserParameters['mapperRelated'][$i] = $this->_mapperFields[$fldName];
if ($selOne) {
if ($selOne == 'url') {
if ($selOne === 'url') {
$parserParameters['relatedContactWebsiteType'][$i] = $websiteTypes[$selTwo];
}
else {
$parserParameters['relatedContactLocType'][$i] = CRM_Utils_Array::value($selTwo, $locationTypes);
if ($selThree) {
if ($selOne == 'phone') {
if ($selOne === 'phone') {
$parserParameters['relatedContactPhoneType'][$i] = $phoneTypes[$selThree];
}
elseif ($selOne == 'im') {
elseif ($selOne === 'im') {
$parserParameters['relatedContactImProvider'][$i] = $imProviders[$selThree];
}
}
Expand Down

0 comments on commit 4009859

Please sign in to comment.