PHP Class Neos\Flow\Cli\ConsoleOutput

Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство 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

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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 méthode

Creates and initializes the SymfonyConsoleOutput instance
public __construct ( )

ask() public méthode

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
Résultat string The user answer

askAndValidate() public méthode

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
Résultat mixed

askConfirmation() public méthode

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
Résultat boolean true if the user has confirmed, false otherwise

askHiddenResponse() public méthode

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
Résultat string The answer

askHiddenResponseAndValidate() public méthode

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
Résultat string The response

getDialogHelper() protected méthode

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

getMaximumLineLength() public méthode

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

getProgressHelper() protected méthode

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

getTableHelper() protected méthode

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

output() public méthode

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
Résultat void

outputFormatted() public méthode

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
Résultat void

outputLine() public méthode

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
Résultat void

outputTable() public méthode

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

progressAdvance() public méthode

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
Résultat void

progressFinish() public méthode

Finishes the progress output
public progressFinish ( ) : void
Résultat void

progressSet() public méthode

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

progressStart() public méthode

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

select() public méthode

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)
Résultat 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
Résultat Symfony\Component\Console\Helper\DialogHelper

$output protected_oe property

protected ConsoleOutput,Symfony\Component\Console\Output $output
Résultat Symfony\Component\Console\Output\ConsoleOutput

$progressHelper protected_oe property

protected ProgressHelper,Symfony\Component\Console\Helper $progressHelper
Résultat Symfony\Component\Console\Helper\ProgressHelper

$tableHelper protected_oe property

protected TableHelper,Symfony\Component\Console\Helper $tableHelper
Résultat Symfony\Component\Console\Helper\TableHelper