PHP Class TQ\Vcs\Cli\Binary

显示文件 Open project: teqneers/php-stream-wrapper-for-git Class Usage Examples

Protected Properties

Property Type Description
$path string The file system path to a VCS binary

Public Methods

Method Description
__call ( string $method, array $arguments ) : CallResult Method overloading - allows calling VCS commands directly as class methods
__construct ( string $path ) Creates a VCS binary interface
createCall ( string $path, string $command, array $arguments ) : Call Create a call to the VCS binary for later execution
ensure ( Binary | string | null $binary ) : static Ensures that the given arguments is a valid VCS binary

Protected Methods

Method Description
createCallCommand ( string $binary, string $command, array $args, array $files ) : string Creates the command string to be executed
doCreateCall ( string $cmd, string $path ) : Call The call factory
extractCallParametersFromMagicCall ( string $method, array $arguments ) : array Extracts the CLI call parameters from the arguments to a magic method call
isWindows ( ) : boolean Checks if the current system is Windows
sanitizeCommandArgument ( string $key, string $value ) : string Sanitizes a command line argument
sanitizeCommandArguments ( array $arguments ) : array Sanitizes a list of command line arguments and splits them into args and files

Method Details

__call() public method

Method overloading - allows calling VCS commands directly as class methods
public __call ( string $method, array $arguments ) : CallResult
$method string The VCS command, e.g. show, commit or add
$arguments array The command arguments with the path to the VCS repository being the first argument
return CallResult

__construct() public method

Creates a VCS binary interface
public __construct ( string $path )
$path string The path to the VCS binary

createCall() public method

Create a call to the VCS binary for later execution
public createCall ( string $path, string $command, array $arguments ) : Call
$path string The full path to the VCS repository
$command string The VCS command, e.g. show, commit or add
$arguments array The command arguments
return Call

createCallCommand() protected method

Creates the command string to be executed
protected createCallCommand ( string $binary, string $command, array $args, array $files ) : string
$binary string The path to the binary
$command string The VCS command
$args array The list of command line arguments (sanitized)
$files array The list of files to be added to the command line call
return string The command string to be executed

doCreateCall() protected method

The call factory
protected doCreateCall ( string $cmd, string $path ) : Call
$cmd string The command string to be executed
$path string The working directory
return Call

ensure() public static method

Ensures that the given arguments is a valid VCS binary
public static ensure ( Binary | string | null $binary ) : static
$binary Binary | string | null The VCS binary
return static

extractCallParametersFromMagicCall() protected method

Extracts the CLI call parameters from the arguments to a magic method call
protected extractCallParametersFromMagicCall ( string $method, array $arguments ) : array
$method string The VCS command, e.g. show, commit or add
$arguments array The command arguments with the path to the VCS repository being the first argument
return array An array with (path, method, args, stdIn)

isWindows() protected static method

Checks if the current system is Windows
protected static isWindows ( ) : boolean
return boolean True if we're on a Windows machine

sanitizeCommandArgument() protected method

Sanitizes a command line argument
protected sanitizeCommandArgument ( string $key, string $value ) : string
$key string The argument key
$value string The argument value (can be empty)
return string

sanitizeCommandArguments() protected method

Sanitizes a list of command line arguments and splits them into args and files
protected sanitizeCommandArguments ( array $arguments ) : array
$arguments array The list of arguments
return array An array with (args, files)

Property Details

$path protected_oe property

The file system path to a VCS binary
protected string $path
return string