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 string $url
* @param IOInterface $io * @param IOInterface $io
* @param ProcessExecutor $process * @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); preg_match('#^(?:https?|git)://github\.com/([^/]+)/(.+?)(?:\.git)?$#', $url, $match);
$this->owner = $match[1]; $this->owner = $match[1];
$this->repository = $match[2]; $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->generateSshUrl(),
$this->io, $this->io,
$this->process, $this->process,
$this->remoteFilesystemGenerator $this->remoteFilesystemFactory
); );
$this->gitDriver->initialize(); $this->gitDriver->initialize();
return; return;

View File

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