class AbstractHasDispatcher

Class that holds an event dispatcher

Hierarchy

Expanded class hierarchy of AbstractHasDispatcher

2 files declare their use of AbstractHasDispatcher
Client.php in drupal/core/vendor/guzzle/http/Guzzle/Http/Client.php
CurlMulti.php in drupal/core/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php

File

drupal/core/vendor/guzzle/common/Guzzle/Common/AbstractHasDispatcher.php, line 12

Namespace

Guzzle\Common
View source
class AbstractHasDispatcher implements HasDispatcherInterface {

  /**
   * @var EventDispatcherInterface
   */
  protected $eventDispatcher;

  /**
   * {@inheritdoc}
   */
  public static function getAllEvents() {
    return array();
  }

  /**
   * {@inheritdoc}
   */
  public function setEventDispatcher(EventDispatcherInterface $eventDispatcher) {
    $this->eventDispatcher = $eventDispatcher;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getEventDispatcher() {
    if (!$this->eventDispatcher) {
      $this->eventDispatcher = new EventDispatcher();
    }
    return $this->eventDispatcher;
  }

  /**
   * {@inheritdoc}
   */
  public function dispatch($eventName, array $context = array()) {
    $this
      ->getEventDispatcher()
      ->dispatch($eventName, new Event($context));
  }

  /**
   * {@inheritdoc}
   */
  public function addSubscriber(EventSubscriberInterface $subscriber) {
    $this
      ->getEventDispatcher()
      ->addSubscriber($subscriber);
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractHasDispatcher::$eventDispatcher protected property
AbstractHasDispatcher::addSubscriber public function Add an event subscriber to the dispatcher Overrides HasDispatcherInterface::addSubscriber
AbstractHasDispatcher::dispatch public function Helper to dispatch Guzzle events and set the event name on the event Overrides HasDispatcherInterface::dispatch
AbstractHasDispatcher::getAllEvents public static function Get a list of all of the events emitted from the class Overrides HasDispatcherInterface::getAllEvents 2
AbstractHasDispatcher::getEventDispatcher public function Get the EventDispatcher of the request Overrides HasDispatcherInterface::getEventDispatcher
AbstractHasDispatcher::setEventDispatcher public function Set the EventDispatcher of the request Overrides HasDispatcherInterface::setEventDispatcher