b74fb6e2d9c47fc75dde7bc91c7befda16a20611
[yaffs-website] / web / core / modules / media / src / OEmbed / ResourceFetcherInterface.php
1 <?php
2
3 namespace Drupal\media\OEmbed;
4
5 /**
6  * Defines an interface for an oEmbed resource fetcher service.
7  *
8  * The resource fetcher's only responsibility is to retrieve oEmbed resource
9  * data from an endpoint URL (i.e., as returned by
10  * \Drupal\media\OEmbed\UrlResolverInterface::getResourceUrl()) and return a
11  * \Drupal\media\OEmbed\Resource value object.
12  */
13 interface ResourceFetcherInterface {
14
15   /**
16    * Fetches an oEmbed resource.
17    *
18    * @param string $url
19    *   Endpoint-specific URL of the oEmbed resource.
20    *
21    * @return \Drupal\media\OEmbed\Resource
22    *   A resource object built from the oEmbed resource data.
23    *
24    * @see https://oembed.com/#section2
25    *
26    * @throws \Drupal\media\OEmbed\ResourceException
27    *   If the oEmbed endpoint is not reachable or the response returns an
28    *   unexpected Content-Type header.
29    */
30   public function fetchResource($url);
31
32 }