/** * Use the JSON encoding scheme for the value specified * * @param mixed $value The value to be encoded * @param bool $cycleCheck Whether or not to check for possible object recursion when encoding * @param array $options Additional options used during encoding * @return string The encoded value */ public static function encode($value, $cycleCheck = false, $options = array()) { $encoder = new static($cycleCheck ? true : false, $options); if ($value instanceof JsonSerializable) { $value = $value->jsonSerialize(); } return $encoder->_encodeValue($value); }
/** * Use the JSON encoding scheme for the value specified * * @param mixed $value The value to be encoded * @param bool $cycleCheck Whether or not to check for possible object recursion when encoding * @param array $options Additional options used during encoding * @return string The encoded value */ public static function encode($value, $cycleCheck = false, $options = array()) { $encoder = new static($cycleCheck ? true : false, $options); return $encoder->_encodeValue($value); }