// Is the stack not yet initialized?
if (!$this->isStackInitialized($stackerName)) {
// Throw an exception
- throw new BadMethodCallException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
} // END - if
// So, is the stack full?
// Is the stack not yet initialized?
if (!$this->isStackInitialized($stackerName)) {
// Throw an exception
- throw new BadMethodCallException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
} // END - if
// So, is the stack empty?
// Is the stack not yet initialized?
if (!$this->isStackInitialized($stackerName)) {
// Throw an exception
- throw new BadMethodCallException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
} // END - if
// Now, count the array of entries
* @param $stackerName Name of the stack
* @return $value Value of last added value
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
protected function getLastValue (string $stackerName) {
// Is the stack not yet initialized or full?
if (!$this->isStackInitialized($stackerName)) {
// Throw an exception
- throw new BadMethodCallException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
} elseif ($this->isStackEmpty($stackerName)) {
// Throw an exception
- throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
}
// Now get the last value
* @param $stackerName Name of the stack
* @return $value Value of last added value
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
protected function getFirstValue (string $stackerName) {
// Is the stack not yet initialized or full?
if (!$this->isStackInitialized($stackerName)) {
// Throw an exception
- throw new BadMethodCallException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
} elseif ($this->isStackEmpty($stackerName)) {
// Throw an exception
- throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
}
// Now get the first value
* @param $stackerName Name of the stack
* @return $value Value "poped" from array
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
protected function popLast (string $stackerName) {
// Is the stack not yet initialized or full?
if (!$this->isStackInitialized($stackerName)) {
// Throw an exception
- throw new BadMethodCallException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
} elseif ($this->isStackEmpty($stackerName)) {
// Throw an exception
- throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
}
// Now, remove the last entry, we don't care about the return value here, see elseif() block above
* @param $stackerName Name of the stack
* @return $value Value "shifted" from array
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
protected function popFirst (string $stackerName) {
// Is the stack not yet initialized or full?
if (!$this->isStackInitialized($stackerName)) {
// Throw an exception
- throw new BadMethodCallException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_NO_STACKER_FOUND);
} elseif ($this->isStackEmpty($stackerName)) {
// Throw an exception
- throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ throw new BadMethodCallException(sprintf('stackerName=%s not yet initialized but method called.', $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
}
// Now, remove the last entry, we don't care about the return value here, see elseif() block above
* @return void
* @throws StackerFullException If the stack is full
*/
- public function pushNamed ($stackerName, $value) {
+ public function pushNamed (string $stackerName, $value) {
// Call the protected method
parent::addValue($stackerName, $value);
}
* @param $stackerName Name of the stack
* @return $value Value of the current stack entry
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
- public function popNamed ($stackerName) {
+ public function popNamed (string $stackerName) {
// Get the value
$value = $this->getNamed($stackerName);
* @param $stackerName Name of the stack
* @return $value Value of last added value
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
- public function getNamed ($stackerName) {
+ public function getNamed (string $stackerName) {
// Call the protected method
return parent::getFirstValue($stackerName);
}
*
* @param $stackerName Name of the stack
* @return $value Value of last added value
- * @throws EmptyStackerException If the stack is empty
+ * @throws BadMethodCallException If the stack is empty
*/
protected function getLastValue (string $stackerName) {
// Is the stack not yet initialized or full?
if ($this->isStackEmpty($stackerName)) {
// Throw an exception
- throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ throw new BadMethodCallException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
} // END - if
// Now get the last value
*
* @param $stackerName Name of the stack
* @return $value Value of last added value
- * @throws EmptyStackerException If the stack is empty
+ * @throws BadMethodCallException If the stack is empty
*/
protected function getFirstValue (string $stackerName) {
// Is the stack not yet initialized or full?
if ($this->isStackEmpty($stackerName)) {
// Throw an exception
- throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ throw new BadMethodCallException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
} // END - if
// Now get the first value
*
* @param $stackerName Name of the stack
* @return $value Value "poped" from array
- * @throws EmptyStackerException If the stack is empty
+ * @throws BadMethodCallException If the stack is empty
*/
protected function popLast (string $stackerName) {
// Is the stack not yet initialized or full?
if ($this->isStackEmpty($stackerName)) {
// Throw an exception
- throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ throw new BadMethodCallException(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
*
* @param $stackerName Name of the stack
* @return $value Value "shifted" from array
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
protected function popFirst (string $stackerName) {
// Is the stack not yet initialized or full?
if ($this->isStackEmpty($stackerName)) {
// Throw an exception
- throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
+ throw new BadMethodCallException(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
* @return void
* @throws StackerFullException If the stack is full
*/
- public function pushNamed ($stackerName, $value) {
+ public function pushNamed (string $stackerName, $value) {
// Call the protected method
parent::addValue($stackerName, $value);
}
* @param $stackerName Name of the stack
* @return $value Value of the current stack entry
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
- public function popNamed ($stackerName) {
+ public function popNamed (string $stackerName) {
// Get the value
$value = $this->getNamed($stackerName);
* @param $stackerName Name of the stack
* @return $value Value of last added value
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
- public function getNamed ($stackerName) {
+ public function getNamed (string $stackerName) {
// Call the protected method
return parent::getFirstValue($stackerName);
}
* @return void
* @throws StackerFullException If the stack is full
*/
- public function pushNamed ($stackerName, $value) {
+ public function pushNamed (string $stackerName, $value) {
// Call the protected method
parent::addValue($stackerName, $value);
}
* @param $stackerName Name of the stack
* @return $value Value of the current stack entry
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
- public function popNamed ($stackerName) {
+ public function popNamed (string $stackerName) {
// Get the value
$value = $this->getNamed($stackerName);
* @param $stackerName Name of the stack
* @return $value Value of last added value
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
- public function getNamed ($stackerName) {
+ public function getNamed (string $stackerName) {
// Call the protected method
return parent::getLastValue($stackerName);
}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Deprecated;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Generic\FrameworkException;
-
-/**
- * Thrown if a stacker is empty
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- * @deprecated Don't use this anymore
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class EmptyStackerException extends FrameworkException {
- /**
- * The super constructor for all exceptions
- *
- * @param $messageArray Error message array
- * @param $code Error code
- * @return void
- */
- public function __construct (array $messageArray, int $code) {
- // Construct message
- $message = sprintf('[%s:%d] Stacker %s is empty.',
- $messageArray[0]->__toString(),
- $this->getLine(),
- $messageArray[1]
- );
-
- // Call parent exception constructor
- parent::__construct($message, $code);
- }
-
-}
* @param $stackerName Name of the stacker
* @return $value Value of the current stack entry
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
function popNamed (string $stackerName);
* @param $stackerName Name of the stacker
* @return $value Value of last added value
* @throws BadMethodCallException If the named stacker was not found
- * @throws EmptyStackerException If the named stacker is empty
+ * @throws BadMethodCallException If the named stacker is empty
*/
function getNamed (string $stackerName);