[Solar-svn] Revision 2765

pmjones at solarphp.com pmjones at solarphp.com
Fri Sep 21 11:32:54 CDT 2007


branch: Solar_Struct: [CHG] "Unified" internals so that ArrayAccess and Iterator methods call __get(), __set(), __isset(), and __unset().



Modified: branches/orm/Solar/Struct.php
===================================================================
--- branches/orm/Solar/Struct.php	2007-09-20 18:24:15 UTC (rev 2764)
+++ branches/orm/Solar/Struct.php	2007-09-21 16:32:54 UTC (rev 2765)
@@ -147,9 +147,7 @@
      */
     public function __get($key)
     {
-        if (array_key_exists($key, $this->_data)) {
-            return $this->_data[$key];
-        }
+        return $this->_data[$key];
     }
     
     /**
@@ -198,6 +196,7 @@
      */
     public function __unset($key)
     {
+        $this->_data[$key] = null;
         unset($this->_data[$key]);
     }
     
@@ -249,7 +248,7 @@
      */
     public function offsetExists($key)
     {
-        return array_key_exists($key, $this->_data);
+        return $this->__isset($key);
     }
     
     /**
@@ -293,8 +292,7 @@
      */
     public function offsetUnset($key)
     {
-        $this->_data[$key] = null;
-        unset($this->_data[$key]);
+        $this->__unset($key);
     }
     
     /**
@@ -311,19 +309,19 @@
     
     /**
      * 
-     * Iterator: get the current key value.
+     * Iterator: get the current value for the array pointer.
      * 
      * @return mixed
      * 
      */
     public function current()
     {
-        return current($this->_data);
+        return $this->__get($this->key());
     }
     
     /**
      * 
-     * Iterator: what is the key at the current position?
+     * Iterator: get the current key for the array pointer.
      * 
      * @return mixed
      * 




More information about the Solar-svn mailing list