Register Chiron system services.

@param ContainerInterface $container A DI container implementing ArrayAccess and container-interop.
18499
public function register(KernelInterface $kernel): void
    {
        // *** register factories ***
        $kernel->closure(RequestFactoryInterface::class, function () {
            return new RequestFactory();
        });

        $kernel->closure(ResponseFactoryInterface::class,function () {
            return new ResponseFactory();
        });

        $kernel->closure(ServerRequestFactoryInterface::class, function () {
            return new ServerRequestFactory();
        });

        $kernel->closure(UriFactoryInterface::class, function () {
            return new UriFactory();
        });

        $kernel->closure(UploadedFileFactoryInterface::class, function () {
            return new UploadedFileFactory();
        });

        $kernel->closure(StreamFactoryInterface::class, function () {
            return new StreamFactory();
        });

        // *** register alias ***
        $kernel->alias(RequestFactory::class, RequestFactoryInterface::class);
        $kernel->alias(ResponseFactory::class, ResponseFactoryInterface::class);
        $kernel->alias(ServerRequestFactory::class, ServerRequestFactoryInterface::class);
        $kernel->alias(UriFactory::class, UriFactoryInterface::class);
        $kernel->alias(UploadedFileFactory::class, UploadedFileFactoryInterface::class);
        $kernel->alias(StreamFactory::class, StreamFactoryInterface::class);

/*
        $kernel[RequestFactory::class] = function ($c) {
            return $c->get(RequestFactoryInterface::class);
        };

        $kernel[ResponseFactory::class] = function ($c) {
            return $c->get(ResponseFactoryInterface::class);
        };

        $kernel[ServerRequestFactory::class] = function ($c) {
            return $c->get(ServerRequestFactoryInterface::class);
        };

        $kernel[UriFactory::class] = function ($c) {
            return $c->get(UriFactoryInterface::class);
        };

        $kernel[UploadedFileFactory::class] = function ($c) {
            return $c->get(UploadedFileFactoryInterface::class);
        };

        $kernel[StreamFactory::class] = function ($c) {
            return $c->get(StreamFactoryInterface::class);
        };*/
    }
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;
            };
        }
    }
867160
public function add(ContainerInterface $container, $name = null)
    {
        if ($name !== null) {
            $this->containers[$name] = $container;
        } else {
            array_push($this->containers, $container);
        }
    }
3699
public function setServiceLocator(ContainerInterface $container)
    {
        trigger_error(sprintf(
            'Usage of %s is deprecated since v3.0.0; please pass the container to the constructor instead',
            __METHOD__
        ), E_USER_DEPRECATED);
        $this->creationContext = $container;
    }
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();
        });
    }
1043797
public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
        if ($container) {
            // Specifically inject translator for tryTranslate method
            $this->translator = $container->get('translator');
        }
    }
664002
public function register(Container $container)
    {
        $container['aura.html.locatorFactory'] = function () {
            return new HelperLocatorFactory();
        };
        $container['aura.html.locator'] = function (Container $container) {
            return $container['aura.html.locatorFactory']->newInstance();
        };
        $container['aura.html.escaper'] = function (Container $container) {
            return $container['aura.html.locator']->escape();
        };
    }
238323
public function checkServices(ContainerInterface $container)
    {
        /** @var DIServiceWrapper $service */
        foreach ($this->getServices() as $service) {
            if ($container->has($service->getKey())) {
                throw new SystemServiceOverwriteException($service->getKey() . ' is already defined');
            }
        }
    }
669578
public function addContainer(ContainerInterface $container)
    {
        $container->setDelegator($this);
        $this->containers[] = $container;
        return $this;
    }
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);
    }
140012
public function register(Container $container)
    {
        $container->prepareSharedObject(RendererManager::class, [$this, 'manager']);
        $container->prepareSharedObject(PackageFinder::class);
        $container->share(WidgetManager::class, [$this, 'widget']);
    }
265835
public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
        $this->resourceManager = $container->get('claroline.manager.resource_manager');
        $this->workspaceManager = $container->get('claroline.manager.workspace_manager');
        $this->om = $container->get('claroline.persistence.object_manager');
        $this->tokenStorage = $container->get('security.token_storage');
        $this->request = $container->get('request_stack');
        $this->httpKernel = $container->get('httpKernel');
        $this->filesDir = $container->getParameter('claroline.param.files_directory');
    }
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);
    }
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);
    }
43933
public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
        $this->eventDispatcher = $this->container->get('event_dispatcher');
    }
1244890
public function register(Container $container)
    {
        /** @var Config $configuration */
        $configuration = $container['config'];

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

        return $logger;
    }
252119
public function register(Container $container)
    {
        if (!isset($container['console'])) {
            throw new \LogicException('You must register the ConsoleServiceProvider to use the WebServerServiceProvider.');
        }

        $container['web_server.document_root'] = null;
        $container['web_server.environment'] = 'dev';

        $commands = [
            'server:run' => 'web_server.command.server_run',
            'server:start' => 'web_server.command.server_start',
            'server:stop' => 'web_server.command.server_stop',
            'server:status' => 'web_server.command.server_status',
        ];

        $container['web_server.command.server_run'] = function (Container $container) {
            if (null === $docRoot = $container['web_server.document_root']) {
                throw new \LogicException('You must set the web_server.document_root parameter to use the development web server.');
            }

            return new ServerRunCommand($docRoot, $container['web_server.environment']);
        };

        $container['web_server.command.server_start'] = function (Container $container) {
            if (null === $docRoot = $container['web_server.document_root']) {
                throw new \LogicException('You must set the web_server.document_root parameter to use the development web server.');
            }

            return new ServerStartCommand($docRoot, $container['web_server.environment']);
        };

        $container['web_server.command.server_stop'] = function () {
            return new ServerStopCommand();
        };

        $container['web_server.command.server_status'] = function () {
            return new ServerStatusCommand();
        };

        if (class_exists(ConsoleFormatter::class)) {
            $container['web_server.command.server_log'] = function () {
                return new ServerLogCommand();
            };
            $commands['server:log'] = 'web_server.command.server_log';
        }

        $container['console.command.ids'] = array_merge($container['console.command.ids'], $commands);
    }