Registers the service provider with a DI container.

@param   Container $container The DI container.

@return  void
435074
public function register(Container $container)
    {
        $container->share(Container::class, $container);

        $container->share(get_class($this->app), $this->app)
            ->bindShared(WindwalkerApplicationInterface::class, get_class($this->app));

        $container->share(Config::class, $this->config);

        $container->prepareSharedObject(PackageResolver::class);

        $this->registerClassAlias();
    }
167123
protected function registerFormats(Container $container)
    {
        foreach ($this->formats as $formatClass) {
            $container['format.'.$formatClass::getName()] = $container->factory(function() use ($formatClass) {
                return new $formatClass();
            });
        }
    }
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);
    }
1214866
public function boot(Container $container)
    {
        error_reporting($this->config->get('system.error_reporting', 0));

        /** @var ErrorManager $handler */
        $handler = $container->get(ErrorManager::class);

        $handler->setErrorTemplate(
            $this->config->get('error.template', 'windwalker.error.default'),
            $this->config->get('error.engine', 'php')
        );

        $handler->register(true, null, true);
    }
951766
protected function registerServiceProviders( $service_providers, Container $container ) {
		foreach ( $service_providers as $provider ) {
			$provider->register( $container );
		}
	}
705249
public function register(ServiceContainer $container)
    {
        $container->set(ServiceId::CONFIG_FILE, function () {
            return $this->packageFolder . '/resources/config/config.php';
        });

        $container->set(ServiceId::CONFIG, function (ContainerInterface $container) {
            $path = $container->get(ServiceId::CONFIG_FILE);
            if (!file_exists($path)) {
                throw new RuntimeException('Wrong presentation framework configuration path.');
            }
            $fileName = basename($path);
            list(, $extension) = explode('.', $fileName);
            switch (strtolower($extension)) {
                case 'php':
                    return include($path);
                case 'json':
                    return json_decode(file_get_contents($path));
            }
            throw new RuntimeException('Unsupported configuration file type.');
        });

        $container->set(ServiceId::RENDERER, function (ContainerInterface $container) {
            return new SimpleRenderer($container->get(ServiceId::TEMPLATE_FINDER));
        });

        $container->set(ServiceId::TEMPLATE_FINDER, function () {
            return new TemplateFinder([$this->packageFolder . '/resources/views']);
        });

        $container->set(ServiceId::RESOURCE_MANAGER, function (ContainerInterface $container) {
            $config = $container->get(ServiceId::CONFIG);
            return new ResourceManager(
                new AliasRegistry(isset($config['js_aliases']) ? $config['js_aliases'] : []),
                new AliasRegistry(isset($config['css_aliases']) ? $config['css_aliases'] : []),
                new IncludedResourcesRegistry()
            );
        });

        $container->set(ServiceId::HTML_BUILDER, function (ContainerInterface $container) {
            return new HtmlBuilder($container->get(ServiceId::RESOURCE_MANAGER));
        });

        $container->set(ServiceId::BOOTSTRAP_STYLING_CONFIG, function () {
            return include $this->packageFolder . '/resources/config/styling/twitter_bootstrap.php';
        });

        $container->set(ServiceId::FOUNDATION_STYLING_CONFIG, function () {
            return include $this->packageFolder . '/resources/config/styling/foundation.php';
        });

        $container->set(ServiceId::SEMANTIC_UI_STYLING_CONFIG, function () {
            return include $this->packageFolder . '/resources/config/styling/semantic-ui.php';
        });
    }
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'];
        };
    }
1325100
public function register(Container $container)
    {
        /** @var Config $configuration */
        $configuration = $container['config'];

        /** @var LoggerInterface $logger */
        $logger = $container['logger'];

        /** @var Client $http */
        $http = $container['http'];

        /** @var TierConfiguration $tierConfiguration */
        $tierConfiguration = $container['tierConfiguration'];

        return new Fulfillment($configuration, $logger, $http, $tierConfiguration);
    }
484427
public function register(Container $container)
    {
        $closure = function (Container $container) {
            $manager = $container->newInstance(LoggerManager::class, [
                'logPath' => $container->get('config')->get('path.logs')
            ]);

            return $manager;
        };

        $container->share(LoggerManager::class, $closure);
    }
19202
public function register(Container $container)
    {
        $this->registerConfig($container);
        $this->reggisterDateHelper($container);
        $this->registerSectionServices($container);
        $this->registerNewsServices($container);
        $this->registerEventServices($container);
    }
370268
protected function registerBundleDependencies(ContainerBuilder $container)
    {
        if (true === $this->booted) {
            return;
        }

        $this->bundles = $container->getParameter('kernel.bundles');

        if ($this->createBundles($this->getBundleDependencies())) {
            $container->setParameter('kernel.bundles', $this->bundles);

            $this->initializeBundles($container);

            $pass = new Compiler\ExtensionLoadPass($this->instances);

            $container->addCompilerPass($pass);
        }

        $this->booted = true;
    }
806052
public function register(Container $container)
    {
        $container->prepareSharedObject(
            EventDispatcher::class,
            function (EventDispatcher $dispatcher, Container $container) {
                $dispatcher->foo = 'bar';

                return $dispatcher->setDebug($container->get('config')->get('system.debug'));
            }
        )->bindShared(Dispatcher::class, EventDispatcher::class)
            ->bindShared(DispatcherInterface::class, EventDispatcher::class);
    }
675450
public function register(Container $container)
    {
        $config = $container->get('config');

        if ($config->get('system.debug')) {
            $whoops = new Whoops();

            $handler = new PrettyPageHandler();
            $handler->setEditor($config->get('whoops.editor', 'phpstorm'));

            $whoops->pushHandler($handler);

            $container->share(Whoops::class, $whoops)
                ->alias('whoops', Whoops::class);

            $container->share(PrettyPageHandler::class, $handler)
                ->alias('whoops.handler', PrettyPageHandler::class);
        }
    }
596755
public function register(Container $container)
    {
        $container["tplLoader.service"] = function (Container $container) {
            $loader = new \SlaxWeb\View\Loader\PHP($container["response.service"], $container["logger.service"]());
            return $loader->setTemplateExt($container["config.service"]["view.templateExtension"]);
        };
    }
1192067
public function handle(Container $container)
    {
        $class = new \ReflectionClass(get_class($this->methodInvocation->getThis()));
        if ($class->getFileName()) {
            $method = $this->methodInvocation->getMethod()->getName();
            $container->call(
                [
                    $this->methodInvocation->getThis(),
                    $method,
                ],
                $this->methodInvocation->getArguments()->getArrayCopy()
            );
        }
    }
416587
public function register(Container $container)
    {
        $container = $container->getParent();

        // System profiler
        $closure = function (Container $container) {
            $config = $container->get('config');

            if ($config->get('system.debug')) {
                $profiler = new Profiler('windwalker');

                $profiler->setPoint(new Point(
                    'start',
                    $config['execution.start'] ?: microtime(true),
                    $config['execution.memory'] ?: memory_get_usage(true),
                    ['tag' => 'system.process']
                ));

                return $profiler;
            }

            return new NullProfiler();
        };

        $container->share('profiler', $closure);

        // System collector
        $closure = function (Container $container) {
            $config = $container->get('config');

            if ($config->get('system.debug')) {
                return new Structure();
            } else {
                return new NullObject();
            }
        };

        $container->share('debugger.collector', $closure);

        if ($container->get('config')->get('system.debug')) {
            $this->registerProfilerListener($container, $container->get('config'));
            $this->registerDatabaseProfiler($container, $container->get('config'));
            $this->registerEmailProfiler($container, $container->get('config'));
            $this->registerLogsProfiler($container, $container->get('config'));
        }
    }
1244890
public function register(Container $container)
    {
        /** @var Config $configuration */
        $configuration = $container['config'];

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

        return $logger;
    }