PHP 클래스 Cake\Console\ConsoleOutput
Can be connected to any stream resource that can be used with fopen()
Can generate colorized output on consoles that support it. There are a few
built in styles
-
error Error messages.
-
warning Warning messages.
-
info Informational messages.
-
comment Additional text.
-
question Magenta text used for user prompts
By defining styles with addStyle() you can create custom console styles.
### Using styles in output
You can format console output using tags with the name of the style to apply. From inside a shell object
$this->out('Overwrite: foo.php was overwritten.');
This would create orange 'Overwrite:' text, while the rest of the text would remain the normal color.
See ConsoleOutput::styles() to learn more about defining your own styles. Nested styles are not supported
at this time.
파일 보기
프로젝트 열기: cakephp/cakephp
1 사용 예제들
보호된 프로퍼티들
공개 메소드들
보호된 메소드들
메소드 상세
Checks for a pretty console environment. Ansicon and ConEmu allows
pretty consoles on windows, and is supported.
public __construct ( string $stream = 'php://stdout' ) |
$stream |
string |
The identifier of the stream to write output to. |
Clean up and close handles
Writes a message to the output stream.
Get/Set the output type to use. The output type how formatting tags are treated.
### Get a style definition
$output->styles('error');
### Get all the style definitions
$output->styles();
### Create or modify an existing style
$output->styles('annoy', ['text' => 'purple', 'background' => 'yellow', 'blink' => true]);
### Remove a style
$this->output->styles('annoy', false);
public styles ( string | null $style = null, array | boolean | null $definition = null ) : mixed |
$style |
string | null |
The style to get or create. |
$definition |
array | boolean | null |
The array definition of the style to change or create a style
or false to remove a style. |
리턴 |
mixed |
If you are getting styles, the style or null will be returned. If you are creating/modifying
styles true will be returned. |
Outputs a single or multiple messages to stdout or stderr. If no parameters
are passed, outputs just a newline.
프로퍼티 상세
$_backgroundColors 보호되어 있는 정적으로 프로퍼티
background colors used in colored output.
protected static array $_backgroundColors |
리턴 |
array |
|
$_foregroundColors 보호되어 있는 정적으로 프로퍼티
text colors used in colored output.
protected static array $_foregroundColors |
리턴 |
array |
|
$_options 보호되어 있는 정적으로 프로퍼티
formatting options for colored output
protected static string $_options |
리턴 |
string |
|
protected resource $_output |
리턴 |
resource |
|
The current output type. Manipulated with ConsoleOutput::outputAs();
protected int $_outputAs |
리턴 |
integer |
|
$_styles 보호되어 있는 정적으로 프로퍼티
You can modify these styles with ConsoleOutput::styles()
protected static array $_styles |
리턴 |
array |
|