You are here

class CommandRegistryService in Googalytics - Google Analytics 8

Class CommandRegistryService.

Hierarchy

Expanded class hierarchy of CommandRegistryService

1 file declares its use of CommandRegistryService
DefaultCommandSubscriber.php in src/EventSubscriber/DefaultCommandSubscriber.php
1 string reference to 'CommandRegistryService'
ga.services.yml in ./ga.services.yml
ga.services.yml
1 service uses CommandRegistryService
ga.command_registry in ./ga.services.yml
Drupal\ga\CommandRegistryService

File

src/CommandRegistryService.php, line 10

Namespace

Drupal\ga
View source
class CommandRegistryService {

  /**
   * The registered analytics commands.
   *
   * @var \Drupal\ga\AnalyticsCommand\DrupalSettingCommandsInterface[]
   */
  protected $commands;

  /**
   * CommandRegistryService constructor.
   */
  public function __construct() {
    $this->commands = [];
  }

  /**
   * Add a command to the registry.
   *
   * @param \Drupal\ga\AnalyticsCommand\DrupalSettingCommandsInterface $command
   *   An analytics command.
   *
   * @deprecated Use addCommand() instead.
   */
  public function addItem(DrupalSettingCommandsInterface $command) {
    $this
      ->addCommand($command);
  }

  /**
   * Add a command to the registry.
   *
   * @param \Drupal\ga\AnalyticsCommand\DrupalSettingCommandsInterface $command
   *   An analytics command.
   */
  public function addCommand(DrupalSettingCommandsInterface $command) {
    $this->commands[] = $command;
  }

  /**
   * Get all commands registered.
   *
   * @return \Drupal\ga\AnalyticsCommand\DrupalSettingCommandsInterface[]
   *   The array of registered commands.
   */
  public function getCommands() {
    return $this->commands;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CommandRegistryService::$commands protected property The registered analytics commands.
CommandRegistryService::addCommand public function Add a command to the registry.
CommandRegistryService::addItem Deprecated public function Add a command to the registry.
CommandRegistryService::getCommands public function Get all commands registered.
CommandRegistryService::__construct public function CommandRegistryService constructor.