public function generate(proto\FileDescriptorProto $proto)
 {
     parent::generate($proto);
     $this->components = array();
     $namespace = $proto->getPackage();
     // Generate Enums
     foreach ($proto->getEnumType() as $enum) {
         $src = $this->compileEnum($enum, $namespace);
         $this->addComponent($namespace, $enum->getName(), $src);
     }
     // Generate Messages
     foreach ($proto->getMessageType() as $msg) {
         $src = $this->compileMessage($msg, $namespace);
         $this->addComponent($namespace, $msg->getName(), $src);
     }
     // Generate services
     if ($this->getOption('generic_services') && count($proto->hasService())) {
         foreach ($proto->getServiceList() as $service) {
             $src = $this->compileService($service, $namespace);
             $this->addComponent($namespace, $service->getName(), $src);
         }
     }
     // Collect extensions
     if ($proto->hasExtension()) {
         foreach ($proto->getExtensionList() as $field) {
             $this->extensions[$field->getExtendee()][] = array($namespace, $field);
         }
     }
     // Dump all extensions found in this proto file
     if (count($this->extensions)) {
         $s[] = 'namespace {';
         foreach ($this->extensions as $extendee => $fields) {
             foreach ($fields as $pair) {
                 list($ns, $field) = $pair;
                 $s[] = $this->compileExtension($field, $ns, '  ');
             }
         }
         $s[] = '}';
         $src = implode(PHP_EOL, $s);
         // In multifile mode we output all the extensions in a file named after
         // the proto file, since it's not trivial or even possible in all cases
         // to include the extensions with the extended message file.
         $fname = pathinfo($proto->getName(), PATHINFO_FILENAME);
         $this->addComponent(null, $fname . '-extensions', $src);
         // Reset extensions for next proto file
         $this->extensions = array();
     }
     $files = array();
     if (!$this->getOption('multifile')) {
         $src = '';
         foreach ($this->components as $content) {
             $src .= $content;
         }
         $fname = pathinfo($proto->getName(), PATHINFO_FILENAME);
         $files[] = $this->buildFile($proto, $fname, $src);
     } else {
         foreach ($this->components as $ns => $content) {
             $fname = str_replace('\\', '/', $ns);
             $files[] = $this->buildFile($proto, $fname, $content);
         }
     }
     return $files;
 }
 public function generate(proto\FileDescriptorProto $proto)
 {
     parent::generate($proto);
 }