PHP Class ConsoleKit\Widgets\Dialog

Inheritance: extends AbstractWidget
Datei anzeigen Open project: maximebf/consolekit Class Usage Examples

Public Methods

Method Description
ask ( string $text, string $default = '', boolean $displayDefault = true ) : string Writes $text and reads the user's input
confirm ( string $text, string $expected = 'y', array $choices = ['Y', 'n'], string $default = 'y', string $errorMessage = 'Invalid choice' ) : boolean Writes $text (followed by the list of choices) and reads the user response.

Method Details

ask() public method

Writes $text and reads the user's input
public ask ( string $text, string $default = '', boolean $displayDefault = true ) : string
$text string
$default string
$displayDefault boolean
return string

confirm() public method

Returns true if it matches $expected, false otherwise if($dialog->confirm('Are you sure?')) { ... } if($dialog->confirm('Your choice?', null, array('a', 'b', 'c'))) { ... }
public confirm ( string $text, string $expected = 'y', array $choices = ['Y', 'n'], string $default = 'y', string $errorMessage = 'Invalid choice' ) : boolean
$text string
$expected string
$choices array
$default string
$errorMessage string
return boolean