Expose the Driver of the VcsRepository
parent
4c7162c94e
commit
9f55335011
|
@ -37,20 +37,32 @@ class VcsRepository extends ArrayRepository
|
||||||
$this->debug = $debug;
|
$this->debug = $debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDriver()
|
||||||
|
{
|
||||||
|
foreach ($this->drivers as $driver) {
|
||||||
|
if ($driver::supports($this->url)) {
|
||||||
|
$driver = new $driver($this->url);
|
||||||
|
$driver->initialize();
|
||||||
|
return $driver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->drivers as $driver) {
|
||||||
|
if ($driver::supports($this->url, true)) {
|
||||||
|
$driver = new $driver($this->url);
|
||||||
|
$driver->initialize();
|
||||||
|
return $driver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function initialize()
|
protected function initialize()
|
||||||
{
|
{
|
||||||
parent::initialize();
|
parent::initialize();
|
||||||
|
|
||||||
$debug = $this->debug;
|
$debug = $this->debug;
|
||||||
|
|
||||||
foreach ($this->drivers as $driver) {
|
$driver = $this->getDriver();
|
||||||
if ($driver::supports($this->url)) {
|
|
||||||
$driver = new $driver($this->url);
|
|
||||||
$driver->initialize();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$driver) {
|
if (!$driver) {
|
||||||
throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
|
throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue