You are here

interface DownloadLoggerInterface in Commerce File 8.2

Interface for the download logger, responsible for logging file downloads.

Hierarchy

Expanded class hierarchy of DownloadLoggerInterface

All classes that implement DownloadLoggerInterface

4 files declare their use of DownloadLoggerInterface
DownloadLimit.php in src/Plugin/views/field/DownloadLimit.php
File.php in src/Plugin/Commerce/LicenseType/File.php
FileDownloadController.php in src/Controller/FileDownloadController.php
FileResponseSubscriber.php in src/EventSubscriber/FileResponseSubscriber.php

File

src/DownloadLoggerInterface.php, line 11

Namespace

Drupal\commerce_file
View source
interface DownloadLoggerInterface {

  /**
   * Clears the download log for the given license.
   *
   * @param \Drupal\commerce_license\Entity\LicenseInterface $license
   *   The license.
   */
  public function clear(LicenseInterface $license);

  /**
   * Gets the download counts for the given license and its files.
   *
   * Note that the download counts are returned for the license owner since we
   * we only record downloads from the license owner.
   *
   * @param \Drupal\commerce_license\Entity\LicenseInterface $license
   *   The license.
   *
   * @return array
   *   The download counts, keyed by fid.
   *
   * @throws \InvalidArgumentException
   *   Thrown when the given license references a purchased entity that does not
   *   reference any file.
   */
  public function getDownloadCounts(LicenseInterface $license);

  /**
   * Logs the download of the given file, for the given license.
   *
   * @param \Drupal\commerce_license\Entity\LicenseInterface $license
   *   The license.
   * @param \Drupal\file\FileInterface $file
   *   The downloaded file.
   */
  public function log(LicenseInterface $license, FileInterface $file);

}

Members

Namesort descending Modifiers Type Description Overrides
DownloadLoggerInterface::clear public function Clears the download log for the given license. 1
DownloadLoggerInterface::getDownloadCounts public function Gets the download counts for the given license and its files. 1
DownloadLoggerInterface::log public function Logs the download of the given file, for the given license. 1