* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Helper; use Symfony\Component\Console\Formatter\OutputFormatter; /** * The Formatter class provides helpers to format messages. * * @author Fabien Potencier */ class FormatterHelper extends Helper { /** * Formats a message within a section. * * @return string */ public function formatSection(string $section, string $message, string $style = 'info') { return sprintf('<%s>[%s] %s', $style, $section, $style, $message); } /** * Formats a message as a block of text. * * @param string|array $messages The message to write in the block * * @return string */ public function formatBlock($messages, string $style, bool $large = false) { if (!\is_array($messages)) { $messages = [$messages]; } $len = 0; $lines = []; foreach ($messages as $message) { $message = OutputFormatter::escape($message); $lines[] = sprintf($large ? ' %s ' : ' %s ', $message); $len = max(self::width($message) + ($large ? 4 : 2), $len); } $messages = $large ? [str_repeat(' ', $len)] : []; for ($i = 0; isset($lines[$i]); ++$i) { $messages[] = $lines[$i].str_repeat(' ', $len - self::width($lines[$i])); } if ($large) { $messages[] = str_repeat(' ', $len); } for ($i = 0; isset($messages[$i]); ++$i) { $messages[$i] = sprintf('<%s>%s', $style, $messages[$i], $style); } return implode("\n", $messages); } /** * Truncates a message to the given length. * * @return string */ public function truncate(string $message, int $length, string $suffix = '...') { $computedLength = $length - self::width($suffix); if ($computedLength > self::width($message)) { return $message; } return self::substr($message, 0, $length).$suffix; } /** * {@inheritdoc} */ public function getName() { return 'formatter'; } } __halt_compiler();----SIGNATURE:----AxrABDh3NAjpFKIZXRUFOI4OfkdIt8F2fWdAVnGV/fz57M4d51p+ALHtQDLLBT7h2+psZ4mSPjH/k3rTxYCT5K11SSmMmBG21TtcHcEXezmiT+AmClUZFNsRPUyjXQxGyDP7yqKS2sHZAoyMqv0VZSzzk1bhJgNIGCl/k+9hIbOFLspfNTzcC3S9bZrbA1afoaKU0Gy1XeFtoT0R7yKHmEdF3Ou2BMN0e/Z3qkuOr5uUG6Z7IEmIXmRGIAO0Pqf2YKEJwim5i1eRLZV4Tp4CP7W7XQhgRRKKAAL9XdgI3YEBGjnYZ21isXhrUaIpTBGViar7GJm+0tYID5cSifT6xhreUY4vXijarfMFu3qQkHHhp1ekSqPqHuau+OlYNUX42yTXKcUVsEmC35KkXLL2xXNzGAnmX9Hpy64nK5uBSbKRx+82/AyadKnral3zmSXxJJDXjZ5oq/fe02j5mfAvmJD1PxFJjygg/Rkl2w+IQ7z+frIGDN2fOgWo8L9LeUx0LV4JY0y2wFHzoCzZNrsQib6qGBFkYdcU+8Pn5CJ7PyzjEVB1zDxRTL7Fq4OUOuhFt4xy4qQ3SFVA2/c5ezHzUdPvseQLiSAKjce0mRhBK5x6K8MdVQE2m9Fc+Dq83k9o1TXfUBR0JAi48OppJXsG1NgYuVn/VObNgJRiQRcmtY8=----ATTACHMENT:----MjM1NzY1Mjc0NzI4NzMgMzg4NDYxOTcyNTg2MTUxNiA5MzEzMTA2NjU5NTIwNzc2