Register the Mapper decorator.

@param Container $app
435594
public function registerAutoPresenterMapper(Container $app)
    {
        $app->singleton('autopresentermapper', function () {
            return new AutoPresenterMapper();
        });

        $autoPresenter = $app->make('autopresenter');
        $autoPresenter->register(new MapperDecorator($autoPresenter, $this->app->make('autopresentermapper'), $this->app));
    }
433368
public function register(Application $app)
    {
        $app['parser.example.finder'] = new Example\Finder();

        $this->addCache($app);
        $this->addAssemblers($app);
        $this->addFilters($app);
        $this->addValidators($app);
        $this->addBuilder($app);

        // I would prefer to extend it but due to a circular reference will pimple fatal
        $this->attachFiltersToManager($app['descriptor.filter'], $app);

        $app['descriptor.analyzer'] = function () {
            return new ProjectAnalyzer();
        };
    }
307688
protected function checkDependencies(Container $app)
    {
        $dependencies = [
            'twig' => 'TwigServiceProvider',
            'session' => 'SessionServiceProvider',
            'translator' => 'TranslationServiceProvider',
            'validator' => 'ValidatorServiceProvider',
            'form.factory' => 'FormServiceProvider',
            'security.token_storage' => 'SecurityServiceProvider'
        ];

        if (!$app['resolver'] instanceof ServiceControllerResolver) {
            throw new LogicException('You must register the ServiceControllerServiceProvider to use the UserServiceProvider');
        }

        foreach ($dependencies as $key => $provider) {
            if (!isset($app[$key])) {
                throw new LogicException(sprintf('You must register the %s to use the UserServiceProvider', $provider));
            }
        }
    }
777610
public function register(App $app)
    {
        $app["logger.service"] = $app->protect(
            function (string $loggerName = "") use ($app) {
                $cacheName = "logger.service-{$loggerName}";
                if (isset($app[$cacheName])) {
                    return $app[$cacheName];
                }
                /*
                 * Check the config service has been defined and provides correct
                 * object
                 */
                if (isset($app["config.service"]) === false
                    || get_class($app["config.service"]) !== "SlaxWeb\\Config\\Container") {
                    throw new \SlaxWeb\Bootstrap\Exception\LoggerConfigException(
                        "Config component provider must be registered before you can use the Logger component."
                    );
                }

                $config = $app["config.service"];
                if ($loggerName === "") {
                    $loggerName = $config["logger.defaultLogger"];
                }

                $logger = new MLogger($loggerName);
                foreach ($config["logger.loggerSettings"][$loggerName] as $type => $settings) {
                    // load propper handler and instantiate the Monolog\Logger
                    $handler = null;
                    switch ($type) {
                        case Helper::L_TYPE_FILE:
                            $app["temp.logger.settings"] = $settings;
                            $handler = $app["logger.{$type}.service"];
                            unset($app["temp.logger.settings"]);
                            break;
                        default:
                            throw new \SlaxWeb\Bootstrap\Exception\UnknownLoggerHandlerException(
                                "The handler you are tring to use is not known or not supported."
                            );
                    }
                    $logger->pushHandler($handler);
                }

                return $app[$cacheName] = $logger;
            }
        );

        $app["logger.StreamHandler.service"] = $app->factory(
            function (App $cont) {
                $settings = $cont["temp.logger.settings"];

                // if the log file name does not begin with a dir separator, treat
                // it as relative path and prepend 'logFilePath'
                if ($settings[0][0] !== DIRECTORY_SEPARATOR) {
                    $settings[0] = ($cont["config.service"]["logger.logFilePath"] ?? "")
                        . $settings[0];
                }
                return new \Monolog\Handler\StreamHandler(...$settings);
            }
        );
    }
1169236
public function register(App $app)
    {
        $app["hooks.service"] = function (App $app) {
            return new \SlaxWeb\Hooks\Container($app["logger.service"]("System"));
        };

        $app["newHook.factory"] = $app->factory(
            function (App $app) {
                return new \SlaxWeb\Hooks\Hook;
            }
        );
    }
368059
public function register(Application $app)
    {
        if ($this->registered) {
            throw new \RuntimeException('Can not re-register extensions.');
        }
        foreach ($this->extensions as $extension) {
            if ($extension->isEnabled() !== true) {
                continue;
            }
            $extension->getInnerExtension()->setContainer($app);
            foreach ($extension->getInnerExtension()->getServiceProviders() as $provider) {
                $app->register($provider);
            }
        }
        $this->registered = true;

        // @deprecated Deprecated since 3.0, to be removed in 4.0.
        $this->app = $app;
    }
400154
public function register(Application $app)
    {
        $app[self::TEMPLATE_FOLDER] = realpath(__DIR__ . '/data/templates/');
        $app[self::CONVERTERS] = array(
            '\phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\ToHtml' => array(Format::RST, Format::HTML),
        );

        $app[self::FORMATS] = $app->share(
            function () {
                return new Converter\Format\Collection();
            }
        );
        $app[self::CONVERTER_DEFINITION_FACTORY] = $app->share(
            function ($container) {
                return new Factory($container[ServiceProvider::FORMATS]);
            }
        );
        $app[self::CONVERTER_FACTORY] = $app->share(
            function ($container) {
                return new Converter\Factory(
                    $container['converters'],
                    $container['converter_definition_factory'],
                    $container['monolog']
                );
            }
        );
        $app[self::TEMPLATE_FACTORY]  = $app->share(
            function ($app) {
                return new Template\Factory(
                    array('twig' => new Template\Twig($app[ServiceProvider::TEMPLATE_FOLDER]))
                );
            }
        );

        $this->addCommands($app);
    }
948075
public function register(Application $app)
    {
        $app['guzzle.base_url'] = '/';
        if(!isset($app['guzzle.plugins'])){
            $app['guzzle.plugins'] = array();
        }

        // Register a Guzzle ServiceBuilder
        $app['guzzle'] = $app->share(function () use ($app) {
            if (!isset($app['guzzle.services'])) {
                $builder = new ServiceBuilder(array());
            } else {
                $builder = ServiceBuilder::factory($app['guzzle.services']);
            }

            return $builder;
        });

        // Register a simple Guzzle Client object (requires absolute URLs when guzzle.base_url is unset)
        $app['guzzle.client'] = $app->share(function() use ($app) {
            $client = new Client($app['guzzle.base_url']);

            foreach ($app['guzzle.plugins'] as $plugin) {
                $client->addSubscriber($plugin);
            }

            return $client;
        });
    }
776226
public function bootstrap(Container $app) {
	    $extensions = $this->manager->getAvailableExtensions()->filterByActivated();

        $this->dispatcher->registerCollection($extensions);
        $this->dispatcher->boot();
	}
517076
public function bindIlluminateCore(Container $app = null)
    {
        if (! $app) {
            $app = new Container();
        }

        $this->ensureIlluminateBase($app);

        // Core classes
        $app->bindIf('url', $this->illuminateClasses[ 'url' ]);

        // Session and request
        $app->bindIf('session.manager', function ($app) {
            return new SessionManager($app);
        });

        $app->bindIf('session', function ($app) {
            return $app['session.manager']->driver('array');
        }, true);

        $app->bindIf('request', function ($app) {
            $request = Request::createFromGlobals();

            if (method_exists($request, 'setSessionStore')) {
                $request->setSessionStore($app['session']);
            } else {
                $request->setSession($app['session']);
            }

            return $request;
        }, true);

        // Config
        $app->bindIf('path.config', function ($app) {
            return $this->illuminateConfigPath;
        }, true);

        $app->bindIf('config', function ($app) {
            $config = new Repository;
            $this->loadIlluminateConfig($app, $config);

            return $config;
        }, true);

        // Localization
        $app->bindIf('translation.loader', function ($app) {
            return new FileLoader($app['files'], 'src/config');
        });

        $app->bindIf('translator', function ($app) {
            $loader = new FileLoader($app['files'], 'lang');

            return new Translator($loader, 'en');
        });

        return $app;
    }
491319
private function registerRememberMeServices(Container $app)
    {
        $app['security.remember_me.service._proto'] = $app->protect(function ($providerKey, $options) use ($app) {
            return function () use ($providerKey, $options, $app) {
                $options = array_replace([
                    'name' => 'REMEMBERME',
                    'lifetime' => 31536000,
                    'path' => '/',
                    'domain' => null,
                    'secure' => false,
                    'httponly' => true,
                    'always_remember_me' => false,
                    'remember_me_parameter' => '_remember_me',
                ], $options);

                return new UserTokenBasedRememberMeServices(
                    [$app['security.user_provider.'.$providerKey]],
                    $options['key'],
                    $providerKey,
                    $options,
                    $app['logger']
                );
            };
        });
    }
1020954
protected function registerApiHelper(Application $app)
    {
        $app->singleton(Factory::class, function ($app) {
            $request = $app['request'];
            $config = $app['config'];

            return new Factory($request, $config);
        });

        $app->alias(Factory::class, 'apihelper');
    }
537656
public function register(Container $app)
    {
        $app["slaxer.service"] = function (Container $app) {
            $cliApp = new CLIApp("Slaxer", "0.4.*-dev");

            if (isset($app["slaxerCommands"]) === false) {
                return $cliApp;
            }

            foreach ($app["slaxerCommands"] as $key => $value) {
                $params = [];
                if (is_int($key)) {
                    $command = $value;
                } else {
                    $command = $key;
                    if (is_string($value)) {
                        $value = [$value];
                    }
                    foreach ($value as $service) {
                        $params[] = $app[$service];
                    }
                }

                $cmd = new $command($app["logger.service"]("Slaxer"));
                if (method_exists($cmd, "init")) {
                    $cmd->init(...$params);
                }
                $cliApp->add($cmd);
            }

            return $cliApp;
        };
    }
189156
public function configure(Container $app): Pointcut
    {
        return new Pointcut(
            new AnnotationScanMatcher($this->annotation),
            (new Matcher)->any(),
            []
        );
    }
74301
public function register(Container $app)
    {
        $this->kernel                        = $app;
        $app['request_matcher']              = $app->extend(
            'request_matcher',
            function ($urlMatcher, $c) {
                $context = $c['request_context'];
                
                $newMatcher = new GroupUrlMatcher(
                    $context,
                    [
                        new CacheableRouterUrlMatcherWrapper(
                            $this->getRouter($context)->getMatcher(),
                            $c['routing.config.namespaces']
                        ),
                        $urlMatcher,
                    ]
                );
                
                return $newMatcher;
            }
        );
        $app['url_generator']                = $app->extend(
            'url_generator',
            function ($generator, $kernel) {
                /** @var SilexKernel $kernel */
                
                /** @var RequestContext $context */
                //$context = $kernel['request_context'];
                /** @var Router $router */
                $router       = $kernel['router'];
                $newGenerator = $router->getGenerator();
                
                //$newGenerator = new UrlGenerator($router->getRouteCollection(), $context);
                
                return new GroupUrlGenerator(
                    [
                        $newGenerator,
                        $generator,
                    ]
                );
            }
        );
        $app['router']                       = function ($app) {
            return $this->getRouter($app['request_context']);
        };
        $app['routing.config.data_provider'] = function ($app) {
            $routingConfig = $app['routing.config'];
            
            return $this->processConfiguration(
                $routingConfig,
                new CacheableRouterConfiguration()
            );
        };
        $app['routing.config.namespaces']    = function () {
            return $this->getConfigDataProvider()->getOptional(
                'namespaces',
                DataProviderInterface::ARRAY_TYPE,
                []
            );
        };
        $app['routing.config.cache_dir']     = function () {
            return $this->getConfigDataProvider()->getOptional('cache_dir');
        };
    }
434727
public function register(Container $app)
    {
        $app['singular.packs'] = function () use ($app) {
            return new Container();
        };

        $app['singular.service_map'] = function () use ($app) {
            return new Container();
        };

        $app['singular.config_loader'] = function () use ($app) {
            return new ConfigLoader($app);
        };

        $app['singular.service_locator'] = function () use ($app) {
            return new ServiceLocator(
                $app['singular.packs'],
                $app['singular.service_map'],
                $app['singular.resolver']
            );
        };

        $app['singular.service_resolver'] = function () use ($app) {
            return new ServiceResolver($app);
        };

        $app['singular.resolver'] = function () use ($app) {
            return new Resolver(
                $app['singular.controller_resolver'],
                $app['singular.service_resolver']
            );
        };

        $app['singular.controller_locator'] = function () use ($app) {
            return new ControllerLocator(
                $app['singular.resolver'],
                $app['singular.packs'],
                $app['singular.service_map']
            );
        };

        $app['singular.controller_resolver'] = function () use ($app) {
            return new ControllerResolver($app);
        };
    }
868345
public function configure(Container $app): Pointcut
    {
        $interceptor = new LoggableInterceptor;
        $interceptor->setLogger($app[LoggerInterface::class]);
        $this->setInterceptor($interceptor);

        return $this->withAnnotatedAnyInterceptor();
    }