public function connect() { $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_CONNECT, new TransporterEvent($this)); $port = $this->port ?: 22; $success = $this->sftp->connect($this->host, $port); if (false === $success) { throw new \RuntimeException(sprintf('Could not connect to host %s on port %s', $this->host, $port)); } }