diff core/modules/media/src/OEmbed/ResourceFetcherInterface.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/media/src/OEmbed/ResourceFetcherInterface.php	Thu Feb 28 13:21:36 2019 +0000
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\media\OEmbed;
+
+/**
+ * Defines an interface for an oEmbed resource fetcher service.
+ *
+ * The resource fetcher's only responsibility is to retrieve oEmbed resource
+ * data from an endpoint URL (i.e., as returned by
+ * \Drupal\media\OEmbed\UrlResolverInterface::getResourceUrl()) and return a
+ * \Drupal\media\OEmbed\Resource value object.
+ */
+interface ResourceFetcherInterface {
+
+  /**
+   * Fetches an oEmbed resource.
+   *
+   * @param string $url
+   *   Endpoint-specific URL of the oEmbed resource.
+   *
+   * @return \Drupal\media\OEmbed\Resource
+   *   A resource object built from the oEmbed resource data.
+   *
+   * @see https://oembed.com/#section2
+   *
+   * @throws \Drupal\media\OEmbed\ResourceException
+   *   If the oEmbed endpoint is not reachable or the response returns an
+   *   unexpected Content-Type header.
+   */
+  public function fetchResource($url);
+
+}