From b1fcbe9dde3f82456e1bbf3db48ac158b70ba16c Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 15 Sep 2011 06:58:57 -0500 Subject: [PATCH] Simplifying how composer initializes its commands --- src/Composer/Console/Application.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index d4f380e82..84f307143 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -17,6 +17,7 @@ use Composer\Composer; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Finder\Finder; +use Composer\Command\InstallCommand; /** * The console application that handles the commands @@ -58,23 +59,10 @@ class Application extends BaseApplication } /** - * Looks for all *Command files in Composer's Command directory + * Initializes all the composer commands */ protected function registerCommands() { - $dir = __DIR__.'/../Command'; - $finder = new Finder(); - $finder->files()->name('*Command.php')->in($dir); - - foreach ($finder as $file) { - $ns = 'Composer\\Command'; - if ($relativePath = $file->getRelativePath()) { - $ns .= '\\'.strtr($relativePath, '/', '\\'); - } - $r = new \ReflectionClass($ns.'\\'.$file->getBasename('.php')); - if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract()) { - $this->add($r->newInstance()); - } - } + $this->add(new InstallCommand()); } } \ No newline at end of file