From: Roland Haeder Date: Wed, 10 Jun 2015 19:23:08 +0000 (+0200) Subject: - Renamed InvalidStateException to UnexpectedStateException X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=98355573139973cb7c3cdabda075492917cecde8;p=hub.git - Renamed InvalidStateException to UnexpectedStateException - Updated 'core' Signed-off-by: Roland Haeder --- diff --git a/application/hub/exceptions/state/class_InvalidStateException.php b/application/hub/exceptions/state/class_InvalidStateException.php deleted file mode 100644 index 5d1d3472e..000000000 --- a/application/hub/exceptions/state/class_InvalidStateException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/application/hub/exceptions/state/class_UnexpectedStateException.php b/application/hub/exceptions/state/class_UnexpectedStateException.php new file mode 100644 index 000000000..4613814f5 --- /dev/null +++ b/application/hub/exceptions/state/class_UnexpectedStateException.php @@ -0,0 +1,45 @@ + + * @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 . + */ +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] +?> diff --git a/application/hub/main/package/class_NetworkPackage.php b/application/hub/main/package/class_NetworkPackage.php index 20af55662..a6328fab9 100644 --- a/application/hub/main/package/class_NetworkPackage.php +++ b/application/hub/main/package/class_NetworkPackage.php @@ -889,7 +889,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // 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()); diff --git a/application/hub/main/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php b/application/hub/main/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php index 18f399853..0abd16c37 100644 --- a/application/hub/main/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php +++ b/application/hub/main/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php @@ -56,7 +56,7 @@ class MinerRealGenesisBlockProducer extends BaseBlockProducer implements BlockPr * class. * * @return void - * @todo ~10% done + * @todo 0% done */ protected function initProducer () { $this->partialStub('Please implement this method.'); diff --git a/application/hub/main/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php b/application/hub/main/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php index b710328bf..fbf80a39f 100644 --- a/application/hub/main/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php +++ b/application/hub/main/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php @@ -56,7 +56,7 @@ class MinerTestGenesisBlockProducer extends BaseBlockProducer implements BlockPr * class. * * @return void - * @todo ~10% done + * @todo 0% done */ protected function initProducer () { $this->partialStub('Please implement this method.'); diff --git a/application/hub/main/states/communicator/class_BaseCommunicatorState.php b/application/hub/main/states/communicator/class_BaseCommunicatorState.php index 99688600e..32a055406 100644 --- a/application/hub/main/states/communicator/class_BaseCommunicatorState.php +++ b/application/hub/main/states/communicator/class_BaseCommunicatorState.php @@ -38,13 +38,13 @@ class BaseCommunicatorState extends BaseState { * 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 } } diff --git a/application/hub/main/states/crawler/class_BaseCrawlerState.php b/application/hub/main/states/crawler/class_BaseCrawlerState.php index 03dbf5ffa..fbb75fda4 100644 --- a/application/hub/main/states/crawler/class_BaseCrawlerState.php +++ b/application/hub/main/states/crawler/class_BaseCrawlerState.php @@ -38,13 +38,13 @@ class BaseCrawlerState extends BaseState { * 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 } } diff --git a/application/hub/main/states/cruncher/class_BaseCruncherState.php b/application/hub/main/states/cruncher/class_BaseCruncherState.php index 1c08782a2..246bd812e 100644 --- a/application/hub/main/states/cruncher/class_BaseCruncherState.php +++ b/application/hub/main/states/cruncher/class_BaseCruncherState.php @@ -38,13 +38,13 @@ class BaseCruncherState extends BaseState { * 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 } diff --git a/application/hub/main/states/dht/class_BaseDhtState.php b/application/hub/main/states/dht/class_BaseDhtState.php index efc3b51c0..44e0b5584 100644 --- a/application/hub/main/states/dht/class_BaseDhtState.php +++ b/application/hub/main/states/dht/class_BaseDhtState.php @@ -39,13 +39,13 @@ class BaseDhtState extends BaseState { * 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 } diff --git a/application/hub/main/states/miner/class_BaseMinerState.php b/application/hub/main/states/miner/class_BaseMinerState.php index 0208d7a2c..cf53991ee 100644 --- a/application/hub/main/states/miner/class_BaseMinerState.php +++ b/application/hub/main/states/miner/class_BaseMinerState.php @@ -38,13 +38,13 @@ class BaseMinerState extends BaseState { * 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 } @@ -53,13 +53,13 @@ class BaseMinerState extends BaseState { * 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 } @@ -68,13 +68,13 @@ class BaseMinerState extends BaseState { * 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 } diff --git a/application/hub/main/states/node/class_BaseNodeState.php b/application/hub/main/states/node/class_BaseNodeState.php index 3cb1c628e..171331df8 100644 --- a/application/hub/main/states/node/class_BaseNodeState.php +++ b/application/hub/main/states/node/class_BaseNodeState.php @@ -38,13 +38,13 @@ class BaseNodeState extends BaseState { * 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 } @@ -53,13 +53,13 @@ class BaseNodeState extends BaseState { * 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 } @@ -68,13 +68,13 @@ class BaseNodeState extends BaseState { * 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 } @@ -83,13 +83,13 @@ class BaseNodeState extends BaseState { * 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 } } diff --git a/application/hub/main/states/peer/class_BasePeerState.php b/application/hub/main/states/peer/class_BasePeerState.php index 7bc1513c8..cbbc183f2 100644 --- a/application/hub/main/states/peer/class_BasePeerState.php +++ b/application/hub/main/states/peer/class_BasePeerState.php @@ -38,13 +38,13 @@ class BasePeerState extends BaseState { * 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 } diff --git a/core b/core index b2caf380b..cc0e0b439 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit b2caf380b85fbe804d7464ecc1bfe60aafcbc7d9 +Subproject commit cc0e0b439900fd1ffb882f9150f37dd3eb8d301d