/** * @param mixed $data * @return string * @throws Rych_Bencode_Exception */ static public function encode($data) { if (is_object($data)) { if (method_exists($data, 'toArray')) { $data = $data->toArray(); } else { $data = (array) $data; } } $encoder = new self($data); return $encoder->_encode(); }
/** * Encode $value into a LDIF representation * * @param mixed $value The value to be encoded * @param array $options Additional options used during encoding * @return string The encoded value */ public static function encode($value, array $options = array()) { $encoder = new self($options); return $encoder->_encode($value); }
/** * Use the JSON encoding scheme for the value specified * * @param mixed $value The value to be encoded * * @return string The encoded value */ public function encode($value) { $encoder = new self(); $encoder->setOptions($this->getOptions()); return $encoder->_encode($value); }