buildMessageParts.

@param $message
@param $references
@param $offset
195268
protected function buildMessageParts($message, $references, $offset = 0)
    {
        $messageParts = array();

        // get first reference
        $reference = array_shift($references);

        if (!$reference) {
            return array(
                $this->buildMessagePart($message, 0, mb_strlen($message)),
            );
        }

        $messageParts[] = $this->buildMessagePart(
            $message,
            0,
            $reference->getStartIndice() - $offset
        );

        $messageParts[] = $this->buildMessagePart(
            $message,
            $reference->getStartIndice() - $offset,
            $reference->getEndIndice() - $offset,
            $reference
        );

        $message = mb_substr($message, $reference->getEndIndice() - $offset);

        foreach ($this->buildMessageParts($message, $references, $reference->getEndIndice()) as $messagePart) {
            $messageParts[] = $messagePart;
        };

        return $messageParts;
    }
371169
public function load(Message $message) : ?Message
    {
        $aggregateIdentifiers = [];
        $expectedVersion = null;

        foreach ($this->aggregateIdentifierMapping as $aggregateIdentifierName => $aggregateIdentifierMappingName) {
            $aggregateIdentifiers[$aggregateIdentifierName] = $this->isFactoryMethod ? null : $this->propertyReaderAccessor->getPropertyValue(PropertyPath::createWith($aggregateIdentifierMappingName), $message->getPayload());
        }

        $aggregate = null;
        if (!$this->isFactoryMethod) {

            foreach ($aggregateIdentifiers as $identifierName => $aggregateIdentifier) {
                if (is_null($aggregateIdentifier)) {
                    throw AggregateNotFoundException::create("Aggregate identifier {$identifierName} definition found, but is null. Can't load aggregate {$this->aggregateClassName} to call {$this->aggregateMethod}.");
                }
            }

            $expectedVersion = $this->expectedVersionName ? $this->propertyReaderAccessor->getPropertyValue(PropertyPath::createWith($this->expectedVersionName), $message->getPayload()) : null;
            if ($this->expectedVersionName && !$expectedVersion) {
                throw InvalidArgumentException::create("Aggregate {$this->aggregateClassName}:{$this->aggregateMethod} has defined version locking, but no version during command handling was provided");
            }

            $aggregate = is_null($this->expectedVersionName)
                ? $this->aggregateRepository->findBy($aggregateIdentifiers)
                : $this->aggregateRepository->findWithLockingBy($aggregateIdentifiers, $expectedVersion);

            if (!$aggregate && $this->filterOutOnNotFound) {
                return null;
            }
        }

        $messageBuilder = MessageBuilder::fromMessage($message);
        if ($aggregate) {
            $messageBuilder = $messageBuilder->setHeader(AggregateMessage::AGGREGATE_OBJECT, $aggregate);
        }
        if ($expectedVersion) {
            $messageBuilder = $messageBuilder->setHeader(AggregateMessage::EXPECTED_VERSION, $expectedVersion);
        }

        if (!$message->getHeaders()->containsKey(MessageHeaders::REPLY_CHANNEL)) {
            $messageBuilder = $messageBuilder
                                ->setReplyChannel(NullableMessageChannel::create());
        }

        return $messageBuilder
            ->setHeader(AggregateMessage::CLASS_NAME, $this->aggregateClassName)
            ->setHeader(AggregateMessage::METHOD_NAME, $this->aggregateMethod)
            ->setHeader(AggregateMessage::AGGREGATE_ID, $aggregateIdentifiers)
            ->setHeader(AggregateMessage::IS_FACTORY_METHOD, $this->isFactoryMethod)
            ->setHeader(AggregateMessage::CALLING_MESSAGE, $message)
            ->build();
    }
191564
public function createAlternativeContentPart(Message $message, MessagePart $contentPart)
    {
        $altPart = $this->partBuilderFactory->newPartBuilder($this->mimePartFactory)->createMessagePart();
        $this->setMimeHeaderBoundaryOnPart($altPart, 'multipart/alternative');
        $message->removePart($contentPart);
        $message->addChild($altPart, 0);
        $altPart->addChild($contentPart, 0);
        return $altPart;
    }
1354235
public function addInfoMessage($message, $params = array())
    {
        $message =  $this->trans($message, $params);
        static::$messages[] = array(
            'type' => 'info',
            'bootstrapType' => 'info',
            'message' => $message
        );
    }
632310
public void addMessage(Message message) {
        synchronized (messages) {
            api.addMessageToCache(message);
            if (messages.stream().map(Reference::get).anyMatch(message::equals)) {
                return;
            }
            // Add the message in the correct order
            messages.removeIf(messageRef -> messageRef.get() == null);
            Reference<Message> messageRef = new SoftReference<>(message, messagesCleanupQueue);
            int pos = Collections.binarySearch(messages, messageRef, Comparator.comparing(Reference::get));
            if (pos < 0) {
                pos = -pos - 1;
            }
            messages.add(pos, messageRef);
        }
    }
86837
public function appendCustomMessage($message)
    {
        $customMessage = $this->getHTMLDocument()->getHTMLFactory()->buildHtmlElement('div', $message, '', 'custom-message');

        return $this->append($customMessage);
    }
1086546
public static function addMessage($message, $label = 'info', $isString = true): void
    {
        if (self::$debugbar instanceof StandardDebugBar) {
            $collector = self::$debugbar->getCollector('messages');

            if ($collector instanceof MessagesCollector) {
                $collector->addMessage($message, $label, $isString);
            }
        }
    }
680901
public function appendMessage($message)
    {
        $context = $this->_context;

        $context->messages[$message->field][] = $message;

        return $this;
    }
139174
private function withExtra(PusherMessage $message)
    {
        if ($message->getPlatform() == $this->platform) {
            throw CouldNotCreateMessage::platformConflict($this->platform);
        }

        $this->extraMessage = $message;
    }
1351014
public function addWarningMessage($message, $params = array())
    {
        $message = $this->trans($message, $params);
        static::$messages[] = array(
            'type' => 'warning',
            'bootstrapType' => 'warning',
            'message' => $message
        );
    }
1283242
public function message($message)
    {
        if(trim($message))
        {
            $msg = new stdClass();
            $msg->type = 'text';
            $msg->message = $message;
            $this->messages[] = $msg;
        }        
    }
417200
private function addMessage($name, $parts)
    {
        $this->addToDebug("Adding message: '$name'");
        $msg = $this->addElement('message', $this->definitions);
        $msg->setAttribute('name', $name);
        foreach ((array) $parts as $partName => $partType) {
            $this->addToDebug("Adding Message part: '$partName => $partType'");
            $part = $this->addElement('part', $msg);
            $this->xmlSchema->addType($partType, $partName, $part);
        }
    }
1002428
public function buildMessage($level, string $message, array $context = []): MessageInterface
    {
        $level = $this->validateSeverity($level);
        $data = [
            MessageInterface::CONTEXT => []
        ];

        // Append message defaults to this payload
        $data = $this->consume($data, $this->logProperties);

        // Append message context to this payload
        $data = $this->consume($data, $context);

        return new Message($level, $message, $data);
    }
1080603
public function addSuccessMessage($message, $params = array())
    {
        $message = $this->trans($message, $params);
        static::$messages[$message] = array(
            'type' => 'success',
            'bootstrapType' => 'success',
            'message' => $message
        );
    }
206831
public static function decodeMessage(string $message): Message
    {
        $offset = 0;
        $header = self::decodeHeader($message, $offset);
        $messageObject = new Message($header);
        $messageObject->setQuestions(self::decodeResourceRecords($message, $header->getQuestionCount(), $offset, true));
        $messageObject->setAnswers(self::decodeResourceRecords($message, $header->getAnswerCount(), $offset));
        $messageObject->setAuthoritatives(self::decodeResourceRecords($message, $header->getNameServerCount(), $offset));
        $messageObject->setAdditionals(self::decodeResourceRecords($message, $header->getAdditionalRecordsCount(), $offset));

        return $messageObject;
    }
1223810
public function add(ApnsPHP_Message $message)
	{
		static $n = 0;
		if ($n >= $this->_nProcesses) {
			$n = 0;
		}
		sem_acquire($this->_hSem);
		$aQueue = $this->_getQueue(self::SHM_MESSAGES_QUEUE_KEY_START, $n);
		$aQueue[] = $message;
		$this->_setQueue(self::SHM_MESSAGES_QUEUE_KEY_START, $n, $aQueue);
		sem_release($this->_hSem);
		$n++;
	}
1153284
protected function setMessage($message, array $parameters = [])
    {
        $message = sprintf(
            "%s: %s.",
            (new \ReflectionClass($this))->getShortName(),
            $message
        );

        $parameters = array_map([$this->getDumper(), "dump"], $parameters);

        $this->message = call_user_func_array(
            "sprintf",
            array_merge([$message], $parameters)
        );
    }