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;
+ }
}
//