return $hasAnnounced;
}
+ /**
+ * Checks whether this node has attempted to announce itself and completed it
+ *
+ * @return $hasAnnouncementCompleted Whether this node has attempted to announce itself and completed it
+ * @todo Add checking if this node has been announced to the sender node
+ */
+ public function ifNodeHasAnnouncementCompleted () {
+ // Debug message
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): state=' . $this->getStateInstance()->getStateName());
+
+ // Simply check the state of this node
+ $hasAnnouncementCompleted = ($this->getStateInstance() instanceof NodeAnnouncementCompletedState);
+
+ // Debug message
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted));
+
+ // Return it
+ return $hasAnnouncementCompleted;
+ }
+
/**
* Enables whether this node accepts announcements
*
* @todo Handle thrown exception
*/
public function handleAnswerStatusByMessageData (array $messageData, Receivable $packageInstance) {
+ // Is it not empty?
+ assert(!empty($messageData[NetworkPackage::MESSAGE_DATA_ANSWER_STATUS]));
+
// Construct configuration entry for handling class' name
- $classConfigEntry = strtolower($messageData[NetworkPackage::MESSAGE_ARRAY_TYPE] . '_status_' . $messageData[XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_ANSWER_STATUS]) . '_handler_class';
+ $classConfigEntry = strtolower($messageData[NetworkPackage::MESSAGE_ARRAY_TYPE] . '_status_' . $messageData[NetworkPackage::MESSAGE_DATA_ANSWER_STATUS]) . '_handler_class';
// Try to get a class
$handlerInstance = ObjectFactory::createObjectByConfiguredName($classConfigEntry);