You are here

public static function S3::create in Flysystem - S3 2.0.x

Same name and namespace in other branches
  1. 8 src/Flysystem/S3.php \Drupal\flysystem_s3\Flysystem\S3::create()

Creates an instance of the plugin.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The container to pull out services used in the plugin.

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin ID for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Return value

static Returns an instance of this plugin.

Overrides ContainerFactoryPluginInterface::create

4 calls to S3::create()
S3Test::testCreate in tests/src/Unit/Flysystem/S3Test.php
S3Test::testCreateUsingNonAwsConfiguration in tests/src/Unit/Flysystem/S3Test.php
S3Test::testCreateUsingNonAwsConfigurationWithBucket in tests/src/Unit/Flysystem/S3Test.php
S3Test::testIamAuth in tests/src/Unit/Flysystem/S3Test.php

File

src/Flysystem/S3.php, line 93

Class

S3
Drupal plugin for the "S3" Flysystem adapter.

Namespace

Drupal\flysystem_s3\Flysystem

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  $configuration = static::mergeConfiguration($container, $configuration);
  $client_config = static::mergeClientConfiguration($container, $configuration);
  $client = new S3Client($client_config);
  unset($configuration['key'], $configuration['secret']);
  return new static($client, new Config($configuration));
}