} if ($opts->gap === null) { $result = '{' . join(',', $parts) . '}'; } else { $result = count($parts) === 0 ? "{}" : "{\n" . $opts->gap . join(",\n" . $opts->gap, $parts) . "\n" . $prevGap . "}"; } } $opts->level -= 1; $opts->gap = $prevGap; return $result; }; $methods = array('parse' => function ($string, $reviver = null) use(&$decode) { $string = '{"_":' . $string . '}'; $value = json_decode($string); if ($value === null) { throw new Ex(SyntaxError::create('Unexpected end of input')); } return $decode($value->_); }, 'stringify' => function ($value, $replacer = null, $space = null) use(&$encode) { $opts = new stdClass(); $opts->indent = null; $opts->gap = null; if (is_int_or_float($space)) { $space = floor($space); if ($space > 0) { $space = str_repeat(' ', $space); } } if (is_string($space)) { $length = strlen($space); if ($length > 10) {