@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | private static function buildNodeList(NodeList $node, &$parent) |
| 45 | 45 | { |
| 46 | - if ($node->type & (Y::RAW | Y::LITTERALS)) { |
|
| 46 | + if ($node->type & (Y::RAW|Y::LITTERALS)) { |
|
| 47 | 47 | return self::buildLitteral($node, $node->type); |
| 48 | 48 | } |
| 49 | 49 | $p = $parent; |
| 50 | 50 | switch ($node->type) { |
| 51 | 51 | case Y::MAPPING: //fall through |
| 52 | 52 | case Y::SET: $p = new \StdClass; break; |
| 53 | - case Y::SEQUENCE: $p = [];break; |
|
| 53 | + case Y::SEQUENCE: $p = []; break; |
|
| 54 | 54 | // case Y::KEY: $p = $parent;break; |
| 55 | 55 | } |
| 56 | 56 | $out = null; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | private static function buildNode(Node $node, &$parent) |
| 79 | 79 | { |
| 80 | 80 | extract((array) $node, EXTR_REFS); |
| 81 | - if ($type & (Y::REF_DEF | Y::REF_CALL)) { |
|
| 81 | + if ($type&(Y::REF_DEF|Y::REF_CALL)) { |
|
| 82 | 82 | if (is_object($value)) { |
| 83 | 83 | $tmp = self::build($value, $parent) ?? $parent; |
| 84 | 84 | } else { |
@@ -193,15 +193,15 @@ discard block |
||
| 193 | 193 | { |
| 194 | 194 | self::$_root = new YamlObject(); |
| 195 | 195 | $childTypes = $list->getTypes(); |
| 196 | - $isaMapping = (bool) (Y::KEY | Y::MAPPING) & $childTypes; |
|
| 196 | + $isaMapping = (bool) (Y::KEY|Y::MAPPING)&$childTypes; |
|
| 197 | 197 | $isaSequence = (bool) Y::ITEM & $childTypes; |
| 198 | 198 | $isaSet = (bool) Y::SET_VALUE & $childTypes; |
| 199 | 199 | if ($isaMapping && $isaSequence) { |
| 200 | 200 | throw new \ParseError(sprintf(self::INVALID_DOCUMENT, $key)); |
| 201 | 201 | } else { |
| 202 | 202 | switch (true) { |
| 203 | - case $isaSequence: $list->type = Y::SEQUENCE;break; |
|
| 204 | - case $isaSet: $list->type = Y::SET;break; |
|
| 203 | + case $isaSequence: $list->type = Y::SEQUENCE; break; |
|
| 204 | + case $isaSet: $list->type = Y::SET; break; |
|
| 205 | 205 | default: $list->type = Y::MAPPING; |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -236,15 +236,15 @@ discard block |
||
| 236 | 236 | $lines[] = self::buildLitteral($child->value, $type); |
| 237 | 237 | } else { |
| 238 | 238 | $prefix = ''; |
| 239 | - if ($type & Y::LITT_FOLDED && ($child->indent > $refIndent || ($child->type & Y::BLANK))) { |
|
| 239 | + if ($type&Y::LITT_FOLDED && ($child->indent > $refIndent || ($child->type & Y::BLANK))) { |
|
| 240 | 240 | $prefix = "\n"; |
| 241 | 241 | } |
| 242 | 242 | $lines[] = $prefix.$child->value; |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | - if ($type & Y::RAW) return implode('', $lines); |
|
| 246 | - if ($type & Y::LITT) return implode("\n", $lines); |
|
| 247 | - if ($type & Y::LITT_FOLDED) return implode(' ', $lines); |
|
| 245 | + if ($type&Y::RAW) return implode('', $lines); |
|
| 246 | + if ($type&Y::LITT) return implode("\n", $lines); |
|
| 247 | + if ($type&Y::LITT_FOLDED) return implode(' ', $lines); |
|
| 248 | 248 | return ''; |
| 249 | 249 | } |
| 250 | 250 | |