@param Messages $messages

@return PrePush
965452
public function setMessages(Messages $messages)
    {
        return new self(
            $this->undefined,
            $this->enabled,
            $this->execute,
            $messages
        );
    }
408996
public function sendShortMessages($messages)
    {
        if (! $messages instanceof ShortMessageCollection) {
            $collection = $this->collectionFactory->create();

            foreach ($messages as $message) {
                $collection->push($this->factory->create(
                    $message['recipient'],
                    $message['message']
                ));
            }

            $messages = $collection;
        }

        if (is_callable($this->beforeMultipleShortMessageCallback)) {
            call_user_func_array($this->beforeMultipleShortMessageCallback, [$messages]);
        }

        $response = $this->client->sendShortMessages($messages);

        if (is_callable($this->afterMultipleShortMessageCallback)) {
            call_user_func_array($this->afterMultipleShortMessageCallback, [$response, $messages]);
        }

        return $response;
    }
858498
protected function translateMessages(array $messages)
    {
        $results = array();
        foreach( $messages as $message ) {
            $results[] = Translate::message($message);
        }

        return $results;
    }
670993
protected function formatMessages($messages, string $prefix): array
    {
        $result = [];

        // Convert single messages to array
        if (is_string($messages)) {
            $messages = [$messages];
        }

        // Prefix all messages
        foreach ($messages as $message) {
            $result[] = sprintf("[%s][%s] %s : %s", $this->module, $this->configType, $prefix, $message);
        }

        return $result;
    }
881550
public function log($messages)
    {
        if (!is_array($messages)) {
            $messages = [$messages];
        }
        foreach ($messages as $message) {
            file_put_contents($this->logFile, date('d.m.Y H:i:s') . ' - ' . $message . PHP_EOL, FILE_APPEND | LOCK_EX);
        }
    }
1042260
public function addMessage(Message $message)
    {
        $type = $message->getType();
        if (!array_key_exists($type, $this->messages)) {
            $this->messages[$type] = [];
        }

        if ($message->getId() !== null) {
            $this->messages[$type][$message->getId()] = $message;
        } else {
            $this->messages[$type][] = $message;
        }

        return $this;
    }
808743
private function prepareMessage($message) {
    return is_string($message) ? $message :
      (is_object($message) && method_exists($message, '__toString') ? $message->__toString() :
            StringUtil::getDump($message));
  }
196309
public function reset()
    {
        $this->messages = [];

        foreach (self::$when as $when) {
            $this->messages[$when] = [];
        }

        return $this;
    }
1360231
protected function buildRecipients($message)
    {
        foreach (['to', 'cc', 'bcc', 'replyTo'] as $type) {
            foreach ($this->{$type} as $recipient) {
                $message->{$type}($recipient['address'], $recipient['name']);
            }
        }

        return $this;
    }
1031489
public function access_messages($messages) {
        $output = '';
        foreach ($messages as $message) {
            $output .= html_writer::tag('p', $message) . "\n";
        }
        return $output;
    }
350061
protected function checkout(MessageBag $messages)
    {
        $html       = '';
        $hasError   = false;
        $hasSuccess = false;

        foreach (['error', 'info', 'success', 'warning'] as $key) {
            if ($messages->has($key)) {
                $hasError   = (!$hasError && $key == 'error');
                $hasSuccess = (!$hasSuccess && $key == 'success');

                $flashMessages = $messages->setFormat('<div class="activity-item"> <i class="fa ' . $this->mapping[$key] . '"></i> <div class="activity">:message</div>')->get($key);


                array_walk($flashMessages, function($current) use ($key, &$html) {
                    $html .= "generate('{$key}', '{$current}');\n";
                });
            }
        }
        return $html;
    }
1135392
protected function notFound($messages = null)
	{
		$data = $this->getStatusData('not-found', $messages);
		return $this->jsonResponse($data, 404);
	}
873242
private function removeMessage($messages)
    {
        if (! is_null($this->messageKey)) {
            unset($messages[$this->messageKey]);
            $this->messageKey = null;
        }

        return $messages;
    }
700400
public function addMessage($message) {
        if (!is_array(self::$_store->messages)) {
            self::$_store->messages = array();
        }
        $messages = self::$_store->messages;
        // Duplicates are wack
        if (in_array($message, $messages)) {
            return $this;
        }
        $messages[] = $message;
        self::$_store->messages = $messages;
        return $this;
    }
599505
public static function messages($messages = [], $append = true)
    {
        if (func_num_args()) {
            static::$_messages = $append ? array_merge(static::$_messages, $messages) : $messages + ['_default_' => 'is invalid'];
        }
        return static::$_messages;
    }
529072
public function report(string ...$messages): ResultInterface
    {
        if (! empty($messages)) {
            return ResultFactory::makeFailure(
                $this->checker,
                array_merge([$this->failureMessage], $messages)
            );
        }

        return ResultFactory::makeSuccess($this->checker);
    }
775272
protected function getValidationMessagesForElements(array $messages = [])
    {
        $this->getElements()->onlyActive()->each(function ($element) use (&$messages) {
            $element = $this->getElementContainer($element);

            if ($element instanceof Validable) {
                $messages += $element->getValidationMessages();
            }
        });

        return $messages;
    }