You are here

interface CdnBaseInterface in Libraries CDN API 8

Interface CdnBaseInterface.

Hierarchy

Expanded class hierarchy of CdnBaseInterface

All classes that implement CdnBaseInterface

3 files declare their use of CdnBaseInterface
CdnJs.php in src/Plugin/LibrariesCdn/CdnJs.php
Plugin: CDNJS.
JsDelivr.php in src/Plugin/LibrariesCdn/JsDelivr.php
Plugin: jsDelivr.
LibrariesCdn.php in src/LibrariesCdn.php
Contains LibrariesCdn.

File

src/CdnBaseInterface.php, line 13
Interface CdnBaseInterface.

Namespace

Drupal\libraries_cdn
View source
interface CdnBaseInterface extends PluginInspectionInterface {

  /**
   * Check if library is available.
   *
   * @return bool
   *   Return TRUE if the library is available, otherwise, FALSE.
   */
  public function isAvailable();

  /**
   * Return all available version(s).
   *
   * @return array
   *   Return an array with available versions of the library.
   */
  public function getVersions();

  /**
   * Return all available file(s).
   *
   * @param array $version
   *   Filter the returning array with this one.
   *
   * @return array
   *   Return an array with available files of the library.
   */
  public function getFiles(array $version = array());

  /**
   * Set the library to work with.
   *
   * @param string $library
   *   The library to work with.
   */
  public function setLibrary($library);

  /**
   * Get the library in use.
   *
   * @return string
   *   The library name.
   */
  public function getLibrary();

  /**
   * Set a particular URL.
   *
   * @param string $identifier
   *   The identifier.
   * @param string $url
   *   The URL.
   */
  public function setURL($identifier, $url);

  /**
   * Get a particular URL.
   *
   * @return string
   *   The URL.
   */
  public function getURL($identifier);

  /**
   * Set URLs.
   *
   * @param array $urls
   *   An array of URLs for querying the service.
   */
  public function setURLs(array $urls = array());

  /**
   * Get URLs.
   *
   * @return array
   *   Return an array of URLs in use for querying the service.
   */
  public function getURLs();

  /**
   * Make an HTTP Request.
   *
   * TODO: Do not use drupal_http_request.
   *
   * @param string $url
   *   The URL.
   */
  public function request($url);

  /**
   * Request wrapper for querying a CDN.
   *
   * @param string $url
   *   The URL.
   */
  public function query($url);

  /**
   * Get library information.
   *
   * @return array
   *   Return an array containing information about the library.
   */
  public function getInformation();

  /**
   * Get latest version available of a library.
   *
   * @return string
   *   The latest available version of the library.
   */
  public function getLatestVersion();

  /**
   * Perform a search for a library.
   *
   * @return array
   *   The resulting array.
   */
  public function search($library);

  /**
   * Check if a file is available locally.
   *
   * @param string $file
   *   The file to check.
   * @param string $version
   *   The version to check the file against.
   *
   * @return bool
   *   Return TRUE if the file is available, FALSE otherwise.
   */
  public function isLocalAvailable($file, $version);

  /**
   * Get the local file name of a library file.
   *
   * @param string $file
   *   The file to check.
   * @param string $version
   *   The version to check the file against.
   *
   * @return string
   *   Return the file name.
   */
  public function getLocalFileName($file, $version);

  /**
   * Get the local directory name of a library.
   *
   * @param string $version
   *   The version to check the file against.
   *
   * @return string
   *   Return the directory name.
   */
  public function getLocalDirectoryName($version = NULL);

  /**
   * Copy a library from the CDN to the local filesystem.
   *
   * @param array $versions
   *   The library versions to copy.
   */
  public function getLocalCopy(array $versions = array());

  /**
   * Set default scheme for an url.
   *
   * @param string $default
   *   The scheme.
   */
  public function setScheme($default = 'http');

  /**
   * Get the default scheme.
   *
   * @param string $default
   *   The default scheme is none is set.
   */
  public function getScheme($default = 'http');

  /**
   * Return the configuration of the object.
   *
   * @param string $key
   *     A key of configuration.
   *
   * @return mixed
   *    If a configuration item has a value for the key parameter in the
   *    configuration array, then the function will return it, otherwise,
   *    the whole configuration array is returned.
   */
  public function getConfiguration($key = NULL);

  /**
   * Set the configuration of the object.
   *
   * @param array $configuration
   *   The configuration array.
   */
  public function setConfiguration(array $configuration = array());

  /**
   * Return the data to use in each method.
   *
   * @param string $function
   *   The method name.
   * @param array $data
   *   The data from query.
   *
   * @return array
   *   The resulting array.
   */
  public function formatData($function, array $data = array());

}

Members

Namesort descending Modifiers Type Description Overrides
CdnBaseInterface::formatData public function Return the data to use in each method. 1
CdnBaseInterface::getConfiguration public function Return the configuration of the object. 1
CdnBaseInterface::getFiles public function Return all available file(s). 1
CdnBaseInterface::getInformation public function Get library information. 1
CdnBaseInterface::getLatestVersion public function Get latest version available of a library. 1
CdnBaseInterface::getLibrary public function Get the library in use. 1
CdnBaseInterface::getLocalCopy public function Copy a library from the CDN to the local filesystem. 1
CdnBaseInterface::getLocalDirectoryName public function Get the local directory name of a library. 1
CdnBaseInterface::getLocalFileName public function Get the local file name of a library file. 1
CdnBaseInterface::getScheme public function Get the default scheme. 1
CdnBaseInterface::getURL public function Get a particular URL. 1
CdnBaseInterface::getURLs public function Get URLs. 1
CdnBaseInterface::getVersions public function Return all available version(s). 1
CdnBaseInterface::isAvailable public function Check if library is available. 1
CdnBaseInterface::isLocalAvailable public function Check if a file is available locally. 1
CdnBaseInterface::query public function Request wrapper for querying a CDN. 1
CdnBaseInterface::request public function Make an HTTP Request. 1
CdnBaseInterface::search public function Perform a search for a library. 1
CdnBaseInterface::setConfiguration public function Set the configuration of the object. 1
CdnBaseInterface::setLibrary public function Set the library to work with. 1
CdnBaseInterface::setScheme public function Set default scheme for an url. 1
CdnBaseInterface::setURL public function Set a particular URL. 1
CdnBaseInterface::setURLs public function Set URLs. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2