Configure and load the given component and provider.

@param  string  $config
@param  array|string  $providers
@param  string|null  $return
@return mixed
779323
public function loadComponent($config, $providers, $return = null)
    {
        $this->configure($config);

        foreach ((array) $providers as $provider) {
            $this->register($provider);
        }

        return $this->make($return ?: $config);
    }
726558
public static function factory($config, array $options = array())
    {
        // @codeCoverageIgnoreStart
        if (!self::$descriptionLoader) {
            self::$descriptionLoader = new ServiceDescriptionLoader();
        }
        // @codeCoverageIgnoreEnd

        return self::$descriptionLoader->load($config, $options);
    }
689444
public function setCacheProvider($provider = null, $config = array()) {
    if ($provider) {
      switch ($provider) {
        case 'inmemory':
          $this->cache = new ArrayCache();
          break;
        case 'redis':
          if (!isset($config['host'])) {
            throw new GiantBombException('host config not specified');
          }
          if (!isset($config['port'])) {
            throw new GiantBombException('port config not specified');
          }
          $redis = new Redis();
          $redis->connect($config['host'], $config['port']);

          $this->cache = new RedisCache();
          $this->cache->setRedis($redis);
          break;
        default:
          throw new GiantBombException('Unsupported cache type: ' . $provider);
      };
    }
  }
499571
public static ProviderList newList(Provider ... providers) {
        ProviderConfig[] configs = new ProviderConfig[providers.length];
        for (int i = 0; i < providers.length; i++) {
            configs[i] = new ProviderConfig(providers[i]);
        }
        return new ProviderList(configs, true);
    }
666661
public function load(array $config, ContainerBuilder $container)
    {
        $config = $this->processConfiguration(new Configuration(), $config);

        $provider = $config['provider'];
        $container->setParameter(
            'openclassrooms.cache.default_lifetime',
            $config['default_lifetime']
        );

        $container->setParameter(
            'openclassrooms.cache.cache_provider_type',
            key($provider)
        );

        switch (key($provider)) {
            case CacheProviderType::REDIS:
                $providerConfig = $provider[CacheProviderType::REDIS];
                $container->setParameter('openclassrooms.cache.provider_host', $providerConfig['host']);
                $container->setParameter('openclassrooms.cache.provider_port', $providerConfig['port']);
                $container->setParameter('openclassrooms.cache.provider_timeout', $providerConfig['timeout']);
                break;
            default;
                break;
        }

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/'));
        $loader->load('services.xml');
    }
422945
private function createUserProviders($config, ContainerBuilder $container)
    {
        $providerIds = [];
        foreach ($config['providers'] as $name => $provider) {
            $id = $this->createUserDaoProvider($name, $provider, $container);
            $providerIds[str_replace('-', '_', $name)] = $id;
        }

        return $providerIds;
    }
1104344
public function setProvider(\Core\Entity\Provider $provider = null) {
        $this->provider = $provider;

        return $this;
    }
21588
public static function create(ProviderInterface $provider, array $config)
    {
        return OAuth1Factory::create(
            array_merge($provider->getUriConfig(), $config),
            $provider->getSigner()
        );
    }
954304
public function load(array $configs, ContainerBuilder $container)
    {
        $config = $this->processConfiguration($this->getConfiguration($configs, $container), $configs);

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('gaufrette.xml');

        $adapters = array();

        foreach ($config['adapters'] as $name => $adapter) {
            $adapters[$name] = $this->createAdapter($name, $adapter, $container, $this->factories);
        }

        $map = array();
        foreach ($config['filesystems'] as $name => $filesystem) {
            $map[$name] = $this->createFilesystem($name, $filesystem, $container, $adapters);
        }

        $container->getDefinition('knp_gaufrette.filesystem_map')
            ->setPublic(true)
            ->replaceArgument(0, $map);

        if (isset($config['stream_wrapper'])) {
            $container->setParameter('knp_gaufrette.stream_wrapper.protocol', $config['stream_wrapper']['protocol']);
            $container->setParameter('knp_gaufrette.stream_wrapper.filesystems', $config['stream_wrapper']['filesystems']);
        }
    }
426520
public function autoload(array $autoloads, $provider, $options = [])
    {
        foreach ($autoloads as $name => $alias) {
            if (is_int($name)) {
                $name = $alias;
            }
            if (empty($name)) {
                throw new \InvalidArgumentException("Cannot not autoload empty service");
            }
            if (!empty($options['prefix'])) {
                $alias = $options['prefix'] . ucfirst($alias);
            }
            $shared = true;
            if (isset($options['shared'])) {
                if (is_array($options['shared'])) {
                    $shared = in_array($name, $options['shared']);
                } else {
                    $shared = $options['shared'];
                }
            } elseif (isset($options['instances'])) {
                $shared = !in_array($name, $options['instances']);
            }
            $this->set($alias, function () use ($name, $provider) {
                if (!is_object($provider)) {
                    $provider = $this->getShared($provider);
                }
                return $provider->provide($name, func_get_args());
            }, $shared);
        }
        return $this;
    }
133037
public function load($name = null, $configs = [])
	{
		$name = $name ?: $this->getDefaultDriver();

		$configs = array_merge($this->getDriverConfigs($name), $configs);

		return new Filesystem($this->resolveAdapter($configs['driver'], $configs));
	}
162558
public function load(ContainerBuilder $container, array $config)
    {
        $container->setParameter('cjm.local_webserver.configuration.host', $config['host']);
        $container->setParameter('cjm.local_webserver.configuration.port', $config['port']);
        $container->setParameter('cjm.local_webserver.configuration.docroot', $config['docroot']);
        $container->setParameter('cjm.local_webserver.configuration.suites', $config['suites']);
        $container->setParameter('cjm.local_webserver.configuration.router', $config['router']);

        $this->loadEventSubscribers($container);
        $this->loadWebserverController($container);
        $this->loadWebserverConfiguration($container, $config);
    }
1001091
public function load(array $config, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $container->setParameter('twig.template_dir', $config['template_dir']);

        $container->register('twig.asset_extension', 'Nice\Twig\AssetExtension')
            ->addArgument(new Reference('service_container'))
            ->addTag('twig.extension');

        $container->register('twig.router_extension', 'Nice\Twig\RouterExtension')
            ->addArgument(new Reference('service_container'))
            ->addTag('twig.extension');

        $container->register('twig.loader', 'Twig_Loader_Filesystem')
            ->addArgument(array('%twig.template_dir%'));

        $container->register('twig', 'Twig_Environment')
            ->addArgument(new Reference('twig.loader'));

        $container->register('templating.engine.twig', 'Nice\Templating\TwigEngine')
            ->addArgument(new Reference('twig'))
            ->addArgument(new Reference('templating.template_name_parser'))
            ->addTag('templating.engine');
    }
882721
public function load(array $config, ContainerBuilder $container)
    {
        $container->setParameter('maba_oauth_commerce.internal_client.default_base_url', null);

        $container
            ->register(
                'maba_oauth_commerce.normalizer.client_credentials',
                'Maba\OAuthCommerceInternalClient\Normalizer\ClientCredentialsNormalizer'
            )
            ->setArguments(array(new Reference('maba_oauth_commerce.algorithm_manager')))
            ->addTag('maba_oauth_commerce.normalizer')
            ->setPublic(false)
        ;
        $container
            ->setDefinition(
                'maba_oauth_commerce.factory.internal',
                new DefinitionDecorator('maba_oauth_commerce.factory.base')
            )
            ->addMethodCall('setDefaultBaseUrl', array('%maba_oauth_commerce.internal_client.default_base_url%'))
            ->setClass('Maba\OAuthCommerceInternalClient\InternalClientFactory')
        ;
    }
517460
public function load($config = array())
    {
        $identifier = $this->getIdentifier();

        $config = new ObjectConfigJson($config);
        $config->append(array(
            'debug' => \Kodekit::getInstance()->isDebug(),
            'package' => $identifier->package,
            'domain'  => $identifier->domain,
            'type'    => $identifier->type,
            'styles' => array(),
        ))->append(array(
            'k_ui_container' => ($config->domain === 'admin' || $config->domain === '') && $config->type === 'com'
        ))->append(array(
            'wrapper_class' => array(
                // Only add k-ui-container for top-level component templates
                ($config->k_ui_container ? 'k-ui-container'.($config->debug ? '' : ' k-no-css-errors') : ''),
                'k-ui-namespace',
                $identifier->type.'_'.$identifier->package
            ),
        ))->append(array(
            'wrapper' => sprintf('<div class="%s">
                <!--[if lte IE 8 ]><div class="old-ie"><![endif]-->
                %%s
                <!--[if lte IE 8 ]></div><![endif]-->
                </div>', implode(' ', ObjectConfig::unbox($config->wrapper_class))
            )
        ));

        $html = '';

        if ($config->styles !== false)
        {
            if ($config->package) {
                $config->styles->package = $config->package;
            }

            if ($config->domain) {
                $config->styles->domain = $config->domain;
            }

            $config->styles->debug = $config->debug;
            $config->styles->decorator = $config->decorator;

            $html .= $this->styles($config->styles);
        }

        $html .= $this->scripts($config);

        if ($config->wrapper) {
            $html .= $this->wrapper($config);
        }

        return $html;
    }
771479
protected function loadProviders($providers)
	{
		foreach ((array) $providers as $provider) {
			$provider = $this->container->get($provider);

			if (!$provider instanceof ServiceProviderInterface) {
				$providerName = get_class($provider);
				throw new \Exception(
					"$providerName does not implement required \\TitaPHP\\Foundation\\ServiceProviderInterface Interface"
				);
			}

			$provider->register($this);
		}
	}
1137817
public function configureProviderPlugins(ContainerBuilder $container, array $config, string $providerServiceId): array
    {
        $plugins = [];
        foreach ($config['plugins'] as $plugin) {
            if ($plugin['reference']['enabled']) {
                $plugins[] = $plugin['reference']['id'];
            }
        }

        if (isset($config['cache']) || isset($config['cache_lifetime']) || isset($config['cache_precision'])) {
            if (null === $cacheServiceId = $config['cache']) {
                if (!$container->has('app.cache')) {
                    throw new \LogicException('You need to specify a service for cache.');
                }
                $cacheServiceId = 'app.cache';
            }
            $plugins[] = $providerServiceId.'.cache';
            $container->register($providerServiceId.'.cache', CachePlugin::class)
                ->setPublic(false)
                ->setArguments([new Reference($cacheServiceId), (int) $config['cache_lifetime'], $config['cache_precision']]);
        }

        if (isset($config['limit'])) {
            $plugins[] = $providerServiceId.'.limit';
            $container->register($providerServiceId.'.limit', LimitPlugin::class)
                ->setPublic(false)
                ->setArguments([(int) $config['limit']]);
        }

        if (isset($config['locale'])) {
            $plugins[] = $providerServiceId.'.locale';
            $container->register($providerServiceId.'.locale', LocalePlugin::class)
                ->setPublic(false)
                ->setArguments([$config['locale']]);
        }

        if (isset($config['logger'])) {
            $plugins[] = $providerServiceId.'.logger';
            $container->register($providerServiceId.'.logger', LoggerPlugin::class)
                ->setPublic(false)
                ->setArguments([new Reference($config['logger'])]);
        }

        if ($container->has(FakeIpPlugin::class)) {
            $plugins[] = FakeIpPlugin::class;
        }

        if ($container->has(GeocoderDataCollector::class)) {
            $plugins[] = $providerServiceId.'.profiler';
            $container->register($providerServiceId.'.profiler', ProfilingPlugin::class)
                ->setPublic(false)
                ->setArguments([substr($providerServiceId, strlen('bazinga_geocoder.provider.'))])
                ->addTag('bazinga_geocoder.profiling_plugin');
        }

        return array_map(function (string $id) {
            return new Reference($id);
        }, $plugins);
    }