You are here

public function ProviderRepository::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media/src/OEmbed/ProviderRepository.php \Drupal\media\OEmbed\ProviderRepository::__construct()

Constructs a ProviderRepository instance.

Parameters

\GuzzleHttp\ClientInterface $http_client: The HTTP client.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory service.

\Drupal\Component\Datetime\TimeInterface $time: The time service.

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

int $max_age: (optional) How long the cache data should be kept. Defaults to a week.

File

core/modules/media/src/OEmbed/ProviderRepository.php, line 62

Class

ProviderRepository
Retrieves and caches information about oEmbed providers.

Namespace

Drupal\media\OEmbed

Code

public function __construct(ClientInterface $http_client, ConfigFactoryInterface $config_factory, TimeInterface $time, CacheBackendInterface $cache_backend = NULL, $max_age = 604800) {
  $this->httpClient = $http_client;
  $this->providersUrl = $config_factory
    ->get('media.settings')
    ->get('oembed_providers_url');
  $this->time = $time;
  $this->cacheBackend = $cache_backend;
  $this->maxAge = (int) $max_age;
}