Register bindings for the Handler Locator.

@return void
13623
protected function registerLocator()
    {
        $this->app->singleton('tactician.locator', function($app) {

            $commandNamespace = $this->config('command_namespace');
            $handlerNamespace = $this->config('handler_namespace');
            $locator           = $this->config('locator');

            return (new $locator($this->app, $commandNamespace, $handlerNamespace));
        });
    }
560039
protected function registerBindings()
    {
        $this->app->bind('dropbox.connection', function (Container $app) {
            $manager = $app['dropbox'];

            return $manager->connection();
        });

        $this->app->alias('dropbox.connection', Client::class);
    }
570161
protected function registerHandlers() {
		set_exception_handler(function($exception) {
			$this->pushException($exception);
			
			echo $this->renderDebugBar();
		});
		
		register_shutdown_function(function() {
			if ($this->onShutdownCallback !== null) {
				$this->onShutdownCallback->__invoke($this);
			}
			
			// Debug bar rendering for the deferred mode
			if ($this->deferredMode) {
				// Garbage collection
				if ($this->profilesGcEnabled) {
					$this->gcCycle();
				}
				
				// Content creating
				$filePath = $this->deferredDir . DIRECTORY_SEPARATOR . 'profile_' . $this->token . '.html';
				if (file_put_contents($filePath, $this->renderDebugBar()) === false) {
					throw new InvalidPath('Unable to write the debug data into: "' . $filePath . '"');
				}
			}
		});
	}
417665
public function bind()
    {
        parent::bind();

        // In environments that are not a skeleton app we use an Application
        // instance to hold the paths.
        if (!$this->app->bound(Application::class)) {
            $this->app->instance(Application::class, $this->createPlaceholderApp());
        }

        $this->assignPathsToApp($this->app->make(Application::class));

        $this->app->resolving(PathFinder::class, function ($paths) {
            $this->assignBaseAppPaths($paths);
        });

        $this->app->resolving(StringConverterChain::class, function ($chain) {
            $this->addStringConverters($chain);
        });

        $this->app->resolving(TextFormatter::class, function ($formatter, $app) {
            $formatter->setLocalizer($app('Ems\Contracts\Core\Localizer'));
        });

        $this->app->bind('ems::locale-config', function ($ioc) {

            /** @var Application $app */
            $app = $ioc(Application::class);
            $storage = new NestedFileStorage();
            $storage->setUrl($app->path('ems-resources')->append('lang'));
            $storage->setNestingLevel(1);

            $provider = new ArrayProvider();
            $provider->add($storage);

            return $provider;

        }, true);

        $this->app->bind(Matcher::class, function ($ioc) {
            return new Matcher($ioc(CheckerContract::class), $ioc(ExtractorContract::class));
        }, true);

        $this->app->resolving(Formatter::class, function (Formatter $formatter, $app) {
            $formatter->setFormats($app('ems::locale-config'));
        });

        $this->app->resolving(TextParserQueue::class, function ($queue, $app) {
            $queue->add($app(VariablesTextParser::class));
        });

        $this->app->resolving(AnythingProvider::class, function ($provider, $app) {
            $provider->createObjectsWith($app);
        });

        $this->app->resolving(SupportsCustomFactory::class, function ($object) {
            $object->createObjectsBy($this->app);
        });

        $this->app->resolving(HasInjectMethods::class, function (HasInjectMethods $object) {
            $this->autoInjectDependendies($object);
        });

        $this->app->resolving(ConnectionPoolContract::class, function (ConnectionPoolContract $pool) {
            /** @return void */
            $pool->extend('php', function (UrlContract $url) {
                if ($url->scheme == 'php' || $url->scheme == 'file') {
                    return new FilesystemConnection($url);
                }
                return null;
            });
        });
    }
697508
public function register()
    {
        if ($this->app instanceof \Laravel\Lumen\Application) {
            $this->inLumen = true;

            $this->app->configure('app');

            unset($this->app->availableBindings['translator']);
        }

        parent::register();

        $this->registerCommands();
    }
171980
protected function registerBindings()
    {
        $this->app->bind('FluxBB\Models\GroupRepositoryInterface', function ($app) {
            return new GroupRepository($app['cache']);
        });

        $this->app->bind('FluxBB\Models\ConfigRepositoryInterface', function ($app) {
            return new ConfigRepository($app['cache.store'], $app['Illuminate\Database\ConnectionInterface']);
        });

        $this->app->bind('FluxBB\Models\CategoryRepositoryInterface', function ($app) {
            return new CategoryRepository($app['Illuminate\Database\ConnectionInterface']);
        });

        $this->app->bind('FluxBB\Models\ConversationRepositoryInterface', function ($app) {
            return new ConversationRepository($app['Illuminate\Database\ConnectionInterface']);
        });
    }
194195
protected function bindEvents(): void
    {
        $userConfig = $this->app['config'][static::$abstract];

        $handler = new EventHandler($this->app->events, $userConfig);

        $handler->subscribe();

        $handler->subscribeQueueEvents($this->app->queue);

        if (isset($userConfig['send_default_pii']) && $userConfig['send_default_pii'] !== false) {
            $handler->subscribeAuthEvents();
        }
    }
23343
public function registerDispatcher()
    {
        $this->app->singleton('ajax.dispatcher', function ($app) {
            return new Dispatcher(
                $app['ajaxes.collection'],
                $app['router'],
                $app
            );
        });

        $this->app->alias('ajax.dispatcher', Dispatcher::class);
    }
738528
protected function registerTranslationBindings()
    {
        $this->singleton('translator', function () {
            $this->configure('app');

            $this->instance('path.lang', $this->getLanguagePath());

            $this->register('Orchestra\Translation\TranslationServiceProvider');

            return $this->make('translator');
        });
    }
914909
private function registerBindings()
    {
        $this->app->bind('society.isInstalled', function ($app) {
            return
                file_exists(base_path('.env')) &&
                file_exists(storage_path('app/installed')) &&
                Schema::hasTable('migrations');
        });
    }
688841
protected function registerHelperInterfaceBindings()
    {
        $this->app->singleton(RouteHelperInterface::class, RouteHelper::class);
        $this->app->singleton(ModuleHelperInterface::class, ModuleHelper::class);
        $this->app->singleton(MetaReferenceDataProviderInterface::class, MetaReferenceDataProvider::class);
        $this->app->singleton(TranslationLocaleHelperInterface::class, TranslationLocaleHelper::class);
        $this->app->singleton(ModelListMemoryInterface::class, ModelListMemory::class);
        $this->app->singleton(ValidationRuleDecoratorInterface::class, ValidationRuleDecorator::class);
        $this->app->bind(ValidationRuleMergerInterface::class, ValidationRuleMerger::class);

        return $this;
    }
1277523
protected function init_handlers() {
		$keys = [ self::KEY_SCRIPTS, self::KEY_STYLES ];
		foreach ( $keys as $key ) {
			if ( $this->hasConfigKey( $key ) ) {
				$this->add_handler( $key );
			}
		}
	}
849393
public function register()
    {
        $this->resolveDirectories();

        $this->tryRequireHelpers(self::ON_REGISTER);
        $this->tryRegisterProviders(self::ON_REGISTER);

        if (method_exists($this, $this->bootingMethod)) {
            $this->app->booting(function (Application $app) {
                $app->call([$this, $this->bootingMethod]);
            });
        }

        if (method_exists($this, $this->bootedMethod)) {
            $this->app->booted(function (Application $app) {
                $app->call([$this, $this->bootedMethod]);
            });
        }

        // Config
        $this->registerConfigFiles();

        // Middlewares
        if (!$this->app->runningInConsole()) {
            $router = $this->app->make('router');
            $kernel = $this->app->make('Illuminate\Contracts\Http\Kernel');

            foreach ($this->prependMiddleware as $middleware) {
                $kernel->prependMiddleware($middleware);
            }

            foreach ($this->middleware as $middleware) {
                $kernel->pushMiddleware($middleware);
            }

            foreach ($this->routeMiddleware as $key => $middleware) {
                $router->middleware($key, $middleware);
            }
        }

        // Container bindings and aliases
        foreach ($this->bindings as $binding => $class) {
            $this->app->bind($binding, $class);
        }

        foreach ($this->weaklings as $binding => $class) {
            $this->bindIf($binding, $class);
        }

        foreach (['share' => $this->share, 'shared' => $this->shared] as $type => $bindings) {
            foreach ($bindings as $binding => $class) {
                $this->share($binding, $class, [], $type === 'shared');
            }
        }

        foreach ($this->singletons as $binding => $class) {
            if ($this->strict && !class_exists($class) && !interface_exists($class)) {
                throw new \Exception(get_called_class().": Could not find alias class [{$class}]. This exception is only thrown when \$strict checking is enabled");
            }
            $this->app->singleton($binding, $class);
        }

        foreach ($this->aliases as $alias => $full) {
            if ($this->strict && !class_exists($full) && !interface_exists($full)) {
                throw new \Exception(get_called_class().": Could not find alias class [{$full}]. This exception is only thrown when \$strict checking is enabled");
            }
            $this->app->alias($alias, $full);
        }

        // Commands
        if ($this->app->runningInConsole()) {
            foreach ($this->findCommands as $path) {
                $dir = path_get_directory((new ReflectionClass(get_called_class()))->getFileName());
                $classes = $this->findCommandsIn(path_join($dir, $path), $this->findCommandsRecursive);

                $this->commands = array_merge($this->commands, $classes);
            }
            if (is_array($this->commands) && count($this->commands) > 0) {
                $commands = [];
                foreach ($this->commands as $k => $v) {
                    if (is_string($k)) {
                        $this->app[ $this->commandPrefix.$k ] = $this->app->share(function ($app) use ($k, $v) {
                            return $app->build($v);
                        });

                        $commands[] = $this->commandPrefix.$k;
                    } else {
                        $commands[] = $v;
                    }
                }
                $this->commands($commands);
            }
        }
        // Facades
        if (class_exists('Illuminate\Foundation\AliasLoader')) {
            \Illuminate\Foundation\AliasLoader::getInstance($this->facades)->register();
        }

        // Helpers
        $this->tryRequireHelpers(self::ON_REGISTERED);

        $this->tryRegisterProviders(self::ON_REGISTERED);

        return $this->app;
    }
334091
protected function registerCommands()
    {
        $this->app->bind('command.log-reader.delete', 'Jackiedo\LogReader\Console\Commands\LogReaderDeleteCommand');
        $this->app->bind('command.log-reader.detail', 'Jackiedo\LogReader\Console\Commands\LogReaderDetailCommand');
        $this->app->bind('command.log-reader.file-list', 'Jackiedo\LogReader\Console\Commands\LogReaderFileListCommand');
        $this->app->bind('command.log-reader.get', 'Jackiedo\LogReader\Console\Commands\LogReaderGetCommand');
        $this->app->bind('command.log-reader.remove-file', 'Jackiedo\LogReader\Console\Commands\LogReaderRemoveFileCommand');

        $this->commands('command.log-reader.delete');
        $this->commands('command.log-reader.detail');
        $this->commands('command.log-reader.file-list');
        $this->commands('command.log-reader.get');
        $this->commands('command.log-reader.remove-file');
    }
1139803
protected function registerSessionBinder()
    {
        list($app, $me) = array($this->app, $this);

        $app->booted(function() use ($app, $me)
        {
            // If the current session has an "errors" variable bound to it, we will share
            // its value with all view instances so the views can easily access errors
            // without having to bind. An empty bag is set when there aren't errors.
            if ($me->sessionHasErrors($app))
            {
                $errors = $app['session.store']->get('errors');

                $app['view']->share('errors', $errors);
            }

            // Putting the errors in the view for every view allows the developer to just
            // assume that some errors are always available, which is convenient since
            // they don't have to continually run checks for the presence of errors.
            else
            {
                $app['view']->share('errors', new ViewErrorBag);
            }
        });
    }
585273
protected function registerIronRequestBinder()
    {
        $this->app->rebinding('request', function ($app, $request) {
            if ($app['queue']->connected('iron')) {
                $app['queue']->connection('iron')->setRequest($request);
            }
        });
    }
224221
protected function registerRequestBindings()
  {
    $this->singleton('Illuminate\Http\Request', function () {
      // create a new request object
      $request = Request::capture();
      // create an arbitrary response object
      $this->response = new Response;
      // get a SessionManager from the container
      $manager = $this['session'];
      // startup the StartSession middleware
      $middleware = new StartSession($manager);
      $middleware->handle($request, function() {
        return $this->response;
      });
      // print out any cookies created by the session system
      foreach($this->response->headers->getCookies() as $cookie) {
        @header('Set-Cookie: '.$cookie);
      }
      return $request;
    });
  }