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
773081
public function register(Container $pimple)
    {
        $pimple['logger'] = $pimple['log'] = function ($app) {
            $config = $this->formatLogConfig($app);

            if (!empty($config)) {
                $app->rebind('config', $app['config']->merge($config));
            }

            return new LogManager($app);
        };
    }
1354977
public function register(Container $app)
    {
        $app[DataInterface::class] = $app->factory(Data::class);
        $app[ConfigInterface::class] = $app->factory(FileConfig::class);
    }
882910
public function register(\Pimple $mainContainer)
    {
        $mainContainer['core']['db'] = $mainContainer->share(function () {
            return \Pelican_Db::getInstance();
        });




        $mainContainer['core']['listener.ajax_response_render'] = $mainContainer->share(function () {
            return new AjaxRenderResponseListener(
                new \Pelican_Ajax_Adapter_Jquery()
            );
        });
    }
59911
protected function registerProviders(Container $container): void
    {
        foreach (self::$providers as $className) {
            $container->addServiceProvider($className);
        }
    }
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);
    }
679563
public static function initContainer($container)
    {
        if ($container instanceof \Pimple\Container) {
            static::$container = $container;
            static::$logger = static::$container
                ->offsetGet(\oat\oatbox\log\LoggerService::SERVICE_ID)
                ->getLogger();
        }
    }
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;
            }
        );
    }
29573
public function register(ContainerInterface $container)
    {
        if (! isset($container['session'])) {
            $container['session'] = function (ContainerInterface $container) {
                return new Session;
            };
        }

        if (! isset($container['router'])) {
            /**
             * This service MUST return a SHARED instance
             * of Mbh\Interfaces\RouterInterface.
             *
             * @param Container $container
             * @return RouterInterface
             */
            $container['router'] = function (ContainerInterface $container) {
                $routerCacheFile = false;
                if (isset($container->get('settings')['routerCacheFile'])) {
                    $routerCacheFile = $container->get('settings')['routerCacheFile'];
                }

                $router = (new Router)->setCacheFile($routerCacheFile);
                if (method_exists($router, 'setContainer')) {
                    $router->setContainer($container);
                }

                if (method_exists($router, 'setCallableResolver')) {
                    $router->setCallableResolver($container['callableResolver']);
                }

                return $router;
            };
        }
    }
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();
    }
774043
public function registerService($service, $name = '') {
        if (empty($name)) {
            $name = Assist::classNameShort($service);
        }

        static::$container->offsetSet(strtolower($name), $service);
    }
1075691
public function register(Container $container)
    {
        $container->register(new CacheServiceProvider());
        $container->register(new DatabaseServiceProvider());
        $container->register(new FilesystemServiceProvider());
        $container->register(new LoggerServiceProvider());
        $container->register(new ScriptServiceProvider());
        $container->register(new TranslatorServiceProvider());
        $container->register(new ViewServiceProvider());

        $this->registerKernelServices($container);
        $this->registerHandlerServices($container);
        $this->registerRouteServices($container);
        $this->registerMiddlewareServices($container);
        $this->registerRequestControllerServices($container);
        $this->registerModuleServices($container);
        $this->registerViewServices($container);
    }
938104
public function register(Container $container)
    {
        $this->registerFinder($container);
        $this->registerSections($container);
        $this->registerTemplate($container);
        $this->registerEngine($container);
    }
319283
public function register(Container $container)
    {
        // Authentication
        $container->share(Authentication::class, [$this, 'authentication'])
            ->bindShared(AuthenticationInterface::class, Authentication::class);

        // Authorisation
        $container->share(Authorisation::class, [$this, 'authorisation'])
            ->bindShared(AuthorisationInterface::class, Authorisation::class);

        // User Handler
        $this->prepareHandler($container);

        // User Manager
        $container->prepareSharedObject(UserManager::class);
    }
663605
private function getBuilder(Container $pimple)
    {
        $builder = ClientBuilder::create();

        $this->setFactory($builder, $pimple);
        $this->setSender($builder, $pimple);
        $this->setLogger($builder, $pimple);

        return $builder;
    }
565239
public function register(Container $container)
    {
        $container->share(get_class($this->package), $this->package)
            ->bindShared(AbstractPackage::class, get_class($this->package));

        $container->share('controller.resolver', function (Container $container) {
            return new ControllerResolver($this->package, $container);
        });

        $container->share('repository.resolver', function (Container $container) {
            return new RepositoryResolver($this->package, $container);
        })->alias('model.resolver', 'repository.resolver');

        $container->share('view.resolver', function (Container $container) {
            return new ViewResolver($this->package, $container);
        });

        $container->share('mvc.resolver', function (Container $container) {
            return new MvcResolver(
                $container->get('controller.resolver'),
                $container->get('repository.resolver'),
                $container->get('view.resolver')
            );
        });

        if ($this->package->app->isWeb()) {
            // Router
            $container->prepareSharedObject(PackageRouter::class)->alias('router', PackageRouter::class);
        }
    }
459876
public function register(PimpleContainer $app)
    {
        $app['capsule.connection_defaults'] = [
            'driver' => 'mysql',
            'host' => 'localhost',
            'database' => null,
            'username' => 'root',
            'password' => null,
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => null,
            'logging' => false,
        ];

        $app['capsule.container'] = function () {
            return new Container();
        };

        $app['capsule.dispatcher'] = function () use ($app) {
            return new Dispatcher($app['capsule.container']);
        };

        if (class_exists('Illuminate\Cache\CacheManager')) {
            $app['capsule.cache_manager'] = function () use ($app) {
                return new CacheManager($app['capsule.container']);
            };
        }

        $app['capsule.eloquent'] = true;

        $app['capsule'] = function ($app) {
            $capsule = new DB($app['capsule.container']);
            $capsule->setEventDispatcher($app['capsule.dispatcher']);

            if (isset($app['capsule.cache_manager']) && isset($app['capsule.cache'])) {
                $capsule->setCacheManager($app['capsule.cache_manager']);

                foreach ($app['capsule.cache'] as $key => $value) {
                    $app['capsule.container']->offsetGet('config')->offsetSet('cache.'.$key, $value);
                }
            }

            if (!isset($app['capsule.connections'])) {
                $app['capsule.connections'] = [
                    'default' => (isset($app['capsule.connection']) ? $app['capsule.connection'] : []),
                ];
            }

            foreach ($app['capsule.connections'] as $connection => $options) {
                $options = array_replace($app['capsule.connection_defaults'], $options);
                $logging = $options['logging'];
                unset($options['logging']);

                $capsule->addConnection($options, $connection);

                if ($logging) {
                    $capsule->getConnection($connection)->enableQueryLog();
                } else {
                    $capsule->getConnection($connection)->disableQueryLog();
                }
            }

            $capsule->bootEloquent();
            $capsule->setAsGlobal();

            $app['db'] = $app->factory(function ($c) {
                return DB::connection();
            });

            return $capsule;
        };
    }
280194
public function register(Container $pimple)
    {
        $pimple['singular.service.pack'] = function () use ($pimple) {
            return new PackService(
                $pimple['singular.directory.src'],
                $pimple['singular.directory.app'].DIRECTORY_SEPARATOR."packs"
            );
        };

        $pimple['singular.service.command'] = function() use ($pimple) {
            return new CommandService(
                $pimple['singular.directory.src'],
                $pimple['singular.service.pack']
            );
        };
        
        $pimple['singular.service.service'] = function() use ($pimple) {
            return new ServiceService(
                $pimple['singular.directory.src'],
                $pimple['singular.service.pack']
            );
        };

        $pimple['singular.service.store'] = function() use ($pimple) {
            return new StoreService(
                $pimple['singular.directory.src'],
                $pimple['singular.service.pack']
            );
        };

        $pimple['singular.service.controller'] = function() use ($pimple) {
            return new ControllerService(
                $pimple['singular.directory.src'],
                $pimple['singular.service.pack']
            );
        };

        $pimple['singular.service.module'] = function() use ($pimple) {
            return new ModuleService(
                $pimple['injector.directory.src']
            );
        };

        $pimple['singular.service.menu'] = function() use ($pimple) {
            return new MenuService(
                $pimple['singular.directory.root'],
                $pimple['db']
            );
        };

        $pimple['singular.service.front_controller'] = function() use ($pimple) {
            return new FrontControllerService(
                $pimple['injector.directory.src']
            );
        };

        $pimple['singular.service.front_service'] = function() use ($pimple) {
            return new FrontServiceService(
                $pimple['injector.directory.src']
            );
        };

        $pimple['singular.service.front_view'] = function() use ($pimple) {
            return new FrontViewService(
                $pimple['injector.directory.src']
            );
        };

        $pimple['singular.service.component'] = function() use ($pimple) {
            return new ComponentService(
                $pimple['singular.directory.root'],
                $pimple['db']
            );
        };

        $pimple['singular.command.create_pack'] = function () {
            return new CreatePackCommand();
        };
        
        $pimple['singular.command.disable_pack'] = function () {
            return new DisablePackCommand();
        };

        $pimple['singular.command.enable_pack'] = function () {
            return new EnablePackCommand();
        };

        $pimple['singular.command.create_command'] = function () {
            return new CreateCommandCommand();
        };

        $pimple['singular.command.create_service'] = function () {
            return new CreateServiceCommand();
        };

        $pimple['singular.command.create_controller'] = function () {
            return new CreateControllerCommand();
        };

        $pimple['singular.command.create_store'] = function () {
            return new CreateStoreCommand();
        };

        $pimple['singular.command.create_module'] = function () {
            return new CreateModuleCommand();
        };

        $pimple['singular.command.create_front_controller'] = function () {
            return new CreateFrontControllerCommand();
        };

        $pimple['singular.command.create_front_service'] = function () {
            return new CreateFrontServiceCommand();
        };

        $pimple['singular.command.create_front_view'] = function () {
            return new CreateFrontViewCommand();
        };

        $pimple['singular.command.create_component_migration'] = function () {
            return new CreateComponentMigrationCommand();
        };

        $pimple['singular.command.create_menu_migration'] = function () {
            return new CreateMenuMigrationCommand();
        };

        $pimple['singular.command.grant_full_access'] = function () {
            return new GrantFullAccessCommand();
        };
    }