Locale.php 755 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
<?php

namespace Drupal\commerce;

/**
 * Represents a locale.
 */
final class Locale {

  /**
11
   * The locale.
12 13 14 15 16 17 18 19
   *
   * @var string
   */
  protected $localeCode;

  /**
   * Constructs a new Locale object.
   *
20
   * @param string $locale_code
21 22
   *   The locale code.
   */
23
  public function __construct(string $locale_code) {
24
    $this->localeCode = $locale_code;
25 26 27 28 29 30
  }

  /**
   * Gets the locale code.
   *
   * @return string
31
   *   The locale code.
32
   */
33
  public function getLocaleCode() : string {
34 35 36 37 38 39 40
    return $this->localeCode;
  }

  /**
   * Gets the string representation of the locale.
   *
   * @return string
41
   *   The string representation of the locale.
42
   */
43
  public function __toString() : string {
44 45 46 47
    return $this->localeCode;
  }

}