aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/classes/ElggAnnotation.php23
-rw-r--r--engine/classes/ElggData.php41
-rw-r--r--engine/classes/ElggEntity.php36
-rw-r--r--engine/classes/ElggMetadata.php23
-rw-r--r--engine/classes/ElggRelationship.php4
5 files changed, 43 insertions, 84 deletions
diff --git a/engine/classes/ElggAnnotation.php b/engine/classes/ElggAnnotation.php
index d99f5fc9a..da43aea23 100644
--- a/engine/classes/ElggAnnotation.php
+++ b/engine/classes/ElggAnnotation.php
@@ -46,29 +46,6 @@ class ElggAnnotation extends ElggExtender {
}
/**
- * Class member get overloading
- *
- * @param string $name The name of the value to get
- *
- * @return mixed
- */
- function __get($name) {
- return $this->get($name);
- }
-
- /**
- * Class member set overloading
- *
- * @param string $name The name of the value to set
- * @param mixed $value The value to set
- *
- * @return mixed
- */
- function __set($name, $value) {
- return $this->set($name, $value);
- }
-
- /**
* Save this instance
*
* @return int an object id
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
*
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index 7532bd9dd..2128a35e9 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -261,42 +261,6 @@ abstract class ElggEntity extends ElggData implements
}
/**
- * Return an attribute or a piece of metadata.
- *
- * @param string $name Name
- *
- * @return mixed
- */
- 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
- */
- 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;
- }
-
- /**
* Unset a property from metadata or attribute.
*
* @warning If you use this to unset an attribute, you must save the object!
diff --git a/engine/classes/ElggMetadata.php b/engine/classes/ElggMetadata.php
index 24365d4d9..90cbba5bd 100644
--- a/engine/classes/ElggMetadata.php
+++ b/engine/classes/ElggMetadata.php
@@ -43,29 +43,6 @@ class ElggMetadata extends ElggExtender {
}
/**
- * Class member get overloading
- *
- * @param string $name Name
- *
- * @return mixed
- */
- function __get($name) {
- return $this->get($name);
- }
-
- /**
- * Class member set overloading
- *
- * @param string $name Name
- * @param mixed $value Value
- *
- * @return mixed
- */
- function __set($name, $value) {
- return $this->set($name, $value);
- }
-
- /**
* Determines whether or not the user can edit this piece of metadata
*
* @return true|false Depending on permissions
diff --git a/engine/classes/ElggRelationship.php b/engine/classes/ElggRelationship.php
index 376150f9f..413527df3 100644
--- a/engine/classes/ElggRelationship.php
+++ b/engine/classes/ElggRelationship.php
@@ -40,7 +40,7 @@ class ElggRelationship extends ElggData implements
*
* @return mixed
*/
- function __get($name) {
+ function get($name) {
if (isset($this->attributes[$name])) {
return $this->attributes[$name];
}
@@ -56,7 +56,7 @@ class ElggRelationship extends ElggData implements
*
* @return mixed
*/
- function __set($name, $value) {
+ function set($name, $value) {
$this->attributes[$name] = $value;
return true;
}