* * 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:----wsOSXy2MG/epDC84x0ah49nI3diLX0BNH6lZbRiqD/i9m8LL9N3m0t0gGdfrRRaLoKilmhOuy0VMqj0tx+erZQARbdsskRZ22KPCBSowlzv8zQmqWB8iLLbPSHsiX/CQlSyluntk0181F9H61MwTujuCo9XUgpqKMqlGrsPqG4epAuNtbxvH5nkS3QyHsWeWTgqAkvarcCmsiMoJFFfbWdVND17YNS8n5vClqn3s4JAOQfyMnJVfvCiSa5YPJpRcCdctpNCyg88r1NONlr134rMi8GYnZF5xoAjz3GT0vIYLKmGTy3Wy9NP2wEZmlmjW86ahQcbGyWrLH1O3wl0vRy2f0IdQoreMrx6RedRLACvUyk/iGJhSFVsHos5Uj2ieQFpr2f3QXQ903et3DMiyDQCEFNQqMwK6ES94OYQpKrxmwchu1d1iEGSnfOhRjmZrrvKYAVnHfJgGeX+eNGqlFCmr3af00jVnD0uKPxFAwhMfO+h8zn8iUBTKEcFXcihTeo+h8wxaPhwk3sSx2mujDrpbZ64eZheKK7I3WbyuAHYsRu5UOPJNU4d6nTsAxcxagjwUwaukjKL1XwfTMrRCpT3t0obaPK1q5W2Lje1bRDvDnW9r+2q7CIBesMw+1fsQ9NFCTJqywu8gjUVH7I97lqIt1NaXA754/tOQE8qXfSY=----ATTACHMENT:----NTU5MzM2OTczNDk5NDk3IDIxMjQxODA1MTIxNjc5OTMgNzYwNDgyNjExMTk3NzYwNQ==