src/Console/Application.php
protected function registerCommands(OutputInterface $output)
    {
        $container = $this->kernel->getContainer();

        foreach ($this->kernel->getBundles() as $bundle) {
            if ($bundle instanceof Bundle) {
                $bundle->registerCommands($this);
            }
        }

        if ($container->hasParameter('console.command.ids')) {
            foreach ($container->getParameter('console.command.ids') as $id) {
                $this->add($container->get($id));
            }
        }

        $this->addComposerCommands();

        /** @var ComposerJson $file */
        $file = $container->get('tenside.composer_json');

        // Add non-standard scripts as own commands - keep this last to ensure we do not override internal commands.
        if ($file->has('scripts')) {
            foreach (array_keys($file->get('scripts')) as $script) {
                if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
                    if ($this->has($script)) {
                        $output->writeln(
                            sprintf(
                                '<warning>' .
                                'A script named %s would override a native function and has been skipped' .
                                '</warning>',
                                $script
                            )
                        );
                        continue;
                    }
                    $this->add(new ScriptAliasCommand($script));
                }
            }
        }
    }
protected function registerCommands(OutputInterface $output)
    {
        $container = $this->kernel->getContainer();

        foreach ($this->kernel->getBundles() as $bundle) {
            if ($bundle instanceof Bundle) {
                $bundle->registerCommands($this);
            }
        }

        if ($container->hasParameter('console.command.ids')) {
            foreach ($container->getParameter('console.command.ids') as $id) {
                $this->add($container->get($id));
            }
        }

        $this->addComposerCommands();

        /** @var ComposerJson $file */
        $file = $container->get('tenside.composer_json');

        // Add non-standard scripts as own commands - keep this last to ensure we do not override internal commands.
        if ($file->has('scripts')) {
            foreach (array_keys($file->get('scripts')) as $script) {
                if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
                    if ($this->has($script)) {
                        $output->writeln(
                            sprintf(
                                '<warning>' .
                                'A script named %s would override a native function and has been skipped' .
                                '</warning>',
                                $script
                            )
                        );
                        continue;
                    }
                    $this->add(new ScriptAliasCommand($script));
                }
            }
        }
    }
protected function registerCommands ( OutputInterface $ output ) { $ container = $ this -> kernel -> getContainer ( ) ; foreach ( $ this -> kernel -> getBundles ( ) as $ bundle ) { if ( $ bundle instanceof Bundle ) { $ bundle -> registerCommands ( $ this ) ; } } if ( $ container -> hasParameter ( 'console.command.ids' ) ) { foreach ( $ container -> getParameter ( 'console.command.ids' ) as $ id ) { $ this -> add ( $ container -> get ( $ id ) ) ; } } $ this -> addComposerCommands ( ) ; /** @var ComposerJson $file */ $ file = $ container -> get ( 'tenside.composer_json' ) ; // Add non-standard scripts as own commands - keep this last to ensure we do not override internal commands. if ( $ file -> has ( 'scripts' ) ) { foreach ( array_keys ( $ file -> get ( 'scripts' ) ) as $ script ) { if ( ! defined ( 'Composer\Script\ScriptEvents::' . str_replace ( '-' , '_' , strtoupper ( $ script ) ) ) ) { if ( $ this -> has ( $ script ) ) { $ output -> writeln ( sprintf ( '<warning>' . 'A script named %s would override a native function and has been skipped' . '</warning>' , $ script ) ) ; continue ; } $ this -> add ( new ScriptAliasCommand ( $ script ) ) ; } } } }
Register all commands from the container and bundles in the application.

@param OutputInterface $output The output handler to use.

@return void
Register all commands from the container and bundles in the application .