You are here

class EventDispatcher in Currency 8.3

Provides a Currency event dispatcher.

Hierarchy

Expanded class hierarchy of EventDispatcher

1 file declares its use of EventDispatcher
EventDispatcherTest.php in tests/src/Unit/EventDispatcherTest.php
1 string reference to 'EventDispatcher'
currency.services.yml in ./currency.services.yml
currency.services.yml
1 service uses EventDispatcher
currency.event_dispatcher in ./currency.services.yml
Drupal\currency\EventDispatcher

File

src/EventDispatcher.php, line 12

Namespace

Drupal\currency
View source
class EventDispatcher implements EventDispatcherInterface {

  /**
   * The Symfony event dispatcher.
   *
   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
   */
  protected $symfonyEventDispatcher;

  /**
   * Constructs a new instance.
   *
   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $symfony_event_dispatcher
   */
  public function __construct(SymfonyEventDispatcherInterface $symfony_event_dispatcher) {
    $this->symfonyEventDispatcher = $symfony_event_dispatcher;
  }

  /**
   * {@inheritdoc}
   */
  public function resolveCountryCode() {
    $event = new ResolveCountryCode();
    $this->symfonyEventDispatcher
      ->dispatch(CurrencyEvents::RESOLVE_COUNTRY_CODE, $event);
    return $event
      ->getCountryCode();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EventDispatcher::$symfonyEventDispatcher protected property The Symfony event dispatcher.
EventDispatcher::resolveCountryCode public function Gets the current country code. Overrides EventDispatcherInterface::resolveCountryCode
EventDispatcher::__construct public function Constructs a new instance.