From: Coleman Watts Date: Tue, 9 Apr 2019 11:04:19 +0000 (-0400) Subject: Reduce redundant code in CRM_Utils_Type::validate X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;ds=sidebyside;h=03616e6d4faceee256848ef45fcc4def9212a7c6;p=civicrm-core.git Reduce redundant code in CRM_Utils_Type::validate --- diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index e2786712a4..ef066db8f0 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -456,18 +456,6 @@ class CRM_Utils_Type { } break; - case 'CommaSeparatedIntegers': - if (CRM_Utils_Rule::commaSeparatedIntegers($data)) { - return $data; - } - break; - - case 'Boolean': - if (CRM_Utils_Rule::boolean($data)) { - return $data; - } - break; - case 'Float': case 'Money': if (CRM_Utils_Rule::numeric($data)) { @@ -520,47 +508,23 @@ class CRM_Utils_Type { } break; - case 'MysqlColumnNameOrAlias': - if (CRM_Utils_Rule::mysqlColumnNameOrAlias($data)) { - return $data; - } - break; - case 'MysqlOrderByDirection': if (CRM_Utils_Rule::mysqlOrderByDirection($data)) { return strtolower($data); } break; - case 'MysqlOrderBy': - if (CRM_Utils_Rule::mysqlOrderBy($data)) { - return $data; - } - break; - case 'ExtensionKey': if (CRM_Utils_Rule::checkExtensionKeyIsValid($data)) { return $data; } break; - case 'Json': - if (CRM_Utils_Rule::json($data)) { - return $data; - } - break; - - case 'Alphanumeric': - if (CRM_Utils_Rule::alphanumeric($data)) { - return $data; - } - break; - - case 'Color': - if (CRM_Utils_Rule::color($data)) { + default: + $check = lcfirst($type); + if (CRM_Utils_Rule::$check($data)) { return $data; } - break; } if ($abort) {