Esempio n. 1
0
 /**
  * Add a child Composite.
  *
  * @param T_CompositeLeaf $child  child URL object.
  * @return T_Text_Composite  fluent interface
  */
 function addChild(T_CompositeLeaf $child, $key = null)
 {
     if (isset($key)) {
         $this->children[$key] = $child;
     } else {
         $this->children[] = $child;
     }
     $child->setParent(get_class($this));
     foreach (array_keys($this->parents) as $parent) {
         $child->setParent($parent);
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * Add a child URL.
  *
  * @param T_CompositeLeaf $child  child URL object.
  * @return T_Url_Collection  fluent interface
  */
 function addChild(T_CompositeLeaf $child, $key = null)
 {
     $child->setParent($this);
     if (isset($key)) {
         $this->children[$key] = $child;
     } else {
         $this->children[] = $child;
     }
     if ($child->isActive()) {
         $this->setActive();
     }
     return $this;
 }