/** * @inheritdoc */ public function getFile() { if ($this->file === null) { try { $this->file = $this->transport->getFile(); } catch (\RuntimeException $e) { throw new TransportException(sprintf('Could not open file "%s": %s', $this->transport->getDestination(), $e->getMessage()), null, $e); } } return $this->file; }
/** * @param TransportInterface $transport * * @throws \LogicException * * @return array */ public static function createConfigFromTransport(TransportInterface $transport) { if ($transport instanceof FileTransport) { return static::createConfigFromFile($transport->getConnection()['file']); } if ($transport instanceof HttpTransport) { return static::createConfigFromUrl($transport->getUrl(), $transport->getUser(), $transport->getPass()); } if ($transport instanceof FtpTransport) { return ['type' => self::TYPE_FTP, 'host' => $transport->getHost(), 'user' => $transport->getUser(), 'pass' => $transport->getPass(), 'file' => $transport->getConnection()['file'], 'mode' => $transport->getMode(), 'pasv' => $transport->getPasv()]; } throw new \LogicException(sprintf('Unable to create config for transport of type "%s"', get_class($transport))); }