package Default
inherited_from \Zend\Console\Prompt\Char

 Methods

Ask the user for a single key stroke

__construct(string $promptText = 'Are you sure?', string $yesChar = 'y', string $noChar = 'n'
inherited_from \Zend\Console\Prompt\Char::__construct()

Parameters

$promptText

string

The prompt text to display in console

$yesChar

string

The "yes" key (defaults to Y)

$noChar

string

The "no" key (defaults to N)

Ask the user for a single key stroke

__construct(string $promptText = 'Please hit a key', string $allowedChars = '0123456789abcdefghijklmnopqrstuvwxyz', boolean $ignoreCase = true, boolean $allowEmpty = false, boolean $echo = true
Inherited

Parameters

$promptText

string

The prompt text to display in console

$allowedChars

string

A list of allowed chars (i.e. "abc12345")

$ignoreCase

boolean

If true, case will be ignored and prompt will always return lower-cased response

$allowEmpty

boolean

Is empty response allowed?

$echo

boolean

Display the selection after user presses key

getAllowEmpty()

getAllowEmpty() : boolean
Inherited

Returns

boolean

getAllowedChars()

getAllowedChars() : string
Inherited

Returns

string

Return console adapter to use when showing prompt.

getConsole() : \Zend\Console\Adapter\AdapterInterface
Inherited
inherited_from \Zend\Console\Prompt\PromptInterface::getConsole()

Returns

\Zend\Console\Adapter\AdapterInterface

getEcho()

getEcho() : boolean
Inherited

Returns

boolean

getIgnoreCase()

getIgnoreCase() : boolean
Inherited

Returns

boolean

Return last answer to this prompt.

getLastResponse() : mixed
Inherited
inherited_from \Zend\Console\Prompt\PromptInterface::getLastResponse()

Returns

mixed

getNoChar()

getNoChar() : string

Returns

string

getPromptText()

getPromptText() : string
Inherited

Returns

string

getYesChar()

getYesChar() : string

Returns

string

Create an instance of this prompt, show it and return response.

prompt() : mixed
InheritedStatic

This is a convenience method for creating statically creating prompts, i.e.:

 $name = Zend\Console\Prompt\Line::prompt("Enter your name: ");

Exceptions

\Zend\Console\Exception\BadMethodCallException

Returns

mixed

setAllowEmpty()

setAllowEmpty(boolean $allowEmpty) 
Inherited

Parameters

$allowEmpty

boolean

setAllowedChars()

setAllowedChars(string $allowedChars) 
Inherited

Parameters

$allowedChars

string

Set console adapter to use when showing prompt.

setConsole(\Zend\Console\Adapter\AdapterInterface $adapter) 
Inherited
inherited_from \Zend\Console\Prompt\PromptInterface::setConsole()

Parameters

$adapter

\Zend\Console\Adapter\AdapterInterface

setEcho()

setEcho(boolean $echo) 
Inherited

Parameters

$echo

boolean

setIgnoreCase()

setIgnoreCase(boolean $ignoreCase) 
Inherited

Parameters

$ignoreCase

boolean

setNoChar()

setNoChar(string $noChar) 

Parameters

$noChar

string

setPromptText()

setPromptText(string $promptText) 
Inherited

Parameters

$promptText

string

setYesChar()

setYesChar(string $yesChar) 

Parameters

$yesChar

string

Show the confirmation message and return result.

show() : boolean
inherited_from \Zend\Console\Prompt\Char::show()

Returns

boolean

Show the prompt to user and return a single char.

show() : string
Inherited

Returns

string

 Properties

 

$allowEmpty

$allowEmpty : boolean

Default

false
 

$allowedChars

$allowedChars : string

Default

'yn'
inherited_from \Zend\Console\Prompt\Char::allowedChars
 

$allowedChars

$allowedChars : string

Default

'yn'
 

$console

$console : \Zend\Console\Adapter\AdapterInterface

Default

 

$echo

$echo : boolean

Default

true
 

$ignoreCase

$ignoreCase : boolean

Default

true
inherited_from \Zend\Console\Prompt\Char::ignoreCase
 

$ignoreCase

$ignoreCase : boolean

Default

true
 

$lastResponse

$lastResponse : mixed

Default

 

$noChar

$noChar : string

Default

'n'
 

$promptText

$promptText : string

Default

'Are you sure?'
inherited_from \Zend\Console\Prompt\Char::promptText
 

$promptText

$promptText : string

Default

'Please select one option '
 

$yesChar

$yesChar : string

Default

'y'