You are here

public function ProviderRepositoryDecorator::get in oEmbed Providers 1.0.x

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

Returns information for a specific oEmbed provider.

Parameters

string $provider_name: The name of the provider.

Return value

\Drupal\media\OEmbed\Provider A value object containing information about the provider.

Throws

\InvalidArgumentException If there is no known oEmbed provider with the specified name.

Overrides ProviderRepositoryInterface::get

File

src/OEmbed/ProviderRepositoryDecorator.php, line 161

Class

ProviderRepositoryDecorator
Decorates the oEmbed ProviderRepository provided by core Media module.

Namespace

Drupal\oembed_providers\OEmbed

Code

public function get($provider_name) {
  $providers = $this
    ->getAll();
  if (!isset($providers[$provider_name])) {
    throw new \InvalidArgumentException("Unknown provider '{$provider_name}'");
  }
  return $providers[$provider_name];
}