@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function add(NodeGeneric $child):NodeGeneric |
| 56 | 56 | { |
| 57 | - if ($this->value instanceof NodeGeneric && $this->value->isOneOf('Literal','LiteralFolded', 'Anchor')) { |
|
| 57 | + if ($this->value instanceof NodeGeneric && $this->value->isOneOf('Literal', 'LiteralFolded', 'Anchor')) { |
|
| 58 | 58 | return $this->value->add($child); |
| 59 | 59 | } else { |
| 60 | 60 | return parent::add($child); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | if (is_null($this->value) || $node instanceof Comment) { |
| 86 | 86 | return true; |
| 87 | - } elseif($this->value instanceof NodeGeneric) { |
|
| 87 | + } elseif ($this->value instanceof NodeGeneric) { |
|
| 88 | 88 | $current = $this->value; |
| 89 | 89 | } else { |
| 90 | 90 | $current = $this->value->current(); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | && !($child instanceof Directive) |
| 65 | 65 | && !($child instanceof Blank) |
| 66 | 66 | && !($child instanceof Docstart |
| 67 | - && is_null($child->value)) ) return true; |
|
| 67 | + && is_null($child->value))) return true; |
|
| 68 | 68 | } |
| 69 | 69 | return false; |
| 70 | 70 | } |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | public function push($node) |
| 73 | 73 | { |
| 74 | 74 | $type = null; |
| 75 | - if ($node instanceof Item ) { |
|
| 75 | + if ($node instanceof Item) { |
|
| 76 | 76 | $type = self::SEQUENCE; |
| 77 | 77 | } elseif ($node instanceof Key) { |
| 78 | 78 | $type = self::MAPPING; |
| 79 | - } elseif ($node->isOneOf('SetKey','SetValue')) { |
|
| 79 | + } elseif ($node->isOneOf('SetKey', 'SetValue')) { |
|
| 80 | 80 | $type = self::SET; |
| 81 | - } elseif ($node instanceof Scalar){ |
|
| 81 | + } elseif ($node instanceof Scalar) { |
|
| 82 | 82 | $type = self::MULTILINE; |
| 83 | 83 | } |
| 84 | 84 | if (!is_null($type) && $this->checkTypeCoherence($type)) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $output = trim($first->raw); |
| 142 | 142 | foreach ($list as $child) { |
| 143 | 143 | if ($child instanceof Scalar) { |
| 144 | - $separator = isset($output[-1]) && $output[-1] === "\n" ? '' : ' '; |
|
| 144 | + $separator = isset($output[-1]) && $output[-1] === "\n" ? '' : ' '; |
|
| 145 | 145 | $output .= $separator.trim($child->raw); |
| 146 | 146 | } elseif ($child instanceof Blank) { |
| 147 | 147 | $output .= "\n"; |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | if ($child instanceof Comment) { |
| 168 | 168 | // $child->build(); |
| 169 | 169 | } else { |
| 170 | - if($child->value instanceof Comment) { |
|
| 170 | + if ($child->value instanceof Comment) { |
|
| 171 | 171 | // $child->value->build(); |
| 172 | 172 | // $child->value = null; |
| 173 | - } elseif($child->value instanceof NodeList) { |
|
| 173 | + } elseif ($child->value instanceof NodeList) { |
|
| 174 | 174 | $child->value = $child->value->filterComment(); |
| 175 | 175 | } |
| 176 | 176 | $out->push($child); |
@@ -50,7 +50,9 @@ discard block |
||
| 50 | 50 | $tmp->rewind(); |
| 51 | 51 | $fqn = __NAMESPACE__."\\Nodes\\$nodeType"; |
| 52 | 52 | foreach ($tmp as $child) { |
| 53 | - if ($child instanceof $fqn) return true; |
|
| 53 | + if ($child instanceof $fqn) { |
|
| 54 | + return true; |
|
| 55 | + } |
|
| 54 | 56 | } |
| 55 | 57 | return false; |
| 56 | 58 | } |
@@ -64,7 +66,9 @@ discard block |
||
| 64 | 66 | && !($child instanceof Directive) |
| 65 | 67 | && !($child instanceof Blank) |
| 66 | 68 | && !($child instanceof Docstart |
| 67 | - && is_null($child->value)) ) return true; |
|
| 69 | + && is_null($child->value)) ) { |
|
| 70 | + return true; |
|
| 71 | + } |
|
| 68 | 72 | } |
| 69 | 73 | return false; |
| 70 | 74 | } |