@@ -69,7 +69,7 @@ |
||
69 | 69 | return $this->_anchors[$name]; |
70 | 70 | } |
71 | 71 | throw new \UnexpectedValueException(sprintf(self::UNKNOWN_REFERENCE, |
72 | - $name, implode(',',array_keys($this->_anchors))) |
|
72 | + $name, implode(',', array_keys($this->_anchors))) |
|
73 | 73 | ); |
74 | 74 | } |
75 | 75 |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Dallgoot\Yaml; |
3 | 3 | |
4 | -require_once __DIR__ . '/../../vendor/autoload.php'; |
|
4 | +require_once __DIR__.'/../../vendor/autoload.php'; |
|
5 | 5 | |
6 | 6 | use Dallgoot; |
7 | 7 | |
8 | -$fileName = __DIR__ . '/../dummy.yml'; |
|
8 | +$fileName = __DIR__.'/../dummy.yml'; |
|
9 | 9 | |
10 | 10 | $yamlObject = Yaml::parseFile($fileName, $options = null, $debug = null); |
11 | 11 |
@@ -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,12 +72,12 @@ discard block |
||
72 | 72 | public function push($node) |
73 | 73 | { |
74 | 74 | $type = null; |
75 | - if ($node instanceof Item ) $type = self::SEQUENCE; |
|
75 | + if ($node instanceof Item) $type = self::SEQUENCE; |
|
76 | 76 | elseif ($node instanceof Key) $type = self::MAPPING; |
77 | 77 | elseif ($node instanceof SetKey |
78 | 78 | || $node instanceof SetValue) { |
79 | 79 | $type = self::SET; |
80 | - } elseif ($node instanceof Scalar ){ |
|
80 | + } elseif ($node instanceof Scalar) { |
|
81 | 81 | $type = self::MULTILINE; |
82 | 82 | } |
83 | 83 | if (!is_null($type) && $this->checkTypeCoherence($type)) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $output = trim($first->raw); |
140 | 140 | foreach ($list as $child) { |
141 | 141 | if ($child instanceof Scalar) { |
142 | - $separator = isset($output[-1]) && $output[-1] === "\n" ? '' : ' '; |
|
142 | + $separator = isset($output[-1]) && $output[-1] === "\n" ? '' : ' '; |
|
143 | 143 | $output .= $separator.trim($child->raw); |
144 | 144 | } elseif ($child instanceof Blank) { |
145 | 145 | $output .= "\n"; |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | if ($child instanceof Comment) { |
166 | 166 | // $child->build(); |
167 | 167 | } else { |
168 | - if($child->value instanceof Comment) { |
|
168 | + if ($child->value instanceof Comment) { |
|
169 | 169 | // $child->value->build(); |
170 | 170 | // $child->value = null; |
171 | - } elseif($child->value instanceof NodeList) { |
|
171 | + } elseif ($child->value instanceof NodeList) { |
|
172 | 172 | $child->value = $child->value->filterComment(); |
173 | 173 | } |
174 | 174 | $out->push($child); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function __construct(string $nodeString, int $line) |
14 | 14 | { |
15 | 15 | parent::__construct($nodeString, $line); |
16 | - preg_match_all(Regex::MAPPING_VALUES, trim(substr(trim($nodeString), 1,-1)), $matches); |
|
16 | + preg_match_all(Regex::MAPPING_VALUES, trim(substr(trim($nodeString), 1, -1)), $matches); |
|
17 | 17 | foreach ($matches['k'] as $index => $property) { |
18 | 18 | $pair = $property.': '.trim($matches['v'][$index]); |
19 | 19 | $child = NodeFactory::get($pair, $line); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function __construct(string $nodeString, int $line) |
19 | 19 | { |
20 | 20 | parent::__construct($nodeString, $line); |
21 | - preg_match_all(Regex::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1,-1)), $matches); |
|
21 | + preg_match_all(Regex::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1, -1)), $matches); |
|
22 | 22 | foreach ($matches['item'] as $key => $item) { |
23 | 23 | $i = new Item('', $line); |
24 | 24 | $i->indent = null; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getParent(int $indent = null):NodeGeneric |
73 | 73 | { |
74 | - if (!is_int($indent)){ |
|
74 | + if (!is_int($indent)) { |
|
75 | 75 | if ($this->_parent instanceof NodeGeneric) { |
76 | 76 | return $this->_parent; |
77 | 77 | } else { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | if ($this->tag) $props['tag'] = "($this->tag)"; |
246 | 246 | if ($this->value) $props['value'] = $this->value; |
247 | 247 | // $props['value'] = $this->value; |
248 | - $props['raw'] = $this->raw; |
|
248 | + $props['raw'] = $this->raw; |
|
249 | 249 | if (!$this->_parent) $props['parent'] = 'NO PARENT!!!'; |
250 | 250 | return $props; |
251 | 251 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | if ($value instanceof Key && $child instanceof Key) { |
32 | 32 | if ($value->indent === $child->indent) { |
33 | 33 | return parent::add($child); |
34 | - } elseif ($value->isAwaitingChild($child)){ |
|
34 | + } elseif ($value->isAwaitingChild($child)) { |
|
35 | 35 | return $value->add($child); |
36 | 36 | } else { |
37 | 37 | // throw new \ParseError('key ('.$value->identifier.')@'.$value->line.' has already a value', 1); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | public function add(NodeGeneric $child):NodeGeneric |
14 | 14 | { |
15 | - if($this->_parent instanceof NodeGeneric) { |
|
15 | + if ($this->_parent instanceof NodeGeneric) { |
|
16 | 16 | return $this->_parent->add($child); |
17 | 17 | } else { |
18 | 18 | throw new \ParseError(__METHOD__." no parent to add to", 1); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | public function build(&$parent = null) |
30 | 30 | { |
31 | 31 | $built = is_null($this->value) ? null : $this->value->build(); |
32 | - $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" '): $built; |
|
32 | + $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" ') : $built; |
|
33 | 33 | $key = json_encode($stringKey, JSON_PARTIAL_OUTPUT_ON_ERROR|JSON_UNESCAPED_SLASHES); |
34 | 34 | if (empty($key)) throw new \Exception("Cant serialize complex key: ".var_export($this->value, true)); |
35 | 35 | $parent->{trim($key, '\'" ')} = null; |