/** * Add child for current element. * @param string $name * @param string, array $options * @param string $htmlTagType default null * @return self */ public function addChild($name, $options = null, $htmlTagType = null) { if (is_null($options) && is_null($htmlTagType)) { $htmlTagType = $name; $options = array(); $name = ''; } $child = new self($name, $options, $htmlTagType, $this->_current, true); $child->_setParent($this->_current); return $child; }