Skip to content

Commit

Permalink
MDL-50561 messages: Add missing __isset magic method
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyva committed Jun 19, 2015
1 parent f4bfbd5 commit 2291883
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/classes/message/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,20 @@ public function __set($prop, $value) {
throw new \coding_exception("Invalid property $prop specified");
}

/**
* Magic method to check if property is set.
*
* @param string $prop name of property to check.
* @return bool
* @throws \coding_exception
*/
public function __isset($prop) {
if (in_array($prop, $this->properties)) {
return isset($this->$prop);
}
throw new \coding_exception("Invalid property $prop specified");
}

/**
* This method lets you define content that would be added to the message only for specific message processors.
*
Expand Down

0 comments on commit 2291883

Please sign in to comment.