Skip to content

Commit

Permalink
MonitoredObject: Implement awesome __isset()
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Fuhr committed Sep 30, 2014
1 parent ac2aeca commit e6c674e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/monitoring/library/Monitoring/Object/MonitoredObject.php
Expand Up @@ -442,7 +442,7 @@ public function __get($name)
{
if (property_exists($this->properties, $name)) {
return $this->properties->$name;
} elseif (isset($this->$name)) {
} elseif (property_exists($this, $name) && $this->$name !== null) {
return $this->$name;
} elseif (property_exists($this, $name)) {
$fetchMethod = 'fetch' . ucfirst($name);
Expand All @@ -458,6 +458,16 @@ public function __get($name)
throw new InvalidPropertyException('Can\'t access property \'%s\'. Property does not exist.', $name);
}

public function __isset($name)
{
if (property_exists($this->properties, $name)) {
return isset($this->properties->$name);
} elseif (property_exists($this, $name)) {
return isset($this->$name);
}
return false;
}

/**
* @deprecated
*/
Expand Down

0 comments on commit e6c674e

Please sign in to comment.