Provides a basic information about modules before doing a test
@return array
968214
protected function checkAllModule()
    {
        $modSvc = $this->getServiceLocator()->get('ModulesService');
        $config = $this->getServiceLocator()->get('MelisCoreConfig');
        $modules = $modSvc->getActiveModules(array('MelisDesign', 'MelisModuleConfig'));
        $translate = $this->getServiceLocator()->get('translator');

        $coreModulesArray = $modSvc->getCoreModules(['melisinstaller', 'melissites', 'melisassetmanager']);
        $coreModules = array();
        foreach($coreModulesArray as $module) {
            //echo 'test';
            $coreModules[] = $module;
        }

        $modules = array_merge($modules, $coreModules);

        $testCfgDir = $_SERVER['DOCUMENT_ROOT'].'/../test';
        $testCfgFile = $testCfgDir.'/test.application.config.php';
        $logs = array();

        // TEST FOLDER
        if(!is_readable($testCfgDir)) {
            $logs[] = $testCfgDir . ' is not readable';
        }
        else {
            if(!is_writable($testCfgDir)) {
                $logs[] = $testCfgDir . ' is not writable';
            }
        }

        // TEST/test.application.config.php FOLDER
        if(!is_readable($testCfgFile)) {
            $logs[] = $testCfgFile . ' is not readable';
        }
        else {
            if(!is_writable($testCfgFile)) {
                $logs[] = $testCfgFile . ' is not writable';
            }
        }

        foreach($modules as $module) {
            $phpUnitCfg = $config->getItem('diagnostic/' . $module);

            if($phpUnitCfg) {
                $testFolder = isset($phpUnitCfg['testFolder']) ? $phpUnitCfg['testFolder'] : null;
                $moduleTest = isset($phpUnitCfg['moduleTestName']) ? $phpUnitCfg['moduleTestName'] : null;
                $modulePath = $modSvc->getModulePath($module, true);

                if(file_exists($modulePath) && !file_exists($modulePath.'/'.$testFolder)) {
                    $modulePathDisplay = $modSvc->getModulePath($module, false);
                    if(!is_readable($modulePath)) {
                        $logs[] = 'Unable to create diagnostic test on ' . $module .' (' . $modulePathDisplay .'), folder is not readable';
                    }
                    else {
                        if(!is_writable($modulePath)) {
                            $logs[] = 'Unable to create diagnostic test on ' . $module .' (' . $modulePathDisplay .'), folder is not writable';
                        }
                    }
                }

                if(file_exists($modulePath.'/'.$testFolder)) {
                    // permission force change
                    @chmod($modulePath.'/'.$testFolder, 0777);
                    if(!is_readable($modulePath.'/'.$testFolder)) {
                        $logs[] = $module.'/'.$testFolder . ' is not readable';
                    }
                }

            }
            else {
                $logs[] = $module . ' ' . $translate->translate('tr_melis_core_diagnostic_error_message');
            }

        }


        return $logs;
    }
1058498
public function getModules($current_module = '')
    {
        $st_dir = Config::$dataPath . $this->statisticDir;
        $modules_name_array = array();
        foreach(glob($st_dir."/*", GLOB_ONLYDIR) as $module_file)
        {
            $tmp = explode("/", $module_file);
            $module = end($tmp);
            $modules_name_array[$module] = array();
            if($current_module == $module)
            {
                $st_dir = $st_dir.$current_module.'/';
                $all_interface = array();
                foreach(glob($st_dir."*") as $file)
                {
                    if(is_dir($file))
                    {
                        continue;
                    }
                    list($interface, $date) = explode(".", basename($file));
                    $all_interface[$interface] = $interface;
                }
                $modules_name_array[$module] = $all_interface;
            }
        }
        return $modules_name_array;
    }
1354398
public function getDisabledModuleClasses()
    {
        $disabledModules = $this->getDisabledModules();
        $disabledModuleClasses = [];
        if (isset($disabledModules) && is_array($disabledModules)) {
            //get all disabled module paths
            $extensions = $this->getModuleConfigParametersByKey(static::MODULE_KEY_EXTENSIONS);
            $modules = $this->getModulesWithExtendedClass();
            $modulePaths = $this->getModuleConfigParametersByKey(static::MODULE_KEY_PATHS);

            foreach ($disabledModules as $moduleId) {
                if (!array_key_exists($moduleId, $extensions)) {
                    $path = $modulePaths[$moduleId];
                    if (!isset($path)) {
                        $path = $moduleId;
                    }
                    foreach ($modules as $moduleClasses) {
                        foreach ($moduleClasses as $moduleClass) {
                            if (strpos($moduleClass, $path . "/") === 0) {
                                $disabledModuleClasses[] = $moduleClass;
                            }
                        }
                    }
                } else {
                    $disabledModuleClasses = array_merge($disabledModuleClasses, $extensions[$moduleId]);
                }
            }
        }

        return $disabledModuleClasses;
    }
1130524
public function getCoreModules()
    {
        $coreModulesByName = $this->getCoreModulesByName();

        $coreModules = $this->all()->filter(
            function ($module) use ($coreModulesByName) {
                return array_key_exists($module->getLowerName(), $coreModulesByName->toArray());
            });

        return $coreModules->all();
    }
1360206
public function scanModules() {
        $modules = RtCache::get('loader@modules');
        if (!$modules) {
            $modules = [];
            if (is_dir(MODULE_ROOT)) {
                $it = new \DirectoryIterator (MODULE_ROOT);
                foreach ($it as $dir) {
                    if ($dir->isDot()) {
                        continue;
                    }
                    if ($dir->isDir()) {
                        $dirname = $dir->getFilename();
                        $boot    = MODULE_ROOT . $dirname . '/bootstrap.php';
                        if (is_file($boot)) {
                            $modules[ $dirname ] = $boot;
                        }
                    }
                }
            }
            RtCache::add('loader@modules', $modules);
        }

        return $modules;
    }
987504
public function getAllModularInfo()
    {
        $modularInfo = new Collection();
        foreach ($this->getAllValidModular() as $modularName => $modular) {
            $modularInfo[$modularName] = $this->getModularInformation($modularName);
        }

        return $modularInfo;
    }
1121414
public function getModules($inited=false)
	{
	    if ($inited) {
	        $instances = [];
	        if ($this->_modules) foreach ($this->_modules as $v) {
	            $instances[] = $this->getModule($v);
	        }
	        return $instances;
	    }
	    
		return $this->_modules;
	}
747752
public function getControllerClasses()
    {
        $moduleName = $this->getVarValue('moduleName', false);
    
        return (empty($moduleName) || !Yii::$app->hasModule($moduleName)) ? [] : Yii::$app->getModule($moduleName)->getControllerFiles();
    }
857475
public function getAllModules()
    {
        $returnValue = array();

        // routes
        $namespaces = array();
        foreach ($this->getManifest()->getRoutes() as $mapedPath => $ns) {
            $namespaces[] = trim($ns, '\\');
        }
        if (!empty($namespaces)) {
        	common_Logger::d('Namespace not empty for extension '. $this->getId() );
            $recDir = new RecursiveDirectoryIterator($this->getDir());
            $recIt = new RecursiveIteratorIterator($recDir);
            $regexIt = new RegexIterator($recIt, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
            foreach ($regexIt as $entry) {
                $info = helpers_PhpTools::getClassInfo($entry[0]);
                if (!empty($info['ns'])) {
                    $ns = trim($info['ns'], '\\');
                    if (!empty($info['ns']) && in_array($ns, $namespaces)) {
                        $returnValue[$info['class']] = $ns.'\\'.$info['class'];
                    }
                }
            }
        } 
        // legacy
        if ($this->hasConstant('DIR_ACTIONS') && file_exists($this->getConstant('DIR_ACTIONS'))) {
			$dir = new DirectoryIterator($this->getConstant('DIR_ACTIONS'));
		    foreach ($dir as $fileinfo) {
				if(preg_match('/^class\.[^.]*\.php$/', $fileinfo->getFilename())) {
					$module = substr($fileinfo->getFilename(), 6, -4);
					$returnValue[$module] = $this->getId().'_actions_'.$module;
				}
			}
        }
        
        // validate the classes
        foreach (array_keys($returnValue) as $key) {
            $class = $returnValue[$key];
            if (!class_exists($class)) {
				common_Logger::w($class.' not found');
				unset($returnValue[$key]);
            } elseif (!is_subclass_of($class, 'Module')) {
				common_Logger::w($class.' does not inherit Module');
				unset($returnValue[$key]);
            } 
        }
        
        return (array) $returnValue;
    }
379623
protected function get_module_names() {
        if ($this->_modnames !== null) {
            return $this->_modnames;
        }
        $this->_modnames = [];
        foreach ($this->cms as $cm) {
            $this->_modnames[$cm->modname] = $cm->modfullname;
        }
        return $this->_modnames;
    }
724766
public function extractModulePaths()
    {
        $aModules = $this->getModulesWithExtendedClass();
        $aModulePaths = [];

        if (is_array($aModules) && count($aModules) > 0) {
            foreach ($aModules as $aModuleClasses) {
                foreach ($aModuleClasses as $sModule) {
                    $sModuleId = substr($sModule, 0, strpos($sModule, "/"));
                    $aModulePaths[$sModuleId] = $sModuleId;
                }
            }
        }

        return $aModulePaths;
    }
1331331
public function getPredefinedCommands()
    {
        $tasks = [
            'check' => 'Check',
            'cleanup' => 'Cleanup',
            'current' => 'CurrentRelease',
            'deploy' => 'Deploy',
            'flush' => 'Flush',
            'ignite' => 'Ignite',
            'ignite-stubs' => 'Ignite\Stubs',
            'rollback' => 'Rollback',
            'setup' => 'Setup',
            'strategies' => 'Strategies',
            'teardown' => 'Teardown',
            'test' => 'Test',
            'update' => 'Update',
            'debug-tinker' => 'Development\Tinker',
            'debug-config' => 'Development\Configuration',
            'self-update' => 'Development\SelfUpdate',
            'plugin-publish' => 'Plugins\Publish',
            'plugin-list' => 'Plugins\List',
            'plugin-install' => 'Plugins\Install',
            'plugin-update' => 'Plugins\Updater',
        ];

        // Add user commands
        $userTasks = (array) $this->config->get('hooks.custom');
        $userTasks = array_filter($userTasks);
        $tasks = array_merge($tasks, $userTasks);

        return $tasks;
    }
1210406
public function getDisabledModuleInfo()
    {
        $aDisabledModules = $this->getDisabledModules();
        $aModulePaths = [];

        if (is_array($aDisabledModules) && count($aDisabledModules) > 0) {
            $aModulePaths = $this->getModuleConfigParametersByKey(static::MODULE_KEY_PATHS);

            // Extract module paths from extended classes
            if (!is_array($aModulePaths) || count($aModulePaths) < 1) {
                $aModulePaths = $this->extractModulePaths();
            }

            if (is_array($aModulePaths) || count($aModulePaths) > 0) {
                $aModulePaths = array_intersect_key($aModulePaths, array_flip($aDisabledModules));
            }
        }

        return $aModulePaths;
    }
779910
public function getMelisModules()
    {
        $modules = array();
        foreach($this->getAllModules() as $module) {
            if(strpos($module, 'Melis') !== false || strpos($module, 'melis') !== false) {
                $modules[] = $module;
            }
        }
        return $modules;
    }
979064
public function hasAllRequiredModules()
    {
        $required = $this->getRequiredModules();
        $available = array_keys($this->module->getList());
        $difference = array_diff($required, array_intersect($required, $available));

        return empty($difference);
    }
1017369
protected function getTypesModule()
    {
        $types = array();

        foreach ($this->module->getList() as $module) {
            $types[$module['type']] = $this->text(ucfirst($module['type']));
        }

        return $types;
    }
948382
protected function getMyModules()
    {
        $all = array_keys( app()->getLoadedProviders() );
        $modules = [];
        foreach($all as $provider) {
            $parts = explode('\\', $provider);
            if ($parts[0] === 'ErenMustafaOzdal' && array_search($parts[1],$modules) === false) {
                array_push($modules, snake_case($parts[1], '-'));
            }
        }
        return $modules;
    }