class Confirmation extends Question

Confirmation helper.

Properties

protected Input $input Input instance. from Question
protected Output $output Output instance. from Question

Methods

__construct(Input $input, Output $output)

Constructor.

from Question
mixed
ask(string $question, mixed $default = 'n', array|null $options = null)

Asks user for confirmation and returns value corresponding to the chosen value.

array
normalizeKeys(array $array)

Returns an array where all array keys lower case.

string
getOptions(array $options, string $default)

Returns a slash-separated list of valid options where the default one is highlighted as upper-case.

Details

in Question at line 42
__construct(Input $input, Output $output)

Constructor.

Parameters

Input $input Input instance
Output $output Output instance

at line 68
mixed ask(string $question, mixed $default = 'n', array|null $options = null)

Asks user for confirmation and returns value corresponding to the chosen value.

Parameters

string $question Question to ask
mixed $default Default if no input is entered
array|null $options Answer options

Return Value

mixed

at line 29
protected array normalizeKeys(array $array)

Returns an array where all array keys lower case.

Parameters

array $array Array

Return Value

array

at line 48
protected string getOptions(array $options, string $default)

Returns a slash-separated list of valid options where the default one is highlighted as upper-case.

Parameters

array $options Answer options
string $default Default answer

Return Value

string