]> git.mxchange.org Git - core.git/commitdiff
popNamed() does also now return the current stacker's value.
authorRoland Häder <roland@mxchange.org>
Thu, 28 Apr 2011 14:34:37 +0000 (14:34 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 28 Apr 2011 14:34:37 +0000 (14:34 +0000)
inc/classes/interfaces/stacker/class_Stackable.php
inc/classes/main/stacker/fifo/class_FiFoStacker.php
inc/classes/main/stacker/filo/class_FiLoStacker.php

index f8ef7fe8ee3278a93a68837e13bc358a0ae18444..34b6cf18324e64e9876c54100a9d5abff408b60e 100644 (file)
@@ -33,17 +33,17 @@ interface Stackable extends FrameworkInterface {
        function pushNamed ($stackerName, $value);
 
        /**
        function pushNamed ($stackerName, $value);
 
        /**
-        * 'Pops' a value from a named stacker
+        * 'Pops' a value from a named stacker and returns it's value
         *
         * @param       $stackerName    Name of the stacker
         *
         * @param       $stackerName    Name of the stacker
-        * @return      void
+        * @return      $value                  Value of the current stack entry
         * @throws      NoStackerException      If the named stacker was not found
         * @throws      EmptyStackerException   If the named stacker is empty
         */
        function popNamed ($stackerName);
 
        /**
         * @throws      NoStackerException      If the named stacker was not found
         * @throws      EmptyStackerException   If the named stacker is empty
         */
        function popNamed ($stackerName);
 
        /**
-        * Get value from named stacker
+        * Get value from named stacker but don't "pop" it
         *
         * @param       $stackerName    Name of the stacker
         * @return      $value                  Value of last added value
         *
         * @param       $stackerName    Name of the stacker
         * @return      $value                  Value of last added value
index 5b036a4feda7f4973df96657e9309c13494c52fa..7b33cd9d8c3b9e78860c994512d00f778a6d152a 100644 (file)
@@ -62,16 +62,22 @@ class FiFoStacker extends BaseStacker implements Stackable {
        }
 
        /**
        }
 
        /**
-        * 'Pops' a value from a named stacker
+        * 'Pops' a value from a named stacker and returns it's value
         *
         * @param       $stackerName    Name of the stack
         *
         * @param       $stackerName    Name of the stack
-        * @return      void
+        * @return      $value                  Value of the current stack entry
         * @throws      NoStackerException      If the named stacker was not found
         * @throws      EmptyStackerException   If the named stacker is empty
         */
        public function popNamed ($stackerName) {
         * @throws      NoStackerException      If the named stacker was not found
         * @throws      EmptyStackerException   If the named stacker is empty
         */
        public function popNamed ($stackerName) {
+               // Get the value
+               $value = $this->getNamed($stackerName();
+
                // Call the protected method
                parent::popFirst($stackerName);
                // Call the protected method
                parent::popFirst($stackerName);
+
+               // Return the value
+               return $value;
        }
 
        /**
        }
 
        /**
index 1d2d94afe7c5326c94c6e39ceaabe513e2c3d3b0..81604945e974d2e91342d7e560bf7c9543569cc1 100644 (file)
@@ -62,16 +62,22 @@ class FiLoStacker extends BaseStacker implements Stackable {
        }
 
        /**
        }
 
        /**
-        * 'Pops' a value from a named stacker
+        * 'Pops' a value from a named stacker and returns it's value
         *
         * @param       $stackerName    Name of the stack
         *
         * @param       $stackerName    Name of the stack
-        * @return      void
+        * @return      $value                  Value of the current stack entry
         * @throws      NoStackerException      If the named stacker was not found
         * @throws      EmptyStackerException   If the named stacker is empty
         */
        public function popNamed ($stackerName) {
         * @throws      NoStackerException      If the named stacker was not found
         * @throws      EmptyStackerException   If the named stacker is empty
         */
        public function popNamed ($stackerName) {
+               // Get the value
+               $value = $this->getNamed($stackerName();
+
                // Call the protected method
                parent::popLast($stackerName);
                // Call the protected method
                parent::popLast($stackerName);
+
+               // Return the value
+               return $value;
        }
 
        /**
        }
 
        /**