@@ -32,7 +32,9 @@ |
||
| 32 | 32 | $match => new Nodes\Key($nodeString, $line, $matches), |
| 33 | 33 | default => self::onCharacter($trimmed[0], $nodeString, $line) |
| 34 | 34 | }; |
| 35 | - if ($debug) echo $line . ":" . get_class($node) . "\n"; |
|
| 35 | + if ($debug) { |
|
| 36 | + echo $line . ":" . get_class($node) . "\n"; |
|
| 37 | + } |
|
| 36 | 38 | return $node; |
| 37 | 39 | } |
| 38 | 40 | |
@@ -26,8 +26,12 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function dumpScalar($dataType): string |
| 28 | 28 | { |
| 29 | - if ($dataType === \INF) return '.inf'; |
|
| 30 | - if ($dataType === -\INF) return '-.inf'; |
|
| 29 | + if ($dataType === \INF) { |
|
| 30 | + return '.inf'; |
|
| 31 | + } |
|
| 32 | + if ($dataType === -\INF) { |
|
| 33 | + return '-.inf'; |
|
| 34 | + } |
|
| 31 | 35 | $precision = "%." . $this->dumper->floatPrecision . "F"; |
| 32 | 36 | switch (gettype($dataType)) { |
| 33 | 37 | case 'boolean': |
@@ -51,7 +51,9 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function toString($dataType, ?int $options = null): string |
| 53 | 53 | { |
| 54 | - if (empty($dataType)) throw new \Exception(self::class . ": No content to convert to Yaml"); |
|
| 54 | + if (empty($dataType)) { |
|
| 55 | + throw new \Exception(self::class . ": No content to convert to Yaml"); |
|
| 56 | + } |
|
| 55 | 57 | if (is_scalar($dataType)) { |
| 56 | 58 | return "--- " . $this->handler->dumpScalar($dataType) . PHP_EOL; |
| 57 | 59 | } |
@@ -114,7 +116,7 @@ discard block |
||
| 114 | 116 | $pairs = []; |
| 115 | 117 | if (count($properties) === 0) { |
| 116 | 118 | return $this->handler->dumpArray($obj->getArrayCopy(), 0, false, true); |
| 117 | - }else { |
|
| 119 | + } else { |
|
| 118 | 120 | return $this->handler->dumpObject($obj, 0, false, true); |
| 119 | 121 | } |
| 120 | 122 | } |