1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 09:02:59 +00:00

Make problem report messages more readable

Added pretty strings to constraints
This commit is contained in:
Nils Adermann 2012-06-20 19:04:21 +02:00
parent 4bbb168d44
commit cc7632489d
14 changed files with 187 additions and 40 deletions

View file

@ -18,23 +18,24 @@ namespace Composer\DependencyResolver;
class SolverProblemsException extends \RuntimeException
{
protected $problems;
protected $installedMap;
public function __construct(array $problems)
public function __construct(array $problems, array $installedMap)
{
$this->problems = $problems;
$this->installedMap = $installedMap;
parent::__construct($this->createMessage());
}
protected function createMessage()
{
$messages = array();
foreach ($this->problems as $problem) {
$messages[] = (string) $problem;
$text = "\n";
foreach ($this->problems as $i => $problem) {
$text .= " Problem ".($i+1).$problem->getPrettyString($this->installedMap)."\n";
}
return "\n\tProblems:\n\t\t- ".implode("\n\t\t- ", $messages);
return $text;
}
public function getProblems()