/** * Encode the given data in plist format * * @param array $data * resulting data that needs to * be encoded in plist format * @param boolean $humanReadable * set to true when restler * is not running in production mode. Formatter has to * make the encoded output more human readable * * @return string encoded string */ public function encode($data, $humanReadable = false) { //require_once 'CFPropertyList.php'; if (!isset(self::$compact)) { self::$compact = !$humanReadable; } /** * * @var CFPropertyList */ $plist = new CFPropertyList(); $td = new CFTypeDetector(); $guessedStructure = $td->toCFType(Object::toArray($data)); $plist->add($guessedStructure); return self::$compact ? $plist->toBinary() : $plist->toXML(true); }