Reader.php 956 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Framework\GraphQlSchemaStitching\Common;
  8. use Magento\Framework\Config\ReaderInterface;
  9. /**
  10. * Composite configuration reader for GraphQL schema information.
  11. */
  12. class Reader implements ReaderInterface
  13. {
  14. /**
  15. * @var ReaderInterface[]
  16. */
  17. private $readers;
  18. /**
  19. * @param ReaderInterface[] $readers
  20. */
  21. public function __construct(
  22. array $readers = []
  23. ) {
  24. $this->readers = $readers;
  25. }
  26. /**
  27. * Read configuration scope for GraphQL.
  28. *
  29. * @param string|null $scope
  30. * @return array
  31. */
  32. public function read($scope = null) : array
  33. {
  34. $output = [];
  35. foreach ($this->readers as $reader) {
  36. $output = array_replace_recursive($output, $reader->read($scope));
  37. }
  38. return $output;
  39. }
  40. }