diff --git a/src/Composer/Command/AboutCommand.php b/src/Composer/Command/AboutCommand.php index ea924f678..d6800ee15 100644 --- a/src/Composer/Command/AboutCommand.php +++ b/src/Composer/Command/AboutCommand.php @@ -18,7 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @author Jordi Boggiano */ -class AboutCommand extends Command +class AboutCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/ArchiveCommand.php b/src/Composer/Command/ArchiveCommand.php index 2fea529a6..104877d8d 100644 --- a/src/Composer/Command/ArchiveCommand.php +++ b/src/Composer/Command/ArchiveCommand.php @@ -30,7 +30,7 @@ use Symfony\Component\Console\Output\OutputInterface; * * @author Nils Adermann */ -class ArchiveCommand extends Command +class ArchiveCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/Command.php b/src/Composer/Command/BaseCommand.php similarity index 96% rename from src/Composer/Command/Command.php rename to src/Composer/Command/BaseCommand.php index 6c5226c6a..2a70b584d 100644 --- a/src/Composer/Command/Command.php +++ b/src/Composer/Command/BaseCommand.php @@ -18,7 +18,7 @@ use Composer\IO\IOInterface; use Composer\IO\NullIO; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command as BaseCommand; +use Symfony\Component\Console\Command\Command; /** * Base class for Composer commands @@ -26,7 +26,7 @@ use Symfony\Component\Console\Command\Command as BaseCommand; * @author Ryan Weaver * @author Konstantin Kudryashov */ -abstract class Command extends BaseCommand +abstract class BaseCommand extends Command { /** * @var Composer diff --git a/src/Composer/Command/ClearCacheCommand.php b/src/Composer/Command/ClearCacheCommand.php index 818b8ee30..7ab17806d 100644 --- a/src/Composer/Command/ClearCacheCommand.php +++ b/src/Composer/Command/ClearCacheCommand.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @author David Neilsen */ -class ClearCacheCommand extends Command +class ClearCacheCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index 0f4637ef3..eef4521b6 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -27,7 +27,7 @@ use Composer\Json\JsonFile; * @author Joshua Estes * @author Jordi Boggiano */ -class ConfigCommand extends Command +class ConfigCommand extends BaseCommand { /** * @var Config diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index ace946f3a..50c067de6 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -46,7 +46,7 @@ use Composer\Package\Version\VersionParser; * @author Tobias Munk * @author Nils Adermann */ -class CreateProjectCommand extends Command +class CreateProjectCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/DependsCommand.php b/src/Composer/Command/DependsCommand.php index bc39d0c3e..f08b00521 100644 --- a/src/Composer/Command/DependsCommand.php +++ b/src/Composer/Command/DependsCommand.php @@ -15,13 +15,11 @@ namespace Composer\Command; use Composer\DependencyResolver\Pool; use Composer\Package\Link; use Composer\Package\PackageInterface; -use Composer\Package\RootPackageInterface; use Composer\Repository\ArrayRepository; use Composer\Repository\CompositeRepository; use Composer\Repository\PlatformRepository; use Composer\Plugin\CommandEvent; use Composer\Plugin\PluginEvents; -use Composer\Semver\Constraint\ConstraintInterface; use Composer\Semver\VersionParser; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\InputInterface; @@ -30,10 +28,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** - * @author Justin Rainbow - * @author Jordi Boggiano + * @author Niels Keurentjes */ -class DependsCommand extends Command +class DependsCommand extends BaseCommand { protected function configure() { @@ -173,41 +170,5 @@ EOT } } - /** - * @param string|string[] $needle The package(s) to inspect. - * @param PackageInterface[] $packages List of installed packages. - * @param ConstraintInterface|null $constraint Optional constraint to filter by. - * @param bool $invert Whether to invert matches on the previous constraint. - * @param bool $recurse Whether to recursively expand the requirement tree. - * @return array An array with dependers as key, and as values an array containing the source package and the link respectively - */ - private function getDependents($needle, $packages, $constraint = null, $invert = false, $recurse = true) - { - $needles = is_array($needle) ? $needle : array($needle); - $results = array(); - // Loop over all currently installed packages. - foreach ($packages as $package) { - // Requirements and replaces are both considered valid reasons for a package to be installed - $links = $package->getRequires() + $package->getReplaces(); - - // Require-dev is only relevant for the root package - if ($package instanceof RootPackageInterface) { - $links += $package->getDevRequires(); - } - - // Cross-reference all discovered links to the needles - foreach ($links as $link) { - foreach ($needles as $needle) { - if ($link->getTarget() === $needle) { - if (is_null($constraint) || (($link->getConstraint()->matches($constraint) === !$invert))) { - $results[$link->getSource()] = array($package, $link, $recurse ? $this->getDependents($link->getSource(), $packages, null, false, true) : array()); - } - } - } - } - } - ksort($results); - return $results; - } } diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php index 2b1927f6b..0ee606f4a 100644 --- a/src/Composer/Command/DiagnoseCommand.php +++ b/src/Composer/Command/DiagnoseCommand.php @@ -29,7 +29,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @author Jordi Boggiano */ -class DiagnoseCommand extends Command +class DiagnoseCommand extends BaseCommand { /** @var RemoteFileSystem */ protected $rfs; diff --git a/src/Composer/Command/DumpAutoloadCommand.php b/src/Composer/Command/DumpAutoloadCommand.php index d47dd7284..94e2b4f6c 100644 --- a/src/Composer/Command/DumpAutoloadCommand.php +++ b/src/Composer/Command/DumpAutoloadCommand.php @@ -21,7 +21,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @author Jordi Boggiano */ -class DumpAutoloadCommand extends Command +class DumpAutoloadCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/GlobalCommand.php b/src/Composer/Command/GlobalCommand.php index 502ce5e8a..86baeeade 100644 --- a/src/Composer/Command/GlobalCommand.php +++ b/src/Composer/Command/GlobalCommand.php @@ -21,7 +21,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @author Jordi Boggiano */ -class GlobalCommand extends Command +class GlobalCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/HomeCommand.php b/src/Composer/Command/HomeCommand.php index 150b8c71b..706308bc4 100644 --- a/src/Composer/Command/HomeCommand.php +++ b/src/Composer/Command/HomeCommand.php @@ -26,7 +26,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @author Robert Schönthal */ -class HomeCommand extends Command +class HomeCommand extends BaseCommand { /** * {@inheritDoc} diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index cd3f7395d..b16fa21b3 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -31,7 +31,7 @@ use Symfony\Component\Process\ExecutableFinder; * @author Justin Rainbow * @author Jordi Boggiano */ -class InitCommand extends Command +class InitCommand extends BaseCommand { /** @var CompositeRepository */ protected $repos; diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php index 3ae00c228..11abdfaf3 100644 --- a/src/Composer/Command/InstallCommand.php +++ b/src/Composer/Command/InstallCommand.php @@ -26,7 +26,7 @@ use Symfony\Component\Console\Output\OutputInterface; * @author Konstantin Kudryashov * @author Nils Adermann */ -class InstallCommand extends Command +class InstallCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/LicensesCommand.php b/src/Composer/Command/LicensesCommand.php index e6e52d481..7cb250607 100644 --- a/src/Composer/Command/LicensesCommand.php +++ b/src/Composer/Command/LicensesCommand.php @@ -25,7 +25,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @author Benoît Merlet */ -class LicensesCommand extends Command +class LicensesCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/RemoveCommand.php b/src/Composer/Command/RemoveCommand.php index e9bd610b4..759103c8a 100644 --- a/src/Composer/Command/RemoveCommand.php +++ b/src/Composer/Command/RemoveCommand.php @@ -27,7 +27,7 @@ use Symfony\Component\Console\Output\OutputInterface; * @author Pierre du Plessis * @author Jordi Boggiano */ -class RemoveCommand extends Command +class RemoveCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/RunScriptCommand.php b/src/Composer/Command/RunScriptCommand.php index e1cf17892..9ac558939 100644 --- a/src/Composer/Command/RunScriptCommand.php +++ b/src/Composer/Command/RunScriptCommand.php @@ -22,7 +22,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @author Fabien Potencier */ -class RunScriptCommand extends Command +class RunScriptCommand extends BaseCommand { /** * @var array Array with command events diff --git a/src/Composer/Command/ScriptAliasCommand.php b/src/Composer/Command/ScriptAliasCommand.php index aeb83b0a4..010643dbb 100644 --- a/src/Composer/Command/ScriptAliasCommand.php +++ b/src/Composer/Command/ScriptAliasCommand.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @author Jordi Boggiano */ -class ScriptAliasCommand extends Command +class ScriptAliasCommand extends BaseCommand { private $script; diff --git a/src/Composer/Command/SearchCommand.php b/src/Composer/Command/SearchCommand.php index e636fc4d0..d79feed26 100644 --- a/src/Composer/Command/SearchCommand.php +++ b/src/Composer/Command/SearchCommand.php @@ -26,7 +26,7 @@ use Composer\Plugin\PluginEvents; /** * @author Robert Schönthal */ -class SearchCommand extends Command +class SearchCommand extends BaseCommand { protected $matches; protected $lowMatches = array(); diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 16b98020a..030c6bebd 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -30,7 +30,7 @@ use Symfony\Component\Finder\Finder; * @author Kevin Ran * @author Jordi Boggiano */ -class SelfUpdateCommand extends Command +class SelfUpdateCommand extends BaseCommand { const HOMEPAGE = 'getcomposer.org'; const OLD_INSTALL_EXT = '-old.phar'; diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 5ddce2954..af7593fe1 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -38,7 +38,7 @@ use Composer\Spdx\SpdxLicenses; * @author Jordi Boggiano * @author Jérémy Romey */ -class ShowCommand extends Command +class ShowCommand extends BaseCommand { protected $versionParser; protected $colors; diff --git a/src/Composer/Command/StatusCommand.php b/src/Composer/Command/StatusCommand.php index 7455e84b8..918301cc6 100644 --- a/src/Composer/Command/StatusCommand.php +++ b/src/Composer/Command/StatusCommand.php @@ -24,7 +24,7 @@ use Composer\Script\ScriptEvents; * @author Tiago Ribeiro * @author Rui Marinho */ -class StatusCommand extends Command +class StatusCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/SuggestsCommand.php b/src/Composer/Command/SuggestsCommand.php index d59ef1dc6..e1508b81b 100644 --- a/src/Composer/Command/SuggestsCommand.php +++ b/src/Composer/Command/SuggestsCommand.php @@ -17,7 +17,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class SuggestsCommand extends Command +class SuggestsCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/UpdateCommand.php b/src/Composer/Command/UpdateCommand.php index 118a04fa1..233714cdc 100644 --- a/src/Composer/Command/UpdateCommand.php +++ b/src/Composer/Command/UpdateCommand.php @@ -28,7 +28,7 @@ use Symfony\Component\Console\Question\Question; * @author Jordi Boggiano * @author Nils Adermann */ -class UpdateCommand extends Command +class UpdateCommand extends BaseCommand { protected function configure() { diff --git a/src/Composer/Command/ValidateCommand.php b/src/Composer/Command/ValidateCommand.php index 321453f18..87158d2bb 100644 --- a/src/Composer/Command/ValidateCommand.php +++ b/src/Composer/Command/ValidateCommand.php @@ -29,7 +29,7 @@ use Symfony\Component\Console\Output\OutputInterface; * @author Robert Schönthal * @author Jordi Boggiano */ -class ValidateCommand extends Command +class ValidateCommand extends BaseCommand { /** * configure