Tries to dispatch all messages to notification service

@param MessageCollection $messages
@return $this
557190
public function dispatchAll(MessageCollection $messages)
    {
        $collection = $messages->getMessageCollection();

        while ($collection->valid()) {
            $message = $collection->current();
            $this->dispatch($message);
            $collection->next();
        }

        return $this;
    }
55259
public function setMessage(\Sopinet\ChatBundle\Entity\Message $message = null)
    {
        $this->message = $message;

        return $this;
    }
689831
public function setMessages($locale, $messages)
    {
        $this->loadMessagesFromFile($locale);
        $this->addResource('array', $messages, $locale);
        $this->messages[$locale] = array_merge(
            isset($this->messages[$locale]) ? $this->messages[$locale] : [],
            $messages
        );

        return $this;
    }
821166
public function send(MessageInterface $message, &$failures = null)
    {
        return $this->transport->send($message, $failures);
    }
722036
public function setReportedShippingCollections(array $collectionIds)
    {
        try {
            $collectionIds = $this->encoder->encode($collectionIds);
            $this->setData(self::FIELD_REPORTED_SHIPPING_COLLECTIONS, $collectionIds);
        } catch (\InvalidArgumentException $e) {
            $this->_logger->error($e->getMessage());
        }

        return $this;
    }
921835
public function setMessages($messages)
	{
		if (!is_array($messages))
		{
			throw new InvalidArgumentException(sprintf(
				'Messages must be an array. Type of "%s" passed.',
				gettype($messages)
			));
		}

		$this->_messages = $messages;

		return $this;
	}
883870
public function writeLines(array $messages)
    {
        if (!$this->writer) {
            throw new \Parable\Log\Exception("Can't writeLines without a valid \Log\Writer instance set.");
        }
        foreach ($messages as $message) {
            $this->write($message);
        }
        return $this;
    }
482907
public function items($items)
    {
        $items = !is_array($items) ? $items->all() : $items;
        $this->message['items'] = $items;
        return $this;
    }
603051
public function setDispatchers(array $dispatchers)
    {
        foreach ($dispatchers as $name => $dispatcher) {
            $this->addDispatcher($name, $dispatcher);
        }

        return $this;
    }
94542
protected function withoutNotifications()
    {
        $mock = Mockery::mock(NotificationDispatcher::class);

        $mock->shouldReceive('send')->andReturnUsing(function ($notifiable, $instance, $channels = []) {
            $this->dispatchedNotifications[] = compact(
                'notifiable', 'instance', 'channels'
            );
        });

        $this->app->instance(NotificationDispatcher::class, $mock);

        return $this;
    }
1139444
protected function dispatch($message, MessageCallback $callback) : void
    {
        $sendable = $message;
        if (!($message instanceof Serializable)) {
            $sendable = new MessageWrapper($message);
        }
        $mf4phpMessage = $this->findObjectMessageFactory($message)->createMessage($sendable);
        $this->dispatcher->send($this->queue, $mf4phpMessage);
    }
1195655
public function delete(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        Resque::dequeue($queue, [static::JOB_CLASS => $message->getId()]);

        return $this;
    }
1335695
public static function withMessages(array $messages)
    {
        return new static(tap(ValidatorFacade::make([], []), function ($validator) use ($messages) {
            foreach ($messages as $key => $value) {
                foreach (Arr::wrap($value) as $message) {
                    $validator->errors()->add($key, $message);
                }
            }
        }));
    }
1053560
public function addMessage(Message $message): Email
    {
        if (null === $this->message->getBody()) {
            $this->message->setBody($message->getBody(), $message->getContentType());

            return $this;
        }

        $this->message->addPart($message->getBody(), $message->getContentType());

        return $this;
    }
1185090
public static function alert(...$messages): void
    {
        static::init();

        if (!static::isTemporaryDisabled('alert')) {
            foreach (static::$adapters as $adapter) {
                /* @var $adapter \Koldy\Log\Adapter\AbstractLogAdapter */
                if ($adapter->isLevelEnabled(self::ALERT)) {
                    $adapter->alert((new Message(self::ALERT))->setMessages($messages));
                }
            }
        }
    }
259792
protected function dispatch($messages, bool $final): void
    {
        $targetErrors = [];
        foreach ($this->getTargets() as $target) {
            if ($target->enabled) {
                try {
                    $target->collect($messages, $final);
                } catch (\Exception $e) {
                    $target->enabled = false;
                    $targetErrors[] = [
                        'Unable to send log via ' . get_class($target) . ': ' . ErrorHandler::convertExceptionToString($e),
                        LogLevel::WARNING,
                        __METHOD__,
                        microtime(true),
                        [],
                    ];
                }
            }
        }

        if (!empty($targetErrors)) {
            $this->dispatch($targetErrors, true);
        }
    }
604349
public function merge($messages)
    {
        if ($messages instanceof MessageProvider) {
            $messages = $messages->getMessageBag()->getMessages();
        }

        $this->messages = array_merge_recursive($this->messages, $messages);

        return $this;
    }