PHP Interface Yosymfony\Spress\Core\IO\IOInterface

Based on https://github.com/composer/composer/blob/master/src/Composer/IO/IOInterface.php from François Pluchino
Author: Victor Puertas
Mostrar archivo Open project: spress/spress Interface Usage Examples

Public Methods

Method Description
ask ( string | array $question, string $default = null ) : string Asks a question to the user.
askAndHideAnswer ( string $question, boolean $fallback = true ) : string Asks a question to the user and hide the answer.
askAndValidate ( string | array $question, callable $validator, boolean | integer $attempts = false, string $default = null ) : mixed Asks for a value and validates the response.
askConfirmation ( string | array $question, boolean $default = true ) : boolean Asks a confirmation to the user.
askHiddenResponseAndValidate ( string | array $question, callable $validator, boolean | integer $attempts = false, boolean $fallback = true ) : mixed Asks for a value, hide and validates the response.
isDebug ( ) : boolean Is the output in debug verbosity?
isDecorated ( ) : boolean Is this output decorated?
isInteractive ( ) : boolean Is this input means interactive?
isVerbose ( ) : boolean Is this output verbose?
isVeryVerbose ( ) : boolean Is the output very verbose?
write ( string | array $messages, boolean $newline = true ) Writes a message to the output.

Method Details

ask() public method

Asks a question to the user.
public ask ( string | array $question, string $default = null ) : string
$question string | array The question to ask
$default string The default answer if none is given by the user
return string The user answer

askAndHideAnswer() public method

Asks a question to the user and hide the answer.
public askAndHideAnswer ( string $question, boolean $fallback = true ) : string
$question string The question to ask
$fallback boolean In case the response can not be hidden, whether to fallback on non-hidden question or not
return string The answer

askAndValidate() public method

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 ( string | array $question, callable $validator, boolean | integer $attempts = false, string $default = null ) : mixed
$question string | array The question to ask
$validator callable A PHP callback
$attempts boolean | 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
return mixed

askConfirmation() public method

The question will be asked until the user answers by nothing, yes, or no.
public askConfirmation ( string | array $question, boolean $default = true ) : boolean
$question string | array The question to ask
$default boolean The default answer if the user enters nothing
return boolean true if the user has confirmed, false otherwise

askHiddenResponseAndValidate() public method

The validator receives the data to validate. It must return the validated data when the data is valid and throw an exception otherwise.
public askHiddenResponseAndValidate ( string | array $question, callable $validator, boolean | integer $attempts = false, boolean $fallback = true ) : mixed
$question string | array The question to ask
$validator callable A PHP callback
$attempts boolean | integer Max number of times to ask before giving up (false by default, which means infinite)
$fallback boolean In case the response can not be hidden, whether to fallback on non-hidden question or not
return mixed

isDebug() public method

Is the output in debug verbosity?
public isDebug ( ) : boolean
return boolean

isDecorated() public method

Is this output decorated?
public isDecorated ( ) : boolean
return boolean

isInteractive() public method

Is this input means interactive?
public isInteractive ( ) : boolean
return boolean

isVerbose() public method

Is this output verbose?
public isVerbose ( ) : boolean
return boolean

isVeryVerbose() public method

Is the output very verbose?
public isVeryVerbose ( ) : boolean
return boolean

write() public method

Writes a message to the output.
public write ( string | array $messages, boolean $newline = true )
$messages string | array The message as an array of lines or a single string
$newline boolean Whether to add a newline or not