You are here

public function Ftp::getAdapter in Flysystem 8

Same name and namespace in other branches
  1. 7 src/Flysystem/Ftp.php \Drupal\flysystem\Flysystem\Ftp::getAdapter()
  2. 3.x src/Flysystem/Ftp.php \Drupal\flysystem\Flysystem\Ftp::getAdapter()
  3. 2.0.x src/Flysystem/Ftp.php \Drupal\flysystem\Flysystem\Ftp::getAdapter()
  4. 3.0.x src/Flysystem/Ftp.php \Drupal\flysystem\Flysystem\Ftp::getAdapter()

Returns the Flysystem adapter.

Plugins should not keep references to the adapter. If a plugin needs to perform filesystem operations, it should either use a scheme:// or have the \Drupal\flysystem\FlysystemFactory injected.

Return value

\League\Flysystem\AdapterInterface The Flysytem adapter.

Overrides FlysystemPluginInterface::getAdapter

1 call to Ftp::getAdapter()
Ftp::ensure in src/Flysystem/Ftp.php
Checks the sanity of the filesystem.

File

src/Flysystem/Ftp.php, line 47

Class

Ftp
Drupal plugin for the "FTP" Flysystem adapter.

Namespace

Drupal\flysystem\Flysystem

Code

public function getAdapter() {
  try {
    $adapter = new FtpAdapter($this->configuration);
    $adapter
      ->connect();
  } catch (\RuntimeException $e) {

    // A problem connecting to the server.
    $adapter = new MissingAdapter();
  }
  return $adapter;
}