private function loadModuleByName($name)
    {
        // First of all, make sure a valid module name is being processed
        if (!$this->nameValid($name)) {
            throw new LogicException(sprintf(
                'Invalid module name "%s" is being processed. Module name must start from a capital letter and contain only alphabetic characters', $name
            ));
        }

        // Prepare PSR-0 compliant name
        $moduleNamespace = sprintf('%s\%s', $name, self::MODULE_CONFIG_FILE);

        // Ensure a module exists
        if (!class_exists($moduleNamespace)) {
            return false;
        }

        $pathProvider = new PathProvider($this->appConfig->getModulesDir(), $name);

        $sl = new ServiceLocator();
        $sl->registerArray($this->services);

        // Build module instance
        $module = new $moduleNamespace($this, $sl, $this->appConfig, $pathProvider, $name);

        // Routes must be global, so we'd extract them
        if (method_exists($module, 'getRoutes')) {
            $this->appendRoutes($this->prepareRoutes($moduleNamespace, $module->getRoutes()));
        }

        $this->loaded[$name] = $module;
        return $module;
    }
private function loadModuleByName($name)
    {
        // First of all, make sure a valid module name is being processed
        if (!$this->nameValid($name)) {
            throw new LogicException(sprintf(
                'Invalid module name "%s" is being processed. Module name must start from a capital letter and contain only alphabetic characters', $name
            ));
        }

        // Prepare PSR-0 compliant name
        $moduleNamespace = sprintf('%s\%s', $name, self::MODULE_CONFIG_FILE);

        // Ensure a module exists
        if (!class_exists($moduleNamespace)) {
            return false;
        }

        $pathProvider = new PathProvider($this->appConfig->getModulesDir(), $name);

        $sl = new ServiceLocator();
        $sl->registerArray($this->services);

        // Build module instance
        $module = new $moduleNamespace($this, $sl, $this->appConfig, $pathProvider, $name);

        // Routes must be global, so we'd extract them
        if (method_exists($module, 'getRoutes')) {
            $this->appendRoutes($this->prepareRoutes($moduleNamespace, $module->getRoutes()));
        }

        $this->loaded[$name] = $module;
        return $module;
    }
private function loadModuleByName ( $ name ) { // First of all, make sure a valid module name is being processed if ( ! $ this -> nameValid ( $ name ) ) { throw new LogicException ( sprintf ( 'Invalid module name "%s" is being processed. Module name must start from a capital letter and contain only alphabetic characters' , $ name ) ) ; } // Prepare PSR-0 compliant name $ moduleNamespace = sprintf ( '%s\%s' , $ name , self :: MODULE_CONFIG_FILE ) ; // Ensure a module exists if ( ! class_exists ( $ moduleNamespace ) ) { return false ; } $ pathProvider = new PathProvider ( $ this -> appConfig -> getModulesDir ( ) , $ name ) ; $ sl = new ServiceLocator ( ) ; $ sl -> registerArray ( $ this -> services ) ; // Build module instance $ module = new $ moduleNamespace ( $ this , $ sl , $ this -> appConfig , $ pathProvider , $ name ) ; // Routes must be global, so we'd extract them if ( method_exists ( $ module , 'getRoutes' ) ) { $ this -> appendRoutes ( $ this -> prepareRoutes ( $ moduleNamespace , $ module -> getRoutes ( ) ) ) ; } $ this -> loaded [ $ name ] = $ module ; return $ module ; }
Loads a module by its name

@param string $name Module name
@throws \LogicException If invalid module name is being processed
@return \Krystal\Application\Module\AbstractModule|boolean
Loads a module by its name