Beispiel #1
0
 /**
  * Register the given service provider.
  *
  * @param  \Spires\Core\ServiceProvider $provider
  * @param  array $config
  * @return mixed
  *
  * @throws \Spires\Contracts\Core\UndefinedConfigKeyException
  */
 protected function registerConfig(ServiceProvider $provider, array $config)
 {
     $default = $provider->config();
     if ($undefined = array_keys(array_diff_key($config, $default))) {
         throw new UndefinedConfigKeyException('Undefined config keys passed to provider: [' . implode(', ', $undefined) . ']');
     }
     foreach (array_merge($default, $config) as $key => $value) {
         $this->bind($key, function () use($value) {
             return $value;
         });
     }
 }