Add contextual bindings for Horizon's services that inject the package's
Redis Sentinel manager.

@return void
543708
protected function rebindHorizonRedisFactory()
    {
        // Although not all of the classes that Horizon registers need an
        // instance of the Redis service, we'll set up contextual bindings
        // for any declared so we don't need to update this package in the
        // future every time Horizon adds or removes one:
        foreach ((new HorizonServiceBindings()) as $serviceClass) {
            $this->app->when($serviceClass)
                ->needs(RedisFactory::class)
                ->give(function () {
                    return $this->app->make('redis-sentinel.manager');
                });
        }
    }
1990
protected function initAsynPools()
    {
        if ($this->config->get('redis.enable', true)) {
            get_instance()->addAsynPool('redisPool', new RedisAsynPool($this->config, $this->config->get('redis.active')));
        }
        if ($this->config->get('mysql.enable', true)) {
            get_instance()->addAsynPool('mysqlPool', new MysqlAsynPool($this->config, $this->config->get('mysql.active')));
        }
    }
1146006
protected function registerServices()
    {
        $this->app->bind(
            'Xuma\Amaran\ViewBinder',
            'Xuma\Amaran\AmaranViewBinder'
        );

        $this->app->singleton('amaran', function($app) {
            $binder = new AmaranViewBinder($app['events']);

            return $this->app->make('Xuma\Amaran\AmaranHandler');
        });
    }
1053337
public function bootContainerBindings()
    {
        $this->bindElasticsearch();
        $this->bindLogger();
        $this->bindIndex();
        $this->bindQuery();
        $this->bindProxy();
        $this->bindResult();
    }
150108
public function boot()
    {
        $this->bootComponentDrivers();

        // If we want Laravel's Redis API to use Sentinel, we'll remove the
        // "redis" service from the deferred services in the container:
        if ($this->config->shouldOverrideLaravelRedisApi) {
            $this->removeDeferredRedisServices();
        }

        if ($this->config->shouldIntegrateHorizon) {
            $horizon = new HorizonServiceProvider($this->app, $this->config);
            $horizon->register();
            $horizon->boot();
        }
    }
782650
public function register()
    {
        $this->config = ConfigurationLoader::load($this->app);

        $this->registerServices();

        // If we want Laravel's Redis API to use Sentinel, we'll return an
        // instance of the RedisSentinelManager when requesting the "redis"
        // service:
        if ($this->config->shouldOverrideLaravelRedisApi) {
            $this->registerOverrides();
        }
    }
577661
protected function bindRepositories()
    {
        $bindings = [
            AttributeRepositoryContract::class      => AttributeRepository::class,
            AttributeValueRepositoryContract::class => AttributeValueRepository::class,
            ProductRepositoryContract::class        => ProductRepository::class,
            ProductTypeRepositoryContract::class    => ProductTypeRepository::class,
        ];

        foreach ($bindings as $contract => $implementation) {
            $this->app->bind($contract, $implementation);
        }
    }
341945
protected function addHorizonSentinelQueueConnector()
    {
        $this->app->make('queue')->extend('redis-sentinel', function () {
            $redis = $this->app->make('redis-sentinel.manager');

            return new HorizonRedisConnector($redis);
        });
    }
841560
private function insert()
    {
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '()');

        $plugins = Eresus_Plugin_Registry::getInstance();
        $files = arg('files');
        if ($files && is_array($files))
        {
            foreach ($files as $plugin => $install)
            {
                if ($install)
                {
                    try
                    {
                        $plugins->install($plugin);
                    }
                    catch (DomainException $e)
                    {
                        Eresus_Kernel::app()->getPage()->addErrorMessage($e->getMessage());
                    }
                }
            }

        }
        HttpResponse::redirect('admin.php?mod=plgmgr');
    }
1219573
protected function addRedisSentinelCacheStore()
    {
        $cache = $this->app->make('cache');

        $cache->extend('redis-sentinel', function ($app, $conf) use ($cache) {
            $redis = $app->make('redis-sentinel.manager');
            $prefix = $app->make('config')->get('cache.prefix');
            $connection = Arr::get($conf, 'connection', 'default');
            $store = new RedisStore($redis, $prefix, $connection);

            return $cache->repository($store);
        });
    }
1342725
private function addApiConfig() {
        $this->getDi()->setShared(ApiConfig::DI_NAME, new ApiConfig());

        $di = $this->getDi();
        $di->set(
            'dispatcher',
            function() use ($di) {

                $evManager = $di->getShared('eventsManager');

                $evManager->attach(
                    "dispatch:beforeException",
                    function($event, $dependencyInjectorspatcher, $exception)
                    {
                        switch ($exception->getCode()) {
                            case PhDispatcher::EXCEPTION_HANDLER_NOT_FOUND:
                            case PhDispatcher::EXCEPTION_ACTION_NOT_FOUND:
                                return false;
                        }
                    }
                );
                $dependencyInjectorsPatcher = new PhDispatcher();
                $dependencyInjectorsPatcher->setEventsManager($evManager);
                return $dependencyInjectorsPatcher;
            },
            true
        );

    }
129026
protected function initializeDependencies()
    {
        if ($this->securityContext === null) {
            $this->securityContext = Bootstrap::$staticObjectManager->get(Context::class);
        }

        if ($this->policyService === null) {
            $this->policyService = Bootstrap::$staticObjectManager->get(PolicyService::class);
        }
    }
132181
protected function registerActivations()
    {
        $this->app->singleton('sentinel.activations', function ($app) {
            $config = $app['config']->get('cartalyst.sentinel.activations');

            return new IlluminateActivationRepository($config['model'], $config['expires']);
        });
    }
170236
protected function registerCommands()
    {
        if ($this->app->runningInConsole()) {
            $this->commands([
                Console\InstallCommand::class,
                Console\AssetsCommand::class,
                Console\HorizonCommand::class,
                Console\ListCommand::class,
                Console\PurgeCommand::class,
                Console\PauseCommand::class,
                Console\ContinueCommand::class,
                Console\StatusCommand::class,
                Console\SupervisorCommand::class,
                Console\SupervisorsCommand::class,
                Console\TerminateCommand::class,
                Console\TimeoutCommand::class,
                Console\WorkCommand::class,
            ]);
        }

        $this->commands([Console\SnapshotCommand::class]);
    }
1213158
protected function registerServices()
    {
        foreach (Antvel::bindings() as $key => $value) {
            is_numeric($key)
                ? $this->app->singleton($value)
                : $this->app->singleton($key, $value);
        }
    }
331276
protected function configure()
    {
        $this
            ->setDescription('Make a query')
            ->addArgument(
                'app-name',
                InputArgument::REQUIRED,
                'App name'
            )
            ->addArgument(
                'index-name',
                InputArgument::REQUIRED,
                'Index name'
            )
            ->addArgument(
                'query',
                InputArgument::OPTIONAL,
                'Query text',
                ''
            )
            ->addOption(
                'page',
                null,
                InputOption::VALUE_OPTIONAL,
                'Page',
                ModelQuery::DEFAULT_PAGE
            )
            ->addOption(
                'size',
                null,
                InputOption::VALUE_OPTIONAL,
                'Number of results',
                ModelQuery::DEFAULT_SIZE
            )
            ->addOption(
                'parameter',
                null,
                InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
                'Query parameters',
                []
            );
    }
69672
protected function registerReminders()
    {
        $this->app->singleton('sentinel.reminders', function ($app) {
            $config = $app['config']->get('cartalyst.sentinel.reminders');

            return new IlluminateReminderRepository(
                $app['sentinel.users'], $config['model'], $config['expires']
            );
        });
    }