1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 09:02:59 +00:00
composer/src/Composer/DependencyResolver/SolverProblemsException.php
Nils Adermann cc7632489d Make problem report messages more readable
Added pretty strings to constraints
2012-06-20 19:06:36 +02:00

45 lines
1 KiB
PHP

<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\DependencyResolver;
/**
* @author Nils Adermann <naderman@naderman.de>
*/
class SolverProblemsException extends \RuntimeException
{
protected $problems;
protected $installedMap;
public function __construct(array $problems, array $installedMap)
{
$this->problems = $problems;
$this->installedMap = $installedMap;
parent::__construct($this->createMessage());
}
protected function createMessage()
{
$text = "\n";
foreach ($this->problems as $i => $problem) {
$text .= " Problem ".($i+1).$problem->getPrettyString($this->installedMap)."\n";
}
return $text;
}
public function getProblems()
{
return $this->problems;
}
}