You are here

final class Psr14Bridge in Search API Solr 8

Same name and namespace in other branches
  1. 4.x src/Solarium/EventDispatcher/Psr14Bridge.php \Drupal\search_api_solr\Solarium\EventDispatcher\Psr14Bridge

A helper to decorate the legacy EventDispatcherInterface::dispatch().

Hierarchy

  • class \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher implements \Symfony\Component\EventDispatcher\EventDispatcherInterface
    • class \Drupal\search_api_solr\Solarium\EventDispatcher\Psr14Bridge implements \Psr\EventDispatcher\EventDispatcherInterface

Expanded class hierarchy of Psr14Bridge

1 file declares its use of Psr14Bridge
SolrConnectorPluginBase.php in src/SolrConnector/SolrConnectorPluginBase.php

File

src/Solarium/EventDispatcher/Psr14Bridge.php, line 12

Namespace

Drupal\search_api_solr\Solarium\EventDispatcher
View source
final class Psr14Bridge extends ContainerAwareEventDispatcher implements EventDispatcherInterface {

  /**
   * @var \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher
   */
  protected $dispatcher;
  public function __construct() {
    $this->dispatcher = \Drupal::service('event_dispatcher');
  }
  public function dispatch($event, Event $null = NULL) {
    if (\is_object($event)) {
      return $this->dispatcher
        ->dispatch(\get_class($event), new EventProxy($event));
    }
    return $this->dispatcher
      ->dispatch($event, $null);
  }
  public function addListener($event_name, $listener, $priority = 0) {
    $this->dispatcher
      ->addListener($event_name, $listener, $priority);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContainerAwareEventDispatcher::$container protected property The service container.
ContainerAwareEventDispatcher::$listeners protected property Listener definitions.
ContainerAwareEventDispatcher::$unsorted protected property Whether listeners need to be sorted prior to dispatch, keyed by event name.
ContainerAwareEventDispatcher::addSubscriber public function Adds an event subscriber.
ContainerAwareEventDispatcher::getListenerPriority public function
ContainerAwareEventDispatcher::getListeners public function Gets the listeners of a specific event or all listeners sorted by descending priority.
ContainerAwareEventDispatcher::hasListeners public function Checks whether an event has any registered listeners.
ContainerAwareEventDispatcher::removeListener public function Removes an event listener from the specified events.
ContainerAwareEventDispatcher::removeSubscriber public function Removes an event subscriber.
Psr14Bridge::$dispatcher protected property
Psr14Bridge::addListener public function Adds an event listener that listens on the specified events. Overrides ContainerAwareEventDispatcher::addListener
Psr14Bridge::dispatch public function Dispatches an event to all registered listeners. Overrides ContainerAwareEventDispatcher::dispatch
Psr14Bridge::__construct public function Constructs a container aware event dispatcher. Overrides ContainerAwareEventDispatcher::__construct