QuestionHelper

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
HelperSet 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 string substr(string $string, int $from, int|null $length = null)

Returns the subset of a string, using mb_substr if it is available.

from Helper
static formatTime($secs) from Helper
static formatMemory($memory) from Helper
static strlenWithoutDecoration(OutputFormatterInterface $formatter, $string) from Helper
static removeDecoration(OutputFormatterInterface $formatter, $string) from Helper
mixed ask(InputInterface $input, OutputInterface $output, Question $question)

Asks a question to the user.

setInputStream(resource $stream) deprecated

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

resource getInputStream() deprecated

Returns the helper's input stream.

string getName()

Returns the canonical name of this helper.

static disableStty()

Prevents usage of stty.

Details

setHelperSet(HelperSet $helperSet = null)

Sets the helper set associated with this helper.

Parameters

HelperSet $helperSet

HelperSet getHelperSet()

Gets the helper set associated with this helper.

Return Value

HelperSet A HelperSet instance

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

static string substr(string $string, int $from, int|null $length = null)

Returns the subset of a string, using mb_substr if it is available.

Parameters

string $string String to subset
int $from Start offset
int|null $length Length to read

Return Value

string The string subset

static formatTime($secs)

Parameters

$secs

static formatMemory($memory)

Parameters

$memory

static strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)

Parameters

OutputFormatterInterface $formatter
$string

static removeDecoration(OutputFormatterInterface $formatter, $string)

Parameters

OutputFormatterInterface $formatter
$string

mixed ask(InputInterface $input, OutputInterface $output, Question $question)

Asks a question to the user.

Parameters

InputInterface $input
OutputInterface $output
Question $question

Return Value

mixed The user answer

Exceptions

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

setInputStream(resource $stream) deprecated

deprecated

since version 3.2, to be removed in 4.0. Use StreamableInputInterface::setStream() instead.

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

resource getInputStream() deprecated

deprecated

since version 3.2, to be removed in 4.0. Use StreamableInputInterface::getStream() instead.

Returns the helper's input stream.

Return Value

resource

string getName()

Returns the canonical name of this helper.

Return Value

string The canonical name

static disableStty()

Prevents usage of stty.

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.3/Symfony/Component/Console/Helper/QuestionHelper.html