PHP 클래스 Symfony\Component\Console\Helper\DialogHelper

저자: Fabien Potencier ([email protected])
상속: extends Helper
파일 보기 프로젝트 열기: pmjones/php-framework-benchmarks 1 사용 예제들

공개 메소드들

메소드 설명
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