You are here

public function FlysystemFactory::__construct in Flysystem 8

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

Constructs a FlysystemFactory object.

Parameters

\Drupal\Component\Plugin\PluginManagerInterface $plugin_manager: The plugin manager.

\Drupal\Core\File\FileSystemInterface $filesystem: The Drupal filesystem service.

\Drupal\Core\Cache\CacheBackendInterface $cache: The cache backend.

\Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: The event dispatcher.

File

src/FlysystemFactory.php, line 92

Class

FlysystemFactory
A factory for Flysystem filesystems.

Namespace

Drupal\flysystem

Code

public function __construct(PluginManagerInterface $plugin_manager, FileSystemInterface $filesystem, CacheBackendInterface $cache, EventDispatcherInterface $event_dispatcher) {
  $this->pluginManager = $plugin_manager;
  $this->cacheBackend = $cache;
  $this->eventDispatcher = $event_dispatcher;

  // Apply defaults and validate registered services.
  foreach (Settings::get('flysystem', []) as $scheme => $configuration) {

    // The settings.php file could be changed before rebuilding the container.
    if (!$filesystem
      ->validScheme($scheme)) {
      continue;
    }
    $this->settings[$scheme] = $configuration + $this->defaults;
  }
}