aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-07-03 07:45:06 -0400
committerCash Costello <cash.costello@gmail.com>2011-07-03 07:45:06 -0400
commitd2c9e39308cfd64ca8a6487aac8e0d44a4e406c9 (patch)
tree2ff27d9b7a4fc3e1948cf87ba310e0895557bbc4
parentc6ae2672c08ee800e730b10a691ead1f2279362b (diff)
downloadelgg-d2c9e39308cfd64ca8a6487aac8e0d44a4e406c9.tar.gz
elgg-d2c9e39308cfd64ca8a6487aac8e0d44a4e406c9.tar.bz2
Fixes #3656 updates the AccessArray interface methods for ElggCache
-rw-r--r--engine/classes/ElggCache.php37
1 files changed, 19 insertions, 18 deletions
diff --git a/engine/classes/ElggCache.php b/engine/classes/ElggCache.php
index 2e697e0bb..5c2cafcb7 100644
--- a/engine/classes/ElggCache.php
+++ b/engine/classes/ElggCache.php
@@ -6,9 +6,7 @@
* @package Elgg.Core
* @subpackage Cache
*/
-abstract class ElggCache implements
- // Override for array access
- ArrayAccess {
+abstract class ElggCache implements ArrayAccess {
/**
* Variables for the cache object.
*
@@ -141,6 +139,9 @@ abstract class ElggCache implements
/**
* Load data from the cache using a given key.
*
+ * @todo $offset is a horrible variable name because it creates confusion
+ * with the ArrayAccess methods
+ *
* @param string $key Name
* @param int $offset Offset
* @param int $limit Limit
@@ -186,12 +187,12 @@ abstract class ElggCache implements
// ARRAY ACCESS INTERFACE //////////////////////////////////////////////////////////
/**
- * Set offset
+ * Assigns a value for the specified key
*
* @see ArrayAccess::offsetSet()
*
- * @param mixed $key Name
- * @param mixed $value Value
+ * @param mixed $key The key (offset) to assign the value to.
+ * @param mixed $value The value to set.
*
* @return void
*/
@@ -200,43 +201,43 @@ abstract class ElggCache implements
}
/**
- * Get offset
+ * Get the value for specified key
*
* @see ArrayAccess::offsetGet()
*
- * @param mixed $key Name
+ * @param mixed $offset The key (offset) to retrieve.
*
- * @return void
+ * @return mixed
*/
function offsetGet($key) {
return $this->load($key);
}
/**
- * Unsets offset
+ * Unsets a key.
*
* @see ArrayAccess::offsetUnset()
*
- * @param mixed $key Name
+ * @param mixed $key The key (offset) to unset.
*
* @return void
*/
function offsetUnset($key) {
- if (isset($this->key)) {
- unset($this->key);
+ if (isset($this->$key)) {
+ unset($this->$key);
}
}
/**
- * Does offset exist
+ * Does key exist
*
* @see ArrayAccess::offsetExists()
*
- * @param mixed $offset Offset
+ * @param mixed $key A key (offset) to check for.
*
- * @return void
+ * @return bool
*/
- function offsetExists($offset) {
- return isset($this->$offset);
+ function offsetExists($key) {
+ return isset($this->$key);
}
}