* @return void
* @throws AlreadyInitializedStackerException If the stack is already initialized
*/
- public final function initStacker ($stackerName, $forceReInit = FALSE) {
+ public final function initStack ($stackerName, $forceReInit = FALSE) {
// Is the stack already initialized?
if (($forceReInit === FALSE) && ($this->isStackInitialized($stackerName))) {
// Then throw the exception
- throw new AlreadyInitializedStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_ALREADY_INITIALIZED);
+ throw new AlreadyInitializedStackerException(array($this, $stackerName, $forceReInit), self::EXCEPTION_STACKER_ALREADY_INITIALIZED);
} // END - if
// Initialize the given stack
- $this->initGenericArray('stacks', $stackerName, 'entries', $forceReInit);
+ $this->initGenericArrayKey('stacks', $stackerName, 'entries', $forceReInit);
+ }
+
+ /**
+ * Initializes all stacks
+ *
+ * @return void
+ */
+ public function initStacks (array $stacks, $forceReInit = FALSE) {
+ // "Walk" through all (more will be added as needed
+ foreach ($stacks as $stackerName) {
+ // Init this stack
+ $this->initStack($stackerName, $forceReInit);
+ } // END - foreach
}
/**
// Is the stack not yet initialized or full?
if (!$this->isStackInitialized($stackerName)) {
// Then do it here
- $this->initStacker($stackerName);
+ $this->initStack($stackerName);
} elseif ($this->isStackFull($stackerName)) {
// Stacker is full
throw new FullStackerException(array($this, $stackerName, $value), self::EXCEPTION_STACKER_IS_FULL);
}
// Now add the value to the stack
- $this->pushValueToGenericArrayElement('stacks', $stackerName, 'entries', $value);
+ $this->pushValueToGenericArrayKey('stacks', $stackerName, 'entries', $value);
}
/**