|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|