/** * @param mixed $data * * @return string */ public static function encode($data) { $encoder = new Encoder(); return $encoder->encode($data); }
/** * @param array $array * * @return string */ protected static function encodeAssocArray(array $array) { $encoder = static::getEncoder(); $keys = array_map($encoder, array_keys($array)); $vals = array_map($encoder, array_values($array)); $zipd = Encoder::arrayZip($keys, $vals); return sprintf('{%s}', implode(' ', $zipd)); }