ElementHistory.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Setup\Declaration\Schema;
  7. use Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface;
  8. /**
  9. * Element history container.
  10. *
  11. * This class holds history about element modifications.
  12. */
  13. class ElementHistory
  14. {
  15. /**
  16. * @var ElementInterface
  17. */
  18. private $new;
  19. /**
  20. * @var ElementInterface
  21. */
  22. private $old;
  23. /**
  24. * Constructor.
  25. *
  26. * @param ElementInterface $new
  27. * @param ElementInterface $old
  28. */
  29. public function __construct(ElementInterface $new, ElementInterface $old = null)
  30. {
  31. $this->new = $new;
  32. $this->old = $old;
  33. }
  34. /**
  35. * Retrieve element, that exists before we run installation.
  36. *
  37. * @return ElementInterface|null
  38. */
  39. public function getOld()
  40. {
  41. return $this->old;
  42. }
  43. /**
  44. * Retrieve element, that comes from configuration.
  45. *
  46. * @return ElementInterface
  47. */
  48. public function getNew()
  49. {
  50. return $this->new;
  51. }
  52. }