class ProviderRepository
Same name in this branch
- 9 core/modules/media/src/OEmbed/ProviderRepository.php \Drupal\media\OEmbed\ProviderRepository
Same name in other branches
- 8.9.x core/modules/media/src/OEmbed/ProviderRepository.php \Drupal\media\OEmbed\ProviderRepository
- 8.9.x core/modules/media/tests/modules/media_test_oembed/src/ProviderRepository.php \Drupal\media_test_oembed\ProviderRepository
- 10 core/modules/media/src/OEmbed/ProviderRepository.php \Drupal\media\OEmbed\ProviderRepository
- 10 core/modules/media/tests/modules/media_test_oembed/src/ProviderRepository.php \Drupal\media_test_oembed\ProviderRepository
- 11.x core/modules/media/src/OEmbed/ProviderRepository.php \Drupal\media\OEmbed\ProviderRepository
- 11.x core/modules/media/tests/modules/media_test_oembed/src/ProviderRepository.php \Drupal\media_test_oembed\ProviderRepository
Overrides the oEmbed provider repository service for testing purposes.
This service does not use caching at all, and will always try to retrieve provider data from state before calling the parent methods.
Hierarchy
- class \Drupal\media\OEmbed\ProviderRepository implements \Drupal\media\OEmbed\ProviderRepositoryInterface uses \Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait
- class \Drupal\media_test_oembed\ProviderRepository extends \Drupal\media\OEmbed\ProviderRepository
Expanded class hierarchy of ProviderRepository
File
-
core/
modules/ media/ tests/ modules/ media_test_oembed/ src/ ProviderRepository.php, line 14
Namespace
Drupal\media_test_oembedView source
class ProviderRepository extends BaseProviderRepository {
/**
* {@inheritdoc}
*/
public function getAll() {
return \Drupal::state()->get(static::class) ?: parent::getAll();
}
/**
* {@inheritdoc}
*/
public function get($provider_name) {
$providers = \Drupal::state()->get(static::class, []);
if (isset($providers[$provider_name])) {
return $providers[$provider_name];
}
return parent::get($provider_name);
}
/**
* Stores an oEmbed provider value object in state.
*
* @param \Drupal\media\OEmbed\Provider $provider
* The provider to store.
*/
public function setProvider(Provider $provider) {
$providers = \Drupal::state()->get(static::class, []);
$name = $provider->getName();
$providers[$name] = $provider;
\Drupal::state()->set(static::class, $providers);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
DeprecatedServicePropertyTrait::__get | public | function | Allows to access deprecated/removed properties. | |
ProviderRepository::$deprecatedProperties | private | property | The service properties that should raise a deprecation error. | |
ProviderRepository::$httpClient | protected | property | The HTTP client. | |
ProviderRepository::$keyValue | protected | property | The key-value store. | |
ProviderRepository::$logger | protected | property | The logger channel. | |
ProviderRepository::$maxAge | protected | property | How long the provider data should be cached, in seconds. | |
ProviderRepository::$providersUrl | protected | property | URL of a JSON document which contains a database of oEmbed providers. | |
ProviderRepository::$time | protected | property | The time service. | |
ProviderRepository::get | public | function | Returns information for a specific oEmbed provider. | Overrides ProviderRepository::get |
ProviderRepository::getAll | public | function | Returns information on all available oEmbed providers. | Overrides ProviderRepository::getAll |
ProviderRepository::setProvider | public | function | Stores an oEmbed provider value object in state. | |
ProviderRepository::__construct | public | function | Constructs a ProviderRepository instance. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.