Registers services on the given container.

This method should only be used to configure services and parameters.
It should not get services.

@param Container $pimple A container instance
519985
public function register(Container $pimple)
    {
        $pimple['user'] = function ($pimple) {
            return new User($pimple['access_token']);
        };

        $department = function ($pimple) {
            return new Department($pimple['access_token']);
        };

        $tag = function ($pimple) {
            return new Tag($pimple['access_token']);
        };

        $batch = function ($pimple) {
            return new Batch($pimple['access_token']);
        };

        $pimple['department'] = $department;
        $pimple['party'] = $department;

        $pimple['user_party'] = $department;
        $pimple['user.party'] = $department;

        $pimple['user_department'] = $department;
        $pimple['user.department'] = $department;

        $pimple['tag'] = $tag;

        $pimple['user_tag'] = $tag;
        $pimple['user.tag'] = $tag;

        $pimple['user_batch'] = $batch;
        $pimple['user.batch'] = $batch;
    }
487527
public function register(Container $container)
    {
        /** @var string The default route controller for templates. */
        $container['route/controller/script/class'] = ScriptRoute::class;

        $this->registerScriptFactory($container);
        $this->registerClimate($container);
    }
373792
public function register(Container $pimple)
    {
        $pimple['logger'] = $pimple['log'] = function () {
            if (strtolower(Dispatcher::getInstance()->getRequest()->getModuleName()) == 'console'
                && getenv('LOG_TO_CONSOLE')
            ) {
                return new Logger('console-name', [new StreamHandler('php://output')]);
            } else {
                return new LoggerWrapper();
            }
        };
    }
305723
public function register(Container $container)
    {
        $app = $container->get('application');

        $container->share(WebApplication::class, $app);

        // Input
        $container->share(Input::class, function (Container $container) use ($app) {
            return PsrInput::create($app->getRequest());
        })->bindShared(PsrInput::class, Input::class);

        // Request
//        $container->share(ServerRequest::class, $app->getRequest())
//            ->alias(ServerRequestInterface::class, ServerRequest::class);

        // Environment
        $container->share(WebEnvironment::class, $app->getEnvironment());
        $container->share(Browser::class, $app->getEnvironment()->getBrowser());
        $container->share(Platform::class, $app->getEnvironment()->getPlatform());

        // Uri
        $container->share(UriData::class, function (Container $container) use ($app) {
            return $app->getServer()->getUriData();
        });
    }
630073
public function process(Pimple $container, array $options)
    {
        $container['logger'] = $container->share(
          function () {
              return new NullLogger();
          }
        );

        $container['log_level'] = LogLevel::INFO;

        $container['log_sub_request'] = false;

        foreach ($options as $name => $value) {
            $container[$name] = $value;
        }

        return $container;
    }
941907
public function register(Container $container)
    {
        $this->container = $container;

        // Register the PHP view loader if configuration says so
        if (strtolower($container["config.service"]["view.loader"]) === "php") {
            $container->register(new PHPLoaderProvider);
        }

        // Define view class loader
        $container["loadView.service"] = $container->protect(
            function (string $view, bool $useLayout = true) use ($container) {
                $cacheName = "loadView.service-{$view}" . ($useLayout ? "1" : "0");
                if (isset($container[$cacheName]) && isset($container["view.skipCache"]) === false) {
                    return $container[$cacheName];
                }

                $class = $container["view.className"] ?? $this->getViewClass($view);
                $view = new $class(
                    $container["config.service"],
                    $container["tplLoader.service"],
                    $container["response.service"]
                );

                if (method_exists($view, "init")) {
                    $args = func_get_args();
                    $args = array_slice($args, 2);
                    $view->init(...$args);
                }

                if ($useLayout && ($layoutName = $container["config.service"]["view.defaultLayout"]) !== "") {
                    $this->setLayout($layoutName, $view);
                }

                return $container[$cacheName] = $view;
            }
        );

        $container["loadTemplate.service"] = $container->protect(
            function (string $template, bool $useLayout = true) use ($container) {
                $cacheName = "loadTemplate.service-{$template}" . ($useLayout ? "1" : "0");
                if (isset($container[$cacheName])) {
                    return $container[$cacheName];
                }

                $container["view.skipCache"] = true;
                $container["view.className"] = \SlaxWeb\View\Base::class;
                $view = $container["loadView.service"]("", false);
                $view->template = $template;
                unset($container["view.skipCache"], $container["view.className"]);

                if ($useLayout && ($layoutName = $container["config.service"]["view.defaultLayout"]) !== "") {
                    $this->setLayout($layoutName, $view);
                }

                return $container[$cacheName] = $view;
            }
        );
    }
149778
protected function registerAssetsManager(Container $container)
    {
        $container['assets/config'] = function (Container $container) {
            $config = $container['view/config']->get('assets');

            return new AssetsConfig($config);
        };

        $container['assets/builder'] = function () {
            return new AssetsBuilder();
        };

        /**
         * @param Container $container Pimple DI container.
         * @return AssetManager
         */
        $container['assets'] = function (Container $container) {
            $assetsBuilder = $container['assets/builder'];
            $assetsConfig = $container['assets/config'];

            return $assetsBuilder($assetsConfig);
        };
    }
662173
public function register(ContainerInterface $container)
    {
        $packages = [];

        // TODO : trouver comment ne pas utiliser cette constante !!!!
        $packagesFile = \Chiron\ROOT_DIR . '/bootstrap/cache/packages.php';

        if (file_exists($packagesFile)) {
            $packages = include $packagesFile;
        }

        foreach ($packages as $package) {
            if (! empty($package['providers'])) {
                array_walk($package['providers'], function ($provider) use ($container) {
                    // TODO : faire remonter la méthode "register" directement dans la classe Application
                    $container->register(new $provider);
                });
            }
        }
    }
670011
private function loadServiceConfigurations(PimpleGate $container)
    {
        $paths = $container->getSymfonyParameter('cca.legacy_dic');

        // include the module services configurations
        foreach ($paths as $file) {
            require_once $file;
        }
    }
1348073
public function register(Container $pimple)
    {
        $config = $this->readConfig();

        foreach ($config as $name => $value) {
            if ('%' === substr($name, 0, 1)) {
                $this->replacements[$name] = preg_replace_callback(
                    '/(%.+%)/U', function ($matches) use ($config) {
                        return $this->replacements[$matches[0]];
                    },
                    (string) $value);
            }
        }

        $this->merge($pimple, $config);
    }
793634
public function register( Container $container ) {
		$this->container = $container;

		$this->container->define( array( 'router' => 'Intraxia\Jaxion\Http\Router' ), $router = new Router );

		$this->add_routes( $router );
	}
531612
public function register(Container $container)
    {
        $closure = function (Container $container) {
            $tz = $container->get('config')->get('system.timezone', 'UTC');

            return new Chronos('now', new \DateTimeZone($tz));
        };

        $container->set(Chronos::class, $closure);
    }
1159291
function setServices(iContainer $container)
    {
        /** @var Container $container */
        $this->sc = $container;
        $container->nest($this, uniqid()); // for now nested name are not valuable.
    }
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'];
        };
    }
879654
protected function registerAdminServices(Container $container)
    {
        /**
         * The admin configset.
         *
         * @param  Container $container The Pimple DI Container.
         * @return AdminConfig
         */
        $container['admin/config'] = function (Container $container) {
            $appConfig = $container['config'];

            // The `admin.json` file is not part of regular config
            $extraConfigs = (array)$appConfig['admin_config'];

            $moduleAdminConfigs = [];

            foreach ($container['module/classes'] as $module) {
                if (defined(sprintf('%s::ADMIN_CONFIG', $module))) {
                    $moduleAdminConfigs[] = $module::ADMIN_CONFIG;
                };
            }

            if (!empty($moduleAdminConfigs)) {
                $extraConfigs = array_merge(
                    $extraConfigs,
                    $moduleAdminConfigs
                );
            }

            if (!empty($extraConfigs)) {
                $basePath = $appConfig['base_path'];
                foreach ($extraConfigs as $path) {
                    $appConfig->addFile($basePath.$path);
                }
            }

            return new AdminConfig($appConfig['admin']);
        };

        if (!isset($container['admin/base-url'])) {
            /**
             * Base Admin URL as a PSR-7 UriInterface object for the current request
             * or the Charcoal application.
             *
             * @param  Container $container The Pimple DI Container.
             * @return \Psr\Http\Message\UriInterface
             */
            $container['admin/base-url'] = function (Container $container) {
                $adminConfig = $container['admin/config'];

                if (isset($adminConfig['base_url'])) {
                    $adminUrl = $adminConfig['base_url'];
                } else {
                    $adminUrl = clone $container['base-url'];
                    if ($adminConfig['base_path']) {
                        $basePath  = rtrim($adminUrl->getBasePath(), '/');
                        $adminPath = ltrim($adminConfig['base_path'], '/');
                        $adminUrl  = $adminUrl->withBasePath($basePath.'/'.$adminPath);
                    }
                }

                $adminUrl = Uri::createFromString($adminUrl)->withUserInfo('');

                /** Fix the base path */
                $path = $adminUrl->getPath();
                if ($path) {
                    $adminUrl = $adminUrl->withBasePath($path)->withPath('');
                }

                return $adminUrl;
            };
        }
    }
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);
        }
    }
161523
public function register(Container $pimple)
    {
        $pimple['encryptor'] = function ($pimple) {
            return new Encryptor(
                $pimple['open_platform_config']['app_id'],
                $pimple['open_platform_config']['token'],
                $pimple['open_platform_config']['aes_key']
            );
        };

        $pimple['server'] = function ($pimple) {
            $server = new Guard($pimple['open_platform_config']['token']);
            $server->setAppId($pimple['config']['app_id']);

            $server->debug($pimple['config']['debug']);

            $server->setEncryptor($pimple['encryptor']);

            $server->setTestMessageHandler($this->getTestMessageHandler($pimple));

            return $server;
        };
    }