Exemple #1
0
 /**
  * Adds a new property to this template.
  *
  * @param $node The property node
  */
 public function addProperty(PropertyNode $node)
 {
     if ($node->getKey() == null) {
         $this->propertyMap[$this->curIndex] = $node;
         $node->setKey($this->curIndex);
         $this->curIndex++;
     } else {
         //If there is already a property with the same key, remove it from the children list
         if (isset($this->propertyMap[$node->getKey()])) {
             $this->removeChild($this->propertyMap[$node->getKey()]);
         }
         $this->propertyMap[$node->getKey()] = $node;
     }
     parent::addChild($node);
 }
Exemple #2
0
 /**
  * Returns all child properties.
  *
  * @return PropertyNode[]
  */
 public function getProperties()
 {
     $result = array();
     $nodes = $this->getDirectElementsByTagName($this->node, 'property');
     foreach ($nodes as $node) {
         $node = new PropertyNode($node, $this->nodes, $this);
         $result[$node->getName()] = $node;
     }
     return $result;
 }
 /**
  * Inherits the properties of an element in another class.
  *
  * @param PropertyNode $parent parent property to inherit from.
  *
  * @return void
  */
 public function inherit($parent)
 {
     $docblock = $this->getDocBlock();
     $docblock->inherited_tags = array_merge($docblock->inherited_tags, $this->inherited_tags);
     $docblock->inherit($parent->getDocBlock());
     $this->getNode()->appendChild(new \DOMElement('override_from', $this->class->getFQCN()));
 }