models/classes/runner/communicator/QtiCommunicationService.php
public function processInput(QtiRunnerServiceContext $context, array $input)
    {
        $responses = [];

        foreach ($input as $data) {
            if (!is_array($data) || !isset($data['channel']) || !isset($data['message'])) {
                throw new \common_exception_InconsistentData('Wrong message chunk received by the bidirectional communication service: either channel or message content is missing!');
            }

            if ($this->hasChannel($data['channel'], self::CHANNEL_TYPE_INPUT)) {
                $channel = $this->getChannel($data['channel'], self::CHANNEL_TYPE_INPUT);
                // known channel, forward...
                $responses[] = $this->processChannel($channel, $context,  $data['message']);
            } else {
                // unknown channel, fallback!
                $responses[] = $this->fallback($data['channel'], $context, $data['message']);
            }
        }

        return $responses;
    }
public function processInput(QtiRunnerServiceContext $context, array $input)
    {
        $responses = [];

        foreach ($input as $data) {
            if (!is_array($data) || !isset($data['channel']) || !isset($data['message'])) {
                throw new \common_exception_InconsistentData('Wrong message chunk received by the bidirectional communication service: either channel or message content is missing!');
            }

            if ($this->hasChannel($data['channel'], self::CHANNEL_TYPE_INPUT)) {
                $channel = $this->getChannel($data['channel'], self::CHANNEL_TYPE_INPUT);
                // known channel, forward...
                $responses[] = $this->processChannel($channel, $context,  $data['message']);
            } else {
                // unknown channel, fallback!
                $responses[] = $this->fallback($data['channel'], $context, $data['message']);
            }
        }

        return $responses;
    }
Processes the input messages
@param QtiRunnerServiceContext $context - Needs the current runner context
@param array $input - Accept a list of input, each one is represented by a channel's name that is a string and a message that can be any type
@return array - Returns a list of responses in the same order as the input list
@throws \common_exception_InconsistentData