UninstallOperation.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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\PackageInterface;
  13. /**
  14. * Solver uninstall operation.
  15. *
  16. * @author Konstantin Kudryashov <ever.zet@gmail.com>
  17. */
  18. class UninstallOperation extends SolverOperation
  19. {
  20. protected $package;
  21. /**
  22. * Initializes operation.
  23. *
  24. * @param PackageInterface $package package instance
  25. * @param string $reason operation reason
  26. */
  27. public function __construct(PackageInterface $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 installer type to be used with this operation.
  43. *
  44. * @return string
  45. */
  46. public function getInstallerType()
  47. {
  48. return $this->package->getType();
  49. }
  50. /**
  51. * Returns job type.
  52. *
  53. * @return string
  54. */
  55. public function getJobType()
  56. {
  57. return 'uninstall';
  58. }
  59. }