MarkAliasInstalledOperation.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 MarkAliasInstalledOperation 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 'markAliasInstalled';
  50. }
  51. /**
  52. * {@inheritDoc}
  53. */
  54. public function __toString()
  55. {
  56. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  57. }
  58. }