function FileTransfer::factory

Same name in other branches
  1. 7.x includes/filetransfer/filetransfer.inc \FileTransfer::factory()
  2. 9 core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::factory()
  3. 8.9.x core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::factory()
  4. 11.x core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::factory()

Defines a factory method for this class.

Classes that extend this class must override the factory() static method. They should return a new instance of the appropriate FileTransfer subclass.

Parameters

string $jail: The full path where all file operations performed by this object will be restricted to. This prevents the FileTransfer classes from being able to touch other parts of the filesystem.

array $settings: An array of connection settings for the FileTransfer subclass. If the getSettingsForm() method uses any nested settings, the same structure will be assumed here.

Return value

object New instance of the appropriate FileTransfer subclass.

Throws

\Drupal\Core\FileTransfer\FileTransferException

4 methods override FileTransfer::factory()
FTP::factory in core/lib/Drupal/Core/FileTransfer/FTP.php
Defines a factory method for this class.
Local::factory in core/lib/Drupal/Core/FileTransfer/Local.php
Defines a factory method for this class.
SSH::factory in core/lib/Drupal/Core/FileTransfer/SSH.php
Defines a factory method for this class.
TestFileTransfer::factory in core/modules/system/tests/src/Functional/FileTransfer/TestFileTransfer.php
Defines a factory method for this class.

File

core/lib/Drupal/Core/FileTransfer/FileTransfer.php, line 91

Class

FileTransfer
Defines the base FileTransfer class.

Namespace

Drupal\Core\FileTransfer

Code

public static function factory($jail, $settings) {
    throw new FileTransferException('FileTransfer::factory() static method not overridden by FileTransfer subclass.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.