Example #1
0
File: Git.php Project: sagephp/vcs
 /**
  * Clones a git repository.
  *
  * @param  string $uri    the git url
  * @param  string $folder the folder to clone to, if not set defaults to repository name
  * @param  string $branch the branch to checkout, defaults to "main" branch (as set in repository config)
  *
  * @return boolean true on success
  */
 public function cloneRepository($uri, $folder = null, $branch = null)
 {
     $command = new Command();
     $command->binary('git')->argument('clone')->argument($uri);
     if (null !== $folder) {
         $command->argument($folder);
     }
     if (null !== $branch) {
         $command->option('branch', $branch);
     }
     return 0 === $this->execute($command);
 }
Example #2
0
 public function testArgument()
 {
     $command = new Command();
     $command->argument('foo');
     $this->assertEquals('foo', (string) $command);
 }