Constants

NORMAL

NORMAL

Color indices

BLACK

BLACK

RED

RED

GREEN

GREEN

YELLOW

YELLOW

BLUE

BLUE

MAGENTA

MAGENTA

CYAN

CYAN

WHITE

WHITE

GRAY

GRAY

BOLD_RED

BOLD_RED

BOLD_GREEN

BOLD_GREEN

BOLD_YELLOW

BOLD_YELLOW

BOLD_BLUE

BOLD_BLUE

BOLD_MAGENTA

BOLD_MAGENTA

BOLD_CYAN

BOLD_CYAN

BOLD_WHITE

BOLD_WHITE

Properties

$width

$width : integer

Console character width

Type

integer

$indent

$indent : string

Console indentation

Type

string

$response

$response : string

Console response body

Type

string

$commands

$commands : array

Commands

Type

array

$colorMap

$colorMap : array

Color map of ansi values

Type

array

Methods

__construct()

__construct(integer  $width = 80, string  $indent = null) 

Instantiate a new console object

Parameters

integer $width
string $indent

setWidth()

setWidth(integer  $width) : \Pop\Console\Console

Set the wrap width of the console object

Parameters

integer $width

Returns

\Pop\Console\Console

setIndent()

setIndent(string  $indent = null) : \Pop\Console\Console

Set the indentation of the console object

Parameters

string $indent

Returns

\Pop\Console\Console

getWidth()

getWidth() : integer

Get the wrap width of the console object

Returns

integer

getIndent()

getIndent() : string

Get the indentation of the console object

Returns

string

addCommands()

addCommands(array  $commands) : \Pop\Console\Console

Add commands

Parameters

array $commands

Returns

\Pop\Console\Console

getCommands()

getCommands() : array

Get commands

Returns

array

getCommand()

getCommand(string  $command) : \Pop\Console\Command

Get a command

Parameters

string $command

Returns

\Pop\Console\Command

hasCommand()

hasCommand(string  $command) : boolean

Check if the console object has a command

Parameters

string $command

Returns

boolean

help()

help(string  $command) : string

Get a command help

Parameters

string $command

Returns

string

colorize()

colorize(string  $string, integer  $fg = null, integer  $bg = null) : string

Colorize a string for output

Parameters

string $string
integer $fg
integer $bg

Returns

string

prompt()

prompt(string  $prompt, array  $options = null, boolean  $caseSensitive = false, integer  $length = 500) : string

Get input from the prompt

Parameters

string $prompt
array $options
boolean $caseSensitive
integer $length

Returns

string

append()

append(string  $text = null, boolean  $newline = true) : \Pop\Console\Console

Append a string of text to the response body

Parameters

string $text
boolean $newline

Returns

\Pop\Console\Console

write()

write(string  $text = null, boolean  $newline = true) : \Pop\Console\Console

Write a string of text to the response body and send the response

Parameters

string $text
boolean $newline

Returns

\Pop\Console\Console

clear()

clear() : void

Clear the console

getColorCode()

getColorCode(integer  $color, string  $type = 'foreground') : mixed

Get the color code from the color map

Parameters

integer $color
string $type

Returns

mixed