/**
  * {@inheritdoc}
  */
 public function traverse(TraitGenerator $generator)
 {
     $class = ltrim($generator->getFullyQualifiedName(), '\\');
     if (true === $this->collection->has($class)) {
         foreach ($this->collection->get($class) as $enhancer) {
             $enhancer->visitTraitGenerator($generator);
         }
     }
 }
 public function generate()
 {
     $generator = new TraitGenerator('CategoryExtraTrait', 'WellCommerce\\Bundle\\CategoryBundle\\Entity\\Extra');
     $traitDocAnnotation = new BaseTag('baseAnnotation', 'testing');
     $traitDoc = new DocCommentGenerator('Short trait description.', "Long description.\nOn multiple lines.", [$traitDocAnnotation]);
     $generator->setDocumentation($traitDoc);
     $properties = [];
     $discount = new PropertyGenerator('discount', 'private', Modifiers::MODIFIER_PRIVATE);
     $discountAnnotation = new BaseTag('ORM\\Column(name="discount", type="integer")');
     $discountDoc = new DocCommentGenerator('Discount', "", [$discountAnnotation]);
     $discount->setDocumentation($discountDoc);
     $properties[] = $discount;
     $generator->setProperties($properties);
     $generator->generate();
 }
 /**
  * Adds a setter method to generator
  *
  * @param TraitGenerator $generator
  * @param string         $property
  */
 protected function addSetterMethod(TraitGenerator $generator, string $property)
 {
     $setterMethodName = 'set' . Helper::studly($property);
     $variableName = strval($property);
     $method = new MethodGenerator($setterMethodName);
     $method->addBodyLine(new CodeLineGenerator('$this->' . $variableName . ' = $' . $variableName . ';'));
     $method->addParameter(new ParameterGenerator($variableName));
     $method->setVisibility(Modifiers::VISIBILITY_PUBLIC);
     $generator->addMethod($method);
 }