protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Remove some attributes
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
*/
public function getIterator () {
// Prepare a default iterator
- $iteratorInstance = ObjectFactory::createObjectByConfiguredName('default_iterator_class');
+ $iteratorInstance = ObjectFactory::createObjectByConfiguredName('default_iterator_class', array($this));
// And return it
return $iteratorInstance;
} elseif (is_string($entry)) {
// String found
$entry2 = crc32($entry) . ':' . strlen($entry);
+ } elseif ((is_array($entry)) && (isset($entry['id']))) {
+ // Supported array found
+ $entry2 = crc32($entry['id']) . ':' . count($entry);
} else {
// Unsupported type detected
$this->debugOutut(__METHOD__ . ': entry type ' . gettype($entry) . ' is unsupported.');
return $isValid;
}
+ /**
+ * Getter for hash from given hash index
+ *
+ * @param $hashIndex Index holding the hash
+ * @return $hash The hash
+ */
+ public final function getHash ($hashIndex) {
+ // Get it ...
+ $hash = $this->listIndex[$hashIndex];
+
+ // ... and return it
+ return $hash;
+ }
+
/**
* Gets an entry from given hash index
*
* @param $hashIndex The hash index to resolve the mapped entry
* @return $entry Solved entry from list
- * @throws InvalidListHashException If the solved hash index is invalid
+ * @throws InvalidListHashException If the solved hash index is invalid
*/
public function getEntry ($hashIndex) {
// Get the hash value
- $hash = $this->listIndex[$hashIndex];
+ $hash = $this->getHash($hashIndex);
// Is the hash valid?
if (!$this->isHashValid($hash)) {
// Return it
return $entry;
}
+
+ /**
+ * Updates the given entry by hash with given array
+ *
+ * @param $hash Hash for this entry
+ * @param $entryArray Array with entry we should update
+ * @return void
+ * @throws InvalidListHashException If the solved hash index is invalid
+ */
+ public function updateCurrentEntryByHash ($hash, array $entryArray) {
+ // Is the hash valid?
+ if (!$this->isHashValid($hash)) {
+ // Throw an exception here, hashIndex is unknown at this point
+ throw new InvalidListHashException(array($this, $hash, -999), self::EXCEPTION_INVALID_HASH);
+ }
+
+ // Set the entry
+ $this->listEntries[$hash] = $entryArray;
+ }
}
//