You are here

protected function FlysystemFactory::getAdapter in Flysystem 7

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

Returns the adapter for a scheme.

Parameters

string $scheme: The scheme to find an adapter for.

Return value

\League\Flysystem\AdapterInterface The correct adapter from settings.

1 call to FlysystemFactory::getAdapter()
FlysystemFactory::getFilesystem in src/FlysystemFactory.php
Returns the filesystem for a given scheme.

File

src/FlysystemFactory.php, line 143
Contains \Drupal\flysystem\FlysystemFactory.

Class

FlysystemFactory
A factory for Flysystem filesystems.

Namespace

Drupal\flysystem

Code

protected function getAdapter($scheme) {
  $settings = $this
    ->getSettings($scheme);
  $adapter = $this
    ->getPlugin($scheme)
    ->getAdapter();
  if ($settings['replicate']) {
    $replica = $this
      ->getAdapter($settings['replicate']);
    $adapter = new ReplicateAdapter($adapter, $replica);
  }
  if ($settings['cache']) {
    $cache = new DrupalFlysystemCache('flysystem:' . $scheme);
    $adapter = new CachedAdapter($adapter, $cache);
  }
  return $adapter;
}