SolverOperation.php 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. * Abstract solver operation class.
  15. *
  16. * @author Konstantin Kudryashov <ever.zet@gmail.com>
  17. */
  18. abstract class SolverOperation implements OperationInterface
  19. {
  20. protected $reason;
  21. /**
  22. * Initializes operation.
  23. *
  24. * @param string $reason operation reason
  25. */
  26. public function __construct($reason = null)
  27. {
  28. $this->reason = $reason;
  29. }
  30. /**
  31. * Returns operation reason.
  32. *
  33. * @return string
  34. */
  35. public function getReason()
  36. {
  37. return $this->reason;
  38. }
  39. protected function formatVersion(PackageInterface $package)
  40. {
  41. return $package->getFullPrettyVersion();
  42. }
  43. }