X-Git-Url: https://git.mxchange.org/?p=hub.git;a=blobdiff_plain;f=application%2Fhub%2Fmain%2Fstates%2Fminer%2Fclass_BaseMinerState.php;h=cf53991ee82dfbda8b559aef5be42fc392a99f9c;hp=891a7221d0a2e46bb00d8b61b3d788b94d8da16a;hb=73aff29b9bc78031853b0b8c0fe0a8e04f66ac29;hpb=72871c3489dd8048f273f0cef908e6f28997ae2b diff --git a/application/hub/main/states/miner/class_BaseMinerState.php b/application/hub/main/states/miner/class_BaseMinerState.php index 891a7221d..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,28 @@ 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 + } + + /** + * Validates whether the state is 'booting' or throws an exception if + * it is every other state. + * + * @return void + * @throws UnexpectedStateException If the state is not 'booting' + */ + public function validateMinerStateIsBooting () { + // Just compare it... + if (!$this instanceof MinerBootingState) { + // Throw the exception + throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE); } // END - if }