Test Failed
Branch master (44c6e4)
by stéphane
09:11
created
yaml/Builder.php 1 patch
Braces   +27 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,10 +42,14 @@  discard block
 block discarded – undo
42 42
         }
43 43
         $_root->value instanceof NodeList && $_root->value->setIteratorMode(NodeList::IT_MODE_DELETE);
44 44
         foreach ($_root->value as $child) {
45
-            if ($child->type & Y::DOC_START) $totalDocStart++;
45
+            if ($child->type & Y::DOC_START) {
46
+                $totalDocStart++;
47
+            }
46 48
             //if 0 or 1 DOC_START = we are still in first document
47 49
             $currentDoc = $totalDocStart > 1 ? $totalDocStart - 1 : 0;
48
-            if (!isset($documents[$currentDoc])) $documents[$currentDoc] = new NodeList();
50
+            if (!isset($documents[$currentDoc])) {
51
+                $documents[$currentDoc] = new NodeList();
52
+            }
49 53
             $documents[$currentDoc]->push($child);
50 54
         }
51 55
         $content = [];
@@ -70,7 +74,9 @@  discard block
 block discarded – undo
70 74
      */
71 75
     private static function build(object $node, &$parent = null)
72 76
     {
73
-        if ($node instanceof NodeList) return self::buildNodeList($node, $parent);
77
+        if ($node instanceof NodeList) {
78
+            return self::buildNodeList($node, $parent);
79
+        }
74 80
         return self::buildNode($node, $parent);
75 81
     }
76 82
 
@@ -133,13 +139,17 @@  discard block
 block discarded – undo
133 139
             } else {
134 140
                 $tmp = Node2PHP::get($node);
135 141
             }
136
-            if ($type === Y::REF_DEF) self::$_root->addReference($identifier, $tmp);
142
+            if ($type === Y::REF_DEF) {
143
+                self::$_root->addReference($identifier, $tmp);
144
+            }
137 145
             return self::$_root->getReference($identifier);
138 146
         }
139 147
         if ($type & (Y::COMPACT_MAPPING|Y::COMPACT_SEQUENCE)) {
140 148
             return self::buildNodeList($node->value, $parent);
141 149
         }
142
-        if ($type & Y::COMMENT) self::$_root->addComment($node->line, $node->value);
150
+        if ($type & Y::COMMENT) {
151
+            self::$_root->addComment($node->line, $node->value);
152
+        }
143 153
         $typesActions = [Y::DIRECTIVE => 'buildDirective',
144 154
                          Y::ITEM      => 'buildItem',
145 155
                          Y::KEY       => 'buildKey',
@@ -254,18 +264,24 @@  discard block
 block discarded – undo
254 264
         }
255 265
         $result = '';
256 266
         $separator = '';
257
-        if ($type & Y::LITT)         $separator = "\n";
258
-        if ($type & Y::LITT_FOLDED)  $separator = ' ';
267
+        if ($type & Y::LITT) {
268
+            $separator = "\n";
269
+        }
270
+        if ($type & Y::LITT_FOLDED) {
271
+            $separator = ' ';
272
+        }
259 273
         foreach ($list as $child) {
260 274
             if ($child->value instanceof NodeList) {
261 275
                 $result .= self::buildLitteral($child->value, $type).$separator;
262 276
             } else {
263 277
                 $val = $child->type & (Y::SCALAR|Y::BLANK) ? $child->value : substr($child->raw, $refIndent);
264 278
                 if ($type & Y::LITT_FOLDED && ($child->indent > $refIndent || ($child->type & Y::BLANK))) {
265
-                    if ($result[-1] === $separator)
266
-                        $result[-1] = "\n";
267
-                    if ($result[-1] === "\n")
268
-                        $result .= $val;
279
+                    if ($result[-1] === $separator) {
280
+                                            $result[-1] = "\n";
281
+                    }
282
+                    if ($result[-1] === "\n") {
283
+                                            $result .= $val;
284
+                    }
269 285
                     continue;
270 286
                 }
271 287
                 $result .= $val.$separator;
Please login to merge, or discard this patch.