yii\helpers\BaseConsole::wrapText PHP Метод

wrapText() публичный статический Метод

If screen size could not be detected, or the indentation is greater than the screen size, the text will not be wrapped. The first line will **not** be indented, so Console::wrapText("Lorem ipsum dolor sit amet.", 4) will result in the following output, given the screen width is 16 characters: Lorem ipsum dolor sit amet.
С версии: 2.0.4
public static wrapText ( string $text, integer $indent, boolean $refresh = false ) : string
$text string the text to be wrapped
$indent integer number of spaces to use for indentation.
$refresh boolean whether to force refresh of screen size. This will be passed to [[getScreenSize()]].
Результат string the wrapped text.
    public static function wrapText($text, $indent = 0, $refresh = false)
    {
        $size = static::getScreenSize($refresh);
        if ($size === false || $size[0] <= $indent) {
            return $text;
        }
        $pad = str_repeat(' ', $indent);
        $lines = explode("\n", wordwrap($text, $size[0] - $indent, "\n", true));
        $first = true;
        foreach ($lines as $i => $line) {
            if ($first) {
                $first = false;
                continue;
            }
            $lines[$i] = $pad . $line;
        }
        return implode("\n", $lines);
    }