+++ /dev/null
-<?php
-/**
- * This exception is thrown when an unexpected state is detected.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- *
- * 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 InvalidStateException extends FrameworkException {
- /**
- * The super constructor for all exceptions
- *
- * @param $messageArray Error message array
- * @param $code Error code
- * @return void
- */
- public function __construct (Stateable $stateInstance, $code) {
- // Construct the message
- $message = sprintf('[%s:%d] Unexpected state detected.',
- $stateInstance->__toString(),
- $this->getLine()
- );
-
- // Call parent exception constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
--- /dev/null
+<?php
+/**
+ * This exception is thrown when an unexpected state is detected.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ *
+ * 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 UnexpectedStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $messageArray Error message array
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct (Stateable $stateInstance, $code) {
+ // Construct the message
+ $message = sprintf('[%s:%d] Unexpected state detected.',
+ $stateInstance->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
// And remove it finally
$this->getStackInstance()->popNamed(self::STACKER_NAME_DECLARED);
- } catch (InvalidStateException $e) {
+ } catch (UnexpectedStateException $e) {
// The state is not excepected (shall be 'connected')
self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Caught ' . $e->__toString() . ',message=' . $e->getMessage());
* class.
*
* @return void
- * @todo ~10% done
+ * @todo 0% done
*/
protected function initProducer () {
$this->partialStub('Please implement this method.');
* class.
*
* @return void
- * @todo ~10% done
+ * @todo 0% done
*/
protected function initProducer () {
$this->partialStub('Please implement this method.');
* it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'active'
+ * @throws UnexpectedStateException If the state is not 'active'
*/
public function validateCommunicatorStateIsActive () {
// Just compare it...
if (!$this instanceof CommunicatorActiveState) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
}
* it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'active'
+ * @throws UnexpectedStateException If the state is not 'active'
*/
public function validateCrawlerStateIsActive () {
// Just compare it...
if (!$this instanceof CrawlerActiveState) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
}
* it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'active'
+ * @throws UnexpectedStateException If the state is not 'active'
*/
public function validateCruncherStateIsActive () {
// Just compare it...
if (!$this instanceof CruncherActiveState) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
* is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'virgin'
+ * @throws UnexpectedStateException If the state is not 'virgin'
*/
public function validateDhtStateIsVirginOrInit () {
// Just compare it...
if ((!$this instanceof DhtVirginState) && (!$this instanceof DhtInitState)) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
* it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'active'
+ * @throws UnexpectedStateException If the state is not 'active'
*/
public function validateMinerStateIsActive () {
// Just compare it...
if (!$this instanceof MinerActiveState) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
* it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'init'
+ * @throws UnexpectedStateException If the state is not 'init'
*/
public function validateMinerStateIsInit () {
// Just compare it...
if (!$this instanceof MinerInitState) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
* it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'booting'
+ * @throws UnexpectedStateException If the state is not 'booting'
*/
public function validateMinerStateIsBooting () {
// Just compare it...
if (!$this instanceof MinerBootingState) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
* it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'active'
+ * @throws UnexpectedStateException If the state is not 'active'
*/
public function validateNodeStateIsActive () {
// Just compare it...
if (!$this instanceof NodeActiveState) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
* exception if it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'active' and not 'announcing'
+ * @throws UnexpectedStateException If the state is not 'active' and not 'announcing'
*/
public function validateNodeStateIsActiveOrAnnouncing () {
// Just compare it...
if ((!$this instanceof NodeActiveState) && (!$this instanceof NodeAnnouncingState)) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
* exception if it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'active' and not 'reachable'
+ * @throws UnexpectedStateException If the state is not 'active' and not 'reachable'
*/
public function validateNodeStateIsActiveOrReachable () {
// Just compare it...
if ((!$this instanceof NodeActiveState) && (!$this instanceof NodeReachableState)) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
* exception if it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'active' and not 'announcing'
+ * @throws UnexpectedStateException If the state is not 'active' and not 'announcing'
*/
public function validateNodeStateIsAnnouncementCompleted () {
// Just compare it...
if (!$this instanceof NodeAnnouncementCompletedState) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
}
* it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'connected'
+ * @throws UnexpectedStateException If the state is not 'connected'
*/
public function validatePeerStateConnected () {
// Just compare it...
if (!$this->isPeerStateConnected()) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
-Subproject commit b2caf380b85fbe804d7464ecc1bfe60aafcbc7d9
+Subproject commit cc0e0b439900fd1ffb882f9150f37dd3eb8d301d