@@ -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 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 | |