@@ -99,35 +99,35 @@ |
||
| 99 | 99 | if (Regex::isDate($v)) return Builder::$dateAsObject && !$onlyScalar ? date_create($v) : $v; |
| 100 | 100 | if (Regex::isNumber($v)) return self::getNumber($v); |
| 101 | 101 | $types = ['yes' => true, |
| 102 | - 'no' => false, |
|
| 103 | - 'true' => true, |
|
| 104 | - 'false' => false, |
|
| 105 | - 'null' => null, |
|
| 106 | - '.inf' => \INF, |
|
| 107 | - '-.inf' => -\INF, |
|
| 108 | - '.nan' => \NAN |
|
| 102 | + 'no' => false, |
|
| 103 | + 'true' => true, |
|
| 104 | + 'false' => false, |
|
| 105 | + 'null' => null, |
|
| 106 | + '.inf' => \INF, |
|
| 107 | + '-.inf' => -\INF, |
|
| 108 | + '.nan' => \NAN |
|
| 109 | 109 | ]; |
| 110 | 110 | return array_key_exists(strtolower($v), $types) ? $types[strtolower($v)] : self::replaceSequences($v); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | public static function replaceSequences($value='') |
| 114 | 114 | { |
| 115 | - $replaceUnicodeSeq = function ($matches) { |
|
| 115 | + $replaceUnicodeSeq = function ($matches) { |
|
| 116 | 116 | return json_decode('"'.$matches[1].'"'); |
| 117 | - }; |
|
| 118 | - $replaceNonPrintable = function ($matches) { |
|
| 117 | + }; |
|
| 118 | + $replaceNonPrintable = function ($matches) { |
|
| 119 | 119 | // var_dump($matches[1]); |
| 120 | 120 | return $matches[1].""; |
| 121 | - }; |
|
| 121 | + }; |
|
| 122 | 122 | // preg_match( "/[^\x{06F0}-\x{06F9}\x]+/u" , '۱۲۳۴۵۶۷۸۹۰' ); |
| 123 | - return preg_replace_callback_array( |
|
| 124 | - [ |
|
| 125 | - '/((?<![\\\\])\\\\x[0-9a-f]{2})/i' => $replaceUnicodeSeq, |
|
| 126 | - '/((?<![\\\\])\\\\u[0-9a-f]{4,})/i' => $replaceUnicodeSeq, |
|
| 127 | - '/(\\\\b|\\\\n|\\\\t|\\\\r)/' => $replaceNonPrintable |
|
| 128 | - ], |
|
| 129 | - $value |
|
| 130 | - ); |
|
| 123 | + return preg_replace_callback_array( |
|
| 124 | + [ |
|
| 125 | + '/((?<![\\\\])\\\\x[0-9a-f]{2})/i' => $replaceUnicodeSeq, |
|
| 126 | + '/((?<![\\\\])\\\\u[0-9a-f]{4,})/i' => $replaceUnicodeSeq, |
|
| 127 | + '/(\\\\b|\\\\n|\\\\t|\\\\r)/' => $replaceNonPrintable |
|
| 128 | + ], |
|
| 129 | + $value |
|
| 130 | + ); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | public function dumpYamlObject(YamlObject $obj):string |
| 106 | 106 | { |
| 107 | 107 | if ($this->multipleDocs || $obj->hasDocStart() || $obj->isTagged()) { |
| 108 | - $this->multipleDocs = true; |
|
| 109 | - // && $this->$result instanceof DLL) $this->$result->push("---"); |
|
| 108 | + $this->multipleDocs = true; |
|
| 109 | + // && $this->$result instanceof DLL) $this->$result->push("---"); |
|
| 110 | 110 | } |
| 111 | 111 | // $this->insertComments($obj->getComment()); |
| 112 | 112 | if (count($obj) > 0) { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | public function iteratorToString(\Iterator $iterable, |
| 121 | - string $keyMask, string $itemSeparator, int $indent):string |
|
| 121 | + string $keyMask, string $itemSeparator, int $indent):string |
|
| 122 | 122 | { |
| 123 | 123 | $pairs = []; |
| 124 | 124 | $valueIndent = $indent + self::INDENT; |