A wrapper around the various IO operations shell tasks need to do.
Packages up the stdout, stderr, and stdin streams providing a simple consistent interface for shells to use. This class also makes mocking streams easy to do in unit tests.
__construct( Cake\Console\ConsoleOutput $out null , Cake\Console\ConsoleOutput $err null , Cake\Console\ConsoleInput $in null , Cake\Console\HelperRegistry $helpers null )
Constructor
Cake\Console\ConsoleOutput $out optional null Cake\Console\ConsoleOutput $err optional null Cake\Console\ConsoleInput $in optional null Cake\Console\HelperRegistry $helpers optional null _getInput( string $prompt , string|null $options , string|null $default )
Prompts the user for input, and returns it.
$prompt $options $default stringask( string $prompt , string|null $default null )
Prompts the user for input, and returns it.
$prompt $default optional null mixedaskChoice( string $prompt , string|array $options , string|null $default null )
Prompts the user for input based on a list of options, and returns it.
$prompt $options $default optional null mixederr( string|array $message '' , integer $newlines 1 )
Outputs a single or multiple error messages to stderr. If no parameters are passed outputs just a newline.
$message optional '' $newlines optional 1 helper( string $name , array $settings [] )
Render a Console Helper
Create and render the output for a helper object. If the helper object has not already been loaded, it will be loaded and constructed.
$name $settings optional [] Cake\Console\Helperhr( integer $newlines 0 , integer $width 79 )
Outputs a series of minus characters to the standard output, acts as a visual separator.
$newlines optional 0 $width optional 79 level( null|integer $level null )
Get/set the current output level.
$level optional null integernl( integer $multiplier 1 )
Returns a single or multiple linefeeds sequences.
$multiplier optional 1 stringout( string|array $message '' , integer $newlines 1 , integer $level Cake\Console\ConsoleIo::NORMAL )
Outputs a single or multiple messages to stdout. If no parameters are passed outputs just a newline.
There are 3 built-in output level. Shell::QUIET, Shell::NORMAL, Shell::VERBOSE. The verbose and quiet output levels, map to the verbose and quiet output switches present in most shells. Using Shell::QUIET for a message means it will always display. While using Shell::VERBOSE means it will only display when verbose output is toggled.
$message optional '' $newlines optional 1 $level optional Cake\Console\ConsoleIo::NORMAL integer|booleanoutputAs( integer $mode )
Change the output mode of the stdout stream
$mode Cake\Console\ConsoleOutput::outputAs()overwrite( array|string $message , integer $newlines 1 , integer $size null )
Overwrite some already output text.
Useful for building progress bars, or when you want to replace text already output to the screen with new text.
Warning You cannot overwrite text that contains newlines.
$message $newlines optional 1 $size optional null quiet( string|array $message , integer $newlines 1 )
Output at all levels.
$message $newlines optional 1 integer|booleansetLoggers( integer|boolean $enable )
Connects or disconnects the loggers to the console output.
Used to enable or disable logging stream output to stdout and stderr If you don't wish all log output in stdout or stderr through Cake's Log class, call this function with $enable=false.
$enable styles( string $style null , array|boolean|null $definition null )
Add a new output style or get defined styles.
$style optional null $definition optional null mixedCake\Console\ConsoleOutput::styles()verbose( string|array $message , integer $newlines 1 )
Output at the verbose level.
$message $newlines optional 1 integer|booleaninteger | NORMAL Output constant for making normal shells. | 1 |
integer | QUIET Output constants for making quiet shells. | 0 |
integer | VERBOSE Output constant making verbose shells. | 2 |
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/3.1/class-Cake.Console.ConsoleIo.html