registerProfilerListener

@param Container $container
@param Structure $config

@return  void
324928
protected function registerProfilerListener(Container $container, Structure $config)
    {
        $dispatcher = $container->get('dispatcher');

        $dispatcher->setDebug(true);

        $dispatcher->addListener($container->createSharedObject(ProfilerListener::class), ListenerPriority::LOW);
    }
885116
public function register( Container $container ) {
		$this->container = $container;

		$container->define(
			array( 'assets' => 'Intraxia\Jaxion\Contract\Assets\Register' ),
			$register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) )
		);

		$this->add_assets( $register );
	}
1354977
public function register(Container $app)
    {
        $app[DataInterface::class] = $app->factory(Data::class);
        $app[ConfigInterface::class] = $app->factory(FileConfig::class);
    }
696854
protected function registerElfinderServices(Container $container)
    {
        /**
         * Configure the "config.admin.elfinder" dataset.
         *
         * @param  AdminConfig $adminConfig The admin configset.
         * @return AdminConfig
         */
        $container->extend('admin/config', function (AdminConfig $adminConfig) {
            $adminConfig['elfinder'] = new Config($adminConfig['elfinder']);

            return $adminConfig;
        });

        /**
         * The elFinder configset.
         *
         * @param  Container $container The Pimple DI Container.
         * @return ConfigInterface
         */
        $container['elfinder/config'] = function (Container $container) {
            return $container['admin/config']['elfinder'];
        };
    }
879565
private function configureSerializer(array $config, ContainerBuilder $container): void
    {
        if ($config['metadata_factory']) {
            $container->setAlias('fivelab.resource.serializer.metadata_factory', $config['metadata_factory']);
        }

        if ($config['name_converter']) {
            $container->setAlias('fivelab.resource.serializer.name_converter', $config['name_converter']);
        }

        if ($config['property_accessor']) {
            $container->setAlias('fivelab.resource.serializer.property_accessor', $config['property_accessor']);
        }

        if ($config['property_info']) {
            $container->setAlias('fivelab.resource.serializer.property_info', $config['property_info']);
        }

        if ($config['event_dispatcher']) {
            $container->setAlias('fivelab.resource.serializer.event_dispatcher', $config['event_dispatcher']);
        }

        $container->setParameter('fivelab.resource.serializer.serialize_null', $config['serialize_null']);
    }
690980
public function register(Container $container)
    {
        $this->registerViewConfig($container);
        $this->registerLoaderServices($container);
        $this->registerEngineServices($container);
        $this->registerMustacheTemplatingServices($container);
        $this->registerTwigTemplatingServices($container);
        $this->registerViewServices($container);
    }
1369326
static void register(String group, long durationMillis) {
        for (ProfilingListener listener : LISTENERS) {
            listener.register(group, durationMillis);
        }
    }
245639
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition(static::REGISTRY_NAME) || !$container->hasDefinition(static::EVENT_DISPATCHER_NAME)) {
            return;
        }

        $registry = $container->getDefinition(static::REGISTRY_NAME);
        $dispatcherReference = new Reference(static::EVENT_DISPATCHER_NAME);
        $parameterBag = $container->getParameterBag();

        foreach ($container->findTaggedServiceIds(static::TAG_NAME) as $id => $tags) {
            $registry->addMethodCall("addDriver", [new Reference($id)]);

            // Inject the dispatcher in the driver
            $driver = $container->getDefinition($id);
            $driver->addMethodCall("setDispatcher", [$dispatcherReference]);

            foreach ($tags as $tag) {
                if (isset($tag[static::LISTENER_TAG_PARAMETER])) {
                    $listenerCode = $parameterBag->resolveValue($tag[static::LISTENER_TAG_PARAMETER]);

                    if (!$container->hasDefinition($listenerCode)) {
                        throw new ServiceNotFoundException(sprintf("The service '%s' doesn't exist", $listenerCode));
                    }

                    $listener = $container->getDefinition($listenerCode);
                    $listenerClass = $parameterBag->resolveValue($listener->getClass());

                    $reflection = new \ReflectionClass($listenerClass);

                    if (false === $reflection->implementsInterface(static::DRIVER_LISTENER_INTERFACE)) {
                        throw new InvalidArgumentException(sprintf(
                            "The service '%s' must implement interface '%s' but doesn't",
                            $listenerCode,
                            static::DRIVER_LISTENER_INTERFACE
                        ));
                    }

                    $listener->addMethodCall("setDriver", [new Reference($id)]);
                }
            }
        }
    }
1257110
protected function registerProfileRegistry()
    {
        $this->app->singleton('backup.registry', function (Container $app) {
            $config = $app['config']['backup'];
            $builder = $app['backup.builder'];

            $factory = new ProfileRegistryFactory($builder);

            return $factory->make($config);
        });

        $this->app->alias('backup.registry', ProfileRegistry::class);
    }
177907
private function registerServices(ContainerBuilder $container, $config)
    {
        if ($config['annotation']['enabled']) {
            $this->verifyDoctrineBridgeExists('annotation');
            $container->register('cache.service.annotation', DoctrineCacheBridge::class)
                ->setFactory([DoctrineBridgeFactory::class, 'get'])
                ->addArgument(new Reference($config['annotation']['service_id']))
                ->addArgument($config['annotation'])
                ->addArgument(['annotation']);
        }

        if ($config['serializer']['enabled']) {
            $this->verifyDoctrineBridgeExists('serializer');
            $container->register('cache.service.serializer', DoctrineCacheBridge::class)
                ->setFactory([DoctrineBridgeFactory::class, 'get'])
                ->addArgument(new Reference($config['serializer']['service_id']))
                ->addArgument($config['serializer'])
                ->addArgument(['serializer']);
        }

        if ($config['validation']['enabled']) {
            $container->register('cache.service.validation', SymfonyValidatorBridge::class)
                ->setFactory([ValidationFactory::class, 'get'])
                ->addArgument(new Reference($config['validation']['service_id']))
                ->addArgument($config['validation']);
        }

        if ($config['session']['enabled']) {
            $container->register('cache.service.session', Psr6SessionHandler::class)
                ->setFactory([SessionHandlerFactory::class, 'get'])
                ->addArgument(new Reference($config['session']['service_id']))
                ->addArgument($config['session']);
        }

        if ($config['router']['enabled']) {
            $container->register('cache.service.router', CachingRouter::class)
                ->setFactory([RouterFactory::class, 'get'])
                ->setDecoratedService('router', null, 10)
                ->addArgument(new Reference($config['router']['service_id']))
                ->addArgument(new Reference('cache.service.router.inner'))
                ->addArgument($config['router']);
        }
    }
769865
public function register(Container $container)
    {
        $container->share(\Swift_Mailer::class, [$this, 'swiftmailer'])
            ->alias('swiftmailer', \Swift_Mailer::class);

        $container->bindShared(MailerAdapterInterface::class, SwiftMailerAdapter::class)
            ->alias('mailer.adapter.swiftmailer', SwiftMailerAdapter::class);
    }
421010
private function registerMonologHandlerInAllChannels (ContainerBuilder $container)
    {
        $monitoringReference = new Reference(self::MONOLOG_HANDLER_SERVICE_ID);

        // push reference as handler to every logger in the system
        foreach ($container->getDefinitions() as $key => $definition)
        {
            if (0 === strpos($key, "monolog.logger."))
            {
                $definition->addMethodCall("pushHandler", [$monitoringReference]);
            }
        }
    }
262321
public function register(Container $container)
    {
        // Get cache factory object.
        $container->prepareSharedObject(CacheManager::class);

        // Get global cache object.
        $container->share(Cache::class, function (Container $container) {
            /** @var Structure $config */
            $config = $container->get('config');

            $storage = $config->get('cache.storage', 'file');
            $handler = $config->get('cache.serializer', 'php');

            return $container->get(CacheManager::class)->create('windwalker', $storage, $handler);
        });
    }
1244890
public function register(Container $container)
    {
        /** @var Config $configuration */
        $configuration = $container['config'];

        $logger = Logger::get();
        $logger->setLogLevel($configuration->logLevel);

        return $logger;
    }
1211900
public function register(Container $container)
    {
        $container->prepareSharedObject(CoreLanguage::class)
            ->bindShared(Language::class, CoreLanguage::class)
            ->bindShared(LanguageInterface::class, CoreLanguage::class);
    }
529829
public function register(Container $container)
    {
        $settings = $container->get('settings');

        if (!isset($settings['logger'])) {
            throw new InvalidArgumentException('Logger configuration not found');
        }

        $basename = isset($settings['basename']) ? $settings['basename'] : 'slim-app';

        $container['logger'] = new Monolog($basename, $settings['logger']);
    }
210968
public function registerFlashTypes(ContainerBuilder $container, array $config)
    {
        $mergedConfig = array_merge_recursive($config['flashmessage'], [
            'success' => ['types' => [
                'success' => ['domain' => 'SonataCoreBundle'],
                'sonata_flash_success' => ['domain' => 'SonataAdminBundle'],
                'sonata_user_success' => ['domain' => 'SonataUserBundle'],
                'fos_user_success' => ['domain' => 'FOSUserBundle'],
            ]],
            'warning' => ['types' => [
                'warning' => ['domain' => 'SonataCoreBundle'],
                'sonata_flash_info' => ['domain' => 'SonataAdminBundle'],
            ]],
            'danger' => ['types' => [
                'error' => ['domain' => 'SonataCoreBundle'],
                'sonata_flash_error' => ['domain' => 'SonataAdminBundle'],
                'sonata_user_error' => ['domain' => 'SonataUserBundle'],
            ]],
        ]);

        $types = $cssClasses = [];

        foreach ($mergedConfig as $typeKey => $typeConfig) {
            $types[$typeKey] = $typeConfig['types'];
            $cssClasses[$typeKey] = \array_key_exists('css_class', $typeConfig) ? $typeConfig['css_class'] : $typeKey;
        }

        $identifier = 'sonata.core.flashmessage.manager';

        $definition = $container->getDefinition($identifier);
        $definition->replaceArgument(2, $types);
        $definition->replaceArgument(3, $cssClasses);

        $container->setDefinition($identifier, $definition);
    }