ResourceFetcher
class ResourceFetcher implements ResourceFetcherInterface (View source)
Fetches and caches oEmbed resources.
Traits
Provides methods to use a cache backend while respecting a 'use caches' flag.
Properties
| protected CacheBackendInterface | $cacheBackend | Cache backend instance. |
from UseCacheBackendTrait |
| protected bool | $useCaches | Flag whether caches should be used or skipped. |
from UseCacheBackendTrait |
| protected Client | $httpClient | The HTTP client. |
|
| protected ProviderRepositoryInterface | $providers | The oEmbed provider repository service. |
Methods
Fetches from the cache backend, respecting the use caches flag.
Stores data in the persistent cache, respecting the use caches flag.
Constructs a ResourceFetcher object.
Fetches an oEmbed resource.
Creates a Resource object from raw resource data.
Parses XML resource data.
Details
protected object|false
cacheGet(string $cid)
Fetches from the cache backend, respecting the use caches flag.
protected
cacheSet(string $cid, mixed $data, int $expire = Cache::PERMANENT, array $tags = [])
Stores data in the persistent cache, respecting the use caches flag.
__construct(ClientInterface $http_client, ProviderRepositoryInterface $providers, CacheBackendInterface $cache_backend = NULL)
Constructs a ResourceFetcher object.
Resource
fetchResource(string $url)
Fetches an oEmbed resource.
protected Resource
createResource(array $data, string $url)
Creates a Resource object from raw resource data.
protected array
parseResourceXml(string $data, string $url)
Parses XML resource data.