You are here

final class HookEventDispatcherManager in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 8 src/Manager/HookEventDispatcherManager.php \Drupal\hook_event_dispatcher\Manager\HookEventDispatcherManager
  2. 3.x src/Manager/HookEventDispatcherManager.php \Drupal\hook_event_dispatcher\Manager\HookEventDispatcherManager

Class HookEventDispatcherManager.

Wrapper class for the external dispatcher dependency. If this ever changes we only have to change it once.

Hierarchy

Expanded class hierarchy of HookEventDispatcherManager

1 file declares its use of HookEventDispatcherManager
HookEventDispatcherManagerTest.php in tests/src/Unit/Manager/HookEventDispatcherManagerTest.php
1 string reference to 'HookEventDispatcherManager'
hook_event_dispatcher.services.yml in ./hook_event_dispatcher.services.yml
hook_event_dispatcher.services.yml
1 service uses HookEventDispatcherManager
hook_event_dispatcher.manager in ./hook_event_dispatcher.services.yml
Drupal\hook_event_dispatcher\Manager\HookEventDispatcherManager

File

src/Manager/HookEventDispatcherManager.php, line 15

Namespace

Drupal\hook_event_dispatcher\Manager
View source
final class HookEventDispatcherManager implements HookEventDispatcherManagerInterface {

  /**
   * The event dispatcher.
   *
   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
   */
  private $eventDispatcher;

  /**
   * EntityDispatcherManager constructor.
   *
   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
   *   The event dispatcher.
   */
  public function __construct(EventDispatcherInterface $eventDispatcher) {
    $this->eventDispatcher = $eventDispatcher;
  }

  /**
   * {@inheritdoc}
   */
  public function register(EventInterface $event) : Event {
    return $this->eventDispatcher
      ->dispatch($event
      ->getDispatcherType(), $event);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
HookEventDispatcherManager::$eventDispatcher private property The event dispatcher.
HookEventDispatcherManager::register public function Registers an event dispatcher for given entity. Overrides HookEventDispatcherManagerInterface::register
HookEventDispatcherManager::__construct public function EntityDispatcherManager constructor.