/** * 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; }); } }
/** * Add plugins from the service provider. * * @param \Spires\Core\ServiceProvider $provider * @return void */ protected function addPlugins($provider) { foreach ($provider->plugins() as $plugin) { $this->plugins[$plugin] = $this->make($plugin); } }