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

$commands

$commands : array

Command objects

Type

array

$options

$options : array

Option objects

Type

array

$colorMap

$colorMap : array

Color map of ansi values

Type

array

Methods

__construct()

__construct(integer  $width = 80, string  $indent = null) : \Pop\Console\Console

Instantiate a new console object

Parameters

integer $width
string $indent

Returns

\Pop\Console\Console

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

addOptions()

addOptions(array  $options) : \Pop\Console\Console

Add options

Parameters

array $options

Returns

\Pop\Console\Console

getArguments()

getArguments() : array

Get arguments

Returns

array

hasArgument()

hasArgument(string  $arg) : boolean

Determine if an argument exists

Parameters

string $arg

Returns

boolean

get()

get(string  $name) : mixed

Get a command or option value

Parameters

string $name

Returns

mixed

hasCommand()

hasCommand(string  $command) : boolean

Determine if a command object exists

Parameters

string $command

Returns

boolean

getCommand()

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

Get a command object

Parameters

string $command

Returns

\Pop\Console\Input\Command

getCommands()

getCommands() : array

Get commands

Returns

array

hasOption()

hasOption(string  $option) : boolean

Determine if an option object exists

Parameters

string $option

Returns

boolean

getOption()

getOption(string  $option) : \Pop\Console\Input\Option

Get an option object

Parameters

string $option

Returns

\Pop\Console\Input\Option

getOptions()

getOptions() : array

Get options

Returns

array

getRequiredParamsNotFound()

getRequiredParamsNotFound() : array

Get required parameters that were not found

Returns

array

isRequestValid()

isRequestValid() : boolean

Determine if the request is valid

Returns

boolean

parseRequest()

parseRequest() : void

Parse options

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

__get()

__get(string  $name) : mixed

Magic get method to return the a parameter value

Parameters

string $name

Returns

mixed

__isset()

__isset(string  $name) : boolean

Return the isset value of a parameter value

Parameters

string $name

Returns

boolean

offsetExists()

offsetExists(mixed  $offset) : boolean

ArrayAccess offsetExists

Parameters

mixed $offset

Returns

boolean

offsetGet()

offsetGet(mixed  $offset) : mixed

ArrayAccess offsetGet

Parameters

mixed $offset

Returns

mixed

offsetSet()

offsetSet(mixed  $offset, mixed  $value) : void

ArrayAccess offsetSet

Parameters

mixed $offset
mixed $value

Throws

\Pop\Console\Exception

offsetUnset()

offsetUnset(mixed  $offset) : void

ArrayAccess offsetUnset

Parameters

mixed $offset

Throws

\Pop\Console\Exception

getColorCode()

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

Get the color code from the color map

Parameters

integer $color
string $type

Returns

mixed