Returns the modules selected in the console arguments.

@param Args       $args    The console arguments
@param ModuleList $modules The available modules

@return string[] The module names
194096
public static function getModuleNames(Args $args, ModuleList $modules)
    {
        // Display all modules if "all" is set
        if ($args->isOptionSet('all')) {
            return $modules->getModuleNames();
        }

        $moduleNames = array();

        if ($args->isOptionSet('root')) {
            $moduleNames[] = $modules->getRootModuleName();
        }

        foreach ($args->getOption('module') as $moduleName) {
            $moduleNames[] = $moduleName;
        }

        return $moduleNames ?: $modules->getModuleNames();
    }
40623
public function selectOptions(array $args = []): string
    {
        // Establish args.

        $default_args = [
            // Unique.
            'allow_empty'      => true,
            'allow_arbitrary'  => true,
            'option_formatter' => null,
            'current_roles'    => null,

            // Used by {@link all()}.
            'max'         => 1000,
            'fail_on_max' => true,

            // Used by {@link total()}.
            // Used by {@link all()}.
            'include'  => [],
            'exclude'  => [],
            'no_cache' => false,
        ];
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);

        // Unique.
        $args['allow_empty']      = (bool) $args['allow_empty'];
        $args['allow_arbitrary']  = (bool) $args['allow_arbitrary'];
        $args['option_formatter'] = is_callable($args['option_formatter']) ? $args['option_formatter'] : null;
        $args['current_roles']    = isset($args['current_roles']) ? (array) $args['current_roles'] : null;
        $args['current_roles']    = $this->c::removeEmptys(array_map('strval', $args['current_roles']));

        // Used by {@link all()}.
        $args['max']         = max(1, (int) $args['max']);
        $args['fail_on_max'] = (bool) $args['fail_on_max'];

        // Used by {@link total()}.
        // Used by {@link all()}.
        $args['include']  = (array) $args['include'];
        $args['exclude']  = (array) $args['exclude'];
        $args['no_cache'] = (bool) $args['no_cache'];

        // Check for nothing being available (or too many).

        if (!($roles = $this->all($args))) {
            return ''; // None available.
        }
        // Initialize several working variables.

        $options         = ''; // Initialize.
        $available_roles = []; // Initialize.
        $selected_roles  = []; // Initialize.

        // Build & return all `<option>` tags.

        if ($args['allow_empty']) { // Allow ``?
            $options = '<option value=""></option>';
        }
        foreach ($roles as $_role_id => $_role) { // Array of data.
            $available_roles[] = $_role_id; // Record all available.

            if (isset($args['current_roles']) && in_array($_role_id, $args['current_roles'], true)) {
                $selected_roles[$_role_id] = $_role_id; // Flag selected role.
            }
            $_role_label         = !empty($_role['name']) ? $_role['name'] : $_role_id;
            $_role_selected_attr = isset($selected_roles[$_role_id]) ? ' selected' : '';

            // Format `<option>` tag w/ a custom formatter?

            if ($args['option_formatter']) {
                $options .= $args['option_formatter']($_role_id, [
                        'role_label'         => $_role_label,
                        'role_selected_attr' => $_role_selected_attr,
                    ], $args); // ↑ This allows for a custom option formatter.
                    // The formatter must always return an `<option></option>` tag.

            // Else format the `<option>` tag using a default behavior.
            } else { // Both front & back-end displays are the same for roles.
                $options .= '<option value="'.esc_attr($_role_id).'"'.$_role_selected_attr.'>'.
                                esc_html($_role_label).
                            '</option>';
            }
        } // unset($_role_id, $_role, $_role_label, $_role_selected_attr); // Housekeeping.

        if ($args['allow_arbitrary'] && $args['current_roles']) { // Allow arbitrary select `<option>`s?
            foreach (array_diff($args['current_roles'], $available_roles) as $_arbitrary_role_id) {
                $options .= '<option value="'.esc_attr($_arbitrary_role_id).'" selected>'.
                                esc_html($_arbitrary_role_id).
                            '</option>';
            } // unset($_arbitrary_role_id); // Housekeeping.
        }
        return $options; // HTML markup.
    }
281806
def _get_modules(self, names):
        
        loaded_modules = []
        for name in names:
            loaded_modules.append(sys.modules[name])
        return loaded_modules
592651
public function getChildren(...$args)
    {
        if (!$this->filter) {
            $this->filter = new \Amiss\Filter($this->mapper);
        }
        return $this->filter->getChildren(...$args);
    }
770678
public function bootstrapNavsPills(array $args = []) {
        return $this->bootstrapNavs(ArrayHelper::get($args, "items", []), "nav-pills", ArrayHelper::get($args, "stacked", false));
    }
944162
public function selectOptions(array $args = []): string
    {
        // Establish args.

        $default_args = [
            // Unique.
            'allow_empty'      => true,
            'allow_arbitrary'  => true,
            'option_formatter' => null,
            'current_user_ids' => null,

            // Used by {@link all()}.
            'max'         => 1000,
            'fail_on_max' => true,

            // Used by {@link total()}.
            // Used by {@link all()}.
            'filters' => [
                'orderby' => 'display_name',
            ],
            'no_cache' => false,
        ];
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);

        // Unique.
        $args['allow_empty']      = (bool) $args['allow_empty'];
        $args['allow_arbitrary']  = (bool) $args['allow_arbitrary'];
        $args['option_formatter'] = is_callable($args['option_formatter']) ? $args['option_formatter'] : null;
        $args['current_user_ids'] = isset($args['current_user_ids']) ? (array) $args['current_user_ids'] : null;
        $args['current_user_ids'] = $this->c::removeEmptys(array_map('intval', $args['current_user_ids']));

        // Used by {@link all()}.
        $args['max']         = max(1, (int) $args['max']);
        $args['fail_on_max'] = (bool) $args['fail_on_max'];

        // Used by {@link total()}.
        // Used by {@link all()}.
        $args['filters']  = (array) $args['filters'];
        $args['no_cache'] = (bool) $args['no_cache'];

        // Check for nothing being available (or too many).

        if (!($users = $this->all($args))) {
            return ''; // None available.
        }
        // Initialize several working variables needed below.

        $options            = ''; // Initialize.
        $available_user_ids = []; // Initialize.
        $selected_user_ids  = []; // Initialize.
        $default_user_label = __('User', 'wp-sharks-core');

        // Build & return all `<option>` tags.

        if ($args['allow_empty']) { // Allow ``?
            $options = '<option value=""></option>';
        }
        foreach ($users as $_user) { // \WP_User objects.
            $available_user_ids[] = (int) $_user->ID; // Record all available.

            if (isset($args['current_user_ids']) && in_array((int) $_user->ID, $args['current_user_ids'], true)) {
                $selected_user_ids[$_user->ID] = (int) $_user->ID; // Flag selected user ID.
            }
            $_user_label            = $default_user_label;
            $_user_display_name     = $_user->display_name ?: $_user->user_login;
            $_user_id_selected_attr = isset($selected_user_ids[$_user->ID]) ? ' selected' : '';

            // Format `<option>` tag w/ a custom formatter?

            if ($args['option_formatter']) {
                $options .= $args['option_formatter']($_user, [
                        'user_label'            => $_user_label,
                        'user_display_name'     => $_user_display_name,
                        'user_id_selected_attr' => $_user_id_selected_attr,
                    ], $args); // ↑ This allows for a custom option formatter.
                    // The formatter must always return an `<option></option>` tag.

            // Else format the `<option>` tag using a default behavior.
            } elseif ($this->Wp->is_admin) { // Slightly different format in admin area.
                $options .= '<option value="'.esc_attr($_user->ID).'"'.$_user_id_selected_attr.'>'.
                                esc_html($_user_label.' #'.$_user->ID.': '.$_user->user_login).
                            '</option>';
            } else { // Front-end display should be friendlier in some ways.
                $options .= '<option value="'.esc_attr($_user->ID).'"'.$_user_id_selected_attr.'>'.
                                esc_html($_user->user_login.($_user_display_name !== $_user->user_login ? ' - '.$_user_display_name : '')).
                            '</option>';
            }
        } // unset($_user, $_user_label, $_user_display_name, $_user_id_selected_attr); // Housekeeping.

        if ($args['allow_arbitrary'] && $args['current_user_ids']) { // Allow arbitrary select `<option>`s?
            foreach (array_diff($args['current_user_ids'], $available_user_ids) as $_arbitrary_user_id) {
                $options .= '<option value="'.esc_attr($_arbitrary_user_id).'" selected>'.
                                esc_html($default_user_label.' #'.$_arbitrary_user_id).
                            '</option>';
            } // unset($_arbitrary_user_id); // Housekeeping.
        }
        return $options; // HTML markup.
    }
179305
private function getPathMappingStates(Args $args)
    {
        $states = array(
            PathMappingState::ENABLED => 'enabled',
            PathMappingState::NOT_FOUND => 'not-found',
            PathMappingState::CONFLICT => 'conflict',
        );

        $states = array_filter($states, function ($option) use ($args) {
            return $args->isOptionSet($option);
        });

        return array_keys($states) ?: PathMappingState::all();
    }
1177849
def get_modules(self, name):
        """"""
        result = []
        for module in self.names:
            if name in self.names[module]:
                result.append(module)
        return result
1339333
public function selectArray($q, $args = array())
    {
        $this->exec($q, $args);
        return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_ASSOC) : false;
    }
1120287
protected function getModule($moduleConfig)
    {
        if (!file_exists($moduleConfig)) {
            return [];
        }

        $moduleConfigContent = file_get_contents($moduleConfig);

        return Yaml::parse($moduleConfigContent);
    }
904973
protected function getModulesCommands()
    {
        $commands = [];

        foreach (ModuleManager::getInstalledModules() as $module) {
            $cliFile = getLocalPath('modules/' . $module['ID'] . '/cli.php');

            if ($cliFile === false) {
                continue;
            } elseif (!Loader::includeModule($module['ID'])) {
                continue;
            }

            $config = include_once $this->getDocumentRoot() . $cliFile;

            if (isset($config['commands']) && is_array($config['commands'])) {
                $commands = array_merge($commands, $config['commands']);
            }
        }

        return $commands;
    }
428363
public static function forModules(ModuleList $modules)
    {
        $graph = new static($modules->getModuleNames());

        foreach ($modules as $module) {
            if (null === $module->getModuleFile()) {
                continue;
            }

            foreach ($module->getModuleFile()->getDependencies() as $dependency) {
                if ($graph->hasModuleName($dependency)) {
                    $graph->addDependency($module->getName(), $dependency);
                }
            }
        }

        // Do we have a root module?
        if (null === $modules->getRootModule()) {
            return $graph;
        }

        // Make sure we have numeric, ascending keys here
        $moduleOrder = array_values($modules->getRootModule()->getModuleFile()->getModuleOrder());

        // Each module overrides the previous one in the list
        for ($i = 1, $l = count($moduleOrder); $i < $l; ++$i) {
            $dependency = $moduleOrder[$i - 1];
            $moduleName = $moduleOrder[$i];

            if ($graph->hasModuleName($dependency)) {
                $graph->addDependency($moduleName, $dependency);
            }
        }

        return $graph;
    }
1348398
protected function getSiteModules() : array
    {
        $modules    = [];
        $modulePath = $_SERVER['DOCUMENT_ROOT'] . '/../module/MelisSites';

        if (is_dir($modulePath)){
            foreach (scandir($modulePath) as $module) {
                // Skip directory pointers
                if ($module == '.' || $module == '..') continue;

                if (is_dir($modulePath . '/' . $module)) {
                    $modules[$module] = $this->getControllers($modulePath . '/' . $module . '/src/' . $module . '/Controller');
                }
            }
        }

        return $modules;
    }
404822
protected function checkModuleRelations(array $modules) : array
    {
        $modulesWithRelations = [];

        foreach ($modules as $name => $module) {
            $module['relations'] = [];
            foreach ($module as $field) {
                if (empty($field['type'])) {
                    continue;
                }
                if (strpos($field['type'], 'related') !== false) {
                    //get related module
                    $type = $this->getStringEnclosedInParenthesis($field['type']);
                    $module['relations'][] = $type;
                }
            }
            $modulesWithRelations[$name] = $module;
        }

        return $modulesWithRelations;
    }
156464
public function parseModuleChains($modules)
    {
        $moduleList = oxNew(\OxidEsales\Eshop\Core\Module\ModuleList::class);
        return $moduleList->parseModuleChains($modules);
    }
597856
function getModules(argv,modules){
    if(argv.module){
        var which = getModuleConfig(argv.module,modules);
        if(which){
            return [which];
        }else{
            return [];
        }
    }
    return modules;
}
471532
def get_modules():
    '''
    
    '''
    modules = []
    module_list = exec_action('modules', 'list', action_parameter='--only-names')
    if not module_list:
        return None

    for module in module_list:
        if module not in ['help', 'usage', 'version']:
            modules.append(module)
    return modules