Register a new queue worker. This allows us to capture heartbeats of
the queue actually working. We need to take the Laravel version into
account, because <=5.2 uses a different worker construct compared
to >=5.3.

@return void
5887
protected function registerQueueWorker()
    {
        $this->app->singleton('queue.worker', function () {
            if ($this->eye->laravelVersionIs('>=', '5.3.0')) {
                return new Worker($this->app['queue'], $this->app['events'], $this->app[ExceptionHandler::class]);
            } else {
                return new WorkerLegacy($this->app['queue'], $this->app['queue.failer'], $this->app['events']);
            }
        });
    }
754196
public function register()
    {
        $this->app->singleton('Illuminate\Bus\Dispatcher', function ($app) {
            return new Dispatcher($app, function ($connection = null) use ($app) {
                return $app['Illuminate\Contracts\Queue\Factory']->connection($connection);
            });
        });

        $this->app->alias(
            'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\Dispatcher'
        );

        $this->app->alias(
            'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\QueueingDispatcher'
        );
    }
821581
public function register()
    {
        $this->app->singleton(
            'actions',
            function ($app)
            {
                return (new Dispatcher($app))->setQueueResolver(
                    function () use ($app)
                    {
                        return $app->make('Illuminate\Contracts\Queue\Queue');
                    }
                );
            }
        );
    }
370808
public function register()
	{
		$app = $this->app ?: app();
		$app_version = method_exists($app, 'version') ? $app->version() : $app::VERSION;

		if ( version_compare( $app_version, '5.0', '<' ) )
		{
			$this->is_laravel_5 = false;
		}

		$this->app->singleton('laravel-swiftmailer.mailer', function($app)
		{
			/** @var \Illuminate\Foundation\Application $app */
			$mailer = new Mailer( $app->make('mailer') );

			if ( $app->bound('queue') )
			{
				$this->is_laravel_5 ? $mailer->setQueue($app['queue.connection']) : $mailer->setQueue($app['queue']);
			}

			return $mailer;
		} );
	}
1289272
public function register()
    {
        $this->app->singleton('mutex', function ($app) {
            return new Mutex\Factory(
                $app->make('config')->get('mutex')
            );
        });

        $this->commands([
            Console\Test::class,
        ]);
    }
1264972
protected function registerCouchbaseQueueDriver(): void
    {
        /** @var QueueManager $queueManager */
        $queueManager = $this->app['queue'];
        $queueManager->addConnector('couchbase', function () {
            /** @var DatabaseManager $databaseManager */
            $databaseManager = $this->app['db'];

            return new QueueConnector($databaseManager);
        });
    }
731564
protected function registerFailedJobServices()
	{
		$this->app->bindShared('queue.failer', function($app)
		{
			$config = $app['config']['queue.failed'];

			return new DatabaseFailedJobProvider($app['db'], $config['database'], $config['table']);
		});
	}
708519
protected function registerMiddlewares()
    {
        if (!$this->app['config']->get('laratrust.middleware.register')) {
            return;
        }

        $router = $this->app['router'];

        if (method_exists($router, 'middleware')) {
            $registerMethod = 'middleware';
        } elseif (method_exists($router, 'aliasMiddleware')) {
            $registerMethod = 'aliasMiddleware';
        } else {
            return;
        }

        foreach ($this->middlewares as $key => $class) {
            $router->$registerMethod($key, $class);
        }
    }
807938
protected function registerMailer(): void
    {
        $this->app->singleton('orchestra.mail', function ($app) {
            $mailer = new Mailer($app, $transport = new TransportManager($app));

            if ($app->bound('orchestra.platform.memory')) {
                $mailer->attach($memory = $app->make('orchestra.platform.memory'));
                $transport->setMemoryProvider($memory);
            }

            if ($app->bound('queue')) {
                $mailer->setQueue($app->make('queue'));
            }

            return $mailer;
        });
    }
18634
public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/config/laravelPnotify.php', 'laravelPnotify'
        );

        $this->app->bind(
            'Jleon\LaravelPnotify\SessionStore',
            'Jleon\LaravelPnotify\LaravelSessionStore'
        );

        $this->app->bind(
            'Jleon\LaravelPnotify\ConfigRepo',
            'Jleon\LaravelPnotify\LaravelConfigRepo'
        );

        $this->app->bind('notify', function()
        {
            return $this->app->make('Jleon\LaravelPnotify\Notifier');
        });
    }
165591
protected function startup()
    {
        $this->getProcess()->setTitle('Starting');
        $this->registerSignalHandlers();

        $this->eventDispatcher->dispatch(
            ResqueWorkerEvents::START_UP,
            new WorkerEvent($this)
        );
    }
512781
public function register()
    {
        $this->mergeConfigFrom(__DIR__ . '/config/laravel-random.php', 'laravel-random');
        
        $this->app->singleton('random', function ($app) {
            $factory = new \RandomLib\Factory;
            
            $strength = $app['config']->get('laravel-random.strength');
            
            if ($strength === 'high') {
                return $factory->getHighStrengthGenerator();
            }
            
            if ($strength === 'medium') {
                return $factory->getMediumStrengthGenerator();
            }
            
            return $factory->getLowStrengthGenerator();
        });
    }
987786
public function handleWorkerHandlerQueue()
    {
        if (!$this->workerHandlerReady || count($this->workerHandlerQueue) == 0) {
            return;
        }
        $requestId = array_shift($this->workerHandlerQueue);
        $request   = $this->getRequest($requestId);

        if ($request === null) {
            return;
        }

        $this->getLogger()->debug('Sending request: '.$requestId.' to worker-handler.');

        $this->workerHandlerReady = false;

        $this->getStream('workerHandler')->send(
            new ClientHandlerJobRequest(
                $requestId,
                $request->getActionName(),
                $request->getParams()
            )
        );
    }
1018996
public function register() {

		// Version specific registering
		if ($this->version() == 5) $this->registerLaravel5();

		// Determine the cache dir
		$cache_dir = storage_path($this->version() == 5 ? '/framework/views' : '/views');

		// Bind the package-configred MtHaml instance
		$this->app->singleton('laravel-haml.mthaml', function($app) {
			$config = $this->getConfig();
			return new MtHaml\Environment($config['mthaml']['environment'], 
				$config['mthaml']['options'], 
				$config['mthaml']['filters']);
		});

		// Bind the Haml compiler
		$this->app->singleton('Bkwld\LaravelHaml\HamlCompiler', function($app) use ($cache_dir) {
			return new HamlCompiler($app['laravel-haml.mthaml'], $app['files'], $cache_dir);
		});

		// Bind the Haml Blade compiler
		$this->app->singleton('Bkwld\LaravelHaml\HamlBladeCompiler', function($app) use ($cache_dir) {
			return new HamlBladeCompiler($app['laravel-haml.mthaml'], $app['files'], $cache_dir);
		});

	}
507736
public function register()
    {
        $this->app->singleton('server.factory', function ($app) {
            return new ServerFactory($app);
        });

        // By default, the server manager creates a server instance based on the
        // 'server' configuration. We can easily get it through the IoC container
        // or the server facade.
        $this->app->singleton('server', function ($app) {
            return new ServerManager($app, $app['server.factory'], $app['config']['server']);
        });

        // We can get a Swoole server instance from server, this allows us to easily
        // perform in-depth operations.
        $this->app->singleton('server.swoole', function ($app) {
            return $app['server']->getSwooleServer();
        });

        $this->registerCommands($this->commands);
    }
1291748
def register(coordinator):
    """"""
    timer_queue = Queue.Queue()
    coordinator.register(TimerItem, timer_queue)
    coordinator.worker_threads.append(
        TimerThread(timer_queue, coordinator.input_queue))
525982
protected function registerWorker()
	{
		$this->registerWorkCommand();

		$this->registerRestartCommand();

		$this->app->singleton('queue.worker', function($app)
		{
			return new Worker($app['queue'], $app['queue.failer'], $app['events']);
		});
	}