X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Fstates%2Fnode%2Fclass_BaseNodeState.php;fp=application%2Fhub%2Fmain%2Fstates%2Fnode%2Fclass_BaseNodeState.php;h=d7a1bf962a9abd32bda03ac9361f9178b520878c;hb=e10aa2b808ead315a4b8924f7b2ec2cc349ff414;hp=99ee452b7674f9d6656150596edf8d2f9f563ed7;hpb=39c6d09a6794a279c01d53807991c64324c1d6b2;p=hub.git diff --git a/application/hub/main/states/node/class_BaseNodeState.php b/application/hub/main/states/node/class_BaseNodeState.php index 99ee452b7..d7a1bf962 100644 --- a/application/hub/main/states/node/class_BaseNodeState.php +++ b/application/hub/main/states/node/class_BaseNodeState.php @@ -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]