protected function execute(InputInterface $input, OutputInterface $output)
{
$packages = [];
foreach ((array) $this->argument('packages') as $package) {
$path = $this->container->get('path.packages') . '/' . $package . '/composer.json';
if (file_exists($path)) {
$info = json_decode(file_get_contents($path), true);
}
if (isset($info['require']) && is_array($info['require'])) {
$packages = array_merge($packages, $info['require']);
}
}
$config = [];
foreach (['path.temp', 'path.cache', 'path.vendor', 'path.artifact', 'path.packages', 'system.api'] as $key) {
$config[$key] = $this->container->get($key);
}
$composer = new Composer($config, $output);
$composer->install($packages, true, false, $this->option('prefer-source'));
}