You are here

Country.php in Price 8

Namespace

Drupal\price

File

src/Country.php
View source
<?php

namespace Drupal\price;


/**
 * Represents a country.
 */
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;
  }

}

Classes

Namesort descending Description
Country Represents a country.