本文整理汇总了PHP中google\protobuf\FieldDescriptorProto\Label::isOptional方法的典型用法代码示例。如果您正苦于以下问题:PHP Label::isOptional方法的具体用法?PHP Label::isOptional怎么用?PHP Label::isOptional使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google\protobuf\FieldDescriptorProto\Label
的用法示例。
在下文中一共展示了Label::isOptional方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printExtension
public function printExtension(Printer $printer, FieldDescriptorProto $field)
{
if (ExtensionPool::has($field->getExtendee(), $field->getNumber())) {
// NOTE: already registered.
return;
}
ExtensionPool::register($field->getExtendee(), $field->getNumber(), $field);
$printer->put("\$registry->add('`message`', `extension`, new \\ProtocolBuffers\\FieldDescriptor(array(\n", "message", Helper::getExtendeeClassName($field), "extension", $field->getNumber());
$printer->indent();
$printer->put("\"type\" => `type`,\n", "type", Helper::getFieldTypeName($field));
$printer->put("\"name\" => \"`name`\",\n", "name", $field->getName());
$printer->put("\"required\" => `required`,\n", "required", FieldDescriptorProto\Label::isRequired($field) ? "true" : "false");
$printer->put("\"optional\" => `optional`,\n", "optional", FieldDescriptorProto\Label::isOptional($field) ? "true" : "false");
$printer->put("\"repeated\" => `repeated`,\n", "repeated", FieldDescriptorProto\Label::isRepeated($field) ? "true" : "false");
$printer->put("\"packable\" => `packable`,\n", "packable", FieldDescriptorProto\Label::isPacked($field) ? "true" : "false");
$printer->put("\"default\" => `value`,\n", "value", $this->defaultValueAsString($field));
if (FieldDescriptorProto\Type::isMessage($field)) {
$name = $field->getTypeName();
$descriptor = MessagePool::get($name);
$printer->put("\"message\" => '`message`',\n", "message", Helper::getClassName($descriptor, true));
}
$printer->outdent();
$printer->put(")));\n");
}