- if ($packageInstance->isNewRawDataPending()) {
- // We have to handle raw data from the socket
- $packageInstance->handleIncomingSocketRawData();
- } elseif ($packageInstance->isNewPackageArrived()) {
- // Okay, then handle newly arrived package
- $packageInstance->handleNewlyArrivedPackage();
+ if ($packageInstance->isProcessedMessagePending()) {
+ /*
+ * A previously proccessed message is waiting for being
+ * "interpreted". This is done by trying to find a configuration
+ * entry based on 'message_type' element.
+ */
+ $packageInstance->handleProcessedMessage();
+ } elseif ($packageInstance->isNewMessageArrived()) {
+ /*
+ * A fully "decoded" message has been received and added for being
+ * processed. Processing a message should not take long, so mostly
+ * this step involves reading all data through a XML template engine
+ * as "XML variables" from the content (which must be a well-formed
+ * XML) and then pushing it on the next stack "processed messages".
+ */
+ $packageInstance->handleNewlyArrivedMessage();
+ } elseif ($packageInstance->isIncomingRawDataHandled()) {
+ /*
+ * Incoming decoded data has been handled (see below) so it needs to
+ * be assembled back to a "package array". Please see NetworkPackage
+ * for further details (what array elements are required et cetera).
+ */
+ $packageInstance->assembleDecodedDataToPackage();
+ } elseif ($packageInstance->ifMultipleMessagesPending()) {
+ /*
+ * Some raw data contained multiple messages which where now splitted.
+ */
+ $packageInstance->handleMultipleMessages();
+ } elseif ($packageInstance->isNewRawDataPending($this->getListenerPoolInstance())) {
+ // Raw, decoded data has been received
+ $packageInstance->handleIncomingDecodedData();
+ } elseif ($packageInstance->ifAssemblerHasPendingDataLeft()) {
+ // Handle any pending data from the package assembler
+ $packageInstance->handleAssemblerPendingData();