class Command

deprecated since 2.8, to be removed in 3.0.

Methods

__construct(Command $parent = null)

No description

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.

$this
add(string|Command $bit)

Appends a string or a Command instance.

$this
top(string|Command $bit)

Prepends a string or a command instance.

$this
arg(string $arg)

Appends an argument, will be quoted.

$this
cmd(string $esc)

Appends escaped special command chars.

Command|string
ins(string $label)

Inserts a labeled command to feed later.

Command|string
get(string $label)

Retrieves a previously labeled command.

end()

Returns parent command (if any).

int
length()

Counts bits stored in command.

$this
setErrorHandler(Closure $errorHandler)

No description

Closure|null
getErrorHandler()

No description

array
execute()

Executes current command.

string
join()

Joins bits.

$this
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 32
__construct(Command $parent = null)

Parameters

Command $parent

at line 42
string __toString()

Returns command as string.

Return Value

string

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

Creates a new Command instance.

Parameters

Command $parent

Return Value

Command

at line 64
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 76
static string quote(string $input)

Quotes input.

Parameters

string $input An argument string

Return Value

string The quoted string

at line 88
$this add(string|Command $bit)

Appends a string or a Command instance.

Parameters

string|Command $bit

Return Value

$this

at line 102
$this top(string|Command $bit)

Prepends a string or a command instance.

Parameters

string|Command $bit

Return Value

$this

at line 120
$this arg(string $arg)

Appends an argument, will be quoted.

Parameters

string $arg

Return Value

$this

at line 134
$this cmd(string $esc)

Appends escaped special command chars.

Parameters

string $esc

Return Value

$this

at line 150
Command|string ins(string $label)

Inserts a labeled command to feed later.

Parameters

string $label The unique label

Return Value

Command|string

Exceptions

RuntimeException If label already exists

at line 171
Command|string get(string $label)

Retrieves a previously labeled command.

Parameters

string $label

Return Value

Command|string

Exceptions

RuntimeException

at line 187
Command end()

Returns parent command (if any).

Return Value

Command

Exceptions

RuntimeException If command has no parent

at line 201
int length()

Counts bits stored in command.

Return Value

int The bits count

at line 209
$this setErrorHandler(Closure $errorHandler)

Parameters

Closure $errorHandler

Return Value

$this

at line 219
Closure|null getErrorHandler()

Return Value

Closure|null

at line 231
array execute()

Executes current command.

Return Value

array The command result

Exceptions

RuntimeException

at line 254
string join()

Joins bits.

Return Value

string

at line 272
$this 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

$this