* @param $stackerName Name of the stack
* @param $value Value to add to this stacker
* @return void
+ * @throws FullStackerException If the stack is full
*/
protected function addValue ($stackerName, $value) {
- } elseif ($this->isStackFull($stackerName)) {
+ // Do some tests
+ if ($this->isStackFull($stackerName)) {
// Stacker is full
throw new FullStackerException(array($this, $stackerName, $value), self::EXCEPTION_STACKER_IS_FULL);
- }
+ } // END - if
// Now add the value to the stack
$this->partialStub('stackerName=' . $stackerName . ',value[]=' . gettype($value));
*
* @param $stackerName Name of the stack
* @return $value Value of last added value
+ * @throws EmptyStackerException If the stack is empty
*/
protected function getLastValue ($stackerName) {
// Is the stack not yet initialized or full?
- } elseif ($this->isStackEmpty($stackerName)) {
+ if ($this->isStackEmpty($stackerName)) {
// Throw an exception
throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
- }
+ } // END - if
// Now get the last value
$this->partialStub('stackerName=' . $stackerName);
*
* @param $stackerName Name of the stack
* @return $value Value of last added value
+ * @throws EmptyStackerException If the stack is empty
*/
protected function getFirstValue ($stackerName) {
// Is the stack not yet initialized or full?
- } elseif ($this->isStackEmpty($stackerName)) {
+ if ($this->isStackEmpty($stackerName)) {
// Throw an exception
throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
- }
+ } // END - if
// Now get the first value
$this->partialStub('stackerName=' . $stackerName);
*
* @param $stackerName Name of the stack
* @return $value Value "poped" from array
+ * @throws EmptyStackerException If the stack is empty
*/
protected function popLast ($stackerName) {
// Is the stack not yet initialized or full?
- } elseif ($this->isStackEmpty($stackerName)) {
+ if ($this->isStackEmpty($stackerName)) {
// Throw an exception
throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
- }
+ } // END - if
// Now, remove the last entry, we don't care about the return value here, see elseif() block above
$this->partialStub('stackerName=' . $stackerName);
*
* @param $stackerName Name of the stack
* @return $value Value "shifted" from array
- * @throws NoStackerException If the named stacker was not found
* @throws EmptyStackerException If the named stacker is empty
*/
protected function popFirst ($stackerName) {
// Is the stack not yet initialized or full?
- } elseif ($this->isStackEmpty($stackerName)) {
+ if ($this->isStackEmpty($stackerName)) {
// Throw an exception
throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
- }
+ } // END - if
// Now, remove the last entry, we don't care about the return value here, see elseif() block above
$this->partialStub('stackerName=' . $stackerName);
// Return result
return $count;
}
-
- /**
- * Checks whether the given stack is empty
- *
- * @param $stackerName Name of the stack
- * @return $isEmpty Whether the stack is empty
- * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
- */
- public final function isStackEmpty ($stackerName) {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION);
- }
}
// [EOF]