Exemplo n.º 1
0
 public static function buildFromProto($proto)
 {
     $file = new FileDescriptor();
     $file->setPackage($proto->getPackage());
     foreach ($proto->getMessageType() as $message_proto) {
         $file->addMessageType(Descriptor::buildFromProto($message_proto, $file->getPackage(), ""));
     }
     foreach ($proto->getEnumType() as $enum_proto) {
         $file->getEnumType()[] = $file->addEnumType(EnumDescriptor::buildFromProto($enum_proto, $file->getPackage(), ""));
     }
     return $file;
 }
Exemplo n.º 2
0
 public function internalAddGeneratedFile($data)
 {
     $files = new FileDescriptorSet();
     $files->decode($data);
     $file = FileDescriptor::buildFromProto($files->getFile()[0]);
     foreach ($file->getMessageType() as &$desc) {
         $this->addDescriptor($desc);
     }
     unset($desc);
     foreach ($file->getEnumType() as &$desc) {
         $this->addEnumDescriptor($desc);
     }
     unset($desc);
     foreach ($file->getMessageType() as &$desc) {
         $this->crossLink($desc);
     }
     unset($desc);
 }