for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Packedge\Workbench\Tools;
use Symfony\Component\Process\ExecutableFinder;
class Git
{
/**
* @var string
*/
protected $repositoryPath;
* @var ExecutableFinder
private $executableFinder;
* @param string $repositoryPath
* @param ExecutableFinder $executableFinder
public function __construct($repositoryPath, ExecutableFinder $executableFinder)
$this->repositoryPath = realpath($repositoryPath);
$this->executableFinder = $executableFinder ?: new ExecutableFinder;
}
public function hasGit()
$result = $this->executableFinder->find('git');
var_dump($result);
public function init()
$this->execute('git init');
public function add(array $files)
$files
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
// TODO: logic
public function addAll()
public function commit($message)
$message
public function setRemote($url)
$url
public function push()
* @param string $command
* @throws RuntimeException
protected function execute($command)
$cwd = getcwd();
chdir($this->repositoryPath);
exec($command, $output, $returnValue);
chdir($cwd);
if ($returnValue !== 0) {
throw new RuntimeException($output);
return $output;