Move creation of custom styles to the factory

main
Jordi Boggiano 12 years ago
parent 0c61e9d345
commit aecf4ffe91

@ -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);
}

@ -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();

Loading…
Cancel
Save