1
0
Fork 0

Remove IO from Solver, debug methods don't need it

pull/219/merge
Jordi Boggiano 2012-01-17 22:39:36 +01:00
parent e91897a59b
commit edf948454b
2 changed files with 11 additions and 15 deletions

View File

@ -123,7 +123,7 @@ EOT
// prepare solver // prepare solver
$installationManager = $composer->getInstallationManager(); $installationManager = $composer->getInstallationManager();
$policy = new DependencyResolver\DefaultPolicy(); $policy = new DependencyResolver\DefaultPolicy();
$solver = new DependencyResolver\Solver($policy, $pool, $installedRepo, $this->getApplication()->getIO()); $solver = new DependencyResolver\Solver($policy, $pool, $installedRepo);
// solve dependencies // solve dependencies
$operations = $solver->solve($request); $operations = $solver->solve($request);

View File

@ -12,7 +12,6 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\IO\IOInterface;
use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\DependencyResolver\Operation; use Composer\DependencyResolver\Operation;
@ -56,15 +55,12 @@ class Solver
protected $packageToUpdateRule = array(); protected $packageToUpdateRule = array();
protected $packageToFeatureRule = array(); protected $packageToFeatureRule = array();
protected $io; public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed)
public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
{ {
$this->policy = $policy; $this->policy = $policy;
$this->pool = $pool; $this->pool = $pool;
$this->installed = $installed; $this->installed = $installed;
$this->rules = new RuleSet; $this->rules = new RuleSet;
$this->io = $io;
} }
/** /**
@ -2048,28 +2044,28 @@ class Solver
} }
} }
public function printDecisionMap() private function printDecisionMap()
{ {
$this->io->writeln("\nDecisionMap: "); echo "\nDecisionMap: \n";
foreach ($this->decisionMap as $packageId => $level) { foreach ($this->decisionMap as $packageId => $level) {
if ($packageId === 0) { if ($packageId === 0) {
continue; continue;
} }
if ($level > 0) { if ($level > 0) {
$this->io->writeln(' +' . $this->pool->packageById($packageId)); echo ' +' . $this->pool->packageById($packageId)."\n";
} else { } else {
$this->io->writeln(' -' . $this->pool->packageById($packageId)); echo ' -' . $this->pool->packageById($packageId)."\n";
} }
} }
$this->io->writeln(''); echo "\n";
} }
public function printDecisionQueue() private function printDecisionQueue()
{ {
$this->io->writeln("DecisionQueue: "); echo "DecisionQueue: \n";
foreach ($this->decisionQueue as $i => $literal) { foreach ($this->decisionQueue as $i => $literal) {
$this->io->writeln(' ' . $literal . ' ' . $this->decisionQueueWhy[$i]); echo ' ' . $literal . ' ' . $this->decisionQueueWhy[$i]."\n";
} }
$this->io->writeln(''); echo "\n";
} }
} }