You are here

public function Http::__construct in Migrate Plus 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/migrate_plus/data_fetcher/Http.php \Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http::__construct()
  2. 8 src/Plugin/migrate_plus/data_fetcher/Http.php \Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http::__construct()
  3. 8.2 src/Plugin/migrate_plus/data_fetcher/Http.php \Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http::__construct()
  4. 8.3 src/Plugin/migrate_plus/data_fetcher/Http.php \Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http::__construct()

Constructs a \Drupal\Component\Plugin\PluginBase object.

Parameters

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.

Overrides PluginBase::__construct

1 method overrides Http::__construct()
TestHttp::__construct in tests/src/Unit/data_fetcher/HttpTest.php
Constructs a \Drupal\Component\Plugin\PluginBase object.

File

src/Plugin/migrate_plus/data_fetcher/Http.php, line 57

Class

Http
Retrieve data over an HTTP connection for migration.

Namespace

Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->httpClient = \Drupal::httpClient();

  // Ensure there is a 'headers' key in the configuration.
  $configuration += [
    'headers' => [],
  ];
  $this
    ->setRequestHeaders($configuration['headers']);
}