/** * Create a child configuration component. * * @param integer $type Type of configuration component to be created * @param string $name Component name to be created * @param string $content Component content * @param array $attributes Component attributes * @param string $where Choose a position 'bottom', 'top', 'after', 'before' where the new component will be added * @param __ConfigurationComponent $target needed if you choose 'before' or 'after' for where * * @return __ConfigurationComponent A reference to the new component */ protected function &createComponent($type, $name, $content, array $attributes = array(), $where = 'bottom', __ConfigurationComponent $target = null) { switch ($type) { case __ConfigurationComponentType::SECTION: $component = new __ConfigurationSection($name, $content, $attributes); $section_handler = __SectionHandlerFactory::getInstance()->createSectionHandler($name); if ($section_handler != null) { $component->registerSectionHandler($section_handler); } break; case __ConfigurationComponentType::PROPERTY: $component = new __ConfigurationProperty($name, $content, $attributes); break; case __ConfigurationComponentType::COMMENT: $component = new __ConfigurationComment($name, $content, $attributes); break; case __ConfigurationComponentType::BLANK: $component = new __ConfigurationBlank($name, $content, $attributes); break; default: throw __ExceptionFactory::getInstance()->createException('ERR_UNKNOW_CONFIGURATION_COMPONENT_TYPE', array($type)); break; } $return_value =& $this->addComponent($component, $where, $target); return $return_value; }
public static function &getInstance() { if (self::$_instance == null) { self::$_instance = new __SectionHandlerFactory(); } return self::$_instance; }
private function _processSectionHandler($section_handler) { __SectionHandlerFactory::getInstance()->registerSectionHandlerClass($section_handler->getAttribute('name'), $section_handler->getAttribute('handler-class')); }