positivePattern = $patternList[0]; $this->negativePattern = $patternList[1]; $this->groupingUsed = (strpos($patternList[0], ',') !== false); if ($this->groupingUsed) { preg_match('/#+0/', $patternList[0], $primaryGroupMatches); $this->primaryGroupSize = $this->secondaryGroupSize = strlen($primaryGroupMatches[0]); $numberGroups = explode(',', $patternList[0]); if (count($numberGroups) > 2) { // This pattern has a distinct secondary group size. $this->secondaryGroupSize = strlen($numberGroups[1]); } } } /** * Gets the positive number pattern. * * Used to format positive numbers. * * @return string */ public function getPositivePattern() { return $this->positivePattern; } /** * Gets the negative number pattern. * * Used to format negative numbers. * * @return string */ public function getNegativePattern() { return $this->negativePattern; } /** * Gets whether grouping is used. * * Indicates that major digits should be grouped according to * group sizes, right-to-left. * * @return bool */ public function isGroupingUsed() { return $this->groupingUsed; } /** * Gets the primary group size. * * @return int|null */ public function getPrimaryGroupSize() { return $this->primaryGroupSize; } /** * Gets the secondary group size. * * @return int|null */ public function getSecondaryGroupSize() { return $this->secondaryGroupSize; } }