PHP 클래스 Platformsh\Cli\Helper\GitHelper

상속: extends Symfony\Component\Console\Helper\Helper
파일 보기 프로젝트 열기: commerceguys/platform-cli 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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