From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- .../intl/src/Formatter/ParsedPattern.php | 129 +++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 vendor/commerceguys/intl/src/Formatter/ParsedPattern.php (limited to 'vendor/commerceguys/intl/src/Formatter/ParsedPattern.php') diff --git a/vendor/commerceguys/intl/src/Formatter/ParsedPattern.php b/vendor/commerceguys/intl/src/Formatter/ParsedPattern.php new file mode 100644 index 000000000..aa6e5f43e --- /dev/null +++ b/vendor/commerceguys/intl/src/Formatter/ParsedPattern.php @@ -0,0 +1,129 @@ +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; + } +} -- cgit v1.2.3