0 follower

Final Class Yiisoft\YiiDevTool\App\Component\Git\GitWorkingCopy

InheritanceYiisoft\YiiDevTool\App\Component\Git\GitWorkingCopy

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $gitBinary, string $directory )
$gitBinary string
$directory string

                public function __construct(
    private string $gitBinary,
    private string $directory,
) {
}

            
branch() public method

public string branch ( mixed $argsOrOptions )
$argsOrOptions mixed

                public function branch(mixed ...$argsOrOptions): string
{
    return $this->run('branch', $argsOrOptions);
}

            
checkout() public method

public string checkout ( mixed $argsOrOptions )
$argsOrOptions mixed

                public function checkout(mixed ...$argsOrOptions): string
{
    return $this->run('checkout', $argsOrOptions);
}

            
checkoutNewBranch() public method

public string checkoutNewBranch ( string $branch )
$branch string

                public function checkoutNewBranch(string $branch): string
{
    return $this->checkout(['b' => true], $branch);
}

            
clean() public method

public string clean ( string $argsOrOptions )
$argsOrOptions string

                public function clean(string ...$argsOrOptions): string
{
    return $this->run('clean', $argsOrOptions);
}

            
commit() public method

public string commit ( mixed $argsOrOptions )
$argsOrOptions mixed

                public function commit(mixed ...$argsOrOptions): string
{
    if (isset($argsOrOptions[0]) && is_string($argsOrOptions[0]) && !isset($argsOrOptions[1])) {
        $argsOrOptions[0] = [
            'a' => true,
            'm' => $argsOrOptions[0],
        ];
    }
    return $this->run('commit', $argsOrOptions);
}

            
getBranches() public method

public Yiisoft\YiiDevTool\App\Component\Git\GitBranches getBranches ( )

                public function getBranches(): GitBranches
{
    return new GitBranches($this);
}

            
getRemoteUrl() public method

public string getRemoteUrl ( string $remote, string $operation 'fetch' )
$remote string
$operation string

                public function getRemoteUrl(string $remote, string $operation = 'fetch'): string
{
    $arguments = ['get-url'];
    if ($operation === 'push') {
        $arguments[] = '--push';
    }
    $arguments[] = $remote;
    return trim($this->run('remote', $arguments));
}

            
getStatus() public method

public string getStatus ( )

                public function getStatus(): string
{
    return $this->run('status', ['-s']);
}

            
hasChanges() public method

public boolean hasChanges ( )

                public function hasChanges(): bool
{
    return $this->getStatus() !== '';
}

            
pull() public method

public string pull ( mixed $argsOrOptions )
$argsOrOptions mixed

                public function pull(mixed ...$argsOrOptions): string
{
    return $this->run('pull', $argsOrOptions);
}

            
push() public method

public string push ( mixed $argsOrOptions )
$argsOrOptions mixed

                public function push(mixed ...$argsOrOptions): string
{
    return $this->run('push', $argsOrOptions);
}

            
pushTag() public method

public string pushTag ( string $tag, string $repository 'origin' )
$tag string
$repository string

                public function pushTag(string $tag, string $repository = 'origin'): string
{
    return $this->push($repository, 'tag', $tag);
}

            
reset() public method

public string reset ( mixed $argsOrOptions )
$argsOrOptions mixed

                public function reset(mixed ...$argsOrOptions): string
{
    return $this->run('reset', $argsOrOptions);
}

            
run() public method

public string run ( string $command, array $argsOrOptions = [] )
$command string
$argsOrOptions array

                public function run(string $command, array $argsOrOptions = []): string
{
    return $this->runCommand($command, $argsOrOptions);
}

            
runWithOutput() public method

public string runWithOutput ( string $command, array $argsOrOptions, callable $callback )
$command string
$argsOrOptions array
$callback callable

                public function runWithOutput(string $command, array $argsOrOptions, callable $callback): string
{
    return $this->runCommand($command, $argsOrOptions, $callback);
}

            
tag() public method

public string tag ( mixed $argsOrOptions )
$argsOrOptions mixed

                public function tag(mixed ...$argsOrOptions): string
{
    return $this->run('tag', $argsOrOptions);
}

            
tags() public method

public Yiisoft\YiiDevTool\App\Component\Git\GitTags tags ( )

                public function tags(): GitTags
{
    return new GitTags($this);
}