Reader.php 983 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\MessageQueue\Consumer\Config\Env;
  7. /**
  8. * Communication configuration reader. Reads data from env.php.
  9. */
  10. class Reader implements \Magento\Framework\Config\ReaderInterface
  11. {
  12. /**
  13. * @var \Magento\Framework\MessageQueue\Config\Reader\Env
  14. */
  15. private $envConfig;
  16. /**
  17. * @param \Magento\Framework\MessageQueue\Config\Reader\Env $envConfig
  18. */
  19. public function __construct(\Magento\Framework\MessageQueue\Config\Reader\Env $envConfig)
  20. {
  21. $this->envConfig = $envConfig;
  22. }
  23. /**
  24. * Read consumers configuration from env.php
  25. *
  26. * @param string|null $scope
  27. * @return array
  28. */
  29. public function read($scope = null)
  30. {
  31. $configData = $this->envConfig->read($scope);
  32. return $configData[\Magento\Framework\MessageQueue\Config\Reader\Env::ENV_CONSUMERS] ?? [];
  33. }
  34. }