Exemplo n.º 1
0
 /**
  * Добавляет  компонент  к  списку  дочерних
  * Иерархия  компонентов  должна   строго соответствовать  иерархии
  * вложеных  тэгов (с аттрибутами  zippy) в HTML шаблоне
  */
 public function add(HtmlComponent $component)
 {
     if (isset($this->components[$component->id])) {
         throw new ZE(sprintf(ERROR_COMPONENT_ALREADY_EXISTS, $component->id, $this->id));
     }
     if (property_exists($this, $component->id)) {
         $id = strlen($this->id) > 0 ? $this->id : get_class($this);
         throw new ZE(sprintf(ERROR_COMPONENT_AS_PROPERTY, $component->id, $id));
     }
     $this->components[$component->id] = $component;
     $component->setOwner($this);
     $component->onAdded();
     return $component;
 }