You are here

trait PrivateStreamTrait in Libraries API 8.3

Provides a trait for local streams that are not publicly accessible.

Hierarchy

See also

\Drupal\locale\StreamWrapper\TranslationsStream

1 file declares its use of PrivateStreamTrait
TestLibraryFilesStream.php in tests/src/Kernel/ExternalLibrary/TestLibraryFilesStream.php

File

src/StreamWrapper/PrivateStreamTrait.php, line 10

Namespace

Drupal\libraries\StreamWrapper
View source
trait PrivateStreamTrait {

  /**
   * Returns a web accessible URL for the resource.
   *
   * This function should return a URL that can be embedded in a web page
   * and accessed from a browser. For example, the external URL of
   * "youtube://xIpLd0WQKCY" might be
   * "http://www.youtube.com/watch?v=xIpLd0WQKCY".
   *
   * @return string
   *   Returns a string containing a web accessible URL for the resource.
   *
   * @see \Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl()
   */
  function getExternalUrl() {
    throw new \LogicException("{$this->getName()} should not be public.");
  }

  /**
   * Returns the name of the stream wrapper for use in the UI.
   *
   * @return string
   *   The stream wrapper name.
   *
   * @see \Drupal\Core\StreamWrapper\StreamWrapperInterface::getName()
   */
  public abstract function getName();

}

Members

Namesort descending Modifiers Type Description Overrides
PrivateStreamTrait::getExternalUrl function Returns a web accessible URL for the resource.
PrivateStreamTrait::getName abstract public function Returns the name of the stream wrapper for use in the UI. 4