GetDistanceProviderCode.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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\InventoryDistanceBasedSourceSelection\Model;
  8. use Magento\Framework\App\Config\ScopeConfigInterface;
  9. use Magento\InventoryDistanceBasedSourceSelectionApi\Api\GetDistanceProviderCodeInterface;
  10. /**
  11. * @inheritdoc
  12. */
  13. class GetDistanceProviderCode implements GetDistanceProviderCodeInterface
  14. {
  15. // XML path for default distance provider configuration value
  16. private const XML_PATH_DEFAULT_DISTANCE_PROVIDER = 'cataloginventory/source_selection_distance_based/provider';
  17. /**
  18. * @var ScopeConfigInterface
  19. */
  20. private $scopeConfig;
  21. /**
  22. * GetDistanceProviderCode constructor.
  23. *
  24. * @param ScopeConfigInterface $scopeConfig
  25. */
  26. public function __construct(
  27. ScopeConfigInterface $scopeConfig
  28. ) {
  29. $this->scopeConfig = $scopeConfig;
  30. }
  31. /**
  32. * @inheritdoc
  33. */
  34. public function execute(): string
  35. {
  36. return $this->scopeConfig->getValue(self::XML_PATH_DEFAULT_DISTANCE_PROVIDER);
  37. }
  38. }