wrapText() public static method (available since version 2.0.4)
Word wrap text with indentation to fit the screen size
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.
public static string wrapText ( $text, $indent = 0, $refresh = false ) | ||
---|---|---|
$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(). |
return | string |
The wrapped text. |
Please login to continue.