Passed
Push — master ( c4ae7b...dd077a )
by stéphane
01:37
created
sources/Dumper.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public static function toString($dataType, int $options = null):string
43 43
     {
44
-        if (is_null($dataType)) throw new \Exception(self::class.": No content to convert to Yaml");
44
+        if (is_null($dataType)) {
45
+            throw new \Exception(self::class.": No content to convert to Yaml");
46
+        }
45 47
         self::$options = is_int($options) ? $options : self::OPTIONS;
46 48
         self::$result = new DLL;
47 49
         if ($dataType instanceof YamlObject) {
@@ -83,8 +85,12 @@  discard block
 block discarded – undo
83 85
     private static function dump($dataType, int $indent)
84 86
     {
85 87
         if (is_scalar($dataType)) {
86
-            if ($dataType === \INF) return '.inf';
87
-            if ($dataType === -\INF) return '-.inf';
88
+            if ($dataType === \INF) {
89
+                return '.inf';
90
+            }
91
+            if ($dataType === -\INF) {
92
+                return '-.inf';
93
+            }
88 94
             switch (gettype($dataType)) {
89 95
                 case 'boolean': return $dataType ? 'true' : 'false';
90 96
                 case 'float': //fall through
@@ -106,7 +112,9 @@  discard block
 block discarded – undo
106 112
      */
107 113
     private static function dumpYamlObject(YamlObject $obj)
108 114
     {
109
-        if ($obj->hasDocStart() && self::$result instanceof DLL) self::$result->push("---");
115
+        if ($obj->hasDocStart() && self::$result instanceof DLL) {
116
+            self::$result->push("---");
117
+        }
110 118
         // self::dump($obj, 0);
111 119
         if (count($obj) > 0) {
112 120
             self::dumpArray($obj->getArrayCopy(), 0);
@@ -181,9 +189,13 @@  discard block
 block discarded – undo
181 189
                 self::add(self::dump($obj->value, $indent + self::INDENT), $indent + self::INDENT);
182 190
             }
183 191
         }
184
-        if ($obj instanceof Compact) return self::dumpCompact($obj, $indent);
192
+        if ($obj instanceof Compact) {
193
+            return self::dumpCompact($obj, $indent);
194
+        }
185 195
         //TODO:  consider dumping datetime as date strings according to a format provided by user or default
186
-        if ($obj instanceof \DateTime) return $obj->format(self::DATE_FORMAT);
196
+        if ($obj instanceof \DateTime) {
197
+            return $obj->format(self::DATE_FORMAT);
198
+        }
187 199
         $propList = get_object_vars($obj);
188 200
         foreach ($propList as $property => $value) {
189 201
             if (is_scalar($value) || $value instanceof Compact || $value instanceof \DateTime) {
Please login to merge, or discard this patch.