diff --git a/src/Composer/Command/DependsCommand.php b/src/Composer/Command/DependsCommand.php index fe42387b1..6dc1a7e44 100644 --- a/src/Composer/Command/DependsCommand.php +++ b/src/Composer/Command/DependsCommand.php @@ -50,13 +50,11 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { - $repos = $this->getComposer()->getRepositoryManager()->getLocalRepositories(); + $repo = $this->getComposer()->getRepositoryManager()->getLocalRepository(); $needle = $input->getArgument('package'); $pool = new Pool(); - foreach ($repos as $repo) { - $pool->addRepository($repo); - } + $pool->addRepository($repo); $packages = $pool->whatProvides($needle); if (empty($packages)) { @@ -75,22 +73,20 @@ EOT }, $input->getOption('link-type')); $messages = array(); - foreach ($repos as $repo) { - $repo->filterPackages(function ($package) use ($needle, $types, $linkTypes, &$messages) { - static $outputPackages = array(); + $repo->filterPackages(function ($package) use ($needle, $types, $linkTypes, &$messages) { + static $outputPackages = array(); - foreach ($types as $type) { - foreach ($package->{'get'.$linkTypes[$type][0]}() as $link) { - if ($link->getTarget() === $needle) { - if (!isset($outputPackages[$package->getName()])) { - $messages[] = ''.$package->getPrettyName() . ' ' . $linkTypes[$type][1] . ' ' . $needle .' (' . $link->getPrettyConstraint() . ')'; - $outputPackages[$package->getName()] = true; - } + foreach ($types as $type) { + foreach ($package->{'get'.$linkTypes[$type][0]}() as $link) { + if ($link->getTarget() === $needle) { + if (!isset($outputPackages[$package->getName()])) { + $messages[] = ''.$package->getPrettyName() . ' ' . $linkTypes[$type][1] . ' ' . $needle .' (' . $link->getPrettyConstraint() . ')'; + $outputPackages[$package->getName()] = true; } } } - }); - } + } + }); if ($messages) { sort($messages); diff --git a/src/Composer/Command/DumpAutoloadCommand.php b/src/Composer/Command/DumpAutoloadCommand.php index aa01aecbb..e3687899e 100755 --- a/src/Composer/Command/DumpAutoloadCommand.php +++ b/src/Composer/Command/DumpAutoloadCommand.php @@ -45,10 +45,10 @@ EOT $composer = $this->getComposer(); $installationManager = $composer->getInstallationManager(); - $localRepos = new CompositeRepository($composer->getRepositoryManager()->getLocalRepositories()); + $localRepo = $composer->getRepositoryManager()->getLocalRepository(); $package = $composer->getPackage(); $config = $composer->getConfig(); - $composer->getAutoloadGenerator()->dump($config, $localRepos, $package, $installationManager, 'composer', $input->getOption('optimize')); + $composer->getAutoloadGenerator()->dump($config, $localRepo, $package, $installationManager, 'composer', $input->getOption('optimize')); } } diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index d5ec48dfe..c05517398 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -45,7 +45,6 @@ class ShowCommand extends Command new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'), new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'), new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'), - new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables display of dev-require packages.'), new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'), )) ->setHelp(<<getRepositoryManager(); - $repos = new CompositeRepository(array($manager->getLocalRepository())); - if ($dev) { - $repos->addRepository($manager->getLocalDevRepository()); - } - - return $repos; - }; if ($input->getOption('self')) { $package = $this->getComposer(false)->getPackage(); @@ -79,7 +69,7 @@ EOT } elseif ($input->getOption('platform')) { $repos = $installedRepo = $platformRepo; } elseif ($input->getOption('installed')) { - $repos = $installedRepo = $getRepositories($this->getComposer(), $input->getOption('dev')); + $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository(); } elseif ($input->getOption('available')) { $installedRepo = $platformRepo; if ($composer = $this->getComposer(false)) { @@ -90,7 +80,7 @@ EOT $output->writeln('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos))); } } elseif ($composer = $this->getComposer(false)) { - $localRepo = $getRepositories($composer, $input->getOption('dev')); + $localRepo = $composer = $this->getComposer()->getRepositoryManager()->getLocalRepository(); $installedRepo = new CompositeRepository(array($localRepo, $platformRepo)); $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories())); } else { diff --git a/src/Composer/Installer/InstallerInstaller.php b/src/Composer/Installer/InstallerInstaller.php index dd2b63cec..5a41d4e96 100644 --- a/src/Composer/Installer/InstallerInstaller.php +++ b/src/Composer/Installer/InstallerInstaller.php @@ -41,11 +41,10 @@ class InstallerInstaller extends LibraryInstaller parent::__construct($io, $composer, 'composer-installer'); $this->installationManager = $composer->getInstallationManager(); - foreach ($composer->getRepositoryManager()->getLocalRepositories() as $repo) { - foreach ($repo->getPackages() as $package) { - if ('composer-installer' === $package->getType()) { - $this->registerInstaller($package); - } + $repo = $composer->getRepositoryManager()->getLocalRepository(); + foreach ($repo->getPackages() as $package) { + if ('composer-installer' === $package->getType()) { + $this->registerInstaller($package); } } } diff --git a/src/Composer/Script/EventDispatcher.php b/src/Composer/Script/EventDispatcher.php index c24ea21ae..88b08e2d8 100644 --- a/src/Composer/Script/EventDispatcher.php +++ b/src/Composer/Script/EventDispatcher.php @@ -155,10 +155,7 @@ class EventDispatcher } $generator = $this->composer->getAutoloadGenerator(); - $packages = array_merge( - $this->composer->getRepositoryManager()->getLocalRepository()->getPackages(), - $this->composer->getRepositoryManager()->getLocalDevRepository()->getPackages() - ); + $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages(); $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages); $map = $generator->parseAutoloads($packageMap, $package); $this->loader = $generator->createLoader($map);