PHP Class Symfony\Component\Console\Helper\DialogHelper

Author: Fabien Potencier ([email protected])
Inheritance: extends Helper
Afficher le fichier Open project: pmjones/php-framework-benchmarks Class Usage Examples

Méthodes publiques

Méthode Description
ask ( Symfony\Component\Console\Output\OutputInterface $output, string | array $question, string $default = null ) : string Asks a question to the user.
askAndValidate ( Symfony\Component\Console\Output\OutputInterface $output, string | array $question, callback $validator, integer $attempts = false, string $default = null ) : mixed Asks for a value and validates the response.
askConfirmation ( Symfony\Component\Console\Output\OutputInterface $output, string | array $question, boolean $default = true ) : boolean Asks a confirmation to the user.
getName ( ) Returns the helper's canonical name
setInputStream ( resource $stream ) Sets the input stream to read from when interacting with the user.

Method Details

ask() public méthode

Asks a question to the user.
public ask ( Symfony\Component\Console\Output\OutputInterface $output, string | array $question, string $default = null ) : string
$output Symfony\Component\Console\Output\OutputInterface
$question string | array The question to ask
$default string The default answer if none is given by the user
Résultat string The user answer

askAndValidate() public méthode

The validator receives the data to validate. It must return the validated data when the data is valid and throw an exception otherwise.
public askAndValidate ( Symfony\Component\Console\Output\OutputInterface $output, string | array $question, callback $validator, integer $attempts = false, string $default = null ) : mixed
$output Symfony\Component\Console\Output\OutputInterface
$question string | array
$validator callback A PHP callback
$attempts integer Max number of times to ask before giving up (false by default, which means infinite)
$default string The default answer if none is given by the user
Résultat mixed

askConfirmation() public méthode

The question will be asked until the user answer by nothing, yes, or no.
public askConfirmation ( Symfony\Component\Console\Output\OutputInterface $output, string | array $question, boolean $default = true ) : boolean
$output Symfony\Component\Console\Output\OutputInterface
$question string | array The question to ask
$default boolean The default answer if the user enters nothing
Résultat boolean true if the user has confirmed, false otherwise

getName() public méthode

Returns the helper's canonical name
public getName ( )

setInputStream() public méthode

This is mainly useful for testing purpose.
public setInputStream ( resource $stream )
$stream resource The input stream