php - How can I write this Drupal snippet more efficiently? -
i'm working on patch submit registration code module drupal. in short, there more efficient way write code below?
if (module_exists('regcode_voucher')) { $cnfg = variable_get('regcode_voucher_display', array('regform' => 'regform')); if (empty($cnfg['regform'])) { return; } }
it seems should able reduce 1 if
statement &&
combining 2 conditions, haven't found syntax or necessary php array function allow me that.
in case context helps, regcode_voucher sub-module allows users enter registration code on user edit page. on our sites, after "beta" period, want simplify registration form removing registration code field; we'd users still able enter code on account edit page. code above part of patch allows regcode's hook_user changes bypassed.
code looks good, efficient want? little changes may be:
if (module_exists('regcode_voucher')) { $cnfg = variable_get('regcode_voucher_display', null); if ($cnfg) { // actions } }
and don't recommend merge if..., code should clear , simpler understand. if merge these optimizing, win "tiny" milliseconds real-live processors, lost clean code.
Comments
Post a Comment