public function __construct($localeIdentifier)
{
if (!is_string($localeIdentifier)) {
throw new \InvalidArgumentException('A locale identifier must be of type string, ' . gettype($localeIdentifier) . ' given.', 1221216120);
}
if (preg_match(self::PATTERN_MATCH_LOCALEIDENTIFIER, $localeIdentifier, $matches) !== 1) {
throw new Exception\InvalidLocaleIdentifierException('"' . $localeIdentifier . '" is not a valid locale identifier.', 1221137814);
}
$this->language = strtolower($matches['language']);
if (!empty($matches['script'])) {
$this->script = ucfirst(strtolower($matches['script']));
}
if (!empty($matches['region'])) {
$this->region = strtoupper($matches['region']);
}
if (!empty($matches['variant'])) {
$this->variant = strtoupper($matches['variant']);
}
}