PHP Класс Neos\Flow\Cli\ConsoleOutput

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$dialogHelper Symfony\Component\Console\Helper\DialogHelper
$output Symfony\Component\Console\Output\ConsoleOutput
$progressHelper Symfony\Component\Console\Helper\ProgressHelper
$tableHelper Symfony\Component\Console\Helper\TableHelper

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
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

Описание методов

__construct() публичный Метод

Creates and initializes the SymfonyConsoleOutput instance
public __construct ( )

ask() публичный Метод

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
Результат string The user answer

askAndValidate() публичный Метод

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
Результат mixed

askConfirmation() публичный Метод

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
Результат boolean true if the user has confirmed, false otherwise

askHiddenResponse() публичный Метод

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
Результат string The answer

askHiddenResponseAndValidate() публичный Метод

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
Результат string The response

getDialogHelper() защищенный Метод

Returns or initializes the symfony/console DialogHelper
protected getDialogHelper ( ) : DialogHelper
Результат Symfony\Component\Console\Helper\DialogHelper

getMaximumLineLength() публичный Метод

Returns the desired maximum line length for console output.
public getMaximumLineLength ( ) : integer
Результат integer

getProgressHelper() защищенный Метод

Returns or initializes the symfony/console ProgressHelper
protected getProgressHelper ( ) : Symfony\Component\Console\Helper\ProgressHelper
Результат Symfony\Component\Console\Helper\ProgressHelper

getTableHelper() защищенный Метод

Returns or initializes the symfony/console TableHelper
protected getTableHelper ( ) : Symfony\Component\Console\Helper\TableHelper
Результат Symfony\Component\Console\Helper\TableHelper

output() публичный Метод

Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
См. также: 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
Результат void

outputFormatted() публичный Метод

Formats the given text to fit into the maximum line length and outputs it to the console window
См. также: 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
Результат void

outputLine() публичный Метод

Outputs specified text to the console window and appends a line break
См. также: output()
См. также: outputLines()
public outputLine ( string $text = '', array $arguments = [] ) : void
$text string Text to output
$arguments array Optional arguments to use for sprintf
Результат void

outputTable() публичный Метод

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

progressAdvance() публичный Метод

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
Результат void

progressFinish() публичный Метод

Finishes the progress output
public progressFinish ( ) : void
Результат void

progressSet() публичный Метод

Sets the current progress
public progressSet ( integer $current, boolean $redraw = false ) : void
$current integer The current progress
$redraw boolean Whether to redraw or not
Результат void

progressStart() публичный Метод

Starts the progress output
public progressStart ( integer $max = null ) : void
$max integer Maximum steps. If NULL an indeterminate progress bar is rendered
Результат void

select() публичный Метод

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)
Результат integer | string | array The selected value or values (the key of the choices array)

Описание свойств

$dialogHelper защищенное свойство

protected DialogHelper,Symfony\Component\Console\Helper $dialogHelper
Результат Symfony\Component\Console\Helper\DialogHelper

$output защищенное свойство

protected ConsoleOutput,Symfony\Component\Console\Output $output
Результат Symfony\Component\Console\Output\ConsoleOutput

$progressHelper защищенное свойство

protected ProgressHelper,Symfony\Component\Console\Helper $progressHelper
Результат Symfony\Component\Console\Helper\ProgressHelper

$tableHelper защищенное свойство

protected TableHelper,Symfony\Component\Console\Helper $tableHelper
Результат Symfony\Component\Console\Helper\TableHelper