You are here

final class Country in Commerce Core 8.2

Represents a country.

Hierarchy

Expanded class hierarchy of Country

2 files declare their use of Country
DefaultCountryResolver.php in src/Resolver/DefaultCountryResolver.php
StoreCountryResolver.php in modules/store/src/Resolver/StoreCountryResolver.php
4 string references to 'Country'
CountryCacheContext::getLabel in src/Cache/Context/CountryCacheContext.php
Returns the label of the cache context.
PaymentCheckoutTest::testManualWithoutBilling in modules/payment/tests/src/FunctionalJavascript/PaymentCheckoutTest.php
Tests checkout with a manual gateway, without billing information.
PaymentMethodTest::testPaymentMethodCreationAndUpdateWithoutBilling in modules/payment/tests/src/Functional/PaymentMethodTest.php
Tests creating and updating a payment method without billing information.
TaxNumberTest::testWidget in modules/tax/tests/src/FunctionalJavascript/TaxNumberTest.php
Tests the widget.

File

src/Country.php, line 8

Namespace

Drupal\commerce
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(string $country_code) {
    $this->countryCode = strtoupper($country_code);
  }

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

  /**
   * Gets the string representation of the country.
   *
   * @return string
   *   The string representation of the country
   */
  public function __toString() : string {
    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.