PHP Класс Symfony\Component\Console\Helper\DialogHelper

Автор: Fabien Potencier ([email protected])
Наследование: extends Helper
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

ask() публичный Метод

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
Результат string The user answer

askAndValidate() публичный Метод

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
Результат mixed

askConfirmation() публичный Метод

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
Результат boolean true if the user has confirmed, false otherwise

getName() публичный Метод

Returns the helper's canonical name
public getName ( )

setInputStream() публичный Метод

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