public function setup(bool $force = false, bool $useCache = true): void
    {
        // If the console was already setup no need to do it again
        if (self::$setup && ! $force) {
            return;
        }

        // The console is setting up
        self::$setup = true;

        // If the application should use the console cache files
        if ($useCache && $this->app->config()['console']['useCache']) {
            $this->setupFromCache();

            // Then return out of setup
            return;
        }

        self::$paths         = [];
        self::$commands      = [];
        self::$namedCommands = [];

        // Setup command providers
        $this->setupCommandProviders();

        // If annotations are enabled and the events should use annotations
        if (
            $this->app->config()['console']['useAnnotations']
            && $this->app->config()['annotations']['enabled']
        ) {
            // Setup annotated event listeners
            $this->setupAnnotations();

            // If only annotations should be used
            if ($this->app->config()['console']['useAnnotationsExclusively']) {
                // Return to avoid loading events file
                return;
            }
        }

        // Include the events file
        require $this->app->config()['console']['filePath'];
    }
public function setup(bool $force = false, bool $useCache = true): void
    {
        // If the console was already setup no need to do it again
        if (self::$setup && ! $force) {
            return;
        }

        // The console is setting up
        self::$setup = true;

        // If the application should use the console cache files
        if ($useCache && $this->app->config()['console']['useCache']) {
            $this->setupFromCache();

            // Then return out of setup
            return;
        }

        self::$paths         = [];
        self::$commands      = [];
        self::$namedCommands = [];

        // Setup command providers
        $this->setupCommandProviders();

        // If annotations are enabled and the events should use annotations
        if (
            $this->app->config()['console']['useAnnotations']
            && $this->app->config()['annotations']['enabled']
        ) {
            // Setup annotated event listeners
            $this->setupAnnotations();

            // If only annotations should be used
            if ($this->app->config()['console']['useAnnotationsExclusively']) {
                // Return to avoid loading events file
                return;
            }
        }

        // Include the events file
        require $this->app->config()['console']['filePath'];
    }
public function setup ( bool $ force = false , bool $ useCache = true ) : void { // If the console was already setup no need to do it again if ( self :: $ setup && ! $ force ) { return ; } // The console is setting up self :: $ setup = true ; // If the application should use the console cache files if ( $ useCache && $ this -> app -> config ( ) [ 'console' ] [ 'useCache' ] ) { $ this -> setupFromCache ( ) ; // Then return out of setup return ; } self :: $ paths = [ ] ; self :: $ commands = [ ] ; self :: $ namedCommands = [ ] ; // Setup command providers $ this -> setupCommandProviders ( ) ; // If annotations are enabled and the events should use annotations if ( $ this -> app -> config ( ) [ 'console' ] [ 'useAnnotations' ] && $ this -> app -> config ( ) [ 'annotations' ] [ 'enabled' ] ) { // Setup annotated event listeners $ this -> setupAnnotations ( ) ; // If only annotations should be used if ( $ this -> app -> config ( ) [ 'console' ] [ 'useAnnotationsExclusively' ] ) { // Return to avoid loading events file return ; } } // Include the events file require $ this -> app -> config ( ) [ 'console' ] [ 'filePath' ] ; }
Setup the console.

@param bool $force    [optional] Whether to force setup
@param bool $useCache [optional] Whether to use cache

@throws \ReflectionException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidClosureException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidDispatchCapabilityException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidFunctionException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidMethodException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidPropertyException

@return void
Setup the console .