RouteParamsPreprocessorComposite.php 935 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Url;
  7. /**
  8. * Route parameters composite preprocessor.
  9. */
  10. class RouteParamsPreprocessorComposite implements RouteParamsPreprocessorInterface
  11. {
  12. /**
  13. * @var RouteParamsPreprocessorInterface[]
  14. */
  15. private $routeParamsPreprocessors;
  16. /**
  17. * @param RouteParamsPreprocessorInterface[] $routeParamsPreprocessors
  18. */
  19. public function __construct(array $routeParamsPreprocessors = [])
  20. {
  21. $this->routeParamsPreprocessors = $routeParamsPreprocessors;
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function execute($areaCode, $routePath, $routeParams)
  27. {
  28. foreach ($this->routeParamsPreprocessors as $preprocessor) {
  29. $routeParams = $preprocessor->execute($areaCode, $routePath, $routeParams);
  30. }
  31. return $routeParams;
  32. }
  33. }