@@ -21,7 +21,9 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function __construct(int $options = null) |
| 23 | 23 | { |
| 24 | - if (is_int($options)) self::$options = $options; |
|
| 24 | + if (is_int($options)) { |
|
| 25 | + self::$options = $options; |
|
| 26 | + } |
|
| 25 | 27 | } |
| 26 | 28 | |
| 27 | 29 | /** |
@@ -36,7 +38,9 @@ discard block |
||
| 36 | 38 | */ |
| 37 | 39 | public static function toString($dataType, int $options):string |
| 38 | 40 | { |
| 39 | - if (is_null($dataType)) throw new \Exception(self::class.": No content to convert to Yaml", 1); |
|
| 41 | + if (is_null($dataType)) { |
|
| 42 | + throw new \Exception(self::class.": No content to convert to Yaml", 1); |
|
| 43 | + } |
|
| 40 | 44 | self::$options = is_int($options) ? $options : self::OPTIONS; |
| 41 | 45 | self::$result = new DLL; |
| 42 | 46 | self::$result->setIteratorMode(DLL::IT_MODE_FIFO | DLL::IT_MODE_DELETE); |
@@ -74,8 +78,12 @@ discard block |
||
| 74 | 78 | if (is_scalar($dataType)) { |
| 75 | 79 | switch (gettype($dataType)) { |
| 76 | 80 | case 'boolean': return $dataType ? 'true' : 'false'; |
| 77 | - case 'float': if (is_infinite((float) $dataType)) return $dataType > 0 ? '.inf' : '-.inf'; |
|
| 78 | - case 'double': if (is_nan((float) $dataType)) return '.nan'; |
|
| 81 | + case 'float': if (is_infinite((float) $dataType)) { |
|
| 82 | + return $dataType > 0 ? '.inf' : '-.inf'; |
|
| 83 | + } |
|
| 84 | + case 'double': if (is_nan((float) $dataType)) { |
|
| 85 | + return '.nan'; |
|
| 86 | + } |
|
| 79 | 87 | default: |
| 80 | 88 | return $dataType; |
| 81 | 89 | } |
@@ -9,15 +9,15 @@ |
||
| 9 | 9 | class Compact extends \ArrayIterator implements \JsonSerializable |
| 10 | 10 | { |
| 11 | 11 | // private static $value; |
| 12 | - // public function __construct($argument) |
|
| 13 | - // { |
|
| 14 | - // self::$value = $argument; |
|
| 15 | - // // if ($argument instanceof \Countable && count($argument) > 0) { |
|
| 16 | - // // # it's an array-like |
|
| 17 | - // // } else { |
|
| 18 | - // // //it's an object-like |
|
| 19 | - // // } |
|
| 20 | - // } |
|
| 12 | + // public function __construct($argument) |
|
| 13 | + // { |
|
| 14 | + // self::$value = $argument; |
|
| 15 | + // // if ($argument instanceof \Countable && count($argument) > 0) { |
|
| 16 | + // // # it's an array-like |
|
| 17 | + // // } else { |
|
| 18 | + // // //it's an object-like |
|
| 19 | + // // } |
|
| 20 | + // } |
|
| 21 | 21 | // |
| 22 | 22 | public function __construct() |
| 23 | 23 | { |