Properties

$outputStream

$outputStream : resource

Normal output stream. Default is STDOUT

Type

resource

$errorStream

$errorStream : resource

Error output stream. Default is STDERR

Type

resource

$style

$style : \Toolkit\Cli\Style

控制台窗口(字体/背景)颜色添加处理 window colors

Type

\Toolkit\Cli\Style

Methods

write()

write(  $messages,   $nl = true,   $quit = false, array  $opts = array()) 

Parameters

$messages
$nl
$quit
array $opts

writef()

writef(string  $format, mixed  ...$args) 

Parameters

string $format
mixed $args variadic

printf()

printf(string  $format, mixed  ...$args) 

Parameters

string $format
mixed $args variadic

writeln()

writeln(string|mixed  $text, boolean  $quit = false, array  $opts = array()) : integer

Parameters

string|mixed $text
boolean $quit
array $opts

Returns

integer

println()

println(string|mixed  $text, boolean  $quit = false, array  $opts = array()) : integer

Parameters

string|mixed $text
boolean $quit
array $opts

Returns

integer

writeRaw()

writeRaw(string|mixed  $text, boolean  $nl = true, boolean  $quit = false, array  $opts = array()) : integer

Parameters

string|mixed $text
boolean $nl
boolean $quit
array $opts

Returns

integer

colored()

colored(string  $text, string  $tag = 'info') : integer

Parameters

string $text
string $tag

Returns

integer

block()

block(array|mixed  $messages, string  $type = 'MESSAGE', string  $style = \Toolkit\Cli\Style::NORMAL, boolean  $quit = false) : integer

Parameters

array|mixed $messages
string $type
string $style
boolean $quit

Returns

integer

liteBlock()

liteBlock(array|mixed  $messages, string  $type = 'MESSAGE', string  $style = \Toolkit\Cli\Style::NORMAL, boolean  $quit = false) : integer

Parameters

array|mixed $messages
string $type
string $style
boolean $quit

Returns

integer

title()

title(string  $title, array  $opts = array()) 

Parameters

string $title
array $opts

section()

section(string  $title, string|array  $body, array  $opts = array()) 

Parameters

string $title
string|array $body

The section body message

array $opts

aList()

aList(array|mixed  $data, string  $title = 'Information', array  $opts = array()) 

Parameters

array|mixed $data
string $title
array $opts

multiList()

multiList(array  $data, array  $opts = array()) 

Parameters

array $data
array $opts

mList()

mList(array  $data, array  $opts = array()) 

Parameters

array $data
array $opts

helpPanel()

helpPanel(array  $config) 

Parameters

array $config

panel()

panel(array  $data, string  $title = 'Information panel', array  $opts = array()) 

Parameters

array $data
string $title
array $opts

table()

table(array  $data, string  $title = 'Data Table', array  $opts = array()) 

Parameters

array $data
string $title
array $opts

progressTxt()

progressTxt(integer  $total, string  $msg, string  $doneMsg = '') : \Generator

Parameters

integer $total
string $msg
string $doneMsg

Returns

\Generator

progressBar()

progressBar(  $total, array  $opts = array()) 

Parameters

$total
array $opts

__call()

__call(string  $method, array  $args = array()) : integer

Parameters

string $method
array $args

Throws

\LogicException

Returns

integer

json()

json(mixed  $data, boolean  $echo = true, integer  $flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) : integer|string

Parameters

mixed $data
boolean $echo
integer $flags

Returns

integer|string

dump()

dump(mixed  ...$vars) 

Parameters

mixed $vars variadic

prints()

prints(mixed  ...$vars) 

Parameters

mixed $vars variadic

__construct()

__construct(null|resource  $outputStream = null) 

Output constructor.

Parameters

null|resource $outputStream

resetOutputStream()

resetOutputStream() 

startBuffer()

startBuffer() 

start buffering

clearBuffer()

clearBuffer() 

clear buffering

stopBuffer()

stopBuffer(boolean  $flush = true, boolean  $nl = false, boolean  $quit = false, array  $opts = array()) 

stop buffering and flush buffer text

Parameters

boolean $flush
boolean $nl
boolean $quit
array $opts

flush()

flush(boolean  $nl = false, boolean  $quit = false, array  $opts = array()) 

stop buffering and flush buffer text

Parameters

boolean $nl
boolean $quit
array $opts

read()

read(string  $question = '', boolean  $nl = false) : string

Read input information

Parameters

string $question

若不为空,则先输出文本

boolean $nl

true 会添加换行符 false 原样输出,不添加换行符

Returns

string

stderr()

stderr(string  $text = '', boolean  $nl = true) : integer

Write a message to standard error output stream.

Parameters

string $text
boolean $nl

True (default) to append a new line at the end of the output string.

Returns

integer

getStyle()

getStyle() : \Toolkit\Cli\Style

Returns

\Toolkit\Cli\Style

supportColor()

supportColor() : boolean

Returns

boolean

getOutputStream()

getOutputStream() 

getOutStream

setOutputStream()

setOutputStream(  $outStream) : $this

setOutStream

Parameters

$outStream

Returns

$this

getErrorStream()

getErrorStream() 

Method to get property ErrorStream

setErrorStream()

setErrorStream(  $errorStream) : $this

Method to set property errorStream

Parameters

$errorStream

Returns

$this