]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #2597: Pulled __set, __get, __isset magic functions definitions into ElggData
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 31 Oct 2010 01:00:01 +0000 (01:00 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 31 Oct 2010 01:00:01 +0000 (01:00 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7163 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggAnnotation.php
engine/classes/ElggData.php
engine/classes/ElggEntity.php
engine/classes/ElggMetadata.php
engine/classes/ElggRelationship.php

index d99f5fc9a6af135137b08d2bd2db54f15ab0e110..da43aea23c8525bd10ed1d59d7ccdb8262591b28 100644 (file)
@@ -45,29 +45,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
         *
index 97c33bbb5b3cf89f1bcb6e77213b2f347a2281b4..7ab169c971b9dcfd6566d8f56ff7742e5d96997a 100644 (file)
@@ -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
         * 
index 7532bd9dd56dd85f5c4a4506c4e901da34b92822..2128a35e96810eaf2203489551615a5e2aca3601 100644 (file)
@@ -260,42 +260,6 @@ abstract class ElggEntity extends ElggData implements
                return null;
        }
 
-       /**
-        * 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.
         *
index 24365d4d929ad2b29f0b60d8383ae9df51e01a08..90cbba5bd11818a82b44bb7ff0ac559697030301 100644 (file)
@@ -42,29 +42,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
         *
index 376150f9f85e9a4ecd0ff2b2e2302481426e7bbb..413527df34862bbaefd140fafc78f1664ddb16f0 100644 (file)
@@ -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;
        }