class ProviderRepository implements ProviderRepositoryInterface (View source)

Retrieves and caches information about oEmbed providers.

Traits

Provides a standard way to announce deprecated properties.

Properties

protected int $maxAge

How long the provider data should be cached, in seconds.

protected Client $httpClient

The HTTP client.

protected string $providersUrl

URL of a JSON document which contains a database of oEmbed providers.

protected TimeInterface $time

The time service.

protected KeyValueStoreInterface $keyValue

The key-value store.

protected LoggerChannelInterface $logger

The logger channel.

Methods

__get($name)

Allows to access deprecated/removed properties.

__construct(ClientInterface $http_client, ConfigFactoryInterface $config_factory, TimeInterface $time, KeyValueFactoryInterface $key_value_factory = NULL, LoggerChannelFactoryInterface $logger_factory = NULL, int $max_age = 604800)

Constructs a ProviderRepository instance.

getAll()

Returns information on all available oEmbed providers.

get(string $provider_name)

Returns information for a specific oEmbed provider.

Details

__get($name)

Allows to access deprecated/removed properties.

This method must be public.

Parameters

$name

__construct(ClientInterface $http_client, ConfigFactoryInterface $config_factory, TimeInterface $time, KeyValueFactoryInterface $key_value_factory = NULL, LoggerChannelFactoryInterface $logger_factory = NULL, int $max_age = 604800)

Constructs a ProviderRepository instance.

Parameters

ClientInterface $http_client

The HTTP client.

ConfigFactoryInterface $config_factory

The config factory service.

TimeInterface $time

The time service.

KeyValueFactoryInterface $key_value_factory

The key-value store factory.

LoggerChannelFactoryInterface $logger_factory

The logger channel factory.

int $max_age

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

Provider[] getAll()

Returns information on all available oEmbed providers.

Return Value

Provider[]

Returns an array of provider value objects, keyed by provider name.

Exceptions

ProviderException

Provider get(string $provider_name)

Returns information for a specific oEmbed provider.

Parameters

string $provider_name

The name of the provider.

Return Value

Provider

A value object containing information about the provider.

Exceptions

InvalidArgumentException