public function run()
    {
        $container = $this->getContainer();
        
        foreach ($this->exercises as $exercise) {
            if (false === $container->has($exercise)) {
                throw new \RuntimeException(
                    sprintf('No DI config found for exercise: "%s". Register a factory.', $exercise)
                );
            }
        }

        $checkRepository = $container->get(CheckRepository::class);
        foreach ($this->checks as $check) {
            if (false === $container->has($check)) {
                throw new \RuntimeException(
                    sprintf('No DI config found for check: "%s". Register a factory.', $check)
                );
            }

            $checkRepository->registerCheck($container->get($check));
        }

        if (!empty($this->results)) {
            $resultFactory = $container->get(ResultRendererFactory::class);

            foreach ($this->results as $result) {
                $resultFactory->registerRenderer($result['resultClass'], $result['resultRendererClass']);
            }
        }

        try {
            $exitCode = $container->get(CommandRouter::class)->route();
        } catch (MissingArgumentException $e) {
            $container
                ->get(OutputInterface::class)
                ->printError(
                    sprintf(
                        'Argument%s: "%s" %s missing!',
                        count($e->getMissingArguments()) > 1 ? 's' : '',
                        implode('", "', $e->getMissingArguments()),
                        count($e->getMissingArguments()) > 1 ? 'are' : 'is'
                    )
                );
            return 1;
        } catch (\RuntimeException $e) {
            $container
                ->get(OutputInterface::class)
                ->printError(
                    sprintf(
                        '%s',
                        $e->getMessage()
                    )
                );
            return 1;
        }
        return $exitCode;
    }
public function run()
    {
        $container = $this->getContainer();
        
        foreach ($this->exercises as $exercise) {
            if (false === $container->has($exercise)) {
                throw new \RuntimeException(
                    sprintf('No DI config found for exercise: "%s". Register a factory.', $exercise)
                );
            }
        }

        $checkRepository = $container->get(CheckRepository::class);
        foreach ($this->checks as $check) {
            if (false === $container->has($check)) {
                throw new \RuntimeException(
                    sprintf('No DI config found for check: "%s". Register a factory.', $check)
                );
            }

            $checkRepository->registerCheck($container->get($check));
        }

        if (!empty($this->results)) {
            $resultFactory = $container->get(ResultRendererFactory::class);

            foreach ($this->results as $result) {
                $resultFactory->registerRenderer($result['resultClass'], $result['resultRendererClass']);
            }
        }

        try {
            $exitCode = $container->get(CommandRouter::class)->route();
        } catch (MissingArgumentException $e) {
            $container
                ->get(OutputInterface::class)
                ->printError(
                    sprintf(
                        'Argument%s: "%s" %s missing!',
                        count($e->getMissingArguments()) > 1 ? 's' : '',
                        implode('", "', $e->getMissingArguments()),
                        count($e->getMissingArguments()) > 1 ? 'are' : 'is'
                    )
                );
            return 1;
        } catch (\RuntimeException $e) {
            $container
                ->get(OutputInterface::class)
                ->printError(
                    sprintf(
                        '%s',
                        $e->getMessage()
                    )
                );
            return 1;
        }
        return $exitCode;
    }
public function run ( ) { $ container = $ this -> getContainer ( ) ; foreach ( $ this -> exercises as $ exercise ) { if ( false === $ container -> has ( $ exercise ) ) { throw new \ RuntimeException ( sprintf ( 'No DI config found for exercise: "%s". Register a factory.' , $ exercise ) ) ; } } $ checkRepository = $ container -> get ( CheckRepository :: class ) ; foreach ( $ this -> checks as $ check ) { if ( false === $ container -> has ( $ check ) ) { throw new \ RuntimeException ( sprintf ( 'No DI config found for check: "%s". Register a factory.' , $ check ) ) ; } $ checkRepository -> registerCheck ( $ container -> get ( $ check ) ) ; } if ( ! empty ( $ this -> results ) ) { $ resultFactory = $ container -> get ( ResultRendererFactory :: class ) ; foreach ( $ this -> results as $ result ) { $ resultFactory -> registerRenderer ( $ result [ 'resultClass' ] , $ result [ 'resultRendererClass' ] ) ; } } try { $ exitCode = $ container -> get ( CommandRouter :: class ) -> route ( ) ; } catch ( MissingArgumentException $ e ) { $ container -> get ( OutputInterface :: class ) -> printError ( sprintf ( 'Argument%s: "%s" %s missing!' , count ( $ e -> getMissingArguments ( ) ) > 1 ? 's' : '' , implode ( '", "' , $ e -> getMissingArguments ( ) ) , count ( $ e -> getMissingArguments ( ) ) > 1 ? 'are' : 'is' ) ) ; return 1 ; } catch ( \ RuntimeException $ e ) { $ container -> get ( OutputInterface :: class ) -> printError ( sprintf ( '%s' , $ e -> getMessage ( ) ) ) ; return 1 ; } return $ exitCode ; }
Executes the framework, invoking the specified command.
The return value is the exit code. 0 for success, anything else is a failure.

@return int The exit code
Executes the framework invoking the specified command . The return value is the exit code . 0 for success anything else is a failure .