public function FlysystemFactory::ensure in Flysystem 8
Same name and namespace in other branches
- 7 src/FlysystemFactory.php \Drupal\flysystem\FlysystemFactory::ensure()
- 3.x src/FlysystemFactory.php \Drupal\flysystem\FlysystemFactory::ensure()
- 2.0.x src/FlysystemFactory.php \Drupal\flysystem\FlysystemFactory::ensure()
- 3.0.x src/FlysystemFactory.php \Drupal\flysystem\FlysystemFactory::ensure()
Calls FlysystemPluginInterface::ensure() on each plugin.
Parameters
bool $force: (optional) Wheter to force the insurance. Defaults to false.
Return value
array Errors keyed by scheme.
File
- src/FlysystemFactory.php, line 177 
Class
- FlysystemFactory
- A factory for Flysystem filesystems.
Namespace
Drupal\flysystemCode
public function ensure($force = FALSE) {
  $errors = [];
  foreach ($this
    ->getSchemes() as $scheme) {
    foreach ($this
      ->getPlugin($scheme)
      ->ensure($force) as $error) {
      $event = new EnsureEvent($scheme, $error['severity'], $error['message'], $error['context']);
      $this->eventDispatcher
        ->dispatch(FlysystemEvents::ENSURE, $event);
      $errors[$scheme][] = $error;
    }
  }
  return $errors;
}