1
0
Fork 0

Use factory name instead of generator.

pull/424/head
Beau Simensen 2012-03-10 10:26:03 -08:00
parent 340ac49d87
commit 1e9cb6bac8
2 changed files with 9 additions and 9 deletions

View File

@ -33,15 +33,15 @@ class GitHubDriver extends VcsDriver
* @param string $url
* @param IOInterface $io
* @param ProcessExecutor $process
* @param callable $remoteFilesystemGenerator
* @param callable $remoteFilesystemFactory
*/
public function __construct($url, IOInterface $io, ProcessExecutor $process = null, $remoteFilesystemGenerator = null)
public function __construct($url, IOInterface $io, ProcessExecutor $process = null, $remoteFilesystemFactory = null)
{
preg_match('#^(?:https?|git)://github\.com/([^/]+)/(.+?)(?:\.git)?$#', $url, $match);
$this->owner = $match[1];
$this->repository = $match[2];
parent::__construct($url, $io, $process, $remoteFilesystemGenerator);
parent::__construct($url, $io, $process, $remoteFilesystemFactory);
}
/**
@ -216,7 +216,7 @@ class GitHubDriver extends VcsDriver
$this->generateSshUrl(),
$this->io,
$this->process,
$this->remoteFilesystemGenerator
$this->remoteFilesystemFactory
);
$this->gitDriver->initialize();
return;

View File

@ -27,7 +27,7 @@ abstract class VcsDriver implements VcsDriverInterface
protected $url;
protected $io;
protected $process;
protected $remoteFilesystemGenerator;
protected $remoteFilesystemFactory;
/**
* Constructor.
@ -35,14 +35,14 @@ abstract class VcsDriver implements VcsDriverInterface
* @param string $url The URL
* @param IOInterface $io The IO instance
* @param ProcessExecutor $process Process instance, injectable for mocking
* @param callable $remoteFilesystemGenerator Generates Remote Filesystem, injectable for mocking
* @param callable $remoteFilesystemFactory Remote Filesystem factory, injectable for mocking
*/
public function __construct($url, IOInterface $io, ProcessExecutor $process = null, $remoteFilesystemGenerator = null)
public function __construct($url, IOInterface $io, ProcessExecutor $process = null, $remoteFilesystemFactory = null)
{
$this->url = $url;
$this->io = $io;
$this->process = $process ?: new ProcessExecutor;
$this->remoteFilesystemGenerator = $remoteFilesystemGenerator ?: function() use ($io) {
$this->remoteFilesystemFactory = $remoteFilesystemFactory ?: function() use ($io) {
return new RemoteFilesystem($io);
};
}
@ -85,7 +85,7 @@ abstract class VcsDriver implements VcsDriverInterface
*/
protected function getContents($url)
{
$rfs = call_user_func($this->remoteFilesystemGenerator);
$rfs = call_user_func($this->remoteFilesystemFactory);
return $rfs->getContents($this->url, $url, false);
}