/**
  * {@inheritdoc}
  */
 public function visit(Entity $entity)
 {
     $name = $entity->getName();
     $namespace = $entity->getNamespace();
     $shortDescription = 'Protobuf service : ' . $entity->getClass();
     $class = InterfaceGenerator::fromArray(['name' => $name, 'namespacename' => $namespace, 'methods' => $this->generateMethods($entity), 'docblock' => ['shortDescription' => $shortDescription]]);
     $entity->setContent($this->generateFileContent($class, $entity));
 }
 /**
  * {@inheritdoc}
  */
 public function visit(Entity $entity)
 {
     $name = $entity->getName();
     $namespace = $entity->getNamespace();
     $shortDescription = 'Protobuf extension : ' . $entity->getClass();
     $class = ClassGenerator::fromArray(['name' => $name, 'namespacename' => $namespace, 'implementedinterfaces' => ['\\Protobuf\\Extension'], 'properties' => $this->generateFields($entity), 'methods' => $this->generateMethods($entity), 'docblock' => ['shortDescription' => $shortDescription]]);
     $entity->setContent($this->generateFileContent($class, $entity));
 }
 /**
  * {@inheritdoc}
  */
 public function visit(Entity $entity)
 {
     $name = $entity->getName();
     $namespace = $entity->getNamespace();
     $descriptor = $entity->getDescriptor();
     $shortDescription = 'Protobuf message : ' . $entity->getClass();
     $class = ClassGenerator::fromArray(['name' => $name, 'namespacename' => $namespace, 'extendedClass' => '\\Protobuf\\AbstractMessage', 'docblock' => ['shortDescription' => $shortDescription]]);
     foreach ($this->generators as $generator) {
         $generator->visit($entity, $class);
     }
     $entity->setContent($this->generateFileContent($class, $entity));
 }
 public function testGetClass()
 {
     $name = 'SimpleMessage';
     $type = Entity::TYPE_MESSAGE;
     $descriptor = new DescriptorProto();
     $fileDescriptor1 = new FileDescriptorProto();
     $fileDescriptor2 = new FileDescriptorProto();
     $fileDescriptor3 = new FileDescriptorProto();
     $fileDescriptor2->setPackage('package');
     $fileDescriptor3->setPackage('package');
     $entity1 = new Entity($type, $name, $descriptor, $fileDescriptor1);
     $entity2 = new Entity($type, $name, $descriptor, $fileDescriptor2);
     $entity3 = new Entity($type, $name, $descriptor, $fileDescriptor3, 'Parent');
     $this->assertEquals('SimpleMessage', $entity1->getClass());
     $this->assertEquals('package.SimpleMessage', $entity2->getClass());
     $this->assertEquals('package.Parent.SimpleMessage', $entity3->getClass());
 }