UpdateOperation.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 update operation.
  15. *
  16. * @author Konstantin Kudryashov <ever.zet@gmail.com>
  17. */
  18. class UpdateOperation extends SolverOperation
  19. {
  20. protected $targetPackage;
  21. /**
  22. * Initializes update operation.
  23. *
  24. * @param PackageInterface $initial initial package
  25. * @param PackageInterface $target target package (updated)
  26. * @param string $reason update reason
  27. */
  28. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  29. {
  30. parent::__construct($initial, $reason);
  31. $this->targetPackage = $target;
  32. }
  33. /**
  34. * Returns job type.
  35. *
  36. * @return string
  37. */
  38. public function getJobType()
  39. {
  40. return 'update';
  41. }
  42. /**
  43. * Returns target package.
  44. *
  45. * @return PackageInterface
  46. */
  47. public function getTargetPackage()
  48. {
  49. return $this->targetPackage;
  50. }
  51. }