@@ -54,7 +54,7 @@ |
||
| 54 | 54 | public static function getName($typeInteger) |
| 55 | 55 | { |
| 56 | 56 | if (is_null(self::$TYPE_NAMES)) { |
| 57 | - $f = function ($v) { return str_replace('Dallgoot\Yaml\\', '', $v);}; |
|
| 57 | + $f = function($v) { return str_replace('Dallgoot\Yaml\\', '', $v); }; |
|
| 58 | 58 | self::$TYPE_NAMES = array_map($f, array_flip(get_defined_constants(true)['user'])); |
| 59 | 59 | } |
| 60 | 60 | return self::$TYPE_NAMES[$typeInteger]; |
@@ -10,17 +10,17 @@ discard block |
||
| 10 | 10 | //public |
| 11 | 11 | public $errors = []; |
| 12 | 12 | |
| 13 | - public const EXCLUDE_DIRECTIVES = 1;//DONT include_directive |
|
| 14 | - public const IGNORE_COMMENTS = 2;//DONT include_comments |
|
| 15 | - public const NO_PARSING_EXCEPTIONS = 4;//THROW Exception on parsing Errors |
|
| 16 | - public const NO_OBJECT_FOR_DATE = 8;//DONT import date strings as dateTime Object |
|
| 13 | + public const EXCLUDE_DIRECTIVES = 1; //DONT include_directive |
|
| 14 | + public const IGNORE_COMMENTS = 2; //DONT include_comments |
|
| 15 | + public const NO_PARSING_EXCEPTIONS = 4; //THROW Exception on parsing Errors |
|
| 16 | + public const NO_OBJECT_FOR_DATE = 8; //DONT import date strings as dateTime Object |
|
| 17 | 17 | //privates |
| 18 | 18 | /* @var null|string */ |
| 19 | 19 | private $content; |
| 20 | 20 | /* @var null|string */ |
| 21 | 21 | private $filePath; |
| 22 | 22 | /* @var int */ |
| 23 | - private $debug = 0;///TODO: determine levels |
|
| 23 | + private $debug = 0; ///TODO: determine levels |
|
| 24 | 24 | /* @var int */ |
| 25 | 25 | private $options = 0; |
| 26 | 26 | //Exceptions messages |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | $emptyLines = []; |
| 107 | 107 | switch ($n->indent <=> $previous->indent) { |
| 108 | - case -1: $previous->getParent($n->indent)->add($n);break; |
|
| 109 | - case 0: $previous->getParent()->add($n);break; |
|
| 108 | + case -1: $previous->getParent($n->indent)->add($n); break; |
|
| 109 | + case 0: $previous->getParent()->add($n); break; |
|
| 110 | 110 | default: |
| 111 | 111 | if ($this->onDeepestType($n, $previous, $lineString)) continue 2; |
| 112 | 112 | $previous->add($n); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | // // if ($previous->type & Y\ITEM && $n->type & Y\KEY) { |
| 170 | 170 | // // $previous |
| 171 | 171 | // // } |
| 172 | - if ($deepest->type & (Y\BLANK | Y\SCALAR)) {//|| ($previous->type & (Y\ITEM | Y\SET_KEY))) { |
|
| 172 | + if ($deepest->type & (Y\BLANK|Y\SCALAR)) {//|| ($previous->type & (Y\ITEM | Y\SET_KEY))) { |
|
| 173 | 173 | $previous = $deepest->getParent(); |
| 174 | 174 | // // if ($n->type === Y\SCALAR && ($deepest->getParent()->type & Y\LITTERALS)) { |
| 175 | 175 | // // // $deepest->type = Y\SCALAR; |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | throw new \ParseError(sprintf(self::INVALID_DOCUMENT, $key)); |
| 176 | 176 | } else { |
| 177 | 177 | switch (true) { |
| 178 | - case $isSequence: $list->type = Y\SEQUENCE;break; |
|
| 179 | - case $isSet: $list->type = Y\SET;break; |
|
| 178 | + case $isSequence: $list->type = Y\SEQUENCE; break; |
|
| 179 | + case $isSet: $list->type = Y\SET; break; |
|
| 180 | 180 | default: $list->type = Y\MAPPING; |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | $children->rewind(); |
| 199 | 199 | $refIndent = $children->current()->indent; |
| 200 | 200 | $separator = $type === Y\RAW ? '' : "\n"; |
| 201 | - $action = function ($c) { return $c->value; }; |
|
| 202 | - if ($type & Y\LITT_FOLDED) { |
|
| 201 | + $action = function($c) { return $c->value; }; |
|
| 202 | + if ($type&Y\LITT_FOLDED) { |
|
| 203 | 203 | $separator = ' '; |
| 204 | - $action = function ($c) use ($refIndent) { |
|
| 204 | + $action = function($c) use ($refIndent) { |
|
| 205 | 205 | return $c->indent > $refIndent || ($c->type & Y\BLANK) ? "\n".$c->value : $c->value; |
| 206 | 206 | }; |
| 207 | 207 | } |