Completed
Push — master ( d95e42...809c98 )
by stéphane
02:23
created
yaml/Builder.php 1 patch
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -70,7 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     private static function build(object $node, &$parent = null)
72 72
     {
73
-        if ($node instanceof NodeList) return self::buildNodeList($node, $parent);
73
+        if ($node instanceof NodeList) {
74
+            return self::buildNodeList($node, $parent);
75
+        }
74 76
         return self::buildNode($node, $parent);
75 77
     }
76 78
 
@@ -152,7 +154,9 @@  discard block
 block discarded – undo
152 154
     private static function handleReference($node, $parent)
153 155
     {
154 156
         $tmp = is_null($node->value) ? null : self::build($node->value, $parent);
155
-        if ($node->type === Y::REF_DEF) self::$_root->addReference($node->identifier, $tmp);
157
+        if ($node->type === Y::REF_DEF) {
158
+            self::$_root->addReference($node->identifier, $tmp);
159
+        }
156 160
         return self::$_root->getReference($node->identifier);
157 161
     }
158 162
 
@@ -240,7 +244,9 @@  discard block
 block discarded – undo
240 244
         $list->rewind();
241 245
         $refIndent = $list->current()->indent;
242 246
         //remove trailing blank
243
-        while ($list->top()->type & Y::BLANK) $list->pop();
247
+        while ($list->top()->type & Y::BLANK) {
248
+            $list->pop();
249
+        }
244 250
         $result = '';
245 251
         $separator = [ Y::RAW => '', Y::LITT => "\n", Y::LITT_FOLDED => ' '][$type];
246 252
         foreach ($list as $child) {
@@ -257,10 +263,12 @@  discard block
 block discarded – undo
257 263
     {
258 264
         $val = $child->type & (Y::SCALAR) ? $child->value : substr($child->raw, $refIndent);
259 265
         if ($type & Y::LITT_FOLDED && ($child->indent > $refIndent || ($child->type & Y::BLANK))) {
260
-            if ($result[-1] === $separator)
261
-                $result[-1] = "\n";
262
-            if ($result[-1] === "\n")
263
-                $result .= $val;
266
+            if ($result[-1] === $separator) {
267
+                            $result[-1] = "\n";
268
+            }
269
+            if ($result[-1] === "\n") {
270
+                            $result .= $val;
271
+            }
264 272
             return;
265 273
         }
266 274
         $result .= $val.$separator;
@@ -279,7 +287,9 @@  discard block
 block discarded – undo
279 287
         $built = is_object($node->value) ? self::build($node->value) : null;
280 288
         $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" '): $built;
281 289
         $key = json_encode($stringKey, JSON_PARTIAL_OUTPUT_ON_ERROR|JSON_UNESCAPED_SLASHES);
282
-        if (empty($key)) throw new \Exception("Cant serialize complex key: ".var_export($node->value, true), 1);
290
+        if (empty($key)) {
291
+            throw new \Exception("Cant serialize complex key: ".var_export($node->value, true), 1);
292
+        }
283 293
         $parent->{trim($key, '\'" ')} = null;
284 294
     }
285 295
 
Please login to merge, or discard this patch.