function save($path, Tutorial_AddressBook $addresbook) { file_put_contents($path, $addresbook->serializeToString()); }
/** * get descriptor for protocol buffers * * @return array */ public static function getDescriptor() { if (!isset(self::$descriptor)) { $desc = new ProtocolBuffersDescriptorBuilder(); $desc->addField(1, new ProtocolBuffersFieldDescriptor(array("type" => ProtocolBuffers::TYPE_MESSAGE, "name" => "user", "required" => false, "packable" => false, "repeated" => true, "default" => null, "message" => "Tutorial_User"))); self::$descriptor = $desc->build(); } return self::$descriptor; }