You are here

public function S3::getAdapter in Flysystem - S3 8

Same name and namespace in other branches
  1. 2.0.x src/Flysystem/S3.php \Drupal\flysystem_s3\Flysystem\S3::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

File

src/Flysystem/S3.php, line 176

Class

S3
Drupal plugin for the "S3" Flysystem adapter.

Namespace

Drupal\flysystem_s3\Flysystem

Code

public function getAdapter() {
  try {
    $adapter = new S3Adapter($this->client, $this->bucket, $this->prefix, $this->options);
    return $adapter;
  } catch (S3Exception $e) {
    $message = $e
      ->getMessage();
    \Drupal::logger('flysystem_s3')
      ->error($message);
  }
}