/**
  * Get the appropriate repository cloner
  *
  * @return RepositoryCloner
  */
 protected function getCloner()
 {
     switch ($this->payload->getRepositoryType()) {
         default:
             $this->status(Phase::ERROR(), 0, 0, "Unknown repository type: " . $this->payload->getRepositoryType());
             return null;
         case RepositoryType::GIT():
             return new GitCloner();
         case RepositoryType::SVN():
             return new SvnCloner();
     }
 }
Beispiel #2
0
 /**
  * Connect to the host via all tunnel nodes
  *
  * @return Connection|null
  */
 protected function connect()
 {
     // Connect to target host
     $this->status(Phase::CONNECTION(), 0, 0, "Connecting to target host " . $this->host->getHostname() . ':' . $this->host->getPort());
     $con = new Connection($this->host->getHostname(), $this->host->getPort(), $this->host->getCredential());
     $con->setLogger($this->logger);
     if (!$con->connect()) {
         $this->status(Phase::ERROR(), 0, 0, "Failed to connect to target host");
         $con->disconnectChain();
         return null;
     }
     if (!$con->authenticate()) {
         $this->status(Phase::ERROR(), 0, 0, "Failed to authenticate on target host");
         $con->disconnectChain();
         return null;
     }
     return $con;
 }