Ejemplo n.º 1
0
Archivo: Param.php Proyecto: swiftx/ioc
 /**
  * 初始化构造函数.
  * @param \SimpleXMLElement $config
  * @param Container $ioc
  * @throws Exception
  */
 public function __construct(\SimpleXMLElement $config, Container &$ioc)
 {
     parent::__construct($config, $ioc);
     $this->_type = ucfirst($config['type']);
     $method = 'init' . $this->_type;
     call_user_func([$this, $method], $config);
 }
Ejemplo n.º 2
0
Archivo: Bean.php Proyecto: swiftx/ioc
 /**
  * 初始化构造函数.
  * @param \SimpleXMLElement $config
  * @param Container $ioc
  * @throws Exception
  */
 public function __construct(\SimpleXMLElement $config, Container &$ioc, Bean $extends = null)
 {
     parent::__construct($config, $ioc, $extends);
     $this->_include = $this->attributeString($config, 'include', null);
     $this->_class = $this->attributeString($config, 'class', null);
     $this->_single = $this->attributeBool($config, 'single', null);
     foreach ($config->children() as $key => $value) {
         $method = 'analysis' . ucwords($key);
         if (!method_exists($this, $method)) {
             throw new Exception('无法解析配置节点:' . $key, 403);
         }
         call_user_func([$this, $method], $value);
     }
 }