return $isPending;
}
- /**
- * Handles multiple messages.
- *
- * @return void
- * @todo 0% done
- */
- public function handleMultipleMessages () {
- $this->partialStub('Unfinished method.');
- }
-
/**
* Handles the assembler's pending data
*
BaseRawDataHandler::PACKAGE_ERROR_CODE => BaseRawDataHandler::SOCKET_ERROR_UNHANDLED
);
- // Clear pending data
+ /*
+ * Clear pending data as it has been processed and will be handled some
+ * lines below.
+ */
$this->clearPendingData();
// Debug message
} // END - if
/*
- * "explode" the string from 'raw_data' with chunk separator to
- * get an array of chunks. These chunks must then be verified by
- * their checksums. Also the final chunk must be handled.
+ * "explode" the string from 'raw_data' with chunk separator to get an
+ * array of chunks. These chunks must then be verified by their
+ * checksums. Also the final chunk must be handled.
*/
$chunks = explode(PackageFragmenter::CHUNK_SEPARATOR, $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]);
$this->getHandlerInstance()->addAllChunksWithFinal($chunks);
}
+ /**
+ * Handles multiple messages.
+ *
+ * @return void
+ */
+ public function handleMultipleMessages () {
+ // Assert on condition
+ assert($this->ifMultipleMessagesPending());
+ assert($this->isPendingDataEmpty());
+
+ // "Pop" next entry from stack and set it as new pending data
+ $this->pendingData = $this->getStackerInstance()->popNamed(self::STACKER_NAME_MULTIPLE_MESSAGE);
+
+ // And handle it
+ $this->handlePendingData();
+ }
+
/**
* Accepts the visitor to process the visit "request"
*