trait CommandHelperTrait

Controller helper trait.

Traits

Container aware trait.

Properties

protected Container $container Container. from ContainerAwareTrait
protected array $resolved Array of resolved objects and/or references to resolved objects. from ContainerAwareTrait
Application $app from ContainerAwareTrait
CacheManager $cache from ContainerAwareTrait
Input $input from ContainerAwareTrait
Output $output from ContainerAwareTrait
CommandBusInterface $bus from ContainerAwareTrait
Config $config from ContainerAwareTrait
ConnectionManager $database from ContainerAwareTrait
ErrorHandler $errorHandler from ContainerAwareTrait
Event $event from ContainerAwareTrait
FileSystem $fileSystem from ContainerAwareTrait
AuthorizerInterface $authorizer from ContainerAwareTrait
Gatekeeper $gatekeeper from ContainerAwareTrait
Request $request from ContainerAwareTrait
Response $response from ContainerAwareTrait
Routes $routes from ContainerAwareTrait
URLBuilder $urlBuilder from ContainerAwareTrait
I18n $i18n from ContainerAwareTrait
PaginationFactoryInterface $pagination from ContainerAwareTrait
ConnectionManager $redis from ContainerAwareTrait
CryptoManager $crypto from ContainerAwareTrait
Signer $signer from ContainerAwareTrait
Session $session from ContainerAwareTrait
Humanizer $humanizer from ContainerAwareTrait
ValidatorFactory $validator from ContainerAwareTrait
ViewFactory $view from ContainerAwareTrait
LoggerInterface $logger from ContainerAwareTrait

Methods

setContainer(Container $container)

Sets the container instance.

mixed
__get(string $key)

Resolves item from the container using overloading.

nl(int $lines = 1, int $writer = Output::STANDARD)

Writes n newlines to output.

write(string $string, int $writer = Output::STANDARD)

Writes string to output.

error(string $string)

Writes string to output using the error writer.

clear()

Clears the screen.

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

Draws an alert.

bell(int $times = 1)

Rings the terminal bell n times.

countdown(int $from = 5)

Counts down from n.

progressBar(int $items, float $minTimeBetweenRedraw = 0.1, string|null $prefix = null)

Draws a progress bar and returns a progress bar instance.

table(array $columnNames, array $rows, int $writer = Output::STANDARD)

Draws a table.

ol(array $items, string $marker = '<yellow>%s</yellow>.', int $writer = Output::STANDARD)

Draws an ordered list.

ul(array $items, string $marker = '<yellow>*</yellow>', int $writer = Output::STANDARD)

Draws an unordered list.

bool
confirm(string $question, string $default = 'n')

Writes question to output and returns boolesn value corresponding to the chosen value.

mixed
question(string $question, mixed $default = null)

Writes question to output and returns user input.

int
select(string $question, array $options)

Prints out a list of options and returns the array key of the chosen value.

mixed
secret(string $question, mixed $default = null, bool $fallback = false)

Writes question to output and returns hidden user input.

Details

in ContainerAwareTrait at line 68
setContainer(Container $container)

Sets the container instance.

Parameters

Container $container Container

in ContainerAwareTrait at line 79
mixed __get(string $key)

Resolves item from the container using overloading.

Parameters

string $key Key

Return Value

mixed

at line 41
protected nl(int $lines = 1, int $writer = Output::STANDARD)

Writes n newlines to output.

Parameters

int $lines Number of newlines to write
int $writer Output writer

at line 52
protected write(string $string, int $writer = Output::STANDARD)

Writes string to output.

Parameters

string $string String to write
int $writer Output writer

at line 62
protected error(string $string)

Writes string to output using the error writer.

Parameters

string $string String to write

at line 70
protected clear()

Clears the screen.

at line 82
protected alert(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

at line 92
protected bell(int $times = 1)

Rings the terminal bell n times.

Parameters

int $times Number of times to ring the bell

at line 102
protected countdown(int $from = 5)

Counts down from n.

Parameters

int $from Number of seconds to count down

at line 115
protected ProgressBar progressBar(int $items, float $minTimeBetweenRedraw = 0.1, string|null $prefix = null)

Draws a progress bar and returns a progress bar instance.

Parameters

int $items Total number of items
float $minTimeBetweenRedraw Minimum time between redraw in seconds
string|null $prefix Progress bar prefix

Return Value

ProgressBar

at line 142
protected table(array $columnNames, array $rows, int $writer = Output::STANDARD)

Draws a table.

Parameters

array $columnNames Array of column names
array $rows Array of rows
int $writer Output writer

at line 154
protected ol(array $items, string $marker = '<yellow>%s</yellow>.', int $writer = Output::STANDARD)

Draws an ordered list.

Parameters

array $items Items
string $marker Item marker
int $writer Output writer

at line 166
protected ul(array $items, string $marker = '<yellow>*</yellow>', int $writer = Output::STANDARD)

Draws an unordered list.

Parameters

array $items Items
string $marker Item marker
int $writer Output writer

at line 178
protected bool confirm(string $question, string $default = 'n')

Writes question to output and returns boolesn value corresponding to the chosen value.

Parameters

string $question Question to ask
string $default Default answer

Return Value

bool

at line 190
protected mixed question(string $question, mixed $default = null)

Writes question to output and returns user input.

Parameters

string $question Question to ask
mixed $default Default if no input is entered

Return Value

mixed

at line 202
protected int select(string $question, array $options)

Prints out a list of options and returns the array key of the chosen value.

Parameters

string $question Question to ask
array $options Numeric array of options to choose from

Return Value

int

at line 215
protected mixed secret(string $question, mixed $default = null, bool $fallback = false)

Writes question to output and returns hidden user input.

Parameters

string $question Question to ask
mixed $default Default if no input is entered
bool $fallback Fall back to non-hidden input?

Return Value

mixed