// 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);
}
// 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;
* "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
*/
// 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
*/
// 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');
}
}