MarkAliasUninstalledOperation.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. use Composer\Package\PackageInterface;
  14. /**
  15. * Solver install operation.
  16. *
  17. * @author Nils Adermann <naderman@naderman.de>
  18. */
  19. class MarkAliasUninstalledOperation extends SolverOperation
  20. {
  21. protected $package;
  22. /**
  23. * Initializes operation.
  24. *
  25. * @param AliasPackage $package package instance
  26. * @param string $reason operation reason
  27. */
  28. public function __construct(AliasPackage $package, $reason = null)
  29. {
  30. parent::__construct($reason);
  31. $this->package = $package;
  32. }
  33. /**
  34. * Returns package instance.
  35. *
  36. * @return PackageInterface
  37. */
  38. public function getPackage()
  39. {
  40. return $this->package;
  41. }
  42. /**
  43. * Returns job type.
  44. *
  45. * @return string
  46. */
  47. public function getJobType()
  48. {
  49. return 'markAliasUninstalled';
  50. }
  51. /**
  52. * {@inheritDoc}
  53. */
  54. public function show($lock)
  55. {
  56. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  57. }
  58. /**
  59. * {@inheritDoc}
  60. */
  61. public function __toString()
  62. {
  63. return $this->show(false);
  64. }
  65. }