trait DrawsBoxes

Traits

Properties

protected int $minWidth

Methods

int
longest(array $lines, int $padding = 0)

Get the length of the longest line.

string
pad(string $text, int $length, string $char = ' ')

Pad text ignoring ANSI escape sequences.

string
stripEscapeSequences(string $text)

Strip ANSI escape sequences from the given text.

string
mbWordwrap(string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false)

Multi-byte version of wordwrap.

array
ansiWordwrap(string $text, int $width)

Word wrap text while preserving ANSI escape sequences.

array
parseAnsiText(string $text)

Parse text into segments with their associated ANSI codes.

box(string $title, string $body, string $footer = '', string $color = 'gray', string $info = '')

Draw a box.

Details

protected int longest(array $lines, int $padding = 0)

Get the length of the longest line.

Parameters

array $lines
int $padding

Return Value

int

protected string pad(string $text, int $length, string $char = ' ')

Pad text ignoring ANSI escape sequences.

Parameters

string $text
int $length
string $char

Return Value

string

protected string stripEscapeSequences(string $text)

Strip ANSI escape sequences from the given text.

Parameters

string $text

Return Value

string

protected string mbWordwrap(string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false)

Multi-byte version of wordwrap.

Parameters

string $string
int $width
string $break
bool $cut_long_words

Return Value

string

in InteractsWithStrings at line 138
protected array ansiWordwrap(string $text, int $width)

Word wrap text while preserving ANSI escape sequences.

Parameters

string $text
int $width

Return Value

array

in InteractsWithStrings at line 215
protected array parseAnsiText(string $text)

Parse text into segments with their associated ANSI codes.

Parameters

string $text

Return Value

array

at line 20
protected DrawsBoxes box(string $title, string $body, string $footer = '', string $color = 'gray', string $info = '')

Draw a box.

Parameters

string $title
string $body
string $footer
string $color
string $info

Return Value

DrawsBoxes