* Jordi Boggiano * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\DependencyResolver; use Composer\Package\PackageInterface; /** * @author Nils Adermann */ class Literal { protected $wanted; public function __construct(PackageInterface $package, $wanted) { $this->package = $package; $this->wanted = $wanted; } public function isWanted() { return $this->wanted; } public function getPackage() { return $this->package; } public function getPackageId() { return spl_object_hash($this->package); } public function getId() { return ($this->wanted ? '' : '-') . spl_object_hash($this->package); } public function __toString() { return ($this->wanted ? '+' : '-') . $this->getPackage(); } public function inverted() { return new Literal($this->getPackage(), !$this->isWanted()); } public function equals(Literal $b) { return $this->getId() === $b->getId(); } }