From 3b89933d9f72f5fcededed6c26010c321c1fa52c Mon Sep 17 00:00:00 2001 From: Aparup Banerjee Date: Tue, 13 Dec 2011 16:36:49 +0800 Subject: [PATCH] MDL-29325 Enrol : reduced isset calls and improved readability --- enrol/imsenterprise/lib.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/enrol/imsenterprise/lib.php b/enrol/imsenterprise/lib.php index a8ec98e10bd..b04b7f72a7d 100644 --- a/enrol/imsenterprise/lib.php +++ b/enrol/imsenterprise/lib.php @@ -359,14 +359,16 @@ function process_group_tag($tagcontents) { $this->log_line("Course $coursecode not found in Moodle's course idnumbers."); } else { // Set shortname to description or description to shortname if one is set but not the other. - if (!isset($group->description) && !isset($group->shortName)) { + $nodescription = !isset($group->description); + $noshortname = !isset($group->shortname); + if ( $nodescription && $noshortname) { // If neither short nor long description are set let if fail $this->log_line("Neither long nor short name are set for $coursecode"); - } else if (!isset($group->description)) { + } else if ($nodescription) { // If short and ID exist, then give the long short's value, then give short the ID's value $group->description = $group->shortName; $group->shortName = $coursecode; - } else if (!isset($group->shortName)) { + } else if ($noshortname) { // If long and ID exist, then map long to long, then give short the ID's value. $group->shortName = $coursecode; }