Prepend message with padding

@param $messages

@return array|string
553754
private function addIndentationToMessages($messages)
    {
        if (is_array($messages)) {
            array_walk(
                $messages,
                function ($message) {
                    return $this->indentation . $message;
                }
            );
            return $messages;
        } else {
            $messages = $this->indentation . $messages;
            return $messages;
        }
    }
42967
public function replacePlaceholders($message, $values = array())
    {
        $length = count($values);
        $i = 1;
        foreach ($values as $value) {
            if (is_array($value)) {
                $message = preg_replace_callback('/%' . $i . '\{(.*?)\}\{(.*?)\}/', function ($matches) use ($value) {
                    $length = count($value);
                    $list = '';
                    for ($i = 0; $i < $length; $i ++) {
                        $list .= $value[$i];
                        if ($i != ($length - 1)) {
                            if ($i == ($length - 2)) {
                                $list .= $matches[2];
                            } else {
                                $list .= $matches[1];
                            }
                        }
                    }
                    return $list;
                }, $message);
            } else {
                $message = str_replace('%' . $i, $value, $message);
            }
            $i ++;
        }
        return $message;
    }
114990
public function appendValues(array $values)
    {
        $appendValues = [];

        foreach ($values as $value) {
            $appendValues[] = $this->formatValue($value);
        }

        $this->message = $this->message . implode(', ', $appendValues);

        return $this;
    }
788501
public function addErrors($messages = [])
	{
		// check if messages are an array
		if(! is_array($messages) && ! $messages instanceof MessageProvider)
		{
			$messages = (array) $messages;
		}

		return $this->errors->merge($this->resolveErrorKey($messages));
	}
1314932
private function updateMessages(array $messages)
    {
        $this->reset();

        foreach ($messages as $message) {
            $messageSize = strlen($message);

            $this->data['messages_size'] += $messageSize;
            $this->data['messages_count']++;

            $this->data['messages'] []= array(
                'content' => $message,
                'size' => $messageSize,
                'decoded' => unserialize($message),
            );
        }
    }
2459
public function wrapMessages($messages, $type)
    {
        $type = ($type == 'info') ? 'primary' : $type;

        return sprintf($this->getWrapper(), $type, $messages);
    }
680521
public function render($messages = null)
	{
		if ($messages)
		{
			$this->setMessages($messages);
		}

		$messages = $this->getMessages();

		$output = array();
		$output[] = '<div class="debug-varlist">';
		foreach ($messages as $item)
		{
			$output[] = $this->line($item);
		}
		$output[] = '</div>';
		return implode("\n", $output);
	}
998016
public function sendBatch(array $messages)
    {
        $body = '';
        /** @var Message\Message $message */
        foreach ($messages as $i => $message) {
            if (!$message instanceof Message\Message) {
                throw new InvalidArgumentException();
            }

            $body .= "[{$i}]\n";
            $body .= $message->toINI();
        }
        $body = trim($body);

        $request = $this->client->newRequest(
            'POST',
            $this->client->buildUriWithQuery('/SmSendPost.asp', ['encoding' => 'UTF8']),
            'text/plain',
            $body
        );

        $response = $this->client->sendRequest($request);

        return $this->parseMessageResponse($response);
    }
267997
private function addPadding(string $notification) : string
    {
        $length = $this->length;

        return pack('n*', $length).str_pad($notification, $length + 2, chr(0), STR_PAD_LEFT);
    }
1024931
protected function formatMessage( $message )
	{
		if ( is_array( $message ) )
			return var_export( $message, true );
		elseif ( $message instanceof Jsonable )
			return $message->toJson();
		elseif ( $message instanceof Arrayable )
			return var_export( $message->toArray(), true );

		return $message;
	}
676321
private function formatMessage(Message $message)
    {
        $nodes = $this->nodeStatementsRemover->removeInnerStatements($message->getNodes());
        $prettyPrintedNodes = str_replace("\n", "\n    ", $this->prettyPrinter->prettyPrint($nodes));

        $text = $message->getRawText();
        $color = self::$colors[$message->getLevel()];
        $levelText = self::$levelText[$message->getLevel()];

        if ($color) {
            $text = sprintf(
                '<fg=%s>[%s] %s</fg=%s>',
                $color,
                $levelText,
                $text,
                $color
            );
        }

        return sprintf(
            "> Line <fg=cyan>%s</fg=cyan>: %s\n    %s",
            $message->getLine(),
            $text,
            $prettyPrintedNodes
        );
    }
163434
public function addMessage($message) {
        $this->message = trim(trim($this->message).NL.$message);
        return $this;
    }
172693
protected function transform($messages, $format)
	{
		$messages = (array) $messages;

		foreach ($messages as $key => &$message)
		{
			$message = str_replace(':message', $message, $format);
		}

		return $messages;
	}
558992
public static function compressMessageSet($messages, $force=false)
    {
        // given a comma delimited list of independent mid's,
        // compresses by grouping sequences together
        if (!is_array($messages)) {
            // if less than 255 bytes long, let's not bother
            if (!$force && strlen($messages) < 255) {
                return preg_match('/[^0-9:,*]/', $messages) ? 'INVALID' : $messages;
            }

            // see if it's already been compressed
            if (strpos($messages, ':') !== false) {
                return preg_match('/[^0-9:,*]/', $messages) ? 'INVALID' : $messages;
            }

            // separate, then sort
            $messages = explode(',', $messages);
        }

        sort($messages);

        $result = array();
        $start  = $prev = $messages[0];

        foreach ($messages as $id) {
            $incr = $id - $prev;
            if ($incr > 1) { // found a gap
                if ($start == $prev) {
                    $result[] = $prev; // push single id
                }
                else {
                    $result[] = $start . ':' . $prev; // push sequence as start_id:end_id
                }
                $start = $id; // start of new sequence
            }
            $prev = $id;
        }

        // handle the last sequence/id
        if ($start == $prev) {
            $result[] = $prev;
        }
        else {
            $result[] = $start.':'.$prev;
        }

        // return as comma separated string
        $result = implode(',', $result);

        return preg_match('/[^0-9:,*]/', $result) ? 'INVALID' : $result;
    }
147240
public function preProcessMessage(MessageInterface $message)
    {
        foreach ($this->getProcessorStore()->getProcessors() as $processor) {
            $message = $processor->preProcessMessage($message);
        }

        return $message;
    }
612953
protected function format($message, array $placeholders = [])
    {
        foreach ($placeholders as $name => $value) {
            $placeholders[":$name"] = $value;
            unset($placeholders[$name]);
        }
        
        return strtr($message, $placeholders);
    }
1262182
public static function formatMessage($message): string
    {
        if ($message instanceof \Throwable) {
            while ($message) {
                $tmp[] = ($message instanceof \ErrorException
                        ? Helpers::errorTypeToString($message->getSeverity()) . ': ' . $message->getMessage()
                        : Helpers::getClass($message) . ': ' . $message->getMessage() . ($message->getCode() ? ' #' . $message->getCode() : '')
                    ) . ' in ' . $message->getFile() . ':' . $message->getLine();
                $message = $message->getPrevious();
            }
            $message = \implode("\ncaused by ", $tmp);

        } elseif (!\is_string($message)) {
            $message = self::toText($message);
        }

        return \trim($message);
    }