class PasswordPromptRenderer extends Renderer

Traits

Properties

protected string $output

The output to be rendered.

from  Renderer
protected int $minWidth from  DrawsBoxes

Methods

string
reset(string $text)

Reset all colors and styles.

from  Colors
string
bold(string $text)

Make the text bold.

from  Colors
string
dim(string $text)

Make the text dim.

from  Colors
string
italic(string $text)

Make the text italic.

from  Colors
string
underline(string $text)

Underline the text.

from  Colors
string
inverse(string $text)

Invert the text and background colors.

from  Colors
string
hidden(string $text)

Hide the text.

from  Colors
string
strikethrough(string $text)

Strike through the text.

from  Colors
string
black(string $text)

Set the text color to black.

from  Colors
string
red(string $text)

Set the text color to red.

from  Colors
string
green(string $text)

Set the text color to green.

from  Colors
string
yellow(string $text)

Set the text color to yellow.

from  Colors
string
blue(string $text)

Set the text color to blue.

from  Colors
string
magenta(string $text)

Set the text color to magenta.

from  Colors
string
cyan(string $text)

Set the text color to cyan.

from  Colors
string
white(string $text)

Set the text color to white.

from  Colors
string
bgBlack(string $text)

Set the text background to black.

from  Colors
string
bgRed(string $text)

Set the text background to red.

from  Colors
string
bgGreen(string $text)

Set the text background to green.

from  Colors
string
bgYellow(string $text)

Set the text background to yellow.

from  Colors
string
bgBlue(string $text)

Set the text background to blue.

from  Colors
string
bgMagenta(string $text)

Set the text background to magenta.

from  Colors
string
bgCyan(string $text)

Set the text background to cyan.

from  Colors
string
bgWhite(string $text)

Set the text background to white.

from  Colors
string
gray(string $text)

Set the text color to gray.

from  Colors
string
truncate(string $string, int $width)

Truncate a value with an ellipsis if it exceeds the given width.

__construct(Prompt $prompt)

Create a new renderer instance.

from  Renderer
line(string $message)

Render a line of output.

from  Renderer
newLine(int $count = 1)

Render a new line.

from  Renderer
warning(string $message)

Render a warning message.

from  Renderer
error(string $message)

Render an error message.

from  Renderer
hint(string $message)

Render an hint message.

from  Renderer
when(mixed $value, callable $callback, callable|null $default = null)

Apply the callback if the given "value" is truthy.

from  Renderer
__toString()

Render the output with a blank line above and below.

from  Renderer
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.

string
__invoke(PasswordPrompt $prompt)

Render the password prompt.

Details

in Colors at line 12
string reset(string $text)

Reset all colors and styles.

Parameters

string $text

Return Value

string

in Colors at line 20
string bold(string $text)

Make the text bold.

Parameters

string $text

Return Value

string

in Colors at line 28
string dim(string $text)

Make the text dim.

Parameters

string $text

Return Value

string

in Colors at line 36
string italic(string $text)

Make the text italic.

Parameters

string $text

Return Value

string

in Colors at line 44
string underline(string $text)

Underline the text.

Parameters

string $text

Return Value

string

in Colors at line 52
string inverse(string $text)

Invert the text and background colors.

Parameters

string $text

Return Value

string

in Colors at line 60
string hidden(string $text)

Hide the text.

Parameters

string $text

Return Value

string

in Colors at line 68
string strikethrough(string $text)

Strike through the text.

Parameters

string $text

Return Value

string

in Colors at line 76
string black(string $text)

Set the text color to black.

Parameters

string $text

Return Value

string

in Colors at line 84
string red(string $text)

Set the text color to red.

Parameters

string $text

Return Value

string

in Colors at line 92
string green(string $text)

Set the text color to green.

Parameters

string $text

Return Value

string

in Colors at line 100
string yellow(string $text)

Set the text color to yellow.

Parameters

string $text

Return Value

string

in Colors at line 108
string blue(string $text)

Set the text color to blue.

Parameters

string $text

Return Value

string

in Colors at line 116
string magenta(string $text)

Set the text color to magenta.

Parameters

string $text

Return Value

string

in Colors at line 124
string cyan(string $text)

Set the text color to cyan.

Parameters

string $text

Return Value

string

in Colors at line 132
string white(string $text)

Set the text color to white.

Parameters

string $text

Return Value

string

in Colors at line 140
string bgBlack(string $text)

Set the text background to black.

Parameters

string $text

Return Value

string

in Colors at line 148
string bgRed(string $text)

Set the text background to red.

Parameters

string $text

Return Value

string

in Colors at line 156
string bgGreen(string $text)

Set the text background to green.

Parameters

string $text

Return Value

string

in Colors at line 164
string bgYellow(string $text)

Set the text background to yellow.

Parameters

string $text

Return Value

string

in Colors at line 172
string bgBlue(string $text)

Set the text background to blue.

Parameters

string $text

Return Value

string

in Colors at line 180
string bgMagenta(string $text)

Set the text background to magenta.

Parameters

string $text

Return Value

string

in Colors at line 188
string bgCyan(string $text)

Set the text background to cyan.

Parameters

string $text

Return Value

string

in Colors at line 196
string bgWhite(string $text)

Set the text background to white.

Parameters

string $text

Return Value

string

in Colors at line 204
string gray(string $text)

Set the text color to gray.

Parameters

string $text

Return Value

string

in Truncation at line 14
protected string truncate(string $string, int $width)

Truncate a value with an ellipsis if it exceeds the given width.

Parameters

string $string
int $width

Return Value

string

in Renderer at line 25
__construct(Prompt $prompt)

Create a new renderer instance.

Parameters

Prompt $prompt

in Renderer at line 32
protected Renderer line(string $message)

Render a line of output.

Parameters

string $message

Return Value

Renderer

in Renderer at line 42
protected Renderer newLine(int $count = 1)

Render a new line.

Parameters

int $count

Return Value

Renderer

in Renderer at line 52
protected Renderer warning(string $message)

Render a warning message.

Parameters

string $message

Return Value

Renderer

in Renderer at line 60
protected Renderer error(string $message)

Render an error message.

Parameters

string $message

Return Value

Renderer

in Renderer at line 68
protected Renderer hint(string $message)

Render an hint message.

Parameters

string $message

Return Value

Renderer

in Renderer at line 84
protected Renderer when(mixed $value, callable $callback, callable|null $default = null)

Apply the callback if the given "value" is truthy.

Parameters

mixed $value
callable $callback
callable|null $default

Return Value

Renderer

in Renderer at line 98
__toString()

Render the output with a blank line above and below.

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

in DrawsBoxes 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

at line 16
string __invoke(PasswordPrompt $prompt)

Render the password prompt.

Parameters

PasswordPrompt $prompt

Return Value

string