JsLayoutDataProviderPool.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\CustomerData;
  7. /**
  8. * Js layout data provider pool
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class JsLayoutDataProviderPool implements JsLayoutDataProviderPoolInterface
  14. {
  15. /**
  16. * Js layout data providers
  17. *
  18. * @var JsLayoutDataProviderInterface[]
  19. */
  20. protected $jsLayoutDataProviders;
  21. /**
  22. * Construct
  23. *
  24. * @param JsLayoutDataProviderInterface[] $jsLayoutDataProviders
  25. */
  26. public function __construct(
  27. array $jsLayoutDataProviders = []
  28. ) {
  29. $this->jsLayoutDataProviders = $jsLayoutDataProviders;
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function getData()
  35. {
  36. $data = [];
  37. if ($this->jsLayoutDataProviders) {
  38. foreach ($this->jsLayoutDataProviders as $dataProvider) {
  39. $data = array_merge_recursive($data, $dataProvider->getData());
  40. }
  41. }
  42. return $data;
  43. }
  44. }