PHP Class Neos\Flow\Cli\ConsoleOutput

Mostra file Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$dialogHelper Symfony\Component\Console\Helper\DialogHelper
$output Symfony\Component\Console\Output\ConsoleOutput
$progressHelper Symfony\Component\Console\Helper\ProgressHelper
$tableHelper Symfony\Component\Console\Helper\TableHelper

Public Methods

Method Description
__construct ( ) Creates and initializes the SymfonyConsoleOutput instance
ask ( string | array $question, string $default = null, array $autocomplete = null ) : string Asks a question to the user
askAndValidate ( string | array $question, callable $validator, integer | boolean $attempts = false, string $default = null, array $autocomplete = null ) : mixed Asks for a value and validates the response
askConfirmation ( string | array $question, boolean $default = true ) : boolean Asks a confirmation to the user.
askHiddenResponse ( string | array $question, boolean $fallback = true ) : string Asks a question to the user, the response is hidden
askHiddenResponseAndValidate ( string | array $question, callable $validator, integer | boolean $attempts = false, boolean $fallback = true ) : string Asks for a value, hide and validates the response
getMaximumLineLength ( ) : integer Returns the desired maximum line length for console output.
output ( string $text, array $arguments = [] ) : void Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
outputFormatted ( string $text = '', array $arguments = [], integer $leftPadding ) : void Formats the given text to fit into the maximum line length and outputs it to the console window
outputLine ( string $text = '', array $arguments = [] ) : void Outputs specified text to the console window and appends a line break
outputTable ( array $rows, array $headers = null ) Renders a table like output of the given $rows
progressAdvance ( integer $step = 1, boolean $redraw = false ) : void Advances the progress output X steps
progressFinish ( ) : void Finishes the progress output
progressSet ( integer $current, boolean $redraw = false ) : void Sets the current progress
progressStart ( integer $max = null ) : void Starts the progress output
select ( string | array $question, array $choices, boolean $default = null, boolean $multiSelect = false, boolean | integer $attempts = false ) : integer | string | array Asks the user to select a value

Protected Methods

Method Description
getDialogHelper ( ) : DialogHelper Returns or initializes the symfony/console DialogHelper
getProgressHelper ( ) : Symfony\Component\Console\Helper\ProgressHelper Returns or initializes the symfony/console ProgressHelper
getTableHelper ( ) : Symfony\Component\Console\Helper\TableHelper Returns or initializes the symfony/console TableHelper

Method Details

__construct() public method

Creates and initializes the SymfonyConsoleOutput instance
public __construct ( )

ask() public method

Asks a question to the user
public ask ( string | array $question, string $default = null, array $autocomplete = null ) : string
$question string | array The question to ask. If an array each array item is turned into one line of a multi-line question
$default string The default answer if none is given by the user
$autocomplete array List of values to autocomplete. This only works if "stty" is installed
return string The user 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, integer | boolean $attempts = false, string $default = null, array $autocomplete = null ) : mixed
$question string | array The question to ask. If an array each array item is turned into one line of a multi-line question
$validator callable A PHP callback that gets a value and is expected to return the (transformed) value or throw an exception if it wasn't valid
$attempts integer | boolean 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
$autocomplete array List of values to autocomplete. This only works if "stty" is installed
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. If an array each array item is turned into one line of a multi-line question
$default boolean The default answer if the user enters nothing
return boolean true if the user has confirmed, false otherwise

askHiddenResponse() public method

Asks a question to the user, the response is hidden
public askHiddenResponse ( string | array $question, boolean $fallback = true ) : string
$question string | array The question. If an array each array item is turned into one line of a multi-line question
$fallback boolean In case the response can not be hidden, whether to fallback on non-hidden question or not
return string The answer

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, integer | boolean $attempts = false, boolean $fallback = true ) : string
$question string | array The question to ask. If an array each array item is turned into one line of a multi-line question
$validator callable A PHP callback that gets a value and is expected to return the (transformed) value or throw an exception if it wasn't valid
$attempts integer | boolean 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 string The response

getDialogHelper() protected method

Returns or initializes the symfony/console DialogHelper
protected getDialogHelper ( ) : DialogHelper
return Symfony\Component\Console\Helper\DialogHelper

getMaximumLineLength() public method

Returns the desired maximum line length for console output.
public getMaximumLineLength ( ) : integer
return integer

getProgressHelper() protected method

Returns or initializes the symfony/console ProgressHelper
protected getProgressHelper ( ) : Symfony\Component\Console\Helper\ProgressHelper
return Symfony\Component\Console\Helper\ProgressHelper

getTableHelper() protected method

Returns or initializes the symfony/console TableHelper
protected getTableHelper ( ) : Symfony\Component\Console\Helper\TableHelper
return Symfony\Component\Console\Helper\TableHelper

output() public method

Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
See also: http://www.php.net/sprintf
public output ( string $text, array $arguments = [] ) : void
$text string Text to output
$arguments array Optional arguments to use for sprintf
return void

outputFormatted() public method

Formats the given text to fit into the maximum line length and outputs it to the console window
See also: outputLine()
public outputFormatted ( string $text = '', array $arguments = [], integer $leftPadding ) : void
$text string Text to output
$arguments array Optional arguments to use for sprintf
$leftPadding integer The number of spaces to use for indentation
return void

outputLine() public method

Outputs specified text to the console window and appends a line break
See also: output()
See also: outputLines()
public outputLine ( string $text = '', array $arguments = [] ) : void
$text string Text to output
$arguments array Optional arguments to use for sprintf
return void

outputTable() public method

Renders a table like output of the given $rows
public outputTable ( array $rows, array $headers = null )
$rows array
$headers array

progressAdvance() public method

Advances the progress output X steps
public progressAdvance ( integer $step = 1, boolean $redraw = false ) : void
$step integer Number of steps to advance
$redraw boolean Whether to redraw or not
return void

progressFinish() public method

Finishes the progress output
public progressFinish ( ) : void
return void

progressSet() public method

Sets the current progress
public progressSet ( integer $current, boolean $redraw = false ) : void
$current integer The current progress
$redraw boolean Whether to redraw or not
return void

progressStart() public method

Starts the progress output
public progressStart ( integer $max = null ) : void
$max integer Maximum steps. If NULL an indeterminate progress bar is rendered
return void

select() public method

Asks the user to select a value
public select ( string | array $question, array $choices, boolean $default = null, boolean $multiSelect = false, boolean | integer $attempts = false ) : integer | string | array
$question string | array The question to ask. If an array each array item is turned into one line of a multi-line question
$choices array List of choices to pick from
$default boolean The default answer if the user enters nothing
$multiSelect boolean If TRUE the result will be an array with the selected options. Multiple options can be given separated by commas
$attempts boolean | integer Max number of times to ask before giving up (false by default, which means infinite)
return integer | string | array The selected value or values (the key of the choices array)

Property Details

$dialogHelper protected_oe property

protected DialogHelper,Symfony\Component\Console\Helper $dialogHelper
return Symfony\Component\Console\Helper\DialogHelper

$output protected_oe property

protected ConsoleOutput,Symfony\Component\Console\Output $output
return Symfony\Component\Console\Output\ConsoleOutput

$progressHelper protected_oe property

protected ProgressHelper,Symfony\Component\Console\Helper $progressHelper
return Symfony\Component\Console\Helper\ProgressHelper

$tableHelper protected_oe property

protected TableHelper,Symfony\Component\Console\Helper $tableHelper
return Symfony\Component\Console\Helper\TableHelper