Command

class Command

Methods

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

Command end()

Returns parent command (if any).

int length()

Counts bits stored in command.

$this setErrorHandler(Closure $errorHandler)
Closure|null getErrorHandler()
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

__construct(Command $parent = null)

Parameters

Command $parent

string __toString()

Returns command as string.

Return Value

string

static Command create(Command $parent = null)

Creates a new Command instance.

Parameters

Command $parent

Return Value

Command

static string escape(string $input)

Escapes special chars from input.

Parameters

string $input A string to escape

Return Value

string The escaped string

static string quote(string $input)

Quotes input.

Parameters

string $input An argument string

Return Value

string The quoted string

$this add(string|Command $bit)

Appends a string or a Command instance.

Parameters

string|Command $bit

Return Value

$this

$this top(string|Command $bit)

Prepends a string or a command instance.

Parameters

string|Command $bit

Return Value

$this

$this arg(string $arg)

Appends an argument, will be quoted.

Parameters

string $arg

Return Value

$this

$this cmd(string $esc)

Appends escaped special command chars.

Parameters

string $esc

Return Value

$this

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

Command|string get(string $label)

Retrieves a previously labeled command.

Parameters

string $label

Return Value

Command|string

Exceptions

RuntimeException

Command end()

Returns parent command (if any).

Return Value

Command

Exceptions

RuntimeException If command has no parent

int length()

Counts bits stored in command.

Return Value

int The bits count

$this setErrorHandler(Closure $errorHandler)

Parameters

Closure $errorHandler

Return Value

$this

Closure|null getErrorHandler()

Return Value

Closure|null

array execute()

Executes current command.

Return Value

array The command result

Exceptions

RuntimeException

string join()

Joins bits.

Return Value

string

$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

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.7/Symfony/Component/Finder/Shell/Command.html