@@ -22,8 +22,12 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function dumpScalar($dataType):string |
| 24 | 24 | { |
| 25 | - if ($dataType === \INF) return '.inf'; |
|
| 26 | - if ($dataType === -\INF) return '-.inf'; |
|
| 25 | + if ($dataType === \INF) { |
|
| 26 | + return '.inf'; |
|
| 27 | + } |
|
| 28 | + if ($dataType === -\INF) { |
|
| 29 | + return '-.inf'; |
|
| 30 | + } |
|
| 27 | 31 | $precision = "%.".$this->dumper->floatPrecision."F"; |
| 28 | 32 | switch (gettype($dataType)) { |
| 29 | 33 | case 'boolean': return $dataType ? 'true' : 'false'; |
@@ -48,7 +48,9 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | public function toString($dataType, int $options = null):string |
| 50 | 50 | { |
| 51 | - if (empty($dataType)) throw new \Exception(self::class.": No content to convert to Yaml"); |
|
| 51 | + if (empty($dataType)) { |
|
| 52 | + throw new \Exception(self::class.": No content to convert to Yaml"); |
|
| 53 | + } |
|
| 52 | 54 | if (is_scalar($dataType)) { |
| 53 | 55 | return "--- ".$this->handler->dumpScalar($dataType). self::LINEFEED ; |
| 54 | 56 | } |