diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-31 01:00:01 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-31 01:00:01 +0000 |
commit | aed5a35ed9fa851c96b6e18485188f49de127f1c (patch) | |
tree | 5a3072bcfb3f3060191d744f973c8af1103de2f3 /engine/classes/ElggData.php | |
parent | 0c70cbd09644c3c38f3cb1a1857ff8b77607c945 (diff) | |
download | elgg-aed5a35ed9fa851c96b6e18485188f49de127f1c.tar.gz elgg-aed5a35ed9fa851c96b6e18485188f49de127f1c.tar.bz2 |
Refs #2597: Pulled __set, __get, __isset magic functions definitions into ElggData
git-svn-id: http://code.elgg.org/elgg/trunk@7163 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/ElggData.php')
-rw-r--r-- | engine/classes/ElggData.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/engine/classes/ElggData.php b/engine/classes/ElggData.php index 97c33bbb5..7ab169c97 100644 --- a/engine/classes/ElggData.php +++ b/engine/classes/ElggData.php @@ -32,6 +32,47 @@ abstract class ElggData implements $this->attributes['time_created'] = ''; } + + /** + * Return an attribute or a piece of metadata. + * + * @param string $name Name + * + * @return mixed + */ + public function __get($name) { + return $this->get($name); + } + + /** + * Set an attribute or a piece of metadata. + * + * @param string $name Name + * @param mixed $value Value + * + * @return mixed + */ + public function __set($name, $value) { + return $this->set($name, $value); + } + + /** + * Test if property is set either as an attribute or metadata. + * + * @tip Use isset($entity->property) + * + * @param string $name The name of the attribute or metadata. + * + * @return bool + */ + function __isset($name) { + return $this->$name !== NULL; + } + + abstract protected function get($name); + + abstract protected function set($name, $value); + /** * Get a URL for this object * |