// Call parent constructor
parent::__construct($className);
}
+
+ /**
+ * Validates whether the state is 'connected' or throws an exception if
+ * it is every other state.
+ *
+ * @return void
+ * @throws InvalidStateException 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);
+ } // END - if
+ }
+
+ /**
+ * Checks whether the peer's state is 'connected'
+ *
+ * @return $isConnected Whether the state is 'connected'
+ */
+ public function isPeerStateConnected () {
+ // Just compare it...
+ return ($this instanceof ConnectedPeerState);
+ }
}
// [EOF]