예제 #1
0
 /**
  * Constructor
  * @param string name of the corresponding class
  * @param string $type type consts 
  * @param false|epClassMap $class_map
  */
 public function __construct($name, $type = self::DT_CHAR, $class_map = false)
 {
     parent::__construct($name);
     $this->setType($type);
     if ($class_map) {
         $this->setClassMap($class_map);
     }
 }
예제 #2
0
 /**
  * Add a child
  * @param epBase a reference to the subchild to be added
  * @param bool whether to replace the existing child  with the same name
  * @return bool true if successful
  */
 public function addChild(epBase &$child, $replace = true)
 {
     // get the key from object
     eval('$id = $child->get' . $this->getChildrenKey() . '();');
     if (empty($id)) {
         return false;
     }
     // set this as the child's parent (if child is a container)
     if ($child instanceof epContainer) {
         $child->setParent($this);
     }
     // if replace or child not set
     if ($replace || !isset($this->children[$id])) {
         $this->children[$id] =& $child;
         return true;
     }
     // adding child failed
     return false;
 }