ExchangeConfigItem.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\MessageQueue\Topology\Config;
  7. use Magento\Framework\MessageQueue\Topology\Config\ExchangeConfigItem\BindingInterface;
  8. use Magento\Framework\MessageQueue\Topology\Config\ExchangeConfigItem\Binding\IteratorFactory;
  9. /**
  10. * {@inheritdoc}
  11. */
  12. class ExchangeConfigItem implements ExchangeConfigItemInterface
  13. {
  14. /**
  15. * Exchange name.
  16. *
  17. * @var string
  18. */
  19. private $name;
  20. /**
  21. * Exchange type.
  22. *
  23. * @var string
  24. */
  25. private $type;
  26. /**
  27. * Connection name.
  28. *
  29. * @var string
  30. */
  31. private $connection;
  32. /**
  33. * Exchange bindings.
  34. *
  35. * @var BindingInterface[]
  36. */
  37. private $bindings;
  38. /**
  39. * Exchange arguments.
  40. *
  41. * @var array
  42. */
  43. private $arguments;
  44. /**
  45. * Flag. Is exchange durable.
  46. *
  47. * @var bool
  48. */
  49. private $isDurable;
  50. /**
  51. * Flag. Is auto-delete
  52. *
  53. * @var bool
  54. */
  55. private $isAutoDelete;
  56. /**
  57. * Flag. Is exchange internal.
  58. *
  59. * @var bool
  60. */
  61. private $isInternal;
  62. /**
  63. * Initialize dependencies.
  64. *
  65. * @param IteratorFactory $iteratorFactory
  66. */
  67. public function __construct(IteratorFactory $iteratorFactory)
  68. {
  69. $this->bindings = $iteratorFactory->create();
  70. }
  71. /**
  72. * {@inheritdoc}
  73. */
  74. public function getName()
  75. {
  76. return $this->name;
  77. }
  78. /**
  79. * {@inheritdoc}
  80. */
  81. public function getType()
  82. {
  83. return $this->type;
  84. }
  85. /**
  86. * {@inheritdoc}
  87. */
  88. public function getConnection()
  89. {
  90. return $this->connection;
  91. }
  92. /**
  93. * {@inheritdoc}
  94. */
  95. public function isDurable()
  96. {
  97. return $this->isDurable;
  98. }
  99. /**
  100. * {@inheritdoc}
  101. */
  102. public function isAutoDelete()
  103. {
  104. return $this->isAutoDelete;
  105. }
  106. /**
  107. * {@inheritdoc}
  108. */
  109. public function isInternal()
  110. {
  111. return $this->isInternal;
  112. }
  113. /**
  114. * {@inheritdoc}
  115. */
  116. public function getBindings()
  117. {
  118. return $this->bindings;
  119. }
  120. /**
  121. * {@inheritdoc}
  122. */
  123. public function getArguments()
  124. {
  125. return $this->arguments;
  126. }
  127. /**
  128. * Set exchange config item data.
  129. *
  130. * @param array $data
  131. * @return void
  132. */
  133. public function setData(array $data)
  134. {
  135. $this->name = $data['name'];
  136. $this->type = $data['type'];
  137. $this->connection = $data['connection'];
  138. $this->isInternal = $data['internal'];
  139. $this->isDurable = $data['durable'];
  140. $this->isAutoDelete = $data['autoDelete'];
  141. $this->arguments = $data['arguments'];
  142. $this->bindings->setData($data['bindings']);
  143. }
  144. }