示例#1
0
文件: Param.php 项目: 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);
 }
示例#2
0
文件: Bean.php 项目: 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);
     }
 }