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