You are here

class BlockedLibraryManager in Cookie Content Blocker 8

Manages libraries that are blocked until consent is given.

@package Drupal\cookie_content_blocker

Hierarchy

Expanded class hierarchy of BlockedLibraryManager

1 string reference to 'BlockedLibraryManager'
cookie_content_blocker.services.yml in ./cookie_content_blocker.services.yml
cookie_content_blocker.services.yml
1 service uses BlockedLibraryManager
cookie_content_blocker.library.manager in ./cookie_content_blocker.services.yml
Drupal\cookie_content_blocker\BlockedLibraryManager

File

src/BlockedLibraryManager.php, line 12

Namespace

Drupal\cookie_content_blocker
View source
class BlockedLibraryManager implements BlockedLibraryManagerInterface {

  /**
   * The list of blocked libraries.
   *
   * @var string[]
   */
  protected $blockedLibraries = [];

  /**
   * {@inheritdoc}
   */
  public function addBlockedLibrary(string $library) : void {
    $this->blockedLibraries[$library] = $library;
  }

  /**
   * {@inheritdoc}
   */
  public function getBlockedLibraries() : array {
    return $this->blockedLibraries;
  }

  /**
   * {@inheritdoc}
   */
  public function hasBlockedLibraries() : bool {
    return !empty($this->blockedLibraries);
  }

  /**
   * {@inheritdoc}
   */
  public function isBlocked(string $library) : bool {
    return in_array($library, $this->blockedLibraries, TRUE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockedLibraryManager::$blockedLibraries protected property The list of blocked libraries.
BlockedLibraryManager::addBlockedLibrary public function Add a library to the list of blocked libraries. Overrides BlockedLibraryManagerInterface::addBlockedLibrary
BlockedLibraryManager::getBlockedLibraries public function Get a list of blocked libraries. Overrides BlockedLibraryManagerInterface::getBlockedLibraries
BlockedLibraryManager::hasBlockedLibraries public function Check whether there are any blocked libraries. Overrides BlockedLibraryManagerInterface::hasBlockedLibraries
BlockedLibraryManager::isBlocked public function Check whether a single library is blocked. Overrides BlockedLibraryManagerInterface::isBlocked