You are here

public function ProviderRepositoryDecorator::__construct in oEmbed Providers 1.1.x

Same name and namespace in other branches
  1. 2.x src/OEmbed/ProviderRepositoryDecorator.php \Drupal\oembed_providers\OEmbed\ProviderRepositoryDecorator::__construct()
  2. 1.0.x src/OEmbed/ProviderRepositoryDecorator.php \Drupal\oembed_providers\OEmbed\ProviderRepositoryDecorator::__construct()

Constructs a ProviderRepository instance.

Parameters

\Drupal\media\OEmbed\ProviderRepositoryInterface $decorated: Retrieves and caches information about oEmbed providers.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: Manages entity type plugin definitions.

\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.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler service.

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

File

src/OEmbed/ProviderRepositoryDecorator.php, line 102

Class

ProviderRepositoryDecorator
Decorates the oEmbed ProviderRepository provided by core Media module.

Namespace

Drupal\oembed_providers\OEmbed

Code

public function __construct(ProviderRepositoryInterface $decorated, EntityTypeManagerInterface $entity_type_manager, ClientInterface $http_client, ConfigFactoryInterface $config_factory, TimeInterface $time, CacheBackendInterface $cache_backend = NULL, ModuleHandlerInterface $module_handler, $max_age = 604800) {
  $this->decorated = $decorated;
  $this->oembedProviderStorage = $entity_type_manager
    ->getStorage('oembed_provider');
  $this->httpClient = $http_client;
  $this->providersUrl = $config_factory
    ->get('media.settings')
    ->get('oembed_providers_url');
  $this->externalFetch = $config_factory
    ->get('oembed_providers.settings')
    ->get('external_fetch');
  $this->time = $time;
  $this->cacheBackend = $cache_backend;
  $this->moduleHandler = $module_handler;
  $this->maxAge = (int) $max_age;
}