/**
* Returns the modules that should be displayed for the given console
* arguments.
*
* @param Args $args The console arguments
*
* @return ModuleList The modules
*/
private function getSelectedModules(Args $args)
{
$states = $this->getSelectedStates($args);
$expr = Expr::true();
$envs = array();
if ($states !== ModuleState::all()) {
$expr = $expr->andMethod('getState', Expr::in($states));
}
if ($args->isOptionSet('installer')) {
$expr = $expr->andMethod('getInstallInfo', Expr::method('getInstallerName', Expr::same($args->getOption('installer'))));
}
if ($args->isOptionSet('prod')) {
$envs[] = Environment::PROD;
}
if ($args->isOptionSet('dev')) {
$envs[] = Environment::DEV;
}
if (count($envs) > 0) {
$expr = $expr->andMethod('getInstallInfo', Expr::method('getEnvironment', Expr::in($envs)));
}
return $this->moduleManager->findModules($expr);
}