Register Provider

Method called by the Pimple DIC when registering. Set container to class
property and call the define method.

@param \Pimple\Container $container DIC
@return void
335003
public function register(\Pimple\Container $container)
    {
        $this->define();
        foreach ($this->hooks as $hookName => $hookDef) {
            $hook = $container["newHook.factory"];
            $hook->create($hookName, $hookDef);
            $container["hooks.service"]->addHook($hook);
        }
    }
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);
    }
653638
public function register(Container $container)
    {
        $dir = app()->getPath().'/config';
        $config = $container->get('config');
        $config->load($dir.'/config.php');
        $config->merge([
            'database' => load($dir.'/database.php'),
            'cache' => load($dir.'/cache.php'),
        ]);
        if (file_exists(app()->getPath().'/.env.yml')) {
            $config->merge(load(app()->getPath().'/.env.yml'));
        }
    }
311417
public function register(Container $container)
    {
        $config = $container->get('config')->get('cache');

        $container->add('cache', new CachePool($config));

        unset($config);
    }
75689
private function registerAlias(Container $pimple)
    {
        if ($this->builderAlias) {
            $pimple[$this->builderAlias] = function () use ($pimple) {
                return $pimple['http_client.builder'];
            };
        }

        if ($this->clientAlias) {
            $pimple[$this->clientAlias] = function () use ($pimple) {
                return $pimple['http_client.client'];
            };
        }

        return $pimple;
    }
938104
public function register(Container $container)
    {
        $this->registerFinder($container);
        $this->registerSections($container);
        $this->registerTemplate($container);
        $this->registerEngine($container);
    }
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);
    }
127004
public function register(Container $container)
    {
        /** @var Config $configuration */
        $configuration = $container['config'];

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

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

        return new TierConfiguration($configuration, $logger, $http, $container);
    }
37192
public function register(Container $container)
    {
        $container->prepareSharedObject(AssetManager::class);
        $container->prepareSharedObject(ScriptManager::class);

        AbstractScript::$instance = function () use ($container) {
            return $container->get(ScriptManager::class);
        };
    }
1085871
public function register(Container $pimple)
    {
        $pimple['merchant'] = function ($pimple) {
            $config = array_merge(
                ['app_id' => $pimple['config']['app_id']],
                $pimple['config']->get('payment', [])
            );

            return new Merchant($config);
        };

        $pimple['payment'] = function ($pimple) {
            return new Payment($pimple['merchant']);
        };

        $pimple['lucky_money'] = function ($pimple) {
            return new LuckyMoney($pimple['merchant']);
        };

        $pimple['merchant_pay'] = function ($pimple) {
            return new MerchantPay($pimple['merchant']);
        };

        $pimple['cash_coupon'] = function ($pimple) {
            return new CashCoupon($pimple['merchant']);
        };
    }
715435
public function registerProviders(Container $container)
    {
        $sysProvider = new PackageProvider($this);
        $container->registerServiceProvider($sysProvider);

        $sysProvider->boot();

        $providers = (array) $this->get('providers');

        foreach ($providers as $interface => &$provider) {
            if ($provider === false) {
                continue;
            }

            if (is_subclass_of($provider, ServiceProviderInterface::class)) {
                // Handle provider
                if ($provider instanceof ClassMeta || (is_string($provider) && class_exists($provider))) {
                    $provider = $container->newInstance($provider);
                }

                if ($provider === false) {
                    continue;
                }

                $container->registerServiceProvider($provider);

                if ($provider instanceof BootableProviderInterface || method_exists($provider, 'boot')) {
                    $provider->boot($container);
                }
            } else {
                // Handle Service
                if (is_numeric($interface)) {
                    $container->prepareSharedObject($provider);
                } else {
                    $container->bindShared($interface, $provider);
                }
            }
        }

        foreach ($providers as $provider) {
            if ($provider === false) {
                continue;
            }

            if (is_subclass_of($provider, ServiceProviderInterface::class) && (
                $provider instanceof BootableDeferredProviderInterface
                || method_exists($provider, 'bootDeferred')
            )) {
                $provider->bootDeferred($container);
            }
        }
    }
690980
public function register(Container $container)
    {
        $this->registerViewConfig($container);
        $this->registerLoaderServices($container);
        $this->registerEngineServices($container);
        $this->registerMustacheTemplatingServices($container);
        $this->registerTwigTemplatingServices($container);
        $this->registerViewServices($container);
    }
973301
protected function registerContextOptions(Container $container)
    {
        $defaultOptions = stream_context_get_options(stream_context_get_default());
        stream_context_set_default(array_merge(
            $defaultOptions,
            array($this->scheme => array('Container' => $container))
        ));
    }
1211900
public function register(Container $container)
    {
        $container->prepareSharedObject(CoreLanguage::class)
            ->bindShared(Language::class, CoreLanguage::class)
            ->bindShared(LanguageInterface::class, CoreLanguage::class);
    }
951766
protected function registerServiceProviders( $service_providers, Container $container ) {
		foreach ( $service_providers as $provider ) {
			$provider->register( $container );
		}
	}
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();
        };
    }
135989
public function register(Container $container)
    {
        $container->prepareSharedObject(ErrorManager::class, function (ErrorManager $error, Container $container) {
            foreach ((array) $this->config->get('error.handlers', []) as $key => $handler) {
                if (is_string($handler)) {
                    $handler = $container->newInstance($handler);
                }

                $error->addHandler($handler, is_numeric($key) ? null : $key);
            }

            return $error;
        });

        $container->extend(LoggerManager::class, function (LoggerManager $manager, Container $container) {
            if ($container->get('config')->get('error.log', false)) {
                $logger = $manager->createRotatingLogger('error', LogLevel::ERROR);
            } else {
                $logger = new NullLogger();
            }

            $manager->addLogger('error', $logger);

            return $manager;
        });
    }