class QuestionHelper extends Helper

The QuestionHelper class provides helpers to interact with the user.

Methods

setHelperSet(HelperSet $helperSet = null)

Sets the helper set associated with this helper.

from Helper
getHelperSet()

Gets the helper set associated with this helper.

from Helper
static int
strlen(string $string)

Returns the length of a string, using mb_strwidth if it is available.

from Helper
static 
formatTime($secs)

No description

from Helper
static 
formatMemory($memory)

No description

from Helper
static 
strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)

No description

from Helper
string
ask(InputInterface $input, OutputInterface $output, Question $question)

Asks a question to the user.

setInputStream(resource $stream)

Sets the input stream to read from when interacting with the user.

resource
getInputStream()

Returns the helper's input stream.

string
getName()

Returns the canonical name of this helper.

Details

in Helper at line line 30
setHelperSet(HelperSet $helperSet = null)

Sets the helper set associated with this helper.

Parameters

HelperSet $helperSet A HelperSet instance

in Helper at line line 40
HelperSet getHelperSet()

Gets the helper set associated with this helper.

Return Value

HelperSet A HelperSet instance

in Helper at line line 52
static int strlen(string $string)

Returns the length of a string, using mb_strwidth if it is available.

Parameters

string $string The string to check its length

Return Value

int The length of the string

in Helper at line line 61
static formatTime($secs)

Parameters

$secs

in Helper at line line 88
static formatMemory($memory)

Parameters

$memory

in Helper at line line 105
static strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)

Parameters

OutputFormatterInterface $formatter
$string

at line line 45
string ask(InputInterface $input, OutputInterface $output, Question $question)

Asks a question to the user.

Parameters

InputInterface $input An InputInterface instance
OutputInterface $output An OutputInterface instance
Question $question The question to ask

Return Value

string The user answer

Exceptions

RuntimeException If there is no data to read in the input stream

at line line 75
setInputStream(resource $stream)

Sets the input stream to read from when interacting with the user.

This is mainly useful for testing purpose.

Parameters

resource $stream The input stream

Exceptions

InvalidArgumentException In case the stream is not a resource

at line line 89
resource getInputStream()

Returns the helper's input stream.

Return Value

resource

at line line 97
string getName()

Returns the canonical name of this helper.

Return Value

string The canonical name