Documentation

SymfonyQuestionHelper extends QuestionHelper
in package

Symfony Style Guide compliant question helper.

Tags
author

Kevin Bond kevinbond@gmail.com

Table of Contents

$helperSet  : mixed
$inputStream  : mixed
$shell  : mixed
$stdinIsInteractive  : mixed
$stty  : mixed
ask()  : mixed
Asks a question to the user.
disableStty()  : mixed
Prevents usage of stty.
formatMemory()  : mixed
formatTime()  : mixed
getHelperSet()  : HelperSet
Gets the helper set associated with this helper.
getName()  : mixed
{@inheritdoc}
length()  : int
Returns the length of a string, using mb_strlen if it is available.
removeDecoration()  : mixed
setHelperSet()  : mixed
Sets the helper set associated with this helper.
strlen()  : int
Returns the length of a string, using mb_strwidth if it is available.
strlenWithoutDecoration()  : mixed
substr()  : string
Returns the subset of a string, using mb_substr if it is available.
width()  : int
Returns the width of a string, using mb_strwidth if it is available.
formatChoiceQuestionChoices()  : array<string|int, string>
writeError()  : mixed
Outputs an error message.
writePrompt()  : mixed
Outputs the question prompt.
autocomplete()  : string
Autocompletes a question.
cloneInputStream()  : resource|null
Clones an input stream in order to act on one instance of the same stream without affecting the other instance.
doAsk()  : mixed
Asks the question to the user.
getDefaultAnswer()  : mixed
getEofShortcut()  : string
getHiddenResponse()  : string
Gets a hidden response from user.
isInteractiveInput()  : bool
mostRecentlyEnteredValue()  : string
readInput()  : string|bool
Reads one or more lines of input and returns what is read.
resetIOCodepage()  : string|false
Sets console I/O to the specified code page and converts the user input.
setIOCodepage()  : int
Sets console I/O to the host code page.
validateAttempts()  : mixed
Validates an attempt.

Properties

$helperSet

protected mixed $helperSet = null

Methods

disableStty()

Prevents usage of stty.

public static disableStty() : mixed
Return values
mixed

formatMemory()

public static formatMemory(int $memory) : mixed
Parameters
$memory : int
Return values
mixed

formatTime()

public static formatTime(mixed $secs) : mixed
Parameters
$secs : mixed
Return values
mixed

getHelperSet()

Gets the helper set associated with this helper.

public getHelperSet() : HelperSet
Return values
HelperSet

A HelperSet instance

getName()

{@inheritdoc}

public getName() : mixed
Return values
mixed

length()

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

public static length(string|null $string) : int

The length is related to how many bytes the string will use.

Parameters
$string : string|null
Return values
int

setHelperSet()

Sets the helper set associated with this helper.

public setHelperSet([HelperSet $helperSet = null ]) : mixed
Parameters
$helperSet : HelperSet = null
Return values
mixed

strlen()

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

public static strlen(string|null $string) : int
Parameters
$string : string|null
Tags
deprecated

since 5.3

Return values
int

The length of the string

substr()

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

public static substr(string|null $string, int $from[, int $length = null ]) : string
Parameters
$string : string|null
$from : int
$length : int = null
Return values
string

The string subset

width()

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

public static width(string|null $string) : int

The width is how many characters positions the string will use.

Parameters
$string : string|null
Return values
int

formatChoiceQuestionChoices()

protected formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag) : array<string|int, string>
Parameters
$question : ChoiceQuestion
$tag : string
Return values
array<string|int, string>

autocomplete()

Autocompletes a question.

private autocomplete(OutputInterface $output, Question $question, resource $inputStream, callable $autocomplete) : string
Parameters
$output : OutputInterface
$question : Question
$inputStream : resource
$autocomplete : callable
Return values
string

cloneInputStream()

Clones an input stream in order to act on one instance of the same stream without affecting the other instance.

private cloneInputStream(resource $inputStream) : resource|null
Parameters
$inputStream : resource

The handler resource

Return values
resource|null

The cloned resource, null in case it could not be cloned

getHiddenResponse()

Gets a hidden response from user.

private getHiddenResponse(OutputInterface $output, resource $inputStream[, bool $trimmable = true ]) : string
Parameters
$output : OutputInterface
$inputStream : resource

The handler resource

$trimmable : bool = true

Is the answer trimmable

Tags
throws
RuntimeException

In case the fallback is deactivated and the response cannot be hidden

Return values
string

isInteractiveInput()

private isInteractiveInput(mixed $inputStream) : bool
Parameters
$inputStream : mixed
Return values
bool

mostRecentlyEnteredValue()

private mostRecentlyEnteredValue(string $entered) : string
Parameters
$entered : string
Return values
string

readInput()

Reads one or more lines of input and returns what is read.

private readInput(resource $inputStream, Question $question) : string|bool
Parameters
$inputStream : resource

The handler resource

$question : Question

The question being asked

Return values
string|bool

The input received, false in case input could not be read

resetIOCodepage()

Sets console I/O to the specified code page and converts the user input.

private resetIOCodepage(int $cp, string|false $input) : string|false
Parameters
$cp : int
$input : string|false
Return values
string|false

setIOCodepage()

Sets console I/O to the host code page.

private setIOCodepage() : int
Return values
int

Previous code page in IBM/EBCDIC format

validateAttempts()

Validates an attempt.

private validateAttempts(callable $interviewer, OutputInterface $output, Question $question) : mixed
Parameters
$interviewer : callable

A callable that will ask for a question and return the result

$output : OutputInterface
$question : Question
Tags
throws
Exception

In case the max number of attempts has been reached and no valid response has been given

Return values
mixed

The validated response

Search results