本文整理汇总了PHP中Google\Protobuf\DescriptorProto::getNestedTypeList方法的典型用法代码示例。如果您正苦于以下问题:PHP DescriptorProto::getNestedTypeList方法的具体用法?PHP DescriptorProto::getNestedTypeList怎么用?PHP DescriptorProto::getNestedTypeList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Google\Protobuf\DescriptorProto
的用法示例。
在下文中一共展示了DescriptorProto::getNestedTypeList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compileMessage
public function compileMessage(proto\DescriptorProto $msg, $namespace)
{
$s[] = "/**";
$s[] = " * @constructor";
$s[] = " * @augments {ProtoJson.Message}";
$s[] = " * @extends ProtoJson.Message";
$s[] = " * @memberOf {$namespace}";
$s[] = " * @param {object} data - Optional, provide initial data to parse";
$s[] = " */";
$s[] = "{$namespace}.{$msg->name} = ProtoJson.create({";
$s[] = " fields: {";
$lines = array();
foreach ($msg->getFieldList() as $field) {
$lines[] = " {$field->number}: " . $this->generateField($field);
}
$s[] = implode(",\n", $lines);
$s[] = " },";
$s[] = " ranges: [";
// @todo dump extension ranges
$s[] = " ]";
$s[] = "});";
$s[] = "";
// Compute a new namespace with the message name as suffix
$namespace .= "." . $msg->getName();
// Generate getters/setters
foreach ($msg->getFieldList() as $field) {
$s[] = $this->generateAccessors($field, $namespace);
}
// Generate Enums
foreach ($msg->getEnumTypeList() as $enum) {
$s[] = $this->compileEnum($enum, $namespace);
}
// Generate nested messages
foreach ($msg->getNestedTypeList() as $msg) {
$s[] = $this->compileMessage($msg, $namespace);
}
// Collect extensions
foreach ($msg->getExtensionList() as $field) {
$this->extensions[$field->getExtendee()][] = array($namespace, $field);
}
return implode("\n", $s);
}