Renamed 'stacker' -> 'stack'
[core.git] / inc / classes / main / stacker / class_BaseStacker.php
index aaa1adcae20770e9d667c16eb5e757a8a08bd87f..12cfc03113c0163ad1b7775b9e40c5414ca80145 100644 (file)
@@ -47,15 +47,28 @@ class BaseStacker extends BaseFrameworkSystem {
         * @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
        }
 
        /**
@@ -147,14 +160,14 @@ class BaseStacker extends BaseFrameworkSystem {
                // 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);
        }
 
        /**