Comparator.php 878 B

123456789101112131415161718192021222324252627282930
  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\ElementDiffAwareInterface;
  8. use Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface;
  9. /**
  10. * Comparator allows to compare only sensitive params of 2 nodes
  11. * that can come from different places.
  12. */
  13. class Comparator
  14. {
  15. /**
  16. * Compare elements.
  17. *
  18. * @param ElementInterface | ElementDiffAwareInterface $first
  19. * @param ElementInterface | ElementDiffAwareInterface $second
  20. * @return bool
  21. */
  22. public function compare(ElementInterface $first, ElementInterface $second)
  23. {
  24. return get_class($first) === get_class($second) &&
  25. $first->getDiffSensitiveParams() === $second->getDiffSensitiveParams();
  26. }
  27. }