Jelix 1.8.14-pre

InputHelpers
in package

Tags

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

$consoleInput

protected InputInterface $consoleInput
Tags

$consoleOutput

protected OutputInterface $consoleOutput
Tags

$questionHelper

protected QuestionHelper $questionHelper
Tags

Methods

__construct()

public __construct(QuestionHelper $helper, InputInterface $input, OutputInterface $output) : mixed
Parameters
$helper : QuestionHelper
$input : InputInterface
$output : OutputInterface
Tags
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

Tags
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

Tags
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.

Tags
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
Tags
Return values
string

the value

Search results