Format an array of messages.

@param array  $messages
@param string $format
@param string $messageKey

@return array
963873
protected function transform($messages, $format, $messageKey)
    {
        $messages = (array) $messages;

        // We will simply spin through the given messages and transform each one
        // replacing the :message place holder with the real message allowing
        // the messages to be easily formatted to each developer's desires.
        foreach ($messages as $key => &$message) {
            $replace = [':message', ':key'];

            $message = str_replace($replace, [$message, $messageKey], $format);
        }

        return $messages;
    }
1130435
private String applyPattern( String key, Object[] messageArguments )
    {
        String message = getString( key );
//        MessageFormat formatter = new MessageFormat( message );
        String output = MessageFormat.format( message, messageArguments );
        return output;
    }
1312997
public function appendMessagesWithPrefix(MessageBag $messageBag, $prefix, array $keyedMessages)
    {
        foreach ($keyedMessages as $key => $messages) {
            if ($prefix) {
                $key = $this->transformToDotSyntax($prefix . '[' . $key . ']');
            }

            foreach ((array) $messages as $message) {
                $messageBag->add($key, $message);
            }
        }
    }
399310
protected function writeSection(array $messages, string $style = 'bg=blue;fg=white'): void
    {
        $this->output->writeln(
            [
                '',
                $this->getHelper('formatter')->formatBlock($messages, $style, true),
                '',
            ]
        );
    }
276386
public String formatMessage(String key, Object[] args) {
        String msg = internalFormatMessage(getMessage(key), args);
        return msg;
    }
999576
protected function _error($messageKey, $value = null)
    {
        if ($messageKey === null) {
            $keys       = array_keys($this->_messageTemplates);
            $messageKey = current($keys);
        }
        if ($value === null) {
            $value = $this->_value;
        }
        $this->_messages[$messageKey] = $this->_createMessage($messageKey, $value);
    }
483066
public static function buildMessages(array $messages, string $keyBy = null): array
    {
        $values = array_map(function (MessageInterface $message) {
            return $message->build();
        }, $messages);

        if (!is_null($keyBy)) {
            $accessor = PropertyAccess::createPropertyAccessor();

            $keys = array_map(function (MessageInterface $message) use ($accessor, $keyBy) {
                return $accessor->getValue($message, $keyBy);
            }, $messages);

            $values = array_combine($keys, $values);
        }

        return $values;
    }
710558
String messageFormat(String key, Object... args) {
        String rs = getResourceString(key);
        return MessageFormat.format(rs, args);
    }
571448
public function format($message, array $format)
    {
        $replace = [
            ':message' => $message,
            ':code' => $this->getStatusCode(),
        ];

        array_walk_recursive($format, function (&$value, $key) use ($replace) {
            if (isset($replace[$value])) {
                $value = $replace[$value];
            }
        });

        return $format;
    }
478072
public function setMessageGroups(array $messageGroups)
    {
        $this->messageGroups = $messageGroups;

        // Set the joined message groups as well
        foreach ($this->messageGroups as $header => $keywords) {
            $this->messageGroupsJoined[$header] = join('|', $keywords);
        }

        return $this;
    }
1222872
protected function transform($messages, $format, $messageKey)
    {
        return collect((array) $messages)
            ->map(function ($message) use ($format, $messageKey) {
                // We will simply spin through the given messages and transform each one
                // replacing the :message place holder with the real message allowing
                // the messages to be easily formatted to each developer's desires.
                return str_replace([':message', ':key'], [$message, $messageKey], $format);
            })->all();
    }
44133
public function convert(Validation $validation, $format, array $keyTitles = [], array $customMessages = [])
    {
        return $this->callExtension($format, [$validation, $format, $keyTitles, $customMessages]);
    }
41238
public function addFormat($format, $mime_types)
    {
        static::$_formats[$format] = is_array($mime_types) ? $mime_types : array($mime_types);
        return $this;
    }
308333
public function formatBatch(array $records)
    {
        $logBatch = array('formatted' => '');

        // ignore the logs related to the web debug toolbar
        if ($this->isWebDebugToolbarLog($records)) {
            return $logBatch;
        }

        $logBatch['formatted'] .= $this->formatLogBatchHeader($records);

        foreach ($records as $key => $record) {
            if ($this->isDeprecationLog($record)) {
                $records[$key] = $this->processDeprecationLogRecord($record);
            }

            if ($this->isEventStopLog($record)) {
                $records[$key] = $this->processEventStopLogRecord($record);
            }

            if ($this->isEventNotificationLog($record)) {
                $records[$key] = $this->processEventNotificationLogRecord($records, $key);
            }

            if ($this->isTranslationLog($record)) {
                $records[$key] = $this->processTranslationLogRecord($records, $key);
            }

            if ($this->isRouteMatchLog($record)) {
                $records[$key] = $this->processRouteMatchLogRecord($record);
            }

            if ($this->isDoctrineLog($record)) {
                $records[$key] = $this->processDoctrineLogRecord($record);
            }

            $logBatch['formatted'] .= rtrim($this->formatRecord($records, $key), PHP_EOL).PHP_EOL;
        }

        $logBatch['formatted'] .= PHP_EOL.PHP_EOL;

        return $logBatch;
    }
969735
public function convert(Validation $validation, $format, array $keyTitles = [], array $customMessages = [])
    {

        if (!in_array($format, $this->supportedFormats)) {
            throw new UnsupportedParameterException(static::class . ' only supports MessageBag');
        }

        $messages = new MessageBag;

        if (!count($validation)) {
            return $messages;
        }

        foreach ($validation as $key=>$rules) {
            foreach ($rules as $ruleName=>$parameters) {
                $message = $this->getMessage($key, $ruleName, $rules, $keyTitles, $customMessages);
                $messages->add($key, $message);
            }
        }

        return $messages;

    }
479568
def format(self, message_format):
        
        if message_format not in self.formats:
            self._log.error('Invalid Message format specified: {format}'.format(format=message_format))
            return

        self._log.debug('Setting message format to {format}'.format(format=message_format))
        self._format = message_format
1100430
protected function sortMessages(&$messages)
    {
        if (is_array($messages)) {
            ksort($messages);

            foreach ($messages as $key => &$value) {
                $this->sortMessages($value);
            }
        }
    }