ExchangeFactory.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\MysqlMq\Model\Driver;
  7. /**
  8. * Factory class for @see \Magento\MysqlMq\Model\Driver\Exchange
  9. */
  10. class ExchangeFactory implements \Magento\Framework\MessageQueue\ExchangeFactoryInterface
  11. {
  12. /**
  13. * Object Manager instance
  14. *
  15. * @var \Magento\Framework\ObjectManagerInterface
  16. */
  17. private $objectManager = null;
  18. /**
  19. * Instance name to create
  20. *
  21. * @var string
  22. */
  23. private $instanceName = null;
  24. /**
  25. * Initialize dependencies.
  26. *
  27. * @param \Magento\Framework\ObjectManagerInterface $objectManager
  28. * @param string $instanceName
  29. */
  30. public function __construct(
  31. \Magento\Framework\ObjectManagerInterface $objectManager,
  32. $instanceName = \Magento\MysqlMq\Model\Driver\Exchange::class
  33. ) {
  34. $this->objectManager = $objectManager;
  35. $this->instanceName = $instanceName;
  36. }
  37. /**
  38. * {@inheritdoc}
  39. *
  40. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  41. */
  42. public function create($connectionName, array $data = [])
  43. {
  44. return $this->objectManager->create($this->instanceName, $data);
  45. }
  46. }