Library
Class

Library\Command

class Command

Largely inspired from http://github.com/kbjr/Git.php

Methods

addCache($command, $result, $error, $status, $cwd = null, $env = null, $options = null)

isCached($command, $cwd = null)

getCached($command, $cwd = null)

getCache()

array run(string $command, string $path = null, bool $force = false)

Run a command on a Linux/UNIX system reading it from cache if so

array runCommand(string $command, string $path = null)

Run a command on a Linux/UNIX system

static string getCommandPath(string $cmd)

Get the system path of a command

Details

at line 40
public addCache($command, $result, $error, $status, $cwd = null, $env = null, $options = null)

Parameters

$command
$result
$error
$status
$cwd
$env
$options

at line 53
public isCached($command, $cwd = null)

Parameters

$command
$cwd

at line 67
public getCached($command, $cwd = null)

Parameters

$command
$cwd

at line 73
public getCache()

at line 90
public array run(string $command, string $path = null, bool $force = false)

Run a command on a Linux/UNIX system reading it from cache if so

Parameters

string $command The command to run
string $path The path to go to
bool $force Force the command to really run (avoid caching)

Return Value

array An array like ( stdout , status , stderr )

at line 108
public array runCommand(string $command, string $path = null)

Run a command on a Linux/UNIX system

Accepts a shell command to run

Parameters

string $command The command to run
string $path The path to go to

Return Value

array An array like ( stdout , status , stderr )

at line 136
static public string getCommandPath(string $cmd)

Get the system path of a command

Parameters

string $cmd The command name to retrieve

Return Value

string The realpath of the command in the system

Exceptions

CommandNotFoundException if the command doesn't exist