diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 80180fa6c..fa547c2a4 100755 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -18,7 +18,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Formatter\OutputFormatter; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Composer\Command; use Composer\Command\Helper\DialogHelper; use Composer\Composer; @@ -63,8 +62,7 @@ class Application extends BaseApplication public function run(InputInterface $input = null, OutputInterface $output = null) { if (null === $output) { - $styles['highlight'] = new OutputFormatterStyle('red'); - $styles['warning'] = new OutputFormatterStyle('black', 'yellow'); + $styles = Factory::createAdditionalStyles(); $formatter = new OutputFormatter(null, $styles); $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter); } diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 92701c981..6495583c7 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -19,6 +19,7 @@ use Composer\Repository\ComposerRepository; use Composer\Repository\RepositoryManager; use Composer\Util\ProcessExecutor; use Composer\Util\RemoteFilesystem; +use Symfony\Component\Console\Formatter\OutputFormatterStyle; /** * Creates a configured instance of composer. @@ -70,6 +71,14 @@ class Factory return getenv('COMPOSER') ?: 'composer.json'; } + public static function createAdditionalStyles() + { + return array( + 'highlight' => new OutputFormatterStyle('red'), + 'warning' => new OutputFormatterStyle('black', 'yellow'), + ); + } + public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null) { $repos = array();