function ResourceFetcher::__construct

Same name in other branches
  1. 8.9.x core/modules/media/src/OEmbed/ResourceFetcher.php \Drupal\media\OEmbed\ResourceFetcher::__construct()
  2. 10 core/modules/media/src/OEmbed/ResourceFetcher.php \Drupal\media\OEmbed\ResourceFetcher::__construct()
  3. 11.x core/modules/media/src/OEmbed/ResourceFetcher.php \Drupal\media\OEmbed\ResourceFetcher::__construct()

Constructs a ResourceFetcher object.

Parameters

\GuzzleHttp\ClientInterface $http_client: The HTTP client.

\Drupal\media\OEmbed\ProviderRepositoryInterface $providers: The oEmbed provider repository service.

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

File

core/modules/media/src/OEmbed/ResourceFetcher.php, line 47

Class

ResourceFetcher
Fetches and caches oEmbed resources.

Namespace

Drupal\media\OEmbed

Code

public function __construct(ClientInterface $http_client, ProviderRepositoryInterface $providers, CacheBackendInterface $cache_backend = NULL) {
    $this->httpClient = $http_client;
    $this->providers = $providers;
    if (empty($cache_backend)) {
        $cache_backend = \Drupal::cache();
        @trigger_error('Passing NULL as the $cache_backend parameter to ' . __METHOD__ . '() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. See https://www.drupal.org/node/3223594', E_USER_DEPRECATED);
    }
    $this->cacheBackend = $cache_backend;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.