SymfonyQuestionHelper
class SymfonyQuestionHelper extends QuestionHelper
Symfony Style Guide compliant question helper.
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 | formatTime($secs) | from Helper |
static | formatMemory($memory) | from Helper |
static | strlenWithoutDecoration(OutputFormatterInterface $formatter, $string) | 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. | from QuestionHelper | |
resource | getInputStream() Returns the helper's input stream. | from QuestionHelper |
string | getName() Returns the canonical name of this helper. | from QuestionHelper |
bool|mixed|null|string | doAsk(OutputInterface $output, Question $question) Asks the question to the user. | from QuestionHelper |
Details
setHelperSet(HelperSet $helperSet = null)
Sets the helper set associated with this helper.
Parameters
HelperSet | $helperSet | A HelperSet instance |
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 formatTime($secs)
Parameters
$secs |
static formatMemory($memory)
Parameters
$memory |
static strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
Parameters
OutputFormatterInterface | $formatter | |
$string |
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 |
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 |
resource getInputStream()
Returns the helper's input stream.
Return Value
resource |
string getName()
Returns the canonical name of this helper.
Return Value
string | The canonical name |
bool|mixed|null|string doAsk(OutputInterface $output, Question $question)
Asks the question to the user.
This method is public for PHP 5.3 compatibility, it should be private.
Parameters
OutputInterface | $output | |
Question | $question |
Return Value
bool|mixed|null|string |
Exceptions
Exception | |
RuntimeException |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.8/Symfony/Component/Console/Helper/SymfonyQuestionHelper.html