You are here

MediaFeedsProvider.inc in Media Feeds 7.2

Same filename and directory in other branches
  1. 7 includes/MediaFeedsProvider.inc

The MediaFeedsProvider base class.

File

includes/MediaFeedsProvider.inc
View source
<?php

/**
 * @file
 * The MediaFeedsProvider base class.
 */

/**
 * Base class for different Media Feeds providers.
 */
abstract class MediaFeedsProvider {

  /**
   * The FeedsSource.
   */
  protected $source;

  /**
   * The target entity.
   */
  protected $entity;

  /**
   * The target name.
   */
  protected $target;

  /**
   * The values to save.
   */
  protected $value;

  /**
   * An associative array of configuration options.
   */
  protected $config;

  /**
   * Constructor of MediaFeedsProvider.
   *
   * @param $value
   *   The value to save.
   *
   * @param $config
   *   An associative array of configuration options.
   */
  public function __construct($value, $config = array()) {

    // Explicitly support FeedsEnclosure.
    if ($value instanceof FeedsEnclosure) {
      $value = $value
        ->getValue();
    }
    $this->value = $value;
    $this->config = $config;
  }

  /**
   * Validate the source value.
   */
  public function validate() {
  }

  /**
   * Create a file object from the source value.
   *
   * @return
   *   File object on success, FALSE on failure.
   */
  public abstract function getFileObject();

  /**
   * Save the file in the database.
   *
   * @return
   *   The file object as it has been saved or FALSE on failure.
   */
  public abstract function save();

}

Classes

Namesort descending Description
MediaFeedsProvider Base class for different Media Feeds providers.