You are here

class ResolveCountryCode in Currency 8.3

Provides an event to resolve the current country code.

Hierarchy

  • class \Drupal\currency\Event\ResolveCountryCode extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of ResolveCountryCode

See also

\Drupal\currency\Event\CurrencyEvents::RESOLVE_COUNTRY_CODE

3 files declare their use of ResolveCountryCode
EventDispatcher.php in src/EventDispatcher.php
EventDispatcherTest.php in tests/src/Unit/EventDispatcherTest.php
ResolveCountryCodeTest.php in tests/src/Unit/Event/ResolveCountryCodeTest.php

File

src/Event/ResolveCountryCode.php, line 12

Namespace

Drupal\currency\Event
View source
class ResolveCountryCode extends Event {

  /**
   * The country code.
   *
   * @var string
   */
  protected $countryCode;

  /**
   * Sets the country code.
   *
   * @return $this
   */
  public function setCountryCode($country_code) {

    // We only want to stop propagation if an actual value was set. Setting an
    // empty value is allowed, but should not have consequences for event
    // propagation.
    if (!empty($country_code)) {
      $this->countryCode = $country_code;
      $this
        ->stopPropagation();
    }
    return $this;
  }

  /**
   * Gets the country code.
   *
   * @return string
   */
  public function getCountryCode() {
    return $this->countryCode;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ResolveCountryCode::$countryCode protected property The country code.
ResolveCountryCode::getCountryCode public function Gets the country code.
ResolveCountryCode::setCountryCode public function Sets the country code.