class Command

deprecated since 2.8, to be removed in 3.0.

Methods

__construct(Command $parent = null)

Constructor.

string
__toString()

Returns command as string.

static Command
create(Command $parent = null)

Creates a new Command instance.

static string
escape(string $input)

Escapes special chars from input.

static string
quote(string $input)

Quotes input.

add(string|Command $bit)

Appends a string or a Command instance.

top(string|Command $bit)

Prepends a string or a command instance.

arg(string $arg)

Appends an argument, will be quoted.

cmd(string $esc)

Appends escaped special command chars.

ins(string $label)

Inserts a labeled command to feed later.

get(string $label)

Retrieves a previously labeled command.

end()

Returns parent command (if any).

int
length()

Counts bits stored in command.

setErrorHandler(Closure $errorHandler)

No description

Closure|null
getErrorHandler()

No description

array
execute()

Executes current command.

string
join()

Joins bits.

addAtIndex(string|Command $bit, int $index)

Insert a string or a Command instance before the bit at given position $index (index starts from 0).

Details

at line line 48
__construct(Command $parent = null)

Constructor.

Parameters

Command $parent Parent command

at line line 58
string __toString()

Returns command as string.

Return Value

string

at line line 70
static Command create(Command $parent = null)

Creates a new Command instance.

Parameters

Command $parent Parent command

Return Value

Command New Command instance

at line line 82
static string escape(string $input)

Escapes special chars from input.

Parameters

string $input A string to escape

Return Value

string The escaped string

at line line 94
static string quote(string $input)

Quotes input.

Parameters

string $input An argument string

Return Value

string The quoted string

at line line 106
Command add(string|Command $bit)

Appends a string or a Command instance.

Parameters

string|Command $bit

Return Value

Command The current Command instance

at line line 120
Command top(string|Command $bit)

Prepends a string or a command instance.

Parameters

string|Command $bit

Return Value

Command The current Command instance

at line line 138
Command arg(string $arg)

Appends an argument, will be quoted.

Parameters

string $arg

Return Value

Command The current Command instance

at line line 152
Command cmd(string $esc)

Appends escaped special command chars.

Parameters

string $esc

Return Value

Command The current Command instance

at line line 168
Command ins(string $label)

Inserts a labeled command to feed later.

Parameters

string $label The unique label

Return Value

Command The current Command instance

Exceptions

RuntimeException If label already exists

at line line 189
Command get(string $label)

Retrieves a previously labeled command.

Parameters

string $label

Return Value

Command The labeled command

Exceptions

RuntimeException

at line line 205
Command end()

Returns parent command (if any).

Return Value

Command Parent command

Exceptions

RuntimeException If command has no parent

at line line 219
int length()

Counts bits stored in command.

Return Value

int The bits count

at line line 229
Command setErrorHandler(Closure $errorHandler)

Parameters

Closure $errorHandler

Return Value

Command

at line line 239
Closure|null getErrorHandler()

Return Value

Closure|null

at line line 251
array execute()

Executes current command.

Return Value

array The command result

Exceptions

RuntimeException

at line line 274
string join()

Joins bits.

Return Value

string

at line line 292
Command addAtIndex(string|Command $bit, int $index)

Insert a string or a Command instance before the bit at given position $index (index starts from 0).

Parameters

string|Command $bit
int $index

Return Value

Command The current Command instance