new features
[plcapi.git] / src / Value.php
index fa402a5..2627e58 100644 (file)
@@ -261,7 +261,7 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
                         // sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
                         // The code below tries its best at keeping max precision while avoiding exp notation,
                         // but there is of course no limit in the number of decimal places to be used...
-                        $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, 128, '.', '')) . "</${typ}>";
+                        $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</${typ}>";
                         break;
                     case static::$xmlrpcDateTime:
                         if (is_string($val)) {
@@ -499,7 +499,8 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
      *
      * @return \ArrayIterator
      */
-    public function getIterator() {
+    public function getIterator()
+    {
         switch ($this->mytype) {
             case 3:
                 return new \ArrayIterator($this->me['struct']);
@@ -512,8 +513,8 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
         }
     }
 
-    public function offsetSet($offset, $value) {
-
+    public function offsetSet($offset, $value)
+    {
         switch ($this->mytype) {
             case 3:
                 if (!($value instanceof \PhpXmlRpc\Value)) {
@@ -552,7 +553,8 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
         }
     }
 
-    public function offsetExists($offset) {
+    public function offsetExists($offset)
+    {
         switch ($this->mytype) {
             case 3:
                 return isset($this->me['struct'][$offset]);
@@ -566,7 +568,8 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
         }
     }
 
-    public function offsetUnset($offset) {
+    public function offsetUnset($offset)
+    {
         switch ($this->mytype) {
             case 3:
                 unset($this->me['struct'][$offset]);
@@ -582,7 +585,8 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
         }
     }
 
-    public function offsetGet($offset) {
+    public function offsetGet($offset)
+    {
         switch ($this->mytype) {
             case 3:
                 return isset($this->me['struct'][$offset]) ? $this->me['struct'][$offset] : null;