From eafb06602425cab205093576a630baa6207dca06 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 8 Dec 2016 17:30:16 +0100 Subject: [PATCH] DbResourceForm: make code a bit less redundand refs #11115 --- .../forms/Config/Resource/DbResourceForm.php | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/application/forms/Config/Resource/DbResourceForm.php b/application/forms/Config/Resource/DbResourceForm.php index 25bf3b39f..d2730cae3 100644 --- a/application/forms/Config/Resource/DbResourceForm.php +++ b/application/forms/Config/Resource/DbResourceForm.php @@ -46,24 +46,13 @@ class DbResourceForm extends Form $encryptionChoices = array(); $offerPostgres = false; $offerMysql = false; - if (isset($formData['db'])) { - if ($formData['db'] === 'pgsql') { - $offerPostgres = true; - } elseif ($formData['db'] === 'mysql') { - $offerMysql = true; - if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) { - $encryptionChoices['ssl'] = 'SSL'; - } - } - } else { - $dbChoice = key($dbChoices); - if ($dbChoice === 'pgsql') { - $offerPostgres = true; - } elseif ($dbChoice === 'mysql') { - $offerMysql = true; - if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) { - $encryptionChoices['ssl'] = 'SSL'; - } + $dbChoice = isset($formData['db']) ? $formData['db'] : key($dbChoices); + if ($dbChoice === 'pgsql') { + $offerPostgres = true; + } elseif ($dbChoice === 'mysql') { + $offerMysql = true; + if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) { + $encryptionChoices['ssl'] = 'SSL'; } }