/**
  * Add Module
  * 
  * @param Provider $provider
  * @return Container
  * @throws \LogicException
  */
 public function addProvider(Provider $provider)
 {
     $name = $provider->getName();
     if (isset($this->providers[$name])) {
         throw new \LogicException(sprintf('Trying to register two providers with the same name "%s"', $name));
     }
     $this->providers[$name] = $provider;
     return $this;
 }
示例#2
0
 /**
  * Register the providers
  * 
  * @access public
  * @param Provider $provider
  * @return MVC
  */
 public function registerProvider(Provider $provider)
 {
     $provider->register($this);
     $this->container->addProvider($provider);
     return $this;
 }