MarkAliasUninstalledOperation.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\DependencyResolver\Operation;
  12. use Composer\Package\AliasPackage;
  13. /**
  14. * Solver install operation.
  15. *
  16. * @author Nils Adermann <naderman@naderman.de>
  17. */
  18. class MarkAliasUninstalledOperation extends SolverOperation
  19. {
  20. protected $package;
  21. /**
  22. * Initializes operation.
  23. *
  24. * @param AliasPackage $package package instance
  25. * @param string $reason operation reason
  26. */
  27. public function __construct(AliasPackage $package, $reason = null)
  28. {
  29. parent::__construct($reason);
  30. $this->package = $package;
  31. }
  32. /**
  33. * Returns package instance.
  34. *
  35. * @return PackageInterface
  36. */
  37. public function getPackage()
  38. {
  39. return $this->package;
  40. }
  41. /**
  42. * Returns job type.
  43. *
  44. * @return string
  45. */
  46. public function getJobType()
  47. {
  48. return 'markAliasUninstalled';
  49. }
  50. /**
  51. * {@inheritDoc}
  52. */
  53. public function __toString()
  54. {
  55. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  56. }
  57. }