/**
  * {@inheritdoc}
  */
 public function visit(Entity $entity, GeneratorInterface $class)
 {
     if (!$this->hasDefaultValue($entity)) {
         return;
     }
     $class->addMethodFromGenerator($this->generateConstructorMethod($entity));
 }
 /**
  * @test
  */
 function it_skips_expressions_when_no_key_is_entered()
 {
     $interception = new TestInterception(null, 'method', ['key1' => 'value1', 'key2' => 'value2']);
     $annotation = new TestAnnotation(['key' => '']);
     $this->innerGenerator->method('generateKey')->with($interception, $annotation)->willReturn('success');
     $result = $this->keyGenerator->generateKey($interception, $annotation);
     $this->assertEquals('success', $result);
 }
 /**
  * {@inheritdoc}
  */
 public function visit(Entity $entity, GeneratorInterface $class)
 {
     $class->addProperties($this->generateExtensionFields($entity));
     $class->addMethods($this->generateExtensionMethods($entity));
     if ($entity->getDescriptor()->hasExtensionList()) {
         $class->setImplementedInterfaces(['\\Protobuf\\Extension']);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function visit(Entity $entity, GeneratorInterface $class)
 {
     $class->addMethodFromGenerator($this->generateMethod($entity));
 }
Пример #5
0
 /**
  * @param \Zend\Code\Generator\GeneratorInterface $class
  *
  * @return string
  */
 public static function generatorToString($class)
 {
     return '<?php' . PHP_EOL . PHP_EOL . $class->generate();
 }
 /**
  * {@inheritdoc}
  */
 public function visit(Entity $entity, GeneratorInterface $class)
 {
     $class->addProperties($this->generateFields($entity));
     $class->addMethods($this->generateAccessorsMethods($entity));
 }