示例#1
0
 /**
  *	Lazy loads a provider given its name and configuration.
  *
  *	@param string $name Name.
  *	@param string $config Configuration.
  *	@return Provider Instance.
  */
 protected function _provider($name, $config)
 {
     if (!isset($this->_providers[$name])) {
         $class = $config['class'];
         $Provider = $this->_Container->has($class) ? $this->_Container->get($class) : new $class();
         $Provider->configure($config);
         $this->_providers[$name] = $Provider;
     }
     return $this->_providers[$name];
 }
示例#2
0
 /**
  *	Constructs a provider given its configuration.
  *
  *	@param string $config Configuration.
  *	@return Provider Instance.
  */
 protected function _buildProvider($config)
 {
     $name = $config['class'];
     if (!$this->_Container->has($name)) {
         throw new Exception("The '{$name}' provider is not configured.");
     }
     $Provider = $this->_Container->get($name);
     $Provider->configure($config);
     return $Provider;
 }