UrlResolver
class UrlResolver implements UrlResolverInterface (View source)
Converts oEmbed media URLs into endpoint-specific resource URLs.
Properties
| protected Client | $httpClient | The HTTP client. |
|
| protected ProviderRepositoryInterface | $providers | The OEmbed provider repository service. |
|
| protected ResourceFetcherInterface | $resourceFetcher | The OEmbed resource fetcher service. |
|
| protected ModuleHandlerInterface | $moduleHandler | The module handler service. |
|
| protected string[] | $urlCache | Static cache of discovered oEmbed resource URLs, keyed by canonical URL. |
|
| protected CacheBackendInterface | $cacheBackend | The cache backend. |
Methods
Constructs a UrlResolver object.
Runs oEmbed discovery and returns the endpoint URL if successful.
Tries to determine the oEmbed provider for a media asset URL.
Builds the resource URL for a media asset URL.
For the given media item URL find an endpoint with schemes that match.
Details
__construct(ProviderRepositoryInterface $providers, ResourceFetcherInterface $resource_fetcher, ClientInterface $http_client, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend = NULL)
Constructs a UrlResolver object.
protected string|bool
discoverResourceUrl(string $url)
Runs oEmbed discovery and returns the endpoint URL if successful.
protected bool|string
findUrl(DOMXPath $xpath, string $format)
Tries to find the oEmbed URL in a DOM.
Provider
getProviderByUrl(string $url)
Tries to determine the oEmbed provider for a media asset URL.
string
getResourceUrl(string $url, int $max_width = NULL, int $max_height = NULL)
Builds the resource URL for a media asset URL.
protected string
getEndpointMatchingUrl(string $url, Provider $provider)
For the given media item URL find an endpoint with schemes that match.