method __construct documentation in bbn\File\System
system constructor.
function(string $type = 'local', array $cfg = [])
{
switch ($type) {
case 'ssh':
if ($this->_connect_ssh($cfg)) {
$this->mode = 'ssh';
$this->prefix = 'ssh2.sftp://' . $this->obj;
}
break;
case 'ftp':
if ($this->_connect_ftp($cfg)) {
$this->mode = 'ftp';
$this->prefix = 'ftp://' . $cfg['user'] . ':' . $this->_get_password($cfg) . '@' . $cfg['host'] . '/';
}
break;
case 'nextcloud':
if (isset($cfg['host'], $cfg['user'], $cfg['pass'])) {
$this->mode = 'nextcloud';
$this->obj = new \bbn\Api\Nextcloud($cfg);
}
break;
case 'webdav':
if (isset($cfg['host'], $cfg['user'], $cfg['pass'])) {
$this->mode = 'webdav';
$this->prefix = 'https://' . $cfg['host'] . $cfg['prefix'];
$this->obj = new \Sabre\DAV\Client([
'baseUri' => $this->path,
'userName' => $cfg['user'],
'password' => $cfg['pass']
]);
}
break;
case 'local':
$this->mode = $type;
$this->current = getcwd();
break;
}
if (empty($this->mode)) {
$this->error = X::_("Impossible to connect to the SSH server");
}
}
system constructor. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions