for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @link http://www.tintsoft.com/
* @copyright Copyright (c) 2012 TintSoft Technology Co. Ltd.
* @license http://www.tintsoft.com/license/
*/
namespace yuncms\filesystem\adapters;
use Yii;
use yii\base\InvalidConfigException;
use yuncms\filesystem\Adapter;
use League\Flysystem\Adapter\Ftp;
* Class Ftp
*
* @author Tongle Xu <[email protected]>
* @since 3.0
class FtpAdapter extends Adapter
{
* @var string
public $host;
* @var integer
public $port;
public $username;
public $password;
* @var boolean
public $ssl;
public $timeout;
public $root;
public $permPrivate;
public $permPublic;
public $passive;
public $transferMode;
* @inheritdoc
public function init()
if ($this->host === null) {
throw new InvalidConfigException('The "host" property must be set.');
}
if ($this->root !== null) {
$this->root = Yii::getAlias($this->root);
parent::init();
* @return Ftp
protected function prepareAdapter()
$config = [];
foreach ([
'host',
'port',
'username',
'password',
'ssl',
'timeout',
'root',
'permPrivate',
'permPublic',
'passive',
'transferMode',
] as $name) {
if ($this->$name !== null) {
$config[$name] = $this->$name;
return new Ftp($config);