Commit 434aa0e1 authored by Ana Rute Mendes's avatar Ana Rute Mendes 🌈
Browse files

Nit pick: replace if statements with switch

These conditions will increase, to keep the code cleaner replace 3
if statements with a switch
parent f355732b
...@@ -448,32 +448,34 @@ final class ManiphestTransactionEditor ...@@ -448,32 +448,34 @@ final class ManiphestTransactionEditor
break; break;
case PhabricatorTransactions::TYPE_CUSTOMFIELD: case PhabricatorTransactions::TYPE_CUSTOMFIELD:
if ($xaction->getMetadataValue('customfield:key') == 'std:maniphest:purchasing:approver') { switch ($xaction->getMetadataValue('customfield:key')) {
foreach ($xaction->getRequiredHandlePHIDs() as $p) { case 'std:maniphest:purchasing:approver':
if (!empty($p)) { foreach ($xaction->getRequiredHandlePHIDs() as $p) {
$approver = $p; if (!empty($p)) {
$approver = $p;
break;
}
}
break; break;
}
}
}
if ($xaction->getMetadataValue('customfield:key') == 'std:maniphest:purchasing:project') { case 'std:maniphest:purchasing:project':
foreach ($xaction->getRequiredHandlePHIDs() as $p) { foreach ($xaction->getRequiredHandlePHIDs() as $p) {
if (!empty($p)) { if (!empty($p)) {
$purchasing_project = $p; $purchasing_project = $p;
break;
}
}
break; break;
}
}
}
if ($xaction->getMetadataValue('customfield:key') == 'std:maniphest:sysadmin:confidential-request') { case 'std:maniphest:sysadmin:confidential-request':
if ($xaction->getNewValue() != $xaction->getOldValue()) { if ($xaction->getNewValue() != $xaction->getOldValue()) {
$changed_confidentiality = true; $changed_confidentiality = true;
} }
if ($xaction->getNewValue() == 'Yes' || $xaction->getNewValue() == 'Dunno') { if ($xaction->getNewValue() == 'Yes' || $xaction->getNewValue() == 'Dunno') {
$confidential = true; $confidential = true;
}
break;
} }
}
break; break;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment