You are here

final class Country in Price 3.x

Same name and namespace in other branches
  1. 8 src/Country.php \Drupal\price\Country
  2. 2.0.x src/Country.php \Drupal\price\Country
  3. 2.x src/Country.php \Drupal\price\Country
  4. 3.0.x src/Country.php \Drupal\price\Country

Represents a country.

Hierarchy

Expanded class hierarchy of Country

1 file declares its use of Country
DefaultCountryResolver.php in src/Resolver/DefaultCountryResolver.php
1 string reference to 'Country'
CountryCacheContext::getLabel in src/Cache/Context/CountryCacheContext.php
Returns the label of the cache context.

File

src/Country.php, line 8

Namespace

Drupal\price
View source
final class Country {

  /**
   * Two-letter country code.
   *
   * @var string
   */
  protected $countryCode;

  /**
   * Constructs a new Country object.
   *
   * @param string $country_code
   *   The country code.
   */
  public function __construct($country_code) {
    $this->countryCode = strtoupper($country_code);
  }

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

  /**
   * Gets the string representation of the country.
   *
   * @return string
   *   The string representation of the country
   */
  public function __toString() {
    return $this->countryCode;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Country::$countryCode protected property Two-letter country code.
Country::getCountryCode public function Gets the country code.
Country::__construct public function Constructs a new Country object.
Country::__toString public function Gets the string representation of the country.