Command deprecated
class Command
deprecated
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. | |
| Command | add(string|Command $bit) Appends a string or a Command instance. | |
| Command | top(string|Command $bit) Prepends a string or a command instance. | |
| Command | arg(string $arg) Appends an argument, will be quoted. | |
| Command | cmd(string $esc) Appends escaped special command chars. | |
| Command | ins(string $label) Inserts a labeled command to feed later. | |
| Command | get(string $label) Retrieves a previously labeled command. | |
| Command | end() Returns parent command (if any). | |
| int | length() Counts bits stored in command. | |
| Command | setErrorHandler(Closure $errorHandler) | |
| Closure|null | getErrorHandler() | |
| array | execute() Executes current command. | |
| string | join() Joins bits. | |
| 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). |
Details
__construct(Command $parent = null)
Constructor.
Parameters
| Command | $parent | Parent command |
string __toString()
Returns command as string.
Return Value
| string |
static Command create(Command $parent = null)
Creates a new Command instance.
Parameters
| Command | $parent | Parent command |
Return Value
| Command | New Command instance |
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 |
Command add(string|Command $bit)
Appends a string or a Command instance.
Parameters
| string|Command | $bit |
Return Value
| Command | The current Command instance |
Command top(string|Command $bit)
Prepends a string or a command instance.
Parameters
| string|Command | $bit |
Return Value
| Command | The current Command instance |
Command arg(string $arg)
Appends an argument, will be quoted.
Parameters
| string | $arg |
Return Value
| Command | The current Command instance |
Command cmd(string $esc)
Appends escaped special command chars.
Parameters
| string | $esc |
Return Value
| Command | The current Command instance |
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 |
Command get(string $label)
Retrieves a previously labeled command.
Parameters
| string | $label |
Return Value
| Command | The labeled command |
Exceptions
| RuntimeException |
Command end()
Returns parent command (if any).
Return Value
| Command | Parent command |
Exceptions
| RuntimeException | If command has no parent |
int length()
Counts bits stored in command.
Return Value
| int | The bits count |
Command setErrorHandler(Closure $errorHandler)
Parameters
| Closure | $errorHandler |
Return Value
| Command |
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 |
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 |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.2/Symfony/Component/Finder/Shell/Command.html