function ProviderRepository::__construct

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

Constructs a ProviderRepository instance.

Parameters

\GuzzleHttp\ClientInterface $httpClient: The HTTP client.

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

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

\Drupal\Core\KeyValueStore\KeyValueFactoryInterface $key_value_factory: The key-value store factory.

\Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory: The logger channel factory.

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

File

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

Class

ProviderRepository
Retrieves and caches information about oEmbed providers.

Namespace

Drupal\media\OEmbed

Code

public function __construct(protected ClientInterface $httpClient, ConfigFactoryInterface $config_factory, protected TimeInterface $time, KeyValueFactoryInterface $key_value_factory, LoggerChannelFactoryInterface $logger_factory, protected int $maxAge = 604800) {
  $this->providersUrl = $config_factory->get('media.settings')
    ->get('oembed_providers_url');
  $this->keyValue = $key_value_factory->get('media');
  $this->logger = $logger_factory->get('media');
}

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