diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-30 23:28:11 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-30 23:28:11 +0000 |
commit | 1ebe92a96d5543e5d2ddcb1b7ca6e735962aaaef (patch) | |
tree | a3d3a1229fde6bffe233daf002d285aacbdebe1e /engine/classes/ElggExtender.php | |
parent | 99537cc078096e84414b8e598fb2a9dadbd1c803 (diff) | |
download | elgg-1ebe92a96d5543e5d2ddcb1b7ca6e735962aaaef.tar.gz elgg-1ebe92a96d5543e5d2ddcb1b7ca6e735962aaaef.tar.bz2 |
Refs #2597: Pulled identical {{{Iterator}}} and {{{ArrayAccess}}} implementations into {{{ElggData}}}
git-svn-id: http://code.elgg.org/elgg/trunk@7154 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/ElggExtender.php')
-rw-r--r-- | engine/classes/ElggExtender.php | 146 |
1 files changed, 2 insertions, 144 deletions
diff --git a/engine/classes/ElggExtender.php b/engine/classes/ElggExtender.php index 707906bac..d6ea14ba8 100644 --- a/engine/classes/ElggExtender.php +++ b/engine/classes/ElggExtender.php @@ -19,17 +19,9 @@ */ abstract class ElggExtender extends ElggData implements Exportable, - Loggable, // Can events related to this object class be logged - Iterator, // Override foreach behaviour - ArrayAccess // Override for array access + Loggable // Can events related to this object class be logged { - /** - * Holds attributes to save to database - * - * @var array - */ - protected $attributes; - + /** * Returns an attribute * @@ -231,138 +223,4 @@ abstract class ElggExtender extends ElggData implements return $this->name; } - - /* - * ITERATOR INTERFACE - */ - - /* - * This lets an entity's attributes be displayed using foreach as a normal array. - * Example: http://www.sitepoint.com/print/php5-standard-library - */ - private $valid = FALSE; - - /** - * Iterator interface - * - * @see Iterator::rewind() - * - * @return void - */ - function rewind() { - $this->valid = (FALSE !== reset($this->attributes)); - } - - /** - * Iterator interface - * - * @see Iterator::current() - * - * @return void - */ - function current() { - return current($this->attributes); - } - - /** - * Iterator interface - * - * @see Iterator::key() - * - * @return void - */ - function key() { - return key($this->attributes); - } - - /** - * Iterator interface - * - * @see Iterator::next() - * - * @return void - */ - function next() { - $this->valid = (FALSE !== next($this->attributes)); - } - - /** - * Iterator interface - * - * @see Iterator::valid() - * - * @return void - */ - function valid() { - return $this->valid; - } - - /* - * ARRAY ACCESS INTERFACE - */ - - /* - * This lets an entity's attributes be accessed like an associative array. - * Example: http://www.sitepoint.com/print/php5-standard-library - */ - - /** - * Array access interface - * - * @see ArrayAccess::offsetSet() - * - * @param mixed $key Name - * @param mixed $value Value - * - * @return void - */ - function offsetSet($key, $value) { - if (array_key_exists($key, $this->attributes)) { - $this->attributes[$key] = $value; - } - } - - /** - * Array access interface - * - * @see ArrayAccess::offsetGet() - * - * @param mixed $key Name - * - * @return void - */ - function offsetGet($key) { - if (array_key_exists($key, $this->attributes)) { - return $this->attributes[$key]; - } - } - - /** - * Array access interface - * - * @see ArrayAccess::offsetUnset() - * - * @param mixed $key Name - * - * @return void - */ - function offsetUnset($key) { - if (array_key_exists($key, $this->attributes)) { - // Full unsetting is dangerious for our objects - $this->attributes[$key] = ""; - } - } - - /** - * Array access interface - * - * @see ArrayAccess::offsetExists() - * - * @param int $offset Offset - * - * @return int - */ - function offsetExists($offset) { - return array_key_exists($offset, $this->attributes); - } } |