class Alert

Alert helper.

Constants

PADDING

Alert padding.

DEFAULT

Default template.

INFO

Info template.

SUCCESS

Success template.

WARNING

Warning template.

DANGER

Danger template.

Properties

protected Output $output Output instance.
protected int $width Alert width.
protected FormatterInterface|null $formatter Formatter.

Methods

__construct(Output $output, int|null $width = null)

Constructor.

string
wordWrap(string $string, int $width)

Wraps a string to a given number of characters.

string
escape(string $string)

Escapes style tags if we have a formatter.

string
format(string $string)

Formats the string.

string
render(string $message, string $template = Alert::DEFAULT)

Renders an alert.

draw(string $message, string $template = Alert::DEFAULT, int $writer = Output::STANDARD)

Draws an alert.

Details

at line 96
__construct(Output $output, int|null $width = null)

Constructor.

Parameters

Output $output Output instance
int|null $width Alert width

at line 112
protected string wordWrap(string $string, int $width)

Wraps a string to a given number of characters.

Parameters

string $string String
int $width Max line width

Return Value

string

at line 123
protected string escape(string $string)

Escapes style tags if we have a formatter.

Parameters

string $string string

Return Value

string

at line 139
protected string format(string $string)

Formats the string.

Parameters

string $string String

Return Value

string

at line 162
string render(string $message, string $template = Alert::DEFAULT)

Renders an alert.

Parameters

string $message Message
string $template Alert template

Return Value

string

at line 174
draw(string $message, string $template = Alert::DEFAULT, int $writer = Output::STANDARD)

Draws an alert.

Parameters

string $message Message
string $template Alert template
int $writer Output writer