PHP Класс Platformsh\Cli\Helper\GitHelper

Наследование: extends Symfony\Component\Console\Helper\Helper
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$repositoryDir string
$shellHelper Platformsh\Cli\Helper\ShellHelperInterface

Открытые методы

Метод Описание
__construct ( Platformsh\Cli\Helper\ShellHelperInterface $shellHelper = null ) Constructor.
branchExists ( string $branchName, string $dir = null, boolean $mustRun = false ) : boolean Check whether a branch exists.
checkOut ( string $name, string | null $dir = null, boolean $mustRun = false, boolean $quiet = false ) : boolean Check out a branch.
checkOutNew ( string $name, string | null $parent = null, string | null $upstream = null, string | null $dir = null, boolean $mustRun = false ) : boolean Create a new branch and check it out.
cloneRepo ( string $url, string $destination = null, array $args = [], boolean $mustRun = false ) : boolean Clone a repository.
ensureInstalled ( ) Ensure that the Git CLI is installed.
execute ( array $args, string | false $dir = null, boolean $mustRun = false, boolean $quiet = true ) : string | boolean Execute a Git command.
fetch ( string $remote, string | null $branch = null, string | null $dir = null, boolean $mustRun = false ) : boolean Fetch from the Git remote.
getConfig ( string $key, string | null $dir = null, boolean $mustRun = false ) : string | false Read a configuration item.
getCurrentBranch ( string $dir = null, boolean $mustRun = false ) : string | false Get the current branch name.
getMergedBranches ( string $ref = 'HEAD', boolean $remote = false, null $dir = null, boolean $mustRun = false ) : string[] Get a list of branches merged with a specific ref.
getName ( )
getRoot ( string | null $dir = null, boolean $mustRun = false ) : string | false Find the root of a directory in a Git repository.
getUpstream ( string $branch = null, string | null $dir = null, boolean $mustRun = false ) : string | false Get the upstream for a branch.
getVersion ( ) : string | false Get the installed version of the Git CLI.
init ( string $dir, boolean $mustRun = false ) : boolean Create a Git repository in a directory.
remoteBranchExists ( string $remote, string $branchName, null $dir = null, boolean $mustRun = false ) : boolean Check whether a branch exists on a remote.
remoteRepoExists ( string $url ) : boolean Check whether a remote repository exists.
setDefaultRepositoryDir ( string $dir ) Set the repository directory.
setOutput ( Symfony\Component\Console\Output\OutputInterface $output )
setUpstream ( string | false $upstream, string | null $dir = null, boolean $mustRun = false ) : boolean Set the upstream for the current branch.
supportsShallowClone ( ) : boolean
updateSubmodules ( boolean $recursive = false, string | null $dir = null, boolean $mustRun = false ) : boolean Update and/or initialize submodules.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( Platformsh\Cli\Helper\ShellHelperInterface $shellHelper = null )
$shellHelper Platformsh\Cli\Helper\ShellHelperInterface

branchExists() публичный Метод

Check whether a branch exists.
public branchExists ( string $branchName, string $dir = null, boolean $mustRun = false ) : boolean
$branchName string The branch name.
$dir string The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
Результат boolean

checkOut() публичный Метод

Check out a branch.
public checkOut ( string $name, string | null $dir = null, boolean $mustRun = false, boolean $quiet = false ) : boolean
$name string
$dir string | null The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
$quiet boolean
Результат boolean

checkOutNew() публичный Метод

Create a new branch and check it out.
public checkOutNew ( string $name, string | null $parent = null, string | null $upstream = null, string | null $dir = null, boolean $mustRun = false ) : boolean
$name string
$parent string | null
$upstream string | null
$dir string | null The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
Результат boolean

cloneRepo() публичный Метод

A ProcessFailedException will be thrown if the command fails.
public cloneRepo ( string $url, string $destination = null, array $args = [], boolean $mustRun = false ) : boolean
$url string The Git repository URL.
$destination string A directory name to clone into.
$args array Extra arguments for the Git command.
$mustRun boolean Enable exceptions if the Git command fails.
Результат boolean

ensureInstalled() публичный Метод

Ensure that the Git CLI is installed.
public ensureInstalled ( )

execute() публичный Метод

Execute a Git command.
public execute ( array $args, string | false $dir = null, boolean $mustRun = false, boolean $quiet = true ) : string | boolean
$args array Command arguments (everything after 'git').
$dir string | false The path to a Git repository. Set to false if the command should not run inside a repository.
$mustRun boolean Enable exceptions if the Git command fails.
$quiet boolean Suppress command output.
Результат string | boolean The command output, true if there is no output, or false if the command fails.

fetch() публичный Метод

Fetch from the Git remote.
public fetch ( string $remote, string | null $branch = null, string | null $dir = null, boolean $mustRun = false ) : boolean
$remote string
$branch string | null
$dir string | null
$mustRun boolean
Результат boolean

getConfig() публичный Метод

Read a configuration item.
public getConfig ( string $key, string | null $dir = null, boolean $mustRun = false ) : string | false
$key string A Git configuration key.
$dir string | null The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
Результат string | false

getCurrentBranch() публичный Метод

Get the current branch name.
public getCurrentBranch ( string $dir = null, boolean $mustRun = false ) : string | false
$dir string The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
Результат string | false

getMergedBranches() публичный Метод

Get a list of branches merged with a specific ref.
public getMergedBranches ( string $ref = 'HEAD', boolean $remote = false, null $dir = null, boolean $mustRun = false ) : string[]
$ref string
$remote boolean
$dir null
$mustRun boolean
Результат string[]

getName() публичный Метод

public getName ( )

getRoot() публичный Метод

Find the root of a directory in a Git repository.
public getRoot ( string | null $dir = null, boolean $mustRun = false ) : string | false
$dir string | null
$mustRun boolean
Результат string | false

getUpstream() публичный Метод

Get the upstream for a branch.
public getUpstream ( string $branch = null, string | null $dir = null, boolean $mustRun = false ) : string | false
$branch string The name of the branch to get the upstream for. Defaults to the current branch.
$dir string | null The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
Результат string | false The upstream, in the form remote/branch, or false if no upstream is found.

getVersion() публичный Метод

Get the installed version of the Git CLI.
public getVersion ( ) : string | false
Результат string | false The version number, or false on failure.

init() публичный Метод

Create a Git repository in a directory.
public init ( string $dir, boolean $mustRun = false ) : boolean
$dir string
$mustRun boolean Enable exceptions if the Git command fails.
Результат boolean

remoteBranchExists() публичный Метод

Check whether a branch exists on a remote.
public remoteBranchExists ( string $remote, string $branchName, null $dir = null, boolean $mustRun = false ) : boolean
$remote string
$branchName string
$dir null
$mustRun boolean
Результат boolean

remoteRepoExists() публичный Метод

Check whether a remote repository exists.
public remoteRepoExists ( string $url ) : boolean
$url string
Результат boolean

setDefaultRepositoryDir() публичный Метод

The default is the current working directory.
public setDefaultRepositoryDir ( string $dir )
$dir string The path to a Git repository.

setOutput() публичный Метод

public setOutput ( Symfony\Component\Console\Output\OutputInterface $output )
$output Symfony\Component\Console\Output\OutputInterface

setUpstream() публичный Метод

Set the upstream for the current branch.
public setUpstream ( string | false $upstream, string | null $dir = null, boolean $mustRun = false ) : boolean
$upstream string | false The upstream name, or false to unset the upstream.
$dir string | null The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
Результат boolean

supportsShallowClone() публичный Метод

public supportsShallowClone ( ) : boolean
Результат boolean

updateSubmodules() публичный Метод

Update and/or initialize submodules.
public updateSubmodules ( boolean $recursive = false, string | null $dir = null, boolean $mustRun = false ) : boolean
$recursive boolean Whether to recurse into nested submodules.
$dir string | null The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
Результат boolean

Описание свойств

$repositoryDir защищенное свойство

protected string $repositoryDir
Результат string

$shellHelper защищенное свойство

protected ShellHelperInterface,Platformsh\Cli\Helper $shellHelper
Результат Platformsh\Cli\Helper\ShellHelperInterface