SourcePool.php 933 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Deploy\Source;
  7. /**
  8. * Configurable (via di.xml) pool of available sources of static files eligible for deployment
  9. */
  10. class SourcePool
  11. {
  12. /**
  13. * Source objects
  14. *
  15. * @var SourceInterface[]
  16. */
  17. private $sources;
  18. /**
  19. * SourcePool constructor.
  20. * @param array $sources
  21. */
  22. public function __construct(array $sources)
  23. {
  24. $this->sources = $sources;
  25. }
  26. /**
  27. * Retrieve static files sources
  28. *
  29. * @return SourceInterface[]
  30. */
  31. public function getAll()
  32. {
  33. return $this->sources;
  34. }
  35. /**
  36. * Retrieve source
  37. *
  38. * @param string $name
  39. * @return SourceInterface|null
  40. */
  41. public function getSource($name)
  42. {
  43. return isset($this->sources[$name]) ? $this->sources[$name] : null;
  44. }
  45. }