diff --git a/composer.json b/composer.json index d973284..a6ecbf4 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ "require": { "php": "^7.4 || ^8.0", "ext-dom": "*", - "ext-libxml": "*" + "ext-libxml": "*", + "ext-intl": "*" }, "authors": [ { diff --git a/src/CFPropertyList/CFNumber.php b/src/CFPropertyList/CFNumber.php index f2b6518..2d303a5 100644 --- a/src/CFPropertyList/CFNumber.php +++ b/src/CFPropertyList/CFNumber.php @@ -45,8 +45,7 @@ namespace CFPropertyList; use \DOMDocument; -use \Iterator; -use \ArrayAccess; +use \NumberFormatter; /** * Number Type of CFPropertyList @@ -68,7 +67,13 @@ public function toXML(DOMDocument $doc, $nodeName = "") $this->value = intval($this->value); $ret = 'integer'; } - return parent::toXML($doc, $ret); + $formatter = new NumberFormatter('en_US', NumberFormatter::DECIMAL); + $formatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, 10); + $formatter->setAttribute(NumberFormatter::GROUPING_USED, false); + $text = $doc->createTextNode($formatter->format($this->value)); + $node = $doc->createElement($ret); + $node->appendChild($text); + return $node; } /**