]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/states/node/class_BaseNodeState.php
While self-connect is running, it might be already announced which is fine
[hub.git] / application / hub / main / states / node / class_BaseNodeState.php
index 99ee452b7674f9d6656150596edf8d2f9f563ed7..d7a1bf962a9abd32bda03ac9361f9178b520878c 100644 (file)
@@ -47,6 +47,21 @@ class BaseNodeState extends BaseState {
                        throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
                } // END - if
        }
+
+       /**
+        * Validates whether the state is 'active' or 'announced' or throws an
+        * exception if it is every other state.
+        *
+        * @return      void
+        * @throws      InvalidStateException   If the state is not 'active'
+        */
+       public function validateNodeStateIsActiveOrAnnounced () {
+               // Just compare it...
+               if ((!$this instanceof NodeActiveState) && (!$this instanceof NodeAnnouncedState) {
+                       // Throw the exception
+                       throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+               } // END - if
+       }
 }
 
 // [EOF]