You are here

public static function Local::factory in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/FileTransfer/Local.php \Drupal\Core\FileTransfer\Local::factory()
  2. 9 core/lib/Drupal/Core/FileTransfer/Local.php \Drupal\Core\FileTransfer\Local::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

Overrides FileTransfer::factory

1 method overrides Local::factory()
TestFileTransferWithSettingsForm::factory in core/modules/update/tests/modules/update_test/src/TestFileTransferWithSettingsForm.php
Returns a Drupal\update_test\TestFileTransferWithSettingsForm object.

File

core/lib/Drupal/Core/FileTransfer/Local.php, line 40

Class

Local
Defines the local connection class for copying files as the httpd user.

Namespace

Drupal\Core\FileTransfer

Code

public static function factory($jail, $settings) {
  return new Local($jail, \Drupal::service('file_system'));
}