PHP Class View_Console, atk4

There are several usage patters with the console. The simplest is to excetue a process and have it's output streamed into the console in real-time. You can manually specify a call-back method which will be executed and you can send regular and error output to the console with simple methods out() ond err(). Finally - you can supply several streams which cosole will read from and output to the browser until streams are closed.
Inheritance: extends View
Show file Open project: atk4/atk4

Public Properties

Property Type Description
$callback callable
$color array
$prefix array
$process System_ProcessIO
$streams array

Public Methods

Method Description
__destruct ( )
_out ( $str )
addStream ( $stream, $prefix = null, $color = null )
afterAdd ( $me, $o )
defaultTemplate ( )
err ( $str ) Displays error on the console (in red).
getProcessIO ( )
jsEval ( $str ) Add ability to send javascript.
out ( $str, $opt = [] ) Displays output in the console.
render ( )
set ( callable $callback ) Evaluates piece of code.
sseMessageJSON ( $text, $id = null ) Sends text or structured data through SSE channel encoded in JSON format. You may supply id argument.
sseMessageLine ( $text, $id = null ) Sends text through SSE channel. Text may contain newlines which will be transmitted proprely. Optionally you can specify ID also.

Method Details

__destruct() public method

public __destruct ( )

_out() public method

public _out ( $str )

addStream() public method

public addStream ( $stream, $prefix = null, $color = null )

afterAdd() public method

public afterAdd ( $me, $o )

defaultTemplate() public method

public defaultTemplate ( )

err() public method

Displays error on the console (in red).
public err ( $str )

getProcessIO() public method

public getProcessIO ( )

jsEval() public method

Add ability to send javascript.
public jsEval ( $str )

out() public method

Displays output in the console.
public out ( $str, $opt = [] )

render() public method

public render ( )

set() public method

Evaluates piece of code.
public set ( callable $callback )
$callback callable function($console)

sseMessageJSON() public method

Sends text or structured data through SSE channel encoded in JSON format. You may supply id argument.
public sseMessageJSON ( $text, $id = null )

sseMessageLine() public method

Sends text through SSE channel. Text may contain newlines which will be transmitted proprely. Optionally you can specify ID also.
public sseMessageLine ( $text, $id = null )

Property Details

$callback public property

public callable $callback
return callable

$color public property

public array $color
return array

$prefix public property

public array $prefix
return array

$process public property

public System_ProcessIO $process
return System_ProcessIO

$streams public property

public array $streams
return array