@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | $previousCompactMode = $this->dumper->_compactMode; |
104 | - $this->dumper->_compactMode = true; |
|
104 | + $this->dumper->_compactMode = true; |
|
105 | 105 | $result = $this->dumper->iteratorToString(new \ArrayIterator($source), $keyMask, ', ', $indent); |
106 | 106 | $this->dumper->_compactMode = $previousCompactMode; |
107 | 107 | return sprintf($structureFormat, $result); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // Example 5.13. Escaped Characters |
124 | 124 | |
125 | 125 | $str = json_encode(ltrim($str)); |
126 | - return strspn(substr($str,1,-1), "-:?{}[]#,&*!>|'\"%") > 0 ? $str : trim($str, '"'); |
|
126 | + return strspn(substr($str, 1, -1), "-:?{}[]#,&*!>|'\"%") > 0 ? $str : trim($str, '"'); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | public function dumpTagged(Tagged $obj, int $indent):string |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | private $handler; |
32 | 32 | |
33 | 33 | |
34 | - public function __construct($options=null) |
|
34 | + public function __construct($options = null) |
|
35 | 35 | { |
36 | 36 | $this->options = is_int($options) ? $options : self::OPTIONS; |
37 | 37 | $this->handler = new DumperHandlers($this); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | if (empty($dataType)) throw new \Exception(self::class.": No content to convert to Yaml"); |
52 | 52 | if (is_scalar($dataType)) { |
53 | - return "--- ".$this->handler->dumpScalar($dataType). self::LINEFEED ; |
|
53 | + return "--- ".$this->handler->dumpScalar($dataType).self::LINEFEED; |
|
54 | 54 | } |
55 | 55 | return $this->dump($dataType, 0); |
56 | 56 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | public function getTargetOnLessIndent(NodeGeneric &$node):NodeGeneric |
52 | 52 | { |
53 | - if ($node instanceof Scalar || $node instanceof Blank ) { |
|
53 | + if ($node instanceof Scalar || $node instanceof Blank) { |
|
54 | 54 | return $this->getParent(); |
55 | 55 | } else { |
56 | 56 | return $this->getParent($node->indent); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | \.nan | \.NaN | \.NAN tag:yaml.org,2002:float (Not a number) |
98 | 98 | * tag:yaml.org,2002:str (Default) |
99 | 99 | */ |
100 | - if (Regex::isDate($v)) return ($this->getRoot()->getYamlObject()->getOptions() & Loader::NO_OBJECT_FOR_DATE) && !$onlyScalar ? date_create($v) : $v; |
|
100 | + if (Regex::isDate($v)) return ($this->getRoot()->getYamlObject()->getOptions()&Loader::NO_OBJECT_FOR_DATE) && !$onlyScalar ? date_create($v) : $v; |
|
101 | 101 | if (Regex::isNumber($v)) return $this->getNumber($v); |
102 | 102 | $types = ['yes' => true, |
103 | 103 | 'no' => false, |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | return array_key_exists(strtolower($v), $types) ? $types[strtolower($v)] : $this->replaceSequences($v); |
112 | 112 | } |
113 | 113 | |
114 | - public function replaceSequences($value='') |
|
114 | + public function replaceSequences($value = '') |
|
115 | 115 | { |
116 | - $replaceUnicodeSeq = function ($matches) { |
|
116 | + $replaceUnicodeSeq = function($matches) { |
|
117 | 117 | return json_decode('"'.$matches[1].'"'); |
118 | 118 | }; |
119 | - $replaceNonPrintable = function ($matches) { |
|
119 | + $replaceNonPrintable = function($matches) { |
|
120 | 120 | // var_dump($matches[1]); |
121 | 121 | return $matches[1].""; |
122 | 122 | }; |
@@ -96,7 +96,7 @@ |
||
96 | 96 | * @return string The child value. |
97 | 97 | * @todo double check behaviour for KEY and ITEM |
98 | 98 | */ |
99 | - protected function getChildValue($child, $refIndent=0):string |
|
99 | + protected function getChildValue($child, $refIndent = 0):string |
|
100 | 100 | { |
101 | 101 | $value = $child->value; |
102 | 102 | $start = ''; |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | elseif ((bool) preg_match(Regex::KEY, $trimmed, $matches)) return new Nodes\Key($nodeString, $line, $matches); |
29 | 29 | else { |
30 | 30 | $first = $trimmed[0]; |
31 | - $stringGroups = ['-', '>|' , '"\'', "#%" , "{[" , ":?" , '*&!']; |
|
32 | - $methodGroups = ['Hyphen','Literal','Quoted','Special','Compact','SetElement','NodeAction']; |
|
31 | + $stringGroups = ['-', '>|', '"\'', "#%", "{[", ":?", '*&!']; |
|
32 | + $methodGroups = ['Hyphen', 'Literal', 'Quoted', 'Special', 'Compact', 'SetElement', 'NodeAction']; |
|
33 | 33 | foreach ($stringGroups as $groupIndex => $stringRef) { |
34 | 34 | if (is_int(strpos($stringRef, $first))) { |
35 | 35 | $methodName = 'on'.$methodGroups[$groupIndex]; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ini_restore($backtrack_setting); |
116 | 116 | |
117 | 117 | if (is_bool($isMapping) || is_bool($isSequence)) { |
118 | - throw new \Exception("Regex Error for ".(is_bool($isMapping) ? 'mapping:' :'sequence:').preg_last_error()); |
|
118 | + throw new \Exception("Regex Error for ".(is_bool($isMapping) ? 'mapping:' : 'sequence:').preg_last_error()); |
|
119 | 119 | } |
120 | 120 | if ($isMapping) { |
121 | 121 | // var_dump(Regex::MAPPING, trim($nodeString)); |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | //public |
21 | 21 | /* @var null|string */ |
22 | 22 | public static $error; |
23 | - public const IGNORE_DIRECTIVES = 0b0001;//DONT include_directive |
|
24 | - public const IGNORE_COMMENTS = 0b0010;//DONT include_comments |
|
25 | - public const NO_PARSING_EXCEPTIONS = 0b0100;//DONT throw Exception on parsing errors |
|
26 | - public const NO_OBJECT_FOR_DATE = 0b1000;//DONT import date strings as dateTime Object |
|
23 | + public const IGNORE_DIRECTIVES = 0b0001; //DONT include_directive |
|
24 | + public const IGNORE_COMMENTS = 0b0010; //DONT include_comments |
|
25 | + public const NO_PARSING_EXCEPTIONS = 0b0100; //DONT throw Exception on parsing errors |
|
26 | + public const NO_OBJECT_FOR_DATE = 0b1000; //DONT import date strings as dateTime Object |
|
27 | 27 | |
28 | 28 | //private |
29 | 29 | /* @var null|array */ |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | { |
179 | 179 | $deepest = $previous->getDeepestNode(); |
180 | 180 | if ($deepest instanceof Nodes\Partial) { |
181 | - return $deepest->specialProcess($current, $this->_blankBuffer); |
|
182 | - } elseif(!($current instanceof Nodes\Partial)) { |
|
181 | + return $deepest->specialProcess($current, $this->_blankBuffer); |
|
182 | + } elseif (!($current instanceof Nodes\Partial)) { |
|
183 | 183 | return $current->specialProcess($previous, $this->_blankBuffer); |
184 | 184 | } |
185 | 185 | return false; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function str($node, &$parent = null) |
59 | 59 | { |
60 | - if($node instanceof Nodes\Literals){ |
|
60 | + if ($node instanceof Nodes\Literals) { |
|
61 | 61 | $node = $node->value; |
62 | 62 | } |
63 | 63 | if ($node instanceof Nodes\NodeGeneric) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $list[] = $this->str($child); |
73 | 73 | } |
74 | 74 | // return new Nodes\Scalar(implode('',$list), 0); |
75 | - return implode('',$list); |
|
75 | + return implode('', $list); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $keyValue = $key->value->build(); |
134 | 134 | if (is_null($parent)) { |
135 | 135 | return [$keyName => $keyValue]; |
136 | - } else{ |
|
136 | + } else { |
|
137 | 137 | $parent[$keyName] = $keyValue; |
138 | 138 | } |
139 | 139 | } else { |
@@ -13,6 +13,6 @@ |
||
13 | 13 | public function build(&$parent = null) |
14 | 14 | { |
15 | 15 | // return substr(Scalar::replaceSequences(trim($this->raw)), 1,-1); |
16 | - return (new Scalar('', 0))->replaceSequences(substr(trim($this->raw), 1,-1)); |
|
16 | + return (new Scalar('', 0))->replaceSequences(substr(trim($this->raw), 1, -1)); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -77,7 +77,7 @@ |
||
77 | 77 | return $this->__yaml__object__api->_anchors[$name]; |
78 | 78 | } |
79 | 79 | throw new \UnexpectedValueException(sprintf(self::UNKNOWN_REFERENCE, |
80 | - $name, implode(',',array_keys($this->__yaml__object__api->_anchors))) |
|
80 | + $name, implode(',', array_keys($this->__yaml__object__api->_anchors))) |
|
81 | 81 | ); |
82 | 82 | } |
83 | 83 |