trait FormatsOutput

Methods

bool
ensureValidEntryTypes(string ...$types)

Verify the given entry types are valid, printing an error if not.

string
unit(int|float|string|null $value, string $unit)

Append a unit to the given value, or return an empty string if it has none.

string
shortUuid(string $uuid)

Get a shortened UUID for display.

string
humanTime(CarbonInterface $date)

Format a timestamp as a human readable difference.

string
summarizeEntry(EntryResult $entry)

Generate a one-line summary for the given entry.

string
colorMethod(string $method)

Colorize an HTTP method for console output.

string
colorStatus(int $status)

Colorize an HTTP status code for console output.

string
colorLevel(string $level)

Colorize a log level for console output.

string
colorCacheAction(string $type)

Colorize a cache action for console output.

string
colorJobStatus(string $status)

Colorize a job status for console output.

string
jsonBlock(mixed $data)

Format a value as a pretty-printed JSON block.

void
writeJson(mixed $data)

Write the given data as JSON output.

Details

at line 18
protected bool ensureValidEntryTypes(string ...$types)

Verify the given entry types are valid, printing an error if not.

Parameters

string ...$types

Return Value

bool

at line 35
protected string unit(int|float|string|null $value, string $unit)

Append a unit to the given value, or return an empty string if it has none.

Parameters

int|float|string|null $value
string $unit

Return Value

string

at line 43
protected string shortUuid(string $uuid)

Get a shortened UUID for display.

Parameters

string $uuid

Return Value

string

at line 51
protected string humanTime(CarbonInterface $date)

Format a timestamp as a human readable difference.

Parameters

CarbonInterface $date

Return Value

string

at line 59
protected string summarizeEntry(EntryResult $entry)

Generate a one-line summary for the given entry.

Parameters

EntryResult $entry

Return Value

string

at line 88
protected string colorMethod(string $method)

Colorize an HTTP method for console output.

Parameters

string $method

Return Value

string

at line 101
protected string colorStatus(int $status)

Colorize an HTTP status code for console output.

Parameters

int $status

Return Value

string

at line 114
protected string colorLevel(string $level)

Colorize a log level for console output.

Parameters

string $level

Return Value

string

at line 128
protected string colorCacheAction(string $type)

Colorize a cache action for console output.

Parameters

string $type

Return Value

string

at line 142
protected string colorJobStatus(string $status)

Colorize a job status for console output.

Parameters

string $status

Return Value

string

at line 155
protected string jsonBlock(mixed $data)

Format a value as a pretty-printed JSON block.

Parameters

mixed $data

Return Value

string

at line 163
protected void writeJson(mixed $data)

Write the given data as JSON output.

Parameters

mixed $data

Return Value

void