Registers the service provider with a DI container.

@param   Container $container The DI container.

@return  void
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);
    }
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();
        };
    }
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()
            );
        }
    }
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);
    }
1278841
public function boot(Container $container)
    {
        // register an extension
        $container['events']->on(
            'f.extension.load',
            function (Extension $extension, array $options, $safe) use ($container) {
                $extension->setup($options);
                $container['command']->registerFunctions($extension->provideFunctions(), $safe);
                $container['command']->registerFilters($extension->provideFilters());
                if ($extension instanceof TemplateAware) {
                    $extension->setStack($container['template.stack']);
                }
                if ($extension instanceof FinderAware) {
                    $extension->setFinder($container['template.finder']);
                }
                if ($extension instanceof EngineAware) {
                    $extension->setEngine($container['engine']);
                }
                $container['events']->fire('f.extension.registered', $extension);
            }
        );

        // register a function
        $container['events']->on(
            'f.function.register',
            function ($function, callable $callback, $safe) use ($container) {
                $container['command']->registerFunctions([$function => $callback], $safe);
            }
        );

        // register a filter
        $container['events']->on(
            'f.filter.register',
            function ($filter, callable $callback) use ($container) {
                $container['command']->registerFilters([$filter => $callback]);
            }
        );

        $container['events']->on('f.bootstrapped', function () use ($container) {
            $container['command']->lock();
        });
    }
1327243
protected function setDependencies(Container $container)
    {
        parent::setDependencies($container);

        $this->setWidgetFactory($container['widget/factory']);

        if (isset($container['attachments/config'])) {
            $this->setConfig($container['attachments/config']);
        } elseif (isset($container['config']['attachments'])) {
            $this->setConfig($container['config']['attachments']);
        }
    }
612454
protected function setupContainer(Container $container)
    {
        $this->container = $container;

        if (! $this->container->bound('config')) {
            $this->container->instance('config', new Fluent);
        }
    }
1189704
protected function setDependencies(Container $container)
    {
        parent::setDependencies($container);

        $this->setAppConfig($container['config']);
        $this->setModelFactory($container['model/factory']);
    }
360476
public function make(Container $container)
    {
        $this->container = $container;

        $this->container->call([$this, 'dispatch']);

        $this->register();

        return $this;
    }
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);
        };
    }
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);
    }
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';
        });
    }
247013
public function register(Container $app): void
    {
        $this->registerWriters($app);
        $this->registerDependenciesOnXsltExtension($app);

        $app->register(new \phpDocumentor\Plugin\Graphs\ServiceProvider());
        $app->register(new \phpDocumentor\Plugin\Twig\ServiceProvider());
    }
494392
public function addContainer(MutableContainerInterface $container): void
    {
        $containerName = get_class($container);
        if (array_key_exists($containerName, $this->registry)) {
            throw new ContainerAlreadyRegisteredException($containerName);
        }

        $this->registry[$containerName] = $container;
    }
305691
protected function setDependencies(Container $container)
    {
        parent::setDependencies($container);

        $this->filesystems = $container['filesystems'];
        $this->filesystemConfig = $container['filesystem/config'];
    }
1244890
public function register(Container $container)
    {
        /** @var Config $configuration */
        $configuration = $container['config'];

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

        return $logger;
    }
75586
protected function registerFactoryServices(Container $container)
    {
        /**
         * @param  Container $container The Pimple DI container.
         * @return FactoryInterface
         */
        $container['property/input/factory'] = function (Container $container) {
            return new Factory([
                'base_class'       => PropertyInputInterface::class,
                'arguments'        => [[
                    'container' => $container,
                    'logger'    => $container['logger']
                ]],
                'resolver_options' => [
                    'suffix' => 'Input'
                ]
            ]);
        };

        /**
         * @param  Container $container The Pimple DI container.
         * @return FactoryInterface
         */
        $container['property/display/factory'] = function (Container $container) {
            return new Factory([
                'base_class'       => PropertyDisplayInterface::class,
                'arguments'        => [[
                    'container' => $container,
                    'logger'    => $container['logger']
                ]],
                'resolver_options' => [
                    'suffix' => 'Display'
                ]
            ]);
        };

        /**
         * @param  Container $container A Pimple DI container.
         * @return FactoryInterface
         */
        $container['secondary-menu/group/factory'] = function (Container $container) {
            return new Factory([
                'base_class'       => SecondaryMenuGroupInterface::class,
                'default_class'    => GenericSecondaryMenuGroup::class,
                'arguments'        => [[
                    'container'      => $container,
                    'logger'         => $container['logger'],
                    'view'           => $container['view'],
                    'layout_builder' => $container['layout/builder']
                ]],
                'resolver_options' => [
                    'suffix' => 'SecondaryMenuGroup'
                ]
            ]);
        };
    }