/**
  * @param \EBT\ExtensionBuilder\Domain\Model\ClassObject\Property $classProperty
  * @return void
  */
 public function setProperty($classProperty)
 {
     $this->properties[$classProperty->getName()] = $classProperty;
 }
Exemple #2
0
 /**
  * @param \EBT\ExtensionBuilder\Domain\Model\ClassObject\Property $property
  * @return \PhpParser\Node\Stmt\Property
  */
 public function buildPropertyNode(\EBT\ExtensionBuilder\Domain\Model\ClassObject\Property $property)
 {
     $factory = new \PhpParser\BuilderFactory();
     $propertyNodeBuilder = $factory->property($property->getName());
     $propertyNode = $propertyNodeBuilder->getNode();
     $propertyNode->type = $property->getModifiers();
     foreach ($propertyNode->props as $subNode) {
         if ($subNode instanceof \PhpParser\Node\Stmt\PropertyProperty) {
             if (!is_null($property->getDefaultValueNode())) {
                 $subNode->default = $property->getDefaultValueNode();
             } else {
                 $subNode->default = $this->buildNodeFromValue($property->getDefault());
             }
         }
     }
     $this->addCommentAttributes($property, $propertyNode);
     $propertyNode->default = $property->getDefault();
     return $propertyNode;
 }
 /**
  * @param \EBT\ExtensionBuilder\Domain\Model\ClassObject\Property $classProperty
  * @return bool TRUE if successfull added
  */
 public function addProperty(Property $classProperty)
 {
     if (!$this->propertyExists($classProperty->getName())) {
         $this->propertyNames[] = $classProperty->getName();
         $this->properties[$classProperty->getName()] = $classProperty;
         $result = TRUE;
     } else {
         $result = FALSE;
     }
     return $result;
 }