Commit efe1f683 authored by Ana Rute Mendes's avatar Ana Rute Mendes ✌🏼

Nit pick: replace if statements with switch

These conditions will increase, to keep the code cleaner replace 3
if statements with a switch
parent 3c158c34
......@@ -439,32 +439,34 @@ final class ManiphestTransactionEditor
break;
case PhabricatorTransactions::TYPE_CUSTOMFIELD:
if ($xaction->getMetadataValue('customfield:key') == 'std:maniphest:purchasing:approver') {
foreach ($xaction->getRequiredHandlePHIDs() as $p) {
if (!empty($p)) {
$approver = $p;
switch ($xaction->getMetadataValue('customfield:key')) {
case 'std:maniphest:purchasing:approver':
foreach ($xaction->getRequiredHandlePHIDs() as $p) {
if (!empty($p)) {
$approver = $p;
break;
}
}
break;
}
}
}
if ($xaction->getMetadataValue('customfield:key') == 'std:maniphest:purchasing:project') {
foreach ($xaction->getRequiredHandlePHIDs() as $p) {
if (!empty($p)) {
$purchasing_project = $p;
case 'std:maniphest:purchasing:project':
foreach ($xaction->getRequiredHandlePHIDs() as $p) {
if (!empty($p)) {
$purchasing_project = $p;
break;
}
}
break;
}
}
}
if ($xaction->getMetadataValue('customfield:key') == 'std:maniphest:sysadmin:confidential-request') {
if ($xaction->getNewValue() != $xaction->getOldValue()) {
$changed_confidentiality = true;
}
if ($xaction->getNewValue() == 'Yes' || $xaction->getNewValue() == 'Dunno') {
$confidential = true;
case 'std:maniphest:sysadmin:confidential-request':
if ($xaction->getNewValue() != $xaction->getOldValue()) {
$changed_confidentiality = true;
}
if ($xaction->getNewValue() == 'Yes' || $xaction->getNewValue() == 'Dunno') {
$confidential = true;
}
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