X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fstacker%2Fclass_BaseStacker.php;h=32dc9d9cc8dc857d5a2508265ca8409ecdaaded5;hp=d28175804e3d47e511a0db7886156ae4c92919df;hb=95673c6dbd12d46bed603a2724437ed863e3215b;hpb=0f4c80d1fd4050de4c2c9d0b705e534289335ac5 diff --git a/inc/classes/main/stacker/class_BaseStacker.php b/inc/classes/main/stacker/class_BaseStacker.php index d2817580..32dc9d9c 100644 --- a/inc/classes/main/stacker/class_BaseStacker.php +++ b/inc/classes/main/stacker/class_BaseStacker.php @@ -55,7 +55,7 @@ class BaseStacker extends BaseFrameworkSystem { } // END - if // Initialize the given stack - $this->initGenericArray('stacks', $stackerName, 'entries'); + $this->initGenericArrayKey('stacks', $stackerName, 'entries', $forceReInit); } /** @@ -154,7 +154,7 @@ class BaseStacker extends BaseFrameworkSystem { } // Now add the value to the stack - $this->pushValueToGenericArrayElement('stacks', $stackerName, 'entries', $value); + $this->pushValueToGenericArrayKey('stacks', $stackerName, 'entries', $value); } /** @@ -171,7 +171,7 @@ class BaseStacker extends BaseFrameworkSystem { // Throw an exception throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); } elseif ($this->isStackEmpty($stackerName)) { - //Throw an exception + // Throw an exception throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); } @@ -196,12 +196,12 @@ class BaseStacker extends BaseFrameworkSystem { // Throw an exception throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); } elseif ($this->isStackEmpty($stackerName)) { - //Throw an exception + // Throw an exception throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); } // Now get the first value - $value = $this->popGenericArrayElement('stacks', $stackerName, 'entries', 0); + $value = $this->getGenericArrayElement('stacks', $stackerName, 'entries', 0); // Return it return $value; @@ -211,7 +211,7 @@ class BaseStacker extends BaseFrameworkSystem { * "Pops" last entry from stack * * @param $stackerName Name of the stack - * @return void + * @return $value Value "poped" from array * @throws NoStackerException If the named stacker was not found * @throws EmptyStackerException If the named stacker is empty */ @@ -221,19 +221,19 @@ class BaseStacker extends BaseFrameworkSystem { // Throw an exception throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); } elseif ($this->isStackEmpty($stackerName)) { - //Throw an exception + // Throw an exception throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); } // Now, remove the last entry, we don't care about the return value here, see elseif() block above - $this->popGenericArrayElement('stacks', $stackerName, 'entries'); + return $this->popGenericArrayElement('stacks', $stackerName, 'entries'); } /** * "Pops" first entry from stack * * @param $stackerName Name of the stack - * @return void + * @return $value Value "shifted" from array * @throws NoStackerException If the named stacker was not found * @throws EmptyStackerException If the named stacker is empty */ @@ -243,12 +243,12 @@ class BaseStacker extends BaseFrameworkSystem { // Throw an exception throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); } elseif ($this->isStackEmpty($stackerName)) { - //Throw an exception + // Throw an exception throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); } // Now, remove the last entry, we don't care about the return value here, see elseif() block above - $this->shiftGenericArrayElement('stacks', $stackerName, 'entries'); + return $this->shiftGenericArrayElement('stacks', $stackerName, 'entries'); } }