Jelix 1.7.18

InputHelpers
in package

Table of Contents

$consoleInput  : InputInterface
$consoleOutput  : OutputInterface
$questionHelper  : QuestionHelper
__construct()  : mixed
askConfirmation()  : bool
Ask a confirmation.
askInChoice()  : string|array<string|int, string>
Ask a value from a choice.
askInformation()  : string
Ask a value to the user.
askSecretInformation()  : string
Ask a hidden value to the user, like a password.

Properties

$questionHelper

protected QuestionHelper $questionHelper

Methods

__construct()

public __construct(QuestionHelper $helper, InputInterface $input, OutputInterface $output) : mixed
Parameters
$helper : QuestionHelper
$input : InputInterface
$output : OutputInterface
Return values
mixed —

askConfirmation()

Ask a confirmation.

public askConfirmation(string $questionMessage[, bool $defaultResponse = false ]) : bool
Parameters
$questionMessage : string

the question

$defaultResponse : bool = false

the default response

Return values
bool —

true it the user has confirmed

askInChoice()

Ask a value from a choice.

public askInChoice(string $questionMessage, array<string|int, mixed> $choice, int $defaultResponse[, bool $multipleChoice = false ][, string $errorMessage = '%s is invalid' ]) : string|array<string|int, string>
Parameters
$questionMessage : string
$choice : array<string|int, mixed>

list of possible values

$defaultResponse : int

the default value

$multipleChoice : bool = false

true if the user can choose different values

$errorMessage : string = '%s is invalid'

error message when the user didn't indicate a value from the choice

Return values
string|array<string|int, string> —

responses from the user

askInformation()

Ask a value to the user.

public askInformation(string $questionMessage[, false|string $defaultResponse = false ][, false|array<string|int, string> $autoCompleterValues = false ][, null|callable $validator = null ]) : string
Parameters
$questionMessage : string
$defaultResponse : false|string = false
$autoCompleterValues : false|array<string|int, string> = false

list of values for autocompletion

$validator : null|callable = null

function to validate the value. It accepts a string as parameter, should return the value (may be modified), and should throw an exception when the value is invalid.

Return values
string —

the value given by the user

askSecretInformation()

Ask a hidden value to the user, like a password.

public askSecretInformation(string $questionMessage[, false|string $defaultResponse = false ]) : string
Parameters
$questionMessage : string
$defaultResponse : false|string = false
Return values
string —

the value

Search results