GenericElement.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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\Dto;
  7. /**
  8. * Generic element DTO.
  9. *
  10. * Data transfer object, that provides access to basic attributes of various structural elements.
  11. *
  12. * Under structural element means one of next element, with can be represented in db schema :
  13. * - column
  14. * - constraint
  15. * - index
  16. */
  17. abstract class GenericElement implements
  18. ElementInterface
  19. {
  20. /**
  21. * High level type.
  22. *
  23. * @var string
  24. */
  25. private $type;
  26. /**
  27. * Element name.
  28. *
  29. * @var string
  30. */
  31. private $name;
  32. /**
  33. * Constructor.
  34. *
  35. * @param string $name
  36. * @param string $type
  37. */
  38. public function __construct(string $name, string $type)
  39. {
  40. $this->type = $type;
  41. $this->name = $name;
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function getName()
  47. {
  48. return $this->name;
  49. }
  50. /**
  51. * {@inheritdoc}
  52. */
  53. public function getType()
  54. {
  55. return $this->type;
  56. }
  57. }