]> git.mxchange.org Git - hub.git/commitdiff
- Renamed InvalidStateException to UnexpectedStateException
authorRoland Haeder <roland@mxchange.org>
Wed, 10 Jun 2015 19:23:08 +0000 (21:23 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 10 Jun 2015 19:23:34 +0000 (21:23 +0200)
- Updated 'core'

Signed-off-by: Roland Haeder <roland@mxchange.org>
13 files changed:
application/hub/exceptions/state/class_InvalidStateException.php [deleted file]
application/hub/exceptions/state/class_UnexpectedStateException.php [new file with mode: 0644]
application/hub/main/package/class_NetworkPackage.php
application/hub/main/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php
application/hub/main/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php
application/hub/main/states/communicator/class_BaseCommunicatorState.php
application/hub/main/states/crawler/class_BaseCrawlerState.php
application/hub/main/states/cruncher/class_BaseCruncherState.php
application/hub/main/states/dht/class_BaseDhtState.php
application/hub/main/states/miner/class_BaseMinerState.php
application/hub/main/states/node/class_BaseNodeState.php
application/hub/main/states/peer/class_BasePeerState.php
core

diff --git a/application/hub/exceptions/state/class_InvalidStateException.php b/application/hub/exceptions/state/class_InvalidStateException.php
deleted file mode 100644 (file)
index 5d1d347..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?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]
-?>
diff --git a/application/hub/exceptions/state/class_UnexpectedStateException.php b/application/hub/exceptions/state/class_UnexpectedStateException.php
new file mode 100644 (file)
index 0000000..4613814
--- /dev/null
@@ -0,0 +1,45 @@
+<?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]
+?>
index 20af55662d19849f65dc73066efeeddb4ba76b42..a6328fab9e63a0f162b13c0f310a243ab57b4237 100644 (file)
@@ -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());
 
index 18f399853e19e6e34b61ba8bb625b1002bbc8289..0abd16c37327ba16defdc78ac7dc508bf0e2e59d 100644 (file)
@@ -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.');
index b710328bf32575e2d51839256ba298c6eb9f78ca..fbf80a39f0e55fb0024a44207281345cc876db8a 100644 (file)
@@ -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.');
index 99688600ee0a96df28eabab066baa5863bcc634e..32a05540620797ef658839ea3b8156adab07ea67 100644 (file)
@@ -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
        }
 }
index 03dbf5ffa3718be35245d41b1c8c767649cd5956..fbb75fda415d5c6890ba87bdf2fe6c674fdbafc4 100644 (file)
@@ -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
        }
 }
index 1c08782a2dbd1db62d5caaae85ff659243463d6b..246bd812e0c5b9bb6730bc8feb364c303b96ce2d 100644 (file)
@@ -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
        }
 
index efc3b51c0cc5d5bb2898aca5d5e6471dbe3999f5..44e0b5584ffe60c00aa8a540bb0ea810fb169d6b 100644 (file)
@@ -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
        }
 
index 0208d7a2cee02e901ea7aa36f07e4ae7e66ac18f..cf53991ee82dfbda8b559aef5be42fc392a99f9c 100644 (file)
@@ -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
        }
 
index 3cb1c628edd4e5d8ec229635275eedd6522ea503..171331df865a0b3910575f14585b35c82cea9406 100644 (file)
@@ -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
        }
 }
index 7bc1513c81c997461739c7179fd762b084cb4326..cbbc183f2e0c193e72b6840eddc53718f3aa3e09 100644 (file)
@@ -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 b2caf380b85fbe804d7464ecc1bfe60aafcbc7d9..cc0e0b439900fd1ffb882f9150f37dd3eb8d301d 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit b2caf380b85fbe804d7464ecc1bfe60aafcbc7d9
+Subproject commit cc0e0b439900fd1ffb882f9150f37dd3eb8d301d