function DescriptorPool::crossLink
2 calls to DescriptorPool::crossLink()
- DescriptorPool::finish in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ DescriptorPool.php - DescriptorPool::internalAddGeneratedFile in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ DescriptorPool.php
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ DescriptorPool.php, line 127
Class
Namespace
Google\Protobuf\InternalCode
private function crossLink(Descriptor $desc) {
foreach ($desc->getField() as $field) {
switch ($field->getType()) {
case GPBType::MESSAGE:
$proto = $field->getMessageType();
if ($proto[0] == '.') {
$proto = substr($proto, 1);
}
$subdesc = $this->getDescriptorByProtoName($proto);
if (is_null($subdesc)) {
trigger_error('proto not added: ' . $proto . " for " . $desc->getFullName(), E_USER_ERROR);
}
$field->setMessageType($subdesc);
break;
case GPBType::ENUM:
$proto = $field->getEnumType();
if ($proto[0] == '.') {
$proto = substr($proto, 1);
}
$field->setEnumType($this->getEnumDescriptorByProtoName($proto));
break;
default:
break;
}
}
unset($field);
foreach ($desc->getNestedType() as $nested_type) {
$this->crossLink($nested_type);
}
unset($nested_type);
}