Register commands

@param Application $application
@return void
188112
public function registerCommands(Application $application)
    {
        if (!is_dir($dir = $this->getPath() . '/Command')) {
            return;
        }
        $explorer = new Explorer($dir);
        $explorer->setSearchPattern('/[a-zA-Z0-9]Command\.php$/i');
        
        $prefixNS = $this->getNamespace() . '\\Command';
        foreach ($explorer->getFiles() as $file) {
            $namespace = $prefixNS;
            $class = $namespace . '\\' . $file->getBasename('.php');
            $r = new \ReflectionClass($class);
            if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) {
                $application->add($r->newInstance());
            }
        }
    }
38181
public function register(Application $app)
    {
        $app["output.service"] = function (Application $app) {
            $config = $app["config.service"];
            $manager = new \SlaxWeb\Output\Manager(
                $app["logger.service"]("System"),
                $app["response.service"],
                [
                    "enabled"           =>  $config["output.enable"] ?? false,
                    "allowOutput"       =>  $config["output.permitDirectOutput"] ?? true,
                    "environment"       =>  $config["app.environment"] ?? "development"
                ], [
                    "style"     =>  realpath(__DIR__ . "/../../resources/errorstyles.html"),
                    "template"  =>  realpath(__DIR__ . "/../../resources/error.php")
                ]
            );
            $manager->setHandlerGetter($app["outputHandler.service"]);
            return $manager;
        };

        $app["outputHandler.service"] = $app->protect(function () use ($app) {
            $handler = $app["outputHandler"] ?? $app["config.service"]["output.defaultHandler"];

            switch ($handler) {
                case "view":
                    $handler = $app["outputViewHandler.service"];
                    break;

                case "json":
                    $handler = $app["outputJsonHandler.service"];
                    break;

                default:
                    if (isset($app[$handler])) {
                        $handler = $app[$handler];
                    } elseif (class_exists($handler)) {
                        $handler = new $handler;
                    } else {
                        throw new Exception(
                            "Output Handler class {$handler} does not exist."
                        );
                    }
            }

            return $handler;
        });

        $app["outputViewHandler.service"] = function () {
            return new \SlaxWeb\Output\Handler\View;
        };

        $app["outputJsonHandler.service"] = function () {
            return new \SlaxWeb\Output\Handler\Json;
        };
    }
712603
public function run(Application $app)
    {
        $this->trigger(self::EVENT_BEFORE_RUN);
        if (count($this->_afterCallbacks) > 0) {
            $this->runCommandInForeground($app);
        } else {
            $this->runCommandInBackground($app);
        }
        $this->trigger(self::EVENT_AFTER_RUN);
    }
1275974
protected function registerCommands()
    {
        if ($this->app->runningInConsole()) {
            $this->commands([
                ModulesCommand::class,
                ModelsCommand::class,
                EnumsCommand::class,
                RequestsCommand::class,
                MakeModuleCommand::class,
                VersionCommand::class
            ]);
        }
    }
793696
public function register(RegisterRequest $application): Response
    {

        $response    = $this->sendRequest($application);
        $this->appID = $application->getApplicationIdentification();
        return $response;

    }
1301624
public function register(Application $app, array $addons)
    {
        // prepare helper functions
        foreach ($addons as $addon) {
            $this->loadFiles($addon, $addon->config('addon.files', []));
        }

        foreach ($addons as $addon) {
            // load config
            $this->loadConfigurationFiles($addon);

            // regist service providers
            $providers = $addon->config('addon.providers', []);
            foreach ($providers as $provider) {
                $app->register($provider);
            }

            // register commands
            $commands = $addon->config('addon.commands', $addon->config('addon.console.commands', []));
            if (!is_array($commands)) $commands = [$commands];
            Artisan::starting(function ($artisan) use ($commands) {
                $artisan->resolveCommands($commands);
            });

            // register named middleware
            $middlewares = $addon->config('addon.middleware', $addon->config('addon.http.route_middlewares', []));
            foreach ($middlewares as $name => $middleware) {
                if (is_array($middleware)) {
                    $app['router']->middlewareGroup($name, $middleware);
                }
                else {
                    $app['router']->aliasMiddleware($name, $middleware);
                }
            }
        }
    }
1358957
public function register(Application $app)
    {
        $app[UseCase::LOGIN] = $app->share(function () use ($app) {
            return new LoginUseCase(
                $app[Repository::USER],
                $app[Validator::LOGIN],
                $app[Service::PASSWORD_HASH]);
        });
        $app[UseCase::REGISTRATION] = $app->share(function () use ($app) {
            return new RegistrationUseCase(
                $app[Repository::USER],
                $app[Validator::REGISTRATION],
                $app[Service::PASSWORD_HASH]);
        });
        $app[UseCase::LIST_DIRECTIONS] = $app->share(function() use($app){
            return new ListDirectionsUseCase($app[Repository::DIRECTION]);
        });
    }
1079499
public function register(Application $app)
    {
        Assertion::isInstanceOf($app, \Alchemy\Phrasea\Application::class);

        $app['setup.validate-config'] = $app->protect(function (Request $request) use ($app) {
            if (0 === strpos($request->getPathInfo(), '/setup')) {
                if (!$app['phraseanet.configuration-tester']->isInstalled()) {
                    if (!$app['phraseanet.configuration-tester']->isBlank()) {
                        if ('setup_upgrade_instructions' !== $app['request']->attributes->get('_route')) {
                            return $app->redirectPath('setup_upgrade_instructions');
                        }
                    }
                } elseif (!$app['phraseanet.configuration-tester']->isBlank()) {
                    return $app->redirectPath('homepage');
                }
            } else {
                if (false === strpos($request->getPathInfo(), '/include/minify')) {
                    $app['firewall']->requireSetup();
                }
            }
        });
    }
40061
public static function start($application)
	{
		self::$_application = $application;
		self::$_starting = true;
		self::$_started = false;
		$application->start();
		self::$_starting = false;
		self::$_started = true;
		self::$_autostart = null;

		// callback to clean up on process shutdown
		if(!self::$_shutdownRegistered)
		{
			register_shutdown_function(array(__CLASS__, 'shutdown'));
			self::$_shutdownRegistered = true;
		}
	}
1118118
public function register(Application $app)
    {
        /** @var Translator $translator  */
        $translator = $app['translator'];

        /** @var Collection $writerCollection */
        $writerCollection = $app['transformer.writer.collection'];

        $writerCollection['twig'] = new Writer\Twig();
        $writerCollection['twig']->setTranslator($translator);
    }
138471
public function register(\Silex\Application $app)
    {
        parent::register($app);

        // Register voters
        $app->extend('security.voters', function($voters) {
            return array_merge($voters, $this->voters);
        });

        // Add reference to this in application instance
        $this->app = $app;
        $this->app['securilex'] = $this;
    }
1280933
public function setApplication(Application $application = null)
    {
        if ($application !== null && !$application instanceof Shell) {
            throw new \InvalidArgumentException('PsySH Commands require an instance of Psy\Shell');
        }

        return parent::setApplication($application);
    }
745067
public function boot(Application $app)
    {
        AnnotationRegistry::registerAutoloadNamespace("Swagger\Annotations", $app["swagger.srcDir"]);

        if ($app["logger"]) {
            $logger = Logger::getInstance();
            $originalLog = $logger->log;
            $logger->log = function ($entry, $type) use ($app, $originalLog) {
                $app["logger"]->notice($entry);
                $originalLog($entry, $type);
            };
        }

        $app->get($app["swagger.apiDocPath"], new ResourceListController());
        $app->get("{$app["swagger.apiDocPath"]}/{service}", new ResourceDefinitionController());
    }
1223952
public function register(Application $app)
    {
        $app['events.order_subscriber'] = $app->share(function (Application $app) {
            $notifierRegistry = new ValidationNotifierRegistry();

            $notifierRegistry->registerNotifier(Order::NOTIFY_MAIL, new MailNotifier($app));
            $notifierRegistry->registerNotifier(Order::NOTIFY_WEBHOOK, new WebhookNotifier(
                new LazyLocator($app, 'manipulator.webhook-event')
            ));

            return new OrderSubscriber($app, $notifierRegistry);
        });
    }
972075
public function register(Application $App) {
        $App->addCommand(new \YourApp\Command\Foo());
        $App->addCommand(new \YourApp\Command\Bar());
        $App->addCommand(new \YourApp\Command\Baz());
    }
221377
public function setApplication($application) {
        $this->application = $application;
        foreach($this->translations as $locale => $translations) {
            foreach($translations as $translation) {
                $translation->translation_key = $this;
            }
        }
    }
466791
public function register(Application $app)
    {
        $prefix = $this->prefix;

        foreach(array('.server', '.options', '.attributes') as $key) {
            if (!(isset($app[$prefix . $key]))) {
                $app[$prefix. $key] = array();
            }
        }

        $app[$prefix] = $this->getPdo($app, $prefix);
    }