@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function __construct(int $options = null) |
| 27 | 27 | { |
| 28 | - if (is_int($options)) $this->options = $options; |
|
| 28 | + if (is_int($options)) { |
|
| 29 | + $this->options = $options; |
|
| 30 | + } |
|
| 29 | 31 | } |
| 30 | 32 | |
| 31 | 33 | |
@@ -45,8 +47,12 @@ discard block |
||
| 45 | 47 | |
| 46 | 48 | public function dumpScalar($dataType):string |
| 47 | 49 | { |
| 48 | - if ($dataType === \INF) return '.inf'; |
|
| 49 | - if ($dataType === -\INF) return '-.inf'; |
|
| 50 | + if ($dataType === \INF) { |
|
| 51 | + return '.inf'; |
|
| 52 | + } |
|
| 53 | + if ($dataType === -\INF) { |
|
| 54 | + return '-.inf'; |
|
| 55 | + } |
|
| 50 | 56 | $precision = "%.".$this->floatPrecision."F"; |
| 51 | 57 | switch (gettype($dataType)) { |
| 52 | 58 | case 'boolean': return $dataType ? 'true' : 'false'; |
@@ -77,9 +83,13 @@ discard block |
||
| 77 | 83 | } elseif (is_iterable($compound)) { |
| 78 | 84 | $iterator = $compound; |
| 79 | 85 | } elseif (is_object($compound)) { |
| 80 | - if ($compound instanceof Tagged) return $this->dumpTagged($compound, $indent); |
|
| 86 | + if ($compound instanceof Tagged) { |
|
| 87 | + return $this->dumpTagged($compound, $indent); |
|
| 88 | + } |
|
| 81 | 89 | //TODO: consider dumping datetime as date strings according to a format provided by user |
| 82 | - if ($compound instanceof \DateTime) return $compound->format(self::DATE_FORMAT); |
|
| 90 | + if ($compound instanceof \DateTime) { |
|
| 91 | + return $compound->format(self::DATE_FORMAT); |
|
| 92 | + } |
|
| 83 | 93 | $iterator = new \ArrayIterator(get_object_vars($compound)); |
| 84 | 94 | } |
| 85 | 95 | return $this->iteratorToString($iterator, $mask, $indent); |