Skip to content

Commit

Permalink
MDL-29325 Enrol : reduced isset calls and improved readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Aparup Banerjee committed Dec 13, 2011
1 parent d919bd0 commit 952a77d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions enrol/imsenterprise/lib.php
Expand Up @@ -359,14 +359,16 @@ function process_group_tag($tagcontents) {
$this->log_line("Course $coursecode not found in Moodle's course idnumbers."); $this->log_line("Course $coursecode not found in Moodle's course idnumbers.");
} else { } else {
// Set shortname to description or description to shortname if one is set but not the other. // 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 // If neither short nor long description are set let if fail
$this->log_line("Neither long nor short name are set for $coursecode"); $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 // If short and ID exist, then give the long short's value, then give short the ID's value
$group->description = $group->shortName; $group->description = $group->shortName;
$group->shortName = $coursecode; $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. // If long and ID exist, then map long to long, then give short the ID's value.
$group->shortName = $coursecode; $group->shortName = $coursecode;
} }
Expand Down

0 comments on commit 952a77d

Please sign in to comment.