You are here

public static function SSH::factory in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/FileTransfer/SSH.php \Drupal\Core\FileTransfer\SSH::factory()
  2. 9 core/lib/Drupal/Core/FileTransfer/SSH.php \Drupal\Core\FileTransfer\SSH::factory()

File

core/lib/Drupal/Core/FileTransfer/SSH.php, line 37

Class

SSH
The SSH connection class for the update module.

Namespace

Drupal\Core\FileTransfer

Code

public 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']) ? 22 : $settings['advanced']['port'];
  return new SSH($jail, $username, $password, $hostname, $port);
}