Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 22 |
FTP | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
72 | |
0.00% |
0 / 22 |
__construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 6 |
|||
factory | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 12 |
|||
getSettingsForm | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\Core\FileTransfer\FTP. | |
*/ | |
namespace Drupal\Core\FileTransfer; | |
/** | |
* Defines the base class for FTP implementations. | |
*/ | |
abstract class FTP extends FileTransfer { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function __construct($jail, $username, $password, $hostname, $port) { | |
$this->username = $username; | |
$this->password = $password; | |
$this->hostname = $hostname; | |
$this->port = $port; | |
parent::__construct($jail); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
static function factory($jail, $settings) { | |
$username = empty($settings['username']) ? '' : $settings['username']; | |
$password = empty($settings['password']) ? '' : $settings['password']; | |
$hostname = empty($settings['advanced']['hostname']) ? 'localhost' : $settings['advanced']['hostname']; | |
$port = empty($settings['advanced']['port']) ? 21 : $settings['advanced']['port']; | |
if (function_exists('ftp_connect')) { | |
$class = 'Drupal\Core\FileTransfer\FTPExtension'; | |
} | |
else { | |
throw new FileTransferException('No FTP backend available.'); | |
} | |
return new $class($jail, $username, $password, $hostname, $port); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getSettingsForm() { | |
$form = parent::getSettingsForm(); | |
$form['advanced']['port']['#default_value'] = 21; | |
return $form; | |
} | |
} |