Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / migrate_plus / src / Plugin / migrate / source / Url.php
index 92f6d449db42ccf3a46033e7eb6f36a2a35c0a1e..242223b61889060e1780fa003ec18817ad3a78cb 100644 (file)
@@ -3,7 +3,6 @@
 namespace Drupal\migrate_plus\Plugin\migrate\source;
 
 use Drupal\migrate\Plugin\MigrationInterface;
-use Drupal\migrate_plus\DataParserPluginInterface;
 
 /**
  * Source plugin for retrieving data via URLs.
@@ -38,15 +37,6 @@ class Url extends SourcePluginExtension {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
 
     $this->sourceUrls = $configuration['urls'];
-
-    // Set a default Accept header.
-/*    $this->headers = array_merge(['Accept' => 'application/json'],
-      $configuration['headers'] ?: []);*/
-
-    // See if this is a paged response with next links. If so, add to the source_urls array.
-/*    foreach ( (array) $configuration['urls'] as $url) {
-      $this->sourceUrls += $this->getNextLinks($url);
-    }*/
   }
 
   /**
@@ -85,55 +75,4 @@ class Url extends SourcePluginExtension {
     return $this->getDataParserPlugin();
   }
 
-  /**
-   * Collect an array of next links from a paged response.
-   */
-/*  protected function getNextLinks($url) {
-    $urls = array();
-    $more = TRUE;
-    while ($more == TRUE) {
-      $response = $this->dataParserPlugin->getDataFetcher()->getResponse($url);
-      if ($url = $this->getNextFromHeaders($response)) {
-        $urls[] = $url;
-      }
-      elseif ($url = $this->getNextFromLinks($response)) {
-        $urls[] = $url;
-      }
-      else {
-        $more = FALSE;
-      }
-    }
-    return $urls;
-  }
-*/
-  /**
-   * See if the next link is in a 'links' group in the response.
-   *
-   * @param \Psr\Http\Message\ResponseInterface $response
-   */
-/*  protected function getNextFromLinks(ResponseInterface $response) {
-    $body = json_decode($response->getBody(), TRUE);
-    if (!empty($body['links']) && array_key_exists('next', $body['links'])) {
-      return $body['links']['next'];
-    }
-    return FALSE;
-  }
-*/
-  /**
-   * See if the next link is in the header.
-   *
-   * @param \Psr\Http\Message\ResponseInterface $response
-   */
-/*  protected function getNextFromHeaders(ResponseInterface $response) {
-    $headers = $response->getHeader('Link');
-    foreach ($headers as $header) {
-      $matches = array();
-      preg_match('/^<(.*)>; rel="next"$/', $header, $matches);
-      if (!empty($matches) && !empty($matches[1])) {
-        return $matches[1];
-      }
-    }
-    return FALSE;
-  }
-*/
 }